public class mxCurve extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CORE_CURVE
Defines the key for the central curve index
|
protected Map<String,Double> |
curveLengths
The curve lengths of the curves
|
List<mxPoint> |
guidePoints
The points this curve is drawn through.
|
protected Map<String,double[]> |
intervals
An array of arrays of intervals.
|
static mxLine |
INVALID_POSITION
Indicates that an invalid position on a curve was requested
|
static String |
LABEL_CURVE
Defines the key for the label curve index
|
protected double |
labelBuffer
Offset of the label curve from the curve the label curve is based on.
|
protected double |
maxXBounds |
protected double |
maxYBounds |
protected double |
minXBounds |
protected double |
minYBounds |
protected Map<String,mxPoint[]> |
points
A collection of arrays of curve points
|
protected boolean |
valid
Whether or not the curve currently holds valid values
|
Constructor and Description |
---|
mxCurve() |
mxCurve(List<mxPoint> points) |
Modifier and Type | Method and Description |
---|---|
mxPoint |
collisionMove(String index,
mxRectangle rect,
double buffer)
Returns a point to move the input rectangle to, in order to
attempt to place the rectangle away from the curve.
|
protected void |
createCoreCurve()
Creates the core curve that is based on the guide points passed into
this class instance
|
protected void |
createLabelCurve() |
protected mxPoint[] |
getBaseLabelCurve()
Returns the curve the label curve is too be based on
|
mxRectangle |
getBounds() |
double |
getCurveLength(String index) |
mxLine |
getCurveParallel(String index,
double distance)
Returns a unit vector parallel to the curve at the specified
distance along the curve.
|
mxPoint[] |
getCurvePoints(String index)
Obtains the points that make up the curve for the specified
curve index.
|
mxPoint[] |
getCurveSection(String index,
double start,
double end)
Returns a section of the curve as an array of points
|
List<mxPoint> |
getGuidePoints() |
double[] |
getIntervals(String index) |
protected int |
getLowerIndexOfSegment(String index,
double distance)
Calculates the index of the lower point on the segment
that contains the point distance along the
|
mxRectangle |
getRelativeFromAbsPoint(mxPoint absPoint,
String index)
Calculates the position of an absolute in terms relative
to this curve.
|
protected mxPoint |
intersectRectPerimeterPoint(String curveIndex,
mxRectangle rect,
int indexSeg)
Returns the point at which this curve segment intersects the boundary
of the given rectangle, if it does so.
|
protected int |
intersectRectPerimeterSeg(String index,
mxRectangle rect)
Utility method to determine within which segment the specified rectangle
intersects the specified curve
|
protected int |
intersectRectPerimeterSeg(String index,
mxRectangle rect,
int startSegment)
Utility method to determine within which segment the specified rectangle
intersects the specified curve.
|
boolean |
intersectsRect(Rectangle rect)
Returns whether or not the rectangle passed in hits any part of this
curve.
|
mxPoint |
intersectsRectPerimeter(String index,
mxRectangle rect)
Returns the point at which this curve intersects the boundary of
the given rectangle, if it does so.
|
double |
intersectsRectPerimeterDist(String index,
mxRectangle rect)
Returns the distance from the start of the curve at which this
curve intersects the boundary of the given rectangle, if it does
so.
|
boolean |
isLabelReversed()
Whether or not the label curve starts from the end target
and traces to the start of the branch
|
protected void |
populateIntervals(String index) |
void |
setLabelBuffer(double buffer) |
protected void |
updateBounds(double pointX,
double pointY)
Updates the total bounds of this curve, increasing any dimensions,
if necessary, to fit in the specified point
|
void |
updateCurve(List<mxPoint> newPoints)
Updates the existing curve using the points passed in.
|
protected boolean |
validateCurve()
Method must be called before any attempt to access curve information
|
protected double minXBounds
protected double maxXBounds
protected double minYBounds
protected double maxYBounds
protected Map<String,double[]> intervals
public static String CORE_CURVE
public static String LABEL_CURVE
public static mxLine INVALID_POSITION
protected double labelBuffer
public List<mxPoint> guidePoints
protected boolean valid
public void setLabelBuffer(double buffer)
public mxRectangle getBounds()
protected int getLowerIndexOfSegment(String index, double distance)
public mxLine getCurveParallel(String index, double distance)
index
- the curve index specifying the curve to analysedistance
- the distance from start to end of curve (0.0...1.0)mxCurve.INVALID_POSITION
is returnedpublic mxPoint[] getCurveSection(String index, double start, double end)
index
- the curve index specifying the curve to analysestart
- the start position of the curve segment (0.0...1.0)end
- the end position of the curve segment (0.0...1.0)public boolean intersectsRect(Rectangle rect)
rect
- the rectangle to detect for a hitpublic mxPoint intersectsRectPerimeter(String index, mxRectangle rect)
index
- the curve index specifying the curve to analyserect
- the whose boundary is to be tested for intersection
with this curvepublic double intersectsRectPerimeterDist(String index, mxRectangle rect)
index
- the curve index specifying the curve to analyserect
- the whose boundary is to be tested for intersection
with this curvepublic mxPoint collisionMove(String index, mxRectangle rect, double buffer)
index
- the curve index specifying the curve to analyserect
- the rectangle that is to be movedbuffer
- the amount by which the rectangle is to be moved,
beyond the dimensions of the rectprotected int intersectRectPerimeterSeg(String index, mxRectangle rect)
index
- the curve index specifying the curve to analyserect
- the whose boundary is to be tested for intersection
with this curveprotected int intersectRectPerimeterSeg(String index, mxRectangle rect, int startSegment)
index
- the curve index specifying the curve to analyserect
- the whose boundary is to be tested for intersection
with this curvestartSegment
- the segment to start searching at. To start at the
beginning of the curve, use 1, not 0.protected mxPoint intersectRectPerimeterPoint(String curveIndex, mxRectangle rect, int indexSeg)
curveIndex
- the curve index specifying the curve to analyserect
- the whose boundary is to be tested for intersection
with this curveindexSeg
- the segments on this curve being checkedpublic mxRectangle getRelativeFromAbsPoint(mxPoint absPoint, String index)
absPoint
- the point whose relative point is to calculatedindex
- the index of the curve whom the relative position is to be
calculated fromprotected void createCoreCurve()
public boolean isLabelReversed()
protected void createLabelCurve()
protected mxPoint[] getBaseLabelCurve()
protected void populateIntervals(String index)
public void updateCurve(List<mxPoint> newPoints)
newPoints
- the new guide pointspublic mxPoint[] getCurvePoints(String index)
index
- the key specifying the curvepublic double[] getIntervals(String index)
public double getCurveLength(String index)
protected boolean validateCurve()
protected void updateBounds(double pointX, double pointY)
Copyright (c) 2010 Gaudenz Alder, David Benson. All rights reserved.