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
Methods
# 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 |
# 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) → {DisplayRule}
Gets the DisplayRule for a given location
Parameters:
Name | Type | Description |
---|---|---|
feature |
Location |
# 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>
# 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
# 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 locaiton 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 |
# 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', () => {...});
# 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) => {...});