summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-09-25 14:06:13 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-09-25 14:13:30 (GMT)
commitf94b7ac1636ee5f5cc47542ebf62a2b6a5db1b57 (patch)
tree13393d95783efce6b49b41b1186e6412eba2d9fc
parent721ee30a107f47e62ce276a62f92b1d2586e9090 (diff)
Enable icons for osm city placemarks. Icons from osm-carto like before.
-rw-r--r--data/svg/osmcarto/svg/place/place-4-z7.svg30
-rw-r--r--data/svg/osmcarto/svg/place/place-4.svg30
-rw-r--r--data/svg/osmcarto/svg/place/place-6-z7.svg30
-rw-r--r--data/svg/osmcarto/svg/place/place-6.svg30
-rw-r--r--data/svg/osmcarto/svg/place/place-capital-6.svg34
-rw-r--r--data/svg/osmcarto/svg/place/place-capital-8.svg38
-rw-r--r--src/lib/marble/StyleBuilder.cpp37
-rw-r--r--src/lib/marble/geodata/data/GeoDataFeature.cpp3
-rw-r--r--src/lib/marble/geodata/data/GeoDataFeature.h3
-rw-r--r--src/plugins/runner/osm/OsmNode.cpp32
10 files changed, 246 insertions, 21 deletions
diff --git a/data/svg/osmcarto/svg/place/place-4-z7.svg b/data/svg/osmcarto/svg/place/place-4-z7.svg
new file mode 100644
index 0000000..4130e8d
--- /dev/null
+++ b/data/svg/osmcarto/svg/place/place-4-z7.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ width="4"
+ height="4"
+ id="svg2">
+ <defs
+ id="defs4" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <path
+ style="fill:#fdfdfc;fill-opacity:1;stroke:#424236;stroke-width:0.49999997;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path2987"
+ d="m 3.7500001,2.000001 a 1.7500001,1.7500007 0 0 1 -3.50000009,0 1.7500001,1.7500007 0 1 1 3.50000009,0 z" />
+</svg>
diff --git a/data/svg/osmcarto/svg/place/place-4.svg b/data/svg/osmcarto/svg/place/place-4.svg
new file mode 100644
index 0000000..1150401
--- /dev/null
+++ b/data/svg/osmcarto/svg/place/place-4.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ width="4"
+ height="4"
+ id="svg2">
+ <defs
+ id="defs4" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <path
+ style="fill:#fdfdfc;fill-opacity:1;stroke:#575749;stroke-width:0.49999997;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path2987"
+ d="m 3.7500001,2.000001 a 1.7500001,1.7500007 0 0 1 -3.50000009,0 1.7500001,1.7500007 0 1 1 3.50000009,0 z" />
+</svg>
diff --git a/data/svg/osmcarto/svg/place/place-6-z7.svg b/data/svg/osmcarto/svg/place/place-6-z7.svg
new file mode 100644
index 0000000..c4fe4ef
--- /dev/null
+++ b/data/svg/osmcarto/svg/place/place-6-z7.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ id="svg2"
+ height="6"
+ width="6"
+ version="1.1">
+ <defs
+ id="defs4" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <path
+ d="M 5.6,3 A 2.6,2.6000012 0 0 1 0.39999998,3 2.6,2.6000012 0 1 1 5.6,3 Z"
+ id="path2987"
+ style="fill:#f9f9f7;fill-opacity:1;stroke:#6f6f5b;stroke-width:0.79999995;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+</svg>
diff --git a/data/svg/osmcarto/svg/place/place-6.svg b/data/svg/osmcarto/svg/place/place-6.svg
new file mode 100644
index 0000000..e0abe6d
--- /dev/null
+++ b/data/svg/osmcarto/svg/place/place-6.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ width="6"
+ height="6"
+ id="svg2">
+ <defs
+ id="defs4" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <path
+ style="fill:#f9f9f7;fill-opacity:1;stroke:#7e7e6a;stroke-width:0.79999995;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path2987"
+ d="M 5.6,3 A 2.6,2.6000012 0 0 1 0.39999998,3 2.6,2.6000012 0 1 1 5.6,3 Z" />
+</svg>
diff --git a/data/svg/osmcarto/svg/place/place-capital-6.svg b/data/svg/osmcarto/svg/place/place-capital-6.svg
new file mode 100644
index 0000000..645aeb5
--- /dev/null
+++ b/data/svg/osmcarto/svg/place/place-capital-6.svg
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ width="6"
+ height="6"
+ id="svg2">
+ <defs
+ id="defs4" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <path
+ style="fill:#fdfdfc;fill-opacity:1;stroke:#575749;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="path2987"
+ d="m 5.5,3.000081 a 2.5,2.5 0 0 1 -5.00000001,0 2.5,2.5 0 1 1 5.00000001,0 z" />
+ <path
+ d="M 4,3 A 1,1 0 0 1 2,3 1,1 0 1 1 4,3 z"
+ id="path2986"
+ style="fill:#575749;fill-opacity:1;stroke:none" />
+</svg>
diff --git a/data/svg/osmcarto/svg/place/place-capital-8.svg b/data/svg/osmcarto/svg/place/place-capital-8.svg
new file mode 100644
index 0000000..e385e1a
--- /dev/null
+++ b/data/svg/osmcarto/svg/place/place-capital-8.svg
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ width="8"
+ height="8"
+ id="svg2">
+ <defs
+ id="defs4" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ transform="matrix(1.5057013,0,0,1.5010517,-0.0107513,-1571.7666)"
+ id="layer1">
+ <path
+ d="m 4.9210516,1049.7756 a 2.2573419,2.2657569 0 0 1 -4.5146837,0 2.2573419,2.2657569 0 1 1 4.5146837,0 z"
+ id="path2987"
+ style="fill:#fdfdfc;fill-opacity:1;stroke:#525244;stroke-width:0.79820418;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+ </g>
+ <path
+ d="m 5.5,4 a 1.5,1.5 0 0 1 -3,0 1.5,1.5 0 1 1 3,0 z"
+ id="path2986"
+ style="fill:#525244;fill-opacity:1;stroke:none" />
+</svg>
diff --git a/src/lib/marble/StyleBuilder.cpp b/src/lib/marble/StyleBuilder.cpp
index bec4229..34165ff 100644
--- a/src/lib/marble/StyleBuilder.cpp
+++ b/src/lib/marble/StyleBuilder.cpp
@@ -395,21 +395,21 @@ void StyleBuilder::Private::initializeDefaultStyles()
// Align area labels centered
m_defaultStyle[GeoDataFeature::Nation]->labelStyle().setAlignment( GeoDataLabelStyle::Center );
- m_defaultStyle[GeoDataFeature::PlaceCity] = GeoDataStyle::Ptr(new GeoDataStyle( QString(), QFont( defaultFamily, (int)(defaultSize * 2.0 ), 75, false ), QColor( "#202020" ) ));
- m_defaultStyle[GeoDataFeature::PlaceCity]->labelStyle().setAlignment( GeoDataLabelStyle::Center );
- m_defaultStyle[GeoDataFeature::PlaceSuburb] = GeoDataStyle::Ptr(new GeoDataStyle( QString(), QFont( defaultFamily, (int)(defaultSize * 2.0 ), 75, false ), QColor( "#707070" ) ));
- m_defaultStyle[GeoDataFeature::PlaceSuburb]->labelStyle().setAlignment( GeoDataLabelStyle::Center );
- m_defaultStyle[GeoDataFeature::PlaceHamlet] = GeoDataStyle::Ptr(new GeoDataStyle( QString(), QFont( defaultFamily, (int)(defaultSize * 2.0 ), 75, false ), QColor( "#707070" ) ));
- m_defaultStyle[GeoDataFeature::PlaceHamlet]->labelStyle().setAlignment( GeoDataLabelStyle::Center );
- m_defaultStyle[GeoDataFeature::PlaceLocality] = GeoDataStyle::Ptr(new GeoDataStyle( QString(), QFont( defaultFamily, (int)(defaultSize * 2.0 ), 75, false ), QColor( "#707070" ) ));
- m_defaultStyle[GeoDataFeature::PlaceLocality]->labelStyle().setAlignment( GeoDataLabelStyle::Center );
- m_defaultStyle[GeoDataFeature::PlaceTown] = GeoDataStyle::Ptr(new GeoDataStyle( QString(), QFont( defaultFamily, (int)(defaultSize * 2.0 ), 75, false ), QColor( "#404040" ) ));
- m_defaultStyle[GeoDataFeature::PlaceTown]->labelStyle().setAlignment( GeoDataLabelStyle::Center );
- m_defaultStyle[GeoDataFeature::PlaceVillage] = GeoDataStyle::Ptr(new GeoDataStyle( QString(), QFont( defaultFamily, (int)(defaultSize * 2.0 ), 75, false ), QColor( "#505050" ) ));
- m_defaultStyle[GeoDataFeature::PlaceVillage]->labelStyle().setAlignment( GeoDataLabelStyle::Center );
- for (int i=GeoDataFeature::PlaceCity; i<=GeoDataFeature::PlaceVillage; ++i) {
+ QFont osmCityFont = QFont(defaultFamily, (int)(defaultSize * 2.0 ), 75, false);
+ m_defaultStyle[GeoDataFeature::PlaceCity] = createOsmPOIStyle(osmCityFont, "place/place-6", QColor( "#202020" ));
+ m_defaultStyle[GeoDataFeature::PlaceCityCapital] = createOsmPOIStyle(osmCityFont, "place/place-capital-6", QColor( "#202020" ));
+ m_defaultStyle[GeoDataFeature::PlaceSuburb] = createOsmPOIStyle(osmCityFont, QString(), QColor( "#707070" ));
+ m_defaultStyle[GeoDataFeature::PlaceHamlet] = createOsmPOIStyle(osmCityFont, QString(), QColor( "#707070" ));
+ m_defaultStyle[GeoDataFeature::PlaceLocality] = createOsmPOIStyle(osmCityFont, QString(), QColor( "#707070" ));
+ m_defaultStyle[GeoDataFeature::PlaceTown] = createOsmPOIStyle(osmCityFont, "place/place-6", QColor( "#404040" ));
+ m_defaultStyle[GeoDataFeature::PlaceTownCapital] = createOsmPOIStyle(osmCityFont, "place/place-capital-6", QColor( "#404040" ));
+ m_defaultStyle[GeoDataFeature::PlaceVillage] = createOsmPOIStyle(osmCityFont, "place/place-6", QColor( "#505050" ));
+ m_defaultStyle[GeoDataFeature::PlaceVillageCapital] = createOsmPOIStyle(osmCityFont, "place/place-capital-6", QColor( "#505050" ));
+ for (int i=GeoDataFeature::PlaceCity; i<=GeoDataFeature::PlaceVillageCapital; ++i) {
m_defaultStyle[GeoDataFeature::GeoDataVisualCategory(i)]->polyStyle().setFill(false);
m_defaultStyle[GeoDataFeature::GeoDataVisualCategory(i)]->polyStyle().setOutline(false);
+ m_defaultStyle[GeoDataFeature::GeoDataVisualCategory(i)]->labelStyle().setAlignment( GeoDataLabelStyle::Center );
+ m_defaultStyle[GeoDataFeature::GeoDataVisualCategory(i)]->iconStyle().setScale(0.25);
}
m_defaultStyle[GeoDataFeature::Mountain]
@@ -1611,11 +1611,14 @@ QString StyleBuilder::visualCategoryName(GeoDataFeature::GeoDataVisualCategory c
visualCategoryNames[GeoDataFeature::GeoDataFeature::LargeNationCapital] = "LargeNationCapital";
visualCategoryNames[GeoDataFeature::GeoDataFeature::Nation] = "Nation";
visualCategoryNames[GeoDataFeature::GeoDataFeature::PlaceCity] = "PlaceCity";
+ visualCategoryNames[GeoDataFeature::GeoDataFeature::PlaceCityCapital] = "PlaceCityCapital";
visualCategoryNames[GeoDataFeature::GeoDataFeature::PlaceSuburb] = "PlaceSuburb";
visualCategoryNames[GeoDataFeature::GeoDataFeature::PlaceHamlet] = "PlaceHamlet";
visualCategoryNames[GeoDataFeature::GeoDataFeature::PlaceLocality] = "PlaceLocality";
visualCategoryNames[GeoDataFeature::GeoDataFeature::PlaceTown] = "PlaceTown";
+ visualCategoryNames[GeoDataFeature::GeoDataFeature::PlaceTownCapital] = "PlaceTownCapital";
visualCategoryNames[GeoDataFeature::GeoDataFeature::PlaceVillage] = "PlaceVillage";
+ visualCategoryNames[GeoDataFeature::GeoDataFeature::PlaceVillageCapital] = "PlaceVillageCapital";
visualCategoryNames[GeoDataFeature::GeoDataFeature::Mountain] = "Mountain";
visualCategoryNames[GeoDataFeature::GeoDataFeature::Volcano] = "Volcano";
visualCategoryNames[GeoDataFeature::GeoDataFeature::Mons] = "Mons";
@@ -2029,6 +2032,14 @@ GeoDataFeature::GeoDataVisualCategory StyleBuilder::determineVisualCategory(cons
const auto tag = OsmTag(iter.key(), iter.value());
GeoDataFeature::GeoDataVisualCategory category = osmVisualCategory(tag);
if (category != GeoDataFeature::None) {
+ if (category == GeoDataFeature::PlaceCity && osmData.containsTag("capital", "yes")) {
+ category = GeoDataFeature::PlaceCityCapital;
+ } else if (category == GeoDataFeature::PlaceTown && osmData.containsTag("capital", "yes")) {
+ category = GeoDataFeature::PlaceTownCapital;
+ } else if (category == GeoDataFeature::PlaceVillage && osmData.containsTag("capital", "yes")) {
+ category = GeoDataFeature::PlaceVillageCapital;
+ }
+
return category;
}
}
diff --git a/src/lib/marble/geodata/data/GeoDataFeature.cpp b/src/lib/marble/geodata/data/GeoDataFeature.cpp
index 3d1b9e9..f3d58bb 100644
--- a/src/lib/marble/geodata/data/GeoDataFeature.cpp
+++ b/src/lib/marble/geodata/data/GeoDataFeature.cpp
@@ -497,11 +497,14 @@ QString GeoDataFeature::categoryName() const
// OpenStreetMap categories
case PlaceCity: return GeoDataFeaturePrivate::tr("City");
+ case PlaceCityCapital: return GeoDataFeaturePrivate::tr("City Capital");
case PlaceSuburb: return GeoDataFeaturePrivate::tr("Suburb");
case PlaceHamlet: return GeoDataFeaturePrivate::tr("Hamlet");
case PlaceLocality: return GeoDataFeaturePrivate::tr("Locality");
case PlaceTown: return GeoDataFeaturePrivate::tr("Town");
+ case PlaceTownCapital: return GeoDataFeaturePrivate::tr("Town Capital");
case PlaceVillage: return GeoDataFeaturePrivate::tr("Village");
+ case PlaceVillageCapital: return GeoDataFeaturePrivate::tr("Village Capital");
case NaturalWater: return GeoDataFeaturePrivate::tr("Water");
case NaturalReef: return GeoDataFeaturePrivate::tr("Reef");
case NaturalWood: return GeoDataFeaturePrivate::tr("Wood");
diff --git a/src/lib/marble/geodata/data/GeoDataFeature.h b/src/lib/marble/geodata/data/GeoDataFeature.h
index f5ff066..02b7047 100644
--- a/src/lib/marble/geodata/data/GeoDataFeature.h
+++ b/src/lib/marble/geodata/data/GeoDataFeature.h
@@ -139,11 +139,14 @@ class GEODATA_EXPORT GeoDataFeature : public GeoDataObject
*/
PlaceCity,
+ PlaceCityCapital,
PlaceSuburb,
PlaceHamlet,
PlaceLocality,
PlaceTown,
+ PlaceTownCapital,
PlaceVillage,
+ PlaceVillageCapital,
NaturalWater,
NaturalReef,
diff --git a/src/plugins/runner/osm/OsmNode.cpp b/src/plugins/runner/osm/OsmNode.cpp
index 853fab6..56af568 100644
--- a/src/plugins/runner/osm/OsmNode.cpp
+++ b/src/plugins/runner/osm/OsmNode.cpp
@@ -60,7 +60,7 @@ void OsmNode::create(GeoDataDocument *document) const
placemark->setStyle( GeoDataStyle::Ptr() );
placemark->setZoomLevel( 18 );
- if (category >= GeoDataFeature::PlaceCity && category <= GeoDataFeature::PlaceVillage) {
+ if (category >= GeoDataFeature::PlaceCity && category <= GeoDataFeature::PlaceVillageCapital) {
int const population = m_osmData.tagValue(QStringLiteral("population")).toInt();
placemark->setPopulation(qMax(0, population));
if (population > 0) {
@@ -68,13 +68,29 @@ void OsmNode::create(GeoDataDocument *document) const
placemark->setPopularity(population);
} else {
switch (category) {
- case GeoDataFeature::PlaceCity: placemark->setZoomLevel(9); break;
- case GeoDataFeature::PlaceSuburb: placemark->setZoomLevel(13); break;
- case GeoDataFeature::PlaceHamlet: placemark->setZoomLevel(15); break;
- case GeoDataFeature::PlaceLocality: placemark->setZoomLevel(15); break;
- case GeoDataFeature::PlaceTown: placemark->setZoomLevel(11); break;
- case GeoDataFeature::PlaceVillage: placemark->setZoomLevel(13); break;
- default: placemark->setZoomLevel(10); break;
+ case GeoDataFeature::PlaceCity:
+ case GeoDataFeature::PlaceCityCapital:
+ placemark->setZoomLevel(9);
+ break;
+ case GeoDataFeature::PlaceSuburb:
+ placemark->setZoomLevel(13);
+ break;
+ case GeoDataFeature::PlaceHamlet:
+ placemark->setZoomLevel(15);
+ break;
+ case GeoDataFeature::PlaceLocality:
+ placemark->setZoomLevel(15);
+ break;
+ case GeoDataFeature::PlaceTown:
+ case GeoDataFeature::PlaceTownCapital:
+ placemark->setZoomLevel(11);
+ break;
+ case GeoDataFeature::PlaceVillage:
+ case GeoDataFeature::PlaceVillageCapital:
+ placemark->setZoomLevel(13);
+ break;
+ default:
+ placemark->setZoomLevel(10); break;
}
}
}