-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCircleElement.cs
More file actions
55 lines (44 loc) · 1.63 KB
/
CircleElement.cs
File metadata and controls
55 lines (44 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#region copyright LGPL nanoLogika
// Copyright 2023, nanoLogika GmbH.
// All rights reserved.
// This source code is licensed under the "LGPL v3 or any later version" license.
// See LICENSE file in the project root for full license information.
#endregion
using System.Xml.Linq;
namespace SvgElements {
/// <summary>
/// Represents SVG <i>circle</i> element.
/// </summary>
public class CircleElement : SvgElementBase<CircleElement> {
/// <summary>
/// Gets or sets the x-coordinate of the circle center.
/// </summary>
public double Cx { get; set; }
/// <summary>
/// Gets or sets the y-coordinate of the circle center.
/// </summary>
public double Cy { get; set; }
/// <summary>
/// Gets or sets the circle radius.
/// </summary>
public double R { get; set; }
/// <inheritdoc />
public override XElement GetXml() {
if (R == 0) {
throw new InvalidOperationException("CircleElement.R must be specified.");
}
XElement xElement = new XElement("circle");
AddID(xElement);
AddClass(xElement);
AddTransform(xElement);
xElement.Add(new XAttribute("cx", Cd(Cx)));
xElement.Add(new XAttribute("cy", Cd(Cy)));
xElement.Add(new XAttribute("r", Cd(R)));
AddStroke(xElement);
AddStrokeDashArray(xElement);
AddFill(xElement);
xElement.Value = string.Empty;
return xElement;
}
}
}