diff --git a/src/gpxfilemodel.cpp b/src/gpxfilemodel.cpp index 75100f4e..76d350ae 100644 --- a/src/gpxfilemodel.cpp +++ b/src/gpxfilemodel.cpp @@ -337,7 +337,7 @@ QVariantList GPXFileModel::createOverlayObjects(int id /*=-1*/) if (item->type() == GPXObject::Track) { const GPXObjectTrack* obj = static_cast(item); - for (auto const& segment : obj->m_track.segments) + for (auto const& segment : obj->data().segments) { std::vector points; points.reserve(segment.points.size()); @@ -356,7 +356,7 @@ QVariantList GPXFileModel::createOverlayObjects(int id /*=-1*/) { const GPXObjectWayPoint* obj = static_cast(item); osmscout::OverlayNode* node = new osmscout::OverlayNode(); - node->addPoint(obj->m_waypoint.coord.GetLat(), obj->m_waypoint.coord.GetLon()); + node->addPoint(obj->data().coord.GetLat(), obj->data().coord.GetLon()); node->setTypeName(OVERLAY_NODE_WAYPOINT_TYPE); node->setName(obj->name()); QVariant var; diff --git a/src/gpxfilemodel.h b/src/gpxfilemodel.h index 3de43b8f..ba7a2822 100644 --- a/src/gpxfilemodel.h +++ b/src/gpxfilemodel.h @@ -62,7 +62,6 @@ class GPXObject : public QObject class GPXObjectTrack : public GPXObject { - friend class GPXFileModel; public: GPXObjectTrack(const osmscout::gpx::Track& track, int id) : m_track(track), m_id(id) { } int id() const override { return m_id; } @@ -71,6 +70,8 @@ class GPXObjectTrack : public GPXObject QString description() const override { return QString::fromUtf8(m_track.desc.value_or("").c_str()); } double length() const { return m_track.GetLength().AsMeter(); } QString displayColor() const; + + const osmscout::gpx::Track& data() const { return m_track; }; private: const osmscout::gpx::Track& m_track; int m_id; @@ -78,7 +79,6 @@ class GPXObjectTrack : public GPXObject class GPXObjectWayPoint : public GPXObject { - friend class GPXFileModel; public: GPXObjectWayPoint(const osmscout::gpx::Waypoint& waipoint, int id) : m_waypoint(waipoint), m_id(id) { } int id() const override { return m_id; } @@ -89,6 +89,8 @@ class GPXObjectWayPoint : public GPXObject double lat() const { return m_waypoint.coord.GetLat(); } double lon() const { return m_waypoint.coord.GetLon(); } double elevation() const { return m_waypoint.elevation.value_or(0.0); } + + const osmscout::gpx::Waypoint& data() const { return m_waypoint; }; private: const osmscout::gpx::Waypoint& m_waypoint; int m_id;