public class RadiusGraphElementAccessor<V,E> extends Object implements GraphElementAccessor<V,E>
No element will be returned that is farther away than the specified maximum distance.
Modifier and Type | Field and Description |
---|---|
protected double |
maxDistance |
Constructor and Description |
---|
RadiusGraphElementAccessor()
Creates an instance with an effectively infinite default maximum distance.
|
RadiusGraphElementAccessor(double maxDistance)
Creates an instance with the specified default maximum distance.
|
Modifier and Type | Method and Description |
---|---|
E |
getEdge(Layout<V,E> layout,
double x,
double y) |
E |
getEdge(Layout<V,E> layout,
double x,
double y,
double maxDistance)
Gets the vertex nearest to the location of the (x,y) location selected,
whose endpoints are <
maxDistance . |
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) |
public RadiusGraphElementAccessor()
public RadiusGraphElementAccessor(double maxDistance)
maxDistance
- the maximum distance at which any element can be from a specified location
and still be returnedpublic V getVertex(Layout<V,E> layout, double x, double y)
getVertex
in interface GraphElementAccessor<V,E>
layout
- the context in which the location is definedx
- the x coordinate of the locationy
- the y coordinate of the location(x,y)
as given by layout
public V getVertex(Layout<V,E> layout, double x, double y, double maxDistance)
maxDistance
. Iterates through all
visible vertices and checks their distance from the location. Override this
method to provide a more efficient implementation.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(x,y)
as given by layout
public Collection<V> getVertices(Layout<V,E> layout, Shape rectangle)
getVertices
in interface GraphElementAccessor<V,E>
layout
- the layout instance that records the positions for all verticesrectangle
- the region in which the returned vertices are locatedlayout
are contained within rectangle
public E getEdge(Layout<V,E> layout, double x, double y)
getEdge
in interface GraphElementAccessor<V,E>
layout
- the context in which the location is definedx
- the x coordinate of the locationy
- the y coordinate of the location(x,y)
as given by layout
, generally by reference to the edge's endpointspublic E getEdge(Layout<V,E> layout, double x, double y, double maxDistance)
maxDistance
. Iterates through all
visible vertices and checks their distance from the location. Override this
method to provide a more efficient implementation.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(x,y)
as given by layout
Copyright © 2015. All rights reserved.