OSMEnvironment

class OSMEnvironment<T> @JvmOverloads constructor(incarnation: Incarnation<T, GeoPosition>, file: String? = null, onStreets: Boolean = file != null, onlyOnStreets: Boolean = DEFAULT_FORCE_STREETS, approximation: Int = DEFAULT_APPROXIMATION) : Abstract2DEnvironment<T, GeoPosition> , MapEnvironment<T, GraphHopperOptions, GraphHopperRoutingService> (source)

An environment backed by an OpenStreetMap extract stored in file. It encloses the navigation logic, loading the map lazily the first time navigation is required. Routes are cached in memory for performance reasons.

Parameters

incarnation

the incarnation to be used.

file

the file path where the map data is stored. Accepts OSM maps of any format (xml, osm, pbf). The map will be processed, optimized and stored for future use. If null, navigation is unavailable.

onStreets

if true, the nodes will be placed on the street nearest to the desired position. Defaults to true when a file is provided, to false otherwise.

onlyOnStreets

if true, the nodes which are too far from a street will be simply discarded. If false, they will be placed anyway, in the original position.

approximation

the symbols of IEEE 754-encoded position that may be discarded when comparing two positions, allowing quicker retrieval of the route between two positions via cache.

Type Parameters

T

concentration type

Constructors

Link copied to clipboard
constructor(incarnation: Incarnation<T, GeoPosition>, file: String? = null, onStreets: Boolean = file != null, onlyOnStreets: Boolean = DEFAULT_FORCE_STREETS, approximation: Int = DEFAULT_APPROXIMATION)

Types

Link copied to clipboard
object Companion

Default values for the OSMEnvironment options.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override val dimensions: Int
Link copied to clipboard
Link copied to clipboard
open override val isTerminated: Boolean
Link copied to clipboard
override val layers: Map<Molecule, Layer<T, GeoPosition>>
Link copied to clipboard
Link copied to clipboard
override var networkModel: NetworkModel<T>
Link copied to clipboard
override val nodeCount: Observable<Int>
Link copied to clipboard
open override val nodes: ObservableList<Node<T>>
Link copied to clipboard
override val offset: DoubleArray
Link copied to clipboard
Link copied to clipboard
open override val reactions: ObservableList<Reaction<T>>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
override val size: DoubleArray
Link copied to clipboard
open override val sizeInDistanceUnits: DoubleArray

Functions

Link copied to clipboard
open override fun addLayer(molecule: Molecule, layer: Layer<T, GeoPosition>)
Link copied to clipboard
open override fun addNode(node: Node<T>, position: GeoPosition): Boolean
Link copied to clipboard
open override fun addReaction(reaction: Reaction<T>)
Link copied to clipboard
open fun addTerminator(terminator: (Environment<T, GeoPosition>) -> Boolean)
open override fun addTerminator(terminator: TerminationPredicate<T, GeoPosition>)
Link copied to clipboard
open override fun computeRoute(p1: GeoPosition, p2: GeoPosition): Route<GeoPosition>
open override fun computeRoute(node: Node<T>, coord: GeoPosition): Route<GeoPosition>
open override fun computeRoute(from: GeoPosition, to: GeoPosition, options: GraphHopperOptions): Route<GeoPosition>
open override fun computeRoute(node: Node<T>, coord: GeoPosition, options: GraphHopperOptions): Route<GeoPosition>

This method relies on the map data and computes a route towards some absolute coordinate solving a TSP problem. It's up to the specific it.unibo.alchemist.model.Action calling this method to effectively move nodes along the path.

open override fun computeRoute(node: Node<T>, node2: Node<T>): Route<GeoPosition>

This method relies on the map data and computes a route towards some absolute coordinate solving a TSP problem. It's up to the specific it.unibo.alchemist.model.Action calling this method to effectively move nodes along the path. It uses the fastest path as a metric.

Link copied to clipboard
open operator override fun contains(node: Node<T>): Boolean
Link copied to clipboard
open override fun currentPositionOf(node: Node<T>): GeoPosition
Link copied to clipboard
open override fun distanceBetween(n1: Node<T>, n2: Node<T>): Double
Link copied to clipboard
open fun Node<T>.distanceTo(other: Node<T>): Double
Link copied to clipboard
open override fun farthestReachablePosition(node: Node<T>, desired: GeoPosition): GeoPosition
Link copied to clipboard

Returns the routing service of this environment.

Link copied to clipboard
open override fun layerFor(molecule: Molecule): Layer<T, GeoPosition>?
Link copied to clipboard
open fun makePosition(coordinates: List<Number>): GeoPosition
open override fun makePosition(coordinates: DoubleArray): GeoPosition
open override fun makePosition(vararg coordinates: Number): GeoPosition
Link copied to clipboard
open override fun moveNodeTo(node: Node<T>, position: GeoPosition)
Link copied to clipboard
open fun Node<T>.moveTo(position: GeoPosition)
Link copied to clipboard
open override fun neighborhoodOf(node: Node<T>): Observable<Neighborhood<T>>
Link copied to clipboard
open override fun nodesAround(position: GeoPosition, range: Double): List<Node<T>>
open override fun nodesAround(node: Node<T>, range: Double): List<Node<T>>
Link copied to clipboard
open fun Node<T>.nodesInRange(range: Double): List<Node<T>>
Link copied to clipboard
open override fun nodeWithId(id: Int): Node<T>
Link copied to clipboard
open override fun observeLayerValue(molecule: Molecule, node: Node<T>): Observable<T?>
Link copied to clipboard
open override fun observeNodesAround(position: GeoPosition, range: Double): ObservableSet<Node<T>>
open override fun observeNodesAround(node: Node<T>, range: Double): ObservableSet<Node<T>>
Link copied to clipboard
open override fun positionOf(node: Node<T>): Observable<GeoPosition>
Link copied to clipboard
open fun Node<T>.remove()
open fun Reaction<T>.remove()
Link copied to clipboard
open override fun removeNode(node: Node<T>)
Link copied to clipboard
open override fun removeReaction(reaction: Reaction<T>)
Link copied to clipboard
Link copied to clipboard
open override fun toString(): String