|
|||||||||||
| 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.Polyline2D
An object of class Polyline2D represents a two-dimensional line
consisting of one or more line segments.
| Field Summary | |
protected int[] |
coordsX
instance variable for the x components of the line coordinates |
protected int[] |
coordsXRef
instance variable for the x components of the polygons reference coordinates (necessary when the polygon has segments that are not linear lines) |
protected int[] |
coordsY
instance variable for the y components of the line coordinates |
protected int[] |
coordsYRef
instance variable for the y components of the polygons reference coordinates (necessary when the polygon has segments that are not linear lines) |
protected MarkerFormat |
markerBegin
instance variable for the marker at the start coordinate of the polyline |
protected MarkerFormat |
markerEnd
instance variable for the marker at the stop coordinate of the polyline |
protected int[] |
segmentTypes
instance variable for the segment types of the polygon |
| 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 | |
Polyline2D()
Constructor for Polyline2D. |
|
Polyline2D(int[] coordsX,
int[] coordsY)
Constructor specifying the visited points of this Polyline2D. |
|
Polyline2D(int[] coordsX,
int[] coordsY,
int[] coordsXRef,
int[] coordsYRef,
int[] segmentTypes)
Constructor specifying the visited points of this Polyline2D. |
|
Polyline2D(Polyline2D polyline)
Copy constructor for Polyline2D. |
|
| Method Summary | |
void |
addCoordinate(Coordinate coordinate)
Adds the given Coordinate to the list of coordinate pairs.
|
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 |
getCoordinateAt(int index)
Returns the coordinate at the index specified by index. |
int |
getCoordinateCount()
Returns the current number of coordinates the Polyline2D
consists of. |
Coordinate[] |
getCoordinates()
Returns an array of Coordinates the Polyline2D
consists of.
|
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. |
Coordinate[] |
getReferenceCoordinates()
Returns an array of Coordinates that represents the
reference coordinates the Polygon2D currently provides.
|
RenderingData |
getRenderingData(Transform2D xform_context)
Returns a RenderingData instance, which are used by a
Renderer implementation to render a Primitive.
|
int[] |
getSegmentTypes()
Returns an int-array that represent the segment types the Polygon2D currently provides.
|
Coordinate |
getStartingCoordinate()
Returns the current starting Coordinate of the line. |
PrimitiveState |
getState()
|
void |
insertCoordinate(int index,
Coordinate coordinate)
Inserts the Coordinate given by coordinate at
the index specified by index. |
void |
insertCoordinate(int index,
Coordinate coordinate,
Coordinate[] refCoordinates)
Inserts the Coordinate given by coordinate at
the index specified by index. |
protected InteractionDescriptor |
internalCreateInteractionDescriptor()
This method should return an InteractionDescriptor that
defines the interaction capabilities of a certain Primitive.
|
void |
internalInvalidateBoundingBox()
For internal use only! |
protected void |
internalSetMarkerBegin(MarkerFormat marker,
AttributeSet attributeschanged_tablelike,
AttributeSet attributeschanged_treelike)
|
protected void |
internalSetMarkerEnd(MarkerFormat marker,
AttributeSet attributeschanged_tablelike,
AttributeSet attributeschanged_treelike)
|
boolean |
isEachPointInteractionAllowed()
Returns true, if interactions for each point are allowed. |
boolean |
isManipulable()
Returns a boolean that indicates whether the
InteractableLine is manipulable or not.
|
void |
removeCoordinate(int index)
Removes the coordinate at the index specified by index from
the Polyline2D. |
void |
removeCoordinates(int index1,
int index2)
Removes the coordinates between the index specified by index1 and the index specified by index2
from the Polyline2D. |
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 |
setCoordinateAt(int index,
Coordinate coordinate)
Sets the given Coordinate at the
index specified by index. |
void |
setCoordinates(Coordinate[] coordinates)
Sets the given Coordinates as the new vertex edges of this
Polyline2D. |
void |
setEachPointInteractionAllowed(boolean allowEachPointInteraction)
Enabled or disables the each-point-interaction dependent on the flag given by allowEachPointInteraction. |
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 |
setReferenceCoordinates(Coordinate[] coords)
Sets the Coordinates given by coords as the
new reference coordinates the Polygon2D should provide. |
void |
setSegmentTypes(int[] segmentTypes)
Sets the segment types for the Polygon2D to the values
given by segmentTypesNew. |
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. |
java.lang.String |
toString()
|
void |
translatePoints(int indexStart,
int indexEnd,
int offsetX,
int offsetY)
Translates the given range of points by the values of offsetX and
offsetY. |
| 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 int[] coordsX
protected int[] coordsY
protected int[] coordsXRef
protected int[] coordsYRef
protected int[] segmentTypes
protected MarkerFormat markerBegin
protected MarkerFormat markerEnd
| Constructor Detail |
public Polyline2D()
public Polyline2D(int[] coordsX,
int[] coordsY,
int[] coordsXRef,
int[] coordsYRef,
int[] segmentTypes)
Polyline2D.
coordsX - the x-coordinates of the points.coordsY - the y-coordinates of the points.segmentTypes - The types of the segmentscoordsXRef - the x-components of the reference coordinatescoordsYRef - the y-components of the reference coordinates
public Polyline2D(int[] coordsX,
int[] coordsY)
Polyline2D.
coordsX - the x-coordinates of the points.coordsY - the y-coordinates of the points.public Polyline2D(Polyline2D polyline)
Polyline2D.
polyline - the Polyline2D to copy| Method Detail |
public boolean isEachPointInteractionAllowed()
true, if interactions for each point are allowed.
true, if interactions for each point are allowed.public void setEachPointInteractionAllowed(boolean allowEachPointInteraction)
allowEachPointInteraction.
allowEachPointInteraction - the new value for the
each-point-interactionpublic 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()
Coordinates the Polyline2D
consists of.
Polyline2D
Polyline2D
consists ofpublic void setCoordinates(Coordinate[] coordinates)
Coordinates as the new vertex edges of this
Polyline2D. The old vertices of this line are deleted.
coordinates - the new Coordinates for the
Polyline2Dpublic int getCoordinateCount()
Polyline2D
consists of.
public Coordinate getCoordinateAt(int index)
index.
index - the index to return the coordinate for
public void setCoordinateAt(int index,
Coordinate coordinate)
Coordinate at the
index specified by index.
index - the index to set the coordinate atcoordinate - the new Coordinatepublic void addCoordinate(Coordinate coordinate)
Coordinate to the list of coordinate pairs.
Each two coordinates defines a segment of this Polyline2D.
coordinate - the Coordinate to add.
public void insertCoordinate(int index,
Coordinate coordinate)
Coordinate given by coordinate at
the index specified by index.
index - the index where to insert the new Coordinatecoordinate - the Coordinate to insert
public void insertCoordinate(int index,
Coordinate coordinate,
Coordinate[] refCoordinates)
Coordinate given by coordinate at
the index specified by index.
index - the index where to insert the new Coordinatecoordinate - the Coordinate to insertrefCoordinates - the reference coordinates to use for the new pointpublic void removeCoordinate(int index)
index from
the Polyline2D.
index - the index where to remove the coordinate
public void removeCoordinates(int index1,
int index2)
index1 and the index specified by index2
from the Polyline2D.
index1 - the start index of the coordinates to removeindex2 - the stop index of the coordinates to removepublic Coordinate[] getReferenceCoordinates()
Coordinates that represents the
reference coordinates the Polygon2D currently provides.
Polygon2D
Polygon2D currently providespublic void setReferenceCoordinates(Coordinate[] coords)
Coordinates given by coords as the
new reference coordinates the Polygon2D should provide.
coords - the new reference Coordinates for the
Polygon2D
public void translatePoints(int indexStart,
int indexEnd,
int offsetX,
int offsetY)
offsetX and
offsetY. In addition the corresponding reference coordinates are
translated as well.
indexStart - The start index of the range to moveindexEnd - The start index of the range to moveoffsetX - The horizontal offsetoffsetY - The vertical offsetpublic int[] getSegmentTypes()
Polygon2D currently provides.
The different segment types that are supported by the
Polygon2D are defined by the constants
UtilitiesLine.LINEAR_SEGMENT,
UtilitiesLine.CUBIC_BEZIER_SEGMENT or
UtilitiesLine.CUBIC_CATMULL_ROM_SEGMENT.
Polygon2Dpublic void setSegmentTypes(int[] segmentTypes)
Polygon2D to the values
given by segmentTypesNew. A value of null will
reset the all segments to linear, so reference coordinates are ignored.
The supported segment types are
UtilitiesLine.LINEAR_SEGMENTUtilitiesLine.CUBIC_BEZIER_SEGMENT
UtilitiesLine.CUBIC_CATMULL_ROM_SEGMENT
public MarkerFormat getMarkerBegin()
public void setMarkerBegin(MarkerFormat marker)
marker - the new format of the beginning marker.
protected final void internalSetMarkerBegin(MarkerFormat marker,
AttributeSet attributeschanged_tablelike,
AttributeSet attributeschanged_treelike)
public MarkerFormat getMarkerEnd()
public void setMarkerEnd(MarkerFormat marker)
marker - the new format of the end marker.
protected final void internalSetMarkerEnd(MarkerFormat marker,
AttributeSet attributeschanged_tablelike,
AttributeSet attributeschanged_treelike)
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()
public void internalInvalidateBoundingBox()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||