예제 #1
0
        /// <summary>
        /// Desenha o grafo atual.
        /// </summary>
        private void DrawGraph(EDA.Graph graphToDraw, EDA.Node[] highlightedNodes)
        {
            List <EDA.Edge> edges = new List <EDA.Edge>();

            Glee.Graph drawingGraph = new Glee.Graph("Grafo - EDA2");
            // Adiciona nós ao grafo..
            foreach (EDA.Node node in graphToDraw.Nodes)
            {
                Glee.Node drawingNode = drawingGraph.AddNode(node.Name);
                drawingNode.Attr.Shape = Glee.Shape.Circle;
                if (highlightedNodes != null && Array.IndexOf(highlightedNodes, node) >= 0)
                {
                    drawingNode.Attr.Color = Glee.Color.Red;
                }
                // Consolida os arcos..
                edges.AddRange(node.Edges);
            }
            foreach (EDA.Edge edge in edges)
            {
                Glee.Edge drawingEdge = drawingGraph.AddEdge(edge.From.Name, edge.To.Name);
                drawingEdge.Attr.Label = String.Format("{0:F4}", edge.Cost);
            }
            // Gera controle de desenho..
            GleeUI.GViewer viewer = new GleeUI.GViewer();
            viewer.NavigationVisible = false;
            viewer.OutsideAreaBrush  = Brushes.White;
            viewer.RemoveToolbar();
            viewer.Graph = drawingGraph;
            viewer.Dock  = System.Windows.Forms.DockStyle.Fill;
            pnlGraph.Controls.Clear();
            pnlGraph.Controls.Add(viewer);
        }
예제 #2
0
        public BaseDiagram()
        {
            InitializeComponent();

            _options = new BaseDiagramOptions(this.GetID());

            _sidePanel = new SidePanel();
            _sidePanel.RefreshDiagram = new DRefreshDiagram(ForceRefresh);
            _sidePanel.HidePane       = new DHidePane(HidePane);
            panel2.Controls.Add(_sidePanel.MainPanel);
            panel2.Visible    = false;
            splitter1.Visible = false;

            // Using a single instance of the viewer UI control.
            _viewer                   = new GV.GViewer();
            _viewer.AsyncLayout       = false;
            _viewer.Dock              = WF.DockStyle.Fill;
            _viewer.BorderStyle       = System.Windows.Forms.BorderStyle.None;
            _viewer.SelectionChanged += new EventHandler(viewer_SelectionChanged);
            _viewer.MouseClick       += new WF.MouseEventHandler(viewer_MouseClick);
            _viewer.MouseDown        += new System.Windows.Forms.MouseEventHandler(viewer_MouseDown);
            _viewer.MouseUp          += new System.Windows.Forms.MouseEventHandler(viewer_MouseUp);
            _viewer.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(viewer_MouseDoubleClick);
            _viewer.MouseMove        += new System.Windows.Forms.MouseEventHandler(viewer_MouseMove);
            _viewer.OutsideAreaBrush  = new Pen(Color.White).Brush;
            _viewer.Visible           = false;
            _viewer.Font              = new Font("Arial", 24, FontStyle.Bold);

            panel1.Controls.Add(_viewer);
            _viewer.BringToFront();

            lblCaption.BringToFront();
            lblCaption.Text = string.Empty;
            lblCaption.Top  = 6;
            lblCaption.Left = 165;

            lblPleaseWait.Text = string.Empty;

            _timer = new Timer(_timer_Callback, null, Timeout.Infinite, 100);

            _clickTimer.Tick    += new EventHandler(_clickTimer_Tick);
            _clickTimer.Interval = 200;

            this.TabText = GetID();
        }
예제 #3
0
        public BaseDiagram()
        {
            InitializeComponent();

            _options = new BaseDiagramOptions(this.GetID());

            _sidePanel = new SidePanel();
            _sidePanel.RefreshDiagram = new DRefreshDiagram(ForceRefresh);
            _sidePanel.HidePane = new DHidePane(HidePane);
            panel2.Controls.Add(_sidePanel.MainPanel);
            panel2.Visible = false;
            splitter1.Visible = false;

            // Using a single instance of the viewer UI control.
            _viewer = new GV.GViewer();
            _viewer.AsyncLayout = false;
            _viewer.Dock = WF.DockStyle.Fill;
            _viewer.BorderStyle = System.Windows.Forms.BorderStyle.None;
            _viewer.SelectionChanged += new EventHandler(viewer_SelectionChanged);
            _viewer.MouseClick += new WF.MouseEventHandler(viewer_MouseClick);
            _viewer.MouseDown += new System.Windows.Forms.MouseEventHandler(viewer_MouseDown);
            _viewer.MouseUp += new System.Windows.Forms.MouseEventHandler(viewer_MouseUp);
            _viewer.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(viewer_MouseDoubleClick);
            _viewer.MouseMove += new System.Windows.Forms.MouseEventHandler(viewer_MouseMove);
            _viewer.OutsideAreaBrush = new Pen(Color.White).Brush;
            _viewer.Visible = false;
            _viewer.Font = new Font("Arial", 24, FontStyle.Bold);

            panel1.Controls.Add(_viewer);
            _viewer.BringToFront();

            lblCaption.BringToFront();
            lblCaption.Text = string.Empty;
            lblCaption.Top = 6;
            lblCaption.Left = 165;

            lblPleaseWait.Text = string.Empty;

            _timer = new Timer(_timer_Callback, null, Timeout.Infinite, 100);

            _clickTimer.Tick += new EventHandler(_clickTimer_Tick);
            _clickTimer.Interval = 200;

            this.TabText = GetID();
        }