mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-02-22 10:20:47 +01:00
Merge branch 'master' into android-latest
This commit is contained in:
commit
ed0ab7f0aa
7
.github/workflows/linux.yml
vendored
7
.github/workflows/linux.yml
vendored
@ -8,7 +8,10 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: GPXSee
|
name: GPXSee
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-22.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
config: ['release', 'debug']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -19,6 +22,6 @@ jobs:
|
|||||||
- name: Create localization
|
- name: Create localization
|
||||||
run: lrelease gpxsee.pro
|
run: lrelease gpxsee.pro
|
||||||
- name: Configure build
|
- name: Configure build
|
||||||
run: qmake gpxsee.pro
|
run: qmake CONFIG+=${{ matrix.config }} gpxsee.pro
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: make -j2
|
run: make -j2
|
||||||
|
2
.github/workflows/osx.yml
vendored
2
.github/workflows/osx.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v4
|
uses: jurplel/install-qt-action@v4
|
||||||
with:
|
with:
|
||||||
version: '6.8.1'
|
version: '6.8.2'
|
||||||
modules: qtpositioning qtserialport qtimageformats
|
modules: qtpositioning qtserialport qtimageformats
|
||||||
- name: Create localization
|
- name: Create localization
|
||||||
run: lrelease gpxsee.pro
|
run: lrelease gpxsee.pro
|
||||||
|
@ -29,8 +29,8 @@ GPS log file formats.
|
|||||||
|
|
||||||
## Build
|
## Build
|
||||||
Build requirements:
|
Build requirements:
|
||||||
* Qt5 >= 5.11 or Qt6 >= 6.2 (Android builds require Qt6)
|
* Qt5 >= 5.15 or Qt6 >= 6.2 (Android builds require Qt6)
|
||||||
* C++11 or newer compiler (tested: msvc2019, gcc 7.5.0, clang/Apple LLVM version
|
* C++11 or newer compiler (tested: msvc2022, gcc 11, clang/Apple LLVM version
|
||||||
10.0.0)
|
10.0.0)
|
||||||
|
|
||||||
Build steps:
|
Build steps:
|
||||||
|
@ -5,7 +5,6 @@ unix:!macx:!android {
|
|||||||
}
|
}
|
||||||
VERSION = 13.36
|
VERSION = 13.36
|
||||||
|
|
||||||
|
|
||||||
QT += core \
|
QT += core \
|
||||||
gui \
|
gui \
|
||||||
gui-private \
|
gui-private \
|
||||||
@ -118,7 +117,7 @@ HEADERS += src/common/config.h \
|
|||||||
src/data/gpsdumpparser.h \
|
src/data/gpsdumpparser.h \
|
||||||
src/data/style.h \
|
src/data/style.h \
|
||||||
src/data/twonavparser.h \
|
src/data/twonavparser.h \
|
||||||
src/map/IMG/lights.h \
|
src/map/IMG/light.h \
|
||||||
src/map/downloader.h \
|
src/map/downloader.h \
|
||||||
src/map/demloader.h \
|
src/map/demloader.h \
|
||||||
src/map/ENC/attributes.h \
|
src/map/ENC/attributes.h \
|
||||||
|
@ -73,9 +73,7 @@ App::App(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
#if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
|
#if defined(Q_OS_WIN32) || defined(Q_OS_MAC)
|
||||||
QIcon::setThemeName(APP_NAME);
|
QIcon::setThemeName(APP_NAME);
|
||||||
#endif // Q_OS_WIN32 || Q_OS_MAC
|
#endif // Q_OS_WIN32 || Q_OS_MAC
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
|
||||||
QIcon::setFallbackThemeName(APP_NAME);
|
QIcon::setFallbackThemeName(APP_NAME);
|
||||||
#endif // QT 5.12
|
|
||||||
|
|
||||||
_gui = new GUI();
|
_gui = new GUI();
|
||||||
|
|
||||||
|
@ -25,15 +25,6 @@
|
|||||||
#define IW(item) ((item)->boundingRect().width())
|
#define IW(item) ((item)->boundingRect().width())
|
||||||
#define IH(item) ((item)->boundingRect().height())
|
#define IH(item) ((item)->boundingRect().height())
|
||||||
|
|
||||||
static inline QPoint POS(QWheelEvent *e)
|
|
||||||
{
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
return e->pos();
|
|
||||||
#else // QT 5.15
|
|
||||||
return e->position().toPoint();
|
|
||||||
#endif // QT 5.15
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline QPoint POS(QMouseEvent *e)
|
static inline QPoint POS(QMouseEvent *e)
|
||||||
{
|
{
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
@ -393,7 +384,7 @@ void GraphView::wheelEvent(QWheelEvent *e)
|
|||||||
return;
|
return;
|
||||||
_angleDelta = _angleDelta % (15 * 8);
|
_angleDelta = _angleDelta % (15 * 8);
|
||||||
|
|
||||||
QPointF pos = mapToScene(POS(e));
|
QPointF pos = mapToScene(e->position().toPoint());
|
||||||
QRectF gr(_grid->boundingRect());
|
QRectF gr(_grid->boundingRect());
|
||||||
QPointF r(pos.x() / gr.width(), pos.y() / gr.height());
|
QPointF r(pos.x() / gr.width(), pos.y() / gr.height());
|
||||||
|
|
||||||
@ -404,7 +395,8 @@ void GraphView::wheelEvent(QWheelEvent *e)
|
|||||||
QPointF npos(mapFromScene(QPointF(r.x() * ngr.width(),
|
QPointF npos(mapFromScene(QPointF(r.x() * ngr.width(),
|
||||||
r.y() * ngr.height())));
|
r.y() * ngr.height())));
|
||||||
QScrollBar *sb = horizontalScrollBar();
|
QScrollBar *sb = horizontalScrollBar();
|
||||||
sb->setSliderPosition(sb->sliderPosition() + npos.x() - POS(e).x());
|
sb->setSliderPosition(sb->sliderPosition() + npos.x()
|
||||||
|
- e->position().toPoint().x());
|
||||||
|
|
||||||
QGraphicsView::wheelEvent(e);
|
QGraphicsView::wheelEvent(e);
|
||||||
}
|
}
|
||||||
|
@ -2498,12 +2498,8 @@ QGeoPositionInfoSource *GUI::positionSource(const Options &options)
|
|||||||
{
|
{
|
||||||
QGeoPositionInfoSource *source;
|
QGeoPositionInfoSource *source;
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
|
||||||
source = QGeoPositionInfoSource::createSource(options.plugin, this);
|
|
||||||
#else // QT 5.14
|
|
||||||
source = QGeoPositionInfoSource::createSource(options.plugin,
|
source = QGeoPositionInfoSource::createSource(options.plugin,
|
||||||
options.pluginParams.value(options.plugin), this);
|
options.pluginParams.value(options.plugin), this);
|
||||||
#endif // QT 5.14
|
|
||||||
if (source)
|
if (source)
|
||||||
source->setPreferredPositioningMethods(
|
source->setPreferredPositioningMethods(
|
||||||
QGeoPositionInfoSource::SatellitePositioningMethods);
|
QGeoPositionInfoSource::SatellitePositioningMethods);
|
||||||
|
@ -638,11 +638,7 @@ void MapView::wheelEvent(QWheelEvent *event)
|
|||||||
return;
|
return;
|
||||||
_wheelDelta = _wheelDelta % (15 * 8);
|
_wheelDelta = _wheelDelta % (15 * 8);
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
zoom((delta > 0) ? 1 : -1, event->pos(), shift);
|
|
||||||
#else // QT 5.15
|
|
||||||
zoom((delta > 0) ? 1 : -1, event->position().toPoint(), shift);
|
zoom((delta > 0) ? 1 : -1, event->position().toPoint(), shift);
|
||||||
#endif // QT 5.15
|
|
||||||
|
|
||||||
/* Do not call QGraphicsView::wheelEvent() here as this would shift the
|
/* Do not call QGraphicsView::wheelEvent() here as this would shift the
|
||||||
view ! */
|
view ! */
|
||||||
|
@ -676,21 +676,17 @@ QWidget *OptionsDialog::createPositionPage()
|
|||||||
_positionPlugin = new QComboBox();
|
_positionPlugin = new QComboBox();
|
||||||
_positionPlugin->addItems(plugins);
|
_positionPlugin->addItems(plugins);
|
||||||
_positionPlugin->setCurrentIndex(_positionPlugin->findText(_options.plugin));
|
_positionPlugin->setCurrentIndex(_positionPlugin->findText(_options.plugin));
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
||||||
_pluginParameters = new PluginParameters(_positionPlugin->currentText(),
|
_pluginParameters = new PluginParameters(_positionPlugin->currentText(),
|
||||||
_options.pluginParams);
|
_options.pluginParams);
|
||||||
connect(_positionPlugin, &QComboBox::currentTextChanged, _pluginParameters,
|
connect(_positionPlugin, &QComboBox::currentTextChanged, _pluginParameters,
|
||||||
&PluginParameters::setPlugin);
|
&PluginParameters::setPlugin);
|
||||||
#endif // QT 5.14
|
|
||||||
|
|
||||||
QFormLayout *pluginLayout = new QFormLayout();
|
QFormLayout *pluginLayout = new QFormLayout();
|
||||||
pluginLayout->addRow(tr("Plugin:"), _positionPlugin);
|
pluginLayout->addRow(tr("Plugin:"), _positionPlugin);
|
||||||
|
|
||||||
QVBoxLayout *sourceLayout = new QVBoxLayout();
|
QVBoxLayout *sourceLayout = new QVBoxLayout();
|
||||||
sourceLayout->addLayout(pluginLayout);
|
sourceLayout->addLayout(pluginLayout);
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
||||||
sourceLayout->addWidget(_pluginParameters);
|
sourceLayout->addWidget(_pluginParameters);
|
||||||
#endif // QT 5.14
|
|
||||||
sourceLayout->addStretch();
|
sourceLayout->addStretch();
|
||||||
|
|
||||||
QWidget *sourceTab = new QWidget();
|
QWidget *sourceTab = new QWidget();
|
||||||
@ -1009,9 +1005,7 @@ void OptionsDialog::accept()
|
|||||||
_options.hillshadingZFactor = _hillshadingZFactor->value();
|
_options.hillshadingZFactor = _hillshadingZFactor->value();
|
||||||
|
|
||||||
_options.plugin = _positionPlugin->currentText();
|
_options.plugin = _positionPlugin->currentText();
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
||||||
_options.pluginParams = _pluginParameters->parameters();
|
_options.pluginParams = _pluginParameters->parameters();
|
||||||
#endif // QT 5.14
|
|
||||||
|
|
||||||
_options.useOpenGL = _useOpenGL->isChecked();
|
_options.useOpenGL = _useOpenGL->isChecked();
|
||||||
_options.enableHTTP2 = _enableHTTP2->isChecked();
|
_options.enableHTTP2 = _enableHTTP2->isChecked();
|
||||||
|
@ -193,9 +193,7 @@ private:
|
|||||||
QDoubleSpinBox *_hillshadingZFactor;
|
QDoubleSpinBox *_hillshadingZFactor;
|
||||||
// Position
|
// Position
|
||||||
QComboBox *_positionPlugin;
|
QComboBox *_positionPlugin;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
|
||||||
PluginParameters *_pluginParameters;
|
PluginParameters *_pluginParameters;
|
||||||
#endif // QT 5.14
|
|
||||||
// System
|
// System
|
||||||
QSpinBox *_pixmapCache;
|
QSpinBox *_pixmapCache;
|
||||||
QSpinBox *_demCache;
|
QSpinBox *_demCache;
|
||||||
|
@ -10,13 +10,6 @@
|
|||||||
#include "markeritem.h"
|
#include "markeritem.h"
|
||||||
#include "pathitem.h"
|
#include "pathitem.h"
|
||||||
|
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
#define INTERSECTS intersect
|
|
||||||
#else // QT 5.15
|
|
||||||
#define INTERSECTS intersects
|
|
||||||
#endif // QT 5.15
|
|
||||||
|
|
||||||
#define GEOGRAPHICAL_MILE 1855.3248
|
#define GEOGRAPHICAL_MILE 1855.3248
|
||||||
|
|
||||||
Units PathItem::_units = Metric;
|
Units PathItem::_units = Metric;
|
||||||
@ -79,14 +72,14 @@ bool PathItem::addSegment(const Coordinates &c1, const Coordinates &c2)
|
|||||||
QLineF l(QPointF(c1.lon(), c1.lat()), QPointF(c2.lon() + 360,
|
QLineF l(QPointF(c1.lon(), c1.lat()), QPointF(c2.lon() + 360,
|
||||||
c2.lat()));
|
c2.lat()));
|
||||||
QLineF dl(QPointF(180, -90), QPointF(180, 90));
|
QLineF dl(QPointF(180, -90), QPointF(180, 90));
|
||||||
l.INTERSECTS(dl, &p);
|
l.intersects(dl, &p);
|
||||||
_painterPath.lineTo(_map->ll2xy(Coordinates(180, p.y())));
|
_painterPath.lineTo(_map->ll2xy(Coordinates(180, p.y())));
|
||||||
_painterPath.moveTo(_map->ll2xy(Coordinates(-180, p.y())));
|
_painterPath.moveTo(_map->ll2xy(Coordinates(-180, p.y())));
|
||||||
} else {
|
} else {
|
||||||
QLineF l(QPointF(c1.lon(), c1.lat()), QPointF(c2.lon() - 360,
|
QLineF l(QPointF(c1.lon(), c1.lat()), QPointF(c2.lon() - 360,
|
||||||
c2.lat()));
|
c2.lat()));
|
||||||
QLineF dl(QPointF(-180, -90), QPointF(-180, 90));
|
QLineF dl(QPointF(-180, -90), QPointF(-180, 90));
|
||||||
l.INTERSECTS(dl, &p);
|
l.intersects(dl, &p);
|
||||||
_painterPath.lineTo(_map->ll2xy(Coordinates(-180, p.y())));
|
_painterPath.lineTo(_map->ll2xy(Coordinates(-180, p.y())));
|
||||||
_painterPath.moveTo(_map->ll2xy(Coordinates(180, p.y())));
|
_painterPath.moveTo(_map->ll2xy(Coordinates(180, p.y())));
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,6 @@
|
|||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
#include <QDesktopWidget>
|
|
||||||
#endif // QT 5.15
|
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
#include "thumbnail.h"
|
#include "thumbnail.h"
|
||||||
#include "flowlayout.h"
|
#include "flowlayout.h"
|
||||||
@ -184,11 +181,7 @@ bool PopupFrame::eventFilter(QObject *o, QEvent *ev)
|
|||||||
|
|
||||||
void PopupFrame::place(const QPoint &pos, QWidget *w)
|
void PopupFrame::place(const QPoint &pos, QWidget *w)
|
||||||
{
|
{
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
QRect screen = QApplication::desktop()->screenGeometry(w);
|
|
||||||
#else // QT 5.15
|
|
||||||
QRect screen = w->screen()->geometry();
|
QRect screen = w->screen()->geometry();
|
||||||
#endif // QT 5.15
|
|
||||||
QPoint p(pos.x() + 2, pos.y() + 16);
|
QPoint p(pos.x() + 2, pos.y() + 16);
|
||||||
|
|
||||||
if (p.x() + width() > screen.x() + screen.width())
|
if (p.x() + width() > screen.x() + screen.width())
|
||||||
|
@ -2,13 +2,6 @@
|
|||||||
#include "map/gcs.h"
|
#include "map/gcs.h"
|
||||||
#include "twonavparser.h"
|
#include "twonavparser.h"
|
||||||
|
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
|
||||||
#define SKIP_EMPTY QString::SkipEmptyParts
|
|
||||||
#else // Qt 5.14
|
|
||||||
#define SKIP_EMPTY Qt::SkipEmptyParts
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static double lon(const QString &str)
|
static double lon(const QString &str)
|
||||||
{
|
{
|
||||||
QStringList l(str.split(QChar(0xBA)));
|
QStringList l(str.split(QChar(0xBA)));
|
||||||
@ -123,7 +116,8 @@ bool TwoNavParser::parse(QFile *file, QList<TrackData> &tracks,
|
|||||||
}}
|
}}
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
{QStringList list(codec.toString(line).split(' ', SKIP_EMPTY));
|
{QStringList list(codec.toString(line).split(' ',
|
||||||
|
Qt::SkipEmptyParts));
|
||||||
if (list.size() < 4) {
|
if (list.size() < 4) {
|
||||||
_errorString = "Parse error";
|
_errorString = "Parse error";
|
||||||
return false;
|
return false;
|
||||||
@ -159,7 +153,8 @@ bool TwoNavParser::parse(QFile *file, QList<TrackData> &tracks,
|
|||||||
tracks.last().last().append(t);}
|
tracks.last().last().append(t);}
|
||||||
break;
|
break;
|
||||||
case 'W':
|
case 'W':
|
||||||
{QStringList list(codec.toString(line).split(' ', SKIP_EMPTY));
|
{QStringList list(codec.toString(line).split(' ',
|
||||||
|
Qt::SkipEmptyParts));
|
||||||
if (list.size() < 5) {
|
if (list.size() < 5) {
|
||||||
_errorString = "Parse error";
|
_errorString = "Parse error";
|
||||||
return false;
|
return false;
|
||||||
|
64
src/map/IMG/light.h
Normal file
64
src/map/IMG/light.h
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
#ifndef IMG_LIGHT_H
|
||||||
|
#define IMG_LIGHT_H
|
||||||
|
|
||||||
|
#include <QVector>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
namespace IMG {
|
||||||
|
|
||||||
|
class Light
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum Color {None, Red, Green, White, Blue, Yellow, Violet, Amber};
|
||||||
|
|
||||||
|
class Sector
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Sector() : _color(None), _angle(0), _range(0) {}
|
||||||
|
Sector(Color color, quint32 angle, quint32 range)
|
||||||
|
: _color(color), _angle(angle), _range(range) {}
|
||||||
|
|
||||||
|
Color color() const {return _color;}
|
||||||
|
quint32 angle() const {return _angle;}
|
||||||
|
quint32 range() const {return _range;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Color _color;
|
||||||
|
quint32 _angle;
|
||||||
|
quint32 _range;
|
||||||
|
};
|
||||||
|
|
||||||
|
Light() : _color(None), _range(0) {}
|
||||||
|
Light(Color color, quint32 range) : _color(color), _range(range) {}
|
||||||
|
Light(const QVector<Sector> §ors)
|
||||||
|
: _color(None), _range(0), _sectors(sectors) {}
|
||||||
|
|
||||||
|
Color color() const {return _color;}
|
||||||
|
quint32 range() const {return _range;}
|
||||||
|
const QVector<Sector> §ors() const {return _sectors;}
|
||||||
|
|
||||||
|
private:
|
||||||
|
Color _color;
|
||||||
|
quint32 _range;
|
||||||
|
QVector<Sector> _sectors;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_DEBUG
|
||||||
|
inline QDebug operator<<(QDebug dbg, const IMG::Light::Sector §or)
|
||||||
|
{
|
||||||
|
dbg.nospace() << "Sector(" << sector.color() << ", " << sector.angle()
|
||||||
|
<< ", " << sector.range() << ")";
|
||||||
|
return dbg.space();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QDebug operator<<(QDebug dbg, const IMG::Light &light)
|
||||||
|
{
|
||||||
|
dbg.nospace() << "Light(" << light.color() << ", " << light.range() << ", "
|
||||||
|
<< light.sectors() << ")";
|
||||||
|
return dbg.space();
|
||||||
|
}
|
||||||
|
#endif // QT_NO_DEBUG
|
||||||
|
|
||||||
|
#endif // IMG_LIGHT_H
|
@ -1,52 +0,0 @@
|
|||||||
#ifndef IMG_LIGHTS_H
|
|
||||||
#define IMG_LIGHTS_H
|
|
||||||
|
|
||||||
#include <QVector>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace IMG {
|
|
||||||
|
|
||||||
class Lights
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum Color {None, Red, Green, White, Blue, Yellow, Violet, Amber};
|
|
||||||
|
|
||||||
struct Sector
|
|
||||||
{
|
|
||||||
Sector() : color(None), angle(0), range(0) {}
|
|
||||||
Sector(Color color, quint32 angle, quint32 range)
|
|
||||||
: color(color), angle(angle), range(range) {}
|
|
||||||
|
|
||||||
Color color;
|
|
||||||
quint32 angle;
|
|
||||||
quint32 range;
|
|
||||||
};
|
|
||||||
|
|
||||||
Lights() : color(None), range(0) {}
|
|
||||||
bool isSectorLight() const
|
|
||||||
{return ((color && range > 6) || !sectors.isEmpty());}
|
|
||||||
|
|
||||||
Color color;
|
|
||||||
quint32 range;
|
|
||||||
QVector<Sector> sectors;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
|
||||||
inline QDebug operator<<(QDebug dbg, const IMG::Lights::Sector §or)
|
|
||||||
{
|
|
||||||
dbg.nospace() << "Sector(" << sector.color << ", " << sector.angle
|
|
||||||
<< ", " << sector.range << ")";
|
|
||||||
return dbg.space();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QDebug operator<<(QDebug dbg, const IMG::Lights &lights)
|
|
||||||
{
|
|
||||||
dbg.nospace() << "Lights(" << lights.color << ", " << lights.range << ", "
|
|
||||||
<< lights.sectors << ")";
|
|
||||||
return dbg.space();
|
|
||||||
}
|
|
||||||
#endif // QT_NO_DEBUG
|
|
||||||
|
|
||||||
#endif // IMG_LIGHTS_H
|
|
@ -14,7 +14,7 @@
|
|||||||
#include "map/matrix.h"
|
#include "map/matrix.h"
|
||||||
#include "label.h"
|
#include "label.h"
|
||||||
#include "raster.h"
|
#include "raster.h"
|
||||||
#include "lights.h"
|
#include "light.h"
|
||||||
#include "zoom.h"
|
#include "zoom.h"
|
||||||
|
|
||||||
namespace IMG {
|
namespace IMG {
|
||||||
@ -56,7 +56,7 @@ public:
|
|||||||
|
|
||||||
Coordinates coordinates;
|
Coordinates coordinates;
|
||||||
Label label;
|
Label label;
|
||||||
Lights lights;
|
QVector<Light> lights;
|
||||||
quint64 id;
|
quint64 id;
|
||||||
quint32 type;
|
quint32 type;
|
||||||
quint32 flags;
|
quint32 flags;
|
||||||
|
@ -19,6 +19,7 @@ using namespace IMG;
|
|||||||
#define TEXT_EXTENT 160
|
#define TEXT_EXTENT 160
|
||||||
#define ICON_PADDING 2
|
#define ICON_PADDING 2
|
||||||
#define RANGE_FACTOR 4
|
#define RANGE_FACTOR 4
|
||||||
|
#define RANGE_MIN 6
|
||||||
#define ROAD 0
|
#define ROAD 0
|
||||||
#define WATER 1
|
#define WATER 1
|
||||||
|
|
||||||
@ -228,8 +229,8 @@ void RasterTile::drawTextItems(QPainter *painter,
|
|||||||
|
|
||||||
static QRect lightRect(const QPoint &pos, quint32 range)
|
static QRect lightRect(const QPoint &pos, quint32 range)
|
||||||
{
|
{
|
||||||
return QRect(pos.x() - range * RANGE_FACTOR, pos.y() - range * RANGE_FACTOR,
|
quint32 r = qMin(range * RANGE_FACTOR, (quint32)TEXT_EXTENT);
|
||||||
2*range * RANGE_FACTOR, 2*range * RANGE_FACTOR);
|
return QRect(pos.x() - r, pos.y() - r, 2 * r, 2 * r);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RasterTile::drawSectorLights(QPainter *painter,
|
void RasterTile::drawSectorLights(QPainter *painter,
|
||||||
@ -239,32 +240,37 @@ void RasterTile::drawSectorLights(QPainter *painter,
|
|||||||
const MapData::Point *p = lights.at(i);
|
const MapData::Point *p = lights.at(i);
|
||||||
QPoint pos(p->coordinates.lon(), p->coordinates.lat());
|
QPoint pos(p->coordinates.lon(), p->coordinates.lat());
|
||||||
|
|
||||||
if (p->lights.sectors.size()) {
|
for (int j = 0; j < p->lights.size(); j++) {
|
||||||
for (int j = 0; j < p->lights.sectors.size(); j++) {
|
const Light &l = p->lights.at(j);
|
||||||
const Lights::Sector &start = p->lights.sectors.at(j);
|
|
||||||
const Lights::Sector &end = (j == p->lights.sectors.size() - 1)
|
|
||||||
? p->lights.sectors.at(0) : p->lights.sectors.at(j+1);
|
|
||||||
|
|
||||||
if (start.color) {
|
if (l.sectors().size()) {
|
||||||
double a1 = -(end.angle / 10.0 + 90.0);
|
for (int k = 0; k < l.sectors().size(); k++) {
|
||||||
double a2 = -(start.angle / 10.0 + 90.0);
|
const Light::Sector &start = l.sectors().at(k);
|
||||||
|
const Light::Sector &end = (k == l.sectors().size() - 1)
|
||||||
|
? l.sectors().at(0) : l.sectors().at(k+1);
|
||||||
|
|
||||||
|
if (start.color()) {
|
||||||
|
double a1 = -(end.angle() / 10.0 + 90.0);
|
||||||
|
double a2 = -(start.angle() / 10.0 + 90.0);
|
||||||
if (a1 > a2)
|
if (a1 > a2)
|
||||||
a2 += 360;
|
a2 += 360;
|
||||||
double as = (a2 - a1);
|
double as = (a2 - a1);
|
||||||
if (as == 0)
|
if (as == 0)
|
||||||
as = 360;
|
as = 360;
|
||||||
|
|
||||||
QRect rect(lightRect(pos, start.range ? start.range : 6));
|
QRect rect(lightRect(pos, start.range()
|
||||||
|
? start.range() : RANGE_MIN));
|
||||||
|
|
||||||
painter->setPen(QPen(Qt::black, 6, Qt::SolidLine,
|
painter->setPen(QPen(Qt::black, 6, Qt::SolidLine,
|
||||||
Qt::FlatCap));
|
Qt::FlatCap));
|
||||||
painter->drawArc(rect, a1 * 16, as * 16);
|
painter->drawArc(rect, a1 * 16, as * 16);
|
||||||
painter->setPen(QPen(Style::color(start.color), 4,
|
painter->setPen(QPen(Style::color(start.color()), 4,
|
||||||
Qt::SolidLine, Qt::FlatCap));
|
Qt::SolidLine, Qt::FlatCap));
|
||||||
painter->drawArc(rect, a1 * 16, as * 16);
|
painter->drawArc(rect, a1 * 16, as * 16);
|
||||||
|
|
||||||
if (a2 - a1 != 0) {
|
if (a2 - a1 != 0) {
|
||||||
QLineF ln(pos, QPointF(pos.x() + rect.width(), pos.y()));
|
QLineF ln(pos, QPointF(pos.x() + rect.width(),
|
||||||
|
pos.y()));
|
||||||
ln.setAngle(a1);
|
ln.setAngle(a1);
|
||||||
painter->setPen(QPen(Qt::black, 1, Qt::DashLine));
|
painter->setPen(QPen(Qt::black, 1, Qt::DashLine));
|
||||||
painter->drawLine(ln);
|
painter->drawLine(ln);
|
||||||
@ -273,16 +279,17 @@ void RasterTile::drawSectorLights(QPainter *painter,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (l.range() > RANGE_MIN) {
|
||||||
QRect rect(lightRect(pos, p->lights.range));
|
QRect rect(lightRect(pos, l.range()));
|
||||||
|
|
||||||
painter->setPen(QPen(Qt::black, 6, Qt::SolidLine, Qt::FlatCap));
|
painter->setPen(QPen(Qt::black, 6, Qt::SolidLine, Qt::FlatCap));
|
||||||
painter->drawArc(rect, 0, 360 * 16);
|
painter->drawArc(rect, 0, 360 * 16);
|
||||||
painter->setPen(QPen(Style::color(p->lights.color), 4,
|
painter->setPen(QPen(Style::color(l.color()), 4, Qt::SolidLine,
|
||||||
Qt::SolidLine, Qt::FlatCap));
|
Qt::FlatCap));
|
||||||
painter->drawArc(rect, 0, 360 * 16);
|
painter->drawArc(rect, 0, 360 * 16);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void removeDuplicitLabel(QList<TextItem *> &labels, const QString &text,
|
static void removeDuplicitLabel(QList<TextItem *> &labels, const QString &text,
|
||||||
@ -456,6 +463,17 @@ void RasterTile::processShields(const QList<MapData::Poly> &lines,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool showAsSector(const QVector<Light> &lights)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < lights.size(); i++) {
|
||||||
|
const Light &l = lights.at(i);
|
||||||
|
if ((l.color() && l.range() > RANGE_MIN) || !l.sectors().isEmpty())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void RasterTile::processPoints(QList<MapData::Point> &points,
|
void RasterTile::processPoints(QList<MapData::Point> &points,
|
||||||
QList<TextItem*> &textItems, QList<const MapData::Point*> &lights)
|
QList<TextItem*> &textItems, QList<const MapData::Point*> &lights)
|
||||||
{
|
{
|
||||||
@ -466,8 +484,9 @@ void RasterTile::processPoints(QList<MapData::Point> &points,
|
|||||||
const Style *style = _data->style();
|
const Style *style = _data->style();
|
||||||
const Style::Point &ps = style->point(point.type);
|
const Style::Point &ps = style->point(point.type);
|
||||||
bool poi = Style::isPOI(point.type);
|
bool poi = Style::isPOI(point.type);
|
||||||
|
bool sl = showAsSector(point.lights);
|
||||||
|
|
||||||
if (point.lights.isSectorLight())
|
if (sl)
|
||||||
lights.append(&point);
|
lights.append(&point);
|
||||||
|
|
||||||
const QString *label = point.label.text().isEmpty()
|
const QString *label = point.label.text().isEmpty()
|
||||||
@ -490,12 +509,16 @@ void RasterTile::processPoints(QList<MapData::Point> &points,
|
|||||||
|
|
||||||
TextPointItem *item = new TextPointItem(pos + offset, label, fnt, img,
|
TextPointItem *item = new TextPointItem(pos + offset, label, fnt, img,
|
||||||
color, hcolor, 0, ICON_PADDING);
|
color, hcolor, 0, ICON_PADDING);
|
||||||
if (item->isValid() && (point.lights.isSectorLight()
|
if (item->isValid() && (sl || !item->collides(textItems))) {
|
||||||
|| !item->collides(textItems))) {
|
|
||||||
textItems.append(item);
|
textItems.append(item);
|
||||||
if (point.lights.color && !point.lights.isSectorLight())
|
for (int j = 0; j < point.lights.size(); j++) {
|
||||||
|
const Light &l = point.lights.at(j);
|
||||||
|
if (l.color() && l.range() <= RANGE_MIN) {
|
||||||
textItems.append(new TextPointItem(pos + style->lightOffset(),
|
textItems.append(new TextPointItem(pos + style->lightOffset(),
|
||||||
0, 0, style->light(point.lights.color), 0, 0, 0, 0));
|
0, 0, style->light(l.color()), 0, 0, 0, 0));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ using namespace Garmin;
|
|||||||
using namespace IMG;
|
using namespace IMG;
|
||||||
|
|
||||||
#define MASK(bits) ((1U << (bits)) - 1U)
|
#define MASK(bits) ((1U << (bits)) - 1U)
|
||||||
|
#define COLOR(color) static_cast<Light::Color>(color)
|
||||||
|
|
||||||
static quint64 pointId(const QPoint &pos, quint32 type, const QString &label)
|
static quint64 pointId(const QPoint &pos, quint32 type, const QString &label)
|
||||||
{
|
{
|
||||||
@ -124,7 +125,7 @@ bool RGNFile::readBuoyInfo(Handle &hdl, quint8 flags, quint32 size,
|
|||||||
lc = (val >> 6) & 7;
|
lc = (val >> 6) & 7;
|
||||||
|
|
||||||
if (lc)
|
if (lc)
|
||||||
point->lights.color = (Lights::Color)lc;
|
point->lights.append(Light(COLOR(lc), 0));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -190,6 +191,7 @@ bool RGNFile::readLightInfo(Handle &hdl, quint8 flags, quint32 size,
|
|||||||
if (flags1 & 0x800) {
|
if (flags1 & 0x800) {
|
||||||
quint16 la;
|
quint16 la;
|
||||||
quint8 cf, range = 0;
|
quint8 cf, range = 0;
|
||||||
|
QVector<Light::Sector> sectors;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (!(size >= 2 && readUInt16(hdl, la)))
|
if (!(size >= 2 && readUInt16(hdl, la)))
|
||||||
@ -197,14 +199,16 @@ bool RGNFile::readLightInfo(Handle &hdl, quint8 flags, quint32 size,
|
|||||||
size -= 2;
|
size -= 2;
|
||||||
|
|
||||||
cf = la >> 8;
|
cf = la >> 8;
|
||||||
Lights::Color c = (Lights::Color)(cf >> 4 & 7);
|
Light::Color c = COLOR(cf >> 4 & 7);
|
||||||
if (c) {
|
if (c) {
|
||||||
if (!(size >= 1 && readUInt8(hdl, range)))
|
if (!(size >= 1 && readUInt8(hdl, range)))
|
||||||
return false;
|
return false;
|
||||||
size--;
|
size--;
|
||||||
}
|
}
|
||||||
point->lights.sectors.append(Lights::Sector(c, la & 0xfff, range));
|
sectors.append(Light::Sector(c, la & 0xfff, range));
|
||||||
} while (!(cf >> 7));
|
} while (!(cf >> 7));
|
||||||
|
|
||||||
|
point->lights.append(Light(sectors));
|
||||||
} else {
|
} else {
|
||||||
quint8 v1, v2, range;
|
quint8 v1, v2, range;
|
||||||
|
|
||||||
@ -220,8 +224,7 @@ bool RGNFile::readLightInfo(Handle &hdl, quint8 flags, quint32 size,
|
|||||||
range += v2;
|
range += v2;
|
||||||
}
|
}
|
||||||
|
|
||||||
point->lights.color = (Lights::Color)(v1 >> 5);
|
point->lights.append(Light(COLOR(v1 >> 5), range));
|
||||||
point->lights.range = range;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -289,8 +292,176 @@ bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
|
|||||||
return seek(hdl, off + rs);
|
return seek(hdl, off + rs);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RGNFile::skipLclFields(Handle &hdl, const quint32 flags[3]) const
|
bool RGNFile::readLclSectors(Handle &hdl, quint32 &size, quint32 flags,
|
||||||
|
Light &light) const
|
||||||
{
|
{
|
||||||
|
quint32 unused, cnt = flags & 0x1f;
|
||||||
|
QVector<Light::Sector> sectors;
|
||||||
|
|
||||||
|
for (quint32 j = 0; j < cnt; j++) {
|
||||||
|
quint32 cf, range = 0;
|
||||||
|
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, cf)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
if (cf >> 6) {
|
||||||
|
if (!(size >= (cf >> 6) && readVUInt32(hdl, cf >> 6, range)))
|
||||||
|
return false;
|
||||||
|
size -= (cf >> 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cnt > 1) {
|
||||||
|
quint32 angle;
|
||||||
|
|
||||||
|
if (!(size >= 2 && readUInt16(hdl, angle)))
|
||||||
|
return false;
|
||||||
|
size -= 2;
|
||||||
|
if ((flags >> 0x13) & 1) {
|
||||||
|
quint32 sflags;
|
||||||
|
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, sflags)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
if (0x3f < sflags) {
|
||||||
|
if (sflags & 0x80) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
unused |= (sflags & 0x40) << 2;
|
||||||
|
} else {
|
||||||
|
if (!(size >= 2 && readUInt16(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sectors.append(Light::Sector(COLOR(cf & 0x7), angle, range));
|
||||||
|
} else {
|
||||||
|
light = Light(COLOR(cf & 0x7), range);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
light = Light(sectors);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RGNFile::readLclLights(Handle &hdl, quint32 &size, quint32 lights,
|
||||||
|
MapData::Point *point) const
|
||||||
|
{
|
||||||
|
quint32 unused;
|
||||||
|
|
||||||
|
for (quint32 i = 0; i < lights; i++) {
|
||||||
|
quint32 fs, vs, flags;
|
||||||
|
Light light;
|
||||||
|
|
||||||
|
if (!(readVUInt32(hdl, fs, &vs) && size >= vs))
|
||||||
|
return false;
|
||||||
|
size -= vs;
|
||||||
|
if (!(size >= 4 && readUInt32(hdl, flags)))
|
||||||
|
return false;
|
||||||
|
size -= 4;
|
||||||
|
if (flags >> 0x11 & 3) {
|
||||||
|
if (!(size >= (flags >> 0x11 & 3)
|
||||||
|
&& readVUInt32(hdl, flags >> 0x11 & 3, unused)))
|
||||||
|
return false;
|
||||||
|
size -= (flags >> 0x11 & 3);
|
||||||
|
}
|
||||||
|
if (flags & 0x3000) {
|
||||||
|
if (flags & 0x2000) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
unused |= (flags >> 4) & 0x100;
|
||||||
|
} else {
|
||||||
|
if (!(size >= 2 && readUInt16(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (flags & 0x100000) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
if (unused & 0x80) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!readLclSectors(hdl, size, flags, light))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
point->lights.append(light);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RGNFile::readLclNavaid(Handle &hdl, quint32 size,
|
||||||
|
MapData::Point *point) const
|
||||||
|
{
|
||||||
|
quint32 unused, flags;
|
||||||
|
|
||||||
|
// Discard the class lights info if any (marine points may have both!)
|
||||||
|
point->lights.clear();
|
||||||
|
|
||||||
|
if (!(size >= 4 && readUInt32(hdl, flags)))
|
||||||
|
return false;
|
||||||
|
size -= 4;
|
||||||
|
if (flags & 1) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
}
|
||||||
|
if (flags & 2) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
}
|
||||||
|
if (flags & 4) {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
}
|
||||||
|
if (flags & 8) {
|
||||||
|
if (!(size >= 3 && readUInt24(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 3;
|
||||||
|
}
|
||||||
|
if (flags & 0x10) {
|
||||||
|
if (!(size >= 3 && readUInt24(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 3;
|
||||||
|
}
|
||||||
|
if (flags & 0x20) {
|
||||||
|
if (!(size >= 3 && readUInt24(hdl, unused)))
|
||||||
|
return false;
|
||||||
|
size -= 3;
|
||||||
|
}
|
||||||
|
if (flags & 0x200) {
|
||||||
|
quint8 b;
|
||||||
|
do {
|
||||||
|
if (!(size >= 1 && readUInt8(hdl, b)))
|
||||||
|
return false;
|
||||||
|
size--;
|
||||||
|
} while (b & 0x80);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!readLclLights(hdl, size, (flags >> 6) & 7, point))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (size == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RGNFile::readLclFields(Handle &hdl, const quint32 flags[3],
|
||||||
|
SegmentType segmentType, void *object) const
|
||||||
|
{
|
||||||
|
MapData::Point *point = (segmentType == Point)
|
||||||
|
? (MapData::Point *) object : 0;
|
||||||
quint32 bitfield = 0xFFFFFFFF;
|
quint32 bitfield = 0xFFFFFFFF;
|
||||||
|
|
||||||
if (flags[0] & 0x20000000)
|
if (flags[0] & 0x20000000)
|
||||||
@ -302,14 +473,20 @@ bool RGNFile::skipLclFields(Handle &hdl, const quint32 flags[3]) const
|
|||||||
if (bitfield & 1) {
|
if (bitfield & 1) {
|
||||||
quint32 m = flags[(j >> 4) + 1] >> ((j * 2) & 0x1e) & 3;
|
quint32 m = flags[(j >> 4) + 1] >> ((j * 2) & 0x1e) & 3;
|
||||||
|
|
||||||
quint32 skip = 0;
|
quint32 size = 0;
|
||||||
if (m == 3) {
|
if (m == 3) {
|
||||||
if (!readVUInt32(hdl, skip))
|
if (!readVUInt32(hdl, size))
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else
|
||||||
skip = m + 1;
|
size = m + 1;
|
||||||
if (!seek(hdl, pos(hdl) + skip))
|
|
||||||
|
if (i == 2 && point) {
|
||||||
|
if (!readLclNavaid(hdl, size, point))
|
||||||
return false;
|
return false;
|
||||||
|
} else {
|
||||||
|
if (!seek(hdl, pos(hdl) + size))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bitfield >>= 1;
|
bitfield >>= 1;
|
||||||
j++;
|
j++;
|
||||||
@ -563,8 +740,8 @@ bool RGNFile::extPolyObjects(Handle &hdl, const SubDiv *subdiv, quint32 shift,
|
|||||||
if (subtype & 0x80 && !readClassFields(hdl, segmentType, &poly, lbl,
|
if (subtype & 0x80 && !readClassFields(hdl, segmentType, &poly, lbl,
|
||||||
lblHdl))
|
lblHdl))
|
||||||
return false;
|
return false;
|
||||||
if (subtype & 0x40 && !skipLclFields(hdl, segmentType == Line
|
if (subtype & 0x40 && !readLclFields(hdl, segmentType == Line
|
||||||
? _linesLclFlags : _polygonsLclFlags))
|
? _linesLclFlags : _polygonsLclFlags, segmentType, &poly))
|
||||||
return false;
|
return false;
|
||||||
quint32 gblFlags = (segmentType == Line)
|
quint32 gblFlags = (segmentType == Line)
|
||||||
? _linesGblFlags : _polygonsGblFlags;
|
? _linesGblFlags : _polygonsGblFlags;
|
||||||
@ -654,7 +831,7 @@ bool RGNFile::extPointObjects(Handle &hdl, const SubDiv *subdiv,
|
|||||||
return false;
|
return false;
|
||||||
if (subtype & 0x80 && !readClassFields(hdl, Point, &point, lbl, lblHdl))
|
if (subtype & 0x80 && !readClassFields(hdl, Point, &point, lbl, lblHdl))
|
||||||
return false;
|
return false;
|
||||||
if (subtype & 0x40 && !skipLclFields(hdl, _pointsLclFlags))
|
if (subtype & 0x40 && !readLclFields(hdl, _pointsLclFlags, Point, &point))
|
||||||
return false;
|
return false;
|
||||||
if (_pointsGblFlags && !skipGblFields(hdl, _pointsGblFlags))
|
if (_pointsGblFlags && !skipGblFields(hdl, _pointsGblFlags))
|
||||||
return false;
|
return false;
|
||||||
|
@ -56,7 +56,8 @@ private:
|
|||||||
bool segments(Handle &hdl, SubDiv *subdiv, SubDiv::Segment seg[5]) const;
|
bool segments(Handle &hdl, SubDiv *subdiv, SubDiv::Segment seg[5]) const;
|
||||||
bool readClassFields(Handle &hdl, SegmentType segmentType, void *object,
|
bool readClassFields(Handle &hdl, SegmentType segmentType, void *object,
|
||||||
LBLFile *lbl, Handle &lblHdl) const;
|
LBLFile *lbl, Handle &lblHdl) const;
|
||||||
bool skipLclFields(Handle &hdl, const quint32 flags[3]) const;
|
bool readLclFields(Handle &hdl, const quint32 flags[3],
|
||||||
|
SegmentType segmentType, void *object) const;
|
||||||
bool skipGblFields(Handle &hdl, quint32 flags) const;
|
bool skipGblFields(Handle &hdl, quint32 flags) const;
|
||||||
bool readRasterInfo(Handle &hdl, const LBLFile *lbl, quint32 size,
|
bool readRasterInfo(Handle &hdl, const LBLFile *lbl, quint32 size,
|
||||||
MapData::Poly *poly) const;
|
MapData::Poly *poly) const;
|
||||||
@ -70,6 +71,12 @@ private:
|
|||||||
MapData::Point *point) const;
|
MapData::Point *point) const;
|
||||||
bool readLabel(Handle &hdl, LBLFile *lbl, Handle &lblHdl,
|
bool readLabel(Handle &hdl, LBLFile *lbl, Handle &lblHdl,
|
||||||
quint8 flags, quint32 size, MapData::Point *point) const;
|
quint8 flags, quint32 size, MapData::Point *point) const;
|
||||||
|
bool readLclNavaid(Handle &hdl, quint32 size,
|
||||||
|
MapData::Point *point) const;
|
||||||
|
bool readLclSectors(Handle &hdl, quint32 &size, quint32 flags,
|
||||||
|
Light &light) const;
|
||||||
|
bool readLclLights(Handle &hdl, quint32 &size, quint32 lights,
|
||||||
|
MapData::Point *point) const;
|
||||||
|
|
||||||
HuffmanTable *_huffmanTable;
|
HuffmanTable *_huffmanTable;
|
||||||
Section _base, _dict, _polygons, _lines, _points;
|
Section _base, _dict, _polygons, _lines, _points;
|
||||||
|
@ -323,6 +323,8 @@ void Style::defaultPolygonStyle()
|
|||||||
Qt::FDiagPattern));
|
Qt::FDiagPattern));
|
||||||
_polygons[0x10503] = Polygon(QBrush(QColor(0xff, 0x40, 0x40),
|
_polygons[0x10503] = Polygon(QBrush(QColor(0xff, 0x40, 0x40),
|
||||||
Qt::FDiagPattern));
|
Qt::FDiagPattern));
|
||||||
|
_polygons[0x10504] = Polygon(QBrush(QColor(0xff, 0x40, 0x40),
|
||||||
|
Qt::FDiagPattern));
|
||||||
_polygons[0x10601] = Polygon(QBrush(QColor(0xaa, 0xaa, 0xaa)));
|
_polygons[0x10601] = Polygon(QBrush(QColor(0xaa, 0xaa, 0xaa)));
|
||||||
_polygons[0x1060a] = Polygon(QBrush(QColor(0xfc, 0xb4, 0xfc)));
|
_polygons[0x1060a] = Polygon(QBrush(QColor(0xfc, 0xb4, 0xfc)));
|
||||||
_polygons[0x10614] = Polygon(QBrush(QColor(0xff, 0xff, 0xff)));
|
_polygons[0x10614] = Polygon(QBrush(QColor(0xff, 0xff, 0xff)));
|
||||||
@ -348,7 +350,8 @@ void Style::defaultPolygonStyle()
|
|||||||
<< TYPE(0x0a) << 0x10907 << TYPE(0x0b) << 0x10908 << TYPE(0x0c) << 0x10909
|
<< TYPE(0x0a) << 0x10907 << TYPE(0x0b) << 0x10908 << TYPE(0x0c) << 0x10909
|
||||||
<< TYPE(0x26) << TYPE(0x0d) << 0x1090a << TYPE(0x0e) << 0x1090b << TYPE(0x0f)
|
<< TYPE(0x26) << TYPE(0x0d) << 0x1090a << TYPE(0x0e) << 0x1090b << TYPE(0x0f)
|
||||||
<< TYPE(0x10) << TYPE(0x11) << TYPE(0x12) << TYPE(0x19) << 0x1090d
|
<< TYPE(0x10) << TYPE(0x11) << TYPE(0x12) << TYPE(0x19) << 0x1090d
|
||||||
<< TYPE(0x13) << 0x10900 << 0x10613 << 0x10409 << 0x10503 << 0x1060a;
|
<< TYPE(0x13) << 0x10900 << 0x10613 << 0x10409 << 0x10503 << 0x10504
|
||||||
|
<< 0x1060a;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Style::defaultLineStyle(qreal ratio)
|
void Style::defaultLineStyle(qreal ratio)
|
||||||
@ -464,7 +467,9 @@ void Style::defaultLineStyle(qreal ratio)
|
|||||||
_lines[0x10409] = Line(QPen(QColor(0, 0, 0), 1, Qt::DotLine));
|
_lines[0x10409] = Line(QPen(QColor(0, 0, 0), 1, Qt::DotLine));
|
||||||
_lines[0x10501] = Line(QImage(":/marine/noanchor-line.png"));
|
_lines[0x10501] = Line(QImage(":/marine/noanchor-line.png"));
|
||||||
_lines[0x10503] = Line(QPen(QColor(0xe7, 0x28, 0xe7), 1, Qt::DashLine));
|
_lines[0x10503] = Line(QPen(QColor(0xe7, 0x28, 0xe7), 1, Qt::DashLine));
|
||||||
|
_lines[0x10504] = Line(QPen(QColor(0xe7, 0x28, 0xe7), 1, Qt::DashLine));
|
||||||
_lines[0x10505] = Line(QImage(":/marine/safety-zone-line.png"));
|
_lines[0x10505] = Line(QImage(":/marine/safety-zone-line.png"));
|
||||||
|
_lines[0x10506] = Line(QImage(":/marine/nature-reserve-line.png"));
|
||||||
_lines[0x10507] = Line(QPen(QColor(0xe7, 0x28, 0xe7), 1, Qt::DashLine));
|
_lines[0x10507] = Line(QPen(QColor(0xe7, 0x28, 0xe7), 1, Qt::DashLine));
|
||||||
_lines[0x10601] = Line(QPen(QColor(0, 0, 0), 1, Qt::SolidLine));
|
_lines[0x10601] = Line(QPen(QColor(0, 0, 0), 1, Qt::SolidLine));
|
||||||
_lines[0x10603] = Line(QPen(QColor(0xe7, 0x28, 0xe7), 2, Qt::DashDotLine));
|
_lines[0x10603] = Line(QPen(QColor(0xe7, 0x28, 0xe7), 2, Qt::DashDotLine));
|
||||||
@ -1377,34 +1382,34 @@ const QFont *Style::font(Style::FontSize size, Style::FontSize defaultSize) cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const QImage *Style::light(Lights::Color color) const
|
const QImage *Style::light(Light::Color color) const
|
||||||
{
|
{
|
||||||
switch (color) {
|
switch (color) {
|
||||||
case Lights::Red:
|
case Light::Red:
|
||||||
return &_lightRed;
|
return &_lightRed;
|
||||||
case Lights::Green:
|
case Light::Green:
|
||||||
return &_lightGreen;
|
return &_lightGreen;
|
||||||
case Lights::White:
|
case Light::White:
|
||||||
return &_lightWhite;
|
return &_lightWhite;
|
||||||
case Lights::Yellow:
|
case Light::Yellow:
|
||||||
case Lights::Amber:
|
case Light::Amber:
|
||||||
return &_lightYellow;
|
return &_lightYellow;
|
||||||
default:
|
default:
|
||||||
return &_light;
|
return &_light;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor Style::color(Lights::Color c)
|
QColor Style::color(Light::Color c)
|
||||||
{
|
{
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case Lights::Red:
|
case Light::Red:
|
||||||
return Qt::red;
|
return Qt::red;
|
||||||
case Lights::Green:
|
case Light::Green:
|
||||||
return Qt::green;
|
return Qt::green;
|
||||||
case Lights::White:
|
case Light::White:
|
||||||
return Qt::white;
|
return Qt::white;
|
||||||
case Lights::Yellow:
|
case Light::Yellow:
|
||||||
case Lights::Amber:
|
case Light::Amber:
|
||||||
return Qt::yellow;
|
return Qt::yellow;
|
||||||
default:
|
default:
|
||||||
return Qt::magenta;
|
return Qt::magenta;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "lights.h"
|
#include "light.h"
|
||||||
#include "subfile.h"
|
#include "subfile.h"
|
||||||
|
|
||||||
#define TYPE(t) ((t)<<8)
|
#define TYPE(t) ((t)<<8)
|
||||||
@ -113,7 +113,7 @@ public:
|
|||||||
const QList<quint32> &drawOrder() const {return _drawOrder;}
|
const QList<quint32> &drawOrder() const {return _drawOrder;}
|
||||||
const QFont *font(Style::FontSize size, Style::FontSize defaultSize
|
const QFont *font(Style::FontSize size, Style::FontSize defaultSize
|
||||||
= Style::Normal) const;
|
= Style::Normal) const;
|
||||||
const QImage *light(Lights::Color color) const;
|
const QImage *light(Light::Color color) const;
|
||||||
const QPoint &lightOffset() const {return _lightOffset;}
|
const QPoint &lightOffset() const {return _lightOffset;}
|
||||||
|
|
||||||
static bool isPOI(quint32 type)
|
static bool isPOI(quint32 type)
|
||||||
@ -157,7 +157,7 @@ public:
|
|||||||
static bool isMarina(quint32 type)
|
static bool isMarina(quint32 type)
|
||||||
{return type == 0x10703;}
|
{return type == 0x10703;}
|
||||||
|
|
||||||
static QColor color(Lights::Color c);
|
static QColor color(Light::Color c);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct Section {
|
struct Section {
|
||||||
|
@ -41,7 +41,7 @@ bool SubFile::seek(Handle &handle, quint32 pos) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SubFile::readVUInt32(Handle &hdl, quint32 &val) const
|
bool SubFile::readVUInt32(Handle &hdl, quint32 &val, quint32 *size) const
|
||||||
{
|
{
|
||||||
quint8 bytes, shift, b;
|
quint8 bytes, shift, b;
|
||||||
|
|
||||||
@ -69,6 +69,9 @@ bool SubFile::readVUInt32(Handle &hdl, quint32 &val) const
|
|||||||
val |= (((quint32)b) << (i * 8)) >> (8 - shift);
|
val |= (((quint32)b) << (i * 8)) >> (8 - shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (size)
|
||||||
|
*size = 1 + bytes;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool readVUInt32(Handle &hdl, quint32 &val) const;
|
bool readVUInt32(Handle &hdl, quint32 &val, quint32 *size = 0) const;
|
||||||
bool readVUInt32(Handle &hdl, quint32 bytes, quint32 &val) const;
|
bool readVUInt32(Handle &hdl, quint32 bytes, quint32 &val) const;
|
||||||
bool readVBitfield32(Handle &hdl, quint32 &bitfield) const;
|
bool readVBitfield32(Handle &hdl, quint32 &bitfield) const;
|
||||||
|
|
||||||
|
@ -27,14 +27,6 @@
|
|||||||
|
|
||||||
#define MAX_REDIRECT_LEVEL 5
|
#define MAX_REDIRECT_LEVEL 5
|
||||||
#define RETRIES 3
|
#define RETRIES 3
|
||||||
|
|
||||||
#define ATTR_REDIRECT_POLICY QNetworkRequest::RedirectPolicyAttribute
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
#define ATTR_HTTP2_ALLOWED QNetworkRequest::HTTP2AllowedAttribute
|
|
||||||
#else // QT 5.15
|
|
||||||
#define ATTR_HTTP2_ALLOWED QNetworkRequest::Http2AllowedAttribute
|
|
||||||
#endif // QT 5.15
|
|
||||||
|
|
||||||
#define TMP_SUFFIX ".download"
|
#define TMP_SUFFIX ".download"
|
||||||
|
|
||||||
// QNetworkReply::errorString() returns bullshit, use our own reporting
|
// QNetworkReply::errorString() returns bullshit, use our own reporting
|
||||||
@ -129,31 +121,6 @@ Authorization::Authorization(const QString &username, const QString &password)
|
|||||||
_header = HTTPHeader("Authorization", "Basic " + data);
|
_header = HTTPHeader("Authorization", "Basic " + data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
NetworkTimeout::NetworkTimeout(int timeout, QNetworkReply *reply)
|
|
||||||
: QObject(reply), _timeout(timeout)
|
|
||||||
{
|
|
||||||
connect(reply, &QIODevice::readyRead, this, &NetworkTimeout::reset);
|
|
||||||
_timer.start(timeout * 1000, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NetworkTimeout::reset()
|
|
||||||
{
|
|
||||||
_timer.start(_timeout * 1000, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NetworkTimeout::timerEvent(QTimerEvent *ev)
|
|
||||||
{
|
|
||||||
if (!_timer.isActive() || ev->timerId() != _timer.timerId())
|
|
||||||
return;
|
|
||||||
QNetworkReply *reply = static_cast<QNetworkReply*>(parent());
|
|
||||||
if (reply->isRunning())
|
|
||||||
reply->abort();
|
|
||||||
_timer.stop();
|
|
||||||
}
|
|
||||||
#endif // QT 5.15
|
|
||||||
|
|
||||||
|
|
||||||
QNetworkAccessManager *Downloader::_manager = 0;
|
QNetworkAccessManager *Downloader::_manager = 0;
|
||||||
int Downloader::_timeout = 30;
|
int Downloader::_timeout = 30;
|
||||||
bool Downloader::_http2 = true;
|
bool Downloader::_http2 = true;
|
||||||
@ -176,12 +143,10 @@ bool Downloader::doDownload(const Download &dl, const QList<HTTPHeader> &headers
|
|||||||
|
|
||||||
QNetworkRequest request(url);
|
QNetworkRequest request(url);
|
||||||
request.setMaximumRedirectsAllowed(MAX_REDIRECT_LEVEL);
|
request.setMaximumRedirectsAllowed(MAX_REDIRECT_LEVEL);
|
||||||
request.setAttribute(ATTR_REDIRECT_POLICY,
|
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute,
|
||||||
QNetworkRequest::NoLessSafeRedirectPolicy);
|
QNetworkRequest::NoLessSafeRedirectPolicy);
|
||||||
request.setAttribute(ATTR_HTTP2_ALLOWED, QVariant(_http2));
|
request.setAttribute(QNetworkRequest::Http2AllowedAttribute, QVariant(_http2));
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
request.setTransferTimeout(_timeout * 1000);
|
request.setTransferTimeout(_timeout * 1000);
|
||||||
#endif // QT 5.15
|
|
||||||
|
|
||||||
for (int i = 0; i < headers.size(); i++) {
|
for (int i = 0; i < headers.size(); i++) {
|
||||||
const HTTPHeader &hdr = headers.at(i);
|
const HTTPHeader &hdr = headers.at(i);
|
||||||
@ -208,9 +173,6 @@ bool Downloader::doDownload(const Download &dl, const QList<HTTPHeader> &headers
|
|||||||
_currentDownloads.insert(url, file);
|
_currentDownloads.insert(url, file);
|
||||||
|
|
||||||
if (reply->isRunning()) {
|
if (reply->isRunning()) {
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
new NetworkTimeout(_timeout, reply);
|
|
||||||
#endif // QT 5.15
|
|
||||||
connect(reply, &QIODevice::readyRead, this, &Downloader::emitReadReady);
|
connect(reply, &QIODevice::readyRead, this, &Downloader::emitReadReady);
|
||||||
connect(reply, &QNetworkReply::finished, this, &Downloader::emitFinished);
|
connect(reply, &QNetworkReply::finished, this, &Downloader::emitFinished);
|
||||||
} else {
|
} else {
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
|
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
#include <QBasicTimer>
|
|
||||||
#endif // QT 5.15
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
@ -41,25 +38,6 @@ private:
|
|||||||
HTTPHeader _header;
|
HTTPHeader _header;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
class NetworkTimeout : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
NetworkTimeout(int timeout, QNetworkReply *reply);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void reset();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void timerEvent(QTimerEvent *ev);
|
|
||||||
|
|
||||||
QBasicTimer _timer;
|
|
||||||
int _timeout;
|
|
||||||
};
|
|
||||||
#endif // QT 5.15
|
|
||||||
|
|
||||||
class Downloader : public QObject
|
class Downloader : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -39,9 +39,7 @@ static QPainterPath parallelPath(const QPainterPath &p, double dy)
|
|||||||
QVector<QPointF> u(n);
|
QVector<QPointF> u(n);
|
||||||
QPainterPath h;
|
QPainterPath h;
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
|
||||||
h.reserve(p.elementCount());
|
h.reserve(p.elementCount());
|
||||||
#endif // QT 5.13
|
|
||||||
|
|
||||||
for (int k = 0; k < n; k++) {
|
for (int k = 0; k < n; k++) {
|
||||||
qreal c = p.elementAt(k + 1).x - p.elementAt(k).x;
|
qreal c = p.elementAt(k + 1).x - p.elementAt(k).x;
|
||||||
@ -251,12 +249,10 @@ QPainterPath RasterTile::painterPath(const Polygon &polygon, bool curve) const
|
|||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
|
|
||||||
if (curve) {
|
if (curve) {
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
|
|
||||||
int size = 0;
|
int size = 0;
|
||||||
for (int i = 0; i < polygon.size(); i++)
|
for (int i = 0; i < polygon.size(); i++)
|
||||||
size += polygon.at(i).size();
|
size += polygon.at(i).size();
|
||||||
path.reserve(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);
|
||||||
|
@ -6,16 +6,8 @@
|
|||||||
#define MAX_ANGLE 30
|
#define MAX_ANGLE 30
|
||||||
#define PADDING 2
|
#define PADDING 2
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
|
||||||
#define INTERSECTS intersect
|
|
||||||
#else // QT 5.15
|
|
||||||
#define INTERSECTS intersects
|
|
||||||
#endif // QT 5.15
|
|
||||||
|
|
||||||
|
|
||||||
static void swap(const QLineF &line, QPointF *p1, QPointF *p2)
|
static void swap(const QLineF &line, QPointF *p1, QPointF *p2)
|
||||||
{
|
{
|
||||||
|
|
||||||
QPointF lp1(line.p1());
|
QPointF lp1(line.p1());
|
||||||
QPointF lp2(line.p2());
|
QPointF lp2(line.p2());
|
||||||
|
|
||||||
@ -34,10 +26,10 @@ static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
|
|||||||
{
|
{
|
||||||
QPointF *p = p1;
|
QPointF *p = p1;
|
||||||
|
|
||||||
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.topRight()), p)
|
if (line.intersects(QLineF(rect.topLeft(), rect.topRight()), p)
|
||||||
== QLineF::BoundedIntersection)
|
== QLineF::BoundedIntersection)
|
||||||
p = p2;
|
p = p2;
|
||||||
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
if (line.intersects(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
||||||
== QLineF::BoundedIntersection) {
|
== QLineF::BoundedIntersection) {
|
||||||
if (p == p2) {
|
if (p == p2) {
|
||||||
swap(line, p1, p2);
|
swap(line, p1, p2);
|
||||||
@ -45,7 +37,7 @@ static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
|
|||||||
}
|
}
|
||||||
p = p2;
|
p = p2;
|
||||||
}
|
}
|
||||||
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
if (line.intersects(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
||||||
== QLineF::BoundedIntersection) {
|
== QLineF::BoundedIntersection) {
|
||||||
if (p == p2) {
|
if (p == p2) {
|
||||||
swap(line, p1, p2);
|
swap(line, p1, p2);
|
||||||
@ -53,7 +45,7 @@ static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
|
|||||||
}
|
}
|
||||||
p = p2;
|
p = p2;
|
||||||
}
|
}
|
||||||
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.topRight()), p)
|
if (line.intersects(QLineF(rect.bottomRight(), rect.topRight()), p)
|
||||||
== QLineF::BoundedIntersection) {
|
== QLineF::BoundedIntersection) {
|
||||||
if (p == p2) {
|
if (p == p2) {
|
||||||
swap(line, p1, p2);
|
swap(line, p1, p2);
|
||||||
@ -68,16 +60,16 @@ static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
|
|||||||
|
|
||||||
static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p)
|
static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p)
|
||||||
{
|
{
|
||||||
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.topRight()), p)
|
if (line.intersects(QLineF(rect.topLeft(), rect.topRight()), p)
|
||||||
== QLineF::BoundedIntersection)
|
== QLineF::BoundedIntersection)
|
||||||
return true;
|
return true;
|
||||||
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
if (line.intersects(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
||||||
== QLineF::BoundedIntersection)
|
== QLineF::BoundedIntersection)
|
||||||
return true;
|
return true;
|
||||||
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
if (line.intersects(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
||||||
== QLineF::BoundedIntersection)
|
== QLineF::BoundedIntersection)
|
||||||
return true;
|
return true;
|
||||||
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.topRight()), p)
|
if (line.intersects(QLineF(rect.bottomRight(), rect.topRight()), p)
|
||||||
== QLineF::BoundedIntersection)
|
== QLineF::BoundedIntersection)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user