public class SnapLine extends Object
GraphSnapContext
and LabelSnapContext
make use of this class to interactively snap moving elements to
snap lines.
Modifier and Type | Field and Description |
---|---|
static ResourceKey |
GRID_LINE_FIXED_LINE_KEY
Resource key which determines a grid snap line having a fixed visualization independent of the
SnapResult . |
static ResourceKey |
SNAP_LINE_BLANK_VARIABLE_LINE_KEY
Resource key which determines a blank line between the
Coordinates and the snapped
coordinates. |
static ResourceKey |
SNAP_LINE_CENTER_BETWEEN_BOUNDS_KEY
Resource key which determines a snap line which lets an item snap in the center between the bounds of two other items.
|
static ResourceKey |
SNAP_LINE_CENTER_BETWEEN_CENTERS_KEY
Resource key which determines a snap line which lets an item snap in the center between the centers of two other items.
|
static ResourceKey |
SNAP_LINE_EDGE_SEGMENT_KEY
Resource key which determines a snap line with three special locations, for example the start, end and center of an edge
segment.
|
static ResourceKey |
SNAP_LINE_EQUAL_DISTANCE_BETWEEN_BOUNDS_KEY
Resource key which determines a snap line which lets an item snap if it has an equal distance to two other items.
|
static ResourceKey |
SNAP_LINE_EQUAL_DISTANCE_BETWEEN_CENTERS_KEY
Resource key which determines a snap line which lets an item snap if it's center has an equal distance to the centers'
of two other items.
|
static ResourceKey |
SNAP_LINE_EQUAL_HEIGHT_KEY
Resource key which determines the snapping of a resized item if it's new height is equal to another item.
|
static ResourceKey |
SNAP_LINE_EQUAL_WIDTH_KEY
Resource key which determines the snapping of a resized item if it's new width is equal to another item.
|
static ResourceKey |
SNAP_LINE_EXTENDED_VARIABLE_LINE_KEY
Resource key which determines a decorated line between the
Coordinates and the snapped
coordinates that is extended on both sides. |
static ResourceKey |
SNAP_LINE_FIXED_DISTANCE_KEY
Resource key which determines a snap line which lets an item snap in a defined distance to another graph item.
|
static ResourceKey |
SNAP_LINE_FIXED_LINE_KEY
Resource key which determines a snap line having a fixed visualization independent of the
SnapResult . |
static ResourceKey |
SNAP_LINE_PEN_KEY
Resource key which determines the
Pen used for the snap line visualization. |
static ResourceKey |
SNAP_LINE_VARIABLE_LINE_KEY
Resource key which determines a decorated snap line between the
Coordinates and the snapped
coordinates. |
static ResourceKey |
SNAP_TO_GRID_KEY
Resource key which determines the snapping of an item to a grid position.
|
Constructor and Description |
---|
SnapLine(SnapLineSnapTypes snapType,
ResourceKey resourceKey,
PointD coordinates,
PointD from,
PointD to,
Object tag,
double weight)
Creates a new snap line using the provided attributes.
|
Modifier and Type | Method and Description |
---|---|
PointD |
getCoordinates()
The coordinates of the center point of the snap line.
|
PointD |
getFrom()
The first location that delimits this snap line.
|
ResourceKey |
getResourceKey()
The resource key which determines the visual appearance of the snap line.
|
SnapLineSnapTypes |
getSnapType()
The type of the line that describes how other items will snap to this line.
|
Object |
getTag()
The tag that is associated with this snap line.
|
PointD |
getTo()
The second location that delimits this snap line.
|
double |
getWeight()
The weight/importance of this snap line.
|
void |
setFrom(PointD value)
The first location that delimits this snap line.
|
void |
setTo(PointD value)
The second location that delimits this snap line.
|
public static final ResourceKey GRID_LINE_FIXED_LINE_KEY
SnapResult
.public static final ResourceKey SNAP_LINE_BLANK_VARIABLE_LINE_KEY
Coordinates
and the snapped
coordinates.public static final ResourceKey SNAP_LINE_CENTER_BETWEEN_BOUNDS_KEY
public static final ResourceKey SNAP_LINE_CENTER_BETWEEN_CENTERS_KEY
public static final ResourceKey SNAP_LINE_EDGE_SEGMENT_KEY
public static final ResourceKey SNAP_LINE_EQUAL_DISTANCE_BETWEEN_BOUNDS_KEY
public static final ResourceKey SNAP_LINE_EQUAL_DISTANCE_BETWEEN_CENTERS_KEY
public static final ResourceKey SNAP_LINE_EQUAL_HEIGHT_KEY
public static final ResourceKey SNAP_LINE_EQUAL_WIDTH_KEY
public static final ResourceKey SNAP_LINE_EXTENDED_VARIABLE_LINE_KEY
Coordinates
and the snapped
coordinates that is extended on both sides.public static final ResourceKey SNAP_LINE_FIXED_DISTANCE_KEY
public static final ResourceKey SNAP_LINE_FIXED_LINE_KEY
SnapResult
.public static final ResourceKey SNAP_LINE_PEN_KEY
Pen
used for the snap line visualization.public static final ResourceKey SNAP_LINE_VARIABLE_LINE_KEY
Coordinates
and the snapped
coordinates.public static final ResourceKey SNAP_TO_GRID_KEY
public SnapLine(SnapLineSnapTypes snapType, ResourceKey resourceKey, PointD coordinates, PointD from, PointD to, Object tag, double weight)
snapType
- The type of the line that describes how other items will snap to this line. This is one of
SnapLineSnapTypes.TOP
, SnapLineSnapTypes.BOTTOM
, SnapLineSnapTypes.LEFT
,
SnapLineSnapTypes.RIGHT
, or SnapLineSnapTypes.CENTER
.resourceKey
- A resource key which determines the visual representation of this snap line.coordinates
- The coordinates of the center point of the snap line.from
- The first location that delimits this snap line.to
- The second location that delimits this snap line.tag
- A tag that is associated with this snap line - see Tag
for a typical use of this value.weight
- The weight (importance) of this snap line. If more than one snap line is snapped to, the one with the greater weight
will be used.public final PointD getCoordinates()
public final PointD getFrom()
setFrom(PointD)
public final ResourceKey getResourceKey()
public final SnapLineSnapTypes getSnapType()
his is one of SnapLineSnapTypes.TOP
, SnapLineSnapTypes.BOTTOM
, SnapLineSnapTypes.LEFT
,
SnapLineSnapTypes.RIGHT
, or SnapLineSnapTypes.CENTER
.
public final Object getTag()
snap result tag
.public final PointD getTo()
setTo(PointD)
public final double getWeight()
Greater values indicate greater importance.
public final void setFrom(PointD value)
value
- The From to set.getFrom()