This is a migrated thread and some comments may be shown as answers.

Updating a point of a polygon already on the map

2 Answers 129 Views
Map
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 10 Nov 2011, 01:43 AM
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 Answers, 1 is accepted

Sort by
0
Brian
Top achievements
Rank 1
answered on 10 Nov 2011, 03:28 AM
I found a workaround.  Toggling the map control's ZoomLevel property in the move handler seems to fix the render problem.

RadMap.ZoomLevel++;
--RadMap.ZoomLevel;
0
Andrey
Telerik team
answered on 14 Nov 2011, 10:27 AM
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 >>

Tags
Map
Asked by
Brian
Top achievements
Rank 1
Answers by
Brian
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or