Table of Contents

Class EllipseElement

Namespace
FlowGraph.Core.Elements.Shapes
Assembly
FlowGraph.Core.dll

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

id string

The unique identifier for this ellipse.

Properties

CenterX

Gets the center X coordinate of the ellipse.

public double CenterX { get; }

Property Value

double

CenterY

Gets the center Y coordinate of the ellipse.

public double CenterY { get; }

Property Value

double

RadiusX

Gets the horizontal radius of the ellipse.

public double RadiusX { get; }

Property Value

double

RadiusY

Gets the vertical radius of the ellipse.

public double RadiusY { get; }

Property Value

double

Type

Gets the type identifier for this element.

public override string Type { get; }

Property Value

string

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

centerX double

X coordinate of the center.

centerY double

Y coordinate of the center.

radiusX double

Horizontal radius.

radiusY double

Vertical 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

centerX double

X coordinate of the center.

centerY double

Y coordinate of the center.

radius double

Radius of the circle.

Returns

EllipseElement

A new EllipseElement configured as a circle.