public static Shape RenderNode(Neo4j.Driver.V1.INode Node, Dataweb.NShape.WinFormsUI.Display Display) { //Globals Project project = Display.Project; Diagram diagram = Display.Diagram; Design design = project.Design; Layer layer = diagram.Layers["NETWORK"]; // //Defaults Point position = new Point(diagram.Width / 2, diagram.Height / 2); int diameter = 100; IFillStyle fill = design.FillStyles.Transparent; ILineStyle stroke = design.LineStyles.Normal; string caption = ""; // //Node Labels if (Node.Labels.Contains("Node")) { diameter = 600; fill = design.FillStyles.Blue; stroke = design.LineStyles.None; caption = Node.Properties["Node_Name"].As <string>(); } else if (Node.Labels.Contains("Pseudonode")) { diameter = 60; fill = design.FillStyles.Black; stroke = design.LineStyles.None; } // Shape exists = NShapeHelper.FindShapeByShapeTag(new display.UI.ShapeTag(Node.Id.As <string>(), null, stroke, fill, Display.Project.Design.CapStyles.None), "Circle", Display); if (exists != null) { //Update Node -- TODO: Move this somewhere else ((Circle)exists).Diameter = diameter; ((Circle)exists).FillStyle = fill; exists.LineStyle = stroke; // return(exists); } else { return(NShapeHelper.DrawCircle(diameter, position.X, position.Y, fill, stroke, caption, new display.UI.ShapeTag(Node.Id.As <string>(), Node, stroke, fill, Display.Project.Design.CapStyles.None), 'B', Display, project, layer)); } }
public static Shape RenderNode(yggdrasil2.Topology.Node.Node Node, Dataweb.NShape.WinFormsUI.Display Display) { //Globals Project project = Display.Project; Diagram diagram = Display.Diagram; Design design = project.Design; Layer layer = diagram.Layers["NETWORK"]; // //Defaults Point position = new Point(diagram.Width / 2, diagram.Height / 2); int diameter = 100; IFillStyle fill = design.FillStyles.Transparent; ILineStyle stroke = design.LineStyles.Normal; string caption = ""; // //Node Labels if (!Node.IsPseudonode) { diameter = 600; fill = design.FillStyles.Blue; stroke = design.LineStyles.None; caption = Node.NodeName; } else { diameter = 60; fill = design.FillStyles.Black; stroke = design.LineStyles.None; } // if (!Node.OperationalStatus) { fill = design.FillStyles.Red; } Shape exists = NShapeHelper.FindShapeByShapeTag(new display.UI.ShapeTag(Node.Id.As <string>(), null), "Circle", Display); if (exists != null) { try { //Update Node -- TODO: Move this somewhere else ((Circle)exists).Diameter = diameter; ((Circle)exists).FillStyle = fill; ((Circle)exists).LineStyle = stroke; ((display.UI.ShapeTag)exists.Tag).LineStyle = stroke; // } catch (Exception) { System.Threading.Thread.Sleep(1); RenderNode(Node, Display); } return(exists); } else { return(NShapeHelper.DrawCircle(diameter, position.X, position.Y, fill, stroke, caption, new display.UI.ShapeTag(Node.Id.As <string>(), Node, stroke, fill, Display.Project.Design.CapStyles.None), 'B', Display, project, layer)); } }