This is a migrated thread and some comments may be shown as answers.

Path on map given a location collection

2 Answers 191 Views
Map
This is a migrated thread and some comments may be shown as answers.
Etienne
Top achievements
Rank 1
Etienne asked on 09 Nov 2016, 03:54 PM

Hi,

I would like to draw a path on a RadMap using locations from an ObservableCollection. I looked at MapPathFigureView (from http://www.telerik.com/forums/draw-a-curve-on-the-map#62RbZ0kLxkCXT7mDVmvT8A) but I didn't find a way to bind to segments collection.

So is there a way to do that ?

Thanks,

Etienne

2 Answers, 1 is accepted

Sort by
0
Accepted
Petar Mladenov
Telerik team
answered on 10 Nov 2016, 09:37 AM
Hello Etienne,

I assume your ObservableCollection of points contains a Latitude/Longitude pairs, if no, please make sure to prepare collection of such Telerik.Windows.Controls.Map.Location objects.

So how to show path / polyline, having such location collection ?

A) Data Objects. These are the shape data objects used in Visualization Layer. This will be the fastest solution because internally multiple threads process the geometries. You need to build the Polyline segments or Path Figures in code behind - iterate your collection and build the collection shape data objects need. IMO you can use both PolylineData and PathData with PathFiguresData collection.

B) Bindable wrappers. These are the MapPathView, MapPathFigureView (Map__X__View naming). They internally create and use shape data objects, should be used only in DataTemplates and support databinding. However, they are slower than the shape data objects. Here you can bind directly the Points collection of MapPolylineView. On the other hand MapPathFigureView, has Segments property of type MapPathSegmentViewCollection. You can create such collection and populate it with MapLineSegmentView objects. However, since you need to do this is model / code behind (before binding the Segements collection), there is no big benefit compared to simply using data objects. So if you need MVVM , we encourage you to use MapPolylineView / MapPolygonView.

Regards,
Petar Mladenov
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
0
Etienne
Top achievements
Rank 1
answered on 15 Nov 2016, 04:58 PM

Hi Petar,

Thanks for the informations, I used the solution with MapPolylineView and it works great.

Have a nice day!

Etienne

Tags
Map
Asked by
Etienne
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Etienne
Top achievements
Rank 1
Share this question
or