Hi,
I would like to draw lines from one point to another but I need them to stay in the ocean and avoid land masses. So the line would path find around Africa instead of going through it for instance. Is there any built in way to do this?
Thanks!
Path Finding in Ocean
Hi Todd,
First you should have a shape file contains some polygonshapes which render Africa’s border.
Then you would like to draw a line from one point to another.
And some APIs should work together for that.
As below is just a simple sample shows basic, you should want to modify it follow your requirement.
PolygonShape africa = new PolygonShape();
LineShape straightline = new LineShape();
MultipointShape points = straightline.GetCrossing(africa);
if (points.Points.Count == 2)
{
LineShape africaBorder = new LineShape(africa.OuterRing.Vertices);
LineShape resultLine = (LineShape)africaBorder.GetLineOnALine(points.Points[0], points.Points[1]);
resultLine.Vertices.Insert(0, straightline.Vertices[0]);
resultLine.Vertices.Add(straightline.Vertices[1]);
}
Any question please let me know.
Regards,
Don