Skip to content

Nodify_BaseConnection

miroiu edited this page Dec 23, 2024 · 1 revision

BaseConnection Class

Namespace: Nodify

Assembly: Nodify

Inheritance: ObjectDispatcherObjectDependencyObjectVisualUIElementFrameworkElementShapeBaseConnection

Derived: LineConnection, Connection

References: ArrowHeadEnds, ArrowHeadShape, ConnectionDirection, ConnectionEventArgs, ConnectionEventHandler, ConnectionOffsetMode, CuttingLine, ConnectionState.Disconnect, NodifyEditor, ConnectionState.Split

Represents the base class for shapes that are drawn from a BaseConnection.Source point to a BaseConnection.Target point.

public abstract class BaseConnection : Shape  

Constructors

BaseConnection()

protected BaseConnection();  

Fields

ZeroVector

Gets a vector that has its coordinates set to 0.

protected static Vector ZeroVector;  

Field Value

Vector

Properties

ArrowEnds

Gets or sets the arrowhead ends.

public ArrowHeadEnds ArrowEnds { get; set; }  

Property Value

ArrowHeadEnds

ArrowShape

Gets or sets the arrowhead ends.

public ArrowHeadShape ArrowShape { get; set; }  

Property Value

ArrowHeadShape

ArrowSize

Gets or sets the size of the arrow head.

public Size ArrowSize { get; set; }  

Property Value

Size

DefiningGeometry

protected override Geometry DefiningGeometry { get; set; }  

Property Value

Geometry

Direction

Gets or sets the direction in which this connection is flowing.

public ConnectionDirection Direction { get; set; }  

Property Value

ConnectionDirection

DirectionalArrowsAnimationDuration

Gets or sets the duration in seconds of a directional arrow flowing from BaseConnection.Source to BaseConnection.Target.

public double DirectionalArrowsAnimationDuration { get; set; }  

Property Value

Double

DirectionalArrowsCount

Gets or sets the number of arrows to be drawn on the line in the direction of the connection (see BaseConnection.Direction).

public uint DirectionalArrowsCount { get; set; }  

Property Value

UInt32

DirectionalArrowsOffset

Gets or sets the offset of the arrows drawn by the BaseConnection.DirectionalArrowsCount (value is clamped between 0 and 1).

public double DirectionalArrowsOffset { get; set; }  

Property Value

Double

DisconnectCommand

Removes this connection. Triggered by Nodify.Interactivity.EditorGestures.ConnectionGestures.Disconnect gesture. Parameter is the location where the disconnect ocurred.

public ICommand DisconnectCommand { get; set; }  

Property Value

ICommand

FontFamily

public FontFamily FontFamily { get; set; }  

Property Value

FontFamily

FontSize

public double FontSize { get; set; }  

Property Value

Double

FontStretch

public FontStretch FontStretch { get; set; }  

Property Value

FontStretch

FontStyle

public FontStyle FontStyle { get; set; }  

Property Value

FontStyle

FontWeight

public FontWeight FontWeight { get; set; }  

Property Value

FontWeight

Foreground

The brush used to render the BaseConnection.Text.

public Brush Foreground { get; set; }  

Property Value

Brush

HasContextMenu

Gets a value indicating whether the connection has a context menu.

public bool HasContextMenu { get; set; }  

Property Value

Boolean

HasCustomContextMenu

Gets or sets a value indicating whether the connection uses a custom context menu.

public bool HasCustomContextMenu { get; set; }  

Property Value

Boolean

IsAnimatingDirectionalArrows

Gets or sets whether the directional arrows should be flowing through the connection wire.

public bool IsAnimatingDirectionalArrows { get; set; }  

Property Value

Boolean

OutlineBrush

The brush used to render the outline.

public Brush OutlineBrush { get; set; }  

Property Value

Brush

OutlineThickness

The thickness of the outline.

public double OutlineThickness { get; set; }  

Property Value

Double

PrioritizeBaseConnectionForSelection

Whether to prioritize controls of type BaseConnection inside custom connections (connection wrappers) when setting the BaseConnection.IsSelectableProperty and BaseConnection.IsSelectedProperty attached properties.

public static bool PrioritizeBaseConnectionForSelection { get; set; }  

Property Value

Boolean

Source

Gets or sets the start point of this connection.

public Point Source { get; set; }  

Property Value

Point

SourceOffset

Gets or sets the offset from the BaseConnection.Source point.

public Size SourceOffset { get; set; }  

Property Value

Size

SourceOffsetMode

Gets or sets the ConnectionOffsetMode to apply to the BaseConnection.Source when drawing the connection.

public ConnectionOffsetMode SourceOffsetMode { get; set; }  

Property Value

ConnectionOffsetMode

SourceOrientation

Gets or sets the orientation in which this connection is flowing.

public Orientation SourceOrientation { get; set; }  

Property Value

Orientation

Spacing

The distance between the start point and the where the angle breaks.

public double Spacing { get; set; }  

Property Value

Double

SplitCommand

Splits the connection. Triggered by Nodify.Interactivity.EditorGestures.ConnectionGestures.Split gesture. Parameter is the location where the splitting ocurred.

public ICommand SplitCommand { get; set; }  

Property Value

ICommand

Target

Gets or sets the end point of this connection.

public Point Target { get; set; }  

Property Value

Point

TargetOffset

Gets or sets the offset from the BaseConnection.Target point.

public Size TargetOffset { get; set; }  

Property Value

Size

TargetOffsetMode

Gets or sets the ConnectionOffsetMode to apply to the BaseConnection.Target when drawing the connection.

public ConnectionOffsetMode TargetOffsetMode { get; set; }  

Property Value

ConnectionOffsetMode

TargetOrientation

Gets or sets the orientation in which this connection is flowing.

public Orientation TargetOrientation { get; set; }  

Property Value

Orientation

Text

Gets or sets the text contents of the BaseConnection.

public string Text { get; set; }  

Property Value

String

Methods

DrawArrowGeometry(StreamGeometryContext, Point, Point, ConnectionDirection, ArrowHeadShape, Orientation)

protected virtual void DrawArrowGeometry(StreamGeometryContext context, Point source, Point target, ConnectionDirection arrowDirection = 0, ArrowHeadShape shape = 0, Orientation orientation = 0);  

Parameters

context StreamGeometryContext

source Point

target Point

arrowDirection ConnectionDirection

shape ArrowHeadShape

orientation Orientation

DrawDefaultArrowhead(StreamGeometryContext, Point, Point, ConnectionDirection, Orientation)

protected virtual void DrawDefaultArrowhead(StreamGeometryContext context, Point source, Point target, ConnectionDirection arrowDirection = 0, Orientation orientation = 0);  

Parameters

context StreamGeometryContext

source Point

target Point

arrowDirection ConnectionDirection

orientation Orientation

DrawDirectionalArrowheadGeometry(StreamGeometryContext, Vector, Point)

protected virtual void DrawDirectionalArrowheadGeometry(StreamGeometryContext context, Vector direction, Point location);  

Parameters

context StreamGeometryContext

direction Vector

location Point

DrawDirectionalArrowsGeometry(StreamGeometryContext, Point, Point)

protected virtual void DrawDirectionalArrowsGeometry(StreamGeometryContext context, Point source, Point target);  

Parameters

context StreamGeometryContext

source Point

target Point

DrawEllipseArrowhead(StreamGeometryContext, Point, Point, ConnectionDirection, Orientation)

protected virtual void DrawEllipseArrowhead(StreamGeometryContext context, Point source, Point target, ConnectionDirection arrowDirection = 0, Orientation orientation = 0);  

Parameters

context StreamGeometryContext

source Point

target Point

arrowDirection ConnectionDirection

orientation Orientation

DrawLineGeometry(StreamGeometryContext, Point, Point)

protected virtual ValueTuple<ValueTuple<Point, Point>, ValueTuple<Point, Point>> DrawLineGeometry(StreamGeometryContext context, Point source, Point target);  

Parameters

context StreamGeometryContext

source Point

target Point

Returns

ValueTuple<ValueTuple<Point, Point>, ValueTuple<Point, Point>>

DrawRectangleArrowhead(StreamGeometryContext, Point, Point, ConnectionDirection, Orientation)

protected virtual void DrawRectangleArrowhead(StreamGeometryContext context, Point source, Point target, ConnectionDirection arrowDirection = 0, Orientation orientation = 0);  

Parameters

context StreamGeometryContext

source Point

target Point

arrowDirection ConnectionDirection

orientation Orientation

GetIsSelectable(UIElement)

public static bool GetIsSelectable(UIElement elem);  

Parameters

elem UIElement

Returns

Boolean

GetIsSelected(UIElement)

public static bool GetIsSelected(UIElement elem);  

Parameters

elem UIElement

Returns

Boolean

GetOffset()

Gets the resulting offset after applying the BaseConnection.SourceOffsetMode.

protected virtual ValueTuple<Vector, Vector> GetOffset();  

Returns

ValueTuple<Vector, Vector>

GetTextPosition(FormattedText, Point, Point)

protected virtual Point GetTextPosition(FormattedText text, Point source, Point target);  

Parameters

text FormattedText

source Point

target Point

Returns

Point

OnKeyDown(KeyEventArgs)

protected override void OnKeyDown(KeyEventArgs e);  

Parameters

e KeyEventArgs

OnKeyUp(KeyEventArgs)

protected override void OnKeyUp(KeyEventArgs e);  

Parameters

e KeyEventArgs

OnLostMouseCapture(MouseEventArgs)

protected override void OnLostMouseCapture(MouseEventArgs e);  

Parameters

e MouseEventArgs

OnMouseDown(MouseButtonEventArgs)

protected override void OnMouseDown(MouseButtonEventArgs e);  

Parameters

e MouseButtonEventArgs

OnMouseMove(MouseEventArgs)

protected override void OnMouseMove(MouseEventArgs e);  

Parameters

e MouseEventArgs

OnMouseUp(MouseButtonEventArgs)

protected override void OnMouseUp(MouseButtonEventArgs e);  

Parameters

e MouseButtonEventArgs

OnMouseWheel(MouseWheelEventArgs)

protected override void OnMouseWheel(MouseWheelEventArgs e);  

Parameters

e MouseWheelEventArgs

OnRender(DrawingContext)

protected override void OnRender(DrawingContext drawingContext);  

Parameters

drawingContext DrawingContext

Remove()

Removes the connection.

public void Remove();  

SetIsSelectable(UIElement, Boolean)

public static void SetIsSelectable(UIElement elem, bool value);  

Parameters

elem UIElement

value Boolean

SetIsSelected(UIElement, Boolean)

public static void SetIsSelected(UIElement elem, bool value);  

Parameters

elem UIElement

value Boolean

SplitAtLocation(Point)

Splits the connection at the specified location.

public void SplitAtLocation(Point splitLocation);  

Parameters

splitLocation Point: The Point where the connection should be split.

StartAnimation(Double)

Starts animating the directional arrows.

public void StartAnimation(double duration = 1.5d);  

Parameters

duration Double: The duration for moving an arrowhead from BaseConnection.Source to BaseConnection.Target.

StopAnimation()

Stops the animation started by Nodify.BaseConnection.StartAnimation(System.Double)

public void StopAnimation();  

Events

Disconnect

Triggered by the Nodify.Interactivity.EditorGestures.ConnectionGestures.Disconnect gesture.

public event ConnectionEventHandler Disconnect;  

Event Type

ConnectionEventHandler

Split

Triggered by the Nodify.Interactivity.EditorGestures.ConnectionGestures.Split gesture.

public event ConnectionEventHandler Split;  

Event Type

ConnectionEventHandler

Clone this wiki locally