[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [marble] src/lib/marble: make zoom level adoptions be the last operation on styles
From:       Bernhard Beschow <bbeschow () cs ! tu-berlin ! de>
Date:       2016-10-16 17:47:34
Message-ID: E1bvpX4-0005bh-VF () code ! kde ! org
[Download RAW message or body]

Git commit 5189a1be168d2fa686ba61953e176b2d0df751e3 by Bernhard Beschow.
Committed on 16/10/2016 at 17:39.
Pushed by beschow into branch 'master'.

make zoom level adoptions be the last operation on styles

M  +28   -29   src/lib/marble/StyleBuilder.cpp

http://commits.kde.org/marble/5189a1be168d2fa686ba61953e176b2d0df751e3

diff --git a/src/lib/marble/StyleBuilder.cpp b/src/lib/marble/StyleBuilder.cpp
index bd0e7be..fb5e598 100644
--- a/src/lib/marble/StyleBuilder.cpp
+++ b/src/lib/marble/StyleBuilder.cpp
@@ -1301,6 +1301,7 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(const \
                StyleParameters &paramete
     } else if (placemark->geometry()->nodeType() == \
GeoDataTypes::GeoDataLineStringType) {  GeoDataPolyStyle polyStyle = \
style->polyStyle();  GeoDataLineStyle lineStyle = style->lineStyle();
+        GeoDataLabelStyle labelStyle = style->labelStyle();
         lineStyle.setCosmeticOutline(true);
 
         if(visualCategory == GeoDataPlacemark::AdminLevel2){
@@ -1316,6 +1317,29 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(const \
StyleParameters &paramete  visualCategory <= GeoDataPlacemark::HighwayMotorway) ||
                 visualCategory == GeoDataPlacemark::TransportAirportRunway) {
 
+            QString const accessValue = osmData.tagValue(QStringLiteral("access"));
+            if (accessValue == QLatin1String("private") ||
+                accessValue == QLatin1String("no") ||
+                accessValue == QLatin1String("agricultural") ||
+                accessValue == QLatin1String("delivery") ||
+                accessValue == QLatin1String("forestry")) {
+                QColor polyColor = polyStyle.color();
+                qreal hue, sat, val;
+                polyColor.getHsvF(&hue, &sat, &val);
+                polyColor.setHsvF(0.98, qMin(1.0, 0.2 + sat), val);
+                polyStyle.setColor(polyColor);
+                lineStyle.setColor(lineStyle.color().darker(150));
+            }
+
+            if (osmData.containsTag("tunnel", "yes") ) {
+                QColor polyColor = polyStyle.color();
+                qreal hue, sat, val;
+                polyColor.getHsvF(&hue, &sat, &val);
+                polyColor.setHsvF(hue, 0.25 * sat, 0.95 * val);
+                polyStyle.setColor(polyColor);
+                lineStyle.setColor(lineStyle.color().lighter(115));
+            }
+
             if (parameters.tileLevel <= 8) {
                 /** @todo: Dummy implementation for dynamic style changes based on \
tile level, replace with sane values */  lineStyle.setPhysicalWidth(0.0);
@@ -1346,29 +1370,6 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(const \
StyleParameters &paramete  }
             }
 
-            QString const accessValue = osmData.tagValue(QStringLiteral("access"));
-            if (accessValue == QLatin1String("private") ||
-                accessValue == QLatin1String("no") ||
-                accessValue == QLatin1String("agricultural") ||
-                accessValue == QLatin1String("delivery") ||
-                accessValue == QLatin1String("forestry")) {
-                QColor polyColor = polyStyle.color();
-                qreal hue, sat, val;
-                polyColor.getHsvF(&hue, &sat, &val);
-                polyColor.setHsvF(0.98, qMin(1.0, 0.2 + sat), val);
-                polyStyle.setColor(polyColor);
-                lineStyle.setColor(lineStyle.color().darker(150));
-            }
-
-            if (osmData.containsTag("tunnel", "yes") ) {
-                QColor polyColor = polyStyle.color();
-                qreal hue, sat, val;
-                polyColor.getHsvF(&hue, &sat, &val);
-                polyColor.setHsvF(hue, 0.25 * sat, 0.95 * val);
-                polyStyle.setColor(polyColor);
-                lineStyle.setColor(lineStyle.color().lighter(115));
-            }
-
         } else if (visualCategory == GeoDataPlacemark::NaturalWater) {
             if (parameters.tileLevel <= 3) {
                 lineStyle.setWidth(1);
@@ -1382,16 +1383,14 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(const \
StyleParameters &paramete  float const width = widthValue.toFloat(&ok);
                 lineStyle.setPhysicalWidth(ok ? qBound(0.1f, width, 200.0f) : 0.0f);
             }
+        } else if (visualCategory == GeoDataPlacemark::HighwayTrack
+                   || (visualCategory >= GeoDataPlacemark::RailwayRail && \
visualCategory <= GeoDataPlacemark::RailwayFunicular)) { +            \
labelStyle.setColor(QColor(Qt::transparent));  }
         GeoDataStyle::Ptr newStyle(new GeoDataStyle(*style));
         newStyle->setPolyStyle(polyStyle);
         newStyle->setLineStyle(lineStyle);
-
-        bool const hideLabel = visualCategory == GeoDataPlacemark::HighwayTrack
-                || (visualCategory >= GeoDataPlacemark::RailwayRail && \
                visualCategory <= GeoDataPlacemark::RailwayFunicular);
-        if (hideLabel) {
-            newStyle->labelStyle().setColor(QColor(Qt::transparent));
-        }
+        newStyle->setLabelStyle(labelStyle);
 
         style = newStyle;
     } else if (placemark->geometry()->nodeType() == \
GeoDataTypes::GeoDataPolygonType) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic