Salta ai contenuti
Seleziona lingua:Italiano
Questa pagina è disponibile solo in inglese.

Way-Fi 1.6.0

This class provides high-level routing capabilities on a graph.

It serves as the main interface to interact with the underlying native WayFi routing engine. This class allows clients to load layers, set routing constraints (such as masks), define source and destination points, and compute optimal routes.

Key features include:

  • Loading layers from GeoJSON files (with optional coordinate reference system specification).

  • Linking layers into a navigable graph.

  • Adding a source and multiple destinations for route computation.

  • Calculating the shortest route(s) between source and destination(s).

  • Modifying arc costs and applying masks to dynamically influence routing behavior.

  • Accessing and inspecting loaded layers.

Constructors

constructor()

Types

Specifies how to handle duplicate arcs (i.e., multiple arcs between the same pair of nodes) when loading layers.

inner class LayerAccessor : Iterable<Layer>

Provides access to the layers of this graph.

Properties

Returns true if the native resources of this object has not been released.

Indicates whether the graph has been finalized.

Provides access to the layers of this graph.

val mask: Int

The mask of bits to enable/disable arcs.

Functions

fun addDestination(idLayer: Int, x: Double, y: Double): Int
fun addDestination(layerName: String, x: Double, y: Double): Int

Adds a destination in the specified layer at the specified position. Multiple destinations can be added for a search.

fun addDestinations(category: String)

Adds all POIs of the specified category in every layer.

fun addDestinations(idLayer: Int, category: String)
fun addDestinations(layerName: String, category: String)

Adds all POIs of the specified category to the specified layer as destinations.

fun addSource(idLayer: Int, x: Double, y: Double): Int
fun addSource(layerName: String, x: Double, y: Double): Int

Adds the source in the specified layer at the specified position. Only one source can be added for each search.

fun changeCost(newCost: Float, idNodeFrom: Int, idNodeTo: Int, mask: Int = -1): Float
fun changeCost(newCost: Float, idLayerFrom: Int, oidNodeFrom: Int, idLayerTo: Int, oidNodeTo: Int, mask: Int = -1): Float
fun changeCost(newCost: Float, layerFrom: String, oidNodeFrom: Int, layerTo: String, oidNodeTo: Int, mask: Int = -1): Float

Change the cost of an arc between two nodes that has the specified mask. This method is useful in case the graph allows for duplicated arcs with different mask.

fun changeCost(newCost: Float, unlNodeFrom: String, unlNodeTo: String, mask: Int = -1): Float

Change the cost of an arc between two nodes identified by UNL.

fun changeCosts(newCost: Float, unl: String, skipMissing: Boolean = true, mask: Int = -1): Int

Change the cost of the arcs between the nodes identified by UNL.

open override fun close()

Release the native resources.

fun findLayer(layerName: String): Int

Translate the name of a layer with its id.

Finds the best route between the source and the nearest destination.

fun findShortestPaths(addEmpty: Boolean = false): RouteSet

Finds the best routes between the source and all the destinations.

fun linkLayers(skipMissingLayers: Boolean = true, optimize: Boolean = false): Int

Links all the layers loaded so far. This operation will finalized the graph, which means that you will not be able to add any more layers after this operation. If not called before, this method will be called automatically when the source is added.

fun loadLayer(layerName: String, fileName: String, crs: Layer.CRS = Layer.CRS.CARTESIAN, crsOverride: Boolean = true): Int

Loads a new layer from a GeoJSON file specifying the default CRS.

open override fun release()

Release the native resources.

fun reset()

Resets source and destination.

fun setMask(value: Int)

Sets the mask of bits to enable/disable arcs.

fun setSnapToEdge(source: Float = Float.NaN, destination: Float = Float.NaN)

Sets the margin to "snap" source and destination points to the nearest edge if they fall within a wall.