Commit 1258fe10 authored by Dennis Nienhüser's avatar Dennis Nienhüser
Browse files

Condense elevation information into placemark description of peaks

parent 3490be25
......@@ -80,12 +80,6 @@ Item {
text: placemark === null ? "" : placemark.description
}
IconText {
width: parent.width
visible: placemark !== null && placemark.elevation !== ""
text: placemark === null ? "" : qsTr("Elevation: %1 m").arg(placemark.elevation)
}
IconText {
width: parent.width
visible: text.length > 0
......
......@@ -35,7 +35,6 @@ void Placemark::setGeoDataPlacemark( const Marble::GeoDataPlacemark &placemark )
m_website = QString();
m_wikipedia = QString();
m_openingHours = QString();
m_elevation = QString();
emit coordinatesChanged();
emit nameChanged();
emit descriptionChanged();
......@@ -43,7 +42,6 @@ void Placemark::setGeoDataPlacemark( const Marble::GeoDataPlacemark &placemark )
emit websiteChanged();
emit wikipediaChanged();
emit openingHoursChanged();
emit elevationChanged();
}
Marble::GeoDataPlacemark & Placemark::placemark()
......@@ -130,6 +128,8 @@ QString Placemark::description() const
addTagDescription(m_description, QStringLiteral("recycling:waste"), "yes", tr("Waste"));
addTagDescription(m_description, QStringLiteral("recycling:white_goods"), "yes", tr("White goods"));
addTagDescription(m_description, QStringLiteral("recycling:wood"), "yes", tr("Wood"));
} else if (category == GeoDataPlacemark::NaturalPeak) {
addTagValue(m_description, QStringLiteral("ele"), tr("%1 m"));
}
}
......@@ -204,17 +204,6 @@ QString Placemark::coordinates() const
return m_placemark.coordinate().toString(GeoDataCoordinates::Decimal).trimmed();
}
QString Placemark::elevation() const
{
if (!m_elevation.isEmpty()){
return m_elevation;
}
m_elevation = m_placemark.osmData().tagValue(QStringLiteral("ele"));
return m_elevation;
}
void Placemark::setName(const QString & name)
{
if (m_placemark.name() == name) {
......@@ -235,11 +224,11 @@ double Placemark::latitude() const
return m_placemark.coordinate().latitude(GeoDataCoordinates::Degree);
}
void Placemark::addTagValue(QString &target, const QString &key) const
void Placemark::addTagValue(QString &target, const QString &key, const QString &format) const
{
auto const & osmData = m_placemark.osmData();
QString const value = osmData.tagValue(key);
QString description = value;
QString description = format.isEmpty() ? value : format.arg(value);
description.replace(QLatin1Char(';'), " · ");
addTagDescription(target, key, value, description);
}
......
......@@ -32,7 +32,6 @@ class Placemark : public QObject
Q_PROPERTY(QString wikipedia READ wikipedia NOTIFY wikipediaChanged)
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)
......@@ -52,7 +51,6 @@ public:
QString wikipedia() const;
QString openingHours() const;
QString coordinates() const;
QString elevation() const;
double longitude() const;
double latitude() const;
......@@ -67,10 +65,9 @@ Q_SIGNALS:
void websiteChanged();
void wikipediaChanged();
void openingHoursChanged();
void elevationChanged();
private:
void addTagValue(QString &target, const QString &key) const;
void addTagValue(QString &target, const QString &key, const QString &format=QString()) const;
void addTagDescription(QString &target, const QString &key, const QString &value, const QString &description) const;
QString addressFromOsmData() const;
QString formatStreet(const QString &street, const QString &houseNumber) const;
......@@ -81,7 +78,6 @@ private:
mutable QString m_website;
mutable QString m_wikipedia;
mutable QString m_openingHours;
mutable QString m_elevation;
};
}
......
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