/// <summary> /// Edit Shape properties /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> private void OnPropertyControlLeave(object sender, EventArgs eventArgs) { var selectedNode = propertyGridControl.SelectedObject as NodeWrapper; if (selectedNode != null && selectedNode.Edited) //if not Edge { selectedObjectAttr = selectedNode.Node.Attr.Clone(); NodeWidth = selectedNode.NodeWidth; NodeHeight = selectedNode.NodeHeight; NodeCenter = selectedNode.Node.Pos; selectedObjectAttr = selectedNode.Node.Attr.Clone(); selectedNode.Node.GeometryNode.BoundaryCurve = DrawCurve(selectedNode.Node); //replace the current gemoetrix curve} selectedNode.Edited = false; } else { //var selectedEdge = propertyGridControl.SelectedObject as EdgeWrapper; //if (selectedEdge != null )//&& selectedEdge.Edited) //if not Edge //{ // selectedEdge.Edge.GeometryEdge = //} } gViewer.Refresh(); }
/// <summary> /// Clears the editor and resets it to a default size. /// </summary> internal void ClearAll() { CloseEditorDelegate(); var g = new Graph(); g.GeometryGraph = new GeometryGraph(); g.GeometryGraph.BoundingBox = new Microsoft.Msagl.Core.Geometry.Rectangle(0, 0, 200, 100); gViewer.Graph = g; gViewer.Refresh(); }
private void removeEntityToolStripMenuItem_Click(object sender, EventArgs e) { string entityName = GetSelectedEntityNameInDiagram(); if (entityName == null) { return; } gviewer.Graph.RemoveNode(clickedNode.DrawingObject as Node); gviewer.RemoveNode(clickedNode as IViewerNode, false); gviewer.Refresh(); foreach (ListViewItem item in lvEntity.Items) { if (item.Text.Equals(entityName)) { item.Checked = false; } } StatusText = $"{entityName} removed from the diagram and selection."; }
private void cboPathSelection_SelectionChangeCommitted(object sender, System.EventArgs e) { var routeKey = (string)cboRouteSelection.SelectedItem; var pathKey = (int)cboPathSelection.SelectedItem; if (Program.MainForm.CurrentProblem.RouteDic.ContainsKey(routeKey)) { _graphViewer.SuspendLayout(); foreach (var edge in _graphViewer.Graph.Edges) { edge.Attr.Color = Color.Black; } foreach (var edge in Program.MainForm.CurrentProblem.RouteDic[routeKey].Graph.PossiblePathsOrderedByPenalty[pathKey].Sections) { _graphViewer.Graph.EdgeById(edge.SequenceNumber.ToString()).Attr.Color = Color.Red; } _graphViewer.Refresh(); _graphViewer.ResumeLayout(); } }
private void cboPathSelection_SelectionChangeCommitted(object sender, EventArgs e) { SelectedTrack?.SelectPath(SelectedPath); _graphViewer.Refresh(); }
/// <summary> /// Pinta el grafo de la red en el canvas correspondiente /// </summary> public void render() { Graph graph = new Graph("MANET"); foreach (NetUserNode netUserNode in netUsersNodes) { graph.AddNode(netUserNode.Id.ToString()); Node node = graph.FindNode(netUserNode.Id.ToString()); switch (netUserNode.State) { case CommunicationQuality.NORMAL: { switch (netUserNode.Quality) { case NetUserQuality.NORMAL: { node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.LightGreen; break; } case NetUserQuality.LOW: { node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.LightGreen; break; } case NetUserQuality.CRITICAL: { node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.LightGreen; break; } } break; } case CommunicationQuality.OVERLOADED: { switch (netUserNode.Quality) { case NetUserQuality.NORMAL: { node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Yellow; break; } case NetUserQuality.LOW: { node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Yellow; break; } case NetUserQuality.CRITICAL: { node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Yellow; break; } } break; } case CommunicationQuality.CRITICAL: { switch (netUserNode.Quality) { case NetUserQuality.NORMAL: { node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Red; break; } case NetUserQuality.LOW: { node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Red; break; } case NetUserQuality.CRITICAL: { node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Red; break; } } break; } } node.Attr.Fontcolor = Microsoft.Glee.Drawing.Color.DarkBlue; node.Attr.Fontsize = 6; node.Attr.Label = netUserNode.Name; node.Attr.Shape = Microsoft.Glee.Drawing.Shape.Ellipse; foreach (NetUserNode remoteNetUserNode in netUserNode.Links) { graph.AddEdge(netUserNode.Id.ToString(), remoteNetUserNode.Id.ToString()); } } viewer.Graph = graph; viewer.Refresh(); }