private void CallT_Click(object sender, RoutedEventArgs e) { CBar.Value = 0; Car nearestCar = null; RStart = Passanger.getFocus(); var Obj = mapObjects.OrderBy(mapObject => mapObject.getDistance(RStart)); foreach (MapObject obj in Obj) { if (obj is Car) { nearestCar = (Car)obj; break; } } CallT.IsEnabled = false; var route = nearestCar.MoveTo(RStart); MapObject mapObject_path = new Route_c(OName.Text, "Route", route.Points, route.Points.First()); Map.Markers.Add(mapObject_path.GetMarker()); RoutingProvider routingProvider = GMapProviders.OpenStreetMap; MapRoute rroute = routingProvider.GetRoute(RStart, RFinish, false, false, 15); MapObject mapObject_path1 = new Route_c(OName.Text, "Route", rroute.Points, rroute.Points.First()); Map.Markers.Add(mapObject_path1.GetMarker()); nearestCar.Arrived += Passanger.CarArrived; Passanger.seated += nearestCar.getintocar; nearestCar.Follow += Focus_Follow; }
public void createroute(List <PointLatLng> points) { rpointc = 0; MapObject mapObject_path = new Route_c(OName.Text, "Route", points, points[0]); mapObjects.Add(mapObject_path); Map.Markers.Add(mapObject_path.GetMarker()); OList.Items.Add(mapObjects.Last().objectType + " - " + mapObjects.Last().objectName); createra.IsEnabled = false; clearpoints.IsEnabled = false; }
public void createroute(List <PointLatLng> points) { rpointc = 0; MapObject mapObject_path = new Route_c(OName.Text, "Route", points, points[0]); mapObjects.Add(mapObject_path); Map.Markers.Add(mapObject_path.GetMarker()); OList.Items.Add(mapObjects.Last().objectType + " - " + mapObjects.Last().objectName); createra.IsEnabled = false; clearpoints.IsEnabled = false; mloc += 1; if (mloc > 1 && mcar > 0 && mhuman > 0) { ChooseH.IsEnabled = true; ChooseD.IsEnabled = true; } }
private void createMarker(List <PointLatLng> points, int index) { MapObject mapObject = null; switch (index) { case 4: { if (points.Count < 3) { MessageBox.Show("Выберите точки"); return; } mapObject = new Area(OName.Text, points); break; } case 0: { if (points.Count < 1) { MessageBox.Show("Выберите точки"); return; } mapObject = new Location_c(OName.Text, points.Last()); break; } case 1: { if (points.Count < 1) { MessageBox.Show("Выберите точки"); return; } mapObject = new Car(OName.Text, points.Last()); break; } case 2: { if (points.Count < 1) { MessageBox.Show("Выберите точки"); return; } mapObject = new Human(OName.Text, points.Last()); break; } case 3: { if (points.Count < 2) { MessageBox.Show("Выберите точки"); return; } mapObject = new Route_c(OName.Text, points); break; } } if (mapObject != null) { mapObjects.Add(mapObject); Map.Markers.Add(mapObject.GetMarker()); } }