Table Of Contents

Previous topic

gxp.plugins.LayerProperties

Next topic

gxp.plugins.LayerTree

gxp.plugins.LayerSource

Extends
class gxp.plugins.LayerSource(config)
Base class for layer sources to plug into a gxp.Viewer. A source is created by adding it to the sources object of the viewer. Once there, the viewer will create layers from it by looking at objects in the layers array of its map config option, calling the source’s createLayerRecord method.

Public Properties

Public properties in addition to those listed for Ext.util.Observable.

LayerSource.lazy
Boolean. true when the source is ready, but its store hasn’t been loaded yet (i.e. lazy source). Read-only.
LayerSource.store
GeoExt.data.LayerStore
LayerSource.title
String A descriptive title for this layer source.

Public Methods

Public methods in addition to those listed for Ext.util.Observable.

LayerSource.createLayerRecord()
Parameter:configObject The application config for this layer.
Returns:GeoExt.data.LayerRecord

Create a layer record given the config.

LayerSource.createStore()
Creates a store of layer records. Fires “ready” when store is loaded.
LayerSource.getConfigForRecord()
Parameter:recordGeoExt.data.LayerRecord
Returns:Object

Create a config object that can be used to recreate the given record.

LayerSource.getProjection()
Parameter:layerRecordGeoExt.data.LayerRecord a record from this source’s store
Returns:OpenLayers.Projection A suitable projection for the layerRecord. If the layer is available in the map projection, the map projection will be returned. Otherwise an equal projection, or null if none is available.

Get the projection that the source will use for the layer created in createLayerRecord. If the layer is not available in a projection that fits the map projection, null will be returned.

LayerSource.getState()
Returns:Object

Gets the configured source state.

LayerSource.init()
Parameter:targetObject The object initializing this plugin.

Calls createStore() with a callback that fires the ‘ready’ event.

Events

Events in addition to those listed for Ext.util.Observable.

failure
Fires if the layer source fails to load.
ready
Fires when the layer source is ready for action.