|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjpicedt.graphic.model.AbstractElement
jpicedt.graphic.model.DefaultLeafElement
jpicedt.graphic.model.PicParallelogram
jpicedt.graphic.model.PicEllipse
jpicedt.graphic.model.PicCircleFrom3Points
public class PicCircleFrom3Points
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.
Field Summary | |
---|---|
protected java.util.ArrayList |
controlPts
A list holding the three control-points this circle goes through, and serving as a convenient caching mechanism. |
protected static int |
CTRL_P_1
index of first control-point, aka P_1, in controlPts list |
protected static int |
CTRL_P_2
index of second control-point, aka P_2, in controlPts list |
protected static int |
CTRL_P_3
index of last control-point, aka P_3, in controlPts list |
static int |
LAST_PT
|
static int |
P_1
index of first end-point |
static int |
P_2
index of intermediate point |
static int |
P_3
index 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 |
Constructor Summary | |
---|---|
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 | |
---|---|
java.lang.Object |
clone()
Overrides Object.clone() method |
PicEllipse |
convertToEllipse()
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 object |
AbstractCustomizer |
createCustomizer()
Return a Customizer for geometry editing |
protected PicPoint |
getControlPoint(int i)
Returns a reference to the ith control-point in the controlPts list. |
int |
getFirstPointIndex()
Returns the index of the first user-controlled point that can be retrieved by getPoint() . |
int |
getLastPointIndex()
Returns the index of the last user-controlled point that can be retrieved by getPoint() . |
java.lang.String |
getName()
Return a localised string that represents this object's name |
PicPoint |
getPoint(int numPoint,
PicPoint src)
Get the coordinate of the point indexed by "numPoint" to the given value. |
boolean |
isPlain()
Return true if this PicEllipse is a plain ellipse, ie if angle extent equals 360. |
void |
rotate(PicPoint ptOrg,
double angle)
Rotate this Element by the given angle along the given point |
void |
scale(double ptOrgX,
double ptOrgY,
double sx,
double sy)
Scale this object by (sx,sy) using (ptOrgX,ptOrgY) as the origin. |
protected void |
setControlPoint(int i,
PicPoint pt)
Set the coordinates of ith control-point from the given point. |
void |
setPlain(boolean b)
|
void |
setPoint(int numPoint,
PicPoint pt,
EditPointConstraint c)
Set the coordinate of the point indexed by "numPoint" to the given value. |
void |
shear(PicPoint ptOrg,
double shx,
double shy)
Shear this Element by the given params wrt to the given origin |
java.lang.String |
toString()
Implementation of the Object.toString() method, used for debugging purpose |
void |
translate(double dx,
double dy)
Translate this circle by (dx,dy) |
protected void |
updateControlPoints(int numPoint)
Update the values of the three control-points from the geometry of the superclass. |
protected void |
updateEllipse()
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.AbstractElement |
---|
anchorPointsIterator, getAttribute, getAttributeSet, getDrawing, getParent, getView, removeView, scale, setAttribute, setAttributeSet, setParent, setViewFromFactory |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int P_1
public static final int P_2
public static final int P_3
public static final int LAST_PT
protected java.util.ArrayList controlPts
setPoint
method, and
are used to update superclass geometry when updateEllipse
is invoked.
Besides, protected getter/setter getControlPoint(int)
and setControlPoint(int, jpicedt.graphic.PicPoint)
allow to
edit them easily without cumbersome class-cast.
protected static final int CTRL_P_1
controlPts
list
protected static final int CTRL_P_2
controlPts
list
protected static final int CTRL_P_3
controlPts
list
Constructor Detail |
---|
public PicCircleFrom3Points()
public PicCircleFrom3Points(boolean plain, int closure)
plain
- if true, we draw a plain circle and ignore the closure parameter.closure
- closure type as defined in java.awt.geom.Arc2Dpublic PicCircleFrom3Points(PicAttributeSet set)
public PicCircleFrom3Points(boolean plain, int closure, PicAttributeSet set)
plain
- if true, we draw a plain circle and ignore the closure parameter.closure
- closure type as defined in java.awt.geom.Arc2Dpublic PicCircleFrom3Points(PicPoint pt1, PicPoint pt2, PicPoint pt3, PicAttributeSet set)
public PicCircleFrom3Points(PicPoint pt1, PicPoint pt2, PicPoint pt3, boolean plain, int closure, PicAttributeSet set)
plain
- whether to draw a plain circle or an arcclosure
- closure type as defined in java.awt.geom.Arc2Dpublic PicCircleFrom3Points(PicCircleFrom3Points circle)
Method Detail |
---|
public java.lang.Object clone()
clone
in interface Element
clone
in class PicEllipse
public int getFirstPointIndex()
getPoint()
.
getFirstPointIndex
in interface Element
getFirstPointIndex
in class PicParallelogram
public int getLastPointIndex()
getPoint()
.
getLastPointIndex
in interface Element
getLastPointIndex
in class PicEllipse
public java.lang.String getName()
PicEllipse
getName
in interface Element
getName
in class PicEllipse
public PicEllipse convertToEllipse()
protected PicPoint getControlPoint(int i)
controlPts
list.
i
- one of CTRL_P_1, CTRL_P_2 or CTRL_P_3.protected void setControlPoint(int i, PicPoint pt)
i
- one of P_1, P_2 or P_3.protected void updateEllipse()
protected void updateControlPoints(int numPoint)
numPoint
- index of the PicParallelogram's control-point that was movedpublic void setPoint(int numPoint, PicPoint pt, EditPointConstraint c)
setPoint
in interface Element
setPoint
in class PicEllipse
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 SQUAREpublic PicPoint getPoint(int numPoint, PicPoint src)
getPoint
in interface Element
getPoint
in class PicEllipse
numPoint
- one of P_1, P_2 or P_3.src
- a PicPoint to update and create if necessary
numPoint
;
if src
is null, allocates a new PicPoint and return it,
otherwise directly modifies src
and returns it as well for convenience.public void translate(double dx, double dy)
translate
in interface Element
translate
in class DefaultLeafElement
dx
- The X coordinate of translation vectordy
- The Y coordinate of translation vectorpublic void scale(double ptOrgX, double ptOrgY, double sx, double sy)
sx
and sy
may be negative.
This method eventually fires a changed-update event.
scale
in interface Element
scale
in class PicEllipse
public void rotate(PicPoint ptOrg, double angle)
rotate
in interface Element
rotate
in class PicEllipse
angle
- rotation angle in radianspublic void shear(PicPoint ptOrg, double shx, double shy)
shear
in interface Element
shear
in class PicEllipse
public boolean isPlain()
PicEllipse
isPlain
in class PicEllipse
public void setPlain(boolean b)
public java.lang.String toString()
toString
in class PicEllipse
public PEAction[] createActions(ActionDispatcher actionDispatcher, ActionLocalizer localizer, HitInfo hi)
createActions
in interface ActionFactory
createActions
in class PicParallelogram
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.public AbstractCustomizer createCustomizer()
createCustomizer
in interface CustomizerFactory
createCustomizer
in class PicEllipse
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |