summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjiban Bairagya <sanjiban22393@gmail.com>2016-07-28 20:06:14 (GMT)
committerSanjiban Bairagya <sanjiban@magicpin.in>2016-07-28 20:06:27 (GMT)
commitb73527b1f6e513996fddbdb1f2ea51611d958de3 (patch)
tree3f0b63830098faefd630cdb2906f3407ffbbe15e
parentba93df952bc831f39b5b85e14c0be6fced1de634 (diff)
Show elevation of peaks in the placemark dialog in the Android version
and in the webpopup in the Desktop version
-rw-r--r--src/apps/marble-maps/PlacemarkDialog.qml6
-rw-r--r--src/lib/marble/MarbleWidgetPopupMenu.cpp36
-rw-r--r--src/lib/marble/declarative/Placemark.cpp17
-rw-r--r--src/lib/marble/declarative/Placemark.h20
-rw-r--r--src/lib/marble/webpopup/osm.html10
-rw-r--r--src/plugins/runner/osm/OsmNode.cpp7
6 files changed, 70 insertions, 26 deletions
diff --git a/src/apps/marble-maps/PlacemarkDialog.qml b/src/apps/marble-maps/PlacemarkDialog.qml
index 904484b..f91e7f0 100644
--- a/src/apps/marble-maps/PlacemarkDialog.qml
+++ b/src/apps/marble-maps/PlacemarkDialog.qml
@@ -91,6 +91,12 @@ Item {
IconText {
width: parent.width
+ visible: placemark != null && placemark.elevation != ""
+ text: placemark === null ? "" : ("Elevation : " + placemark.elevation + " m")
+ }
+
+ IconText {
+ width: parent.width
visible: text.length > 0 && (!condensed || name.text === "")
text: placemark === null ? "" : placemark.address
maximumLineCount: 4
diff --git a/src/lib/marble/MarbleWidgetPopupMenu.cpp b/src/lib/marble/MarbleWidgetPopupMenu.cpp
index a51844d..f031c0b 100644
--- a/src/lib/marble/MarbleWidgetPopupMenu.cpp
+++ b/src/lib/marble/MarbleWidgetPopupMenu.cpp
@@ -201,22 +201,42 @@ void MarbleWidgetPopupMenu::Private::setupDialogOsm( PopupLayer *popup, const Ge
doc["name"] = "";
}
+ if (data.containsTagKey("natural")){
+ QString natural = data.tagValue("natural");
+ if (!natural.isEmpty()){
+ natural[0] = natural[0].toUpper();
+ if (natural == "Peak" && data.containsTagKey("ele")){
+ doc["details"] = natural + " - " + data.tagValue("ele") + " m";
+ } else {
+ doc["details"] = natural;
+ }
+ }
+ } else {
+ doc["detailsVisibility"] = "none";
+ }
+
if (data.containsTagKey("shop")){
QString shop = data.tagValue("shop");
- shop[0] = shop[0].toUpper();
- doc["amenity"] = "Shop - " + shop;
+ if (!shop.isEmpty()){
+ shop[0] = shop[0].toUpper();
+ doc["amenity"] = "Shop - " + shop;
+ }
} else if (data.containsTagKey("amenity")){
QString amenity = data.tagValue("amenity");
- amenity[0] = amenity[0].toUpper();
- doc["amenity"] = amenity;
+ if (!amenity.isEmpty()){
+ amenity[0] = amenity[0].toUpper();
+ doc["amenity"] = amenity;
+ }
} else {
doc["amenityVisibility"] = "none";
}
if (data.containsTagKey("cuisine")){
QString cuisine = data.tagValue("cuisine");
- cuisine[0] = cuisine[0].toUpper();
- doc["cuisine"] = cuisine;
+ if (!cuisine.isEmpty()){
+ cuisine[0] = cuisine[0].toUpper();
+ doc["cuisine"] = cuisine;
+ }
} else {
doc["cuisineVisibility"] = "none";
}
@@ -280,7 +300,9 @@ void MarbleWidgetPopupMenu::Private::setupDialogOsm( PopupLayer *popup, const Ge
doc["contactVisibility"] = "none";
}
- if (data.containsTagKey("wheelchair") || data.containsTagKey("internet_access") || data.containsTagKey("smoking")){
+ bool hasFacilitiesData = data.containsTagKey("wheelchair") || data.containsTagKey("internet_access") || data.containsTagKey("smoking");
+
+ if (hasFacilitiesData){
if (data.containsTagKey("wheelchair")){
doc["wheelchair"] = data.tagValue("wheelchair");
} else {
diff --git a/src/lib/marble/declarative/Placemark.cpp b/src/lib/marble/declarative/Placemark.cpp
index 608c963..73a4924 100644
--- a/src/lib/marble/declarative/Placemark.cpp
+++ b/src/lib/marble/declarative/Placemark.cpp
@@ -36,6 +36,7 @@ void Placemark::setGeoDataPlacemark( const Marble::GeoDataPlacemark &placemark )
m_wikipedia = QString();
m_fuelDetails = QString();
m_openingHours = QString();
+ m_elevation = QString();
emit coordinatesChanged();
emit nameChanged();
emit descriptionChanged();
@@ -43,6 +44,7 @@ void Placemark::setGeoDataPlacemark( const Marble::GeoDataPlacemark &placemark )
emit websiteChanged();
emit wikipediaChanged();
emit openingHoursChanged();
+ emit elevationChanged();
if (m_placemark.visualCategory() == GeoDataFeature::TransportFuel) {
emit fuelDetailsChanged();
}
@@ -168,6 +170,21 @@ QString Placemark::coordinates() const
return m_placemark.coordinate().toString(GeoDataCoordinates::Decimal).trimmed();
}
+QString Placemark::elevation() const
+{
+ if (!m_elevation.isEmpty()){
+ return m_elevation;
+ }
+
+ OsmPlacemarkData data = m_placemark.osmData();
+
+ if (data.containsTagKey("ele")) {
+ m_elevation = data.tagValue("ele");
+ }
+
+ return m_elevation;
+}
+
void Placemark::setName(const QString & name)
{
if (m_placemark.name() == name) {
diff --git a/src/lib/marble/declarative/Placemark.h b/src/lib/marble/declarative/Placemark.h
index 22bfafd..d988ee8 100644
--- a/src/lib/marble/declarative/Placemark.h
+++ b/src/lib/marble/declarative/Placemark.h
@@ -28,14 +28,15 @@ class Placemark : public QObject
{
Q_OBJECT
- Q_PROPERTY( QString name WRITE setName READ name NOTIFY nameChanged )
- Q_PROPERTY( QString description READ description NOTIFY descriptionChanged )
- Q_PROPERTY( QString address READ address NOTIFY addressChanged )
- Q_PROPERTY( QString website READ website NOTIFY websiteChanged )
- Q_PROPERTY( QString wikipedia READ wikipedia NOTIFY wikipediaChanged )
- Q_PROPERTY( QString fuelDetails READ fuelDetails NOTIFY fuelDetailsChanged )
- Q_PROPERTY( QString openingHours READ openingHours NOTIFY openingHoursChanged )
- Q_PROPERTY( QString coordinates READ coordinates NOTIFY coordinatesChanged )
+ Q_PROPERTY(QString name WRITE setName READ name NOTIFY nameChanged)
+ Q_PROPERTY(QString description READ description NOTIFY descriptionChanged)
+ Q_PROPERTY(QString address READ address NOTIFY addressChanged)
+ Q_PROPERTY(QString website READ website NOTIFY websiteChanged)
+ Q_PROPERTY(QString wikipedia READ wikipedia NOTIFY wikipediaChanged)
+ Q_PROPERTY(QString fuelDetails READ fuelDetails NOTIFY fuelDetailsChanged)
+ Q_PROPERTY(QString openingHours READ openingHours NOTIFY openingHoursChanged)
+ Q_PROPERTY(QString coordinates READ coordinates NOTIFY coordinatesChanged)
+ Q_PROPERTY(QString elevation READ elevation NOTIFY elevationChanged)
Q_PROPERTY(double longitude READ longitude NOTIFY coordinatesChanged)
Q_PROPERTY(double latitude READ latitude NOTIFY coordinatesChanged)
@@ -56,6 +57,7 @@ public:
QString fuelDetails() const;
QString openingHours() const;
QString coordinates() const;
+ QString elevation() const;
double longitude() const;
double latitude() const;
@@ -71,6 +73,7 @@ Q_SIGNALS:
void wikipediaChanged();
void fuelDetailsChanged();
void openingHoursChanged();
+ void elevationChanged();
private:
void addTagValue(QString &target, const QString &key) const;
@@ -85,6 +88,7 @@ private:
mutable QString m_website;
mutable QString m_wikipedia;
mutable QString m_openingHours;
+ mutable QString m_elevation;
};
}
diff --git a/src/lib/marble/webpopup/osm.html b/src/lib/marble/webpopup/osm.html
index cfa3773..d44e228 100644
--- a/src/lib/marble/webpopup/osm.html
+++ b/src/lib/marble/webpopup/osm.html
@@ -13,6 +13,10 @@ h2.osmamenity {
display: %amenityVisibility%
}
+h3.osmdetails {
+ display: %detailsVisibility%
+}
+
h3.osmcuisine {
display: %cuisineVisibility%
}
@@ -56,11 +60,9 @@ tr.smoking {
<body>
<div class="flag"><h1>%name%</h1></div>
-
<h2 class="osmamenity">%amenity%</h2>
-
-<h3 class="osmcuisine">%cuisine%</h3>
-
+<h3 class="osmdetails">%details%</h3>
+<h3 class="osmcuisine">%cuisine%</h3>
<p class="openinghours">Opening Hours: %openinghours%</p>
<table class="contact">
diff --git a/src/plugins/runner/osm/OsmNode.cpp b/src/plugins/runner/osm/OsmNode.cpp
index a88277d..e6d5f83 100644
--- a/src/plugins/runner/osm/OsmNode.cpp
+++ b/src/plugins/runner/osm/OsmNode.cpp
@@ -70,13 +70,6 @@ void OsmNode::create(GeoDataDocument *document) const
default: placemark->setZoomLevel(10); break;
}
}
- } else if (category == GeoDataFeature::NaturalPeak) {
- placemark->setZoomLevel(11);
- bool isInteger = false;
- int const elevation = m_osmData.tagValue("ele").toInt(&isInteger);
- if (isInteger) {
- placemark->setName(QString("%1 (%2 m)").arg(placemark->name()).arg(elevation));
- }
}
OsmObjectManager::registerId(m_osmData.id());