diff --git a/src/lib/marble/StyleBuilder.cpp b/src/lib/marble/StyleBuilder.cpp index ed33d89a5..af1605556 100644 --- a/src/lib/marble/StyleBuilder.cpp +++ b/src/lib/marble/StyleBuilder.cpp @@ -1,2571 +1,2598 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2007 Murad Tagirov // Copyright 2009 Patrick Spendrin // Copyright 2015 Marius-Valeriu Stanciu // Copyright 2016 Dennis Nienhüser // #include "StyleBuilder.h" #include "MarbleDirs.h" #include "OsmPlacemarkData.h" #include "GeoDataTypes.h" #include "GeoDataGeometry.h" #include "GeoDataPlacemark.h" #include "GeoDataIconStyle.h" #include "GeoDataLabelStyle.h" #include "GeoDataLineStyle.h" #include "GeoDataPolyStyle.h" #include #include #include #include #include #include #include #include namespace Marble { class StyleBuilder::Private { public: Private(); GeoDataStyle::ConstPtr presetStyle(GeoDataPlacemark::GeoDataVisualCategory visualCategory) const; GeoDataStyle::Ptr createStyle(qreal width, qreal realWidth, const QColor& color, const QColor& outlineColor, bool fill, bool outline, Qt::BrushStyle brushStyle, Qt::PenStyle penStyle, Qt::PenCapStyle capStyle, bool lineBackground, const QVector< qreal >& dashPattern, const QFont& font, const QColor& fontColor = Qt::black, const QString& texturePath = QString()) const; GeoDataStyle::Ptr createPOIStyle(const QFont &font, const QString &bitmap, const QColor &textColor = Qt::black, const QColor &color = QColor( 0xBE, 0xAD, 0xAD ), const QColor &outline = QColor( 0xBE, 0xAD, 0xAD ).darker(), bool fill=true, bool renderOutline=true) const; GeoDataStyle::Ptr createOsmPOIStyle(const QFont &font, const QString &bitmap, const QColor &textColor = Qt::black, const QColor &color = QColor( 0xBE, 0xAD, 0xAD ), const QColor &outline = QColor(0xBE, 0xAD, 0xAD).darker()) const; GeoDataStyle::Ptr createOsmPOIRingStyle(const QFont &font, const QString &bitmap, const QColor &textColor = Qt::black, const QColor &color = QColor( 0xBE, 0xAD, 0xAD ), const QColor &outline = QColor(0xBE, 0xAD, 0xAD).darker()) const; GeoDataStyle::Ptr createOsmPOIAreaStyle(const QFont &font, const QString &bitmap, const QColor &textColor = Qt::black, const QColor &color = QColor( 0xBE, 0xAD, 0xAD ), const QColor &outline = QColor(0xBE, 0xAD, 0xAD).darker()) const; GeoDataStyle::Ptr createHighwayStyle(const QColor& color, const QColor& outlineColor, const QFont& font, const QColor& fontColor = Qt::black, qreal width = 1, qreal realWidth = 0.0, Qt::PenStyle penStyle = Qt::SolidLine, Qt::PenCapStyle capStyle = Qt::RoundCap, bool lineBackground = false) const; GeoDataStyle::Ptr createWayStyle(const QColor& color, const QColor& outlineColor, bool fill = true, bool outline = true, Qt::BrushStyle brushStyle = Qt::SolidPattern, const QString& texturePath = QString()) const; // Having an outline with the same color as the fill results in degraded // performance and degraded display quality for no good reason // Q_ASSERT( !(outline && color == outlineColor && brushStyle == Qt::SolidPattern) ); void initializeDefaultStyles(); static QString createPaintLayerItem(const QString &itemType, GeoDataPlacemark::GeoDataVisualCategory visualCategory, const QString &subType = QString()); static void initializeOsmVisualCategories(); static void initializeMinimumZoomLevels(); int m_maximumZoomLevel; QColor m_defaultLabelColor; QFont m_defaultFont; GeoDataStyle::Ptr m_defaultStyle[GeoDataPlacemark::LastIndex]; GeoDataStyle::Ptr m_styleTreeAutumn; GeoDataStyle::Ptr m_styleTreeWinter; bool m_defaultStyleInitialized; QHash m_specialStyleCache; QHash m_buildingStyles; int m_specialStyleCacheTileLevel; /** * @brief s_visualCategories contains osm tag mappings to GeoDataVisualCategories */ static QHash s_visualCategories; static int s_defaultMinZoomLevels[GeoDataPlacemark::LastIndex]; static bool s_defaultMinZoomLevelsInitialized; static QHash s_popularities; }; QHash StyleBuilder::Private::s_visualCategories; int StyleBuilder::Private::s_defaultMinZoomLevels[GeoDataPlacemark::LastIndex]; bool StyleBuilder::Private::s_defaultMinZoomLevelsInitialized = false; QHash StyleBuilder::Private::s_popularities; StyleBuilder::Private::Private() : m_maximumZoomLevel(15), m_defaultLabelColor(Qt::black), m_defaultFont(QStringLiteral("Sans Serif")), m_defaultStyle(), m_defaultStyleInitialized(false), m_specialStyleCacheTileLevel(-1) { initializeMinimumZoomLevels(); for (int i = 0; i < GeoDataPlacemark::LastIndex; ++i) { m_maximumZoomLevel = qMax(m_maximumZoomLevel, s_defaultMinZoomLevels[i]); } } GeoDataStyle::Ptr StyleBuilder::Private::createPOIStyle(const QFont &font, const QString &path, const QColor &textColor, const QColor &color, const QColor &outlineColor, bool fill, bool renderOutline) const { GeoDataStyle::Ptr style = createStyle(1, 0, color, outlineColor, fill, renderOutline, Qt::SolidPattern, Qt::SolidLine, Qt::RoundCap, false, QVector(), font); style->setIconStyle( GeoDataIconStyle( path) ); auto const screen = QApplication::screens().first(); double const physicalSize = 6.0; // mm int const pixelSize = qRound(physicalSize * screen->physicalDotsPerInch() / (IN2M * M2MM)); style->iconStyle().setSize(QSize(pixelSize, pixelSize)); style->setLabelStyle( GeoDataLabelStyle( font, textColor ) ); style->labelStyle().setAlignment(GeoDataLabelStyle::Center); return style; } GeoDataStyle::Ptr StyleBuilder::Private::createOsmPOIStyle( const QFont &font, const QString &imagePath, const QColor &textColor, const QColor &color, const QColor &outlineColor) const { QString const path = MarbleDirs::path(QLatin1String("svg/osmcarto/svg/") + imagePath + QLatin1String(".svg")); return createPOIStyle(font, path, textColor, color, outlineColor, false, false); } GeoDataStyle::Ptr StyleBuilder::Private::createOsmPOIRingStyle( const QFont &font, const QString &imagePath, const QColor &textColor, const QColor &color, const QColor &outlineColor) const { QString const path = MarbleDirs::path(QLatin1String("svg/osmcarto/svg/") + imagePath + QLatin1String(".svg")); return createPOIStyle(font, path, textColor, color, outlineColor, false, true); } GeoDataStyle::Ptr StyleBuilder::Private::createOsmPOIAreaStyle( const QFont &font, const QString &imagePath, const QColor &textColor, const QColor &color, const QColor &outlineColor) const { QString const path = MarbleDirs::path(QLatin1String("svg/osmcarto/svg/") + imagePath + QLatin1String(".svg")); return createPOIStyle(font, path, textColor, color, outlineColor, true, false); } GeoDataStyle::Ptr StyleBuilder::Private::createHighwayStyle( const QColor& color, const QColor& outlineColor, const QFont& font, const QColor& fontColor, qreal width, qreal realWidth, Qt::PenStyle penStyle, Qt::PenCapStyle capStyle, bool lineBackground) const { return createStyle( width, realWidth, color, outlineColor, true, true, Qt::SolidPattern, penStyle, capStyle, lineBackground, QVector< qreal >(), font, fontColor ); } GeoDataStyle::Ptr StyleBuilder::Private::createWayStyle( const QColor& color, const QColor& outlineColor, bool fill, bool outline, Qt::BrushStyle brushStyle, const QString& texturePath) const { return createStyle(1, 0, color, outlineColor, fill, outline, brushStyle, Qt::SolidLine, Qt::RoundCap, false, QVector(), m_defaultFont, Qt::black, texturePath); } GeoDataStyle::Ptr StyleBuilder::Private::createStyle( qreal width, qreal realWidth, const QColor& color, const QColor& outlineColor, bool fill, bool outline, Qt::BrushStyle brushStyle, Qt::PenStyle penStyle, Qt::PenCapStyle capStyle, bool lineBackground, const QVector< qreal >& dashPattern, const QFont& font, const QColor& fontColor, const QString& texturePath) const { GeoDataStyle *style = new GeoDataStyle; GeoDataLineStyle lineStyle( outlineColor ); lineStyle.setCapStyle( capStyle ); lineStyle.setPenStyle( penStyle ); lineStyle.setWidth( width ); lineStyle.setPhysicalWidth( realWidth ); lineStyle.setBackground( lineBackground ); lineStyle.setDashPattern( dashPattern ); GeoDataPolyStyle polyStyle( color ); polyStyle.setOutline( outline ); polyStyle.setFill( fill ); polyStyle.setBrushStyle( brushStyle ); polyStyle.setTexturePath( texturePath ); GeoDataLabelStyle labelStyle(font, fontColor); style->setLineStyle( lineStyle ); style->setPolyStyle( polyStyle ); style->setLabelStyle( labelStyle ); return GeoDataStyle::Ptr(style); } void StyleBuilder::Private::initializeDefaultStyles() { // We need to do this similar to the way KCmdLineOptions works in // the future: Having a PlacemarkStyleProperty properties[] would // help here greatly. if (m_defaultStyleInitialized) { return; } m_defaultStyleInitialized = true; QString defaultFamily = m_defaultFont.family(); #ifdef Q_OS_MACX int defaultSize = 10; #else int defaultSize = 8; #endif QColor const defaultLabelColor = m_defaultLabelColor; m_defaultStyle[GeoDataPlacemark::None] = GeoDataStyle::Ptr(new GeoDataStyle( QString(), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::Default] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/default_location.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::Unknown] = GeoDataStyle::Ptr(new GeoDataStyle( QString(), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::SmallCity] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_4_white.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::SmallCountyCapital] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_4_yellow.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::SmallStateCapital] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_4_orange.png" ), QFont( defaultFamily, defaultSize, 50, true ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::SmallNationCapital] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_4_red.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::MediumCity] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_3_white.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::MediumCountyCapital] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_3_yellow.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::MediumStateCapital] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_3_orange.png" ), QFont( defaultFamily, defaultSize, 50, true ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::MediumNationCapital] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_3_red.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::BigCity] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_2_white.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::BigCountyCapital] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_2_yellow.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::BigStateCapital] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_2_orange.png" ), QFont( defaultFamily, defaultSize, 50, true ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::BigNationCapital] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_2_red.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::LargeCity] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_1_white.png" ), QFont( defaultFamily, defaultSize, 75, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::LargeCountyCapital] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_1_yellow.png" ), QFont( defaultFamily, defaultSize, 75, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::LargeStateCapital] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_1_orange.png" ), QFont( defaultFamily, defaultSize, 75, true ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::LargeNationCapital] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/city_1_red.png" ), QFont( defaultFamily, defaultSize, 75, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::Nation] = GeoDataStyle::Ptr(new GeoDataStyle( QString(), QFont( defaultFamily, (int)(defaultSize * 1.5 ), 75, false ), QColor( "#404040" ) )); // Align area labels centered m_defaultStyle[GeoDataPlacemark::Nation]->labelStyle().setAlignment( GeoDataLabelStyle::Center ); QFont osmCityFont = QFont(defaultFamily, (int)(defaultSize * 1.5 ), 75, false); m_defaultStyle[GeoDataPlacemark::PlaceCity] = createOsmPOIStyle(osmCityFont, "place/place-6", QColor( "#202020" )); m_defaultStyle[GeoDataPlacemark::PlaceCityCapital] = createOsmPOIStyle(osmCityFont, "place/place-capital-6", QColor( "#202020" )); + m_defaultStyle[GeoDataPlacemark::PlaceCityNationalCapital] = createOsmPOIStyle(osmCityFont, "place/place-capital-adminlevel2", QColor( "#202020" )); m_defaultStyle[GeoDataPlacemark::PlaceSuburb] = createOsmPOIStyle(osmCityFont, QString(), QColor( "#707070" )); m_defaultStyle[GeoDataPlacemark::PlaceHamlet] = createOsmPOIStyle(osmCityFont, QString(), QColor( "#707070" )); QFont localityFont = osmCityFont; localityFont.setPointSize(defaultSize); m_defaultStyle[GeoDataPlacemark::PlaceLocality] = createOsmPOIStyle(localityFont, QString(), QColor( "#707070" )); m_defaultStyle[GeoDataPlacemark::PlaceTown] = createOsmPOIStyle(osmCityFont, "place/place-6", QColor( "#404040" )); m_defaultStyle[GeoDataPlacemark::PlaceTownCapital] = createOsmPOIStyle(osmCityFont, "place/place-capital-6", QColor( "#404040" )); + m_defaultStyle[GeoDataPlacemark::PlaceTownNationalCapital] = createOsmPOIStyle(osmCityFont, "place/place-capital-adminlevel2", QColor( "#404040" )); m_defaultStyle[GeoDataPlacemark::PlaceVillage] = createOsmPOIStyle(osmCityFont, "place/place-6", QColor( "#505050" )); m_defaultStyle[GeoDataPlacemark::PlaceVillageCapital] = createOsmPOIStyle(osmCityFont, "place/place-capital-6", QColor( "#505050" )); + m_defaultStyle[GeoDataPlacemark::PlaceVillageNationalCapital] = createOsmPOIStyle(osmCityFont, "place/place-capital-adminlevel2", QColor( "#505050" )); for (int i=GeoDataPlacemark::PlaceCity; i<=GeoDataPlacemark::PlaceVillageCapital; ++i) { m_defaultStyle[GeoDataPlacemark::GeoDataVisualCategory(i)]->polyStyle().setFill(false); m_defaultStyle[GeoDataPlacemark::GeoDataVisualCategory(i)]->polyStyle().setOutline(false); m_defaultStyle[GeoDataPlacemark::GeoDataVisualCategory(i)]->labelStyle().setAlignment( GeoDataLabelStyle::Center ); - m_defaultStyle[GeoDataPlacemark::GeoDataVisualCategory(i)]->iconStyle().setScale(0.25); + + if (i == GeoDataPlacemark::PlaceCityNationalCapital || i == GeoDataPlacemark::PlaceTownNationalCapital || i == GeoDataPlacemark::PlaceVillageNationalCapital) + m_defaultStyle[GeoDataPlacemark::GeoDataVisualCategory(i)]->iconStyle().setScale(0.55); + else + m_defaultStyle[GeoDataPlacemark::GeoDataVisualCategory(i)]->iconStyle().setScale(0.25); } m_defaultStyle[GeoDataPlacemark::Mountain] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/mountain_1.png" ), QFont( defaultFamily, (int)(defaultSize * 0.9 ), 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::Volcano] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/volcano_1.png" ), QFont( defaultFamily, (int)(defaultSize * 0.9 ), 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::Mons] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/mountain_1.png" ), QFont( defaultFamily, (int)(defaultSize * 0.9 ), 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::Valley] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/valley.png" ), QFont( defaultFamily, (int)(defaultSize * 0.9 ), 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::Continent] = GeoDataStyle::Ptr(new GeoDataStyle( QString(), QFont( defaultFamily, (int)(defaultSize * 1.7 ), 50, false ), QColor( "#bf0303" ) )); // Align area labels centered m_defaultStyle[GeoDataPlacemark::Continent]->labelStyle().setAlignment( GeoDataLabelStyle::Center ); m_defaultStyle[GeoDataPlacemark::Ocean] = GeoDataStyle::Ptr(new GeoDataStyle( QString(), QFont( defaultFamily, (int)(defaultSize * 1.7 ), 50, true ), QColor( "#2c72c7" ) )); // Align area labels centered m_defaultStyle[GeoDataPlacemark::Ocean]->labelStyle().setAlignment( GeoDataLabelStyle::Center ); m_defaultStyle[GeoDataPlacemark::OtherTerrain] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/other.png" ), QFont( defaultFamily, (int)(defaultSize * 0.9 ), 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::Crater] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/crater.png" ), QFont( defaultFamily, (int)(defaultSize * 0.9 ), 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::Mare] = GeoDataStyle::Ptr(new GeoDataStyle( QString(), QFont( defaultFamily, (int)(defaultSize * 1.7 ), 50, false ), QColor( "#bf0303" ) )); // Align area labels centered m_defaultStyle[GeoDataPlacemark::Mare]->labelStyle().setAlignment( GeoDataLabelStyle::Center ); m_defaultStyle[GeoDataPlacemark::GeographicPole] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/pole_1.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::MagneticPole] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/pole_2.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::ShipWreck] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/shipwreck.png" ), QFont( defaultFamily, (int)(defaultSize * 0.8 ), 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::AirPort] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/airport.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::Observatory] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/observatory.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::OsmSite] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/osm.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::Coordinate] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/coordinate.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::MannedLandingSite] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/manned_landing.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::RoboticRover] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/robotic_rover.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::UnmannedSoftLandingSite] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/unmanned_soft_landing.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::UnmannedHardLandingSite] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/unmanned_hard_landing.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); m_defaultStyle[GeoDataPlacemark::Bookmark] = createPOIStyle(QFont( defaultFamily, defaultSize, 50, false ), MarbleDirs::path("svg/bookmark.svg"), defaultLabelColor ); m_defaultStyle[GeoDataPlacemark::Bookmark]->iconStyle().setScale(0.75); QColor const shopColor("#ac39ac"); QColor const transportationColor("#0066ff"); QColor const amenityColor("#734a08"); QColor const healthColor("#da0092"); QColor const airTransportColor("#8461C4"); QColor const educationalAreasAndHospital("#f0f0d8"); QColor const buildingColor("#beadad"); QColor const waterColor("#b5d0d0"); // Allows to visualize multiple repaints of buildings // QColor const buildingColor(0, 255, 0, 64); QFont const osmFont( defaultFamily, 10, 50, false ); m_defaultStyle[GeoDataPlacemark::AccomodationCamping] = createOsmPOIRingStyle(osmFont, "transportation/camping.16", transportationColor); m_defaultStyle[GeoDataPlacemark::AccomodationHostel] = createOsmPOIStyle(osmFont, "transportation/hostel.16", transportationColor); m_defaultStyle[GeoDataPlacemark::AccomodationHotel] = createOsmPOIStyle(osmFont, "transportation/hotel.16", transportationColor); m_defaultStyle[GeoDataPlacemark::AccomodationMotel] = createOsmPOIStyle(osmFont, "transportation/motel.16", transportationColor); m_defaultStyle[GeoDataPlacemark::AccomodationYouthHostel] = createOsmPOIStyle(osmFont, "transportation/hostel.16", transportationColor); m_defaultStyle[GeoDataPlacemark::AccomodationGuestHouse] = createOsmPOIStyle(osmFont, "transportation/guest_house.16", transportationColor); m_defaultStyle[GeoDataPlacemark::AmenityLibrary] = createOsmPOIStyle(osmFont, "amenity/library.20", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityKindergarten] = createOsmPOIAreaStyle(osmFont, QString(), amenityColor, educationalAreasAndHospital, amenityColor); m_defaultStyle[GeoDataPlacemark::EducationCollege] = createOsmPOIAreaStyle(osmFont, QString(), amenityColor, educationalAreasAndHospital, amenityColor); m_defaultStyle[GeoDataPlacemark::EducationSchool] = createOsmPOIAreaStyle(osmFont, QString(), amenityColor, educationalAreasAndHospital, amenityColor); m_defaultStyle[GeoDataPlacemark::EducationUniversity] = createOsmPOIAreaStyle(osmFont, QString(), amenityColor, educationalAreasAndHospital, amenityColor); m_defaultStyle[GeoDataPlacemark::FoodBar] = createOsmPOIStyle(osmFont, "amenity/bar.16", amenityColor); m_defaultStyle[GeoDataPlacemark::FoodBiergarten] = createOsmPOIStyle(osmFont, "amenity/biergarten.16", amenityColor); m_defaultStyle[GeoDataPlacemark::FoodCafe] = createOsmPOIStyle(osmFont, "amenity/cafe.16", amenityColor); m_defaultStyle[GeoDataPlacemark::FoodFastFood] = createOsmPOIStyle(osmFont, "amenity/fast_food.16", amenityColor); m_defaultStyle[GeoDataPlacemark::FoodPub] = createOsmPOIStyle(osmFont, "amenity/pub.16", amenityColor); m_defaultStyle[GeoDataPlacemark::FoodRestaurant] = createOsmPOIStyle(osmFont, "amenity/restaurant.16", amenityColor); m_defaultStyle[GeoDataPlacemark::HealthDentist] = createOsmPOIStyle(osmFont, "health/dentist.16", healthColor); m_defaultStyle[GeoDataPlacemark::HealthDoctors] = createOsmPOIStyle(osmFont, "health/doctors.16", healthColor); m_defaultStyle[GeoDataPlacemark::HealthHospital] = createOsmPOIStyle(osmFont, "health/hospital.16", healthColor, educationalAreasAndHospital, amenityColor); m_defaultStyle[GeoDataPlacemark::HealthPharmacy] = createOsmPOIStyle(osmFont, "health/pharmacy.16", healthColor); m_defaultStyle[GeoDataPlacemark::HealthVeterinary] = createOsmPOIStyle(osmFont, "health/veterinary-14", healthColor); m_defaultStyle[GeoDataPlacemark::MoneyAtm] = createOsmPOIStyle(osmFont, "amenity/atm.16", amenityColor); m_defaultStyle[GeoDataPlacemark::MoneyBank] = createOsmPOIStyle(osmFont, "amenity/bank.16", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityArchaeologicalSite] = createOsmPOIAreaStyle(osmFont, "amenity/archaeological_site.16", amenityColor, Qt::transparent); m_defaultStyle[GeoDataPlacemark::AmenityEmbassy] = createOsmPOIStyle(osmFont, "transportation/embassy.16", transportationColor); m_defaultStyle[GeoDataPlacemark::AmenityEmergencyPhone] = createOsmPOIStyle(osmFont, "amenity/emergency_phone.16", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityWaterPark] = createOsmPOIStyle(osmFont, "amenity/water_park.16", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityCommunityCentre] = createOsmPOIStyle(osmFont, "amenity/community_centre-14", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityFountain] = createOsmPOIStyle(osmFont, "amenity/fountain-14", QColor("#7989de"), waterColor, waterColor.darker(150)); m_defaultStyle[GeoDataPlacemark::AmenityNightClub] = createOsmPOIStyle(osmFont, "amenity/nightclub.18", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityBench] = createOsmPOIStyle(osmFont, "individual/bench.16", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityCourtHouse] = createOsmPOIStyle(osmFont, "amenity/courthouse-16", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityFireStation] = createOsmPOIStyle(osmFont, "amenity/firestation.16", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityHuntingStand] = createOsmPOIStyle(osmFont, "manmade/hunting-stand.16", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityPolice] = createOsmPOIStyle(osmFont, "amenity/police.16", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityPostBox] = createOsmPOIStyle(osmFont, "amenity/post_box-12", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityPostOffice] = createOsmPOIStyle(osmFont, "amenity/post_office-14", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityPrison] = createOsmPOIStyle(osmFont, "amenity/prison.16", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityRecycling] = createOsmPOIStyle(osmFont, "amenity/recycling.16", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityShelter] = createOsmPOIStyle(osmFont, "transportation/shelter", transportationColor); m_defaultStyle[GeoDataPlacemark::AmenityTelephone] = createOsmPOIStyle(osmFont, "amenity/telephone.16", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityToilets] = createOsmPOIStyle(osmFont, "amenity/toilets.16", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityTownHall] = createOsmPOIStyle(osmFont, "amenity/town_hall.16", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityWasteBasket] = createOsmPOIStyle(osmFont, "individual/waste_basket.10", amenityColor); m_defaultStyle[GeoDataPlacemark::AmenityWasteBasket]->iconStyle().setScale(0.75); m_defaultStyle[GeoDataPlacemark::AmenityChargingStation] = createOsmPOIStyle(osmFont, "transportation/charging_station"); m_defaultStyle[GeoDataPlacemark::AmenityDrinkingWater] = createOsmPOIStyle(osmFont, "amenity/drinking_water.16", amenityColor); m_defaultStyle[GeoDataPlacemark::NaturalPeak] = createOsmPOIStyle(osmFont, "individual/peak", amenityColor); m_defaultStyle[GeoDataPlacemark::NaturalPeak]->iconStyle().setScale(0.33); m_defaultStyle[GeoDataPlacemark::NaturalTree] = createOsmPOIStyle(osmFont, "individual/tree-29", amenityColor); // tree-16 provides the official icon m_styleTreeAutumn = createOsmPOIStyle(osmFont, "individual/tree-29-autumn", amenityColor); m_styleTreeWinter = createOsmPOIStyle(osmFont, "individual/tree-29-winter", amenityColor); qreal const treeIconScale = 0.75; m_defaultStyle[GeoDataPlacemark::NaturalTree]->iconStyle().setScale(treeIconScale); m_styleTreeAutumn->iconStyle().setScale(treeIconScale); m_styleTreeWinter->iconStyle().setScale(treeIconScale); m_defaultStyle[GeoDataPlacemark::ShopBeverages] = createOsmPOIStyle(osmFont, "shop/beverages-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopHifi] = createOsmPOIStyle(osmFont, "shop/hifi-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopSupermarket] = createOsmPOIStyle(osmFont, "shop/shop_supermarket", shopColor); m_defaultStyle[GeoDataPlacemark::ShopAlcohol] = createOsmPOIStyle(osmFont, "shop/shop_alcohol.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopBakery] = createOsmPOIStyle(osmFont, "shop/shop_bakery.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopButcher] = createOsmPOIStyle(osmFont, "shop/butcher-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopConfectionery] = createOsmPOIStyle(osmFont, "shop/confectionery.14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopConvenience] = createOsmPOIStyle(osmFont, "shop/shop_convenience", shopColor); m_defaultStyle[GeoDataPlacemark::ShopGreengrocer] = createOsmPOIStyle(osmFont, "shop/greengrocer-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopSeafood] = createOsmPOIStyle(osmFont, "shop/seafood-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopDepartmentStore] = createOsmPOIStyle(osmFont, "shop/department_store-16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopKiosk] = createOsmPOIStyle(osmFont, "shop/kiosk-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopBag] = createOsmPOIStyle(osmFont, "shop/bag-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopClothes] = createOsmPOIStyle(osmFont, "shop/shop_clothes.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopFashion] = createOsmPOIStyle(osmFont, "shop/shop_clothes.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopJewelry] = createOsmPOIStyle(osmFont, "shop/shop_jewelry.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopShoes] = createOsmPOIStyle(osmFont, "shop/shop_shoes.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopVarietyStore] = createOsmPOIStyle(osmFont, "shop/variety_store-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopBeauty] = createOsmPOIStyle(osmFont, "shop/beauty-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopChemist] = createOsmPOIStyle(osmFont, "shop/chemist-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopCosmetics] = createOsmPOIStyle(osmFont, "shop/perfumery-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopHairdresser] = createOsmPOIStyle(osmFont, "shop/shop_hairdresser.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopOptician] = createOsmPOIStyle(osmFont, "shop/shop_optician.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopPerfumery] = createOsmPOIStyle(osmFont, "shop/perfumery-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopDoitYourself] = createOsmPOIStyle(osmFont, "shop/shop_diy.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopFlorist] = createOsmPOIStyle(osmFont, "shop/florist.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopHardware] = createOsmPOIStyle(osmFont, "shop/shop_diy.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopFurniture] = createOsmPOIStyle(osmFont, "shop/shop_furniture.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopElectronics] = createOsmPOIStyle(osmFont, "shop/shop_electronics.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopMobilePhone] = createOsmPOIStyle(osmFont, "shop/shop_mobile_phone.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopBicycle] = createOsmPOIStyle(osmFont, "shop/shop_bicycle.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopCar] = createOsmPOIStyle(osmFont, "shop/shop_car", shopColor); m_defaultStyle[GeoDataPlacemark::ShopCarRepair] = createOsmPOIStyle(osmFont, "shop/shopping_car_repair.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopCarParts] = createOsmPOIStyle(osmFont, "shop/car_parts-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopMotorcycle] = createOsmPOIStyle(osmFont, "shop/motorcycle-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopOutdoor] = createOsmPOIStyle(osmFont, "shop/outdoor-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopSports] = createOsmPOIStyle(osmFont, "shop/sports", shopColor); m_defaultStyle[GeoDataPlacemark::ShopCopy] = createOsmPOIStyle(osmFont, "shop/copyshop", shopColor); m_defaultStyle[GeoDataPlacemark::ShopArt] = createOsmPOIStyle(osmFont, "shop/art", shopColor); m_defaultStyle[GeoDataPlacemark::ShopMusicalInstrument] = createOsmPOIStyle(osmFont, "shop/musical_instrument-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopPhoto] = createOsmPOIStyle(osmFont, "shop/photo-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopBook] = createOsmPOIStyle(osmFont, "shop/shop_books.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopGift] = createOsmPOIStyle(osmFont, "shop/shop_gift.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopStationery] = createOsmPOIStyle(osmFont, "shop/stationery-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopLaundry] = createOsmPOIStyle(osmFont, "shop/laundry-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopPet] = createOsmPOIStyle(osmFont, "shop/shop_pet.16", shopColor); m_defaultStyle[GeoDataPlacemark::ShopToys] = createOsmPOIStyle(osmFont, "shop/toys-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopTravelAgency] = createOsmPOIStyle(osmFont, "shop/travel_agency-14", shopColor); m_defaultStyle[GeoDataPlacemark::ShopDeli] = createOsmPOIStyle(osmFont, "shop/deli", shopColor); m_defaultStyle[GeoDataPlacemark::ShopTobacco] = createOsmPOIStyle(osmFont, "shop/tobacco", shopColor); m_defaultStyle[GeoDataPlacemark::ShopTea] = createOsmPOIStyle(osmFont, "shop/tea", shopColor); m_defaultStyle[GeoDataPlacemark::Shop] = createOsmPOIStyle(osmFont, "shop/shop-14", shopColor); m_defaultStyle[GeoDataPlacemark::ManmadeBridge] = createWayStyle(QColor("#b8b8b8"), Qt::transparent, true, true); m_defaultStyle[GeoDataPlacemark::ManmadeLighthouse] = createOsmPOIStyle(osmFont, "transportation/lighthouse.16", transportationColor, "#f2efe9", QColor( "#f2efe9" ).darker()); m_defaultStyle[GeoDataPlacemark::ManmadePier] = createStyle(0.0, 3.0, "#f2efe9", "#f2efe9", true, false, Qt::SolidPattern, Qt::SolidLine, Qt::FlatCap, false, QVector(), osmFont); m_defaultStyle[GeoDataPlacemark::ManmadeWaterTower] = createOsmPOIStyle(osmFont, "amenity/water_tower.16", amenityColor); m_defaultStyle[GeoDataPlacemark::ManmadeWindMill] = createOsmPOIStyle(osmFont, "amenity/windmill.16", amenityColor); m_defaultStyle[GeoDataPlacemark::HistoricMemorial] = createOsmPOIStyle(osmFont, "amenity/tourist_memorial.16", amenityColor); m_defaultStyle[GeoDataPlacemark::TouristAttraction] = createOsmPOIStyle(osmFont, "amenity/tourist_memorial.16", amenityColor); m_defaultStyle[GeoDataPlacemark::TouristCastle] = createOsmPOIRingStyle(osmFont, "amenity/cinema.16", amenityColor); m_defaultStyle[GeoDataPlacemark::TouristCinema] = createOsmPOIStyle(osmFont, "amenity/cinema.16", amenityColor); m_defaultStyle[GeoDataPlacemark::TouristInformation] = createOsmPOIStyle(osmFont, "amenity/information.16", amenityColor); m_defaultStyle[GeoDataPlacemark::TouristMonument] = createOsmPOIStyle(osmFont, "amenity/monument.16", amenityColor); m_defaultStyle[GeoDataPlacemark::TouristMuseum] = createOsmPOIStyle(osmFont, "amenity/museum.16", amenityColor); m_defaultStyle[GeoDataPlacemark::TouristRuin] = createOsmPOIRingStyle(osmFont, QString(), amenityColor); m_defaultStyle[GeoDataPlacemark::TouristTheatre] = createOsmPOIStyle(osmFont, "amenity/theatre.16", amenityColor); m_defaultStyle[GeoDataPlacemark::TouristThemePark] = createOsmPOIStyle(osmFont, QString(), amenityColor); m_defaultStyle[GeoDataPlacemark::TouristViewPoint] = createOsmPOIStyle(osmFont, "amenity/viewpoint.16", amenityColor); m_defaultStyle[GeoDataPlacemark::TouristZoo] = createOsmPOIRingStyle(osmFont, QString(), amenityColor, Qt::transparent); m_defaultStyle[GeoDataPlacemark::TouristAlpineHut] = createOsmPOIStyle(osmFont, "transportation/alpinehut.16", transportationColor); m_defaultStyle[GeoDataPlacemark::TouristWildernessHut] = createOsmPOIStyle(osmFont, "transportation/wilderness_hut", transportationColor); m_defaultStyle[GeoDataPlacemark::TransportAerodrome] = createOsmPOIStyle(osmFont, "airtransport/aerodrome", airTransportColor); m_defaultStyle[GeoDataPlacemark::TransportHelipad] = createOsmPOIStyle(osmFont, "airtransport/helipad", airTransportColor); m_defaultStyle[GeoDataPlacemark::TransportAirportTerminal] = createOsmPOIAreaStyle(osmFont, QString(), airTransportColor); m_defaultStyle[GeoDataPlacemark::TransportAirportGate] = createOsmPOIAreaStyle(osmFont, QString(), airTransportColor); m_defaultStyle[GeoDataPlacemark::TransportBusStation] = createOsmPOIStyle(osmFont, "transportation/bus_station.16", transportationColor); m_defaultStyle[GeoDataPlacemark::TransportBusStop] = createOsmPOIStyle(osmFont, "transportation/bus_stop.12", transportationColor); m_defaultStyle[GeoDataPlacemark::TransportCarShare] = createOsmPOIStyle(osmFont, "transportation/car_share.16", transportationColor); m_defaultStyle[GeoDataPlacemark::TransportFuel] = createOsmPOIStyle(osmFont, "transportation/fuel.16", transportationColor); m_defaultStyle[GeoDataPlacemark::TransportParking] = createOsmPOIAreaStyle(osmFont, "transportation/parking", transportationColor, "#F6EEB6", QColor( "#F6EEB6" ).darker()); m_defaultStyle[GeoDataPlacemark::TransportBicycleParking] = createOsmPOIAreaStyle(osmFont, "transportation/bicycle_parking.16", transportationColor); m_defaultStyle[GeoDataPlacemark::TransportMotorcycleParking] = createOsmPOIAreaStyle(osmFont, "transportation/motorcycle_parking.16", transportationColor); qreal const parkingIconScale = 0.75; m_defaultStyle[GeoDataPlacemark::TransportParking]->iconStyle().setScale(parkingIconScale); m_defaultStyle[GeoDataPlacemark::TransportBicycleParking]->iconStyle().setScale(parkingIconScale); m_defaultStyle[GeoDataPlacemark::TransportMotorcycleParking]->iconStyle().setScale(parkingIconScale); m_defaultStyle[GeoDataPlacemark::TransportParkingSpace] = createWayStyle("#F6EEB6", QColor( "#F6EEB6" ).darker(), true, true); m_defaultStyle[GeoDataPlacemark::TransportPlatform] = createWayStyle("#bbbbbb", Qt::transparent, true, false); m_defaultStyle[GeoDataPlacemark::TransportTrainStation] = createOsmPOIStyle(osmFont, "individual/railway_station", transportationColor); m_defaultStyle[GeoDataPlacemark::TransportTrainStation]->iconStyle().setScale(0.5); m_defaultStyle[GeoDataPlacemark::TransportTramStop] = createOsmPOIStyle(osmFont, "individual/railway_station", transportationColor); m_defaultStyle[GeoDataPlacemark::TransportTramStop]->iconStyle().setScale(0.33); m_defaultStyle[GeoDataPlacemark::TransportRentalBicycle] = createOsmPOIStyle(osmFont, "transportation/rental_bicycle.16", transportationColor); m_defaultStyle[GeoDataPlacemark::TransportRentalCar] = createOsmPOIStyle(osmFont, "transportation/rental_car.16", transportationColor); m_defaultStyle[GeoDataPlacemark::TransportTaxiRank] = createOsmPOIStyle(osmFont, "transportation/taxi.16", transportationColor); m_defaultStyle[GeoDataPlacemark::TransportSubwayEntrance] = createOsmPOIStyle(osmFont, "transportation/subway_entrance", transportationColor); m_defaultStyle[GeoDataPlacemark::ReligionPlaceOfWorship] = createOsmPOIStyle(osmFont, QString() /* "black/place_of_worship.16" */); m_defaultStyle[GeoDataPlacemark::ReligionBahai] = createOsmPOIStyle(osmFont, QString()); m_defaultStyle[GeoDataPlacemark::ReligionBuddhist] = createOsmPOIStyle(osmFont, "black/buddhist.16"); m_defaultStyle[GeoDataPlacemark::ReligionChristian] = createOsmPOIStyle(osmFont, "black/christian.16"); m_defaultStyle[GeoDataPlacemark::ReligionMuslim] = createOsmPOIStyle(osmFont, "black/muslim.16"); m_defaultStyle[GeoDataPlacemark::ReligionHindu] = createOsmPOIStyle(osmFont, "black/hinduist.16"); m_defaultStyle[GeoDataPlacemark::ReligionJain] = createOsmPOIStyle(osmFont, QString()); m_defaultStyle[GeoDataPlacemark::ReligionJewish] = createOsmPOIStyle(osmFont, "black/jewish.16"); m_defaultStyle[GeoDataPlacemark::ReligionShinto] = createOsmPOIStyle(osmFont, "black/shintoist.16"); m_defaultStyle[GeoDataPlacemark::ReligionSikh] = createOsmPOIStyle(osmFont, "black/sikhist.16"); m_defaultStyle[GeoDataPlacemark::HighwayTrafficSignals] = createOsmPOIStyle(osmFont, "individual/traffic_light"); m_defaultStyle[GeoDataPlacemark::HighwayTrafficSignals]->iconStyle().setScale(0.75); m_defaultStyle[GeoDataPlacemark::PowerTower] = createOsmPOIStyle(osmFont, "individual/power_tower", QColor( "#888888" )); m_defaultStyle[GeoDataPlacemark::PowerTower]->iconStyle().setScale(0.6); m_defaultStyle[GeoDataPlacemark::BarrierCityWall] = createStyle(6.0, 3.0, "#787878", Qt::transparent, true, false, Qt::SolidPattern, Qt::SolidLine, Qt::FlatCap, false, QVector(), osmFont, Qt::transparent); m_defaultStyle[GeoDataPlacemark::BarrierGate] = createOsmPOIStyle(osmFont, "individual/gate"); m_defaultStyle[GeoDataPlacemark::BarrierGate]->iconStyle().setScale(0.75); m_defaultStyle[GeoDataPlacemark::BarrierLiftGate] = createOsmPOIStyle(osmFont, "individual/liftgate"); m_defaultStyle[GeoDataPlacemark::BarrierLiftGate]->iconStyle().setScale(0.75); m_defaultStyle[GeoDataPlacemark::BarrierWall] = createStyle(2.0, 0.0, "#787878", Qt::transparent, true, false, Qt::SolidPattern, Qt::SolidLine, Qt::FlatCap, false, QVector(), osmFont, Qt::transparent); m_defaultStyle[GeoDataPlacemark::HighwaySteps] = createStyle(0.0, 2.0, "#fa8072", QColor(Qt::white), true, true, Qt::SolidPattern, Qt::CustomDashLine, Qt::FlatCap, false, QVector< qreal >() << 0.3 << 0.3, osmFont); m_defaultStyle[GeoDataPlacemark::HighwayUnknown] = createHighwayStyle("#dddddd", "#bbbbbb", osmFont, "000000", 0, 1); m_defaultStyle[GeoDataPlacemark::HighwayPath] = createHighwayStyle("#dddde8", "#999999", osmFont, "000000", 0, 1, Qt::DotLine, Qt::SquareCap, true); m_defaultStyle[GeoDataPlacemark::HighwayTrack] = createHighwayStyle("#996600", QColor(Qt::white), osmFont, QColor(Qt::transparent), 1, 1, Qt::DashLine, Qt::SquareCap, true); m_defaultStyle[GeoDataPlacemark::HighwayPedestrian] = createHighwayStyle("#dddde8", "#999999", osmFont, "000000", 0, 2); m_defaultStyle[GeoDataPlacemark::HighwayPedestrian]->polyStyle().setOutline(false); m_defaultStyle[GeoDataPlacemark::HighwayFootway] = createHighwayStyle("#fa8072", QColor(Qt::white), osmFont, "000000", 0, 2, Qt::DotLine, Qt::SquareCap, true); m_defaultStyle[GeoDataPlacemark::HighwayCycleway] = createHighwayStyle(QColor(Qt::blue), QColor(Qt::white), osmFont, "000000", 0, 2, Qt::DotLine, Qt::SquareCap, true); m_defaultStyle[GeoDataPlacemark::HighwayService] = createHighwayStyle("#ffffff", "#bbbbbb", osmFont, "000000", 1, 6); m_defaultStyle[GeoDataPlacemark::HighwayResidential] = createHighwayStyle("#ffffff", "#bbbbbb", osmFont, "000000", 3, 6); m_defaultStyle[GeoDataPlacemark::HighwayLivingStreet] = createHighwayStyle("#ffffff", "#bbbbbb", osmFont, "000000", 3, 6); m_defaultStyle[GeoDataPlacemark::HighwayRoad] = createHighwayStyle("#dddddd", "#bbbbbb", osmFont, "000000", 3, 6); m_defaultStyle[GeoDataPlacemark::HighwayUnclassified] = createHighwayStyle("#ffffff", "#bbbbbb", osmFont, "000000", 3, 6); m_defaultStyle[GeoDataPlacemark::HighwayTertiary] = createHighwayStyle("#ffffff", "#8f8f8f", osmFont, "000000", 6, 6); m_defaultStyle[GeoDataPlacemark::HighwayTertiaryLink] = createHighwayStyle("#ffffff", "#8f8f8f", osmFont, "000000", 6, 6); m_defaultStyle[GeoDataPlacemark::HighwaySecondary] = createHighwayStyle("#f7fabf", "#707d05", osmFont, "000000", 6, 6); m_defaultStyle[GeoDataPlacemark::HighwaySecondaryLink] = createHighwayStyle("#f7fabf", "#707d05", osmFont, "000000", 6, 6); m_defaultStyle[GeoDataPlacemark::HighwayPrimary] = createHighwayStyle("#fcd6a4", "#a06b00", osmFont, "000000", 9, 6); m_defaultStyle[GeoDataPlacemark::HighwayPrimaryLink] = createHighwayStyle("#fcd6a4", "#a06b00", osmFont, "000000", 6, 6); m_defaultStyle[GeoDataPlacemark::HighwayRaceway] = createHighwayStyle("#ffc0cb", "#ffc0cb", osmFont, "000000", 1, 5); m_defaultStyle[GeoDataPlacemark::HighwayTrunk] = createHighwayStyle("#f9b29c", "#c84e2f", osmFont, "000000", 9, 6); m_defaultStyle[GeoDataPlacemark::HighwayTrunkLink] = createHighwayStyle("#f9b29c", "#c84e2f", osmFont, "000000", 9, 6); m_defaultStyle[GeoDataPlacemark::HighwayMotorway] = createHighwayStyle("#e892a2", "#dc2a67", osmFont, "000000", 9, 10); m_defaultStyle[GeoDataPlacemark::HighwayMotorwayLink] = createHighwayStyle("#e892a2", "#dc2a67", osmFont, "000000", 9, 10); m_defaultStyle[GeoDataPlacemark::TransportAirportRunway] = createHighwayStyle("#bbbbcc", "#bbbbcc", osmFont, "000000", 0, 1, Qt::NoPen); m_defaultStyle[GeoDataPlacemark::TransportAirportTaxiway] = createHighwayStyle("#bbbbcc", "#bbbbcc", osmFont, "000000", 0, 1, Qt::NoPen); m_defaultStyle[GeoDataPlacemark::TransportAirportApron] = createWayStyle("#e9d1ff", Qt::transparent, true, false); m_defaultStyle[GeoDataPlacemark::TransportSpeedCamera] = createOsmPOIStyle(osmFont, "individual/speedcamera"); m_defaultStyle[GeoDataPlacemark::NaturalWater] = createStyle(4, 0, waterColor, waterColor, true, false, Qt::SolidPattern, Qt::SolidLine, Qt::RoundCap, false, QVector< qreal >(), osmFont, waterColor.darker(150)); m_defaultStyle[GeoDataPlacemark::WaterwayRiver] = createStyle(4, 0, waterColor, waterColor, true, false, Qt::SolidPattern, Qt::SolidLine, Qt::RoundCap, false, QVector< qreal >(), osmFont, waterColor.darker(150)); m_defaultStyle[GeoDataPlacemark::WaterwayCanal] = m_defaultStyle[GeoDataPlacemark::WaterwayRiver]; m_defaultStyle[GeoDataPlacemark::WaterwayDitch] = m_defaultStyle[GeoDataPlacemark::WaterwayRiver]; m_defaultStyle[GeoDataPlacemark::WaterwayDrain] = m_defaultStyle[GeoDataPlacemark::WaterwayRiver]; m_defaultStyle[GeoDataPlacemark::WaterwayStream] = m_defaultStyle[GeoDataPlacemark::WaterwayRiver]; m_defaultStyle[GeoDataPlacemark::NaturalReef] = createStyle(5.5, 0, "#36677c", "#36677c", true, false, Qt::Dense7Pattern, Qt::DotLine, Qt::RoundCap, false, QVector< qreal >(), osmFont, waterColor.darker(150)); m_defaultStyle[GeoDataPlacemark::AmenityGraveyard] = createWayStyle("#AACBAF", "#AACBAF", true, false, Qt::SolidPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/grave_yard_generic.png")); m_defaultStyle[GeoDataPlacemark::NaturalWood] = createWayStyle("#8DC46C", "#8DC46C", true, false, Qt::SolidPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/forest.png")); m_defaultStyle[GeoDataPlacemark::NaturalBeach] = createWayStyle("#FFF1BA", "#FFF1BA", true, false, Qt::SolidPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/beach.png")); m_defaultStyle[GeoDataPlacemark::NaturalWetland] = createWayStyle("#DDECEC", "#DDECEC", true, false, Qt::SolidPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/wetland.png")); m_defaultStyle[GeoDataPlacemark::NaturalGlacier] = createWayStyle("#DDECEC", "#DDECEC", true, false, Qt::SolidPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/glacier.png")); m_defaultStyle[GeoDataPlacemark::NaturalIceShelf] = createWayStyle("#8ebebe", "#8ebebe", true, false, Qt::SolidPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/glacier.png")); m_defaultStyle[GeoDataPlacemark::NaturalScrub] = createWayStyle("#B5E3B5", "#B5E3B5", true, false, Qt::SolidPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/scrub.png")); m_defaultStyle[GeoDataPlacemark::NaturalCliff] = createWayStyle(Qt::transparent, Qt::transparent, true, false, Qt::SolidPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/cliff2.png")); m_defaultStyle[GeoDataPlacemark::NaturalCave] = createOsmPOIStyle(osmFont, "amenities/cave", amenityColor); m_defaultStyle[GeoDataPlacemark::NaturalHeath] = createWayStyle("#d6d99f", QColor("#d6d99f").darker(150), true, false); m_defaultStyle[GeoDataPlacemark::LeisureGolfCourse] = createOsmPOIAreaStyle(osmFont, "leisure/golf", "#39ac39", "#b5e3b5", QColor(Qt::transparent)); m_defaultStyle[GeoDataPlacemark::LeisureMinigolfCourse] = createOsmPOIAreaStyle(osmFont, "leisure/miniature_golf", "#39ac39", "#b5e3b5", QColor(Qt::transparent)); m_defaultStyle[GeoDataPlacemark::LeisureMarina] = createOsmPOIStyle(osmFont, QString(), QColor("#95abd5"), QColor("#aec8d1"), QColor("#95abd5").darker(150)); m_defaultStyle[GeoDataPlacemark::LeisurePark] = createWayStyle(QColor("#c8facc"), QColor("#c8facc").darker(150), true, true); m_defaultStyle[GeoDataPlacemark::LeisurePlayground] = createOsmPOIAreaStyle(osmFont, "amenity/playground.16", amenityColor, "#CCFFF1", "#BDFFED"); m_defaultStyle[GeoDataPlacemark::LeisurePitch] = createWayStyle("#8ad3af", QColor("#8ad3af").darker(150), true, true); m_defaultStyle[GeoDataPlacemark::LeisureSportsCentre] = createWayStyle("#33cc99", QColor("#33cc99").darker(150), true, true); m_defaultStyle[GeoDataPlacemark::LeisureStadium] = createWayStyle("#33cc99", QColor("#33cc99").darker(150), true, true); m_defaultStyle[GeoDataPlacemark::LeisureTrack] = createWayStyle("#74dcba", QColor("#74dcba").darker(150), true, true); m_defaultStyle[GeoDataPlacemark::LeisureSwimmingPool] = createWayStyle(waterColor, waterColor.darker(150), true, true); m_defaultStyle[GeoDataPlacemark::LanduseAllotments] = createWayStyle("#E4C6AA", "#E4C6AA", true, false, Qt::SolidPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/allotments.png")); m_defaultStyle[GeoDataPlacemark::LanduseBasin] = createWayStyle(QColor(0xB5, 0xD0, 0xD0, 0x80 ), QColor( 0xB5, 0xD0, 0xD0 )); m_defaultStyle[GeoDataPlacemark::LanduseCemetery] = createWayStyle("#AACBAF", "#AACBAF", true, false, Qt::SolidPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/grave_yard_generic.png")); m_defaultStyle[GeoDataPlacemark::LanduseCommercial] = createWayStyle("#F2DAD9", "#D1B2B0", true, true); m_defaultStyle[GeoDataPlacemark::LanduseConstruction] = createWayStyle("#b6b592", "#b6b592", true, false); m_defaultStyle[GeoDataPlacemark::LanduseFarmland] = createWayStyle("#EDDDC9", "#C8B69E", true, true); m_defaultStyle[GeoDataPlacemark::LanduseFarmyard] = createWayStyle("#EFD6B5", "#D1B48C", true, true); m_defaultStyle[GeoDataPlacemark::LanduseGarages] = createWayStyle("#E0DDCD", "#E0DDCD", true, false); m_defaultStyle[GeoDataPlacemark::LanduseGrass] = createWayStyle("#A8C8A5", "#A8C8A5", true, false); m_defaultStyle[GeoDataPlacemark::LanduseIndustrial] = createWayStyle("#DED0D5", "#DED0D5", true, false); m_defaultStyle[GeoDataPlacemark::LanduseLandfill] = createWayStyle("#b6b592", "#b6b592", true, false); m_defaultStyle[GeoDataPlacemark::LanduseMeadow] = createWayStyle("#cdebb0", "#cdebb0", true, false); m_defaultStyle[GeoDataPlacemark::LanduseMilitary] = createWayStyle("#F3D8D2", "#F3D8D2", true, true, Qt::BDiagPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/military_red_hatch.png")); m_defaultStyle[GeoDataPlacemark::LanduseQuarry] = createWayStyle("#C4C2C2", "#C4C2C2", true, false, Qt::SolidPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/quarry.png")); m_defaultStyle[GeoDataPlacemark::LanduseRailway] = createWayStyle("#DED0D5", "#DED0D5", true, false); m_defaultStyle[GeoDataPlacemark::LanduseReservoir] = createWayStyle(waterColor, waterColor, true, false); m_defaultStyle[GeoDataPlacemark::LanduseResidential] = createWayStyle("#DCDCDC", "#DCDCDC", true, false); m_defaultStyle[GeoDataPlacemark::LanduseRetail] = createWayStyle("#FFD6D1", "#D99C95", true, true); m_defaultStyle[GeoDataPlacemark::LanduseOrchard] = createWayStyle("#AEDFA3", "#AEDFA3", true, false, Qt::SolidPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/orchard.png")); m_defaultStyle[GeoDataPlacemark::LanduseVineyard] = createWayStyle("#AEDFA3", "#AEDFA3", true, false, Qt::SolidPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/vineyard.png")); m_defaultStyle[GeoDataPlacemark::MilitaryDangerArea] = createWayStyle("#FFC0CB", "#FFC0CB", true, false, Qt::SolidPattern, MarbleDirs::path("bitmaps/osmcarto/patterns/danger.png")); m_defaultStyle[GeoDataPlacemark::RailwayRail] = createStyle(2.0, 1.435, "#706E70", "#EEEEEE", true, true, Qt::SolidPattern, Qt::CustomDashLine, Qt::FlatCap, true, QVector< qreal >() << 2 << 3, osmFont, QColor(Qt::transparent)); m_defaultStyle[GeoDataPlacemark::RailwayNarrowGauge] = createStyle(2.0, 1.0, "#706E70", "#EEEEEE", true, true, Qt::SolidPattern, Qt::CustomDashLine, Qt::FlatCap, true, QVector< qreal >() << 2 << 3, osmFont, QColor(Qt::transparent)); // FIXME: the tram is currently being rendered as a polygon. m_defaultStyle[GeoDataPlacemark::RailwayTram] = createStyle(2.0, 1.435, "#706E70", "#B7B6B7", false, true, Qt::SolidPattern, Qt::SolidLine, Qt::FlatCap, false, QVector(), osmFont, QColor(Qt::transparent)); m_defaultStyle[GeoDataPlacemark::RailwayLightRail] = createStyle(2.0, 1.435, "#706E70", "#706E70", false, true, Qt::SolidPattern, Qt::SolidLine, Qt::FlatCap, false, QVector(), osmFont, QColor(Qt::transparent)); m_defaultStyle[GeoDataPlacemark::RailwayAbandoned] = createStyle(2.0, 1.435, Qt::transparent, "#706E70", false, false, Qt::SolidPattern, Qt::DotLine, Qt::FlatCap, false, QVector(), osmFont, QColor(Qt::transparent)); m_defaultStyle[GeoDataPlacemark::RailwaySubway] = createStyle(2.0, 1.435, "#706E70", "#EEEEEE", false, true, Qt::SolidPattern, Qt::SolidLine, Qt::FlatCap, false, QVector(), osmFont, QColor(Qt::transparent)); m_defaultStyle[GeoDataPlacemark::RailwayPreserved] = createStyle(2.0, 1.435, "#EEEEEE", "#706E70", true, true, Qt::SolidPattern, Qt::DotLine, Qt::FlatCap, true, QVector(), osmFont, QColor(Qt::transparent)); m_defaultStyle[GeoDataPlacemark::RailwayMiniature] = createStyle(2.0, 1.435, "#706E70", "#EEEEEE", false, true, Qt::SolidPattern, Qt::SolidLine, Qt::FlatCap, false, QVector(), osmFont, QColor(Qt::transparent)); m_defaultStyle[GeoDataPlacemark::RailwayConstruction] = createStyle(2.0, 1.435, "#EEEEEE", "#706E70", true, true, Qt::SolidPattern, Qt::DotLine, Qt::FlatCap, true, QVector(), osmFont, QColor(Qt::transparent)); m_defaultStyle[GeoDataPlacemark::RailwayMonorail] = createStyle(2.0, 1.435, "#706E70", "#EEEEEE", false, true, Qt::SolidPattern, Qt::SolidLine, Qt::FlatCap, false, QVector(), osmFont, QColor(Qt::transparent)); m_defaultStyle[GeoDataPlacemark::RailwayFunicular] = createStyle(2.0, 1.435, "#706E70", "#EEEEEE", false, true, Qt::SolidPattern, Qt::SolidLine, Qt::FlatCap, false, QVector(), osmFont, QColor(Qt::transparent)); m_defaultStyle[GeoDataPlacemark::Landmass] = createWayStyle("#F1EEE8", "#F1EEE8", true, false); m_defaultStyle[GeoDataPlacemark::UrbanArea] = createWayStyle("#E6E3DD", "#E6E3DD", true, false); m_defaultStyle[GeoDataPlacemark::InternationalDateLine] = createStyle(1.0, 0.0, "#000000", "#000000", false, true, Qt::SolidPattern, Qt::SolidLine, Qt::FlatCap, false, QVector(), osmFont); m_defaultStyle[GeoDataPlacemark::Bathymetry] = createWayStyle("#a5c9c9", "#a5c9c9", true, false); m_defaultStyle[GeoDataPlacemark::AdminLevel1] = createStyle(0.0, 0.0, "#DF9CCF", "#DF9CCF", false, true, Qt::SolidPattern, Qt::CustomDashLine, Qt::FlatCap, false, QVector< qreal >() << 0.3 << 0.3, osmFont); m_defaultStyle[GeoDataPlacemark::AdminLevel2] = createStyle(2.0, 0.0, "#DF9CCF", "#DF9CCF", false, true, Qt::SolidPattern, Qt::SolidLine, Qt::FlatCap, false, QVector< qreal >() << 0.3 << 0.3, osmFont); m_defaultStyle[GeoDataPlacemark::AdminLevel3] = createStyle(1.8, 0.0, "#DF9CCF", "#DF9CCF", false, true, Qt::SolidPattern, Qt::DashLine, Qt::FlatCap, false, QVector< qreal >() << 0.3 << 0.3, osmFont); m_defaultStyle[GeoDataPlacemark::AdminLevel4] = createStyle(1.5, 0.0, "#DF9CCF", "#DF9CCF", false, true, Qt::SolidPattern, Qt::DotLine, Qt::FlatCap, false, QVector< qreal >() << 0.3 << 0.3, osmFont); m_defaultStyle[GeoDataPlacemark::AdminLevel5] = createStyle(1.25, 0.0, "#DF9CCF", "#DF9CCF", false, true, Qt::SolidPattern, Qt::DashDotDotLine, Qt::FlatCap, false, QVector< qreal >() << 0.3 << 0.3, osmFont); m_defaultStyle[GeoDataPlacemark::AdminLevel6] = createStyle(1, 0.0, "#DF9CCF", "#DF9CCF", false, true, Qt::SolidPattern, Qt::DashDotLine, Qt::FlatCap, false, QVector< qreal >() << 0.3 << 0.3, osmFont); m_defaultStyle[GeoDataPlacemark::AdminLevel7] = createStyle(1, 0.0, "#DF9CCF", "#DF9CCF", false, true, Qt::SolidPattern, Qt::DashLine, Qt::FlatCap, false, QVector< qreal >() << 0.3 << 0.3, osmFont); m_defaultStyle[GeoDataPlacemark::AdminLevel8] = createStyle(1, 0.0, "#DF9CCF", "#DF9CCF", false, true, Qt::SolidPattern, Qt::DashLine, Qt::FlatCap, false, QVector< qreal >() << 0.3 << 0.3, osmFont); m_defaultStyle[GeoDataPlacemark::AdminLevel9] = createStyle(1.5, 0.0, "#DF9CCF", "#DF9CCF", false, true, Qt::SolidPattern, Qt::DotLine, Qt::FlatCap, false, QVector< qreal >() << 0.3 << 0.3, osmFont); m_defaultStyle[GeoDataPlacemark::AdminLevel10] = createStyle(1.5, 0.0, "#DF9CCF", "#DF9CCF", false, true, Qt::SolidPattern, Qt::DotLine, Qt::FlatCap, false, QVector< qreal >() << 0.3 << 0.3, osmFont); m_defaultStyle[GeoDataPlacemark::AdminLevel11] = createStyle(1.5, 0.0, "#DF9CCF", "#DF9CCF", false, true, Qt::SolidPattern, Qt::DotLine, Qt::FlatCap, false, QVector< qreal >() << 0.3 << 0.3, osmFont); m_defaultStyle[GeoDataPlacemark::BoundaryMaritime] = createStyle(2.0, 0.0, "#88b3bf", "#88b3bf", false, true, Qt::SolidPattern, Qt::SolidLine, Qt::FlatCap, false, QVector(), osmFont); m_defaultStyle[GeoDataPlacemark::Satellite] = GeoDataStyle::Ptr(new GeoDataStyle( MarbleDirs::path( "bitmaps/satellite.png" ), QFont( defaultFamily, defaultSize, 50, false ), defaultLabelColor )); QFont tmp; // Fonts for areas ... tmp = m_defaultStyle[GeoDataPlacemark::Continent]->labelStyle().font(); tmp.setLetterSpacing( QFont::AbsoluteSpacing, 2 ); tmp.setCapitalization( QFont::AllUppercase ); tmp.setBold( true ); m_defaultStyle[GeoDataPlacemark::Continent]->labelStyle().setFont( tmp ); // Fonts for areas ... tmp = m_defaultStyle[GeoDataPlacemark::Mare]->labelStyle().font(); tmp.setLetterSpacing( QFont::AbsoluteSpacing, 2 ); tmp.setCapitalization( QFont::AllUppercase ); tmp.setBold( true ); m_defaultStyle[GeoDataPlacemark::Mare]->labelStyle().setFont( tmp ); // Now we need to underline the capitals ... tmp = m_defaultStyle[GeoDataPlacemark::SmallNationCapital]->labelStyle().font(); tmp.setUnderline( true ); m_defaultStyle[GeoDataPlacemark::SmallNationCapital]->labelStyle().setFont( tmp ); tmp = m_defaultStyle[GeoDataPlacemark::MediumNationCapital]->labelStyle().font(); tmp.setUnderline( true ); m_defaultStyle[GeoDataPlacemark::MediumNationCapital]->labelStyle().setFont( tmp ); tmp = m_defaultStyle[GeoDataPlacemark::BigNationCapital]->labelStyle().font(); tmp.setUnderline( true ); m_defaultStyle[GeoDataPlacemark::BigNationCapital]->labelStyle().setFont( tmp ); tmp = m_defaultStyle[GeoDataPlacemark::LargeNationCapital]->labelStyle().font(); tmp.setUnderline( true ); m_defaultStyle[GeoDataPlacemark::LargeNationCapital]->labelStyle().setFont( tmp ); // Buildings m_defaultStyle[GeoDataPlacemark::Building] = createStyle(1, 0, buildingColor, buildingColor.darker(), true, true, Qt::SolidPattern, Qt::SolidLine, Qt::RoundCap, false, QVector(), osmFont); for (int i=0; iiconStyle().iconPath().isEmpty()) { auto const category = GeoDataPlacemark::GeoDataVisualCategory(i); m_buildingStyles[category] = GeoDataStyle::Ptr(new GeoDataStyle(*m_defaultStyle[GeoDataPlacemark::Building])); m_buildingStyles[category]->iconStyle() = m_defaultStyle[i]->iconStyle(); m_buildingStyles[category]->labelStyle() = m_defaultStyle[i]->labelStyle(); } } } QString StyleBuilder::Private::createPaintLayerItem(const QString &itemType, GeoDataPlacemark::GeoDataVisualCategory visualCategory, const QString &subType) { QString const category = visualCategoryName(visualCategory); if (subType.isEmpty()) { return itemType + QLatin1Char('/') + category; } else { return itemType + QLatin1Char('/') + category + QLatin1Char('/') + subType; } } void StyleBuilder::Private::initializeOsmVisualCategories() { // Only initialize the map once if (!s_visualCategories.isEmpty()) { return; } s_visualCategories[OsmTag("admin_level", "1")] = GeoDataPlacemark::AdminLevel1; s_visualCategories[OsmTag("admin_level", "2")] = GeoDataPlacemark::AdminLevel2; s_visualCategories[OsmTag("admin_level", "3")] = GeoDataPlacemark::AdminLevel3; s_visualCategories[OsmTag("admin_level", "4")] = GeoDataPlacemark::AdminLevel4; s_visualCategories[OsmTag("admin_level", "5")] = GeoDataPlacemark::AdminLevel5; s_visualCategories[OsmTag("admin_level", "6")] = GeoDataPlacemark::AdminLevel6; s_visualCategories[OsmTag("admin_level", "7")] = GeoDataPlacemark::AdminLevel7; s_visualCategories[OsmTag("admin_level", "8")] = GeoDataPlacemark::AdminLevel8; s_visualCategories[OsmTag("admin_level", "9")] = GeoDataPlacemark::AdminLevel9; s_visualCategories[OsmTag("admin_level", "10")] = GeoDataPlacemark::AdminLevel10; s_visualCategories[OsmTag("admin_level", "11")] = GeoDataPlacemark::AdminLevel11; s_visualCategories[OsmTag("boundary", "maritime")] = GeoDataPlacemark::BoundaryMaritime; s_visualCategories[OsmTag("amenity", "restaurant")] = GeoDataPlacemark::FoodRestaurant; s_visualCategories[OsmTag("amenity", "fast_food")] = GeoDataPlacemark::FoodFastFood; s_visualCategories[OsmTag("amenity", "pub")] = GeoDataPlacemark::FoodPub; s_visualCategories[OsmTag("amenity", "bar")] = GeoDataPlacemark::FoodBar; s_visualCategories[OsmTag("amenity", "cafe")] = GeoDataPlacemark::FoodCafe; s_visualCategories[OsmTag("amenity", "biergarten")] = GeoDataPlacemark::FoodBiergarten; s_visualCategories[OsmTag("amenity", "school")] = GeoDataPlacemark::EducationSchool; s_visualCategories[OsmTag("amenity", "college")] = GeoDataPlacemark::EducationCollege; s_visualCategories[OsmTag("amenity", "library")] = GeoDataPlacemark::AmenityLibrary; s_visualCategories[OsmTag("amenity", "kindergarten")] = GeoDataPlacemark::AmenityKindergarten; s_visualCategories[OsmTag("amenity", "childcare")] = GeoDataPlacemark::AmenityKindergarten; s_visualCategories[OsmTag("amenity", "university")] = GeoDataPlacemark::EducationUniversity; s_visualCategories[OsmTag("amenity", "bus_station")] = GeoDataPlacemark::TransportBusStation; s_visualCategories[OsmTag("amenity", "car_sharing")] = GeoDataPlacemark::TransportCarShare; s_visualCategories[OsmTag("amenity", "fuel")] = GeoDataPlacemark::TransportFuel; s_visualCategories[OsmTag("amenity", "parking")] = GeoDataPlacemark::TransportParking; s_visualCategories[OsmTag("amenity", "parking_space")] = GeoDataPlacemark::TransportParkingSpace; s_visualCategories[OsmTag("amenity", "atm")] = GeoDataPlacemark::MoneyAtm; s_visualCategories[OsmTag("amenity", "bank")] = GeoDataPlacemark::MoneyBank; s_visualCategories[OsmTag("historic", "archaeological_site")] = GeoDataPlacemark::AmenityArchaeologicalSite; s_visualCategories[OsmTag("amenity", "embassy")] = GeoDataPlacemark::AmenityEmbassy; s_visualCategories[OsmTag("emergency", "phone")] = GeoDataPlacemark::AmenityEmergencyPhone; s_visualCategories[OsmTag("leisure", "water_park")] = GeoDataPlacemark::AmenityWaterPark; s_visualCategories[OsmTag("amenity", "community_centre")] = GeoDataPlacemark::AmenityCommunityCentre; s_visualCategories[OsmTag("amenity", "fountain")] = GeoDataPlacemark::AmenityFountain; s_visualCategories[OsmTag("amenity", "nightclub")] = GeoDataPlacemark::AmenityNightClub; s_visualCategories[OsmTag("amenity", "bench")] = GeoDataPlacemark::AmenityBench; s_visualCategories[OsmTag("amenity", "courthouse")] = GeoDataPlacemark::AmenityCourtHouse; s_visualCategories[OsmTag("amenity", "fire_station")] = GeoDataPlacemark::AmenityFireStation; s_visualCategories[OsmTag("amenity", "hunting_stand")] = GeoDataPlacemark::AmenityHuntingStand; s_visualCategories[OsmTag("amenity", "police")] = GeoDataPlacemark::AmenityPolice; s_visualCategories[OsmTag("amenity", "post_box")] = GeoDataPlacemark::AmenityPostBox; s_visualCategories[OsmTag("amenity", "post_office")] = GeoDataPlacemark::AmenityPostOffice; s_visualCategories[OsmTag("amenity", "prison")] = GeoDataPlacemark::AmenityPrison; s_visualCategories[OsmTag("amenity", "recycling")] = GeoDataPlacemark::AmenityRecycling; s_visualCategories[OsmTag("amenity", "shelter")] = GeoDataPlacemark::AmenityShelter; s_visualCategories[OsmTag("amenity", "telephone")] = GeoDataPlacemark::AmenityTelephone; s_visualCategories[OsmTag("amenity", "toilets")] = GeoDataPlacemark::AmenityToilets; s_visualCategories[OsmTag("amenity", "townhall")] = GeoDataPlacemark::AmenityTownHall; s_visualCategories[OsmTag("amenity", "waste_basket")] = GeoDataPlacemark::AmenityWasteBasket; s_visualCategories[OsmTag("amenity", "drinking_water")] = GeoDataPlacemark::AmenityDrinkingWater; s_visualCategories[OsmTag("amenity", "graveyard")] = GeoDataPlacemark::AmenityGraveyard; s_visualCategories[OsmTag("amenity", "charging_station")] = GeoDataPlacemark::AmenityChargingStation; s_visualCategories[OsmTag("amenity", "dentist")] = GeoDataPlacemark::HealthDentist; s_visualCategories[OsmTag("amenity", "pharmacy")] = GeoDataPlacemark::HealthPharmacy; s_visualCategories[OsmTag("amenity", "hospital")] = GeoDataPlacemark::HealthHospital; s_visualCategories[OsmTag("amenity", "doctors")] = GeoDataPlacemark::HealthDoctors; s_visualCategories[OsmTag("amenity", "veterinary")] = GeoDataPlacemark::HealthVeterinary; s_visualCategories[OsmTag("amenity", "cinema")] = GeoDataPlacemark::TouristCinema; s_visualCategories[OsmTag("tourism", "information")] = GeoDataPlacemark::TouristInformation; s_visualCategories[OsmTag("amenity", "theatre")] = GeoDataPlacemark::TouristTheatre; s_visualCategories[OsmTag("amenity", "place_of_worship")] = GeoDataPlacemark::ReligionPlaceOfWorship; s_visualCategories[OsmTag("natural", "peak")] = GeoDataPlacemark::NaturalPeak; s_visualCategories[OsmTag("natural", "tree")] = GeoDataPlacemark::NaturalTree; s_visualCategories[OsmTag("natural", "cave_entrance")] = GeoDataPlacemark::NaturalCave; s_visualCategories[OsmTag("shop", "beverages")] = GeoDataPlacemark::ShopBeverages; s_visualCategories[OsmTag("shop", "hifi")] = GeoDataPlacemark::ShopHifi; s_visualCategories[OsmTag("shop", "supermarket")] = GeoDataPlacemark::ShopSupermarket; s_visualCategories[OsmTag("shop", "alcohol")] = GeoDataPlacemark::ShopAlcohol; s_visualCategories[OsmTag("shop", "bakery")] = GeoDataPlacemark::ShopBakery; s_visualCategories[OsmTag("shop", "butcher")] = GeoDataPlacemark::ShopButcher; s_visualCategories[OsmTag("shop", "confectionery")] = GeoDataPlacemark::ShopConfectionery; s_visualCategories[OsmTag("shop", "convenience")] = GeoDataPlacemark::ShopConvenience; s_visualCategories[OsmTag("shop", "greengrocer")] = GeoDataPlacemark::ShopGreengrocer; s_visualCategories[OsmTag("shop", "seafood")] = GeoDataPlacemark::ShopSeafood; s_visualCategories[OsmTag("shop", "department_store")] = GeoDataPlacemark::ShopDepartmentStore; s_visualCategories[OsmTag("shop", "kiosk")] = GeoDataPlacemark::ShopKiosk; s_visualCategories[OsmTag("shop", "bag")] = GeoDataPlacemark::ShopBag; s_visualCategories[OsmTag("shop", "clothes")] = GeoDataPlacemark::ShopClothes; s_visualCategories[OsmTag("shop", "fashion")] = GeoDataPlacemark::ShopFashion; s_visualCategories[OsmTag("shop", "jewelry")] = GeoDataPlacemark::ShopJewelry; s_visualCategories[OsmTag("shop", "shoes")] = GeoDataPlacemark::ShopShoes; s_visualCategories[OsmTag("shop", "variety_store")] = GeoDataPlacemark::ShopVarietyStore; s_visualCategories[OsmTag("shop", "beauty")] = GeoDataPlacemark::ShopBeauty; s_visualCategories[OsmTag("shop", "chemist")] = GeoDataPlacemark::ShopChemist; s_visualCategories[OsmTag("shop", "cosmetics")] = GeoDataPlacemark::ShopCosmetics; s_visualCategories[OsmTag("shop", "hairdresser")] = GeoDataPlacemark::ShopHairdresser; s_visualCategories[OsmTag("shop", "optician")] = GeoDataPlacemark::ShopOptician; s_visualCategories[OsmTag("shop", "perfumery")] = GeoDataPlacemark::ShopPerfumery; s_visualCategories[OsmTag("shop", "doityourself")] = GeoDataPlacemark::ShopDoitYourself; s_visualCategories[OsmTag("shop", "florist")] = GeoDataPlacemark::ShopFlorist; s_visualCategories[OsmTag("shop", "hardware")] = GeoDataPlacemark::ShopHardware; s_visualCategories[OsmTag("shop", "furniture")] = GeoDataPlacemark::ShopFurniture; s_visualCategories[OsmTag("shop", "electronics")] = GeoDataPlacemark::ShopElectronics; s_visualCategories[OsmTag("shop", "mobile_phone")] = GeoDataPlacemark::ShopMobilePhone; s_visualCategories[OsmTag("shop", "bicycle")] = GeoDataPlacemark::ShopBicycle; s_visualCategories[OsmTag("shop", "car")] = GeoDataPlacemark::ShopCar; s_visualCategories[OsmTag("shop", "car_repair")] = GeoDataPlacemark::ShopCarRepair; s_visualCategories[OsmTag("shop", "car_parts")] = GeoDataPlacemark::ShopCarParts; s_visualCategories[OsmTag("shop", "motorcycle")] = GeoDataPlacemark::ShopMotorcycle; s_visualCategories[OsmTag("shop", "outdoor")] = GeoDataPlacemark::ShopOutdoor; s_visualCategories[OsmTag("shop", "sports")] = GeoDataPlacemark::ShopSports; s_visualCategories[OsmTag("shop", "copy")] = GeoDataPlacemark::ShopCopy; s_visualCategories[OsmTag("shop", "art")] = GeoDataPlacemark::ShopArt; s_visualCategories[OsmTag("shop", "musical_instrument")] = GeoDataPlacemark::ShopMusicalInstrument; s_visualCategories[OsmTag("shop", "photo")] = GeoDataPlacemark::ShopPhoto; s_visualCategories[OsmTag("shop", "books")] = GeoDataPlacemark::ShopBook; s_visualCategories[OsmTag("shop", "gift")] = GeoDataPlacemark::ShopGift; s_visualCategories[OsmTag("shop", "stationery")] = GeoDataPlacemark::ShopStationery; s_visualCategories[OsmTag("shop", "laundry")] = GeoDataPlacemark::ShopLaundry; s_visualCategories[OsmTag("shop", "pet")] = GeoDataPlacemark::ShopPet; s_visualCategories[OsmTag("shop", "toys")] = GeoDataPlacemark::ShopToys; s_visualCategories[OsmTag("shop", "travel_agency")] = GeoDataPlacemark::ShopTravelAgency; s_visualCategories[OsmTag("shop", "deli")] = GeoDataPlacemark::ShopDeli; s_visualCategories[OsmTag("shop", "tobacco")] = GeoDataPlacemark::ShopTobacco; s_visualCategories[OsmTag("shop", "tea")] = GeoDataPlacemark::ShopTea; // Default for all other shops foreach (const QString &value, shopValues()) { s_visualCategories[OsmTag("shop", value)] = GeoDataPlacemark::Shop; } s_visualCategories[OsmTag("man_made", "bridge")] = GeoDataPlacemark::ManmadeBridge; s_visualCategories[OsmTag("man_made", "lighthouse")] = GeoDataPlacemark::ManmadeLighthouse; s_visualCategories[OsmTag("man_made", "pier")] = GeoDataPlacemark::ManmadePier; s_visualCategories[OsmTag("man_made", "water_tower")] = GeoDataPlacemark::ManmadeWaterTower; s_visualCategories[OsmTag("man_made", "windmill")] = GeoDataPlacemark::ManmadeWindMill; s_visualCategories[OsmTag("religion", "")] = GeoDataPlacemark::ReligionPlaceOfWorship; s_visualCategories[OsmTag("religion", "bahai")] = GeoDataPlacemark::ReligionBahai; s_visualCategories[OsmTag("religion", "buddhist")] = GeoDataPlacemark::ReligionBuddhist; s_visualCategories[OsmTag("religion", "christian")] = GeoDataPlacemark::ReligionChristian; s_visualCategories[OsmTag("religion", "muslim")] = GeoDataPlacemark::ReligionMuslim; s_visualCategories[OsmTag("religion", "hindu")] = GeoDataPlacemark::ReligionHindu; s_visualCategories[OsmTag("religion", "jain")] = GeoDataPlacemark::ReligionJain; s_visualCategories[OsmTag("religion", "jewish")] = GeoDataPlacemark::ReligionJewish; s_visualCategories[OsmTag("religion", "shinto")] = GeoDataPlacemark::ReligionShinto; s_visualCategories[OsmTag("religion", "sikh")] = GeoDataPlacemark::ReligionSikh; s_visualCategories[OsmTag("historic", "memorial")] = GeoDataPlacemark::HistoricMemorial; s_visualCategories[OsmTag("tourism", "attraction")] = GeoDataPlacemark::TouristAttraction; s_visualCategories[OsmTag("tourism", "camp_site")] = GeoDataPlacemark::AccomodationCamping; s_visualCategories[OsmTag("tourism", "hostel")] = GeoDataPlacemark::AccomodationHostel; s_visualCategories[OsmTag("tourism", "hotel")] = GeoDataPlacemark::AccomodationHotel; s_visualCategories[OsmTag("tourism", "motel")] = GeoDataPlacemark::AccomodationMotel; s_visualCategories[OsmTag("tourism", "guest_house")] = GeoDataPlacemark::AccomodationGuestHouse; s_visualCategories[OsmTag("tourism", "museum")] = GeoDataPlacemark::TouristMuseum; s_visualCategories[OsmTag("tourism", "theme_park")] = GeoDataPlacemark::TouristThemePark; s_visualCategories[OsmTag("tourism", "viewpoint")] = GeoDataPlacemark::TouristViewPoint; s_visualCategories[OsmTag("tourism", "zoo")] = GeoDataPlacemark::TouristZoo; s_visualCategories[OsmTag("tourism", "alpine_hut")] = GeoDataPlacemark::TouristAlpineHut; s_visualCategories[OsmTag("tourism", "wilderness_hut")] = GeoDataPlacemark::TouristWildernessHut; s_visualCategories[OsmTag("barrier", "city_wall")] = GeoDataPlacemark::BarrierCityWall; s_visualCategories[OsmTag("barrier", "gate")] = GeoDataPlacemark::BarrierGate; s_visualCategories[OsmTag("barrier", "lift_gate")] = GeoDataPlacemark::BarrierLiftGate; s_visualCategories[OsmTag("barrier", "wall")] = GeoDataPlacemark::BarrierWall; s_visualCategories[OsmTag("historic", "castle")] = GeoDataPlacemark::TouristCastle; s_visualCategories[OsmTag("historic", "fort")] = GeoDataPlacemark::TouristCastle; s_visualCategories[OsmTag("historic", "monument")] = GeoDataPlacemark::TouristMonument; s_visualCategories[OsmTag("historic", "ruins")] = GeoDataPlacemark::TouristRuin; s_visualCategories[OsmTag("highway", "traffic_signals")] = GeoDataPlacemark::HighwayTrafficSignals; s_visualCategories[OsmTag("highway", "unknown")] = GeoDataPlacemark::HighwayUnknown; s_visualCategories[OsmTag("highway", "steps")] = GeoDataPlacemark::HighwaySteps; s_visualCategories[OsmTag("highway", "footway")] = GeoDataPlacemark::HighwayFootway; s_visualCategories[OsmTag("highway", "cycleway")] = GeoDataPlacemark::HighwayCycleway; s_visualCategories[OsmTag("highway", "path")] = GeoDataPlacemark::HighwayPath; s_visualCategories[OsmTag("highway", "track")] = GeoDataPlacemark::HighwayTrack; s_visualCategories[OsmTag("highway", "pedestrian")] = GeoDataPlacemark::HighwayPedestrian; s_visualCategories[OsmTag("highway", "service")] = GeoDataPlacemark::HighwayService; s_visualCategories[OsmTag("highway", "living_street")] = GeoDataPlacemark::HighwayLivingStreet; s_visualCategories[OsmTag("highway", "unclassified")] = GeoDataPlacemark::HighwayUnclassified; s_visualCategories[OsmTag("highway", "residential")] = GeoDataPlacemark::HighwayResidential; s_visualCategories[OsmTag("highway", "road")] = GeoDataPlacemark::HighwayRoad; s_visualCategories[OsmTag("highway", "tertiary_link")] = GeoDataPlacemark::HighwayTertiaryLink; s_visualCategories[OsmTag("highway", "tertiary")] = GeoDataPlacemark::HighwayTertiary; s_visualCategories[OsmTag("highway", "secondary_link")] = GeoDataPlacemark::HighwaySecondaryLink; s_visualCategories[OsmTag("highway", "secondary")] = GeoDataPlacemark::HighwaySecondary; s_visualCategories[OsmTag("highway", "primary_link")] = GeoDataPlacemark::HighwayPrimaryLink; s_visualCategories[OsmTag("highway", "primary")] = GeoDataPlacemark::HighwayPrimary; s_visualCategories[OsmTag("highway", "trunk_link")] = GeoDataPlacemark::HighwayTrunkLink; s_visualCategories[OsmTag("highway", "trunk")] = GeoDataPlacemark::HighwayTrunk; s_visualCategories[OsmTag("highway", "motorway_link")] = GeoDataPlacemark::HighwayMotorwayLink; s_visualCategories[OsmTag("highway", "motorway")] = GeoDataPlacemark::HighwayMotorway; s_visualCategories[OsmTag("highway", "raceway")] = GeoDataPlacemark::HighwayRaceway; s_visualCategories[OsmTag("natural", "water")] = GeoDataPlacemark::NaturalWater; s_visualCategories[OsmTag("natural", "reef")] = GeoDataPlacemark::NaturalReef; s_visualCategories[OsmTag("natural", "bay")] = GeoDataPlacemark::NaturalWater; s_visualCategories[OsmTag("natural", "coastline")] = GeoDataPlacemark::NaturalWater; s_visualCategories[OsmTag("waterway", "stream")] = GeoDataPlacemark::WaterwayStream; s_visualCategories[OsmTag("waterway", "river")] = GeoDataPlacemark::WaterwayRiver; s_visualCategories[OsmTag("waterway", "riverbank")] = GeoDataPlacemark::NaturalWater; s_visualCategories[OsmTag("waterway", "canal")] = GeoDataPlacemark::WaterwayCanal; s_visualCategories[OsmTag("waterway", "drain")] = GeoDataPlacemark::WaterwayDrain; s_visualCategories[OsmTag("waterway", "ditch")] = GeoDataPlacemark::WaterwayDitch; s_visualCategories[OsmTag("natural", "wood")] = GeoDataPlacemark::NaturalWood; s_visualCategories[OsmTag("natural", "beach")] = GeoDataPlacemark::NaturalBeach; s_visualCategories[OsmTag("natural", "wetland")] = GeoDataPlacemark::NaturalWetland; s_visualCategories[OsmTag("natural", "glacier")] = GeoDataPlacemark::NaturalGlacier; s_visualCategories[OsmTag("glacier:type", "shelf")] = GeoDataPlacemark::NaturalIceShelf; s_visualCategories[OsmTag("natural", "scrub")] = GeoDataPlacemark::NaturalScrub; s_visualCategories[OsmTag("natural", "cliff")] = GeoDataPlacemark::NaturalCliff; s_visualCategories[OsmTag("military", "danger_area")] = GeoDataPlacemark::MilitaryDangerArea; s_visualCategories[OsmTag("landuse", "forest")] = GeoDataPlacemark::NaturalWood; s_visualCategories[OsmTag("landuse", "allotments")] = GeoDataPlacemark::LanduseAllotments; s_visualCategories[OsmTag("landuse", "basin")] = GeoDataPlacemark::LanduseBasin; s_visualCategories[OsmTag("landuse", "brownfield")] = GeoDataPlacemark::LanduseConstruction; s_visualCategories[OsmTag("landuse", "cemetery")] = GeoDataPlacemark::LanduseCemetery; s_visualCategories[OsmTag("landuse", "commercial")] = GeoDataPlacemark::LanduseCommercial; s_visualCategories[OsmTag("landuse", "construction")] = GeoDataPlacemark::LanduseConstruction; s_visualCategories[OsmTag("landuse", "farm")] = GeoDataPlacemark::LanduseFarmland; s_visualCategories[OsmTag("landuse", "farmland")] = GeoDataPlacemark::LanduseFarmland; s_visualCategories[OsmTag("landuse", "greenhouse_horticulture")] = GeoDataPlacemark::LanduseFarmland; s_visualCategories[OsmTag("landuse", "farmyard")] = GeoDataPlacemark::LanduseFarmland; s_visualCategories[OsmTag("landuse", "garages")] = GeoDataPlacemark::LanduseGarages; s_visualCategories[OsmTag("landuse", "greenfield")] = GeoDataPlacemark::LanduseConstruction; s_visualCategories[OsmTag("landuse", "industrial")] = GeoDataPlacemark::LanduseIndustrial; s_visualCategories[OsmTag("landuse", "landfill")] = GeoDataPlacemark::LanduseLandfill; s_visualCategories[OsmTag("landuse", "meadow")] = GeoDataPlacemark::LanduseMeadow; s_visualCategories[OsmTag("landuse", "military")] = GeoDataPlacemark::LanduseMilitary; s_visualCategories[OsmTag("landuse", "orchard")] = GeoDataPlacemark::LanduseFarmland; s_visualCategories[OsmTag("landuse", "quarry")] = GeoDataPlacemark::LanduseQuarry; s_visualCategories[OsmTag("landuse", "railway")] = GeoDataPlacemark::LanduseRailway; s_visualCategories[OsmTag("landuse", "recreation_ground")] = GeoDataPlacemark::LeisurePark; s_visualCategories[OsmTag("landuse", "reservoir")] = GeoDataPlacemark::LanduseReservoir; s_visualCategories[OsmTag("landuse", "residential")] = GeoDataPlacemark::LanduseResidential; s_visualCategories[OsmTag("landuse", "retail")] = GeoDataPlacemark::LanduseRetail; s_visualCategories[OsmTag("landuse", "orchard")] = GeoDataPlacemark::LanduseOrchard; s_visualCategories[OsmTag("landuse", "vineyard")] = GeoDataPlacemark::LanduseVineyard; s_visualCategories[OsmTag("landuse", "village_green")] = GeoDataPlacemark::LanduseGrass; s_visualCategories[OsmTag("landuse", "grass")] = GeoDataPlacemark::LanduseGrass; s_visualCategories[OsmTag("leisure", "common")] = GeoDataPlacemark::LanduseGrass; s_visualCategories[OsmTag("leisure", "garden")] = GeoDataPlacemark::LanduseGrass; s_visualCategories[OsmTag("leisure", "golf_course")] = GeoDataPlacemark::LeisureGolfCourse; s_visualCategories[OsmTag("leisure", "marina")] = GeoDataPlacemark::LeisureMarina; s_visualCategories[OsmTag("leisure", "park")] = GeoDataPlacemark::LeisurePark; s_visualCategories[OsmTag("leisure", "playground")] = GeoDataPlacemark::LeisurePlayground; s_visualCategories[OsmTag("leisure", "pitch")] = GeoDataPlacemark::LeisurePitch; s_visualCategories[OsmTag("leisure", "sports_centre")] = GeoDataPlacemark::LeisureSportsCentre; s_visualCategories[OsmTag("leisure", "stadium")] = GeoDataPlacemark::LeisureStadium; s_visualCategories[OsmTag("leisure", "track")] = GeoDataPlacemark::LeisureTrack; s_visualCategories[OsmTag("leisure", "swimming_pool")] = GeoDataPlacemark::LeisureSwimmingPool; s_visualCategories[OsmTag("leisure", "miniature_golf")] = GeoDataPlacemark::LeisureMinigolfCourse; s_visualCategories[OsmTag("railway", "rail")] = GeoDataPlacemark::RailwayRail; s_visualCategories[OsmTag("railway", "narrow_gauge")] = GeoDataPlacemark::RailwayNarrowGauge; s_visualCategories[OsmTag("railway", "tram")] = GeoDataPlacemark::RailwayTram; s_visualCategories[OsmTag("railway", "light_rail")] = GeoDataPlacemark::RailwayLightRail; s_visualCategories[OsmTag("railway", "preserved")] = GeoDataPlacemark::RailwayPreserved; s_visualCategories[OsmTag("railway", "abandoned")] = GeoDataPlacemark::RailwayAbandoned; s_visualCategories[OsmTag("railway", "disused")] = GeoDataPlacemark::RailwayAbandoned; s_visualCategories[OsmTag("railway", "razed")] = GeoDataPlacemark::RailwayAbandoned; s_visualCategories[OsmTag("railway", "subway")] = GeoDataPlacemark::RailwaySubway; s_visualCategories[OsmTag("railway", "miniature")] = GeoDataPlacemark::RailwayMiniature; s_visualCategories[OsmTag("railway", "construction")] = GeoDataPlacemark::RailwayConstruction; s_visualCategories[OsmTag("railway", "monorail")] = GeoDataPlacemark::RailwayMonorail; s_visualCategories[OsmTag("railway", "funicular")] = GeoDataPlacemark::RailwayFunicular; s_visualCategories[OsmTag("railway", "platform")] = GeoDataPlacemark::TransportPlatform; s_visualCategories[OsmTag("railway", "station")] = GeoDataPlacemark::TransportTrainStation; s_visualCategories[OsmTag("railway", "halt")] = GeoDataPlacemark::TransportTrainStation; s_visualCategories[OsmTag("power", "tower")] = GeoDataPlacemark::PowerTower; s_visualCategories[OsmTag("aeroway", "aerodrome")] = GeoDataPlacemark::TransportAerodrome; s_visualCategories[OsmTag("aeroway", "helipad")] = GeoDataPlacemark::TransportHelipad; s_visualCategories[OsmTag("aeroway", "gate")] = GeoDataPlacemark::TransportAirportGate; s_visualCategories[OsmTag("aeroway", "runway")] = GeoDataPlacemark::TransportAirportRunway; s_visualCategories[OsmTag("aeroway", "apron")] = GeoDataPlacemark::TransportAirportApron; s_visualCategories[OsmTag("aeroway", "taxiway")] = GeoDataPlacemark::TransportAirportTaxiway; s_visualCategories[OsmTag("aeroway", "terminal")] = GeoDataPlacemark::TransportAirportTerminal; s_visualCategories[OsmTag("public_transport", "platform")] = GeoDataPlacemark::TransportPlatform; s_visualCategories[OsmTag("amenity", "bicycle_rental")] = GeoDataPlacemark::TransportRentalBicycle; s_visualCategories[OsmTag("amenity", "car_rental")] = GeoDataPlacemark::TransportRentalCar; s_visualCategories[OsmTag("amenity", "taxi")] = GeoDataPlacemark::TransportTaxiRank; s_visualCategories[OsmTag("railway", "tram_stop")] = GeoDataPlacemark::TransportTramStop; s_visualCategories[OsmTag("highway", "bus_stop")] = GeoDataPlacemark::TransportBusStop; s_visualCategories[OsmTag("highway", "speed_camera")] = GeoDataPlacemark::TransportSpeedCamera; s_visualCategories[OsmTag("amenity", "bicycle_parking")] = GeoDataPlacemark::TransportBicycleParking; s_visualCategories[OsmTag("amenity", "motorcycle_parking")] = GeoDataPlacemark::TransportMotorcycleParking; s_visualCategories[OsmTag("railway", "subway_entrance")] = GeoDataPlacemark::TransportSubwayEntrance; s_visualCategories[OsmTag("place", "city")] = GeoDataPlacemark::PlaceCity; s_visualCategories[OsmTag("place", "suburb")] = GeoDataPlacemark::PlaceSuburb; s_visualCategories[OsmTag("place", "hamlet")] = GeoDataPlacemark::PlaceHamlet; s_visualCategories[OsmTag("place", "locality")] = GeoDataPlacemark::PlaceLocality; s_visualCategories[OsmTag("place", "town")] = GeoDataPlacemark::PlaceTown; s_visualCategories[OsmTag("place", "village")] = GeoDataPlacemark::PlaceVillage; //Custom Marble OSM Tags s_visualCategories[OsmTag("marble_land", "landmass")] = GeoDataPlacemark::Landmass; s_visualCategories[OsmTag("settlement", "yes")] = GeoDataPlacemark::UrbanArea; s_visualCategories[OsmTag("marble_line", "date")] = GeoDataPlacemark::InternationalDateLine; s_visualCategories[OsmTag("marble:feature", "bathymetry")] = GeoDataPlacemark::Bathymetry; // Default for buildings foreach (const auto &tag, buildingTags()) { s_visualCategories[tag] = GeoDataPlacemark::Building; } } void StyleBuilder::Private::initializeMinimumZoomLevels() { if (s_defaultMinZoomLevelsInitialized) { return; } s_defaultMinZoomLevelsInitialized = true; for ( int i = 0; i < GeoDataPlacemark::LastIndex; i++ ) { s_defaultMinZoomLevels[i] = -1; } s_defaultMinZoomLevels[GeoDataPlacemark::AdminLevel10]= 8; s_defaultMinZoomLevels[GeoDataPlacemark::AdminLevel11]= 8; s_defaultMinZoomLevels[GeoDataPlacemark::AdminLevel1] = 0; s_defaultMinZoomLevels[GeoDataPlacemark::AdminLevel2] = 1; s_defaultMinZoomLevels[GeoDataPlacemark::AdminLevel3] = 1; s_defaultMinZoomLevels[GeoDataPlacemark::AdminLevel4] = 2; s_defaultMinZoomLevels[GeoDataPlacemark::AdminLevel5] = 4; s_defaultMinZoomLevels[GeoDataPlacemark::AdminLevel6] = 5; s_defaultMinZoomLevels[GeoDataPlacemark::AdminLevel7] = 5; s_defaultMinZoomLevels[GeoDataPlacemark::AdminLevel8] = 7; s_defaultMinZoomLevels[GeoDataPlacemark::AdminLevel9] = 7; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityArchaeologicalSite]= 16; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityBench]= 19; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityFountain] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityGraveyard] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityTelephone] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityKindergarten] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityLibrary] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityWasteBasket] = 19; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityToilets]= 17; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityTownHall]= 15; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityWaterPark] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityDrinkingWater]= 17; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityEmbassy]= 15; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityEmergencyPhone]= 17; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityCommunityCentre]= 17; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityFountain]= 17; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityNightClub]= 16; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityCourtHouse]= 16; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityFireStation]= 16; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityHuntingStand]= 17; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityPolice]= 16; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityPostBox]= 17; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityPostOffice]= 17; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityPrison]= 17; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityRecycling]= 17; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityShelter]= 17; s_defaultMinZoomLevels[GeoDataPlacemark::AmenityChargingStation] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::BarrierCityWall] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::BarrierGate] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::BarrierLiftGate] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::BarrierWall] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::Bathymetry] = 1; s_defaultMinZoomLevels[GeoDataPlacemark::BoundaryMaritime] = 1; s_defaultMinZoomLevels[GeoDataPlacemark::Building] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::Default] = 1; s_defaultMinZoomLevels[GeoDataPlacemark::EducationCollege] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::EducationSchool] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::EducationUniversity] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::FoodBar] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::FoodBiergarten] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::FoodCafe] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::FoodFastFood] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::FoodPub] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::FoodRestaurant] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::HealthHospital] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::HealthPharmacy] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::HealthDentist] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::HealthDoctors] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::HealthVeterinary] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::HistoricMemorial] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayCycleway] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayFootway] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayLivingStreet] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayMotorwayLink] = 10; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayMotorway] = 6; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayPath] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayPedestrian] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayPrimaryLink] = 10; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayPrimary] = 8; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayRaceway] = 12; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayResidential] = 14; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayRoad] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::HighwaySecondaryLink]= 10; s_defaultMinZoomLevels[GeoDataPlacemark::HighwaySecondary] = 9; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayService] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::HighwaySteps]= 15; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayTertiaryLink] = 10; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayTertiary] = 10; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayTrack]= 15; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayTrunkLink] = 10; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayTrunk]= 7; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayUnknown] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayUnclassified] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::HighwayTrafficSignals] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::AccomodationCamping] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::AccomodationHostel] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::AccomodationHotel] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::AccomodationMotel] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::AccomodationYouthHostel] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::AccomodationGuestHouse] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::InternationalDateLine] = 1; s_defaultMinZoomLevels[GeoDataPlacemark::Landmass] = 0; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseAllotments] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseBasin]= 11; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseCemetery] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseCommercial] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseConstruction] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseFarmland] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseFarmyard] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseGarages] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseGrass]= 13; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseIndustrial] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseLandfill] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseMeadow] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseMilitary] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseOrchard] = 14; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseQuarry] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseRailway] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseReservoir] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseResidential] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseRetail] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::LanduseVineyard] = 14; s_defaultMinZoomLevels[GeoDataPlacemark::LeisureGolfCourse] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::LeisureMarina] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::LeisurePark] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::LeisurePlayground] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::LeisurePitch] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::LeisureStadium] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::LeisureSwimmingPool] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::LeisureSportsCentre] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::LeisureTrack] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::LeisureMinigolfCourse] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::ManmadeBridge] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::ManmadeLighthouse] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::ManmadePier] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::ManmadeWaterTower] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::ManmadeWindMill] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::MilitaryDangerArea] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::MoneyAtm] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::MoneyBank] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::NaturalBeach]= 13; s_defaultMinZoomLevels[GeoDataPlacemark::NaturalCliff]= 15; s_defaultMinZoomLevels[GeoDataPlacemark::NaturalGlacier] = 3; s_defaultMinZoomLevels[GeoDataPlacemark::NaturalHeath] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::NaturalIceShelf] = 3; s_defaultMinZoomLevels[GeoDataPlacemark::NaturalPeak] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::NaturalReef] = 3; s_defaultMinZoomLevels[GeoDataPlacemark::NaturalScrub]= 13; s_defaultMinZoomLevels[GeoDataPlacemark::NaturalTree] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::NaturalCave] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::NaturalWater]= 3; s_defaultMinZoomLevels[GeoDataPlacemark::NaturalWetland] = 10; s_defaultMinZoomLevels[GeoDataPlacemark::NaturalWood] = 8; + s_defaultMinZoomLevels[GeoDataPlacemark::PlaceCityNationalCapital] = 9; s_defaultMinZoomLevels[GeoDataPlacemark::PlaceCityCapital] = 9; s_defaultMinZoomLevels[GeoDataPlacemark::PlaceCity] = 9; s_defaultMinZoomLevels[GeoDataPlacemark::PlaceHamlet] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::PlaceLocality] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::PlaceSuburb] = 13; + s_defaultMinZoomLevels[GeoDataPlacemark::PlaceTownNationalCapital] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::PlaceTownCapital] = 11; s_defaultMinZoomLevels[GeoDataPlacemark::PlaceTown] = 11; + s_defaultMinZoomLevels[GeoDataPlacemark::PlaceVillageNationalCapital] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::PlaceVillageCapital] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::PlaceVillage]= 13; s_defaultMinZoomLevels[GeoDataPlacemark::PowerTower]= 18; s_defaultMinZoomLevels[GeoDataPlacemark::RailwayAbandoned] = 10; s_defaultMinZoomLevels[GeoDataPlacemark::RailwayConstruction] = 10; s_defaultMinZoomLevels[GeoDataPlacemark::RailwayFunicular] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::RailwayLightRail] = 12; s_defaultMinZoomLevels[GeoDataPlacemark::RailwayMiniature] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::RailwayMonorail] = 12; s_defaultMinZoomLevels[GeoDataPlacemark::RailwayNarrowGauge] = 6; s_defaultMinZoomLevels[GeoDataPlacemark::RailwayPreserved] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::RailwayRail] = 6; s_defaultMinZoomLevels[GeoDataPlacemark::RailwaySubway] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::RailwayTram] = 14; s_defaultMinZoomLevels[GeoDataPlacemark::Satellite] = 0; for (int shop=GeoDataPlacemark::ShopBeverages; shop<=GeoDataPlacemark::Shop; ++shop) { s_defaultMinZoomLevels[shop] = 17; } s_defaultMinZoomLevels[GeoDataPlacemark::ShopSupermarket] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::ShopDepartmentStore] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::ShopDoitYourself] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::TouristAlpineHut] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::TouristWildernessHut] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::TouristAttraction] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::TouristCastle] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::TouristCinema] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::TouristMuseum] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::TouristRuin] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::TouristTheatre] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::TouristThemePark] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::TouristViewPoint] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::TouristZoo] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::TouristMonument] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::TouristInformation] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::TransportAerodrome] = 9; s_defaultMinZoomLevels[GeoDataPlacemark::TransportAirportApron] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::TransportAirportRunway] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::TransportAirportTaxiway] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::TransportBusStation] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::TransportCarShare] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::TransportFuel] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::TransportHelipad] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::TransportAirportTerminal] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::TransportAirportGate] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::TransportPlatform] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::TransportSpeedCamera] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::TransportRentalCar] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::TransportRentalBicycle] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::TransportTaxiRank] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::TransportParking] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::TransportBusStop] = 16; s_defaultMinZoomLevels[GeoDataPlacemark::TransportTrainStation] = 13; s_defaultMinZoomLevels[GeoDataPlacemark::TransportTramStop] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::TransportParkingSpace] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::TransportBicycleParking] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::TransportMotorcycleParking] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::TransportSubwayEntrance] = 17; for (int religion=GeoDataPlacemark::ReligionPlaceOfWorship; religion<=GeoDataPlacemark::ReligionSikh; ++religion) { s_defaultMinZoomLevels[religion] = 17; } s_defaultMinZoomLevels[GeoDataPlacemark::UrbanArea] = 3; s_defaultMinZoomLevels[GeoDataPlacemark::WaterwayCanal] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::WaterwayDitch] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::WaterwayDrain] = 17; s_defaultMinZoomLevels[GeoDataPlacemark::WaterwayStream] = 15; s_defaultMinZoomLevels[GeoDataPlacemark::WaterwayRiver] = 3; for ( int i = GeoDataPlacemark::PlaceCity; i < GeoDataPlacemark::LastIndex; i++ ) { if (s_defaultMinZoomLevels[i] < 0) { qDebug() << "Missing default min zoom level for GeoDataPlacemark::GeoDataVisualCategory " << i; Q_ASSERT(false && "StyleBuilder::Private::initializeMinimumZoomLevels is incomplete"); s_defaultMinZoomLevels[i] = 15; } } } StyleBuilder::StyleBuilder() : d(new Private) { // nothing to do } StyleBuilder::~StyleBuilder() { delete d; } QFont StyleBuilder::defaultFont() const { return d->m_defaultFont; } void StyleBuilder::setDefaultFont( const QFont& font ) { d->m_defaultFont = font; reset(); } QColor StyleBuilder::defaultLabelColor() const { return d->m_defaultLabelColor; } void StyleBuilder::setDefaultLabelColor( const QColor& color ) { d->m_defaultLabelColor = color; reset(); } GeoDataStyle::ConstPtr StyleBuilder::createStyle(const StyleParameters ¶meters) const { const GeoDataPlacemark *const placemark = parameters.placemark; if (!placemark) { Q_ASSERT(false && "Must not pass a null placemark to StyleBuilder::createStyle"); return GeoDataStyle::Ptr(); } if (placemark->customStyle()) { return placemark->customStyle(); } if (d->m_specialStyleCacheTileLevel != parameters.tileLevel) { d->m_specialStyleCache.clear(); d->m_specialStyleCacheTileLevel = parameters.tileLevel; } QString specialStyleCacheKey; bool cacheSpecialStyle = false; OsmPlacemarkData const & osmData = placemark->osmData(); auto const visualCategory = placemark->visualCategory(); if (visualCategory == GeoDataPlacemark::Building) { auto const tagMap = osmTagMapping(); auto const & osmData = placemark->osmData(); auto const buildingTag = QStringLiteral("building"); for (auto iter = osmData.tagsBegin(), end = osmData.tagsEnd(); iter != end; ++iter) { auto const osmTag = StyleBuilder::OsmTag(iter.key(), iter.value()); if (iter.key() != buildingTag && tagMap.contains(osmTag)) { return d->m_buildingStyles.value(tagMap.value(osmTag), d->m_defaultStyle[visualCategory]); } } } GeoDataStyle::ConstPtr style = d->presetStyle(visualCategory); if (placemark->geometry()->nodeType() == GeoDataTypes::GeoDataPointType) { if (visualCategory == GeoDataPlacemark::NaturalTree) { GeoDataCoordinates const coordinates = placemark->coordinate(); qreal const lat = coordinates.latitude(GeoDataCoordinates::Degree); if (qAbs(lat) > 15) { /** @todo Should maybe auto-adjust to MarbleClock at some point */ int const month = QDate::currentDate().month(); bool const southernHemisphere = lat < 0; if (southernHemisphere) { if (month >= 3 && month <= 5) { style = d->m_styleTreeAutumn; } else if (month >= 6 && month <= 8) { style = d->m_styleTreeWinter; } } else { if (month >= 9 && month <= 11) { style = d->m_styleTreeAutumn; } else if (month == 12 || month == 1 || month == 2) { style = d->m_styleTreeWinter; } } } } } else if (placemark->geometry()->nodeType() == GeoDataTypes::GeoDataLinearRingType) { bool adjustStyle = false; GeoDataPolyStyle polyStyle = style->polyStyle(); GeoDataLineStyle lineStyle = style->lineStyle(); if (visualCategory == GeoDataPlacemark::NaturalWater) { if (osmData.containsTag(QStringLiteral("salt"), QStringLiteral("yes"))) { polyStyle.setColor("#ffff80"); lineStyle.setPenStyle(Qt::DashLine); lineStyle.setWidth(2); adjustStyle = true; } } else if (visualCategory == GeoDataPlacemark::Bathymetry) { auto tagIter = osmData.findTag(QStringLiteral("ele")); if (tagIter != osmData.tagsEnd()) { const QString& elevation = tagIter.value(); if (elevation == QLatin1String("4000")) { polyStyle.setColor("#94c2c2"); lineStyle.setColor("#94c2c2"); adjustStyle = true; } } } else if (visualCategory == GeoDataPlacemark::AmenityGraveyard || visualCategory == GeoDataPlacemark::LanduseCemetery) { auto tagIter = osmData.findTag(QStringLiteral("religion")); if (tagIter != osmData.tagsEnd()) { const QString& religion = tagIter.value(); if (religion == QLatin1String("jewish")) { polyStyle.setTexturePath(MarbleDirs::path("bitmaps/osmcarto/patterns/grave_yard_jewish.png")); adjustStyle = true; } else if (religion == QLatin1String("christian")) { polyStyle.setTexturePath(MarbleDirs::path("bitmaps/osmcarto/patterns/grave_yard_christian.png")); adjustStyle = true; } else if (religion == QLatin1String("INT-generic")) { polyStyle.setTexturePath(MarbleDirs::path("bitmaps/osmcarto/patterns/grave_yard_generic.png")); adjustStyle = true; } } } if (adjustStyle) { GeoDataStyle::Ptr newStyle(new GeoDataStyle(*style)); newStyle->setPolyStyle(polyStyle); newStyle->setLineStyle(lineStyle); style = newStyle; } if (style->iconStyle().iconPath().isEmpty()) { const GeoDataPlacemark::GeoDataVisualCategory category = determineVisualCategory(osmData); const GeoDataStyle::ConstPtr categoryStyle = d->presetStyle(category); if (category != GeoDataPlacemark::None && !categoryStyle->iconStyle().scaledIcon().isNull()) { GeoDataStyle::Ptr newStyle(new GeoDataStyle(*style)); newStyle->setIconStyle(categoryStyle->iconStyle()); style = newStyle; } } } else if (placemark->geometry()->nodeType() == GeoDataTypes::GeoDataLineStringType) { GeoDataPolyStyle polyStyle = style->polyStyle(); GeoDataLineStyle lineStyle = style->lineStyle(); GeoDataLabelStyle labelStyle = style->labelStyle(); lineStyle.setCosmeticOutline(true); bool adjustStyle = false; if(visualCategory == GeoDataPlacemark::AdminLevel2){ if (osmData.containsTag(QStringLiteral("maritime"), QStringLiteral("yes"))) { lineStyle.setColor("#88b3bf"); polyStyle.setColor("#88b3bf"); if (osmData.containsTag(QStringLiteral("marble:disputed"), QStringLiteral("yes"))) { lineStyle.setPenStyle( Qt::DashLine ); } adjustStyle = true; } } else if ((visualCategory >= GeoDataPlacemark::HighwayService && visualCategory <= GeoDataPlacemark::HighwayMotorway) || visualCategory == GeoDataPlacemark::TransportAirportRunway) { // Take cached Style instance if possible if (d->m_specialStyleCacheTileLevel == parameters.tileLevel) { specialStyleCacheKey = visualCategory; if (d->m_specialStyleCache.contains(specialStyleCacheKey)) { style = d->m_specialStyleCache[specialStyleCacheKey]; return style; } } adjustStyle = true; if (parameters.tileLevel <= 8) { /** @todo: Dummy implementation for dynamic style changes based on tile level, replace with sane values */ lineStyle.setPhysicalWidth(0.0); lineStyle.setWidth(2.0); cacheSpecialStyle = true; } else if (parameters.tileLevel <= 10) { /** @todo: Dummy implementation for dynamic style changes based on tile level, replace with sane values */ lineStyle.setPhysicalWidth(0.0); lineStyle.setWidth(3.0); cacheSpecialStyle = true; } else if (parameters.tileLevel <= 12) { /** @todo: Dummy implementation for dynamic style changes based on tile level, replace with sane values */ lineStyle.setPhysicalWidth(0.0); lineStyle.setWidth(4.0); cacheSpecialStyle = true; } else { auto tagIter = osmData.findTag(QStringLiteral("width")); if (tagIter != osmData.tagsEnd()) { QString const widthValue = QString(tagIter.value()).remove(QStringLiteral(" meters")).remove(QStringLiteral(" m")); bool ok; float const width = widthValue.toFloat(&ok); lineStyle.setPhysicalWidth(ok ? qBound(0.1f, width, 200.0f) : 0.0f); } else { bool const isOneWay = osmData.containsTag(QStringLiteral("oneway"), QStringLiteral("yes")) || osmData.containsTag(QStringLiteral("oneway"), QStringLiteral("-1")); int const lanes = isOneWay ? 1 : 2; // also for motorway which implicitly is one way, but has two lanes and each direction has its own highway double const laneWidth = 3.0; double const margins = visualCategory == GeoDataPlacemark::HighwayMotorway ? 2.0 : (isOneWay ? 1.0 : 0.0); double const physicalWidth = margins + lanes * laneWidth; lineStyle.setPhysicalWidth(physicalWidth); } } 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)); cacheSpecialStyle = false; } 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)); cacheSpecialStyle = false; } } else if (visualCategory >= GeoDataPlacemark::WaterwayCanal && visualCategory <= GeoDataPlacemark::WaterwayStream) { adjustStyle = true; // Take cached Style instance if possible specialStyleCacheKey = visualCategory; if (d->m_specialStyleCache.contains(specialStyleCacheKey)) { style = d->m_specialStyleCache[specialStyleCacheKey]; return style; } if (parameters.tileLevel <= 3) { lineStyle.setWidth(1); lineStyle.setPhysicalWidth(0.0); cacheSpecialStyle = true; } else if (parameters.tileLevel <= 7) { lineStyle.setWidth(2); lineStyle.setPhysicalWidth(0.0); cacheSpecialStyle = true; } else { QString const widthValue = osmData.tagValue(QStringLiteral("width")).remove(QStringLiteral(" meters")).remove(QStringLiteral(" m")); bool ok; float const width = widthValue.toFloat(&ok); lineStyle.setPhysicalWidth(ok ? qBound(0.1f, width, 200.0f) : 0.0f); } } if (adjustStyle) { GeoDataStyle::Ptr newStyle(new GeoDataStyle(*style)); newStyle->setPolyStyle(polyStyle); newStyle->setLineStyle(lineStyle); newStyle->setLabelStyle(labelStyle); style = newStyle; if (cacheSpecialStyle) { d->m_specialStyleCache.insert(specialStyleCacheKey, newStyle); } } } else if (placemark->geometry()->nodeType() == GeoDataTypes::GeoDataPolygonType) { GeoDataPolyStyle polyStyle = style->polyStyle(); GeoDataLineStyle lineStyle = style->lineStyle(); bool adjustStyle = false; if (visualCategory == GeoDataPlacemark::Bathymetry) { auto tagIter = osmData.findTag(QStringLiteral("ele")); if (tagIter != osmData.tagsEnd()) { const QString& elevation = tagIter.value(); if (elevation == QLatin1String("4000")) { polyStyle.setColor("#a5c9c9"); lineStyle.setColor("#a5c9c9"); adjustStyle = true; } } } if (adjustStyle) { GeoDataStyle::Ptr newStyle(new GeoDataStyle(*style)); newStyle->setPolyStyle(polyStyle); newStyle->setLineStyle(lineStyle); style = newStyle; } } return style; } GeoDataStyle::ConstPtr StyleBuilder::Private::presetStyle(GeoDataPlacemark::GeoDataVisualCategory visualCategory) const { if (!m_defaultStyleInitialized) { const_cast(this)->initializeDefaultStyles(); // const cast due to lazy initialization } if (visualCategory != GeoDataPlacemark::None && m_defaultStyle[visualCategory] ) { return m_defaultStyle[visualCategory]; } else { return m_defaultStyle[GeoDataPlacemark::Default]; } } QStringList StyleBuilder::renderOrder() const { static QStringList paintLayerOrder; if (paintLayerOrder.isEmpty()) { paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::Landmass); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::UrbanArea); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseResidential); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseAllotments); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseBasin); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseCemetery); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseCommercial); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseConstruction); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseFarmland); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseFarmyard); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseGarages); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseIndustrial); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseLandfill); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseMeadow); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseMilitary); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseQuarry); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseRailway); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseReservoir); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseRetail); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseOrchard); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseVineyard); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::Bathymetry); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LeisureGolfCourse); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LeisureMinigolfCourse); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::NaturalBeach); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::NaturalWetland); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::NaturalGlacier); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::NaturalIceShelf); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::NaturalCliff); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::NaturalPeak); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::MilitaryDangerArea); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LeisurePark); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LeisurePitch); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LeisureSportsCentre); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LeisureStadium); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::NaturalWood); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LanduseGrass); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::HighwayPedestrian); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LeisurePlayground); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::NaturalScrub); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LeisureTrack); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::TransportParking); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::TransportParkingSpace); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::ManmadeBridge); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::BarrierCityWall); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::AmenityGraveyard); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::AmenityKindergarten); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::EducationCollege); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::EducationSchool); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::EducationUniversity); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::HealthHospital); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LeisureSwimmingPool); paintLayerOrder << Private::createPaintLayerItem("LineString", GeoDataPlacemark::Landmass); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::NaturalWater); for (int i = GeoDataPlacemark::WaterwayCanal; i <= GeoDataPlacemark::WaterwayStream; ++i) { paintLayerOrder << Private::createPaintLayerItem("LineString", (GeoDataPlacemark::GeoDataVisualCategory)i, "outline"); paintLayerOrder << Private::createPaintLayerItem("LineString", (GeoDataPlacemark::GeoDataVisualCategory)i, "inline"); paintLayerOrder << Private::createPaintLayerItem("LineString", (GeoDataPlacemark::GeoDataVisualCategory)i, "label"); } paintLayerOrder << Private::createPaintLayerItem("LineString", GeoDataPlacemark::NaturalReef, "outline"); paintLayerOrder << Private::createPaintLayerItem("LineString", GeoDataPlacemark::NaturalReef, "inline"); paintLayerOrder << Private::createPaintLayerItem("LineString", GeoDataPlacemark::NaturalReef, "label"); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::LeisureMarina); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::ManmadePier); paintLayerOrder << Private::createPaintLayerItem("LineString", GeoDataPlacemark::ManmadePier, "outline"); paintLayerOrder << Private::createPaintLayerItem("LineString", GeoDataPlacemark::ManmadePier, "inline"); paintLayerOrder << Private::createPaintLayerItem("LineString", GeoDataPlacemark::ManmadePier, "label"); paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::TransportAirportApron); for ( int i = GeoDataPlacemark::HighwaySteps; i <= GeoDataPlacemark::HighwayMotorway; i++ ) { paintLayerOrder << Private::createPaintLayerItem("LineString", (GeoDataPlacemark::GeoDataVisualCategory)i, "outline"); } for ( int i = GeoDataPlacemark::HighwaySteps; i <= GeoDataPlacemark::HighwayMotorway; i++ ) { paintLayerOrder << Private::createPaintLayerItem("LineString", (GeoDataPlacemark::GeoDataVisualCategory)i, "inline"); } for ( int i = GeoDataPlacemark::RailwayRail; i <= GeoDataPlacemark::RailwayFunicular; i++ ) { paintLayerOrder << Private::createPaintLayerItem("LineString", (GeoDataPlacemark::GeoDataVisualCategory)i, "outline"); } for ( int i = GeoDataPlacemark::RailwayRail; i <= GeoDataPlacemark::RailwayFunicular; i++ ) { paintLayerOrder << Private::createPaintLayerItem("LineString", (GeoDataPlacemark::GeoDataVisualCategory)i, "inline"); } // Highway labels shall appear on top of railways, hence here and not already above for ( int i = GeoDataPlacemark::HighwaySteps; i <= GeoDataPlacemark::HighwayMotorway; i++ ) { paintLayerOrder << Private::createPaintLayerItem("LineString", (GeoDataPlacemark::GeoDataVisualCategory)i, "label"); } for ( int i = GeoDataPlacemark::RailwayRail; i <= GeoDataPlacemark::RailwayFunicular; i++ ) { paintLayerOrder << Private::createPaintLayerItem("LineString", (GeoDataPlacemark::GeoDataVisualCategory)i, "label"); } paintLayerOrder << Private::createPaintLayerItem("Polygon", GeoDataPlacemark::TransportPlatform); paintLayerOrder << Private::createPaintLayerItem("LineString", GeoDataPlacemark::TransportPlatform, "outline"); paintLayerOrder << Private::createPaintLayerItem("LineString", GeoDataPlacemark::TransportPlatform, "inline"); paintLayerOrder << Private::createPaintLayerItem("LineString", GeoDataPlacemark::TransportPlatform, "label"); for ( int i = GeoDataPlacemark::AdminLevel1; i <= GeoDataPlacemark::AdminLevel11; i++ ) { paintLayerOrder << Private::createPaintLayerItem("LineString", (GeoDataPlacemark::GeoDataVisualCategory)i, "outline"); } for ( int i = GeoDataPlacemark::AdminLevel1; i <= GeoDataPlacemark::AdminLevel11; i++ ) { paintLayerOrder << Private::createPaintLayerItem("LineString", (GeoDataPlacemark::GeoDataVisualCategory)i, "inline"); } for ( int i = GeoDataPlacemark::AdminLevel1; i <= GeoDataPlacemark::AdminLevel11; i++ ) { paintLayerOrder << Private::createPaintLayerItem("LineString", (GeoDataPlacemark::GeoDataVisualCategory)i, "label"); } paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::Bathymetry); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::AmenityGraveyard); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::NaturalWood); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::NaturalBeach); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::NaturalWetland); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::NaturalGlacier); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::NaturalIceShelf); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::NaturalScrub); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::LeisureMarina); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::LeisurePark); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::LeisurePlayground); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::LeisurePitch); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::LeisureSportsCentre); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::LeisureStadium); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::LeisureTrack); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::TransportParking); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::ManmadeBridge); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::BarrierCityWall); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::NaturalWater); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::NaturalReef); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::Landmass); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::NaturalCliff); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::NaturalPeak); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::AmenityKindergarten); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::EducationCollege); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::EducationSchool); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::EducationUniversity); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::HealthHospital); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::TransportSpeedCamera); paintLayerOrder << Private::createPaintLayerItem("Point", GeoDataPlacemark::MilitaryDangerArea); paintLayerOrder << QStringLiteral("Polygon/Building/frame"); paintLayerOrder << QStringLiteral("Polygon/Building/roof"); paintLayerOrder << QStringLiteral("Photo"); Q_ASSERT(QSet::fromList(paintLayerOrder).size() == paintLayerOrder.size()); } return paintLayerOrder; } void StyleBuilder::reset() { d->m_defaultStyleInitialized = false; } int StyleBuilder::minimumZoomLevel(const GeoDataPlacemark &placemark) const { Q_ASSERT(Private::s_defaultMinZoomLevelsInitialized); return Private::s_defaultMinZoomLevels[placemark.visualCategory()]; } int StyleBuilder::minimumZoomLevel(const GeoDataPlacemark::GeoDataVisualCategory &visualCategory) { Private::initializeMinimumZoomLevels(); return Private::s_defaultMinZoomLevels[visualCategory]; } qint64 StyleBuilder::popularity(const GeoDataPlacemark *placemark) { qint64 const defaultValue = 100; int const offset = 10; if (StyleBuilder::Private::s_popularities.isEmpty()) { QVector popularities; + popularities << GeoDataPlacemark::PlaceCityNationalCapital; + popularities << GeoDataPlacemark::PlaceTownNationalCapital; popularities << GeoDataPlacemark::PlaceCityCapital; popularities << GeoDataPlacemark::PlaceTownCapital; popularities << GeoDataPlacemark::PlaceCity; popularities << GeoDataPlacemark::PlaceTown; popularities << GeoDataPlacemark::PlaceSuburb; + popularities << GeoDataPlacemark::PlaceVillageNationalCapital; popularities << GeoDataPlacemark::PlaceVillageCapital; popularities << GeoDataPlacemark::PlaceVillage; popularities << GeoDataPlacemark::PlaceHamlet; popularities << GeoDataPlacemark::PlaceLocality; popularities << GeoDataPlacemark::AmenityEmergencyPhone; popularities << GeoDataPlacemark::HealthHospital; popularities << GeoDataPlacemark::AmenityToilets; popularities << GeoDataPlacemark::MoneyAtm; popularities << GeoDataPlacemark::TransportSpeedCamera; popularities << GeoDataPlacemark::NaturalPeak; popularities << GeoDataPlacemark::AccomodationHotel; popularities << GeoDataPlacemark::AccomodationMotel; popularities << GeoDataPlacemark::AccomodationGuestHouse; popularities << GeoDataPlacemark::AccomodationYouthHostel; popularities << GeoDataPlacemark::AccomodationHostel; popularities << GeoDataPlacemark::AccomodationCamping; popularities << GeoDataPlacemark::HealthDentist; popularities << GeoDataPlacemark::HealthDoctors; popularities << GeoDataPlacemark::HealthPharmacy; popularities << GeoDataPlacemark::HealthVeterinary; popularities << GeoDataPlacemark::AmenityLibrary; popularities << GeoDataPlacemark::EducationCollege; popularities << GeoDataPlacemark::EducationSchool; popularities << GeoDataPlacemark::EducationUniversity; popularities << GeoDataPlacemark::FoodBar; popularities << GeoDataPlacemark::FoodBiergarten; popularities << GeoDataPlacemark::FoodCafe; popularities << GeoDataPlacemark::FoodFastFood; popularities << GeoDataPlacemark::FoodPub; popularities << GeoDataPlacemark::FoodRestaurant; popularities << GeoDataPlacemark::MoneyBank; popularities << GeoDataPlacemark::AmenityArchaeologicalSite; popularities << GeoDataPlacemark::AmenityEmbassy; popularities << GeoDataPlacemark::AmenityWaterPark; popularities << GeoDataPlacemark::AmenityCommunityCentre; popularities << GeoDataPlacemark::AmenityFountain; popularities << GeoDataPlacemark::AmenityNightClub; popularities << GeoDataPlacemark::AmenityCourtHouse; popularities << GeoDataPlacemark::AmenityFireStation; popularities << GeoDataPlacemark::AmenityShelter; popularities << GeoDataPlacemark::AmenityHuntingStand; popularities << GeoDataPlacemark::AmenityPolice; popularities << GeoDataPlacemark::AmenityPostBox; popularities << GeoDataPlacemark::AmenityPostOffice; popularities << GeoDataPlacemark::AmenityPrison; popularities << GeoDataPlacemark::AmenityRecycling; popularities << GeoDataPlacemark::AmenityTelephone; popularities << GeoDataPlacemark::AmenityTownHall; popularities << GeoDataPlacemark::AmenityDrinkingWater; popularities << GeoDataPlacemark::AmenityGraveyard; popularities << GeoDataPlacemark::ManmadeBridge; popularities << GeoDataPlacemark::ManmadeLighthouse; popularities << GeoDataPlacemark::ManmadePier; popularities << GeoDataPlacemark::ManmadeWaterTower; popularities << GeoDataPlacemark::ManmadeWindMill; popularities << GeoDataPlacemark::TouristAttraction; popularities << GeoDataPlacemark::TouristCastle; popularities << GeoDataPlacemark::TouristCinema; popularities << GeoDataPlacemark::TouristInformation; popularities << GeoDataPlacemark::TouristMonument; popularities << GeoDataPlacemark::TouristMuseum; popularities << GeoDataPlacemark::TouristRuin; popularities << GeoDataPlacemark::TouristTheatre; popularities << GeoDataPlacemark::TouristThemePark; popularities << GeoDataPlacemark::TouristViewPoint; popularities << GeoDataPlacemark::TouristZoo; popularities << GeoDataPlacemark::TouristAlpineHut; popularities << GeoDataPlacemark::TouristWildernessHut; popularities << GeoDataPlacemark::HistoricMemorial; popularities << GeoDataPlacemark::TransportAerodrome; popularities << GeoDataPlacemark::TransportHelipad; popularities << GeoDataPlacemark::TransportAirportTerminal; popularities << GeoDataPlacemark::TransportBusStation; popularities << GeoDataPlacemark::TransportBusStop; popularities << GeoDataPlacemark::TransportCarShare; popularities << GeoDataPlacemark::TransportFuel; popularities << GeoDataPlacemark::TransportParking; popularities << GeoDataPlacemark::TransportParkingSpace; popularities << GeoDataPlacemark::TransportPlatform; popularities << GeoDataPlacemark::TransportRentalBicycle; popularities << GeoDataPlacemark::TransportRentalCar; popularities << GeoDataPlacemark::TransportTaxiRank; popularities << GeoDataPlacemark::TransportTrainStation; popularities << GeoDataPlacemark::TransportTramStop; popularities << GeoDataPlacemark::TransportBicycleParking; popularities << GeoDataPlacemark::TransportMotorcycleParking; popularities << GeoDataPlacemark::TransportSubwayEntrance; popularities << GeoDataPlacemark::ShopBeverages; popularities << GeoDataPlacemark::ShopHifi; popularities << GeoDataPlacemark::ShopSupermarket; popularities << GeoDataPlacemark::ShopAlcohol; popularities << GeoDataPlacemark::ShopBakery; popularities << GeoDataPlacemark::ShopButcher; popularities << GeoDataPlacemark::ShopConfectionery; popularities << GeoDataPlacemark::ShopConvenience; popularities << GeoDataPlacemark::ShopGreengrocer; popularities << GeoDataPlacemark::ShopSeafood; popularities << GeoDataPlacemark::ShopDepartmentStore; popularities << GeoDataPlacemark::ShopKiosk; popularities << GeoDataPlacemark::ShopBag; popularities << GeoDataPlacemark::ShopClothes; popularities << GeoDataPlacemark::ShopFashion; popularities << GeoDataPlacemark::ShopJewelry; popularities << GeoDataPlacemark::ShopShoes; popularities << GeoDataPlacemark::ShopVarietyStore; popularities << GeoDataPlacemark::ShopBeauty; popularities << GeoDataPlacemark::ShopChemist; popularities << GeoDataPlacemark::ShopCosmetics; popularities << GeoDataPlacemark::ShopHairdresser; popularities << GeoDataPlacemark::ShopOptician; popularities << GeoDataPlacemark::ShopPerfumery; popularities << GeoDataPlacemark::ShopDoitYourself; popularities << GeoDataPlacemark::ShopFlorist; popularities << GeoDataPlacemark::ShopHardware; popularities << GeoDataPlacemark::ShopFurniture; popularities << GeoDataPlacemark::ShopElectronics; popularities << GeoDataPlacemark::ShopMobilePhone; popularities << GeoDataPlacemark::ShopBicycle; popularities << GeoDataPlacemark::ShopCar; popularities << GeoDataPlacemark::ShopCarRepair; popularities << GeoDataPlacemark::ShopCarParts; popularities << GeoDataPlacemark::ShopMotorcycle; popularities << GeoDataPlacemark::ShopOutdoor; popularities << GeoDataPlacemark::ShopSports; popularities << GeoDataPlacemark::ShopCopy; popularities << GeoDataPlacemark::ShopArt; popularities << GeoDataPlacemark::ShopMusicalInstrument; popularities << GeoDataPlacemark::ShopPhoto; popularities << GeoDataPlacemark::ShopBook; popularities << GeoDataPlacemark::ShopGift; popularities << GeoDataPlacemark::ShopStationery; popularities << GeoDataPlacemark::ShopLaundry; popularities << GeoDataPlacemark::ShopPet; popularities << GeoDataPlacemark::ShopToys; popularities << GeoDataPlacemark::ShopTravelAgency; popularities << GeoDataPlacemark::ShopDeli; popularities << GeoDataPlacemark::ShopTobacco; popularities << GeoDataPlacemark::ShopTea; popularities << GeoDataPlacemark::Shop; popularities << GeoDataPlacemark::LeisureGolfCourse; popularities << GeoDataPlacemark::LeisureMinigolfCourse; popularities << GeoDataPlacemark::LeisurePark; popularities << GeoDataPlacemark::LeisurePlayground; popularities << GeoDataPlacemark::LeisurePitch; popularities << GeoDataPlacemark::LeisureSportsCentre; popularities << GeoDataPlacemark::LeisureStadium; popularities << GeoDataPlacemark::LeisureTrack; popularities << GeoDataPlacemark::LeisureSwimmingPool; popularities << GeoDataPlacemark::HighwayTrafficSignals; popularities << GeoDataPlacemark::BarrierGate; popularities << GeoDataPlacemark::BarrierLiftGate; popularities << GeoDataPlacemark::AmenityBench; popularities << GeoDataPlacemark::NaturalTree; popularities << GeoDataPlacemark::NaturalCave; popularities << GeoDataPlacemark::AmenityWasteBasket; popularities << GeoDataPlacemark::PowerTower; int value = defaultValue + offset * popularities.size(); for (auto popularity: popularities) { StyleBuilder::Private::s_popularities[popularity] = value; value -= offset; } } bool const isPrivate = placemark->osmData().containsTag(QStringLiteral("access"), QStringLiteral("private")); int const base = defaultValue + (isPrivate ? 0 : offset * StyleBuilder::Private::s_popularities.size()); return base + StyleBuilder::Private::s_popularities.value(placemark->visualCategory(), defaultValue); } int StyleBuilder::maximumZoomLevel() const { return d->m_maximumZoomLevel; } QString StyleBuilder::visualCategoryName(GeoDataPlacemark::GeoDataVisualCategory category) { static QHash visualCategoryNames; if (visualCategoryNames.isEmpty()) { visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::None] = "None"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::Default] = "Default"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::Unknown] = "Unknown"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::SmallCity] = "SmallCity"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::SmallCountyCapital] = "SmallCountyCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::SmallStateCapital] = "SmallStateCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::SmallNationCapital] = "SmallNationCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::MediumCity] = "MediumCity"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::MediumCountyCapital] = "MediumCountyCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::MediumStateCapital] = "MediumStateCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::MediumNationCapital] = "MediumNationCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::BigCity] = "BigCity"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::BigCountyCapital] = "BigCountyCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::BigStateCapital] = "BigStateCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::BigNationCapital] = "BigNationCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::LargeCity] = "LargeCity"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::LargeCountyCapital] = "LargeCountyCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::LargeStateCapital] = "LargeStateCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::LargeNationCapital] = "LargeNationCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::Nation] = "Nation"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::PlaceCity] = "PlaceCity"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::PlaceCityCapital] = "PlaceCityCapital"; + visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::PlaceCityNationalCapital] = "PlaceCityNationalCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::PlaceSuburb] = "PlaceSuburb"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::PlaceHamlet] = "PlaceHamlet"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::PlaceLocality] = "PlaceLocality"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::PlaceTown] = "PlaceTown"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::PlaceTownCapital] = "PlaceTownCapital"; + visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::PlaceTownNationalCapital] = "PlaceTownNationalCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::PlaceVillage] = "PlaceVillage"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::PlaceVillageCapital] = "PlaceVillageCapital"; + visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::PlaceVillageNationalCapital] = "PlaceVillageNationalCapital"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::Mountain] = "Mountain"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::Volcano] = "Volcano"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::Mons] = "Mons"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::Valley] = "Valley"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::Continent] = "Continent"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::Ocean] = "Ocean"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::OtherTerrain] = "OtherTerrain"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::Crater] = "Crater"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::Mare] = "Mare"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::GeographicPole] = "GeographicPole"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::MagneticPole] = "MagneticPole"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::ShipWreck] = "ShipWreck"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::AirPort] = "AirPort"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::Observatory] = "Observatory"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::MilitaryDangerArea] = "MilitaryDangerArea"; visualCategoryNames[GeoDataPlacemark::GeoDataPlacemark::OsmSite] = "OsmSite"; visualCategoryNames[GeoDataPlacemark::Coordinate] = "Coordinate"; visualCategoryNames[GeoDataPlacemark::MannedLandingSite] = "MannedLandingSite"; visualCategoryNames[GeoDataPlacemark::RoboticRover] = "RoboticRover"; visualCategoryNames[GeoDataPlacemark::UnmannedSoftLandingSite] = "UnmannedSoftLandingSite"; visualCategoryNames[GeoDataPlacemark::UnmannedHardLandingSite] = "UnmannedHardLandingSite"; visualCategoryNames[GeoDataPlacemark::Bookmark] = "Bookmark"; visualCategoryNames[GeoDataPlacemark::NaturalWater] = "NaturalWater"; visualCategoryNames[GeoDataPlacemark::NaturalReef] = "NaturalReef"; visualCategoryNames[GeoDataPlacemark::NaturalWood] = "NaturalWood"; visualCategoryNames[GeoDataPlacemark::NaturalBeach] = "NaturalBeach"; visualCategoryNames[GeoDataPlacemark::NaturalWetland] = "NaturalWetland"; visualCategoryNames[GeoDataPlacemark::NaturalGlacier] = "NaturalGlacier"; visualCategoryNames[GeoDataPlacemark::NaturalIceShelf] = "NaturalIceShelf"; visualCategoryNames[GeoDataPlacemark::NaturalScrub] = "NaturalScrub"; visualCategoryNames[GeoDataPlacemark::NaturalCliff] = "NaturalCliff"; visualCategoryNames[GeoDataPlacemark::NaturalHeath] = "NaturalHeath"; visualCategoryNames[GeoDataPlacemark::HighwayTrafficSignals] = "HighwayTrafficSignals"; visualCategoryNames[GeoDataPlacemark::HighwaySteps] = "HighwaySteps"; visualCategoryNames[GeoDataPlacemark::HighwayUnknown] = "HighwayUnknown"; visualCategoryNames[GeoDataPlacemark::HighwayPath] = "HighwayPath"; visualCategoryNames[GeoDataPlacemark::HighwayFootway] = "HighwayFootway"; visualCategoryNames[GeoDataPlacemark::HighwayTrack] = "HighwayTrack"; visualCategoryNames[GeoDataPlacemark::HighwayPedestrian] = "HighwayPedestrian"; visualCategoryNames[GeoDataPlacemark::HighwayCycleway] = "HighwayCycleway"; visualCategoryNames[GeoDataPlacemark::HighwayService] = "HighwayService"; visualCategoryNames[GeoDataPlacemark::HighwayRoad] = "HighwayRoad"; visualCategoryNames[GeoDataPlacemark::HighwayResidential] = "HighwayResidential"; visualCategoryNames[GeoDataPlacemark::HighwayLivingStreet] = "HighwayLivingStreet"; visualCategoryNames[GeoDataPlacemark::HighwayUnclassified] = "HighwayUnclassified"; visualCategoryNames[GeoDataPlacemark::HighwayTertiaryLink] = "HighwayTertiaryLink"; visualCategoryNames[GeoDataPlacemark::HighwayTertiary] = "HighwayTertiary"; visualCategoryNames[GeoDataPlacemark::HighwaySecondaryLink] = "HighwaySecondaryLink"; visualCategoryNames[GeoDataPlacemark::HighwaySecondary] = "HighwaySecondary"; visualCategoryNames[GeoDataPlacemark::HighwayPrimaryLink] = "HighwayPrimaryLink"; visualCategoryNames[GeoDataPlacemark::HighwayPrimary] = "HighwayPrimary"; visualCategoryNames[GeoDataPlacemark::HighwayRaceway] = "HighwayRaceway"; visualCategoryNames[GeoDataPlacemark::HighwayTrunkLink] = "HighwayTrunkLink"; visualCategoryNames[GeoDataPlacemark::HighwayTrunk] = "HighwayTrunk"; visualCategoryNames[GeoDataPlacemark::HighwayMotorwayLink] = "HighwayMotorwayLink"; visualCategoryNames[GeoDataPlacemark::HighwayMotorway] = "HighwayMotorway"; visualCategoryNames[GeoDataPlacemark::Building] = "Building"; visualCategoryNames[GeoDataPlacemark::AccomodationCamping] = "AccomodationCamping"; visualCategoryNames[GeoDataPlacemark::AccomodationHostel] = "AccomodationHostel"; visualCategoryNames[GeoDataPlacemark::AccomodationHotel] = "AccomodationHotel"; visualCategoryNames[GeoDataPlacemark::AccomodationMotel] = "AccomodationMotel"; visualCategoryNames[GeoDataPlacemark::AccomodationYouthHostel] = "AccomodationYouthHostel"; visualCategoryNames[GeoDataPlacemark::AccomodationGuestHouse] = "AccomodationGuestHouse"; visualCategoryNames[GeoDataPlacemark::AmenityLibrary] = "AmenityLibrary"; visualCategoryNames[GeoDataPlacemark::AmenityKindergarten] = "AmenityKindergarten"; visualCategoryNames[GeoDataPlacemark::EducationCollege] = "EducationCollege"; visualCategoryNames[GeoDataPlacemark::EducationSchool] = "EducationSchool"; visualCategoryNames[GeoDataPlacemark::EducationUniversity] = "EducationUniversity"; visualCategoryNames[GeoDataPlacemark::FoodBar] = "FoodBar"; visualCategoryNames[GeoDataPlacemark::FoodBiergarten] = "FoodBiergarten"; visualCategoryNames[GeoDataPlacemark::FoodCafe] = "FoodCafe"; visualCategoryNames[GeoDataPlacemark::FoodFastFood] = "FoodFastFood"; visualCategoryNames[GeoDataPlacemark::FoodPub] = "FoodPub"; visualCategoryNames[GeoDataPlacemark::FoodRestaurant] = "FoodRestaurant"; visualCategoryNames[GeoDataPlacemark::HealthDentist] = "HealthDentist"; visualCategoryNames[GeoDataPlacemark::HealthDoctors] = "HealthDoctors"; visualCategoryNames[GeoDataPlacemark::HealthHospital] = "HealthHospital"; visualCategoryNames[GeoDataPlacemark::HealthPharmacy] = "HealthPharmacy"; visualCategoryNames[GeoDataPlacemark::HealthVeterinary] = "HealthVeterinary"; visualCategoryNames[GeoDataPlacemark::MoneyAtm] = "MoneyAtm"; visualCategoryNames[GeoDataPlacemark::MoneyBank] = "MoneyBank"; visualCategoryNames[GeoDataPlacemark::AmenityArchaeologicalSite] = "AmenityArchaeologicalSite"; visualCategoryNames[GeoDataPlacemark::AmenityEmbassy] = "AmenityEmbassy"; visualCategoryNames[GeoDataPlacemark::AmenityEmergencyPhone] = "AmenityEmergencyPhone"; visualCategoryNames[GeoDataPlacemark::AmenityWaterPark] = "AmenityWaterPark"; visualCategoryNames[GeoDataPlacemark::AmenityCommunityCentre] = "AmenityCommunityCentre"; visualCategoryNames[GeoDataPlacemark::AmenityFountain] = "AmenityFountain"; visualCategoryNames[GeoDataPlacemark::AmenityNightClub] = "AmenityNightClub"; visualCategoryNames[GeoDataPlacemark::AmenityBench] = "AmenityBench"; visualCategoryNames[GeoDataPlacemark::AmenityCourtHouse] = "AmenityCourtHouse"; visualCategoryNames[GeoDataPlacemark::AmenityFireStation] = "AmenityFireStation"; visualCategoryNames[GeoDataPlacemark::AmenityHuntingStand] = "AmenityHuntingStand"; visualCategoryNames[GeoDataPlacemark::AmenityPolice] = "AmenityPolice"; visualCategoryNames[GeoDataPlacemark::AmenityPostBox] = "AmenityPostBox"; visualCategoryNames[GeoDataPlacemark::AmenityPostOffice] = "AmenityPostOffice"; visualCategoryNames[GeoDataPlacemark::AmenityPrison] = "AmenityPrison"; visualCategoryNames[GeoDataPlacemark::AmenityRecycling] = "AmenityRecycling"; visualCategoryNames[GeoDataPlacemark::AmenityShelter] = "AmenityShelter"; visualCategoryNames[GeoDataPlacemark::AmenityTelephone] = "AmenityTelephone"; visualCategoryNames[GeoDataPlacemark::AmenityToilets] = "AmenityToilets"; visualCategoryNames[GeoDataPlacemark::AmenityTownHall] = "AmenityTownHall"; visualCategoryNames[GeoDataPlacemark::AmenityWasteBasket] = "AmenityWasteBasket"; visualCategoryNames[GeoDataPlacemark::AmenityDrinkingWater] = "AmenityDrinkingWater"; visualCategoryNames[GeoDataPlacemark::AmenityGraveyard] = "AmenityGraveyard"; visualCategoryNames[GeoDataPlacemark::AmenityChargingStation] = "ChargingStation"; visualCategoryNames[GeoDataPlacemark::BarrierCityWall] = "BarrierCityWall"; visualCategoryNames[GeoDataPlacemark::BarrierGate] = "BarrierGate"; visualCategoryNames[GeoDataPlacemark::BarrierLiftGate] = "BarrierLiftGate"; visualCategoryNames[GeoDataPlacemark::BarrierWall] = "BarrierWall"; visualCategoryNames[GeoDataPlacemark::NaturalPeak] = "NaturalPeak"; visualCategoryNames[GeoDataPlacemark::NaturalTree] = "NaturalTree"; visualCategoryNames[GeoDataPlacemark::NaturalCave] = "NaturalCave"; visualCategoryNames[GeoDataPlacemark::ShopBeverages] = "ShopBeverages"; visualCategoryNames[GeoDataPlacemark::ShopHifi] = "ShopHifi"; visualCategoryNames[GeoDataPlacemark::ShopSupermarket] = "ShopSupermarket"; visualCategoryNames[GeoDataPlacemark::ShopAlcohol] = "ShopAlcohol"; visualCategoryNames[GeoDataPlacemark::ShopBakery] = "ShopBakery"; visualCategoryNames[GeoDataPlacemark::ShopButcher] = "ShopButcher"; visualCategoryNames[GeoDataPlacemark::ShopConfectionery] = "ShopConfectionery"; visualCategoryNames[GeoDataPlacemark::ShopConvenience] = "ShopConvenience"; visualCategoryNames[GeoDataPlacemark::ShopGreengrocer] = "ShopGreengrocer"; visualCategoryNames[GeoDataPlacemark::ShopSeafood] = "ShopSeafood"; visualCategoryNames[GeoDataPlacemark::ShopDepartmentStore] = "ShopDepartmentStore"; visualCategoryNames[GeoDataPlacemark::ShopKiosk] = "ShopKiosk"; visualCategoryNames[GeoDataPlacemark::ShopBag] = "ShopBag"; visualCategoryNames[GeoDataPlacemark::ShopClothes] = "ShopClothes"; visualCategoryNames[GeoDataPlacemark::ShopFashion] = "ShopFashion"; visualCategoryNames[GeoDataPlacemark::ShopJewelry] = "ShopJewelry"; visualCategoryNames[GeoDataPlacemark::ShopShoes] = "ShopShoes"; visualCategoryNames[GeoDataPlacemark::ShopVarietyStore] = "ShopVarietyStore"; visualCategoryNames[GeoDataPlacemark::ShopBeauty] = "ShopBeauty"; visualCategoryNames[GeoDataPlacemark::ShopChemist] = "ShopChemist"; visualCategoryNames[GeoDataPlacemark::ShopCosmetics] = "ShopCosmetics"; visualCategoryNames[GeoDataPlacemark::ShopHairdresser] = "ShopHairdresser"; visualCategoryNames[GeoDataPlacemark::ShopOptician] = "ShopOptician"; visualCategoryNames[GeoDataPlacemark::ShopPerfumery] = "ShopPerfumery"; visualCategoryNames[GeoDataPlacemark::ShopDoitYourself] = "ShopDoitYourself"; visualCategoryNames[GeoDataPlacemark::ShopFlorist] = "ShopFlorist"; visualCategoryNames[GeoDataPlacemark::ShopHardware] = "ShopHardware"; visualCategoryNames[GeoDataPlacemark::ShopFurniture] = "ShopFurniture"; visualCategoryNames[GeoDataPlacemark::ShopElectronics] = "ShopElectronics"; visualCategoryNames[GeoDataPlacemark::ShopMobilePhone] = "ShopMobilePhone"; visualCategoryNames[GeoDataPlacemark::ShopBicycle] = "ShopBicycle"; visualCategoryNames[GeoDataPlacemark::ShopCar] = "ShopCar"; visualCategoryNames[GeoDataPlacemark::ShopCarRepair] = "ShopCarRepair"; visualCategoryNames[GeoDataPlacemark::ShopCarParts] = "ShopCarParts"; visualCategoryNames[GeoDataPlacemark::ShopMotorcycle] = "ShopMotorcycle"; visualCategoryNames[GeoDataPlacemark::ShopOutdoor] = "ShopOutdoor"; visualCategoryNames[GeoDataPlacemark::ShopSports] = "ShopSports"; visualCategoryNames[GeoDataPlacemark::ShopCopy] = "ShopCopy"; visualCategoryNames[GeoDataPlacemark::ShopArt] = "ShopArt"; visualCategoryNames[GeoDataPlacemark::ShopMusicalInstrument] = "ShopMusicalInstrument"; visualCategoryNames[GeoDataPlacemark::ShopPhoto] = "ShopPhoto"; visualCategoryNames[GeoDataPlacemark::ShopBook] = "ShopBook"; visualCategoryNames[GeoDataPlacemark::ShopGift] = "ShopGift"; visualCategoryNames[GeoDataPlacemark::ShopStationery] = "ShopStationery"; visualCategoryNames[GeoDataPlacemark::ShopLaundry] = "ShopLaundry"; visualCategoryNames[GeoDataPlacemark::ShopPet] = "ShopPet"; visualCategoryNames[GeoDataPlacemark::ShopToys] = "ShopToys"; visualCategoryNames[GeoDataPlacemark::ShopTravelAgency] = "ShopTravelAgency"; visualCategoryNames[GeoDataPlacemark::ShopDeli] = "ShopDeli"; visualCategoryNames[GeoDataPlacemark::ShopTobacco] = "ShopTobacco"; visualCategoryNames[GeoDataPlacemark::ShopTea] = "ShopTea"; visualCategoryNames[GeoDataPlacemark::Shop] = "Shop"; visualCategoryNames[GeoDataPlacemark::ManmadeBridge] = "ManmadeBridge"; visualCategoryNames[GeoDataPlacemark::ManmadeLighthouse] = "ManmadeLighthouse"; visualCategoryNames[GeoDataPlacemark::ManmadePier] = "ManmadePier"; visualCategoryNames[GeoDataPlacemark::ManmadeWaterTower] = "ManmadeWaterTower"; visualCategoryNames[GeoDataPlacemark::ManmadeWindMill] = "ManmadeWindMill"; visualCategoryNames[GeoDataPlacemark::TouristAttraction] = "TouristAttraction"; visualCategoryNames[GeoDataPlacemark::TouristCastle] = "TouristCastle"; visualCategoryNames[GeoDataPlacemark::TouristCinema] = "TouristCinema"; visualCategoryNames[GeoDataPlacemark::TouristInformation] = "TouristInformation"; visualCategoryNames[GeoDataPlacemark::TouristMonument] = "TouristMonument"; visualCategoryNames[GeoDataPlacemark::TouristMuseum] = "TouristMuseum"; visualCategoryNames[GeoDataPlacemark::TouristRuin] = "TouristRuin"; visualCategoryNames[GeoDataPlacemark::TouristTheatre] = "TouristTheatre"; visualCategoryNames[GeoDataPlacemark::TouristThemePark] = "TouristThemePark"; visualCategoryNames[GeoDataPlacemark::TouristViewPoint] = "TouristViewPoint"; visualCategoryNames[GeoDataPlacemark::TouristZoo] = "TouristZoo"; visualCategoryNames[GeoDataPlacemark::HistoricMemorial] = "HistoricMemorial"; visualCategoryNames[GeoDataPlacemark::TouristAlpineHut] = "TouristAlpineHut"; visualCategoryNames[GeoDataPlacemark::TouristWildernessHut] = "TouristWildernessHut"; visualCategoryNames[GeoDataPlacemark::TransportAerodrome] = "TransportAerodrome"; visualCategoryNames[GeoDataPlacemark::TransportHelipad] = "TransportHelipad"; visualCategoryNames[GeoDataPlacemark::TransportAirportTerminal] = "TransportAirportTerminal"; visualCategoryNames[GeoDataPlacemark::TransportAirportGate] = "TransportAirportGate"; visualCategoryNames[GeoDataPlacemark::TransportAirportRunway] = "TransportAirportRunway"; visualCategoryNames[GeoDataPlacemark::TransportAirportTaxiway] = "TransportAirportTaxiway"; visualCategoryNames[GeoDataPlacemark::TransportAirportApron] = "TransportAirportApron"; visualCategoryNames[GeoDataPlacemark::TransportBusStation] = "TransportBusStation"; visualCategoryNames[GeoDataPlacemark::TransportBusStop] = "TransportBusStop"; visualCategoryNames[GeoDataPlacemark::TransportCarShare] = "TransportCarShare"; visualCategoryNames[GeoDataPlacemark::TransportFuel] = "TransportFuel"; visualCategoryNames[GeoDataPlacemark::TransportParking] = "TransportParking"; visualCategoryNames[GeoDataPlacemark::TransportParkingSpace] = "TransportParkingSpace"; visualCategoryNames[GeoDataPlacemark::TransportPlatform] = "TransportPlatform"; visualCategoryNames[GeoDataPlacemark::TransportRentalBicycle] = "TransportRentalBicycle"; visualCategoryNames[GeoDataPlacemark::TransportRentalCar] = "TransportRentalCar"; visualCategoryNames[GeoDataPlacemark::TransportTaxiRank] = "TransportTaxiRank"; visualCategoryNames[GeoDataPlacemark::TransportTrainStation] = "TransportTrainStation"; visualCategoryNames[GeoDataPlacemark::TransportTramStop] = "TransportTramStop"; visualCategoryNames[GeoDataPlacemark::TransportSpeedCamera] = "TransportSpeedCamera"; visualCategoryNames[GeoDataPlacemark::TransportBicycleParking] = "TransportBicycleParking"; visualCategoryNames[GeoDataPlacemark::TransportMotorcycleParking] = "TransportMotorcycleParking"; visualCategoryNames[GeoDataPlacemark::TransportSubwayEntrance] = "TransportSubwayEntrance"; visualCategoryNames[GeoDataPlacemark::ReligionPlaceOfWorship] = "ReligionPlaceOfWorship"; visualCategoryNames[GeoDataPlacemark::ReligionBahai] = "ReligionBahai"; visualCategoryNames[GeoDataPlacemark::ReligionBuddhist] = "ReligionBuddhist"; visualCategoryNames[GeoDataPlacemark::ReligionChristian] = "ReligionChristian"; visualCategoryNames[GeoDataPlacemark::ReligionMuslim] = "ReligionMuslim"; visualCategoryNames[GeoDataPlacemark::ReligionHindu] = "ReligionHindu"; visualCategoryNames[GeoDataPlacemark::ReligionJain] = "ReligionJain"; visualCategoryNames[GeoDataPlacemark::ReligionJewish] = "ReligionJewish"; visualCategoryNames[GeoDataPlacemark::ReligionShinto] = "ReligionShinto"; visualCategoryNames[GeoDataPlacemark::ReligionSikh] = "ReligionSikh"; visualCategoryNames[GeoDataPlacemark::LeisureGolfCourse] = "LeisureGolfCourse"; visualCategoryNames[GeoDataPlacemark::LeisureMarina] = "LeisureMarina"; visualCategoryNames[GeoDataPlacemark::LeisurePark] = "LeisurePark"; visualCategoryNames[GeoDataPlacemark::LeisurePlayground] = "LeisurePlayground"; visualCategoryNames[GeoDataPlacemark::LeisurePitch] = "LeisurePitch"; visualCategoryNames[GeoDataPlacemark::LeisureSportsCentre] = "LeisureSportsCentre"; visualCategoryNames[GeoDataPlacemark::LeisureStadium] = "LeisureStadium"; visualCategoryNames[GeoDataPlacemark::LeisureTrack] = "LeisureTrack"; visualCategoryNames[GeoDataPlacemark::LeisureSwimmingPool] = "LeisureSwimmingPool"; visualCategoryNames[GeoDataPlacemark::LeisureMinigolfCourse] = "LeisureMinigolfCourse"; visualCategoryNames[GeoDataPlacemark::LanduseAllotments] = "LanduseAllotments"; visualCategoryNames[GeoDataPlacemark::LanduseBasin] = "LanduseBasin"; visualCategoryNames[GeoDataPlacemark::LanduseCemetery] = "LanduseCemetery"; visualCategoryNames[GeoDataPlacemark::LanduseCommercial] = "LanduseCommercial"; visualCategoryNames[GeoDataPlacemark::LanduseConstruction] = "LanduseConstruction"; visualCategoryNames[GeoDataPlacemark::LanduseFarmland] = "LanduseFarmland"; visualCategoryNames[GeoDataPlacemark::LanduseFarmyard] = "LanduseFarmyard"; visualCategoryNames[GeoDataPlacemark::LanduseGarages] = "LanduseGarages"; visualCategoryNames[GeoDataPlacemark::LanduseGrass] = "LanduseGrass"; visualCategoryNames[GeoDataPlacemark::LanduseIndustrial] = "LanduseIndustrial"; visualCategoryNames[GeoDataPlacemark::LanduseLandfill] = "LanduseLandfill"; visualCategoryNames[GeoDataPlacemark::LanduseMeadow] = "LanduseMeadow"; visualCategoryNames[GeoDataPlacemark::LanduseMilitary] = "LanduseMilitary"; visualCategoryNames[GeoDataPlacemark::LanduseQuarry] = "LanduseQuarry"; visualCategoryNames[GeoDataPlacemark::LanduseRailway] = "LanduseRailway"; visualCategoryNames[GeoDataPlacemark::LanduseReservoir] = "LanduseReservoir"; visualCategoryNames[GeoDataPlacemark::LanduseResidential] = "LanduseResidential"; visualCategoryNames[GeoDataPlacemark::LanduseRetail] = "LanduseRetail"; visualCategoryNames[GeoDataPlacemark::LanduseOrchard] = "LanduseOrchard"; visualCategoryNames[GeoDataPlacemark::LanduseVineyard] = "LanduseVineyard"; visualCategoryNames[GeoDataPlacemark::RailwayRail] = "RailwayRail"; visualCategoryNames[GeoDataPlacemark::RailwayNarrowGauge] = "RailwayNarrowGauge"; visualCategoryNames[GeoDataPlacemark::RailwayTram] = "RailwayTram"; visualCategoryNames[GeoDataPlacemark::RailwayLightRail] = "RailwayLightRail"; visualCategoryNames[GeoDataPlacemark::RailwayAbandoned] = "RailwayAbandoned"; visualCategoryNames[GeoDataPlacemark::RailwaySubway] = "RailwaySubway"; visualCategoryNames[GeoDataPlacemark::RailwayPreserved] = "RailwayPreserved"; visualCategoryNames[GeoDataPlacemark::RailwayMiniature] = "RailwayMiniature"; visualCategoryNames[GeoDataPlacemark::RailwayConstruction] = "RailwayConstruction"; visualCategoryNames[GeoDataPlacemark::RailwayMonorail] = "RailwayMonorail"; visualCategoryNames[GeoDataPlacemark::RailwayFunicular] = "RailwayFunicular"; visualCategoryNames[GeoDataPlacemark::PowerTower] = "PowerTower"; visualCategoryNames[GeoDataPlacemark::Satellite] = "Satellite"; visualCategoryNames[GeoDataPlacemark::Landmass] = "Landmass"; visualCategoryNames[GeoDataPlacemark::UrbanArea] = "UrbanArea"; visualCategoryNames[GeoDataPlacemark::InternationalDateLine] = "InternationalDateLine"; visualCategoryNames[GeoDataPlacemark::Bathymetry] = "Bathymetry"; visualCategoryNames[GeoDataPlacemark::AdminLevel1] = "AdminLevel1"; visualCategoryNames[GeoDataPlacemark::AdminLevel2] = "AdminLevel2"; visualCategoryNames[GeoDataPlacemark::AdminLevel3] = "AdminLevel3"; visualCategoryNames[GeoDataPlacemark::AdminLevel4] = "AdminLevel4"; visualCategoryNames[GeoDataPlacemark::AdminLevel5] = "AdminLevel5"; visualCategoryNames[GeoDataPlacemark::AdminLevel6] = "AdminLevel6"; visualCategoryNames[GeoDataPlacemark::AdminLevel7] = "AdminLevel7"; visualCategoryNames[GeoDataPlacemark::AdminLevel8] = "AdminLevel8"; visualCategoryNames[GeoDataPlacemark::AdminLevel9] = "AdminLevel9"; visualCategoryNames[GeoDataPlacemark::AdminLevel10] = "AdminLevel10"; visualCategoryNames[GeoDataPlacemark::AdminLevel11] = "AdminLevel11"; visualCategoryNames[GeoDataPlacemark::BoundaryMaritime] = "BoundaryMaritime"; visualCategoryNames[GeoDataPlacemark::WaterwayCanal] = "WaterwayCanal"; visualCategoryNames[GeoDataPlacemark::WaterwayDitch] = "WaterwayDitch"; visualCategoryNames[GeoDataPlacemark::WaterwayDrain] = "WaterwayDrain"; visualCategoryNames[GeoDataPlacemark::WaterwayStream] = "WaterwayStream"; visualCategoryNames[GeoDataPlacemark::WaterwayRiver] = "WaterwayRiver"; visualCategoryNames[GeoDataPlacemark::LastIndex] = "LastIndex"; } Q_ASSERT(visualCategoryNames.contains(category)); return visualCategoryNames[category]; } QHash StyleBuilder::osmTagMapping() { Private::initializeOsmVisualCategories(); return Private::s_visualCategories; } QStringList StyleBuilder::shopValues() { // from https://taginfo.openstreetmap.org/keys/building#values static const QStringList osmShopValues = QStringList() << "cheese" << "chocolate" << "coffee" << "dairy" << "farm" << "pasta" << "pastry" << "wine" << "general" << "mall" << "baby_goods" << "boutique" << "fabric" << "leather" << "tailor" << "watches" << "charity" << "second_hand" << "erotic" << "hearing_aids" << "herbalist" << "massage" << "medical_supply" << "tattoo" << "bathroom_furnishing" << "electrical" << "energy" << "furnace" << "garden_centre" << "garden_furniture" << "gas" << "glaziery" << "houseware" << "locksmith" << "paint" << "trade" << "antiques" << "bed" << "candles" << "carpet" << "curtain" << "interior_decoration" << "kitchen" << "lamps" << "window_blind" << "computer" << "radiotechnics" << "vacuum_cleaner" << "fishing" << "free_flying" << "hunting" << "outdoor" << "scuba_diving" << "sports" << "tyres" << "swimming_pool" << "art" << "craft" << "frame" << "games" << "model" << "music" << "trophy" << "video" << "video_games" << "anime" << "ticket" << "copyshop" << "dry_cleaning" << "e-cigarette" << "funeral_directors" << "money_lender" << "pawnbroker" << "pyrotechnics" << "religion" << "storage_rental" << "weapons" << "user defined"; return osmShopValues; } QSet StyleBuilder::buildingTags() { static const QString building = QStringLiteral("building"); // from https://taginfo.openstreetmap.org/keys/building#values static const QSet osmBuildingTags = QSet() << OsmTag(building, "yes") << OsmTag(building, "house") << OsmTag(building, "residential") << OsmTag(building, "garage") << OsmTag(building, "apartments") << OsmTag(building, "hut") << OsmTag(building, "industrial") << OsmTag(building, "detached") << OsmTag(building, "roof") << OsmTag(building, "garages") << OsmTag(building, "commercial") << OsmTag(building, "terrace") << OsmTag(building, "shed") << OsmTag(building, "school") << OsmTag(building, "retail") << OsmTag(building, "farm_auxiliary") << OsmTag(building, "church") << OsmTag(building, "cathedral") << OsmTag(building, "greenhouse") << OsmTag(building, "barn") << OsmTag(building, "service") << OsmTag(building, "manufacture") << OsmTag(building, "construction") << OsmTag(building, "cabin") << OsmTag(building, "farm") << OsmTag(building, "warehouse") << OsmTag(building, "House") << OsmTag(building, "office") << OsmTag(building, "civic") << OsmTag(building, "Residential") << OsmTag(building, "hangar") << OsmTag(building, "public") << OsmTag(building, "university") << OsmTag(building, "hospital") << OsmTag(building, "chapel") << OsmTag(building, "hotel") << OsmTag(building, "train_station") << OsmTag(building, "dormitory") << OsmTag(building, "kindergarten") << OsmTag(building, "stable") << OsmTag(building, "storage_tank") << OsmTag(building, "shop") << OsmTag(building, "college") << OsmTag(building, "supermarket") << OsmTag(building, "factory") << OsmTag(building, "bungalow") << OsmTag(building, "tower") << OsmTag(building, "silo") << OsmTag(building, "storage") << OsmTag(building, "station") << OsmTag(building, "education") << OsmTag(building, "carport") << OsmTag(building, "houseboat") << OsmTag(building, "castle") << OsmTag(building, "social_facility") << OsmTag(building, "water_tower") << OsmTag(building, "container") << OsmTag(building, "exhibition_hall") << OsmTag(building, "monastery") << OsmTag(building, "bunker") << OsmTag(building, "shelter") << OsmTag("building:part", "yes") << OsmTag("building:part", "antenna"); return osmBuildingTags; } GeoDataPlacemark::GeoDataVisualCategory StyleBuilder::determineVisualCategory(const OsmPlacemarkData &osmData) { if (osmData.containsTagKey(QStringLiteral("area:highway")) || // Not supported yet osmData.containsTag(QStringLiteral("boundary"), QStringLiteral("protected_area")) || // Not relevant for the default map osmData.containsTag(QStringLiteral("boundary"), QStringLiteral("postal_code")) || osmData.containsTag(QStringLiteral("boundary"), QStringLiteral("aerial_views")) || // Created by OSM editor(s) application for digitalization osmData.containsTagKey(QStringLiteral("closed:highway")) || osmData.containsTagKey(QStringLiteral("abandoned:highway")) || osmData.containsTagKey(QStringLiteral("abandoned:natural")) || osmData.containsTagKey(QStringLiteral("abandoned:building")) || osmData.containsTagKey(QStringLiteral("abandoned:leisure")) || osmData.containsTagKey(QStringLiteral("disused:highway")) || osmData.containsTag(QStringLiteral("highway"), QStringLiteral("razed"))) { return GeoDataPlacemark::None; } QString const yes(QStringLiteral("yes")); if (osmData.containsTag(QStringLiteral("building"), yes)) { return GeoDataPlacemark::Building; } if (osmData.containsTag(QStringLiteral("historic"), QStringLiteral("castle")) && osmData.containsTag(QStringLiteral("castle_type"), QStringLiteral("kremlin"))) { return GeoDataPlacemark::None; } if( osmData.containsTag(QStringLiteral("natural"), QStringLiteral("glacier")) && osmData.containsTag(QStringLiteral("glacier:type"), QStringLiteral("shelf")) ){ return GeoDataPlacemark::NaturalIceShelf; } Private::initializeOsmVisualCategories(); QString const capital(QStringLiteral("capital")); + QString const admin_level(QStringLiteral("admin_level")); + // National capitals have admin_level=2 + // More at http://wiki.openstreetmap.org/wiki/Key:capital#Using_relations_for_capitals + QString const national_level(QStringLiteral("2")); + for (auto iter = osmData.tagsBegin(), end=osmData.tagsEnd(); iter != end; ++iter) { const auto tag = OsmTag(iter.key(), iter.value()); GeoDataPlacemark::GeoDataVisualCategory category = Private::s_visualCategories.value(tag, GeoDataPlacemark::None); if (category != GeoDataPlacemark::None) { - if (category == GeoDataPlacemark::PlaceCity && osmData.containsTag(capital, yes)) { + if (category == GeoDataPlacemark::PlaceCity && osmData.containsTag(admin_level, national_level)) { + category = GeoDataPlacemark::PlaceCityNationalCapital; + } else if (category == GeoDataPlacemark::PlaceCity && osmData.containsTag(capital, yes)) { category = GeoDataPlacemark::PlaceCityCapital; + } else if (category == GeoDataPlacemark::PlaceTown && osmData.containsTag(admin_level, national_level)) { + category = GeoDataPlacemark::PlaceTownNationalCapital; } else if (category == GeoDataPlacemark::PlaceTown && osmData.containsTag(capital, yes)) { category = GeoDataPlacemark::PlaceTownCapital; + } else if (category == GeoDataPlacemark::PlaceVillage && osmData.containsTag(admin_level, national_level)) { + category = GeoDataPlacemark::PlaceVillageNationalCapital; } else if (category == GeoDataPlacemark::PlaceVillage && osmData.containsTag(capital, yes)) { category = GeoDataPlacemark::PlaceVillageCapital; } } if (category != GeoDataPlacemark::None) { return category; } } return GeoDataPlacemark::None; } StyleParameters::StyleParameters(const GeoDataPlacemark *placemark_, int tileLevel_) : placemark(placemark_), tileLevel(tileLevel_) { // nothing to do } } diff --git a/src/lib/marble/geodata/data/GeoDataPlacemark.cpp b/src/lib/marble/geodata/data/GeoDataPlacemark.cpp index 663308a28..b930f94e1 100644 --- a/src/lib/marble/geodata/data/GeoDataPlacemark.cpp +++ b/src/lib/marble/geodata/data/GeoDataPlacemark.cpp @@ -1,849 +1,852 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2004-2007 Torsten Rahn // Copyright 2007 Inge Wallin // Copyright 2008-2009 Patrick Spendrin // // Own #include "GeoDataPlacemark.h" // Private #include "GeoDataPlacemark_p.h" #include "GeoDataMultiGeometry.h" #include "GeoDataCoordinates.h" #include "GeoDataLatLonAltBox.h" #include "GeoDataData.h" #include "osm/OsmPlacemarkData.h" // Qt #include #include "MarbleDebug.h" #include "GeoDataTrack.h" #include "GeoDataModel.h" #include #include namespace Marble { const OsmPlacemarkData GeoDataPlacemarkPrivate::s_nullOsmPlacemarkData = OsmPlacemarkData(); const GeoDataPlacemarkExtendedData GeoDataPlacemarkPrivate::s_nullPlacemarkExtendedData = GeoDataPlacemarkExtendedData(); GeoDataPlacemark::GeoDataPlacemark() : GeoDataFeature( new GeoDataPlacemarkPrivate ) { Q_D(GeoDataPlacemark); d->m_geometry->setParent(this); } GeoDataPlacemark::GeoDataPlacemark( const GeoDataPlacemark& other ) : GeoDataFeature(other, new GeoDataPlacemarkPrivate(*other.d_func())) { Q_D(GeoDataPlacemark); if (d->m_geometry) { d->m_geometry->setParent(this); } } GeoDataPlacemark::GeoDataPlacemark( const QString& name ) : GeoDataFeature( new GeoDataPlacemarkPrivate ) { Q_D(GeoDataPlacemark); d->m_name = name; d->m_geometry->setParent(this); } GeoDataPlacemark::~GeoDataPlacemark() { // nothing to do } GeoDataPlacemark &GeoDataPlacemark::operator=( const GeoDataPlacemark &other ) { if (this != &other) { Q_D(GeoDataPlacemark); *d = *other.d_func(); if (d->m_geometry) { d->m_geometry->setParent(this); } } return *this; } bool GeoDataPlacemark::operator==( const GeoDataPlacemark& other ) const { Q_D(const GeoDataPlacemark); const GeoDataPlacemarkPrivate* const other_d = other.d_func(); if (!equals(other) || d->m_population != other_d->m_population) { return false; } if ((d->m_placemarkExtendedData && !other_d->m_placemarkExtendedData) || (!d->m_placemarkExtendedData && other_d->m_placemarkExtendedData)) { return false; } if (d->m_placemarkExtendedData && other_d->m_placemarkExtendedData && !(*d->m_placemarkExtendedData == *other_d->m_placemarkExtendedData)) { return false; } if (!d->m_geometry && !other_d->m_geometry) { return true; } if ((!d->m_geometry && other_d->m_geometry) || (d->m_geometry && !other_d->m_geometry)) { return false; } if (d->m_geometry->nodeType() != other_d->m_geometry->nodeType()) { return false; } if (d->m_geometry->nodeType() == GeoDataTypes::GeoDataPolygonType) { GeoDataPolygon *thisPoly = dynamic_cast(d->m_geometry); GeoDataPolygon *otherPoly = dynamic_cast(other_d->m_geometry); Q_ASSERT( thisPoly && otherPoly ); if ( *thisPoly != *otherPoly ) { return false; } } else if (d->m_geometry->nodeType() == GeoDataTypes::GeoDataLineStringType) { GeoDataLineString *thisLine = dynamic_cast(d->m_geometry); GeoDataLineString *otherLine = dynamic_cast(other_d->m_geometry); Q_ASSERT( thisLine && otherLine ); if ( *thisLine != *otherLine ) { return false; } } else if (d->m_geometry->nodeType() == GeoDataTypes::GeoDataModelType) { GeoDataModel *thisModel = dynamic_cast(d->m_geometry); GeoDataModel *otherModel = dynamic_cast(other_d->m_geometry); Q_ASSERT( thisModel && otherModel ); if ( *thisModel != *otherModel ) { return false; } /*} else if (d->m_geometry->nodeType() == GeoDataTypes::GeoDataMultiGeometryType) { GeoDataMultiGeometry *thisMG = dynamic_cast(d->m_geometry); GeoDataMultiGeometry *otherMG = dynamic_cast(other_d->m_geometry); Q_ASSERT( thisMG && otherMG ); if ( *thisMG != *otherMG ) { return false; } */ // Does not have equality operators. I guess they need to be implemented soon. } else if (d->m_geometry->nodeType() == GeoDataTypes::GeoDataTrackType) { GeoDataTrack *thisTrack = dynamic_cast(d->m_geometry); GeoDataTrack *otherTrack = dynamic_cast(other_d->m_geometry); Q_ASSERT( thisTrack && otherTrack ); if ( *thisTrack != *otherTrack ) { return false; } } else if (d->m_geometry->nodeType() == GeoDataTypes::GeoDataMultiTrackType) { GeoDataMultiTrack *thisMT = dynamic_cast(d->m_geometry); GeoDataMultiTrack *otherMT = dynamic_cast(other_d->m_geometry); Q_ASSERT( thisMT && otherMT ); if ( *thisMT != *otherMT ) { return false; } } else if (d->m_geometry->nodeType() == GeoDataTypes::GeoDataPointType) { GeoDataPoint *thisPoint = dynamic_cast(d->m_geometry); GeoDataPoint *otherPoint = dynamic_cast(other_d->m_geometry); Q_ASSERT( thisPoint && otherPoint ); if ( *thisPoint != *otherPoint ) { return false; } } return true; } bool GeoDataPlacemark::operator!=( const GeoDataPlacemark& other ) const { return !this->operator==( other ); } const char* GeoDataPlacemark::nodeType() const { return GeoDataTypes::GeoDataPlacemarkType; } GeoDataFeature * GeoDataPlacemark::clone() const { return new GeoDataPlacemark(*this); } GeoDataPlacemark::GeoDataVisualCategory GeoDataPlacemark::visualCategory() const { Q_D(const GeoDataPlacemark); return d->m_visualCategory; } void GeoDataPlacemark::setVisualCategory(GeoDataPlacemark::GeoDataVisualCategory index) { Q_D(GeoDataPlacemark); d->m_visualCategory = index; } GeoDataGeometry* GeoDataPlacemark::geometry() { Q_D(GeoDataPlacemark); return d->m_geometry; } const GeoDataGeometry* GeoDataPlacemark::geometry() const { Q_D(const GeoDataPlacemark); return d->m_geometry; } const OsmPlacemarkData& GeoDataPlacemark::osmData() const { Q_D(const GeoDataPlacemark); return d->osmPlacemarkData(); } void GeoDataPlacemark::setOsmData( const OsmPlacemarkData &osmData ) { Q_D(GeoDataPlacemark); d->osmPlacemarkData() = osmData; } OsmPlacemarkData& GeoDataPlacemark::osmData() { Q_D(GeoDataPlacemark); return d->osmPlacemarkData(); } bool GeoDataPlacemark::hasOsmData() const { Q_D(const GeoDataPlacemark); return d->m_osmPlacemarkData != nullptr; } void GeoDataPlacemark::clearOsmData() { Q_D(GeoDataPlacemark); delete d->m_osmPlacemarkData; d->m_osmPlacemarkData = nullptr; } const GeoDataLookAt *GeoDataPlacemark::lookAt() const { return dynamic_cast( abstractView() ); } GeoDataLookAt *GeoDataPlacemark::lookAt() { return dynamic_cast( abstractView() ); } bool GeoDataPlacemark::placemarkLayoutOrderCompare(const GeoDataPlacemark *left, const GeoDataPlacemark *right) { const GeoDataPlacemarkPrivate * const left_d = left->d_func(); const GeoDataPlacemarkPrivate * const right_d = right->d_func(); if (left_d->m_zoomLevel != right_d->m_zoomLevel) { return (left_d->m_zoomLevel < right_d->m_zoomLevel); // lower zoom level comes first } if (left_d->m_popularity != right_d->m_popularity) { return (left_d->m_popularity > right_d->m_popularity); // higher popularity comes first } return left < right; // lower pointer value comes first } GeoDataCoordinates GeoDataPlacemark::coordinate( const QDateTime &dateTime, bool *iconAtCoordinates ) const { Q_D(const GeoDataPlacemark); bool hasIcon = false; GeoDataCoordinates coord; if (d->m_geometry) { // Beware: comparison between pointers, not strings. if (d->m_geometry->nodeType() == GeoDataTypes::GeoDataPointType || d->m_geometry->nodeType() == GeoDataTypes::GeoDataPolygonType || d->m_geometry->nodeType() == GeoDataTypes::GeoDataLinearRingType) { hasIcon = true; coord = d->m_geometry->latLonAltBox().center(); } else if (d->m_geometry->nodeType() == GeoDataTypes::GeoDataMultiGeometryType) { const GeoDataMultiGeometry *multiGeometry = static_cast(d->m_geometry); QVector::ConstIterator it = multiGeometry->constBegin(); QVector::ConstIterator end = multiGeometry->constEnd(); for ( ; it != end; ++it ) { if ((*it)->nodeType() == GeoDataTypes::GeoDataPointType || (*it)->nodeType() == GeoDataTypes::GeoDataPolygonType || (*it)->nodeType() == GeoDataTypes::GeoDataLinearRingType) { hasIcon = true; break; } } coord = d->m_geometry->latLonAltBox().center(); } else if (d->m_geometry->nodeType() == GeoDataTypes::GeoDataTrackType) { const GeoDataTrack *track = static_cast(d->m_geometry); hasIcon = track->size() != 0 && track->firstWhen() <= dateTime; coord = track->coordinatesAt( dateTime ); } else { coord = d->m_geometry->latLonAltBox().center(); } } if ( iconAtCoordinates != 0 ) { *iconAtCoordinates = hasIcon; } return coord; } void GeoDataPlacemark::coordinate( qreal& lon, qreal& lat, qreal& alt ) const { coordinate().geoCoordinates( lon, lat, alt ); } void GeoDataPlacemark::setCoordinate( qreal lon, qreal lat, qreal alt, GeoDataPoint::Unit _unit) { setGeometry( new GeoDataPoint(lon, lat, alt, _unit ) ); } void GeoDataPlacemark::setCoordinate( const GeoDataCoordinates &point ) { setGeometry ( new GeoDataPoint( point ) ); } void GeoDataPlacemark::setGeometry( GeoDataGeometry *entry ) { Q_D(GeoDataPlacemark); delete d->m_geometry; d->m_geometry = entry; d->m_geometry->setParent(this); } QString GeoDataPlacemark::displayName() const { if (hasOsmData()) { OsmPlacemarkData const &data = osmData(); QStringList const uiLanguages = QLocale::system().uiLanguages(); foreach (const QString &uiLanguage, uiLanguages) { for (auto tagIter = data.tagsBegin(), end = data.tagsEnd(); tagIter != end; ++tagIter) { if (tagIter.key().startsWith(QLatin1String("name:"))) { QStringRef const tagLanguage = tagIter.key().midRef(5); if (tagLanguage == uiLanguage) { return tagIter.value(); } } } } } return name(); } QString GeoDataPlacemark::categoryName() const { Q_D(const GeoDataPlacemark); switch (d->m_visualCategory) { case Valley: return GeoDataPlacemarkPrivate::tr("Valley"); case OtherTerrain: return GeoDataPlacemarkPrivate::tr("Terrain"); case Crater: return GeoDataPlacemarkPrivate::tr("Crater"); case Mare: return GeoDataPlacemarkPrivate::tr("Sea"); case MannedLandingSite: return GeoDataPlacemarkPrivate::tr("Manned Landing Site"); case RoboticRover: return GeoDataPlacemarkPrivate::tr("Robotic Rover"); case UnmannedSoftLandingSite: return GeoDataPlacemarkPrivate::tr("Unmanned Soft Landing Site"); case UnmannedHardLandingSite: return GeoDataPlacemarkPrivate::tr("Unmanned Hard Landing Site"); case Mons: return GeoDataPlacemarkPrivate::tr("Mountain"); case SmallCity: return GeoDataPlacemarkPrivate::tr("City"); case SmallCountyCapital: return GeoDataPlacemarkPrivate::tr("County Capital"); case SmallStateCapital: return GeoDataPlacemarkPrivate::tr("State Capital"); case SmallNationCapital: return GeoDataPlacemarkPrivate::tr("Nation Capital"); case MediumCity: return GeoDataPlacemarkPrivate::tr("City"); case MediumCountyCapital: return GeoDataPlacemarkPrivate::tr("County Capital"); case MediumStateCapital: return GeoDataPlacemarkPrivate::tr("State Capital"); case MediumNationCapital: return GeoDataPlacemarkPrivate::tr("Nation Capital"); case BigCity: return GeoDataPlacemarkPrivate::tr("City"); case BigCountyCapital: return GeoDataPlacemarkPrivate::tr("County Capital"); case BigStateCapital: return GeoDataPlacemarkPrivate::tr("State Capital"); case BigNationCapital: return GeoDataPlacemarkPrivate::tr("Nation Capital"); case LargeCity: return GeoDataPlacemarkPrivate::tr("City"); case LargeCountyCapital: return GeoDataPlacemarkPrivate::tr("County Capital"); case LargeStateCapital: return GeoDataPlacemarkPrivate::tr("State Capital"); case LargeNationCapital: return GeoDataPlacemarkPrivate::tr("Nation Capital"); case Nation: return GeoDataPlacemarkPrivate::tr("Nation"); case Mountain: return GeoDataPlacemarkPrivate::tr("Mountain"); case Volcano: return GeoDataPlacemarkPrivate::tr("Volcano"); case Continent: return GeoDataPlacemarkPrivate::tr("Continent"); case Ocean: return GeoDataPlacemarkPrivate::tr("Ocean"); case GeographicPole: return GeoDataPlacemarkPrivate::tr("Geographic Pole"); case MagneticPole: return GeoDataPlacemarkPrivate::tr("Magnetic Pole"); case ShipWreck: return GeoDataPlacemarkPrivate::tr("Ship Wreck"); case AirPort: return GeoDataPlacemarkPrivate::tr("Air Port"); case Observatory: return GeoDataPlacemarkPrivate::tr("Observatory"); case MilitaryDangerArea: return GeoDataPlacemarkPrivate::tr("Military Danger Area"); case OsmSite: return GeoDataPlacemarkPrivate::tr("OSM Site"); case Coordinate: return GeoDataPlacemarkPrivate::tr("Coordinate"); case Bookmark: return GeoDataPlacemarkPrivate::tr("Bookmark"); case Satellite: return GeoDataPlacemarkPrivate::tr("Satellite"); // OpenStreetMap categories case PlaceCity: return GeoDataPlacemarkPrivate::tr("City"); case PlaceCityCapital: return GeoDataPlacemarkPrivate::tr("City Capital"); + case PlaceCityNationalCapital: return GeoDataPlacemarkPrivate::tr("City National Capital"); case PlaceSuburb: return GeoDataPlacemarkPrivate::tr("Suburb"); case PlaceHamlet: return GeoDataPlacemarkPrivate::tr("Hamlet"); case PlaceLocality: return GeoDataPlacemarkPrivate::tr("Locality"); case PlaceTown: return GeoDataPlacemarkPrivate::tr("Town"); case PlaceTownCapital: return GeoDataPlacemarkPrivate::tr("Town Capital"); + case PlaceTownNationalCapital: return GeoDataPlacemarkPrivate::tr("Town National Capital"); case PlaceVillage: return GeoDataPlacemarkPrivate::tr("Village"); case PlaceVillageCapital: return GeoDataPlacemarkPrivate::tr("Village Capital"); + case PlaceVillageNationalCapital: return GeoDataPlacemarkPrivate::tr("Village National Capital"); case NaturalWater: return GeoDataPlacemarkPrivate::tr("Water"); case NaturalReef: return GeoDataPlacemarkPrivate::tr("Reef"); case NaturalWood: return GeoDataPlacemarkPrivate::tr("Wood"); case NaturalBeach: return GeoDataPlacemarkPrivate::tr("Beach"); case NaturalWetland: return GeoDataPlacemarkPrivate::tr("Wetland"); case NaturalGlacier: return GeoDataPlacemarkPrivate::tr("Glacier"); case NaturalIceShelf: return GeoDataPlacemarkPrivate::tr("Ice Shelf"); case NaturalScrub: return GeoDataPlacemarkPrivate::tr("Scrub"); case NaturalCliff: return GeoDataPlacemarkPrivate::tr("Cliff"); case NaturalHeath: return GeoDataPlacemarkPrivate::tr("Heath"); case HighwayTrafficSignals: return GeoDataPlacemarkPrivate::tr("Traffic Signals"); case HighwaySteps: return GeoDataPlacemarkPrivate::tr("Steps"); case HighwayUnknown: return GeoDataPlacemarkPrivate::tr("Unknown Road"); case HighwayPath: return GeoDataPlacemarkPrivate::tr("Path"); case HighwayFootway: return GeoDataPlacemarkPrivate::tr("Footway"); case HighwayTrack: return GeoDataPlacemarkPrivate::tr("Track"); case HighwayPedestrian: return GeoDataPlacemarkPrivate::tr("Footway"); case HighwayCycleway: return GeoDataPlacemarkPrivate::tr("Cycleway"); case HighwayService: return GeoDataPlacemarkPrivate::tr("Service Road"); case HighwayRoad: return GeoDataPlacemarkPrivate::tr("Road"); case HighwayResidential: return GeoDataPlacemarkPrivate::tr("Residential Road"); case HighwayLivingStreet: return GeoDataPlacemarkPrivate::tr("Living Street"); case HighwayUnclassified: return GeoDataPlacemarkPrivate::tr("Unclassified Road"); case HighwayTertiaryLink: return GeoDataPlacemarkPrivate::tr("Tertiary Link Road"); case HighwayTertiary: return GeoDataPlacemarkPrivate::tr("Tertiary Road"); case HighwaySecondaryLink: return GeoDataPlacemarkPrivate::tr("Secondary Link Road"); case HighwaySecondary: return GeoDataPlacemarkPrivate::tr("Secondary Road"); case HighwayPrimaryLink: return GeoDataPlacemarkPrivate::tr("Primary Link Road"); case HighwayPrimary: return GeoDataPlacemarkPrivate::tr("Primary Road"); case HighwayRaceway: return GeoDataPlacemarkPrivate::tr("Raceway"); case HighwayTrunkLink: return GeoDataPlacemarkPrivate::tr("Trunk Link Road"); case HighwayTrunk: return GeoDataPlacemarkPrivate::tr("Trunk Road"); case HighwayMotorwayLink: return GeoDataPlacemarkPrivate::tr("Motorway Link Road"); case HighwayMotorway: return GeoDataPlacemarkPrivate::tr("Motorway"); case Building: return GeoDataPlacemarkPrivate::tr("Building"); case AccomodationCamping: return GeoDataPlacemarkPrivate::tr("Camping"); case AccomodationHostel: return GeoDataPlacemarkPrivate::tr("Hostel"); case AccomodationHotel: return GeoDataPlacemarkPrivate::tr("Hotel"); case AccomodationMotel: return GeoDataPlacemarkPrivate::tr("Motel"); case AccomodationYouthHostel: return GeoDataPlacemarkPrivate::tr("Youth Hostel"); case AccomodationGuestHouse: return GeoDataPlacemarkPrivate::tr("Guest House"); case AmenityLibrary: return GeoDataPlacemarkPrivate::tr("Library"); case AmenityKindergarten: return GeoDataPlacemarkPrivate::tr("Kindergarten"); case EducationCollege: return GeoDataPlacemarkPrivate::tr("College"); case EducationSchool: return GeoDataPlacemarkPrivate::tr("School"); case EducationUniversity: return GeoDataPlacemarkPrivate::tr("University"); case FoodBar: return GeoDataPlacemarkPrivate::tr("Bar"); case FoodBiergarten: return GeoDataPlacemarkPrivate::tr("Biergarten"); case FoodCafe: return GeoDataPlacemarkPrivate::tr("Cafe"); case FoodFastFood: return GeoDataPlacemarkPrivate::tr("Fast Food"); case FoodPub: return GeoDataPlacemarkPrivate::tr("Pub"); case FoodRestaurant: return GeoDataPlacemarkPrivate::tr("Restaurant"); case HealthDentist: return GeoDataPlacemarkPrivate::tr("Dentist"); case HealthDoctors: return GeoDataPlacemarkPrivate::tr("Doctors"); case HealthHospital: return GeoDataPlacemarkPrivate::tr("Hospital"); case HealthPharmacy: return GeoDataPlacemarkPrivate::tr("Pharmacy"); case HealthVeterinary: return GeoDataPlacemarkPrivate::tr("Veterinary"); case MoneyAtm: return GeoDataPlacemarkPrivate::tr("ATM"); case MoneyBank: return GeoDataPlacemarkPrivate::tr("Bank"); case AmenityArchaeologicalSite: return GeoDataPlacemarkPrivate::tr("Archaeological Site"); case AmenityEmbassy: return GeoDataPlacemarkPrivate::tr("Embassy"); case AmenityEmergencyPhone: return GeoDataPlacemarkPrivate::tr("Emergency Phone"); case AmenityWaterPark: return GeoDataPlacemarkPrivate::tr("Water Park"); case AmenityCommunityCentre: return GeoDataPlacemarkPrivate::tr("Community Centre"); case AmenityFountain: return GeoDataPlacemarkPrivate::tr("Fountain"); case AmenityNightClub: return GeoDataPlacemarkPrivate::tr("Night Club"); case AmenityBench: return GeoDataPlacemarkPrivate::tr("Bench"); case AmenityCourtHouse: return GeoDataPlacemarkPrivate::tr("Court House"); case AmenityFireStation: return GeoDataPlacemarkPrivate::tr("Fire Station"); case AmenityHuntingStand: return GeoDataPlacemarkPrivate::tr("Hunting Stand"); case AmenityPolice: return GeoDataPlacemarkPrivate::tr("Police"); case AmenityPostBox: return GeoDataPlacemarkPrivate::tr("Post Box"); case AmenityPostOffice: return GeoDataPlacemarkPrivate::tr("Post Office"); case AmenityPrison: return GeoDataPlacemarkPrivate::tr("Prison"); case AmenityRecycling: return GeoDataPlacemarkPrivate::tr("Recycling"); case AmenityShelter: return GeoDataPlacemarkPrivate::tr("Shelter"); case AmenityTelephone: return GeoDataPlacemarkPrivate::tr("Telephone"); case AmenityToilets: return GeoDataPlacemarkPrivate::tr("Toilets"); case AmenityTownHall: return GeoDataPlacemarkPrivate::tr("Town Hall"); case AmenityWasteBasket: return GeoDataPlacemarkPrivate::tr("Waste Basket"); case AmenityDrinkingWater: return GeoDataPlacemarkPrivate::tr("Drinking Water"); case AmenityGraveyard: return GeoDataPlacemarkPrivate::tr("Graveyard"); case AmenityChargingStation: return GeoDataPlacemarkPrivate::tr("Charging Station"); case BarrierCityWall: return GeoDataPlacemarkPrivate::tr("City Wall"); case BarrierGate: return GeoDataPlacemarkPrivate::tr("Gate"); case BarrierLiftGate: return GeoDataPlacemarkPrivate::tr("Lift Gate"); case BarrierWall: return GeoDataPlacemarkPrivate::tr("Wall"); case NaturalPeak: return GeoDataPlacemarkPrivate::tr("Peak"); case NaturalTree: return GeoDataPlacemarkPrivate::tr("Tree"); case NaturalCave: return GeoDataPlacemarkPrivate::tr("Cave Entrance"); case ShopBeverages: return GeoDataPlacemarkPrivate::tr("Beverages"); case ShopHifi: return GeoDataPlacemarkPrivate::tr("Hifi"); case ShopSupermarket: return GeoDataPlacemarkPrivate::tr("Supermarket"); case ShopAlcohol: return GeoDataPlacemarkPrivate::tr("Liquor Store"); case ShopBakery: return GeoDataPlacemarkPrivate::tr("Bakery"); case ShopButcher: return GeoDataPlacemarkPrivate::tr("Butcher"); case ShopConfectionery: return GeoDataPlacemarkPrivate::tr("Confectionery"); case ShopConvenience: return GeoDataPlacemarkPrivate::tr("Convenience Shop"); case ShopGreengrocer: return GeoDataPlacemarkPrivate::tr("Greengrocer"); case ShopSeafood: return GeoDataPlacemarkPrivate::tr("Seafood Shop"); case ShopDepartmentStore: return GeoDataPlacemarkPrivate::tr("Department Store"); case ShopKiosk: return GeoDataPlacemarkPrivate::tr("Kiosk"); case ShopBag: return GeoDataPlacemarkPrivate::tr("Bag Shop"); case ShopClothes: return GeoDataPlacemarkPrivate::tr("Clothes Shop"); case ShopFashion: return GeoDataPlacemarkPrivate::tr("Fashion Shop"); case ShopJewelry: return GeoDataPlacemarkPrivate::tr("Jewelry Shop"); case ShopShoes: return GeoDataPlacemarkPrivate::tr("Shoe Shop"); case ShopVarietyStore: return GeoDataPlacemarkPrivate::tr("Variety Store"); case ShopBeauty: return GeoDataPlacemarkPrivate::tr("Beauty Services"); case ShopChemist: return GeoDataPlacemarkPrivate::tr("Chemist"); case ShopCosmetics: return GeoDataPlacemarkPrivate::tr("Cosmetics"); case ShopHairdresser: return GeoDataPlacemarkPrivate::tr("Hairdresser"); case ShopOptician: return GeoDataPlacemarkPrivate::tr("Optician"); case ShopPerfumery: return GeoDataPlacemarkPrivate::tr("Perfumery"); case ShopDoitYourself: return GeoDataPlacemarkPrivate::tr("Hardware Store"); case ShopFlorist: return GeoDataPlacemarkPrivate::tr("Florist"); case ShopHardware: return GeoDataPlacemarkPrivate::tr("Hardware Store"); case ShopFurniture: return GeoDataPlacemarkPrivate::tr("Furniture Store"); case ShopElectronics: return GeoDataPlacemarkPrivate::tr("Electronics Shop"); case ShopMobilePhone: return GeoDataPlacemarkPrivate::tr("Mobile Phone Shop"); case ShopBicycle: return GeoDataPlacemarkPrivate::tr("Bicycle Shop"); case ShopCar: return GeoDataPlacemarkPrivate::tr("Car Dealer"); case ShopCarRepair: return GeoDataPlacemarkPrivate::tr("Car Repair Shop"); case ShopCarParts: return GeoDataPlacemarkPrivate::tr("Car Parts"); case ShopMotorcycle: return GeoDataPlacemarkPrivate::tr("Motorcycle Shop"); case ShopOutdoor: return GeoDataPlacemarkPrivate::tr("Outdoor Shop"); case ShopSports: return GeoDataPlacemarkPrivate::tr("Sports Shop"); case ShopCopy: return GeoDataPlacemarkPrivate::tr("Printing Services"); case ShopArt: return GeoDataPlacemarkPrivate::tr("Art Shop"); case ShopMusicalInstrument: return GeoDataPlacemarkPrivate::tr("Musical Instrument Shop"); case ShopPhoto: return GeoDataPlacemarkPrivate::tr("Photo Shop"); case ShopBook: return GeoDataPlacemarkPrivate::tr("Bookshop"); case ShopGift: return GeoDataPlacemarkPrivate::tr("Gift Shop"); case ShopStationery: return GeoDataPlacemarkPrivate::tr("Stationery"); case ShopLaundry: return GeoDataPlacemarkPrivate::tr("Laundry"); case ShopPet: return GeoDataPlacemarkPrivate::tr("Pet Shop"); case ShopToys: return GeoDataPlacemarkPrivate::tr("Toy Store"); case ShopTravelAgency: return GeoDataPlacemarkPrivate::tr("Travel Agency"); case ShopDeli: return GeoDataPlacemarkPrivate::tr("Deli"); case ShopTobacco: return GeoDataPlacemarkPrivate::tr("Tobacco Shop"); case ShopTea: return GeoDataPlacemarkPrivate::tr("Tea Shop"); case Shop: return GeoDataPlacemarkPrivate::tr("Shop"); case ManmadeBridge: return GeoDataPlacemarkPrivate::tr("Bridge"); case ManmadeLighthouse: return GeoDataPlacemarkPrivate::tr("Lighthouse"); case ManmadePier: return GeoDataPlacemarkPrivate::tr("Pier"); case ManmadeWaterTower: return GeoDataPlacemarkPrivate::tr("Water Tower"); case ManmadeWindMill: return GeoDataPlacemarkPrivate::tr("Wind Mill"); case TouristAttraction: return GeoDataPlacemarkPrivate::tr("Tourist Attraction"); case TouristCastle: return GeoDataPlacemarkPrivate::tr("Castle"); case TouristCinema: return GeoDataPlacemarkPrivate::tr("Cinema"); case TouristInformation: return GeoDataPlacemarkPrivate::tr("Information"); case TouristMonument: return GeoDataPlacemarkPrivate::tr("Monument"); case TouristMuseum: return GeoDataPlacemarkPrivate::tr("Museum"); case TouristRuin: return GeoDataPlacemarkPrivate::tr("Ruin"); case TouristTheatre: return GeoDataPlacemarkPrivate::tr("Theatre"); case TouristThemePark: return GeoDataPlacemarkPrivate::tr("Theme Park"); case TouristViewPoint: return GeoDataPlacemarkPrivate::tr("View Point"); case TouristZoo: return GeoDataPlacemarkPrivate::tr("Zoo"); case TouristAlpineHut: return GeoDataPlacemarkPrivate::tr("Alpine Hut"); case TouristWildernessHut: return GeoDataPlacemarkPrivate::tr("Wilderness Hut"); case HistoricMemorial: return GeoDataPlacemarkPrivate::tr("Memorial"); case TransportAerodrome: return GeoDataPlacemarkPrivate::tr("Aerodrome"); case TransportHelipad: return GeoDataPlacemarkPrivate::tr("Helipad"); case TransportAirportGate: return GeoDataPlacemarkPrivate::tr("Airport Gate"); case TransportAirportRunway: return GeoDataPlacemarkPrivate::tr("Airport Runway"); case TransportAirportApron: return GeoDataPlacemarkPrivate::tr("Airport Apron"); case TransportAirportTaxiway: return GeoDataPlacemarkPrivate::tr("Airport Taxiway"); case TransportAirportTerminal: return GeoDataPlacemarkPrivate::tr("Airport Terminal"); case TransportBusStation: return GeoDataPlacemarkPrivate::tr("Bus Station"); case TransportBusStop: return GeoDataPlacemarkPrivate::tr("Bus Stop"); case TransportCarShare: return GeoDataPlacemarkPrivate::tr("Car Sharing"); case TransportFuel: return GeoDataPlacemarkPrivate::tr("Gas Station"); case TransportParking: return GeoDataPlacemarkPrivate::tr("Parking"); case TransportParkingSpace: return GeoDataPlacemarkPrivate::tr("Parking Space"); case TransportPlatform: return GeoDataPlacemarkPrivate::tr("Platform"); case TransportRentalBicycle: return GeoDataPlacemarkPrivate::tr("Rental Bicycle"); case TransportRentalCar: return GeoDataPlacemarkPrivate::tr("Rental Car"); case TransportTaxiRank: return GeoDataPlacemarkPrivate::tr("Taxi Rank"); case TransportTrainStation: return GeoDataPlacemarkPrivate::tr("Train Station"); case TransportTramStop: return GeoDataPlacemarkPrivate::tr("Tram Stop"); case TransportBicycleParking: return GeoDataPlacemarkPrivate::tr("Bicycle Parking"); case TransportMotorcycleParking: return GeoDataPlacemarkPrivate::tr("Motorcycle Parking"); case TransportSubwayEntrance: return GeoDataPlacemarkPrivate::tr("Subway Entrance"); case TransportSpeedCamera: return GeoDataPlacemarkPrivate::tr("Speed Camera"); case ReligionPlaceOfWorship: return GeoDataPlacemarkPrivate::tr("Place Of Worship"); case ReligionBahai: return GeoDataPlacemarkPrivate::tr("Bahai"); case ReligionBuddhist: return GeoDataPlacemarkPrivate::tr("Buddhist"); case ReligionChristian: return GeoDataPlacemarkPrivate::tr("Christian"); case ReligionMuslim: return GeoDataPlacemarkPrivate::tr("Muslim"); case ReligionHindu: return GeoDataPlacemarkPrivate::tr("Hindu"); case ReligionJain: return GeoDataPlacemarkPrivate::tr("Jain"); case ReligionJewish: return GeoDataPlacemarkPrivate::tr("Jewish"); case ReligionShinto: return GeoDataPlacemarkPrivate::tr("Shinto"); case ReligionSikh: return GeoDataPlacemarkPrivate::tr("Sikh"); case LeisureGolfCourse: return GeoDataPlacemarkPrivate::tr("Golf Course"); case LeisureMarina: return GeoDataPlacemarkPrivate::tr("Marina"); case LeisurePark: return GeoDataPlacemarkPrivate::tr("Park"); case LeisurePlayground: return GeoDataPlacemarkPrivate::tr("Playground"); case LeisurePitch: return GeoDataPlacemarkPrivate::tr("Pitch"); case LeisureSportsCentre: return GeoDataPlacemarkPrivate::tr("Sports Centre"); case LeisureStadium: return GeoDataPlacemarkPrivate::tr("Stadium"); case LeisureTrack: return GeoDataPlacemarkPrivate::tr("Track"); case LeisureSwimmingPool: return GeoDataPlacemarkPrivate::tr("Swimming Pool"); case LeisureMinigolfCourse: return GeoDataPlacemarkPrivate::tr("Miniature Golf Course"); case LanduseAllotments: return GeoDataPlacemarkPrivate::tr("Allotments"); case LanduseBasin: return GeoDataPlacemarkPrivate::tr("Basin"); case LanduseCemetery: return GeoDataPlacemarkPrivate::tr("Cemetery"); case LanduseCommercial: return GeoDataPlacemarkPrivate::tr("Commercial"); case LanduseConstruction: return GeoDataPlacemarkPrivate::tr("Construction"); case LanduseFarmland: return GeoDataPlacemarkPrivate::tr("Farmland"); case LanduseFarmyard: return GeoDataPlacemarkPrivate::tr("Farmyard"); case LanduseGarages: return GeoDataPlacemarkPrivate::tr("Garages"); case LanduseGrass: return GeoDataPlacemarkPrivate::tr("Grass"); case LanduseIndustrial: return GeoDataPlacemarkPrivate::tr("Industrial"); case LanduseLandfill: return GeoDataPlacemarkPrivate::tr("Landfill"); case LanduseMeadow: return GeoDataPlacemarkPrivate::tr("Meadow"); case LanduseMilitary: return GeoDataPlacemarkPrivate::tr("Military"); case LanduseQuarry: return GeoDataPlacemarkPrivate::tr("Quarry"); case LanduseRailway: return GeoDataPlacemarkPrivate::tr("Railway"); case LanduseReservoir: return GeoDataPlacemarkPrivate::tr("Reservoir"); case LanduseResidential: return GeoDataPlacemarkPrivate::tr("Residential"); case LanduseRetail: return GeoDataPlacemarkPrivate::tr("Retail"); case LanduseOrchard: return GeoDataPlacemarkPrivate::tr("Orchard"); case LanduseVineyard: return GeoDataPlacemarkPrivate::tr("Vineyard"); case RailwayRail: return GeoDataPlacemarkPrivate::tr("Rail"); case RailwayNarrowGauge: return GeoDataPlacemarkPrivate::tr("Narrow Gauge"); case RailwayTram: return GeoDataPlacemarkPrivate::tr("Tram"); case RailwayLightRail: return GeoDataPlacemarkPrivate::tr("Light Rail"); case RailwayAbandoned: return GeoDataPlacemarkPrivate::tr("Abandoned Railway"); case RailwaySubway: return GeoDataPlacemarkPrivate::tr("Subway"); case RailwayPreserved: return GeoDataPlacemarkPrivate::tr("Preserved Railway"); case RailwayMiniature: return GeoDataPlacemarkPrivate::tr("Miniature Railway"); case RailwayConstruction: return GeoDataPlacemarkPrivate::tr("Railway Construction"); case RailwayMonorail: return GeoDataPlacemarkPrivate::tr("Monorail"); case RailwayFunicular: return GeoDataPlacemarkPrivate::tr("Funicular Railway"); case PowerTower: return GeoDataPlacemarkPrivate::tr("Power Tower"); case AdminLevel1: return GeoDataPlacemarkPrivate::tr("Admin Boundary (Level 1)"); case AdminLevel2: return GeoDataPlacemarkPrivate::tr("Admin Boundary (Level 2)"); case AdminLevel3: return GeoDataPlacemarkPrivate::tr("Admin Boundary (Level 3)"); case AdminLevel4: return GeoDataPlacemarkPrivate::tr("Admin Boundary (Level 4)"); case AdminLevel5: return GeoDataPlacemarkPrivate::tr("Admin Boundary (Level 5)"); case AdminLevel6: return GeoDataPlacemarkPrivate::tr("Admin Boundary (Level 6)"); case AdminLevel7: return GeoDataPlacemarkPrivate::tr("Admin Boundary (Level 7)"); case AdminLevel8: return GeoDataPlacemarkPrivate::tr("Admin Boundary (Level 8)"); case AdminLevel9: return GeoDataPlacemarkPrivate::tr("Admin Boundary (Level 9)"); case AdminLevel10: return GeoDataPlacemarkPrivate::tr("Admin Boundary (Level 10)"); case AdminLevel11: return GeoDataPlacemarkPrivate::tr("Admin Boundary (Level 11)"); case BoundaryMaritime: return GeoDataPlacemarkPrivate::tr("Boundary (Maritime)"); case Landmass: return GeoDataPlacemarkPrivate::tr("Land Mass"); case UrbanArea: return GeoDataPlacemarkPrivate::tr("Urban Area"); case InternationalDateLine: return GeoDataPlacemarkPrivate::tr("International Date Line"); case Bathymetry: return GeoDataPlacemarkPrivate::tr("Bathymetry"); case WaterwayCanal: return GeoDataPlacemarkPrivate::tr("Canal"); case WaterwayDrain: return GeoDataPlacemarkPrivate::tr("Drain"); case WaterwayDitch: return GeoDataPlacemarkPrivate::tr("Ditch"); case WaterwayStream: return GeoDataPlacemarkPrivate::tr("Stream"); case WaterwayRiver: return GeoDataPlacemarkPrivate::tr("River"); case Default: case Unknown: case None: case LastIndex: return QString(); } return QString(); } qreal GeoDataPlacemark::area() const { Q_D(const GeoDataPlacemark); return d->m_placemarkExtendedData ? d->m_placemarkExtendedData->m_area : -1.0; } void GeoDataPlacemark::setArea( qreal area ) { if (area == -1.0 && !d_func()->m_placemarkExtendedData) { return; // nothing to do } Q_D(GeoDataPlacemark); d->placemarkExtendedData().m_area = area; } qint64 GeoDataPlacemark::population() const { Q_D(const GeoDataPlacemark); return d->m_population; } void GeoDataPlacemark::setPopulation( qint64 population ) { Q_D(GeoDataPlacemark); d->m_population = population; } const QString GeoDataPlacemark::state() const { Q_D(const GeoDataPlacemark); return d->m_placemarkExtendedData ? d->m_placemarkExtendedData->m_state : QString(); } void GeoDataPlacemark::setState( const QString &state ) { if (state.isEmpty() && !d_func()->m_placemarkExtendedData) { return; // nothing to do } Q_D(GeoDataPlacemark); d->placemarkExtendedData().m_state = state; } const QString GeoDataPlacemark::countryCode() const { Q_D(const GeoDataPlacemark); return d->m_placemarkExtendedData ? d->m_placemarkExtendedData->m_countrycode : QString(); } void GeoDataPlacemark::setCountryCode( const QString &countrycode ) { if (countrycode.isEmpty() && !d_func()->m_placemarkExtendedData) { return; // nothing to do } Q_D(GeoDataPlacemark); d->placemarkExtendedData().m_countrycode = countrycode; } bool GeoDataPlacemark::isBalloonVisible() const { Q_D(const GeoDataPlacemark); return d->m_placemarkExtendedData ? d->m_placemarkExtendedData->m_isBalloonVisible : false; } void GeoDataPlacemark::setBalloonVisible( bool visible ) { if (!visible && !d_func()->m_placemarkExtendedData) { return; // nothing to do } Q_D(GeoDataPlacemark); d->placemarkExtendedData().m_isBalloonVisible = visible; } void GeoDataPlacemark::pack( QDataStream& stream ) const { Q_D(const GeoDataPlacemark); GeoDataFeature::pack( stream ); stream << d->placemarkExtendedData().m_countrycode; stream << d->placemarkExtendedData().m_area; stream << d->m_population; if (d->m_geometry) { stream << d->m_geometry->geometryId(); d->m_geometry->pack( stream ); } else { stream << InvalidGeometryId; } } QXmlStreamWriter& GeoDataPlacemark::pack( QXmlStreamWriter& stream ) const { stream.writeStartElement( "placemark" ); stream.writeEndElement(); return stream; } QXmlStreamWriter& GeoDataPlacemark::operator <<( QXmlStreamWriter& stream ) const { pack( stream ); return stream; } void GeoDataPlacemark::unpack( QDataStream& stream ) { Q_D(GeoDataPlacemark); GeoDataFeature::unpack( stream ); stream >> d->placemarkExtendedData().m_countrycode; stream >> d->placemarkExtendedData().m_area; stream >> d->m_population; int geometryId; stream >> geometryId; GeoDataGeometry *geometry = nullptr; switch( geometryId ) { case InvalidGeometryId: break; case GeoDataPointId: { GeoDataPoint* point = new GeoDataPoint; point->unpack( stream ); geometry = point; } break; case GeoDataLineStringId: { GeoDataLineString* lineString = new GeoDataLineString; lineString->unpack( stream ); geometry = lineString; } break; case GeoDataLinearRingId: { GeoDataLinearRing* linearRing = new GeoDataLinearRing; linearRing->unpack( stream ); geometry = linearRing; } break; case GeoDataPolygonId: { GeoDataPolygon* polygon = new GeoDataPolygon; polygon->unpack( stream ); geometry = polygon; } break; case GeoDataMultiGeometryId: { GeoDataMultiGeometry* multiGeometry = new GeoDataMultiGeometry; multiGeometry->unpack( stream ); geometry = multiGeometry; } break; case GeoDataModelId: break; default: break; }; if (geometry) { delete d->m_geometry; d->m_geometry = geometry; d->m_geometry->setParent(this); } } } diff --git a/src/lib/marble/geodata/data/GeoDataPlacemark.h b/src/lib/marble/geodata/data/GeoDataPlacemark.h index a5fb5107a..ef7890ef9 100644 --- a/src/lib/marble/geodata/data/GeoDataPlacemark.h +++ b/src/lib/marble/geodata/data/GeoDataPlacemark.h @@ -1,661 +1,664 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2006-2007 Torsten Rahn // Copyright 2007 Inge Wallin // Copyright 2008-2009 Patrick Spendrin // #ifndef MARBLE_GEODATAPLACEMARK_H #define MARBLE_GEODATAPLACEMARK_H #include #include "GeoDataCoordinates.h" #include "GeoDataFeature.h" #include "geodata_export.h" class QXmlStreamWriter; namespace Marble { class GeoDataPlacemarkPrivate; class OsmPlacemarkData; class GeoDataLookAt; class GeoDataPolygon; class GeoDataGeometry; /** * @short a class representing a point of interest on the map * * This class represents a point of interest, e.g. a city or a * mountain. It is filled with data by the KML or GPX loader and the * PlacemarkModel makes use of it. * * A Placemark can have an associated geometry which will be rendered to the map * along with the placemark's point icon. If you would like to render more than * one geometry for any one placemark than use @see setGeometry() to set add a * @see MultiGeometry. * * This is more or less only a GeoDataFeature with a geographic * position and a country code attached to it. The country code is * not provided in a KML file. */ class GEODATA_EXPORT GeoDataPlacemark: public GeoDataFeature { public: /** * Create a new placemark. */ GeoDataPlacemark(); /** * Create a new placemark from existing placemark @p placemark */ GeoDataPlacemark( const GeoDataPlacemark& placemark ); /** * Create a new placemark with the given @p name. */ explicit GeoDataPlacemark( const QString &name ); /** * Delete the placemark */ ~GeoDataPlacemark() override; GeoDataPlacemark &operator=( const GeoDataPlacemark &other ); /** * Equality operators. */ bool operator==( const GeoDataPlacemark& other ) const; bool operator!=( const GeoDataPlacemark& other ) const; const char* nodeType() const override; GeoDataFeature * clone() const override; /** * @brief A categorization of a placemark as defined by ...FIXME. * There is an additional osm tag mapping to GeoDataVisualCategory * in OsmPlacemarkData */ enum GeoDataVisualCategory { None, Default, Unknown, // The order of the cities needs to stay fixed as the // algorithms rely on that. SmallCity, SmallCountyCapital, SmallStateCapital, SmallNationCapital, MediumCity, MediumCountyCapital, MediumStateCapital, MediumNationCapital, BigCity, BigCountyCapital, BigStateCapital, BigNationCapital, LargeCity, LargeCountyCapital, LargeStateCapital, LargeNationCapital, Nation, // Terrain Mountain, Volcano, Mons, // m Valley, // v Continent, Ocean, OtherTerrain, // o // Space Terrain Crater, // c Mare, // a // Places of Interest GeographicPole, MagneticPole, ShipWreck, AirPort, Observatory, // Military MilitaryDangerArea, // Runners OsmSite, Coordinate, // Planets MannedLandingSite, // h RoboticRover, // r UnmannedSoftLandingSite, // u UnmannedHardLandingSite, // i Bookmark, Satellite, /* * Start of OpenStreetMap categories */ PlaceCity, PlaceCityCapital, + PlaceCityNationalCapital, PlaceSuburb, PlaceHamlet, PlaceLocality, PlaceTown, PlaceTownCapital, + PlaceTownNationalCapital, PlaceVillage, PlaceVillageCapital, + PlaceVillageNationalCapital, NaturalWater, NaturalReef, NaturalWood, NaturalBeach, NaturalWetland, NaturalGlacier, NaturalIceShelf, NaturalScrub, NaturalCliff, NaturalHeath, HighwayTrafficSignals, // OpenStreetMap highways HighwaySteps, HighwayUnknown, HighwayPath, HighwayFootway, HighwayTrack, HighwayPedestrian, HighwayCycleway, HighwayService, HighwayRoad, HighwayResidential, HighwayLivingStreet, HighwayUnclassified, HighwayTertiaryLink, HighwayTertiary, HighwaySecondaryLink, HighwaySecondary, HighwayPrimaryLink, HighwayPrimary, HighwayRaceway, HighwayTrunkLink, HighwayTrunk, HighwayMotorwayLink, HighwayMotorway, //OSM building Building, // OpenStreetMap category Accomodation AccomodationCamping, AccomodationHostel, AccomodationHotel, AccomodationMotel, AccomodationYouthHostel, AccomodationGuestHouse, // OpenStreetMap category Amenity AmenityLibrary, AmenityKindergarten, ///< @since 0.26.0 // OpenStreetMap category Education EducationCollege, EducationSchool, EducationUniversity, // OpenStreetMap category Food FoodBar, FoodBiergarten, FoodCafe, FoodFastFood, FoodPub, FoodRestaurant, // OpenStreetMap category Health HealthDentist, HealthDoctors, HealthHospital, HealthPharmacy, HealthVeterinary, // OpenStreetMap category Money MoneyAtm, MoneyBank, AmenityArchaeologicalSite, AmenityEmbassy, AmenityEmergencyPhone, AmenityWaterPark, AmenityCommunityCentre, AmenityFountain, AmenityNightClub, AmenityBench, AmenityCourtHouse, AmenityFireStation, AmenityHuntingStand, AmenityPolice, AmenityPostBox, AmenityPostOffice, AmenityPrison, AmenityRecycling, AmenityShelter, ///< @since 0.26.0 AmenityTelephone, AmenityToilets, AmenityTownHall, AmenityWasteBasket, AmenityDrinkingWater, AmenityGraveyard, AmenityChargingStation, // OpenStreetMap category Barrier BarrierCityWall, BarrierGate, BarrierLiftGate, BarrierWall, NaturalPeak, NaturalTree, NaturalCave, // OpenStreetMap category Shopping ShopBeverages, ShopHifi, ShopSupermarket, ShopAlcohol, ShopBakery, ShopButcher, ShopConfectionery, ShopConvenience, ShopGreengrocer, ShopSeafood, ShopDepartmentStore, ShopKiosk, ShopBag, ShopClothes, ShopFashion, ShopJewelry, ShopShoes, ShopVarietyStore, ShopBeauty, ShopChemist, ShopCosmetics, ShopHairdresser, ShopOptician, ShopPerfumery, ShopDoitYourself, ShopFlorist, ShopHardware, ShopFurniture, ShopElectronics, ShopMobilePhone, ShopBicycle, ShopCar, ShopCarRepair, ShopCarParts, ShopMotorcycle, ShopOutdoor, ShopSports, ShopCopy, ShopArt, ShopMusicalInstrument, ShopPhoto, ShopBook, ShopGift, ShopStationery, ShopLaundry, ShopPet, ShopToys, ShopTravelAgency, ShopDeli, ShopTobacco, ShopTea, Shop, ManmadeBridge, ManmadeLighthouse, ManmadePier, ManmadeWaterTower, ManmadeWindMill, // OpenStreetMap category Tourist TouristAttraction, TouristCastle, TouristCinema, TouristInformation, TouristMonument, TouristMuseum, TouristRuin, TouristTheatre, TouristThemePark, TouristViewPoint, TouristZoo, TouristAlpineHut, TouristWildernessHut, // OpenStreetMap category Historic HistoricMemorial, // OpenStreetMap category Transport TransportAerodrome, TransportHelipad, TransportAirportTerminal, TransportAirportGate, ///< @since 0.26.0 TransportAirportRunway, ///< @since 0.26.0 TransportAirportTaxiway, ///< @since 0.26.0 TransportAirportApron, ///< @since 0.26.0 TransportBusStation, TransportBusStop, TransportCarShare, TransportFuel, TransportParking, TransportParkingSpace, TransportPlatform, TransportRentalBicycle, TransportRentalCar, TransportTaxiRank, TransportTrainStation, TransportTramStop, TransportBicycleParking, TransportMotorcycleParking, TransportSubwayEntrance, TransportSpeedCamera, // OpenStreetMap category religion ReligionPlaceOfWorship, ReligionBahai, ReligionBuddhist, ReligionChristian, ReligionMuslim, ReligionHindu, ReligionJain, ReligionJewish, ReligionShinto, ReligionSikh, // OpenStreetMap category Leisure LeisureGolfCourse, LeisureMarina, ///< @since 0.26.0 LeisurePark, LeisurePlayground, LeisurePitch, LeisureSportsCentre, LeisureStadium, LeisureTrack, LeisureSwimmingPool, LeisureMinigolfCourse, LanduseAllotments, LanduseBasin, LanduseCemetery, LanduseCommercial, LanduseConstruction, LanduseFarmland, LanduseFarmyard, LanduseGarages, LanduseGrass, LanduseIndustrial, LanduseLandfill, LanduseMeadow, LanduseMilitary, LanduseQuarry, LanduseRailway, LanduseReservoir, LanduseResidential, LanduseRetail, LanduseOrchard, LanduseVineyard, RailwayRail, RailwayNarrowGauge, RailwayTram, RailwayLightRail, RailwayAbandoned, RailwaySubway, RailwayPreserved, RailwayMiniature, RailwayConstruction, RailwayMonorail, RailwayFunicular, // OpenStreetMap category Power PowerTower, // Waterways WaterwayCanal, WaterwayDitch, WaterwayDrain, WaterwayRiver, WaterwayStream, //Admin level tags for depicting boundary AdminLevel1, AdminLevel2, AdminLevel3, AdminLevel4, AdminLevel5, AdminLevel6, AdminLevel7, AdminLevel8, AdminLevel9, AdminLevel10, AdminLevel11, BoundaryMaritime, //Custom OSM Tags Landmass, UrbanArea, InternationalDateLine, Bathymetry, ///< @since 0.26.0 // Important: Make sure that this is always the last // item and just use it to specify the array size LastIndex }; /** * Return the symbol index of the placemark. */ GeoDataVisualCategory visualCategory() const; /** * Sets the symbol @p index of the placemark. * @param category the new category to be used. */ void setVisualCategory(GeoDataVisualCategory category); /** * Return the coordinates of the placemark at time @p dateTime as a GeoDataCoordinates * * The @p dateTime parameter should be used if the placemark geometry() is a * GeoDataTrack and thus contains several coordinates associated with a date and time. * * The @p iconAtCoordinates boolean is set to true if an icon should be drawn to * represent the placemark at these coordinates as described in * https://code.google.com/apis/kml/documentation/kmlreference.html#placemark, * it is set to false otherwise. * * @see GeoDataTrack::GeoDataTrack */ GeoDataCoordinates coordinate( const QDateTime &dateTime = QDateTime(), bool *iconAtCoordinates = 0 ) const; /** * The geometry of the GeoDataPlacemark is to be rendered to the marble map * along with the icon at the coordinate associated with this Placemark. * @return a pointer to the current Geometry object */ GeoDataGeometry* geometry(); const GeoDataGeometry* geometry() const; /** * @brief displays the name of a place in the locale language of the user */ QString displayName() const; /** * @since 0.26.0 */ QString categoryName() const; /** * Return the coordinates of the placemark as @p longitude, * @p latitude and @p altitude. */ void coordinate( qreal &longitude, qreal &latitude, qreal &altitude ) const; /** * Quick, safe accessor to the placemark's OsmPlacemarkData stored within it's * ExtendedData. If the extendedData does not contain osmData, the function * inserts a default-constructed one, and returns a reference to it. */ OsmPlacemarkData &osmData(); const OsmPlacemarkData &osmData() const; void setOsmData( const OsmPlacemarkData &osmData ); bool hasOsmData() const; /** * @since 0.26.0 */ void clearOsmData(); /** * Set the coordinate of the placemark in @p longitude and * @p latitude. */ void setCoordinate( qreal longitude, qreal latitude, qreal altitude = 0, GeoDataCoordinates::Unit _unit = GeoDataCoordinates::Radian ); /** * Set the coordinate of the placemark with an @p GeoDataPoint. */ void setCoordinate( const GeoDataCoordinates &coordinate ); /** * Sets the current Geometry of this Placemark. @see geometry() and the class * overview for description of the geometry concept. The geometry can be set * to any @see GeoDataGeometry like @see GeoDataPoint,@see GeoDataLineString, * @see GeoDataLinearRing and @see GeoDataMultiGeometry */ void setGeometry( GeoDataGeometry *entry ); /** * Return the area size of the feature in square km. * * FIXME: Once we make Marble more area-aware we need to * move this into the GeoDataArea class which will get * inherited from GeoDataPlacemark (or GeoDataFeature). */ qreal area() const; /** * Set the area size of the feature in square km. */ void setArea( qreal area ); /** * Return the population of the placemark. */ qint64 population() const; /** * Sets the @p population of the placemark. * @param population the new population value */ void setPopulation( qint64 population ); /** * Return the state of the placemark. */ const QString state() const; /** * Set the state @p state of the placemark. */ void setState( const QString &state ); /** * Return the country code of the placemark. */ const QString countryCode() const; /** * Set the country @p code of the placemark. */ void setCountryCode( const QString &code ); /** * Returns whether balloon is visible or not */ bool isBalloonVisible() const; /** * Set visibility of the balloon */ void setBalloonVisible( bool visible ); /** * Serialize the Placemark to a data stream. This is a binary serialisation * and is deserialised using @see unpack() * @param stream the QDataStream to serialise object to. */ void pack( QDataStream& stream ) const override; /** * Serialise this Placemark to a XML stream writer @see QXmlStreamWriter in * the Qt documentation for more info. This will output the XML * representation of this Placemark. The default XML format is KML, to have * other formats supported you need to create a subclass and override this * method. * @param stream the XML Stream Reader to output to. */ virtual QXmlStreamWriter& pack( QXmlStreamWriter& stream ) const; virtual QXmlStreamWriter& operator <<( QXmlStreamWriter& stream ) const; /** * Deserialize the Placemark from a data stream. This has the opposite effect * from @see pack() * @param stream the QDataStream to deserialise from. */ void unpack( QDataStream& stream ) override; /** * Returns GeoDataLookAt object if lookAt is setup earlier * otherwise It will convert GeoDataCoordinates of Placemark * to GeoDataLookAt with range equals to altitude of * GeoDataCoordinate */ const GeoDataLookAt *lookAt() const; GeoDataLookAt *lookAt(); static bool placemarkLayoutOrderCompare(const GeoDataPlacemark *a, const GeoDataPlacemark* b); private: Q_DECLARE_PRIVATE(GeoDataPlacemark) }; } #endif diff --git a/src/plugins/runner/osm/OsmNode.cpp b/src/plugins/runner/osm/OsmNode.cpp index b02426e49..e26aec020 100644 --- a/src/plugins/runner/osm/OsmNode.cpp +++ b/src/plugins/runner/osm/OsmNode.cpp @@ -1,113 +1,113 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2015 Dennis Nienhüser // #include #include "osm/OsmObjectManager.h" #include #include #include #include #include #include #include namespace Marble { void OsmNode::parseCoordinates(const QXmlStreamAttributes &attributes) { qreal const lon = attributes.value(QLatin1String("lon")).toDouble(); qreal const lat = attributes.value(QLatin1String("lat")).toDouble(); setCoordinates(GeoDataCoordinates(lon, lat, 0, GeoDataCoordinates::Degree)); } void OsmNode::setCoordinates(const GeoDataCoordinates &coordinates) { m_coordinates = coordinates; } void OsmNode::create(GeoDataDocument *document) const { GeoDataPlacemark::GeoDataVisualCategory const category = StyleBuilder::determineVisualCategory(m_osmData); if (category == GeoDataPlacemark::None) { return; } GeoDataPlacemark* placemark = new GeoDataPlacemark; placemark->setOsmData(m_osmData); auto coordinates = m_coordinates; coordinates.setAltitude(m_osmData.tagValue("ele").toDouble()); placemark->setCoordinate(coordinates); QHash::const_iterator tagIter; if ((category == GeoDataPlacemark::TransportCarShare || category == GeoDataPlacemark::MoneyAtm) && (tagIter = m_osmData.findTag(QStringLiteral("operator"))) != m_osmData.tagsEnd()) { placemark->setName(tagIter.value()); } else { placemark->setName(m_osmData.tagValue(QStringLiteral("name"))); } if (placemark->name().isEmpty()) { placemark->setName(m_osmData.tagValue(QStringLiteral("ref"))); } placemark->setVisualCategory(category); placemark->setZoomLevel(StyleBuilder::minimumZoomLevel(category)); placemark->setPopularity(StyleBuilder::popularity(placemark)); - if (category >= GeoDataPlacemark::PlaceCity && category <= GeoDataPlacemark::PlaceVillageCapital) { + if (category >= GeoDataPlacemark::PlaceCity && category <= GeoDataPlacemark::PlaceVillageNationalCapital) { int const population = m_osmData.tagValue(QStringLiteral("population")).toInt(); placemark->setPopulation(qMax(0, population)); if (population > 0) { placemark->setZoomLevel(populationIndex(population)); placemark->setPopularity(population); } } if (m_osmData.containsTagKey(QLatin1String("marbleZoomLevel"))) { int const zoomLevel = m_osmData.tagValue(QLatin1String("marbleZoomLevel")).toInt(); placemark->setZoomLevel(zoomLevel); } OsmObjectManager::registerId(m_osmData.id()); document->append(placemark); } int OsmNode::populationIndex(qint64 population) const { int popidx = 3; if ( population < 2500 ) popidx=10; else if ( population < 5000) popidx=9; else if ( population < 25000) popidx=8; else if ( population < 75000) popidx=7; else if ( population < 250000) popidx=6; else if ( population < 750000) popidx=5; else if ( population < 2500000) popidx=4; return popidx; } const GeoDataCoordinates &OsmNode::coordinates() const { return m_coordinates; } OsmPlacemarkData &OsmNode::osmData() { return m_osmData; } const OsmPlacemarkData &OsmNode::osmData() const { return m_osmData; } } diff --git a/tools/shp2osm/polyshp2osm.py b/tools/shp2osm/polyshp2osm.py index 951b774fb..f14513753 100644 --- a/tools/shp2osm/polyshp2osm.py +++ b/tools/shp2osm/polyshp2osm.py @@ -1,824 +1,832 @@ #!/usr/bin/python3 """ This script is designed to act as assistance in converting shapefiles to OpenStreetMap data. This file is optimized and tested with MassGIS shapefiles, converted to EPSG:4326 before being passed to the script. You can perform this conversion with ogr2ogr -t_srs EPSG:4326 new_file.shp old_file.shp It is expected that you will modify the fixed_tags, tag_mapping, and boring_tags attributes of this script before running. You should read, or at least skim, the code up until it says: DO NOT CHANGE AFTER THIS LINE. to accomodate your own data. """ __author__ = "Christopher Schmidt " __version__ = "$Id$" gdal_install = """ Installing GDAL depends on your platform. Information is available at: http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries For Debian-based systems: apt-get install python-gdal will usually suffice. """ # These tags are attached to all exterior ways. You can put any key/value pairs # in this dictionary. fixed_tags = {} feat_dict = {} node_dict = {} non_geom = 0 eflag = False nodes = [] #(id, lon, lat, tags) ways = [] #(id, node_refs, tags) relations = [] #(id, ways) element_indices = [] non_polygons = ['Admin-1 aggregation', 'Admin-1 minor island', 'Admin-1 scale rank'] # Here are a number of functions: These functions define tag mappings. The API # For these functions is that they are passed the attributes from a feature, # and they return a list of two-tuples which match to key/value pairs. def access(data): """Access restrictions.""" keys = { 'Y': 'yes', 'N': 'private', 'L': 'restricted' } if 'pub_access' in data: if data['pub_access'] in keys: return [('access', keys[data['pub_access']])] return None def protection(data): keys = { 'P': 'perpetuity', 'T': 'temporary', 'L': 'limited', } if 'lev_prot' in data: if data['lev_prot'] in keys: return [('protected', keys[data['lev_prot']])] return None def owner_type(data): """See wiki:Key:ownership""" keys = { 'F': 'national', 'S': 'state', 'C': 'county', 'M': 'municipal', 'N': 'private_nonprofit', 'P': 'private', 'B': 'public_nonprofit', 'L': 'land_trust', 'G': 'conservation_rganization', 'I': 'inholding', } if 'owner_type' in data: if data['owner_type'] in keys: return [['ownership', keys[data['owner_type']]]] def purpose(data): """Based on a discussion on IRC""" keys = { 'R': [('leisure', 'recreation_ground')], 'C': [('leisure', 'nature_reserve'), ('landuse', 'conservation')], 'B': [('landuse','conservation'), ('leisure','recreation_ground')], 'H': [('historical', 'yes')], 'A': [('agricultural', 'yes'), ('landuse','farm')], 'W': [('landuse', 'resevoir')], 'S': [('scenic','yes')], 'F': [('landuse','land')], 'Q': [('landuse','conservation')], 'U': [('water','yes')] } if 'prim_purp' in data: if data['prim_purp'] in keys: return keys[data['prim_purp']] def bathymetry_map(data): elevation = 0 if 'depth' in data: elevation = data['depth'] tag = [('marble:feature', 'bathymetry'), ('ele', elevation)] return tag def road_map(data): keys = { 'Ferry Route': [('route','ferry')], 'Major Highway': [('highway','motorway')], 'Beltway': [('highway','primary')], 'Track': [('highway','tertiary')], 'Unknown': [('highway','unclassified')], 'Secondary Highway': [('highway','trunk')], 'Bypass': [('highway','secondary')], 'Road': [('highway','primary')] } if 'type' in data: if data['type'] in keys: return keys[data['type']] def city_map(data): population = 0 capital = 'no' country = '' if data['featurecla'] == 'Admin-0 capital' or data['featurecla'] == 'Admin-1 capital' or data['featurecla'] == 'Admin-0 region capital' or data['featurecla'] == 'Admin-1 region capital': - capital = 'yes' + capital = 'yes' if 'pop_max' in data: population = data['pop_max'] if 'adm0name' in data: country = data['adm0name'] - temp = [('is_in:country', country), ('capital', capital), ('population', population), ('place', 'city') ] + + # National capitals in OSM are recongised by tag "admin_level"="2" ( http://wiki.openstreetmap.org/wiki/Key:capital#Using_relations_for_capitals ). + # In Natural Earth .shp files these capitals are tagged as "Admin-0 capital". + if data['featurecla'] == 'Admin-0 capital': + admin_level = "2" + temp = [('is_in:country', country), ('capital', capital), ('admin_level', admin_level), ('population', population), ('place', 'city')] + else: + temp = [('is_in:country', country), ('capital', capital), ('population', population), ('place', 'city')] + return temp def mountain_map(data): elevation = 0 if 'elevation' in data: elevation = data['elevation'] temp = [('natural', 'peak'), ('ele', elevation)] return temp def feature_class(data): global non_fcla_dict keys = { 'Lake': [('natural', 'water')], 'Alkaline Lake': [('natural', 'water')], 'Reservoir': [('natural', 'water')], 'Road': [(road_map,None)], 'Ferry': [('route','ferry')], 'River': [('waterway', 'river')], 'Coastline': [('natural', 'coastline')], 'Minor coastline': [('natural', 'coastline')], 'Ocean': [('natural', 'water')], 'Land': [('marble_land', 'landmass')], 'Minor island': [('marble_land', 'landmass'), ('place', 'island')], 'Reefs': [('natural', 'reef')], 'Admin-0 country': [('marble_land', 'landmass')], 'Admin-0 sovereignty': [('marble_land', 'landmass')], 'Admin-0 map unit': [('marble_land', 'landmass')], 'Adm-0 scale ranks': [('marble_land', 'landmass')], 'International boundary (verify)': [('boundary', 'administrative'), ('admin_level', '2')], 'Overlay limit': [('boundary', 'administrative'), ('admin_level', '2')], 'Disputed (please verify)': [('boundary', 'administrative'), ('admin_level', '2')], 'Line of control (please verify)': [('boundary', 'administrative'), ('admin_level', '2')], 'Indefinite (please verify)': [('boundary', 'administrative'), ('admin_level', '2')], 'Lease limit': [('boundary', 'administrative'), ('admin_level', '2')], 'Indeterminant frontier': [('boundary', 'administrative'), ('admin_level', '2')], 'Admin-0 lease': [('marble_land', 'landmass')], 'Admin-0 claim area': [('marble_land', 'landmass')], 'Admin-0 breakaway and disputed': [('marble_land', 'landmass')], 'Admin-0 overlay': [('marble_land', 'landmass')], 'Admin-0 indeterminant': [('marble_land', 'landmass')], 'Admin-1 aggregation': [('boundary', 'administrative'), ('admin_level', '4')], 'Admin-1 minor island': [('boundary', 'administrative'), ('admin_level', '4')], 'Admin-1 scale rank': [('boundary', 'administrative'), ('admin_level', '4')], 'Admin-1 region boundary': [('boundary', 'administrative'), ('admin_level', '4')], 'Railroad': [('railway', 'rail')], 'Railroad ferry': [('route', 'ferry')], 'Urban area': [('settlement', 'yes')], 'Timezone': [('marble_land', 'landmass')], 'Historic place': [(city_map,None)], 'Populated place': [(city_map,None)], 'Scientific station': [(city_map,None)], 'Meteorological Station': [(city_map,None)], 'Admin-0 capital': [(city_map,None)], 'Admin-1 capital': [(city_map,None)], 'Admin-0 region capital': [(city_map,None)], 'Admin-1 region capital': [(city_map,None)], 'Admin-0 capital alt': [(city_map,None)], 'Lake Centerline': [('waterway', 'river')], 'Port': [('harbour', 'yes')], 'Island': [('marble_land', 'landmass'), ('place', 'island')], 'Island group': [('marble_land', 'landmass'), ('place', 'island')], 'Wetlands': [('natural', 'wetland')], 'Basin': [('landuse', 'basin')], 'Desert': [('natural', 'desert')], #no tag support in marble, no clue as to how to render 'Depression': [('natural', 'sinkhole')], #no tag support in marble, no clue as to how to render 'Range/mtn': [('marble_land', 'landmass')], # no clue as to how to render 'Geoarea': [('marble_land', 'landmass')], # no clue as to how to render 'Plain' : [('marble_land', 'landmass')], # no clue as to how to render 'Tundra': [('natural', 'tundra')], #no tag support in marble, no clue as to how to render 'Foothills' : [('marble_land', 'landmass')], #no tag support in OSM, nothing in Marble, no clue as to how to render 'Lowland' : [('marble_land', 'landmass')], #no tag support in OSM, nothing in Marble, no clue as to how to render 'Dragons-be-here': [('marble_land', 'landmass')], #no tag support in OSM, nothing in Marble, no clue as to how to render 'Delta': [('marble_land', 'landmass')], #no tag support in OSM, nothing in Marble, no clue as to how to render 'Peninsula': [('marble_land', 'landmass')], 'Plateau' : [('marble_land', 'landmass')], 'Pen/cape' : [('natural', 'cape')], #osm tag still in proposal stage, no clue as to how to render 'Gorge': [('marble_land', 'landmass')], #no tag support in OSM, nothing in Marble, no clue as to how to render 'Coast': [('marble_land', 'landmass')], #no tag support in OSM, nothing in Marble, no clue as to how to render 'Continent': [('marble_land', 'landmass')], #no tag support in OSM, nothing in Marble, redundant data 'Isthmus': [('marble_land', 'landmass')], #no tag support in OSM, nothing in Marble, no clue as to how to render 'Valley': [('natural', 'valley')], #no tag support in marble 'waterfall' : [('waterway', 'waterfall')], #no tag support in marble 'cape': [('natural', 'cape')], #osm tag still in proposal stage, no clue as to how to render 'NONE' 'pole': [], 'plain': [], 'island group': [], 'island': [], 'mountain': [(mountain_map,None)], #this tag has to be mapped to Mountain feature of Marble 'spot elevation': [], 'plateau': [], 'depression': [], 'pass': [], 'sound': [('natural', 'water')], 'river': [('waterway', 'river')], 'generic': [('natural', 'water')], #still have to confirm what generic means exactly in marine_polygons? 'lagoon': [('natural', 'water'), ('water', 'lagoon')], 'reef': [('natural', 'reef')], 'gulf': [('natural', 'water')], 'inlet': [('natural', 'water')], 'strait': [('natural', 'water')], 'bay': [('natural', 'water')], 'fjord': [('natural', 'water')], 'sea': [('natural', 'water')], 'ocean': [('natural', 'water')], 'channel': [('natural', 'water')], 'Playa': [('natural', 'water'), ('water', 'lake'), ('salt', 'yes')], #glacier:type is a proposed OSM tag - http://wiki.openstreetmap.org/wiki/Proposed_features/Glaciers_tags 'Antarctic Ice Shelf': [('natural', 'glacier'), ('glacier:type','shelf')], 'Antarctic Ice Shelf Edge': [('glacier:edge', 'calving_line')], #marble does not support this osm tag 'Glaciated areas': [('natural', 'glacier')], 'Admin-0 Tiny Countries': [], 'Admin-0 Tiny GeoUnit': [], 'Admin-0 Tiny GeoSubunit': [], 'Admin-0 Tiny Countries Pacific': [], 'Pacific Groupings': [], 'Admin-1 boundary': [('boundary', 'administrative'), ('admin_level', '4')], 'Map unit boundary':[], 'Marine Indicator Treaty':[('boundary', 'administrative'), ('admin_level', '2'), ('maritime', 'yes'), ('border_type', 'territorial')], 'Marine Indicator Median':[('boundary', 'administrative'), ('admin_level', '2'), ('maritime', 'yes'), ('border_type', 'territorial')], 'Boundary Treaty':[('boundary', 'administrative'), ('admin_level', '2'), ('maritime', 'yes'), ('border_type', 'territorial')], 'Marine Indicator 200 mi nl':[('boundary', 'maritime'), ('border_type', 'eez')], 'Marine Indicator Disputed':[('boundary', 'administrative'), ('admin_level', '2'), ('maritime', 'yes'), ('border_type', 'territorial'), ('marble:disputed', 'yes')], 'Claim boundary': [('boundary', 'administrative'), ('admin_level', '2')], 'Reference line': [('boundary', 'administrative'), ('admin_level', '2')], 'Breakaway': [('boundary', 'administrative'), ('admin_level', '2')], 'Elusive frontier': [('boundary', 'administrative'), ('admin_level', '2')], 'Country': [('marble_land', 'landmass')], '1st Order Admin Lines': [('boundary', 'administrative'), ('admin_level', '4')], 'Claim': [('boundary', 'administrative'), ('admin_level', '4')], 'Airport': [('aeroway', 'aerodrome')], 'Date line': [('marble_line', 'date')], 'Bathymetry': [(bathymetry_map,None)] } if 'featurecla' in data: if data['featurecla'] in feat_dict: feat_dict[data['featurecla']] += 1 else: feat_dict[data['featurecla']] = 1 if data['featurecla'] in keys: if len(keys[data['featurecla']]) == 0: return keys[data['featurecla']] if hasattr(keys[data['featurecla']][0][0], '__call__'): return keys[data['featurecla']][0][0](data) else: return keys[data['featurecla']] else: if data['featurecla'] in non_fcla_dict: non_fcla_dict[data['featurecla']] += 1 else: non_fcla_dict[data['featurecla']] = 1 def name_map(data): if 'name' in data: return [('name', data['name'])] def name_tags(data): """This function returns two things: a 'pretty' name to use, and may return a landuse of either 'cemetery' or 'forest' if the name contains those words; based on evaluation the dataset in question.""" tags = [] name = data.get('site_name', None) if not name: return name = name.title() if "cemetery" in name.lower(): tags.append(['landuse', 'cemetery']) elif "forest" in name.lower(): tags.append(['landuse', 'forest']) tags.append(['name', name]) return tags def cal_date(data): """Return YYYY-MM-DD or YYYY formatted dates, based on (m)m/(d)d/yyyy dates""" date = data.get('cal_date_r', None) if not date: return try: m, d, y = map(int, date.split("/")) if m == 1 and d == 1: return [['start_date', '%4i' % y]] return [['start_date', '%04i-%02i-%02i' % (y, m, d)]] except: print("Invalid date: %s" % date) eflag = True return None # The most important part of the code: define a set of key/value pairs # to iterate over to generate keys. This is a list of two-tuples: first # is a 'key', which is only used if the second value is a string. In # that case, it is a map of lowercased fielnames to OSM tag names: so # fee_owner maps to 'owner' in the OSM output. # if the latter is callable (has a __call__; is a function), then that # method is called, passing in a dict of feature attributes with # lowercased key names. Those functions can then return a list of # two-tuples to be used as tags, or nothin' to skip the tags. tag_mapping = [ ('fee_owner', 'owner'), ('cal_date', cal_date), ('pub_access', access), ('lev_prot', protection), ('owner_type', owner_type), ('prim_purp', purpose), ('site_name', name_tags), ('featurecla', feature_class), ('name', name_map) ] # These tags are not exported, even with the source data; this should be # used for tags which are usually calculated in a GIS. AREA and LEN are # common. boring_tags = [ 'AREA', 'LEN', 'GIS_ACRES'] # Namespace is used to prefix existing data attributes. If 'None', or # '--no-source' is set, then source attributes are not exported, only # attributes in tag_mapping. namespace = "natural_earth" #namespace = None # Uncomment the "DONT_RUN = False" line to get started. #DONT_RUN = True DONT_RUN = False # =========== DO NOT CHANGE AFTER THIS LINE. =========================== # Below here is regular code, part of the file. This is not designed to # be modified by users. # ====================================================================== import sys try: try: from osgeo import ogr except ImportError: import ogr eflag = True except ImportError: __doc__ += gdal_install if DONT_RUN: print(__doc__) sys.exit(2) print("OGR Python Bindings not installed.\n%s" % gdal_install) sys.exit(1) eflag = True def close_file(): """ Internal. Close an open file.""" global open_file if not open_file.closed: open_file.write("") open_file.close() def start_new_file(): """ Internal. Open a new file, closing existing file if neccesary.""" global open_file, file_counter, node_dict, file_name file_counter += 1 if open_file: close_file() open_file = open("%s.%s.osm" % (file_name, file_counter), "w") print("" , end = '\n', file = open_file) print("" , end = '\n', file = open_file) node_dict = {} def write_osm_files(): global nodes, ways, relations, element_indices, open_file, file_counter, file_name current = [0, 0, 0] previous = [0, 0, 0] for indices in element_indices: start_new_file() current[0] = indices[0] - 1 current[1] = indices[1] - 1 current[2] = indices[2] - 1 while current[0] >= previous[0]: write_node(nodes[current[0]]) current[0] -= 1 while current[1] >= previous[1]: write_way(ways[current[1]]) current[1] -= 1 while current[2] >= previous[2]: write_relation_multipolygon(relations[current[2]]) current[2] -= 1 previous = indices[:] close_file() element_indices = [] def clean_attr(val): """Internal. Hacky way to make attribute XML safe.""" val = str(val) val = val.replace("&", "&").replace("'", """).replace("<", "<").replace(">", ">").strip() return val def check_featurecla(f): """ Checks if featurecla field is present in the feature f. If present it implies that shp data is from Natural Earth dataset """ if 'featurecla' in f.keys(): return True else: return False def add_point(f): """Adds a point geometry to the OSM file""" global id_counter airport_metadata = None pt = f.GetGeometryRef() if check_featurecla(f): if f['featurecla'] == 'Airport': airport_metadata = f f = None node_id = add_node(id_counter, pt.GetX(0), pt.GetY(0), 'POINT', f) if node_id == id_counter: id_counter += 1 if airport_metadata != None: add_way_around_node(airport_metadata) def add_relation_multipolygon(geom, f): """ Writes the multipolygon relation to the OSM file, returns 0 if no relation is formed""" global id_counter, file_counter, counter, file_name, open_file, namespace rel_ways = [] rel_id = 0 way_id = add_way(geom.GetGeometryRef(0), f, True) if way_id == None: print('Error in writing relation') return None rel_ways.append(way_id) if geom.GetGeometryCount() > 1: for i in range(1, geom.GetGeometryCount()): way_id = add_way(geom.GetGeometryRef(i), f, False) if way_id == None: print('Error in writing relation') return None rel_ways.append(way_id) rel_id = id_counter if check_featurecla(f): if f['featurecla'] in non_polygons: return 0 #means no relation is there relations.append((rel_id, rel_ways)) id_counter += 1 return rel_id #if rel_id return 0, means no relations is there def write_relation_multipolygon(relation): global open_file print("" % relation[0] , end = '\n', file = open_file) print('' % relation[1][0] , end = '\n', file = open_file) for way in relation[1][1:]: print('' % way , end = '\n', file = open_file) print("" , end = '\n', file = open_file) def write_tags(f): """Writes the tags associated with a way or a relation""" global id_counter, file_counter, counter, file_name, open_file, namespace field_count = f.GetFieldCount() fields = {} for field in range(field_count): value = f.GetFieldAsString(field) name = f.GetFieldDefnRef(field).GetName() if namespace and name and value and name not in boring_tags: print(" " % (namespace, name, clean_attr(value)) , end = '\n', file = open_file) fields[name.lower()] = value tags={} for tag_name, map_value in tag_mapping: if hasattr(map_value, '__call__'): tag_values = map_value(fields) if tag_values: for tag in tag_values: tags[tag[0]] = tag[1] else: if tag_name in fields: tags[map_value] = fields[tag_name].title() for key, value in tags.items(): if key and value: print(" " % (key, clean_attr(value)) , end = '\n', file = open_file) for name, value in fixed_tags.items(): print(" " % (name, clean_attr(value)) , end = '\n', file = open_file) if f.GetGeometryRef().GetGeometryName() == 'POLYGON' or f.GetGeometryRef().GetGeometryName() == 'MULTIPOLYGON': if check_featurecla(f): if f['featurecla'] not in non_polygons: print(" " , end = '\n', file = open_file) def add_way(geom, f, tag_flag): """ Writes the way of a particular geometry to the OSM file""" global open_file, id_counter, ways ids = add_way_nodes(geom, f) if len(ids) == 0: print('Error in writing way') return None way_id = id_counter id_counter += 1 node_refs = ids if tag_flag: tags = f else: tags = None ways.append((way_id, node_refs, tags)) return way_id def write_way(way): global open_file print("" % way[0] , end = '\n', file = open_file) for i in way[1]: print(" " % i , end = '\n', file = open_file) if way[2]: write_tags(way[2]) print("", end = '\n', file = open_file) def add_way_nodes(geom, f): """Writes the nodes of a particular way""" global open_file, id_counter ids = [] geom_name = geom.GetGeometryName() pt_count = geom.GetPointCount() if geom_name == 'LINESTRING': range_count = range(geom.GetPointCount()) else: range_count = range(geom.GetPointCount() - 1) if range_count == 0 or pt_count == 0: print( "Degenerate ", geom_name , end = '\n', file = sys.stderr) return #if geom_name != 'LINESTRING': # pt_count -= 1 for count in range(pt_count): node_id = add_node(id_counter, geom.GetX(count), geom.GetY(count), geom_name, f) if node_id == id_counter: #means a new node is created, if not means node already exists id_counter += 1 ids.append(node_id) return ids def add_node(num_id, lon, lat, geom_name, f): """ Writes the node to the OSM file""" global open_file, node_dict key = (lon, lat) if geom_name == 'POINT': nodes.append((num_id, lon, lat, f)) node_dict[key] = num_id else: if key in node_dict: num_id = node_dict[key] else: nodes.append((num_id, lon, lat, None)) node_dict[key] = num_id return num_id def write_node(node): global open_file if node[3] == None: print("".format(node[0], node[1], node[2]), end = '\n', file = open_file) else: print("".format(node[0], node[1], node[2]), end = '\n', file = open_file) write_tags(node[3]) print("", end = '\n', file = open_file) def add_way_around_node(f): """ Writes a way around a single point""" global id_counter, ways nid = id_counter - 1 ways.append((id_counter, [nid], f)) id_counter += 1 open_file = None file_name = None id_counter = 1 file_counter = 0 counter = 0 geom_counter = {} class AppError(Exception): pass def run(filenames, slice_count=1, obj_count=5000000, output_location=None, no_source=False): """Run the converter. Requires open_file, file_name, id_counter, file_counter, counter to be defined in global space; not really a very good singleton.""" global id_counter, file_counter, counter, file_name, open_file, namespace, non_geom, non_fcla_dict, nodes, ways, relations, geom_counter open_file = None file_name = None id_counter = 1 file_counter = 0 counter = 0 geom_counter = {} node_dict = {} if output_location: file_name = output_location # start_new_file() for filename in filenames: non_geom = 0 non_fcla_dict = {} if no_source: namespace=None ds = ogr.Open(filename) if not ds: raise AppError("OGR Could not open the file %s" % filename) eflag = True l = ds.GetLayer(0) max_objs_per_file = obj_count extent = l.GetExtent() #if extent[0] < -180 or extent[0] > 180 or extent[2] < -90 or extent[2] > 90: # raise AppError("Extent does not look like degrees; are you sure it is? \n(%s, %s, %s, %s)" % (extent[0], extent[2], extent[1], extent[3])) slice_width = (extent[1] - extent[0]) / slice_count seen = {} print("Running %s slices with %s base filename against shapefile %s" % ( slice_count, file_name, filename)) for i in range(slice_count): l.ResetReading() l.SetSpatialFilterRect(extent[0] + slice_width * i, extent[2], extent[0] + (slice_width * (i + 1)), extent[3]) #start_new_file() f = l.GetNextFeature() obj_counter = 0 last_obj_split = 0 while f: start_id_counter = id_counter if f.GetFID() in seen: f = l.GetNextFeature() continue seen[f.GetFID()] = True if (obj_counter - last_obj_split) > max_objs_per_file: print("Splitting file with %s objs" % (obj_counter - last_obj_split)) #start_new_file() last_obj_split = obj_counter element_indices.append((len(nodes), len(ways), len(relations))) node_dict = {} feat_dict = f.items() geom = f.GetGeometryRef() geom_name = geom.GetGeometryName() if geom_name in geom_counter: geom_counter[geom_name] += 1 else: geom_counter[geom_name] = 1 if geom_name == 'POLYGON': rel_id = add_relation_multipolygon(geom, f) if rel_id == None: f = l.GetNextFeature() continue elif geom_name == 'LINESTRING': way_id = add_way(geom, f, True) if way_id == None: f = l.GetNextFeature() continue elif geom_name == 'MULTILINESTRING': for i in range(geom.GetGeometryCount()): way_id = add_way(geom.GetGeometryRef(i), f, True) if way_id == None: f = l.GetNextFeature() continue elif geom_name == 'MULTIPOLYGON': for i in range(geom.GetGeometryCount()): rel_id = add_relation_multipolygon(geom.GetGeometryRef(i), f) if rel_id == None: f = l.GetNextFeature() continue elif geom_name == 'POINT': add_point(f) else: ids = [] non_geom += 1 counter += 1 f = l.GetNextFeature() obj_counter += (id_counter - start_id_counter) # for node in nodes: # write_node(node) # for way in ways: # write_way(way) # for relation in relations: # write_relation_multipolygon(relation) element_indices.append((len(nodes), len(ways), len(relations))) write_osm_files() # close_file() nodes = [] #(id, lon, lat, tags) ways = [] #(id, node_refs, tags) relations = [] #(id, ways) if __name__ == "__main__": if DONT_RUN: print(__doc__) sys.exit(2) from optparse import OptionParser parse = OptionParser(usage="%prog [args] filename.shp", version=__version__) parse.add_option("-s", "--slice-count", dest="slice_count", help="Number of horizontal slices of data", default=1, action="store", type="int") parse.add_option("-o", "--obj-count", dest="obj_count", help="Target Maximum number of objects in a single .osm file", default=5000000, type="int") parse.add_option("-n", "--no-source", dest="no_source", help="Do not store source attributes as tags.", action="store_true", default=False) parse.add_option("-l", "--output-location", dest="output_location", help="base filepath for output files.", default="poly_output") (options, args) = parse.parse_args() if not len(args): print("No shapefile name given!") parse.print_help() sys.exit(3) kw = {} for key in ('slice_count', 'obj_count', 'output_location', 'no_source'): kw[key] = getattr(options, key) try: run(args, **kw) except AppError as E: print("An error occurred: \n%s" % E) eflag = True print() print('Geometry types present: ') for key in geom_counter: print(key, geom_counter[key]) print() print('Feature type present: ') for key in feat_dict: print(key, feat_dict[key]) print() if eflag: print('Conversion not Successful :') else: if len(non_fcla_dict) == 0 and non_geom == 0: print('Conversion Successful') else: print('Conversion not Successful :') if len(non_fcla_dict) != 0: print('Unknown features present in SHP file: ', len(non_fcla_dict)) print() for key in non_fcla_dict: print(key, non_fcla_dict[key]) if non_geom != 0: print('Unknown geometry present in SHP file: ', non_geom) diff --git a/tools/vectorosm-tilecreator/SpellChecker.cpp b/tools/vectorosm-tilecreator/SpellChecker.cpp index 6e7bdd8cc..ec6fef3d0 100644 --- a/tools/vectorosm-tilecreator/SpellChecker.cpp +++ b/tools/vectorosm-tilecreator/SpellChecker.cpp @@ -1,187 +1,190 @@ // // This file is part of the Marble Virtual Globe. // // This program is free software licensed under the GNU LGPL. You can // find a copy of this license in LICENSE.txt in the top directory of // the source code. // // Copyright 2016 Dennis Nienhüser // #include "SpellChecker.h" #include "GeoDataPlacemark.h" #include "MarbleMath.h" #include "OsmPlacemarkData.h" #include "MarbleDirs.h" #include "MarbleModel.h" #include "ParsingRunnerManager.h" #include "GeoSceneMercatorTileProjection.h" #include "TileId.h" #include #include #include namespace Marble { SpellChecker::SpellChecker(const QString &citiesFile) : m_tileLevel(10), m_tileHash(parseCities(citiesFile)), m_verbose(false) { // nothing to do } void SpellChecker::correctPlaceLabels(const QVector &placemarks) { auto places = cityPlaces(placemarks); double const maxDistance = 5000.0 / EARTH_RADIUS; int hits = 0; int validated = 0; int misses = 0; for (auto place: places) { auto const places = candidatesFor(place); bool hasMatch = false; bool isValid = false; QString const placeName = place->name(); if (!places.isEmpty()) { auto match = places.first(); if (match->name() == place->name()) { ++validated; isValid = true; } else { if (distanceSphere(match->coordinate(), place->coordinate()) < maxDistance) { if (levenshteinDistance(places.first()->name(), placeName) < 6) { if (m_verbose) { qDebug() << "Correcting" << placeName << "to" << match->name(); } place->setName(match->name()); place->osmData().removeTag("name"); place->osmData().addTag("name", match->name()); hasMatch = true; } } if (m_verbose && !hasMatch) { qDebug() << "No match for " << placeName << ", candidates: "; for (auto candidate: places) { qDebug() << distanceSphere(candidate->coordinate(), place->coordinate()) * EARTH_RADIUS << " m, " << "levenshtein distance " << levenshteinDistance(placeName, candidate->name()) << ":" << candidate->name(); } } } } else if (m_verbose) { qDebug() << "No match for " << placeName << " at " << place->coordinate().toString(GeoDataCoordinates::Decimal) << " and no candidates for replacement"; } hits += hasMatch ? 1 : 0; misses += (hasMatch || isValid) ? 0 : 1; } if (m_verbose) { qDebug() << "In total there are " << hits << " corrections, " << validated << " validations and " << misses << " misses"; } } void SpellChecker::setVerbose(bool verbose) { m_verbose = verbose; } QVector SpellChecker::cityPlaces(const QVector &placemarks) const { QSet categories; categories << GeoDataPlacemark::PlaceCity; categories << GeoDataPlacemark::PlaceCityCapital; + categories << GeoDataPlacemark::PlaceCityNationalCapital; categories << GeoDataPlacemark::PlaceSuburb; categories << GeoDataPlacemark::PlaceHamlet; categories << GeoDataPlacemark::PlaceLocality; categories << GeoDataPlacemark::PlaceTown; categories << GeoDataPlacemark::PlaceTownCapital; + categories << GeoDataPlacemark::PlaceTownNationalCapital; categories << GeoDataPlacemark::PlaceVillage; categories << GeoDataPlacemark::PlaceVillageCapital; + categories << GeoDataPlacemark::PlaceVillageNationalCapital; QVector places; std::copy_if(placemarks.begin(), placemarks.end(), std::back_inserter(places), [categories] (GeoDataPlacemark* placemark) { return categories.contains(placemark->visualCategory()); }); return places; } QHash > SpellChecker::parseCities(const QString &filename) const { QHash > placeLabels; QFile file(filename); if (!file.open(QIODevice::ReadOnly)) { qDebug() << "Cannot open " << filename << ":" << file.errorString(); return placeLabels; } while (!file.atEnd()) { QByteArray line = file.readLine(); auto const values = line.split('\t'); if (values.size() > 15) { GeoDataPlacemark* city = new GeoDataPlacemark; city->setName(values[1]); bool ok; double const lon = values[5].toDouble(&ok); if (!ok) { qDebug() << values[5] << " is no longitude"; continue; } double const lat = values[4].toDouble(&ok); if (!ok) { qDebug() << values[4] << " is no latitude"; continue; } double const ele = values[15].toDouble(); auto const coordinate = GeoDataCoordinates(lon, lat, ele, GeoDataCoordinates::Degree); city->setCoordinate(coordinate); auto const tile = TileId::fromCoordinates(coordinate, m_tileLevel); placeLabels[tile] << city; } } return placeLabels; } int SpellChecker::levenshteinDistance(const QString &a, const QString &b) { // From https://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance unsigned int const len1 = a.size(), len2 = b.size(); std::vector> distance(len1 + 1, std::vector(len2 + 1)); distance[0][0] = 0; for(unsigned int i = 1; i <= len1; ++i) { distance[i][0] = i; } for(unsigned int i = 1; i <= len2; ++i) { distance[0][i] = i; } for(unsigned int i = 1; i <= len1; ++i) { for(unsigned int j = 1; j <= len2; ++j) { distance[i][j] = std::min({ distance[i - 1][j] + 1, distance[i][j - 1] + 1, distance[i - 1][j - 1] + (a[i - 1] == b[j - 1] ? 0 : 1) }); } } return distance[len1][len2]; } QVector SpellChecker::candidatesFor(GeoDataPlacemark *placemark) const { int const N = pow(2, m_tileLevel); auto const tile = TileId::fromCoordinates(placemark->coordinate(), m_tileLevel); QVector places; for (int x=qMax(0, tile.x()-1); xname(); std::sort(places.begin(), places.end(), [placeName] (GeoDataPlacemark* a, GeoDataPlacemark* b) { return levenshteinDistance(a->name(), placeName) < levenshteinDistance(b->name(), placeName); }); return places; } }