Reusable Accessible Mapping Platform

API Docs for: 2.0.0
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

Methods

_checkMaster

() private

Synchronizes the state of the master Checkbox with the state of the group. All group members checked -> master checked Any of the group members unchecked -> master unchecked

_emit

(
  • agency
)
private

Emits a TOGGLE event when the checkbox's state is changed.

Parameters:

  • agency String

    Specified the agency that toggled the Checkbox.

_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

_getSymbolConfig

(
  • layerUrl
  • wmsName
)
Esri/layer/symbology

Gets the defined symbology from a layer's web service

Parameters:

  • layerUrl String

    A URL to the feature layer service

  • wmsName String

    WMS Layer name. Optional. Should only be provided if attempting to get a WMS layer.

Returns:

Esri/layer/symbology:

The defined symbology from the layer definition

_hideLoadingImg

() private

Hides the loading image.

_initEventHandlers

(
  • map
)
private

Creates event handlers for the map control: click, mouse-over, load, extent change, and update events.

Parameters:

  • map Object

    A ESRI map object

_initListeners

(
  • map
)
private

Subscribe to external events (published using topic.publish) and react accordingly

Parameters:

_initRepublishers

(
  • map
)
private

Republishes map events to the outside using topic.publish

Parameters:

_initScale

(
  • event
)
private

Initialize Map Scale

Parameters:

_showLoadingImg

() private

Shows the loading image.

_updateScale

(
  • event
)
private

Update Map Scale when zoom level changes

Parameters:

AddStaticLayer

(
  • layer_type
  • layer_url
  • layer_op
)
private

Add a static, non-interactive Layer to the map

Parameters:

  • layer_type String

    A value which controls how the layer is going to be added to the map

  • layer_url String

    A URL pointing to a valid map service endpoint

  • layer_op Number

    A value between 0.0 and 1.0 which determines the transparency of the layer

adjustExpandAllButtonState

() private

Changes the state of the expand all control if all the nodes are expanded.

adjustPaneWidth

() private

Changes the width of the layers pane to accommodate for the scrollbar if it's needed.

checkBoundary

(
  • e
  • maxExtent
)
Esri/geometry/Extent

Given an ESRI Extent Object, returns a new ESRI Extent Object that contains the extent adjusted according to this map's maximum extent

NOTE: this method is currently unused!

Parameters:

  • e Esri/geometry/Extent

    the extent Object

  • maxExtent Esri/geometry/Extent

    the maximum extent

Returns:

Esri/geometry/Extent:

An adjusted extent, if the target extent is outside the boundary

createExtent

(
  • extentConfig
  • sr
)
Esri/geometry/Extent private

Instantiates an extent from a JSON config object and spatial reference

Parameters:

Returns:

Esri/geometry/Extent:

An ESRI extent object based on the config data

getFeatureLayer

(
  • featureUrl
)
Esri/layer/FeatureLayer private

Return the feature layer corresponding to the given url.

Parameters:

  • featureUrl String

    the url of the feature layer

Returns:

Esri/layer/FeatureLayer:

feature layer

getLayerConfig

(
  • url
  • wmsName
)

Returns the feature layer config for the given url

Parameters:

  • url String
  • wmsName String

    WMS Layer name. Optional. Should only be provided if attempting to get a WMS layer.

getSymbolForFeature

(
  • feature
)
Icon

Given a feature object or a graphic object (or any object that has a getLayer method and an attributes field) return the object containing the image URL and legend text for that feature/graphic object.

Parameters:

Returns:

Icon:

The default icon used to represent the feature layer

getSymbolForLayer

(
  • layer
  • wmsName
)
Icon

Gets the default symbology icon from a layer's web service

Parameters:

  • layer Object

    A feature layer

  • wmsName String

    WMS Layer name. Optional. Should only be provided if attempting to get a WMS layer.

Returns:

Icon:

The default icon from the layer's symbology

getVisibleFeatureLayers

() Array

Returns a list of feature layers that are currently visible on the map.

Returns:

Array:

an array of Esri/layer/FeatureLayer objects

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.

loadStrings

()

Updates some of the Strings on the HTML page using the config string resources

newPopup

(
  • popupAttr
)
private

Create a new PopupBase object from the settings provided.

Parameters:

Returns:

popup

republish

(
  • name
)
private

Republish map events using topic.publish

Parameters:

setBoundingBoxVisibility

(
  • layerId
)
private

Sets the visibility of the bounding box that belongs to the layer with the given layerId. Note: the layerId needs to be the ID of the featurelayer, not the ID of the actual bounding box layer.

Parameters:

  • layerId String

    the id of the layer whose bounding box visibility should be set

setButtonEvents

() private

Adjusts UI layout according to a layer event.

setCheckboxEvents

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

setEachState

(
  • fcn
)
chainable

Toggle all the checkboxes based on the return value of the given function.

Parameters:

  • fcn Function

    a function that takes a checkbox as an argument and returns true if the given checkbox should be toggled on, false if it should be toggled off

setLayerReorderingEvents

() private

Sets all the events to handle layer reordering with both mouse and keyboard.

setState

(
  • state
)
Checkbox chainable

Inherited from CheckboxGroup but overwritten in src\js\RAMP\Utils\checkbox.js:255

Toggle the state of Checkbox.

Parameters:

  • state Boolean

    Specifies the state of the checkbox: true, false

Returns:

Checkbox:

Control object for chaining

Properties

agency

Object private

An object specifying possible agencies that can affect the Checkbox.

Example:

 agency: {
      USER: "USER",
      CODE: "CODE"
  }

baseLayer

Esri/layers/ArcGISTiledMapServiceLayer private

The basemap layer

boundingBoxLayers

Array of esri/layer/GraphicsLayer

A list GraphicsLayer that represent the extent bounding box of the feature layers. {[esr/layer/featurelayers]} featureLayers A list of feature layers found in the application config {[esri/layer/graphiclayer]} An array of graphic layers to add to the map

boundingBoxMapping

Object private

Maps the id of a graphic layer to the GraphicsLayer Object that represents its extent bounding box. A dictionary of String, Esri/layer/GraphicsLayer pairs.

cssClass

Object

Inherited from CheckboxGroup but overwritten in src\js\RAMP\Utils\checkbox.js:74

active, focus, and check CSS class to be applied to the Checkbox correspondingly.

Example:

 cssClass: {
     active: "active",
     focus: "focused",
     check: "checked"
 }

event

Object private

Inherited from CheckboxGroup but overwritten in src\js\RAMP\Utils\checkbox.js:156

Event names published by the Checkbox

Default: null

Example:

 {
     TOGGLE: "checkbox/toggle"
 }

featureLayers

Array private

An Array of Esri/layer/FeatureLayer objects.

featureLayerStartIndex

Integer private

The map not only contains feature layers, but also other layers such as the basemap layer, highlight layer, bounding box layer, etc. This variable is used to store the starting index of the feature layers in the map.

fullExtent

Esri/geometry/Extent private

Used for full extent in nav widget

getConfigUrl

Object

Returns a URL that points to the application configuration (JSON format) if it's hosted on a web service. This is not required if the application has a JSON config file in the website's folder

getMap

Object

Return the map control object

getMaxExtent

Object

The maximum extent of the map control is allowed to go to

id

String

Id of the Checkbox as specified by nodeIdAttr.

Default: null

InitExtent

Esri/geometry/Extent private

The initial extent of the map

label

Object

Inherited from CheckboxGroup but overwritten in src\js\RAMP\Utils\checkbox.js:93

check and uncheck label texts to be applied to the Checkbox labels.

Example:

 label: {
     check: "check",
     uncheck: "unchecked"
 }

labelNode

JObject private

Node of the input checkbox label.

Default: null

master

Object

Options for the master Checkbox.

Example:

 master: {
     node: null,
     checkbox: null,
     nodeIdAttr: null,

     cssClass: {
         active: "active",
         focus: "focused",
         check: "checked"
     },

     label: {
         check: "checked",
         uncheck: "unchecked"
     },

     onChange: function () { }
 }

maxExtent

Esri/geometry/Extent private

The maximum extent of the map

node

JObject

Node of the input checkbox originally supplied to the Checkbox.

Default: null

nodeIdAttr

String

Inherited from CheckboxGroup but overwritten in src\js\RAMP\Utils\checkbox.js:65

Name of the "data-*" attribute set on the checkbox node to be treated as the checkbox id.

Default: "id"

nodes

JArray

Inherited from CheckboxGroup but overwritten in src\js\RAMP\Utils\checkboxGroup.js:62

Nodes of the checkbox nodes originally supplied to the CheckboxGroup.

Default: []

onChnage

Function

Inherited from CheckboxGroup but overwritten in src\js\RAMP\Utils\checkbox.js:110

A function to be called when the state of the Checkbox changes.

Example:

 function () { }

spatialReference

Esri/SpatialReference private

The spatial reference of the map

state

Boolean

State of the Checkbox: true | false

Default: null

url

String private

The URL of the basemap that is on by default

wmsLayers

Array private

An Array of Esri/layer/WMSLayer objects.

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.

MASTER_TOGGLE

Published whenever the master Checkbox get toggled.

Event Payload:

  • event Object
    • checkbox Checkbox

      master Checkbox object that has been toggled

    • agency String

      Agency that toggled the Checkbox

MEMBER_TOGGLE

Published whenever a Checkbox get toggled.

Event Payload:

  • event Object
    • checkbox Checkbox

      Checkbox object that has been toggled

    • agency String

      Agency that toggled the Checkbox

TOGGLE

Inherited from CheckboxGroup but overwritten in src\js\RAMP\Utils\checkbox.js:169

Published whenever a Checkbox get toggled.

Event Payload:

  • event Object
    • checkbox Checkbox

      Checkbox object that has been toggled

    • agency String

      Agency that toggled the Checkbox