GeoMOOSE.MapSource

GeoMOOSE base layer.

Do NOT forget to include a GeoMOOSE.registerMapSourceType() directive at the end of subclasses.

Summary
GeoMOOSE.MapSourceGeoMOOSE base layer.
Variables
mapbookTypeThe matching “type” attribute from the mapbook XML
_ol_layerThe OpenLayers Object Managed by the GeoMOOSE layer
pathThe root path of the MapSource.
cssNameCSS Friendly identifier for the MapSource.
paramsUsed to hold the “parameters” found in the mapbook.
pathsA list of the matching paths for this layer.
titleTitle for the layer
titlesA hash of the titles keyed on layer path.
metadataA hash of the metadata URLs keyed on layer path.
controlsA hash of OL controls supported by the layer.
clearPopupsOnMoveToggle whether to clear popups when the user moves the mouse.
displayInLayerSwitcherToggles whether the map source should be displayed in any of the layer-by-layer catalogs.
Functions
_parseParamsParse the Mapbook parameters for a map-source
_parseLayersParses the <layer/>s from a Mapbook Entry
onLayersChange()Called every time a change is made to the visible layers list.
_getLayersList()Returns an array of current layers.
getStatusDifferences()Returns a two element object with lists for “on” and “off”, representing layers that are currently different than their definition in the mapbook.
getLayerByName()Returns a layer by name.
isVisible()By default the isVisible checks to see if any layers are “on”.
preParseNode(mapbook_xml)Can be overridden to convert some layer types (e.g.
constructorCreates a new instance of a GeoMOOSE MapSource.
checkPathChecks to see if this is a matching path for this layer.
setVisibilityTurn a layer on or off.
addToMapAdds the MapSource to the map.
Variables
printableIndication whether this MapSource is printable.
Functions
isPrintableCheck whether the .printable flag is set.
_createBlankLayerCreates a “blank” WMS layer stub to preserve the behavior of a layer when a library is missing.
deactivateDeactivates any of the layer controls.
asLayerReturn a representation of the MapSource as a GeoMOOSE.Layer class.

Variables

mapbookType

mapbookType: null

The matching “type” attribute from the mapbook XML

_ol_layer

_ol_layer: null

The OpenLayers Object Managed by the GeoMOOSE layer

path

path: ""

The root path of the MapSource.

cssName

cssName: ""

CSS Friendly identifier for the MapSource.

params

params: {}

Used to hold the “parameters” found in the mapbook.

paths

paths: []

A list of the matching paths for this layer.

title

title: null

Title for the layer

titles

titles: {}

A hash of the titles keyed on layer path.

metadata

metadata: {}

A hash of the metadata URLs keyed on layer path.

controls

controls: {}

A hash of OL controls supported by the layer.

clearPopupsOnMove

clearPopupsOnMove: false

Toggle whether to clear popups when the user moves the mouse.  Defaults to CONFIGURATION.popups.clearOnMove

displayInLayerSwitcher

displayInLayerSwitcher: true

Toggles whether the map source should be displayed in any of the layer-by-layer catalogs.

Functions

_parseParams

_parseParams: function(mapbook_entry)

Parse the Mapbook parameters for a map-source

Parameters

mapbook_entryThe XML fragment pertaining to the mapbook entry.

_parseLayers

_parseLayers: function(mapbook_entry)

Parses the <layer/>s from a Mapbook Entry

Parameters

mapbook_entryThe XML fragment pertaining to the mapbook entry.

onLayersChange()

onLayersChange: function (path,
visibility)

Called every time a change is made to the visible layers list.  A sub-class is expected to handle changing the values here.

Parameters

pathThe layer path that changed.
visibilityHow it changed.

_getLayersList()

_getLayersList: function()

Returns an array of current layers.

getStatusDifferences()

getStatusDifferences: function()

Returns a two element object with lists for “on” and “off”, representing layers that are currently different than their definition in the mapbook.

getLayerByName()

getLayerByName: function(name)

Returns a layer by name.

Parameters

nameThe name of the layer.

Returns

A GeoMOOSE._Layer class, or null if not found.

isVisible()

isVisible: function()

By default the isVisible checks to see if any layers are “on”.  This can be over-ridden depending on the layer type.

preParseNode(mapbook_xml)

preParseNode: function(mapbook_xml)

Can be overridden to convert some layer types (e.g.  MapServer) into another (e.g.  WMS)

constructor

constructor: function(mapbook_entry)

Creates a new instance of a GeoMOOSE MapSource.

Parmaeters

mapbook_entryThe XML fragment pertaining to the mapbook entry.

checkPath

checkPath: function(path)

Checks to see if this is a matching path for this layer.

Parameters

pathThe GeoMOOSE “path” format (POSIX style).

setVisibility

setVisibility: function(path,
visibility)

Turn a layer on or off.

Parameters

pathPath of layer from the mapbook.
visibilitythe visibility status

addToMap

addToMap: function(map)

Adds the MapSource to the map.  This may seem backwards, but a GeoMOOSE MapSource != an OpenLayers layer. addToMap takes care of the clean up to bridge that gap.

Parameters

map{<OpenLayers.Map}> Map to add the layer to.

Variables

printable

printable: false

Indication whether this MapSource is printable.

Functions

isPrintable

isPrintable: function()

Check whether the .printable flag is set.  This is made into a function so that sub-classes can over-ride it with more specific knowledge (for example, printing maybe scale dependent)

_createBlankLayer

_createBlankLayer: function(name)

Creates a “blank” WMS layer stub to preserve the behavior of a layer when a library is missing.

deactivate

deactivate: function()

Deactivates any of the layer controls.

asLayer

asLayer: function()

Return a representation of the MapSource as a GeoMOOSE.Layer class.

mapbookType: null
The matching “type” attribute from the mapbook XML
_ol_layer: null
The OpenLayers Object Managed by the GeoMOOSE layer
path: ""
The root path of the MapSource.
cssName: ""
CSS Friendly identifier for the MapSource.
params: {}
Used to hold the “parameters” found in the mapbook.
paths: []
A list of the matching paths for this layer.
title: null
Title for the layer
titles: {}
A hash of the titles keyed on layer path.
metadata: {}
A hash of the metadata URLs keyed on layer path.
controls: {}
A hash of OL controls supported by the layer.
clearPopupsOnMove: false
Toggle whether to clear popups when the user moves the mouse.
displayInLayerSwitcher: true
Toggles whether the map source should be displayed in any of the layer-by-layer catalogs.
_parseParams: function(mapbook_entry)
Parse the Mapbook parameters for a map-source
_parseLayers: function(mapbook_entry)
Parses the layer/s from a Mapbook Entry
onLayersChange: function (path,
visibility)
Called every time a change is made to the visible layers list.
_getLayersList: function()
Returns an array of current layers.
getStatusDifferences: function()
Returns a two element object with lists for “on” and “off”, representing layers that are currently different than their definition in the mapbook.
getLayerByName: function(name)
Returns a layer by name.
isVisible: function()
By default the isVisible checks to see if any layers are “on”.
preParseNode: function(mapbook_xml)
Can be overridden to convert some layer types (e.g.
constructor: function(mapbook_entry)
Creates a new instance of a GeoMOOSE MapSource.
checkPath: function(path)
Checks to see if this is a matching path for this layer.
setVisibility: function(path,
visibility)
Turn a layer on or off.
addToMap: function(map)
Adds the MapSource to the map.
printable: false
Indication whether this MapSource is printable.
isPrintable: function()
Check whether the .printable flag is set.
_createBlankLayer: function(name)
Creates a “blank” WMS layer stub to preserve the behavior of a layer when a library is missing.
deactivate: function()
Deactivates any of the layer controls.
asLayer: function()
Return a representation of the MapSource as a GeoMOOSE.Layer class.
Close