Class PicCircleFrom3Points

  • All Implemented Interfaces:
    Element, PicMultiCurveConvertable, PicObjectConstants, ActionFactory, CustomizerFactory

    public class PicCircleFrom3Points
    extends PicEllipse
    implements CustomizerFactory
    A class implementing either a circle or an arc, whose geometry is specified by a PicEllipse, yet is further controllable by three additional points : this may either be a plain circle going through these three points, or an arc going from P_1 to P_3 through P_2, in which case a pie or a chord may be added as well.
    Superclass control-points are still available here, yet geometry is constrained to a circle by invoking e.g. super.setPoint using a PicParallelogram.SQUARE EditPointConstraint.
    Since:
    jPicEdt 1.4
    Version:
    $Id: PicCircleFrom3Points.java,v 1.19.2.1 2007/09/02 11:56:26 reynal Exp $
    Author:
    Vincent Guirardel
    • Constructor Detail

      • PicCircleFrom3Points

        public PicCircleFrom3Points()
        Creates a new circle reduced to a single point located at (0,0).
      • PicCircleFrom3Points

        public PicCircleFrom3Points​(boolean plain,
                                    int closure)
        Creates a new arc or circle reduced to a single point located at (0,0), with a default attribute set and the given closure type.
        Parameters:
        plain - if true, we draw a plain circle and ignore the closure parameter.
        closure - closure type as defined in java.awt.geom.Arc2D
      • PicCircleFrom3Points

        public PicCircleFrom3Points​(PicAttributeSet set)
        Creates a new (full) circle reduced to a single point located at (0,0), with the given attribute set.
      • PicCircleFrom3Points

        public PicCircleFrom3Points​(boolean plain,
                                    int closure,
                                    PicAttributeSet set)
        Creates a new arc or circle reduced to a single point located at (0,0), with the given closure and attribute set.
        Parameters:
        plain - if true, we draw a plain circle and ignore the closure parameter.
        closure - closure type as defined in java.awt.geom.Arc2D
      • PicCircleFrom3Points

        public PicCircleFrom3Points​(PicPoint pt1,
                                    PicPoint pt2,
                                    PicPoint pt3,
                                    PicAttributeSet set)
        Create a new circle whose geometry is specificed by the the 3 given points, and with the given attribute set.
      • PicCircleFrom3Points

        public PicCircleFrom3Points​(PicPoint pt1,
                                    PicPoint pt2,
                                    PicPoint pt3,
                                    boolean plain,
                                    int closure,
                                    PicAttributeSet set)
        Create a new arc or circle whose geometry is specified by the 3 given points, and with the given attribute set.
        Parameters:
        plain - whether to draw a plain circle or an arc
        closure - closure type as defined in java.awt.geom.Arc2D
      • PicCircleFrom3Points

        public PicCircleFrom3Points​(PicCircleFrom3Points circle)
        "cloning" constructor (to be used by clone())
    • Method Detail

      • clone

        public java.lang.Object clone()
        Overrides Object.clone() method
        Specified by:
        clone in interface Element
        Overrides:
        clone in class PicEllipse
      • getName

        public java.lang.String getName()
        Description copied from class: PicEllipse
        Return a localised string that represents this object's name
        Specified by:
        getName in interface Element
        Overrides:
        getName in class PicEllipse
        Returns:
        a string that represents this object's name ; should be a key-entry to i18n files.
        Since:
        jpicedt 1.3.3
      • convertToEllipse

        public PicEllipse convertToEllipse()
        Convert this circle to a new PicEllipse object.
      • getControlPoint

        protected PicPoint getControlPoint​(int i)
        Returns a reference to the ith control-point in the controlPts list.
        Parameters:
        i - one of CTRL_P_1, CTRL_P_2 or CTRL_P_3.
      • setControlPoint

        protected void setControlPoint​(int i,
                                       PicPoint pt)
        Set the coordinates of ith control-point from the given point.
        Parameters:
        i - one of P_1, P_2 or P_3.
      • updateEllipse

        protected void updateEllipse()
        This method update the geometry of the superclass, i.e. specification points P_BL, P_BR and P_TL, from the current value of the three control points P_1, P_2, P_3.
        Subclasser may want to adapt updating scheme to their own need here.
      • updateControlPoints

        protected void updateControlPoints​(int numPoint)
        Update the values of the three control-points from the geometry of the superclass. This aka updateEllipse(), yet the other way around.
        Parameters:
        numPoint - index of the PicParallelogram's control-point that was moved
      • setPoint

        public void setPoint​(int numPoint,
                             PicPoint pt,
                             EditPointConstraint c)
        Set the coordinate of the point indexed by "numPoint" to the given value.
        Specified by:
        setPoint in interface Element
        Overrides:
        setPoint in class PicEllipse
        Parameters:
        numPoint - one of P_TL, P_TR, P_BL, P_BR, SIDE_T, SIDE_B, SIDE_L, SIDE_R or P_CENTER.
        c - either null, DEFAULT, CENTER_FIXED or SQUARE
      • getPoint

        public PicPoint getPoint​(int numPoint,
                                 PicPoint src)
        Get the coordinate of the point indexed by "numPoint" to the given value.
        Specified by:
        getPoint in interface Element
        Overrides:
        getPoint in class PicEllipse
        Parameters:
        numPoint - one of P_1, P_2 or P_3.
        src - a PicPoint to update and create if necessary
        Returns:
        the point indexed by numPoint ; if src is null, allocates a new PicPoint and return it, otherwise directly modifies src and returns it as well for convenience.
      • translate

        public void translate​(double dx,
                              double dy)
        Translate this circle by (dx,dy)
        Specified by:
        translate in interface Element
        Overrides:
        translate in class DefaultLeafElement
        Parameters:
        dx - The X coordinate of translation vector
        dy - The Y coordinate of translation vector
      • scale

        public void scale​(double ptOrgX,
                          double ptOrgY,
                          double sx,
                          double sy)
        Scale this object by (sx,sy) using (ptOrgX,ptOrgY) as the origin. This implementation simply apply a scaling transform to all specification-points. Note that sx and sy may be negative. This method eventually fires a changed-update event.
        Specified by:
        scale in interface Element
        Overrides:
        scale in class PicEllipse
      • rotate

        public void rotate​(PicPoint ptOrg,
                           double angle)
        Rotate this Element by the given angle along the given point
        Specified by:
        rotate in interface Element
        Overrides:
        rotate in class PicEllipse
        Parameters:
        angle - rotation angle in radians
      • shear

        public void shear​(PicPoint ptOrg,
                          double shx,
                          double shy)
        Shear this Element by the given params wrt to the given origin
        Specified by:
        shear in interface Element
        Overrides:
        shear in class PicEllipse
      • isPlain

        public boolean isPlain()
        Description copied from class: PicEllipse
        Return true if this PicEllipse is a plain ellipse, ie if angle extent equals 360.
        Overrides:
        isPlain in class PicEllipse
      • setPlain

        public void setPlain​(boolean b)
      • toString

        public java.lang.String toString()
        Implementation of the Object.toString() method, used for debugging purpose
        Overrides:
        toString in class PicEllipse
        Since:
        PicEdt 1.1.4