|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
This interface defines an atomic graphical shape.
A Primitive can be implemented as a line, rectangle, polygon,
ellipse or text. While the name of this interface might cause some initial
confusion, please remember that within the visual graph domain, a basic,
atomic drawing unit for a complex visual Node and Edge
is simply called a Primitive.
A Primitive must support a StrokeFormat and a PaintFormat
for regions. Additionally, a Primitive representing text will also support
a FontFormat. A StrokeFormat may be provided by default if the
application programmer does not specify one.
The following class diagram illustrates the general dependencies between
the classes and interfaces in package
com.tensegrity.graphics.primitive:
A single pixel implementation cannot be represented by this interface because the framework does not handle raster graphics.
A Primitive always provides a bounding box. The method for
retrieving it is:
A Primitive can be transformed using a Transform2D
component from the Generic package. At the current time, a
Primitive can be translated, scaled and rotated. For more help,
please read the Transform2D class documentation.
The methods for transforming a Primitive are:
A Primitive supports the Illustrator technology.
For more information on this, please read the Illustrator interface.
An Illustrator can be retrieved with this method:
A Primitive can also be deep copied. This means that a
Primitive client does not have to know the implementation
class in order to make a copy.
| Field Summary |
| Fields inherited from interface com.tensegrity.generic.attribute.AttributableOnSet |
TREE_SUBSET_POSTFIX |
| Method Summary | |
void |
addInfoValue(java.lang.Object key,
java.lang.Object value)
Adds the infovalue given by value with the given
key to the infovalue registry of the Primitive.
|
void |
addOrSetInfoValue(java.lang.Object key,
java.lang.Object value)
Adds the infovalue given by value with the given
key to the infovalue registry of the Primitive.
|
void |
applyState(PrimitiveState state)
|
Primitive |
deepCopy()
An implementation of this method is responsible for returning a deep- copy of the Primitive instance |
Boundary |
getBoundingBox()
Returns a Boundary that describes the bounding box for a
graphical object implementing this interface. |
FontFormat |
getFont()
Returns the FontFormat that is used by this
Primitive to draw text.
|
Illustrator |
getIllustrator(Transform2D xform_context)
Returns the Primitives illustrator object. |
java.lang.Object |
getInfoValue(java.lang.Object key)
Returns the infovalue that is stored with the given key
in the infovalue registry of the Primitive. |
PaintFormat |
getPaint()
Returns the PaintFormat that is used by the
Primitive to fill areas.
|
RenderingData |
getRenderingData(Transform2D xform_context)
Returns a RenderingData instance, which are used by a
Renderer implementation to render a Primitive.
|
PrimitiveState |
getState()
|
StrokeFormat |
getStroke()
Returns the StrokeFormat that is used by the
Primitive to draw lines, borders and such.
|
Transform2D |
getTransform()
Returns a Transform2D currently used to transform
the coordinates of the graphical Primitive. |
boolean |
hasInfoValue(java.lang.Object key)
Returns a boolean that indicates whether an infovalue with
the key given by key is already registered or not. |
void |
removeInfoValue(java.lang.Object key)
Removes the infovalue that is stored with the given key
in the infovalue registry of the Primitive from the
infovalue registry. |
void |
setFontFormat(FontFormat font)
Sets the FontFormat for the Primitive. |
void |
setInfoValue(java.lang.Object key,
java.lang.Object newValue)
Sets the value of the infovalue with the key given by key to
the value given by newValue.
|
void |
setPaint(PaintFormat paint)
Sets the PaintFormat for the Primitive. |
void |
setStroke(StrokeFormat stroke)
Sets a StrokeFormat for the Primitive. |
void |
setTransform(Transform2D transform)
Sets the Transform2D given by transform as the
new transform for the coordinates of the Primitive. |
| Methods inherited from interface com.tensegrity.generic.attribute.AttributableOnSet |
addAttributableOnSetListener, areAttributableEventsEnabled, disableAttributableEvents, enableAttributableEvents, getAttributes, getAttributesTree, removeAttributableOnSetListener, setAttributes, setAttributesTree |
| Methods inherited from interface com.tensegrity.generic.attribute.Attributable |
getAttribute, getAttributeType, getAttributeValue, setAttribute, setAttributeValue |
| Methods inherited from interface com.tensegrity.graphics.interaction.BaseInteractable |
getInteractionDescriptor, getMoveItem, hits, internalEnableSelection, internalSelect, internalSetSelected, isMovable, isSelectable, isSelected, mouseClick, mouseDown, mouseEnter, mouseExit, mouseUp, postActing, preActing, select, setMovable, setSelectable, setSelected, startAction, stopAction |
| Method Detail |
public StrokeFormat getStroke()
StrokeFormat that is used by the
Primitive to draw lines, borders and such.
The returned StrokeFormat can be null for
Primitives that have no lines, borders or such.
public void setStroke(StrokeFormat stroke)
StrokeFormat for the Primitive.
stroke - the StrokeFormat to usepublic PaintFormat getPaint()
PaintFormat that is used by the
Primitive to fill areas.
The returned PaintFormat can be null for
Primitives that have no areas.
public void setPaint(PaintFormat paint)
PaintFormat for the Primitive.
paint - the PaintFormat to usepublic FontFormat getFont()
FontFormat that is used by this
Primitive to draw text.
The returned FontFormat can be null for
Primitives that have no text.
public void setFontFormat(FontFormat font)
FontFormat for the Primitive.
font - the FontFormat to usepublic Transform2D getTransform()
Transform2D currently used to transform
the coordinates of the graphical Primitive.
Primitivepublic void setTransform(Transform2D transform)
Transform2D given by transform as the
new transform for the coordinates of the Primitive.
transform - the new transform of the Primitive, may not
be null.public boolean hasInfoValue(java.lang.Object key)
boolean that indicates whether an infovalue with
the key given by key is already registered or not.
key - the key to check for
public void addInfoValue(java.lang.Object key,
java.lang.Object value)
Adds the infovalue given by value with the given
key to the infovalue registry of the Primitive.
If there is already an infovalue registered with the given
key an InvalidArgumentException is thrown.
key - the key to store the infovalue withvalue - the infovalue to storepublic void removeInfoValue(java.lang.Object key)
key
in the infovalue registry of the Primitive from the
infovalue registry.
key - the key of the infovalue to removepublic java.lang.Object getInfoValue(java.lang.Object key)
key
in the infovalue registry of the Primitive. If there is
no infovalue stored for the given key the methods returns
null
key - the key to return the infovalue for
key or
null if there is none
public void setInfoValue(java.lang.Object key,
java.lang.Object newValue)
Sets the value of the infovalue with the key given by key to
the value given by newValue.
If there is no infovalue registered with the given key an
InvalidArgumentException is thrown.
key - the key of the infovalue to set a new value fornewValue - the new value for the infovalue
public void addOrSetInfoValue(java.lang.Object key,
java.lang.Object value)
Adds the infovalue given by value with the given
key to the infovalue registry of the Primitive.
If there is already an infovalue registered with the given
key the value given by value is set as the
new value of the infovalue.
key - the key to store the infovalue withvalue - the infovalue to store or setpublic Boundary getBoundingBox()
Boundary that describes the bounding box for a
graphical object implementing this interface.
getBoundingBox in interface BaseInteractablePrimitivepublic PrimitiveState getState()
public void applyState(PrimitiveState state)
throws PrimitiveStateNotApplicableException
PrimitiveStateNotApplicableExceptionpublic Illustrator getIllustrator(Transform2D xform_context)
Primitives illustrator object. To get more
informations about the illustrator object see the class above or the
documentation of the Illustrator class.
xform_context - the transformation of the context the
Primitive lies within.
Primitive.public RenderingData getRenderingData(Transform2D xform_context)
RenderingData instance, which are used by a
Renderer implementation to render a Primitive.
RenderingData object see
the class documentation above or the documentation of the
RenderingData class.
Renderer technique see the
class documentation above or the documentation of the
Renderer class.
xform_context - the transformation of the context the
Primitive lies within. May not be null.
RenderingData instancepublic Primitive deepCopy()
Primitive instance
Primitive.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||