edu.uci.ics.jung.algorithms.layout
Class RadiusGraphElementAccessor<V,E>

java.lang.Object
  extended by edu.uci.ics.jung.algorithms.layout.RadiusGraphElementAccessor<V,E>
All Implemented Interfaces:
GraphElementAccessor<V,E>
Direct Known Subclasses:
RadiusPickSupport

public class RadiusGraphElementAccessor<V,E>
extends Object
implements GraphElementAccessor<V,E>

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.

No element will be returned that is farther away than the specified maximum distance.

Author:
Tom Nelson, Joshua O'Madadhain

Field Summary
protected  double maxDistance
           
 
Constructor Summary
RadiusGraphElementAccessor()
          Creates an instance with an effectively infinite default maximum distance.
RadiusGraphElementAccessor(double maxDistance)
          Creates an instance with the specified default maximum distance.
 
Method Summary
 E getEdge(Layout<V,E> layout, double x, double y)
          Gets the edge nearest to the location of the (x,y) location selected.
 E getEdge(Layout<V,E> layout, 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.
 V getVertex(Layout<V,E> layout, double x, double y)
          Gets the vertex nearest to the location of the (x,y) location selected, within a distance of maxDistance.
 V getVertex(Layout<V,E> layout, double x, double y, double maxDistance)
          Gets the vertex nearest to the location of the (x,y) location selected, within a distance of maxDistance.
 Collection<V> getVertices(Layout<V,E> layout, Shape rectangle)
          Returns the vertices contained within rectangle relative to layout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxDistance

protected double maxDistance
Constructor Detail

RadiusGraphElementAccessor

public RadiusGraphElementAccessor()
Creates an instance with an effectively infinite default maximum distance.


RadiusGraphElementAccessor

public RadiusGraphElementAccessor(double maxDistance)
Creates an instance with the specified default maximum distance.

Method Detail

getVertex

public V getVertex(Layout<V,E> layout,
                   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<V,E>

getVertex

public V getVertex(Layout<V,E> layout,
                   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.

Parameters:
x -
y -
maxDistance - temporarily overrides member maxDistance

getVertices

public Collection<V> getVertices(Layout<V,E> layout,
                                 Shape rectangle)
Description copied from interface: GraphElementAccessor
Returns the vertices contained within rectangle relative to layout.

Specified by:
getVertices in interface GraphElementAccessor<V,E>

getEdge

public E getEdge(Layout<V,E> layout,
                 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<V,E>

getEdge

public E getEdge(Layout<V,E> layout,
                 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.

Parameters:
x -
y -
maxDistance - temporarily overrides member maxDistance
Returns:
Edge closest to the click.


Copyright © 2009. All Rights Reserved.