Commit e134bd4e authored by Dennis Nienhüser's avatar Dennis Nienhüser
Browse files

Do not render duplicated OSM placemarks several times

parent aa3352e4
......@@ -25,6 +25,7 @@
#include "GeoDataPlacemark.h"
#include "GeoDataStyle.h"
#include "GeoDataTypes.h"
#include "OsmPlacemarkData.h"
#include "MarbleDebug.h"
#include "MarbleGlobal.h"
......@@ -309,6 +310,16 @@ void PlacemarkLayout::addPlacemarks( QModelIndex parent, int first, int last )
continue;
}
if (placemark->hasOsmData()) {
qint64 const osmId = placemark->osmData().id();
if (osmId > 0) {
if (m_osmIds.contains(osmId)) {
continue; // placemark is already shown
}
m_osmIds << osmId;
}
}
int zoomLevel = placemark->zoomLevel();
TileId key = TileId::fromCoordinates( coordinates, zoomLevel );
m_placemarkCache[key].append( placemark );
......@@ -333,6 +344,12 @@ void PlacemarkLayout::removePlacemarks( QModelIndex parent, int first, int last
int zoomLevel = placemark->zoomLevel();
TileId key = TileId::fromCoordinates( coordinates, zoomLevel );
m_placemarkCache[key].removeAll( placemark );
if (placemark->hasOsmData()) {
qint64 const osmId = placemark->osmData().id();
if (osmId > 0) {
m_osmIds.remove(osmId);
}
}
}
emit repaintNeeded();
}
......@@ -341,6 +358,7 @@ void PlacemarkLayout::resetCacheData()
{
const int rowCount = m_placemarkModel.rowCount();
m_osmIds.clear();
m_placemarkCache.clear();
requestStyleReset();
addPlacemarks( m_placemarkModel.index( 0, 0 ), 0, rowCount );
......
......@@ -143,6 +143,7 @@ class PlacemarkLayout : public QObject
/// map providing the list of placemark belonging in TileId as key
QMap<TileId, QList<const GeoDataPlacemark*> > m_placemarkCache;
QSet<qint64> m_osmIds;
const QVector< GeoDataFeature::GeoDataVisualCategory > m_acceptedVisualCategories;
......
Markdown is supported
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