Ejemplo n.º 1
0
        public void loadMap(Map map)
        {
            panel1.Controls.Clear();
            GraphicHelper gr = new GraphicHelper(panel1.Width, panel1.Height);
            panel1.BackgroundImage = gr.flush();

            solarsystemMap.Clear();
            refferenzTable.Clear();
            refferenzTable2.Clear();
            randomArea = null;
            randomArea = map.randomArea;
            randomAreaReady = true;

            Systemcount.Text = map.systemcount.ToString();
            Min_distance.Text = map.min_distance.ToString();

            List<Solarsystem> systems = map.solarsystems;

            foreach (Solarsystem system in systems)
            {

                PictureBox picture = new PictureBox();
                panel1.Controls.Add(picture);
                picture.Image = getImage("sun");
                picture.Left = system.x;
                picture.Top = system.y;
                picture.Width = picture.Image.Width;
                picture.Height = picture.Image.Height;
                picture.Visible = true;

                picture.MouseClick += new MouseEventHandler(picture_Click);

                solarsystemMap.Add(system);

                refferenzTable.Add(picture, system);
                refferenzTable2.Add(system, picture);

            }

            checkNodes();
            printConnections();
        }
Ejemplo n.º 2
0
        private void panel1_MouseClick(object sender, MouseEventArgs e)
        {
            if (tool_systemAdd.Checked)
            {
                PictureBox picture = new PictureBox();
                panel1.Controls.Add(picture);
                picture.Image = getImage("sun");
                picture.Left = e.X;
                picture.Top = e.Y;
                picture.Width = picture.Image.Width;
                picture.Height = picture.Image.Height;
                picture.Visible = true;

                picture.MouseClick += new MouseEventHandler(picture_Click);

                Solarsystem system = new Solarsystem();
                system.x = e.X;
                system.y = e.Y;

                solarsystemMap.Add(system);

                refferenzTable.Add(picture, system);
                refferenzTable2.Add(system, picture);
            }
            else if (tool_randomArea.Checked)
            {
                if (!randomAreaReady)
                {
                    if (randomArea == null)
                    {
                        randomArea = new Area();
                        randomArea.x1 = e.X;
                        randomArea.y1 = e.Y;

                    }
                    else
                    {
                        randomArea.x2 = e.X;
                        randomArea.y2 = e.Y;
                        randomAreaReady = true;
                    }

                }
                else
                {
                    randomArea = null;
                    randomAreaReady = false;
                }

            }
            else if (tool_delRandomArea.Checked)
            {
                randomArea = null;
                randomAreaReady = false;
            }

            printConnections();
        }
Ejemplo n.º 3
0
        private void neuToolStripMenuItem_Click(object sender, EventArgs e)
        {
            panel1.Controls.Clear();
            GraphicHelper gr = new GraphicHelper(panel1.Width, panel1.Height);
            panel1.BackgroundImage = gr.flush();

            solarsystemMap.Clear();
            refferenzTable.Clear();
            refferenzTable2.Clear();
            randomArea = null;
            randomAreaReady = false;
        }