Forum > Packages and Libraries

LazMapViewer Get Positions from Track

(1/1)

Dzandaa:
Hi,

Using Lazarus 2.0.12 on Windows, Mac, Linux

I'm Translating one of My program written in C# to Pascal Lazarus.
I use that program to visualize walks we've made with friends.

I'm using LazMapViewer and have 2 GPS Objects

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---   Track: TGpsTrack; // show the path of the track.   CurPos: TGpsPoint; // Show a Cursor
For now, all is O.K., I can load the path from a .CSV file and display it and also the Cursor at the start of the path.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- Track.Name := 'CSV'; Map.GPSItems.Add(Track, ID); CurPos.Name:= 'Pos'; Map.GpsItems.Add(CurPos, _CURSOR_);
My problem:
 I want CurPos to follow the Track with a timer.
But I don"t know how to get the Track positions back from
Map.GPSItems and set CurPos to a new value.

Any idea?

Thank you.

P.S. I found the solution by myself, thank you.

wp:
This is an interesting topic... Therefore I made some of the built-in functions a bit more user-friendly and added a new demo "trackdemo" which loads a gpx file and uses a separate GPSPoint which moves along the track, either triggered by a timer or by a user-click on the points in a points grid.

The timed motion of the track is flickering to some extent. This can be avoided by turning of the "UseThreads" property - the advantage is some waiting time at first program start until the map tiles have arrived from the map server.

Have a look at the CCR version of LazMapViewer to get this new code (it is not yet contained in the OPM release).

When writing this new demo I noticed that GPS points can only be displayed by a single loaded bitmap (POIImage) or by custom drawing. If somebody wants to display several kinds of bitmaps (one for "restaurants", one for "gas stations", one for "museums" etc) it would be maybe simpler to have an imagelist with all these images and an imageindex for the GPSPoint(s). Do you think this is a usefull extension of the lazMapViewer?

Navigation

[0] Message Index

Go to full version