Drawing Layers

Jun 18, 2009 at 8:10 AM

Hi Radioman.

Is it possible to draw a layer that can resize according to the zoom level.

I want to draw lines on the map with specific lengths (length based on distance) and then when the map zoom changes the layer adjusts accordingly.

I'm using it to draw Wind Plume lines based on wind speed over time.

Jun 18, 2009 at 11:17 AM

OnRender functions, you can use current zoom level to draw things accordingly, try look at scale info drawing code

Jun 18, 2009 at 11:37 AM
Edited Jun 18, 2009 at 11:38 AM

Thanks for the speedy reply.

My current OnRender function calls my DrawPlumeLines(Graphics g) Method.

If I understand correctly I can pass the current zoom level to it as well and then use it in my calculation of the Distance.

Currently I'm using two PointLatLng on the map and converting them to System.Drawing.Point s.

//Code Sample
centerP.X = LocalPosition.X;
centerP.Y = LocalPosition.Y

//Convert the EndPoint and Calculate the Distance
GMap.NET.Point ep = mapControl.FromLatLngToLocal(endPoint);
ePoint.X = ep.X;
ePoint.Y = ep.Y;

plumeLeadingEdge = GetDist(centerP, ePoint);

//GetDist Method
private float GetDist(System.Drawing.Point startPoint, System.Drawing.Point endPoint)
      float dist = 0;
      float diffX = endPoint.X - startPoint.X;
      float diffY = endPoint.Y - startPoint.Y;
      dist = (
float)Math.Pow((Math.Pow(diffX, 2) + Math.Pow(diffY, 2)), 0.5);
      return dist;

Can you give me push in the right direction?