示例#1
0
        public ShortestPath(GPSNavigation gps, Node start, Node end)
        {
            this.gps   = gps;
            this.start = start;
            this.end   = end;

            FindShortestPath();
            SetPathInfo();
        }
示例#2
0
        public ShortestPath(GPSNavigation gps, Node start, Node end, Characteristic.CharacteristicTypes type)
        {
            this.gps   = gps;
            this.start = start;
            this.end   = end;

            FindShortestPath(type);
            SetPathInfoCharacteristic();
        }
示例#3
0
        private void button4_Click(object sender, EventArgs e)
        {
            userControl11.Hide();
            userControl31.Hide();

            GPSDatabase gpsDatabase = new GPSDatabase();
            Node        startNode   = gpsDatabase.FindNodeByName(userControl21.textBox1.Text);
            Node        endNode     = gpsDatabase.FindNodeByName(userControl21.textBox2.Text);

            if (startNode != null && endNode != null)
            {
                userControl21.Hide();
                button4.Hide();

                Graphics g = pictureBox1.CreateGraphics();

                userControl31.Show();

                userControl31.label1.Text = startNode.Name;
                userControl31.label2.Text = endNode.Name;

                GPSNavigation gps = new GPSNavigation();

                if (userControl21.isChecked == -1)
                {
                    path = new ShortestPath(gps, startNode, endNode);
                }
                else
                {
                    path = new ShortestPath(gps, startNode, endNode, (Characteristic.CharacteristicTypes)userControl21.isChecked);
                }

                pictureBox1.Refresh();
            }
            else
            {
                string errorMessage = "Navedene lokacije ne postoje na karti:\n";
                errorMessage += (startNode == null ? userControl21.textBox1.Text : "") + Environment.NewLine;

                errorMessage += (endNode == null ? userControl21.textBox2.Text : "");
                userControl21.Show();
                button4.Show();
                ErrorMsg notFoundForm = new ErrorMsg(errorMessage);
                notFoundForm.ShowDialog();
            }
        }