public class Selection extends Object
In particular, every selection starts with a SceneGraphPath
.
Adding an object which is not an instance of SceneGraphNode to the selection's path defines the end of the contained
SceneGraphPath, i.e any objects added subsequently are not treated as part of the SceneGraphPath.
Selections can be constructed from an existing SceneGraphPaths by using Selection(SceneGraphPath)
and truncated to a SceneGraphPath using getSGPath()
.
Constructor and Description |
---|
Selection()
Default constructor, starts with an empty selection path
|
Selection(SceneGraphPath path)
Constructs a selection object from the given SceneGraphPath
|
Selection(Selection s)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
SceneGraphComponent |
asComponent()
Returns the selected component if the current selection is a
SceneGraphComponent , null otherwise |
AttributeEntity |
asEntity()
Returns the selected entity if the current selection is an
AttributeEntity , null otherwise |
SceneGraphNode |
asNode()
Returns the selected node if the current selection is a
SceneGraphNode , null otherwise |
Tool |
asTool()
Returns the selected tool if the current selection is a
Tool , null otherwise |
void |
clear()
Clear the selection's path
|
boolean |
equals(Object s) |
SceneGraphNode |
getFirstElement()
Get the first element of the selection's path.
Note that selections always start with a SceneGraphPath . |
SceneGraphComponent |
getLastComponent() |
Object |
getLastElement() |
SceneGraphNode |
getLastNode() |
int |
getLength() |
SceneGraphPath |
getSGPath()
Truncates the selection to SceneGraphNodes.
|
int |
hashCode() |
boolean |
isComponent()
Returns true iff a
SceneGraphComponent was selected |
boolean |
isEntity()
Returns true iff an
AttributeEntity was selected |
boolean |
isEqual(Selection anotherSelection) |
boolean |
isNode()
Returns true iff a
SceneGraphNode was selected |
boolean |
isSGPath()
Returns true iff the selection corresponds to a SceneGraphPath,
i.e.
|
boolean |
isTool()
Returns true iff a
Tool was selected |
ListIterator<Object> |
iterator() |
ListIterator<Object> |
iterator(int start) |
void |
pop() |
void |
push(Object o)
When pushing a SceneGraphNode, this method treats it as part of the SceneGraphPath the selection's path starts with
if no other object was pushed before.
|
Iterator |
reverseIterator() |
Iterator |
reverseIterator(int start) |
List<Object> |
toList() |
String |
toString() |
public Selection()
public Selection(Selection s)
public Selection(SceneGraphPath path)
public void clear()
public final void push(Object o)
public final void pop()
public SceneGraphNode getFirstElement()
SceneGraphPath
.public SceneGraphPath getSGPath()
public SceneGraphComponent getLastComponent()
public SceneGraphNode getLastNode()
public Object getLastElement()
public boolean isSGPath()
public int getLength()
public boolean isEqual(Selection anotherSelection)
public ListIterator<Object> iterator()
public ListIterator<Object> iterator(int start)
public Iterator reverseIterator()
public Iterator reverseIterator(int start)
public boolean isTool()
Tool
was selectedpublic Tool asTool()
Tool
, null
otherwisepublic boolean isComponent()
SceneGraphComponent
was selectedpublic SceneGraphComponent asComponent()
SceneGraphComponent
, null
otherwisepublic boolean isNode()
SceneGraphNode
was selectedpublic SceneGraphNode asNode()
SceneGraphNode
, null
otherwisepublic boolean isEntity()
AttributeEntity
was selectedpublic AttributeEntity asEntity()
AttributeEntity
, null
otherwise