public class mxCurve
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CORE_CURVE
Defines the key for the central curve index
|
protected java.util.Map<java.lang.String,java.lang.Double> |
curveLengths
The curve lengths of the curves
|
java.util.List<mxPoint> |
guidePoints
The points this curve is drawn through.
|
protected java.util.Map<java.lang.String,double[]> |
intervals
An array of arrays of intervals.
|
static mxLine |
INVALID_POSITION
Indicates that an invalid position on a curve was requested
|
static java.lang.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 java.util.Map<java.lang.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(java.util.List<mxPoint> points) |
Modifier and Type | Method and Description |
---|---|
mxPoint |
collisionMove(java.lang.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(java.lang.String index) |
mxLine |
getCurveParallel(java.lang.String index,
double distance)
Returns a unit vector parallel to the curve at the specified
distance along the curve.
|
mxPoint[] |
getCurvePoints(java.lang.String index)
Obtains the points that make up the curve for the specified
curve index.
|
mxPoint[] |
getCurveSection(java.lang.String index,
double start,
double end)
Returns a section of the curve as an array of points
|
java.util.List<mxPoint> |
getGuidePoints() |
double[] |
getIntervals(java.lang.String index) |
protected int |
getLowerIndexOfSegment(java.lang.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,
java.lang.String index)
Calculates the position of an absolute in terms relative
to this curve.
|
protected mxPoint |
intersectRectPerimeterPoint(java.lang.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(java.lang.String index,
mxRectangle rect)
Utility method to determine within which segment the specified rectangle
intersects the specified curve
|
protected int |
intersectRectPerimeterSeg(java.lang.String index,
mxRectangle rect,
int startSegment)
Utility method to determine within which segment the specified rectangle
intersects the specified curve.
|
boolean |
intersectsRect(java.awt.Rectangle rect)
Returns whether or not the rectangle passed in hits any part of this
curve.
|
mxPoint |
intersectsRectPerimeter(java.lang.String index,
mxRectangle rect)
Returns the point at which this curve intersects the boundary of
the given rectangle, if it does so.
|
double |
intersectsRectPerimeterDist(java.lang.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(java.lang.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(java.util.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 java.util.Map<java.lang.String,mxPoint[]> points
protected double minXBounds
protected double maxXBounds
protected double minYBounds
protected double maxYBounds
protected java.util.Map<java.lang.String,double[]> intervals
protected java.util.Map<java.lang.String,java.lang.Double> curveLengths
public static java.lang.String CORE_CURVE
public static java.lang.String LABEL_CURVE
public static mxLine INVALID_POSITION
protected double labelBuffer
public java.util.List<mxPoint> guidePoints
protected boolean valid
public mxCurve()
public mxCurve(java.util.List<mxPoint> points)
public void setLabelBuffer(double buffer)
public mxRectangle getBounds()
protected int getLowerIndexOfSegment(java.lang.String index, double distance)
public mxLine getCurveParallel(java.lang.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(java.lang.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(java.awt.Rectangle rect)
rect
- the rectangle to detect for a hitpublic mxPoint intersectsRectPerimeter(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.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, java.lang.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(java.lang.String index)
public void updateCurve(java.util.List<mxPoint> newPoints)
newPoints
- the new guide pointspublic mxPoint[] getCurvePoints(java.lang.String index)
index
- the key specifying the curvepublic double[] getIntervals(java.lang.String index)
public double getCurveLength(java.lang.String index)
protected boolean validateCurve()
protected void updateBounds(double pointX, double pointY)
public java.util.List<mxPoint> getGuidePoints()
Copyright (c) 2010-2017 Gaudenz Alder, JGraph Ltd. All rights reserved.