#ifndef POI_H #define POI_H #include #include #include #include #include "common/rtree.h" #include "common/treenode.h" #include "waypoint.h" class Path; class RectC; class POI : public QObject { Q_OBJECT public: POI(QObject *parent = 0); ~POI(); bool loadFile(const QString &path); TreeNode loadDir(const QString &path); const QString &errorString() const {return _errorString;} int errorLine() const {return _errorLine;} unsigned radius() const {return _radius;} void setRadius(unsigned radius); QList points(const Path &path) const; QList points(const Waypoint &point) const; QList points(const RectC &rect) const; bool isLoaded(const QString &path) const {return _files.contains(path);} bool enableFile(const QString &fileName, bool enable); signals: void pointsChanged(); private: typedef RTree POITree; class File { public: File(int start, int end, const QVector &data); const POITree &tree() const {return _tree;} bool isEnabled() const {return _enabled;} void enable(bool enable) {_enabled = enable;} private: bool _enabled; POITree _tree; }; typedef QHash::const_iterator ConstIterator; typedef QHash::iterator Iterator; void search(const RectC &rect, QSet &set) const; QVector _data; QHash _files; unsigned _radius; QString _errorString; int _errorLine; }; #endif // POI_H