com.tensegrity.graphics.primitive2D
Class Ellipse2D

java.lang.Object
  extended bycom.tensegrity.graphics.AbstractPrimitive
      extended bycom.tensegrity.graphics.primitive2D.Ellipse2D
All Implemented Interfaces:
Attributable, AttributableOnSet, BaseInteractable, Interactable, Primitive

public class Ellipse2D
extends AbstractPrimitive
implements Interactable

An object of class Ellipse2D represents a 2-dimensional elliptical shape specified by a rectangular boundary. If the boundary is a square, the corresponding ellipse is a circle such that its diameter equals the length of one of the square's sides.

Version:
$Id: Ellipse2D.java,v 1.51 2006/03/21 14:26:11 MichaelKegel Exp $
Author:
MichaelKegel

Field Summary
static int COORD_LEFT_TOP
          constant that tells about a coordinate index in the bounding box of the ellipse
static int COORD_RIGHT_BOTTOM
          constant that tells about a coordinate index in the bounding box of the ellipse
protected  int[] coordsX
          instance variable for the x components of the ellipse coordinates
protected  int[] coordsY
          instance variable for the y components of the ellipse coordinates
 
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
Ellipse2D()
          Constructor that creates an empty Ellipse2D.
Ellipse2D(Ellipse2D ellipse)
          Copy constructor for Ellipse2D.
Ellipse2D(int x1, int y1, int x2, int y2)
          Constructor that creates an Ellipse2D with the coordinates given by x1/code>, y1, x2 and y2.
 
Method Summary
 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
 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 bottom value of the ellipse bounding box.
 Boundary getBoundingBox()
          Returns the bounding box of the BaseInteractable.
 int getCenterX()
          Returns the x component of the center coordinate of the ellipse bounding box.
 int getCenterY()
          Returns the y component of the center coordinate of the ellipse bounding box.
 int getHeight()
          Returns the height of the ellipse bounding box.
 Illustrator getIllustrator(Transform2D xform_context)
          Returns the Primitives illustrator object.
 int getLeft()
          Returns the left value of the ellipse bounding box.
 int getRadiusX()
          Returns the radius in x direction of the ellipse.
 int getRadiusY()
          Returns the radius in y direction of the ellipse.
 int getRight()
          Returns the right value of the ellipse bounding box.
 PrimitiveState getState()
           
 int getTop()
          Returns the top value of the ellipse bounding box.
 int getWidth()
          Returns the width of the ellipse bounding box.
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 bounding box of this Rect2D to the given left, top, right and bottom coordinate components.
 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 bottom value of the ellipse bounding box to the value given by bottom
 void setCenter(int centerX, int centerY)
          Sets the center coordinate of the ellipse bounding box to the coordinate given by centerX and centerY.
 void setCenterX(int centerX)
          Sets the x component of the center coordinate of the ellipse bounding box to the value given by centerX
 void setCenterY(int centerY)
          Sets the y component of the center coordinate of the ellipse bounding box to the value given by centerY
 void setHeight(int height)
          Sets the height of the ellipse bounding box to the value given by height
 void setLeft(int left)
          Sets the left value of the ellipse bounding box to the value given by left.
 void setRadii(int radiusX, int radiusY)
          Sets the radii in x and y direction of the ellipse to the values given by radiusX and radiusY.
 void setRadiusX(int radiusX)
          Sets the radius in x direction of the ellipse to the value given by radiusX.
 void setRadiusY(int radiusY)
          Sets the radius in y direction of the ellipse to the value given by radiusY.
 void setResizable(boolean resizable)
          Sets the state of resizability for the Interactable to the value given by resizable.
 void setRight(int right)
          Sets the right value of the ellipse bounding box to the value given by right.
 void setStroke(StrokeFormat stroke)
          Sets a StrokeFormat for the Primitive.
 void setTop(int top)
          Sets the top value of the ellipse bounding box to the value given by top.
 void setWidth(int width)
          Sets the width of the ellipse bounding box to the value given by width
 java.lang.String toString()
           
 
Methods inherited from class com.tensegrity.graphics.AbstractPrimitive
addAttributableOnSetListener, addInfoValue, addOrSetInfoValue, areAttributableEventsEnabled, disableAttributableEvents, enableAttributableEvents, fireAttributableOnSetChangedEvent, fireAttributableOnSetChangedEvent, getAttributeType, getAttributeValue, getFont, getInfoValue, getInteractionDescriptor, getMoveItem, getPaint, getRenderingData, getStroke, getTransform, hasInfoValue, hits, internalDeepCopyInfoValues, internalEnableSelection, internalSelect, internalSetFont, internalSetPaint, internalSetSelected, internalSetStroke, internalSetStroke, isMovable, isSelectable, isSelected, mouseClick, mouseDown, mouseEnter, mouseExit, mouseUp, postActing, preActing, raiseAttributableEvents, removeAttributableOnSetListener, removeInfoValue, select, setAttribute, setFontFormat, setInfoValue, setMovable, setPaint, setSelectable, setSelected, setTransform, startAction, stopAction
 
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

COORD_LEFT_TOP

public static final int COORD_LEFT_TOP
constant that tells about a coordinate index in the bounding box of the ellipse

See Also:
Constant Field Values

COORD_RIGHT_BOTTOM

public static final int COORD_RIGHT_BOTTOM
constant that tells about a coordinate index in the bounding box of the ellipse

See Also:
Constant Field Values

coordsX

protected int[] coordsX
instance variable for the x components of the ellipse coordinates


coordsY

protected int[] coordsY
instance variable for the y components of the ellipse coordinates

Constructor Detail

Ellipse2D

public Ellipse2D()
Constructor that creates an empty Ellipse2D.


Ellipse2D

public Ellipse2D(int x1,
                 int y1,
                 int x2,
                 int y2)
Constructor that creates an Ellipse2D with the coordinates given by x1/code>, y1, x2 and y2.

Parameters:
x1 - x component of the first coordinate of the ellipse bounding box
y1 - y component of the first coordinate of the ellipse bounding box
x2 - x component of the second coordinate of the ellipse bounding box
y2 - y component of the second coordinate of the ellipse bounding box

Ellipse2D

public Ellipse2D(Ellipse2D ellipse)
Copy constructor for Ellipse2D.

Parameters:
ellipse - the Ellipse2D to copy
Method Detail

getLeft

public final int getLeft()
Returns the left value of the ellipse bounding box.

Returns:
the left value of the ellipse bounding box

setLeft

public final void setLeft(int left)
Sets the left value of the ellipse bounding box to the value given by left.

Parameters:
left - the new value for the left value of the ellipse bounding box

getTop

public final int getTop()
Returns the top value of the ellipse bounding box.

Returns:
the top value of the ellipse bounding box.

setTop

public final void setTop(int top)
Sets the top value of the ellipse bounding box to the value given by top.

Parameters:
top - the new value for the top value of the ellipse bounding box

getRight

public final int getRight()
Returns the right value of the ellipse bounding box.

Returns:
the right value of the ellipse bounding box

setRight

public final void setRight(int right)
Sets the right value of the ellipse bounding box to the value given by right.

Parameters:
right - the new value for the right value of the ellipse bounding box

getBottom

public final int getBottom()
Returns the bottom value of the ellipse bounding box.

Returns:
the bottom value of the ellipse bounding box

setBottom

public final void setBottom(int bottom)
Sets the bottom value of the ellipse bounding box to the value given by bottom

Parameters:
bottom - the new value for the bottom value of the ellipse bounding box

getWidth

public final int getWidth()
Returns the width of the ellipse bounding box.

Returns:
the width of the ellipse bounding box

setWidth

public final void setWidth(int width)
Sets the width of the ellipse bounding box to the value given by width

Parameters:
width - the new width value for the ellipse bounding box

getHeight

public final int getHeight()
Returns the height of the ellipse bounding box.

Returns:
the height of the ellipse bounding box

setHeight

public final void setHeight(int height)
Sets the height of the ellipse bounding box to the value given by height

Parameters:
height - the new height value for the ellipse bounding box

getCenterX

public final int getCenterX()
Returns the x component of the center coordinate of the ellipse bounding box.

Returns:
the x component of the center coordinate

setCenterX

public final void setCenterX(int centerX)
Sets the x component of the center coordinate of the ellipse bounding box to the value given by centerX

Parameters:
centerX - the new value for the x center of the ellipse bounding box

getCenterY

public final int getCenterY()
Returns the y component of the center coordinate of the ellipse bounding box.

Returns:
the y component of the center coordinate

setCenterY

public final void setCenterY(int centerY)
Sets the y component of the center coordinate of the ellipse bounding box to the value given by centerY

Parameters:
centerY - the new value for the y center of the ellipse bounding box

setCenter

public final void setCenter(int centerX,
                            int centerY)
Sets the center coordinate of the ellipse bounding box to the coordinate given by centerX and centerY.

Parameters:
centerX - the x component of the new center coordinate
centerY - the y component of the new center coordinate

getRadiusX

public final int getRadiusX()
Returns the radius in x direction of the ellipse.

Returns:
the radius in x direction.

Find more information in the class documentation


setRadiusX

public final void setRadiusX(int radiusX)
Sets the radius in x direction of the ellipse to the value given by radiusX.

Parameters:
radiusX - the new radius in x direction

getRadiusY

public final int getRadiusY()
Returns the radius in y direction of the ellipse.

Returns:
the radius in y direction.

Find more information in the class documentation


setRadiusY

public final void setRadiusY(int radiusY)
Sets the radius in y direction of the ellipse to the value given by radiusY.

Parameters:
radiusY - the new radius in y direction

setRadii

public final void setRadii(int radiusX,
                           int radiusY)
Sets the radii in x and y direction of the ellipse to the values given by radiusX and radiusY.

Parameters:
radiusX - the new radius in x direction
radiusY - the new radius in y direction

Find more information in the class documentation


set

public final void set(int left,
                      int top,
                      int right,
                      int bottom)
Sets the bounding box of this Rect2D to the given left, top, right and bottom coordinate components.

Parameters:
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.

setStroke

public void setStroke(StrokeFormat stroke)
Description copied from interface: Primitive
Sets a StrokeFormat for the Primitive.

Specified by:
setStroke in interface Primitive
Parameters:
stroke - the StrokeFormat to use

getBoundingBox

public Boundary getBoundingBox()
Description copied from interface: BaseInteractable
Returns the bounding box of the BaseInteractable.

Specified by:
getBoundingBox in interface BaseInteractable
Returns:
Boundary the bounding box of the BaseInteractable

getState

public PrimitiveState getState()
Specified by:
getState in interface Primitive

applyState

public void applyState(PrimitiveState state)
                throws PrimitiveStateNotApplicableException
Specified by:
applyState in interface Primitive
Throws:
PrimitiveStateNotApplicableException

getIllustrator

public Illustrator getIllustrator(Transform2D xform_context)
Description copied from interface: Primitive
Returns the Primitives illustrator object. To get more informations about the illustrator object see the class above or the documentation of the Illustrator class.

Specified by:
getIllustrator in interface Primitive
Parameters:
xform_context - the transformation of the context the Primitive lies within.
Returns:
Illustrator the illustrator for outputting the Primitive.

deepCopy

public Primitive deepCopy()
Description copied from interface: Primitive
An implementation of this method is responsible for returning a deep- copy of the Primitive instance

Specified by:
deepCopy in interface Primitive
Returns:
a deep copy of the Primitive.

isResizable

public boolean isResizable()
Description copied from interface: Interactable
Returns a boolean that indicates whether the Interactable is resizable or not.

Specified by:
isResizable in interface Interactable
Returns:
boolean that indicates the state of resizability of the Interactable

setResizable

public void setResizable(boolean resizable)
Description copied from interface: Interactable
Sets the state of resizability for the Interactable to the value given by resizable.

Specified by:
setResizable in interface Interactable
Parameters:
resizable - the new state of resizability for the Interactable

calculateBoundingBox

public BoundingBox calculateBoundingBox(InteractionInfo interactionInfo)
Specified by:
calculateBoundingBox in interface Interactable

setAttributeValue

public void setAttributeValue(java.lang.String name,
                              java.lang.Object value)
                       throws IllegalValueException,
                              ConstraintViolationException
Description copied from interface: Attributable
Sets the value of the attribute with the name to the given value.
Notice: If the specific implementor of the Attributable 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.

Specified by:
setAttributeValue in interface Attributable
Overrides:
setAttributeValue in class AbstractPrimitive
Throws:
IllegalValueException
ConstraintViolationException

getAttribute

public Attribute getAttribute(java.lang.String name)
Description copied from interface: Attributable
Returns the attribute with the given name or null if there is no Attribute with the given name.

Specified by:
getAttribute in interface Attributable
Overrides:
getAttribute in class AbstractPrimitive

getAttributes

public AttributeSet getAttributes()
Description copied from interface: AttributableOnSet
Returns an AttributeSet consisting of all attributes of this AttributableOnSet.

Specified by:
getAttributes in interface AttributableOnSet
Returns:
AttributeSet an AttributeSet with all attributes.

setAttributes

public void setAttributes(AttributeSet attributes)
Description copied from interface: AttributableOnSet
Searches within the AttributeSet 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.

Specified by:
setAttributes in interface AttributableOnSet
Parameters:
attributes - the AttributeSet consisting of the attributes whose values to set.

getAttributesTree

public AttributeSet getAttributesTree()
Description copied from interface: AttributableOnSet
Returns an AttributeSet containing all Attributes of this AttributableOnSet in a treelike structure.
Treelike means that each attribute can have a subset that contains subsequent Attributes for an Attribute of this AttributableOnSet.
Since an 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.

Specified by:
getAttributesTree in interface AttributableOnSet
Returns:
AttributeSet an AttributeSet with the attributes in a treelike structure

setAttributesTree

public void setAttributesTree(AttributeSet attributes)
Description copied from interface: AttributableOnSet
Performs the same operation as the AttributableOnSet.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().

Specified by:
setAttributesTree in interface AttributableOnSet
Parameters:
attributes - the AttributeSet containing the attributes whose values to set.

internalCreateInteractionDescriptor

protected InteractionDescriptor internalCreateInteractionDescriptor()
Description copied from class: AbstractPrimitive
This method should return an InteractionDescriptor 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.
NOTICE: The return value must not be null.

Specified by:
internalCreateInteractionDescriptor in class AbstractPrimitive
Returns:
InteractionDescriptor the InteractionDescriptor for the certain Primitive instance

toString

public java.lang.String toString()


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.