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
Item Index
Methods
Methods
_loadLayer
-
layer
-
reloadIndex
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
Objectan instantiated, unloaded ESRI layer object
-
reloadIndex
IntegerOptional. 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
Objectan instantiated, unloaded ESRI layer object
-
reloadIndex
IntegerOptional. If reloading a layer, supply the index it should reside at. Do not set for new layers
onLayerError
-
layerId
-
newState
-
abortIfError
-
[options]
Will set a layerId's layer selector state to a new state.
onLayerError
-
evt
Deals with a layer that had an error when it tried to load.
onLayerError
-
layerId
Will remove a layer from the map, and adjust counts.
Parameters:
-
layerId
Stringconfig 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
onLayerRemove
-
evt
Reacts to a request for a layer to be removed. Usually the case when a layer errors and the user clicks remove.
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
onLayerUpdateEnd
-
evt
Reacts when a layer has updated successfully. This means the layer has pulled its data and displayed it.
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.
Events
LayerLoader.LAYER_ERROR
Indicates that a map layer has errored
LayerLoader.LAYER_LOADED
Indicates that a map layer has loaded. This means the constructor initialized and shook hands with it's data source
LayerLoader.LAYER_UPDATED
Indicates that a map layer has updated. This means the data it is showing is visible and up-to-date
LayerLoader.LAYER_UPDATING
Indicates that a map layer has started updating. This means it is getting data from its source
LayerLoader.RELOAD_LAYER
Indicates that a map layer should be removed from the map