Commit d202b912 authored by Volker Krause's avatar Volker Krause
Browse files

Remove broken caching of area computation results

The problem here is that this code uses the address of the argument as
cache key. The argument can however be a temporary, meaning we can get
cache key collisions and thus wrong results. This shows in tiles
occasionally missing a random subset of polygons, typically in the zoom
range 11-15, where we apply area size filters.

The solution is fortunately easy: Remove the caching of the area
computation result entirely. We can do this as this neither contributes
to the overall cost in a measurable way, nor do we seem to compute the
area of the same polygon multiple times anyway.
parent 20f22ec5
......@@ -188,10 +188,6 @@ bool VectorClipper::canBeArea(GeoDataPlacemark::GeoDataVisualCategory visualCate
qreal VectorClipper::area(const GeoDataLinearRing &ring)
auto const iter = m_areas.find(&ring);
if (iter != m_areas.end()) {
return *iter;
int const n = ring.size();
qreal area = 0;
if (n<3) {
......@@ -202,7 +198,6 @@ qreal VectorClipper::area(const GeoDataLinearRing &ring)
area += (ring[0].longitude() - ring[n-1].longitude() ) * (ring[0].latitude() + ring[n-1].latitude());
qreal const result = EARTH_RADIUS * EARTH_RADIUS * qAbs(area * 0.5);
m_areas.insert(&ring, result);
return result;
......@@ -131,7 +131,6 @@ private:
QMap<TileId, QVector<GeoDataPlacemark*> > m_items;
int m_maxZoomLevel;
GeoSceneMercatorTileProjection m_tileProjection;
QHash<const GeoDataLinearRing*, qreal> m_areas;
QSet<GeoDataRelation*> m_relations;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment