Building
Loading a building performs all download requests needed to display a plan, so that calls to viewer.loadPlan
can immediately start the rendering process.
Loading a building
locatrix.plans.loadBuilding(viewerToken[, options])
viewerToken
: <string>options
: <Object>- Returns: <Promise<Building>>
Returns a promise that will resolve with the loaded building. The promise will reject if there are network errors while loading the building.
In order to use the downloaded data when loading a plan of the building, the same viewerToken
must be provided to loadPlan
.
The viewerToken
can be for a building, campus, or client. If the viewerToken
is not for a building, the buildingCode
must be provided.
If prepare
is true, the plans in the building will be prepared for use in the viewer and with world paths, before the promise resolves.
Buildings must be manually unloaded with locatrix.plans.unload()
when they are no longer needed.
locatrix.plans.unload(building)
building
: <Building>
Unloads the given building.
Querying building data
building.getClientCode()
- Returns: <string>
Returns the client code associated with this building.
building.getCampusCode()
- Returns: <string>
Returns the campus code associated with this building.
building.getBuildingCode()
- Returns: <string>
Returns the building code associated with this building.
building.getPlanCodes()
- Returns: <string[]>
Returns an array of all plan codes contained within this building.
building.getLoadedPlan(planCode)
-
planCode
: <string> -
Returns: <Promise<Plan>>
Returns the loaded plan for the plan code. The plan must be part of the building, which can be checked with getPlanCodes()
.
If loadBuilding()
wasn’t called with prepare
as true
, then the plan will now be prepared.
building.getHierarchy()
- Returns: <Promise<Hierarchy>>
Returns the hierarchy for this building.