Commit 453200a8 authored by Bernhard Beschow's avatar Bernhard Beschow
Browse files

always extract elevation

parent 61cfd053
......@@ -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)
......
......@@ -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);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment