Package jpicedt.graphic.model
Class PicCircleFrom3Points
- java.lang.Object
-
- jpicedt.graphic.model.AbstractElement
-
- jpicedt.graphic.model.DefaultLeafElement
-
- jpicedt.graphic.model.PicParallelogram
-
- jpicedt.graphic.model.PicEllipse
-
- jpicedt.graphic.model.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.setPointusing aPicParallelogram.SQUAREEditPointConstraint.- Since:
- jPicEdt 1.4
- Version:
- $Id: PicCircleFrom3Points.java,v 1.19.2.1 2007/09/02 11:56:26 reynal Exp $
- Author:
- Vincent Guirardel
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.ArrayListcontrolPtsA list holding the three control-points this circle goes through, and serving as a convenient caching mechanism.protected static intCTRL_P_1index of first control-point, aka P_1, incontrolPtslistprotected static intCTRL_P_2index of second control-point, aka P_2, incontrolPtslistprotected static intCTRL_P_3index of last control-point, aka P_3, incontrolPtsliststatic intLAST_PTstatic intP_1index of first end-pointstatic intP_2index of intermediate pointstatic intP_3index of last end-point-
Fields inherited from class jpicedt.graphic.model.PicEllipse
CHORD, closure, greatAxis, OPEN, P_ANGLE_END, P_ANGLE_START, PIE, rotatedAngleEnd, rotatedAngleStart, rotationAngle, skewAngleEnd, skewAngleStart, smallAxis
-
Fields inherited from class jpicedt.graphic.model.PicParallelogram
b2tVec, CENTER_FIXED, DEFAULT, FIRST_PT, l2rVec, P_BL, P_BR, P_CENTER, P_SPEC_BL, P_SPEC_BR, P_SPEC_TR, P_TL, P_TR, SIDE_B, SIDE_L, SIDE_R, SIDE_T, SQUARE
-
Fields inherited from class jpicedt.graphic.model.DefaultLeafElement
nodeConnections, nodeName, pts
-
Fields inherited from class jpicedt.graphic.model.AbstractElement
attributeSet, parent, view
-
Fields inherited from interface jpicedt.graphic.model.PicObjectConstants
ARROW_GLOBAL_SCALE_LENGTH, ARROW_GLOBAL_SCALE_WIDTH, ARROW_INSET_SCALE, ARROW_LENGTH_SCALE, ARROW_WIDTH_LINEWIDTH_SCALE, ARROW_WIDTH_MINIMUM_MM, BRACKET_LENGTH_SCALE, CROSSHATCH, CROSSHATCH_FILLED, DASH_OPAQUE, DASH_TRANSPARENT, DASH1, DASH2, DASH3, DASHED, DIMEN, DOT_SEP, DOT_SEP1, DOT_SEP2, DOT_SEP3, DOTTED, DOUBLE_COLOR, DOUBLE_LINE, DOUBLE_SEP, FILL_COLOR, FILL_STYLE, HATCH_ANGLE, HATCH_COLOR, HATCH_SEP, HATCH_WIDTH, HLINES, HLINES_FILLED, INNER, LEFT_ARROW, LINE_COLOR, LINE_STYLE, LINE_WIDTH, MIDDLE, NONE, OUTER, OVER_STRIKE, OVER_STRIKE_COLOR, OVER_STRIKE_WIDTH, POLYDOTS_ANGLE, POLYDOTS_CIRCLE, POLYDOTS_DISK, POLYDOTS_PENTAGON, POLYDOTS_PENTAGON_FILLED, POLYDOTS_PLUS, POLYDOTS_SCALE_H, POLYDOTS_SCALE_V, POLYDOTS_SIZE_LINEWIDTH_SCALE, POLYDOTS_SIZE_MINIMUM_MM, POLYDOTS_SQUARE, POLYDOTS_SQUARE_FILLED, POLYDOTS_STYLE, POLYDOTS_SUPERIMPOSE, POLYDOTS_TRIANGLE, POLYDOTS_TRIANGLE_FILLED, PS_POINT, PST_CUSTOM, RBRACKET_LENGTH_SCALE, RIGHT_ARROW, SHADOW, SHADOW_ANGLE, SHADOW_COLOR, SHADOW_SIZE, SOLID, TBAR_WIDTH_LINEWIDTH_SCALE, TBAR_WIDTH_MINIMUM_MM, TEXT_BOX_CIRCLE, TEXT_BOX_NO_FRAME, TEXT_BOX_OVAL, TEXT_BOX_RECTANGLE, TEXT_FRAME, TEXT_HALIGN_CENTER, TEXT_HALIGN_LEFT, TEXT_HALIGN_RIGHT, TEXT_HOR_ALIGN, TEXT_ROTATION, TEXT_VALIGN_BASELINE, TEXT_VALIGN_BOTTOM, TEXT_VALIGN_CENTER, TEXT_VALIGN_TOP, TEXT_VERT_ALIGN, VLINES, VLINES_FILLED
-
-
Constructor Summary
Constructors Constructor Description PicCircleFrom3Points()Creates a new circle reduced to a single point located at (0,0).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.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.PicCircleFrom3Points(PicAttributeSet set)Creates a new (full) circle reduced to a single point located at (0,0), with the given attribute set.PicCircleFrom3Points(PicCircleFrom3Points circle)"cloning" constructor (to be used by clone())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.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Overrides Object.clone() methodPicEllipseconvertToEllipse()Convert this circle to a new PicEllipse object.PEAction[]createActions(ActionDispatcher actionDispatcher, ActionLocalizer localizer, HitInfo hi)Create an array of Action's related to this objectAbstractCustomizercreateCustomizer()Return a Customizer for geometry editingprotected PicPointgetControlPoint(int i)Returns a reference to the ith control-point in thecontrolPtslist.intgetFirstPointIndex()Returns the index of the first user-controlled point that can be retrieved bygetPoint().intgetLastPointIndex()Returns the index of the last user-controlled point that can be retrieved bygetPoint().java.lang.StringgetName()Return a localised string that represents this object's namePicPointgetPoint(int numPoint, PicPoint src)Get the coordinate of the point indexed by "numPoint" to the given value.booleanisPlain()Return true if this PicEllipse is a plain ellipse, ie if angle extent equals 360.voidrotate(PicPoint ptOrg, double angle)Rotate this Element by the given angle along the given pointvoidscale(double ptOrgX, double ptOrgY, double sx, double sy)Scale this object by (sx,sy) using (ptOrgX,ptOrgY) as the origin.protected voidsetControlPoint(int i, PicPoint pt)Set the coordinates of ith control-point from the given point.voidsetPlain(boolean b)voidsetPoint(int numPoint, PicPoint pt, EditPointConstraint c)Set the coordinate of the point indexed by "numPoint" to the given value.voidshear(PicPoint ptOrg, double shx, double shy)Shear this Element by the given params wrt to the given originjava.lang.StringtoString()Implementation of the Object.toString() method, used for debugging purposevoidtranslate(double dx, double dy)Translate this circle by (dx,dy)protected voidupdateControlPoints(int numPoint)Update the values of the three control-points from the geometry of the superclass.protected voidupdateEllipse()This method update the geometry of the superclass, i.e.-
Methods inherited from class jpicedt.graphic.model.PicEllipse
_updateAxis, convertToMultiCurve, getAngleEnd, getAngleExtent, getAngleStart, getArcType, getArcTypeAsString, getGreatAxisLength, getRotatedAngleEnd, getRotatedAngleExtent, getRotatedAngleStart, getRotationAngle, getSmallAxisLength, getTangentAtAngleEnd, getTangentAtAngleStart, isArc, isCircle, isCircular, isClosed, isFlat, isRotated, setAngleEnd, setAngleExtent, setAngleStart, setArcType, setPlain, updateAxis, updateRotatedAngles
-
Methods inherited from class jpicedt.graphic.model.PicParallelogram
getBoundingBox, getCenter, getCenterX, getCenterY, getPointX, getPointY, isRectangle, toParalleloBasisCoordinates, updateParalleloBasis
-
Methods inherited from class jpicedt.graphic.model.DefaultLeafElement
addConnection, fireChangedUpdate, forwardChangedUpdate, getAllowsChildren, getNodeName, getNumberOfSpecificationPoints, getPoint, getSpecificationPoint, getSpecificationPoint, getSpecificationPointX, getSpecificationPointY, isNode, isNodeable, iterator, nodeConnectionOrigin, nodeReferencePoint, nodeReferencePointX, nodeReferencePointY, removeAllConnections, removeConnection, setNodeName, setPoint, setSpecificationPoint
-
Methods inherited from class jpicedt.graphic.model.AbstractElement
anchorPointsIterator, getAttribute, getAttributeSet, getDrawing, getParent, getView, removeView, scale, setAttribute, setAttributeSet, setParent, setViewFromFactory
-
-
-
-
Field Detail
-
P_1
public static final int P_1
index of first end-point- See Also:
- Constant Field Values
-
P_2
public static final int P_2
index of intermediate point- See Also:
- Constant Field Values
-
P_3
public static final int P_3
index of last end-point- See Also:
- Constant Field Values
-
LAST_PT
public static final int LAST_PT
- See Also:
- Constant Field Values
-
controlPts
protected java.util.ArrayList controlPts
A list holding the three control-points this circle goes through, and serving as a convenient caching mechanism. These are controlled by thesetPointmethod, and are used to update superclass geometry whenupdateEllipseis invoked. Besides, protected getter/settergetControlPoint(int)andsetControlPoint(int, jpicedt.graphic.PicPoint)allow to edit them easily without cumbersome class-cast.
-
CTRL_P_1
protected static final int CTRL_P_1
index of first control-point, aka P_1, incontrolPtslist- See Also:
- Constant Field Values
-
CTRL_P_2
protected static final int CTRL_P_2
index of second control-point, aka P_2, incontrolPtslist- See Also:
- Constant Field Values
-
CTRL_P_3
protected static final int CTRL_P_3
index of last control-point, aka P_3, incontrolPtslist- See Also:
- Constant Field Values
-
-
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 arcclosure- 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:
clonein interfaceElement- Overrides:
clonein classPicEllipse
-
getFirstPointIndex
public int getFirstPointIndex()
Returns the index of the first user-controlled point that can be retrieved bygetPoint().- Specified by:
getFirstPointIndexin interfaceElement- Overrides:
getFirstPointIndexin classPicParallelogram
-
getLastPointIndex
public int getLastPointIndex()
Returns the index of the last user-controlled point that can be retrieved bygetPoint().- Specified by:
getLastPointIndexin interfaceElement- Overrides:
getLastPointIndexin classPicEllipse
-
getName
public java.lang.String getName()
Description copied from class:PicEllipseReturn a localised string that represents this object's name- Specified by:
getNamein interfaceElement- Overrides:
getNamein classPicEllipse- 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 thecontrolPtslist.- 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:
setPointin interfaceElement- Overrides:
setPointin classPicEllipse- 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:
getPointin interfaceElement- Overrides:
getPointin classPicEllipse- 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; ifsrcis null, allocates a new PicPoint and return it, otherwise directly modifiessrcand returns it as well for convenience.
-
translate
public void translate(double dx, double dy)Translate this circle by (dx,dy)- Specified by:
translatein interfaceElement- Overrides:
translatein classDefaultLeafElement- Parameters:
dx- The X coordinate of translation vectordy- 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 thatsxandsymay be negative. This method eventually fires a changed-update event.- Specified by:
scalein interfaceElement- Overrides:
scalein classPicEllipse
-
rotate
public void rotate(PicPoint ptOrg, double angle)
Rotate this Element by the given angle along the given point- Specified by:
rotatein interfaceElement- Overrides:
rotatein classPicEllipse- 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:
shearin interfaceElement- Overrides:
shearin classPicEllipse
-
isPlain
public boolean isPlain()
Description copied from class:PicEllipseReturn true if this PicEllipse is a plain ellipse, ie if angle extent equals 360.- Overrides:
isPlainin classPicEllipse
-
setPlain
public void setPlain(boolean b)
-
toString
public java.lang.String toString()
Implementation of the Object.toString() method, used for debugging purpose- Overrides:
toStringin classPicEllipse- Since:
- PicEdt 1.1.4
-
createActions
public PEAction[] createActions(ActionDispatcher actionDispatcher, ActionLocalizer localizer, HitInfo hi)
Create an array of Action's related to this object- Specified by:
createActionsin interfaceActionFactory- Overrides:
createActionsin classPicParallelogram- Parameters:
actionDispatcher- dispatches events to the proper PECanvaslocalizer- i18n localizer for PEAction'shi- a HitInfo containing information related to the mouse-event which triggered the popup menu.
-
createCustomizer
public AbstractCustomizer createCustomizer()
Return a Customizer for geometry editing- Specified by:
createCustomizerin interfaceCustomizerFactory- Overrides:
createCustomizerin classPicEllipse- Returns:
- a Customizer for geometry editing
- Since:
- jpicedt 1.3.3
-
-