Beispiel #1
0
        // klik na slicicu za pronaci sve karakteristike
        private void tempFunctionForGetAllCharacteristic(Characteristic.CharacteristicTypes type)
        {
            //type=Store, Pharmacy...
            GPSDatabase gpsDatabase = new GPSDatabase();
            Graphics    g           = pictureBox1.CreateGraphics();

            List <Element> list = gpsDatabase.GetAllElementsWithCharacteristics(type);

            drawMap.drawAllElementsWithCharacteristic(g, list);
        }
Beispiel #2
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();
            }
        }
Beispiel #3
0
        //kada se klikne na ikonu ---search---
        private void button8_Click(object sender, EventArgs e)
        {
            GPSDatabase gpsDatabase = new GPSDatabase();

            //gledamo 1. postoji li uneseni element u bazi
            Element temp = gpsDatabase.FindElementByName(textBox1.Text);

            userControl21.Hide();
            button4.Hide();

            userControl31.Hide();

            if (upDownInfo != 2)
            {
                upDownInfo = 1;
            }


            if (temp == null)
            {
                upDownInfo = 0;
                ErrorMsg notFoundForm = new ErrorMsg("Unijeli ste lokaciju\nkoja ne postoji na karti!");
                notFoundForm.ShowDialog();
                return;
            }

            List <Characteristic.CharacteristicTypes> locations = gpsDatabase.GetCharacteristicsByElementId(temp.ElementId);

            userControl11.label1.Text = temp.Name;
            userControl11.label3.Text = "";
            textBox1.Text             = "";

            foreach (Characteristic.CharacteristicTypes type in locations)
            {
                userControl11.label3.Text += " - " + type + Environment.NewLine;
            }

            Graphics g = pictureBox1.CreateGraphics();

            drawMap.drawGraph(g, streets);
            drawMap.drawNodeOrEdgeLocation(g, temp.ElementId);
        }
Beispiel #4
0
        //provjerava jel name ime nekog node-a
        private int checkIfExistsNodeWithName(string name)
        {
            GPSDatabase gpsDatabase = new GPSDatabase();

            return(gpsDatabase.FindIdByName(name));
        }