FloorSelection
A collection of zero or more Floor instances. A FloorSelection is returned by UnitMap.floors() and provides a chainable API for querying and manipulating floors, similar to LevelSelection.
map.on("ready", function () {
// Get a floor selection instance from the map:
var floors = map.floors();
// Show the floor with a `label` of `Floor 1`:
floors.where({ label: "Floor 1" }).show();
});FloorSelection.length
The number of Floor instances in the collection.
FloorSelection.where([attrs])
Get the Floor in the collection whose attributes match the given key-value pairs.
Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| attrs | No | Object | {} | An object of key-value pairs to filter by, where a key is a Floor attribute such as label or shortLabel. |
Returns
A new FloorSelection instance.
FloorSelection.find(id)
Get all Floor instances in the collection which match the given id or ids.
Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| id | Yes | String | Array | undefined | A single id or an array of ids to look for. |
Returns
A new FloorSelection instance.
FloorSelection.first()
Get the first Floor in the collection.
Returns
A new FloorSelection instance.
FloorSelection.last()
Get the last Floor in the collection.
Returns
A new FloorSelection instance.
FloorSelection.at(index)
Get the Floor at the given index.
Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| index | Yes | Integer | undefined | The index of the desired Floor. |
Returns
A new FloorSelection instance.
FloorSelection.show()
Display the first Floor in the collection, hiding the other floors of the map. This method is chainable.
Returns
The object chain.
FloorSelection.each(iterator)
Iterate over each Floor in the collection. This method is chainable.
Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| iterator | Yes | Function | undefined | A function invoked with each Floor in the collection. |
Returns
The object chain.
FloorSelection.map(iterator)
Map over each Floor in the collection, returning an array of the iterator results.
// Build an array of floor labels:
var labels = map.floors().map(function (floor) {
return floor.label;
});Arguments
| Argument | Required | Type | Default Value | Description |
|---|---|---|---|---|
| iterator | Yes | Function | undefined | A function invoked with each Floor in the collection. |
Returns
An Array of the iterator return values.
FloorSelection.markers()
Add or remove Marker instances across the Floor instances in the collection.
Returns
A new MarkerCollection instance.
FloorSelection.data()
Get the FloorSelection data as JSON.
Returns
An Array of JSON objects.
Updated 1 day ago
