Hi,
We have requirements to display raster images of many traffic devices along a road/street in a region/city. We already know the coordinates the road goes through. Using graphic overlays, we are able to add the device images on the map, exactly at the given coordinates. Each device image must have a WPF Checkbox control right below it, and when the checkbox is selected some additional UI actions will happen in the Application. We found out that 'OverlayItemsControl' control can be used to display any WPF UI Control on the map, using the 'Overlays' property of the 'MapView' control. But by default, all 'OverlayItemsControl' is being displayed on the zero coordinates (i,e at latitude 0, longitude 0). Of course, we don't want the checkboxes on the zero coordinates, instead, we need those on the coordinates of the road/street of our interest.
So,
1. How can we control the coordinates/positioning of the 'OverlayItemsControl' ? Event better if we can directly control the checkbox control's position, instead of controlling OverlayItemsControl.
Is there a way ?
2.Is it possible that when the map is zoomed, the checkboxes also become bigger/smaller responding to the zooming action ?
3. If the above 2 actions are not possible, my plan B is, draw polygons ,lines to simulate a checkbox control at the given coordinates, with check/uncheck behavior implemented accordingly, and put everything in the graphics overlay. Is this a feasible plan, given we will have a few hundreds of devices on the map as graphic overlay ?
Is there any other better design that can achieve our goals ?
Let us know. Thanks in advance.
Regards,
ABM Rokonuzzaman
You will need to set the ViewOverlayAnchor attached property on your view element so the mapview knows how to position it. Example:
GeoView.SetViewOverlayAnchor(myCheckBox, new MapPoint(-117, 34, SpatialReferences.Wgs84));
See the doc here:
https://developers.arcgis.com/net/api-reference/api/netwin/winui/Esri.ArcGISRuntime.UI.Controls.GeoV...
and here:
https://developers.arcgis.com/net/api-reference/api/netwin/winui/Esri.ArcGISRuntime.UI.Controls.GeoV...
Thanks for your reply. Positioning on a desired coordinate part works following your advice, but is there a way to make this wpf ui control (i,c checkbox or any other control) responding to the map zooming actions accordingly ? When trying your solution, the ui control size remains the same size, and the map area behind it zooms in or out depending on what the user is trying.
No the anchor is only to a certain location, and not scaling.
> Is this a feasible plan, given we will have a few hundreds of devices on the map as graphic overlay ?
This will definitely give you performance issues. The feature is meant for minor set of elements like callout to be placed at a location. For high performance rendering you really need to be rendering with the existing layer types - XAML just isn't geared for that kind of dynamic rendering.
You could look into the raster layers which allows you to place raster images that'll scale with the zoom.