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, as well as the same satelliteImageryFallback and sitePlanInBackground options.
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.
satelliteImageryFallback specifies which satellite imagery provider, for the site plan, should be used as a backup if the primary one fails to load. Supported values are "none" or "bingSatellite".
If sitePlanInBackground is true, then the site plan will be loaded for each floor plan as well for rendering it in the background. The Viewer will fail to show the site plan in the background if the provided viewerToken allows access only to a specific building - it must provide access to a campus or client.
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.