Animated Symbols?

Oct 24, 2014 at 11:35 AM
Hi,

Just started using Mapsui, its very cool.

I was wondering how I could implement some kind of animated symbol?

Could I supply a framework element to use as the symbol, and that element could contain a storyboard that handled the animation?


Thanks,

Rob
Oct 24, 2014 at 12:06 PM
That might not be very easy. What kind of animation are we talking about? Movement? Changing colors? Are you working with WPF?

Perhaps it is an option to create your own layer by putting a Canvas on top of your MapControl (with IsHitTestVisible = false) and position your framework element in that Canvas on the MapControl.ViewChanged event using MapControl.Map.Viewport.WorldToScreen.
Oct 24, 2014 at 2:19 PM
Hi, thanks for the reply.

Yes its WPF.

I guess the kind of thing I was thinking was changing colours, or perhaps morphing icons depending on state (think of something in an alerted state which should show as a different icon)

Or how about animated rain clouds or something for a weather layer?

That kind of thing.

I don't know at lot about WPF, but I know you can do storyboards for a framework element, so I thought it might not be too hard to support.

Thanks,

Rob
Dec 15, 2014 at 1:53 PM
I've recently looked at Openlayers 3 and this can do a similar thing to what I was looking for. So using OL3 you can create an overlay item at a location, and then you give it a html element to render. It then renders that element at that location.
Its really cool because it it really powerful. I can supply <video> tags, and have little videos playing over the map surface.

This is the kind of thing I was thinking with Mapsui in that I can provide a framework element as the 'style', and that gets rendered on the map. Then I can just make the icon do anything at that location. How feasible does that sound?

Thanks
Dec 15, 2014 at 5:21 PM
Edited Dec 15, 2014 at 6:00 PM
So I think what you want is to position a WPF UIElement on a map location? Such a UIElement could be any WPF control, including a video.

A solution could be that you create an overlay on top of the MapControl. Such a 'WPFLayer' could position the UIElements on the screen on every change of the Viewport. You could add a listener to the MapControl.ViewChanged. On every change you can position the UIElements with:
MapControl.Map.Viewport.WorldToScreen(...)

btw, Mapsui has moved to github, please add your questions there (as issues with the 'question' tag)
https://github.com/pauldendulk/Mapsui