edu.uci.ics.jung.visualization.picking
Class ViewLensShapePickSupport<V,E>

java.lang.Object
  extended by edu.uci.ics.jung.visualization.picking.ShapePickSupport<V,E>
      extended by edu.uci.ics.jung.visualization.picking.ViewLensShapePickSupport<V,E>
All Implemented Interfaces:
GraphElementAccessor<V,E>

public class ViewLensShapePickSupport<V,E>
extends ShapePickSupport<V,E>
implements GraphElementAccessor<V,E>

ShapePickSupport provides access to Vertices and EdgeType based on their actual shapes.

Author:
Tom Nelson

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.uci.ics.jung.visualization.picking.ShapePickSupport
ShapePickSupport.Style
 
Field Summary
 
Fields inherited from class edu.uci.ics.jung.visualization.picking.ShapePickSupport
pickSize, style, vv
 
Constructor Summary
ViewLensShapePickSupport(VisualizationServer<V,E> vv)
          Create an instance.
ViewLensShapePickSupport(VisualizationServer<V,E> vv, float pickSize)
          Create an instance.
 
Method Summary
 E getEdge(Layout<V,E> layout, double x, double y)
          return an edge whose shape intersects the 'pickArea' footprint of the passed x,y, coordinates.
 V getVertex(Layout<V,E> layout, double x, double y)
          Iterates over Vertices, checking to see if x,y is contained in the Vertex's Shape.
 Collection<V> getVertices(Layout<V,E> layout, Shape rectangle)
          returns the vertices that are contained in the passed shape.
 
Methods inherited from class edu.uci.ics.jung.visualization.picking.ShapePickSupport
edgesAreFiltered, getFilteredEdges, getFilteredVertices, getPickSize, getStyle, isEdgeRendered, isVertexRendered, setPickSize, setStyle, verticesAreFiltered
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ViewLensShapePickSupport

public ViewLensShapePickSupport(VisualizationServer<V,E> vv,
                                float pickSize)
Create an instance. The HasGraphLayout is used as the source of the current Graph Layout. The HasShapes is used to access the VertexShapes and the EdgeShapes

Parameters:
hasGraphLayout - source of the current layout.
hasShapeFunctions - source of Vertex and Edge shapes.
pickSize - how large to make the pick footprint for line edges

ViewLensShapePickSupport

public ViewLensShapePickSupport(VisualizationServer<V,E> vv)
Create an instance. The pickSize footprint defaults to 2.

Method Detail

getVertex

public V getVertex(Layout<V,E> layout,
                   double x,
                   double y)
Iterates over Vertices, checking to see if x,y is contained in the Vertex's Shape. If (x,y) is contained in more than one vertex, use the vertex whose center is closest to the pick point.

Specified by:
getVertex in interface GraphElementAccessor<V,E>
Overrides:
getVertex in class ShapePickSupport<V,E>
See Also:
edu.uci.ics.jung.visualization.picking.PickSupport#getVertex(double, double)

getVertices

public Collection<V> getVertices(Layout<V,E> layout,
                                 Shape rectangle)
returns the vertices that are contained in the passed shape. The shape is in screen coordinates, and the graph vertices are transformed to screen coordinates before they are tested for inclusion

Specified by:
getVertices in interface GraphElementAccessor<V,E>
Overrides:
getVertices in class ShapePickSupport<V,E>
Returns:
the Collection of vertices whose layout coordinates are contained in shape.

getEdge

public E getEdge(Layout<V,E> layout,
                 double x,
                 double y)
return an edge whose shape intersects the 'pickArea' footprint of the passed x,y, coordinates.

Specified by:
getEdge in interface GraphElementAccessor<V,E>
Overrides:
getEdge in class ShapePickSupport<V,E>


Copyright © 2009. All Rights Reserved.