| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
package org.locationtech.jts.index.strtree; |
| 14 |
|
| 15 |
|
| 16 |
/** |
| 17 |
* A function method which computes the distance |
| 18 |
* between two {@link ItemBoundable}s in an {@link STRtree}. |
| 19 |
* Used for Nearest Neighbour searches. |
| 20 |
* <p> |
| 21 |
* To make a distance function suitable for |
| 22 |
* querying a single index tree |
| 23 |
* via {@link STRtree#nearestNeighbour(ItemDistance)} , |
| 24 |
* the function should have a non-zero <i>reflexive distance</i>. |
| 25 |
* That is, if the two arguments are the same object, |
| 26 |
* the distance returned should be non-zero. |
| 27 |
* If it is required that only pairs of <b>distinct</b> items be returned, |
| 28 |
* the distance function must be <i>anti-reflexive</i>, |
| 29 |
* and must return {@link Double#MAX_VALUE} for identical arguments. |
| 30 |
* |
| 31 |
* @author Martin Davis |
| 32 |
* |
| 33 |
*/ |
| 34 |
public interface ItemDistance |
| 35 |
{ |
| 36 |
/** |
| 37 |
* Computes the distance between two items. |
| 38 |
* |
| 39 |
* @param item1 |
| 40 |
* @param item2 |
| 41 |
* @return the distance between the items |
| 42 |
* |
| 43 |
* @throws IllegalArgumentException if the metric is not applicable to the arguments |
| 44 |
*/ |
| 45 |
double distance(ItemBoundable item1, ItemBoundable item2); |
| 46 |
|
| 47 |
} |
| 48 |
|