Source: BKGWebMap/Layer/DLM.js

/*
 * 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.DLM
 */
BKGWebMap.Layer.DLM = BKGWebMap.Layer.DLM || {};

/**
 * Standardparameter für DLM-WMSe
 */
BKGWebMap.Layer.DLM.WMS_DEFAULTS = {
    singleTile: true,
    params: { format: 'image/png', transparent: true }
};

// == DLM ==============================================================================================================

/**
 * Factory-Funktion für Basis-DLM Overlay
 *
 * @param config
 * @param projection
 * @returns {OpenLayers.Layer.WMS}
 */
BKGWebMap.Layer.FACTORIES['WMS.BDLM_OV'] = function(config, projection) {
    var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DLM.WMS_DEFAULTS);
    defaults.name = 'Basis-DLM Verkehr und Ortslagen';
    defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_bdlm_ov' );

    defaults.singleTile = false;
    defaults.tileSize = new OpenLayers.Size(1024,1024);

    defaults.layers = [
        { title: 'Ortslagen', name: 'ortslagen', active: true },
        { title: 'Flüsse', name: 'fluesse', active: true },
        { title: 'Gewässer', name: 'gewaesser', active: true },
        { title: 'Eisenbahn', name: 'eisenbahn', active: true },
        { title: 'Autobahn', name: 'autobahn', active: true },
        { title: 'Bundesstr.', name: 'bundesstrasse', active: true },
        { title: 'Landstraße', name: 'landstrasse', active: true },
        { title: 'Straße', name: 'strasse', active: true },
        { title: 'Städtenamen', name: 'staedtenamen', active: true },
        { title: 'Städte (GN250)', name: 'staedte', active: true },
        { title: 'grosse Städte (GN250)', name: 'grosse_staedte', active: true }
    ];
    return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);

};

/**
 * Factory-Funktion für Basis-DLM Overlay
 *
 * @param config
 * @param projection
 * @returns {OpenLayers.Layer.WMS}
 */
BKGWebMap.Layer.FACTORIES['WMS.BDLM'] = function(config, projection) {
    var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DLM.WMS_DEFAULTS);
    defaults.name = 'Basis-DLM';
    defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_bdlm' );
    defaults.maxResolution = 50;

    defaults.layers = [
        { title: 'VEG03_F', name: '0', active: true },
        { title: 'VEG02_F', name: '1', active: true },
        { title: 'VEG04_F', name: '2', active: true },
        { title: 'VEG01_F', name: '3', active: true },
        { title: 'SIE04_F', name: '4', active: true },
        { title: 'VEG05_F', name: '5', active: true },
        { title: 'SIE01_F', name: '6', active: true },
        { title: 'SIE02_F', name: '7', active: true },
        { title: 'SIE05_F', name: '8', active: true },
        { title: 'SIE03_F', name: '9', active: true },
        { title: 'VER02_F', name: '10', active: true },
        { title: 'VER03_F', name: '11', active: true },
        { title: 'GEB05_F', name: '12', active: true },
        { title: 'GEW01_F', name: '13', active: true },
        { title: 'GEW01_F', name: '14', active: true },
        { title: 'GEB01_F', name: '15', active: true },
        { title: 'VER04_F', name: '16', active: true },
        { title: 'GEB06_F', name: '17', active: true },
        { title: 'GEB04_F', name: '18', active: true },
        { title: 'VER06_L', name: '19', active: true },
        { title: 'VER02_L', name: '20', active: true },
        { title: 'VER01_L', name: '21', active: true },
        { title: 'VER05_L', name: '22', active: true },
        { title: 'VEG04_L', name: '23', active: true },
        { title: 'REL01_L', name: '24', active: true },
        { title: 'GEW03_L', name: '25', active: true },
        { title: 'GEW02_L', name: '26', active: true },
        { title: 'GEW01_L', name: '27', active: true },
        { title: 'GEB02_L', name: '28', active: true },
        { title: 'VER01_L 3101', name: '29', active: true },
        { title: 'SIE04_L', name: '30', active: true },
        { title: 'VER02_P', name: '31', active: true },
        { title: 'VEG06_P', name: '32', active: true },
        { title: 'SIE04_P', name: '33', active: true },
        { title: 'VEG06_L', name: '34', active: true },
        { title: 'GEB03_F', name: '35', active: true },
        { title: 'GEB03_P', name: '36', active: true }
    ];
    return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
};

/**
 * Factory-Funktion für DLM1000
 *
 * @param config
 * @param projection
 * @returns {OpenLayers.Layer.WMS}
 */
BKGWebMap.Layer.FACTORIES['WMS.DLM1000'] = function(config, projection) {
    var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DLM.WMS_DEFAULTS);
    defaults.isBaseLayer = true;

    defaults.name = 'DLM1000';
    defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_dlm1000' );

    defaults.layers = [
        { title: 'geb01_f Nationalstaat', name: '1', active: true },
        { title: 'geb01_f Bundesland', name: '2', active: true },
        { title: 'geb01_f Regierungsbezirk', name: '3', active: true },
        { title: 'geb01_f Kreis', name: '4', active: true },
        { title: 'sonstige Landschaft', name: '6', active: true },
        { title: 'sonstige Landschaft Text', name: '7', active: true },
        { title: 'Wattlandschaft', name: '8', active: true },
        { title: 'Wattlandschaft Text', name: '9', active: true },
        { title: 'Inselgruppe', name: '10', active: true },
        { title: 'Inselgruppe Text', name: '11', active: true },
        { title: 'Gebirge', name: '12', active: true },
        { title: 'Gebirge Text', name: '13', active: true },
        { title: 'Plateau Hochebene', name: '14', active: true },
        { title: 'Plateau Hochebene Text', name: '15', active: true },
        { title: 'Tiefebene', name: '16', active: true },
        { title: 'Tiefebene Text', name: '17', active: true },
        { title: 'Niederung Senke', name: '18', active: true },
        { title: 'Niederung Senke Text', name: '19', active: true },
        { title: 'Heidelandschaft', name: '20', active: true },
        { title: 'Heidelandschaft Text', name: '21', active: true },
        { title: 'Waldlandschaft', name: '22', active: true },
        { title: 'Waldlandschaft Text', name: '23', active: true },
        { title: 'Moorlandschaft', name: '24', active: true },
        { title: 'Moorlandschaft Text', name: '25', active: true },
        { title: 'Siedlungslandschaft', name: '26', active: true },
        { title: 'Siedlungslandschaft Text', name: '27', active: true },
        { title: 'Seenlandschaft', name: '28', active: true },
        { title: 'Seenlandschaft Text', name: '29', active: true },
        { title: 'Berg', name: '30', active: true },
        { title: 'Berg Text', name: '31', active: true },
        { title: 'veg03_f', name: '33', active: true },
        { title: 'veg01_f', name: '34', active: true },
        { title: 'veg04_f', name: '35', active: true },
        { title: 'veg02_f', name: '36', active: true },
        { title: 'geb02_f Insel', name: '38', active: true },
        { title: 'geb03_f Truppenübungsplatz', name: '39', active: true },
        { title: 'geb03_f Biosphärenreservat', name: '40', active: true },
        { title: 'geb03_f Naturpark', name: '41', active: true },
        { title: 'geb03_f Nationalpark', name: '42', active: true },
        { title: 'rel01_l Höhenlinie', name: '44', active: true },
        { title: 'rel01_l Geländekante', name: '45', active: true },
        { title: 'sie01_f', name: '47', active: true },
        { title: 'sie01_f große Orte', name: '48', active: true },
        { title: 'sie02_f', name: '49', active: true },
        { title: 'sie01_p', name: '50', active: true },
        { title: 'sie03_p', name: '51', active: true },
        { title: 'sie05_p Turm', name: '52', active: true },
        { title: 'sie05_p Gebäude', name: '53', active: true },
        { title: 'gew01_f', name: '55', active: true },
        { title: 'gew01_f klein', name: '56', active: true },
        { title: 'gew02_f', name: '57', active: true },
        { title: 'gew03_l', name: '58', active: true },
        { title: 'gew01_l', name: '59', active: true },
        { title: 'gew01_l klein', name: '60', active: true },
        { title: 'ver06_l', name: '61', active: true },
        { title: 'ver06_p', name: '62', active: true },
        { title: 'sie04_p', name: '63', active: true },
        { title: 'ver04_f', name: '65', active: true },
        { title: 'ver06_l', name: '66', active: true },
        { title: 'ver03_l', name: '67', active: true },
        { title: 'ver05_l', name: '68', active: true },
        { title: 'ver06_p Bhf-anlage', name: '69', active: true },
        { title: 'ver06_p BrückeTunnel', name: '70', active: true },
        { title: 'ver01_l', name: '71', active: true },
        { title: 'ver01_l mittel', name: '72', active: true },
        { title: 'ver01_l klein', name: '73', active: true },
        { title: 'ver06_p Flugplatz', name: '74', active: true },
        { title: 'ver06_p Verkehrsknoten Straße', name: '75', active: true },
        { title: 'ver06_p Verkehrsknoten Autobahn', name: '76', active: true },
        { title: 'geb03_f Truppenübungsplatz', name: '78', active: true },
        { title: 'geb03_f Biosphärenreservat', name: '79', active: true },
        { title: 'geb03_f Naturpark', name: '80', active: true },
        { title: 'geb01_f Kondominium', name: '81', active: true },
        { title: 'geb01_l Kreis', name: '82', active: true },
        { title: 'geb01_l Regierungsbezirk', name: '83', active: true },
        { title: 'geb01_l Landesgrenze', name: '84', active: true }
    ];
    return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);

};

/**
 * Factory-Funktion für Basis-DLM, DLM250 und DLM1000 in selektiver und integrierter Form
 *
 * @param config
 * @param projection
 * @returns {OpenLayers.Layer.WMS}
 */
BKGWebMap.Layer.FACTORIES['WMS.DLM'] = function(config, projection) {
    var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DLM.WMS_DEFAULTS);
    defaults.isBaseLayer = true;

    defaults.name = 'DLM';
    defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_dlm' );

    defaults.layers = [
        { title: 'Leer', name: '0', active: true },
        { title: 'Vegetation_F_Z03_BDLM', name: '1', active: true },
        { title: 'Vegetation_F_Z02_DLM250', name: '2', active: true },
        { title: 'Vegetation_F_Z01_DLM1000', name: '3', active: true },
        { title: 'Siedlung_F_Text_DLM250', name: '4', active: true },
        { title: 'Siedlung_P_Text_DLM250', name: '5', active: true },
        { title: 'Siedlung_F_Z04_BDLM', name: '6', active: true },
        { title: 'Siedlung_F_Z03_DLM250', name: '7', active: true },
        { title: 'Siedlung_P_Z03_DLM250', name: '8', active: true },
        { title: 'Siedlung_F_Z02_DLM250', name: '9', active: true },
        { title: 'Siedlung_P_Z02_DLM250', name: '10', active: true },
        { title: 'Siedlung_F_Z01_DLM1000', name: '11', active: true },
        { title: 'Grenzen_L_Z03_BDLM', name: '12', active: true },
        { title: 'Grenzen_L_Z02_VG1000', name: '13', active: true },
        { title: 'Grenzen_L_Z01_VG1000', name: '14', active: true },
        { title: 'Gewaesser_F_Z04_BDLM', name: '15', active: true },
        { title: 'Gewaesser_L_Z04_BDLM', name: '16', active: true },
        { title: 'Gewaesser_F_Z03_DLM250', name: '17', active: true },
        { title: 'Gewaesser_L_Z03_DLM250', name: '18', active: true },
        { title: 'Gewaesser_F_Z02_DLM1000', name: '19', active: true },
        { title: 'Gewaesser_L_Z02_DLM1000', name: '20', active: true },
        { title: 'Gewaesser_L_Z01_DLM1000', name: '21', active: true },
        { title: 'Schienenbahn_L_Z02_BDLM', name: '22', active: true },
        { title: 'Schienenbahn_L_Z01_DLM1000', name: '23', active: true },
        { title: 'Strassen_L_Z06_BDLM', name: '24', active: true },
        { title: 'Strassen_L_Z05_BDLM', name: '25', active: true },
        { title: 'Strassen_L_Z04_BDLM', name: '26', active: true },
        { title: 'Strassen_L_Z03_BDLM', name: '27', active: true },
        { title: 'Strassen_L_Z02_BDLM', name: '28', active: true },
        { title: 'Strassen_L_Z01_BDLM', name: '29', active: true }
    ];
    return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
};

BKGWebMap.Layer.FACTORIES['WMS.BDLM.META'] = function(config, projection) {
    var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DLM.WMS_DEFAULTS);
    defaults.name = 'BDLM_META';
    defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_bdlm_meta' );
    defaults.layers = [
        { title: 'Erfassungsstufe_vertrieb', name: '0', active: true },
        { title: 'Spitzenaktualität_vertrieb', name: '1', active: true },
        { title: 'Grundaktualität_vertrieb', name: '2', active: true },
        { title: 'Erfassungsstufe_geliefert', name: '3', active: true },
        { title: 'Spitzenaktualität_geliefert', name: '4', active: true },
        { title: 'Grundaktualität_geliefert', name: '5', active: true },
        { title: 'Erfassungseinheiten', name: '6', active: true },
        { title: 'aaa Spitzenaktualität_vertrieb', name: '7', active: true },
        { title: 'aaa Grundaktualität_vertrieb', name: '8', active: true },
        { title: 'aaa Spitzenaktualität_geliefert', name: '9', active: true },
        { title: 'aaa Grundaktualität_geliefert', name: '10', active: true },
        { title: 'aaa Erfassungseinheiten', name: '11', active: true }
    ];
    return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
};

/**
 * Factory-Funktion für Basis-DLM Metadienst mit AAA Erfassungseinheiten
 *
 * @param config
 * @param projection
 * @returns {OpenLayers.Layer.WMS}
 */
BKGWebMap.Layer.FACTORIES['WMS.BDLM.META.AAA.ERFASSUNGSEINHEITEN'] = function(config, projection) {
    var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DLM.WMS_DEFAULTS);
    defaults.name = 'Erfassungseinheiten (AAA)';
    defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_bdlm_meta' );
    defaults.isBaseLayer = false;
    defaults.layers = [ { title: 'AAA Erfassungseinheiten', name: '11', active: true } ];
    return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
};

/**
 * Factory-Funktion für Basis-DLM Metadienst mit Grundaktualität geliefert
 *
 * @param config
 * @param projection
 * @returns {OpenLayers.Layer.WMS}
 */
BKGWebMap.Layer.FACTORIES['WMS.BDLM.META.AAA.GRUND.GELIEFERT'] = function(config, projection) {
    var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DLM.WMS_DEFAULTS);
    defaults.name = 'Grundaktualität geliefert (AAA)';
    defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_bdlm_meta' );
    defaults.isBaseLayer = false;
    defaults.layers = [ { title: 'AAA Grundaktualität_geliefert', name: '10', active: true } ];
    return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
};

/**
 * Factory-Funktion für Basis-DLM Metadienst mit AAA Spitzenaktualität geliefert
 *
 * @param config
 * @param projection
 * @returns {OpenLayers.Layer.WMS}
 */
BKGWebMap.Layer.FACTORIES['WMS.BDLM.META.AAA.SPITZE.GELIEFERT'] = function(config, projection) {
    var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DLM.WMS_DEFAULTS);
    defaults.name = 'Spitzenaktualität geliefert (AAA)';
    defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_bdlm_meta' );
    defaults.isBaseLayer = false;
    defaults.layers = [{ title: 'AAA Spitzenaktualität_geliefert', name: '9', active: true } ];
    return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
};

/**
 * Factory-Funktion für Basis-DLM Metadienst mit Grundaktualität vertrieb
 *
 * @param config
 * @param projection
 * @returns {OpenLayers.Layer.WMS}
 */
BKGWebMap.Layer.FACTORIES['WMS.BDLM.META.AAA.GRUND.VERTRIEB'] = function(config, projection) {
    var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DLM.WMS_DEFAULTS);
    defaults.name = 'Grundaktualität vertrieb (AAA)';
    defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_bdlm_meta' );
    defaults.isBaseLayer = false;
    defaults.layers = [ { title: 'AAA Grundaktualität_vertrieb', name: '8', active: true } ];
    return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
};

/**
 * Factory-Funktion für Basis-DLM Metadienst mit AAA Spitzenaktualität vertrieb
 *
 * @param config
 * @param projection
 * @returns {OpenLayers.Layer.WMS}
 */
BKGWebMap.Layer.FACTORIES['WMS.BDLM.META.AAA.SPITZE.VERTRIEB'] = function(config, projection) {
    var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DLM.WMS_DEFAULTS);
    defaults.name = 'Spitzenaktualität vertrieb (AAA)';
    defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_bdlm_meta' );
    defaults.isBaseLayer = false;
    defaults.layers = [ { title: 'AAA Spitzenaktualität_vertrieb', name: '7', active: true } ];
    return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
};

// == LBM ==============================================================================================================

BKGWebMap.Util.each(['2009', '2012', '2015', '2018'], function(index, year) {
    /**
    * Factory-Funktionen für Digitales Landbedeckungsmodell für Deutschland, Stand 2009, 2012, 2015 und 2018
    *
    * @param config
    * @param projection
    * @returns {OpenLayers.Layer.WMS}
    */
    BKGWebMap.Layer.FACTORIES['WMS.LBM.' + year] = function(config, projection) {
        var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DLM.WMS_DEFAULTS);
        defaults.isBaseLayer = true;

        defaults.name = 'LBM, Stand ' + year;
        defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_lbm_' + year );

        defaults.layers = [ { title: 'LBM', name: 'lbm', active: true } ];
        return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
    };

    /**
     * Factory-Funktionen für Digitales Landbedeckungsmodell für Deutschland, StandReferenzjahr 2009, 2012 und 2015 in
     * Corine Landcover Ausprägung
     *
     * @param config
     * @param projection
     * @returns {OpenLayers.Layer.WMS}
     */
    BKGWebMap.Layer.FACTORIES['WMS.CLC.' + year] = function(config, projection) {
        var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DLM.WMS_DEFAULTS);
        defaults.isBaseLayer = true;

        defaults.name = 'LBM, Stand '  + year + ' (Corine Landcover)';
        defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_lbm_' + year );

        defaults.layers = [ { title: 'CLC', name: 'clc', active: true } ];
        return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
    };
});


BKGWebMap.Util.each(['2012', '2015', '2018'], function(index, year) {
    /**
     * Factory-Funktionen für CLC 5ha, Stand 2012, 2015 und 2018
     *
     * @param config
     * @param projection
     * @returns {OpenLayers.Layer.WMS}
     */
    BKGWebMap.Layer.FACTORIES['WMS.CLC5.' + year] = function(config, projection) {
        var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DLM.WMS_DEFAULTS);
        defaults.isBaseLayer = true;

        defaults.name = 'CLC5, Stand ' + year;
        defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_clc5_' + year );

        defaults.layers = [ { title: 'CLC5', name: 'clc5', active: true } ];
        return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);
    };
});


/**
 * Factory-Funktion für Digitales Landbedeckungsmodell für Deutschland, Stand 2009
 *
 * @param config
 * @param projection
 * @returns {OpenLayers.Layer.WMS}
 * @depreciated WMS.DLM.2009 verwenden
 */
BKGWebMap.Layer.FACTORIES['WMS.DLMDE.2009'] = function(config, projection) {
    return BKGWebMap.Layer.FACTORIES['WMS.LBM.2009'](config, projection);
};

/**
 * Factory-Funktion für Landschaften
 *
 * @param config
 * @param projection
 * @returns {OpenLayers.Layer.WMS}
 */
BKGWebMap.Layer.FACTORIES['WMS.LANDSCHAFTEN'] = function(config, projection) {
  var defaults = OpenLayers.Util.extend(null, BKGWebMap.Layer.DLM.WMS_DEFAULTS);
  defaults.name = 'Landschaften';
  defaults.url = BKGWebMap.Util.getServiceUrl( 'wms_landschaften' );
  defaults.attribution = "Karte: © BKG, StAGN 2014; " +
      "Landschaftsbeschreibungen: © Herbert Liedtke, " +
      "Namen und Abgrenzungen von Landschaften in der Bundesrepublik Deutschland, " +
      "3. Auflage 2002, Band 239 in der Reihe "Forschungen zur deutschen Landeskunde", " +
      "Deutsche Akademie für Landeskunde, Selbstverlag.";

  defaults.layers = [
    { title: 'Historisch', name: 'historisch', active: false },
    { title: 'Siedlung', name: 'siedlung', active: false },
    { title: 'Gebirge', name: 'gebirge', active: false },
    { title: 'Insel', name: 'insel', active: false },
    { title: 'Becken', name: 'becken', active: false },
    { title: 'Tal', name: 'tal', active: false },
    { title: 'Wald', name: 'wald', active: false },
    { title: 'Küste', name: 'kueste', active: false },
    { title: 'Plateau', name: 'plateau', active: false },
    { title: 'Landschaften', name: 'landschaften', active: true },
    { title: 'Umringe', name: 'umringe', active: true },
    { title: 'Beschriftung', name: 'beschriftung', active: true }
  ];
  return BKGWebMap.Layer.FACTORIES['BKG.WMS'](config, projection, defaults);

};