Drawing Traceline

4 posts, 1 answers
  1. Vincent
    Vincent avatar
    7 posts
    Member since:
    Apr 2015

    Posted 23 Sep 2015 Link to this post

     Hi,

    I have marker point that updates it's position periodically on the map. If i wanted to draw a traceline on the map to keep track of the path that the marker point has moved, what would be the best way of doing it without slowing down the rendering of the details on the map?

     

  2. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 25 Sep 2015 Link to this post

    Hello Vincent,

    You can achieve your requirement by using the map's VisualizationLayer and its map shape data objects to draw the traceline and the marker. For example, you can use the PolylineData object to draw the traceline and when the marker's position is updated you can add new Location in the Points collection of the polyline. for your convenience I prepared a sample project demonstrating this approach. Please give it a try and let me know if it works for you.

    Regards,
    Martin
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Vincent
    Vincent avatar
    7 posts
    Member since:
    Apr 2015

    Posted 17 Dec 2015 in reply to Martin Link to this post

    Hi Martin,

    the example you provided was really helpful thank you, however I come across a problem when I try to clear the LocationCollection (Contains 1 hour of data points that's roughly 72k worth of location) it took me roughly around 4 to 5 seconds before the layer clears it all off. Any recommendation how I can clear this fast?

     a sample code

     visualizationLayer.Visibility = false;

    visualizationLayer.Points.RemoveAll();

    visualizationLayer.Layer.Items.Clear();

     

     

  5. Answer
    Martin
    Admin
    Martin avatar
    1101 posts

    Posted 21 Dec 2015 Link to this post

    Hello Vincent,

    Removing an item from the Points collection of a PlylineData object executes a logic in code which requires additional computing time. This is why clearing the collection takes several seconds. To improve the removing operation on your side you can use the Clear() method of the Points collection instead of RemoveAll().
    visualizationLayer.Points.Clear();

    Please try this and let me know if it works for you.

    Regards,
    Martin
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top