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])

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)

Unloads the given building.

Querying building data

building.getClientCode()

Returns the client code associated with this building.

building.getCampusCode()

Returns the campus code associated with this building.

building.getBuildingCode()

Returns the building code associated with this building.

building.getPlanCodes()

Returns an array of all plan codes contained within this building.

building.getLoadedPlan(planCode)

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 the hierarchy for this building.