private void UpdatePropertyValues() { Label = WpfHelper.IdToText( EdgeBehind.HasAttribute("label") ? EdgeBehind.GetAttribute("label") : null); if (Label != null) { var labelPos = WpfHelper.IdToText(EdgeBehind.GetAttribute("lp")) .Split(',') .Select(p => p + "pt") .Select(WpfHelper.StringToPixel) .ToList(); LabelMargin = FormattableString.Invariant($"{labelPos[0]},{labelPos[1]},0,0"); } var pos = WpfHelper.IdToText(EdgeBehind.GetAttribute("pos")); var pathGeometryData = new PathGeometryData(pos); Geometry = pathGeometryData.PathGeometry; HasArrowHead = pathGeometryData.HasArrowHead; HasArrowTail = pathGeometryData.HasArrowTail; ArrowHeadGeometry = pathGeometryData.ArrowHeadGeometry; ArrowTailGeometry = pathGeometryData.ArrowTailGeometry; Styles = WpfHelper.IdToStyles( EdgeBehind.HasAttribute("style", true) ? EdgeBehind.GetAttribute("style", true) : null); StrokeColor = GetEdgeStrokeColor(); StrokeThickness = GetEdgeStrokeThickness(); StrokeDashList = WpfHelper.AbsoluteStrokeDash(Styles, StrokeThickness); //FontFamily = GetFontFamily(); FontColor = GetFontColor(); FontSize = GetFontSize(); }
private void UpdatePropertyValues() { Id = SubGraphBehind.Id; IsCluster = Id.StartsWith("cluster", StringComparison.OrdinalIgnoreCase); Label = WpfHelper.IdToText( SubGraphBehind.HasAttribute("label", true) ? SubGraphBehind.GetAttribute("label", true) : null); HasBoundingBox = SubGraphBehind.HasAttribute("bb"); if (HasBoundingBox) { StrokeThickness = GetSubGraphStrokeThickness(); UpperRightX = WpfHelper.StringToPixel(WpfHelper.IdToText( SubGraphBehind.GetAttribute("bb")).Split(',')[2] + "pt") + StrokeThickness / 2.0; UpperRightY = WpfHelper.StringToPixel(WpfHelper.IdToText( SubGraphBehind.GetAttribute("bb")).Split(',')[3] + "pt") + StrokeThickness / 2.0; X = WpfHelper.StringToPixel(WpfHelper.IdToText( SubGraphBehind.GetAttribute("bb")).Split(',')[0] + "pt") - StrokeThickness / 2.0; Y = WpfHelper.StringToPixel(WpfHelper.IdToText( SubGraphBehind.GetAttribute("bb")).Split(',')[1] + "pt") - StrokeThickness / 2.0; Width = UpperRightX - X; Height = UpperRightY - Y; Margin = FormattableString.Invariant($"{X},{Y},0,0"); Styles = WpfHelper.IdToStyles( SubGraphBehind.HasAttribute("style", true) ? SubGraphBehind.GetAttribute("style", true) : null); FillColor = GetSubGraphFillColor(); StrokeColor = GetSubGraphStrokeColor(); StrokeDashList = WpfHelper.AbsoluteStrokeDash(Styles, StrokeThickness); //FontFamily = GetFontFamily(); FontColor = GetFontColor(); FontSize = GetFontSize(); if (Label != null) { var labelPos = WpfHelper.IdToText(SubGraphBehind.GetAttribute("lp")) .Split(',') .Select(p => p + "pt") .Select(WpfHelper.StringToPixel) .ToList(); LabelMargin = FormattableString.Invariant($"{labelPos[0]},{labelPos[1]},0,0"); } } }
private void UpdatePropertyValues() { Id = NodeBehind.Id; Label = WpfHelper.IdToText( NodeBehind.HasAttribute("label") ? NodeBehind.GetAttribute("label") : NodeBehind.Id); Styles = WpfHelper.IdToStyles( NodeBehind.HasAttribute("style", true) ? NodeBehind.GetAttribute("style", true) : null); NodeShapeData = WpfHelper.ConvertToShapeData( NodeBehind.HasAttribute("shape", true) ? NodeBehind.GetAttribute("shape", true) : "ellipse", NodeBehind.HasAttribute("sides", true) ? NodeBehind.GetAttribute("sides", true) : "4", Styles.Contains("diagonals")); //Dot extends the border in both directions but wpf only inwards //so we compensate this by increasing the Width/Height by StrokeThickness. //Side note: Thickness is set to 0 in case of a plain shape StrokeThickness = GetNodeStrokeThickness(); CenterX = WpfHelper.StringToPixel(WpfHelper.IdToText( NodeBehind.GetAttribute("pos")).Split(',')[0] + "pt"); CenterY = WpfHelper.StringToPixel(WpfHelper.IdToText( NodeBehind.GetAttribute("pos")).Split(',')[1] + "pt"); Width = WpfHelper.StringToPixel(WpfHelper.IdToText( NodeBehind.GetAttribute("width", true)) + "in") + StrokeThickness; Height = WpfHelper.StringToPixel(WpfHelper.IdToText( NodeBehind.GetAttribute("height", true)) + "in") + StrokeThickness; X = CenterX - Width / 2; Y = CenterY - Height / 2; Margin = FormattableString.Invariant($"{X},{Y},0,0"); FillColor = GetNodeFillColor(); StrokeColor = GetNodeStrokeColor(); StrokeDashList = WpfHelper.AbsoluteStrokeDash(Styles, StrokeThickness); //FontFamily = GetFontFamily(); FontColor = GetFontColor(); FontSize = GetFontSize(); }