Constructor
new FiltersMapConnector()
- Since:
- Source:
Extends
Members
type :string
The type of Backbone.Model this is.
Type:
- Since:
- Default Value:
- Source:
Methods
addSpatialFilterIfNeeded(add)
Adds a new SpatialFilter to the Filters collection if no spatial
filters are found and 'add' is true. This will trigger a collection
update, which will re-run the findAndSetSpatialFilters function.
Parameters:
Name |
Type |
Description |
add |
boolean
|
Whether to add a SpatialFilter if none are found
in the collection. |
- Source:
connect()
Starts listening to the Map Interaction model for changes in the
'viewExtent' attribute, and calls the updateSpatialFilters function
when changes are detected. This method needs to be called for the
connector to work.
- Source:
defaults()
Properties:
Name |
Type |
Description |
filtersList |
Array.<Filter>
|
An array of Filter models to
optionally add to the Filters collection |
filters |
Filters
|
A Filters collection to connect to the Map |
spatialFilters |
Array.<SpatialFilter>
|
An array of SpatialFilter
models present in the Filters collection. |
map |
Map
|
The Map model that will update the spatial filters |
isConnected |
boolean
|
Whether the connector is currently
listening to the Map model for changes. Set automatically when the
connector is started or stopped. |
onMoveEnd |
function
|
A function to call when the map is
finished moving. This function will be called with the connector as
'this'. |
- Since:
- Source:
disconnect(resetSpatialFilteropt)
Stops all Filter-Map listeners, including listeners on the Filters
collection and the Map model.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
resetSpatialFilter |
boolean
|
<optional>
|
false
|
Whether to reset the
spatial filter values to their defaults. This will remove any spatial
constraints from the search. |
- Source:
findAndSetSpatialFilters(addopt)
Finds and sets the spatial filters within the Filters collection. Stops
any existing listeners, adds a new listener for collection updates, and
adds a spatial filter if needed.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
add |
boolean
|
<optional>
|
false
|
Whether to add a SpatialFilter if none
are found in the collection. |
- Source:
initialize(attr, options)
Set up the model connections.
Parameters:
Name |
Type |
Description |
attr |
object
|
The attributes passed to the model, must include
a Filters collection and a Map model. |
options |
object
|
The options passed to the model.
Properties
Name |
Type |
Attributes |
Default |
Description |
addSpatialFilter |
boolean
|
<optional>
|
true
|
Whether to add a
SpatialFilter to the Filters collection if none are found. The
connector won't work without a SpatialFilter, but it will listen for
updates to the Filters collection and connect to any SpatialFilters
that are added. |
|
- Source:
listenOnceToFiltersUpdates()
Adds a listener to the Filters collection for updates, to re-run the
findAndSetSpatialFilters function.
- Source:
removeSpatialFilter()
Removes all SpatialFilter models from the Filters collection and
destroys them.
- Source:
resetSpatialFilter()
Reset the spatial filter values to their defaults. This will remove
any spatial constraints from the search.
- Source:
setSpatialFilters()
Sets the SpatialFilter models found within the Filters collection to
the 'spatialFilters' attribute.
- Source:
updateSpatialFilters()
Updates the spatial filters with the current map extent and zoom level.
- Source: