Class EllipseElement
An ellipse/circle shape element that can be rendered on the canvas.
public class EllipseElement : ShapeElement, ICanvasElement, INotifyPropertyChanged
- Inheritance
-
EllipseElement
- Implements
- Inherited Members
Examples
// Create a start state circle
var startState = new EllipseElement("start")
{
Position = new Point(50, 100),
Width = 30,
Height = 30,
Fill = "#2ecc71",
Stroke = "#27ae60",
StrokeWidth = 2
};
// Create an oval annotation
var oval = new EllipseElement("highlight")
{
Position = new Point(100, 200),
Width = 150,
Height = 80,
Fill = null, // No fill
Stroke = "#e74c3c",
StrokeWidth = 3
};
Remarks
Ellipses are useful for: - State diagram start/end states - Circular annotations - Icon backgrounds - Decision points
The ellipse is defined by its bounding box (Position, Width, Height). For a perfect circle, set Width == Height.
Constructors
EllipseElement()
Creates a new ellipse element with a generated ID.
public EllipseElement()
EllipseElement(string)
Creates a new ellipse element with the specified ID.
public EllipseElement(string id)
Parameters
idstringThe unique identifier for this ellipse.
Properties
CenterX
Gets the center X coordinate of the ellipse.
public double CenterX { get; }
Property Value
CenterY
Gets the center Y coordinate of the ellipse.
public double CenterY { get; }
Property Value
RadiusX
Gets the horizontal radius of the ellipse.
public double RadiusX { get; }
Property Value
RadiusY
Gets the vertical radius of the ellipse.
public double RadiusY { get; }
Property Value
Type
Gets the type identifier for this element.
public override string Type { get; }
Property Value
Remarks
Used by renderer registries to select the appropriate renderer. For nodes, this typically comes from the node definition's Type property. For shapes, this identifies the shape type (line, rectangle, text, etc.).
Methods
CreateCentered(double, double, double, double)
Creates an ellipse centered at the specified point with the given radii.
public static EllipseElement CreateCentered(double centerX, double centerY, double radiusX, double radiusY)
Parameters
centerXdoubleX coordinate of the center.
centerYdoubleY coordinate of the center.
radiusXdoubleHorizontal radius.
radiusYdoubleVertical radius.
Returns
- EllipseElement
A new EllipseElement positioned at the center point.
CreateCircle(double, double, double)
Creates a circle centered at the specified point with the given radius.
public static EllipseElement CreateCircle(double centerX, double centerY, double radius)
Parameters
centerXdoubleX coordinate of the center.
centerYdoubleY coordinate of the center.
radiusdoubleRadius of the circle.
Returns
- EllipseElement
A new EllipseElement configured as a circle.