Fusion. Widget.Map

generic class for map widgets.  Provides common utility classes.  This class provides a wrapper around the OpenLayers Map object.

Summary
generic class for map widgets.
Callback for when all maps have been loaded
Attaches a context menu as defined in the AppDef to the map
Controls the creation of Layers based on the MapGroup object passed in
Called after each layer is loaded in the OL viewport.
handles mouse wheel events by accummulating the events and setting a timer to do the actual zoom in/out
Carries out the actual map zoom based on the wheel movement
User spun scroll wheel up
User spun scroll wheel down
returns the dom element for this widget
returns the name of the baselayer map
returns the Title of the baselayer map.
returns the server session ID
returns the ID of dom element for this widget
sets options on the OpenLayers map object, a wrapper for the OL function
adds a map/Layer to the map and registers some event handlers on the map
returns the array of map objects
Called to reload all the map objects.
Loads the ScaleRange objects separate from the LoadMap sequence since this also generates sprites and is a relatively expensive operation.
dispatch query requests to the maps
handle selection events from maps and republish for widgets as appropriate
cehck to see if any of the maps have an active selection
clear the selection on all maps
initiates a call to get the current selection asynchronously in case we need to retrieve the details from the server
sets a Selection XML back to the server for each of the maps
accumulate the selection results from each map and when all have reported in, pass the results to the callback function
sets the active layer for selection/manipulation
returns the active layer for selection/manipulation
indicate that a new asynchronous process has started and make sure the visual indicator is visible for the user.
indicate that an asynchronous process has completed and hide the visual indicator if no remaining processes are active.
OpenLayers event handler for whenever the map changes either zoom level of the center has changed.
check to see if there are any outstanding requests to the server
callback for when the browser window size changes, simply calls resize on the map viewport layout object
handles the resizing of the maps and triggers a Fusion event
redraws the map using current extents and zoom level.
sets the background color for the map
handle selection events from maps and republish for widgets as appropriate
1.
gets the intitial extents from all maps with or without including the extent of any Generic/commercial layers
sets the extent of the map to the max as returned by loadMap
returns if the map has finished loading (based on setting the _oCurrentExtent value)
sets the map zoom and extent.
sets the map zoom and extent.
sets the map zoom and extent.
sets the map zoom and extent.
returns the current center of the map view
returns the Extent of the map given a center point and a scale (optional)

Functions

mapLoaded

mapLoaded: function()

Callback for when all maps have been loaded

Parameter: none.

Return: none

setMenu

setMenu: function()

Attaches a context menu as defined in the AppDef to the map

Parameter: none.

Return: none

loadMapGroup

loadMapGroup: function(mapGroup)

Controls the creation of Layers based on the MapGroup object passed in

Parameter: {Object} mapGroupa representation of the MapGroup object

Return: none

layerLoaded

layerLoaded: function()

Called after each layer is loaded in the OL viewport.  Nothing happens here until the last layer is laoded, then it sets the OL baselayer and zooms to the initial extent.

Parameter: none

Return: none

wheelChange

wheelChange: function(evt,
deltaZ)

handles mouse wheel events by accummulating the events and setting a timer to do the actual zoom in/out

Parameters

evt{Event} the mouse wheel event object
deltaZ{Integer} the number of ticks wheeled

doWheelChange

doWheelChange: function(evt,
deltaZ)

Carries out the actual map zoom based on the wheel movement

Parameters

evt{Event} the mouse wheel event object
deltaZ{Integer} the number of ticks wheeled

Return: none

wheelUp

wheelUp: function(evt)

User spun scroll wheel up

Parameters

evt{Event}

wheelDown

wheelDown: function(evt)

User spun scroll wheel down

Parameters

evt{Event}

getDomObj

getDomObj: function()

returns the dom element for this widget

Parameters: none

Return: none

getMapName

getMapName: function()

returns the name of the baselayer map

Parameters: none

Return: {String} the name of the baselayer map

getMapTitle

getMapTitle: function()

returns the Title of the baselayer map.  This is a human-readable title

Parameters: none

Return: {String} the Title of the baselayer map

getSessionID

getSessionID: function()

returns the server session ID

Parameters: none

Return: {String} the session ID

getDomId

getDomId: function()

returns the ID of dom element for this widget

Parameters: none

Return: {String} the id of the DOM element

setMapOptions

setMapOptions: function(options)

sets options on the OpenLayers map object, a wrapper for the OL function

Parameters: {Object} optionshas of option key/value pairs

Return: none

addMap

addMap: function(map)

adds a map/Layer to the map and registers some event handlers on the map

Parameters: {Object} mapthe map object to tbe added (really a layer object)

Return: none

getAllMaps

getAllMaps: function()

returns the array of map objects

Parameters: none

Return: {Array} the array of map Objects

reloadMap

reloadMap: function()

Called to reload all the map objects. this uses setTimeout so this method can be called from an IFRAME

Parameters: none

Return: none

loadScaleRanges

loadScaleRanges: function(userFunc)

Loads the ScaleRange objects separate from the LoadMap sequence since this also generates sprites and is a relatively expensive operation.

Parameters: {Function} userFunca user defined function to be called as a callback

Return: none

query

query: function(options)

dispatch query requests to the maps

Parameters: {object} optionsquery options to be passed to each map

selectionHandler

selectionHandler: function()

handle selection events from maps and republish for widgets as appropriate

Parameters: none

Return: none

hasSelection

hasSelection: function()

cehck to see if any of the maps have an active selection

Returns: {Boolean}true if any map has a selection

clearSelection

clearSelection: function()

clear the selection on all maps

getSelection

getSelection: function(callback,
layers,
startcount)

initiates a call to get the current selection asynchronously in case we need to retrieve the details from the server

setSelection

setSelection: function(selText,
zoomTo)

sets a Selection XML back to the server for each of the maps

Parameters

{String} selTextthe selection string
{Boolean} zoomToif set, will zoom to the selection on completion

accumulateSelection

accumulateSelection: function(map,
oSelection)

accumulate the selection results from each map and when all have reported in, pass the results to the callback function

Parameters

{Object} mapthe map object that has the selection
{Object} oSelectionthe Fusion selection object

setActiveLayer

setActiveLayer: function(oLayer)

sets the active layer for selection/manipulation

Parameters

{Object} oLayerthe layer to be set as active

getActiveLayer

getActiveLayer: function()

returns the active layer for selection/manipulation

Returns

{Object} the active layer

_addWorker

_addWorker: function()

indicate that a new asynchronous process has started and make sure the visual indicator is visible for the user.  This is intended to be used internally by gMap but could be used by external tools if appropriate.

_removeWorker

_removeWorker: function()

indicate that an asynchronous process has completed and hide the visual indicator if no remaining processes are active.  This is intended to be used internally by gMap but could be used by external tools if appropriate.  Only call this function if addWorker was previously called

mapExtentsChanged

mapExtentsChanged: function()

OpenLayers event handler for whenever the map changes either zoom level of the center has changed.  This in turn triggers the Fusion event.

Parameters: none

Return: none

isBusy

isBusy: function()

check to see if there are any outstanding requests to the server

Parameters: none

Return: {Boolean} true if there are active requests

sizeChanged

sizeChanged: function()

callback for when the browser window size changes, simply calls resize on the map viewport layout object

Parameters: none

Return: none

resize

resize: function()

handles the resizing of the maps and triggers a Fusion event

Parameters: none

Return: none

redraw

redraw: function()

redraws the map using current extents and zoom level.  A dummy parameter is added to the map request to ensure the map request is not cached.

Parameters: none

Return: none

setBackgroundColor

setBackgroundColor: function(color)

sets the background color for the map

Parameters: {String} colorthe CSS color value to set as background

Return: none

setExtents

setExtents: function(oExtents)

handle selection events from maps and republish for widgets as appropriate

Parameters: {Object} oExtentsan OpenLayers.Bounds object or an array of 4 values that will be converted to Bounds

Return: none

setInitialExtents

setInitialExtents: function()

determine the initialExtents of the map from (in order of precedence)

1. a URL query parameter called ‘extent’ 2. an <InitialView> specified in the MapGroup in AppDef 3. the maxExtent as specified by the LoadMap call (default)

Returns: {Object} an OpenLayers.Bounds object which is the initial extent

getMapGroupExtent

getMapGroupExtent: function(includeGenericLayers)

gets the intitial extents from all maps with or without including the extent of any Generic/commercial layers

Return: {Object} an OpenLayers.Bounds object which is the initial extent

fullExtents

fullExtents: function()

sets the extent of the map to the max as returned by loadMap

isMapLoaded

isMapLoaded: function()

returns if the map has finished loading (based on setting the _oCurrentExtent value)

Returns {Boolean} true if the map is loaded and extent has been set

zoom

zoom: function(fX,
fY,
nFactor)

sets the map zoom and extent.

Parameters

fX {Float}new x coordinate value in map units
fY {Float}new y coordinate value in map units
nFactor {Float}zoom factor; positive values zoom in, negative out
  • if set to 0 or 1, the map is just recentered
  • if the map has fractional zoom enabled, the map resolution will be modified by this factor
  • with fixed scales, zoom up or down one level, depending on the sign

Returns: none

zoom

zoomToScale: function(fScale)

sets the map zoom and extent.

Parameters

fX {Float}new x coordinate value in map units
fY {Float}new y coordinate value in map units
nFactor {Float}zoom factor; positive values zoom in, negative out
  • if set to 0 or 1, the map is just recentered
  • if the map has fractional zoom enabled, the map resolution will be modified by this factor
  • with fixed scales, zoom up or down one level, depending on the sign

Returns: none

zoom

sets the map zoom and extent.

Parameters

fX {Float}new x coordinate value in map units
fY {Float}new y coordinate value in map units
nFactor {Float}zoom factor; positive values zoom in, negative out
  • if set to 0 or 1, the map is just recentered
  • if the map has fractional zoom enabled, the map resolution will be modified by this factor
  • with fixed scales, zoom up or down one level, depending on the sign

Returns: none

zoom

sets the map zoom and extent.

Parameters

fX {Float}new x coordinate value in map units
fY {Float}new y coordinate value in map units
nFactor {Float}zoom factor; positive values zoom in, negative out
  • if set to 0 or 1, the map is just recentered
  • if the map has fractional zoom enabled, the map resolution will be modified by this factor
  • with fixed scales, zoom up or down one level, depending on the sign

Returns: none

getCurrentCenter

getCurrentCenter: function()

returns the current center of the map view

Return: {Object} an object with the following attributes x - the x coordinate of the center y - the y coordinate of the center

getExtentFromPoint

getExtentFromPoint: function(fX,
fY,
fScale)

returns the Extent of the map given a center point and a scale (optional)

Return: {OpenLayers.Bounds} the bounds for the map centered on a point

mapLoaded: function()
Callback for when all maps have been loaded
setMenu: function()
Attaches a context menu as defined in the AppDef to the map
loadMapGroup: function(mapGroup)
Controls the creation of Layers based on the MapGroup object passed in
layerLoaded: function()
Called after each layer is loaded in the OL viewport.
wheelChange: function(evt,
deltaZ)
handles mouse wheel events by accummulating the events and setting a timer to do the actual zoom in/out
doWheelChange: function(evt,
deltaZ)
Carries out the actual map zoom based on the wheel movement
wheelUp: function(evt)
User spun scroll wheel up
wheelDown: function(evt)
User spun scroll wheel down
getDomObj: function()
returns the dom element for this widget
getMapName: function()
returns the name of the baselayer map
getMapTitle: function()
returns the Title of the baselayer map.
getSessionID: function()
returns the server session ID
getDomId: function()
returns the ID of dom element for this widget
setMapOptions: function(options)
sets options on the OpenLayers map object, a wrapper for the OL function
addMap: function(map)
adds a map/Layer to the map and registers some event handlers on the map
getAllMaps: function()
returns the array of map objects
reloadMap: function()
Called to reload all the map objects.
loadScaleRanges: function(userFunc)
Loads the ScaleRange objects separate from the LoadMap sequence since this also generates sprites and is a relatively expensive operation.
query: function(options)
dispatch query requests to the maps
selectionHandler: function()
handle selection events from maps and republish for widgets as appropriate
hasSelection: function()
cehck to see if any of the maps have an active selection
clearSelection: function()
clear the selection on all maps
getSelection: function(callback,
layers,
startcount)
initiates a call to get the current selection asynchronously in case we need to retrieve the details from the server
setSelection: function(selText,
zoomTo)
sets a Selection XML back to the server for each of the maps
accumulateSelection: function(map,
oSelection)
accumulate the selection results from each map and when all have reported in, pass the results to the callback function
setActiveLayer: function(oLayer)
sets the active layer for selection/manipulation
getActiveLayer: function()
returns the active layer for selection/manipulation
_addWorker: function()
indicate that a new asynchronous process has started and make sure the visual indicator is visible for the user.
_removeWorker: function()
indicate that an asynchronous process has completed and hide the visual indicator if no remaining processes are active.
mapExtentsChanged: function()
OpenLayers event handler for whenever the map changes either zoom level of the center has changed.
isBusy: function()
check to see if there are any outstanding requests to the server
sizeChanged: function()
callback for when the browser window size changes, simply calls resize on the map viewport layout object
resize: function()
handles the resizing of the maps and triggers a Fusion event
redraw: function()
redraws the map using current extents and zoom level.
setBackgroundColor: function(color)
sets the background color for the map
setExtents: function(oExtents)
handle selection events from maps and republish for widgets as appropriate
setInitialExtents: function()
1.
getMapGroupExtent: function(includeGenericLayers)
gets the intitial extents from all maps with or without including the extent of any Generic/commercial layers
fullExtents: function()
sets the extent of the map to the max as returned by loadMap
isMapLoaded: function()
returns if the map has finished loading (based on setting the _oCurrentExtent value)
zoom: function(fX,
fY,
nFactor)
sets the map zoom and extent.
getCurrentCenter: function()
returns the current center of the map view
getExtentFromPoint: function(fX,
fY,
fScale)
returns the Extent of the map given a center point and a scale (optional)