Ejemplo n.º 1
0
        private void printConnections(MouseEventArgs e = null)
        {
            GraphicHelper graphic = new GraphicHelper(panel1.Width, panel1.Height);
            List<Node> allreadydrawn = new List<Node>();

            foreach (Solarsystem system in solarsystemMap)
            {
                foreach (Node node in system.nodes)
                {
                    if (!allreadydrawn.Contains(node))
                    {
                        allreadydrawn.Add(node);

                        graphic.drawLine(Color.Black, node.pointa.x, node.pointa.y, node.pointb.x, node.pointb.y);

                    }
                }

            }

            if ((randomAreaReady) && (randomArea != null))
            {
                graphic.drawLine(Color.Orange, randomArea.x1, randomArea.y1, randomArea.x1, randomArea.y2);
                graphic.drawLine(Color.Orange, randomArea.x1, randomArea.y1, randomArea.x2, randomArea.y1);

                graphic.drawLine(Color.Orange, randomArea.x2, randomArea.y2, randomArea.x1, randomArea.y2);
                graphic.drawLine(Color.Orange, randomArea.x2, randomArea.y2, randomArea.x2, randomArea.y1);

            }

            if ((randomArea != null) && (e != null) && !randomAreaReady)
            {
                graphic.drawLine(Color.Orange, randomArea.x1, randomArea.y1, randomArea.x1, e.Y);
                graphic.drawLine(Color.Orange, randomArea.x1, randomArea.y1, e.X, randomArea.y1);

                graphic.drawLine(Color.Orange, e.X, e.Y, randomArea.x1, e.Y);
                graphic.drawLine(Color.Orange, e.X, e.Y, e.X, randomArea.y1);
            }

            panel1.BackgroundImage = graphic.flush();
        }