Class

MapsIndoors

mapsindoors.MapsIndoors(options)

Constructor

# new MapsIndoors(options)

Creates a new instance of MapsIndoors.
Parameters:
Name Type Attributes Default Description
options object Configuration options for the MapsIndoors instance.
mapView mapsindoors.mapView.GoogleMapsView | mapsindoors.mapView.MapboxView An instance of a MapView.
venue string <optional>
The ID of the initial venue. Optional.
buildingOutlineOptions BuildingOutlineOptions <optional>
Settings for the polygon outlining the building in focus. Optional.
labelOptions LabelOptions <optional>
Styling options for labels on the map. Optional.
floorSelectionMode 'manual' | 'automatic' <optional>
'automatic' Sets the floor selection mode. Can be 'automatic' or 'manual'. Defaults to 'automatic'.
buildingSelectionMode 'manual' | 'automatic' <optional>
'automatic' Sets the building selection mode. Can be 'automatic' or 'manual'. Defaults to 'automatic'.
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

# (target) → {Array}

Retrieves the display rules for a given target.
Parameters:
Name Type Description
target Location The target for which to retrieve the display rules.
- An array of display rules.
Array

# (locationId) → {DisplayRule}

Returns the current state DisplayRule for a location.
Parameters:
Name Type Description
locationId string
DisplayRule

# 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.

# deselectLocation()

Clears the selected Location.

# 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

# getBuilding() → {Building}

Gets the building that currently is in focus
Building
Building

# getBuildingOutlineOptions() → {BuildingOutlineOptions}

Gets the building outline options

# getBuildingSelectionMode() → {'manual'|'automatic'}

Retrieves the building selection mode.
The building selection mode, either 'automatic' or 'manual'.
'manual' | 'automatic'

# getDirectionsRenderer() → {DirectionsRenderer}

Returns the DirectionsRenderer instance. The DirectionsRenderer is responsible for rendereing routes on the map.
DirectionsRenderer

# getDisplayRule(target, ignoreOverridesopt) → {DisplayRule}

Gets the DisplayRule for a given location
Parameters:
Name Type Attributes Default Description
target Location
ignoreOverrides boolean <optional>
false When true the display rule is returned without the overrides.
DisplayRule

# getFilter() → {Array:.<string:>}

Returns the array of locations ids to filter by.
Array:.<string:>

# getFloor() → {string}

Gets the floor
floor
string

# getFloorSelectionMode() → {'manual'|'automatic'}

Retrieves the floor selection mode.
The floor selection mode, either 'automatic' or 'manual'.
'manual' | 'automatic'

# getHighlight() → {Array:.<string:>}

Returns the array of highlighted locations ids.
Array:.<string:>

# getHoveredLocation() → {Location}

Gets the hovered location.
Location

# getLabelOptions() → {LabelOptions}

Gets label's options
LabelOptions

# getLocationSettings(location) → {Object}

Gets location settings object.
Parameters:
Name Type Description
location Location
Object

# getMap() → {google.maps.Map|mapboxgl.Map}

Gets the current map instance.
google.maps.Map | mapboxgl.Map

# getMapIndoorsStyle() → {MapStyle}

Gets the current MapsIndoors style.
MapStyle

# 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

# getSelectedLocation() → {Location}

Gets the selected Location.
Location

# getSolutionConfig() → {SolutionConfig}

Gets the solution config.
- Solution Config.

# getStatefulDisplayRule(target, ignoreOverridesopt) → {DisplayRule}

Gets the stateful display rule for a given location. A stateful display rule is a display rule that is combined with the location's current state display rule.
Parameters:
Name Type Attributes Default Description
target Location
ignoreOverrides boolean <optional>
false When true the display rule is returned without the overrides.
DisplayRule

# getTileURL() → {string}

Creates the tile url for the current venue, floor and map style.
string

# getVenue() → {Venue}

Gets the venue
Venue
Venue

# 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

# highlight(ids, fitView)

Highlight locations on the map by array of ids.
Parameters:
Name Type Description
ids Array:.<string:> An array of location ids to highlight on the map.
fitView boolean Change the map viewport to fit the current filter.

# hoverLocation(location)

Sets the Location to be hovered. (Until another Location is hovered, either by calling this method again or by moving the mouse).
Parameters:
Name Type Description
location Location The Location be hovered.

# overrideDisplayRule(target, displayRule)

Will override the default display rule for the target.
Parameters:
Name Type Description
target string | Array:.<string:> Target id (type or location).
displayRule DisplayRule The 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).

# selectLocation(location)

Select a Location.
Parameters:
Name Type Description
location Location The Location be selected.

# setBuilding(building) → {void}

Sets the building in focus.
Parameters:
Name Type Description
building Building
void

# setBuildingOutlineOptions(options)

Sets the building outline options
Parameters:
Name Type Description
options BuildingOutlineOptions

# setBuildingSelectionMode(mode)

Sets the building selection mode.
Parameters:
Name Type Default Description
mode 'manual' | 'automatic' automatic The building selection mode. Defaults to 'automatic'.

# 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

# setFloor(floor)

Sets the floor
Parameters:
Name Type Description
floor string

# setFloorSelectionMode(mode)

Sets the floor selection mode.
Parameters:
Name Type Default Description
mode 'manual' | 'automatic' automatic The floor selection mode. Defaults to 'automatic'.

# setLabelOptions(opts)

Sets the label options used for rendering labels on the map.
Parameters:
Name Type Description
opts LabelOptions

# 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 *

# setMapsIndoorsStyle(mapStyle)

Sets the map style.
Parameters:
Name Type Description
mapStyle MapStyle

# setSolutionConfig(solutionConfig)

Sets the solution config.
Parameters:
Name Type Description
solutionConfig SolutionConfig Solution Config object.

# setVenue(venue)

Sets the venue
Parameters:
Name Type Description
venue Venue

# 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

# unhoverLocation()

Unsets the hovered location.

# static addVenuesToSync(venueIds)

Set one or more venues to sync location data for.
Parameters:
Name Type Description
venueIds string | Array:.<string:> An array of venue ids.

# static getLanguage() → {string}

Gets the current configured language for mapsindoors.
string

# static getUserRoles() → {Array:.<UserRole:>}

Gets the user roles that will be applied when querying routes and locations.
- Array of UserRoles.
Array:.<UserRole:>

# static removeVenuesToSync(venueIds)

Remove one or more venues from the synced data.
Parameters:
Name Type Description
venueIds string | Array:.<string:> An array of venue ids.

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

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.
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', () => {...})

Object

# mouseenter

This event will fire when the cursor of a pointing device is moved so it is within the bounds of a Location.
Properties:
Name Type Description
location Location
Example
mapsIndoors.addListener('mouseenter', (location) => {...});

Object

# mouseleave

This event will fire when the cursor of a pointing device is moved so it leaves the bounds of a Location.
Properties:
Name Type Description
location Location
Example
mapsIndoors.addListener('mouseleave', (location) => {...});

# 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) => {...});