Esempio n. 1
0
        private void CreateMapObject()
        {
            switch (comboBox.SelectedIndex)
            {
            case 0:
                Area area = new Area(textNameAdd.Text.ToString(), activePoints);
                mapObjects.Add(area);
                Map.Markers.Add(area.GetMarker());
                activePoints.Clear();
                break;

            case 1:
                Car car = new Car(textNameAdd.Text.ToString(), activePoints.Last());
                mapObjects.Add(car);
                Map.Markers.Add(car.GetMarker());
                activePoints.Clear();
                break;

            case 2:
                Classes.Route route = new Classes.Route(textNameAdd.Text.ToString(), activePoints);
                mapObjects.Add(route);
                Map.Markers.Add(route.GetMarker());
                activePoints.Clear();
                break;

            case 3:
                Human human = new Human(textNameAdd.Text.ToString(), activePoints.Last());
                mapObjects.Add(human);
                Map.Markers.Add(human.GetMarker());
                activePoints.Clear();
                break;

            case 4:
                Classes.Location location = new Classes.Location(textNameAdd.Text.ToString(), activePoints.Last());
                mapObjects.Add(location);
                Map.Markers.Add(location.GetMarker());
                activePoints.Clear();
                break;
            }
        }
Esempio n. 2
0
        private void CreateMapObject()
        {
            switch (comboBox.SelectedIndex)
            {
            case 0:
                if (activePoints.Count >= 3)
                {
                    Area area = new Area(textNameAdd.Text.ToString(), activePoints);
                    mapObjects.Add(area);
                    Map.Markers.Add(area.GetMarker());
                    activePoints.Clear();
                }
                else if (activePoints.Count < 3)
                {
                    MessageBox.Show("Count of active points must be bigger two");
                }
                activePoints.Clear();
                break;

            case 1:
                if (activePoints.Count > 0)
                {
                    Car car = new Car(textNameAdd.Text.ToString(), activePoints.Last());
                    mapObjects.Add(car);
                    Map.Markers.Add(car.GetMarker());
                    activePoints.Clear();
                }
                else if (activePoints.Count < 1)
                {
                    MessageBox.Show("Count of active points must be bigger zero");
                    activePoints.Clear();
                }
                break;

            case 2:
                if (activePoints.Count >= 2)
                {
                    Classes.Route route = new Classes.Route(textNameAdd.Text.ToString(), activePoints);
                    mapObjects.Add(route);
                    Map.Markers.Add(route.GetMarker());
                    activePoints.Clear();
                }
                else if (activePoints.Count < 2)
                {
                    MessageBox.Show("Count of active points must be bigger one");
                }
                activePoints.Clear();
                break;

            case 3:
                if (activePoints.Count > 0)
                {
                    Human human = new Human(textNameAdd.Text.ToString(), activePoints.Last());
                    mapObjects.Add(human);
                    Map.Markers.Add(human.GetMarker());
                    activePoints.Clear();
                }
                else if (activePoints.Count != 1)
                {
                    MessageBox.Show("Count of active points must be bigger zero");
                    activePoints.Clear();
                }
                break;

            case 4:
                if (activePoints.Count > 0)
                {
                    Classes.Location location = new Classes.Location(textNameAdd.Text.ToString(), activePoints.Last());
                    mapObjects.Add(location);
                    Map.Markers.Add(location.GetMarker());
                    activePoints.Clear();
                }
                else if (activePoints.Count != 1)
                {
                    MessageBox.Show("Count of active points must be bigger zero");
                    activePoints.Clear();
                }
                break;
            }
        }