Documentation of 'com.mxgraph.util.mxCurve' Java class
mxCurve
com.mxgraph.util

Class mxCurve



  • public class mxCurve
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String CORE_CURVE
      Defines the key for the central curve index
      java.util.List<mxPoint> guidePoints
      The points this curve is drawn through.
      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
    • Constructor Summary

      Constructors 
      Constructor and Description
      mxCurve() 
      mxCurve(java.util.List<mxPoint> points) 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      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.
      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) 
      mxRectangle getRelativeFromAbsPoint(mxPoint absPoint, java.lang.String index)
      Calculates the position of an absolute in terms relative to this 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
      void setLabelBuffer(double buffer) 
      void updateCurve(java.util.List<mxPoint> newPoints)
      Updates the existing curve using the points passed in.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CORE_CURVE

        public static java.lang.String CORE_CURVE
        Defines the key for the central curve index
      • LABEL_CURVE

        public static java.lang.String LABEL_CURVE
        Defines the key for the label curve index
      • INVALID_POSITION

        public static mxLine INVALID_POSITION
        Indicates that an invalid position on a curve was requested
      • guidePoints

        public java.util.List<mxPoint> guidePoints
        The points this curve is drawn through. These are typically control points and are at distances from each other that straight lines between them do not describe a smooth curve. This class takes these guiding points and creates a finer set of internal points that visually appears to be a curve when linked by straight lines
    • Constructor Detail

      • mxCurve

        public mxCurve()
      • mxCurve

        public mxCurve(java.util.List<mxPoint> points)
    • Method Detail

      • setLabelBuffer

        public void setLabelBuffer(double buffer)
      • getCurveParallel

        public mxLine getCurveParallel(java.lang.String index,
                                       double distance)
        Returns a unit vector parallel to the curve at the specified distance along the curve. To obtain the angle the vector makes with (1,0) perform Math.atan(segVectorY/segVectorX).
        Parameters:
        index - the curve index specifying the curve to analyse
        distance - the distance from start to end of curve (0.0...1.0)
        Returns:
        a unit vector at the specified point on the curve represented as a line, parallel with the curve. If the distance or curve is invalid, mxCurve.INVALID_POSITION is returned
      • getCurveSection

        public mxPoint[] getCurveSection(java.lang.String index,
                                         double start,
                                         double end)
        Returns a section of the curve as an array of points
        Parameters:
        index - the curve index specifying the curve to analyse
        start - the start position of the curve segment (0.0...1.0)
        end - the end position of the curve segment (0.0...1.0)
        Returns:
        a sequence of point representing the curve section or null if it cannot be calculated
      • intersectsRect

        public boolean intersectsRect(java.awt.Rectangle rect)
        Returns whether or not the rectangle passed in hits any part of this curve.
        Parameters:
        rect - the rectangle to detect for a hit
        Returns:
        whether or not the rectangle hits this curve
      • intersectsRectPerimeter

        public 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. If it does not intersect, null is returned. If it intersects multiple times, the first intersection from the start end of the curve is returned.
        Parameters:
        index - the curve index specifying the curve to analyse
        rect - the whose boundary is to be tested for intersection with this curve
        Returns:
        the point at which this curve intersects the boundary of the given rectangle, if it does so. If it does not intersect, null is returned.
      • intersectsRectPerimeterDist

        public 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. If it does not intersect, -1 is returned. If it intersects multiple times, the first intersection from the start end of the curve is returned.
        Parameters:
        index - the curve index specifying the curve to analyse
        rect - the whose boundary is to be tested for intersection with this curve
        Returns:
        the distance along the curve from the start at which the intersection occurs
      • collisionMove

        public 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. NOTE: Curves are scaled, the input rectangle should be also.
        Parameters:
        index - the curve index specifying the curve to analyse
        rect - the rectangle that is to be moved
        buffer - the amount by which the rectangle is to be moved, beyond the dimensions of the rect
        Returns:
        the point to move the top left of the input rect to , otherwise null if no point can be determined
      • getRelativeFromAbsPoint

        public mxRectangle getRelativeFromAbsPoint(mxPoint absPoint,
                                                   java.lang.String index)
        Calculates the position of an absolute in terms relative to this curve.
        Parameters:
        absPoint - the point whose relative point is to calculated
        index - the index of the curve whom the relative position is to be calculated from
        Returns:
        an mxRectangle where the x is the distance along the curve (0 to 1), y is the orthogonal offset from the closest segment on the curve and (width, height) is an additional Cartesian offset applied after the other calculations
      • isLabelReversed

        public boolean isLabelReversed()
        Whether or not the label curve starts from the end target and traces to the start of the branch
        Returns:
        whether the label curve is reversed
      • updateCurve

        public void updateCurve(java.util.List<mxPoint> newPoints)
        Updates the existing curve using the points passed in.
        Parameters:
        newPoints - the new guide points
      • getCurvePoints

        public mxPoint[] getCurvePoints(java.lang.String index)
        Obtains the points that make up the curve for the specified curve index. If that curve, or the core curve that other curves are based on have not yet been created, then they are lazily created. If creation is impossible, null is returned
        Parameters:
        index - the key specifying the curve
        Returns:
        the points making up that curve, or null
      • getIntervals

        public double[] getIntervals(java.lang.String index)
      • getCurveLength

        public double getCurveLength(java.lang.String index)
      • getGuidePoints

        public java.util.List<mxPoint> getGuidePoints()
        Returns:
        the guidePoints

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.