|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.SnapLine
public class SnapLine
Models a snap line that is an line segment in the world coordinate system that is parallel to the x or y axis
and to which other items (lines or points) snap to during interactive movements.
AbstractSnapContext
makes use of this class to interactively snap moving elements to snap lines.
Field Summary | |
---|---|
static byte |
BOTTOM
Constant that describes a special snap type . |
static byte |
CENTER
Constant that describes a special snap type . |
static byte |
HORIZONTAL
Constant that describes a horizontal orientation of a snap line. |
static byte |
LEFT
Constant that describes a special snap type . |
static byte |
RIGHT
Constant that describes a special snap type . |
static byte |
TOP
Constant that describes a special snap type . |
static byte |
VERTICAL
Constant that describes a vertical orientation of a snap line. |
Constructor Summary | |
---|---|
SnapLine(byte orientation,
byte snapType,
YPoint coordinates,
double from,
double to,
java.lang.Object tag,
double weight)
Creates a new snap line using the provided attributes. |
|
SnapLine(byte orientation,
byte snapType,
YPoint coordinates,
java.lang.Object tag,
double weight)
Creates a new snap line using the provided attributes. |
Method Summary | |
---|---|
java.awt.Rectangle |
getBounds()
Yields the bounds of the canonical drawable of this snap line. |
YPoint |
getCoordinates()
Gets the coordinates of the snap line. |
double |
getFrom()
Yields the smaller coordinate this snap line starts from. |
byte |
getOrientation()
Yields the orientation of this snap line. |
byte |
getSnapType()
Yields the snapping type of this snap line. |
java.lang.Object |
getTag()
Yields the tag that is associated with this snap line. |
double |
getTo()
Yields the greater coordinate this snap line starts from. |
double |
getWeight()
Gets the weight/importance of this snap line. |
void |
paint(java.awt.Graphics2D g)
Renders a canonical drawable of this snap line. |
void |
setFrom(double from)
Sets the smaller coordinate this snap line starts from. |
void |
setTo(double to)
Sets the greater coordinate this snap line starts from. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte HORIZONTAL
getOrientation()
,
Constant Field Valuespublic static final byte VERTICAL
getOrientation()
,
Constant Field Valuespublic static final byte TOP
snap type
. This is typically used
to describe snap lines to which the top sides of rectangular elements will snap.
public static final byte BOTTOM
snap type
. This is typically used
to describe snap lines to which the bottom sides of rectangular elements will snap.
public static final byte LEFT
snap type
. This is typically used
to describe snap lines to which the left sides of rectangular elements will snap.
public static final byte RIGHT
snap type
. This is typically used
to describe snap lines to which the right sides of rectangular elements will snap.
public static final byte CENTER
snap type
. This is typically used
to describe snap lines to which the horizontal or vertical center lines of elements will snap.
Constructor Detail |
---|
public SnapLine(byte orientation, byte snapType, YPoint coordinates, java.lang.Object tag, double weight)
orientation
- The orientation of the snap line. This is one of HORIZONTAL
or VERTICAL
snapType
- The type of the line that describes how other items will snap to this line.
This is one of TOP
, BOTTOM
, LEFT
, RIGHT
, or CENTER
.coordinates
- The coordinates of the center point of the snap line.tag
- A tag that is associated with this snap line - see SnapResult.getTag()
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 SnapLine(byte orientation, byte snapType, YPoint coordinates, double from, double to, java.lang.Object tag, double weight)
orientation
- The orientation of the snap line. One of HORIZONTAL
or VERTICAL
.snapType
- The type of the line that describes how other items will snap to this line.
One of TOP
, BOTTOM
, LEFT
, RIGHT
, or CENTER
.coordinates
- The coordinates of the center point of the snap line.tag
- A tag that is associated with this snap line - see SnapResult.getTag()
for a typical use
of this value.from
- The smaller value of the coordinate that delimits this snap lineto
- The greater value of the coordinate that delimits this snap lineweight
- 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.Method Detail |
---|
public double getWeight()
public YPoint getCoordinates()
public byte getOrientation()
HORIZONTAL
or VERTICAL
.
public byte getSnapType()
TOP
, BOTTOM
, RIGHT
, LEFT
,
or CENTER
.
public double getFrom()
getOrientation()
,
setFrom(double)
,
getTo()
,
setTo(double)
public double getTo()
getOrientation()
,
setTo(double)
,
getFrom()
,
setFrom(double)
public void setFrom(double from)
getOrientation()
,
getFrom()
,
getTo()
,
setTo(double)
public void setTo(double to)
getOrientation()
,
getTo()
,
getFrom()
,
setFrom(double)
public java.awt.Rectangle getBounds()
getBounds
in interface Drawable
public void paint(java.awt.Graphics2D g)
Graphics2D
context.
paint
in interface Drawable
public java.lang.Object getTag()
snap result tag
.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |