Polyline or multicolor route

Jun 5, 2009 at 9:56 PM
Edited Jun 5, 2009 at 10:00 PM

Hi radioman

First I want to thank you for great control. It is realy awesome!!!

I am quite new to this and I have trying your control for a few days now - I am using standard windows forms application.

I have a problem and I hope somebody would be able to help me out or point me in right direction.

I would need a possibility to draw route that would have different colors based on speed of tracking wehicle. I think currently this is not available but I would appreciate if somebody can point me into right direction how to do that or what would be nedded to change in source code.

If somebody is interesting I have managed to expand a bit route property where I have add Pen property so that I can change thickness of the route dynamicaly. I don't know this is interesting to anybody and if it is the right way to do but it works fine for me - just small contribution to community :-) 

In GMapRoute.cs below public Color color; I have add public Pen pen; and in GMapOverlay.cs under DrawRoutes method below RoutePen.Color = r.Color; I have added RoutePen.Width = r.Pen.Width;

If somebody would like to use other property of the Pen they can add it like RoutePen.DashStyle = r.Pen.DashStyle

Best regards radioman and all. 

Coordinator
Jun 5, 2009 at 10:21 PM

you can override protected virtual void DrawRoutes(Graphics g) in GMapOverlay

Jun 5, 2009 at 10:45 PM

Hi radioman

thank you for fast reply. I would do this but I don't know how - unfortunately.
What I have managed to do today is that I have tested in GMapOverlay trying to put code like two colors depend upon number of point like:

if (i<3) //points
{
RoutePen.Color = Color.Red
g.DrawLine(RoutePen, p2.X, p2.Y, p2.X, p2.Y);//instead of rp.AddLine(p2.X, p2.Y, p2.X, p2.Y);
}
else
{
RoutePen.Color = Color.Red
g.DrawLine(RoutePen, p2.X, p2.Y, p2.X, p2.Y);//instead of rp.AddLine(p2.X, p2.Y, p2.X, p2.Y);
}

But this is hard coded just for testing purposes to see how I can do this but I don't know how foe example to pass parameter for example number of points to be in this color and others in other color. I am not sure this is the right way to do it in the first place :-)

I would appreciate if you can just write me base code snippet for override protected virtual void DrawRoutes(Graphics g) in GmapOverlay -Howto do this - I hope it is not to much work for you.

Looking forward for your feedback.

Best regards