edu.uci.ics.jung.visualization
Class RadiusPickSupport

java.lang.Object
  extended by edu.uci.ics.jung.visualization.RadiusGraphElementAccessor
      extended by edu.uci.ics.jung.visualization.RadiusPickSupport
All Implemented Interfaces:
GraphElementAccessor, PickSupport

public class RadiusPickSupport
extends RadiusGraphElementAccessor
implements PickSupport

Simple implementation of PickSupport that returns the vertex or edge that is closest to the specified location. This implementation provides the same picking options that were available in previous versions of AbstractLayout.

Author:
Tom Nelson, Joshua O'Madadhain

Field Summary
protected  HasGraphLayout hasGraphLayout
           
 
Fields inherited from class edu.uci.ics.jung.visualization.RadiusGraphElementAccessor
layout, maxDistance
 
Constructor Summary
RadiusPickSupport()
           
RadiusPickSupport(double maxDistance)
          the layout will always be provided by the VisualizationViewer this is supporting picking for
RadiusPickSupport(HasGraphLayout hasGraphLayout, double maxDistance)
           
 
Method Summary
 Edge getEdge(double x, double y)
          Gets the edge nearest to the location of the (x,y) location selected.
 Edge getEdge(double x, double y, double maxDistance)
          Gets the edge nearest to the location of the (x,y) location selected, within a distance of maxDistance, Iterates through all visible edges and checks their distance from the click.
 Vertex getVertex(double x, double y)
          Gets the vertex nearest to the location of the (x,y) location selected, within a distance of maxDistance.
 Vertex getVertex(double x, double y, double maxDistance)
          Gets the vertex nearest to the location of the (x,y) location selected, within a distance of maxDistance.
 void setHasGraphLayout(HasGraphLayout hasGraphLayout)
          called by VisualizationViewer when this PickSupport impl is added to VisualizationViewer.
 
Methods inherited from class edu.uci.ics.jung.visualization.RadiusGraphElementAccessor
setLayout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.uci.ics.jung.visualization.GraphElementAccessor
setLayout
 

Field Detail

hasGraphLayout

protected HasGraphLayout hasGraphLayout
Constructor Detail

RadiusPickSupport

public RadiusPickSupport(HasGraphLayout hasGraphLayout,
                         double maxDistance)

RadiusPickSupport

public RadiusPickSupport()

RadiusPickSupport

public RadiusPickSupport(double maxDistance)
the layout will always be provided by the VisualizationViewer this is supporting picking for

Parameters:
maxDistance -
Method Detail

setHasGraphLayout

public void setHasGraphLayout(HasGraphLayout hasGraphLayout)
called by VisualizationViewer when this PickSupport impl is added to VisualizationViewer. This allows the PickSupport to always get the current Layout from the VisualizationViewer it supports picking on.

Specified by:
setHasGraphLayout in interface PickSupport

getVertex

public Vertex getVertex(double x,
                        double y)
Gets the vertex nearest to the location of the (x,y) location selected, within a distance of maxDistance. Iterates through all visible vertices and checks their distance from the click. Override this method to provde a more efficient implementation.

Specified by:
getVertex in interface GraphElementAccessor
Overrides:
getVertex in class RadiusGraphElementAccessor

getVertex

public Vertex getVertex(double x,
                        double y,
                        double maxDistance)
Gets the vertex nearest to the location of the (x,y) location selected, within a distance of maxDistance. Iterates through all visible vertices and checks their distance from the click. Override this method to provde a more efficient implementation.

Overrides:
getVertex in class RadiusGraphElementAccessor
Parameters:
x -
y -
maxDistance - temporarily overrides member maxDistance

getEdge

public Edge getEdge(double x,
                    double y)
Gets the edge nearest to the location of the (x,y) location selected. Calls the longer form of the call.

Specified by:
getEdge in interface GraphElementAccessor
Overrides:
getEdge in class RadiusGraphElementAccessor

getEdge

public Edge getEdge(double x,
                    double y,
                    double maxDistance)
Gets the edge nearest to the location of the (x,y) location selected, within a distance of maxDistance, Iterates through all visible edges and checks their distance from the click. Override this method to provide a more efficient implementation.

Overrides:
getEdge in class RadiusGraphElementAccessor
Parameters:
x -
y -
maxDistance - temporarily overrides member maxDistance
Returns:
Edge closest to the click.