mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-06-01 07:43:03 +02:00
Enable the legend also for areas
This commit is contained in:
parent
92b9f4958f
commit
d3daa17bf7
@ -28,6 +28,9 @@ public:
|
||||
|
||||
ToolTip info(bool extended) const;
|
||||
|
||||
const QColor color() const {return _pen.color();}
|
||||
const QString &name() const {return _area.name();}
|
||||
|
||||
protected:
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||
|
@ -29,6 +29,9 @@ public:
|
||||
|
||||
ToolTip info(bool extended) const;
|
||||
|
||||
const QColor color() const {return _pen.color();}
|
||||
const QString &name() const {return _name;}
|
||||
|
||||
signals:
|
||||
void triggered();
|
||||
|
||||
|
@ -159,6 +159,10 @@ void MapView::updateLegend()
|
||||
for (int i = 0; i < _routes.size(); i++)
|
||||
addLegendEntry(_routes.at(i));
|
||||
}
|
||||
if (_showAreas) {
|
||||
for (int i = 0; i < _areas.size(); i++)
|
||||
addLegendEntry(_areas.at(i));
|
||||
}
|
||||
}
|
||||
|
||||
void MapView::addLegendEntry(const PathItem *ti)
|
||||
@ -167,6 +171,12 @@ void MapView::addLegendEntry(const PathItem *ti)
|
||||
? QFileInfo(ti->file()).fileName() : ti->name());
|
||||
}
|
||||
|
||||
void MapView::addLegendEntry(const PlaneItem *plane)
|
||||
{
|
||||
if (!plane->name().isEmpty())
|
||||
_legend->addItem(plane->color(), plane->name());
|
||||
}
|
||||
|
||||
PathItem *MapView::addTrack(const Track &track)
|
||||
{
|
||||
if (!track.isValid()) {
|
||||
@ -254,8 +264,10 @@ void MapView::addArea(const Area &area)
|
||||
_ar |= ai->bounds();
|
||||
_areas.append(ai);
|
||||
|
||||
if (_showAreas)
|
||||
if (_showAreas) {
|
||||
addPOI(_poi->points(ai->bounds()));
|
||||
addLegendEntry(ai);
|
||||
}
|
||||
}
|
||||
|
||||
void MapView::addWaypoints(const QVector<Waypoint> &waypoints)
|
||||
@ -295,8 +307,10 @@ MapItem *MapView::addMap(MapAction *map)
|
||||
_ar |= mi->bounds();
|
||||
_areas.append(mi);
|
||||
|
||||
if (_showAreas)
|
||||
if (_showAreas) {
|
||||
addPOI(_poi->points(mi->bounds()));
|
||||
addLegendEntry(mi);
|
||||
}
|
||||
|
||||
return mi;
|
||||
}
|
||||
@ -1330,6 +1344,8 @@ void MapView::useStyles(bool use)
|
||||
_areas.at(i)->updateStyle();
|
||||
for (int i = 0; i < _waypoints.size(); i++)
|
||||
_waypoints.at(i)->updateStyle();
|
||||
|
||||
updateLegend();
|
||||
}
|
||||
|
||||
void MapView::setMarkerColor(const QColor &color)
|
||||
|
@ -169,6 +169,7 @@ private:
|
||||
void skipColor() {_palette.nextColor();}
|
||||
void setHidpi(bool hidpi);
|
||||
void addLegendEntry(const PathItem *path);
|
||||
void addLegendEntry(const PlaneItem *plane);
|
||||
void updateLegend();
|
||||
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
|
@ -20,6 +20,9 @@ public:
|
||||
virtual void setPenStyle(Qt::PenStyle style) = 0;
|
||||
virtual void setDigitalZoom(int zoom) = 0;
|
||||
virtual void updateStyle() {}
|
||||
|
||||
virtual const QColor color() const = 0;
|
||||
virtual const QString &name() const = 0;
|
||||
};
|
||||
|
||||
#endif // PLANEITEM_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user