Map Class
Map class represents the ESRI map object. The map is generated based on the application configuration and templates.
Item Index
Methods
- _hideLoadingImg
- _initEventHandlers
- _initListeners
- _initRepublishers
- _initScale
- _showLoadingImg
- _updateScale
- _wrapFileCallInPromise
- AddStaticLayer
- applyExtentDefaulting
- checkBoundary
- enhanceLayer
- finishExtentProjection
- getBoundingBoxMapping
- getFeatureLayer
- getLayerConfigWithId
- getServiceURL
- getSymbolForFeature
- getVisibleFeatureLayers
- init
- initListeners
- initTopics
- loadStrings
- localProjectExtent
- localProjectExtent
- makeFeatureLayer
- makeStaticLayer
- makeWmsLayer
- onFeatureDeselect
- onFeatureMouseOut
- onFeatureMouseOver
- onFeatureSelect
- prepLayer
- projectConfigExtents
- projectExtent
- projectFullExtent
- projectMaxExtent
- registerWMSClick
- republish
- setBoundingBoxVisibility
- zoomToLayerScale
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.
_wrapFileCallInPromise
-
readMethod
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
Stringa string indicating the FileReader method to call
Returns:
a function which accepts a {File} object and returns a Promise
AddStaticLayer
-
layer_type
-
layer_url
-
layer_op
Add a static, non-interactive Layer to the map
applyExtentDefaulting
()
private
Apply extent defaulting prior to URL overrides.
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
enhanceLayer
-
layer
-
config
-
userLayer
Adds custom ramp properties to layer. Adds handlers to loading events.
finishExtentProjection
-
projectedMaxExtent
process the projected maximum extent, then alert app to continue loading the map. used as an asynchronous gate for the projection.
Parameters:
-
projectedMaxExtent
Arrayan 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:
A dictionary of String, Esri/layers/GraphicsLayer pairs.
getFeatureLayer
-
featureId
Return the feature layer corresponding to the given id.
Parameters:
-
featureId
Stringthe id of the feature layer
Returns:
feature layer
getLayerConfigWithId
-
id
Returns the feature layer config for the given id
Parameters:
-
id
Stringlayer id string
getServiceURL
-
rampService
-
mapID
-
language
This method builds a complete service URL callout for a map configuration. The URL is built using a base URL and map ID, and a language culture code.
getSymbolForFeature
-
feature
Given a feature object or a graphic object (or any object that has a getLayer method and an attributes field) return the object containing the image URL and legend text for that feature/graphic object.
Parameters:
-
feature
Object
Returns:
The default icon used to represent the feature layer
getVisibleFeatureLayers
()
Array
Returns a list of feature layers that are currently visible on the map.
Returns:
an array of Esri/layers/FeatureLayer objects
init
-
currentLevel
Initialize navigation widget for pan and zooming using global configuration object
Parameters:
-
currentLevel
Number
initListeners
()
private
Listen to map evens and adjust the navigation widget accordingly
initTopics
()
private
Listen to internal events and republish for other modules' benefit
loadStrings
()
Updates some of the Strings on the HTML page using the config string resources
localProjectExtent
-
extent
-
sr
Will project an extent to a desired spatial reference, using client side projection library. Avoids the need for Esri Geometry Service
Parameters:
-
extent
Esri/Extentextent to be projected
-
sr
Esri/SpatialReferenceEsri/SpatialReference to project to
Returns:
extent in the desired projection
localProjectExtent
-
extent
-
sr
Will project an extent to a desired spatial reference, using client side projection library. Avoids the need for Esri Geometry Service
Parameters:
-
extent
Esri/Extentextent to be projected
-
sr
Esri/SpatialReferenceEsri/SpatialReference to project to
Returns:
extent in the desired projection
makeFeatureLayer
-
layerConfig
-
userLayer
Create a new FeatureLayer object based on the config input
Parameters:
Returns:
feature layer object (unloaded)
makeStaticLayer
-
layerConfig
-
userLayer
Return the static layer corresponding to the given url.
Parameters:
Returns:
layer object of the appropriate type
makeWmsLayer
-
layerConfig
-
userLayer
Return the feature layer corresponding to the given url.
Parameters:
Returns:
WMS layer
onFeatureDeselect
()
This function is called whenever the "Details" button is deselected (either by the user click on another "Details" button, clicking on another point, or by clicking on an already highlighted "Details" button, or clicking somewhere on the map where is no features present).
onFeatureMouseOut
-
evt
This function is called whenever the user moves the mouse away from a feature being hovered over.
onFeatureMouseOver
-
evt
This function is called whenever the user hovers over a feature on the map when another feature already has been selected.
onFeatureSelect
-
evt
This function is called whenever the feature on the map is clicked/selected by the user. Publish the "Gui/subPanelOpen" message to indicate a feature has been selected. Panel content and Panel event handler information is passed in as the additional object for the event handler.
prepLayer
-
layer
-
config
-
userLayer
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
projectConfigExtents
()
initiate the projection of the config extents to basemap extents
projectExtent
-
extent
-
sr
-
callWhenDone
project an extent to a new spatial reference, if required when projection is finished, call another function and pass the result to it.
Parameters:
-
extent
Objectan extent object from the configuration
-
sr
Esri/SpatialReferenceEsri/SpatialReference to project to
-
callWhenDone
Functionfunction to call when extent is projected. expects geometry parameter
projectFullExtent
-
projectedDefaultExtent
process the projected default extent, begin projection of full extent. used as an asynchronous gate for the projection.
Parameters:
-
projectedDefaultExtent
Arrayan array containing the default extent object in the map's projection
projectMaxExtent
-
projectedFullExtent
process the projected full extent, begin projection of maximum extent. used as an asynchronous gate for the projection.
Parameters:
-
projectedFullExtent
Arrayan array containing the full extent object in the map's projection
registerWMSClick
-
map
This function should be called after the map has been created. It will subscribe to the Map.CLICK event and trigger GUI.SUBPANEL_OPEN events for displaying the response data.
Parameters:
-
map
Objectan EsriMap instance
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
zoomToLayerScale
-
layerId
For a specified layer, zooms to the closest level that has some visible data.
Parameters:
-
layerId
Stringa layer id to zoom to.
Properties
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.
config
Object
The RAMP application config, it should be treated as read only by all modules other than globalStorage and bootstrapper
configServiceURL
String
Contains 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
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
InitExtent
Esri/geometry/Extent
private
The initial extent of the map
maxExtent
Esri/geometry/Extent
private
The maximum extent of the map
plugins
Object
A registry of plugins for RAMP code to reference, these should be loaded and registered by bootstrapper.js