summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Beschow <bbeschow@cs.tu-berlin.de>2016-09-02 06:56:14 (GMT)
committerBernhard Beschow <bbeschow@cs.tu-berlin.de>2016-10-16 17:39:05 (GMT)
commit5189a1be168d2fa686ba61953e176b2d0df751e3 (patch)
treeb66a8ee8d0bfc8a72630591be39555a058f1ff1e
parent7463cfd00e53d8e0a89f933efd1755ba11084689 (diff)
make zoom level adoptions be the last operation on styles
-rw-r--r--src/lib/marble/StyleBuilder.cpp57
1 files changed, 28 insertions, 29 deletions
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) {