mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-30 02:14:23 +02:00
Compare commits
20 Commits
a2728b6227
...
13.26
Author | SHA1 | Date | |
---|---|---|---|
225e6da48b | |||
23c398caf7 | |||
17ef334c4c | |||
b01dcc4569 | |||
762e374adf | |||
c68a2a1ac4 | |||
672fca9dd5 | |||
8c2e2f65c3 | |||
c5a7a4bb0e | |||
4f77d7a40e | |||
285a9a55f3 | |||
9c00ff53c2 | |||
531b37bc70 | |||
87c5a255c8 | |||
ce826966cf | |||
a56a558f37 | |||
e3d603e8d7 | |||
344e665bed | |||
d412390c75 | |||
524ac8347f |
@ -1,4 +1,4 @@
|
||||
version: 13.25.{build}
|
||||
version: 13.26.{build}
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
|
@ -3,7 +3,7 @@ unix:!macx:!android {
|
||||
} else {
|
||||
TARGET = GPXSee
|
||||
}
|
||||
VERSION = 13.25
|
||||
VERSION = 13.26
|
||||
|
||||
|
||||
QT += core \
|
||||
|
@ -99,7 +99,6 @@
|
||||
<!-- marine stuff (IMG & ENC style) -->
|
||||
<qresource prefix="/marine">
|
||||
<file alias="light-major.png">icons/map/marine/light-major.png</file>
|
||||
<file alias="light-platform.png">icons/map/marine/light-platform.png</file>
|
||||
<file alias="buoy.png">icons/map/marine/buoy.png</file>
|
||||
<file alias="beacon.png">icons/map/marine/beacon.png</file>
|
||||
<file alias="rock-exposed.png">icons/map/marine/rock-exposed.png</file>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 226 B |
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB |
@ -486,17 +486,17 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="370"/>
|
||||
<source>All</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Tot</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="374"/>
|
||||
<source>Raster only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Només ràster</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="378"/>
|
||||
<source>Vector only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Només vector</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="385"/>
|
||||
@ -733,7 +733,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="695"/>
|
||||
<source>Layers</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Capes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="704"/>
|
||||
|
@ -486,7 +486,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="370"/>
|
||||
<source>All</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Ĉiuj</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="374"/>
|
||||
|
@ -492,17 +492,17 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="370"/>
|
||||
<source>All</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Kaikki</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="374"/>
|
||||
<source>Raster only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Vain rasteri</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="378"/>
|
||||
<source>Vector only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Vain vektori</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="385"/>
|
||||
|
@ -492,17 +492,17 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="370"/>
|
||||
<source>All</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Все</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="374"/>
|
||||
<source>Raster only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Только растр</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="378"/>
|
||||
<source>Vector only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Только вектор</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="385"/>
|
||||
@ -699,7 +699,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="695"/>
|
||||
<source>Layers</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Слои</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="721"/>
|
||||
|
@ -486,17 +486,17 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="370"/>
|
||||
<source>All</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Все</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="374"/>
|
||||
<source>Raster only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Лише растр</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="378"/>
|
||||
<source>Vector only</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Лише вектор</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="385"/>
|
||||
@ -723,7 +723,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="695"/>
|
||||
<source>Layers</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Шари</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/gui.cpp" line="704"/>
|
||||
@ -1894,12 +1894,12 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="388"/>
|
||||
<source>Detect pauses</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Визначити паузи</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="537"/>
|
||||
<source>Detection:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Визначення:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="656"/>
|
||||
|
@ -37,7 +37,7 @@ Unicode true
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "13.25"
|
||||
!define VERSION "13.26"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||
|
@ -248,30 +248,33 @@ void GraphItem::setScale(qreal sx, qreal sy)
|
||||
if (_sx == sx && _sy == sy)
|
||||
return;
|
||||
|
||||
prepareGeometryChange();
|
||||
|
||||
_sx = sx; _sy = sy;
|
||||
|
||||
updatePath();
|
||||
}
|
||||
|
||||
void GraphItem::updatePath()
|
||||
{
|
||||
if (_sx == 0 && _sy == 0)
|
||||
return;
|
||||
|
||||
prepareGeometryChange();
|
||||
|
||||
_path = QPainterPath();
|
||||
|
||||
if (!(_type == Time && !_time)) {
|
||||
if (!((_type == Time && !_time) || _sx == 0 || _sy == 0)) {
|
||||
for (int i = 0; i < _graph.size(); i++) {
|
||||
const GraphSegment &segment = _graph.at(i);
|
||||
|
||||
_path.moveTo(segment.first().x(_type) * _sx, -segment.first().y()
|
||||
QPointF p1(segment.first().x(_type) * _sx, -segment.first().y()
|
||||
* _sy);
|
||||
for (int i = 1; i < segment.size(); i++)
|
||||
_path.lineTo(segment.at(i).x(_type) * _sx, -segment.at(i).y()
|
||||
|
||||
_path.moveTo(p1);
|
||||
for (int i = 1; i < segment.size(); i++) {
|
||||
QPointF p2(segment.at(i).x(_type) * _sx, -segment.at(i).y()
|
||||
* _sy);
|
||||
QPointF diff(p1 - p2);
|
||||
if (qAbs(diff.x()) >= 1.0 || qAbs(diff.y()) >= 1.0) {
|
||||
_path.lineTo(p2);
|
||||
p1 = p2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,8 +264,7 @@ QRectF GraphView::bounds() const
|
||||
|
||||
void GraphView::redraw()
|
||||
{
|
||||
if (!_graphs.isEmpty())
|
||||
redraw(viewport()->size() - QSizeF(MARGIN, MARGIN));
|
||||
redraw(viewport()->size() - QSizeF(MARGIN, MARGIN));
|
||||
}
|
||||
|
||||
void GraphView::redraw(const QSizeF &size)
|
||||
@ -275,7 +274,6 @@ void GraphView::redraw(const QSizeF &size)
|
||||
RangeF rx, ry;
|
||||
qreal sx, sy;
|
||||
|
||||
|
||||
if (_bounds.isNull()) {
|
||||
removeItem(_xAxis);
|
||||
removeItem(_yAxis);
|
||||
@ -284,7 +282,10 @@ void GraphView::redraw(const QSizeF &size)
|
||||
removeItem(_slider);
|
||||
removeItem(_info);
|
||||
removeItem(_grid);
|
||||
addItem(_message);
|
||||
if (_graphs.isEmpty())
|
||||
removeItem(_message);
|
||||
else
|
||||
addItem(_message);
|
||||
_scene->setSceneRect(_scene->itemsBoundingRect());
|
||||
return;
|
||||
}
|
||||
|
@ -1171,6 +1171,8 @@ void GUI::loadData(const Data &data)
|
||||
|
||||
for (int i = 0; i < _tabs.count(); i++)
|
||||
graphs.append(_tabs.at(i)->loadData(data, _map));
|
||||
/* Refreshing the splitter is necessary to update the map viewport and
|
||||
properly fit the data! */
|
||||
if (updateGraphTabs())
|
||||
_splitter->refresh();
|
||||
paths = _mapView->loadData(data);
|
||||
|
@ -686,7 +686,7 @@ void MapView::keyReleaseEvent(QKeyEvent *event)
|
||||
void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||
Flags flags)
|
||||
{
|
||||
QRect orig, adj;
|
||||
QRect orig;
|
||||
qreal ratio, diff, q, p;
|
||||
QPointF scenePos, scalePos, posPos, motionPos;
|
||||
bool hidpi = _hidpi && _deviceRatio > 1.0;
|
||||
@ -699,6 +699,7 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||
|
||||
// Compute sizes & ratios
|
||||
orig = viewport()->rect();
|
||||
QRectF adj(orig);
|
||||
scalePos = _mapScale->pos();
|
||||
posPos = _positionCoordinates->pos();
|
||||
motionPos = _motionInfo->pos();
|
||||
@ -706,11 +707,11 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||
if (orig.height() * (target.width() / target.height()) - orig.width() < 0) {
|
||||
ratio = target.height() / target.width();
|
||||
diff = (orig.width() * ratio) - orig.height();
|
||||
adj = orig.adjusted(0, -diff/2, 0, diff/2);
|
||||
adj.adjust(0, -diff/2.0, 0, diff/2.0);
|
||||
} else {
|
||||
ratio = target.width() / target.height();
|
||||
diff = (orig.height() * ratio) - orig.width();
|
||||
adj = orig.adjusted(-diff/2, 0, diff/2, 0);
|
||||
adj.adjust(-diff/2.0, 0, diff/2.0, 0);
|
||||
}
|
||||
|
||||
// Expand the view if plotting into a bitmap
|
||||
@ -735,8 +736,8 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||
/ (qreal)metric(QPaintDevice::PdmDpiX),
|
||||
painter->device()->logicalDpiY()
|
||||
/ (qreal)metric(QPaintDevice::PdmDpiY));
|
||||
adj = QRect(0, 0, adj.width() * s.x(), adj.height() * s.y());
|
||||
_map->zoomFit(adj.size(), _tr | _rr | _wr | _ar);
|
||||
adj = QRectF(0, 0, adj.width() * s.x(), adj.height() * s.y());
|
||||
_map->zoomFit(adj.size().toSize(), _tr | _rr | _wr | _ar);
|
||||
rescale();
|
||||
|
||||
QPointF center = contentCenter();
|
||||
@ -748,20 +749,20 @@ void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
|
||||
p = 1 / q;
|
||||
|
||||
_mapScale->setDigitalZoom(_digitalZoom - log2(p));
|
||||
_mapScale->setPos(mapToScene(adj.bottomRight() + QPoint(
|
||||
_mapScale->setPos(mapToScene(adj.bottomRight().toPoint() + QPoint(
|
||||
-(SCALE_OFFSET + _mapScale->boundingRect().width()) * p,
|
||||
-(SCALE_OFFSET + _mapScale->boundingRect().height()) * p)));
|
||||
_positionCoordinates->setDigitalZoom(_digitalZoom - log2(p));
|
||||
_positionCoordinates->setPos(mapToScene(adj.topLeft() + QPoint(
|
||||
_positionCoordinates->setPos(mapToScene(adj.topLeft().toPoint() + QPoint(
|
||||
COORDINATES_OFFSET * p,
|
||||
(COORDINATES_OFFSET + _positionCoordinates->boundingRect().height()) * p)));
|
||||
_motionInfo->setDigitalZoom(_digitalZoom - log2(p));
|
||||
_motionInfo->setPos(mapToScene(adj.topRight() + QPoint(
|
||||
_motionInfo->setPos(mapToScene(adj.topRight().toPoint() + QPoint(
|
||||
(-COORDINATES_OFFSET - _motionInfo->boundingRect().width()) * p,
|
||||
(COORDINATES_OFFSET + _motionInfo->boundingRect().height()) * p)));
|
||||
|
||||
// Print the view
|
||||
render(painter, target, adj);
|
||||
render(painter, target, adj.toRect());
|
||||
|
||||
// Revert view changes to display mode
|
||||
if (flags & HiRes) {
|
||||
|
@ -69,7 +69,7 @@ void PathItem::updateShape()
|
||||
_shape = s.createStroke(_painterPath);
|
||||
}
|
||||
|
||||
void PathItem::addSegment(const Coordinates &c1, const Coordinates &c2)
|
||||
bool PathItem::addSegment(const Coordinates &c1, const Coordinates &c2)
|
||||
{
|
||||
if (fabs(c1.lon() - c2.lon()) > 180.0) {
|
||||
// Split segment on date line crossing
|
||||
@ -91,8 +91,21 @@ void PathItem::addSegment(const Coordinates &c1, const Coordinates &c2)
|
||||
_painterPath.moveTo(_map->ll2xy(Coordinates(180, p.y())));
|
||||
}
|
||||
_painterPath.lineTo(_map->ll2xy(c2));
|
||||
} else
|
||||
_painterPath.lineTo(_map->ll2xy(c2));
|
||||
|
||||
return true;
|
||||
} else {
|
||||
QPointF p(_map->ll2xy(c2));
|
||||
const QPainterPath::Element &e = _painterPath.elementAt(
|
||||
_painterPath.elementCount() - 1);
|
||||
qreal dx = qAbs(p.x() - e.x);
|
||||
qreal dy = qAbs(p.y() - e.y);
|
||||
|
||||
if (dx >= 1.0 || dy >= 1.0) {
|
||||
_painterPath.lineTo(p);
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void PathItem::updatePainterPath()
|
||||
@ -101,24 +114,29 @@ void PathItem::updatePainterPath()
|
||||
|
||||
for (int i = 0; i < _path.size(); i++) {
|
||||
const PathSegment &segment = _path.at(i);
|
||||
_painterPath.moveTo(_map->ll2xy(segment.first().coordinates()));
|
||||
const PathPoint *p1 = &segment.first();
|
||||
|
||||
_painterPath.moveTo(_map->ll2xy(p1->coordinates()));
|
||||
|
||||
for (int j = 1; j < segment.size(); j++) {
|
||||
const PathPoint &p1 = segment.at(j-1);
|
||||
const PathPoint &p2 = segment.at(j);
|
||||
unsigned n = segments(p2.distance() - p1.distance());
|
||||
const PathPoint *p2 = &segment.at(j);
|
||||
double dist = p2->distance() - p1->distance();
|
||||
|
||||
if (n > 1) {
|
||||
GreatCircle gc(p1.coordinates(), p2.coordinates());
|
||||
Coordinates last = p1.coordinates();
|
||||
if (dist > GEOGRAPHICAL_MILE) {
|
||||
GreatCircle gc(p1->coordinates(), p2->coordinates());
|
||||
Coordinates last(p1->coordinates());
|
||||
unsigned n = segments(dist);
|
||||
|
||||
for (unsigned k = 1; k <= n; k++) {
|
||||
Coordinates c(gc.pointAt(k/(double)n));
|
||||
addSegment(last, c);
|
||||
last = c;
|
||||
}
|
||||
} else
|
||||
addSegment(p1.coordinates(), p2.coordinates());
|
||||
p1 = p2;
|
||||
} else {
|
||||
if (addSegment(p1->coordinates(), p2->coordinates()))
|
||||
p1 = p2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -289,12 +307,14 @@ QPointF PathItem::position(qreal x) const
|
||||
p1 = seg->at(mid-1).distance(); p2 = seg->at(mid).distance();
|
||||
}
|
||||
|
||||
unsigned n = segments(p2 - p1);
|
||||
if (n > 1) {
|
||||
qreal dist = p2 - p1;
|
||||
|
||||
if (dist > GEOGRAPHICAL_MILE) {
|
||||
GreatCircle gc(c1, c2);
|
||||
unsigned n = segments(dist);
|
||||
|
||||
// Great circle point
|
||||
double f = (x - p1) / (p2 - p1);
|
||||
double f = (x - p1) / (dist);
|
||||
QPointF p(_map->ll2xy(gc.pointAt(f)));
|
||||
|
||||
// Segment line of the great circle path
|
||||
@ -310,7 +330,7 @@ QPointF PathItem::position(qreal x) const
|
||||
+ l.p1().y());
|
||||
} else {
|
||||
QLineF l(_map->ll2xy(c1), _map->ll2xy(c2));
|
||||
return l.pointAt((x - p1) / (p2 - p1));
|
||||
return l.pointAt((x - p1) / (dist));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ private:
|
||||
QPointF position(qreal distance) const;
|
||||
void updatePainterPath();
|
||||
void updateShape();
|
||||
void addSegment(const Coordinates &c1, const Coordinates &c2);
|
||||
bool addSegment(const Coordinates &c1, const Coordinates &c2);
|
||||
void setMarkerInfo(qreal pos);
|
||||
void updateColor();
|
||||
void updateWidth();
|
||||
|
@ -12,6 +12,8 @@ int main(int argc, char *argv[])
|
||||
qRegisterMetaTypeStreamOperators<TimeZoneInfo>("TimeZoneInfo");
|
||||
#else // QT6
|
||||
qRegisterMetaType<TimeZoneInfo>("TimeZoneInfo");
|
||||
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(
|
||||
Qt::HighDpiScaleFactorRoundingPolicy::Round);
|
||||
#endif // QT6
|
||||
|
||||
QSurfaceFormat fmt;
|
||||
|
@ -45,13 +45,19 @@ public:
|
||||
};
|
||||
|
||||
struct Point {
|
||||
Point() : id(0), classLabel(false) {}
|
||||
Point() : id(0), flags(0) {}
|
||||
|
||||
enum Flags {
|
||||
NoFlag = 0,
|
||||
ClassLabel = 1,
|
||||
Light = 2
|
||||
};
|
||||
|
||||
Coordinates coordinates;
|
||||
Label label;
|
||||
quint32 type;
|
||||
quint64 id;
|
||||
bool classLabel;
|
||||
quint32 type;
|
||||
quint32 flags;
|
||||
|
||||
bool operator<(const Point &other) const
|
||||
{return id < other.id;}
|
||||
|
@ -114,11 +114,8 @@ const QFont *RasterTile::poiFont(Style::FontSize size, int zoom,
|
||||
}
|
||||
}
|
||||
|
||||
void RasterTile::ll2xy(QList<MapData::Poly> &polys, bool polygons) const
|
||||
void RasterTile::ll2xy(QList<MapData::Poly> &polys) const
|
||||
{
|
||||
if (!_vectors && !polygons)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < polys.size(); i++) {
|
||||
MapData::Poly &poly = polys[i];
|
||||
for (int j = 0; j < poly.points.size(); j++) {
|
||||
@ -130,9 +127,6 @@ void RasterTile::ll2xy(QList<MapData::Poly> &polys, bool polygons) const
|
||||
|
||||
void RasterTile::ll2xy(QList<MapData::Point> &points) const
|
||||
{
|
||||
if (!_vectors)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
QPointF p(ll2xy(points.at(i).coordinates));
|
||||
points[i].coordinates = Coordinates(p.x(), p.y());
|
||||
@ -198,9 +192,6 @@ void RasterTile::drawPolygons(QPainter *painter,
|
||||
void RasterTile::drawLines(QPainter *painter,
|
||||
const QList<MapData::Poly> &lines) const
|
||||
{
|
||||
if (!_vectors)
|
||||
return;
|
||||
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
|
||||
for (int i = 0; i < lines.size(); i++) {
|
||||
@ -290,9 +281,6 @@ void RasterTile::processPolygons(const QList<MapData::Poly> &polygons,
|
||||
void RasterTile::processLines(QList<MapData::Poly> &lines,
|
||||
QList<TextItem*> &textItems, const QImage (&arrows)[2])
|
||||
{
|
||||
if (!_vectors)
|
||||
return;
|
||||
|
||||
std::stable_sort(lines.begin(), lines.end());
|
||||
|
||||
if (_zoom >= 22)
|
||||
@ -411,38 +399,40 @@ void RasterTile::processShields(const QList<MapData::Poly> &lines,
|
||||
void RasterTile::processPoints(QList<MapData::Point> &points,
|
||||
QList<TextItem*> &textItems)
|
||||
{
|
||||
if (!_vectors)
|
||||
return;
|
||||
|
||||
std::sort(points.begin(), points.end());
|
||||
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
const MapData::Point &point = points.at(i);
|
||||
const Style::Point &style = _data->style()->point(point.type);
|
||||
const Style *style = _data->style();
|
||||
const Style::Point &ps = style->point(point.type);
|
||||
bool poi = Style::isPOI(point.type);
|
||||
|
||||
const QString *label = point.label.text().isEmpty()
|
||||
? 0 : &(point.label.text());
|
||||
const QImage *img = style.img().isNull() ? 0 : &style.img();
|
||||
const QImage *img = ps.img().isNull() ? 0 : &ps.img();
|
||||
const QFont *fnt = poi
|
||||
? poiFont(style.text().size(), _zoom, point.classLabel)
|
||||
: _data->style()->font(style.text().size());
|
||||
const QColor *color = style.text().color().isValid()
|
||||
? &style.text().color() : &textColor;
|
||||
? poiFont(ps.text().size(), _zoom, point.flags
|
||||
& MapData::Point::ClassLabel)
|
||||
: style->font(ps.text().size());
|
||||
const QColor *color = ps.text().color().isValid()
|
||||
? &ps.text().color() : &textColor;
|
||||
const QColor *hcolor = Style::isDepthPoint(point.type)
|
||||
? 0 : &haloColor;
|
||||
|
||||
if ((!label || !fnt) && !img)
|
||||
continue;
|
||||
|
||||
QPoint offset = img ? style.offset() : QPoint(0, 0);
|
||||
QPoint pos(point.coordinates.lon(), point.coordinates.lat());
|
||||
QPoint offset = img ? ps.offset() : QPoint(0, 0);
|
||||
|
||||
TextPointItem *item = new TextPointItem(QPoint(point.coordinates.lon(),
|
||||
point.coordinates.lat()) + offset, label, fnt, img, color, hcolor, 0,
|
||||
ICON_PADDING);
|
||||
if (item->isValid() && !item->collides(textItems))
|
||||
TextPointItem *item = new TextPointItem(pos + offset, label, fnt, img,
|
||||
color, hcolor, 0, ICON_PADDING);
|
||||
if (item->isValid() && !item->collides(textItems)) {
|
||||
textItems.append(item);
|
||||
else
|
||||
if (Style::isLight(point.type) || point.flags & MapData::Point::Light)
|
||||
textItems.append(new TextPointItem(pos + style->lightOffset(),
|
||||
0, 0, style->light(), 0, 0, 0, 0));
|
||||
} else
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
@ -457,14 +447,16 @@ void RasterTile::fetchData(QList<MapData::Poly> &polygons,
|
||||
RectD polyRectD(_transform.img2proj(polyRect.topLeft()),
|
||||
_transform.img2proj(polyRect.bottomRight()));
|
||||
_data->polys(polyRectD.toRectC(_proj, 20), _zoom,
|
||||
&polygons, &lines);
|
||||
&polygons, _vectors ? &lines : 0);
|
||||
|
||||
QRectF pointRect(QPointF(ttl.x() - TEXT_EXTENT, ttl.y() - TEXT_EXTENT),
|
||||
QPointF(ttl.x() + _rect.width() + TEXT_EXTENT, ttl.y() + _rect.height()
|
||||
+ TEXT_EXTENT));
|
||||
RectD pointRectD(_transform.img2proj(pointRect.topLeft()),
|
||||
_transform.img2proj(pointRect.bottomRight()));
|
||||
_data->points(pointRectD.toRectC(_proj, 20), _zoom, &points);
|
||||
if (_vectors) {
|
||||
QRectF pointRect(QPointF(ttl.x() - TEXT_EXTENT, ttl.y() - TEXT_EXTENT),
|
||||
QPointF(ttl.x() + _rect.width() + TEXT_EXTENT, ttl.y() + _rect.height()
|
||||
+ TEXT_EXTENT));
|
||||
RectD pointRectD(_transform.img2proj(pointRect.topLeft()),
|
||||
_transform.img2proj(pointRect.bottomRight()));
|
||||
_data->points(pointRectD.toRectC(_proj, 20), _zoom, &points);
|
||||
}
|
||||
}
|
||||
|
||||
MatrixD RasterTile::elevation(int extend) const
|
||||
@ -535,8 +527,8 @@ void RasterTile::render()
|
||||
arrows[WATER] = HIDPI_IMG(":/map", "water-arrow", _ratio);
|
||||
|
||||
fetchData(polygons, lines, points);
|
||||
ll2xy(polygons, true);
|
||||
ll2xy(lines, false);
|
||||
ll2xy(polygons);
|
||||
ll2xy(lines);
|
||||
ll2xy(points);
|
||||
|
||||
processPoints(points, textItems);
|
||||
|
@ -54,7 +54,7 @@ private:
|
||||
{return _transform.proj2img(_proj.ll2xy(c));}
|
||||
Coordinates xy2ll(const QPointF &p) const
|
||||
{return _proj.xy2ll(_transform.img2proj(p));}
|
||||
void ll2xy(QList<MapData::Poly> &polys, bool polygons) const;
|
||||
void ll2xy(QList<MapData::Poly> &polys) const;
|
||||
void ll2xy(QList<MapData::Point> &points) const;
|
||||
|
||||
void drawPolygons(QPainter *painter, const QList<MapData::Poly> &polygons) const;
|
||||
|
@ -107,6 +107,27 @@ bool RGNFile::readObstructionInfo(Handle &hdl, quint8 flags, quint32 size,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RGNFile::readBuoyInfo(Handle &hdl, quint8 flags, MapData::Point *point) const
|
||||
{
|
||||
quint16 val;
|
||||
quint8 lc;
|
||||
|
||||
if ((flags & 0xe0) != 0xe0)
|
||||
return true;
|
||||
|
||||
if (!readUInt16(hdl, val))
|
||||
return false;
|
||||
|
||||
lc = (val >> 10) & 0x0f;
|
||||
if (!lc)
|
||||
lc = (val >> 6) & 7;
|
||||
|
||||
if (lc)
|
||||
point->flags |= MapData::Point::Light;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RGNFile::readLabel(Handle &hdl, LBLFile *lbl, Handle &lblHdl,
|
||||
quint8 flags, quint32 size, MapData::Point *point) const
|
||||
{
|
||||
@ -116,7 +137,7 @@ bool RGNFile::readLabel(Handle &hdl, LBLFile *lbl, Handle &lblHdl,
|
||||
return false;
|
||||
|
||||
point->label = lbl->label(lblHdl, this, hdl, size);
|
||||
point->classLabel = true;
|
||||
point->flags |= MapData::Point::ClassLabel;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -154,12 +175,15 @@ bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
|
||||
|
||||
if (poly && Style::isRaster(poly->type))
|
||||
readRasterInfo(hdl, lbl, rs, poly);
|
||||
if (point && !Style::isMarinePoint(point->type))
|
||||
readLabel(hdl, lbl, lblHdl, flags, rs, point);
|
||||
|
||||
if (point && Style::isDepthPoint(point->type))
|
||||
readDepthInfo(hdl, flags, rs, point);
|
||||
if (point && Style::isObstructionPoint(point->type))
|
||||
readObstructionInfo(hdl, flags, rs, point);
|
||||
if (point && !Style::isMarinePoint(point->type))
|
||||
readLabel(hdl, lbl, lblHdl, flags, rs, point);
|
||||
if (point && Style::isBuoy(point->type))
|
||||
readBuoyInfo(hdl, flags, point);
|
||||
|
||||
return seek(hdl, off + rs);
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ private:
|
||||
MapData::Point *point) const;
|
||||
bool readObstructionInfo(Handle &hdl, quint8 flags, quint32 size,
|
||||
MapData::Point *point) const;
|
||||
bool readBuoyInfo(Handle &hdl, quint8 flags, MapData::Point *point) const;
|
||||
bool readLabel(Handle &hdl, LBLFile *lbl, Handle &lblHdl,
|
||||
quint8 flags, quint32 size, MapData::Point *point) const;
|
||||
|
||||
|
@ -675,17 +675,17 @@ void Style::defaultPointStyle(qreal ratio)
|
||||
_points[0x11108] = _points[0x3008];
|
||||
|
||||
// Marine stuff
|
||||
_points[0x10100] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10101] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10102] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10103] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10104] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10105] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10106] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10107] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10108] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10109] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x1010a] = Point(QImage(":/marine/light-major.png"), QPoint(8, -8));
|
||||
_points[0x10100] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10101] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10102] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10103] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10104] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10105] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10106] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10107] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10108] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10109] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x1010a] = Point(QImage(":/marine/light-major.png"));
|
||||
_points[0x10200] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
_points[0x10201] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
_points[0x10202] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
@ -699,8 +699,7 @@ void Style::defaultPointStyle(qreal ratio)
|
||||
_points[0x1020a] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
_points[0x1020b] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
_points[0x1020c] = Point(QImage(":/marine/buoy.png"), QPoint(6, -6));
|
||||
_points[0x1020d] = Point(QImage(":/marine/light-platform.png"),
|
||||
QPoint(8, -8));
|
||||
_points[0x1020d] = Point(QImage(":/marine/platform.png"));
|
||||
_points[0x1020e] = Point(QImage(":/marine/beacon.png"), QPoint(0, -8));
|
||||
_points[0x1020f] = Point(QImage(":/marine/beacon.png"), QPoint(0, -8));
|
||||
_points[0x10210] = Point(QImage(":/marine/beacon.png"), QPoint(0, -8));
|
||||
@ -710,6 +709,7 @@ void Style::defaultPointStyle(qreal ratio)
|
||||
_points[0x10214] = Point(QImage(":/marine/beacon.png"), QPoint(0, -8));
|
||||
_points[0x10215] = Point(QImage(":/marine/beacon.png"), QPoint(0, -8));
|
||||
_points[0x10216] = Point(QImage(":/marine/mooring-buoy.png"), QPoint(0, -5));
|
||||
_points[0x10304] = Point(QImage(":/marine/building.png"));
|
||||
_points[0x10305] = Point(QImage(":/marine/chimney.png"), QPoint(0, -11));
|
||||
_points[0x10306] = Point(QImage(":/marine/church.png"));
|
||||
_points[0x10307] = Point(QImage(":/marine/silo.png"));
|
||||
@ -1278,6 +1278,9 @@ Style::Style(qreal ratio, SubFile *typ)
|
||||
_small = pixelSizeFont(12);
|
||||
_extraSmall = pixelSizeFont(10);
|
||||
|
||||
_light = QImage(":/marine/light.png");
|
||||
_lightOffset = QPoint(11, 11);
|
||||
|
||||
defaultLineStyle(ratio);
|
||||
defaultPolygonStyle();
|
||||
defaultPointStyle(ratio);
|
||||
|
@ -113,6 +113,9 @@ public:
|
||||
const QFont *font(Style::FontSize size, Style::FontSize defaultSize
|
||||
= Style::Normal) const;
|
||||
|
||||
const QImage *light() const {return &_light;}
|
||||
const QPoint &lightOffset() const {return _lightOffset;}
|
||||
|
||||
static bool isPOI(quint32 type)
|
||||
{return !((type >= TYPE(0x01) && type <= TYPE(0x1f))
|
||||
|| (type >= 0x11400 && type < 0x11500));}
|
||||
@ -143,6 +146,10 @@ public:
|
||||
{return (type == 0x10301);}
|
||||
static bool isObstructionPoint(quint32 type)
|
||||
{return (type >= 0x10400 && type <= 0x10401);}
|
||||
static bool isBuoy(quint32 type)
|
||||
{return (type >= 0x10200 && type < 0x10300);}
|
||||
static bool isLight(quint32 type)
|
||||
{return (type >= 0x10100 && type < 0x10200);}
|
||||
static bool isMarinePoint(quint32 type)
|
||||
{return type >= 0x10100 && type < 0x10a00;}
|
||||
static bool isMarina(quint32 type)
|
||||
@ -193,6 +200,9 @@ private:
|
||||
|
||||
/* Fonts and images must be initialized after QGuiApplication! */
|
||||
QFont _large, _normal, _small, _extraSmall;
|
||||
|
||||
QImage _light;
|
||||
QPoint _lightOffset;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -183,12 +183,14 @@ void VectorTile::polys(const RectC &rect, const Zoom &zoom,
|
||||
}
|
||||
|
||||
copyPolys(rect, &polys->polygons, polygons);
|
||||
copyPolys(rect, &polys->lines, lines);
|
||||
if (lines)
|
||||
copyPolys(rect, &polys->lines, lines);
|
||||
|
||||
cache->insert(subdiv, polys);
|
||||
} else {
|
||||
copyPolys(rect, &polys->polygons, polygons);
|
||||
copyPolys(rect, &polys->lines, lines);
|
||||
if (lines)
|
||||
copyPolys(rect, &polys->lines, lines);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user