1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-06-27 03:29:16 +02:00

Added support for Mapsforge maps

This commit is contained in:
2021-04-10 15:27:40 +02:00
parent 8fe0f836ae
commit 44a5e5de81
208 changed files with 5761 additions and 475 deletions

62
src/common/polygon.h Normal file
View File

@ -0,0 +1,62 @@
#ifndef POLYGON_H
#define POLYGON_H
#include <QList>
#include <QVector>
#include "common/rectc.h"
class Polygon
{
public:
Polygon() {}
Polygon(const QVector<Coordinates> &path)
{
_paths.reserve(1);
_paths.append(path);
_boundingRect = boundingRect(path);
}
Polygon(const RectC &rect)
{
QVector<Coordinates> v(4);
v[0] = Coordinates(rect.left(), rect.top());
v[1] = Coordinates(rect.right(), rect.top());
v[2] = Coordinates(rect.right(), rect.bottom());
v[3] = Coordinates(rect.left(), rect.bottom());
_paths.reserve(1);
_paths.append(v);
_boundingRect = RectC(v.at(0), v.at(2));
}
void append(const QVector<Coordinates> &path)
{
_paths.append(path);
_boundingRect |= boundingRect(path);
}
void reserve(int size) {_paths.reserve(size);}
int size() const {return _paths.size();}
bool isEmpty() const {return _paths.isEmpty();}
const QVector<Coordinates> &at(int i) const {return _paths.at(i);}
const QVector<Coordinates> &first() const {return _paths.first();}
const QVector<Coordinates> &last() const {return _paths.last();}
const RectC &boundingRect() const {return _boundingRect;}
private:
static RectC boundingRect(const QVector<Coordinates> &path)
{
RectC rect;
for (int i = 0; i < path.size(); i++)
rect = rect.united(path.at(i));
return rect;
}
QList<QVector<Coordinates> > _paths;
RectC _boundingRect;
};
#endif // POLYGON_H

View File

@ -15,6 +15,7 @@
#define GCS_FILE "gcs.csv"
#define PCS_FILE "pcs.csv"
#define TYP_FILE "style.typ"
#define RENDERTHEME_FILE "style.xml"
QString ProgramPaths::mapDir(bool writable)
@ -102,3 +103,9 @@ QString ProgramPaths::typFile()
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
STYLE_DIR "/" TYP_FILE, QStandardPaths::LocateFile);
}
QString ProgramPaths::renderthemeFile()
{
return QStandardPaths::locate(QStandardPaths::AppDataLocation,
STYLE_DIR "/" RENDERTHEME_FILE, QStandardPaths::LocateFile);
}

View File

@ -16,6 +16,7 @@ namespace ProgramPaths
QString gcsFile();
QString pcsFile();
QString typFile();
QString renderthemeFile();
}
#endif // PROGRAMPATHS_H