BaseMapSelector Class
Populates the BasemapGallery widget located in the maps toolbar with items found in the application configuration. This module also handles all the event needed to change the map basemap and update the UI
Item Index
Methods
Properties
Methods
_hideLoadingImg
()
private
Hides the loading image.
_initEventHandlers
-
map
Creates event handlers for the map control: click, mouse-over, load, extent change, and update events.
Parameters:
-
map
ObjectA ESRI map object
_initListeners
-
map
Subscribe to external events (published using topic.publish) and react accordingly
Parameters:
-
map
Objectmap object
_initRepublishers
-
map
Republishes map events to the outside using topic.publish
Parameters:
-
map
Objectobject
_showLoadingImg
()
private
Shows the loading image.
AddStaticLayer
-
layer_type
-
layer_url
-
layer_op
Add a static, non-interactive Layer to the map
checkBoundary
-
e
-
maxExtent
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/Extentthe extent Object
-
maxExtent
Esri/geometry/Extentthe maximum extent
Returns:
An adjusted extent, if the target extent is outside the boundary
createExtent
-
extentConfig
-
sr
Instantiates an extent from a JSON config object and spatial reference
Parameters:
-
extentConfig
Objectthe JSON config object
-
sr
Esri/SpatialReference
Returns:
An ESRI extent object based on the config data
getFeatureLayer
-
featureUrl
Return the feature layer corresponding to the given url.
Parameters:
-
featureUrl
Stringthe url of the feature layer
Returns:
feature layer
getVisibleFeatureLayers
()
Array
Returns a list of feature layers that are currently visible on the map.
Returns:
an array of Esri/layer/FeatureLayer objects
init
()
Object
private
Initiates additional UI components of the widget, setting listeners and registering the popup functionality
Returns:
itself
initListeners
()
private
Initializes class listeners.
initTopics
()
private
Initializes functions that publish events.
setBoundingBoxVisibility
-
layerId
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
Stringthe id of the layer whose bounding box visibility should be set
Properties
boundingBoxLayers
Array of esri/layer/GraphicsLayer
A list GraphicsLayer that represent the extent bounding box of the feature layers. {[esr/layer/featurelayers]} featureLayers A list of feature layers found in the application config {[esri/layer/graphiclayer]} An array of graphic layers to add to the map
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/layer/GraphicsLayer pairs.
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
getConfigUrl
Object
Returns a URL that points to the application configuration (JSON format) if it's hosted on a web service. This is not required if the application has a JSON config file in the website's folder
InitExtent
Esri/geometry/Extent
private
The initial extent of the map
maxExtent
Esri/geometry/Extent
private
The maximum extent of the map
Events
baseMapSelector/basemap-changed
Fires whenever the basemap changes
baseMapSelector/toggle [subscribed]
Changes the selected basemap