|
|||||||||
Home >> All >> jpicedt >> graphic >> [ model overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
jpicedt.graphic.model
Class AbstractElement

java.lang.Objectjpicedt.graphic.model.AbstractElement
- All Implemented Interfaces:
- Element, PicObjectConstants
- Direct Known Subclasses:
- BranchElement, PicBezierCubic, PicBezierQuad, PicPolygon, PicRectangle, TextEditable
- public abstract class AbstractElement
- extends java.lang.Object
- implements Element
- extends java.lang.Object
An abstract class that can serve as the basis class for elements of a Drawing.
The geometry is backed by an array of coordinate, containing the minimum number of pair of coordinate which are necessary for the specification of the shape of this element.
There can be more control points however (e.g. for a rectangle, there are two "specification" points, yet five control points, including the center).
- Since:
- PicEdt 1.0
Nested Class Summary | |
class |
AbstractElement.DefaultPointIterator
An iterator over PicPoint's. |
Nested classes inherited from class jpicedt.graphic.model.Element |
Element.PointIterator |
Field Summary | |
protected PicAttributeSet |
attributeSet
the attribute set |
protected BranchElement |
parent
the parent of this element |
protected double[] |
ptsX
an array of X-coordinates representing the geometry of this element along the X-axis. |
protected double[] |
ptsY
an array of Y-coordinates representing the geometry of this element along the Y-axis. |
protected jpicedt.graphic.view.View |
view
the view that render this element |
Fields inherited from interface jpicedt.graphic.model.PicObjectConstants |
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, MaxAttributeNameIndex, MIDDLE, NONE, OUTER, POLYGON_DOTS, POLYGON_SOLID, POLYGON_STYLE, PS_POINT, RIGHT_ARROW, SHADOW, SHADOW_ANGLE, SHADOW_COLOR, SHADOW_SIZE, SOLID, VLINES, VLINES_FILLED |
Constructor Summary | |
AbstractElement(AbstractElement obj)
cloning constructor ; specification points and attribute set are deeply copied. |
|
AbstractElement(int nPts)
construct a Element with no parent and a default PicAttributeSet, and the given number of specification points. |
|
AbstractElement(int nPts,
PicAttributeSet attributeSet)
construct a AbstractElement with no parent and the given PicAttributeSet, and the given number of specification points. |
Method Summary | |
Element.PointIterator |
anchorPointsIterator()
Create an Iterator over points that can serve as anchor points for grid alignment. |
abstract java.lang.Object |
clone()
Returns a clone of this element |
protected void |
fireChangedUpdate(jpicedt.graphic.event.DrawingEvent.EventType eventType)
must be called each time this AbstractElement changes. |
java.lang.Object |
getAttribute(PicAttributeName name)
Returns the value for the given attribute name |
PicAttributeSet |
getAttributeSet()
Returns AttributeSet for this AbstractElement |
java.awt.geom.Rectangle2D |
getBoundingBox(java.awt.geom.Rectangle2D r)
Returns the bounding box (i.e. |
Drawing |
getDrawing()
Retrieves the underlying drawing |
int |
getFirstPointIndex()
Returns the index of the first point that can be retrieved by getPoint This default implementation returns 0. |
int |
getLastPointIndex()
Returns the index of the last point that can be retrieved by getPoint This default implementation returns the greater index allowed in ptsX (or ptsY). |
java.lang.String |
getName()
Returns a non-localised string representing this object's name This default implementation returns the class name. |
BranchElement |
getParent()
Gets the parent of the element. |
jpicedt.graphic.PicPoint |
getPoint(int numPoint,
jpicedt.graphic.PicPoint src)
This implementation calls getPointX and getPointY. |
double |
getPointX(int numPoint)
This default implementation returns ptsX[numPoint] . |
double |
getPointY(int numPoint)
This default implementation returns ptsY[numPoint] .This might be a valid implementation
as long as subclasses don't have other control points. |
jpicedt.graphic.view.View |
getView()
Returns the View that's responsible for rendering this AbstractElement |
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 |
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(jpicedt.graphic.PicPoint ptOrg,
double sx,
double sy)
Scale this object by (sx,sy) using ptOrg as origin sx and sy can be negative. |
void |
setAttribute(PicAttributeName name,
java.lang.Object value)
set the given attribute name to the given value for this AbstractElement |
void |
setAttributeSet(PicAttributeSet attributeSet)
|
void |
setParent(BranchElement p)
Sets the parent of the element. |
void |
setPoint(int numPoint,
jpicedt.graphic.PicPoint pt)
Set the point indexed by "numPoint" to the given value. |
void |
setViewFromFactory(jpicedt.graphic.view.ViewFactory f)
set the view for this AbstractElement from the given view factory or remove the view if f is null. |
java.lang.String |
toString()
Returns a String representation of the attribute set for this AbstractElement |
void |
translate(double dx,
double dy)
Translate this element by (dx,dy) ; this implementation translates the specification points, then fires a changed-update. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
parent
protected BranchElement parent
- the parent of this element
attributeSet
protected PicAttributeSet attributeSet
- the attribute set
view
protected jpicedt.graphic.view.View view
- the view that render this element
ptsX
protected double[] ptsX
- an array of X-coordinates representing the geometry of this element along the X-axis.
ptsY
protected double[] ptsY
- an array of Y-coordinates representing the geometry of this element along the Y-axis.
Constructor Detail |
AbstractElement
public AbstractElement(int nPts)
- construct a Element with no parent and a default PicAttributeSet, and the given
number of specification points.
AbstractElement
public AbstractElement(int nPts, PicAttributeSet attributeSet)
- construct a AbstractElement with no parent and the given PicAttributeSet,
and the given number of specification points.
AbstractElement
public AbstractElement(AbstractElement obj)
- cloning constructor ; specification points and attribute set are deeply copied.
The parent and the view are set to null.
Method Detail |
getName
public java.lang.String getName()
- Returns a non-localised string representing this object's name
This default implementation returns the class name.
clone
public abstract java.lang.Object clone()
getDrawing
public Drawing getDrawing()
- Retrieves the underlying drawing
- Specified by:
getDrawing
in interfaceElement
getParent
public BranchElement getParent()
setParent
public void setParent(BranchElement p)
fireChangedUpdate
protected void fireChangedUpdate(jpicedt.graphic.event.DrawingEvent.EventType eventType)
- must be called each time this AbstractElement changes.
This default implementation updates the associated View if any,
then propagates upward along the tree by calling
forwardChangedUpdate(this)
on the Element's parent.
Tree's root-element should override so as to fire the change to the hosting drawing.
If subclasser are willing to override this method, they should call super.fireChangeUpdate.
getFirstPointIndex
public int getFirstPointIndex()
- Returns the index of the first point that can be retrieved by getPoint
This default implementation returns 0.
- Specified by:
getFirstPointIndex
in interfaceElement
getLastPointIndex
public int getLastPointIndex()
- Returns the index of the last point that can be retrieved by getPoint
This default implementation returns the greater index allowed in ptsX (or ptsY).
- Specified by:
getLastPointIndex
in interfaceElement
getPointX
public double getPointX(int numPoint)
- This default implementation returns
ptsX[numPoint]
. This might be a valid implementation as long as subclasses don't have other control points.- Since:
- PicEdt 1.0
getPointY
public double getPointY(int numPoint)
- This default implementation returns
ptsY[numPoint]
.This might be a valid implementation as long as subclasses don't have other control points.- Since:
- PicEdt 1.0
getPoint
public jpicedt.graphic.PicPoint getPoint(int numPoint, jpicedt.graphic.PicPoint src)
- This implementation calls getPointX and getPointY.
- Since:
- PicEdt 1.0
setPoint
public void setPoint(int numPoint, jpicedt.graphic.PicPoint pt)
- Set the point indexed by "numPoint" to the given value.
This default implementation sets
ptsX[numPoint]
andptsY[numPoint]
, then fire a changed-update.
anchorPointsIterator
public Element.PointIterator anchorPointsIterator()
- Create an Iterator over points that can serve as anchor points for grid alignment.
This implementation returns a default PointIterator which simply iterates through
control points.
- Specified by:
anchorPointsIterator
in interfaceElement
translate
public void translate(double dx, double dy)
- Translate this element by (dx,dy) ; this implementation translates the specification points,
then fires a changed-update.
- Since:
- PicEdt 1.0
scale
public void scale(jpicedt.graphic.PicPoint ptOrg, double sx, double sy)
- Scale this object by (sx,sy) using ptOrg as origin
sx and sy can be negative. This is a convenience call to
scale(double,double,double,double)
.
scale
public 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. This fires a changed-update.
getBoundingBox
public java.awt.geom.Rectangle2D getBoundingBox(java.awt.geom.Rectangle2D r)
- Returns the bounding box (i.e. the surrounding rectangle) in double precision
Used e.g. to determine the arguments of the \\begin{picture} command.
This implementation compute the bb from the smallest rectangle that encompasses all the specification points.
- Specified by:
getBoundingBox
in interfaceElement
- Since:
- PicEdt 1.0
getView
public jpicedt.graphic.view.View getView()
- Returns the View that's responsible for rendering this AbstractElement
setViewFromFactory
public void setViewFromFactory(jpicedt.graphic.view.ViewFactory f)
- set the view for this AbstractElement from the given view factory
or remove the view if f is null.
- Specified by:
setViewFromFactory
in interfaceElement
removeView
public 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.
- Specified by:
removeView
in interfaceElement
getAttributeSet
public PicAttributeSet getAttributeSet()
- Returns AttributeSet for this AbstractElement
- Specified by:
getAttributeSet
in interfaceElement
setAttributeSet
public void setAttributeSet(PicAttributeSet attributeSet)
- Specified by:
setAttributeSet
in interfaceElement
setAttribute
public void setAttribute(PicAttributeName name, java.lang.Object value)
- set the given attribute name to the given value for this AbstractElement
- Specified by:
setAttribute
in interfaceElement
getAttribute
public java.lang.Object getAttribute(PicAttributeName name)
- Returns the value for the given attribute name
- Specified by:
getAttribute
in interfaceElement
toString
public java.lang.String toString()
- Returns a String representation of the attribute set for this AbstractElement
|
|||||||||
Home >> All >> jpicedt >> graphic >> [ model overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |