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
Item Index
Methods
- _getFeatures
- _getField
- _getSymbolConfig
- adjustExpandAllButtonState
- adjustHeight
- adjustHelpDimensions
- adjustPaneWidth
- adjustWidth
- adjutSubPanelDimensions
- captureSubPanel
- dockSubPanel
- generateFilterCheckboxes
- generateGlobalCheckboxes
- getLayerConfig
- getSymbolForFeature
- hideSubPanel
- init
- initListeners
- initScrollListeners
- initTooltips
- layoutChange
- load
- loadStrings
- newPopup
- newSubPanel
- setButtonEvents
- setCheckboxEvents
- showSubPanel
- subPanelChange
- toggleBox
- toggleEye
- toggleFooter
- toggleFullScreenMode
- toggleGlobalBox
- toggleGlobalEye
- toggleSubPanelContainer
Attributes
Events
- FilterManager.events.BOX_VISIBILITY_TOGGLED
- FilterManager.events.GLOBAL_BOX_VISIBILITY_TOGGLED
- FilterManager.events.GLOBAL_LAYER_VISIBILITY_TOGGLED
- FilterManager.events.LAYER_VISIBILITY_TOGGLED
- FilterManager.events.SELECTION_CHANGED
- FilterManager.events.TOGGLE_BOX_VISIBILITY [subscribed]
- FilterManager.events.TOGGLE_GLOBAL_BOX_VISIBILITY [subscribed]
- FilterManager.events.TOGGLE_GLOBAL_LAYER_VISIBILITY [subscribed]
- FilterManager.events.TOGGLE_LAYER_VISIBILITY [subscribed]
- FilterManager.events.UI_COMPLETE
- gui.events.FULLSCREEN_CHANGE
- gui.events.HELP_PANEL_CHANGE
- gui.events.LAYOUT_CHANGE
- gui.events.PANEL_CHANGE
- gui.events.PANEL_TOGGLE [subscribed]
- gui.events.SUBPANEL_CAPTURE [subscribed]
- gui.events.SUBPANEL_CHANGE
- gui.events.SUBPANEL_CLOSE [subscribed]
- gui.events.SUBPANEL_DOCK [subscribed]
- gui.events.SUBPANEL_OPEN [subscribed]
- gui.events.TAB_DESELECTED
- gui.events.TAB_SELECTED
- gui.events.TOGGLE_FULLSCREEN [subscribed]
- gui/add-layer-panel-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
-
The
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
_getSymbolConfig
-
layerUrl
Gets the defined symbology from a layer's web service
Parameters:
-
layerUrl
StringA URL to the feature layer service
Returns:
The defined symbology from the layer definition
adjustExpandAllButtonState
()
private
Changes the state of the expand all control if all the nodes are expanded.
adjustHeight
()
private
Adjust the height of the body of the page on initial load and every page resize.
adjustHelpDimensions
()
private
Adjusts dimensions of the help panel relative to the mapContent div
.
adjustPaneWidth
()
private
Changes the width of the layers pane to accommodate for the scrollbar if it's needed.
adjustWidth
()
private
Adjusts the width of the slide out panel and the map section.
adjutSubPanelDimensions
-
subPanel
Adjusts the dimensions and position of the SubPanel when layout of the page is changing.
Parameters:
-
subPanel
SubPanelSubPanel whose dimensions and position need to be adjusted
captureSubPanel
-
attr
Finds a SubPanel with origin
equal to the supplied consumeOrigin
and
- changes its
origin
to the suppliedorigin
- moves the SubPanel in the DOM hierarchy and attaches it to the specified target
Parameters:
-
attr
SubPanelSettingsSettings for the SubPanel; only
origin
,consumeOrigin
andtarget
are required here
dockSubPanel
-
attr
Moves the SubPanel with the specified origin
in the DOM hierarchy to the new specified target
; if target
is not specified, the SubPanel is attached to the SidePanel.
Parameters:
-
attr
SubPanelSettingsSettings for the SubPanel; only
target
andorigin
are required here
generateFilterCheckboxes
()
String
Generates legend for each interactive layer on the map (non-basemap layers).
Returns:
a string representation of the legends with simplified layer info for identification
generateGlobalCheckboxes
()
Object
Generates a data grid row with a checkbox.
Returns:
toggleRow the generated data grid row.
getSymbolForFeature
-
feature
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:
-
feature
Object
Returns:
The default icon used to represent the feature layer
hideSubPanel
-
attr
-
speed
-
d
Closes the SubPanel whose origin
is specified in the attr
parameter.
Parameters:
-
attr
SubPanelSettingsonly
origin
attribute is required here -
speed
NumberDuration of the closing animation
-
d
DeferredThe deferred object to be resolved upon successful closing of the panel
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.
layoutChange
()
private
Fires an event when the layout of the page changes.
load
-
id
-
req
-
load
Call load to initialize the GUI module.
loadStrings
()
Updates some of the Strings on the HTML page using the config string resources
newPopup
-
popupAttr
Create a new PopupBase object from the settings provided.
Parameters:
-
popupAttr
PopupBaseSettingsPopup settings
Returns:
popup
newSubPanel
-
attr
Create a new SubPanel with the settings provided.
Parameters:
-
attr
SubPanelSettingsSubPanel settings
Returns:
A newly created SubPanel
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
showSubPanel
-
attr
Creates and opens a new SubPanel with given settings.
If the SubPanel with the requested origin
is already present, updates its content.
Parameters:
-
attr
SubPanelSettingsSettings for the SubPanel instance
subPanelChange
-
visible
-
origin
-
container
Fires an even when the subpanel closes or opens.
toggleBox
-
checked
-
node
Toggles the boundary box button beside a given layer in the legend. Fires the box_visibility event.
toggleEye
-
checked
-
node
Toggles the visibility button (or eye) beside a given layer in the legend. Fires the layer_visibility event.
toggleFullScreenMode
-
fullscreen
Toggles the FullScreen mode of the application
Parameters:
-
fullscreen
Booleantrue/undefined - expand; false - collapse
toggleGlobalBox
-
checked
Toggles each layers boundary box display check box when the global boundary box button is clicked
Parameters:
-
checked
BooleanThe value of the global boundary box button's check status (on or off)
toggleGlobalEye
-
checked
Toggles each layers visibility when the global visibility button is clicked
Parameters:
-
checked
BooleanThe value of the global visibility button's check status (on or off)
toggleSubPanelContainer
()
private
Adjust the SubPanels to the full-screen mode of the page.
Attributes
Events
FilterManager.events.BOX_VISIBILITY_TOGGLED
Published whenever the "box" button for a layer is clicked
FilterManager.events.GLOBAL_BOX_VISIBILITY_TOGGLED
Published whenever the global "box" button is clicked
FilterManager.events.GLOBAL_LAYER_VISIBILITY_TOGGLED
Published whenever the global "eye" button is clicked
FilterManager.events.LAYER_VISIBILITY_TOGGLED
Published whenever the "eye" button for a layer is clicked
FilterManager.events.SELECTION_CHANGED
Published whenever the layer list is rearranged
FilterManager.events.TOGGLE_BOX_VISIBILITY [subscribed]
Tells the filter manager to toggle a layer on or off
FilterManager.events.TOGGLE_GLOBAL_BOX_VISIBILITY [subscribed]
Tells the filter manager to toggle all bounding boxes on or off
FilterManager.events.TOGGLE_GLOBAL_LAYER_VISIBILITY [subscribed]
Tells the filter manager to toggle all layers on or off
FilterManager.events.TOGGLE_LAYER_VISIBILITY [subscribed]
Tells the filter manager to toggle a layer on or off
FilterManager.events.UI_COMPLETE
Published after the ui for the filter manager finishes initializing.
gui.events.FULLSCREEN_CHANGE
Published each time fullscreen is toggled
gui.events.HELP_PANEL_CHANGE
Published each time the help panel opens or closes.
gui.events.LAYOUT_CHANGE
Published each time the layout changes.
gui.events.PANEL_CHANGE
Published each time the panel opens/closes
gui.events.PANEL_TOGGLE [subscribed]
Toggles the main panel (i.e. collapses it if was expanded, and expands it if it was collapsed)
gui.events.SUBPANEL_CAPTURE [subscribed]
Attaches subPanel node to the module that calls it in the DOM hierarchy
Event Payload:
-
consumeOrigin
Object
gui.events.SUBPANEL_CHANGE
Published each time the subpanel opens/closes
gui.events.SUBPANEL_CLOSE [subscribed]
Closes the sub panel
Event Payload:
-
origin
Stringthe name of the module that requested to close the subPanel (e.g. "filterManager")
gui.events.SUBPANEL_DOCK [subscribed]
Moves the panel up DOM hierarchy next to the sidePanel, or to other target
Event Payload:
-
origin
Stringthe name of the module that requested to dock the subPanel (e.g. "filterManager")
-
target
JNodewhere to move the subPanel; if not supplied; sidePanel is used
gui.events.SUBPANEL_OPEN [subscribed]
Opens the subpanel
Event Payload:
-
attr
SubPanelSettingsSettings for the SubPanel
gui.events.TAB_DESELECTED
Fires whenever a tab has been deselected in the main panel
gui.events.TAB_SELECTED
Fires whenever a tab has been selected in the main panel
gui.events.TOGGLE_FULLSCREEN [subscribed]
Toggles the fullscreen