1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-16 20:04:23 +02:00

Compare commits

..

24 Commits

Author SHA1 Message Date
436cf0d14c Qt5 compatability module is not needed anymore 2024-01-21 18:44:42 +01:00
0e83bd89d1 Use Qt 6.6.1 for the Mac OS Qt6 CI build 2024-01-21 18:26:11 +01:00
536d12469a Use the canonical file name also for the "already open" check 2024-01-21 17:50:56 +01:00
c9f44506e7 Fixed minimal Windows version check for Qt6 builds 2024-01-21 16:04:59 +01:00
bc4bffdfe7 Fixed NSIS command line parameters 2024-01-21 12:26:04 +01:00
eda35b6762 Made the Windows installer more modular
Enable separately selecting the Qt6, OpenSSL or ANGLE options.
Added ICU option for Qt builds with ICU enabled/required.
2024-01-21 12:01:27 +01:00
b05e7b15fe Use ISO-8859-1 as the fallback encoding rather than UTF-8 2024-01-19 09:56:56 +01:00
ed2fc0c627 Fixed missing sdkmanager in path 2024-01-18 22:39:56 +01:00
60f58592b2 Try to use older cmdline-tools 2024-01-18 22:37:08 +01:00
80abb6f604 Trying to fix the android CI build... 2024-01-18 22:27:57 +01:00
19c4aa1c34 Try another Java 11 version instead of the now broken azul build 2024-01-18 22:15:48 +01:00
578045108f Removed now unused Qt5 compatability module 2024-01-18 22:13:54 +01:00
796c2e7eaf Removed unused header include 2024-01-18 22:13:05 +01:00
c08d3b7159 Fixed indent 2024-01-18 22:12:23 +01:00
7f7de87e99 Drop Qt5Compat dependency
Use QStringConverter instead of QTextCodec on Qt > 6.5.
Qt6 builds now require Qt build with ICU support for the non-UTF encodings to
work!
2024-01-18 10:04:38 +01:00
9cacf1906e Do not duplicate the same paths in the "open recent" menu 2024-01-18 09:53:50 +01:00
cedca8725b Supress windows build warnings 2024-01-18 09:52:22 +01:00
c493f8cf16 Make the popup layout more resistant to broken HTML content 2024-01-17 08:57:08 +01:00
866b2c27ca Consistently initialize all stuff in constructor 2024-01-05 00:20:05 +01:00
07614a8f74 Added missing header includes 2024-01-04 18:53:43 +01:00
bc7d965a49 Version++ 2024-01-02 22:05:56 +01:00
e383a35c65 Year++ in copyright notices 2024-01-02 22:04:30 +01:00
6b4990a204 Fixed error handling 2024-01-02 19:11:04 +01:00
7a7a331b58 The codec is always set when reading the GPI header 2024-01-02 09:48:13 +01:00
26 changed files with 209 additions and 106 deletions

View File

@ -1,4 +1,4 @@
version: 13.14.{build}
version: 13.15.{build}
configuration:
- Release
@ -11,11 +11,10 @@ environment:
matrix:
- QTDIR: C:\Qt\5.15\msvc2019_64
OPENSSLDIR: C:\OpenSSL-v111-Win64\bin
OPENSSLVERSION: 1_1
NSISDEF: /DOPENSSL /DANGLE
- QTDIR: C:\Qt\6.5\msvc2019_64
OPENSSLDIR: C:\OpenSSL-v30-Win64\bin
OPENSSLVERSION: 3
NSISDEF: /DQT6
NSISDEF: /DQT6 /DOPENSSL
install:
- cmd: |-
@ -37,8 +36,8 @@ build_script:
xcopy lang\*.qm installer\translations\ /sy
xcopy icons\symbols installer\symbols /i
copy licence.txt installer
copy %OPENSSLDIR%\libcrypto-%OPENSSLVERSION%-x64.dll installer
copy %OPENSSLDIR%\libssl-%OPENSSLVERSION%-x64.dll installer
copy %OPENSSLDIR%\libcrypto-*-x64.dll installer
copy %OPENSSLDIR%\libssl-*-x64.dll installer
makensis.exe %NSISDEF% installer\gpxsee64.nsi

View File

@ -15,14 +15,14 @@ jobs:
- name: set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu'
distribution: 'temurin'
java-version: '11'
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Run sdkmanager update
run: ${ANDROID_HOME}/tools/bin/sdkmanager --update
- name: Install android platform, platform-tools, build-tools and ndk
run: ${ANDROID_HOME}/tools/bin/sdkmanager --install "cmdline-tools;latest" "platform-tools" "platforms;android-33" "build-tools;33.0.0" "ndk;23.1.7779620"
uses: android-actions/setup-android@v3
with:
cmdline-tools-version: 9862592
- name: Install android platform, build-tools and ndk
run: ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "platforms;android-33" "build-tools;33.0.0" "ndk;23.1.7779620"
- name: Setup NDK path
run: echo "ANDROID_NDK_ROOT=${ANDROID_HOME}/ndk/23.1.7779620/" >> $GITHUB_ENV
- name: Install Qt (Desktop)

View File

@ -39,8 +39,8 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '6.5.1'
modules: qtpositioning qt5compat qtserialport
version: '6.6.1'
modules: qtpositioning qtserialport
- name: Create localization
run: lrelease gpxsee.pro
- name: Configure build

View File

@ -3,7 +3,7 @@ unix:!macx:!android {
} else {
TARGET = GPXSee
}
VERSION = 13.14
VERSION = 13.15
QT += core \
@ -18,8 +18,10 @@ QT += core \
svg \
serialport
greaterThan(QT_MAJOR_VERSION, 5) {
QT += openglwidgets \
core5compat
QT += openglwidgets
lessThan(QT_MINOR_VERSION, 5) {
QT += core5compat
}
}
CONFIG += object_parallel_to_source
@ -510,10 +512,11 @@ macx {
}
win32 {
CONFIG += no_batch
RESOURCES += theme-color.qrc
QMAKE_TARGET_DESCRIPTION = GPXSee
QMAKE_TARGET_COPYRIGHT = Copyright (c) 2023 Martin Tuma
QMAKE_TARGET_COPYRIGHT = Copyright (c) 2015-2024 Martin Tuma
RC_ICONS = icons/app/gpxsee.ico \
icons/formats/gpx.ico \
icons/formats/tcx.ico \

View File

@ -37,7 +37,7 @@ Unicode true
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "13.14"
!define VERSION "13.15"
; The file to write
OutFile "GPXSee-${VERSION}_x64.exe"
@ -58,7 +58,7 @@ VIProductVersion "${VERSION}.0.0"
VIAddVersionKey "ProductVersion" ${VERSION}
VIAddVersionKey "FileVersion" "${VERSION}.0.0"
VIAddVersionKey "ProductName" "GPXSee"
VIAddVersionKey "LegalCopyright" "Copyright (c) 2023 Martin Tůma"
VIAddVersionKey "LegalCopyright" "Copyright (c) 2015-2024 Martin Tůma"
VIAddVersionKey "FileDescription" "GPXSee installer (x64)"
; Registry key to check for directory (so if you install again, it will
@ -95,10 +95,17 @@ Var StartMenuFolder
!insertmacro MUI_LANGUAGE "English"
Function .onInit
!ifdef QT6
${IfNot} ${AtLeastWin10}
MessageBox MB_OK "GPXSee can only be installed on Windows 10 or later."
Abort
${EndIf}
!else
${IfNot} ${AtLeastWin7}
MessageBox MB_OK "GPXSee can only be installed on Windows 7 or later."
Abort
${EndIf}
!endif
${If} ${RunningX64}
SetRegView 64
@ -249,7 +256,7 @@ Section "GPXSee" SEC_APP
SectionEnd
Section "QT framework" SEC_QT
Section "Qt framework" SEC_QT
SectionIn RO
@ -264,7 +271,6 @@ Section "QT framework" SEC_QT
File "Qt6Sql.dll"
File "Qt6Svg.dll"
File "Qt6Widgets.dll"
File "Qt6Core5Compat.dll"
File "Qt6Positioning.dll"
File "Qt6SerialPort.dll"
File /r "tls"
@ -282,6 +288,7 @@ Section "QT framework" SEC_QT
File /r "printsupport"
!endif
File /r "platforms"
File /r "iconengines"
File /r "imageformats"
File /r "styles"
File /r "sqldrivers"
@ -300,21 +307,30 @@ Section "MSVC runtime" SEC_MSVC
SectionEnd
!ifdef ICU
Section "ICU" SEC_ICU
SectionIn RO
File "icudt*.dll"
File "icuin*.dll"
File "icuuc*.dll"
SectionEnd
!endif
!ifdef OPENSSL
Section "OpenSSL" SEC_OPENSSL
SectionIn RO
!ifdef QT6
File "libcrypto-3-x64.dll"
File "libssl-3-x64.dll"
!else
File "libcrypto-1_1-x64.dll"
File "libssl-1_1-x64.dll"
!endif
File "libcrypto-*-x64.dll"
File "libssl-*-x64.dll"
SectionEnd
!endif
!ifndef QT6
!ifdef ANGLE
Section "ANGLE" SEC_ANGLE
File "libGLESv2.dll"
@ -470,13 +486,24 @@ SectionEnd
; Descriptions
; Language strings
!ifdef QT6
LangString DESC_QT ${LANG_ENGLISH} \
"QT cross-platform application framework."
"Qt6 cross-platform application framework."
!else
LangString DESC_QT ${LANG_ENGLISH} \
"Qt5 cross-platform application framework."
!endif
LangString DESC_MSVC ${LANG_ENGLISH} \
"Microsoft Visual C++ 2019 runtime. If already installed, will be skipped."
"Microsoft Visual C++ runtime. If already installed, will be skipped."
!ifdef ICU
LangString DESC_ICU ${LANG_ENGLISH} \
"ICU library. Required for character set/encoding conversions."
!endif
!ifdef OPENSSL
LangString DESC_OPENSSL ${LANG_ENGLISH} \
"OpenSSL library. Required for HTTPS to work."
!ifndef QT6
"OpenSSL library. Qt SSL/TLS backend for HTTPS."
!endif
!ifdef ANGLE
LangString DESC_ANGLE ${LANG_ENGLISH} \
"ANGLE (OpenGL via Direct3D). Enables OpenGL on systems without native OpenGL drivers."
!endif
@ -488,8 +515,13 @@ LangString DESC_LOCALIZATION ${LANG_ENGLISH} \
; Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT)
!ifdef ICU
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_ICU} $(DESC_ICU)
!endif
!ifdef OPENSSL
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_OPENSSL} $(DESC_OPENSSL)
!ifndef QT6
!endif
!ifdef ANGLE
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_ANGLE} $(DESC_ANGLE)
!endif
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC)

View File

@ -4,6 +4,7 @@
#include <QGraphicsItem>
#include <QVector>
#include <QLocale>
#include <QFont>
#include "common/range.h"
class AxisItem : public QGraphicsItem

View File

@ -1028,13 +1028,16 @@ void GUI::openDir()
bool GUI::openFile(const QString &fileName, bool tryUnknown, int &showError)
{
if (_files.contains(fileName))
QFileInfo fi(fileName);
QString canonicalFileName(fi.canonicalFilePath());
if (_files.contains(canonicalFileName))
return true;
if (!loadFile(fileName, tryUnknown, showError))
return false;
_files.append(fileName);
_files.append(canonicalFileName);
#ifndef Q_OS_ANDROID
_browser->setCurrent(fileName);
#endif // Q_OS_ANDROID
@ -1047,7 +1050,7 @@ bool GUI::openFile(const QString &fileName, bool tryUnknown, int &showError)
updateStatusBarInfo();
updateWindowTitle();
#ifndef Q_OS_ANDROID
updateRecentFiles(fileName);
updateRecentFiles(canonicalFileName);
#endif // Q_OS_ANDROID
return true;

View File

@ -3,6 +3,7 @@
#include <QGraphicsItem>
#include <QList>
#include <QFont>
#include "common/kv.h"
class InfoItem : public QGraphicsItem

View File

@ -2,6 +2,7 @@
#define MOTIONINFOITEM_H
#include <QGraphicsItem>
#include <QFont>
#include "units.h"
class MotionInfoItem : public QGraphicsItem

View File

@ -3,6 +3,7 @@
#include <QFont>
#include <QGraphicsItem>
#include <QtMath>
#include "graphicsscene.h"
class PathTickItem : public GraphicsItem
@ -16,7 +17,7 @@ public:
void setPos(const QPointF &pos);
void setColor(const QColor &color) {_brush = QBrush(color);}
void setDigitalZoom(int zoom) {setScale(pow(2, -zoom));}
void setDigitalZoom(int zoom) {setScale(qPow(2, -zoom));}
int type() const {return parentItem()->type();}
ToolTip info() const

View File

@ -7,6 +7,7 @@
#include <QBasicTimer>
#include <QScreen>
#include <QVBoxLayout>
#include <QFormLayout>
#include <QApplication>
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
#include <QDesktopWidget>
@ -93,21 +94,29 @@ void PopupFrame::createLayout(const ToolTip &content)
}
if (!content.list().isEmpty()) {
QString html = "<table>";
for (int i = 0; i < content.list().count(); i++)
html += "<tr><td align=\"right\"><b>" + content.list().at(i).key()
+ ":&nbsp;</b></td><td>" + content.list().at(i).value()
+ "</td></tr>";
html += "</table>";
QFormLayout *textLayout = new QFormLayout();
textLayout->setLabelAlignment(Qt::AlignRight);
textLayout->setHorizontalSpacing(5);
textLayout->setVerticalSpacing(2);
QLabel *label = new QLabel(html);
label->setAlignment(Qt::AlignLeft);
label->setIndent(1);
label->setTextInteractionFlags(Qt::TextBrowserInteraction);
label->setOpenExternalLinks(true);
label->setWordWrap(true);
for (int i = 0; i < content.list().count(); i++) {
QLabel *key = new QLabel(content.list().at(i).key() + ":");
key->setTextFormat(Qt::PlainText);
key->setAlignment(Qt::AlignTop);
key->setStyleSheet("font-weight: bold");
QLabel *value = new QLabel(content.list().at(i).value());
value->setSizePolicy(QSizePolicy::MinimumExpanding,
QSizePolicy::Preferred);
value->setTextFormat(Qt::RichText);
value->setAlignment(Qt::AlignTop);
value->setTextInteractionFlags(Qt::TextBrowserInteraction);
value->setOpenExternalLinks(true);
value->setWordWrap(true);
layout->addWidget(label);
textLayout->addRow(key, value);
}
layout->addLayout(textLayout);
}
setLayout(layout);

View File

@ -2,6 +2,7 @@
#define SCALEITEM_H
#include <QGraphicsItem>
#include <QFont>
#include "units.h"
class ScaleItem : public QGraphicsItem

View File

@ -2,6 +2,7 @@
#define SLIDERINFOITEM_H
#include <QGraphicsItem>
#include <QFont>
class SliderInfoItem : public QGraphicsItem
{

View File

@ -2,9 +2,12 @@
#define HASH_H
#include <QtGlobal>
#include <QPoint>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QPoint>
#include <QPair>
#include <QHash>
#define HASH_T uint
inline uint qHash(const QPoint &p)

View File

@ -1,15 +1,20 @@
#include <QTextCodec>
#include "textcodec.h"
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
static QTextCodec *codec(int mib)
{
QTextCodec *c = QTextCodec::codecForMib(mib);
if (!c)
qWarning("MIB-%d: No such QTextCodec, using UTF-8", mib);
qWarning("MIB-%d: No such QTextCodec, using ISO-8859-1", mib);
return c;
}
TextCodec::TextCodec() : _codec(0)
{
}
TextCodec::TextCodec(int codepage)
{
switch (codepage) {
@ -56,15 +61,40 @@ TextCodec::TextCodec(int codepage)
_codec = codec(2258);
break;
case 65001:
_codec = 0;
_codec = codec(106);
break;
default:
qWarning("%d: Unknown codepage, using UTF-8", codepage);
qWarning("%d: Unknown codepage, using ISO-8859-1", codepage);
_codec = 0;
}
}
QString TextCodec::toString(const QByteArray &ba) const
QString TextCodec::toString(const QByteArray &ba)
{
return _codec ? _codec->toUnicode(ba) : QString::fromUtf8(ba);
return _codec ? _codec->toUnicode(ba) : QString::fromLatin1(ba);
}
#else // QT 6.5
TextCodec::TextCodec()
{
}
TextCodec::TextCodec(int codepage)
{
if (codepage == 65001)
_decoder = QStringDecoder(QStringDecoder::Utf8);
else {
QByteArray cp(QByteArray("CP") + QByteArray::number(codepage));
_decoder = QStringDecoder(cp.constData());
if (!_decoder.isValid())
qWarning("%d: Unknown codepage, using ISO-8859-1", codepage);
}
}
QString TextCodec::toString(const QByteArray &ba)
{
return _decoder.isValid() ? _decoder.decode(ba) : QString::fromLatin1(ba);
}
#endif // QT 6.5

View File

@ -2,20 +2,26 @@
#define TEXTCODEC_H
#include <QString>
#include <QMap>
class QTextCodec;
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
#include <QTextCodec>
#else // QT 6.5
#include <QStringDecoder>
#endif // QT 6.5
class TextCodec
{
public:
TextCodec() : _codec(0) {}
TextCodec();
TextCodec(int codepage);
QString toString(const QByteArray &ba) const;
QString toString(const QByteArray &ba);
private:
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
QTextCodec *_codec;
#else // QT 6.5
QStringDecoder _decoder;
#endif // QT 6.5
};
#endif // TEXTCODEC_H

View File

@ -128,7 +128,7 @@ qint64 CryptDevice::readData(char *data, qint64 maxSize)
class DataStream : public QDataStream
{
public:
DataStream(QIODevice *d) : QDataStream(d), _codec(1252) {}
DataStream(QIODevice *d) : QDataStream(d) {}
void setCodepage(quint16 codepage) {_codec = TextCodec(codepage);}

View File

@ -138,7 +138,7 @@ void LBLFile::clear()
}
Label LBLFile::str2label(const QVector<quint8> &str, bool capitalize,
bool convert) const
bool convert)
{
Shield::Type shieldType = Shield::None;
QByteArray label, shieldLabel;
@ -247,7 +247,7 @@ Label LBLFile::label6b(const SubFile *file, Handle &fileHdl, quint32 size,
}
Label LBLFile::label8b(const SubFile *file, Handle &fileHdl, quint32 size,
bool capitalize, bool convert) const
bool capitalize, bool convert)
{
QVector<quint8> str;
quint8 c;
@ -264,7 +264,7 @@ Label LBLFile::label8b(const SubFile *file, Handle &fileHdl, quint32 size,
}
Label LBLFile::labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl,
quint32 size, bool capitalize, bool convert) const
quint32 size, bool capitalize, bool convert)
{
QVector<quint8> str;
@ -305,7 +305,7 @@ Label LBLFile::labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl,
}
Label LBLFile::label(Handle &hdl, quint32 offset, bool poi, bool capitalize,
bool convert) const
bool convert)
{
quint32 labelOffset;
if (poi) {
@ -328,7 +328,7 @@ Label LBLFile::label(Handle &hdl, quint32 offset, bool poi, bool capitalize,
}
Label LBLFile::label(Handle &hdl, const SubFile *file, Handle &fileHdl,
quint32 size, bool capitalize, bool convert) const
quint32 size, bool capitalize, bool convert)
{
switch (_encoding) {
case 6:

View File

@ -30,9 +30,9 @@ public:
void clear();
Label label(Handle &hdl, quint32 offset, bool poi = false,
bool capitalize = true, bool convert = false) const;
bool capitalize = true, bool convert = false);
Label label(Handle &hdl, const SubFile *file, Handle &fileHdl,
quint32 size, bool capitalize = true, bool convert = false) const;
quint32 size, bool capitalize = true, bool convert = false);
quint8 imageIdSize() const {return _imgIdSize;}
QPixmap image(Handle &hdl, quint32 id) const;
@ -44,13 +44,13 @@ private:
};
Label str2label(const QVector<quint8> &str, bool capitalize,
bool convert) const;
bool convert);
Label label6b(const SubFile *file, Handle &fileHdl, quint32 size,
bool capitalize, bool convert) const;
Label label8b(const SubFile *file, Handle &fileHdl, quint32 size,
bool capitalize, bool convert) const;
bool capitalize, bool convert);
Label labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl,
quint32 size, bool capitalize, bool convert) const;
quint32 size, bool capitalize, bool convert);
bool loadRasterTable(Handle &hdl, quint32 offset, quint32 size,
quint32 recordSize);

View File

@ -329,7 +329,7 @@ bool NETFile::readShape(const NODFile *nod, SubFile::Handle &nodHdl,
}
bool NETFile::linkLabel(Handle &hdl, quint32 offset,
const LBLFile *lbl, Handle &lblHdl, Label &label) const
LBLFile *lbl, Handle &lblHdl, Label &label) const
{
if (!seek(hdl, offset))
return false;
@ -392,7 +392,7 @@ NETFile::~NETFile()
}
bool NETFile::link(const SubDiv *subdiv, quint32 shift, Handle &hdl,
const NODFile *nod, Handle &nodHdl2, Handle &nodHdl, const LBLFile *lbl,
const NODFile *nod, Handle &nodHdl2, Handle &nodHdl, LBLFile *lbl,
Handle &lblHdl, const NODFile::BlockInfo &blockInfo, quint8 linkId,
quint8 lineId, QList<MapData::Poly> *lines) const
{

View File

@ -30,13 +30,13 @@ public:
bool lblOffset(Handle &hdl, quint32 netOffset, quint32 &lblOffset) const;
bool link(const SubDiv *subdiv, quint32 shift, Handle &hdl,
const NODFile *nod, Handle &nodHdl2, Handle &nodHdl, const LBLFile *lbl,
const NODFile *nod, Handle &nodHdl2, Handle &nodHdl, LBLFile *lbl,
Handle &lblHdl, const NODFile::BlockInfo &blockInfo, quint8 linkId,
quint8 lineId, QList<MapData::Poly> *lines) const;
bool hasLinks() const {return (_links.size > 0);}
private:
bool linkLabel(Handle &hdl, quint32 offset, const LBLFile *lbl,
bool linkLabel(Handle &hdl, quint32 offset, LBLFile *lbl,
Handle &lblHdl, Label &label) const;
bool readShape(const NODFile *nod, SubFile::Handle &nodHdl,
NODFile::AdjacencyInfo &adj, BitStream4R &bs, const SubDiv *subdiv,

View File

@ -107,7 +107,7 @@ bool RGNFile::readObstructionInfo(Handle &hdl, quint8 flags, quint32 size,
return true;
}
bool RGNFile::readLabel(Handle &hdl, const LBLFile *lbl, Handle &lblHdl,
bool RGNFile::readLabel(Handle &hdl, LBLFile *lbl, Handle &lblHdl,
quint8 flags, quint32 size, MapData::Point *point) const
{
if (!(flags & 1))
@ -122,7 +122,7 @@ bool RGNFile::readLabel(Handle &hdl, const LBLFile *lbl, Handle &lblHdl,
}
bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
void *object, const LBLFile *lbl, Handle &lblHdl) const
void *object, LBLFile *lbl, Handle &lblHdl) const
{
quint8 flags;
quint32 rs = 0;
@ -257,7 +257,7 @@ void RGNFile::clear()
}
bool RGNFile::polyObjects(Handle &hdl, const SubDiv *subdiv,
SegmentType segmentType, const LBLFile *lbl, Handle &lblHdl, NETFile *net,
SegmentType segmentType, LBLFile *lbl, Handle &lblHdl, NETFile *net,
Handle &netHdl, QList<MapData::Poly> *polys) const
{
const SubDiv::Segment &segment = (segmentType == Line)
@ -340,7 +340,7 @@ bool RGNFile::polyObjects(Handle &hdl, const SubDiv *subdiv,
}
bool RGNFile::extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift,
SegmentType segmentType, const LBLFile *lbl, Handle &lblHdl,
SegmentType segmentType, LBLFile *lbl, Handle &lblHdl,
QList<MapData::Poly> *polys) const
{
quint32 labelPtr, len;
@ -457,7 +457,7 @@ bool RGNFile::extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift,
}
bool RGNFile::pointObjects(Handle &hdl, const SubDiv *subdiv,
SegmentType segmentType, const LBLFile *lbl, Handle &lblHdl,
SegmentType segmentType, LBLFile *lbl, Handle &lblHdl,
QList<MapData::Point> *points) const
{
const SubDiv::Segment &segment = (segmentType == IndexedPoint)
@ -502,7 +502,7 @@ bool RGNFile::pointObjects(Handle &hdl, const SubDiv *subdiv,
}
bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv,
const LBLFile *lbl, Handle &lblHdl, QList<MapData::Point> *points) const
LBLFile *lbl, Handle &lblHdl, QList<MapData::Point> *points) const
{
const SubDiv::Segment &segment = subdiv->extPoints();
@ -554,7 +554,7 @@ bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv,
bool RGNFile::links(Handle &hdl, const SubDiv *subdiv, quint32 shift,
const NETFile *net, Handle &netHdl, const NODFile *nod, Handle &nodHdl,
Handle &nodHdl2, const LBLFile *lbl, Handle &lblHdl,
Handle &nodHdl2, LBLFile *lbl, Handle &lblHdl,
QList<MapData::Poly> *lines) const
{
quint32 size, blockIndexId;

View File

@ -33,18 +33,18 @@ public:
bool load(Handle &hdl);
bool polyObjects(Handle &hdl, const SubDiv *subdiv, SegmentType segmentType,
const LBLFile *lbl, Handle &lblHdl, NETFile *net, Handle &netHdl,
LBLFile *lbl, Handle &lblHdl, NETFile *net, Handle &netHdl,
QList<MapData::Poly> *polys) const;
bool pointObjects(Handle &hdl, const SubDiv *subdiv, SegmentType segmentType,
const LBLFile *lbl, Handle &lblHdl, QList<MapData::Point> *points) const;
LBLFile *lbl, Handle &lblHdl, QList<MapData::Point> *points) const;
bool extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift,
SegmentType segmentType, const LBLFile *lbl, Handle &lblHdl,
SegmentType segmentType, LBLFile *lbl, Handle &lblHdl,
QList<MapData::Poly> *polys) const;
bool extPointObjects(Handle &hdl, const SubDiv *subdiv, const LBLFile *lbl,
bool extPointObjects(Handle &hdl, const SubDiv *subdiv, LBLFile *lbl,
Handle &lblHdl, QList<MapData::Point> *points) const;
bool links(Handle &hdl, const SubDiv *subdiv, quint32 shift,
const NETFile *net, Handle &netHdl, const NODFile *nod, Handle &nodHdl,
Handle &nodHdl2, const LBLFile *lbl, Handle &lblHdl,
Handle &nodHdl2, LBLFile *lbl, Handle &lblHdl,
QList<MapData::Poly> *lines) const;
bool subdivInit(Handle &hdl, SubDiv *subdiv) const;
@ -55,7 +55,7 @@ public:
private:
bool segments(Handle &hdl, SubDiv *subdiv, SubDiv::Segment seg[5]) const;
bool readClassFields(Handle &hdl, SegmentType segmentType, void *object,
const LBLFile *lbl, Handle &lblHdl) const;
LBLFile *lbl, Handle &lblHdl) const;
bool skipLclFields(Handle &hdl, const quint32 flags[3]) const;
bool skipGblFields(Handle &hdl, quint32 flags) const;
bool readRasterInfo(Handle &hdl, const LBLFile *lbl, quint32 size,
@ -64,7 +64,7 @@ private:
MapData::Point *point) const;
bool readObstructionInfo(Handle &hdl, quint8 flags, quint32 size,
MapData::Point *point) const;
bool readLabel(Handle &hdl, const LBLFile *lbl, Handle &lblHdl,
bool readLabel(Handle &hdl, LBLFile *lbl, Handle &lblHdl,
quint8 flags, quint32 size, MapData::Point *point) const;
HuffmanTable *_huffmanTable;

View File

@ -2,6 +2,7 @@
#define IMG_SHIELD_H
#include <QString>
#include <QDebug>
#include "common/hash.h"
#define FIRST_SHIELD Shield::USInterstate

View File

@ -9,7 +9,8 @@
class Ellipsoid
{
public:
Ellipsoid() : _radius(NAN), _flattening(NAN), _es(NAN), _b(NAN) {}
Ellipsoid()
: _radius(NAN), _flattening(NAN), _es(NAN), _e2s(NAN), _b(NAN) {}
Ellipsoid(double radius, double flattening);
double radius() const {return _radius;}

View File

@ -24,11 +24,6 @@ bool GmiFile::parse(QIODevice &device)
int width, height;
bool ok;
if (!device.open(QIODevice::ReadOnly)) {
_errorString = device.errorString();
return false;
}
while (!device.atEnd()) {
QByteArray line = device.readLine(4096);
@ -42,13 +37,13 @@ bool GmiFile::parse(QIODevice &device)
else if (ln == 3) {
width = line.toInt(&ok);
if (!ok || width <= 0) {
_errorString = "Invalid image width";
_errorString = line + ": invalid image width";
return false;
}
} else if (ln == 4) {
height = line.toInt(&ok);
if (!ok || height <= 0) {
_errorString = "Invalid image height";
_errorString = line + ": invalid image height";
return false;
}
_size = QSize(width, height);
@ -56,19 +51,34 @@ bool GmiFile::parse(QIODevice &device)
CalibrationPoint cp(calibrationPoint(line));
if (cp.isValid())
_points.append(cp);
else
else {
if (_points.size() < 2) {
_errorString = line + ": invalid calibration point";
return false;
} else
break;
}
}
ln++;
}
device.close();
if (ln < 6) {
_errorString = "Unexpected EOF";
return false;
}
return (_points.size() >= 2);
return true;
}
GmiFile::GmiFile(QIODevice &file)
GmiFile::GmiFile(QIODevice &file) : _valid(false)
{
if (!file.open(QIODevice::ReadOnly)) {
_errorString = file.errorString();
return;
}
_valid = parse(file);
file.close();
}