Class GeometryItemDistance
- java.lang.Object
-
- org.locationtech.jts.index.strtree.GeometryItemDistance
-
- All Implemented Interfaces:
ItemDistance
public class GeometryItemDistance extends Object implements ItemDistance
AnItemDistancefunction for items which areGeometrys, using theGeometry.distance(Geometry)method.To make this distance function suitable for using to query a single index tree, the distance metric is anti-reflexive. That is, if the two arguments are the same Geometry object, the distance returned is
Double.MAX_VALUE.- Author:
- Martin Davis
-
-
Constructor Summary
Constructors Constructor Description GeometryItemDistance()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubledistance(ItemBoundable item1, ItemBoundable item2)Computes the distance between twoGeometryitems, using theGeometry.distance(Geometry)method.
-
-
-
Method Detail
-
distance
public double distance(ItemBoundable item1, ItemBoundable item2)
Computes the distance between twoGeometryitems, using theGeometry.distance(Geometry)method.- Specified by:
distancein interfaceItemDistance- Parameters:
item1- an item which is a Geometryitem2- an item which is a Geometry- Returns:
- the distance between the geometries
- Throws:
ClassCastException- if either item is not a Geometry
-
-