Class RadiusGraphElementAccessor<V,E>
java.lang.Object
edu.uci.ics.jung.algorithms.layout.RadiusGraphElementAccessor<V,E>
- All Implemented Interfaces:
GraphElementAccessor<V,
E>
- Direct Known Subclasses:
RadiusPickSupport
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.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance with an effectively infinite default maximum distance.RadiusGraphElementAccessor
(double maxDistance) Creates an instance with the specified default maximum distance. -
Method Summary
Modifier and TypeMethodDescriptionGets the vertex nearest to the location of the (x,y) location selected, whose endpoints are <maxDistance
.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 ofmaxDistance
.getVertices
(Layout<V, E> layout, Shape rectangle)
-
Field Details
-
maxDistance
protected double maxDistance
-
-
Constructor Details
-
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.- Parameters:
maxDistance
- the maximum distance at which any element can be from a specified location and still be returned
-
-
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> - 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 ofmaxDistance
. Iterates through all visible vertices and checks their distance from the location. Override this method to provide a more efficient implementation.- Parameters:
layout
- the context in which the location is definedx
- the x coordinate of the locationy
- the y coordinate of the locationmaxDistance
- the maximum distance at which any element can be from a specified location and still be returned- Returns:
- a vertex which is associated with the location
(x,y)
as given bylayout
-
getVertices
- Specified by:
getVertices
in interfaceGraphElementAccessor<V,
E> - Parameters:
layout
- the layout instance that records the positions for all verticesrectangle
- the region in which the returned vertices are located- Returns:
- the vertices whose locations given by
layout
are contained withinrectangle
-
getEdge
- Specified by:
getEdge
in interfaceGraphElementAccessor<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:
- an edge which is associated with the location
(x,y)
as given bylayout
, generally by reference to the edge's endpoints
-
getEdge
Gets the vertex nearest to the location of the (x,y) location selected, whose endpoints are <maxDistance
. Iterates through all visible vertices and checks their distance from the location. Override this method to provide a more efficient implementation.- Parameters:
layout
- the context in which the location is definedx
- the x coordinate of the locationy
- the y coordinate of the locationmaxDistance
- the maximum distance at which any element can be from a specified location and still be returned- Returns:
- an edge which is associated with the location
(x,y)
as given bylayout
-