mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-02 05:49:15 +02:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
ac5f4cafeb | |||
ccb0364e76 | |||
414bdead17 | |||
8cf09a68d1 | |||
e4c79d7275 | |||
a718f1e122 | |||
6507764545 | |||
bd2d66ecd3 | |||
c09525f306 | |||
5bc7487c3a | |||
9b73b0f70e |
@ -1,4 +1,4 @@
|
||||
version: 11.8.{build}
|
||||
version: 11.9.{build}
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
|
@ -3,7 +3,7 @@ unix:!macx:!android {
|
||||
} else {
|
||||
TARGET = GPXSee
|
||||
}
|
||||
VERSION = 11.8
|
||||
VERSION = 11.9
|
||||
|
||||
QT += core \
|
||||
gui \
|
||||
@ -29,6 +29,7 @@ HEADERS += src/common/config.h \
|
||||
src/GUI/pluginparameters.h \
|
||||
src/common/garmin.h \
|
||||
src/common/coordinates.h \
|
||||
src/common/linec.h \
|
||||
src/common/range.h \
|
||||
src/common/rectc.h \
|
||||
src/common/textcodec.h \
|
||||
|
@ -172,6 +172,7 @@
|
||||
<file alias="chimney.png">icons/map/marine/chimney.png</file>
|
||||
<file alias="platform.png">icons/map/marine/platform.png</file>
|
||||
<file alias="ferry-line.png">icons/map/marine/ferry-line.png</file>
|
||||
<file alias="dw-route-line.png">icons/map/marine/dw-route-line.png</file>
|
||||
</qresource>
|
||||
|
||||
<!-- Mapsforge rendertheme -->
|
||||
|
BIN
icons/map/marine/dw-route-line.png
Normal file
BIN
icons/map/marine/dw-route-line.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
@ -37,7 +37,7 @@ Unicode true
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "11.8"
|
||||
!define VERSION "11.9"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||
|
25
src/common/linec.h
Normal file
25
src/common/linec.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef LINEC_H
|
||||
#define LINEC_H
|
||||
|
||||
#include "coordinates.h"
|
||||
|
||||
class LineC
|
||||
{
|
||||
public:
|
||||
LineC(const Coordinates &c1, const Coordinates &c2) : _c1(c1), _c2(c2) {}
|
||||
|
||||
const Coordinates &c1() const {return _c1;}
|
||||
const Coordinates &c2() const {return _c2;}
|
||||
|
||||
Coordinates pointAt(double t) const
|
||||
{
|
||||
return Coordinates(
|
||||
_c1.lon() + (_c2.lon() - _c1.lon()) * t,
|
||||
_c1.lat() + (_c2.lat() - _c1.lat()) * t);
|
||||
}
|
||||
|
||||
private:
|
||||
Coordinates _c1, _c2;
|
||||
};
|
||||
|
||||
#endif // LINEC_H
|
@ -12,6 +12,7 @@
|
||||
#define DRVAL1 87
|
||||
#define ELEVAT 90
|
||||
#define OBJNAM 116
|
||||
#define ORIENT 117
|
||||
#define RESTRN 131
|
||||
#define VALDCO 174
|
||||
#define WATLEV 187
|
||||
|
@ -22,32 +22,32 @@ static QMap<uint,uint> orderMapInit()
|
||||
|
||||
map.insert(SUBTYPE(BUAARE, 1), 1);
|
||||
map.insert(SUBTYPE(BUAARE, 5), 2);
|
||||
map.insert(SUBTYPE(BUAARE, 4), 2);
|
||||
map.insert(SUBTYPE(BUAARE, 3), 3);
|
||||
map.insert(SUBTYPE(BUAARE, 2), 4);
|
||||
map.insert(SUBTYPE(BUAARE, 6), 5);
|
||||
map.insert(SUBTYPE(BUAARE, 0), 6);
|
||||
map.insert(TYPE(BCNISD), 7);
|
||||
map.insert(TYPE(BCNLAT), 8);
|
||||
map.insert(TYPE(BCNSAW), 9);
|
||||
map.insert(TYPE(BCNSPP), 10);
|
||||
map.insert(TYPE(BOYCAR), 11);
|
||||
map.insert(TYPE(BOYINB), 12);
|
||||
map.insert(TYPE(BOYISD), 13);
|
||||
map.insert(TYPE(BOYLAT), 14);
|
||||
map.insert(TYPE(BOYSAW), 15);
|
||||
map.insert(TYPE(BOYSPP), 16);
|
||||
map.insert(TYPE(MORFAC), 17);
|
||||
map.insert(TYPE(OFSPLF), 18);
|
||||
map.insert(TYPE(LIGHTS), 19);
|
||||
map.insert(TYPE(OBSTRN), 20);
|
||||
map.insert(TYPE(WRECKS), 21);
|
||||
map.insert(TYPE(UWTROC), 22);
|
||||
map.insert(TYPE(HRBFAC), 23);
|
||||
map.insert(TYPE(PILPNT), 24);
|
||||
map.insert(TYPE(ACHBRT), 25);
|
||||
map.insert(TYPE(LNDELV), 26);
|
||||
map.insert(TYPE(LNDMRK), 27);
|
||||
map.insert(SUBTYPE(BUAARE, 4), 3);
|
||||
map.insert(SUBTYPE(BUAARE, 3), 4);
|
||||
map.insert(SUBTYPE(BUAARE, 2), 5);
|
||||
map.insert(SUBTYPE(BUAARE, 6), 6);
|
||||
map.insert(SUBTYPE(BUAARE, 0), 7);
|
||||
map.insert(TYPE(BCNISD), 8);
|
||||
map.insert(TYPE(BCNLAT), 9);
|
||||
map.insert(TYPE(BCNSAW), 10);
|
||||
map.insert(TYPE(BCNSPP), 11);
|
||||
map.insert(TYPE(BOYCAR), 12);
|
||||
map.insert(TYPE(BOYINB), 13);
|
||||
map.insert(TYPE(BOYISD), 14);
|
||||
map.insert(TYPE(BOYLAT), 15);
|
||||
map.insert(TYPE(BOYSAW), 16);
|
||||
map.insert(TYPE(BOYSPP), 17);
|
||||
map.insert(TYPE(MORFAC), 18);
|
||||
map.insert(TYPE(OFSPLF), 19);
|
||||
map.insert(TYPE(LIGHTS), 20);
|
||||
map.insert(TYPE(OBSTRN), 21);
|
||||
map.insert(TYPE(WRECKS), 22);
|
||||
map.insert(TYPE(UWTROC), 23);
|
||||
map.insert(TYPE(HRBFAC), 24);
|
||||
map.insert(TYPE(PILPNT), 25);
|
||||
map.insert(TYPE(ACHBRT), 26);
|
||||
map.insert(TYPE(LNDELV), 27);
|
||||
map.insert(TYPE(LNDMRK), 28);
|
||||
map.insert(TYPE(SOUNDG), 0xFFFFFFFF);
|
||||
|
||||
return map;
|
||||
@ -57,9 +57,9 @@ static QMap<uint,uint> orderMap = orderMapInit();
|
||||
|
||||
static uint order(uint type)
|
||||
{
|
||||
uint st = (type>>16 == BUAARE) ? type : type && 0xFFFF;
|
||||
uint st = ((type>>16) == BUAARE) ? type : (type & 0xFFFF0000);
|
||||
QMap<uint, uint>::const_iterator it = orderMap.find(st);
|
||||
return (it == orderMap.constEnd()) ? type + 512 : it.value();
|
||||
return (it == orderMap.constEnd()) ? (type>>16) + 512 : it.value();
|
||||
}
|
||||
|
||||
static void warning(const ISO8211::Field &FRID, uint PRIM)
|
||||
@ -420,14 +420,14 @@ MapData::Attr MapData::pointAttr(const ISO8211::Record &r, uint OBJL)
|
||||
uint key = av.at(0).toUInt();
|
||||
|
||||
if (key == OBJNAM)
|
||||
label = av.at(1).toString();
|
||||
label = QString::fromLatin1(av.at(1).toByteArray());
|
||||
if ((OBJL == HRBFAC && key == CATHAF)
|
||||
|| (OBJL == LNDMRK && key == CATLMK)
|
||||
|| (OBJL == WRECKS && key == CATWRK)
|
||||
|| (OBJL == MORFAC && key == CATMOR)
|
||||
|| (OBJL == UWTROC && key == WATLEV)
|
||||
|| (OBJL == BUAARE && key == CATBUA))
|
||||
subtype = av.at(1).toString().toUInt();
|
||||
subtype = av.at(1).toByteArray().toUInt();
|
||||
}
|
||||
|
||||
return Attr(subtype, label);
|
||||
@ -447,12 +447,12 @@ MapData::Attr MapData::lineAttr(const ISO8211::Record &r, uint OBJL)
|
||||
uint key = av.at(0).toUInt();
|
||||
|
||||
if (key == OBJNAM)
|
||||
label = av.at(1).toString();
|
||||
label = QString::fromLatin1(av.at(1).toByteArray());
|
||||
if ((OBJL == DEPCNT && key == VALDCO)
|
||||
|| (OBJL == LNDELV && key == ELEVAT))
|
||||
label = av.at(1).toString();
|
||||
if (OBJL == RECTRC && key == CATTRK)
|
||||
subtype = av.at(1).toString().toUInt();
|
||||
label = QString::fromLatin1(av.at(1).toByteArray());
|
||||
if ((OBJL == RECTRC || OBJL == RCRTCL) && key == CATTRK)
|
||||
subtype = av.at(1).toByteArray().toUInt();
|
||||
}
|
||||
|
||||
return Attr(subtype, label);
|
||||
@ -472,13 +472,16 @@ MapData::Attr MapData::polyAttr(const ISO8211::Record &r, uint OBJL)
|
||||
uint key = av.at(0).toUInt();
|
||||
|
||||
if (OBJL == DEPARE && key == DRVAL1)
|
||||
subtype = depthLevel(av.at(1).toString());
|
||||
subtype = depthLevel(av.at(1).toByteArray());
|
||||
else if ((OBJL == RESARE && key == CATREA)
|
||||
|| (OBJL == ACHARE && key == CATACH))
|
||||
subtype = av.at(1).toString().toUInt();
|
||||
subtype = av.at(1).toByteArray().toUInt();
|
||||
else if (OBJL == RESARE && key == RESTRN) {
|
||||
if (av.at(1).toString().toUInt() == 1)
|
||||
if (av.at(1).toByteArray().toUInt() == 1)
|
||||
subtype = 2;
|
||||
} else if (OBJL == TSSLPT && key == ORIENT) {
|
||||
double angle = av.at(1).toByteArray().toDouble();
|
||||
subtype = (uint)(angle * 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define BCNLAT 7
|
||||
#define BCNSAW 8
|
||||
#define BCNSPP 9
|
||||
#define BERTHS 10
|
||||
#define BRIDGE 11
|
||||
#define BUISGL 12
|
||||
#define BUAARE 13
|
||||
@ -22,13 +23,17 @@
|
||||
#define CBLSUB 22
|
||||
#define CANALS 23
|
||||
#define COALNE 30
|
||||
#define DAMCON 38
|
||||
#define DWRTPT 41
|
||||
#define DEPARE 42
|
||||
#define DEPCNT 43
|
||||
#define DRGARE 46
|
||||
#define DRYDOC 47
|
||||
#define DMPGRD 48
|
||||
#define DYKCON 49
|
||||
#define FAIRWY 51
|
||||
#define FERYRT 53
|
||||
#define FLODOC 57
|
||||
#define GATCON 61
|
||||
#define HRBFAC 64
|
||||
#define LAKARE 69
|
||||
@ -43,7 +48,10 @@
|
||||
#define PILPNT 90
|
||||
#define PIPSOL 94
|
||||
#define PONTON 95
|
||||
#define PRCARE 96
|
||||
#define PYLONS 98
|
||||
#define RAILWY 106
|
||||
#define RCRTCL 108
|
||||
#define RECTRC 109
|
||||
#define RESARE 112
|
||||
#define RIVERS 114
|
||||
@ -53,6 +61,7 @@
|
||||
#define SOUNDG 129
|
||||
#define TSELNE 145
|
||||
#define TSSBND 146
|
||||
#define TSSLPT 148
|
||||
#define TSEZNE 150
|
||||
#define UWTROC 153
|
||||
#define UNSARE 154
|
||||
|
@ -1,4 +1,6 @@
|
||||
#include <QtMath>
|
||||
#include <QPainter>
|
||||
#include "common/linec.h"
|
||||
#include "map/bitmapline.h"
|
||||
#include "map/textpointitem.h"
|
||||
#include "map/textpathitem.h"
|
||||
@ -8,9 +10,12 @@
|
||||
using namespace ENC;
|
||||
|
||||
#define ICON_PADDING 2
|
||||
#define ARROW_SIZE 0.005
|
||||
|
||||
#define ECDIS(x) (((x)>TYPE(17000))?((x)-TYPE(17000)):(x))
|
||||
|
||||
const float C1 = 0.866025f; /* sqrt(3)/2 */
|
||||
|
||||
static const QColor haloColor(Qt::white);
|
||||
|
||||
static struct {
|
||||
@ -51,6 +56,36 @@ static const Style& style()
|
||||
return s;
|
||||
}
|
||||
|
||||
static double area(const QVector<Coordinates> &polygon)
|
||||
{
|
||||
double area = 0;
|
||||
|
||||
for (int i = 0; i < polygon.size(); i++) {
|
||||
int j = (i + 1) % polygon.size();
|
||||
area += polygon.at(i).lon() * polygon.at(j).lat();
|
||||
area -= polygon.at(i).lat() * polygon.at(j).lon();
|
||||
}
|
||||
area /= 2.0;
|
||||
|
||||
return area;
|
||||
}
|
||||
|
||||
static Coordinates centroid(const QVector<Coordinates> &polygon)
|
||||
{
|
||||
double cx = 0, cy = 0;
|
||||
double factor = 1.0 / (6.0 * area(polygon));
|
||||
|
||||
for (int i = 0; i < polygon.size(); i++) {
|
||||
int j = (i + 1) % polygon.size();
|
||||
qreal f = (polygon.at(i).lon() * polygon.at(j).lat()
|
||||
- polygon.at(j).lon() * polygon.at(i).lat());
|
||||
cx += (polygon.at(i).lon() + polygon.at(j).lon()) * f;
|
||||
cy += (polygon.at(i).lat() + polygon.at(j).lat()) * f;
|
||||
}
|
||||
|
||||
return Coordinates(cx * factor, cy * factor);
|
||||
}
|
||||
|
||||
QPainterPath RasterTile::painterPath(const Polygon &polygon) const
|
||||
{
|
||||
QPainterPath path;
|
||||
@ -77,6 +112,48 @@ QPolygonF RasterTile::polyline(const QVector<Coordinates> &path) const
|
||||
return polygon;
|
||||
}
|
||||
|
||||
QPolygonF RasterTile::arrow(const Coordinates &c, qreal angle) const
|
||||
{
|
||||
Coordinates t[3], r[4];
|
||||
QPolygonF polygon;
|
||||
|
||||
t[0] = c;
|
||||
t[1] = Coordinates(t[0].lon() - qCos(angle - M_PI/3) * ARROW_SIZE,
|
||||
t[0].lat() - qSin(angle - M_PI/3) * ARROW_SIZE);
|
||||
t[2] = Coordinates(t[0].lon() - qCos(angle - M_PI + M_PI/3) * ARROW_SIZE,
|
||||
t[0].lat() - qSin(angle - M_PI + M_PI/3) * ARROW_SIZE);
|
||||
|
||||
LineC l(t[1], t[2]);
|
||||
r[0] = l.pointAt(0.25);
|
||||
r[1] = l.pointAt(0.75);
|
||||
r[2] = Coordinates(r[0].lon() - C1 * ARROW_SIZE * qCos(angle - M_PI/2),
|
||||
r[0].lat() - C1 * ARROW_SIZE * qSin(angle - M_PI/2));
|
||||
r[3] = Coordinates(r[1].lon() - C1 * ARROW_SIZE * qCos(angle - M_PI/2),
|
||||
r[1].lat() - C1 * ARROW_SIZE * qSin(angle - M_PI/2));
|
||||
|
||||
polygon << ll2xy(t[0]) << ll2xy(t[2]) << ll2xy(r[1]) << ll2xy(r[3])
|
||||
<< ll2xy(r[2]) << ll2xy(r[0]) << ll2xy(t[1]);
|
||||
|
||||
return polygon;
|
||||
}
|
||||
|
||||
void RasterTile::drawArrows(QPainter *painter)
|
||||
{
|
||||
painter->setPen(QPen(QColor("#eb49eb"), 1));
|
||||
painter->setBrush(QBrush("#80eb49eb"));
|
||||
|
||||
for (int i = 0; i < _polygons.size(); i++) {
|
||||
const MapData::Poly *poly = _polygons.at(i);
|
||||
|
||||
if (poly->type()>>16 == TSSLPT) {
|
||||
qreal angle = (poly->type() & 0xFFFF) / 10.0;
|
||||
QPolygonF polygon(arrow(centroid(poly->path().first()),
|
||||
deg2rad(180 - angle)));
|
||||
painter->drawPolygon(polygon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RasterTile::drawPolygons(QPainter *painter)
|
||||
{
|
||||
const Style &s = style();
|
||||
@ -198,6 +275,7 @@ void RasterTile::render()
|
||||
|
||||
drawPolygons(&painter);
|
||||
drawLines(&painter);
|
||||
drawArrows(&painter);
|
||||
|
||||
drawTextItems(&painter, textItems);
|
||||
|
||||
|
@ -32,10 +32,12 @@ private:
|
||||
{return _transform.proj2img(_proj.ll2xy(c));}
|
||||
QPainterPath painterPath(const Polygon &polygon) const;
|
||||
QPolygonF polyline(const QVector<Coordinates> &path) const;
|
||||
QPolygonF arrow(const Coordinates &c, qreal angle) const;
|
||||
void processPoints(QList<TextItem*> &textItems);
|
||||
void processLines(QList<TextItem*> &textItems);
|
||||
void drawBitmapPath(QPainter *painter, const QImage &img,
|
||||
const Polygon &polygon);
|
||||
void drawArrows(QPainter *painter);
|
||||
void drawPolygons(QPainter *painter);
|
||||
void drawLines(QPainter *painter);
|
||||
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems);
|
||||
|
@ -36,6 +36,7 @@ void Style::defaultPolygonStyle()
|
||||
_polygons[TYPE(OBSTRN)] = Polygon(Qt::NoBrush, QPen(QColor("#000000"), 1.5,
|
||||
Qt::DotLine));
|
||||
_polygons[TYPE(PONTON)] = Polygon(QBrush("#333333"));
|
||||
_polygons[TYPE(DRYDOC)] = Polygon(QBrush("#333333"));
|
||||
_polygons[TYPE(SLCONS)] = Polygon(Qt::NoBrush, QPen(QColor("#333333"), 1.5,
|
||||
Qt::DashLine));
|
||||
_polygons[TYPE(LAKARE)] = Polygon(QBrush("#9fc4e1"),
|
||||
@ -52,9 +53,19 @@ void Style::defaultPolygonStyle()
|
||||
_polygons[TYPE(UNSARE)] = Polygon(QBrush("#999999"));
|
||||
_polygons[SUBTYPE(RESARE, 9)] = Polygon(QBrush(QColor("#ff0000"),
|
||||
Qt::BDiagPattern));
|
||||
|
||||
_polygons[SUBTYPE(RESARE, 2)] = Polygon(QImage(":/marine/noanchor-line.png"));
|
||||
_polygons[SUBTYPE(ACHARE, 1)] = Polygon(QImage(":/marine/anchor-line.png"));
|
||||
_polygons[TYPE(PRCARE)] = Polygon(QBrush(QColor("#eb49eb"),
|
||||
Qt::BDiagPattern));
|
||||
_polygons[TYPE(DAMCON)] = Polygon(QBrush("#d98b21"), QPen(QColor("#000000"),
|
||||
1));
|
||||
_polygons[TYPE(DRYDOC)] = Polygon(QBrush("#ebab54"), QPen(QColor("#000000"),
|
||||
1));
|
||||
_polygons[TYPE(PYLONS)] = Polygon(QBrush("#a58140"), QPen(QColor("#000000"),
|
||||
1));
|
||||
_polygons[TYPE(FLODOC)] = Polygon(QBrush("#333333"), QPen(QColor("#000000"),
|
||||
1));
|
||||
_polygons[TYPE(DWRTPT)] = Polygon(QImage(":/marine/dw-route-line"));
|
||||
|
||||
_drawOrder
|
||||
<< TYPE(M_COVR) << TYPE(LNDARE) << SUBTYPE(DEPARE, 0)
|
||||
@ -63,8 +74,10 @@ void Style::defaultPolygonStyle()
|
||||
<< SUBTYPE(DEPARE, 6) << TYPE(LAKARE) << TYPE(CANALS) << TYPE(DYKCON)
|
||||
<< TYPE(RIVERS) << TYPE(DRGARE) << TYPE(FAIRWY) << TYPE(BUAARE)
|
||||
<< TYPE(BUISGL) << TYPE(AIRARE) << TYPE(BRIDGE) << TYPE(SLCONS)
|
||||
<< TYPE(PONTON) << TYPE(DMPGRD) << TYPE(TSEZNE) << TYPE(OBSTRN)
|
||||
<< SUBTYPE(ACHARE, 1) << SUBTYPE(RESARE, 9) << SUBTYPE(RESARE, 2);
|
||||
<< TYPE(PONTON) << TYPE(FLODOC) << TYPE(DRYDOC) << TYPE(DAMCON)
|
||||
<< TYPE(PYLONS) << TYPE(DMPGRD) << TYPE(TSEZNE) << TYPE(OBSTRN)
|
||||
<< TYPE(DWRTPT) << SUBTYPE(ACHARE, 1) << SUBTYPE(RESARE, 9)
|
||||
<< SUBTYPE(RESARE, 2) << TYPE(PRCARE);
|
||||
}
|
||||
|
||||
void Style::defaultLineStyle()
|
||||
@ -97,6 +110,10 @@ void Style::defaultLineStyle()
|
||||
_lines[TYPE(TSELNE)] = Line(QPen(QColor("#80fcb4fc"), 4, Qt::SolidLine));
|
||||
_lines[SUBTYPE(RECTRC, 1)] = Line(QPen(QColor("#000000"), 0, Qt::SolidLine));
|
||||
_lines[SUBTYPE(RECTRC, 2)] = Line(QPen(QColor("#000000"), 0, Qt::DashLine));
|
||||
_lines[SUBTYPE(RCRTCL, 1)] = Line(QPen(QColor("#eb49eb"), 0, Qt::SolidLine));
|
||||
_lines[SUBTYPE(RCRTCL, 2)] = Line(QPen(QColor("#eb49eb"), 0, Qt::DashLine));
|
||||
_lines[TYPE(FAIRWY)] = Line(QPen(QColor("#888888"), 1, Qt::DashDotDotLine));
|
||||
_lines[TYPE(BERTHS)] = Line(QPen(QColor("#333333"), 2));
|
||||
}
|
||||
|
||||
void Style::defaultPointStyle()
|
||||
|
Reference in New Issue
Block a user