Class RadiusPickSupport<V,E>
java.lang.Object
edu.uci.ics.jung.algorithms.layout.RadiusGraphElementAccessor<V,E>
edu.uci.ics.jung.visualization.picking.RadiusPickSupport<V,E>
- All Implemented Interfaces:
GraphElementAccessor<V,
E>
public class RadiusPickSupport<V,E>
extends RadiusGraphElementAccessor<V,E>
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.
-
Field Summary
Fields inherited from class edu.uci.ics.jung.algorithms.layout.RadiusGraphElementAccessor
maxDistance
-
Constructor Summary
ConstructorsConstructorDescriptionRadiusPickSupport
(double maxDistance) Creates an instance with the specified maximum distance. -
Method Summary
Modifier and TypeMethodDescriptionGets the edge nearest to the location of the (x,y) location selected.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.Gets the vertex nearest to the location of the (x,y) location selected, within a distance of maxDistance.Gets the vertex nearest to the location of the (x,y) location selected, within a distance of maxDistance.Methods inherited from class edu.uci.ics.jung.algorithms.layout.RadiusGraphElementAccessor
getVertices
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.algorithms.layout.GraphElementAccessor
getVertices
-
Constructor Details
-
RadiusPickSupport
public RadiusPickSupport() -
RadiusPickSupport
public RadiusPickSupport(double maxDistance) Creates an instance with the specified maximum distance.- Parameters:
maxDistance
- the farthest that a vertex can be from the selection point and still be 'picked'
-
-
Method Details
-
getVertex
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 provide a more efficient implementation.- Specified by:
getVertex
in interfaceGraphElementAccessor<V,
E> - Overrides:
getVertex
in classRadiusGraphElementAccessor<V,
E> - Parameters:
layout
- the context in which the location is definedx
- the x coordinate of the locationy
- the y coordinate of the location- Returns:
- a vertex which is associated with the location
(x,y)
as given bylayout
-
getVertex
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 provide a more efficient implementation.- Overrides:
getVertex
in classRadiusGraphElementAccessor<V,
E> - Parameters:
layout
- the layout instance that records the positions for all verticesx
- the x coordinate of the pick pointy
- the y coordinate of the pick pointmaxDistance
- vertices whose from (x, y) is > this cannot be returned- Returns:
- the vertex whose center is closest to the pick point (x, y)
-
getEdge
Gets the edge nearest to the location of the (x,y) location selected. Calls the longer form of the call.- Specified by:
getEdge
in interfaceGraphElementAccessor<V,
E> - Overrides:
getEdge
in classRadiusGraphElementAccessor<V,
E> - Parameters:
layout
- the layout instance that records the positions for all verticesx
- the x coordinate of the pick pointy
- the y coordinate of the pick point- Returns:
- the vertex whose center is closest to the pick point (x, y)
-
getEdge
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 classRadiusGraphElementAccessor<V,
E> - Parameters:
layout
- the context in which the location is definedx
- the x coordinate of the pick pointy
- the y coordinate of the pick pointmaxDistance
- vertices whose from (x, y) is > this cannot be returned- Returns:
- Edge closest to the click.
-