-
Notifications
You must be signed in to change notification settings - Fork 0
/
qctcollection.h
83 lines (73 loc) · 2.22 KB
/
qctcollection.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* > qctcollection.h
* 1.00 arb
*/
#ifndef QCTCOLLECTION_H
#define QCTCOLLECTION_H
#include <qstringlist.h>
#include <qthread.h>
class QCT; //#include "osmap/qct.h"
/*
* This class is private not to be used externally.
* It encapsulates the information in a single map regarding which region
* it covers so we can query it quickly by location.
*/
class QCTCollectionMap
{
public:
QCTCollectionMap(const QString &filename);
~QCTCollectionMap();
bool containsLatLon(double lat, double lon);
QString getFilename() const;
QString getLabel() const;
QString getScale() const;
float getDegreesPerPixel() const;
private:
QString filename;
QString chartname;
QString description;
QString scale;
float degreesPerPixel;
int numpoints;
unsigned int (*intpoints)[2]; // ie. int[][2], coords passed to inpoly()
QCT *qct;
};
/*
* This class is private not to be used externally.
* It collects the map list and bounding boxes in the background.
* The run() method is a separate thread, you must wait() on it
* when you need it to have finished.
*/
class QCTCollectionWorker : public QThread
{
public:
QCTCollectionWorker();
~QCTCollectionWorker();
void setPaths(QStringList);
void setMapList(QPtrList<QCTCollectionMap>*);
void run(); // this will run in the "background" but must sleep to relinquish CPU
void hurryUp();
private:
bool stillBackgroundThread; // true in background, false for faster foreground
QStringList mapPaths; // directories in which to look for maps
QPtrList<QCTCollectionMap> *qctlistptr; // pointer to the QCTCollection list of maps
};
/*
* This class is a collection of maps which can be queried by location
* to find out which maps contain the given location.
*/
class QCTCollection
{
public:
QCTCollection(const QString &qctdir);
~QCTCollection();
void setPath(const QString &);
void setPaths(QStringList);
void collectMaps();
QStringList mapsListAtLatLon(double lat, double lon);
QString getFilenameForMap(const QString &mapname);
private:
QStringList mapPaths; // directories in which to look for maps
QCTCollectionWorker worker; // populates qctlist in the background
QPtrList<QCTCollectionMap> qctlist; // list of maps
};
#endif // !QCTCOLLECTION_H