Represent a moving object track on map

2 posts, 0 answers
  1. Peter
    Peter avatar
    27 posts
    Member since:
    Oct 2016

    Posted 09 Dec 2016 Link to this post

    Hi,

    I'm trying to use radmap to show a number of objects that move (between updates, approximately every 500ms). I'm showing the track the object has taken as a number of line segments (currently using PolyLineView). I've bound the layer item source to a collection containing the object (as an image) and a line segment showing for each track update. Can you advise on the best way to cause the tracks to be redrawn when a track update happens? I've been using an observable collection but the layer does not seem to update in response to the addition of a new line segment view model.

    The other problem I have is that I'd like to draw each line segment as a colored line with a shadow effect - I'm not sure if this is possible?

    I'd also like each line segment to show a tooltip when the user hovers over the line segment - is there some way I can increase the size of the area the mouse has to be over to show the tooltip (i.e. if the line thickness is small the user have to position the mouse very accurately.

    Thanks for any suggestions received,

    Pete

  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2969 posts

    Posted 13 Dec 2016 Link to this post

    Hello Peter,

    Could you please share more from your code - your DataTemplate and the exact class in it, is it MapPolylineView ? Also, your models and the code which adds new segment, this will give us better detail of your setup and we will be better able to advise you.

    I want to make a quick clarification that if you use hundreds / thousand of objects, probably the BindableWrappers ( MapPolylineView, MapPathView, MapLineView etc) will not be the fastest solution.
    So we encourage you to try directly frameworkelements in template, or event avoid MVVM and use the shape data objects.

    A template with Polyline would look like:
    <DataTemplate>
    <Grid ToolTip="some tooltip">
                <Polyline Points="1 50, 10 80, 20 40" Fill="Transparent" Stroke="Black" >
                    <Polyline.Effect>
                        <DropShadowEffect />
                    </Polyline.Effect>
                </Polyline>
            </Grid>

    You can see the DropShadow effect can be defined in xaml and also, the tooltip can be applied to a Grid, to increase the tooltip area around the polyline. In order to receive proper Mouse events needed for the tooltip, Grid might need background almost transparent - "#01FFFFF".

    Regards,
    Petar Mladenov
    Telerik by Progress
    Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Back to Top