public interface Element extends PicObjectConstants
A MODEL of graphic element basically comprises :
getFirstPointIndex()
to getLastPointIndex()
inclusive.
These methods may be used e.g. by the UI machinery when processing mouse-events, or by parsers when
building a new Drawing from scratch.
PointIterator
).
java.awt.Shape
, or by any other kind of mechanism the developper thinks is appropriate
to the particular model she wants to implement.
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
Modifier and Type | Method and Description |
---|---|
PointIndexIterator |
anchorPointsIterator()
Return an Iterator over user-controlled point indexes that can serve as anchor points for grid alignment.
|
java.lang.Object |
clone()
Return a deep copy of this element.
|
void |
forwardChangedUpdate(Element child,
DrawingEvent.EventType eventType)
Called by a child of this element to inform its parent of some change that occured to it or one of its children.
|
boolean |
getAllowsChildren()
Returns true if the receiver allows children.
|
java.lang.Object |
getAttribute(PicAttributeName name) |
PicAttributeSet |
getAttributeSet() |
java.awt.geom.Rectangle2D |
getBoundingBox(java.awt.geom.Rectangle2D r) |
Drawing |
getDrawing()
Retrieves the underlying drawing
|
int |
getFirstPointIndex()
Return the index of the first user-controlled point that can be retrieved by getPoint()
|
int |
getLastPointIndex()
Return the index of the last user-controlled point that can be retrieved by getPoint()
|
java.lang.String |
getName()
Return a non-localised string representing this element's name.
|
Element |
getParent()
Gets the parent of the element.
|
PicPoint |
getPoint(int index,
PicPoint src)
Return the user-controlled point having the given index.
|
double |
getPointX(int index)
Same as
getPoint() , yet return the x-coordinate only. |
double |
getPointY(int index)
Same as
getPoint() , yet return the y-coordinate only. |
View |
getView() |
void |
removeView()
remove the view that render this element ; this may be used to remove any reference to the view,
and render it eligible for garbage collection ; if no View, does nothing.
|
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 origin
sx and sy can be negative.
|
void |
scale(PicPoint ptOrg,
double sx,
double sy)
Scale this object by (sx,sy) using ptOrg as origin
sx and sy may be negative.
|
void |
setAttribute(PicAttributeName name,
java.lang.Object value)
set the given attribute name to the given value for this Element
|
void |
setAttributeSet(PicAttributeSet attributeSet) |
void |
setParent(Element p)
Sets the parent of the element.
|
void |
setPoint(int index,
PicPoint pt)
Deprecated.
Use setPoint(int, PicPoint, EditPointConstraint)
|
void |
setPoint(int index,
PicPoint pt,
EditPointConstraint constraint)
Set the user-controlled point indexed by "index" to the given value, using the specified geometrical constraint.
|
void |
setViewFromFactory(ViewFactory f)
set the view for this Element from the given view factory
|
void |
shear(PicPoint ptOrg,
double shx,
double shy)
Shear this Element by the given params wrt to the given origin
|
void |
translate(double dx,
double dy)
Translate this object by (dx,dy)
|
java.lang.String getName()
java.lang.Object clone()
Drawing getDrawing()
Element getParent()
void setParent(Element p)
boolean getAllowsChildren()
void forwardChangedUpdate(Element child, DrawingEvent.EventType eventType)
eventType
- the event typechild
- the child that sent the change-event.PicPoint getPoint(int index, PicPoint src)
setPoint
method.index
- the point index, should be greater or equal to the value returned by
getFirstPointIndex
, and lower or equal to getLastPointIndex
.index
;
if src
is null, concrete implementation of this method should
allocate a new PicPoint and return it,
otherwise directly modify src
and return it as well for convenience.double getPointX(int index)
getPoint()
, yet return the x-coordinate only.index
- the point index, should be greater or equal to the value returned by
getFirstPointIndex
, and lower or equal to getLastPointIndex
.index
.double getPointY(int index)
getPoint()
, yet return the y-coordinate only.index
- the point index, should be greater or equal to the value returned by
getFirstPointIndex
, and lower or equal to getLastPointIndex
.index
.int getFirstPointIndex()
int getLastPointIndex()
void setPoint(int index, PicPoint pt)
void setPoint(int index, PicPoint pt, EditPointConstraint constraint)
constraint
- a geometry constraint, or null if no particular constraint is being imposed (aka default).PointIndexIterator anchorPointsIterator()
void translate(double dx, double dy)
dx
- The X coordinate of translation vectordy
- The Y coordinate of translation vectorvoid scale(PicPoint ptOrg, double sx, double sy)
void scale(double ptOrgX, double ptOrgY, double sx, double sy)
void rotate(PicPoint ptOrg, double angle)
angle
- rotation angle in radiansvoid shear(PicPoint ptOrg, double shx, double shy)
java.awt.geom.Rectangle2D getBoundingBox(java.awt.geom.Rectangle2D r)
View getView()
void setViewFromFactory(ViewFactory f)
void removeView()
PicAttributeSet getAttributeSet()
void setAttributeSet(PicAttributeSet attributeSet)
attributeSet
- a new AttributeSet for this Element ; this actually make a deep copy of the
given attribute set beforehands.void setAttribute(PicAttributeName name, java.lang.Object value)
java.lang.Object getAttribute(PicAttributeName name)
Submit a bug : syd@jpicedt.org