Reusable Accessible Mapping Platform

API Docs for: 5.2.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).

Imports RAMP Modules:

GlobalStorage
Map
EventManager
RAMP
Url
Util
Dictionary
PopupManager

Methods

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)

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

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.

Properties

anchors

Object private

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

boundingBoxVisibility

Object private

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

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

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).

Events

BookmarkLink.BOOKMARK_GENERATED

Provided by the UI module.

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

Published when a new link has been generated.

Event Payload:

  • event Object
    • link String

      The bookmark URL that was generated