camptocamp/cgxp — pull request #324 by asaunier (2012-12-14 20:06:23+00:00)
Title: Transfer SwitchableWMTSSource code to an OpenLayers addin

The code in SwitchableWMTSSource is mostly the same than in GXP's OLSource. I suggest to move the code that makes the URL of the WMTS layer switch when some zoomlevel is reached to an OpenLayers addin.

Than it is simply possible to use a standard OLSource with the "type" parameter referencing the addin. For instance:
```
{
source: "olsource",
type: "OpenLayers.Layer.SwitchableWMTS",
group: 'background',
args: [Ext.applyIf({
name: OpenLayers.i18n('relief'),
mapserverLayers: 'relief_raster',
queryLayers: [],
zoomThreshold: 11,
ref: 'relief',
layer: 'dtm_av_relief_02m',
params: {'time': '200703'},
group: 'background'
}, WMTS_OPTIONS)]
}
```
Tested successfully in project BL.

Perhaps an entry in c2cgeoportal's CONST_CHANGELOG.txt is necessary to explain how to make the changes in ``viewer.js`` and in ``jsbuild/app.cfg``.