Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Education
Marble
Commits
6424c2b1
Commit
6424c2b1
authored
May 10, 2021
by
Torsten Rahn
Browse files
Add toVariantList-function to GeoDataLineString.
parent
8957fd69
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/lib/marble/geodata/data/GeoDataLineString.cpp
View file @
6424c2b1
...
...
@@ -881,6 +881,30 @@ GeoDataLineString GeoDataLineString::optimized () const
}
}
QVariantList
GeoDataLineString
::
toVariantList
()
const
{
Q_D
(
const
GeoDataLineString
);
QVariantList
variantList
;
for
(
const
GeoDataCoordinates
&
itCoords
:
d
->
m_vector
)
{
QVariantMap
map
;
map
.
insert
(
"lon"
,
itCoords
.
longitude
(
GeoDataCoordinates
::
Degree
));
map
.
insert
(
"lat"
,
itCoords
.
latitude
(
GeoDataCoordinates
::
Degree
));
map
.
insert
(
"alt"
,
itCoords
.
altitude
());
variantList
<<
map
;
}
if
(
isClosed
())
{
QVariantMap
map
;
map
.
insert
(
"lon"
,
d
->
m_vector
.
first
().
longitude
(
GeoDataCoordinates
::
Degree
));
map
.
insert
(
"lat"
,
d
->
m_vector
.
first
().
latitude
(
GeoDataCoordinates
::
Degree
));
map
.
insert
(
"alt"
,
d
->
m_vector
.
first
().
altitude
());
variantList
<<
map
;
}
return
variantList
;
}
void
GeoDataLineString
::
pack
(
QDataStream
&
stream
)
const
{
Q_D
(
const
GeoDataLineString
);
...
...
src/lib/marble/geodata/data/GeoDataLineString.h
View file @
6424c2b1
...
...
@@ -384,6 +384,11 @@ class GEODATA_EXPORT GeoDataLineString : public GeoDataGeometry
*/
GeoDataLineString
optimized
()
const
;
/*!
\brief Returns a javascript-style list (that can be used e.g. with the QML GeoPolyline element).
*/
QVariantList
toVariantList
()
const
;
// Serialization
/*!
\brief Serialize the LineString to a stream.
...
...
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