Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Education
Marble
Commits
22402709
Commit
22402709
authored
Jul 08, 2016
by
Dennis Nienhüser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show gas station details
parent
c78e47ed
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
40 deletions
+60
-40
src/apps/marble-maps/MarbleMaps.qrc
src/apps/marble-maps/MarbleMaps.qrc
+2
-0
src/apps/marble-maps/PlacemarkDialog.qml
src/apps/marble-maps/PlacemarkDialog.qml
+13
-16
src/apps/marble-maps/material-icons/ic_local_gas_station_48px.svg
.../marble-maps/material-icons/ic_local_gas_station_48px.svg
+1
-0
src/lib/marble/declarative/MarbleQuickItem.cpp
src/lib/marble/declarative/MarbleQuickItem.cpp
+2
-0
src/lib/marble/declarative/Placemark.cpp
src/lib/marble/declarative/Placemark.cpp
+36
-22
src/lib/marble/declarative/Placemark.h
src/lib/marble/declarative/Placemark.h
+6
-2
No files found.
src/apps/marble-maps/MarbleMaps.qrc
View file @
22402709
...
...
@@ -7,6 +7,7 @@
<file>SearchField.qml</file>
<file>Search.qml</file>
<file>CircularButton.qml</file>
<file>IconText.qml</file>
<file>PositionButton.qml</file>
<file>BoxedText.qml</file>
<file>ImageButton.qml</file>
...
...
@@ -48,6 +49,7 @@
<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="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>ScrollBar.qml</file>
</qresource>
...
...
src/apps/marble-maps/PlacemarkDialog.qml
View file @
22402709
...
...
@@ -21,7 +21,7 @@ Item {
property
var
placemark
:
null
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
()
{
viaGroup
.
current
.
execute
()
...
...
@@ -46,50 +46,47 @@ Item {
Column
{
id
:
infoLayout
clip
:
true
anchors
{
to
p
:
parent
.
to
p
bot
to
m
:
parent
.
bot
to
m
left
:
parent
.
left
right
:
actionsLayout
.
left
margins
:
Screen
.
pixelDensity
*
2
}
height
:
nameLabel
.
height
+
(
descriptionLabel
.
text
==
""
?
0
:
descriptionLabel
.
height
)
+
(
addressLabel
.
text
==
""
?
0
:
addressLabel
.
height
)
Text
{
Icon
Text
{
id
:
nameLabel
width
:
parent
.
width
text
:
placemark
===
null
?
""
:
placemark
.
name
wrapMode
:
Text
.
WordWrap
elide
:
Text
.
ElideRight
maximumLineCount
:
2
font.pointSize
:
20
}
Text
{
Icon
Text
{
id
:
descriptionLabel
width
:
parent
.
width
text
:
placemark
===
null
?
""
:
placemark
.
description
wrapMode
:
Text
.
WordWrap
elide
:
Text
.
ElideRight
maximumLineCount
:
4
font.pointSize
:
14
}
Text
{
Icon
Text
{
id
:
addressLabel
width
:
parent
.
width
text
:
placemark
===
null
?
""
:
placemark
.
address
wrapMode
:
Text
.
WordWrap
elide
:
Text
.
ElideRight
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
{
id
:
actionsLayout
width
:
rowLayout
.
width
height
:
spacer
.
height
+
rowLayout
.
height
spacing
:
Screen
.
pixelDensity
*
2
anchors
{
right
:
parent
.
right
...
...
src/apps/marble-maps/material-icons/ic_local_gas_station_48px.svg
0 → 100644
View file @
22402709
<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
src/lib/marble/declarative/MarbleQuickItem.cpp
View file @
22402709
...
...
@@ -182,6 +182,8 @@ namespace Marble
MarbleQuickItem
::
MarbleQuickItem
(
QQuickItem
*
parent
)
:
QQuickPaintedItem
(
parent
)
,
d
(
new
MarbleQuickItemPrivate
(
this
))
{
qRegisterMetaType
<
Placemark
*>
(
"Placemark*"
);
foreach
(
AbstractFloatItem
*
item
,
d
->
m_map
.
floatItems
())
{
if
(
item
->
nameId
()
==
"license"
)
{
item
->
setPosition
(
QPointF
(
5.0
,
-
10.0
));
...
...
src/lib/marble/declarative/Placemark.cpp
View file @
22402709
...
...
@@ -34,6 +34,9 @@ void Placemark::setGeoDataPlacemark( const Marble::GeoDataPlacemark &placemark )
emit
nameChanged
();
emit
descriptionChanged
();
emit
addressChanged
();
if
(
m_placemark
.
visualCategory
()
==
GeoDataFeature
::
TransportFuel
)
{
emit
fuelDetailsChanged
();
}
}
Marble
::
GeoDataPlacemark
Placemark
::
placemark
()
const
...
...
@@ -62,19 +65,19 @@ QString Placemark::description() const
if
(
category
>=
GeoDataFeature
::
FoodBar
&&
category
<=
GeoDataFeature
::
FoodRestaurant
)
{
addTagValue
(
"brand"
);
addTagValue
(
"cuisine"
);
addTagDescription
(
"self_service"
,
"yes"
,
"Self Service"
);
addTagDescription
(
"takeaway"
,
"yes"
,
"Take Away"
);
addTagDescription
(
"outdoor_seating"
,
"yes"
,
"Outdoor Seating"
);
addTagDescription
(
"ice_cream"
,
"yes"
,
"Ice Cream"
);
addTagDescription
(
"smoking"
,
"dedicated"
,
"Smoking (dedicated)"
);
addTagDescription
(
"smoking"
,
"yes"
,
"Smoking allowed"
);
addTagDescription
(
"smoking"
,
"separated"
,
"Smoking (separated)"
);
addTagDescription
(
"smoking"
,
"isolated"
,
"Smoking (isolated)"
);
addTagDescription
(
"smoking"
,
"no"
,
"No smoking"
);
addTagDescription
(
"smoking"
,
"outside"
,
"Smoking (outside)"
);
addTagDescription
(
"smoking:outside"
,
"yes"
,
"Smoking (outside)"
);
addTagDescription
(
"smoking:outside"
,
"separated"
,
"Smoking (outside separated)"
);
addTagDescription
(
"smoking:outside"
,
"no"
,
"No smoking outside"
);
addTagDescription
(
m_description
,
"self_service"
,
"yes"
,
"Self Service"
);
addTagDescription
(
m_description
,
"takeaway"
,
"yes"
,
"Take Away"
);
addTagDescription
(
m_description
,
"outdoor_seating"
,
"yes"
,
"Outdoor Seating"
);
addTagDescription
(
m_description
,
"ice_cream"
,
"yes"
,
"Ice Cream"
);
addTagDescription
(
m_description
,
"smoking"
,
"dedicated"
,
"Smoking (dedicated)"
);
addTagDescription
(
m_description
,
"smoking"
,
"yes"
,
"Smoking allowed"
);
addTagDescription
(
m_description
,
"smoking"
,
"separated"
,
"Smoking (separated)"
);
addTagDescription
(
m_description
,
"smoking"
,
"isolated"
,
"Smoking (isolated)"
);
addTagDescription
(
m_description
,
"smoking"
,
"no"
,
"No smoking"
);
addTagDescription
(
m_description
,
"smoking"
,
"outside"
,
"Smoking (outside)"
);
addTagDescription
(
m_description
,
"smoking:outside"
,
"yes"
,
"Smoking (outside)"
);
addTagDescription
(
m_description
,
"smoking:outside"
,
"separated"
,
"Smoking (outside separated)"
);
addTagDescription
(
m_description
,
"smoking:outside"
,
"no"
,
"No smoking outside"
);
}
else
if
(
category
>=
GeoDataFeature
::
ShopBeverages
&&
category
<=
GeoDataFeature
::
Shop
)
{
addTagValue
(
"operator"
);
}
else
if
(
category
==
GeoDataFeature
::
TransportBusStop
)
{
...
...
@@ -87,12 +90,6 @@ QString Placemark::description() const
}
else
if
(
category
==
GeoDataFeature
::
TransportFuel
)
{
addTagValue
(
"brand"
);
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
)
{
addTagValue
(
"species:en"
);
addTagValue
(
"genus:en"
);
...
...
@@ -119,6 +116,20 @@ QString Placemark::address() const
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
)
{
if
(
m_placemark
.
name
()
==
name
)
{
...
...
@@ -323,7 +334,7 @@ QString Placemark::categoryName(GeoDataFeature::GeoDataVisualCategory category)
case
GeoDataFeature
::
TransportBusStation
:
return
tr
(
"Bus Station"
);
case
GeoDataFeature
::
TransportBusStop
:
return
tr
(
"Bus Stop"
);
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
::
TransportParkingSpace
:
return
tr
(
"Parking Space"
);
case
GeoDataFeature
::
TransportPlatform
:
return
tr
(
"Platform"
);
...
...
@@ -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
();
if
(
osmData
.
containsTag
(
key
,
value
))
{
m_description
+=
" - "
+
description
;
if
(
!
target
.
isEmpty
())
{
target
+=
" · "
;
}
target
+=
description
;
}
}
...
...
src/lib/marble/declarative/Placemark.h
View file @
22402709
...
...
@@ -32,6 +32,7 @@ class Placemark : public QObject
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
fuelDetails
READ
fuelDetails
NOTIFY
fuelDetailsChanged
)
public:
/** Constructor */
...
...
@@ -46,6 +47,7 @@ public:
QString
name
()
const
;
QString
description
()
const
;
QString
address
()
const
;
QString
fuelDetails
()
const
;
public
Q_SLOTS
:
void
setName
(
const
QString
&
name
);
...
...
@@ -56,11 +58,12 @@ Q_SIGNALS:
void
nameChanged
();
void
descriptionChanged
();
void
addressChanged
();
void
fuelDetailsChanged
();
private:
QString
categoryName
(
GeoDataFeature
::
GeoDataVisualCategory
category
)
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
addressFromOsmData
()
const
;
QString
formatStreet
(
const
QString
&
street
,
const
QString
&
houseNumber
)
const
;
...
...
@@ -69,10 +72,11 @@ private:
Coordinate
m_coordinate
;
mutable
QString
m_address
;
// mutable to allow lazy calculation in the getter
mutable
QString
m_description
;
mutable
QString
m_fuelDetails
;
};
}
QML_DECLARE_TYPE
(
Marble
::
Placemark
)
QML_DECLARE_TYPE
(
Marble
::
Placemark
)
#endif // MARBLE_DECLARATIVE_PLACEMARK_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment