mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-27 03:29:16 +02:00
Added some more data display options
This commit is contained in:
19
src/gui.cpp
19
src/gui.cpp
@ -281,10 +281,14 @@ void GUI::createActions()
|
||||
_showWaypointsAction->setCheckable(true);
|
||||
connect(_showWaypointsAction, SIGNAL(triggered(bool)), _track,
|
||||
SLOT(showWaypoints(bool)));
|
||||
_showWaypointLabelsAction = new QAction(tr("Show waypoint labels"), this);
|
||||
_showWaypointLabelsAction = new QAction(tr("Waypoint labels"), this);
|
||||
_showWaypointLabelsAction->setCheckable(true);
|
||||
connect(_showWaypointLabelsAction, SIGNAL(triggered(bool)), _track,
|
||||
SLOT(showWaypointLabels(bool)));
|
||||
_showRouteWaypointsAction = new QAction(tr("Route Waypoints"), this);
|
||||
_showRouteWaypointsAction->setCheckable(true);
|
||||
connect(_showRouteWaypointsAction, SIGNAL(triggered(bool)), _track,
|
||||
SLOT(showRouteWaypoints(bool)));
|
||||
|
||||
// Settings actions
|
||||
_showGraphsAction = new QAction(tr("Show graphs"), this);
|
||||
@ -370,12 +374,13 @@ void GUI::createMenus()
|
||||
poiMenu->addAction(_showPOIAction);
|
||||
|
||||
QMenu *dataMenu = menuBar()->addMenu(tr("Data"));
|
||||
QMenu *displayMenu = dataMenu->addMenu(tr("Display"));
|
||||
displayMenu->addAction(_showWaypointLabelsAction);
|
||||
displayMenu->addAction(_showRouteWaypointsAction);
|
||||
dataMenu->addSeparator();
|
||||
dataMenu->addAction(_showTracksAction);
|
||||
dataMenu->addAction(_showRoutesAction);
|
||||
dataMenu->addAction(_showWaypointsAction);
|
||||
dataMenu->addSeparator();
|
||||
QMenu *displayMenu = dataMenu->addMenu(tr("Rendering"));
|
||||
displayMenu->addAction(_showWaypointLabelsAction);
|
||||
|
||||
QMenu *settingsMenu = menuBar()->addMenu(tr("Settings"));
|
||||
QMenu *unitsMenu = settingsMenu->addMenu(tr("Units"));
|
||||
@ -1146,6 +1151,8 @@ void GUI::writeSettings()
|
||||
_showWaypointsAction->isChecked());
|
||||
settings.setValue(SHOW_WAYPOINT_LABELS_SETTING,
|
||||
_showWaypointLabelsAction->isChecked());
|
||||
settings.setValue(SHOW_ROUTE_WAYPOINTS_SETTING,
|
||||
_showRouteWaypointsAction->isChecked());
|
||||
|
||||
settings.endGroup();
|
||||
}
|
||||
@ -1233,6 +1240,10 @@ void GUI::readSettings()
|
||||
_track->showWaypointLabels(false);
|
||||
else
|
||||
_showWaypointLabelsAction->setChecked(true);
|
||||
if (settings.value(SHOW_ROUTE_WAYPOINTS_SETTING, true).toBool() == false)
|
||||
_track->showRouteWaypoints(false);
|
||||
else
|
||||
_showRouteWaypointsAction->setChecked(true);
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
|
@ -140,6 +140,7 @@ private:
|
||||
QAction *_showRoutesAction;
|
||||
QAction *_showWaypointsAction;
|
||||
QAction *_showWaypointLabelsAction;
|
||||
QAction *_showRouteWaypointsAction;
|
||||
QList<QAction*> _mapActions;
|
||||
QList<QAction*> _poiFilesActions;
|
||||
|
||||
|
@ -54,7 +54,6 @@ void RouteItem::setScale(qreal scale)
|
||||
|
||||
_pen.setWidthF(ROUTE_WIDTH * 1.0/scale);
|
||||
QGraphicsItem::setScale(scale);
|
||||
_marker->setScale(1.0/scale);
|
||||
|
||||
QList<QGraphicsItem *> childs = childItems();
|
||||
for (int i = 0; i < childs.count(); i++)
|
||||
@ -72,3 +71,11 @@ void RouteItem::moveMarker(qreal t)
|
||||
Q_ASSERT(t >= 0 && t <= 1.0);
|
||||
_marker->setPos(_path.pointAtPercent(t));
|
||||
}
|
||||
|
||||
void RouteItem::showWaypoints(bool show)
|
||||
{
|
||||
QList<QGraphicsItem *> childs = childItems();
|
||||
for (int i = 0; i < childs.count(); i++)
|
||||
if (childs.at(i) != _marker)
|
||||
childs.at(i)->setVisible(show);
|
||||
}
|
||||
|
@ -22,6 +22,8 @@ public:
|
||||
void showMarker(bool show) {_marker->setVisible(show);}
|
||||
void moveMarker(qreal t);
|
||||
|
||||
void showWaypoints(bool show);
|
||||
|
||||
private:
|
||||
QPainterPath _path;
|
||||
QPen _pen;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#define SHOW_TRACKS_SETTING "tracks"
|
||||
#define SHOW_ROUTES_SETTING "routes"
|
||||
#define SHOW_WAYPOINTS_SETTING "waypoints"
|
||||
#define SHOW_ROUTE_WAYPOINTS_SETTING "routeWaypoints"
|
||||
#define SHOW_WAYPOINT_LABELS_SETTING "waypointLabels"
|
||||
|
||||
#endif // SETTINGS_H
|
||||
|
@ -45,6 +45,7 @@ TrackView::TrackView(QWidget *parent)
|
||||
_showWaypointLabels = true;
|
||||
_showPOILabels = true;
|
||||
_overlapPOIs = true;
|
||||
_showRouteWaypoints = true;
|
||||
|
||||
_plot = false;
|
||||
}
|
||||
@ -89,6 +90,7 @@ void TrackView::addRoute(const Route &route)
|
||||
ri->setScale(1.0/_scale);
|
||||
ri->setColor(_palette.color());
|
||||
ri->setVisible(_showRoutes);
|
||||
ri->showWaypoints(_showRouteWaypoints);
|
||||
_scene->addItem(ri);
|
||||
|
||||
_maxPath = qMax(ri->path().length(), _maxPath);
|
||||
@ -540,6 +542,14 @@ void TrackView::showWaypointLabels(bool show)
|
||||
_waypoints.at(i)->showLabel(show);
|
||||
}
|
||||
|
||||
void TrackView::showRouteWaypoints(bool show)
|
||||
{
|
||||
_showRouteWaypoints = show;
|
||||
|
||||
for (int i = 0; i < _routes.size(); i++)
|
||||
_routes.at(i)->showWaypoints(show);
|
||||
}
|
||||
|
||||
void TrackView::showPOILabels(bool show)
|
||||
{
|
||||
_showPOILabels = show;
|
||||
|
@ -52,6 +52,7 @@ public slots:
|
||||
void showTracks(bool show);
|
||||
void showRoutes(bool show);
|
||||
void showWaypoints(bool show);
|
||||
void showRouteWaypoints(bool show);
|
||||
|
||||
private:
|
||||
void addTrack(const Track &track);
|
||||
@ -100,6 +101,7 @@ private:
|
||||
bool _showWaypointLabels;
|
||||
bool _showPOILabels;
|
||||
bool _overlapPOIs;
|
||||
bool _showRouteWaypoints;
|
||||
|
||||
bool _plot;
|
||||
};
|
||||
|
Reference in New Issue
Block a user