none
Animate a MapPolyLine? RRS feed

  • Question

  • I'm building a Windows Store app with C#/XAML and would like to be able to "animate" a PolyLine.  What I'm going for is to allow the user to draw the poly line with the mouse/stylus. As the PolyLine is extended with a new segment I want that new segment to track the mouse/stylus as it moves. The effect is like an animation, but I don't see trying to actually use the animation feature here. (Should I?)

    Just modifying the long/lat values of the last point doesn't cause the rendered object to change. Obviously the points themselves are not dependency properties.

    Might it work to extend the MapPolyLine type, adding a LastPoint dependency property that internally updates the lont/lat of the last Location in the collection? Would updating such a property cause a rerendering of the image?

    Thanks in advance,

     Bill


    Bill Cohagan

    Sunday, December 2, 2012 2:43 PM

Answers

  • Hi,

    on mouse move event you need to remove last polyline and after add new one

            shapeLayer.Shapes.Remove(lastpolyline);
            App.shapeLayer.Shapes.Add(newpolyline);
            map.ShapeLayers.Add(App.shapeLayer);


               

    Monday, December 3, 2012 6:54 AM

All replies

  • Hi,

    on mouse move event you need to remove last polyline and after add new one

            shapeLayer.Shapes.Remove(lastpolyline);
            App.shapeLayer.Shapes.Add(newpolyline);
            map.ShapeLayers.Add(App.shapeLayer);


               

    Monday, December 3, 2012 6:54 AM
  • Andrey

      Thanks for the quick answer! That works perfectly. Of course now, slapping my forehead, that's what I should have tried in the first place...

    Bill


    Bill Cohagan

    Tuesday, December 4, 2012 3:56 PM