22 KiB
BaseConnection Class
Namespace: Nodify
Assembly: Nodify
Inheritance: Object → DispatcherObject → DependencyObject → Visual → UIElement → FrameworkElement → Shape → BaseConnection
Implements: IKeyboardFocusTarget<FrameworkElement>
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, IKeyboardFocusTarget<FrameworkElement>
Constructors
BaseConnection()
protected BaseConnection();
Fields
ZeroVector
Gets a vector that has its coordinates set to 0.
protected static Vector ZeroVector;
Field Value
Properties
ArrowEnds
Gets or sets the arrowhead ends.
public ArrowHeadEnds ArrowEnds { get; set; }
Property Value
ArrowShape
Gets or sets the arrowhead ends.
public ArrowHeadShape ArrowShape { get; set; }
Property Value
ArrowSize
Gets or sets the size of the arrow head.
public Size ArrowSize { get; set; }
Property Value
DefiningGeometry
protected override Geometry DefiningGeometry { get; set; }
Property Value
Direction
Gets or sets the direction in which this connection is flowing.
public ConnectionDirection Direction { get; set; }
Property Value
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
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
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
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
FocusVisualPadding
The space between the focus visual and the connection geometry.
public double FocusVisualPadding { get; set; }
Property Value
FocusVisualPen
The pen used to render the focus visual.
public Pen FocusVisualPen { get; set; }
Property Value
FocusVisualPenKey
The key used to retrieve the BaseConnection.FocusVisualPen resource.
public static ResourceKey FocusVisualPenKey { get; set; }
Property Value
FontFamily
public FontFamily FontFamily { get; set; }
Property Value
FontSize
public double FontSize { get; set; }
Property Value
FontStretch
public FontStretch FontStretch { get; set; }
Property Value
FontStyle
public FontStyle FontStyle { get; set; }
Property Value
FontWeight
public FontWeight FontWeight { get; set; }
Property Value
Foreground
The brush used to render the BaseConnection.Text.
public Brush Foreground { get; set; }
Property Value
HasContextMenu
Gets a value indicating whether the connection has a context menu.
public bool HasContextMenu { get; set; }
Property Value
HasCustomContextMenu
Gets or sets a value indicating whether the connection uses a custom context menu.
public bool HasCustomContextMenu { get; set; }
Property Value
IsAnimatingDirectionalArrows
Gets or sets whether the directional arrows should be flowing through the connection wire.
public bool IsAnimatingDirectionalArrows { get; set; }
Property Value
OutlineBrush
The brush used to render the outline.
public Brush OutlineBrush { get; set; }
Property Value
OutlineThickness
The thickness of the outline.
public double OutlineThickness { get; set; }
Property Value
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
Source
Gets or sets the start point of this connection.
public Point Source { get; set; }
Property Value
SourceOffset
Gets or sets the offset from the BaseConnection.Source point.
public Size SourceOffset { get; set; }
Property Value
SourceOffsetMode
Gets or sets the ConnectionOffsetMode to apply to the BaseConnection.Source when drawing the connection.
public ConnectionOffsetMode SourceOffsetMode { get; set; }
Property Value
SourceOrientation
Gets or sets the orientation in which this connection is flowing.
public Orientation SourceOrientation { get; set; }
Property Value
Spacing
The distance between the start point and the where the angle breaks.
public double Spacing { get; set; }
Property Value
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
Target
Gets or sets the end point of this connection.
public Point Target { get; set; }
Property Value
TargetOffset
Gets or sets the offset from the BaseConnection.Target point.
public Size TargetOffset { get; set; }
Property Value
TargetOffsetMode
Gets or sets the ConnectionOffsetMode to apply to the BaseConnection.Target when drawing the connection.
public ConnectionOffsetMode TargetOffsetMode { get; set; }
Property Value
TargetOrientation
Gets or sets the orientation in which this connection is flowing.
public Orientation TargetOrientation { get; set; }
Property Value
Text
Gets or sets the text contents of the BaseConnection.
public string Text { get; set; }
Property Value
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
GetIsSelected(UIElement)
public static bool GetIsSelected(UIElement elem);
Parameters
elem UIElement
Returns
GetOffset()
Gets the resulting offset after applying the BaseConnection.SourceOffsetMode.
protected virtual ValueTuple<Vector, Vector> GetOffset();
Returns
GetTextPosition(FormattedText, Point, Point)
protected virtual Point GetTextPosition(FormattedText text, Point source, Point target);
Parameters
text FormattedText
source Point
target Point
Returns
OnKeyDown(KeyEventArgs)
protected override void OnKeyDown(KeyEventArgs e);
Parameters
OnKeyUp(KeyEventArgs)
protected override void OnKeyUp(KeyEventArgs e);
Parameters
OnLostMouseCapture(MouseEventArgs)
protected override void OnLostMouseCapture(MouseEventArgs e);
Parameters
OnMouseDown(MouseButtonEventArgs)
protected override void OnMouseDown(MouseButtonEventArgs e);
Parameters
OnMouseMove(MouseEventArgs)
protected override void OnMouseMove(MouseEventArgs e);
Parameters
OnMouseUp(MouseButtonEventArgs)
protected override void OnMouseUp(MouseButtonEventArgs e);
Parameters
OnMouseWheel(MouseWheelEventArgs)
protected override void OnMouseWheel(MouseWheelEventArgs e);
Parameters
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
Split
Triggered by the Nodify.Interactivity.EditorGestures.ConnectionGestures.Split gesture.
public event ConnectionEventHandler Split;
Event Type