summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Beschow <bbeschow@cs.tu-berlin.de>2016-10-23 12:01:24 (GMT)
committerBernhard Beschow <bbeschow@cs.tu-berlin.de>2016-10-23 12:08:16 (GMT)
commit2e5a6e3443437057a54978b8c0047bcc9b199fc8 (patch)
tree199d3b4eaa3cf7dc24d73ef53955c79fb99ea2bf
parent91d07d77a3726c7ece10c9d7770fdd7ed0f01797 (diff)
Revert "set the bboxe's height to the building height and use that for building rendering"
This reverts commit e2e3e1989783c8b5640ad703e2d7001d87f05dcc.
-rw-r--r--src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp30
-rw-r--r--src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.h1
-rw-r--r--src/plugins/runner/osm/OsmWay.cpp42
-rw-r--r--src/plugins/runner/osm/OsmWay.h2
4 files changed, 30 insertions, 45 deletions
diff --git a/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp b/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp
index e9f73d3..cf86ea7 100644
--- a/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp
+++ b/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.cpp
@@ -14,7 +14,6 @@
#include "ViewportParams.h"
#include "GeoDataTypes.h"
#include "GeoDataPlacemark.h"
-#include "GeoDataLatLonAltBox.h"
#include "GeoDataLinearRing.h"
#include "GeoDataPolygon.h"
#include "GeoDataIconStyle.h"
@@ -28,7 +27,7 @@ namespace Marble
BuildingGeoPolygonGraphicsItem::BuildingGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark,
const GeoDataPolygon *polygon)
: AbstractGeoPolygonGraphicsItem(placemark, polygon)
- , m_buildingHeight(polygon->latLonAltBox().maxAltitude() - polygon->latLonAltBox().minAltitude())
+ , m_buildingHeight(extractBuildingHeight(*placemark))
, m_buildingLabel(extractBuildingLabel(*placemark))
, m_entries(extractNamedEntries(*placemark))
{
@@ -44,7 +43,7 @@ BuildingGeoPolygonGraphicsItem::BuildingGeoPolygonGraphicsItem(const GeoDataPlac
BuildingGeoPolygonGraphicsItem::BuildingGeoPolygonGraphicsItem(const GeoDataPlacemark *placemark,
const GeoDataLinearRing* ring)
: AbstractGeoPolygonGraphicsItem(placemark, ring)
- , m_buildingHeight(ring->latLonAltBox().maxAltitude() - ring->latLonAltBox().minAltitude())
+ , m_buildingHeight(extractBuildingHeight(*placemark))
, m_buildingLabel(extractBuildingLabel(*placemark))
, m_entries(extractNamedEntries(*placemark))
{
@@ -135,6 +134,31 @@ QPointF BuildingGeoPolygonGraphicsItem::buildingOffset(const QPointF &point, con
return QPointF(shiftX, shiftY);
}
+double BuildingGeoPolygonGraphicsItem::extractBuildingHeight(const GeoDataPlacemark &placemark)
+{
+ double height = 8.0;
+
+ const OsmPlacemarkData &osmData = placemark.osmData();
+
+ QHash<QString, QString>::const_iterator tagIter;
+ if ((tagIter = osmData.findTag(QStringLiteral("height"))) != osmData.tagsEnd()) {
+ /** @todo Also parse non-SI units, see https://wiki.openstreetmap.org/wiki/Key:height#Height_of_buildings */
+ QString const heightValue = QString(tagIter.value()).remove(QStringLiteral(" meters")).remove(QStringLiteral(" m"));
+ bool extracted = false;
+ double extractedHeight = heightValue.toDouble(&extracted);
+ if (extracted) {
+ height = extractedHeight;
+ }
+ } else if ((tagIter = osmData.findTag(QStringLiteral("building:levels"))) != osmData.tagsEnd()) {
+ int const levels = tagIter.value().toInt();
+ int const skipLevels = osmData.tagValue(QStringLiteral("building:min_level")).toInt();
+ /** @todo Is 35 as an upper bound for the number of levels sane? */
+ height = 3.0 * qBound(1, 1+levels-skipLevels, 35);
+ }
+
+ return qBound(1.0, height, 1000.0);
+}
+
QString BuildingGeoPolygonGraphicsItem::extractBuildingLabel(const GeoDataPlacemark &placemark)
{
if (!placemark.name().isEmpty()) {
diff --git a/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.h b/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.h
index bb7a662..8514cc5 100644
--- a/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.h
+++ b/src/lib/marble/geodata/graphicsitem/BuildingGeoPolygonGraphicsItem.h
@@ -46,6 +46,7 @@ private:
static QPointF centroid(const QPolygonF &polygon, double &area);
static void screenPolygons(const ViewportParams *viewport, const GeoDataPolygon* polygon,
QVector<QPolygonF*> &polygons, QVector<QPolygonF*> &outlines);
+ static double extractBuildingHeight(const GeoDataPlacemark &placemark);
static QString extractBuildingLabel(const GeoDataPlacemark &placemark);
static QVector<NamedEntry> extractNamedEntries(const GeoDataPlacemark &placemark);
diff --git a/src/plugins/runner/osm/OsmWay.cpp b/src/plugins/runner/osm/OsmWay.cpp
index 1b2a02b..151f91d 100644
--- a/src/plugins/runner/osm/OsmWay.cpp
+++ b/src/plugins/runner/osm/OsmWay.cpp
@@ -25,8 +25,6 @@ QSet<StyleBuilder::OsmTag> OsmWay::s_areaTags;
void OsmWay::create(GeoDataDocument *document, const OsmNodes &nodes, QSet<qint64> &usedNodes) const
{
- const double height = extractBuildingHeight(m_osmData);
-
OsmPlacemarkData osmData = m_osmData;
GeoDataGeometry *geometry = 0;
@@ -45,12 +43,7 @@ void OsmWay::create(GeoDataDocument *document, const OsmNodes &nodes, QSet<qint6
usedNodes << nodeId;
}
- linearRing = GeoDataLinearRing(linearRing.optimized());
- if (!linearRing.isEmpty() && height != 0) {
- linearRing.first().setAltitude(height);
- }
-
- geometry = new GeoDataLinearRing(linearRing);
+ geometry = new GeoDataLinearRing(linearRing.optimized());
} else {
GeoDataLineString lineString;
@@ -66,18 +59,10 @@ void OsmWay::create(GeoDataDocument *document, const OsmNodes &nodes, QSet<qint6
usedNodes << nodeId;
}
- lineString = lineString.optimized();
- if (!lineString.isEmpty() && height != 0) {
- lineString.first().setAltitude(height);
- }
-
- geometry = new GeoDataLineString(lineString);
+ geometry = new GeoDataLineString(lineString.optimized());
}
Q_ASSERT(geometry != nullptr);
- if (height != 0) {
- geometry->setAltitudeMode(RelativeToGround);
- }
OsmObjectManager::registerId(m_osmData.id());
@@ -195,27 +180,4 @@ bool OsmWay::isAreaTag(const StyleBuilder::OsmTag &keyValue)
return s_areaTags.contains(keyValue);
}
-double OsmWay::extractBuildingHeight(const OsmPlacemarkData &osmData)
-{
- double height = 8.0;
-
- QHash<QString, QString>::const_iterator tagIter;
- if ((tagIter = osmData.findTag(QStringLiteral("height"))) != osmData.tagsEnd()) {
- /** @todo Also parse non-SI units, see https://wiki.openstreetmap.org/wiki/Key:height#Height_of_buildings */
- QString const heightValue = QString(tagIter.value()).remove(QStringLiteral(" meters")).remove(QStringLiteral(" m"));
- bool extracted = false;
- double extractedHeight = heightValue.toDouble(&extracted);
- if (extracted) {
- height = extractedHeight;
- }
- } else if ((tagIter = osmData.findTag(QStringLiteral("building:levels"))) != osmData.tagsEnd()) {
- int const levels = tagIter.value().toInt();
- int const skipLevels = osmData.tagValue(QStringLiteral("building:min_level")).toInt();
- /** @todo Is 35 as an upper bound for the number of levels sane? */
- height = 3.0 * qBound(1, 1+levels-skipLevels, 35);
- }
-
- return qBound(1.0, height, 1000.0);
-}
-
}
diff --git a/src/plugins/runner/osm/OsmWay.h b/src/plugins/runner/osm/OsmWay.h
index 197f1dc..89f01ba 100644
--- a/src/plugins/runner/osm/OsmWay.h
+++ b/src/plugins/runner/osm/OsmWay.h
@@ -39,8 +39,6 @@ private:
static bool isAreaTag(const StyleBuilder::OsmTag &keyValue);
- static double extractBuildingHeight(const OsmPlacemarkData &osmData);
-
OsmPlacemarkData m_osmData;
QVector<qint64> m_references;