summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-10-22 11:12:22 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-11-05 16:47:11 (GMT)
commitf2ef75f7dccedeb5b519273b0760b0850c553c9c (patch)
treebc901b481a7f6a904e36cf8478a8ae3319b7615c
parent7bce2565109f6cb8bea8bfd897ec72d2f9b50cc5 (diff)
Do not create geographics items from invisible placemarks
So far they will never become visible (=used), so spare the CPU time and memory overhead for now.
-rw-r--r--src/lib/marble/layers/GeometryLayer.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/marble/layers/GeometryLayer.cpp b/src/lib/marble/layers/GeometryLayer.cpp
index d0a90d7..95d0284 100644
--- a/src/lib/marble/layers/GeometryLayer.cpp
+++ b/src/lib/marble/layers/GeometryLayer.cpp
@@ -213,6 +213,10 @@ void GeometryLayerPrivate::createGraphicsItems( const GeoDataObject *object )
void GeometryLayerPrivate::createGraphicsItemFromGeometry(const GeoDataGeometry* object, const GeoDataPlacemark *placemark , bool avoidOsmDuplicates)
{
+ if (!placemark->isGloballyVisible()) {
+ return; // Reconsider this when visibility can be changed dynamically
+ }
+
GeoGraphicsItem *item = 0;
if ( object->nodeType() == GeoDataTypes::GeoDataLineStringType )
{
@@ -285,6 +289,10 @@ void GeometryLayerPrivate::createGraphicsItemFromGeometry(const GeoDataGeometry*
void GeometryLayerPrivate::createGraphicsItemFromOverlay( const GeoDataOverlay *overlay )
{
+ if (!overlay->isGloballyVisible()) {
+ return; // Reconsider this when visibility can be changed dynamically
+ }
+
GeoGraphicsItem* item = 0;
if ( overlay->nodeType() == GeoDataTypes::GeoDataPhotoOverlayType ) {
GeoDataPhotoOverlay const * photoOverlay = static_cast<GeoDataPhotoOverlay const *>( overlay );
@@ -309,7 +317,7 @@ void GeometryLayerPrivate::removeGraphicsItems( const GeoDataFeature *feature )
if( feature->nodeType() == GeoDataTypes::GeoDataPlacemarkType ) {
GeoDataPlacemark const * placemark = static_cast<GeoDataPlacemark const *>(feature);
- if (placemark->hasOsmData() && placemark->osmData().id() > 0) {
+ if (placemark->isGloballyVisible() && placemark->hasOsmData() && placemark->osmData().id() > 0) {
QMap<qint64,OsmQueue>* osmItems = 0;
if (placemark->geometry()->nodeType() == GeoDataTypes::GeoDataLinearRingType) {
osmItems = &m_osmWayItems;