|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.graphics.AbstractPrimitive
com.tensegrity.graphics.primitive2D.Rect2D
An object of class Rect2D represents a 2-dimensional
rectangular shape. The main properties are its location and size.
This class has three constructors to choose from.
| Field Summary | |
protected static double[] |
tmpCoords
instance variable that is used to transform the coordinates of the rectangle |
protected static int[] |
tmpPtX
instance variable that is used to transform the coordinates of the rectangle |
protected static int[] |
tmpPtY
instance variable that is used to transform the coordinates of the rectangle |
| Fields inherited from class com.tensegrity.graphics.AbstractPrimitive |
attributableOnSetListener, doAttributableEvents, infovalueregistry, interactionDescriptor, selected |
| Fields inherited from interface com.tensegrity.generic.attribute.AttributableOnSet |
TREE_SUBSET_POSTFIX |
| Constructor Summary | |
Rect2D()
Constructor that creates an empty Rect2D. |
|
Rect2D(int left,
int top,
int right,
int bottom)
Constructor that creates a Rect2D with the coordinates
given by left, top, right and
bottom. |
|
Rect2D(Rect2D rect)
Copy constructor for Rect2D. |
|
| Method Summary | |
protected void |
addSpecificAttributes(AttributeFactory factory,
AttributeSet attributes)
Add the specific attributes of a Rect2D to the
AttributeSet given by attributes. |
void |
applyState(PrimitiveState state)
|
BoundingBox |
calculateBoundingBox(InteractionInfo interactionInfo)
|
Primitive |
deepCopy()
An implementation of this method is responsible for returning a deep- copy of the Primitive instance |
int |
getArcHeight()
Returns the height of the arc of the rounded edges. |
int |
getArcWidth()
Returns the width of the arc of the rounded edges. |
Attribute |
getAttribute(java.lang.String name)
Returns the attribute with the given name or null if there
is no Attribute with the given name. |
AttributeSet |
getAttributes()
Returns an AttributeSet consisting of all attributes of this
AttributableOnSet. |
AttributeSet |
getAttributesTree()
Returns an AttributeSet containing all
Attributes of this AttributableOnSet in a
treelike structure.
|
int |
getBottom()
Returns the y-coordinate of the bottom bounding. |
Boundary |
getBoundingBox()
Returns the bounding box of the BaseInteractable. |
boolean |
getEdgesRounded()
Returns indicates whether rounded edges are enabled for this Rect2D. |
int |
getHeight()
Returns the height of the bounding Rect2D. |
Illustrator |
getIllustrator(Transform2D xform_context)
Returns the Primitives illustrator object. |
int |
getLeft()
Returns the x-coordinate of the left bounding. |
int |
getRight()
Returns the x-coordinate of the right bounding. |
PrimitiveState |
getState()
|
int |
getTop()
Returns the y-coordinate of the top bounding. |
int |
getWidth()
Returns the width of the bounding Rect2D. |
protected InteractionDescriptor |
internalCreateInteractionDescriptor()
This method should return an InteractionDescriptor that
defines the interaction capabilities of a certain Primitive.
|
boolean |
isResizable()
Returns a boolean that indicates whether the
Interactable is resizable or not. |
void |
set(int left,
int top,
int right,
int bottom)
Sets the bounds of this Rect2D to the given left, top and
right, bottom coordinates. |
void |
setArcHeight(int arcHeight)
Sets the height of the arc of the rounded edges. |
void |
setArcWidth(int arcWidth)
Sets the width of the arc of the rounded edges. |
void |
setAttributes(AttributeSet attributes)
Searches within the AttributeSet given by
attributes for attributes that have the same name as the
attributes of this AttributableOnSet holds. |
void |
setAttributesTree(AttributeSet attributes)
Performs the same operation as the setAttributes(com.tensegrity.generic.attribute.AttributeSet) method with
the difference that the AttributeSet given to this method
must provide the treelike structure mentioned in the documentation of
the getAttributesTree(). |
void |
setAttributeValue(java.lang.String name,
java.lang.Object value)
Sets the value of the attribute with the name to the given value. |
void |
setBottom(int bottom)
Sets the y-coordinate of the bottom bounding. |
void |
setEdgesRounded(boolean roundEdges)
If the parameter is true, this rectangle will have rounded
edges. |
void |
setHeight(int height)
Sets the height of this Rect2D to the given height. |
void |
setLeft(int left)
Sets the x-coordinate of the left bounding. |
void |
setResizable(boolean resizable)
Sets the state of resizability for the Interactable to the
value given by resizable. |
void |
setRight(int right)
Sets the x-coordinate of the right bounding. |
protected void |
setSpecificAttributes(AttributeFactory aFac,
AttributeSet attributes,
AttributeSet attributeschanged_tablelike,
AttributeSet attributeschanged_treelike)
Set the specific attributes of a Rect2D located in the
AttributeSet given by attributes to the
Rect2D's properties. |
void |
setStroke(StrokeFormat stroke)
Sets a StrokeFormat for the Primitive. |
void |
setTop(int top)
Sets the y-coordinate of the top bounding. |
void |
setWidth(int width)
Sets the width of this Rect2D to the given width. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 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 |
| Field Detail |
protected static final double[] tmpCoords
protected static final int[] tmpPtX
protected static final int[] tmpPtY
| Constructor Detail |
public Rect2D()
Rect2D.
public Rect2D(int left,
int top,
int right,
int bottom)
Rect2D with the coordinates
given by left, top, right and
bottom.
left - the left boundingtop - the top boundingright - the right boundingbottom - the bottom boundingpublic Rect2D(Rect2D rect)
Rect2D.
rect - the Rect2D to copy| Method Detail |
public final int getLeft()
public final void setLeft(int left)
left - the left-bounding to set.public final int getTop()
public final void setTop(int top)
top - the top-bounding to set.public final int getRight()
public final void setRight(int right)
right - the right-bounding to set.public final int getBottom()
public final void setBottom(int bottom)
bottom - the bottom-bounding to set.public final int getWidth()
Rect2D.
Rect2D.public final void setWidth(int width)
Rect2D to the given width.
width - the new width for this rectangle.public final int getHeight()
Rect2D.
Rect2D.public final void setHeight(int height)
Rect2D to the given height.
height - the new height for this rectangle.public final int getArcWidth()
public final void setArcWidth(int arcWidth)
arcWidth - the new width of the arc of the rounded edges.setEdgesRounded(boolean)public final int getArcHeight()
public final void setArcHeight(int arcHeight)
arcHeight - the new height of the arc of the rounded edges.setEdgesRounded(boolean)public final void setEdgesRounded(boolean roundEdges)
true, this rectangle will have rounded
edges.
roundEdges - true for rounded edges.setArcHeight(int),
setArcWidth(int)public final boolean getEdgesRounded()
Rect2D.
true, if rounded edges are enabled.
public final void set(int left,
int top,
int right,
int bottom)
Rect2D to the given left, top and
right, bottom coordinates.
left - the x-coordinate of the left bounding.top - the y-coordinate of the top bounding.right - the x-coordinate of the right bounding.bottom - the y-coordinate of the bottom bounding.public void setStroke(StrokeFormat stroke)
PrimitiveStrokeFormat for the Primitive.
setStroke in interface Primitivestroke - the StrokeFormat to usepublic Boundary getBoundingBox()
BaseInteractableBaseInteractable.
getBoundingBox in interface BaseInteractableBaseInteractablepublic PrimitiveState getState()
getState in interface Primitive
public void applyState(PrimitiveState state)
throws PrimitiveStateNotApplicableException
applyState in interface PrimitivePrimitiveStateNotApplicableExceptionpublic Illustrator getIllustrator(Transform2D xform_context)
PrimitivePrimitives illustrator object. To get more
informations about the illustrator object see the class above or the
documentation of the Illustrator class.
getIllustrator in interface Primitivexform_context - the transformation of the context the
Primitive lies within.
Primitive.public Primitive deepCopy()
PrimitivePrimitive instance
deepCopy in interface PrimitivePrimitive.public boolean isResizable()
Interactableboolean that indicates whether the
Interactable is resizable or not.
isResizable in interface InteractableInteractablepublic void setResizable(boolean resizable)
InteractableInteractable to the
value given by resizable.
setResizable in interface Interactableresizable - the new state of resizability for the
Interactablepublic BoundingBox calculateBoundingBox(InteractionInfo interactionInfo)
calculateBoundingBox in interface Interactable
public void setAttributeValue(java.lang.String name,
java.lang.Object value)
throws IllegalValueException,
ConstraintViolationException
AttributableAttributable interface doesn't support an
Attribute with the name given by name,
the attribute given through name and value
is not handled nor created by Attributable.
setAttributeValue in interface AttributablesetAttributeValue in class AbstractPrimitiveIllegalValueException
ConstraintViolationExceptionpublic Attribute getAttribute(java.lang.String name)
Attributablenull if there
is no Attribute with the given name.
getAttribute in interface AttributablegetAttribute in class AbstractPrimitivepublic AttributeSet getAttributes()
AttributableOnSetAttributeSet consisting of all attributes of this
AttributableOnSet.
getAttributes in interface AttributableOnSetAttributeSet with all attributes.public void setAttributes(AttributeSet attributes)
AttributableOnSetAttributeSet given by
attributes for attributes that have the same name as the
attributes of this AttributableOnSet holds. The value of
every attribute that has the same name is used as the new value for the
corresponding attribute of this AttributableOnSet.
An Attribute within the given AttributeSet that
is not an attribute of the object that implements the
AttributableOnSet interface is not handled by nor added
to the specific implementor of the AttributableOnSet
interface.
setAttributes in interface AttributableOnSetattributes - the AttributeSet consisting of the attributes
whose values to set.public AttributeSet getAttributesTree()
AttributableOnSetAttributeSet containing all
Attributes of this AttributableOnSet in a
treelike structure.
Attributes for an Attribute of this
AttributableOnSet.
Attribute can only
have one value (in this case an object or the Attributes
for an object) the subsequent attributes are plugged into the returned
AttributeSet as a new Attribute with the same
name and the AttributableOnSet.TREE_SUBSET_POSTFIX.
getAttributesTree in interface AttributableOnSetAttributeSet with the attributes
in a treelike structurepublic void setAttributesTree(AttributeSet attributes)
AttributableOnSetAttributableOnSet.setAttributes(com.tensegrity.generic.attribute.AttributeSet) method with
the difference that the AttributeSet given to this method
must provide the treelike structure mentioned in the documentation of
the AttributableOnSet.getAttributesTree().
setAttributesTree in interface AttributableOnSetattributes - the AttributeSet containing the attributes
whose values to set.
protected void addSpecificAttributes(AttributeFactory factory,
AttributeSet attributes)
Rect2D to the
AttributeSet given by attributes.
factory - an instance of AttributeFactory needed to
create new a new attributeattributes - the AttributeSet to add the attributes to
protected void setSpecificAttributes(AttributeFactory aFac,
AttributeSet attributes,
AttributeSet attributeschanged_tablelike,
AttributeSet attributeschanged_treelike)
Rect2D located in the
AttributeSet given by attributes to the
Rect2D's properties.
attributes - the AttributeSet that contains the
attributes to setprotected InteractionDescriptor internalCreateInteractionDescriptor()
AbstractPrimitiveInteractionDescriptor that
defines the interaction capabilities of a certain Primitive.
Since the InteractionDescriptor varies for different kinds
of primitives this method is declared as abstract and must be
implemented for each Primitive that is based on the
AbstractPrimitive class.
null.
internalCreateInteractionDescriptor in class AbstractPrimitiveInteractionDescriptor
for the certain Primitive instancepublic java.lang.String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||