private static DiagramNodeModel BuildDiagramNode(VertexControl vertexControl) { if (vertexControl == null) { throw new ArgumentNullException(nameof(vertexControl)); } var outputNode = new DiagramNodeModel(); if (vertexControl.Vertex is ArrowGraphVertex node) { outputNode.Id = Convert.ToInt32(node.ID); Point point = vertexControl.GetPosition(); outputNode.X = point.X; outputNode.Y = point.Y; outputNode.Height = vertexControl.ActualHeight; outputNode.Width = vertexControl.ActualWidth; Color fillColor = ((SolidColorBrush)vertexControl.Background).Color; outputNode.FillColorHexCode = ViewModel.ProjectPlan.Converter.HexConverter(fillColor.R, fillColor.G, fillColor.B); Color borderColor = ((SolidColorBrush)vertexControl.BorderBrush).Color; outputNode.BorderColorHexCode = ViewModel.ProjectPlan.Converter.HexConverter(borderColor.R, borderColor.G, borderColor.B); outputNode.Text = node.ToString(); } return(outputNode); }
private static graphmlGraphNode BuildArrowGraphNode(DiagramNodeModel diagramNode) { if (diagramNode == null) { throw new ArgumentNullException(nameof(diagramNode)); } var outputNode = new graphmlGraphNode { id = FormatArrowGraphNodeId(diagramNode.Id), data = new data { key = "d6", ShapeNode = new ShapeNode { Geometry = new ShapeNodeGeometry { height = diagramNode.Height.ToString(CultureInfo.InvariantCulture), width = diagramNode.Width.ToString(CultureInfo.InvariantCulture), x = diagramNode.X.ToString(CultureInfo.InvariantCulture), y = diagramNode.Y.ToString(CultureInfo.InvariantCulture) }, Fill = new ShapeNodeFill { color = diagramNode.FillColorHexCode, hasColor = "true", transparent = "false" }, BorderStyle = new ShapeNodeBorderStyle { color = diagramNode.BorderColorHexCode, type = "line", width = "1.0" }, Shape = new ShapeNodeShape { type = "roundrectangle" }, NodeLabel = new ShapeNodeNodeLabel { alignment = "center", autoSizePolicy = "content", fontFamily = "Dialog", fontSize = "12", fontStyle = "plain", hasBackgroundColor = "false", hasLineColor = "false", hasText = "true", height = "4.0", modelName = "custom", textColor = "#000000", visible = "true", width = "4.0", x = "13.0", y = "13.0", Text = diagramNode.Text, LabelModel = new ShapeNodeNodeLabelLabelModel { SmartNodeLabelModel = new ShapeNodeNodeLabelLabelModelSmartNodeLabelModel { distance = "4.0" } }, ModelParameter = new ShapeNodeNodeLabelModelParameter { SmartNodeLabelModelParameter = new ShapeNodeNodeLabelModelParameterSmartNodeLabelModelParameter { labelRatioX = "0.0", labelRatioY = "0.0", nodeRatioX = "0.0", nodeRatioY = "0.0", offsetX = "0.0", offsetY = "0.0", upX = "0.0", upY = "-1.0" } } } } } }; return(outputNode); }