public class LocationIndexTree extends Object implements LocationIndex
All leafs are at the same depth, otherwise it is quite complicated to calculate the Bresenham line for different resolutions, especially if a leaf node could be split into a tree-node and resolution changes.
| Modifier and Type | Class and Description |
|---|---|
protected class |
LocationIndexTree.XFirstSearchCheck
Make it possible to collect nearby location also for other purposes.
|
| Modifier and Type | Field and Description |
|---|---|
protected DistanceCalc |
distCalc |
protected Graph |
graph |
protected SpatialKeyAlgo |
keyAlgo |
| Constructor and Description |
|---|
LocationIndexTree(Graph g,
Directory dir) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
This method makes sure that the underlying used resources are released.
|
LocationIndexTree |
create(long size)
Creates the underlying storage.
|
QueryResult |
findClosest(double queryLat,
double queryLon,
EdgeFilter edgeFilter)
This method returns the closest QueryResult for the specified location (lat, lon) and only if
the filter accepts the edge as valid candidate (e.g.
|
List<QueryResult> |
findNClosest(double queryLat,
double queryLon,
EdgeFilter edgeFilter,
double radius)
Returns all edges that are within the specified radius around the queried position.
|
boolean |
findNetworkEntries(double queryLat,
double queryLon,
GHIntHashSet foundEntries,
int iteration)
This method collects the node indices from the quad tree data structure in a certain order
which makes sure not too many nodes are collected as well as no nodes will be missing.
|
void |
findNetworkEntriesSingleRegion(GHIntHashSet storedNetworkEntryIds,
double queryLat,
double queryLon) |
void |
flush()
This method makes sure that the underlying data is written to the storage.
|
long |
getCapacity() |
double |
getDeltaLat()
Provide info about tilesize for testing / visualization
|
double |
getDeltaLon() |
int |
getMinResolutionInMeter() |
boolean |
isClosed() |
boolean |
loadExisting() |
LocationIndex |
prepareIndex()
Creates this index - to be called once before findID.
|
LocationIndex |
setApproximation(boolean approx) |
LocationIndexTree |
setMaxRegionSearch(int numTiles)
Searches also neighbouring tiles until the maximum distance from the query point is reached
(minResolutionInMeter*regionAround).
|
LocationIndexTree |
setMinResolutionInMeter(int minResolutionInMeter)
Minimum width in meter of one tile.
|
LocationIndex |
setResolution(int minResolutionInMeter)
Integer value to specify the resolution of this location index.
|
void |
setSegmentSize(int bytes) |
protected final Graph graph
protected DistanceCalc distCalc
protected SpatialKeyAlgo keyAlgo
public int getMinResolutionInMeter()
public LocationIndexTree setMinResolutionInMeter(int minResolutionInMeter)
public LocationIndexTree setMaxRegionSearch(int numTiles)
public LocationIndex setResolution(int minResolutionInMeter)
LocationIndexsetResolution in interface LocationIndexpublic LocationIndex setApproximation(boolean approx)
setApproximation in interface LocationIndexapprox - false if initialization and querying should be faster but less precise.public LocationIndexTree create(long size)
Storablecreate in interface Storable<LocationIndex>public boolean loadExisting()
loadExisting in interface Storable<LocationIndex>public void flush()
Storableflush in interface Storable<LocationIndex>public LocationIndex prepareIndex()
LocationIndexprepareIndex in interface LocationIndexpublic void close()
Storableclose in interface Storable<LocationIndex>close in interface Closeableclose in interface AutoCloseablepublic boolean isClosed()
isClosed in interface Storable<LocationIndex>public long getCapacity()
getCapacity in interface Storable<LocationIndex>public void setSegmentSize(int bytes)
setSegmentSize in interface LocationIndexpublic double getDeltaLat()
public double getDeltaLon()
public final boolean findNetworkEntries(double queryLat,
double queryLon,
GHIntHashSet foundEntries,
int iteration)
public final void findNetworkEntriesSingleRegion(GHIntHashSet storedNetworkEntryIds, double queryLat, double queryLon)
public QueryResult findClosest(double queryLat, double queryLon, EdgeFilter edgeFilter)
LocationIndexfindClosest in interface LocationIndexedgeFilter - if a graph supports multiple vehicles we have to make sure that the entry
node into the graph is accessible from a selected vehicle. E.g. if you have a FOOT-query do:
new DefaultEdgeFilter(footFlagEncoder);
public List<QueryResult> findNClosest(double queryLat, double queryLon, EdgeFilter edgeFilter, double radius)
radius - in metersCopyright © 2012–2018. All rights reserved.