org.graphstream.ui.graphicGraph
Class GraphicSprite

java.lang.Object
  extended by org.graphstream.graph.implementations.AbstractElement
      extended by org.graphstream.ui.graphicGraph.GraphicElement
          extended by 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.SwingElementRenderer
 
Nested classes/interfaces inherited from class org.graphstream.graph.implementations.AbstractElement
AbstractElement.AttributeChangeEvent
 
Field Summary
 Values position
          Sprite position.
 
Fields inherited from class org.graphstream.ui.graphicGraph.GraphicElement
component, hidden, label, style
 
Constructor Summary
GraphicSprite(String id, GraphicGraph graph)
          New sprite.
 
Method Summary
 void attachToEdge(GraphicEdge edge)
          Attach this sprite to the given edge.
 void attachToNode(GraphicNode node)
          Attach this sprite to the given node.
 void detach()
          Detach this sprite from the edge or node it was attached to.
 GraphicElement getAttachment()
          Return the graphic object this sprite is attached to or null if not attached.
 GraphicEdge getEdgeAttachment()
          The edge this sprite is attached to or null if not attached to an edge.
 GraphicNode getNodeAttachment()
          The node this sprite is attached to or null if not attached to an edge.
 Selector.Type getSelectorType()
          Type of selector for the graphic element (Node, Edge, Sprite ?).
 StyleConstants.Units getUnits()
           
 double getX()
          Abscissa of the element, always in GU (graph units).
 double getY()
          Ordinate of the element, always in GU (graph units).
 double getZ()
          Depth of the element, always in GU (graph units).
 boolean isAttached()
          True if the sprite is attached to a node or edge.
 boolean isAttachedToEdge()
          True if the node is attached to an edge.
 boolean isAttachedToNode()
          True if the sprite is attached to a node.
 void move(double x, double y, double z)
          Try to force the element to move at the give location in graph units (GU).
 void setPosition(double value)
          Reposition this sprite.
 void setPosition(double x, double y, double z, StyleConstants.Units units)
          Reposition this sprite.
 void setPosition(Values values)
           
 
Methods inherited from class org.graphstream.ui.graphicGraph.GraphicElement
addAttribute, getComponent, getLabel, getStyle, myGraph, setComponent
 
Methods inherited from class org.graphstream.graph.implementations.AbstractElement
addAttributes, changeAttribute, clearAttributes, getArray, getAttribute, getAttribute, getAttributeCount, getAttributeKeyIterator, getAttributeKeySet, getEachAttributeKey, getFirstAttributeOf, getFirstAttributeOf, getHash, getId, getIndex, getLabel, getNumber, getVector, hasArray, hasAttribute, hasAttribute, hasHash, hasLabel, hasNumber, hasVector, removeAttribute, setAttribute, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

position

public Values position
Sprite position.

Constructor Detail

GraphicSprite

public GraphicSprite(String id,
                     GraphicGraph graph)
New sprite.

Parameters:
id - The sprite unique identifier.
graph - The graph containing this sprite.
Method Detail

getNodeAttachment

public GraphicNode getNodeAttachment()
The node this sprite is attached to or null if not attached to an edge.

Returns:
A graphic node.

getEdgeAttachment

public GraphicEdge getEdgeAttachment()
The edge this sprite is attached to or null if not attached to an edge.

Returns:
A graphic edge.

getAttachment

public GraphicElement 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

public Selector.Type getSelectorType()
Description copied from class: GraphicElement
Type of selector for the graphic element (Node, Edge, Sprite ?).

Specified by:
getSelectorType in class GraphicElement

getX

public double getX()
Description copied from class: GraphicElement
Abscissa of the element, always in GU (graph units). For edges this is the X of the "from" node.

Specified by:
getX in class GraphicElement

getY

public double getY()
Description copied from class: GraphicElement
Ordinate of the element, always in GU (graph units). For edges this is the Y of the "from" node.

Specified by:
getY in class GraphicElement

getZ

public double getZ()
Description copied from class: GraphicElement
Depth of the element, always in GU (graph units). For edges this is the Z of the "from" node.

Specified by:
getZ in class GraphicElement

getUnits

public StyleConstants.Units getUnits()

move

public void move(double x,
                 double y,
                 double z)
Description copied from class: GraphicElement
Try 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:
move in class GraphicElement
Parameters:
x - The new X.
y - The new Y.
z - the new Z.

attachToNode

public void attachToNode(GraphicNode node)
Attach this sprite to the given node.

Parameters:
node - A graphic node.

attachToEdge

public void attachToEdge(GraphicEdge edge)
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

public void setPosition(double x,
                        double y,
                        double z,
                        StyleConstants.Units units)
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

public void setPosition(Values values)


Copyright © 2011. All Rights Reserved.