From kde-commits Sun Oct 16 17:47:34 2016 From: Bernhard Beschow Date: Sun, 16 Oct 2016 17:47:34 +0000 To: kde-commits Subject: [marble] src/lib/marble: make zoom level adoptions be the last operation on styles Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=147664006327262 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(cons= t StyleParameters ¶mete } else if (placemark->geometry()->nodeType() =3D=3D GeoDataTypes::GeoD= ataLineStringType) { GeoDataPolyStyle polyStyle =3D style->polyStyle(); GeoDataLineStyle lineStyle =3D style->lineStyle(); + GeoDataLabelStyle labelStyle =3D style->labelStyle(); lineStyle.setCosmeticOutline(true); = if(visualCategory =3D=3D GeoDataPlacemark::AdminLevel2){ @@ -1316,6 +1317,29 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(con= st StyleParameters ¶mete visualCategory <=3D GeoDataPlacemark::HighwayMotorway) || visualCategory =3D=3D GeoDataPlacemark::TransportAirportRu= nway) { = + QString const accessValue =3D osmData.tagValue(QStringLiteral(= "access")); + if (accessValue =3D=3D QLatin1String("private") || + accessValue =3D=3D QLatin1String("no") || + accessValue =3D=3D QLatin1String("agricultural") || + accessValue =3D=3D QLatin1String("delivery") || + accessValue =3D=3D QLatin1String("forestry")) { + QColor polyColor =3D 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 =3D 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 <=3D 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(con= st StyleParameters ¶mete } } = - QString const accessValue =3D osmData.tagValue(QStringLiteral(= "access")); - if (accessValue =3D=3D QLatin1String("private") || - accessValue =3D=3D QLatin1String("no") || - accessValue =3D=3D QLatin1String("agricultural") || - accessValue =3D=3D QLatin1String("delivery") || - accessValue =3D=3D QLatin1String("forestry")) { - QColor polyColor =3D 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 =3D 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 =3D=3D GeoDataPlacemark::NaturalWater) { if (parameters.tileLevel <=3D 3) { lineStyle.setWidth(1); @@ -1382,16 +1383,14 @@ GeoDataStyle::ConstPtr StyleBuilder::createStyle(co= nst StyleParameters ¶mete float const width =3D widthValue.toFloat(&ok); lineStyle.setPhysicalWidth(ok ? qBound(0.1f, width, 200.0f= ) : 0.0f); } + } else if (visualCategory =3D=3D GeoDataPlacemark::HighwayTrack + || (visualCategory >=3D GeoDataPlacemark::RailwayRail &= & visualCategory <=3D GeoDataPlacemark::RailwayFunicular)) { + labelStyle.setColor(QColor(Qt::transparent)); } GeoDataStyle::Ptr newStyle(new GeoDataStyle(*style)); newStyle->setPolyStyle(polyStyle); newStyle->setLineStyle(lineStyle); - - bool const hideLabel =3D visualCategory =3D=3D GeoDataPlacemark::H= ighwayTrack - || (visualCategory >=3D GeoDataPlacemark::RailwayRail && v= isualCategory <=3D GeoDataPlacemark::RailwayFunicular); - if (hideLabel) { - newStyle->labelStyle().setColor(QColor(Qt::transparent)); - } + newStyle->setLabelStyle(labelStyle); = style =3D newStyle; } else if (placemark->geometry()->nodeType() =3D=3D GeoDataTypes::GeoD= ataPolygonType) {