public class GraphSnapContext extends SnapContext
SnapContext
implementation which handles snapping movement for IGraph
items.
This class provides a set of properties that determine the way snapping operations are being performed in the context of
IGraph
s. IPositionHandler
implementations and the like can use the following idiom to retrieve
instances of this class:
Constructor and Description |
---|
GraphSnapContext()
Creates a new instance with default settings.
|
Modifier and Type | Method and Description |
---|---|
void |
addBendToBeMoved(MovementInfo info)
Adds
MovementInfo representing an IBend that will be considered for the next drag gesture. |
void |
addCollectSnapLinesListener(IEventHandler<CollectGraphSnapLinesEventArgs> collectSnapLinesEvent)
Adds the given listener for the
CollectSnapLines event that occurs every time this instance has been initialized
to collect OrthogonalSnapLine s. |
void |
addEdgeEndToBeMoved(MovementInfo info,
boolean sourceEnd)
Adds
MovementInfo representing the end of an IEdge that will be considered for the next drag gesture. |
void |
addItemToBeReshaped(IModelItem item)
Adds an item which will be reshaped.
|
void |
addNodeToBeMoved(MovementInfo info)
Adds
MovementInfo representing an INode that will be considered for the next drag gesture. |
void |
addOrthogonalSegment(MovementInfo start,
MovementInfo end)
Adds an orthogonally moved segment to this context for which this instance will automatically collect
SnapResult s and provide a default visualization. |
void |
addPortToBeMoved(MovementInfo info)
Adds
MovementInfo representing an IPort that will be considered for the next drag gesture. |
void |
addSameHeightEntry(RectD rectangle)
Adds an entry for the same-height-snapping.
|
void |
addSameWidthEntry(RectD rectangle)
Adds an entry for the same-width-snapping.
|
protected void |
cleanUp()
Disposes of all previously temporarily collected state and clears the
SnapResults
collection. |
protected void |
collectFixedNodeSnapLines(CollectGraphSnapLinesEventArgs args)
Collects the
OrthogonalSnapLine s for the nodes which are not moving. |
protected void |
collectFixedPortSnapLines(CollectGraphSnapLinesEventArgs args)
Collects the
OrthogonalSnapLine s for the ports which are not moving. |
protected void |
collectFixedSegmentSnapLines(CollectGraphSnapLinesEventArgs args)
Collects snap lines for edge segments.
|
protected void |
collectSameSizeEntries()
Collects all node widths and heights in the collections
findSameWidthEntries(double, double, double) and
findSameHeightEntries(double, double, double) . |
protected void |
collectVisibleNodePairs()
Finds pairs of nodes that are visually adjacent to create
center
and same distance snap lines. |
void |
dragInitialized()
Collects a list of snap lines.
|
IListEnumerable<RectD> |
findSameHeightEntries(double size,
double maxSize,
double minSize)
Finds the entries (
RectD s) that have been registered using the addSameHeightEntry(RectD) previously
that best match the given constraints. |
IListEnumerable<RectD> |
findSameWidthEntries(double size,
double maxSize,
double minSize)
Finds the entries (
RectD s) that have been registered using the addSameWidthEntry(RectD) previously that
best match the given constraints. |
IEnumerable<OrthogonalSnapLine> |
getAdditionalSnapLines()
The collection of additional
OrthogonalSnapLine s. |
IEnumerable<OrthogonalSnapLine> |
getAdditionalSnapLines(SnapLineOrientation orientation,
SnapLineSnapTypes snapType,
RectD area)
Gets a subset of
AdditionalSnapLines that matches the given orientation , snapType
and intersects with the provided area . |
IGridConstraintProvider<IBend> |
getBendGridConstraintProvider()
Gets the grid constraint provider for the
IBend s. |
double |
getEdgeToEdgeDistance()
Gets the preferred distance between edges.
|
protected Collection<INode> |
getFixedNodes()
Gets the nodes that stay fixed for the current edit.
|
IEnumerable<OrthogonalSnapLine> |
getFixedNodeSnapLines()
The collection of
OrthogonalSnapLine s for fixed nodes. |
IEnumerable<OrthogonalSnapLine> |
getFixedNodeSnapLines(SnapLineOrientation orientation,
SnapLineSnapTypes snapType,
RectD area)
Gets a subset of
FixedNodeSnapLines that matches the given orientation , snapType
and intersects with the provided area . |
IEnumerable<OrthogonalSnapLine> |
getFixedPortSnapLines()
The collection of
OrthogonalSnapLine s to which ports should be snapping. |
IEnumerable<OrthogonalSnapLine> |
getFixedPortSnapLines(SnapLineOrientation orientation,
SnapLineSnapTypes snapType,
RectD area)
Gets a subset of
FixedPortSnapLines that matches the given orientation , snapType
and intersects with the provided area . |
IEnumerable<OrthogonalSnapLine> |
getFixedSegmentSnapLines()
The collection of
OrthogonalSnapLine s for fixed segments. |
IEnumerable<OrthogonalSnapLine> |
getFixedSegmentSnapLines(SnapLineOrientation orientation,
SnapLineSnapTypes snapType,
RectD area)
Gets a subset of
FixedSegmentSnapLines that matches the given orientation , snapType
and intersects with the provided area . |
double |
getGridSnapDistance()
Gets the GridSnapDistance.
|
GridSnapTypes |
getGridSnapType()
Gets the type of the grid snapping that should be performed.
|
MovementInfo |
getMovementInfo(IBend bend)
Gets the movement info for the given bend.
|
MovementInfo |
getMovementInfo(INode node)
Gets the movement info for the given node.
|
MovementInfo |
getMovementInfo(IPort port)
Gets the movement info for the given port.
|
IListEnumerable<MovementInfo> |
getMovementInfos(IEdge edge)
Gets the
movement information for the provided edge. |
IGridConstraintProvider<INode> |
getNodeGridConstraintProvider()
Gets the grid constraint provider for the
INode s. |
double |
getNodeToEdgeDistance()
The preferred distance between node borders and edge segments.
|
double |
getNodeToNodeDistance()
The preferred distance between node borders.
|
IGridConstraintProvider<IPort> |
getPortGridConstraintProvider()
Gets the grid constraint provider for the
IPort s. |
double |
getSnapLineExtension()
Gets the amount by which snap lines that are induced by existing edge segments and node borders are being extended.
|
void |
initializeDrag(IInputModeContext context,
PointD originalLocation)
Called by
IInputMode implementations when an interactive drag is started. |
boolean |
isCollectingEdgeSnapLinesEnabled()
Determines whether this instance should collect
fixed snap lines for edge segments. |
boolean |
isCollectingNodePairCenterSnapLinesEnabled()
Determines whether this instance will try to align the centers of adjacent nodes so that their centers are equally far
away from each other.
|
boolean |
isCollectingNodePairSegmentSnapLinesEnabled()
Gets a value indicating whether this instance will collect pairs of adjacent nodes and add snapping logic so that moved
edge segments will snap so that the distances to the adjacent nodes are equal.
|
boolean |
isCollectingNodePairSnapLinesEnabled()
Gets a value indicating whether this instance will collect pairs of adjacent nodes and add snapping logic so that moved
nodes will snap so that the distances to the adjacent nodes are equal.
|
boolean |
isCollectingNodeSizesEnabled()
Determines whether this instance should collect the sizes of fixed nodes.
|
boolean |
isCollectingNodeSnapLinesEnabled()
Determines whether this instance should collect
fixed snap lines for nodes. |
boolean |
isCollectingPortSnapLinesEnabled()
Determines whether this instance should collect
fixed snap lines for ports. |
boolean |
isSnapLineCroppingEnabled()
Gets a value indicating whether to crop the snap lines at obstacles.
|
boolean |
isSnappingBendAdjacentSegmentsEnabled()
Whether this context will automatically snap the movements of bends so that the two adjacent segments become
horizontally or vertically oriented.
|
boolean |
isSnappingBendsToSnapLinesEnabled()
Whether this context will automatically snap the bends to snap lines.
|
boolean |
isSnappingNodesToSnapLinesEnabled()
Whether
INodeSnapResultProvider implementations should snap nodes to snap lines. |
boolean |
isSnappingOrthogonalMovementEnabled()
Determines whether this context will automatically snap the movement in such a way that the overall move gesture is
constrained to the horizontal or vertical axis.
|
boolean |
isSnappingPortAdjacentSegmentsEnabled()
Whether this context will automatically snap the movements of nodes so that the first and last segments of edges become
orthogonal.
|
boolean |
isSnappingSegmentsToSnapLinesEnabled()
Determines whether this context will automatically snap orthogonal edge segments to snap lines.
|
protected void |
onCollectSnapLines(CollectGraphSnapLinesEventArgs args)
Raises the
CollectSnapLines event. |
void |
removeCollectSnapLinesListener(IEventHandler<CollectGraphSnapLinesEventArgs> collectSnapLinesEvent)
Removes the given listener for the
CollectSnapLines event that occurs every time this instance has been initialized
to collect OrthogonalSnapLine s. |
void |
setBendGridConstraintProvider(IGridConstraintProvider<IBend> value)
Sets the grid constraint provider for the
IBend s. |
void |
setCollectingEdgeSnapLinesEnabled(boolean value)
Determines whether this instance should collect
fixed snap lines for edge segments. |
void |
setCollectingNodePairCenterSnapLinesEnabled(boolean value)
Determines whether this instance will try to align the centers of adjacent nodes so that their centers are equally far
away from each other.
|
void |
setCollectingNodePairSegmentSnapLinesEnabled(boolean value)
Sets a value indicating whether this instance will collect pairs of adjacent nodes and add snapping logic so that moved
edge segments will snap so that the distances to the adjacent nodes are equal.
|
void |
setCollectingNodePairSnapLinesEnabled(boolean value)
Sets a value indicating whether this instance will collect pairs of adjacent nodes and add snapping logic so that moved
nodes will snap so that the distances to the adjacent nodes are equal.
|
void |
setCollectingNodeSizesEnabled(boolean value)
Determines whether this instance should collect the sizes of fixed nodes.
|
void |
setCollectingNodeSnapLinesEnabled(boolean value)
Determines whether this instance should collect
fixed snap lines for nodes. |
void |
setCollectingPortSnapLinesEnabled(boolean value)
Determines whether this instance should collect
fixed snap lines for ports. |
void |
setEdgeToEdgeDistance(double value)
Sets the preferred distance between edges.
|
void |
setGridSnapDistance(double value)
Sets the GridSnapDistance.
|
void |
setGridSnapType(GridSnapTypes value)
Sets the type of the grid snapping that should be performed.
|
void |
setNodeGridConstraintProvider(IGridConstraintProvider<INode> value)
Sets the grid constraint provider for the
INode s. |
void |
setNodeToEdgeDistance(double value)
The preferred distance between node borders and edge segments.
|
void |
setNodeToNodeDistance(double value)
The preferred distance between node borders.
|
void |
setPortGridConstraintProvider(IGridConstraintProvider<IPort> value)
Sets the grid constraint provider for the
IPort s. |
void |
setSnapLineCroppingEnabled(boolean value)
Sets a value indicating whether to crop the snap lines at obstacles.
|
void |
setSnapLineExtension(double value)
Sets the amount by which snap lines that are induced by existing edge segments and node borders are being extended.
|
void |
setSnappingBendAdjacentSegmentsEnabled(boolean value)
Whether this context will automatically snap the movements of bends so that the two adjacent segments become
horizontally or vertically oriented.
|
void |
setSnappingBendsToSnapLinesEnabled(boolean value)
Whether this context will automatically snap the bends to snap lines.
|
void |
setSnappingNodesToSnapLinesEnabled(boolean value)
Whether
INodeSnapResultProvider implementations should snap nodes to snap lines. |
void |
setSnappingOrthogonalMovementEnabled(boolean value)
Determines whether this context will automatically snap the movement in such a way that the overall move gesture is
constrained to the horizontal or vertical axis.
|
void |
setSnappingPortAdjacentSegmentsEnabled(boolean value)
Whether this context will automatically snap the movements of nodes so that the first and last segments of edges become
orthogonal.
|
void |
setSnappingSegmentsToSnapLinesEnabled(boolean value)
Determines whether this context will automatically snap orthogonal edge segments to snap lines.
|
IInputModeContext |
wrapContext(IInputModeContext context)
Helper method that wraps the given
context so that a ILookup.lookup(Class) query
on the wrapped context for the SnapContext type yields this instance. |
addCleanedUpListener, addCollectSnapResultsListener, addInitializedListener, addInitializingListener, cancelDrag, createSnapResultCanvasObjectDescriptor, createSnapResultsModelManager, dragFinished, dragged, getCurrentInputModeContext, getOriginalLocation, getSnapDistance, getSnapResults, handleMove, isEnabled, isInitialized, isInitializing, isSnapResultVisualizationEnabled, onCleanUp, onCollectSnapResults, onInitialized, onInitializing, processSnapResults, removeCleanedUpListener, removeCollectSnapResultsListener, removeInitializedListener, removeInitializingListener, setEnabled, setSnapDistance, setSnapResultVisualizationEnabled
public GraphSnapContext()
public void addBendToBeMoved(MovementInfo info)
MovementInfo
representing an IBend
that will be considered for the next drag gesture.
The default IHandle
of an IBend
calls this method in its IDragHandler.initializeDrag(IInputModeContext)
method so snap results are calculated when this bend is repositioned. Custom IHandle
implementations can add infos created by getMovementInfo(IBend)
.
info
- The MovementInfo
representing the bend to be moved. Can be created with getMovementInfo(IBend)
.public final void addCollectSnapLinesListener(IEventHandler<CollectGraphSnapLinesEventArgs> collectSnapLinesEvent)
CollectSnapLines
event that occurs every time this instance has been initialized
to collect OrthogonalSnapLine
s.
Event handlers should add snap lines to the caller using the methods provided by
CollectGraphSnapLinesEventArgs
.
collectSnapLinesEvent
- The listener to add.removeCollectSnapLinesListener(IEventHandler)
public void addEdgeEndToBeMoved(MovementInfo info, boolean sourceEnd)
MovementInfo
representing the end of an IEdge
that will be considered for the next drag gesture.
The IHandle
returned by the default IEdgePortHandleProvider
of an IEdge
calls this method in its IDragHandler.initializeDrag(IInputModeContext)
method so snap results are calculated when reparenting this edge end. Custom IHandle
implementations can call getMovementInfos(IEdge)
and add the first or last MovementInfo
of the returned
list.
info
- The MovementInfo
representing the edge end to be reparented. Can be created with
getMovementInfos(IEdge)
.sourceEnd
- true
if the info
represents the source end of the edge.public void addItemToBeReshaped(IModelItem item)
item
- The item to be reshaped.public void addNodeToBeMoved(MovementInfo info)
MovementInfo
representing an INode
that will be considered for the next drag gesture.
The default IPositionHandler
of an INode
calls this method in its IDragHandler.initializeDrag(IInputModeContext)
method so snap results are calculated when this node is repositioned. Custom IPositionHandler
implementations can add infos created by getMovementInfo(INode)
.
info
- The MovementInfo
representing the node to be moved. Can be created with getMovementInfo(INode)
.public void addOrthogonalSegment(MovementInfo start, MovementInfo end)
SnapResult
s and provide a default visualization.
This method can be called during initialization to collect orthogonal segments that should be tested against FixedSegmentSnapLines
and AdditionalSnapLines
.
start
- The starting point of the manipulated segment.end
- The end point of the manipulated segment.public void addPortToBeMoved(MovementInfo info)
MovementInfo
representing an IPort
that will be considered for the next drag gesture.
The default IHandle
of an IPort
calls this method in its IDragHandler.initializeDrag(IInputModeContext)
method so snap results are calculated for this port. Custom IHandle
implementations
can add infos created by getMovementInfo(IPort)
.
info
- The MovementInfo
representing the port to be moved. Can be created with getMovementInfo(IPort)
.public void addSameHeightEntry(RectD rectangle)
During initialization
this method can be used to register entries that can later be
retrieved using the findSameHeightEntries(double, double, double)
method. The rectangle will be used to obtain
the height value and will also be used for the visualization of the snap result.
rectangle
- The rectangle to obtain the height value from. This rectangle will be used for the snap result visualization.addSameWidthEntry(RectD)
public void addSameWidthEntry(RectD rectangle)
During initialization
this method can be used to register entries that can later be
retrieved using the findSameWidthEntries(double, double, double)
method. The rectangle will be used to obtain
the width value and will also be used for the visualization of the snap result.
rectangle
- The rectangle to obtain the width value from. This rectangle will be used for the snap result visualization.addSameHeightEntry(RectD)
protected void cleanUp()
SnapResults
collection.
Subclasses should make sure to call the base implementation as their last operation.
cleanUp
in class SnapContext
protected void collectFixedNodeSnapLines(CollectGraphSnapLinesEventArgs args)
OrthogonalSnapLine
s for the nodes which are not moving.
Delegates to the ISnapLineProvider
implementation in the lookup of the INode
.
protected void collectFixedPortSnapLines(CollectGraphSnapLinesEventArgs args)
OrthogonalSnapLine
s for the ports which are not moving.
Delegates to the ISnapLineProvider
implementation in the lookup of the IPort
.
protected void collectFixedSegmentSnapLines(CollectGraphSnapLinesEventArgs args)
Delegates to the ISnapLineProvider
implementation in the lookup of the IEdge
. This implementation should
then make us of getMovementInfos(IEdge)
to determine what segments are fixed.
protected void collectSameSizeEntries()
findSameWidthEntries(double, double, double)
and
findSameHeightEntries(double, double, double)
.
This method will only be called if CollectingNodeSizesEnabled
is enabled and
delegates to addSameHeightEntry(RectD)
and addSameWidthEntry(RectD)
.
protected void collectVisibleNodePairs()
center
and same distance
snap lines.public void dragInitialized()
This method has been overridden to collect the snap lines for all fixed graph elements and crop
them after collection.
dragInitialized
in class SnapContext
onCollectSnapLines(CollectGraphSnapLinesEventArgs)
,
isSnapLineCroppingEnabled()
public IListEnumerable<RectD> findSameHeightEntries(double size, double maxSize, double minSize)
RectD
s) that have been registered using the addSameHeightEntry(RectD)
previously
that best match the given constraints.size
- The size to find the closest set of identical sizes.maxSize
- The maximum allowed size.minSize
- The minimum allowed size.addSameHeightEntry(RectD)
.public IListEnumerable<RectD> findSameWidthEntries(double size, double maxSize, double minSize)
RectD
s) that have been registered using the addSameWidthEntry(RectD)
previously that
best match the given constraints.size
- The size to find the closest set of identical sizes.maxSize
- The maximum allowed size.minSize
- The minimum allowed size.addSameWidthEntry(RectD)
.public final IEnumerable<OrthogonalSnapLine> getAdditionalSnapLines()
OrthogonalSnapLine
s.
This collection is only available if IsInitialized
is true
.
getAdditionalSnapLines(SnapLineOrientation, SnapLineSnapTypes, RectD)
public final IEnumerable<OrthogonalSnapLine> getAdditionalSnapLines(SnapLineOrientation orientation, SnapLineSnapTypes snapType, RectD area)
AdditionalSnapLines
that matches the given orientation
, snapType
and intersects with the provided area
.orientation
- The orientation of the lines to return.snapType
- The snap type to be included.area
- The area to test for intersection.public final IGridConstraintProvider<IBend> getBendGridConstraintProvider()
IBend
s.null
if none is set.setBendGridConstraintProvider(IGridConstraintProvider)
public final double getEdgeToEdgeDistance()
This will influence the creation of the segment snap lines. For each orthogonally oriented fixed segment there will be snap lines on the segment itself and to both sides of the segment at the specified distance.
The default is 0.0d which disables parallel snap lines.
setEdgeToEdgeDistance(double)
protected final Collection<INode> getFixedNodes()
public final IEnumerable<OrthogonalSnapLine> getFixedNodeSnapLines()
OrthogonalSnapLine
s for fixed nodes.
This collection is only available if IsInitialized
is true
.
getFixedNodeSnapLines(SnapLineOrientation, SnapLineSnapTypes, RectD)
public final IEnumerable<OrthogonalSnapLine> getFixedNodeSnapLines(SnapLineOrientation orientation, SnapLineSnapTypes snapType, RectD area)
FixedNodeSnapLines
that matches the given orientation
, snapType
and intersects with the provided area
.orientation
- The orientation of the lines to return.snapType
- The snap type to be included.area
- The area to test for intersection.public final IEnumerable<OrthogonalSnapLine> getFixedPortSnapLines()
OrthogonalSnapLine
s to which ports should be snapping.
This collection is only available if IsInitialized
is true
.
getFixedPortSnapLines(SnapLineOrientation, SnapLineSnapTypes, RectD)
public final IEnumerable<OrthogonalSnapLine> getFixedPortSnapLines(SnapLineOrientation orientation, SnapLineSnapTypes snapType, RectD area)
FixedPortSnapLines
that matches the given orientation
, snapType
and intersects with the provided area
.orientation
- The orientation of the lines to return.snapType
- The snap type to be included.area
- The area to test for intersection.public final IEnumerable<OrthogonalSnapLine> getFixedSegmentSnapLines()
OrthogonalSnapLine
s for fixed segments.
This collection is only available if IsInitialized
is true
.
getFixedSegmentSnapLines(SnapLineOrientation, SnapLineSnapTypes, RectD)
public final IEnumerable<OrthogonalSnapLine> getFixedSegmentSnapLines(SnapLineOrientation orientation, SnapLineSnapTypes snapType, RectD area)
FixedSegmentSnapLines
that matches the given orientation
, snapType
and intersects with the provided area
.orientation
- The orientation of the lines to return.snapType
- The snap type to be included.area
- The area to test for intersection.public final double getGridSnapDistance()
The maximum distance between the current mouse coordinates and the coordinates to which the mouse will snap. The distance is interpreted in view coordinates.
setGridSnapDistance(double)
public final GridSnapTypes getGridSnapType()
Determines which grid elements an object should snap to.
getNodeGridConstraintProvider()
,
getBendGridConstraintProvider()
,
getPortGridConstraintProvider()
,
setGridSnapType(GridSnapTypes)
public MovementInfo getMovementInfo(IBend bend)
This is either the info passed to addBendToBeMoved(MovementInfo)
or a dynamically created instance if no
specific one had been registered.
bend
- The bend to obtain the info for.MovementInfo
that describes the movement of the bend.public MovementInfo getMovementInfo(INode node)
This is either the info passed to addNodeToBeMoved(MovementInfo)
or another, dynamically created instance, if
no specific one had been registered.
node
- The node to obtain the info for.MovementInfo
that describes the movement of the node.public MovementInfo getMovementInfo(IPort port)
This is either the info passed to addNodeToBeMoved(MovementInfo)
or another, dynamically created instance, if
no specific one had been registered.
port
- The port to obtain the info for.MovementInfo
that describes the movement of the port.public IListEnumerable<MovementInfo> getMovementInfos(IEdge edge)
movement information
for the provided edge.
The result describes the shape of the edge and the reshaping behavior of the geometry. The first element in the
enumerable is the source end of the edge, followed by bend like elements and the target side. Note that it cannot in
general be assumed MovedItem
of the first and last element is either a IPort
or IEdge
, also items in between may not necessarily be bound to IBend
s and therefore their MovedItem
can be of a different type than IBend
.
edge
- The edge to obtain the movement information of.IListEnumerable
of MovementInfo
s items that describe the geometry of the edge being modified.public final IGridConstraintProvider<INode> getNodeGridConstraintProvider()
INode
s.null
if none is set.setNodeGridConstraintProvider(IGridConstraintProvider)
public final double getNodeToEdgeDistance()
This will influence the creation of the node snap lines. For each fixed node there will be snap lines on the borders of the node itself and around the node at the specified distance to which orthogonal edge segments can snap.
The default is -1.0d which disables distant snap lines around the nodes for edge segments.
setNodeToEdgeDistance(double)
public final double getNodeToNodeDistance()
This will influence the creation of the node snap lines. For each fixed node there will be snap lines on the borders of the node itself and around the node at the specified distance.
The default is 0.0d which disables distant snap lines around the nodes.
setNodeToNodeDistance(double)
public final IGridConstraintProvider<IPort> getPortGridConstraintProvider()
IPort
s.null
if none is set.setPortGridConstraintProvider(IGridConstraintProvider)
public final double getSnapLineExtension()
The default is 40.0d
, this value will be used to extend the ends of the snap lines.
setSnapLineExtension(double)
public void initializeDrag(IInputModeContext context, PointD originalLocation)
IInputMode
implementations when an interactive drag is started.
Initializes the list of nodes to be moved. Called by the wrapping position handler on initialization of a drag action.
initializeDrag
in class SnapContext
IllegalStateException
- If this context is already initialized
.context
- The context in which the interactive drag is started.originalLocation
- The original location of the mouse.public final boolean isCollectingEdgeSnapLinesEnabled()
fixed snap lines
for edge segments.
The default is true
.
ISnapLineProvider
,
collectFixedSegmentSnapLines(CollectGraphSnapLinesEventArgs)
,
setCollectingEdgeSnapLinesEnabled(boolean)
public final boolean isCollectingNodePairCenterSnapLinesEnabled()
Note that this will only make a difference for differently sized nodes.
By default this feature is turned off, so that the instance will try to distribute nodes evenly, so that there is the same spacing between their borders, not between their centers.
setCollectingNodePairCenterSnapLinesEnabled(boolean)
public final boolean isCollectingNodePairSegmentSnapLinesEnabled()
true
if pairs of nodes should be collected for additional edge snap lines; false
otherwise. The default
is true
setCollectingNodePairSegmentSnapLinesEnabled(boolean)
public final boolean isCollectingNodePairSnapLinesEnabled()
true
if pairs of nodes should be collected for additional snap lines; false
otherwise. The default is
true
setCollectingNodePairSnapLinesEnabled(boolean)
public final boolean isCollectingNodeSizesEnabled()
The default is true
.
collectSameSizeEntries()
,
setCollectingNodeSizesEnabled(boolean)
public final boolean isCollectingNodeSnapLinesEnabled()
fixed snap lines
for nodes.
The default is true
.
ISnapLineProvider
,
collectFixedNodeSnapLines(CollectGraphSnapLinesEventArgs)
,
setCollectingNodeSnapLinesEnabled(boolean)
public final boolean isCollectingPortSnapLinesEnabled()
fixed snap lines
for ports.
The default is true
.
ISnapLineProvider
,
collectFixedPortSnapLines(CollectGraphSnapLinesEventArgs)
,
setCollectingPortSnapLinesEnabled(boolean)
public final boolean isSnapLineCroppingEnabled()
The default is true
setSnapLineCroppingEnabled(boolean)
public final boolean isSnappingBendAdjacentSegmentsEnabled()
The default is true
.
setSnappingBendAdjacentSegmentsEnabled(boolean)
public final boolean isSnappingBendsToSnapLinesEnabled()
The default is false.
setSnappingBendsToSnapLinesEnabled(boolean)
public final boolean isSnappingNodesToSnapLinesEnabled()
INodeSnapResultProvider
implementations should snap nodes to snap lines.
The default is true.
setSnappingNodesToSnapLinesEnabled(boolean)
public final boolean isSnappingOrthogonalMovementEnabled()
The default is false.
setSnappingOrthogonalMovementEnabled(boolean)
public final boolean isSnappingPortAdjacentSegmentsEnabled()
The default is true
.
setSnappingPortAdjacentSegmentsEnabled(boolean)
public final boolean isSnappingSegmentsToSnapLinesEnabled()
The default is true.
setSnappingSegmentsToSnapLinesEnabled(boolean)
protected void onCollectSnapLines(CollectGraphSnapLinesEventArgs args)
CollectSnapLines
event.args
- The CollectGraphSnapLinesEventArgs
instance containing the event data.public final void removeCollectSnapLinesListener(IEventHandler<CollectGraphSnapLinesEventArgs> collectSnapLinesEvent)
CollectSnapLines
event that occurs every time this instance has been initialized
to collect OrthogonalSnapLine
s.
Event handlers should add snap lines to the caller using the methods provided by
CollectGraphSnapLinesEventArgs
.
collectSnapLinesEvent
- The listener to remove.addCollectSnapLinesListener(IEventHandler)
public final void setBendGridConstraintProvider(IGridConstraintProvider<IBend> value)
IBend
s.value
- The bend grid constraint provider, or null
if none is set.getBendGridConstraintProvider()
public final void setCollectingEdgeSnapLinesEnabled(boolean value)
fixed snap lines
for edge segments.
The default is true
.
value
- The CollectingEdgeSnapLinesEnabled to set.ISnapLineProvider
,
collectFixedSegmentSnapLines(CollectGraphSnapLinesEventArgs)
,
isCollectingEdgeSnapLinesEnabled()
public final void setCollectingNodePairCenterSnapLinesEnabled(boolean value)
Note that this will only make a difference for differently sized nodes.
By default this feature is turned off, so that the instance will try to distribute nodes evenly, so that there is the same spacing between their borders, not between their centers.
value
- The CollectingNodePairCenterSnapLinesEnabled to set.isCollectingNodePairCenterSnapLinesEnabled()
public final void setCollectingNodePairSegmentSnapLinesEnabled(boolean value)
value
- true
if pairs of nodes should be collected for additional edge snap lines; false
otherwise. The default
is true
isCollectingNodePairSegmentSnapLinesEnabled()
public final void setCollectingNodePairSnapLinesEnabled(boolean value)
value
- true
if pairs of nodes should be collected for additional snap lines; false
otherwise. The default is
true
isCollectingNodePairSnapLinesEnabled()
public final void setCollectingNodeSizesEnabled(boolean value)
The default is true
.
value
- The CollectingNodeSizesEnabled to set.collectSameSizeEntries()
,
isCollectingNodeSizesEnabled()
public final void setCollectingNodeSnapLinesEnabled(boolean value)
fixed snap lines
for nodes.
The default is true
.
value
- The CollectingNodeSnapLinesEnabled to set.ISnapLineProvider
,
collectFixedNodeSnapLines(CollectGraphSnapLinesEventArgs)
,
isCollectingNodeSnapLinesEnabled()
public final void setCollectingPortSnapLinesEnabled(boolean value)
fixed snap lines
for ports.
The default is true
.
value
- The CollectingPortSnapLinesEnabled to set.ISnapLineProvider
,
collectFixedPortSnapLines(CollectGraphSnapLinesEventArgs)
,
isCollectingPortSnapLinesEnabled()
public final void setEdgeToEdgeDistance(double value)
This will influence the creation of the segment snap lines. For each orthogonally oriented fixed segment there will be snap lines on the segment itself and to both sides of the segment at the specified distance.
The default is 0.0d which disables parallel snap lines.
value
- The EdgeToEdgeDistance to set.getEdgeToEdgeDistance()
public final void setGridSnapDistance(double value)
The maximum distance between the current mouse coordinates and the coordinates to which the mouse will snap. The distance is interpreted in view coordinates.
value
- The GridSnapDistance to set.getGridSnapDistance()
public final void setGridSnapType(GridSnapTypes value)
Determines which grid elements an object should snap to.
value
- The GridSnapType to set.getNodeGridConstraintProvider()
,
getBendGridConstraintProvider()
,
getPortGridConstraintProvider()
,
getGridSnapType()
public final void setNodeGridConstraintProvider(IGridConstraintProvider<INode> value)
INode
s.value
- The node grid constraint provider, or null
if none is set.getNodeGridConstraintProvider()
public final void setNodeToEdgeDistance(double value)
This will influence the creation of the node snap lines. For each fixed node there will be snap lines on the borders of the node itself and around the node at the specified distance to which orthogonal edge segments can snap.
The default is -1.0d which disables distant snap lines around the nodes for edge segments.
value
- The NodeToEdgeDistance to set.getNodeToEdgeDistance()
public final void setNodeToNodeDistance(double value)
This will influence the creation of the node snap lines. For each fixed node there will be snap lines on the borders of the node itself and around the node at the specified distance.
The default is 0.0d which disables distant snap lines around the nodes.
value
- The NodeToNodeDistance to set.getNodeToNodeDistance()
public final void setPortGridConstraintProvider(IGridConstraintProvider<IPort> value)
IPort
s.value
- The port grid constraint provider, or null
if none is set.getPortGridConstraintProvider()
public final void setSnapLineCroppingEnabled(boolean value)
The default is true
value
- The SnapLineCroppingEnabled to set.isSnapLineCroppingEnabled()
public final void setSnapLineExtension(double value)
The default is 40.0d
, this value will be used to extend the ends of the snap lines.
value
- The SnapLineExtension to set.getSnapLineExtension()
public final void setSnappingBendAdjacentSegmentsEnabled(boolean value)
The default is true
.
value
- The SnappingBendAdjacentSegmentsEnabled to set.isSnappingBendAdjacentSegmentsEnabled()
public final void setSnappingBendsToSnapLinesEnabled(boolean value)
The default is false.
value
- The SnappingBendsToSnapLinesEnabled to set.isSnappingBendsToSnapLinesEnabled()
public final void setSnappingNodesToSnapLinesEnabled(boolean value)
INodeSnapResultProvider
implementations should snap nodes to snap lines.
The default is true.
value
- The SnappingNodesToSnapLinesEnabled to set.isSnappingNodesToSnapLinesEnabled()
public final void setSnappingOrthogonalMovementEnabled(boolean value)
The default is false.
value
- The SnappingOrthogonalMovementEnabled to set.isSnappingOrthogonalMovementEnabled()
public final void setSnappingPortAdjacentSegmentsEnabled(boolean value)
The default is true
.
value
- The SnappingPortAdjacentSegmentsEnabled to set.isSnappingPortAdjacentSegmentsEnabled()
public final void setSnappingSegmentsToSnapLinesEnabled(boolean value)
The default is true.
value
- The SnappingSegmentsToSnapLinesEnabled to set.isSnappingSegmentsToSnapLinesEnabled()
public IInputModeContext wrapContext(IInputModeContext context)
SnapContext
context
so that a ILookup.lookup(Class)
query
on the wrapped context for the SnapContext
type yields this instance.wrapContext
in class SnapContext
context
- The context to wrap and delegate all calls to.SnapContext
type.