1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 19:55:53 +01:00

Use the GreatCircle for all segments longer than 1 arc minute

This commit is contained in:
Martin Tůma 2018-09-15 00:22:27 +02:00
parent e707cc30ad
commit c89137204e

View File

@ -46,19 +46,18 @@ void PathItem::updatePainterPath(Map *map)
_painterPath.moveTo(map->ll2xy(_path.first().coordinates())); _painterPath.moveTo(map->ll2xy(_path.first().coordinates()));
for (int i = 1; i < _path.size(); i++) { for (int i = 1; i < _path.size(); i++) {
Coordinates c1(_path.at(i-1).coordinates()); const PathPoint &p1 = _path.at(i-1);
Coordinates c2(_path.at(i).coordinates()); const PathPoint &p2 = _path.at(i);
unsigned n = qAbs(c1.lon() - c2.lon()); unsigned n = (p2.distance() - p1.distance()) / 1855.3;
if (n) { if (n) {
double prev = c1.lon(); Coordinates c1(p1.coordinates());
Coordinates c2(p2.coordinates());
GreatCircle gc(c1, c2); GreatCircle gc(c1, c2);
double prev = c1.lon();
if (n > 180) for (unsigned j = 1; j <= n; j++) {
n = n - 180; Coordinates c(gc.pointAt(j/(double)n));
for (unsigned j = 1; j <= n * 60; j++) {
Coordinates c(gc.pointAt(j/(n * 60.0)));
double current = c.lon(); double current = c.lon();
if (fabs(current - prev) > 180.0) if (fabs(current - prev) > 180.0)
_painterPath.moveTo(map->ll2xy(c)); _painterPath.moveTo(map->ll2xy(c));
@ -67,7 +66,7 @@ void PathItem::updatePainterPath(Map *map)
prev = current; prev = current;
} }
} else } else
_painterPath.lineTo(map->ll2xy(c2)); _painterPath.lineTo(map->ll2xy(p2.coordinates()));
} }
} }