Table of Contents

Class LineElement

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

A line shape element that connects two points on the canvas.

public class LineElement : ShapeElement, ICanvasElement, INotifyPropertyChanged
Inheritance
LineElement
Implements
Inherited Members

Examples

// Create a vertical lifeline for sequence diagram
var lifeline = new LineElement("lifeline-1")
{
    Position = new Point(100, 50),  // Start point
    EndX = 100,
    EndY = 500,
    Stroke = "#34495e",
    StrokeWidth = 2,
    StrokeDashArray = "5,5"  // Dashed line
};

Remarks

Lines are useful for: - Sequence diagram lifelines - Swimlane separators - Custom connectors that aren't edges - Diagram annotations

Unlike edges, lines don't connect nodes and don't have routing logic. They simply draw from (X, Y) to (EndX, EndY).

Constructors

LineElement()

Creates a new line element with a generated ID.

public LineElement()

LineElement(string)

Creates a new line element with the specified ID.

public LineElement(string id)

Parameters

id string

The unique identifier for this line.

Properties

EndCap

Gets or sets the cap style for the end of the line.

public LineCapStyle EndCap { get; set; }

Property Value

LineCapStyle

EndX

Gets or sets the X coordinate of the end point. The start point is defined by Position.

public double EndX { get; set; }

Property Value

double

EndY

Gets or sets the Y coordinate of the end point. The start point is defined by Position.

public double EndY { get; set; }

Property Value

double

StartCap

Gets or sets the cap style for the start of the line.

public LineCapStyle StartCap { get; set; }

Property Value

LineCapStyle

StrokeDashArray

Gets or sets the dash pattern for the stroke. Format: "dash,gap,dash,gap" e.g., "5,3" or "10,5,2,5". Null for solid line.

public string? StrokeDashArray { get; set; }

Property Value

string

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

GetBounds()

Gets the bounding rectangle of this element in canvas coordinates.

public override Rect GetBounds()

Returns

Rect

The bounds as a Rect.