|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.BridgeCalculator
public class BridgeCalculator
Calculates and inserts "bridges" (also called "gaps" or "jumps") into PathIterator
s.
Bridges are inserted when two (or more) segments cross, which can mean both segments
of different paths or segments of one path.
crossing modes
. This can be used for one-pass or two-pass
calculation (see EdgeRealizer.registerObstacles(BridgeCalculator)
).
setCrossingMode(short)
,
setCrossingStyle(short)
,
setOrientationStyle(short)
,
DefaultGraph2DRenderer.setBridgeCalculator(BridgeCalculator)
Field Summary | |
---|---|
static short |
CROSSING_MODE_HORIZONTAL_CROSSES_VERTICAL
Crossing mode constant. |
static short |
CROSSING_MODE_ORDER_INDUCED
Crossing mode constant. |
static short |
CROSSING_MODE_VERTICAL_CROSSES_HORIZONTAL
Crossing mode constant. |
static short |
CROSSING_STYLE_ARC
Crossing style constant. |
static short |
CROSSING_STYLE_ARC_SCALED
Crossing style constant. |
static short |
CROSSING_STYLE_CUSTOM
Crossing style constant. |
static short |
CROSSING_STYLE_GAP
Crossing style constant. |
static short |
CROSSING_STYLE_SQUARE
Crossing style constant. |
static short |
CROSSING_STYLE_SQUARE_SCALED
Crossing style constant. |
static short |
CROSSING_STYLE_TWO_SIDES
Crossing style constant. |
static short |
CROSSING_STYLE_TWO_SIDES_SCALED
Crossing style constant. |
static short |
ORIENTATION_STYLE_DOWN
Orientation style constant. |
static short |
ORIENTATION_STYLE_FLOW_LEFT
Orientation style constant. |
static short |
ORIENTATION_STYLE_FLOW_RIGHT
Orientation style constant. |
static short |
ORIENTATION_STYLE_LEFT
Orientation style constant. |
static short |
ORIENTATION_STYLE_NEGATIVE
Orientation style constant. |
static short |
ORIENTATION_STYLE_POSITIVE
Orientation style constant. |
static short |
ORIENTATION_STYLE_RIGHT
Orientation style constant. |
static short |
ORIENTATION_STYLE_UP
Orientation style constant. |
Constructor Summary | |
---|---|
BridgeCalculator()
Creates a new BridgeCalculator instance using the default size for the storage of segments. |
|
BridgeCalculator(int size)
Creates a new BridgeCalculator instance with given initial size for the storage of segments. |
Method Summary | |
---|---|
double |
getBridgeHeight()
Returns the default height for a bridge. |
double |
getBridgeWidth()
Returns the default width for a bridge. |
short |
getCrossingMode()
Returns the mode that is responsible for determining crossings in the drawing. |
short |
getCrossingStyle()
Returns the current default crossing drawing style. |
short |
getOrientationStyle()
Returns the current default orientation style. |
java.awt.geom.PathIterator |
insertBridges(java.awt.geom.PathIterator pi)
Takes the given PathIterator, calculates and inserts bridges into those segments that intersect with other segments (from either this or another path), and returns a new PathIterator instance with bridges inserted. |
protected void |
insertCustomBridge(MutableGeneralPath mgp,
MutableGeneralPath.Segment beforeSegment,
double up,
double x1,
double y1,
double down,
double x2,
double y2)
Callback method that is called during insertBridges(java.awt.geom.PathIterator) to allow for
custom modifications of the MutableGeneralPath and optionally recording of the bridges. |
void |
registerObstacleLine(double x1,
double y1,
double x2,
double y2)
Registers a line as an obstacle for subsequent insertBridges(java.awt.geom.PathIterator)
calls. |
void |
registerObstacles(java.awt.geom.PathIterator pi)
Iterates over the given Path and inserts all straight-line segments as obstacles via registerObstacleLine(double, double, double, double) |
void |
reset()
Resets the internal segment storage. |
void |
setBridgeHeight(double bridgeHeight)
Sets the default height for a bridge. |
void |
setBridgeWidth(double bridgeWidth)
Sets the default width for a bridge. |
void |
setCrossingMode(short crossingMode)
Sets the mode that is used for calculation of the crossings. |
void |
setCrossingStyle(short crossingStyle)
Sets the current default crossing drawing style. |
void |
setOrientationStyle(short orientationStyle)
Sets the current default orientation style. |
void |
setScope(double minX,
double minY,
double maxX,
double maxY)
Limits the scope of the calculation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final short CROSSING_STYLE_GAP
public static final short CROSSING_STYLE_ARC
public static final short CROSSING_STYLE_SQUARE
public static final short CROSSING_STYLE_TWO_SIDES
public static final short CROSSING_STYLE_ARC_SCALED
public static final short CROSSING_STYLE_SQUARE_SCALED
public static final short CROSSING_STYLE_TWO_SIDES_SCALED
public static final short CROSSING_STYLE_CUSTOM
insertCustomBridge(MutableGeneralPath,y.view.MutableGeneralPath.Segment,double,double,double,double,double,double)
being called for each bridge to insert into the path.
public static final short ORIENTATION_STYLE_UP
public static final short ORIENTATION_STYLE_DOWN
public static final short ORIENTATION_STYLE_LEFT
public static final short ORIENTATION_STYLE_RIGHT
public static final short ORIENTATION_STYLE_POSITIVE
public static final short ORIENTATION_STYLE_NEGATIVE
public static final short ORIENTATION_STYLE_FLOW_LEFT
public static final short ORIENTATION_STYLE_FLOW_RIGHT
public static final short CROSSING_MODE_ORDER_INDUCED
public static final short CROSSING_MODE_HORIZONTAL_CROSSES_VERTICAL
public static final short CROSSING_MODE_VERTICAL_CROSSES_HORIZONTAL
Constructor Detail |
---|
public BridgeCalculator(int size)
CROSSING_STYLE_ARC
and orientation style ORIENTATION_STYLE_POSITIVE
are used as the default settings.
public BridgeCalculator()
CROSSING_STYLE_ARC
and orientation style ORIENTATION_STYLE_POSITIVE
are used as the default settings.
Method Detail |
---|
public void reset()
public short getCrossingMode()
CROSSING_MODE_ORDER_INDUCED
CROSSING_MODE_ORDER_INDUCED
,
CROSSING_MODE_HORIZONTAL_CROSSES_VERTICAL
, or
CROSSING_MODE_VERTICAL_CROSSES_HORIZONTAL
.setCrossingMode(short)
public void setCrossingMode(short crossingMode)
CROSSING_MODE_ORDER_INDUCED
)
CROSSING_MODE_HORIZONTAL_CROSSES_VERTICAL
: Each vertical segment is stored as an obstacle
during the first pass and each horizontal segment in the second pass is tested against all
of the vertical segments from the first pass. Each resulting crossing is inserted into the
horizontal segments only.
CROSSING_MODE_VERTICAL_CROSSES_HORIZONTAL
: Each horizontal segment is stored as an obstacle
during the first pass and each vertical segment in the second pass is tested against all
of the horizontal segments from the first pass. Each resulting crossing is inserted into the
vertical segments only.
crossingMode
- one of CROSSING_MODE_ORDER_INDUCED
,
CROSSING_MODE_HORIZONTAL_CROSSES_VERTICAL
, or
CROSSING_MODE_VERTICAL_CROSSES_HORIZONTAL
.public short getOrientationStyle()
ORIENTATION_STYLE_UP
,
ORIENTATION_STYLE_DOWN
,
ORIENTATION_STYLE_FLOW_LEFT
,
ORIENTATION_STYLE_FLOW_RIGHT
,
ORIENTATION_STYLE_LEFT
,
ORIENTATION_STYLE_RIGHT
,
ORIENTATION_STYLE_POSITIVE
,
ORIENTATION_STYLE_NEGATIVE
.public void setOrientationStyle(short orientationStyle)
orientationStyle
- one of ORIENTATION_STYLE_UP
,
ORIENTATION_STYLE_DOWN
,
ORIENTATION_STYLE_FLOW_LEFT
,
ORIENTATION_STYLE_FLOW_RIGHT
,
ORIENTATION_STYLE_LEFT
,
ORIENTATION_STYLE_RIGHT
,
ORIENTATION_STYLE_POSITIVE
,
ORIENTATION_STYLE_NEGATIVE
.public void setCrossingStyle(short crossingStyle)
crossingStyle
- one of
CROSSING_STYLE_ARC
,
CROSSING_STYLE_ARC_SCALED
,
CROSSING_STYLE_GAP
,
CROSSING_STYLE_SQUARE
,
CROSSING_STYLE_SQUARE_SCALED
,
CROSSING_STYLE_TWO_SIDES
,
CROSSING_STYLE_TWO_SIDES_SCALED
,
CROSSING_STYLE_CUSTOM
.public short getCrossingStyle()
CROSSING_STYLE_ARC
,
CROSSING_STYLE_ARC_SCALED
,
CROSSING_STYLE_GAP
,
CROSSING_STYLE_SQUARE
,
CROSSING_STYLE_SQUARE_SCALED
,
CROSSING_STYLE_TWO_SIDES
,
CROSSING_STYLE_TWO_SIDES_SCALED
,
CROSSING_STYLE_CUSTOM
.public double getBridgeWidth()
public void setBridgeWidth(double bridgeWidth)
bridgeWidth
- the length of a bridgepublic double getBridgeHeight()
public void setBridgeHeight(double bridgeHeight)
bridgeHeight
- the height of a bridge/jumppublic void setScope(double minX, double minY, double maxX, double maxY)
public java.awt.geom.PathIterator insertBridges(java.awt.geom.PathIterator pi)
pi
- The PathIterator that should be processed.
public void registerObstacles(java.awt.geom.PathIterator pi)
registerObstacleLine(double, double, double, double)
pi
- the PathIterator that describes the pathpublic void registerObstacleLine(double x1, double y1, double x2, double y2)
insertBridges(java.awt.geom.PathIterator)
calls. The obstacle will not be registered if it does not intersect with the
current scope
.
x1
- the x coordinate of the first point of the liney1
- the y coordinate of the first point of the linex2
- the x coordinate of the second point of the liney2
- the y coordinate of the second point of the lineprotected void insertCustomBridge(MutableGeneralPath mgp, MutableGeneralPath.Segment beforeSegment, double up, double x1, double y1, double down, double x2, double y2)
insertBridges(java.awt.geom.PathIterator)
to allow for
custom modifications of the MutableGeneralPath and optionally recording of the bridges.
This method will be called if the crossing style
is set
to CROSSING_STYLE_CUSTOM
.
This implementation does nothing. The path stays unmodified.
mgp
- the path to be modifiedbeforeSegment
- the segment (PathIterator.SEG_MOVETO
) that should be modifiedup
- the distance from the start of the segment to the first pointx1
- the x coordinate of the beginning of the bridgey1
- the y coordinate of the beginning of the bridgedown
- the distance from the start of the segment to the second pointx2
- the x coordinate of the end of the bridgey2
- the y coordinate of the end of the bridge
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |