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