Package org.graphstream.ui.graphicGraph
Class GraphicSprite
java.lang.Object
org.graphstream.graph.implementations.AbstractElement
org.graphstream.ui.graphicGraph.GraphicElement
org.graphstream.ui.graphicGraph.GraphicSprite
- All Implemented Interfaces:
Element
public class GraphicSprite extends GraphicElement
A small gentle sprite.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.graphstream.ui.graphicGraph.GraphicElement
GraphicElement.SwingElementRendererNested classes/interfaces inherited from class org.graphstream.graph.implementations.AbstractElement
AbstractElement.AttributeChangeEvent -
Field Summary
Fields inherited from class org.graphstream.ui.graphicGraph.GraphicElement
component, hidden, label, style -
Constructor Summary
Constructors Constructor Description GraphicSprite(String id, GraphicGraph graph)New sprite. -
Method Summary
Modifier and Type Method Description voidattachToEdge(GraphicEdge edge)Attach this sprite to the given edge.voidattachToNode(GraphicNode node)Attach this sprite to the given node.voiddetach()Detach this sprite from the edge or node it was attached to.GraphicElementgetAttachment()Return the graphic object this sprite is attached to or null if not attached.GraphicEdgegetEdgeAttachment()The edge this sprite is attached to or null if not attached to an edge.GraphicNodegetNodeAttachment()The node this sprite is attached to or null if not attached to an edge.Selector.TypegetSelectorType()Type of selector for the graphic element (Node, Edge, Sprite ?).StyleConstants.UnitsgetUnits()doublegetX()Abscissa of the element, always in GU (graph units).doublegetY()Ordinate of the element, always in GU (graph units).doublegetZ()Depth of the element, always in GU (graph units).booleanisAttached()True if the sprite is attached to a node or edge.booleanisAttachedToEdge()True if the node is attached to an edge.booleanisAttachedToNode()True if the sprite is attached to a node.voidmove(double x, double y, double z)Try to force the element to move at the give location in graph units (GU).voidsetPosition(double value)Reposition this sprite.voidsetPosition(double x, double y, double z, StyleConstants.Units units)Reposition this sprite.voidsetPosition(Values values)Methods inherited from class org.graphstream.ui.graphicGraph.GraphicElement
getComponent, getLabel, getStyle, myGraph, setAttribute, setComponentMethods inherited from class org.graphstream.graph.implementations.AbstractElement
attributeKeys, clearAttributes, getAttribute, getAttribute, getAttributeCount, getFirstAttributeOf, getFirstAttributeOf, getId, getIndex, hasAttribute, hasAttribute, removeAttribute, toString
-
Field Details
-
position
Sprite position.
-
-
Constructor Details
-
GraphicSprite
New sprite.- Parameters:
id- The sprite unique identifier.graph- The graph containing this sprite.
-
-
Method Details
-
getNodeAttachment
The node this sprite is attached to or null if not attached to an edge.- Returns:
- A graphic node.
-
getEdgeAttachment
The edge this sprite is attached to or null if not attached to an edge.- Returns:
- A graphic edge.
-
getAttachment
Return the graphic object this sprite is attached to or null if not attached.- Returns:
- A graphic object or null if no attachment.
-
isAttached
public boolean isAttached()True if the sprite is attached to a node or edge. -
isAttachedToNode
public boolean isAttachedToNode()True if the sprite is attached to a node. -
isAttachedToEdge
public boolean isAttachedToEdge()True if the node is attached to an edge. -
getSelectorType
Description copied from class:GraphicElementType of selector for the graphic element (Node, Edge, Sprite ?).- Specified by:
getSelectorTypein classGraphicElement
-
getX
public double getX()Description copied from class:GraphicElementAbscissa of the element, always in GU (graph units). For edges this is the X of the "from" node.- Specified by:
getXin classGraphicElement
-
getY
public double getY()Description copied from class:GraphicElementOrdinate of the element, always in GU (graph units). For edges this is the Y of the "from" node.- Specified by:
getYin classGraphicElement
-
getZ
public double getZ()Description copied from class:GraphicElementDepth of the element, always in GU (graph units). For edges this is the Z of the "from" node.- Specified by:
getZin classGraphicElement
-
getUnits
-
move
public void move(double x, double y, double z)Description copied from class:GraphicElementTry to force the element to move at the give location in graph units (GU). For edges, this may move the two attached nodes.- Specified by:
movein classGraphicElement- Parameters:
x- The new X.y- The new Y.z- the new Z.
-
attachToNode
Attach this sprite to the given node.- Parameters:
node- A graphic node.
-
attachToEdge
Attach this sprite to the given edge.- Parameters:
edge- A graphic edge.
-
detach
public void detach()Detach this sprite from the edge or node it was attached to. -
setPosition
public void setPosition(double value)Reposition this sprite.- Parameters:
value- The coordinate.
-
setPosition
Reposition this sprite.- Parameters:
x- First coordinate.y- Second coordinate.z- Third coordinate.units- The units to use for lengths and radii, null means "unchanged".
-
setPosition
-