AnyLogic
Expand
Font size
All Implemented Interfaces:
IGISRouteFinder

@AnyLogicInternalAPI
public class CachedGISRouteFinder
extends ChainedGISRouteFinder
This class is internal and shouldn't be called by user.
it may be removed/renamed in future.
Author:
AnyLogic North America, LLC https://anylogic.com

Constructor Summary

ConstructorDescription
CachedGISRouteFinder(IGISRouteFinder base, Supplier<AnyLogicMapDB> dbSupplier, String routeCacheId, String distanceCacheId, UnaryOperator<double[]> cacheKeyFunction, boolean readOnlyRouteCache) 

Method Summary

Modifier and TypeMethodDescription
GISResultDoublegetDistance(double[] latLonPoints)
Returns the distance by route with intermediate points.
GISResult<double[]>getRoute(double[] latLonPoints)
Returns the route build with the given input coordinates.
The result may depend on internal state of this route finder (e.g.

Methods inherited from class com.anylogic.engine.gis.ChainedGISRouteFinder

registerDistanceCache

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

CachedGISRouteFinder

public CachedGISRouteFinder(IGISRouteFinder base,
 Supplier<AnyLogicMapDB> dbSupplier,
 String routeCacheId,
 String distanceCacheId,
 UnaryOperator<double[]> cacheKeyFunction,
 boolean readOnlyRouteCache)
Parameters:
base -
dbSupplier - Use either the default AnyLogicMapDB::instance or construct and provide your own new AnyLogicMapDB(path) based on your cache folder
routeCacheId - use null to disable caching of routes
distanceCacheId - use null to disable caching of distances
cacheKeyFunction -
readOnlyRouteCache -

Method Details

getRoute

public GISResult<double[]> getRoute(double[] latLonPoints)
Description copied from interface: IGISRouteFinder
Returns the route build with the given input coordinates.
The result may depend on internal state of this route finder (e.g. GeneralizingGISRouteFinder performs generalization with some configurable precision).
The format of result may also depend on the implementation.
  • raw (not generalized) routes are returned in the form of array of (lat, lon) pairs of resulting route curve, followed by a single number - the length of total route measured in meters.
     lat0 lon0 lat1 lon1 lat2 lon2 total_length 
     
  • generalized routes are returned in the form of array comprising: N (lat, lon) pairs, followed by (N-1) segment lengths, then one number - the length of the route. So that the resulting array length will be triple of the number of points. Given the r result of this method call, the first route segment would start at r[0], r[1], end at r[2], r[3] and will have 'real distance' length of r[r.length / 3 * 2 + 0] meters.
     lat0 lon0 lat1 lon1 lat2 lon2 seg01_len seg12_len total_length 
     
The total length of the route (measured in meters) is always stored in the last element of the returned array. Array length can't make any clue on whether this array contains generalized data or not - this understanding comes from the way the route finder chain was created.
Parameters:
latLonPoints - the array of coordinates ([latitude1, longitude1, latitude2, longitude2, ... latitudeN, longitudeN])
Returns:
see above, or empty optional if route not found, or null in case of server error

getDistance

public GISResultDouble getDistance(double[] latLonPoints)
Description copied from interface: IGISRouteFinder
Returns the distance by route with intermediate points.
Parameters:
latLonPoints - the array of coordinates ([latitude1, longitude1, latitude2, longitude2, ... latitudeN, longitudeN])
Returns:
the distance of route which sequentially connects all specified points, empty optional if route not found, or null in case of server error