mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-30 22:51:16 +01:00
Compare commits
No commits in common. "8b391fc871e881006b679c57a900a54f211f5cc8" and "3e6ad20c059c2d4a25e0c164cb9e73a6fa133bb0" have entirely different histories.
8b391fc871
...
3e6ad20c05
@ -106,6 +106,10 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
struct Polys {
|
struct Polys {
|
||||||
|
Polys() {}
|
||||||
|
Polys(const QList<Poly> &polygons, const QList<Poly> &lines)
|
||||||
|
: polygons(polygons), lines(lines) {}
|
||||||
|
|
||||||
QList<Poly> polygons;
|
QList<Poly> polygons;
|
||||||
QList<Poly> lines;
|
QList<Poly> lines;
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
using namespace IMG;
|
using namespace IMG;
|
||||||
|
|
||||||
static void copyPolys(const RectC &rect, const QList<MapData::Poly> *src,
|
static void copyPolys(const RectC &rect, QList<MapData::Poly> *src,
|
||||||
QList<MapData::Poly> *dst)
|
QList<MapData::Poly> *dst)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < src->size(); i++)
|
for (int i = 0; i < src->size(); i++)
|
||||||
@ -10,7 +10,7 @@ static void copyPolys(const RectC &rect, const QList<MapData::Poly> *src,
|
|||||||
dst->append(src->at(i));
|
dst->append(src->at(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void copyPoints(const RectC &rect, const QList<MapData::Point> *src,
|
static void copyPoints(const RectC &rect, QList<MapData::Point> *src,
|
||||||
QList<MapData::Point> *dst)
|
QList<MapData::Point> *dst)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < src->size(); j++)
|
for (int j = 0; j < src->size(); j++)
|
||||||
@ -152,6 +152,7 @@ void VectorTile::polys(const RectC &rect, const Zoom &zoom,
|
|||||||
MapData::Polys *polys = cache->object(subdiv);
|
MapData::Polys *polys = cache->object(subdiv);
|
||||||
if (!polys) {
|
if (!polys) {
|
||||||
quint32 shift = _tre->shift(subdiv->bits());
|
quint32 shift = _tre->shift(subdiv->bits());
|
||||||
|
QList<MapData::Poly> p, l;
|
||||||
|
|
||||||
if (!rgnHdl) {
|
if (!rgnHdl) {
|
||||||
rgnHdl = new SubFile::Handle(_rgn);
|
rgnHdl = new SubFile::Handle(_rgn);
|
||||||
@ -162,16 +163,14 @@ void VectorTile::polys(const RectC &rect, const Zoom &zoom,
|
|||||||
if (!subdiv->initialized() && !_rgn->subdivInit(*rgnHdl, subdiv))
|
if (!subdiv->initialized() && !_rgn->subdivInit(*rgnHdl, subdiv))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
polys = new MapData::Polys();
|
|
||||||
|
|
||||||
_rgn->polyObjects(*rgnHdl, subdiv, RGNFile::Polygon, _lbl, *lblHdl,
|
_rgn->polyObjects(*rgnHdl, subdiv, RGNFile::Polygon, _lbl, *lblHdl,
|
||||||
_net, *netHdl, &polys->polygons);
|
_net, *netHdl, &p);
|
||||||
_rgn->polyObjects(*rgnHdl, subdiv, RGNFile::Line, _lbl, *lblHdl,
|
_rgn->polyObjects(*rgnHdl, subdiv, RGNFile::Line, _lbl, *lblHdl,
|
||||||
_net, *netHdl, &polys->lines);
|
_net, *netHdl, &l);
|
||||||
_rgn->extPolyObjects(*rgnHdl, subdiv, shift, RGNFile::Polygon, _lbl,
|
_rgn->extPolyObjects(*rgnHdl, subdiv, shift, RGNFile::Polygon, _lbl,
|
||||||
*lblHdl, &polys->polygons);
|
*lblHdl, &p);
|
||||||
_rgn->extPolyObjects(*rgnHdl, subdiv, shift, RGNFile::Line, _lbl,
|
_rgn->extPolyObjects(*rgnHdl, subdiv, shift, RGNFile::Line, _lbl,
|
||||||
*lblHdl, &polys->lines);
|
*lblHdl, &l);
|
||||||
|
|
||||||
if (_net && _net->hasLinks()) {
|
if (_net && _net->hasLinks()) {
|
||||||
if (!nodHdl)
|
if (!nodHdl)
|
||||||
@ -179,16 +178,15 @@ void VectorTile::polys(const RectC &rect, const Zoom &zoom,
|
|||||||
if (!nodHdl2)
|
if (!nodHdl2)
|
||||||
nodHdl2 = new SubFile::Handle(_nod);
|
nodHdl2 = new SubFile::Handle(_nod);
|
||||||
_rgn->links(*rgnHdl, subdiv, shift, _net, *netHdl, _nod, *nodHdl,
|
_rgn->links(*rgnHdl, subdiv, shift, _net, *netHdl, _nod, *nodHdl,
|
||||||
*nodHdl2, _lbl, *lblHdl, &polys->lines);
|
*nodHdl2, _lbl, *lblHdl, &l);
|
||||||
}
|
}
|
||||||
|
|
||||||
copyPolys(rect, &polys->polygons, polygons);
|
copyPolys(rect, &p, polygons);
|
||||||
copyPolys(rect, &polys->lines, lines);
|
copyPolys(rect, &l, lines);
|
||||||
|
cache->insert(subdiv, new MapData::Polys(p, l));
|
||||||
cache->insert(subdiv, polys);
|
|
||||||
} else {
|
} else {
|
||||||
copyPolys(rect, &polys->polygons, polygons);
|
copyPolys(rect, &(polys->polygons), polygons);
|
||||||
copyPolys(rect, &polys->lines, lines);
|
copyPolys(rect, &(polys->lines), lines);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,6 +226,8 @@ void VectorTile::points(const RectC &rect, const Zoom &zoom,
|
|||||||
|
|
||||||
QList<MapData::Point> *pl = cache->object(subdiv);
|
QList<MapData::Point> *pl = cache->object(subdiv);
|
||||||
if (!pl) {
|
if (!pl) {
|
||||||
|
QList<MapData::Point> p;
|
||||||
|
|
||||||
if (!rgnHdl) {
|
if (!rgnHdl) {
|
||||||
rgnHdl = new SubFile::Handle(_rgn);
|
rgnHdl = new SubFile::Handle(_rgn);
|
||||||
lblHdl = new SubFile::Handle(_lbl);
|
lblHdl = new SubFile::Handle(_lbl);
|
||||||
@ -236,17 +236,14 @@ void VectorTile::points(const RectC &rect, const Zoom &zoom,
|
|||||||
if (!subdiv->initialized() && !_rgn->subdivInit(*rgnHdl, subdiv))
|
if (!subdiv->initialized() && !_rgn->subdivInit(*rgnHdl, subdiv))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pl = new QList<MapData::Point>;
|
|
||||||
|
|
||||||
_rgn->pointObjects(*rgnHdl, subdiv, RGNFile::Point, _lbl, *lblHdl,
|
_rgn->pointObjects(*rgnHdl, subdiv, RGNFile::Point, _lbl, *lblHdl,
|
||||||
pl);
|
&p);
|
||||||
_rgn->pointObjects(*rgnHdl, subdiv, RGNFile::IndexedPoint, _lbl,
|
_rgn->pointObjects(*rgnHdl, subdiv, RGNFile::IndexedPoint, _lbl,
|
||||||
*lblHdl, pl);
|
*lblHdl, &p);
|
||||||
_rgn->extPointObjects(*rgnHdl, subdiv, _lbl, *lblHdl, pl);
|
_rgn->extPointObjects(*rgnHdl, subdiv, _lbl, *lblHdl, &p);
|
||||||
|
|
||||||
copyPoints(rect, pl, points);
|
copyPoints(rect, &p, points);
|
||||||
|
cache->insert(subdiv, new QList<MapData::Point>(p));
|
||||||
cache->insert(subdiv, pl);
|
|
||||||
} else
|
} else
|
||||||
copyPoints(rect, pl, points);
|
copyPoints(rect, pl, points);
|
||||||
}
|
}
|
||||||
@ -283,7 +280,6 @@ void VectorTile::elevations(const RectC &rect, const Zoom &zoom,
|
|||||||
// the given zoom (we prefer rendering quality rather than speed). For
|
// the given zoom (we prefer rendering quality rather than speed). For
|
||||||
// maps with a single level this has no effect.
|
// maps with a single level this has no effect.
|
||||||
int level = qMax(0, _dem->level(zoom) - 1);
|
int level = qMax(0, _dem->level(zoom) - 1);
|
||||||
|
|
||||||
QList<const DEMTile*> tiles(_dem->tiles(rect, level));
|
QList<const DEMTile*> tiles(_dem->tiles(rect, level));
|
||||||
for (int i = 0; i < tiles.size(); i++) {
|
for (int i = 0; i < tiles.size(); i++) {
|
||||||
const DEMTile *tile = tiles.at(i);
|
const DEMTile *tile = tiles.at(i);
|
||||||
|
@ -18,7 +18,6 @@ using namespace IMG;
|
|||||||
|
|
||||||
#define EPSILON 1e-6
|
#define EPSILON 1e-6
|
||||||
#define TILE_SIZE 384
|
#define TILE_SIZE 384
|
||||||
#define DELTA 1e-3
|
|
||||||
|
|
||||||
static RectC limitBounds(const RectC &bounds, const Projection &proj)
|
static RectC limitBounds(const RectC &bounds, const Projection &proj)
|
||||||
{
|
{
|
||||||
@ -275,8 +274,8 @@ double IMGMap::elevation(const Coordinates &c)
|
|||||||
if (d->hasDEM()) {
|
if (d->hasDEM()) {
|
||||||
QList<MapData::Elevation> tiles;
|
QList<MapData::Elevation> tiles;
|
||||||
|
|
||||||
d->elevations(RectC(c, Coordinates(c.lon() + DELTA, c.lat() - DELTA)),
|
d->elevations(RectC(Coordinates(c), Coordinates(c)), d->zooms().max(),
|
||||||
d->zooms().max(), &tiles);
|
&tiles);
|
||||||
DEMTree tree(tiles);
|
DEMTree tree(tiles);
|
||||||
|
|
||||||
return tree.elevation(c);
|
return tree.elevation(c);
|
||||||
|
@ -13,6 +13,8 @@ using namespace Mapsforge;
|
|||||||
#define PATHS_EXTENT 20
|
#define PATHS_EXTENT 20
|
||||||
#define SEARCH_EXTENT -0.5
|
#define SEARCH_EXTENT -0.5
|
||||||
|
|
||||||
|
#define BLUR_RADIUS 3
|
||||||
|
|
||||||
static double LIMIT = cos(deg2rad(170));
|
static double LIMIT = cos(deg2rad(170));
|
||||||
|
|
||||||
static qreal area(const QPainterPath &polygon)
|
static qreal area(const QPainterPath &polygon)
|
||||||
|
Loading…
Reference in New Issue
Block a user