示例#1
0
        private List<Incident> GetIncidents(string fromAddress, string toAddress)
        {
            var route = new Route(fromAddress,
                                  toAddress);

            var points = route.GetRoutePoints();

            var boundingBox = route.GetBoundingBox();

            var incidentsController = new IncidentsController(boundingBox);

            var incidents = incidentsController.GetIncidents();

            var incidentsOnTheRoute = new List<Incident>();

            foreach (var incident in incidents)
            {
                RoutePoint prevPoint = null;
                foreach (var point in points)
                {
                    if (prevPoint != null)
                    {

                        var box = Util.BuildCollisionBox(prevPoint, point);

                        if (incident.Location.FallsWithin(box))
                        {
                            incidentsOnTheRoute.Add(incident);
                            break;
                        }
                    }
                    prevPoint = point;
                }
            }

            return incidentsOnTheRoute;
        }
示例#2
0
        public void SuggestAlternateRoute(long[] linkToAvoid)
        {
            var route = new Route(_addresses[0],                // TODO: Igor, add support for multiple waypoints
                      _addresses[1]);

            var someString = route.GetAlternateRoute(linkToAvoid);
        }