[Marble-devel] calculating the distance between two points
Dennis Nienhüser
earthwings at gentoo.org
Wed Mar 24 20:54:53 CET 2010
Hi Emil,
emil vanherp wrote:
> Hello,
>
> I'd like to write something to see the traveled distance at each point
> of an imported gpx file.
> As Marble already has the possibility to calculate the distance
> between two measure points, I assume I could use the same function to
> calculate the distance between each point in my gpx file.
> Now is my question: where can I find this function?
>
a suitable data structure is a GeoDataLineString. You can pass in all
the points you are interested in (in order) and use its length() method.
The method requires the planet's radius as parameter. You can retrieve
it from MarbleModel::planetRadius() or use the EARTH_RADIUS constant
(earth only: the quick, but deprecated way).
> (PS. I don't really have experience with coding and this feature I
> need seemed a nice start. I already have (read) books about Qt and C++
> but I've never written something useful)
>
Everything is useful; at minimum you'll learn while writing it.
Good start and have fun :-)
Regards,
Dennis
More information about the Marble-devel
mailing list