Reusable Accessible Mapping Platform

API Docs for: 2.0.0
Show:

FeatureHighlighter Class

A class responsible for highlighting points, lines, and shapes on the map upon selection and consequent hover actions. The highlighting is achieved by manipulating svg rendering of the map as follows:

  • all existing feature layers are wrapped into a group object
  • three more group objects are created:
    • highlight group is positioned after the graphicGroup
    • zoomlight group is positioned before the graphicGroup
    • hoverlight group is positioned before the zoomlight group

and changing the opacity of the graphicGroup while adding shapes to one or more of the additional group objects.

Methods

_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

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

cloneGraphic

(
  • graphic
)
private

Creates a copy of the given graphic object.

Parameters:

  • graphic Object

    Graphic object to clone

Returns:

clone A cloned Graphic object

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

getVisibleFeatureLayers

() Array

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

Returns:

Array:

an array of Esri/layer/FeatureLayer objects

highlightGraphic

(
  • eventArg
)
private

Clones the Graphic object from the event, adds it to the Highlight layer, and lowers the opacity of other map layers to make the cloned Graphic stand out.

Parameters:

highlightGraphicHide

() private

Clears the Highlight layer and restores the opacity of the map layers.

hoverLight

(
  • eventArg
)
private

Clones the Graphic object from the event, adds it to the Hoverlight layer.

Parameters:

hoverLightHide

() private

Clears the Hoverlight layer.

init

()

Initiates the FeatureHighlighter static class.

initListeners

() private

Initiates various listeners for the class.

repositionInteractive

() private

If there a Graphic in the Highlihgh layer, resets it's bounding box and repositions an interactive maptip to match the top center of the boudning box of the highlighted graphic.

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

sortLayers

() private

Sorts and groups the svg representation of the map layers on the page to make highlighting work. Group all the feature layers and create new groups for highlight, zoomlight, and hoverlight layers.

zoomLight

(
  • eventArg
)
private

Clones the Graphic object from the event, adds it to the Zoomlight layer, and lowers the opacity of other map layers to make the cloned Graphic stand out.

Parameters:

zoomLightHide

() private

Clears the Zoomlight layer and restores the opacity of the map layers if the Highlight layer is empty.

Properties

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.

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

InitExtent

Esri/geometry/Extent private

The initial extent of the map

maxExtent

Esri/geometry/Extent private

The maximum extent of the map

spatialReference

Esri/SpatialReference private

The spatial reference of the map

url

String private

The URL of the basemap that is on by default

wmsLayers

Array private

An Array of Esri/layer/WMSLayer objects.

Events

featureHighlighter.HIGHLIGHT_HIDE [subscribed]

Provided by the UI module.

Defined in src\js\RAMP\Modules\eventManager.js:289

Dehighlights a currently highlighted feature on the map and restores opacity of the rest of the layers; hides the interactive tooltip.

featureHighlighter.HIGHLIGHT_SHOW [subscribed]

Provided by the UI module.

Defined in src\js\RAMP\Modules\eventManager.js:278

Permanently highlights a given feature on the map; display an interactive tooltip for this feature; reduces opacity of the graphicGroup layers. Even when the user moves the cursor away, the feature stays highlighted; tooltip stays put. Only one feature can be highlighted like this at a time.

Event Payload:

  • eventAttr Object

    ESRI feature click even attributes

featureHighlighter.HOVERLIGHT_HIDE [subscribed]

Provided by the UI module.

Defined in src\js\RAMP\Modules\eventManager.js:309

Dehighlights a currently highlighted (hoverlighted) feature on the map without restoring opacity of the rest of the layers;

featureHighlighter.HOVERLIGHT_SHOW [subscribed]

Provided by the UI module.

Defined in src\js\RAMP\Modules\eventManager.js:298

Temporarilly highlights (hoverlights) a given feature on the map. Intended to be dehighlighted when the user moves the cursor away; to do that, publish HOVERLIGHT_HIDE event. Effect is only visible when another feature is already permanently highlighted. Only one feature can be highlighted like this at a time.

Event Payload:

  • eventAttr Object

    ESRI feature click even attributes

featureHighlighter.ZOOMLIGHT_HIDE [subscribed]

Provided by the UI module.

Defined in src\js\RAMP\Modules\eventManager.js:329

Dehighlights a currently highlighted (zoomlighted) feature on the map; Removes the tooltip. Restores the opacity of the graphicGroup layers if no feature is highlighted at present.

featureHighlighter.ZOOMLIGHT_SHOW [subscribed]

Provided by the UI module.

Defined in src\js\RAMP\Modules\eventManager.js:317

Temporarilly highlights (zoomlightes) a given feature on the map. Intended to be dehighlighted when the user makes an action like panning or zooming the map, publish ZOOMLIGHT_HIDE event. Displays a temporary tooltip for this feature; Only one feature can be highlighted (zoomlighted) like this at a time.

Event Payload:

  • eventAttr Object

    ESRI feature click even attributes