I’ve already managed to successfully load a map (using the sample countries_2.shp file) using a WPF application.
Now, I’m trying to dynamically manipulate icons (small bitmap images of approximately 32 by 32 pixels) on the map. I have the following requirements:
- the number of icons on the map varies and more than one type of icons may be shown simultaneously on the map
- the icons are place on the map based on specific latitude and longitude values
- the icons need to be rotated, based on a certain heading of the entity that the icons are representing.
What is the best Map Suite WPF feature to be used in this case?
Manipulating icons on the map dynamically
Hi Cheng,
Thanks for your post, attached code should be able to provide a basic idea for this functionality, would you please try it?
if you have any more question , please feel free to let us know.
Best Regards
Summer
Post11483.txt (3.31 KB)
Hi Summer,
thanks for the reply.
If I need to simulate up to 100 bitmap symbols and:
- each of them are updated periodically (more than once a second) with its individual latitude, longitude and heading. The latitude, longitude and heading are dynamically updated.
- not all the bitmap symbols are the same
What will be the best method in this case? And are there any performance issues to watch out for?
Hi Cheng,
Summer’s code is our basic function for show marker and it should works well for simple scenario.
Please make sure only refresh MarkerOverlay when update your markers: wpfMap1.Refresh(wpfMap1.Overlays[“MarkerOverlay”]);
We have some discuss in this topic, the scenario is similar with yours, so maybe helpful.
thinkgeo.com/forums/MapSuite/tabid/143/aft/11406/Default.aspx
Regards,
Don
Hi Cheng,
Summer’s code is our basic function for show marker and it should works well for simple scenario.
Don’t worry about the performance problem, I tested Summer’s code with big number of marker, the speed is very fast.
Please make sure only refresh MarkerOverlay when update your markers:
wpfMap1.Refresh(wpfMap1.Overlays[
“MarkerOverlay”
]);
Regards,
Don
Hi Cheng,
Don is right, it is fast when the markers' count is 100, and I made a deeper test with attached test code, I added 1000 markers the time for adding markers is 1200ms, the time for drawing these markers is 70ms (we used win8 and intel core i7-3770).
Hope our test could be helpful,
Another thing for your infromation is that our sample is just for your reference because there are some none-built-in methods like KiRotate(). and bitmap.GetHbitmap();
if you have any more question , please feel free to let us know.
Best Regards
Summer
001_Post11483.txt (4.37 KB)
Hi,
thanks a lot for the help previously. Now I intend to do more with the bitmap icon markers:
1. For each icon, I will like to print some information next to it. Like some meaningful name to help identify each symbol on the map. I don’t intend to use the tool tip function, the string/information is persistent and stays with each icon throughout its life span.
2. I also intend to blink the icon if necessary. I thought of using a timer to toggle the visibility of the respective marker. Not sure if it is a good way to do it.
Can you please advise what is the best way to do it?
Hi Cheng,
I take over this post in these days as Don and Summer are on the holiday.
When we look into the Marker class definition, we can see the Map Suite Marker inherits from ContentControl which is a basic control In WPF.
Based on this point. For the first question, The “Content” property of the Marker can be set as the marker label. More details please have a look at HowDoI samples=>Markers=>AddLabelOnMarker.
As for the second question, currently if there is not a performance issue when rendering those markers , I think it is a good choice to make use of the visibility property of the control. However, if those markers can be very large, I guess we should consider to remove those useless markers to reduce the elements in Wpf element tree.
Don’t hesitate to let us know if there is any questions.
Thanks
Johnny