1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-01-19 12:12:08 +01:00
GPXSee/src/data/poi.h

67 lines
1.3 KiB
C
Raw Normal View History

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>
#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"
2015-10-05 01:43:48 +02:00
2019-01-31 01:46:53 +01:00
class Path;
class Area;
class RectC;
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);
bool loadFile(const QString &path);
bool loadDir(const QString &path);
2016-10-23 11:09:20 +02:00
const QString &errorString() const {return _errorString;}
int errorLine() const {return _errorLine;}
2016-12-06 01:48:26 +01:00
unsigned radius() const {return _radius;}
void setRadius(unsigned radius);
void useDEM(bool use);
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;
2019-01-31 01:46:53 +01:00
QList<Waypoint> points(const Area &area) const;
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:
typedef RTree<size_t, qreal, 2> POITree;
2017-08-10 08:58:21 +02:00
struct FileIndex {
int start;
int end;
bool enabled;
2017-08-10 08:58:21 +02:00
};
2015-10-05 01:43:48 +02: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;
void appendElevation(QList<Waypoint> &points) const;
2015-10-05 01:43:48 +02:00
POITree _tree;
2016-02-19 21:42:54 +01:00
QVector<Waypoint> _data;
QStringList _files;
QList<FileIndex> _indexes;
2016-02-19 21:34:55 +01:00
2016-12-06 01:48:26 +01:00
unsigned _radius;
bool _useDEM;
2016-10-09 23:46:30 +02:00
2016-10-23 11:09:20 +02:00
QString _errorString;
int _errorLine;
2015-10-05 01:43:48 +02:00
};
#endif // POI_H