Commit 22402709 authored by Dennis Nienhüser's avatar Dennis Nienhüser

Show gas station details

parent c78e47ed
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<file>SearchField.qml</file> <file>SearchField.qml</file>
<file>Search.qml</file> <file>Search.qml</file>
<file>CircularButton.qml</file> <file>CircularButton.qml</file>
<file>IconText.qml</file>
<file>PositionButton.qml</file> <file>PositionButton.qml</file>
<file>BoxedText.qml</file> <file>BoxedText.qml</file>
<file>ImageButton.qml</file> <file>ImageButton.qml</file>
...@@ -48,6 +49,7 @@ ...@@ -48,6 +49,7 @@
<file alias="ic_place_unknown.png">../../../data/android/drawable-xxxhdpi/ic_place_unknown.png</file> <file alias="ic_place_unknown.png">../../../data/android/drawable-xxxhdpi/ic_place_unknown.png</file>
<file alias="ic_place_via.png">../../../data/android/drawable-xxxhdpi/ic_place_via.png</file> <file alias="ic_place_via.png">../../../data/android/drawable-xxxhdpi/ic_place_via.png</file>
<file alias="add.png">../../../data/android/drawable-xxxhdpi/ic_add_black_48dp.png</file> <file alias="add.png">../../../data/android/drawable-xxxhdpi/ic_add_black_48dp.png</file>
<file alias="material/gas_station.svg">material-icons/ic_local_gas_station_48px.svg</file>
<file>RouteProfileRadioButton.qml</file> <file>RouteProfileRadioButton.qml</file>
<file>ScrollBar.qml</file> <file>ScrollBar.qml</file>
</qresource> </qresource>
......
...@@ -21,7 +21,7 @@ Item { ...@@ -21,7 +21,7 @@ Item {
property var placemark: null property var placemark: null
property string actionIconSource: viaGroup.current === addDestinationButton ? routeEditor.currentProfileIcon : "qrc:///add.png" property string actionIconSource: viaGroup.current === addDestinationButton ? routeEditor.currentProfileIcon : "qrc:///add.png"
height: placemark === null ? 0 : Screen.pixelDensity * 4 + Math.max(infoLayout.height, actionsLayout.height) height: placemark === null ? 0 : Screen.pixelDensity * 6 + Math.max(infoLayout.height, actionsLayout.height)
function addToRoute() { function addToRoute() {
viaGroup.current.execute() viaGroup.current.execute()
...@@ -46,50 +46,47 @@ Item { ...@@ -46,50 +46,47 @@ Item {
Column { Column {
id: infoLayout id: infoLayout
clip: true
anchors { anchors {
top: parent.top bottom: parent.bottom
left: parent.left left: parent.left
right: actionsLayout.left right: actionsLayout.left
margins: Screen.pixelDensity * 2 margins: Screen.pixelDensity * 2
} }
height: nameLabel.height + (descriptionLabel.text == "" ? 0 : descriptionLabel.height) + (addressLabel.text == "" ? 0 : addressLabel.height)
Text { IconText {
id: nameLabel id: nameLabel
width: parent.width width: parent.width
text: placemark === null ? "" : placemark.name text: placemark === null ? "" : placemark.name
wrapMode: Text.WordWrap
elide: Text.ElideRight
maximumLineCount: 2 maximumLineCount: 2
font.pointSize: 20 font.pointSize: 20
} }
Text { IconText {
id: descriptionLabel id: descriptionLabel
width: parent.width width: parent.width
text: placemark === null ? "" : placemark.description text: placemark === null ? "" : placemark.description
wrapMode: Text.WordWrap
elide: Text.ElideRight
maximumLineCount: 4 maximumLineCount: 4
font.pointSize: 14
} }
Text { IconText {
id: addressLabel id: addressLabel
width: parent.width width: parent.width
text: placemark === null ? "" : placemark.address text: placemark === null ? "" : placemark.address
wrapMode: Text.WordWrap
elide: Text.ElideRight
maximumLineCount: 4 maximumLineCount: 4
font.pointSize: 14 }
IconText {
id: fuelLabel
width: parent.width
visible: placemark !== null && placemark.fuelDetails !== ""
text: placemark === null ? "" : placemark.fuelDetails
icon: "qrc:/material/gas_station.svg"
} }
} }
Column { Column {
id: actionsLayout id: actionsLayout
width: rowLayout.width width: rowLayout.width
height: spacer.height + rowLayout.height
spacing: Screen.pixelDensity * 2 spacing: Screen.pixelDensity * 2
anchors { anchors {
right: parent.right right: parent.right
......
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><path d="M39.54 14.46l.03-.03L32.12 7 30 9.12l4.22 4.22C32.34 14.06 31 15.87 31 18c0 2.76 2.24 5 5 5 .71 0 1.39-.15 2-.42V37c0 1.1-.9 2-2 2s-2-.9-2-2v-9c0-2.21-1.79-4-4-4h-2V10c0-2.21-1.79-4-4-4H12c-2.21 0-4 1.79-4 4v32h20V27h3v10c0 2.76 2.24 5 5 5s5-2.24 5-5V18c0-1.38-.56-2.63-1.46-3.54zM24 20H12V10h12v10zm12 0c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"/></svg>
\ No newline at end of file
...@@ -182,6 +182,8 @@ namespace Marble ...@@ -182,6 +182,8 @@ namespace Marble
MarbleQuickItem::MarbleQuickItem(QQuickItem *parent) : QQuickPaintedItem(parent) MarbleQuickItem::MarbleQuickItem(QQuickItem *parent) : QQuickPaintedItem(parent)
,d(new MarbleQuickItemPrivate(this)) ,d(new MarbleQuickItemPrivate(this))
{ {
qRegisterMetaType<Placemark*>("Placemark*");
foreach (AbstractFloatItem *item, d->m_map.floatItems()) { foreach (AbstractFloatItem *item, d->m_map.floatItems()) {
if (item->nameId() == "license") { if (item->nameId() == "license") {
item->setPosition(QPointF(5.0, -10.0)); item->setPosition(QPointF(5.0, -10.0));
......
...@@ -34,6 +34,9 @@ void Placemark::setGeoDataPlacemark( const Marble::GeoDataPlacemark &placemark ) ...@@ -34,6 +34,9 @@ void Placemark::setGeoDataPlacemark( const Marble::GeoDataPlacemark &placemark )
emit nameChanged(); emit nameChanged();
emit descriptionChanged(); emit descriptionChanged();
emit addressChanged(); emit addressChanged();
if (m_placemark.visualCategory() == GeoDataFeature::TransportFuel) {
emit fuelDetailsChanged();
}
} }
Marble::GeoDataPlacemark Placemark::placemark() const Marble::GeoDataPlacemark Placemark::placemark() const
...@@ -62,19 +65,19 @@ QString Placemark::description() const ...@@ -62,19 +65,19 @@ QString Placemark::description() const
if (category >= GeoDataFeature::FoodBar && category <= GeoDataFeature::FoodRestaurant) { if (category >= GeoDataFeature::FoodBar && category <= GeoDataFeature::FoodRestaurant) {
addTagValue("brand"); addTagValue("brand");
addTagValue("cuisine"); addTagValue("cuisine");
addTagDescription("self_service", "yes", "Self Service"); addTagDescription(m_description, "self_service", "yes", "Self Service");
addTagDescription("takeaway", "yes", "Take Away"); addTagDescription(m_description, "takeaway", "yes", "Take Away");
addTagDescription("outdoor_seating", "yes", "Outdoor Seating"); addTagDescription(m_description, "outdoor_seating", "yes", "Outdoor Seating");
addTagDescription("ice_cream", "yes", "Ice Cream"); addTagDescription(m_description, "ice_cream", "yes", "Ice Cream");
addTagDescription("smoking", "dedicated", "Smoking (dedicated)"); addTagDescription(m_description, "smoking", "dedicated", "Smoking (dedicated)");
addTagDescription("smoking", "yes", "Smoking allowed"); addTagDescription(m_description, "smoking", "yes", "Smoking allowed");
addTagDescription("smoking", "separated", "Smoking (separated)"); addTagDescription(m_description, "smoking", "separated", "Smoking (separated)");
addTagDescription("smoking", "isolated", "Smoking (isolated)"); addTagDescription(m_description, "smoking", "isolated", "Smoking (isolated)");
addTagDescription("smoking", "no", "No smoking"); addTagDescription(m_description, "smoking", "no", "No smoking");
addTagDescription("smoking", "outside", "Smoking (outside)"); addTagDescription(m_description, "smoking", "outside", "Smoking (outside)");
addTagDescription("smoking:outside", "yes", "Smoking (outside)"); addTagDescription(m_description, "smoking:outside", "yes", "Smoking (outside)");
addTagDescription("smoking:outside", "separated", "Smoking (outside separated)"); addTagDescription(m_description, "smoking:outside", "separated", "Smoking (outside separated)");
addTagDescription("smoking:outside", "no", "No smoking outside"); addTagDescription(m_description, "smoking:outside", "no", "No smoking outside");
} else if (category >= GeoDataFeature::ShopBeverages && category <= GeoDataFeature::Shop) { } else if (category >= GeoDataFeature::ShopBeverages && category <= GeoDataFeature::Shop) {
addTagValue("operator"); addTagValue("operator");
} else if (category == GeoDataFeature::TransportBusStop) { } else if (category == GeoDataFeature::TransportBusStop) {
...@@ -87,12 +90,6 @@ QString Placemark::description() const ...@@ -87,12 +90,6 @@ QString Placemark::description() const
} else if (category == GeoDataFeature::TransportFuel) { } else if (category == GeoDataFeature::TransportFuel) {
addTagValue("brand"); addTagValue("brand");
addTagValue("operator"); addTagValue("operator");
addTagDescription("fuel:diesel", "yes", tr("Diesel"));
addTagDescription("fuel:octane_91", "yes", tr("Octane 91"));
addTagDescription("fuel:octane_95", "yes", tr("Octane 95"));
addTagDescription("fuel:octane_98", "yes", tr("Octane 98"));
addTagDescription("fuel:e10", "yes", tr("E10"));
addTagDescription("fuel:lpg", "yes", tr("LPG"));
} else if (category == GeoDataFeature::NaturalTree) { } else if (category == GeoDataFeature::NaturalTree) {
addTagValue("species:en"); addTagValue("species:en");
addTagValue("genus:en"); addTagValue("genus:en");
...@@ -119,6 +116,20 @@ QString Placemark::address() const ...@@ -119,6 +116,20 @@ QString Placemark::address() const
return m_address; return m_address;
} }
QString Placemark::fuelDetails() const
{
if (m_fuelDetails.isEmpty() && m_placemark.visualCategory() == GeoDataFeature::TransportFuel) {
addTagDescription(m_fuelDetails, "fuel:diesel", "yes", tr("Diesel"));
addTagDescription(m_fuelDetails, "fuel:octane_91", "yes", tr("Octane 91"));
addTagDescription(m_fuelDetails, "fuel:octane_95", "yes", tr("Octane 95"));
addTagDescription(m_fuelDetails, "fuel:octane_98", "yes", tr("Octane 98"));
addTagDescription(m_fuelDetails, "fuel:e10", "yes", tr("E10"));
addTagDescription(m_fuelDetails, "fuel:lpg", "yes", tr("LPG"));
}
return m_fuelDetails;
}
void Placemark::setName(const QString & name) void Placemark::setName(const QString & name)
{ {
if (m_placemark.name() == name) { if (m_placemark.name() == name) {
...@@ -323,7 +334,7 @@ QString Placemark::categoryName(GeoDataFeature::GeoDataVisualCategory category) ...@@ -323,7 +334,7 @@ QString Placemark::categoryName(GeoDataFeature::GeoDataVisualCategory category)
case GeoDataFeature::TransportBusStation: return tr("Bus Station"); case GeoDataFeature::TransportBusStation: return tr("Bus Station");
case GeoDataFeature::TransportBusStop: return tr("Bus Stop"); case GeoDataFeature::TransportBusStop: return tr("Bus Stop");
case GeoDataFeature::TransportCarShare: return tr("Car Sharing"); case GeoDataFeature::TransportCarShare: return tr("Car Sharing");
case GeoDataFeature::TransportFuel: return tr("Fuel"); case GeoDataFeature::TransportFuel: return tr("Gas Station");
case GeoDataFeature::TransportParking: return tr("Parking"); case GeoDataFeature::TransportParking: return tr("Parking");
case GeoDataFeature::TransportParkingSpace: return tr("Parking Space"); case GeoDataFeature::TransportParkingSpace: return tr("Parking Space");
case GeoDataFeature::TransportPlatform: return tr("Platform"); case GeoDataFeature::TransportPlatform: return tr("Platform");
...@@ -428,11 +439,14 @@ void Placemark::addTagValue(const QString &key) const ...@@ -428,11 +439,14 @@ void Placemark::addTagValue(const QString &key) const
} }
} }
void Placemark::addTagDescription(const QString &key, const QString &value, const QString &description) const void Placemark::addTagDescription(QString &target, const QString &key, const QString &value, const QString &description) const
{ {
auto const & osmData = m_placemark.osmData(); auto const & osmData = m_placemark.osmData();
if (osmData.containsTag(key, value)) { if (osmData.containsTag(key, value)) {
m_description += " - " + description; if (!target.isEmpty()) {
target += " · ";
}
target += description;
} }
} }
......
...@@ -32,6 +32,7 @@ class Placemark : public QObject ...@@ -32,6 +32,7 @@ class Placemark : public QObject
Q_PROPERTY( QString name WRITE setName READ name NOTIFY nameChanged ) Q_PROPERTY( QString name WRITE setName READ name NOTIFY nameChanged )
Q_PROPERTY( QString description READ description NOTIFY descriptionChanged ) Q_PROPERTY( QString description READ description NOTIFY descriptionChanged )
Q_PROPERTY( QString address READ address NOTIFY addressChanged ) Q_PROPERTY( QString address READ address NOTIFY addressChanged )
Q_PROPERTY( QString fuelDetails READ fuelDetails NOTIFY fuelDetailsChanged)
public: public:
/** Constructor */ /** Constructor */
...@@ -46,6 +47,7 @@ public: ...@@ -46,6 +47,7 @@ public:
QString name() const; QString name() const;
QString description() const; QString description() const;
QString address() const; QString address() const;
QString fuelDetails() const;
public Q_SLOTS: public Q_SLOTS:
void setName(const QString &name); void setName(const QString &name);
...@@ -56,11 +58,12 @@ Q_SIGNALS: ...@@ -56,11 +58,12 @@ Q_SIGNALS:
void nameChanged(); void nameChanged();
void descriptionChanged(); void descriptionChanged();
void addressChanged(); void addressChanged();
void fuelDetailsChanged();
private: private:
QString categoryName(GeoDataFeature::GeoDataVisualCategory category) const; QString categoryName(GeoDataFeature::GeoDataVisualCategory category) const;
void addTagValue(const QString &key) const; void addTagValue(const QString &key) const;
void addTagDescription(const QString &key, const QString &value, const QString &description) const; void addTagDescription(QString &target, const QString &key, const QString &value, const QString &description) const;
QString addressFromExtendedData() const; QString addressFromExtendedData() const;
QString addressFromOsmData() const; QString addressFromOsmData() const;
QString formatStreet(const QString &street, const QString &houseNumber) const; QString formatStreet(const QString &street, const QString &houseNumber) const;
...@@ -69,10 +72,11 @@ private: ...@@ -69,10 +72,11 @@ private:
Coordinate m_coordinate; Coordinate m_coordinate;
mutable QString m_address; // mutable to allow lazy calculation in the getter mutable QString m_address; // mutable to allow lazy calculation in the getter
mutable QString m_description; mutable QString m_description;
mutable QString m_fuelDetails;
}; };
} }
QML_DECLARE_TYPE( Marble::Placemark ) QML_DECLARE_TYPE(Marble::Placemark)
#endif // MARBLE_DECLARATIVE_PLACEMARK_H #endif // MARBLE_DECLARATIVE_PLACEMARK_H
Markdown is supported
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