예제 #1
0
        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;
        }
예제 #2
0
        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;
        }
예제 #3
0
        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;
            }
        }
예제 #4
0
        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());
            }
        }