Hi Nirish,
You can get that follow below steps:
1. Add a new method used in the sample:
private RectangleShape GenerateMiniBoundingBox(PointShape pointShape)
{
double tolerance = 1e-3;
RectangleShape bbox = new RectangleShape();
double miniTolerance = tolerance / 2;
bbox.UpperLeftPoint.X = pointShape.X - miniTolerance;
bbox.UpperLeftPoint.Y = pointShape.Y + miniTolerance;
bbox.LowerRightPoint.X = pointShape.X + miniTolerance;
bbox.LowerRightPoint.Y = pointShape.Y - miniTolerance;
return bbox;
}
2. Add some code below in the method btnFindBestRoute_Click of that sample:
private void btnFindBestRoute_Click(object sender, EventArgs e)
{
........
// Render the route
routingLayer.Routes.Clear();
int count = routingResult.VisitSequence.Count;
PointShape lastPointShape = routingResult.VisitSequence[count - 1];
RectangleShape rectangleShape = GenerateMiniBoundingBox(lastPointShape);
int index = routingResult.Route.Lines.Count-1;
while (!routingResult.Route.Lines[index].Crosses(rectangleShape))
{
routingResult.Route.Lines.RemoveAt(index);
index--;
};
routingResult.Route.Lines.RemoveAt(index);
routingLayer.Routes.Add(routingResult.Route);
.........
}
Any questions please let us know.
Thanks,
Johnny