Project

General

Profile

Download (21.9 KB) Statistics
| Branch: | Tag: | Revision:
1
//see also https://github.com/geetarista/jquery-plugin-template/blob/master/jquery.plugin-template.js
2

    
3
/**
4
 * Expected dom structure:
5
 *  '<div class="ahah-content" rel="'.$cdm_proxy_url.'"><span class="loading">Loading ....</span></div>';
6
 */
7
(function($, document, window, undefined) {
8

    
9
  $.fn.cdm_openlayers_map = function(mapserverBaseUrl, mapserverVersion, options) {
10

    
11
    var opts = $.extend({},$.fn.cdm_openlayers_map.defaults, options);
12

    
13
    return this.each(function(){
14
      this.cdmOpenlayersMap = new CdmOpenLayers.Map($(this), mapserverBaseUrl, mapserverVersion, opts);
15
      this.cdmOpenlayersMap.init();
16
     }); // END each
17

    
18
  }; // END cdm_openlayers_map
19

    
20
})(jQuery, document, window, undefined);
21

    
22
(function($){
23
    $.fn.cdm_openlayers_map.defaults = {  // set up default options
24
        legendPosition:  null,      // 1,2,3,4,5,6 = display a legend in the corner specified by the number
25
        distributionOpacity: 0.75,
26
        legendOpacity: 0.75,
27
        boundingBox: "-180,-90,180,90",
28
        showLayerSwitcher: false,
29
        baseLayerNames: ["osgeo_vmap0"],
30
        defaultBaseLayerName: 'osgeo_vmap0',
31
        maxZoom: 4,
32
        minZoom: 0,
33
        /**
34
         * allows the map to display parts of the layers which are outside
35
         * the maxExtent if the aspect ratio of the map and of the baselayer
36
         * are not equal
37
         */
38
        displayOutsideMaxExtent: false,
39
        customWMSBaseLayerData: {
40
            name: null,
41
            url: null,
42
            params: null,
43
            projection: null,
44
            max_extent: null,
45
            units: null
46
        }
47
//        customWMSBaseLayerData: {
48
//            name: "Euro+Med",
49
//            url: "http://edit.africamuseum.be/geoserver/topp/wms",
50
//            params: {layers: "topp:em_tiny_jan2003", format:"image/png", tiled: true},
51
//            projection: "EPSG:7777777",
52
//            maxExtent: "-1600072.75, -1800000, 5600000, 5850093",
53
//            units: 'm'
54
//        }
55
    };
56
})(jQuery);
57

    
58

    
59

    
60
/**************************************************************************
61
 *                          CdmOpenLayers
62
 **************************************************************************/
63
(function() {
64

    
65
/**
66
 * The CdmOpenLayers namespace definition
67
 */
68
window.CdmOpenLayers  = (function () {
69

    
70
    var projections = {
71
            epsg_4326: new OpenLayers.Projection("EPSG:4326"),
72
            epsg_900913: new OpenLayers.Projection("EPSG:900913"),
73
            epsg_3857:  new OpenLayers.Projection("EPSG:3857")
74
    };
75
    var mapExtends = {
76
        epsg_4326: new OpenLayers.Bounds(-180, -90, 180, 90),
77
        epsg_900913: new OpenLayers.Bounds(-180, -90, 180, 90),
78
        epsg_3857: new OpenLayers.Bounds(-180, -90, 180, 90)
79
    };
80
    // transform epsg_900913 to units meter
81
    mapExtends.epsg_900913.transform(projections.epsg_4326, projections.epsg_900913);
82
    mapExtends.epsg_3857.transform(projections.epsg_4326, projections.epsg_3857);
83

    
84
    // make public by returning an object
85
    return {
86
            projections: projections,
87
            mapExtends: mapExtends,
88
            getLayerByName: function(layerName){} // initially empty fuction, will be populated by openlayers_layers.js
89
    };
90

    
91
})(); // end of namespace definition for CdmOpenLayers
92

    
93
  /**
94
   * The CdmOpenLayers.Map constructor
95
   * @param mapElement
96
   * @param mapserverBaseUrl
97
   * @param mapserverVersion
98
   * @param opts
99
   * @returns
100
   */
101
window.CdmOpenLayers.Map = function(mapElement, mapserverBaseUrl, mapserverVersion, opts){
102

    
103
    var mapServicePath = '/edit_wp5';
104

    
105
    // firebug console stub (avoids errors if firebug is not active)
106
    if(typeof console === "undefined") {
107
        console = { log: function() { } };
108
    }
109

    
110
    // sanitize given options
111
    try {
112
        opts.customWMSBaseLayerData.max_extent = OpenLayers.Bounds.fromString(opts.customWMSBaseLayerData.max_extent);
113
    } catch(e){
114
        opts.customWMSBaseLayerData.max_extent = null;
115
    }
116

    
117

    
118
    var legendImgSrc = null;
119

    
120
    var map = null;
121

    
122
    var infoElement = null;
123

    
124
    var dataBounds = null;
125

    
126
    var baseLayers = [];
127
    var defaultBaseLayer = null;
128

    
129
    var mapHeight = mapElement.height();
130
    var mapWidth = mapElement.width();
131

    
132
    var defaultControls = [
133
             new OpenLayers.Control.PanZoom(),
134
             new OpenLayers.Control.Navigation({zoomWheelEnabled: false, handleRightClicks:true, zoomBoxKeyMask: OpenLayers.Handler.MOD_CTRL})
135
           ];
136

    
137
//    var dataProj = new OpenLayers.Projection("EPSG:4326");
138

    
139
    var dataLayerOptions = {
140
        isBaseLayer: false,
141
        displayInLayerSwitcher: true
142
    };
143

    
144
    var layerByNameMap = {
145
        tdwg1: 'topp:tdwg_level_1',
146
        tdwg2: 'topp:tdwg_level_2',
147
        tdwg3: 'topp:tdwg_level_3',
148
        tdwg4: 'topp:tdwg_level_4'
149
    };
150

    
151
    /**
152
     *
153
     */
154
    this.init = function(){ // public function
155

    
156
      createLayers(opts.baseLayerNames, opts.defaultBaseLayerName, opts.customWMSBaseLayerData);
157

    
158
      initMap();
159

    
160
      // -- Distribution Layer --
161
      var mapServiceRequest;
162
      var distributionQuery = mapElement.attr('distributionQuery');
163

    
164
      if(distributionQuery !== undefined){
165
        if(typeof legendPosition == 'number'){
166
          distributionQuery = mergeQueryStrings(distributionQuery, 'legend=1&mlp=' + opts.legendPosition);
167
        }
168

    
169
        distributionQuery = mergeQueryStrings(distributionQuery, 'callback=?');
170
        var legendFormatQuery = mapElement.attr('legendFormatQuery');
171
        if(legendFormatQuery !== undefined){
172
          legendImgSrc = mergeQueryStrings('/GetLegendGraphic?SERVICE=WMS&VERSION=1.1.1', legendFormatQuery);
173
        }
174

    
175
        mapServiceRequest = mapserverBaseUrl + mapServicePath + '/' + mapserverVersion + '/areas.php?' + distributionQuery;
176

    
177
        jQuery.ajax({
178
            url: mapServiceRequest,
179
            dataType: "jsonp",
180
            success: function(data){
181
              addDataLayer(data);
182
            }
183
          });
184
      }
185

    
186
      // -- Occurrence Layer --
187
      var occurrenceQuery = mapElement.attr('occurrenceQuery');
188
      if(occurrenceQuery !== undefined){
189
//        if(typeof legendPosition == 'number'){
190
//          occurrenceQuery = mergeQueryStrings(distributionQuery, 'legend=1&mlp=' + opts.legendPosition);
191
//        }
192

    
193
        occurrenceQuery = mergeQueryStrings(occurrenceQuery, 'callback=?');
194
//        var legendFormatQuery = mapElement.attr('legendFormatQuery');
195
//        if(legendFormatQuery !== undefined){
196
//          legendImgSrc = mergeQueryStrings('/GetLegendGraphic?SERVICE=WMS&VERSION=1.1.1', legendFormatQuery);
197
//        }
198

    
199
        mapServiceRequest = mapserverBaseUrl + mapServicePath + '/' + mapserverVersion + '/points.php?' + occurrenceQuery;
200

    
201
        jQuery.ajax({
202
            url: mapServiceRequest,
203
            dataType: "jsonp",
204
            success: function(data){
205
              addDataLayer(data);
206
            }
207
          });
208
      }
209

    
210

    
211
    };
212

    
213
    /**
214
     * public function
215
     */
216
    this.registerEvents = function(events){
217
        for (var key in events) {
218
            if (events.hasOwnProperty(key)) {
219
                map.events.register(key, map , events[key]);
220
            }
221
        }
222
    };
223

    
224
    /**
225
     * public function
226
     */
227
    this.getMap = function(){
228
        return map;
229
    };
230

    
231
    /**
232
     * Prints info on the current map into the jQuery element
233
     * as set in the options (opts.infoElement)
234
     * public function
235
     *
236
     * @param jQuery $element
237
     */
238
    this.printInfo = function(){
239

    
240
        var mapExtendDegree = map.getExtent().clone();
241
        mapExtendDegree.transform(map.baseLayer.projection, CdmOpenLayers.projections.epsg_4326);
242

    
243
        var info = "<dl>";
244
        info += "<dt>zoom:<dt><dd>" + map.getZoom() + "</dd>";
245
        if(opts.debug){
246
            info += "<dt>map resolution:<dt><dd>" + map.getResolution() + "</dd>";
247
            info += "<dt>map max resolution:<dt><dd>" + map.getMaxResolution() + "</dd>";
248
            info += "<dt>map scale:<dt><dd>" + map.getScale() + "</dd>";
249
            info += "<dt>map extent bbox:<dt><dd>" + map.getExtent().toBBOX() + " (" + mapExtendDegree.toBBOX() + ")</dd>";
250
            info += "<dt>map maxExtent bbox:<dt><dd>" + map.getMaxExtent().toBBOX() + "</dd>";
251
            info += "<dt>baselayer projection:<dt><dd>" + map.baseLayer.projection.getCode() + "</dd>";
252
        } else {
253
            info += "<dt>bbox:<dt><dd>" + mapExtendDegree.toBBOX() + "</dd>";
254
        }
255
        info += "</dl>";
256

    
257
        if(infoElement == null){
258
            infoElement = jQuery('<div class="map_info"></div>');
259
            mapElement.parent().after(infoElement);
260
        }
261
        infoElement.html(info);
262
    };
263

    
264
    /**
265
     * Initialize the Openlayers Map with the base layer
266
     */
267
    var initMap = function(){
268

    
269

    
270
      if(opts.showLayerSwitcher === true){
271
          defaultControls.push(new OpenLayers.Control.LayerSwitcher({'ascending':false}));
272
      }
273

    
274
//      var maxExtentByAspectRatio = cropBoundsToAspectRatio(defaultBaseLayer.maxExtent, mapWidth/mapHeight);
275
      var maxResolution = null;
276
      // gmaps has no maxExtent at this point, need to check for null
277
      if(defaultBaseLayer.maxExtent != null){
278
          maxResolution = Math[(opts.displayOutsideMaxExtent ? 'max' : 'min')](
279
                      defaultBaseLayer.maxExtent.getWidth() / mapWidth,
280
                      defaultBaseLayer.maxExtent.getHeight() / mapHeight
281
                    );
282
      }
283
      console.log("mapOptions.maxResolution: " + maxResolution);
284
      console.log("mapOptions.restrictedExtent: " + defaultBaseLayer.maxExtent);
285

    
286
      map = new OpenLayers.Map(
287
          "openlayers_map",
288
          {
289
              // defines the map ui elements and interaction features
290
              controls: defaultControls,
291

    
292
              // maxResolution determines the lowest zoom level and thus places the map
293
              // in its maximum extent into the available view port so that no additinal
294
              // gutter is visible and no parts of the map are hidden
295
              // see http://trac.osgeo.org/openlayers/wiki/SettingZoomLevels
296
              // IMPORTANT!!!
297
              // the maxResulution set here will be overwritten if the baselayers maxResolution
298
              // it is set
299
              maxResolution: maxResolution,
300

    
301
              // setting restrictedExtent the the maxExtent prevents from panning the
302
              // map out of its bounds
303
              restrictedExtent: defaultBaseLayer.maxExtent,
304
//              maxExtent: defaultBaseLayer.maxExtent,
305

    
306
             // Setting the map.fractionalZoom property to true allows zooming to an arbitrary level
307
             // (between the min and max resolutions).
308
             // fractional tiles are not supported by XYZ layers like OSM so this option would
309
             // however break the tile retrieval for OSM (e.g.: tile for frational zoom level
310
             // 1.2933333333333332 = http://b.tile.openstreetmap.org/1.2933333333333332/1/0.png)
311
             fractionalZoom: defaultBaseLayer.CLASS_NAME != "OpenLayers.Layer.OSM" && defaultBaseLayer.CLASS_NAME != "OpenLayers.Layer.XYZ",
312

    
313
              eventListeners: opts.eventListeners
314

    
315
          }
316
      );
317

    
318
      //add the base layers
319
      map.addLayers(baseLayers);
320
      map.setBaseLayer(defaultBaseLayer);
321

    
322
      // calculate the bounds to zoom to
323
      zoomToBounds = zoomToBoundsFor(opts.boundingBox, defaultBaseLayer);
324
      zoomToBounds = cropBoundsToAspectRatio(zoomToBounds, map.getSize().w / map.getSize().h);
325
      console.log("zoomToBounds: " + zoomToBounds);
326

    
327
      // zoom to the extent of the bbox
328
      map.zoomToExtent(zoomToBounds, true);
329

    
330
      // readjust if the zoom level is out side of the min max
331
//      if(map.getZoom() > opts.maxZoom){
332
//        map.zoomTo(opts.maxZoom);
333
//      } else if(map.getZoom() < opts.minZoom){
334
//        map.zoomTo(opts.minZoom);
335
//      }
336

    
337
    };
338

    
339
    /**
340
     * add a distribution layer
341
     */
342
    var addDataLayer = function(mapResponseObj){
343

    
344
      var layer;
345
      // add additional layers, get them from the mapResponseObj
346
      if(mapResponseObj !== undefined){
347
        if(mapResponseObj.points_sld !== undefined){
348
          // it is a response from the points.php
349

    
350
        var geoserverUri;
351
        if(mapResponseObj.geoserver) {
352
          geoserverUri = mapResponseObj.geoserver;
353
        } else {
354
          // it is an old servive which is not providing the corresponding geoserver URI, so we guess it
355
          geoserverUri = mapserverBaseUrl + "/geoserver/wms";
356
        }
357

    
358
        //TODO points_sld should be renamed to sld in response + fill path to sld should be given
359
          layer = new OpenLayers.Layer.WMS(
360
              'points',
361
              geoserverUri,
362
              {layers: 'topp:rest_points' ,transparent:"true", format:"image/png"},
363
              dataLayerOptions );
364

    
365
          var sld = mapResponseObj.points_sld;
366
          if(sld.indexOf("http://") !== 0){
367
            // it is an old servive which is not providing the full sdl URI, so we guess it
368
            //  http://edit.africamuseum.be/synthesys/www/v1/sld/
369
            //  http://edit.br.fgov.be/synthesys/www/v1/sld/
370
            sld =  mapserverBaseUrl + "/synthesys/www/v1/sld/" + sld;
371

    
372
          }
373

    
374
          layer.params.SLD = sld;
375
          map.addLayers([layer]);
376

    
377
        } else {
378
          // it is a response from the areas.php
379
          for ( var i in mapResponseObj.layers) {
380
          var layerData = mapResponseObj.layers[i];
381

    
382
            layer = new OpenLayers.Layer.WMS(
383
                layerData.tdwg,
384
                mapResponseObj.geoserver + "/wms",
385
                {layers: layerByNameMap[layerData.tdwg] ,transparent:"true", format:"image/png"},
386
                dataLayerOptions );
387
            layer.params.SLD = layerData.sld;
388
            layer.setOpacity(opts.distributionOpacity);
389
            map.addLayers([layer]);
390

    
391
          }
392

    
393
        }
394

    
395
        // zoom to the required area
396
        if(mapResponseObj.bbox !== undefined){
397
          var newBounds =  OpenLayers.Bounds.fromString( mapResponseObj.bbox );
398
          newBounds.transform(layer.projection, map.getProjectionObject());
399
          if(dataBounds !== null){
400
            dataBounds.extend(newBounds);
401
          } else if(newBounds !== undefined){
402
            dataBounds = newBounds;
403
          }
404
          map.zoomToExtent(dataBounds, false);
405

    
406
          if(map.getZoom() > opts.maxZoom){
407
            map.zoomTo(opts.maxZoom);
408
          } else if(map.getZoom() < opts.minZoom){
409
            map.zoomTo(opts.minZoom);
410
          }
411
        }
412

    
413

    
414
        if(opts.legendPosition !== undefined && mapResponseObj.legend !== undefined){
415
          var legendSrcUrl = mapResponseObj.geoserver + legendImgSrc + mapResponseObj.legend;
416
          addLegendAsElement(legendSrcUrl);
417
          //addLegendAsLayer(legendSrcUrl, map);
418
        }
419
      }
420

    
421
    };
422

    
423
    /**
424
     *
425
     */
426
    var addLegendAsElement= function(legendSrcUrl){
427

    
428
      mapElement.after('<div class="openlayers_legend"><img src="' + legendSrcUrl + '"></div>');
429
      mapElement.next('.openlayers_legend').css('opacity', opts.legendOpacity).find('img').load(function () {
430
        jQuery(this).parent()
431
          .css('position', 'relative')
432
          .css('z-index', '1002')
433
          .css('top', -mapElement.height())
434
          .css('left', mapElement.width()- jQuery(this).width())
435
          .width(jQuery(this).width());
436
      });
437
    };
438

    
439

    
440
    var addLegendAsLayer= function(legendSrcUrl, map){
441
      var w, h;
442

    
443
      // 1. download imge to find height and width
444
      mapElement.after('<div class="openlayers_legend"><img src="' + legendSrcUrl + '"></div>');
445
      mapElement.next('.openlayers_legend').css('display', 'none').css('opacity', opts.legendOpacity).find('img').load(function () {
446

    
447
        w = mapElement.next('.openlayers_legend').find('img').width();
448
        h = mapElement.next('.openlayers_legend').find('img').height();
449
        mapElement.next('.openlayers_legend').remove();
450

    
451
//        createLegendLayer();
452
//        // 2. create the Legend Layer
453
        //TODO createLegendLayer as inner fiinction seems like an error
454
//        var createLegendLayer = function(){
455
  //
456
  //
457
//          var legendLayerOptions={
458
//              maxResolution: '.$maxRes.',
459
//              maxExtent: new OpenLayers.Bounds(0, 0, w, h)
460
//          };
461
  //
462
//          var legendLayer = new OpenLayers.Layer.Image(
463
//              'Legend',
464
//              legendSrcUrl,
465
//              new OpenLayers.Bounds(0, 0, w, h),
466
//              new OpenLayers.Size(w, h),
467
//              imageLayerOptions);
468
//        };
469
      });
470

    
471

    
472
    };
473

    
474
    /**
475
     * merge 2 Url query strings
476
     */
477
     var mergeQueryStrings = function(queryStr1, queryStr2){
478
      if(queryStr1.charAt(queryStr1.length - 1) != '&'){
479
        queryStr1 += '&';
480
      }
481
      if(queryStr2.charAt(0) == '&'){
482
        return queryStr1 + queryStr2.substr(1);
483
      } else {
484
        return queryStr1 + queryStr2;
485
      }
486

    
487
     };
488

    
489
     /**
490
      *
491
      */
492
     var createLayers = function( baseLayerNames, defaultBaseLayerName, customWMSBaseLayerData){
493

    
494
       for(var i = 0; i <  baseLayerNames.length; i++) {
495
          // create the layer
496
          if (baseLayerNames[i] == "custom_wms_base_layer_1"){
497
             baseLayers[i] = createWMSBaseLayer(
498
                     customWMSBaseLayerData.name,
499
                     customWMSBaseLayerData.url,
500
                     customWMSBaseLayerData.params,
501
                     customWMSBaseLayerData.projection,
502
                     customWMSBaseLayerData.units,
503
                     customWMSBaseLayerData.max_extent
504
                  );
505
         } else {
506
             baseLayers[i] = window.CdmOpenLayers.getLayerByName(baseLayerNames[i]);
507
         }
508
         // set default baselayer
509
         if(baseLayerNames[i] == defaultBaseLayerName){
510
           defaultBaseLayer = baseLayers[i];
511
         }
512

    
513
       }
514
     };
515

    
516
     /**
517
      * returns the intersction of the bounds b1 and b2.
518
      * The b1 and b2 do not intersect b1 will be returned.
519
      *
520
      * @param OpenLayers.Bounds b1
521
      * @param OpenLayers.Bounds b2
522
      *
523
      * @return the bounds of the intersection between both rectangles
524
      */
525
     var intersectionOfBounds = function (b1, b2){
526

    
527
         if(b1.intersectsBounds(b2)){
528

    
529
             var left = Math.max(b1.left, b2.left);
530
             var bottom = Math.max(b1.bottom, b2.bottom);
531
             var right = Math.min(b1.right, b2.right);
532
             var top = Math.min(b1.top, b2.top);
533

    
534
             return new OpenLayers.Bounds(left, bottom, right, top);
535

    
536
         } else {
537
             return b1;
538
         }
539
     };
540

    
541
     /**
542
      *
543
      * @param OpenLayers.Bounds b
544
      * @param float aspectRatio width/height
545
      *
546
      * @return the bounds croped to the given aspectRatio
547
      */
548
     var cropBoundsToAspectRatio = function (b, aspectRatio){
549

    
550
         var cropedB = b.clone();
551

    
552
         if(aspectRatio == 1){
553
             return cropedB;
554
         }
555

    
556
         /*
557
          * LonLat:
558
          *   lon {Float} The x-axis coodinate in map units
559
          *   lat {Float} The y-axis coordinate in map units
560
          */
561
         var center = cropedB.getCenterLonLat();
562
         if(aspectRatio < 1){
563
             var dist = (b.getHeight() / 2) * aspectRatio;
564
             cropedB.top = center.lat + dist;
565
             cropedB.cropedBottom = center.lat - dist;
566
         } else if(aspectRatio > 1){
567
             var dist = (b.getWidth() / 2) / aspectRatio;
568
             cropedB.left = center.lon - dist;
569
             cropedB.right = center.lon + dist;
570
         }
571
         return cropedB;
572
     };
573

    
574
     /**
575
      * returns the zoom to bounds.
576
      *
577
      * @param bboxString
578
      *     a string representation of the bounds in degree
579
      * @param layer
580
      *     the Openlayers.Layer
581
      *
582
      * @return the bboxstring projected onto the layer and intersected with the maximum extent of the layer
583
      */
584
     var zoomToBoundsFor = function(bboxString, layer){
585
         var zoomToBounds;
586
         if(typeof bboxString == 'string' && bboxString.length > 6) {
587
             zoomToBounds = OpenLayers.Bounds.fromString(bboxString);
588
             // transform bounding box given in degree values to the projection of the base layer
589
             zoomToBounds.transform(CdmOpenLayers.projections.epsg_4326, layer.projection);
590
         } else if(layer.maxExtent) {
591
             zoomToBounds = layer.maxExtent;
592
             // no need to transform since the bounds are obtained from the layer
593
         } else {
594
             zoomToBounds = new OpenLayers.Bounds(-180, -90, 180, 90);
595
             // transform bounding box given in degree values to the projection of the base layer
596
             zoomToBounds.transform(CdmOpenLayers.projections.epsg_4326, layer.projection);
597
         }
598

    
599
         zoomToBounds = intersectionOfBounds(layer.maxExtent, zoomToBounds);
600

    
601
         return zoomToBounds;
602
     };
603

    
604

    
605

    
606
     /**
607
      * returns the version number contained in the version string:
608
      *   v1.1 --> 1.1
609
      *   v1.2_dev --> 1.2
610
      */
611
     var mapServerVersionNumber = function() {
612
       var pattern = /v([\d\.]+).*$/;
613
       var result;
614
       if (result = mapserverVersion.match(pattern) !== null) {
615
         return result[0];
616
       } else {
617
         return null;
618
       }
619
     };
620

    
621
     /**
622
      * Creates a WMS Base layer
623
      * @param String name
624
      *     A name for the layer
625
      * @param String url
626
      *     Base url for the WMS (e.g.  http://wms.jpl.nasa.gov/wms.cgi)
627
      * @param Object params
628
      *     An object with key/value pairs representing the GetMap query string parameters and parameter values.
629
      * @param Object projection
630
      *    A OpenLayers.Projection object
631
      */
632
     var createWMSBaseLayer= function(name, url, params, projection, units, maxExtent){
633

    
634
         if(maxExtent == null){
635
             maxExtent = CdmOpenLayers.mapExtends.epsg_4326.clone();
636
             maxExtent.transform(CdmOpenLayers.projections.epsg_4326, projection);
637
         }
638

    
639
         return  new OpenLayers.Layer.WMS(
640
                 name,
641
                 url,
642
                 params,
643
                 {
644
                   maxExtent: maxExtent,
645
                   projection: projection,
646
                   units: units,
647
                   isBaseLayer: true,
648
                   displayInLayerSwitcher: true
649
                 }
650
               );
651
     };
652

    
653
  }; // end of CdmOpenLayers.Map
654
})();
655

    
656

    
657

    
658

    
659

    
660

    
(2-2/2)