2015-10-05 01:43:48 +02:00
|
|
|
#ifndef POI_H
|
|
|
|
#define POI_H
|
|
|
|
|
2017-11-26 18:54:03 +01:00
|
|
|
#include <QList>
|
2015-10-05 01:43:48 +02:00
|
|
|
#include <QPointF>
|
|
|
|
#include <QString>
|
2016-03-05 18:01:13 +01:00
|
|
|
#include <QStringList>
|
2018-05-22 22:40:15 +02:00
|
|
|
#include "common/rtree.h"
|
2017-11-26 18:54:03 +01:00
|
|
|
#include "waypoint.h"
|
2017-03-18 01:30:31 +01:00
|
|
|
#include "path.h"
|
2015-10-05 01:43:48 +02:00
|
|
|
|
2016-07-28 00:23:22 +02:00
|
|
|
|
2016-10-09 23:46:30 +02:00
|
|
|
class POI : public QObject
|
2015-10-05 01:43:48 +02:00
|
|
|
{
|
2016-10-09 23:46:30 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2015-10-05 01:43:48 +02:00
|
|
|
public:
|
2016-10-09 23:46:30 +02:00
|
|
|
POI(QObject *parent = 0);
|
|
|
|
|
2018-01-30 00:30:26 +01:00
|
|
|
bool loadFile(const QString &path);
|
|
|
|
bool loadDir(const QString &path);
|
2016-10-23 11:09:20 +02:00
|
|
|
const QString &errorString() const {return _errorString;}
|
2015-11-26 19:13:59 +01:00
|
|
|
int errorLine() const {return _errorLine;}
|
|
|
|
|
2016-12-06 01:48:26 +01:00
|
|
|
unsigned radius() const {return _radius;}
|
|
|
|
void setRadius(unsigned radius);
|
2016-10-09 23:46:30 +02:00
|
|
|
|
2017-11-26 18:54:03 +01:00
|
|
|
QList<Waypoint> points(const Path &path) const;
|
|
|
|
QList<Waypoint> points(const Waypoint &point) const;
|
2016-07-28 00:23:22 +02:00
|
|
|
|
2016-03-05 18:01:13 +01:00
|
|
|
const QStringList &files() const {return _files;}
|
|
|
|
void enableFile(const QString &fileName, bool enable);
|
2015-10-05 01:43:48 +02:00
|
|
|
void clear();
|
|
|
|
|
2016-10-09 23:46:30 +02:00
|
|
|
signals:
|
2016-10-11 00:19:42 +02:00
|
|
|
void pointsChanged();
|
2016-10-09 23:46:30 +02:00
|
|
|
|
2015-10-05 01:43:48 +02:00
|
|
|
private:
|
2015-11-26 19:13:59 +01:00
|
|
|
typedef RTree<size_t, qreal, 2> POITree;
|
2017-08-10 08:58:21 +02:00
|
|
|
struct FileIndex {
|
2016-03-05 18:01:13 +01:00
|
|
|
int start;
|
|
|
|
int end;
|
|
|
|
bool enabled;
|
2017-08-10 08:58:21 +02:00
|
|
|
};
|
2015-10-05 01:43:48 +02:00
|
|
|
|
2018-01-30 00:30:26 +01:00
|
|
|
bool loadFile(const QString &path, bool dir);
|
2018-09-13 01:15:43 +02:00
|
|
|
void search(const RectC &rect, QSet<int> &set) const;
|
2018-01-30 00:30:26 +01:00
|
|
|
|
2015-10-05 01:43:48 +02:00
|
|
|
POITree _tree;
|
2016-02-19 21:42:54 +01:00
|
|
|
QVector<Waypoint> _data;
|
2016-03-05 18:01:13 +01:00
|
|
|
QStringList _files;
|
|
|
|
QList<FileIndex> _indexes;
|
2016-02-19 21:34:55 +01:00
|
|
|
|
2016-12-06 01:48:26 +01:00
|
|
|
unsigned _radius;
|
2016-10-09 23:46:30 +02:00
|
|
|
|
2016-10-23 11:09:20 +02:00
|
|
|
QString _errorString;
|
2015-11-26 19:13:59 +01:00
|
|
|
int _errorLine;
|
2015-10-05 01:43:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // POI_H
|