summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/location/declarativemaps/qdeclarativecirclemapitem.cpp53
-rw-r--r--src/location/declarativemaps/qdeclarativegeomapitembase.cpp2
-rw-r--r--src/location/declarativemaps/qdeclarativepolygonmapitem.cpp33
-rw-r--r--src/location/declarativemaps/qgeomapitemgeometry.cpp9
-rw-r--r--src/location/maps/qgeoprojection.cpp3
5 files changed, 3 insertions, 97 deletions
diff --git a/src/location/declarativemaps/qdeclarativecirclemapitem.cpp b/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
index f5127c5e..4cba1ab6 100644
--- a/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativecirclemapitem.cpp
@@ -246,56 +246,6 @@ void QGeoMapCircleGeometry::updateScreenPointsInvert(const QList<QGeoCoordinate>
}
ppi.translate(-1 * origin.toPointF());
-#if 0 // old poly2tri code, has to be ported to clip2tri in order to work with tilted projections
- std::vector<p2t::Point*> borderPts;
- borderPts.reserve(4);
-
- std::vector<p2t::Point*> curPts;
- curPts.reserve(ppi.elementCount());
- for (int i = 0; i < ppi.elementCount(); ++i) {
- const QPainterPath::Element e = ppi.elementAt(i);
- if (e.isMoveTo() || i == ppi.elementCount() - 1
- || (qAbs(e.x - curPts.front()->x) < 0.1
- && qAbs(e.y - curPts.front()->y) < 0.1)) {
- if (curPts.size() > 2) {
- for (int j = 0; j < 4; ++j) {
- const QPainterPath::Element e2 = ppiBorder.elementAt(j);
- borderPts.push_back(new p2t::Point(e2.x, e2.y));
- }
- p2t::CDT *cdt = new p2t::CDT(borderPts);
- cdt->AddHole(curPts);
- cdt->Triangulate();
- std::vector<p2t::Triangle*> tris = cdt->GetTriangles();
- screenVertices_.reserve(screenVertices_.size() + int(tris.size()));
- for (size_t i = 0; i < tris.size(); ++i) {
- p2t::Triangle *t = tris.at(i);
- for (int j = 0; j < 3; ++j) {
- p2t::Point *p = t->GetPoint(j);
- screenVertices_ << QPointF(p->x, p->y);
- }
- }
- delete cdt;
- }
- curPts.clear();
- curPts.reserve(ppi.elementCount() - i);
- curPts.push_back(new p2t::Point(e.x, e.y));
- } else if (e.isLineTo()) {
- curPts.push_back(new p2t::Point(e.x, e.y));
- } else {
- qWarning("Unhandled element type in circle painterpath");
- }
- }
-
- if (curPts.size() > 0) {
- qDeleteAll(curPts.begin(), curPts.end());
- curPts.clear();
- }
-
- if (borderPts.size() > 0) {
- qDeleteAll(borderPts.begin(), borderPts.end());
- borderPts.clear();
- }
-#else // Using qTriangulate as this case is not frequent, and not many circles including both poles are usually used
QTriangleSet ts = qTriangulate(ppi);
qreal *vx = ts.vertices.data();
@@ -313,7 +263,6 @@ void QGeoMapCircleGeometry::updateScreenPointsInvert(const QList<QGeoCoordinate>
}
for (int i = 0; i < (ts.vertices.size()/2*2); i += 2)
screenVertices_ << QPointF(vx[i], vx[i + 1]);
-#endif
screenBounds_ = ppi.boundingRect();
sourceBounds_ = screenBounds_;
@@ -702,7 +651,7 @@ void QDeclarativeCircleMapItem::updateCirclePathForRendering(QList<QGeoCoordinat
for (int i = 1; i <= path.count(); ++i) {
int index = i % path.count();
QDoubleVector2D point = map()->geoProjection().wrapMapProjection(map()->geoProjection().geoToMapProjection(path.at(index)));
- if ( (qAbs(point.x() - prev.x())) >= 0.5 ) { // TODO: Add a projectionWidth to GeoProjection, perhaps?
+ if ( (qAbs(point.x() - prev.x())) >= 0.5 ) {
wrapPathIndex << index;
if (wrapPathIndex.size() == 2 || !(crossNorthPole && crossSouthPole))
break;
diff --git a/src/location/declarativemaps/qdeclarativegeomapitembase.cpp b/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
index d3a527cc..c4d43b45 100644
--- a/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
+++ b/src/location/declarativemaps/qdeclarativegeomapitembase.cpp
@@ -179,7 +179,7 @@ void QDeclarativeGeoMapItemBase::setPositionOnMap(const QGeoCoordinate &coordina
return;
QDoubleVector2D wrappedProjection = map_->geoProjection().geoToWrappedMapProjection(coordinate);
- if (! map_->geoProjection().isProjectable(wrappedProjection))
+ if (!map_->geoProjection().isProjectable(wrappedProjection))
return;
QDoubleVector2D pos = map_->geoProjection().wrappedMapProjectionToItemPosition(wrappedProjection);
diff --git a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
index b9632636..8f5442d6 100644
--- a/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
+++ b/src/location/declarativemaps/qdeclarativepolygonmapitem.cpp
@@ -276,9 +276,6 @@ void QGeoMapPolygonGeometry::updateScreenPoints(const QGeoMap &map)
if (ppi.elementCount() < 3)
return;
- // TODO: move this to clip2tri, and remove the code below.
- // For clip2tri use the intersection between the the viewport AND the map as clipping region.
-
// Intersection between the viewport and a concave polygon can create multiple polygons
// joined by a line at the viewport border, and poly2tri does not triangulate this very well
// so use the full src path if the resulting polygon is concave.
@@ -313,35 +310,6 @@ void QGeoMapPolygonGeometry::updateScreenPoints(const QGeoMap &map)
screenOutline_ = ppi;
-#if 0 // TODO: This code appears to crash seldomly in presence of tilt. Requires further investigation
- std::vector<std::vector<c2t::Point>> clipperPoints;
- clipperPoints.push_back(std::vector<c2t::Point>());
- std::vector<c2t::Point> &curPts = clipperPoints.front();
- curPts.reserve(ppi.elementCount());
- for (int i = 0; i < ppi.elementCount(); ++i) {
- const QPainterPath::Element e = ppi.elementAt(i);
- if (e.isMoveTo() || i == ppi.elementCount() - 1
- || (qAbs(e.x - curPts.front().x) < 0.1
- && qAbs(e.y - curPts.front().y) < 0.1)) {
- if (curPts.size() > 2) {
- c2t::clip2tri *cdt = new c2t::clip2tri();
- std::vector<c2t::Point> outputTriangles;
- cdt->triangulate(clipperPoints, outputTriangles, std::vector<c2t::Point>());
- for (size_t i = 0; i < outputTriangles.size(); ++i) {
- screenVertices_ << QPointF(outputTriangles[i].x, outputTriangles[i].y);
- }
- delete cdt;
- }
- curPts.clear();
- curPts.reserve(ppi.elementCount() - i);
- curPts.push_back( c2t::Point(e.x, e.y));
- } else if (e.isLineTo()) {
- curPts.push_back( c2t::Point(e.x, e.y));
- } else {
- qWarning("Unhandled element type in polygon painterpath");
- }
- }
-#else // Old qTriangulate()-based code.
QTriangleSet ts = qTriangulate(ppi);
qreal *vx = ts.vertices.data();
@@ -359,7 +327,6 @@ void QGeoMapPolygonGeometry::updateScreenPoints(const QGeoMap &map)
}
for (int i = 0; i < (ts.vertices.size()/2*2); i += 2)
screenVertices_ << QPointF(vx[i], vx[i + 1]);
-#endif
screenBounds_ = ppi.boundingRect();
}
diff --git a/src/location/declarativemaps/qgeomapitemgeometry.cpp b/src/location/declarativemaps/qgeomapitemgeometry.cpp
index 80f3e218..2883c2bb 100644
--- a/src/location/declarativemaps/qgeomapitemgeometry.cpp
+++ b/src/location/declarativemaps/qgeomapitemgeometry.cpp
@@ -101,15 +101,6 @@ QRectF QGeoMapItemGeometry::translateToCommonOrigin(const QList<QGeoMapItemGeome
// first get max offset
QPointF maxOffset = geoms.at(0)->firstPointOffset();
foreach (QGeoMapItemGeometry *g, geoms) {
-#ifndef QT_NO_DEBUG
- //Q_ASSERT(g->origin() == origin); // this might fail on clipper clipping inaccuracies, so better to remove it in production
- if (!qFuzzyCompare(origin.latitude(), g->origin().latitude())) {
- qWarning("translateToCommonOrigin: Origins differ!");
- }
- if (!qFuzzyCompare(origin.longitude(), g->origin().longitude())) {
- qWarning("translateToCommonOrigin: Origins differ!");
- }
-#endif
QPointF o = g->firstPointOffset();
maxOffset.setX(qMax(o.x(), maxOffset.x()));
maxOffset.setY(qMax(o.y(), maxOffset.y()));
diff --git a/src/location/maps/qgeoprojection.cpp b/src/location/maps/qgeoprojection.cpp
index 15f400d9..586dcb02 100644
--- a/src/location/maps/qgeoprojection.cpp
+++ b/src/location/maps/qgeoprojection.cpp
@@ -388,8 +388,7 @@ void QGeoProjectionWebMercator::setupCamera()
m_centerNearPlane = m_eye + m_viewNormalized;
m_centerNearPlaneMercator = m_eyeMercator + m_viewNormalized * m_nearPlaneMercator;
- // TODO: support tilting angles > 90.0, if desired. And flip the bottom corners with the top corners, if needed
- // by clipper.
+ // The method does not support tilting angles >= 90.0 or < 0.
// The following formula is used to have a growing epsilon with the zoom level,
// in order not to have too large values at low zl, which would overflow when converted to Clipper::cInt.