|
|||||||||||
| 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.Line2D
An object of class Line2D represents a 2-dimensional
line segment.
| Field Summary | |
static int |
LINE_CUBIC
constant that tells about the degree of the line segment |
static int |
LINE_LINEAR
constant that tells about the degree of the line segment |
| 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 | |
Line2D()
Creates with a size and width of 1, a pixel. |
|
Line2D(int x1,
int y1,
int x2,
int y2)
Constructor for Line2D specifying the beginning and
ending coordinate. |
|
Line2D(int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
int x4,
int y4,
int transformation)
Constructor for Line2D specifying the beginning and
ending coordinate as well as the reference coordinates for the
beginning and the ending coordinate and create a cubic line.
|
|
Line2D(Line2D line)
Copy constructor for Line2D. |
|
| Method Summary | |
void |
applyState(PrimitiveState state)
|
Coordinate[] |
calculateCoordinates(InteractionInfo interactionInfo)
|
Primitive |
deepCopy()
An implementation of this method is responsible for returning a deep- copy of the Primitive instance |
int |
getActionMode(InteractionItem item)
|
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.
|
Boundary |
getBoundingBox()
Returns the bounding box of the BaseInteractable. |
Coordinate[] |
getCoordinates()
Returns the coordinates of the line with respect to the current model in the following order: degreetypeorder LINE_LINEAR - 1. index ==> starting coordinate 2. index ==> ending coordinate LINE_CUBIC CUBIC_BEZIER 0. index ==> starting coordinate 1. index ==> ending coordinate 2. index ==> starting reference coordinate 3. index ==> ending reference coordinate LINE_CUBIC CUBIC_CATMULL_ROM 0. index ==> starting coordinate 1. index ==> ending coordinate 2. index ==> starting reference coordinate 3. index ==> ending reference coordinate |
int |
getDegree()
Returns the bias of this line or, in other words, the degree of the formula the LineModel of this line uses. |
Coordinate |
getEndingCoordinate()
Returns the current ending Coordinate of the line. |
Illustrator |
getIllustrator(Transform2D xform_context)
Returns the Primitives illustrator object. |
MarkerFormat |
getMarkerBegin()
Returns the format of the beginning marker. |
MarkerFormat |
getMarkerEnd()
Returns the format of the end marker. |
RenderingData |
getRenderingData(Transform2D xform_context)
Returns a RenderingData instance, which are used by a
Renderer implementation to render a Primitive.
|
Coordinate |
getStartingCoordinate()
Returns the current starting Coordinate of the line. |
PrimitiveState |
getState()
|
int |
getType()
Returns the type of this line. |
int |
getWeight()
Returns the thickness of this line. |
protected InteractionDescriptor |
internalCreateInteractionDescriptor()
This method should return an InteractionDescriptor that
defines the interaction capabilities of a certain Primitive.
|
boolean |
isManipulable()
Returns a boolean that indicates whether the
InteractableLine is manipulable or not.
|
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 |
setCoordinates(Coordinate[] coordinates)
Sets the coordinates of the line to the Coordinate given by
coordinates. |
void |
setEndingCoordinate(Coordinate coordinate)
Sets the ending Coordinate of the line to the value given
by coordinate. |
void |
setManipulable(boolean manipulable)
Sets the state of the ability to manipulate the InteractableLine to the value given by
manipulable. |
void |
setMarkerBegin(MarkerFormat marker)
Sets the format of the beginning marker to the given one. |
void |
setMarkerEnd(MarkerFormat marker)
Sets the format of the end marker to the given one. |
void |
setStartEndCoordinate(Coordinate coordinateStart,
Coordinate coordinateEnd)
Sets the starting and the ending Coordinate of the line to
the values given by coordinateStart and
coordinateEnd |
void |
setStartingCoordinate(Coordinate coordinate)
Sets the starting Coordinate of the line to the value given
by coordinate. |
void |
setStroke(StrokeFormat stroke)
Sets a StrokeFormat for the Primitive. |
void |
setWeight(int weight)
Sets the weight of this line. |
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 |
public static final int LINE_LINEAR
public static final int LINE_CUBIC
| Constructor Detail |
public Line2D()
public Line2D(int x1,
int y1,
int x2,
int y2)
Line2D specifying the beginning and
ending coordinate.
x1 - the x-coordinate of the beginning coordinatey1 - the y-coordinate of the beginning coordinatex2 - the x-coordinate of the ending coordinatey2 - the y-coordinate of the ending coordinate
public Line2D(int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
int x4,
int y4,
int transformation)
Line2D specifying the beginning and
ending coordinate as well as the reference coordinates for the
beginning and the ending coordinate and create a cubic line.
The transformation type for the cubic line is given by
transformation.
x1 - the x-coordinate of the beginning coordinatey1 - the y-coordinate of the beginning coordinatex2 - the x-coordinate of the ending coordinatey2 - the y-coordinate of the ending coordinatex3 - the x-coordinate of the reference coordinate for the
beginning coordinatey3 - the y-coordinate of the reference coordinate for the
beginning coordinatex4 - the x-coordinate of the reference coordinate for the
ending coordinatey4 - the y-coordinate of the reference coordinate for the
ending coordinatetransformation - the transformation to use for the cubic line
modelpublic Line2D(Line2D line)
Line2D.
line - the Line2D to copy.| Method Detail |
public Coordinate getStartingCoordinate()
Coordinate of the line.
public void setStartingCoordinate(Coordinate coordinate)
Coordinate of the line to the value given
by coordinate.
coordinate - the new starting Coordinate of the linepublic Coordinate getEndingCoordinate()
Coordinate of the line.
public void setEndingCoordinate(Coordinate coordinate)
Coordinate of the line to the value given
by coordinate.
coordinate - the new ending Coordinate of the line
public void setStartEndCoordinate(Coordinate coordinateStart,
Coordinate coordinateEnd)
Coordinate of the line to
the values given by coordinateStart and
coordinateEnd
coordinateStart - the new starting Coordinate of the
linecoordinateEnd - the new ending Coordinate of the linepublic Coordinate[] getCoordinates()
| degree | type | order |
| LINE_LINEAR | - |
1. index ==> starting coordinate 2. index ==> ending coordinate |
| LINE_CUBIC | CUBIC_BEZIER |
0. index ==> starting coordinate 1. index ==> ending coordinate 2. index ==> starting reference coordinate 3. index ==> ending reference coordinate |
| LINE_CUBIC | CUBIC_CATMULL_ROM |
0. index ==> starting coordinate 1. index ==> ending coordinate 2. index ==> starting reference coordinate 3. index ==> ending reference coordinate |
public void setCoordinates(Coordinate[] coordinates)
Coordinate given by
coordinates.Coordinates in the array are
expected in the following order:
| degree | type | order |
| LINE_LINEAR | - |
1. index ==> starting coordinate 2. index ==> ending coordinate |
| LINE_CUBIC | CUBIC_BEZIER |
0. index ==> starting coordinate 1. index ==> ending coordinate 2. index ==> starting reference coordinate 3. index ==> ending reference coordinate |
| LINE_CUBIC | CUBIC_CATMULL_ROM |
0. index ==> starting coordinate 1. index ==> ending coordinate 2. index ==> starting reference coordinate 3. index ==> ending reference coordinate |
coordinates - the coordinate to setpublic int getWeight()
public void setWeight(int weight)
weight - the new weight of this line.public int getDegree()
LineModel of this line uses. For instance the
degree of a straight line is 1, for a quadric line it is 2 and the degree
for a cubic line is 3 and so forth.
public int getType()
LINEAR
and CUBIC as defined by this class.
public MarkerFormat getMarkerBegin()
public void setMarkerBegin(MarkerFormat marker)
marker - the new format of the beginning marker.public MarkerFormat getMarkerEnd()
public void setMarkerEnd(MarkerFormat marker)
marker - the new format of the end marker.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 RenderingData getRenderingData(Transform2D xform_context)
PrimitiveRenderingData 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.
getRenderingData in interface PrimitivegetRenderingData in class AbstractPrimitivepublic Primitive deepCopy()
PrimitivePrimitive instance
deepCopy in interface PrimitivePrimitive.public boolean isManipulable()
InteractableLineboolean that indicates whether the
InteractableLine is manipulable or not.
Manipulable means in this case that a single point of the line can
be manipulated.
isManipulable in interface InteractableLineInteractableLine
is manipulable or not.public void setManipulable(boolean manipulable)
InteractableLineInteractableLine to the value given by
manipulable.
setManipulable in interface InteractableLinemanipulable - the new state for the ability to manipulate the
InteractableLinepublic Coordinate[] calculateCoordinates(InteractionInfo interactionInfo)
calculateCoordinates in interface InteractableLinepublic int getActionMode(InteractionItem item)
getActionMode in interface InteractableLine
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 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 | ||||||||||