mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-22 14:54:24 +02:00
Compare commits
16 Commits
3af98b6785
...
11.12
Author | SHA1 | Date | |
---|---|---|---|
80ec7f624e | |||
bfeb6d266e | |||
af3e5d41c2 | |||
51511a9bf9 | |||
2549204662 | |||
b826c856fc | |||
1afe74242a | |||
b43412b135 | |||
bbad4eb8d9 | |||
f6c128fbf6 | |||
b955c4d45e | |||
e26a776576 | |||
52c4e97be5 | |||
49bd2b9501 | |||
ab76521990 | |||
ee73908231 |
@ -28,9 +28,9 @@ build_script:
|
||||
md installer
|
||||
copy release\GPXSee.exe installer
|
||||
windeployqt --release installer\GPXSee.exe
|
||||
copy pkg\gpxsee64.nsi installer
|
||||
xcopy pkg\csv installer\csv /i
|
||||
xcopy pkg\maps installer\maps /i
|
||||
copy pkg\windows\gpxsee64.nsi installer
|
||||
xcopy data\csv installer\csv /i
|
||||
xcopy data\maps installer\maps /i
|
||||
xcopy lang\*.qm installer\translations\ /sy
|
||||
xcopy icons\symbols installer\symbols /i
|
||||
copy licence.txt installer
|
||||
|
Can't render this file because it is too large.
|
30
gpxsee.pro
30
gpxsee.pro
@ -29,6 +29,7 @@ HEADERS += src/common/config.h \
|
||||
src/GUI/pluginparameters.h \
|
||||
src/common/garmin.h \
|
||||
src/common/coordinates.h \
|
||||
src/common/hash.h \
|
||||
src/common/linec.h \
|
||||
src/common/range.h \
|
||||
src/common/rectc.h \
|
||||
@ -472,23 +473,26 @@ TRANSLATIONS = lang/gpxsee_en.ts \
|
||||
lang/gpxsee_it.ts \
|
||||
lang/gpxsee_eo.ts \
|
||||
lang/gpxsee_zh.ts \
|
||||
lang/gpxsee_ca.ts
|
||||
lang/gpxsee_ca.ts \
|
||||
lang/gpxsee_ko.ts
|
||||
|
||||
macx {
|
||||
ICON = icons/app/gpxsee.icns
|
||||
QMAKE_INFO_PLIST = pkg/Info.plist
|
||||
QMAKE_INFO_PLIST = pkg/mac/Info.plist
|
||||
locale.path = Contents/Resources/translations
|
||||
locale.files = $$files(lang/*.qm)
|
||||
csv.path = Contents/Resources
|
||||
csv.files = pkg/csv
|
||||
csv.files = data/csv
|
||||
maps.path = Contents/Resources
|
||||
maps.files = pkg/maps
|
||||
maps.files = data/maps
|
||||
symbols.path = Contents/Resources/symbols
|
||||
symbols.files = $$files(icons/symbols/*.png)
|
||||
icons.path = Contents/Resources/icons
|
||||
icons.files = $$files(icons/formats/*.icns)
|
||||
lproj.path = Contents/Resources
|
||||
lproj.files = $$files(pkg/mac/lproj/*)
|
||||
|
||||
QMAKE_BUNDLE_DATA += locale maps symbols icons csv
|
||||
QMAKE_BUNDLE_DATA += locale maps symbols icons csv lproj
|
||||
}
|
||||
|
||||
win32 {
|
||||
@ -533,9 +537,9 @@ win32 {
|
||||
unix:!macx:!android {
|
||||
isEmpty(PREFIX):PREFIX = /usr/local
|
||||
|
||||
maps.files = $$files(pkg/maps/*)
|
||||
maps.files = $$files(data/maps/*)
|
||||
maps.path = $$PREFIX/share/gpxsee/maps
|
||||
csv.files = $$files(pkg/csv/*)
|
||||
csv.files = $$files(data/csv/*)
|
||||
csv.path = $$PREFIX/share/gpxsee/csv
|
||||
symbols.files = $$files(icons/symbols/*.png)
|
||||
symbols.path = $$PREFIX/share/gpxsee/symbols
|
||||
@ -543,12 +547,14 @@ unix:!macx:!android {
|
||||
locale.path = $$PREFIX/share/gpxsee/translations
|
||||
icon.files = $$files(icons/app/hicolor/*)
|
||||
icon.path = $$PREFIX/share/icons/hicolor
|
||||
desktop.files = pkg/gpxsee.desktop
|
||||
desktop.files = pkg/linux/gpxsee.desktop
|
||||
desktop.path = $$PREFIX/share/applications
|
||||
mime.files = pkg/gpxsee.xml
|
||||
mime.files = pkg/linux/gpxsee.xml
|
||||
mime.path = $$PREFIX/share/mime/packages
|
||||
appdata.files = pkg/linux/gpxsee.appdata.xml
|
||||
appdata.path = $$PREFIX/share/metainfo
|
||||
target.path = $$PREFIX/bin
|
||||
INSTALLS += target maps csv symbols locale icon desktop mime
|
||||
INSTALLS += target maps csv symbols locale icon desktop mime appdata
|
||||
}
|
||||
|
||||
android {
|
||||
@ -581,9 +587,9 @@ android {
|
||||
pkg/android/build.gradle \
|
||||
pkg/android/res/values/libs.xml
|
||||
|
||||
maps.files = $$files(pkg/maps/*)
|
||||
maps.files = $$files(data/maps/*)
|
||||
maps.path = /assets/maps
|
||||
csv.files = $$files(pkg/csv/*)
|
||||
csv.files = $$files(data/csv/*)
|
||||
csv.path = /assets/csv
|
||||
symbols.files = $$files(icons/symbols/*.png)
|
||||
symbols.path = /assets/symbols
|
||||
|
@ -204,7 +204,7 @@
|
||||
|
||||
<!-- Mapsforge rendertheme -->
|
||||
<qresource prefix="/mapsforge">
|
||||
<file alias="default.xml">data/default.xml</file>
|
||||
<file alias="default.xml">data/mapsforge/default.xml</file>
|
||||
|
||||
<file alias="patterns/hills.svg">icons/map/mapsforge/patterns/hills.svg</file>
|
||||
<file alias="patterns/farmland.svg">icons/map/mapsforge/patterns/farmland.svg</file>
|
||||
|
@ -556,7 +556,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="432"/>
|
||||
<source>Use styles</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Uzi stilojn</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="439"/>
|
||||
@ -603,7 +603,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="482"/>
|
||||
<source>Show tabs</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Montri langetojn</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="491"/>
|
||||
@ -1241,7 +1241,7 @@
|
||||
<message>
|
||||
<location filename="../src/map/maplist.cpp" line="158"/>
|
||||
<source>Electronic Navigational Charts</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>ENC-mapoj</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/map/maplist.cpp" line="165"/>
|
||||
|
@ -557,7 +557,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="432"/>
|
||||
<source>Use styles</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Käytä tyylejä</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="439"/>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -557,7 +557,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="432"/>
|
||||
<source>Use styles</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Использовать стили</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="439"/>
|
||||
@ -1247,7 +1247,7 @@
|
||||
<message>
|
||||
<location filename="../src/map/maplist.cpp" line="158"/>
|
||||
<source>Electronic Navigational Charts</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Морские карты ENC</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/map/maplist.cpp" line="165"/>
|
||||
|
@ -2,8 +2,12 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>GPXSee</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>@ICON@</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
@ -16,6 +20,34 @@
|
||||
<string>@EXECUTABLE@</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.gpxsee.GPXSee</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@FULL_VERSION@</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
|
||||
<key>CFBundleLocalizations</key>
|
||||
<array>
|
||||
<string>ca</string>
|
||||
<string>cs</string>
|
||||
<string>da</string>
|
||||
<string>de</string>
|
||||
<string>en</string>
|
||||
<string>eo</string>
|
||||
<string>es</string>
|
||||
<string>fi</string>
|
||||
<string>fr</string>
|
||||
<string>hu</string>
|
||||
<string>it</string>
|
||||
<string>ko</string>
|
||||
<string>nb</string>
|
||||
<string>pl</string>
|
||||
<string>pt_BR</string>
|
||||
<string>ru</string>
|
||||
<string>sv</string>
|
||||
<string>tr</string>
|
||||
<string>uk</string>
|
||||
<string>zh_CN</string>
|
||||
</array>
|
||||
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
@ -325,6 +325,7 @@ SectionGroup "Localization" SEC_LOCALIZATION
|
||||
!insertmacro LOCALIZATION "German" "de"
|
||||
!insertmacro LOCALIZATION "Hungarian" "hu"
|
||||
!insertmacro LOCALIZATION "Italian" "it"
|
||||
!insertmacro LOCALIZATION "Korean" "ko"
|
||||
!insertmacro LOCALIZATION "Norwegian" "nb"
|
||||
!insertmacro LOCALIZATION "Polish" "pl"
|
||||
!insertmacro LOCALIZATION "Portuguese (Brazil)" "pt_BR"
|
@ -28,10 +28,10 @@ App::App(int &argc, char **argv) : QApplication(argc, argv)
|
||||
#endif
|
||||
setApplicationVersion(APP_VERSION);
|
||||
|
||||
QTranslator *gpxsee = new QTranslator(this);
|
||||
if (gpxsee->load(QLocale::system(), "gpxsee", "_",
|
||||
QTranslator *app = new QTranslator(this);
|
||||
if (app->load(QLocale::system(), "gpxsee", "_",
|
||||
ProgramPaths::translationsDir()))
|
||||
installTranslator(gpxsee);
|
||||
installTranslator(app);
|
||||
|
||||
QTranslator *qt = new QTranslator(this);
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <QStyle>
|
||||
#include <QTabBar>
|
||||
#include <QGeoPositionInfoSource>
|
||||
#include "common/config.h"
|
||||
#include "common/programpaths.h"
|
||||
#include "common/downloader.h"
|
||||
#include "data/data.h"
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include <QList>
|
||||
#include <QFlags>
|
||||
#include "common/rectc.h"
|
||||
#include "common/config.h"
|
||||
#include "data/waypoint.h"
|
||||
#include "map/projection.h"
|
||||
#include "searchpointer.h"
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef SEARCHPOINTER_H
|
||||
#define SEARCHPOINTER_H
|
||||
|
||||
#include "common/config.h"
|
||||
#include "common/hash.h"
|
||||
|
||||
template <class T>
|
||||
class SearchPointer
|
||||
|
@ -1,21 +1,7 @@
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QPoint>
|
||||
|
||||
#define APP_NAME "GPXSee"
|
||||
#define APP_HOMEPAGE "http://www.gpxsee.org"
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#define HASH_T uint
|
||||
#else // QT6
|
||||
#define HASH_T size_t
|
||||
#endif // QT6
|
||||
|
||||
inline HASH_T qHash(const QPoint &p)
|
||||
{
|
||||
return ::qHash(p.x()) ^ ::qHash(p.y());
|
||||
}
|
||||
|
||||
#endif /* CONFIG_H */
|
||||
|
18
src/common/hash.h
Normal file
18
src/common/hash.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef HASH_H
|
||||
#define HASH_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QPoint>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#define HASH_T uint
|
||||
#else // QT6
|
||||
#define HASH_T size_t
|
||||
#endif // QT6
|
||||
|
||||
inline HASH_T qHash(const QPoint &p)
|
||||
{
|
||||
return ::qHash(p.x()) ^ ::qHash(p.y());
|
||||
}
|
||||
|
||||
#endif // HASH_H
|
@ -4,7 +4,7 @@
|
||||
#include <QString>
|
||||
#include <QCache>
|
||||
#include <QByteArray>
|
||||
#include "common/config.h"
|
||||
#include "common/hash.h"
|
||||
#include "area.h"
|
||||
|
||||
class QString;
|
||||
|
@ -482,6 +482,7 @@ void KMLParser::track(SegmentData &segment)
|
||||
{
|
||||
const char error[] = "gx:coord/when element count mismatch";
|
||||
int i = 0;
|
||||
bool empty = false;
|
||||
|
||||
while (_reader.readNextStartElement()) {
|
||||
if (_reader.name() == QLatin1String("when")) {
|
||||
@ -495,6 +496,8 @@ void KMLParser::track(SegmentData &segment)
|
||||
_reader.raiseError("Invalid coordinates");
|
||||
return;
|
||||
}
|
||||
if (segment.at(i).coordinates().isNull())
|
||||
empty = true;
|
||||
i++;
|
||||
} else if (_reader.name() == QLatin1String("ExtendedData"))
|
||||
extendedData(segment);
|
||||
@ -507,10 +510,15 @@ void KMLParser::track(SegmentData &segment)
|
||||
return;
|
||||
}
|
||||
|
||||
// empty (invalid) coordinates are allowed per KML specification!
|
||||
for (int i = 0; i < segment.size(); i++)
|
||||
if (segment.at(i).coordinates().isNull())
|
||||
segment.remove(i);
|
||||
/* empty (invalid) coordinates are allowed per KML specification, but
|
||||
invalid in our data representation so get rid of the segment entries */
|
||||
if (empty) {
|
||||
SegmentData filtered;
|
||||
for (int i = 0; i < segment.size(); i++)
|
||||
if (!segment.at(i).coordinates().isNull())
|
||||
filtered.append(segment.at(i));
|
||||
segment = filtered;
|
||||
}
|
||||
}
|
||||
|
||||
void KMLParser::multiTrack(TrackData &t)
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <QVector>
|
||||
#include <QPixmap>
|
||||
#include <QDebug>
|
||||
#include "common/config.h"
|
||||
#include "common/hash.h"
|
||||
#include "common/coordinates.h"
|
||||
#include "link.h"
|
||||
#include "style.h"
|
||||
|
@ -5,6 +5,13 @@
|
||||
|
||||
using namespace ENC;
|
||||
|
||||
#define UINT16(x) \
|
||||
(((quint16)*(const uchar*)(x)) \
|
||||
| ((quint16)(*((const uchar*)(x) + 1)) << 8))
|
||||
|
||||
#define INT32(x) ((qint32)UINT32(x))
|
||||
#define INT16(x) ((qint16)UINT16(x))
|
||||
|
||||
struct DR {
|
||||
char RecordLength[5];
|
||||
char InterchangeLevel;
|
||||
@ -91,14 +98,14 @@ bool ISO8211::fieldType(const QString &str, int cnt, FieldType &type, int &size)
|
||||
return true;
|
||||
}
|
||||
|
||||
int ISO8211::readDR(QFile &file, QVector<FieldDefinition> &fields) const
|
||||
int ISO8211::readDR(QVector<FieldDefinition> &fields)
|
||||
{
|
||||
DR ddr;
|
||||
QByteArray fieldLen, fieldPos;
|
||||
int len, lenSize, posSize, tagSize, offset;
|
||||
|
||||
static_assert(sizeof(ddr) == 24, "Invalid DR alignment");
|
||||
if (file.read((char*)&ddr, sizeof(ddr)) != sizeof(ddr))
|
||||
if (_file.read((char*)&ddr, sizeof(ddr)) != sizeof(ddr))
|
||||
return -1;
|
||||
|
||||
len = Util::str2int(ddr.RecordLength, sizeof(ddr.RecordLength));
|
||||
@ -119,9 +126,9 @@ int ISO8211::readDR(QFile &file, QVector<FieldDefinition> &fields) const
|
||||
|
||||
r.tag.resize(tagSize);
|
||||
|
||||
if (file.read(r.tag.data(), tagSize) != tagSize
|
||||
|| file.read(fieldLen.data(), lenSize) != lenSize
|
||||
|| file.read(fieldPos.data(), posSize) != posSize)
|
||||
if (_file.read(r.tag.data(), tagSize) != tagSize
|
||||
|| _file.read(fieldLen.data(), lenSize) != lenSize
|
||||
|| _file.read(fieldPos.data(), posSize) != posSize)
|
||||
return -1;
|
||||
|
||||
r.pos = offset + Util::str2int(fieldPos.constData(), posSize);
|
||||
@ -134,13 +141,13 @@ int ISO8211::readDR(QFile &file, QVector<FieldDefinition> &fields) const
|
||||
return len;
|
||||
}
|
||||
|
||||
bool ISO8211::readDDA(QFile &file, const FieldDefinition &def, SubFields &fields)
|
||||
bool ISO8211::readDDA(const FieldDefinition &def, SubFields &fields)
|
||||
{
|
||||
static QRegularExpression re("(\\d*)(\\w+)\\(*(\\d*)\\)*");
|
||||
QByteArray ba;
|
||||
|
||||
ba.resize(def.size);
|
||||
if (!(file.seek(def.pos) && file.read(ba.data(), ba.size()) == ba.size()))
|
||||
if (!(_file.seek(def.pos) && _file.read(ba.data(), ba.size()) == ba.size()))
|
||||
return false;
|
||||
|
||||
QList<QByteArray> list(ba.split('\x1f'));
|
||||
@ -188,12 +195,16 @@ bool ISO8211::readDDA(QFile &file, const FieldDefinition &def, SubFields &fields
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ISO8211::readDDR(QFile &file)
|
||||
bool ISO8211::readDDR()
|
||||
{
|
||||
QVector<FieldDefinition> fields;
|
||||
qint64 pos = file.pos();
|
||||
int len = readDR(file, fields);
|
||||
|
||||
if (!_file.open(QIODevice::ReadOnly)) {
|
||||
_errorString = _file.errorString();
|
||||
return false;
|
||||
}
|
||||
|
||||
int len = readDR(fields);
|
||||
if (len < 0) {
|
||||
_errorString = "Not a ISO8211 file";
|
||||
return false;
|
||||
@ -201,7 +212,7 @@ bool ISO8211::readDDR(QFile &file)
|
||||
|
||||
for (int i = 0; i < fields.size(); i++) {
|
||||
SubFields def;
|
||||
if (!readDDA(file, fields.at(i), def)) {
|
||||
if (!readDDA(fields.at(i), def)) {
|
||||
_errorString = QString("Error reading %1 DDA field")
|
||||
.arg(QString(fields.at(i).tag));
|
||||
return false;
|
||||
@ -209,7 +220,7 @@ bool ISO8211::readDDR(QFile &file)
|
||||
_map.insert(fields.at(i).tag, def);
|
||||
}
|
||||
|
||||
if (file.pos() != pos + len || fields.size() < 2) {
|
||||
if (_file.pos() != len || fields.size() < 2) {
|
||||
_errorString = "DDR format error";
|
||||
return false;
|
||||
}
|
||||
@ -217,20 +228,21 @@ bool ISO8211::readDDR(QFile &file)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ISO8211::readUDA(QFile &file, quint64 pos, const FieldDefinition &def,
|
||||
const SubFields &fields, Data &data) const
|
||||
bool ISO8211::readUDA(quint64 pos, const FieldDefinition &def,
|
||||
const SubFields &fields, Data &data)
|
||||
{
|
||||
QByteArray ba;
|
||||
|
||||
ba.resize(def.size);
|
||||
if (!(file.seek(pos + def.pos)
|
||||
&& file.read(ba.data(), ba.size()) == ba.size()))
|
||||
if (!(_file.seek(pos + def.pos)
|
||||
&& _file.read(ba.data(), ba.size()) == ba.size()))
|
||||
return false;
|
||||
|
||||
const char *sp;
|
||||
const char *dp = ba.constData();
|
||||
const char *ep = ba.constData() + ba.size() - 1;
|
||||
|
||||
data.clear();
|
||||
data.setFields(&fields);
|
||||
|
||||
do {
|
||||
@ -287,11 +299,14 @@ bool ISO8211::readUDA(QFile &file, quint64 pos, const FieldDefinition &def,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ISO8211::readRecord(QFile &file, Record &record)
|
||||
bool ISO8211::readRecord(Record &record)
|
||||
{
|
||||
if (_file.atEnd())
|
||||
return false;
|
||||
|
||||
QVector<FieldDefinition> fields;
|
||||
qint64 pos = file.pos();
|
||||
int len = readDR(file, fields);
|
||||
qint64 pos = _file.pos();
|
||||
int len = readDR(fields);
|
||||
|
||||
if (len < 0) {
|
||||
_errorString = "Error reading DR";
|
||||
@ -313,7 +328,7 @@ bool ISO8211::readRecord(QFile &file, Record &record)
|
||||
|
||||
f.setTag(def.tag);
|
||||
|
||||
if (!readUDA(file, pos, def, it.value(), f.rdata())) {
|
||||
if (!readUDA(pos, def, it.value(), f.rdata())) {
|
||||
_errorString = QString("Error reading %1 record")
|
||||
.arg(QString(def.tag));
|
||||
return false;
|
||||
|
@ -1,25 +1,17 @@
|
||||
#ifndef ENC_ISO8211_H
|
||||
#define ENC_ISO8211_H
|
||||
|
||||
#include <QFile>
|
||||
#include <QByteArray>
|
||||
#include <QVariant>
|
||||
#include <QDebug>
|
||||
|
||||
class QFile;
|
||||
|
||||
#define UINT32(x) \
|
||||
(((quint32)*(const uchar*)(x)) \
|
||||
| ((quint32)(*((const uchar*)(x) + 1)) << 8) \
|
||||
| ((quint32)(*((const uchar*)(x) + 2)) << 16) \
|
||||
| ((quint32)(*((const uchar*)(x) + 3)) << 24))
|
||||
|
||||
#define UINT16(x) \
|
||||
(((quint16)*(const uchar*)(x)) \
|
||||
| ((quint16)(*((const uchar*)(x) + 1)) << 8))
|
||||
|
||||
#define INT32(x) ((qint32)UINT32(x))
|
||||
#define INT16(x) ((qint16)UINT16(x))
|
||||
|
||||
namespace ENC {
|
||||
|
||||
class ISO8211
|
||||
@ -102,8 +94,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
bool readDDR(QFile &file);
|
||||
bool readRecord(QFile &file, Record &record);
|
||||
ISO8211(const QString &path) : _file(path) {}
|
||||
bool readDDR();
|
||||
bool readRecord(Record &record);
|
||||
|
||||
const QString &errorString() const {return _errorString;}
|
||||
|
||||
@ -113,11 +106,12 @@ private:
|
||||
static bool fieldType(const QString &str, int cnt, FieldType &type,
|
||||
int &size);
|
||||
|
||||
int readDR(QFile &file, QVector<FieldDefinition> &fields) const;
|
||||
bool readDDA(QFile &file, const FieldDefinition &def, SubFields &fields);
|
||||
bool readUDA(QFile &file, quint64 pos, const FieldDefinition &def,
|
||||
const SubFields &fields, Data &data) const;
|
||||
int readDR(QVector<FieldDefinition> &fields);
|
||||
bool readDDA(const FieldDefinition &def, SubFields &fields);
|
||||
bool readUDA(quint64 pos, const FieldDefinition &def,
|
||||
const SubFields &fields, Data &data);
|
||||
|
||||
QFile _file;
|
||||
FieldsMap _map;
|
||||
QString _errorString;
|
||||
};
|
||||
|
@ -1,4 +1,3 @@
|
||||
#include <QFile>
|
||||
#include "common/util.h"
|
||||
#include "objects.h"
|
||||
#include "attributes.h"
|
||||
@ -751,31 +750,25 @@ bool MapData::bounds(const QVector<ISO8211::Record> &gv, Rect &b)
|
||||
|
||||
MapData::MapData(const QString &path): _fileName(path)
|
||||
{
|
||||
QFile file(_fileName);
|
||||
QVector<ISO8211::Record> gv;
|
||||
ISO8211 ddf;
|
||||
ISO8211 ddf(_fileName);
|
||||
ISO8211::Record record;
|
||||
uint COMF = 1;
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
_errorString = file.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ddf.readDDR(file)) {
|
||||
if (!ddf.readDDR()) {
|
||||
_errorString = ddf.errorString();
|
||||
return;
|
||||
}
|
||||
while (!file.atEnd()) {
|
||||
ISO8211::Record record;
|
||||
if (!ddf.readRecord(file, record)) {
|
||||
_errorString = ddf.errorString();
|
||||
return;
|
||||
}
|
||||
while (ddf.readRecord(record)) {
|
||||
if (!processRecord(record, gv, COMF, _name)) {
|
||||
_errorString = "Invalid S-57 record";
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!ddf.errorString().isNull()) {
|
||||
_errorString = ddf.errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
Rect b;
|
||||
if (!bounds(gv, b)) {
|
||||
@ -807,30 +800,22 @@ MapData::~MapData()
|
||||
|
||||
void MapData::load()
|
||||
{
|
||||
QFile file(_fileName);
|
||||
RecordMap vi, vc, ve, vf;
|
||||
QVector<ISO8211::Record> fe;
|
||||
uint COMF = 1, SOMF = 1;
|
||||
ISO8211 ddf;
|
||||
uint PRIM, OBJL;
|
||||
ISO8211 ddf(_fileName);
|
||||
ISO8211::Record record;
|
||||
uint PRIM, OBJL, COMF = 1, SOMF = 1;
|
||||
Poly *poly;
|
||||
Line *line;
|
||||
Point *point;
|
||||
double min[2], max[2];
|
||||
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
if (!ddf.readDDR())
|
||||
return;
|
||||
|
||||
if (!ddf.readDDR(file))
|
||||
return;
|
||||
while (!file.atEnd()) {
|
||||
ISO8211::Record record;
|
||||
if (!ddf.readRecord(file, record))
|
||||
return;
|
||||
while (ddf.readRecord(record))
|
||||
if (!processRecord(record, fe, vi, vc, ve, vf, COMF, SOMF))
|
||||
return;
|
||||
}
|
||||
qWarning("Invalid S-57 record");
|
||||
|
||||
for (int i = 0; i < fe.size(); i++) {
|
||||
const ISO8211::Record &r = fe.at(i);
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define IMG_SHIELD_H
|
||||
|
||||
#include <QString>
|
||||
#include "common/config.h"
|
||||
#include "common/hash.h"
|
||||
|
||||
#define FIRST_SHIELD Shield::USInterstate
|
||||
#define LAST_SHIELD Shield::Oval
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <QImageReader>
|
||||
#include <QBuffer>
|
||||
#include <QtConcurrent>
|
||||
#include "common/hash.h"
|
||||
#include "osm.h"
|
||||
#include "tile.h"
|
||||
#include "aqmmap.h"
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QHash>
|
||||
#include "common/config.h"
|
||||
#include "map.h"
|
||||
|
||||
class AQMMap : public Map
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <QFile>
|
||||
#include <QCache>
|
||||
#include <QPainterPath>
|
||||
#include "common/config.h"
|
||||
#include "common/hash.h"
|
||||
#include "common/rectc.h"
|
||||
#include "common/rtree.h"
|
||||
#include "common/range.h"
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <QRegularExpression>
|
||||
#include "common/coordinates.h"
|
||||
#include "common/rectc.h"
|
||||
#include "common/config.h"
|
||||
#include "tar.h"
|
||||
#include "ozf.h"
|
||||
#include "image.h"
|
||||
@ -381,7 +380,7 @@ void OziMap::setDevicePixelRatio(qreal deviceRatio, qreal mapRatio)
|
||||
Map *OziMap::createTAR(const QString &path, const Projection &, bool *isDir)
|
||||
{
|
||||
if (isDir)
|
||||
*isDir = true;
|
||||
*isDir = false;
|
||||
|
||||
return new OziMap(path, true);
|
||||
}
|
||||
@ -389,7 +388,7 @@ Map *OziMap::createTAR(const QString &path, const Projection &, bool *isDir)
|
||||
Map *OziMap::createMAP(const QString &path, const Projection &, bool *isDir)
|
||||
{
|
||||
if (isDir)
|
||||
*isDir = true;
|
||||
*isDir = false;
|
||||
|
||||
return new OziMap(path, false);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <QSet>
|
||||
#include <QList>
|
||||
#include <QHash>
|
||||
#include "common/config.h"
|
||||
#include "common/hash.h"
|
||||
#include "common/rectc.h"
|
||||
#include "common/kv.h"
|
||||
#include "common/downloader.h"
|
||||
|
Reference in New Issue
Block a user