Wayfinder Class
The wayfinder class exports the following static properties and functions:
|
BuildVersion |
A string with the current version |
|
BuildDate |
When this was created, in dd/mm/yyyy format |
|
BoundaryTypeFloorActiveArea BoundaryTypeFloorArea BoundaryTypeEntireRoute BoundaryTypeRouteLeg |
Integer values to use with the getFloorBounds() function |
|
GetRGB |
Converts multiple types of colour input into a standard object containing r, g, b and a properties that have a range between 0 and 255. |
|
RGB2Hex |
Converts an object with properties r, g and b, into hex notatation suitable for use with CSS. |
|
ToCDN |
Converts a url of the form: wayfinderstorager.blob.core.windows.net to |
The wayfinder class also exports the following properties and functions while instantiated. With properties, (r) means read only, (r/w) means read/write.
|
angle |
property (r/w) |
The current rotational angle of the map in degrees |
|
animateToBounds(bounds, angle, tilt, animate) |
function |
Pans and zooms the map such that the map coordinates provided fit within the display. bounds: a WayfinderBounds object describing the region angle: defaults to null, the rotational angle of the map to spin to tilt: The tilt of the map to use animate: true/false if the function should smoothly animate to these bounds or not. returns: A promise on completion. |
|
clearRoute |
function |
Clears and removes any active route |
|
database |
property (r) |
Provides access to the |
|
floorId |
property (r) |
Returns the current floor ID |
|
getFloorBounds(floorId, type, leg) |
function |
Returns a Wayfinder Bounds object that describes the minimum and maximum coordinates of the map, where: floorId: The floor to get bounds from type: Can be one of: BoundaryTypeFloorActiveArea |
|
loaded |
property (r) |
Boolean indicating whether the database data has finished loading. |
|
loadFromApiKey(key) |
function |
Loads and sets up the map from the api key string provided. Returns a promise that resolves when the map is loaded. |
|
loadFromJSON(jsonData) |
function |
Loads and sets up the map from jsonData object. This is in the format generated via the Wayfinder CMS. Returns a promise that resolves when the map is loaded. |
|
loadAsMapApp() |
function |
Should only ever be called from mapapp.co. This will populate the required fields from the handoff URL from the kiosk and start the map loading process. The default starting floor will be overwritten to the start waypoint/node supplied. This also generates a new event when loading is complete called 'mapapp' Returns a promise that resolves when the map is loaded. |
|
panTo(position, animate) |
function |
Moves the center of the map to a new position position: The new position to move/pan to. Position is an object with x, y and z properties, although the y property is not used. animate: If true then the map moves over a small interval as oppose to instantly moving there. returns: a promise for completion or error. |
|
position |
property (r/w) |
Set the position of the map on screen. The property is an object with x, y and z properties. |
|
ready |
property (r) |
Boolean indicating whether all background assets have finished loading. |
|
redraw |
function |
The map only re-renders if something changes. This will cause a re-draw of the map. |
|
resetSelection |
function |
Restores all meshes and icons back to their default non-selected state |
|
rootDIV |
property (r) |
The HTML element passed into the constructor |
|
routeBetween(startId, endIds, useDDA, [routeByShortestDistance]) |
function |
Requests a route to be generated start: The ID of a node to start from endIds: An array of target node IDs. The nearest one will be the route returned. useDDA: true/false. If true makes the routing engine generate more accessible routes. routeByShortestDistance: optional true/false. If not set will default to project settings. If true then route generated will be the shortest distance, if false it will be the quickest time returns: A promise for success/failure |
|
setViewMode(perspectiveView) |
function |
Changes the display type. perspectiveView: true: switches to perspective view false: switches to orthographic view. |
|
showFloor(floorId, animate, waitForLoad) |
function |
Switches the map to a different map floorid: The map to change to animate: If an animation should occur for the transition (not currently implemented) waitForLoad: If the map is not currently loaded then the function will wait for this. returns: a promise for completion or error. |
|
size |
property (r) |
Returns the current map size in pixels {width,height} |
|
settings |
property (r) |
Allows access to the settings object |
|
tilt |
property (r/w) |
The current elevation angle of the map in degrees between 30 and 90, where 90 is top-down |
|
zoomBy(delta) |
function |
Zooms the map in or out. delta: A negative value causes zoom out by 10% A positive value causes zoom in by 10% |
|
zoomLevel |
property (r/w) |
The current zoom level of the map. Between 0 and 100. 0 is fully zoomed out 100 is fully zoomed in |
|
addMarker(url, nodeId) |
function |
Adds a marker to the specified nodeId using the image provided in url. A marker object is returned. |
|
deleteMarker(marker) |
function |
Deletes a previously created marker. The parameter marker is the return value from addMarker |