public SvgLink(SvgRoot rootSvg, string text, string href, double x, double y) : base(rootSvg, "a") { Text = new SvgText(rootSvg, text, x, y); CreateElement(); Text.Fill = "#1382CE"; Text.OnMouseOut = "this.setAttribute('fill', '#1382CE')"; Text.OnMouseOver = "this.setAttribute('fill', '#F58026')"; Href = href; Text.X = x; Text.Y = y; }
public SvgLink(SvgRoot svg, string text, string href, double x, double y) { Text = new SvgText(svg, text, x, y); CreateElement(svg); Text.Fill = "#1382CE"; Text.OnMouseOut = "this.setAttribute('fill', '#1382CE')"; Text.OnMouseOver = "this.setAttribute('fill', '#F58026')"; Href = href; Text.X = x; Text.Y = y; }
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 CloseBlock() { _openBlocks--; var text = new SvgText(_svgRoot, "end", 20 + _openBlocks * 15, _diagramSize.Height); text.FontSize = 10; _svgGraphic.Add(text); _diagramSize.Height += 20; }
private void OpenBlock(SequenceDiagramComposite block) { var textWidth = block.Text.GetWidth(12, Fonts.FontLight); var text = new SvgText(_svgRoot, block.Text, 20 + _openBlocks * 15, _diagramSize.Height + 10); text.FontSize = 10; _svgGraphic.Add(text); // Setzen der Breite des Diagramms auf die eventuell größere Breite des Textes if ((textWidth + 20 + _openBlocks * 15) > _diagramSize.Width) _diagramSize.Width = textWidth + 20 + _openBlocks * 15 + 10; _diagramSize.Height += 20; _openBlocks++; }
private void DrawReturnConnection(SequenceDiagramConnection connection) { var callerNodeMiddlePoint = _nodeMiddlePoints[connection.CallerId]; var calledNodeMiddlePoint = connection.CalledId == Guid.Empty ? 0 : _nodeMiddlePoints[connection.CalledId]; var textWidth = ("return " + connection.Text).GetWidth(12, Fonts.FontLight); var text = new SvgText(_svgRoot, "return " + connection.Text, calledNodeMiddlePoint + 10, _diagramSize.Height + 10); text.FontSize = 12; _svgGraphic.Add(text); if ((textWidth + calledNodeMiddlePoint + 10) > _diagramSize.Width) { _diagramSize.Width = textWidth + calledNodeMiddlePoint + 20; } var path = new SvgPath(_svgRoot, string.Format("M{0},{1}L{2},{1}", calledNodeMiddlePoint.ToString("0.00", CultureInfo.InvariantCulture), (_diagramSize.Height + 20).ToString("0.00", CultureInfo.InvariantCulture), callerNodeMiddlePoint.ToString("0.00", CultureInfo.InvariantCulture))); path.StrokeWidth = 1; path.Stroke = "#979797"; _svgGraphic.Add(path); var startX = (int)calledNodeMiddlePoint; var startY = (int)_diagramSize.Height + 20; var points = string.Format("{0},{1} {2},{3} {2},{4}", startX, startY, startX + 5, startY + 5, startY - 5); var arrow = new SvgPolygon(_svgRoot, points); arrow.Stroke = arrow.Fill = "#979797"; _svgGraphic.Add(arrow); _diagramSize.Height += 35; }
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); } }
private void CloseBlock() { _openBlocks--; var text = new SvgText(_svgRoot, "end", 20 + _openBlocks * 15, _diagramSize.Height); text.FontSize = 10; _svgRoot.AppendChild(text.XmlElement); _diagramSize.Height += 20; }