Logo
Developer

VisioWeb Remote 1.16.1

Class

VisioWebRemote

Proxy class allowing to interact with a VisioWeb instance loaded in an iframe, exposing a simplified API.

All methods take a single argument (object or primitive) and return a Promise.
They should be called from within a handler passed to the ready method.

Constructor

new VisioWebRemote(domElement, parameters)

constructor to create a new instance of VisioWebRemote
Parameters:
Name Type Description
domElement DOMElement the iframe that will receive the VisioWeb instance
parameters Object a set of parameters to configure both UI and the VisioWeb instance
Since:
  • 1.8.11
See:

Methods summary


Name Description
ready Registers a handler called when the visioweb instance is loaded and ready
mouseup Registers a handler called when the user clicks/taps on an interactive element.
NB:
- the 'mouseup' event must be included in parameters.mapview.events.listenTo for events to be forwarded to VisioWeb Remote.
- only one handler can be defined: calling this method twice will replace the first handler with a new one.
exploreStateWillChange Registers a handler called when the explore state is about to change (changing floor/building).
NB:
- the 'exploreStateWillChange' event must be included in parameters.mapview.events.listenTo for events to be forwarded to VisioWeb Remote.
- only one handler can be defined: calling this method twice will replace the first handler with a new one.
exploreStateChanged Registers a handler called when the explore state just changed (changing floor/building).
NB:
- the 'exploreStateChanged' event must be included in parameters.mapview.events.listenTo for events to be forwarded to VisioWeb Remote.
- only one handler can be defined: calling this method twice will replace the first handler with a new one.
createCategory Registers a category. Can be called to add multiple categories by providing arrays.
addCategory Registers a category. Renamed into createCategory.
addPlaceCategory Adds a categoryID to a place. Can be called to add multiple categories to multiple places by providing arrays.
setPlaceContent Registers a place's content. Can be used to add multiple places by providing an array of parameters objects.
addPlaceContent Registers a place's content. Renamed into setPlaceContent.
createPlace Creates a place represented as an icon or a text in the map. Can be used to create multiple places by providing an array of parameters objects.
getFootprintPoints Retrieves the footprint(s) points for a given ID.
getCategory Retrieves the category's basic information for a given ID, including a number of places related to that category.
getPlace Retrieves the place's basic information for a given ID.
getPointOfFocus Retrieves the Point Of Focus object for a given ID.
getVersion Retrieves VisioWeb's version
getViewpoint Computes an optimal viewpoint for a given zone defined by a set of points expressed in local coordinates.
goToBuilding Animates to camera to a viewpoint showing a particular building. It also activates the building and shows its default floor.
goToFloor Animates to camera to a viewpoint showing a particular floor. It also activates the building thus making sure the floor is visible.
goToGlobal Animates to camera to the initial / global viewpoint.
goToPlace Animates to camera to center on a specific place. It also activates the place's building and floor thus making sure the place is visible.
goToViewpoint Animates to camera to the provided viewpoint.
openSearch Opens the search panel.
queryAllCategoryIDs Retrieves all category IDs used in the map.
queryAllPlaceIDs Retrieves all place IDs mentioned in the map.
removePlace Removes a place represented as an icon or a text on the map.
resetPlaceColor Restores the original color of a place, thus removing a potential highlight or temporary color.
routeFrom Sets a route start and computes a route if both start and destination are set.
routeTo Sets a route destination and computes a route if both start and destination are set.
setParameters Re-sets configuration parameters (they already have been set when instantiating VisioWeb Remote). Useful to adjust UI/UX to user input or to the map. e.g. use buttons by default, but revert to selectors if the map has many floors. If the some mapview configuration parameters are concerned, the map will be reloaded.
setPlaceColor Sets an alternate color to a place (as highlight, or temporarily). Can be applied to multiple places by providing arrays.
setPlaceDescription Sets a description for a place. It will be displayed in the place info component, if enabled. Can be applied to multiple places by providing arrays.
setPlaceIcon Sets an icon for a place. It will appear on the surface if a label slot exists. Can be applied to multiple places by providing arrays.
setPlaceName Sets a name for a place. It will appear on the surface if a label slot exists. Can be applied to multiple places by providing arrays.
setPlacePosition Moves to a new position a place represented as an icon or a text on the map. Can be applied to multiple places by providing arrays.

Methods detail

ready(callback)

Registers a handler called when the visioweb instance is loaded and ready
Parameters:
Name Type Description
callback function the handler
Example
var visioweb = new VisioWebRemote(document.getElementById('visioweb'), parameters);
visioweb.ready(() => {
     console.log(visioweb.getVersion());
});

mouseup(callback)

Registers a handler called when the user clicks/taps on an interactive element.
NB:
- the 'mouseup' event must be included in parameters.mapview.events.listenTo for events to be forwarded to VisioWeb Remote.
- only one handler can be defined: calling this method twice will replace the first handler with a new one.
Parameters:
Name Type Description
callback function the handler
Since:
  • 1.9.7
Example
var visioweb = new VisioWebRemote(document.getElementById('visioweb'), parameters);
visioweb.mouseup(element => {
     console.log('clicked on: ' + element.id);
});

exploreStateWillChange(callback)

Registers a handler called when the explore state is about to change (changing floor/building).
NB:
- the 'exploreStateWillChange' event must be included in parameters.mapview.events.listenTo for events to be forwarded to VisioWeb Remote.
- only one handler can be defined: calling this method twice will replace the first handler with a new one.
Parameters:
Name Type Description
callback function the handler
Since:
  • 1.9.7
Example
var visioweb = new VisioWebRemote(document.getElementById('visioweb'), parameters);
visioweb.exploreStateWillChange(data => {
     console.log('going to floor: ' + data.target.floorID + ' from floor: ' + data.current.floorID);
});

exploreStateChanged(callback)

Registers a handler called when the explore state just changed (changing floor/building).
NB:
- the 'exploreStateChanged' event must be included in parameters.mapview.events.listenTo for events to be forwarded to VisioWeb Remote.
- only one handler can be defined: calling this method twice will replace the first handler with a new one.
Parameters:
Name Type Description
callback function the handler
Since:
  • 1.9.7
Example
var visioweb = new VisioWebRemote(document.getElementById('visioweb'), parameters);
visioweb.exploreStateChanged(data => {
     console.log('arrived at: ' + data.current.floorID + ' from floor: ' + data.previous.floorID);
});

createCategory(parameters) → {Promise}

Registers a category. Can be called to add multiple categories by providing arrays.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string | Array.<string> the category's ID
name string | Array.<string> the category's name
icon string | Array.<string> the category's icon
Since:
  • 1.10.1
Returns:
Type
Promise

addCategory(parameters)

Registers a category. Renamed into createCategory.
Parameters:
Name Type Description
parameters Object
Since:
  • 1.9.10
Deprecated:
  • Yes
See:

addPlaceCategory(parameters) → {Promise}

Adds a categoryID to a place. Can be called to add multiple categories to multiple places by providing arrays.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string | Array.<string> the place's ID
categoryID string | Array.<string> the category's ID
Since:
  • 1.9.10
Returns:
Type
Promise

setPlaceContent(parameters) → {Promise}

Registers a place's content. Can be used to add multiple places by providing an array of parameters objects.
Parameters:
Name Type Description
parameters Object | Array.<Object>
Properties
Name Type Attributes Description
id string the place's ID
name string the place's name
categories Array.<string> <optional>
the place's category IDs
floor string <optional>
the place's floor
description string <optional>
the url pointing to the icon to display
Since:
  • 1.10.1
Returns:
Type
Promise

addPlaceContent(parameters)

Registers a place's content. Renamed into setPlaceContent.
Parameters:
Name Type Description
parameters Object | Array.<Object>
Since:
  • 1.10.0
Deprecated:
  • Yes
See:

createPlace(parameters) → {Promise.<Object>}

Creates a place represented as an icon or a text in the map. Can be used to create multiple places by providing an array of parameters objects.
Parameters:
Name Type Description
parameters Object | Array.<Object>
Properties
Name Type Attributes Description
id string the place's ID
floor string the target floor
position string the target {lat, lon, height} position
url string <optional>
the url pointing to the icon to display
text string <optional>
the text to display
Since:
  • 1.9.10
See:
Returns:
fulfills with {id, floor, position} of the resulting place
Type
Promise.<Object>

getFootprintPoints(parameters) → {Promise.<Array.<Object>>}

Retrieves the footprint(s) points for a given ID.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string the footprint ID
Returns:
fulfills with an Array of {lat, lon} coordinates.
Type
Promise.<Array.<Object>>

getCategory(parameters) → {Promise.<Object>}

Retrieves the category's basic information for a given ID, including a number of places related to that category.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string the category ID
Since:
  • 1.9.10
Returns:
fulfills with {id, name, icon, nbPlaces}
Type
Promise.<Object>

getPlace(parameters) → {Promise.<Object>}

Retrieves the place's basic information for a given ID.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string the place's ID
Returns:
fulfills with {id, floor, position: {lat, lon, height}}
Type
Promise.<Object>

getPointOfFocus(parameters) → {Promise.<Object>}

Retrieves the Point Of Focus object for a given ID.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string the Point Of Focus ID
Returns:
fulfills with {id, floor, position: {lat, lon, height}, heading}
Type
Promise.<Object>

getVersion() → {Promise.<string>}

Retrieves VisioWeb's version
Returns:
fulfills with version
Type
Promise.<string>

getViewpoint(parametersopt) → {Promise.<Object>}

Computes an optimal viewpoint for a given zone defined by a set of points expressed in local coordinates.
Parameters:
Name Type Attributes Description
parameters Object <optional>
if called without parameters, this method returns the current camera viewpoint
Properties
Name Type Attributes Description
points Array.<Object> <optional>
array of points describing the targeted zone, expected as {lat, lon} coordinates.
padding Object <optional>
{top, bottom, left, right} defining the padding values in pixels around the targeted zone
pitch number <optional>
new pitch value (in degrees) for camera in the resulting viewpoint
heading number <optional>
new heading value (in degrees) for camera in the resulting viewpoint
See:
Returns:
fulfills with {position: {lat, lon}, radius, pitch, heading}
Type
Promise.<Object>

goToBuilding(parameters) → {Promise}

Animates to camera to a viewpoint showing a particular building. It also activates the building and shows its default floor.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string the building ID
Returns:
Type
Promise

goToFloor(parameters) → {Promise}

Animates to camera to a viewpoint showing a particular floor. It also activates the building thus making sure the floor is visible.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string the floor ID
Returns:
Type
Promise

goToGlobal() → {Promise}

Animates to camera to the initial / global viewpoint.
Returns:
Type
Promise

goToPlace(parameters) → {Promise}

Animates to camera to center on a specific place. It also activates the place's building and floor thus making sure the place is visible.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Attributes Description
id string the place's ID
radius number <optional>
expected camera radius
Returns:
Type
Promise

goToViewpoint(viewpoint) → {Promise}

Animates to camera to the provided viewpoint.
Parameters:
Name Type Description
viewpoint Object
Properties
Name Type Attributes Description
position Object {lat, lon}
radius number expected camera radius (in meters)
pitch number <optional>
expected camera pitch (in degrees)
heading number <optional>
expected camera heading (in degrees)
Returns:
Type
Promise

openSearch() → {Promise}

Opens the search panel.
Since:
  • 1.9.10
Returns:
Type
Promise

queryAllCategoryIDs() → {Promise.<Array.<string>>}

Retrieves all category IDs used in the map.
Returns:
fulfills with an array of IDs
Type
Promise.<Array.<string>>

queryAllPlaceIDs() → {Promise.<Array.<string>>}

Retrieves all place IDs mentioned in the map.
Returns:
fulfills with an array of IDs
Type
Promise.<Array.<string>>

removePlace(parameters) → {Promise}

Removes a place represented as an icon or a text on the map.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string the place's ID
Returns:
only succeeds for point-based Places (icons, texts), fails if the targeted place is linked to a physical surface.
Type
Promise

resetPlaceColor(parameters) → {Promise}

Restores the original color of a place, thus removing a potential highlight or temporary color.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string the place's ID
Returns:
Type
Promise

routeFrom(parameters) → {Promise}

Sets a route start and computes a route if both start and destination are set.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
from string | Object the start place's ID or a {lat, lon, floor} object
Since:
  • 1.9.10
Returns:
Type
Promise

routeTo(parameters) → {Promise}

Sets a route destination and computes a route if both start and destination are set.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
to string | Object the destination place's ID or a {lat, lon, floor} object
Since:
  • 1.9.10
Returns:
Type
Promise

setParameters(parameters) → {Promise}

Re-sets configuration parameters (they already have been set when instantiating VisioWeb Remote). Useful to adjust UI/UX to user input or to the map. e.g. use buttons by default, but revert to selectors if the map has many floors. If the some mapview configuration parameters are concerned, the map will be reloaded.
Parameters:
Name Type Description
parameters Object
Since:
  • 1.9.7
See:
Returns:
Type
Promise

setPlaceColor(parameters) → {Promise}

Sets an alternate color to a place (as highlight, or temporarily). Can be applied to multiple places by providing arrays.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string | Array.<string> the place's ID
color string | Array.<string> the place's new color
Returns:
Type
Promise

setPlaceDescription(parameters) → {Promise}

Sets a description for a place. It will be displayed in the place info component, if enabled. Can be applied to multiple places by providing arrays.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string | Array.<string> the place's ID
description string | Array.<string> the place's new description
Returns:
Type
Promise

setPlaceIcon(parameters) → {Promise}

Sets an icon for a place. It will appear on the surface if a label slot exists. Can be applied to multiple places by providing arrays.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string | Array.<string> the place's ID
url string | Array.<string> the place's new icon url
Returns:
Type
Promise

setPlaceName(parameters) → {Promise}

Sets a name for a place. It will appear on the surface if a label slot exists. Can be applied to multiple places by providing arrays.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string | Array.<string> the place's ID
name string | Array.<string> the place's new name
Returns:
Type
Promise

setPlacePosition(parameters) → {Promise}

Moves to a new position a place represented as an icon or a text on the map. Can be applied to multiple places by providing arrays.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string | Array.<string> the place's ID
position Object | Array.<Object> the place's new position {lat, lon, height}
Returns:
only succeeds for point-based Places (icons, texts), fails if the targeted place is linked to a physical surface.
Type
Promise