Reusable Accessible Mapping Platform

API Docs for: 5.2.0
Show:

LayerLoader Class

Layer Loader class.

Handles the asynchronous loading of map layers (excluding basemaps) This includes dealing with errors, and raising appropriate events when the layer loads

Imports RAMP Modules:

EventManager
FeatureClickHandler
FilterManager
GlobalStorage
LayerItem
Map
MapClickHandler
Ramp
Util

Methods

_loadLayer

(
  • layer
  • reloadIndex
)
private

This function initiates the loading of an ESRI layer object to the map. Will add it to the map in the appropriate spot, wire up event handlers, and generate any bounding box layers Note: a point of confusion. The layer objects "load" event may have already finished by the time this function is called. This means the object's constructor has initialized itself with the layers data source. This functions is not event triggered to guarantee the order in which things are added.

Parameters:

  • layer Object

    an instantiated, unloaded ESRI layer object

  • reloadIndex Integer

    Optional. If reloading a layer, supply the index it should reside at. Do not set for new layers

init

()

Initializes properties. Set up event listeners

loadLayer

(
  • layer
  • reloadIndex
)

Public endpoint to initiate the loading of an ESRI layer object to the map.

Parameters:

  • layer Object

    an instantiated, unloaded ESRI layer object

  • reloadIndex Integer

    Optional. If reloading a layer, supply the index it should reside at. Do not set for new layers

onLayerError

(
  • layerId
  • newState
  • abortIfError
  • [options]
)
private

Will set a layerId's layer selector state to a new state.

Parameters:

  • layerId String

    config id of the layer

  • newState String

    the state to set the layer to in the layer selector

  • abortIfError Boolean

    if true, don't update state if current state is an error state

  • [options] Object optional

    additional options for layer item (mostly error messages in this case)

onLayerError

(
  • evt
)

Deals with a layer that had an error when it tried to load.

Parameters:

onLayerError

(
  • layerId
)
private

Will remove a layer from the map, and adjust counts.

Parameters:

  • layerId String

    config id of the layer

onLayerLoaded

(
  • evt
)

Reacts when a layer has loaded successfully. This means the site has shaken hands with the layer and it seems ok. This does not mean data has been downloaded

Parameters:

onLayerRemove

(
  • evt
)

Reacts to a request for a layer to be removed. Usually the case when a layer errors and the user clicks remove.

Parameters:

onLayerRemove

(
  • evt
)

Reacts to a request for a layer to be reloaded. Usually the case when a layer errors and user wants to try again

Parameters:

onLayerUpdateEnd

(
  • evt
)

Reacts when a layer has updated successfully. This means the layer has pulled its data and displayed it.

Parameters:

onLayerUpdateStart

(
  • evt
)

Reacts when a layer begins to update. This happens when a feature layer starts to download its data. Data download doesn't start until points are made visible. It also happens when a WMS requests a new picture.

Parameters:

Events

LayerLoader.LAYER_ERROR

Provided by the UI module.

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

Indicates that a map layer has errored

Event Payload:

  • event Object
    • layer Object

      ESRI layer object that has errored

    • error Object

      the error object

LayerLoader.LAYER_LOADED

Provided by the UI module.

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

Indicates that a map layer has loaded. This means the constructor initialized and shook hands with it's data source

Event Payload:

  • event Object
    • layer Object

      ESRI layer object that has loaded

LayerLoader.LAYER_UPDATED

Provided by the UI module.

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

Indicates that a map layer has updated. This means the data it is showing is visible and up-to-date

Event Payload:

  • event Object
    • layer Object

      ESRI layer object that has updated

LayerLoader.LAYER_UPDATING

Provided by the UI module.

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

Indicates that a map layer has started updating. This means it is getting data from its source

Event Payload:

  • event Object
    • layer Object

      ESRI layer object that is updating

LayerLoader.RELOAD_LAYER

Provided by the UI module.

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

Indicates that a map layer should be removed from the map

Event Payload:

LayerLoader.REMOVE_LAYER

Provided by the UI module.

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

Indicates that a map layer should be removed from the map

Event Payload: