Constructor
# new MapsIndoors(options)
Creates a new instance of MapsIndoors.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
|||
mapView |
mapsindoors.mapView.GoogleMapsView | mapsindoors.mapView.MapboxView | An instance of a MapView. | |
venue |
string |
<optional> |
Id of the initial venue. |
buildingOutlineOptions |
BuildingOutlineOptions |
<optional> |
Settings for the polygon outlining the building thats in focus. |
labelOptions |
LabelOptions |
<optional> |
Styling options for labels on the map. |
Example
new mapsindoors.MapsIndoors({mapView: mapsindoors.mapView.GoogleMapsView|mapsindoors.mapView.MapboxView});
Members
function
# static onAuthRequired
The onAuthRequired property is an EventHandler that processes the AuthRequired event.
The AuthRequired is raised when authentication is required for the requested solution.
Example
mapsindoors.MapsIndoors.onAuthRequired = () => {...};
Methods
# static getUserRoles() → {Array.<UserRole>}
Gets the user roles that will be applied when querying routes and locations.
- Array of UserRoles.
Array.<UserRole>
# static setAuthToken(authToken)
Sets the MapsIndoors authentication token. The token is required for retriving data from solutions behind a login.
Parameters:
Name | Type | Description |
---|---|---|
authToken |
string |
# static setLanguage(language)
Sets a language for mapsindoors.
Parameters:
Name | Type | Description |
---|---|---|
language |
string |
# static setMapsIndoorsApiKey(apiKey)
Sets a new mapsindoors api key.
Parameters:
Name | Type | Description |
---|---|---|
apiKey |
string |
# static setUserRoles(userRoles)
Sets the user roles that will be applied when querying routes and locations.
Parameters:
Name | Type | Description |
---|---|---|
userRoles |
UserRole | Array.<UserRole> | One or more UserRoles. |
Example
mapsindoors.services.SolutionsService.getUserRoles().then(userRoles => {
const roles = userRoles.filter(role => ["Maintenance", "Staff"].includes(role.name));
mapsindoors.MapsIndoors.setUserRoles(roles);
});
# deallocate()
Clean up and release resources associated with this MapsIndoors instance.
This includes event bindings and other internal ressources.
Use this method when you are done using the instance and wish to ensure that it no longer consumes browser resources.
Afterwards, you must not call any other methods on the instance.
# filter(filter, fitView)
Filter locations on the map by array of ids
Parameters:
Name | Type | Description |
---|---|---|
filter |
Array.<string> | An array of location ids to filter the map by. |
fitView |
boolean | Change the map viewport to fit the current filter. |
# fitBuilding(buildingopt) → {Promise}
Fits a building's geometry in the map's bounding box.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
building |
Building | string |
<optional> |
building (object or id). If not given, the currently set building will be used. |
Promise
# fitVenue(venueopt) → {Promise}
Fits a venue's geometry in the map's bounding box.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
venue |
Venue | string |
<optional> |
venue (object or id). If not given, the current venue will be used. |
Promise
# getDirectionsRenderer() → {DirectionsRenderer}
Returns the DirectionsRenderer instance.
The DirectionsRenderer is responsible for rendereing routes on the map.
DirectionsRenderer
# getDisplayRule(feature, ignoreOverridesopt) → {DisplayRule}
Gets the DisplayRule for a given location
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
feature |
Location | |||
ignoreOverrides |
boolean |
<optional> |
false | When true the display rule is returned without the overrides. |
# getMap() → {google.maps.Map|mapboxgl.Map}
Gets the current map instance.
google.maps.Map
|
mapboxgl.Map
# getMapIndoorsStyles() → {Array.<MapStyle>}
Gets a list of available MapsIndoors map styles.
Array.<MapStyle>
# getMapView(mapView)
Gets the map view.
The map view is the adapter between the SDK and the specific map provider. This could be Google Maps or MapBox.
Parameters:
Name | Type | Description |
---|---|---|
mapView |
* |
MapView
# getMaxZoom() → {number}
Gets the MapsIndoors current max zoom level.
This function gets a normalized zoom level. Due to the difference in zoom levels between map providers is recommended to use this function to get the max zoom level as it returns a normalized max zoom level. The SDK uses the normalized zoom level for evaluating DisplayRules.
number
# getZoom() → {number}
Gets the MapsIndoors zoom level.
This function gets a normalized zoom level. Due to the difference in zoom levels between map providers is recommended to use this function to get the zoom level as it returns a normalized zoom level. The SDK uses the normalized zoom level for evaluating DisplayRules.
number
# overrideDisplayRule(displayRules)
Will override the default display rule for the taget.
Parameters:
Name | Type | Description |
---|---|---|
displayRules |
Map.<string, DisplayRule> | key: taget, value: display rule. |
# revertDisplayRule(target)
Reverts one or more overridden display rule(s).
Parameters:
Name | Type | Description |
---|---|---|
target |
string | Array.<string> | Target id (type or location). |
# setBuildingOutlineOptions(options)
Sets the building outline options
Parameters:
Name | Type | Description |
---|---|---|
options |
BuildingOutlineOptions |
# setDisplayRule(target, displayRule)
Sets a DisplayRule for one or more types or locations
Parameters:
Name | Type | Description |
---|---|---|
target |
string | Array.<string> | Can be a single location id or type name, or an array of locations ids and type names. |
displayRule |
DisplayRule |
# setLabelOptions(opts)
Sets the label options used for rendering labels on the map.
Parameters:
Name | Type | Description |
---|---|---|
opts |
LabelOptions |
# setMapsIndoorsStyle(mapStyle)
Sets the map style.
Parameters:
Name | Type | Description |
---|---|---|
mapStyle |
MapStyle |
# setMapView(mapView)
Sets the map view.
The map view is the adapter between the SDK and the specific map provider. This could be Google Maps or MapBox.
Parameters:
Name | Type | Description |
---|---|---|
mapView |
* |
# setZoom(zoom)
Sets the MapsIndoors zoom level.
This function sets the map zoom level. Due to the difference in zoom levels between map providers is recommended to use this function to set the zoom level as it normalizes the zoom level across different map providers. The SDK uses the normalized zoom level for evaluating DisplayRules.
Parameters:
Name | Type | Description |
---|---|---|
zoom |
number |
Events
# building_changed
This event will fire if the building focus changes after the map has moved or by calling `mapsIndoors.fitBuilding(building)`.
Properties:
Name | Type | Description |
---|---|---|
building |
Building |
Example
mapsIndoors.addListener('building_changed', (building) => {...});
# building_outline_changed
This event will fire when the style for the building outline has changed.
Example
mapsIndoors.addListener('building_outline_changed', () => {...})
Object
# click
This event will fire when a location is clicked on the map.
Object
Properties:
Name | Type | Description |
---|---|---|
location |
Location |
Example
mapsIndoors.addListener('click', (location) => {...});
# floor_changed
This event will fire when the floor index has changed.
The floor index can be changed by calling `mapsIndoors.setFloor(index)` or through interaction with the FloorSelector.
Properties:
Name | Type | Description |
---|---|---|
floorIndex |
number |
Example
mapsIndoors.addListener('floor_changed', (floorIndex) => {...});
# label_options_changed
This event will fire when the style for the labels has changed.
Example
mapsIndoors.addListener('label_options_changed', () => {...})
# ready
This event will fire when MapsIndoors has been initilaized and is ready.
Example
mapsIndoors.addListener('ready', () => {...});
# redraw
This event will fire when a display rule or location was changed, and the changes were reflected on the map.
Example
mapsIndoors.addListener('redraw', () => {...})
# venue_changed
This event will fire if the venue changes after calling `mapsIndoors.setVenue(venue|venueId)`.
Properties:
Name | Type | Description |
---|---|---|
venue |
Venue |
Example
mapsIndoors.addListener('venue_changed', (building) => {...});
# zoom_changed
This event will fire when the map zoom level has changed.
Due to the difference in zoom levels between map providers is recommended to listen to this event as the zoom level in the event payload is normalized across different map providers. The SDK uses the normalized zoom level for evaluating DisplayRules.
Properties:
Name | Type | Description |
---|---|---|
zoomLevel |
number | A normalized MapsIndoors zoom level. |
Example
mapsIndoors.addListener('zoom_changed', (zoomLevel) => {...});