public class NodeSnapLineProvider extends Object implements ISnapLineProvider
ISnapLineProvider
interface that provides OrthogonalSnapLine
s for
INode
s.
This implementation uses the GraphSnapContext
to create snap lines around the geometric border of the node.
Constructor and Description |
---|
NodeSnapLineProvider() |
Modifier and Type | Method and Description |
---|---|
protected void |
addCenterSnapLines(GraphSnapContext context,
CollectGraphSnapLinesEventArgs args,
INode node,
RectD layout)
Callback method that is called by
addSnapLines(GraphSnapContext, CollectGraphSnapLinesEventArgs, IModelItem)
the collect snap lines for the centers of the node. |
protected void |
addFixedNodeBorderSnapLines(GraphSnapContext context,
CollectGraphSnapLinesEventArgs args,
INode node,
RectD layout)
Callback method that adds the fixed snap lines around the border of the nodes'
layout . |
protected void |
addNodeToNodeSnapLines(GraphSnapContext context,
CollectGraphSnapLinesEventArgs args,
INode node,
RectD layout)
Callback method that adds the fixed snap lines around the node for other nodes to snap to using the
NodeToNodeDistance . |
protected void |
addNodeToSegmentSnapLines(GraphSnapContext context,
CollectGraphSnapLinesEventArgs args,
INode node,
RectD layout)
Callback method that adds the fixed snap lines around the node for edge segments to snap to.
|
protected void |
addPortSnapLines(GraphSnapContext context,
CollectGraphSnapLinesEventArgs args,
INode node,
RectD layout)
Callback method that is called by
addSnapLines(GraphSnapContext, CollectGraphSnapLinesEventArgs, IModelItem)
the collect snap lines to snap ports to at the provided node. |
void |
addSnapLines(GraphSnapContext context,
CollectGraphSnapLinesEventArgs args,
IModelItem item)
Called by the
GraphSnapContext when a drag
is about to start. |
protected OrthogonalSnapLine |
createCenterSnapLine(GraphSnapContext context,
INode node,
SnapLineOrientation orientation,
PointD location)
Convenience method that creates a snap line for the center of nodes.
|
protected void addCenterSnapLines(GraphSnapContext context, CollectGraphSnapLinesEventArgs args, INode node, RectD layout)
addSnapLines(GraphSnapContext, CollectGraphSnapLinesEventArgs, IModelItem)
the collect snap lines for the centers of the node.
This method is called by addSnapLines(GraphSnapContext, CollectGraphSnapLinesEventArgs, IModelItem)
and by
default used the createCenterSnapLine(GraphSnapContext, INode, SnapLineOrientation, PointD)
to add them to the
fixed node
and fixed segment
collections
context
- The context which holds the settings for the snap lines. Note that implementations should not change the state of the
context explicitly.args
- The argument to use for adding snap lines.node
- The node to add snap lines for.layout
- The layout of the node to use for adding the snap lines.protected void addFixedNodeBorderSnapLines(GraphSnapContext context, CollectGraphSnapLinesEventArgs args, INode node, RectD layout)
layout
.
This method is called by addSnapLines(GraphSnapContext, CollectGraphSnapLinesEventArgs, IModelItem)
context
- The context which holds the settings for the snap lines. Note that implementations should not change the state of the
context explicitly.args
- The argument to use for adding snap lines.node
- The node to add snap lines for.layout
- The layout of the node to use for adding the snap lines.protected void addNodeToNodeSnapLines(GraphSnapContext context, CollectGraphSnapLinesEventArgs args, INode node, RectD layout)
NodeToNodeDistance
.
This method is called by addSnapLines(GraphSnapContext, CollectGraphSnapLinesEventArgs, IModelItem)
and uses
the NodeToNodeDistance
to determine the location of the segments to add
around the layout
.
context
- The context which holds the settings for the snap lines. Note that implementations should not change the state of the
context explicitly.args
- The argument to use for adding snap lines.node
- The node to add snap lines for.layout
- The layout of the node to use for adding the snap lines.protected void addNodeToSegmentSnapLines(GraphSnapContext context, CollectGraphSnapLinesEventArgs args, INode node, RectD layout)
This method is called by addSnapLines(GraphSnapContext, CollectGraphSnapLinesEventArgs, IModelItem)
and uses
the NodeToEdgeDistance
to determine the location of the segments to add
around the layout
.
context
- The context which holds the settings for the snap lines. Note that implementations should not change the state of the
context explicitly.args
- The argument to use for adding snap lines.node
- The node to add snap lines for.layout
- The layout of the node to use for adding the snap lines.protected void addPortSnapLines(GraphSnapContext context, CollectGraphSnapLinesEventArgs args, INode node, RectD layout)
addSnapLines(GraphSnapContext, CollectGraphSnapLinesEventArgs, IModelItem)
the collect snap lines to snap ports to at the provided node.
This method is called by addSnapLines(GraphSnapContext, CollectGraphSnapLinesEventArgs, IModelItem)
context
- The context which holds the settings for the snap lines. Note that implementations should not change the state of the
context explicitly.args
- The argument to use for adding snap lines.node
- The node to add snap lines for.layout
- The layout of the node to use for adding the snap lines.public void addSnapLines(GraphSnapContext context, CollectGraphSnapLinesEventArgs args, IModelItem item)
GraphSnapContext
when a drag
is about to start.
This means that the provided item
, which can be cast to INode
will not be moved during the edit and thus
can contribute to the set of fixed snap lines. This implementation delegates to
addFixedNodeBorderSnapLines(GraphSnapContext, CollectGraphSnapLinesEventArgs, INode, RectD)
,
addPortSnapLines(GraphSnapContext, CollectGraphSnapLinesEventArgs, INode, RectD)
,
addNodeToNodeSnapLines(GraphSnapContext, CollectGraphSnapLinesEventArgs, INode, RectD)
, and
addCenterSnapLines(GraphSnapContext, CollectGraphSnapLinesEventArgs, INode, RectD)
.
addSnapLines
in interface ISnapLineProvider
context
- The context which holds the settings for the snap lines. Note that implementations should not change the state of the
context explicitly.args
- The argument to use for adding snap lines.item
- The item to add snap lines for.protected OrthogonalSnapLine createCenterSnapLine(GraphSnapContext context, INode node, SnapLineOrientation orientation, PointD location)
context
- The context which holds the settings for the snap lines. Note that implementations should not change the state of the
context explicitly.node
- The node to add snap lines for.orientation
- The snap line orientation.location
- The location of the snap line.