summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Beschow <bbeschow@cs.tu-berlin.de>2016-09-24 09:35:33 (GMT)
committerBernhard Beschow <bbeschow@cs.tu-berlin.de>2016-09-24 09:35:33 (GMT)
commit453200a86fd04d085f2640b67b1f177038844af7 (patch)
tree24cce496089b1cb7a95c6650011c8f75635acf2f
parent61cfd05382e8d4c8a273ad329cfbde713193df1f (diff)
always extract elevation
-rw-r--r--src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp25
-rw-r--r--src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.h2
2 files changed, 8 insertions, 19 deletions
diff --git a/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp b/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp
index 2155b13..51f605e 100644
--- a/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp
+++ b/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.cpp
@@ -51,10 +51,8 @@ GeoPolygonGraphicsItem::GeoPolygonGraphicsItem(const GeoDataFeature *feature, co
setPaintLayers(paintLayers);
}
else {
- if (visualCategory == GeoDataFeature::Bathymetry) {
- const int elevation = extractBathymetryElevation(feature);
- setZValue(zValue() + elevation);
- }
+ const int elevation = extractElevation(*feature);
+ setZValue(zValue() + elevation);
const QString paintLayer = QLatin1String("Polygon/") + StyleBuilder::visualCategoryName(visualCategory);
setPaintLayers(QStringList() << paintLayer);
@@ -81,27 +79,20 @@ GeoPolygonGraphicsItem::GeoPolygonGraphicsItem(const GeoDataFeature *feature, co
setPaintLayers(paintLayers);
}
else {
- if (visualCategory == GeoDataFeature::Bathymetry) {
- const int elevation = extractBathymetryElevation(feature);
- setZValue(zValue() + elevation);
- }
+ const int elevation = extractElevation(*feature);
+ setZValue(zValue() + elevation);
const QString paintLayer = QLatin1String("Polygon/") + StyleBuilder::visualCategoryName(visualCategory);
setPaintLayers(QStringList() << paintLayer);
}
}
-int GeoPolygonGraphicsItem::extractBathymetryElevation(const GeoDataFeature *feature)
+int GeoPolygonGraphicsItem::extractElevation(const GeoDataFeature &feature)
{
- const GeoDataFeature::GeoDataVisualCategory visualCategory = feature->visualCategory();
- if (visualCategory != GeoDataFeature::Bathymetry) {
- return 0;
- }
-
int elevation = 0;
- if (feature->nodeType() == GeoDataTypes::GeoDataPlacemarkType) {
- const GeoDataPlacemark *placemark = static_cast<const GeoDataPlacemark *>(feature);
+ if (feature.nodeType() == GeoDataTypes::GeoDataPlacemarkType) {
+ const GeoDataPlacemark *placemark = static_cast<const GeoDataPlacemark *>(&feature);
const OsmPlacemarkData &osmData = placemark->osmData();
const auto tagIter = osmData.findTag(QStringLiteral("ele"));
@@ -111,8 +102,6 @@ int GeoPolygonGraphicsItem::extractBathymetryElevation(const GeoDataFeature *fea
}
return elevation;
-
-
}
bool GeoPolygonGraphicsItem::isBuilding(GeoDataFeature::GeoDataVisualCategory visualCategory)
diff --git a/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.h b/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.h
index 4a77411..e821082 100644
--- a/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.h
+++ b/src/lib/marble/geodata/graphicsitem/GeoPolygonGraphicsItem.h
@@ -48,7 +48,7 @@ private:
void paintRoof( GeoPainter* painter, const ViewportParams *viewport );
QPointF buildingOffset(const QPointF &point, const ViewportParams *viewport, bool* isCameraAboveBuilding=0) const;
- int extractBathymetryElevation(const GeoDataFeature *feature);
+ static int extractElevation(const GeoDataFeature &feature);
static double extractBuildingHeight(const GeoDataFeature *feature);
static QString extractBuildingLabel(const GeoDataFeature *feature);
static QVector<NamedEntry> extractNamedEntries(const GeoDataFeature *feature);