LayerRecord

LayerRecord

new LayerRecord(layerClass, apiRef, config, esriLayer, epsgLookup)

Source:

Create a layer record with the appropriate geoApi layer type. Layer config should be fully merged with all layer options defined (i.e. this constructor will not apply any defaults).

Parameters:
Name Type Description
layerClass Object

the ESRI api object for the layer

apiRef Object

object pointing to the geoApi. allows us to call other geoApi functions.

config Object

layer config values

esriLayer Object

an optional pre-constructed layer

epsgLookup function

an optional lookup function for EPSG codes (see geoService for signature)

Methods

_fireEvent()

Source:

Utility for triggering an event and giving it to the listeners

_stateChange()

Source:

Handle a change in layer state

(private) _zoomToScaleSet(map, lods, zoomIn, scaleSet, zoomGraphic)

Source:

Figure out visibility scale and zoom to it. Will use layer minScale/maxScale and map levels of detail to determine scale boundaries.

Parameters:
Name Type Default Description
map Object

the map object

lods Array

level of details array for basemap

zoomIn Boolean

the zoom to scale direction; true need to zoom in; false need to zoom out

scaleSet Object

contains min and max scales for the layer.

zoomGraphic Boolean false

an optional value when zoomToScale is use to zoom to a graphic element; true used to zoom to a graphic element; false not used to zoom to a graphic element

addHoverListener()

Source:

Wire up mouse hover listener

addStateListener()

Source:

Wire up state change listener

bindEvents()

Source:

Attach event handlers to layer events

constructLayer()

Source:

Perform layer initialization tasks

createBbox()

Source:

Generate a bounding box for the layer on the given map.

destroyBbox()

Source:

Destroy bounding box

findZoomScale(lods, scaleSet, zoomIn, zoomGraphic) → {Object}

Source:

Figure out visibility scale. Will use layer minScale/maxScale and map levels of detail to determine scale boundaries.

Parameters:
Name Type Default Description
lods Array

array of valid levels of detail for the map

scaleSet Object

contains .minScale and .maxScale for valid viewing scales

zoomIn Boolean

the zoom to scale direction; true need to zoom in; false need to zoom out

zoomGraphic Boolean false

an optional value when zoomToScale is use to zoom to a graphic element; true used to zoom to a graphic element; false not used to zoom to a graphic element

Returns:

a level of detail (lod) object for the appropriate scale to zoom to

Type
Object

getFeatureCount() → {Promise}

Source:

Returns the feature count

Returns:

resolves feature count

Type
Promise

getVisibleScales() → {Promise}

Source:

Returns the visible scale values of the layer

Returns:

resolves in object properties .minScale and .maxScale

Type
Promise

isBBoxVisible() → {Boolean}

Source:

Indicates if the bounding box is visible

Returns:

indicates if the bounding box is visible

Type
Boolean

makeClickBuffer(point, map, tolerance) → {Object}

Source:

Create an extent centered around a point, that is appropriate for the current map scale.

Parameters:
Name Type Default Description
point Object

point on the map for extent center

map Object

map object the extent is relevant for

tolerance Integer 5

optional. distance in pixels from mouse point that qualifies as a hit. default is 5

Returns:

an extent of desired size and location

Type
Object

makeLayerConfig()

Source:

Creates an options object for the physical layer

onError()

Source:

Handles when the layer has an error

onMouseOut()

Source:

Handles when the mouse leaves a layer

onMouseOver()

Source:

Handles when the mouse enters a layer

onUpdateEnd()

Source:

Handles when the layer finishes updating

onUpdateStart()

Source:

Handles when the layer starts to update

removeHoverListener()

Source:

Remove a mouse hover listener

removeStateListener()

Source:

Remove a state change listener

setMapScale(map, lod, zoomIn) → {Promise}

Source:

Set map scale depending on zooming in or zooming out of layer visibility scale

Parameters:
Name Type Description
map Object

layer to zoom to scale to for feature layers; parent layer for dynamic layers

lod Object

scale object the map will be set to

zoomIn Boolean

the zoom to scale direction; true need to zoom in; false need to zoom out

Returns:

resolves after map is done changing its extent

Type
Promise

zoomToBoundary(map) → {Promise}

Source:

Zoom to layer boundary of the layer specified by layerId

Parameters:
Name Type Description
map Object

map object we want to execute the zoom on

Returns:

resolves when map is done zooming

Type
Promise

LayerRecord

new LayerRecord()

Source:

Methods

_fireEvent()

Source:

Utility for triggering an event and giving it to the listeners

_stateChange()

Source:

Handle a change in layer state

(private) _zoomToScaleSet(map, lods, zoomIn, scaleSet, zoomGraphic)

Source:

Figure out visibility scale and zoom to it. Will use layer minScale/maxScale and map levels of detail to determine scale boundaries.

Parameters:
Name Type Default Description
map Object

the map object

lods Array

level of details array for basemap

zoomIn Boolean

the zoom to scale direction; true need to zoom in; false need to zoom out

scaleSet Object

contains min and max scales for the layer.

zoomGraphic Boolean false

an optional value when zoomToScale is use to zoom to a graphic element; true used to zoom to a graphic element; false not used to zoom to a graphic element

addHoverListener()

Source:

Wire up mouse hover listener

addStateListener()

Source:

Wire up state change listener

bindEvents()

Source:

Attach event handlers to layer events

constructLayer()

Source:

Perform layer initialization tasks

createBbox()

Source:

Generate a bounding box for the layer on the given map.

destroyBbox()

Source:

Destroy bounding box

findZoomScale(lods, scaleSet, zoomIn, zoomGraphic) → {Object}

Source:

Figure out visibility scale. Will use layer minScale/maxScale and map levels of detail to determine scale boundaries.

Parameters:
Name Type Default Description
lods Array

array of valid levels of detail for the map

scaleSet Object

contains .minScale and .maxScale for valid viewing scales

zoomIn Boolean

the zoom to scale direction; true need to zoom in; false need to zoom out

zoomGraphic Boolean false

an optional value when zoomToScale is use to zoom to a graphic element; true used to zoom to a graphic element; false not used to zoom to a graphic element

Returns:

a level of detail (lod) object for the appropriate scale to zoom to

Type
Object

getFeatureCount() → {Promise}

Source:

Returns the feature count

Returns:

resolves feature count

Type
Promise

getVisibleScales() → {Promise}

Source:

Returns the visible scale values of the layer

Returns:

resolves in object properties .minScale and .maxScale

Type
Promise

isBBoxVisible() → {Boolean}

Source:

Indicates if the bounding box is visible

Returns:

indicates if the bounding box is visible

Type
Boolean

makeClickBuffer(point, map, tolerance) → {Object}

Source:

Create an extent centered around a point, that is appropriate for the current map scale.

Parameters:
Name Type Default Description
point Object

point on the map for extent center

map Object

map object the extent is relevant for

tolerance Integer 5

optional. distance in pixels from mouse point that qualifies as a hit. default is 5

Returns:

an extent of desired size and location

Type
Object

makeLayerConfig()

Source:

Creates an options object for the physical layer

onError()

Source:

Handles when the layer has an error

onMouseOut()

Source:

Handles when the mouse leaves a layer

onMouseOver()

Source:

Handles when the mouse enters a layer

onUpdateEnd()

Source:

Handles when the layer finishes updating

onUpdateStart()

Source:

Handles when the layer starts to update

removeHoverListener()

Source:

Remove a mouse hover listener

removeStateListener()

Source:

Remove a state change listener

setMapScale(map, lod, zoomIn) → {Promise}

Source:

Set map scale depending on zooming in or zooming out of layer visibility scale

Parameters:
Name Type Description
map Object

layer to zoom to scale to for feature layers; parent layer for dynamic layers

lod Object

scale object the map will be set to

zoomIn Boolean

the zoom to scale direction; true need to zoom in; false need to zoom out

Returns:

resolves after map is done changing its extent

Type
Promise

zoomToBoundary(map) → {Promise}

Source:

Zoom to layer boundary of the layer specified by layerId

Parameters:
Name Type Description
map Object

map object we want to execute the zoom on

Returns:

resolves when map is done zooming

Type
Promise