diff --git a/README.md b/README.md index d1bd02d1..b65043f9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ GPX viewer and analyzer. * User-definable map sources. * Track and elevation/speed graphs. * Support for multiple tracks in one view. -* Support for POI files (Garmin CSV format). +* Support for POI files. * Export to PDF. * Native GUI for Windows, Mac OS X and Linux. diff --git a/gpxsee.pro b/gpxsee.pro index b29cc8ea..cf3a2bcf 100644 --- a/gpxsee.pro +++ b/gpxsee.pro @@ -13,7 +13,6 @@ HEADERS += src/config.h \ src/rtree.h \ src/ll.h \ src/axisitem.h \ - src/poiitem.h \ src/colorshop.h \ src/keys.h \ src/slideritem.h \ @@ -33,7 +32,8 @@ HEADERS += src/config.h \ src/trackview.h \ src/track.h \ src/graphview.h \ - src/trackpoint.h + src/trackpoint.h \ + src/waypointitem.h SOURCES += src/main.cpp \ src/gui.cpp \ src/gpx.cpp \ @@ -41,7 +41,6 @@ SOURCES += src/main.cpp \ src/poi.cpp \ src/ll.cpp \ src/axisitem.cpp \ - src/poiitem.cpp \ src/colorshop.cpp \ src/slideritem.cpp \ src/markeritem.cpp \ @@ -57,7 +56,8 @@ SOURCES += src/main.cpp \ src/nicenum.cpp \ src/trackview.cpp \ src/track.cpp \ - src/graphview.cpp + src/graphview.cpp \ + src/waypointitem.cpp RESOURCES += gpxsee.qrc TRANSLATIONS = lang/gpxsee_cs.ts macx:ICON = icons/gpxsee.icns diff --git a/src/poi.cpp b/src/poi.cpp index d9e554a6..3763fc44 100644 --- a/src/poi.cpp +++ b/src/poi.cpp @@ -6,8 +6,6 @@ #include "poi.h" -#define BOUNDING_RECT_SIZE 0.01 - bool POI::loadFile(const QString &fileName) { QString error; @@ -122,17 +120,17 @@ static bool cb(size_t data, void* context) return true; } -QVector POI::points(const QVector &path) const +QVector POI::points(const QVector &path, qreal radius) const { QVector ret; QSet set; qreal min[2], max[2]; for (int i = 0; i < path.count(); i++) { - min[0] = path.at(i).x() - BOUNDING_RECT_SIZE; - min[1] = path.at(i).y() - BOUNDING_RECT_SIZE; - max[0] = path.at(i).x() + BOUNDING_RECT_SIZE; - max[1] = path.at(i).y() + BOUNDING_RECT_SIZE; + min[0] = path.at(i).x() - radius; + min[1] = path.at(i).y() - radius; + max[0] = path.at(i).x() + radius; + max[1] = path.at(i).y() + radius; _tree.Search(min, max, cb, &set); } diff --git a/src/poi.h b/src/poi.h index 6cc4cc3a..b91e96db 100644 --- a/src/poi.h +++ b/src/poi.h @@ -15,7 +15,8 @@ public: QString errorString() const {return _error;} int errorLine() const {return _errorLine;} - QVector points(const QVector &path) const; + QVector points(const QVector &path, + qreal radius = 0.01) const; void clear(); @@ -27,6 +28,7 @@ private: POITree _tree; QVector _data; + QString _error; int _errorLine; }; diff --git a/src/trackview.cpp b/src/trackview.cpp index 3578a844..4da63f0a 100644 --- a/src/trackview.cpp +++ b/src/trackview.cpp @@ -6,7 +6,7 @@ #include "poi.h" #include "gpx.h" #include "map.h" -#include "poiitem.h" +#include "waypointitem.h" #include "markeritem.h" #include "scaleitem.h" #include "ll.h" @@ -156,7 +156,7 @@ void TrackView::rescale(qreal scale) _trackPaths.at(i)->setPen(pen); } - QHash::const_iterator it, jt; + QHash::const_iterator it, jt; for (it = _pois.constBegin(); it != _pois.constEnd(); it++) { it.value()->setPos(QPointF(it.value()->entry().coordinates().x() * 1.0/scale, -it.value()->entry().coordinates().y() * 1.0/scale)); @@ -176,7 +176,7 @@ void TrackView::rescale(qreal scale) void TrackView::loadPOI(const POI &poi) { - QHash::const_iterator it,jt; + QHash::const_iterator it,jt; if (!_tracks.size()) return; @@ -188,7 +188,7 @@ void TrackView::loadPOI(const POI &poi) if (_pois.contains(p.at(i))) continue; - POIItem *pi = new POIItem(p.at(i)); + WayPointItem *pi = new WayPointItem(p.at(i)); pi->setPos(p.at(i).coordinates().x() * 1.0/_scale, -p.at(i).coordinates().y() * 1.0/_scale); pi->setZValue(1); @@ -298,7 +298,7 @@ enum QPrinter::Orientation TrackView::orientation() const void TrackView::clearPOI() { - QHash::const_iterator it; + QHash::const_iterator it; for (it = _pois.constBegin(); it != _pois.constEnd(); it++) { _scene->removeItem(it.value()); diff --git a/src/trackview.h b/src/trackview.h index 7b10fc56..afe91d38 100644 --- a/src/trackview.h +++ b/src/trackview.h @@ -13,7 +13,7 @@ class GPX; class POI; class Map; -class POIItem; +class WayPointItem; class MarkerItem; class ScaleItem; @@ -61,7 +61,7 @@ private: QList > _tracks; QList _trackPaths; QList _markers; - QHash _pois; + QHash _pois; Map *_map; ScaleItem *_mapScale; diff --git a/src/poiitem.cpp b/src/waypointitem.cpp similarity index 80% rename from src/poiitem.cpp rename to src/waypointitem.cpp index 89dc87c0..012c4680 100644 --- a/src/poiitem.cpp +++ b/src/waypointitem.cpp @@ -1,18 +1,18 @@ #include #include "config.h" -#include "poiitem.h" +#include "waypointitem.h" #define POINT_SIZE 8 -POIItem::POIItem(const WayPoint &entry, QGraphicsItem *parent) +WayPointItem::WayPointItem(const WayPoint &entry, QGraphicsItem *parent) : QGraphicsItem(parent) { _entry = entry; updateBoundingRect(); } -void POIItem::updateBoundingRect() +void WayPointItem::updateBoundingRect() { QFont font; font.setPixelSize(FONT_SIZE); @@ -24,7 +24,7 @@ void POIItem::updateBoundingRect() ts.height() + fm.descent() + POINT_SIZE); } -void POIItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, +void WayPointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(option); diff --git a/src/poiitem.h b/src/waypointitem.h similarity index 65% rename from src/poiitem.h rename to src/waypointitem.h index f9685466..a6f2ac24 100644 --- a/src/poiitem.h +++ b/src/waypointitem.h @@ -1,13 +1,13 @@ -#ifndef POIITEM_H -#define POIITEM_H +#ifndef WAYPOINTITEM_H +#define WAYPOINTITEM_H #include #include "waypoint.h" -class POIItem : public QGraphicsItem +class WayPointItem : public QGraphicsItem { public: - POIItem(const WayPoint &entry, QGraphicsItem *parent = 0); + WayPointItem(const WayPoint &entry, QGraphicsItem *parent = 0); const WayPoint &entry() const {return _entry;} QRectF boundingRect() const {return _boundingRect;} @@ -21,4 +21,4 @@ private: QRectF _boundingRect; }; -#endif // POIITEM_H +#endif // WAYPOINTITEM_H