public static Shape RenderRelationship(Neo4j.Driver.V1.IRelationship Rel, Dataweb.NShape.WinFormsUI.Display Display) { //Globals Project project = Display.Project; Diagram diagram = Display.Diagram; Design design = project.Design; Layer layer = diagram.Layers["NETWORK"]; // //Defaults ILineStyle stroke = design.LineStyles.Normal; ICapStyle startCap = design.CapStyles.None; ICapStyle endCap = design.CapStyles.None; // if (Rel.Properties.ContainsKey("Operational_Status")) { if (Rel.Properties["Operational_Status"].As <bool>()) { stroke = design.LineStyles.Green; } else { stroke = design.LineStyles.Red; } } //Start and End Shapes Shape shapeStart = NShapeHelper.FindShapeByShapeTag(new display.UI.ShapeTag(Rel.StartNodeId.As <string>(), null), "Circle", Display); Shape shapeEnd = NShapeHelper.FindShapeByShapeTag(new display.UI.ShapeTag(Rel.EndNodeId.As <string>(), null), "Circle", Display); Shape exists = NShapeHelper.FindShapeByShapeTag(new display.UI.ShapeTag(Rel.Id.As <string>(), null), "Polyline", Display); if (exists != null) { exists.LineStyle = stroke; return(exists); } else { //Rel Type switch (Rel.Type) { case "Link": return(NShapeHelper.ConnectShapes(shapeStart, shapeEnd, new display.UI.ShapeTag(Rel.Id.As <string>(), Rel, stroke, null, Display.Project.Design.CapStyles.None), Display, project, stroke, layer)); default: return(NShapeHelper.ConnectShapes(shapeStart, shapeEnd, new display.UI.ShapeTag(Rel.Id.As <string>(), Rel, stroke, null, Display.Project.Design.CapStyles.None), Display, project, stroke, layer)); } // } }
public static Shape RenderRelationship(yggdrasil2.Topology.IGP.Link.Link link, Dataweb.NShape.WinFormsUI.Display Display) { //Globals Project project = Display.Project; Diagram diagram = Display.Diagram; Design design = project.Design; Layer layer = diagram.Layers["NETWORK"]; // //Defaults ILineStyle stroke = design.LineStyles.Normal; ICapStyle startCap = design.CapStyles.None; ICapStyle endCap = design.CapStyles.None; // if (link.OperationalStatus) { stroke = design.LineStyles.Green; } else { stroke = design.LineStyles.Red; } //Start and End Shapes Shape shapeStart = NShapeHelper.FindShapeByShapeTag(new display.UI.ShapeTag(link.SourceNode, null), "Circle", Display); Shape shapeEnd = NShapeHelper.FindShapeByShapeTag(new display.UI.ShapeTag(link.TargetNode, null), "Circle", Display); while (shapeStart == null || shapeEnd == null) { System.Threading.Thread.Sleep(1); shapeStart = NShapeHelper.FindShapeByShapeTag(new display.UI.ShapeTag(link.SourceNode, null), "Circle", Display); shapeEnd = NShapeHelper.FindShapeByShapeTag(new display.UI.ShapeTag(link.TargetNode, null), "Circle", Display); } Shape exists = NShapeHelper.FindShapeByShapeTag(new display.UI.ShapeTag(link.Id, null), "Polyline", Display); Shape reverseExists = NShapeHelper.FindShapeByShapeTag(new display.UI.ShapeTag(link.ReverseId, null), "Polyline", Display); if (exists != null) { exists.LineStyle = stroke; ((UI.ShapeTag)exists.Tag).LineStyle = stroke; if (reverseExists != null) { reverseExists.LineStyle = stroke; ((UI.ShapeTag)reverseExists.Tag).LineStyle = stroke; } return(exists); } else { return(NShapeHelper.ConnectShapes(shapeStart, shapeEnd, new display.UI.ShapeTag(link.Id, link, stroke, null, Display.Project.Design.CapStyles.None), Display, project, stroke, layer)); } }