VisioWeb Remote 1.9.5

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
addPlace Adds a place represented as an icon or a text in the map.
computeRoute Computes a route given a source and a destination and other optional parameters.
convertLatLonToPoint Converts a (lat,lon) point to a point in local (or scene) coordinates.
convertPointToLatLon Converts a local point to a point in (lat,lon) coordinates.
getFootprintPoints Retrieves the footprint(s) points for a given ID.
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.
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.
setPlaceColor Sets an alternate color to a place (as highlight, or temporarily).
setPlaceDescription Sets a description for a place. It will be displayed in the place info component, if enabled.
setPlaceName Sets a name for a place. It will appear on the surface if a label slot exists.
setPlacePosition Moves to a new position a place represented as an icon or a text on the map.

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());
});

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

Adds a place represented as an icon or a text in the map.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Attributes Description
id string the place's ID
floor string the target floor
position string the target {x, y, z} position
url string <optional>
the url pointing to the icon to display
text string <optional>
the text to display
See:
Returns:
fulfills with {id, floor, position} of the resulting place
Type
Promise.<Object>

computeRoute(parameters) → {Promise}

Computes a route given a source and a destination and other optional parameters.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
src string the start place ID
dst string the destination place ID
See:
Returns:
Type
Promise

convertLatLonToPoint(position) → {Promise.<Object>}

Converts a (lat,lon) point to a point in local (or scene) coordinates.
Parameters:
Name Type Description
position Object
Properties
Name Type Description
lat number
lon number
Returns:
fulfills with {x, y, z}
Type
Promise.<Object>

convertPointToLatLon(position) → {Promise.<Object>}

Converts a local point to a point in (lat,lon) coordinates.
Parameters:
Name Type Description
position Object
Properties
Name Type Description
x number
y number
z number
Returns:
fulfills with {lat, lon}
Type
Promise.<Object>

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

Retrieves the footprint(s) points for a given ID.
Parameters:
Name Type Description
id string
Returns:
fulfills with an Array of positions {x, y} in local coordinates.
Type
Promise.<Array.<Object>>

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

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

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

Retrieves the Point Of Focus object for a given ID.
Parameters:
Name Type Description
id string
Returns:
fulfills with {id, x, y, 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
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: {x, y, radius}, pitch, heading}
Type
Promise.<Object>

goToBuilding(id) → {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
id string the building's ID
Returns:
Type
Promise

goToFloor(id) → {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
id string the floor's 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 {x, y, radius}
pitch number <optional>
expected camera pitch (in degrees)
heading number <optional>
expected camera heading (in degrees)
Returns:
Type
Promise

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

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

removePlace(id) → {Promise}

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

resetPlaceColor(id) → {Promise}

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

setPlaceColor(parameters) → {Promise}

Sets an alternate color to a place (as highlight, or temporarily).
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string the place's ID
color 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.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string the place's ID
description string the place's new description
Returns:
Type
Promise

setPlaceName(parameters) → {Promise}

Sets a name for a place. It will appear on the surface if a label slot exists.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string the place's ID
name 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.
Parameters:
Name Type Description
parameters Object
Properties
Name Type Description
id string the place's ID
position string the place's new position
Returns:
only succeeds for point-based Places (icons, texts), fails if the targeted place is linked to a physical surface.
Type
Promise