undefined

API Docs for: 5.4.2
Show:

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

Methods

_getFeatures

(
  • fl
)
Object

Queries all map points on a given feature layer and returns their attributes

Parameters:

  • fl Object

    A feature layer to query

Returns:

Object:

An array of attributes from the designated feature layer

_getField

(
  • fl
  • field
)
Object

Grabs all distinct values of the given field from a featureLayer.

Parameters:

  • fl Object

    A feature layer to query

  • field String

    The field (or column) to query in the feature layer

Returns:

Object:

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.

Parameters:

  • layerType String

    layer type - name of the layer group

  • layerRamp Object

    ramp object

  • [options] Object optional

    additional options for the layer item

    • [state] String optional

      the state to initialize in. Default value is LOADING

    • [notices] String optional

      optional notices, for example error notices if the layer cannot be loaded from the get go

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
)
private

Returns a LayerItem object with specified layerId.

Parameters:

getLayerState

(
  • layerId
)
private

Returns the state of the layer with the specified layer id.

Parameters:

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.

Parameters:

  • layerType String

    layer type - name of the layer group

  • layerId String

    layer id of layer to remove

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
)
private

Checks if a specific layer has data that is not visible and sets the appropriate layer state.

Parameters:

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]
)
private

Set the state of the specified layer to the provided value.

Parameters:

  • layerId String

    a layer id

  • layerState String

    a state to set the specified layer to

  • [options] Object optional

    additional options to be passed to the layerItem upon setting state

setLayerState

(
  • layerId
  • layerState
  • [options]
)

Set the state of the specified layer to the provided value. Public hook to call internal setLayerState function.

Parameters:

  • layerId String

    a layer id

  • layerState String

    a state to set the specified layer to

  • [options] Object optional

    additional options to be passed to the layerItem upon setting state

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

Provided by the UI module.

Defined in src/js/RAMP/Modules/eventManager.js:46

Published whenever the 'box' button for a layer is clicked

Event Payload:

  • event Object
    • checked Boolean

      true if the 'box' button is checked, false otherwise

    • node Object

      the input dom node that represents the checkbox

FilterManager.LAYER_TRANSPARENCY_CHANGED

Provided by the UI module.

Defined in src/js/RAMP/Modules/eventManager.js:35

Published each time the transparency of a layer is modified.

Event Payload:

  • event Object
    • layerId String

      the id of the layer

    • value Int

      the value of the slider

FilterManager.LAYER_VISIBILITY_TOGGLED

Provided by the UI module.

Defined in src/js/RAMP/Modules/eventManager.js:24

Published whenever the 'eye' button for a layer is clicked

Event Payload:

  • event Object
    • checked Boolean

      true if the 'eye' button is checked, false otherwise

    • node Object

      the input dom node that represents the checkbox

FilterManager.SELECTION_CHANGED

Provided by the UI module.

Defined in src/js/RAMP/Modules/eventManager.js:57

Published whenever the layer list is rearranged

Event Payload:

  • event Object
    • id String

      the layer Id

    • index Integer

      index of the layer that moved. index is relative to the control, not the layer stack in the map

FilterManager.TOGGLE_BOX_VISIBILITY [subscribed]

Provided by the UI module.

Defined in src/js/RAMP/Modules/eventManager.js:89

Tells the filter manager to toggle a layer on or off

Event Payload:

  • event Object
    • layerId String

      the name of the layer to toggle

    • state Boolean

      true if the layer should be visible, false otherwise

FilterManager.TOGGLE_LAYER_VISIBILITY [subscribed]

Provided by the UI module.

Defined in src/js/RAMP/Modules/eventManager.js:78

Tells the filter manager to toggle a layer on or off

Event Payload:

  • event Object
    • layerId String

      the name of the layer to toggle

    • state Boolean

      true if the layer should be visible, false otherwise

FilterManager.UI_COMPLETE

Provided by the UI module.

Defined in src/js/RAMP/Modules/eventManager.js:69

Published after the ui for the filter manager finishes initializing.

FilterManager.WMS_QUERY_CHANGE

Provided by the UI module.

Defined in src/js/RAMP/Modules/eventManager.js:99

Published each time wms query is toggled

Event Payload:

  • evt Object

    the event Object

    • allowed Boolean

      true if wms query is allowed, false if wms query is turned off.