WorldPath
WorldPath will be expanded in future to support travel between multiple buildings across a campus.
WorldPath instances are generated by calling locatrix.plans.getWorldPath()
and can be displayed by the Viewer (using viewer.setEnabledWorldPath()
).
WorldPath will obey all nav mesh rules including primary
, one way
and no way
. Consider the rules you use in your nav mesh if you intend for bidirectional world paths.
You cannot directly create WorldPath instances, and you cannot modify any of their properties.
Getting a WorldPath
Before world paths can be generated you must have a world. Worlds can be either individual plans or buildings.
Plans must be loaded using the enableWorldPaths
option. Buildings may be loaded using the prepare
option, otherwise the building will be prepared the first time getWorldPath()
is called for it.
Paths are generated by calling locatrix.plans.getWorldPath()
.
locatrix.plans.getWorldPath(world, from, to[, options])
world
: <Plan> | <Building>from
: <Object>to
: <Object>options
: <Object>fromPlanCode
: <string>toPlanCode
: <string>excludedPortals
: <string[]>pathfindingMode
: <string>
- Returns: <Promise<WorldPath>>
Returns a world path.
fromPlanCode
and toPlanCode
must be provided if the world
is a building.
If excludedPortals
is provided, the path will not use any portals with the given tags.
pathfindingMode
must be either "evacuation"
or "wayfinding"
. If not provided, it defaults to "evacuation"
. The pathfindingMode
modifies how primary paths should be treated; "evacuation"
is used to find the best route out of a building, while "wayfinding"
is more suitable for finding the best route between two points.
The promise will reject if there is no path available.
Methods
worldPath.getSteps()
- Returns: <Object[]>
Returns the sequence of steps in the world path, where each step denotes a transition between plans.
index
indicates which step this is in the sequence.
planCode
indicates which plan this step applies to.
nextPlanCode
indicates the plan code of the following step, or null if this is the last step.
previousPlanCode
indicates the plan code of the previous step, or null if this is the first step.
startPoint
and endPoint
are the latitude and longitudes of the start/end points of the path in this step.
The points
array is the ordered set of points making up the path. You can pass the points
array into the viewer.setFraming(framing)
method to zoom and position the viewer onto the step.
worldPath.getDistance()
- Returns: <number>
Returns the total distance of the world path (from its beginning to its end), in meters.