Reusable Accessible Mapping Platform

API Docs for: 5.0.0
Show:

BookmarkLink Class

BookmarkLink class.

  1. Subscribe to the event of interest (e.g. map extent-change)
  2. Create an object containing fields that will contain the necessary information for reconstructing the map to the same state. (e.g. for map extent-change, a useful object might be one that represents the current extent of the map: { xmin : 123, xmax : 456, ymin : 789, ymax : 000}).

    IMPORTANT: the object must be serializable since it will be added to the URL and should serialize to a reasonable length String. If the fields contain non-primitives, e.g. array, object, one must manually serialize the field first. Also only use anonymous objects with custom fields, do not use class objects (e.g. use an anonymous { } object to store map extent instead of ESRI's map Esri/geometry/Extent object, since it will contain other fields and methods that will also be serialized).

  3. Call updateURL, passing it a name (e.g. "newExtent") and the object (a name is required for efficiency, this way the URL will only need to serialize and update the given object instead of all 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:

_wrapFileCallInPromise

(
  • readMethod
)
Function private

Helper function for wrapping File API calls in Promise objects. Used for building a series of helpers which call different file read methods.

Parameters:

  • readMethod String

    a string indicating the FileReader method to call

Returns:

Function:

a function which accepts a {File} object and returns a Promise

addParameter

(
  • paramKey
  • paramObj
)
private

Update the parameter dictionary with the new values for the parameter. If paramObj is set to null, essentially removes the given paramKey from the URL.

Parameters:

  • paramKey String

    the parameter (e.g. extent) that was changed

  • paramObj Object

    an object representing data that can be serialized into the query parameter of the URL (can be null, in which case the parameter will NOT be included in the URL)

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

applyExtentDefaulting

() private

Apply extent defaulting prior to URL overrides.

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

enhanceLayer

(
  • layer
  • config
  • userLayer
)

Adds custom ramp properties to layer. Adds handlers to loading events.

Parameters:

  • layer Object

    layer to be prepped

  • config Object

    config object for the layer

  • userLayer Boolean

    optional. indicates if layer was added by a user. default value is false

finishExtentProjection

(
  • projectedMaxExtent
)
private

process the projected maximum extent, then alert app to continue loading the map. used as an asynchronous gate for the projection.

Parameters:

  • projectedMaxExtent Array

    an array containing the maximum extent object in the map's projection

getBoundingBoxMapping

() Object

Returns the mapping of feature layer ids to assocciated bounding box layers.

Returns:

Object:

A dictionary of String, Esri/layers/GraphicsLayer pairs.

getFeatureLayer

(
  • featureId
)
Esri/layers/FeatureLayer private

Return the feature layer corresponding to the given id.

Parameters:

  • featureId String

    the id of the feature layer

Returns:

Esri/layers/FeatureLayer:

feature layer

getVisibleFeatureLayers

() Array

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

Returns:

Array:

an array of Esri/layers/FeatureLayer objects

init

() private

Initiates additional UI components of the widget, setting listeners and other stuff.

init!~YUIDOC_LINE~! homePage a string denoting the name of the homePage (e.g. usually "Default.aspx" or "index.html")

()

Instantiates a BookmarkLink. Subscribes to all the events that causes the bookmark link to update (e.g. map extent change or feature layer visibility change).

isBookmarkLayer

(
  • layerId
)
Boolean private

Figures out if a layer is valid to be in the bookmark

Parameters:

  • layerId String

    layers id to check

Returns:

Boolean:

true if layer should be included in the bookmark

localProjectExtent

(
  • extent
  • sr
)
Esri/Extent private

Inherited from Map but overwritten in src\js\RAMP\Modules\map.js:420

Will project an extent to a desired spatial reference, using client side projection library. Avoids the need for Esri Geometry Service

Parameters:

Returns:

Esri/Extent:

extent in the desired projection

makeFeatureLayer

(
  • layerConfig
  • userLayer
)
Esri/layers/FeatureLayer

Create a new FeatureLayer object based on the config input

Parameters:

  • layerConfig Object

    config object for the layer to create

  • userLayer Boolean

    optional specifies if layer was added by a user

Returns:

Esri/layers/FeatureLayer:

feature layer object (unloaded)

makeStaticLayer

(
  • layerConfig
  • userLayer
)
Object private

Return the static layer corresponding to the given url.

Parameters:

  • layerConfig Object

    config object for the layer to create

  • userLayer Boolean

    optional specifies if layer was added by a user

Returns:

Object:

layer object of the appropriate type

makeWmsLayer

(
  • layerConfig
  • userLayer
)
Esri/layers/WMSLayer

Return the feature layer corresponding to the given url.

Parameters:

  • layerConfig Object

    config object for the layer to create

  • userLayer Boolean

    optional specifies if layer was added by a user

Returns:

Esri/layers/WMSLayer:

WMS layer

newPopup

(
  • popupAttr
)
private

Create a new PopupBase object from the settings provided.

Parameters:

Returns:

popup

prepLayer

(
  • layer
  • config
  • userLayer
)
private

Sets up loading event handlers and initializes the .ramp object of a layer Circular reference errors prevent us from calling LayerLoader directly from this module

Parameters:

  • layer Object

    layer to be prepped

  • config Object

    config object for the layer

  • userLayer Boolean

    optional. indicates if layer was added by a user. default value is false

projectConfigExtents

()

initiate the projection of the config extents to basemap extents

projectExtent

(
  • extent
  • sr
  • callWhenDone
)
private

project an extent to a new spatial reference, if required when projection is finished, call another function and pass the result to it.

Parameters:

projectFullExtent

(
  • projectedDefaultExtent
)
private

process the projected default extent, begin projection of full extent. used as an asynchronous gate for the projection.

Parameters:

  • projectedDefaultExtent Array

    an array containing the default extent object in the map's projection

projectMaxExtent

(
  • projectedFullExtent
)
private

process the projected full extent, begin projection of maximum extent. used as an asynchronous gate for the projection.

Parameters:

  • projectedFullExtent Array

    an array containing the full extent object in the map's projection

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

slimCoord

(
  • value
)
private

If a co-ordinate has a big value before the decimal point, drop the precision after the decimal

Parameters:

  • value Object

    co-ordinate to potentially slim down

subscribeAndUpdate

() private

Subscribe to map state changes so the URL displayed can be changed accordingly. SUBSCRIBES TO: map "extent-change" Updates URL when map extent changes

EventManager.GUI.FULLSCREEN_CHANGE Updates URL when map goes into fullscreen mode

EventManager.GUI.TAB_SELECTED Updates URL when tabs are selected

EventManager.GUI.PANEL_CHANGE Updates URL when panel opens/closes

EventManager.BasemapSelector.BASEMAP_CHANGED Updates URL when basemap changed

  • ================================================================

    Subscribe to updates

    To include more information into the query string, do not get the information directly from the object/module of interest, but rather make it publish an event with data to include and subscribe to this event here.

toggleShortLinkMode

(
  • value
)
private

Toggle the short/long link mode and change the label accordingly

Parameters:

  • value Object

    true - shortLinkMode; false - !shortlinkMore; undefined - toggle;

updateConfig

(
  • homePage
)
private

Process the URL. If there are any parameters that came from a short-link, apply them to the config or the RAMP application

Parameters:

  • homePage String

    the page name of the ramp site (e.g. index.html, map.html)

updateHref

(
  • link
)
private

update Href on language button based on link provided from bookmarklink

Parameters:

updateURL

() private

Updates the link displayed in the textbox. This function should be called whenever one of the objects that are in the URL query is modified.

zoomToLayerScale

(
  • layerId
)

For a specified layer, zooms to the closest level that has some visible data.

Parameters:

  • layerId String

    a layer id to zoom to.

Properties

anchors

Object private

A dictionary mapping names (String) to anchors (String) used at the end of the URL.

baseLayer

Esri/layers/ArcGISTiledMapServiceLayer private

The basemap layer

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/layers/GraphicsLayer pairs.

boundingBoxVisibility

Object private

A dictionary containing layer id (String) as key and bounding box visibility (boolean) as value

featureLayers

Array private

An Array of Esri/layers/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

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

layerTransparency

Object private

A dictionary with the layer id as key, and the transparency as value.

layerVisibility

Object private

A dictionary containing layer id (String) as key and layer visibility (boolean) as value

maxExtent

Esri/geometry/Extent private

The maximum extent of the map

parameters

Object private

A dictionary mapping names (String) to query parameter (String) of the URL. The query parameter is what ends up in the url. The key can be any arbitrary name (best to name them to describe the query parameter).

url

String private

The URL of the first layer of the basemap that is on by default.

wmsLayers

Array private

An Array of Esri/layer/WMSLayer objects.

Events

BookmarkLink.BOOKMARK_GENERATED

Provided by the UI module.

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

Published when a new link has been generated.

Event Payload:

  • event Object
    • link String

      The bookmark URL that was generated