Commit 02d3b07a authored by Bernhard Beschow's avatar Bernhard Beschow

move render order code from GeometryLayer to StyleBuilder

Vector themes might want to change the priority of rendered visual categories. Therefore, the render order should be part of the vector theme.
parent c0d81846
This diff is collapsed.
......@@ -38,8 +38,16 @@ public:
GeoDataStyle::ConstPtr createStyle(const StyleParameters &parameters) const;
GeoDataStyle::ConstPtr presetStyle(GeoDataFeature::GeoDataVisualCategory visualCategory) const;
/**
* @brief Returns the order in which the visual categories used in the theme shall be painted on the map.
* @return order in which the visual categories shall be painted on the map
*/
QStringList renderOrder() const;
void reset();
static QString visualCategoryName(GeoDataFeature::GeoDataVisualCategory category);
private:
Q_DISABLE_COPY(StyleBuilder)
......
......@@ -168,299 +168,6 @@ QSharedPointer<const GeoDataStyle> GeoDataFeature::presetStyle( GeoDataVisualCat
return GeoDataFeaturePrivate::s_styleBuilder.presetStyle(category);
}
QString GeoDataFeature::visualCategoryName(GeoDataFeature::GeoDataVisualCategory category)
{
static QHash<GeoDataFeature::GeoDataVisualCategory, QString> s_visualCategoryNames;
if (s_visualCategoryNames.isEmpty()) {
s_visualCategoryNames[None] = "None";
s_visualCategoryNames[Default] = "Default";
s_visualCategoryNames[Unknown] = "Unknown";
s_visualCategoryNames[SmallCity] = "SmallCity";
s_visualCategoryNames[SmallCountyCapital] = "SmallCountyCapital";
s_visualCategoryNames[SmallStateCapital] = "SmallStateCapital";
s_visualCategoryNames[SmallNationCapital] = "SmallNationCapital";
s_visualCategoryNames[MediumCity] = "MediumCity";
s_visualCategoryNames[MediumCountyCapital] = "MediumCountyCapital";
s_visualCategoryNames[MediumStateCapital] = "MediumStateCapital";
s_visualCategoryNames[MediumNationCapital] = "MediumNationCapital";
s_visualCategoryNames[BigCity] = "BigCity";
s_visualCategoryNames[BigCountyCapital] = "BigCountyCapital";
s_visualCategoryNames[BigStateCapital] = "BigStateCapital";
s_visualCategoryNames[BigNationCapital] = "BigNationCapital";
s_visualCategoryNames[LargeCity] = "LargeCity";
s_visualCategoryNames[LargeCountyCapital] = "LargeCountyCapital";
s_visualCategoryNames[LargeStateCapital] = "LargeStateCapital";
s_visualCategoryNames[LargeNationCapital] = "LargeNationCapital";
s_visualCategoryNames[Nation] = "Nation";
s_visualCategoryNames[PlaceCity] = "PlaceCity";
s_visualCategoryNames[PlaceSuburb] = "PlaceSuburb";
s_visualCategoryNames[PlaceHamlet] = "PlaceHamlet";
s_visualCategoryNames[PlaceLocality] = "PlaceLocality";
s_visualCategoryNames[PlaceTown] = "PlaceTown";
s_visualCategoryNames[PlaceVillage] = "PlaceVillage";
s_visualCategoryNames[Mountain] = "Mountain";
s_visualCategoryNames[Volcano] = "Volcano";
s_visualCategoryNames[Mons] = "Mons";
s_visualCategoryNames[Valley] = "Valley";
s_visualCategoryNames[Continent] = "Continent";
s_visualCategoryNames[Ocean] = "Ocean";
s_visualCategoryNames[OtherTerrain] = "OtherTerrain";
s_visualCategoryNames[Crater] = "Crater";
s_visualCategoryNames[Mare] = "Mare";
s_visualCategoryNames[GeographicPole] = "GeographicPole";
s_visualCategoryNames[MagneticPole] = "MagneticPole";
s_visualCategoryNames[ShipWreck] = "ShipWreck";
s_visualCategoryNames[AirPort] = "AirPort";
s_visualCategoryNames[Observatory] = "Observatory";
s_visualCategoryNames[MilitaryDangerArea] = "MilitaryDangerArea";
s_visualCategoryNames[Wikipedia] = "Wikipedia";
s_visualCategoryNames[OsmSite] = "OsmSite";
s_visualCategoryNames[Coordinate] = "Coordinate";
s_visualCategoryNames[MannedLandingSite] = "MannedLandingSite";
s_visualCategoryNames[RoboticRover] = "RoboticRover";
s_visualCategoryNames[UnmannedSoftLandingSite] = "UnmannedSoftLandingSite";
s_visualCategoryNames[UnmannedHardLandingSite] = "UnmannedHardLandingSite";
s_visualCategoryNames[Folder] = "Folder";
s_visualCategoryNames[Bookmark] = "Bookmark";
s_visualCategoryNames[NaturalWater] = "NaturalWater";
s_visualCategoryNames[NaturalReef] = "NaturalReef";
s_visualCategoryNames[NaturalWood] = "NaturalWood";
s_visualCategoryNames[NaturalBeach] = "NaturalBeach";
s_visualCategoryNames[NaturalWetland] = "NaturalWetland";
s_visualCategoryNames[NaturalGlacier] = "NaturalGlacier";
s_visualCategoryNames[NaturalIceShelf] = "NaturalIceShelf";
s_visualCategoryNames[NaturalScrub] = "NaturalScrub";
s_visualCategoryNames[NaturalCliff] = "NaturalCliff";
s_visualCategoryNames[NaturalHeath] = "NaturalHeath";
s_visualCategoryNames[HighwayTrafficSignals] = "HighwayTrafficSignals";
s_visualCategoryNames[HighwaySteps] = "HighwaySteps";
s_visualCategoryNames[HighwayUnknown] = "HighwayUnknown";
s_visualCategoryNames[HighwayPath] = "HighwayPath";
s_visualCategoryNames[HighwayFootway] = "HighwayFootway";
s_visualCategoryNames[HighwayTrack] = "HighwayTrack";
s_visualCategoryNames[HighwayPedestrian] = "HighwayPedestrian";
s_visualCategoryNames[HighwayCycleway] = "HighwayCycleway";
s_visualCategoryNames[HighwayService] = "HighwayService";
s_visualCategoryNames[HighwayRoad] = "HighwayRoad";
s_visualCategoryNames[HighwayResidential] = "HighwayResidential";
s_visualCategoryNames[HighwayLivingStreet] = "HighwayLivingStreet";
s_visualCategoryNames[HighwayUnclassified] = "HighwayUnclassified";
s_visualCategoryNames[HighwayTertiaryLink] = "HighwayTertiaryLink";
s_visualCategoryNames[HighwayTertiary] = "HighwayTertiary";
s_visualCategoryNames[HighwaySecondaryLink] = "HighwaySecondaryLink";
s_visualCategoryNames[HighwaySecondary] = "HighwaySecondary";
s_visualCategoryNames[HighwayPrimaryLink] = "HighwayPrimaryLink";
s_visualCategoryNames[HighwayPrimary] = "HighwayPrimary";
s_visualCategoryNames[HighwayTrunkLink] = "HighwayTrunkLink";
s_visualCategoryNames[HighwayTrunk] = "HighwayTrunk";
s_visualCategoryNames[HighwayMotorwayLink] = "HighwayMotorwayLink";
s_visualCategoryNames[HighwayMotorway] = "HighwayMotorway";
s_visualCategoryNames[Building] = "Building";
s_visualCategoryNames[AccomodationCamping] = "AccomodationCamping";
s_visualCategoryNames[AccomodationHostel] = "AccomodationHostel";
s_visualCategoryNames[AccomodationHotel] = "AccomodationHotel";
s_visualCategoryNames[AccomodationMotel] = "AccomodationMotel";
s_visualCategoryNames[AccomodationYouthHostel] = "AccomodationYouthHostel";
s_visualCategoryNames[AccomodationGuestHouse] = "AccomodationGuestHouse";
s_visualCategoryNames[AmenityLibrary] = "AmenityLibrary";
s_visualCategoryNames[EducationCollege] = "EducationCollege";
s_visualCategoryNames[EducationSchool] = "EducationSchool";
s_visualCategoryNames[EducationUniversity] = "EducationUniversity";
s_visualCategoryNames[FoodBar] = "FoodBar";
s_visualCategoryNames[FoodBiergarten] = "FoodBiergarten";
s_visualCategoryNames[FoodCafe] = "FoodCafe";
s_visualCategoryNames[FoodFastFood] = "FoodFastFood";
s_visualCategoryNames[FoodPub] = "FoodPub";
s_visualCategoryNames[FoodRestaurant] = "FoodRestaurant";
s_visualCategoryNames[HealthDentist] = "HealthDentist";
s_visualCategoryNames[HealthDoctors] = "HealthDoctors";
s_visualCategoryNames[HealthHospital] = "HealthHospital";
s_visualCategoryNames[HealthPharmacy] = "HealthPharmacy";
s_visualCategoryNames[HealthVeterinary] = "HealthVeterinary";
s_visualCategoryNames[MoneyAtm] = "MoneyAtm";
s_visualCategoryNames[MoneyBank] = "MoneyBank";
s_visualCategoryNames[AmenityArchaeologicalSite] = "AmenityArchaeologicalSite";
s_visualCategoryNames[AmenityEmbassy] = "AmenityEmbassy";
s_visualCategoryNames[AmenityEmergencyPhone] = "AmenityEmergencyPhone";
s_visualCategoryNames[AmenityWaterPark] = "AmenityWaterPark";
s_visualCategoryNames[AmenityCommunityCentre] = "AmenityCommunityCentre";
s_visualCategoryNames[AmenityFountain] = "AmenityFountain";
s_visualCategoryNames[AmenityNightClub] = "AmenityNightClub";
s_visualCategoryNames[AmenityBench] = "AmenityBench";
s_visualCategoryNames[AmenityCourtHouse] = "AmenityCourtHouse";
s_visualCategoryNames[AmenityFireStation] = "AmenityFireStation";
s_visualCategoryNames[AmenityHuntingStand] = "AmenityHuntingStand";
s_visualCategoryNames[AmenityPolice] = "AmenityPolice";
s_visualCategoryNames[AmenityPostBox] = "AmenityPostBox";
s_visualCategoryNames[AmenityPostOffice] = "AmenityPostOffice";
s_visualCategoryNames[AmenityPrison] = "AmenityPrison";
s_visualCategoryNames[AmenityRecycling] = "AmenityRecycling";
s_visualCategoryNames[AmenityTelephone] = "AmenityTelephone";
s_visualCategoryNames[AmenityToilets] = "AmenityToilets";
s_visualCategoryNames[AmenityTownHall] = "AmenityTownHall";
s_visualCategoryNames[AmenityWasteBasket] = "AmenityWasteBasket";
s_visualCategoryNames[AmenityDrinkingWater] = "AmenityDrinkingWater";
s_visualCategoryNames[AmenityGraveyard] = "AmenityGraveyard";
s_visualCategoryNames[BarrierCityWall] = "BarrierCityWall";
s_visualCategoryNames[BarrierGate] = "BarrierGate";
s_visualCategoryNames[BarrierLiftGate] = "BarrierLiftGate";
s_visualCategoryNames[BarrierWall] = "BarrierWall";
s_visualCategoryNames[NaturalPeak] = "NaturalPeak";
s_visualCategoryNames[NaturalTree] = "NaturalTree";
s_visualCategoryNames[ShopBeverages] = "ShopBeverages";
s_visualCategoryNames[ShopHifi] = "ShopHifi";
s_visualCategoryNames[ShopSupermarket] = "ShopSupermarket";
s_visualCategoryNames[ShopAlcohol] = "ShopAlcohol";
s_visualCategoryNames[ShopBakery] = "ShopBakery";
s_visualCategoryNames[ShopButcher] = "ShopButcher";
s_visualCategoryNames[ShopConfectionery] = "ShopConfectionery";
s_visualCategoryNames[ShopConvenience] = "ShopConvenience";
s_visualCategoryNames[ShopGreengrocer] = "ShopGreengrocer";
s_visualCategoryNames[ShopSeafood] = "ShopSeafood";
s_visualCategoryNames[ShopDepartmentStore] = "ShopDepartmentStore";
s_visualCategoryNames[ShopKiosk] = "ShopKiosk";
s_visualCategoryNames[ShopBag] = "ShopBag";
s_visualCategoryNames[ShopClothes] = "ShopClothes";
s_visualCategoryNames[ShopFashion] = "ShopFashion";
s_visualCategoryNames[ShopJewelry] = "ShopJewelry";
s_visualCategoryNames[ShopShoes] = "ShopShoes";
s_visualCategoryNames[ShopVarietyStore] = "ShopVarietyStore";
s_visualCategoryNames[ShopBeauty] = "ShopBeauty";
s_visualCategoryNames[ShopChemist] = "ShopChemist";
s_visualCategoryNames[ShopCosmetics] = "ShopCosmetics";
s_visualCategoryNames[ShopHairdresser] = "ShopHairdresser";
s_visualCategoryNames[ShopOptician] = "ShopOptician";
s_visualCategoryNames[ShopPerfumery] = "ShopPerfumery";
s_visualCategoryNames[ShopDoitYourself] = "ShopDoitYourself";
s_visualCategoryNames[ShopFlorist] = "ShopFlorist";
s_visualCategoryNames[ShopHardware] = "ShopHardware";
s_visualCategoryNames[ShopFurniture] = "ShopFurniture";
s_visualCategoryNames[ShopElectronics] = "ShopElectronics";
s_visualCategoryNames[ShopMobilePhone] = "ShopMobilePhone";
s_visualCategoryNames[ShopBicycle] = "ShopBicycle";
s_visualCategoryNames[ShopCar] = "ShopCar";
s_visualCategoryNames[ShopCarRepair] = "ShopCarRepair";
s_visualCategoryNames[ShopCarParts] = "ShopCarParts";
s_visualCategoryNames[ShopMotorcycle] = "ShopMotorcycle";
s_visualCategoryNames[ShopOutdoor] = "ShopOutdoor";
s_visualCategoryNames[ShopMusicalInstrument] = "ShopMusicalInstrument";
s_visualCategoryNames[ShopPhoto] = "ShopPhoto";
s_visualCategoryNames[ShopBook] = "ShopBook";
s_visualCategoryNames[ShopGift] = "ShopGift";
s_visualCategoryNames[ShopStationery] = "ShopStationery";
s_visualCategoryNames[ShopLaundry] = "ShopLaundry";
s_visualCategoryNames[ShopPet] = "ShopPet";
s_visualCategoryNames[ShopToys] = "ShopToys";
s_visualCategoryNames[ShopTravelAgency] = "ShopTravelAgency";
s_visualCategoryNames[Shop] = "Shop";
s_visualCategoryNames[ManmadeBridge] = "ManmadeBridge";
s_visualCategoryNames[ManmadeLighthouse] = "ManmadeLighthouse";
s_visualCategoryNames[ManmadePier] = "ManmadePier";
s_visualCategoryNames[ManmadeWaterTower] = "ManmadeWaterTower";
s_visualCategoryNames[ManmadeWindMill] = "ManmadeWindMill";
s_visualCategoryNames[TouristAttraction] = "TouristAttraction";
s_visualCategoryNames[TouristCastle] = "TouristCastle";
s_visualCategoryNames[TouristCinema] = "TouristCinema";
s_visualCategoryNames[TouristInformation] = "TouristInformation";
s_visualCategoryNames[TouristMonument] = "TouristMonument";
s_visualCategoryNames[TouristMuseum] = "TouristMuseum";
s_visualCategoryNames[TouristRuin] = "TouristRuin";
s_visualCategoryNames[TouristTheatre] = "TouristTheatre";
s_visualCategoryNames[TouristThemePark] = "TouristThemePark";
s_visualCategoryNames[TouristViewPoint] = "TouristViewPoint";
s_visualCategoryNames[TouristZoo] = "TouristZoo";
s_visualCategoryNames[TouristAlpineHut] = "TouristAlpineHut";
s_visualCategoryNames[TransportAerodrome] = "TransportAerodrome";
s_visualCategoryNames[TransportHelipad] = "TransportHelipad";
s_visualCategoryNames[TransportAirportTerminal] = "TransportAirportTerminal";
s_visualCategoryNames[TransportBusStation] = "TransportBusStation";
s_visualCategoryNames[TransportBusStop] = "TransportBusStop";
s_visualCategoryNames[TransportCarShare] = "TransportCarShare";
s_visualCategoryNames[TransportFuel] = "TransportFuel";
s_visualCategoryNames[TransportParking] = "TransportParking";
s_visualCategoryNames[TransportParkingSpace] = "TransportParkingSpace";
s_visualCategoryNames[TransportPlatform] = "TransportPlatform";
s_visualCategoryNames[TransportRentalBicycle] = "TransportRentalBicycle";
s_visualCategoryNames[TransportRentalCar] = "TransportRentalCar";
s_visualCategoryNames[TransportTaxiRank] = "TransportTaxiRank";
s_visualCategoryNames[TransportTrainStation] = "TransportTrainStation";
s_visualCategoryNames[TransportTramStop] = "TransportTramStop";
s_visualCategoryNames[TransportBicycleParking] = "TransportBicycleParking";
s_visualCategoryNames[TransportMotorcycleParking] = "TransportMotorcycleParking";
s_visualCategoryNames[TransportSubwayEntrance] = "TransportSubwayEntrance";
s_visualCategoryNames[ReligionPlaceOfWorship] = "ReligionPlaceOfWorship";
s_visualCategoryNames[ReligionBahai] = "ReligionBahai";
s_visualCategoryNames[ReligionBuddhist] = "ReligionBuddhist";
s_visualCategoryNames[ReligionChristian] = "ReligionChristian";
s_visualCategoryNames[ReligionMuslim] = "ReligionMuslim";
s_visualCategoryNames[ReligionHindu] = "ReligionHindu";
s_visualCategoryNames[ReligionJain] = "ReligionJain";
s_visualCategoryNames[ReligionJewish] = "ReligionJewish";
s_visualCategoryNames[ReligionShinto] = "ReligionShinto";
s_visualCategoryNames[ReligionSikh] = "ReligionSikh";
s_visualCategoryNames[LeisureGolfCourse] = "LeisureGolfCourse";
s_visualCategoryNames[LeisurePark] = "LeisurePark";
s_visualCategoryNames[LeisurePlayground] = "LeisurePlayground";
s_visualCategoryNames[LeisurePitch] = "LeisurePitch";
s_visualCategoryNames[LeisureSportsCentre] = "LeisureSportsCentre";
s_visualCategoryNames[LeisureStadium] = "LeisureStadium";
s_visualCategoryNames[LeisureTrack] = "LeisureTrack";
s_visualCategoryNames[LeisureSwimmingPool] = "LeisureSwimmingPool";
s_visualCategoryNames[LanduseAllotments] = "LanduseAllotments";
s_visualCategoryNames[LanduseBasin] = "LanduseBasin";
s_visualCategoryNames[LanduseCemetery] = "LanduseCemetery";
s_visualCategoryNames[LanduseCommercial] = "LanduseCommercial";
s_visualCategoryNames[LanduseConstruction] = "LanduseConstruction";
s_visualCategoryNames[LanduseFarmland] = "LanduseFarmland";
s_visualCategoryNames[LanduseFarmyard] = "LanduseFarmyard";
s_visualCategoryNames[LanduseGarages] = "LanduseGarages";
s_visualCategoryNames[LanduseGrass] = "LanduseGrass";
s_visualCategoryNames[LanduseIndustrial] = "LanduseIndustrial";
s_visualCategoryNames[LanduseLandfill] = "LanduseLandfill";
s_visualCategoryNames[LanduseMeadow] = "LanduseMeadow";
s_visualCategoryNames[LanduseMilitary] = "LanduseMilitary";
s_visualCategoryNames[LanduseQuarry] = "LanduseQuarry";
s_visualCategoryNames[LanduseRailway] = "LanduseRailway";
s_visualCategoryNames[LanduseReservoir] = "LanduseReservoir";
s_visualCategoryNames[LanduseResidential] = "LanduseResidential";
s_visualCategoryNames[LanduseRetail] = "LanduseRetail";
s_visualCategoryNames[LanduseOrchard] = "LanduseOrchard";
s_visualCategoryNames[LanduseVineyard] = "LanduseVineyard";
s_visualCategoryNames[RailwayRail] = "RailwayRail";
s_visualCategoryNames[RailwayNarrowGauge] = "RailwayNarrowGauge";
s_visualCategoryNames[RailwayTram] = "RailwayTram";
s_visualCategoryNames[RailwayLightRail] = "RailwayLightRail";
s_visualCategoryNames[RailwayAbandoned] = "RailwayAbandoned";
s_visualCategoryNames[RailwaySubway] = "RailwaySubway";
s_visualCategoryNames[RailwayPreserved] = "RailwayPreserved";
s_visualCategoryNames[RailwayMiniature] = "RailwayMiniature";
s_visualCategoryNames[RailwayConstruction] = "RailwayConstruction";
s_visualCategoryNames[RailwayMonorail] = "RailwayMonorail";
s_visualCategoryNames[RailwayFunicular] = "RailwayFunicular";
s_visualCategoryNames[PowerTower] = "PowerTower";
s_visualCategoryNames[Satellite] = "Satellite";
s_visualCategoryNames[Landmass] = "Landmass";
s_visualCategoryNames[UrbanArea] = "UrbanArea";
s_visualCategoryNames[InternationalDateLine] = "InternationalDateLine";
s_visualCategoryNames[AdminLevel1] = "AdminLevel1";
s_visualCategoryNames[AdminLevel2] = "AdminLevel2";
s_visualCategoryNames[AdminLevel3] = "AdminLevel3";
s_visualCategoryNames[AdminLevel4] = "AdminLevel4";
s_visualCategoryNames[AdminLevel5] = "AdminLevel5";
s_visualCategoryNames[AdminLevel6] = "AdminLevel6";
s_visualCategoryNames[AdminLevel7] = "AdminLevel7";
s_visualCategoryNames[AdminLevel8] = "AdminLevel8";
s_visualCategoryNames[AdminLevel9] = "AdminLevel9";
s_visualCategoryNames[AdminLevel10] = "AdminLevel10";
s_visualCategoryNames[AdminLevel11] = "AdminLevel11";
s_visualCategoryNames[BoundaryMaritime] = "BoundaryMaritime";
s_visualCategoryNames[LastIndex] = "LastIndex";
}
Q_ASSERT(s_visualCategoryNames.contains(category));
return s_visualCategoryNames[category];
}
QFont GeoDataFeature::defaultFont()
{
return GeoDataFeaturePrivate::s_defaultFont;
......
......@@ -652,8 +652,6 @@ class GEODATA_EXPORT GeoDataFeature : public GeoDataObject
static QSharedPointer<const GeoDataStyle> presetStyle( GeoDataVisualCategory category );
static QString visualCategoryName(GeoDataVisualCategory category);
protected:
// the d-pointer needs to be protected to be accessible from derived classes
GeoDataFeaturePrivate* d;
......
......@@ -14,6 +14,7 @@
#include "GeoDataLineString.h"
#include "GeoDataLineStyle.h"
#include "GeoPainter.h"
#include "StyleBuilder.h"
#include "ViewportParams.h"
#include "GeoDataStyle.h"
#include "MarbleDebug.h"
......@@ -28,7 +29,7 @@ GeoLineStringGraphicsItem::GeoLineStringGraphicsItem( const GeoDataFeature *feat
: GeoGraphicsItem( feature ),
m_lineString( lineString )
{
QString const category = GeoDataFeature::visualCategoryName(feature->visualCategory());
QString const category = StyleBuilder::visualCategoryName(feature->visualCategory());
QStringList paintLayers;
paintLayers << QString("LineString/%1/outline").arg(category);
paintLayers << QString("LineString/%1/inline").arg(category);
......
......@@ -13,6 +13,7 @@
#include "GeoPainter.h"
#include "GeoDataStyle.h"
#include "GeoDataFeature.h"
#include "StyleBuilder.h"
#include "ViewportParams.h"
#include <QImageReader>
......@@ -26,7 +27,7 @@ GeoPhotoGraphicsItem::GeoPhotoGraphicsItem( const GeoDataFeature *feature )
: GeoGraphicsItem( feature )
{
if (feature) {
QString const paintLayer = QString("Photo/%1").arg(GeoDataFeature::visualCategoryName(feature->visualCategory()));
QString const paintLayer = QString("Photo/%1").arg(StyleBuilder::visualCategoryName(feature->visualCategory()));
setPaintLayers(QStringList() << paintLayer);
}
}
......
......@@ -12,6 +12,7 @@
#include "GeoPainter.h"
#include "GeoDataFeature.h"
#include "StyleBuilder.h"
namespace Marble
{
......@@ -20,7 +21,7 @@ GeoPointGraphicsItem::GeoPointGraphicsItem( const GeoDataFeature *feature )
: GeoGraphicsItem( feature )
{
if (feature) {
QString const paintLayer = QString("Point/%1").arg(GeoDataFeature::visualCategoryName(feature->visualCategory()));
QString const paintLayer = QString("Point/%1").arg(StyleBuilder::visualCategoryName(feature->visualCategory()));
setPaintLayers(QStringList() << paintLayer);
}
}
......
......@@ -20,6 +20,7 @@
#include "MarbleDirs.h"
#include "MarbleDebug.h"
#include "OsmPlacemarkData.h"
#include "StyleBuilder.h"
#include <QVector2D>
#include <QtCore/qmath.h>
......@@ -48,7 +49,7 @@ GeoPolygonGraphicsItem::GeoPolygonGraphicsItem(const GeoDataFeature *feature, co
}
else
{
const QString paintLayer = QString("Polygon/%1").arg(GeoDataFeature::visualCategoryName(visualCategory));
const QString paintLayer = QString("Polygon/%1").arg(StyleBuilder::visualCategoryName(visualCategory));
setPaintLayers(QStringList() << paintLayer);
}
}
......@@ -74,7 +75,7 @@ GeoPolygonGraphicsItem::GeoPolygonGraphicsItem(const GeoDataFeature *feature, co
}
else
{
const QString paintLayer = QString("Polygon/%1").arg(GeoDataFeature::visualCategoryName(visualCategory));
const QString paintLayer = QString("Polygon/%1").arg(StyleBuilder::visualCategoryName(visualCategory));
setPaintLayers(QStringList() << paintLayer);
}
}
......
......@@ -14,6 +14,7 @@
#include "GeoDataTrack.h"
#include "GeoDataFeature.h"
#include "MarbleDebug.h"
#include "StyleBuilder.h"
using namespace Marble;
......@@ -22,7 +23,7 @@ GeoTrackGraphicsItem::GeoTrackGraphicsItem( const GeoDataFeature *feature, const
{
setTrack( track );
if (feature) {
QString const paintLayer = QString("Track/%1").arg(GeoDataFeature::visualCategoryName(feature->visualCategory()));
QString const paintLayer = QString("Track/%1").arg(StyleBuilder::visualCategoryName(feature->visualCategory()));
setPaintLayers(QStringList() << paintLayer);
}
}
......
......@@ -80,7 +80,6 @@ public:
private:
static void initializeDefaultValues();
static QString createPaintLayerOrder(const QString &itemType, GeoDataFeature::GeoDataVisualCategory visualCategory, const QString &subType = QString());
static int s_defaultMinZoomLevels[GeoDataFeature::LastIndex];
static bool s_defaultValuesInitialized;
......@@ -90,7 +89,6 @@ private:
int GeometryLayerPrivate::s_defaultMinZoomLevels[GeoDataFeature::LastIndex];
bool GeometryLayerPrivate::s_defaultValuesInitialized = false;
int GeometryLayerPrivate::s_maximumZoomLevel = 0;
QStringList s_paintLayerOrder;
GeometryLayerPrivate::GeometryLayerPrivate( const QAbstractItemModel *model )
: m_model( model ),
......@@ -104,16 +102,6 @@ int GeometryLayerPrivate::maximumZoomLevel()
return s_maximumZoomLevel;
}
QString GeometryLayerPrivate::createPaintLayerOrder(const QString &itemType, GeoDataFeature::GeoDataVisualCategory visualCategory, const QString &subType)
{
QString const category = GeoDataFeature::visualCategoryName(visualCategory);
if (subType.isEmpty()) {
return QString("%1/%2").arg(itemType).arg(category);
} else {
return QString("%1/%2/%3").arg(itemType).arg(category).arg(subType);
}
}
GeometryLayer::GeometryLayer( const QAbstractItemModel *model )
: d( new GeometryLayerPrivate( model ) )
{
......@@ -153,117 +141,6 @@ void GeometryLayerPrivate::initializeDefaultValues()
for ( int i = 0; i < GeoDataFeature::LastIndex; i++ )
s_defaultMinZoomLevels[i] = 15;
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::Landmass);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::UrbanArea);
for ( int i = GeoDataFeature::LanduseAllotments; i <= GeoDataFeature::LanduseVineyard; i++ ) {
if ((GeoDataFeature::GeoDataVisualCategory)i != GeoDataFeature::LanduseGrass) {
s_paintLayerOrder << createPaintLayerOrder("Polygon", (GeoDataFeature::GeoDataVisualCategory)i);
}
}
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::NaturalBeach);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::NaturalWetland);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::NaturalGlacier);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::NaturalIceShelf);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::NaturalCliff);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::NaturalPeak);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::MilitaryDangerArea);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::LeisurePark);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::LeisurePitch);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::LeisureSportsCentre);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::LeisureStadium);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::NaturalWood);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::LanduseGrass);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::LeisurePlayground);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::NaturalScrub);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::LeisureTrack);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::TransportParking);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::TransportParkingSpace);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::ManmadeBridge);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::BarrierCityWall);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::AmenityGraveyard);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::EducationCollege);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::EducationSchool);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::EducationUniversity);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::HealthHospital);
s_paintLayerOrder << createPaintLayerOrder("LineString", GeoDataFeature::Landmass);
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::NaturalWater);
s_paintLayerOrder << createPaintLayerOrder("LineString", GeoDataFeature::NaturalWater, "outline");
s_paintLayerOrder << createPaintLayerOrder("LineString", GeoDataFeature::NaturalWater, "inline");
s_paintLayerOrder << createPaintLayerOrder("LineString", GeoDataFeature::NaturalWater, "label");
s_paintLayerOrder << createPaintLayerOrder("LineString", GeoDataFeature::NaturalReef, "outline");
s_paintLayerOrder << createPaintLayerOrder("LineString", GeoDataFeature::NaturalReef, "inline");
s_paintLayerOrder << createPaintLayerOrder("LineString", GeoDataFeature::NaturalReef, "label");
for ( int i = GeoDataFeature::HighwaySteps; i <= GeoDataFeature::HighwayMotorway; i++ ) {
s_paintLayerOrder << createPaintLayerOrder("LineString", (GeoDataFeature::GeoDataVisualCategory)i, "outline");
}
for ( int i = GeoDataFeature::HighwaySteps; i <= GeoDataFeature::HighwayMotorway; i++ ) {
s_paintLayerOrder << createPaintLayerOrder("LineString", (GeoDataFeature::GeoDataVisualCategory)i, "inline");
}
for ( int i = GeoDataFeature::HighwaySteps; i <= GeoDataFeature::HighwayMotorway; i++ ) {
s_paintLayerOrder << createPaintLayerOrder("LineString", (GeoDataFeature::GeoDataVisualCategory)i, "label");
}
for ( int i = GeoDataFeature::RailwayRail; i <= GeoDataFeature::RailwayFunicular; i++ ) {
s_paintLayerOrder << createPaintLayerOrder("LineString", (GeoDataFeature::GeoDataVisualCategory)i, "outline");
}
for ( int i = GeoDataFeature::RailwayRail; i <= GeoDataFeature::RailwayFunicular; i++ ) {
s_paintLayerOrder << createPaintLayerOrder("LineString", (GeoDataFeature::GeoDataVisualCategory)i, "inline");
}
for ( int i = GeoDataFeature::RailwayRail; i <= GeoDataFeature::RailwayFunicular; i++ ) {
s_paintLayerOrder << createPaintLayerOrder("LineString", (GeoDataFeature::GeoDataVisualCategory)i, "label");
}
s_paintLayerOrder << createPaintLayerOrder("Polygon", GeoDataFeature::TransportPlatform);
for ( int i = GeoDataFeature::AdminLevel1; i <= GeoDataFeature::AdminLevel11; i++ ) {
s_paintLayerOrder << createPaintLayerOrder("LineString", (GeoDataFeature::GeoDataVisualCategory)i, "outline");
}
for ( int i = GeoDataFeature::AdminLevel1; i <= GeoDataFeature::AdminLevel11; i++ ) {
s_paintLayerOrder << createPaintLayerOrder("LineString", (GeoDataFeature::GeoDataVisualCategory)i, "inline");
}
for ( int i = GeoDataFeature::AdminLevel1; i <= GeoDataFeature::AdminLevel11; i++ ) {
s_paintLayerOrder << createPaintLayerOrder("LineString", (GeoDataFeature::GeoDataVisualCategory)i, "label");
}
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::AmenityGraveyard);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::NaturalWood);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::NaturalBeach);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::NaturalWetland);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::NaturalGlacier);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::NaturalIceShelf);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::NaturalScrub);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::LeisurePark);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::LeisurePlayground);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::LeisurePitch);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::LeisureSportsCentre);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::LeisureStadium);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::LeisureTrack);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::TransportParking);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::ManmadeBridge);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::BarrierCityWall);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::NaturalWater);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::NaturalReef);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::Landmass);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::NaturalCliff);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::NaturalPeak);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::EducationCollege);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::EducationSchool);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::EducationUniversity);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::HealthHospital);
s_paintLayerOrder << createPaintLayerOrder("Point", GeoDataFeature::MilitaryDangerArea);
s_paintLayerOrder << "Polygon/Building/frame";
s_paintLayerOrder << "Polygon/Building/roof";
Q_ASSERT(QSet<QString>::fromList(s_paintLayerOrder).size() == s_paintLayerOrder.size());