FilterManager Class
FilterManager class. Represents the legend next to the map and the controls to toggle each map layer's visibility and boundary box. The FilterManager also includes a attribute filter that allows the user to hide map features based on a attribute values
For a doc with diagrams on how this class works, please see http://ecollab.ncr.int.ec.gc.ca/projects/science-apps/priv/RAMP/RAMP%20AMD%20Filter%20Module.docx
Imports RAMP Modules:
RAMP
GlobalStorage
Map
EventManager
LayerItem
LayerGroup
Theme
TmplHelper
Util
Dictionary
PopupManager
Checkbox
CheckboxGroup
Uses RAMP Templates:
templates/filter_manager_template.json templates/filter_wms_meta_Template.json
Item Index
Methods
Events
- FilterManager.BOX_VISIBILITY_TOGGLED
- FilterManager.LAYER_TRANSPARENCY_CHANGED
- FilterManager.LAYER_VISIBILITY_TOGGLED
- FilterManager.SELECTION_CHANGED
- FilterManager.TOGGLE_BOX_VISIBILITY [subscribed]
- FilterManager.TOGGLE_LAYER_VISIBILITY [subscribed]
- FilterManager.UI_COMPLETE
- FilterManager.WMS_QUERY_CHANGE
Methods
_getFeatures
-
fl
Queries all map points on a given feature layer and returns their attributes
Parameters:
-
fl
ObjectA feature layer to query
Returns:
An array of attributes from the designated feature layer
_getField
-
fl
-
field
Grabs all distinct values of the given field from a featureLayer.
Parameters:
Returns:
deferred A deferred object which will resolve to an array of unique values
addLayer
-
layerType
-
layerRamp
-
[options]
Add a provided layer to the layer selector.
adjustPaneWidth
()
private
Changes the width of the layers pane to accommodate for the scrollbar if it's needed.
createGroups
()
private
Sets UI status of a layer presentation (checkbox and eye) according to the user action: select / de-select a layer. publishes event "filterManager/box-visibility-toggled" every time a layer status changed. There should only be one eye and one global checkbox, but we say checkbox"es" because jquery returns a list and it's easier to write a function that takes a list of checkboxes than to write two functions, one to take a list and one to take an individual checkbox
getLayerItem
-
layerId
Returns a LayerItem object with specified layerId.
Parameters:
-
layerId
Stringa layer id
getLayerState
-
layerId
Returns the state of the layer with the specified layer id.
Parameters:
-
layerId
Stringa layer id
init
()
Reads the application configuration and creates the legend and filter management widget
initListeners
()
private
Initiates a listener to handle tab deselected event
initScrollListeners
()
private
Adjusts filter style according to the scroll action on the layers.
initTooltips
()
private
initialize a tooltip for each layer, using the layer name.
removeLayer
-
layerType
-
layerId
Remove a layer from the layer selector.
setButtonEvents
()
private
Sets event handlers for various controls that may be present in the layer items. All event handlers are set on the main list container and are independed of the individual layer items.
setLayerOffScaleState
-
layerId
Checks if a specific layer has data that is not visible and sets the appropriate layer state.
Parameters:
-
layerId
Stringa layer id
setLayerOffScaleStates
()
private
Checks if any of the layers have data that is not visible and sets the appropriate layer state.
setLayerReorderingEvents
()
private
Sets all the events to handle layer reordering with both mouse and keyboard.
setLayerState
-
layerId
-
layerState
-
[options]
Set the state of the specified layer to the provided value.
setLayerState
-
layerId
-
layerState
-
[options]
Set the state of the specified layer to the provided value. Public hook to call internal setLayerState function.
ui.addLayerGroup
()
private
Add the provided layer group node to the layer selector ui.
ui.update
()
private
Updates certain UI aspects like layer settings panel (visibility sliders for now only), layer visibility and bounding box toggles, and layer sorting.
Events
FilterManager.BOX_VISIBILITY_TOGGLED
Published whenever the "box" button for a layer is clicked
FilterManager.LAYER_TRANSPARENCY_CHANGED
Published each time the transparency of a layer is modified.
FilterManager.LAYER_VISIBILITY_TOGGLED
Published whenever the "eye" button for a layer is clicked
FilterManager.SELECTION_CHANGED
Published whenever the layer list is rearranged
FilterManager.TOGGLE_BOX_VISIBILITY [subscribed]
Tells the filter manager to toggle a layer on or off
FilterManager.TOGGLE_LAYER_VISIBILITY [subscribed]
Tells the filter manager to toggle a layer on or off
FilterManager.UI_COMPLETE
Published after the ui for the filter manager finishes initializing.