/*
* Copyright (c) 2013 Bundesamt für Kartographie und Geodäsie.
* See license.txt in the BKG WebMap distribution or repository for the
* full text of the license.
*
* Author: Dirk Thalheim
*/
/**
* @requires OpenLayers/Util.js
* @requires BKGWebMap/Layer.js
* @requires BKGWebMap/Layer/WMS.js
*/
/**
* @namespace BKGWebMap.Layer.DGM
*/
BKGWebMap.Layer.DGM = BKGWebMap.Layer.DGM || {};
/**
* Standardparameter für WMS Layer
* @constant BKGWebMap.Layer.DGM.WMS_DEFAULTS
* @type object
*/
BKGWebMap.Layer.DGM.WMS_DEFAULTS = {
isBaseLayer: true,
attribution: BKGWebMap.Layer.COPYRIGHT,
size: new OpenLayers.Size(512,512),
params: { format: "image/png" }
};
/*
* Registriert die DGM Layer-Factories:
* WMS.DGM10.RELIEF
* WMS.DGM10.SCHUMMERUNG
* WMS.DGM10.COLORMAP
* WMS.DGM10.HOEHE
* WMS.DGM25.RELIEF
* WMS.DGM25.SCHUMMERUNG
* WMS.DGM25.COLORMAP
* WMS.DGM25.HOEHE
* WMS.DGM50.RELIEF
* WMS.DGM50.SCHUMMERUNG
* WMS.DGM50.COLORMAP
* WMS.DGM50.HOEHE
* WMS.DGM200.RELIEF
* WMS.DGM200.SCHUMMERUNG
* WMS.DGM200.COLORMAP
* WMS.DGM200.HOEHE
* WMS.DGM1000.RELIEF
* WMS.DGM1000.SCHUMMERUNG
* WMS.DGM1000.COLORMAP
* WMS.DGM1000.HOEHE
*/
BKGWebMap.Util.each(['dgm10', 'dgm25', 'dgm50', 'dgm200', 'dgm1000'], function(index, name) {
// Verfügbare Layer je Dienst
var layers = [
{service: name, name: 'relief', title: 'Relief'},
{service: name, name: 'schummerung', title: 'Schummerung'},
{service: name, name: 'colormap', title: 'Colormap'},
{service: name, name: 'hoehe', title: 'Höhe'}
];
// Für jeden Layer wird ein separater Dienst erstellt
BKGWebMap.Util.each(layers, function(index, layer) {
var factoryName = 'WMS.' + layer.service.toUpperCase() + '.' + layer.name.toUpperCase();
BKGWebMap.Layer.FACTORIES[factoryName] = function(config, projection) {
var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DGM.WMS_DEFAULTS);
defaults.name = layer.service.toUpperCase() + ' ' + layer.title;
defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_' + layer.service );
defaults.layers = [{ title: layer.title, name: layer.name, active: true }];
return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
};
})
});
// EURO DEM
BKGWebMap.Util.each(['relief', 'schummerung', 'schummerung_hell'], function(index, layer) {
var title = layer.charAt(0).toUpperCase() + layer.slice(1).replace('_', ' ');
BKGWebMap.Layer.FACTORIES['WMS.DGM.EU.'+layer.toUpperCase()] = function (config, projection) {
var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DGM.WMS_DEFAULTS);
defaults.name = 'Euro DEM ' + title;
defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_euro_dem' );
defaults.layers = [{title: title, name: layer, active: true}];
defaults.maxExtent = BKGWebMap.Util.getMaxExtent(projection, BKGWebMap.Layer.TopPlus.EXTENTS);
return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
}
});
// == Metadienste ================================================================
/*
* Registriert die DGM Metadatendienste:
* WMS.DGM.META.DGM10.VERTRIEB
* WMS.DGM.META.DGM10.KACHELN
*/
BKGWebMap.Util.each(
[
{ key: 'DGM10.VERTRIEB', name: 'dgm10', title: 'DGM10 Aktualität im Vertrieb', style: 'default'},
{ key: 'DGM10.KACHELN', name: 'dgm10', title: 'DGM10 20km Kacheln', style: 'erfassungseinheiten'}
],
function(index, layer) {
BKGWebMap.Layer.FACTORIES['WMS.DGM.META.' + layer.key] = function(config, projection) {
var defaults = {
name: layer.title,
url: BKGWebMap.Util.getServiceUrl( 'wms_info' ),
attribution: BKGWebMap.Layer.COPYRIGHT,
layers: [ { title: layer.title, name: layer.name, active: true, style: layer.style } ],
params: { format: 'image/png', transparent: true }
};
return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
};
}
);
BKGWebMap.Util.each( ['DGM1000', 'DGM200', 'DGM100', 'DGM50', 'DGM25', 'DGM10', 'DGM5', 'DGM1'], function(index, name) {
var factoryName = 'WMS.INFO.' + name + '.LIEFERUNG';
if('DGM1000' !== name && 'DGM200' !== name) {
BKGWebMap.Layer.FACTORIES[factoryName] = function (config, projection) {
var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.INFO_WMS_DEFAULTS);
defaults.singleTile = false;
defaults.name = name + ' Spitzenaktualität Lieferung';
defaults.url = BKGWebMap.Util.getServiceUrl('wms_info');
defaults.layers = [{title: defaults.name, name: name.toLowerCase() + '_upd', active: true}];
return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
};
}
factoryName = 'WMS.INFO.' + name + '.VERTRIEB';
BKGWebMap.Layer.FACTORIES[factoryName] = function(config, projection) {
var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.INFO_WMS_DEFAULTS);
defaults.singleTile = false;
defaults.name = name + ' Spitzenaktualität Vertrieb';
defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_info' );
defaults.layers = [ { title: defaults.name, name: name.toLowerCase(), active: true } ];
return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
};
factoryName = 'WMS.INFO.' + name + '.ERFASSUNGSEINHEITEN';
BKGWebMap.Layer.FACTORIES[factoryName] = function(config, projection) {
var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.INFO_WMS_DEFAULTS);
defaults.name = name + ' Erfassungseinheiten';
defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_info' );
defaults.layers = [ {
title: defaults.name, name: name.toLowerCase(), active: true, style: 'erfassungseinheiten'
} ];
return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
};
});