mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-04-21 12:49:10 +02:00
Compare commits
No commits in common. "2bd25dd9b0c9620daf86f016c15698ffb518ec6b" and "b64065e076bc8ee712dc6ff1420a4d71bab0a68c" have entirely different histories.
2bd25dd9b0
...
b64065e076
@ -1144,7 +1144,7 @@
|
|||||||
<rule e="any" k="amenity" v="fuel" zoom-min="13">
|
<rule e="any" k="amenity" v="fuel" zoom-min="13">
|
||||||
<symbol id="fuel" src=":/mapsforge/symbols/transport/fuel.svg" />
|
<symbol id="fuel" src=":/mapsforge/symbols/transport/fuel.svg" />
|
||||||
<rule e="any" k="*" v="*" zoom-min="18">
|
<rule e="any" k="*" v="*" zoom-min="18">
|
||||||
<caption fill="#AC39AC" font-size="12" font-style="bold" k="name" stroke="#FFFFFF"
|
<caption fill="#0092DA" font-size="12" font-style="bold" k="name" stroke="#FFFFFF"
|
||||||
stroke-width="2.0" symbol-id="fuel" />
|
stroke-width="2.0" symbol-id="fuel" />
|
||||||
</rule>
|
</rule>
|
||||||
</rule>
|
</rule>
|
||||||
|
@ -866,7 +866,7 @@
|
|||||||
<location filename="../src/GUI/gui.cpp" line="907"/>
|
<location filename="../src/GUI/gui.cpp" line="907"/>
|
||||||
<location filename="../src/GUI/gui.cpp" line="925"/>
|
<location filename="../src/GUI/gui.cpp" line="925"/>
|
||||||
<source>CRS directory:</source>
|
<source>CRS directory:</source>
|
||||||
<translation>CRS 디렉토리:</translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>GCS/PCS directory:</source>
|
<source>GCS/PCS directory:</source>
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#endif // Q_OS_ANDROID
|
#endif // Q_OS_ANDROID
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#define SQLITE_DB_MAGIC "SQLite format 3"
|
|
||||||
|
|
||||||
#ifdef Q_OS_ANDROID
|
#ifdef Q_OS_ANDROID
|
||||||
static QString documentName(const QString &path)
|
static QString documentName(const QString &path)
|
||||||
@ -157,21 +156,3 @@ const QTemporaryDir &Util::tempDir()
|
|||||||
static QTemporaryDir dir;
|
static QTemporaryDir dir;
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Util::isSQLiteDB(const QString &path, QString &errorString)
|
|
||||||
{
|
|
||||||
QFile file(path);
|
|
||||||
char magic[sizeof(SQLITE_DB_MAGIC)];
|
|
||||||
|
|
||||||
if (!file.open(QFile::ReadOnly)) {
|
|
||||||
errorString = file.errorString();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((file.read(magic, sizeof(magic)) < (qint64)sizeof(magic))
|
|
||||||
|| memcmp(SQLITE_DB_MAGIC, magic, sizeof(SQLITE_DB_MAGIC))) {
|
|
||||||
errorString = "Not a SQLite database file";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
@ -16,7 +16,6 @@ namespace Util
|
|||||||
QString file2name(const QString &path);
|
QString file2name(const QString &path);
|
||||||
QString displayName(const QString &path);
|
QString displayName(const QString &path);
|
||||||
const QTemporaryDir &tempDir();
|
const QTemporaryDir &tempDir();
|
||||||
bool isSQLiteDB(const QString &path, QString &errorString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // UTIL_H
|
#endif // UTIL_H
|
||||||
|
@ -200,13 +200,6 @@ QPainterPath RasterTile::painterPath(const Polygon &polygon, bool curve) const
|
|||||||
{
|
{
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
|
||||||
int size = 0;
|
|
||||||
for (int i = 0; i < polygon.size(); i++)
|
|
||||||
size += polygon.at(i).size();
|
|
||||||
path.reserve(size);
|
|
||||||
#endif // QT 5.13
|
|
||||||
|
|
||||||
for (int i = 0; i < polygon.size(); i++) {
|
for (int i = 0; i < polygon.size(); i++) {
|
||||||
const QVector<Coordinates> &subpath = polygon.at(i);
|
const QVector<Coordinates> &subpath = polygon.at(i);
|
||||||
|
|
||||||
|
@ -138,13 +138,12 @@ void Style::area(QXmlStreamReader &reader, const QString &dir, qreal ratio,
|
|||||||
PathRender ri(rule, _paths.size() + _circles.size());
|
PathRender ri(rule, _paths.size() + _circles.size());
|
||||||
const QXmlStreamAttributes &attr = reader.attributes();
|
const QXmlStreamAttributes &attr = reader.attributes();
|
||||||
QString file;
|
QString file;
|
||||||
QColor fillColor;
|
|
||||||
int height = 0, width = 0;
|
int height = 0, width = 0;
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
ri._area = true;
|
ri._area = true;
|
||||||
if (attr.hasAttribute("fill"))
|
if (attr.hasAttribute("fill"))
|
||||||
fillColor = QColor(attr.value("fill").toString());
|
ri._fillColor = QColor(attr.value("fill").toString());
|
||||||
if (attr.hasAttribute("stroke"))
|
if (attr.hasAttribute("stroke"))
|
||||||
ri._strokeColor = QColor(attr.value("stroke").toString());
|
ri._strokeColor = QColor(attr.value("stroke").toString());
|
||||||
if (attr.hasAttribute("stroke-width")) {
|
if (attr.hasAttribute("stroke-width")) {
|
||||||
@ -172,9 +171,7 @@ void Style::area(QXmlStreamReader &reader, const QString &dir, qreal ratio,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!file.isNull())
|
if (!file.isNull())
|
||||||
ri._brush = QBrush(image(file, width, height, ratio));
|
ri._fillImage = image(file, width, height, ratio);
|
||||||
else if (fillColor.isValid())
|
|
||||||
ri._brush = QBrush(fillColor);
|
|
||||||
|
|
||||||
if (ri.rule()._type == Rule::AnyType || ri.rule()._type == Rule::WayType)
|
if (ri.rule()._type == Rule::AnyType || ri.rule()._type == Rule::WayType)
|
||||||
_paths.append(ri);
|
_paths.append(ri);
|
||||||
@ -655,9 +652,10 @@ QList<const Style::Symbol*> Style::areaSymbols(int zoom) const
|
|||||||
|
|
||||||
QPen Style::PathRender::pen(int zoom) const
|
QPen Style::PathRender::pen(int zoom) const
|
||||||
{
|
{
|
||||||
|
qreal width = (zoom >= 12)
|
||||||
|
? pow(1.5, zoom - 12) * _strokeWidth : _strokeWidth;
|
||||||
|
|
||||||
if (_strokeColor.isValid()) {
|
if (_strokeColor.isValid()) {
|
||||||
qreal width = (zoom >= 12)
|
|
||||||
? pow(1.5, zoom - 12) * _strokeWidth : _strokeWidth;
|
|
||||||
QPen p(QBrush(_strokeColor), width, Qt::SolidLine, _strokeCap,
|
QPen p(QBrush(_strokeColor), width, Qt::SolidLine, _strokeCap,
|
||||||
_strokeJoin);
|
_strokeJoin);
|
||||||
if (!_strokeDasharray.isEmpty()) {
|
if (!_strokeDasharray.isEmpty()) {
|
||||||
@ -671,6 +669,16 @@ QPen Style::PathRender::pen(int zoom) const
|
|||||||
return Qt::NoPen;
|
return Qt::NoPen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QBrush Style::PathRender::brush() const
|
||||||
|
{
|
||||||
|
if (!_fillImage.isNull())
|
||||||
|
return QBrush(_fillImage);
|
||||||
|
else if (_fillColor.isValid())
|
||||||
|
return QBrush(_fillColor);
|
||||||
|
else
|
||||||
|
return Qt::NoBrush;
|
||||||
|
}
|
||||||
|
|
||||||
qreal Style::CircleRender::radius(int zoom) const
|
qreal Style::CircleRender::radius(int zoom) const
|
||||||
{
|
{
|
||||||
return (_scale && zoom >= 12) ? pow(1.5, zoom - 12) * _radius : _radius;
|
return (_scale && zoom >= 12) ? pow(1.5, zoom - 12) * _radius : _radius;
|
||||||
|
@ -11,6 +11,17 @@ class QXmlStreamReader;
|
|||||||
|
|
||||||
namespace Mapsforge {
|
namespace Mapsforge {
|
||||||
|
|
||||||
|
inline bool wcmp(const QByteArray &b1, const QByteArray &b2)
|
||||||
|
{
|
||||||
|
int len = b1.length();
|
||||||
|
|
||||||
|
if (!len)
|
||||||
|
return true;
|
||||||
|
if (len != b2.length())
|
||||||
|
return false;
|
||||||
|
return !memcmp(b1.constData(), b2.constData(), len);
|
||||||
|
}
|
||||||
|
|
||||||
class Style
|
class Style
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -76,13 +87,10 @@ public:
|
|||||||
|
|
||||||
bool valueMatches(const QVector<MapData::Tag> &tags) const
|
bool valueMatches(const QVector<MapData::Tag> &tags) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _vals.size(); i++) {
|
for (int i = 0; i < _vals.size(); i++)
|
||||||
for (int j = 0; j < tags.size(); j++) {
|
for (int j = 0; j < tags.size(); j++)
|
||||||
const QByteArray &ba = _vals.at(i);
|
if (wcmp(_vals.at(i), tags.at(j).value))
|
||||||
if (!ba.size() || ba == tags.at(j).value)
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -140,7 +148,7 @@ public:
|
|||||||
|
|
||||||
int zOrder() const {return _zOrder;}
|
int zOrder() const {return _zOrder;}
|
||||||
QPen pen(int zoom) const;
|
QPen pen(int zoom) const;
|
||||||
const QBrush &brush() const {return _brush;}
|
QBrush brush() const;
|
||||||
bool area() const {return _area;}
|
bool area() const {return _area;}
|
||||||
bool curve() const {return _curve;}
|
bool curve() const {return _curve;}
|
||||||
|
|
||||||
@ -148,12 +156,12 @@ public:
|
|||||||
friend class Style;
|
friend class Style;
|
||||||
|
|
||||||
int _zOrder;
|
int _zOrder;
|
||||||
QColor _strokeColor;
|
QColor _fillColor, _strokeColor;
|
||||||
qreal _strokeWidth;
|
qreal _strokeWidth;
|
||||||
QVector<qreal> _strokeDasharray;
|
QVector<qreal> _strokeDasharray;
|
||||||
Qt::PenCapStyle _strokeCap;
|
Qt::PenCapStyle _strokeCap;
|
||||||
Qt::PenJoinStyle _strokeJoin;
|
Qt::PenJoinStyle _strokeJoin;
|
||||||
QBrush _brush;
|
QImage _fillImage;
|
||||||
bool _area, _curve;
|
bool _area, _curve;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QSqlRecord>
|
#include <QSqlRecord>
|
||||||
#include <QSqlField>
|
#include <QSqlField>
|
||||||
#include <QSqlError>
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
@ -49,15 +48,12 @@ MBTilesMap::MBTilesMap(const QString &fileName, QObject *parent)
|
|||||||
: Map(fileName, parent), _mapRatio(1.0), _tileRatio(1.0), _scalable(false),
|
: Map(fileName, parent), _mapRatio(1.0), _tileRatio(1.0), _scalable(false),
|
||||||
_scaledSize(0), _valid(false)
|
_scaledSize(0), _valid(false)
|
||||||
{
|
{
|
||||||
if (!Util::isSQLiteDB(fileName, _errorString))
|
|
||||||
return;
|
|
||||||
|
|
||||||
_db = QSqlDatabase::addDatabase("QSQLITE", fileName);
|
_db = QSqlDatabase::addDatabase("QSQLITE", fileName);
|
||||||
_db.setDatabaseName(fileName);
|
_db.setDatabaseName(fileName);
|
||||||
_db.setConnectOptions("QSQLITE_OPEN_READONLY");
|
_db.setConnectOptions("QSQLITE_OPEN_READONLY");
|
||||||
|
|
||||||
if (!_db.open()) {
|
if (!_db.open()) {
|
||||||
_errorString = _db.lastError().text();
|
_errorString = "Error opening database file";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,12 +413,6 @@ OruxMap::OruxMap(const QString &fileName, QObject *parent)
|
|||||||
|
|
||||||
if (dir.exists("OruxMapsImages.db")) {
|
if (dir.exists("OruxMapsImages.db")) {
|
||||||
QString dbFile(dir.absoluteFilePath("OruxMapsImages.db"));
|
QString dbFile(dir.absoluteFilePath("OruxMapsImages.db"));
|
||||||
|
|
||||||
if (!Util::isSQLiteDB(dbFile, _errorString)) {
|
|
||||||
_errorString = "OruxMapsImages.db: " + _errorString;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_db = QSqlDatabase::addDatabase("QSQLITE", dbFile);
|
_db = QSqlDatabase::addDatabase("QSQLITE", dbFile);
|
||||||
_db.setDatabaseName(dbFile);
|
_db.setDatabaseName(dbFile);
|
||||||
_db.setConnectOptions("QSQLITE_OPEN_READONLY");
|
_db.setConnectOptions("QSQLITE_OPEN_READONLY");
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QSqlRecord>
|
#include <QSqlRecord>
|
||||||
#include <QSqlField>
|
#include <QSqlField>
|
||||||
#include <QSqlError>
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
@ -19,15 +18,12 @@ OsmdroidMap::OsmdroidMap(const QString &fileName, QObject *parent)
|
|||||||
{
|
{
|
||||||
quint64 z, l = 0, r = 0, t = 0, b = 0;
|
quint64 z, l = 0, r = 0, t = 0, b = 0;
|
||||||
|
|
||||||
if (!Util::isSQLiteDB(fileName, _errorString))
|
|
||||||
return;
|
|
||||||
|
|
||||||
_db = QSqlDatabase::addDatabase("QSQLITE", fileName);
|
_db = QSqlDatabase::addDatabase("QSQLITE", fileName);
|
||||||
_db.setDatabaseName(fileName);
|
_db.setDatabaseName(fileName);
|
||||||
_db.setConnectOptions("QSQLITE_OPEN_READONLY");
|
_db.setConnectOptions("QSQLITE_OPEN_READONLY");
|
||||||
|
|
||||||
if (!_db.open()) {
|
if (!_db.open()) {
|
||||||
_errorString = _db.lastError().text();
|
_errorString = "Error opening database file";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QSqlRecord>
|
#include <QSqlRecord>
|
||||||
#include <QSqlField>
|
#include <QSqlField>
|
||||||
#include <QSqlError>
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
@ -17,15 +16,12 @@
|
|||||||
SqliteMap::SqliteMap(const QString &fileName, QObject *parent)
|
SqliteMap::SqliteMap(const QString &fileName, QObject *parent)
|
||||||
: Map(fileName, parent), _mapRatio(1.0), _valid(false)
|
: Map(fileName, parent), _mapRatio(1.0), _valid(false)
|
||||||
{
|
{
|
||||||
if (!Util::isSQLiteDB(fileName, _errorString))
|
|
||||||
return;
|
|
||||||
|
|
||||||
_db = QSqlDatabase::addDatabase("QSQLITE", fileName);
|
_db = QSqlDatabase::addDatabase("QSQLITE", fileName);
|
||||||
_db.setDatabaseName(fileName);
|
_db.setDatabaseName(fileName);
|
||||||
_db.setConnectOptions("QSQLITE_OPEN_READONLY");
|
_db.setConnectOptions("QSQLITE_OPEN_READONLY");
|
||||||
|
|
||||||
if (!_db.open()) {
|
if (!_db.open()) {
|
||||||
_errorString = _db.lastError().text();
|
_errorString = "Error opening database file";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user