|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
A CompositeLine is a specialization of the BaseComposite
interface. Therefore, it is recommended that you read the documentation of the
BaseComposite interface first to acquire a basic understanding of
this interface's inherited responsibility.
The CompositeLine interface is used whenever a line is drawn or two
composites are connected with a link. This connecting edge is made up of a
CompositeLine - a Composite that holds a line and behaves
differently than normal composites.
The CompositeLine interface supplements the BaseComposite
behavior by managing a set of Coordinate objects that are used by
a parent CoordinateSystem.
To deal with the coordinates of a CompositeLine, you may
use the following methods:
Coordinate getStartingLocation()void setStartingLocation(Coordinate)Coordinate getEndingLocation()void setEndingLocation(Coordinate)Coordinate[] getCoordinates()void setCoordinates(Coordinate[])int getCoordinateCount()Coordinate getCoordinateAt(int)void setCoordinateAt(int, Coordinate)void addCoordinate(Coordinate)void insertCoordinate(int, Coordinate)void insertCoordinate(int, Coordinate, Coordinate[])void removeCoordinate(int)void removeCoordinates(int, int)
A CompositeLine object fires events for every change that can happen
to it. In order to be notified about these events, you have to programmatically
register an object that implements the CompositeLineListener interface.
For more information about this interface, please take a closer look at the
documentation for CompositeLineListener
and CompositeLineEvent.
Some of the events generated by a CompositeLine are vetoable, which
means that the processing of an event can be programmatically stopped. In order
to veto an event, you have to register a VetoableCompositeLineListener.
For more information about this interface, please take a closer look at the
documentation for VetoableCompositeLineListener.
For more information about the event mechanism in the tensegrity frameworks,
please see interface EventListenerTag and
class EventMultiplexer.
The methods a CompositeLine provides to support the event mechanism are:
addCompositeLineListener(com.tensegrity.composite.event.CompositeLineListener)removeCompositeLineListener(com.tensegrity.composite.event.CompositeLineListener)addVetoableCompositeLineListener(com.tensegrity.composite.event.VetoableCompositeLineListener)removeVetoableCompositeLineListener(com.tensegrity.composite.event.VetoableCompositeLineListener)
| Field Summary | |
static int |
EVENT_MASK_CHANGE
Constant that tells about the different events or groups of events and can be used with BaseComposite.enableEvents(int) to turn them on and
BaseComposite.disableEvents(int) to turn them off. |
static int |
EVENT_MASK_MANIPULATE
Constant that tells about the different events or groups of events and can be used with BaseComposite.enableEvents(int) to turn them on and
BaseComposite.disableEvents(int) to turn them off. |
static int |
EVENT_MASK_MOVE
Constant that tells about the different events or groups of events and can be used with BaseComposite.enableEvents(int) to turn them on and
BaseComposite.disableEvents(int) to turn them off. |
static int |
LABEL_POSITION_CENTER
Deprecated. use SIGN_XXX position constants instead |
static int |
LABEL_POSITION_CENTER_END
Deprecated. use SIGN_XXX position constants instead |
static int |
LABEL_POSITION_CENTER_START
Deprecated. use SIGN_XXX position constants instead |
static int |
LABEL_POSITION_FREE
Deprecated. use SIGN_XXX position constants instead |
static int |
LABEL_POSITION_HEAD
Deprecated. use SIGN_XXX position constants instead |
static int |
LABEL_POSITION_HEAD_END
Deprecated. use SIGN_XXX position constants instead |
static int |
LABEL_POSITION_HEAD_START
Deprecated. use SIGN_XXX position constants instead |
static int |
LABEL_POSITION_TAIL
Deprecated. use SIGN_XXX position constants instead |
static int |
LABEL_POSITION_TAIL_END
Deprecated. use SIGN_XXX position constants instead |
static int |
LABEL_POSITION_TAIL_START
Deprecated. use SIGN_XXX position constants instead |
static int |
LABEL_POSITION_UNKNOWN
Deprecated. use SIGN_XXX position constants instead |
static int |
SIGN_ANCHOR_BEGIN
|
static int |
SIGN_ANCHOR_CENTER
|
static int |
SIGN_ANCHOR_END
|
static int |
SIGN_ANCHOR_FREE
|
static int |
SIGN_PLACEMENT_CENTER
|
static int |
SIGN_PLACEMENT_FREE
|
static int |
SIGN_PLACEMENT_HEAD
|
static int |
SIGN_PLACEMENT_TAIL
|
static int |
TYPE_CURVED
Constant to specify the type of the CompositeLine. |
static int |
TYPE_DYNAMIC
Constant to specify the type of the CompositeLine. |
static int |
TYPE_ORTHOGONAL
Constant to specify the type of the CompositeLine. |
static int |
TYPE_STRAIGHT
Constant to specify the type of the CompositeLine. |
| Fields inherited from interface com.tensegrity.composite.BaseComposite |
DELEGATE_INFOVALUE, EVENT_MASK_MOUSE, EVENT_MASK_SELECT, GENERAL_INFOVALUE, NON_INFOVALUE |
| Fields inherited from interface com.tensegrity.generic.attribute.AttributableOnSet |
TREE_SUBSET_POSTFIX |
| Method Summary | |
void |
addCompositeLineListener(CompositeLineListener listener)
Adds the given CompositeLineListener to the
CompositeLines internal structure, such that the listener is
informed about every event that occurs. |
void |
addCoordinate(Coordinate coordinate)
Adds the Coordinate given by coordinate to the
end of the CompositeLines actual coordinates. |
void |
addVetoableCompositeLineListener(VetoableCompositeLineListener listener)
Adds the given VetoableCompositeLineListener to the
CompositeLines internal structure, such that the listener is
informed about every event that occurs. |
void |
applyState(CompositeLineState state)
Applies the CompositeLineState given by state
to the CompositeLine. |
CompositeLine |
deepCopy()
Deep copies a CompositeLine. |
Coordinate |
getCoordinateAt(int index)
Returns the Coordinate at the index given by
index from the CompositeLines current
coordinates.
|
int |
getCoordinateCount()
Returns the current number of Coordinates the
CompositeLine consist of. |
Coordinate[] |
getCoordinates()
Returns an array of the current Coordinates the
CompositeLine consist of. |
Coordinate |
getEndingLocation()
Returns the ending Coordinate of the
CompositeLine. |
java.lang.String |
getLabel()
Deprecated. use .setSignVisible() and .adjustGeometry() instead [NOTICE: method will be removed in the near future] |
Coordinate |
getLabelLocation()
Deprecated. use .getSign().getLocation() instead [NOTICE: method will be removed in the near future] |
int |
getLabelPositioning()
Deprecated. use .getSignPosition() or .getSignLinePosition() instead [NOTICE: method will be removed in the near future] |
Size |
getLabelSize()
Deprecated. use .getSign().getSize() instead [NOTICE: method will be removed in the near future] |
MarkerFormat |
getMarkerBegin()
Returns the MarkerFormat that is currently used to draw a
marker at the beginning coordinate of the CompositeLine. |
MarkerFormat |
getMarkerEnd()
Returns the MarkerFormat that is currently used to draw a
marker at the ending coordinate of the CompositeLine. |
Coordinate[] |
getReferenceCoordinates()
Returns an array of Coordinates that represents the
reference coordinates the CompositeLine currently provides.
|
int[] |
getSegmentTypes()
Returns an int-array that represent the segment types the CompositeLine currently provides.
|
Composite |
getSign()
|
int |
getSignAnchor()
|
int |
getSignPlacement()
|
Coordinate |
getStartingLocation()
Returns the starting Coordinate of the
CompositeLine.
|
CompositeLineState |
getState()
Returns a CompositeLineState instance that can be used to
reset the state of the CompositeLine to the state that is
stored into the CompositeLineState. |
StrokeFormat |
getStroke()
Returns the StrokeFormat that is currently used to draw the
CompositeLine. |
int |
getType()
Returns the type of the line. |
void |
insertCoordinate(int index,
Coordinate coordinate)
Inserts the Coordinate given by coordinate at
the index given by index. |
void |
insertCoordinate(int index,
Coordinate coordinate,
Coordinate[] refCoordinate)
Inserts the Coordinate given by coordinate at
the index given by index. |
boolean |
isEachPointInteractionAllowed()
Returns a boolean that indicates whether it is allowed for
the user to interact at each point of the CompositeLine
or not. |
boolean |
isSignVisible()
Returns a boolean that indicates whether the current sign
of the CompositeLine is visible or not. |
void |
layoutLabel(Coordinate location)
Deprecated. use .getSign().setLocation() [NOTICE: method will be removed in the near future] |
void |
removeCompositeLineListener(CompositeLineListener listener)
Removes the given CompositeLineListener from the
CompositeLines internal structure, such that the listener is
no longer informed about occurring events. |
void |
removeCoordinate(int index)
Removes the Coordinate at the index given by
index from the CompositeLines coordinates.
|
void |
removeCoordinates(int index1,
int index2)
Removes all Coordinates between the two indices given by
index1 and index2 from the
CompositeLines actual Coordinates. |
void |
removeVetoableCompositeLineListener(VetoableCompositeLineListener listener)
Removes the given VetoableCompositeLineListener from the
CompositeLines internal structure, such that the listener is
no longer informed about occurring events. |
void |
setCoordinateAt(int index,
Coordinate coordinate)
Sets the Coordinate given by coordinate at the
index given by index of the Composites current
coordinates.
|
void |
setCoordinates(Coordinate[] coordinates)
Sets the Coordinates given by coordinates as
the CompositeLines coordinates. |
void |
setEachPointInteractionAllowed(boolean allowEachPointInteraction)
Sets the state of the each-point-interaction flag to the value given by allowEachPointInteraction. |
void |
setEndingLocation(Coordinate coordinate)
Sets the Coordinate given by Coordinate as the
new ending coordinate of the CompositeLine. |
void |
setLabel(java.lang.String text)
Deprecated. use .setSignVisible() and .adjustGeometry() instead [NOTICE: method will be removed in the near future] |
void |
setLabel(Transform2D xform_context,
ScaleValues scalevalues,
java.lang.String text)
Deprecated. use .setSignVisible() and .adjustGeometry() instead [NOTICE: method will be removed in the near future] |
void |
setLabelPositioning(int positioning)
Deprecated. use .setSignAnchor() and/or .setSignPlacement() instead [NOTICE: method will be removed in the near future] |
void |
setLabelVisible(Transform2D xform_context,
ScaleValues scalevalues,
boolean visible)
Deprecated. use .setSignVisible() and .adjustGeometry() instead [NOTICE: method will be removed in the near future] |
void |
setMarkerBegin(MarkerFormat marker)
Sets the MarkerFormat given by marker as the
new MarkerFormat> used to draw a marker at the beginning
coordinate of the CompositeLine. |
void |
setMarkerEnd(MarkerFormat marker)
Sets the MarkerFormat given by marker as the
new MarkerFormat> used to draw a marker at the ending
coordinate of the CompositeLine. |
void |
setReferenceCoordinates(Coordinate[] coordinatesRef)
Sets the reference Coordinates given by coordinates as
the CompositeLines reference coordinates. |
void |
setSegmentTypes(int[] segmentTypesNew)
Sets the segment types for the PolygonLine to the values
given by segmentTypesNew. |
void |
setSign(Composite sign)
|
void |
setSignAnchor(int anchor)
|
void |
setSignPlacement(int placement)
|
void |
setSignVisible(boolean visible)
Sets the visibility state of the CompositeLine's sign to
the value given by visible. |
void |
setStartingLocation(Coordinate coordinate)
Sets the Coordinate given by coordinate as the
new starting coordinate of the CompositeLine. |
void |
setStroke(StrokeFormat stroke)
Sets the StrokeFormat given by stroke as the
new StrokeFormat used to draw the
CompositeLine. |
void |
setType(int type)
Sets the type of the line. |
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 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 |
getBoundingBox, getInteractionDescriptor, getMoveItem, hits, internalEnableSelection, internalSelect, internalSetSelected, isMovable, isSelectable, isSelected, mouseClick, mouseDown, mouseEnter, mouseExit, mouseUp, postActing, preActing, select, setMovable, setSelectable, setSelected, startAction, stopAction |
| Methods inherited from interface com.tensegrity.graphics.interaction.InteractableLine |
calculateCoordinates, getActionMode, isManipulable, setManipulable |
| Field Detail |
public static final int LABEL_POSITION_UNKNOWN
public static final int LABEL_POSITION_FREE
public static final int LABEL_POSITION_HEAD
public static final int LABEL_POSITION_HEAD_START
public static final int LABEL_POSITION_HEAD_END
public static final int LABEL_POSITION_TAIL
public static final int LABEL_POSITION_TAIL_START
public static final int LABEL_POSITION_TAIL_END
public static final int LABEL_POSITION_CENTER
public static final int LABEL_POSITION_CENTER_START
public static final int LABEL_POSITION_CENTER_END
public static final int SIGN_PLACEMENT_FREE
public static final int SIGN_PLACEMENT_HEAD
public static final int SIGN_PLACEMENT_CENTER
public static final int SIGN_PLACEMENT_TAIL
public static final int SIGN_ANCHOR_FREE
public static final int SIGN_ANCHOR_BEGIN
public static final int SIGN_ANCHOR_CENTER
public static final int SIGN_ANCHOR_END
public static final int TYPE_DYNAMIC
CompositeLine.
public static final int TYPE_STRAIGHT
CompositeLine.
public static final int TYPE_ORTHOGONAL
CompositeLine.
public static final int TYPE_CURVED
CompositeLine.
public static final int EVENT_MASK_CHANGE
BaseComposite.enableEvents(int) to turn them on and
BaseComposite.disableEvents(int) to turn them off.
public static final int EVENT_MASK_MANIPULATE
BaseComposite.enableEvents(int) to turn them on and
BaseComposite.disableEvents(int) to turn them off.
public static final int EVENT_MASK_MOVE
BaseComposite.enableEvents(int) to turn them on and
BaseComposite.disableEvents(int) to turn them off.
| Method Detail |
public int getType()
public void setType(int type)
TYPE_DYNAMIC,
TYPE_STRAIGHT, TYPE_ORTHOGONAL and
TYPE_POLYLINE.
type - the type to set.public boolean isEachPointInteractionAllowed()
boolean that indicates whether it is allowed for
the user to interact at each point of the CompositeLine
or not. In case that it is not allowed he can manipulate the
CompositeLine only at the starting and ending location.
In this case selection markers are also shown only for the starting and
ending location.
CompositeLinepublic void setEachPointInteractionAllowed(boolean allowEachPointInteraction)
allowEachPointInteraction.
allowEachPointInteraction - the new value for the
each-point-interaction flagpublic StrokeFormat getStroke()
StrokeFormat that is currently used to draw the
CompositeLine.
CompositeLinepublic void setStroke(StrokeFormat stroke)
StrokeFormat given by stroke as the
new StrokeFormat used to draw the
CompositeLine.
stroke - the new StrokeFormat for the
CompositeLinepublic MarkerFormat getMarkerBegin()
MarkerFormat that is currently used to draw a
marker at the beginning coordinate of the CompositeLine.
public void setMarkerBegin(MarkerFormat marker)
MarkerFormat given by marker as the
new MarkerFormat> used to draw a marker at the beginning
coordinate of the CompositeLine.
marker - the new MarkerFormat for the marker at the
beginning coordinatepublic MarkerFormat getMarkerEnd()
MarkerFormat that is currently used to draw a
marker at the ending coordinate of the CompositeLine.
public void setMarkerEnd(MarkerFormat marker)
MarkerFormat given by marker as the
new MarkerFormat> used to draw a marker at the ending
coordinate of the CompositeLine.
marker - the new MarkerFormat for the marker at the
ending coordinatepublic java.lang.String getLabel()
CompositeLine is the default sign.
null.public void setLabel(java.lang.String text)
CompositeLine is the default sign.
text - the text to set.
public void setLabel(Transform2D xform_context,
ScaleValues scalevalues,
java.lang.String text)
Tranform2D xform_context and with the given zoom-values.
xform_context - the Tranform2D to usescalevalues - the scale values for the different directions the
CompositeView has been set totext - the text to setpublic boolean isSignVisible()
boolean that indicates whether the current sign
of the CompositeLine is visible or not.
CompositeLine's sign is visible or not.public void setSignVisible(boolean visible)
CompositeLine's sign to
the value given by visible.
public Composite getSign()
public void setSign(Composite sign)
public void setLabelVisible(Transform2D xform_context,
ScaleValues scalevalues,
boolean visible)
xform_context - the Transform2D to usescalevalues - the scale values for the different directions the
CompositeView has been set tovisible - set to true, if the label should be visiblepublic int getLabelPositioning()
public void setLabelPositioning(int positioning)
positioning - the position to set.public int getSignAnchor()
public void setSignAnchor(int anchor)
public int getSignPlacement()
public void setSignPlacement(int placement)
public Coordinate getLabelLocation()
Coordinate.
Coordinate.public Size getLabelSize()
Size of the label.
Size of the label.public void layoutLabel(Coordinate location)
Coordinate.
location - the Coordinate.public Coordinate getStartingLocation()
Coordinate of the
CompositeLine.
The ending coordinate is the last Coordinate the
CompositeLine consists of (respectively the
CompositeLine starts at).
public void setStartingLocation(Coordinate coordinate)
Coordinate given by coordinate as the
new starting coordinate of the CompositeLine. The starting
coordinate is the first Coordinate the
CompositeLine consists of respectively the
CompositeLine starts.
coordinate - the new starting coordinate of the
CompositeLinepublic Coordinate getEndingLocation()
Coordinate of the
CompositeLine. The ending coordinate is the last
Coordinate the CompositeLine consists of
respectively the CompositeLine ends.
public void setEndingLocation(Coordinate coordinate)
Coordinate given by Coordinate as the
new ending coordinate of the CompositeLine. The
ending coordinate is the last Coordinate of the coordinates
the CompositeLine consists of respectively the
CompositeLine ends.
coordinate - the new ending coordinate of the
CompositeLinepublic Coordinate[] getCoordinates()
Coordinates the
CompositeLine consist of.
Coordinates the
CompositeLine actually consists ofpublic void setCoordinates(Coordinate[] coordinates)
Coordinates given by coordinates as
the CompositeLines coordinates. The old coordinates will be
removed.
coordinates - the coordinates to setpublic void setReferenceCoordinates(Coordinate[] coordinatesRef)
Coordinates given by coordinates as
the CompositeLines reference coordinates. The old coordinates will be
removed.
coordinatesRef - the reference coordinates to setpublic Coordinate[] getReferenceCoordinates()
Coordinates that represents the
reference coordinates the CompositeLine currently provides.
CompositeLine
CompositeLine currently providespublic int getCoordinateCount()
Coordinates the
CompositeLine consist of.
public Coordinate getCoordinateAt(int index)
Coordinate at the index given by
index from the CompositeLines current
coordinates.
If the index is less than zero or larger than the actual
count of Coordinates an exception will be thrown.
index - the index of the Coordinate to return
Coordinate at the given index
public void setCoordinateAt(int index,
Coordinate coordinate)
Coordinate given by coordinate at the
index given by index of the Composites current
coordinates.
If the index is less than zero or larger than the actual
count of Coordinates an exception will be thrown.
index - where to set the given Coordinate tocoordinate - the Coordinate to setpublic void addCoordinate(Coordinate coordinate)
Coordinate given by coordinate to the
end of the CompositeLines actual coordinates.
coordinate - the Coordinate to add
public void insertCoordinate(int index,
Coordinate coordinate)
Coordinate given by coordinate at
the index given by index. If the first index is less than
zero it is adjusted to zero. If the second index is larger than the
actual count of Coordinates it is adjusted to the actual
count of Coordinates
index - the index where to insert the Coordinatecoordinate - the Coordinate to insert
public void insertCoordinate(int index,
Coordinate coordinate,
Coordinate[] refCoordinate)
Coordinate given by coordinate at
the index given by index. If the first index is less than
zero it is adjusted to zero. If the second index is larger than the
actual count of Coordinates it is adjusted to the actual
count of Coordinates
index - the index where to insert the Coordinatecoordinate - the Coordinate to insertrefCoordinate - the reference Coordinates to insertpublic void removeCoordinate(int index)
Coordinate at the index given by
index from the CompositeLines coordinates.
If the index is less than zero or larger than the actual count of
Coordinates an exception will be thrown.
index - the index of the Coordinate to remove
public void removeCoordinates(int index1,
int index2)
Coordinates between the two indices given by
index1 and index2 from the
CompositeLines actual Coordinates. If the first
index is less than zero it is adjusted to zero. If the second index is
larger than the actual count of Coordinates it is adjusted
to the actual count of Coordinates
index1 - the index of the first Coordinate to removeindex2 - the index of the last Coordinate to remove
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 void setSegmentTypes(int[] segmentTypesNew)
PolygonLine to the values
given by segmentTypesNew. The supported segment types are
defined by
UtilitiesLine.LINEAR_SEGMENT,
UtilitiesLine.CUBIC_BEZIER_SEGMENT or
UtilitiesLine.CUBIC_CATMULL_ROM_SEGMENT.
segmentTypesNew - the new segment types for the CompositeLinepublic int[] getSegmentTypes()
CompositeLine currently provides.
The different segment types that are supported by the
CompositeLine are defined by the constants
UtilitiesLine.LINEAR_SEGMENT,
UtilitiesLine.CUBIC_BEZIER_SEGMENT or
UtilitiesLine.CUBIC_CATMULL_ROM_SEGMENT.
CompositeLinepublic CompositeLineState getState()
CompositeLineState instance that can be used to
reset the state of the CompositeLine to the state that is
stored into the CompositeLineState.
Composite
public void applyState(CompositeLineState state)
throws StateNotApplicableException
CompositeLineState given by state
to the CompositeLine. If the given state is not applicable
an exception is thrown.
state - the CompositeLineState instance that should be
applied to the CompositeLine
StateNotApplicableException - if the given
CompositeLineState can not be applied.public void addCompositeLineListener(CompositeLineListener listener)
CompositeLineListener to the
CompositeLines internal structure, such that the listener is
informed about every event that occurs.
listener - the CompositeLineListener to addpublic void removeCompositeLineListener(CompositeLineListener listener)
CompositeLineListener from the
CompositeLines internal structure, such that the listener is
no longer informed about occurring events.
listener - the CompositeLineListener to removepublic void addVetoableCompositeLineListener(VetoableCompositeLineListener listener)
VetoableCompositeLineListener to the
CompositeLines internal structure, such that the listener is
informed about every event that occurs.
listener - the VetoableCompositeLineListener to addpublic void removeVetoableCompositeLineListener(VetoableCompositeLineListener listener)
VetoableCompositeLineListener from the
CompositeLines internal structure, such that the listener is
no longer informed about occurring events.
listener - the VetoableCompositeLineListener to removepublic CompositeLine deepCopy()
CompositeLine. Each implementation is
responsible for providing the semantics of a deep copy in this method.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||