public class LabelSnapContextHelper extends Object implements ILabelSnapContextHelper
LabelSnapContext
during dragging of labels.Modifier and Type | Field and Description |
---|---|
static LabelSnapContextHelper |
INSTANCE
Returns the static shared instance of this class.
|
Constructor and Description |
---|
LabelSnapContextHelper() |
Modifier and Type | Method and Description |
---|---|
protected void |
addEdgePathSnapLines(LabelSnapContext snapContext,
IInputModeContext inputModeContext,
ILabel label)
Adds snap lines to the
snapContext that are parallel to the path segments of the owner edge at particular
distances. |
protected void |
addEdgePathSnapLines(LabelSnapContext snapContext,
IInputModeContext inputModeContext,
ILabel label,
double distance)
Adds snap lines to the
snapContext that are parallel to the path segments of the owner edge at the given
distance. |
protected void |
addInitialLocationSnapLines(LabelSnapContext snapContext,
IInputModeContext inputModeContext,
ILabel label)
Adds two snap line for the initial center location of the label, one in the direction of the up vector, the other
orthogonal to that direction.
|
protected void |
addNodeShapeSnapLines(LabelSnapContext snapContext,
IInputModeContext inputModeContext,
ILabel label)
Adds snap lines to the
snapContext that are parallel to the owner node's border at particular distances. |
void |
addSnapLines(LabelSnapContext snapContext,
IInputModeContext inputModeContext,
ILabel label)
Called during
initialization of a label
dragging to add snap lines to which the label can potentially snap to the snapContext . |
void |
collectSnapResults(LabelSnapContext context,
CollectSnapResultsEventArgs args,
IOrientedRectangle suggestedLayout,
ILabel label)
Called while the given
label is dragged
to add snap results for the snap lines
provided by the context . |
public static final LabelSnapContextHelper INSTANCE
Since this implementation does not carry any state, this instance can safely be used even in multi-threaded environments.
protected void addEdgePathSnapLines(LabelSnapContext snapContext, IInputModeContext inputModeContext, ILabel label)
snapContext
that are parallel to the path segments of the owner edge at particular
distances.
The corresponding settings of the snapContext
specify which snap lines are actually created.
snapContext
- The snap context which manages the snap lines and the settings. Note that implementations should not change the state of
the context explicitly.inputModeContext
- The context of the input mode that handles the dragging.label
- The edge label that is dragged.protected void addEdgePathSnapLines(LabelSnapContext snapContext, IInputModeContext inputModeContext, ILabel label, double distance)
snapContext
that are parallel to the path segments of the owner edge at the given
distance.
This method is not used by this class to create its snap lines. Instead, it can be called by custom sub-classes to create this kind of snap lines.
snapContext
- The snap context which manages the snap lines and the settings. Note that implementations should not change the state of
the context explicitly.inputModeContext
- The context of the input mode that handles the dragging.label
- The edge label that is dragged.distance
- The distance of the added snap lines from the edge path.protected void addInitialLocationSnapLines(LabelSnapContext snapContext, IInputModeContext inputModeContext, ILabel label)
This method is called by addSnapLines(LabelSnapContext, IInputModeContext, ILabel)
to add the snap lines for
the initial position label location.
snapContext
- The snap context which manages the snap lines and the settings. Note that implementations should not change the state of
the context explicitly.inputModeContext
- The context of the input mode that handles the dragging.label
- The label that is dragged.protected void addNodeShapeSnapLines(LabelSnapContext snapContext, IInputModeContext inputModeContext, ILabel label)
snapContext
that are parallel to the owner node's border at particular distances.
The corresponding settings of the snapContext
specify which snap lines are actually created.
snapContext
- The snap context which manages the snap lines and the settings. Note that implementations should not change the state of
the context explicitly.inputModeContext
- The context of the input mode that handles the dragging.label
- The node label that is dragged.public void addSnapLines(LabelSnapContext snapContext, IInputModeContext inputModeContext, ILabel label)
initialization
of a label
dragging to add snap lines
to which the label can potentially snap to the snapContext
.addSnapLines
in interface ILabelSnapContextHelper
snapContext
- The snap context which manages the snap lines and the settings. Note that implementations should not change the state of
the context explicitly.inputModeContext
- The context of the input mode that handles the dragging.label
- The label that is dragged.public void collectSnapResults(LabelSnapContext context, CollectSnapResultsEventArgs args, IOrientedRectangle suggestedLayout, ILabel label)
ILabelSnapContextHelper
label
is dragged
to add snap results
for the snap lines
provided by the context
.collectSnapResults
in interface ILabelSnapContextHelper
context
- The snap context which manages the snap lines and the settings.args
- The event argument to obtain the necessary information from and
add results to
.suggestedLayout
- The layout
of the label that would be used without snapping.label
- The label that is dragged.