|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpicedt.graphic.model.AbstractElement jpicedt.graphic.model.PicParallelogram
public class PicParallelogram
A class implementing a parallelogram. Geometry is fully specified by three corner points (namely, the bottom-left, bottom-right and top-right corners). [SR:TODO] add rounded-corners feature.
Field Summary | |
---|---|
protected PicVector |
b2tVec
see documentation for l2rVec |
protected static int[] |
CTRL_PT_SIDE_BITMAP
|
static int |
FIRST_PT
Index of first control-point |
protected static int |
IN_SIDE_B
|
protected static int |
IN_SIDE_L
|
protected static int |
IN_SIDE_R
|
protected static int |
IN_SIDE_T
|
protected PicVector |
l2rVec
"l2rVec" is a vector pointing from P_BL to P_BR (or equally, from P_TL to P_TR) "b2tVec" is a vector pointing from P_BR to P_TR (or equally, from P_BL to P_TL) These two vectors simply define a convenient parallelogram's basis, and are updated by a call to updateParalleloBasis() . |
static int |
LAST_PT
Index of last control-point |
static int |
P_BL
Bottom-Left corner (also first specification point) |
static int |
P_BR
Bottom-Right corner (also second specification point) |
static int |
P_CENTER
Parallelogram's centre |
static int |
P_TL
Top-Left corner |
static int |
P_TR
Top-Right corner (also third specification point) |
protected PicPoint |
ptBL
Bottom-Left corner (specification point) |
protected PicPoint |
ptBR
Bottom-Right corner (specification point) |
protected PicPoint |
ptTR
Top-Right corner (specification point) |
protected static int |
SIDE_0
Numéro du premier côté indéxé |
static int |
SIDE_B
Bottom side mid-point |
static int |
SIDE_L
Left side mid-pint |
static int |
SIDE_R
Right side mid-point |
static int |
SIDE_T
Top side mid-point |
Fields inherited from class jpicedt.graphic.model.AbstractElement |
---|
attributeSet, name, parent, view |
Constructor Summary | |
---|---|
PicParallelogram()
Creates a new PicParallelogram reduced to (0,0) |
|
PicParallelogram(PicAttributeSet set)
Creates a new PicParallelogram reduced to (0,0), with the given attribute set |
|
PicParallelogram(PicParallelogram src)
"cloning" constructor (to be used by clone()) |
|
PicParallelogram(PicPoint pt,
PicAttributeSet set)
Create a new PicParallelogram reduced to a point located at the given position |
|
PicParallelogram(PicPoint ptBL,
PicPoint ptTR)
Create a new rectangle with axes parallel to X- and Y-axes, using the 2 given points to build the diagonal, and a default attribute set. |
|
PicParallelogram(PicPoint ptBL,
PicPoint ptBR,
PicPoint ptTR)
Create a new PicParallelogram object using the 3 given points as 3 consecutive specification points of the parallelogram (namely BL, BR and TR) and a default attribute set. |
|
PicParallelogram(PicPoint ptBL,
PicPoint ptBR,
PicPoint ptTR,
PicAttributeSet set)
Create a new PicParallelogram object using the 3 given points as 3 consecutive points of the parallelogram. |
|
PicParallelogram(RectangularShape rect)
Create a new rectangular PicParallelogram object using the given Rectangle2D. |
Method Summary | |
---|---|
PicParallelogram |
clone()
Overrides Object.clone() method |
PicMultiCurve |
convertToMultiCurve()
Return a polygon created from the sides of this parallelogram. |
ArrayList<PEAction> |
createActions(ActionDispatcher actionDispatcher,
ActionLocalizer localizer,
HitInfo hi)
Create an array of Action's related to this object |
AbstractCustomizer |
createCustomizer()
Returns a customizer (Swing) component |
Shape |
createShape()
Returns a GeneralPath that represents the shape of this PicParallelogram. |
PicVector |
getB2TVec()
|
Rectangle2D |
getBoundingBox(Rectangle2D r)
Returns the bounding box (ie the surrounding rectangle) in double precision Used for instance to determine the arguments of a \\begin{picture} command. |
PicPoint |
getCenter(PicPoint src)
Return the parallelogram's centre |
PicPoint |
getCtrlPt(int numPoint,
PicPoint src)
Return the user-controlled point having the given index. |
CtrlPtSubset |
getCtrlPtSubset(ConvexZoneGroup csg,
BitSet czExtension)
Renvoie un la partie des points de contrôle qui satisfont à l'un des deux critères suivants: ceux compris dans l'ensemble de zones convexes csg , et
ceux en relation avec les points de contrôle satisfaisant au première critère selon une relation
définies par czExtension
|
String |
getDefaultName()
|
int |
getFirstPointIndex()
Return the index of the first point that can be retrieved by getPoint |
Double |
getL2RtoXAxisAngle()
|
PicVector |
getL2RVec()
|
int |
getLastPointIndex()
Return the index of the last point that can be retrieved by getPoint |
boolean |
isRectangle()
Returns true if this parallelogram is a rectangle |
boolean |
isXYorYXRectangle()
|
boolean |
isXYRectangle()
|
void |
makeRectangle()
Makes this parallelogram a rectangle [pending] |
void |
makeXYRectangle()
Makes this parallelogram a rectangle with its sides parallel to the X- and Y-axes. |
void |
mirror(PicPoint ptOrg,
PicVector normalVector)
Effectue une réflexion sur this relativement à l'axe
défini par ptOrg et normalVector . |
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,
UserConfirmationCache ucc)
Scale this object by (sx,sy) using (ptOrgX,ptOrgY) as the origin. |
void |
setCtrlPt(int index,
PicPoint pt)
Convenience call to setCtrlPt(int, PicPoint, EditPointConstraint) with a null constraint. |
void |
setCtrlPt(int numPoint,
PicPoint pt,
EditPointConstraint constraint)
Set the coordinate of the control-point indexed by "numPoint" to the given value. |
void |
setGeometry(PicParallelogram para)
Sets the coordinates of this element from those of the given source. |
void |
setGeometry(RectangularShape rect)
Sets the coordinates of this element from the given shape. |
void |
shear(PicPoint ptOrg,
double shx,
double shy,
UserConfirmationCache ucc)
Shear this Element by the given params wrt to the given origin. |
protected PicVector |
toParalleloBasisCoordinates(PicPoint ptOrg,
PicPoint ptSrc,
PicVector ptDest)
Compute the contravariant coordinate of the given point "ptSrc" along the "l2r" and "b2t" vectors of the parallelogram's basis, the origin of the basis being set at "ptOrg" This simply reduces to a contravariant change of coordinates from the cartesian basis to the (non-orthonormalized) parallelogram basis. |
String |
toString()
Implementation of the Object.toString() method, used for debugging purpose |
void |
translate(double dx,
double dy)
Translate this Element by (dx,dy) ; this implementation translates the specification-points, then fires a changed-update event. |
protected void |
updateParalleloBasis()
Compute the l2r and b2t vectors of the parallelogram basis from the location
of the three specification-points of this parallelogram. |
Methods inherited from class jpicedt.graphic.model.AbstractElement |
---|
anchorPointsIterator, fireChangedUpdate, getAttribute, getAttributeSet, getDrawing, getName, getParent, getView, pullOutOfGroup, removeView, replaceBy, scale, scale, scale, setAttribute, setAttributeSet, setName, setParent, setViewFromFactory, shear, syncArrowGeometry |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface jpicedt.graphic.model.Element |
---|
anchorPointsIterator, getAttribute, getAttributeSet, getDrawing, getName, getParent, getView, removeView, replaceBy, scale, scale, scale, setAttribute, setAttributeSet, setParent, setViewFromFactory, shear, syncArrowGeometry |
Field Detail |
---|
public static final int P_BL
public static final int P_BR
public static final int P_TR
public static final int P_TL
protected static final int SIDE_0
public static final int SIDE_B
public static final int SIDE_R
public static final int SIDE_T
public static final int SIDE_L
public static final int P_CENTER
public static final int FIRST_PT
public static final int LAST_PT
protected static final int IN_SIDE_B
protected static final int IN_SIDE_R
protected static final int IN_SIDE_T
protected static final int IN_SIDE_L
protected static final int[] CTRL_PT_SIDE_BITMAP
protected PicPoint ptBL
protected PicPoint ptBR
protected PicPoint ptTR
protected PicVector l2rVec
updateParalleloBasis()
.
They are used e.g. when moving a corner-point.An essential function of these vectors is to "retain" the initial parallelogram basis even if the element becomes flat at some point during an edit operation.
protected PicVector b2tVec
l2rVec
Constructor Detail |
---|
public PicParallelogram()
public PicParallelogram(PicAttributeSet set)
public PicParallelogram(PicPoint ptBL, PicPoint ptBR, PicPoint ptTR)
public PicParallelogram(PicPoint ptBL, PicPoint ptBR, PicPoint ptTR, PicAttributeSet set)
public PicParallelogram(PicPoint ptBL, PicPoint ptTR)
public PicParallelogram(PicPoint pt, PicAttributeSet set)
public PicParallelogram(PicParallelogram src)
src
- The PicParallelogram object to clonepublic PicParallelogram(RectangularShape rect)
Method Detail |
---|
public PicParallelogram clone()
clone
in interface Element
clone
in class AbstractElement
public String getDefaultName()
getDefaultName
in class AbstractElement
public PicPoint getCtrlPt(int numPoint, PicPoint src)
Element
is to return an IMMUTABLE instance of PicPoint, so that the only way to alter the
geometry of this element is by calling the setCtrlPt
method.
getCtrlPt
in interface Element
numPoint
- the point index, should be greater or equal to the value returned by
getFirstPointIndex
, and lower or equal to getLastPointIndex
.
numPoint
;
if src
is null, allocates a new PicPoint and return it,
otherwise directly modifies src
and returns it as well for convenience.public int getFirstPointIndex()
getFirstPointIndex
in interface Element
public int getLastPointIndex()
getLastPointIndex
in interface Element
protected void updateParalleloBasis()
l2r
and b2t
vectors of the parallelogram basis from the location
of the three specification-points of this parallelogram.
protected PicVector toParalleloBasisCoordinates(PicPoint ptOrg, PicPoint ptSrc, PicVector ptDest)
Note that updateParalleloBasis
must be called beforehands for this method to return
a valid results [SR:pending] need to be cleaned up.
ptOrg
- origin of parallelogram's basisptSrc
- source point whose coordinates have to be convertedptDest
- if null, gets allocated and returned for convenience ; besides, it is perfectly safe to call
this method with ptDest and one of ptOrg or ptSrc referencing the same PicPoint.
public void setCtrlPt(int numPoint, PicPoint pt, EditPointConstraint constraint)
The SQUARE constraint imposes that the parallelogram be a square. The square diagonal is computed from the current control-point and its opposite corner. Other spec' points are set accordingly.
The CENTER_FIXED constraint imposes that the parallelogram center be kept fixed. Spec' points are set accordingly.
setCtrlPt
in interface Element
numPoint
- one of P_TL, P_TR, P_BL, P_BR, SIDE_T, SIDE_B, SIDE_L, SIDE_R or P_CENTER.constraint
- either null or one of PicParallelogram.EditConstraintpublic void setCtrlPt(int index, PicPoint pt)
setCtrlPt
in interface Element
setCtrlPt
in class AbstractElement
public void setGeometry(PicParallelogram para)
public void setGeometry(RectangularShape rect)
public PicPoint getCenter(PicPoint src)
src
is null, allocates a new PicPoint and return it,
otherwise directly modifies src
and returns it as well for convenience.public void rotate(PicPoint ptOrg, double angle)
rotate
in interface Element
angle
- rotation angle in radianspublic void mirror(PicPoint ptOrg, PicVector normalVector)
this
relativement à l'axe
défini par ptOrg
et normalVector
.
mirror
in interface Element
ptOrg
- le PicPoint
par lequel passe l'axe de réflexion.normalVector
- le PicVector
normal à l'axe de réflexion.public void shear(PicPoint ptOrg, double shx, double shy, UserConfirmationCache ucc)
Element
by the given params wrt to the given origin.
shear
in interface Element
ucc
- une valeur UserConfirmationCache
permettant de demander à l'utilisateur
confirmation, de se souvenir de la dernière confirmation qu'il a donné, ou de ses préférences.public void scale(double ptOrgX, double ptOrgY, double sx, double sy, UserConfirmationCache ucc)
(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.
scale
in interface Element
ucc
- une valeur UserConfirmationCache
permettant de demander à l'utilisateur
confirmation, de se souvenir de la dernière confirmation qu'il a donné, ou de ses préférences.public void translate(double dx, double dy)
translate
in interface Element
dx
- The X coordinate of translation vectordy
- The Y coordinate of translation vectorpublic CtrlPtSubset getCtrlPtSubset(ConvexZoneGroup csg, BitSet czExtension)
Element
csg
, et
czExtension
getCtrlPtSubset
in interface Element
getCtrlPtSubset
in class AbstractElement
csg
- l'ensemble de zones convexes auquel on teste l'appartenance des points de contrôlesczExtension
- ignoré
null
jpicedt.graphic.model
public PicMultiCurve convertToMultiCurve()
convertToMultiCurve
in interface PicMultiCurveConvertable
public boolean isRectangle()
public void makeRectangle()
public boolean isXYRectangle()
true
si le parallélogramme est rectangle, et que l'axe (BL, BR) est parallèle à
l'axe des x, et l'axe (BL, TL) à l'axe des y.public boolean isXYorYXRectangle()
true
si le parallélogramme est rectangle, et que l'un de ses axes est parallèle à
l'axe des x, et l'autre à l'axe des y.public Double getL2RtoXAxisAngle()
public final PicVector getL2RVec()
public final PicVector getB2TVec()
public void makeXYRectangle()
public Shape createShape()
createShape
in interface Element
createShape
in class AbstractElement
public Rectangle2D getBoundingBox(Rectangle2D r)
This implementation compute the bounding-box from the smallest rectangle that encompasses all the specification-points.
getBoundingBox
in interface Element
public String toString()
toString
in class AbstractElement
public ArrayList<PEAction> createActions(ActionDispatcher actionDispatcher, ActionLocalizer localizer, HitInfo hi)
createActions
in interface ActionFactory
createActions
in class AbstractElement
actionDispatcher
- dispatches events to the proper PECanvaslocalizer
- i18n localizer for PEAction'shi
- une HitInfo
contenant les informations relatives à l'évènement-souris qui a
déclencher le menu contextuel.public AbstractCustomizer createCustomizer()
CustomizerFactory
createCustomizer
in interface CustomizerFactory
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |