private double RenderHeader(ClassDiagram classDiagram, double position) { var accessibility = new SvgText(_svgRoot, classDiagram.Accessibility, (_diagramWidth - classDiagram.Accessibility.GetWidth(11, Fonts.FontItalic)) / 2, position); accessibility.FontSize = 11; var name = new SvgLink(_svgRoot, classDiagram.Name, string.Format("{{{{type-link:{0}}}}}", classDiagram.TypeIdentifier), (_diagramWidth - classDiagram.Name.GetWidth(14, Fonts.FontLight)) / 2, position += 20); name.Text.FontSize = 14; position += 15; var path = new SvgPath(_svgRoot, string.Format("M0.5,{0}L{1},{0}", position.ToString("0.00", CultureInfo.InvariantCulture), _diagramWidth.ToString("0.00", CultureInfo.InvariantCulture))); path.StrokeWidth = 1; path.Stroke = "#979797"; _svgRoot.AppendChild(accessibility.XmlElement); _svgRoot.AppendChild(name.XmlElement); _svgRoot.AppendChild(path.XmlElement); return position + 25; }
private void DrawNode(SequenceDiagramNode node) { var textWidth = node.Text.GetWidth(12, Fonts.FontLight); var textPosition = new Point(_diagramSize.Width, 10); var textSize = new Size(textWidth + 20, 35); _diagramSize = new Size(_diagramSize.Width + textWidth + 40, _diagramSize.Height); var rectangle = new SvgRectangle(_svgRoot, textPosition.X, textPosition.Y, textSize.Width, textSize.Height); rectangle.StrokeWidth = 1; rectangle.Stroke = "#979797"; rectangle.Fill = "#FFFFFF"; var link = new SvgLink(_svgRoot, node.Text, string.Format("{{{{type-link:{0}}}}}", node.TypeIdentifier), textPosition.X + 15, textPosition.Y + 22); link.Text.FontSize = 12; _svgGraphic.Add(rectangle); _svgGraphic.Add(link); _nodeMiddlePoints.Add(node.ID, textSize.Width / 2 + textPosition.X); }
private void DrawConnection(SequenceDiagramConnection connection) { var callerNodeMiddlePoint = connection.CallerId == Guid.Empty ? 0 : _nodeMiddlePoints[connection.CallerId]; var calledNodeMiddlePoint = _nodeMiddlePoints[connection.CalledId]; var textWidth = connection.Text.GetWidth(12, Fonts.FontLight); var link = new SvgLink(_svgRoot, connection.Text, string.Format("{{{{method-link:{0}}}}}", connection.CalledMethodIdentifier), callerNodeMiddlePoint + 10, _diagramSize.Height + 10); link.Text.FontSize = 12; _svgGraphic.Add(link); if ((textWidth + callerNodeMiddlePoint + 10) > _diagramSize.Width) { _diagramSize.Width = textWidth + callerNodeMiddlePoint + 20; } DrawConnectionLine(connection, callerNodeMiddlePoint, calledNodeMiddlePoint); DrawConnectionArrow(calledNodeMiddlePoint); }
private double RenderRowSection(List<ClassDiagramRow> classDiagramRows, string memberType, double position, bool renderLine) { var actualPosition = position; foreach (var row in classDiagramRows) { var image = new SvgImage(_svgRoot, 15, actualPosition - 12, 16, 16, string.Format("data:image/png;base64,{0}", Icons.GetBase64Icon(row.Type, row.Accessibility))); var text = new SvgLink(_svgRoot, row.Text, string.Format("{{{{{0}-link:{1}}}}}", memberType, row.Identifier), 40, actualPosition); text.Text.FontSize = 14; _svgRoot.AppendChild(image.XmlElement); _svgRoot.AppendChild(text.XmlElement); actualPosition += 25; } if (classDiagramRows.Count > 0 && renderLine) { actualPosition -= 10; actualPosition = RenderLine(actualPosition); } return actualPosition; }
private void RenderHeader() { var accessibility = new SvgText( _svgRoot, _classDiagram.Accessibility, (_diagramSize.Width - _classDiagram.Accessibility.GetWidth(11, Fonts.FontItalic)) / 2, ACCESSIBILITY_LABEL_Y); accessibility.FontSize = 11; SvgElement name; if (_classDiagram.IsProjectStranger) { name = new SvgText( _svgRoot, _classDiagram.Name, (_diagramSize.Width - _classDiagram.Name.GetWidth(14, Fonts.FontLight)) / 2, CLASSLABEL_Y); ((SvgText)name).FontSize = 14; } else { name = new SvgLink( _svgRoot, _classDiagram.Name, string.Format("{{{{type-link:{0}}}}}", _classDiagram.TypeIdentifier), (_diagramSize.Width - _classDiagram.Name.GetWidth(14, Fonts.FontLight)) / 2, CLASSLABEL_Y); ((SvgLink)name).Text.FontSize = 14; } var path = new SvgPath( _svgRoot, string.Format("M0.5,{0}L{1},{0}", (CLASSLABEL_Y + 10).ToString("0.00", CultureInfo.InvariantCulture), _diagramSize.Width.ToString("0.00", CultureInfo.InvariantCulture))); path.StrokeWidth = 1; path.Stroke = "#979797"; _svgGraphic.Add(accessibility); _svgGraphic.Add(name); _svgGraphic.Add(path); }
private void RenderRowSection(List<ClassDiagramRow> classDiagramRows, string memberType, int rowCountOffset, int sectionOffset) { for (int i = 0; i < classDiagramRows.Count; i++) { var image = new SvgImage( _svgRoot, 15, FIRSTROW_OFFSET_Y + ((i + rowCountOffset) * 25) + (sectionOffset * 10) - 12, 16, 16, string.Format("data:image/png;base64,{0}", Icons.GetBase64Icon(classDiagramRows[i].Type, classDiagramRows[i].Accessibility))); SvgElement text; if (_classDiagram.IsProjectStranger) { text = new SvgText( _svgRoot, classDiagramRows[i].Text, 40, FIRSTROW_OFFSET_Y + ((i + rowCountOffset) * 25) + (sectionOffset * 10)); ((SvgText)text).FontSize = 14; } else { text = new SvgLink( _svgRoot, classDiagramRows[i].Text, string.Format("{{{{{0}-link:{1}}}}}", memberType, classDiagramRows[i].Identifier), 40, FIRSTROW_OFFSET_Y + ((i + rowCountOffset) * 25) + (sectionOffset * 10)); ((SvgLink)text).Text.FontSize = 14; } _svgGraphic.Add(image); _svgGraphic.Add(text); } if (classDiagramRows.Count > 0 && FollowingSectionsNotEmpty(memberType)) { RenderLine(FIRSTROW_OFFSET_Y + ((classDiagramRows.Count + rowCountOffset) * 25) + (sectionOffset * 10) - 10); } }