Re draw shape to new zoom value

Topics: WPF
Nov 8, 2011 at 8:35 AM

Hi,

I am using GMap.NET for WPF.

In the GMap.NET, after drawing rectangle when we zoom in/out the shape is redrawn correctly in the new zoom level because the values are taken from selectedArea topleft and Bottom right. I have requirement like pen where user can draw shape.

Below is the code snippets/ flow

In MouseleftButton i take the starting point

PointLatLng p1 = MainMap.FromLocalToLatLng(Convert.ToInt32(e.GetPosition(MainMap).X), Convert.ToInt32(e.GetPosition(MainMap).Y));

and in the Mousemove i am taking the points, the path on with mouse was moved. Using Geometry i add the paths and draw during Map render

var lineGeometry = new LineGeometry
                       {
                           StartPoint = new Point(StartXValue, StartYValue),
                           EndPoint = new Point(EndXValue, EndYValue)
                       };
    PathGeometry.AddGeometry(lineGeometry);
    drawingContext.DrawGeometry(null, SelectionPen, PathGeometry);

 

It works normally. But when we zoom in/out the drawn shape does not redraw with the new zoom level(since i am taking the mouse coordinates) and it renders again in the same size/area . Is there any way to have the above implementation and include the zoom functionality to this.

Regards,

Balaji