Updating a point of a polygon already on the map

3 posts, 0 answers
  1. Brian
    Brian avatar
    5 posts
    Member since:
    Nov 2011

    Posted 09 Nov 2011 Link to this post

    I'm trying to update a polygon-point location using a Map.MouseMove handler but the shape on the map is displayed incorrectly, as if the polygon bounds are not updated.  If I position the updated point within the bounds of the existing polygon, all the points are rendered correctly.  Changing the zoom level also corrects the problem, until the mouse is moved enough again.

    I've attached screenshots:

    RadMapPolygonA.png shows the initial, correct state, with the red dot showing the MouseMove position which is supposed to update the location of the point beneath it.

    RadMapPolygonB.png shows what happens if you update the location property of the polygon point outside the bounds of the existing polygon.  

    RadMapPolygonC.png shows the correctly rendered polygon after I changed the zoom level and reset it.

    void RadMapMouseMove(object sender, MouseEventArgs e)
        if (!vm.DrawingShape || vm.CurrentShape == null) return;
        if (vm.CurrentShape.LocationWrappers.Count < 2) return;
        var locationWrapper = vm.CurrentShape.LocationWrappers[vm.CurrentShape.LocationWrappers.Count - 1];
        var location = Location.GetCoordinates(RadMap, e.GetPosition(RadMap));
        locationWrapper.Location = location;  // updates databound LocationCollection

  2. Brian
    Brian avatar
    5 posts
    Member since:
    Nov 2011

    Posted 09 Nov 2011 Link to this post

    I found a workaround.  Toggling the map control's ZoomLevel property in the move handler seems to fix the render problem.

  3. Andrey
    Andrey avatar
    1681 posts

    Posted 14 Nov 2011 Link to this post

    Hi Brian,

    Unfortunately we can't reproduce the problem just using the code snippet you sent.
    Could you, please, provide us with a small sample solution which reproduces it?

    We already have a solution which allows to draw a polygon using the MapMouseClick and MapMouseDoubleClick events. It works without any problem. You may find the sample project attached. I hope it helps.

    All the best,
    Andrey Murzov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top