[fusion-commits] r2560 - in branches/fusion-mg24: layers/Generic text widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Tue Jul 31 05:43:12 PDT 2012


Author: jng
Date: 2012-07-31 05:43:11 -0700 (Tue, 31 Jul 2012)
New Revision: 2560

Modified:
   branches/fusion-mg24/layers/Generic/Generic.js
   branches/fusion-mg24/text/en.json
   branches/fusion-mg24/widgets/BasemapSwitcher.js
Log:
#533, #534: OpenStreetMap fixes for Fusion:
 - Fix broken OSM sub-layer support in Generic.js. All sub-types were defaulting to the Mapnik tileset. Now we test if the given OSM sub-type is supported. If that sub-type is supported, we create that instance instead of the default OpenLayers.Layer.OSM type. Including the required script through the OpenStreetMapScript extension element will ensure these sub-types are defined.
 - Fix the BasemapSwitcher.js in light of the above changes. Osmarender is no longer available as an OSM layer sub-type, so this has been replaced with the TransportMap sub-type. The new OSM supported sub-types are:
   - Mapnik (default)
   - TransportMap
   - CycleMap

Modified: branches/fusion-mg24/layers/Generic/Generic.js
===================================================================
--- branches/fusion-mg24/layers/Generic/Generic.js	2012-07-30 08:32:17 UTC (rev 2559)
+++ branches/fusion-mg24/layers/Generic/Generic.js	2012-07-31 12:43:11 UTC (rev 2560)
@@ -190,7 +190,12 @@
        
         if (!this.oLayerOL) {
             if(this.layerType == 'OpenStreetMap' || this.layerType == 'OSM') {
-                this.oLayerOL = new OpenLayers.Layer.OSM(this.getMapName(), null, this.mapTag.layerOptions );
+                //Test OSM sub-type before falling back to OpenLayers.Layer.OSM
+                if (typeof(OpenLayers.Layer.OSM[this.mapTag.layerOptions.type]) != 'undefined') { 
+                    this.oLayerOL = new OpenLayers.Layer.OSM[this.mapTag.layerOptions.type](this.getMapName(), null, this.mapTag.layerOptions );
+                } else {
+                    this.oLayerOL = new OpenLayers.Layer.OSM(this.getMapName(), null, this.mapTag.layerOptions );
+                }
             }
             else {
                 this.oLayerOL = new OpenLayers.Layer[this.layerType](this.getMapName(), this.mapTag.layerOptions );

Modified: branches/fusion-mg24/text/en.json
===================================================================
--- branches/fusion-mg24/text/en.json	2012-07-30 08:32:17 UTC (rev 2559)
+++ branches/fusion-mg24/text/en.json	2012-07-31 12:43:11 UTC (rev 2560)
@@ -75,7 +75,7 @@
 'bingSatellite':'Bing Satellite',
 'bingHybrid':'Bing Hybrid',
 'openStreetMap':'Open Street Map',
-'openStreetMapOsmarender':'Open Street Map (Osmarender)',
+'openStreetMapTransportMap':'Open Street Map (TransportMap)',
 'openStreetMapCycleMap':'Open Street Map (CycleMap)',
 'end': ''
 };

Modified: branches/fusion-mg24/widgets/BasemapSwitcher.js
===================================================================
--- branches/fusion-mg24/widgets/BasemapSwitcher.js	2012-07-30 08:32:17 UTC (rev 2559)
+++ branches/fusion-mg24/widgets/BasemapSwitcher.js	2012-07-31 12:43:11 UTC (rev 2560)
@@ -45,7 +45,7 @@
         'Aerial': -1,
         'Hybrid': -1,
         'Mapnik': 0,
-        'Osmarender': 0,
+        'TransportMap': 0,
         'CycleMap': 0,
         'None': 0
     },
@@ -71,7 +71,7 @@
             'Aerial': null,
             'Hybrid': null,
             'Mapnik': null,
-            'Osmarender': null,
+            'TransportMap': null,
             'CycleMap': null,
             'None': null
         };
@@ -260,35 +260,33 @@
                     else {
 
                         switch (map.mapTag.extension.Options[0].type[0]) {
-                            case 'Mapnik':
+                            case 'TransportMap':
                                 if (map.mapTag.extension.Options[0].name) {
-                                    this.options['Mapnik'] = map.mapTag.extension.Options[0].name[0];
+                                    this.options['TransportMap'] = map.mapTag.extension.Options[0].name[0];
                                 }
                                 else {
-                                    this.options['Mapnik'] =  OpenLayers.i18n('openStreetMap');
+                                    this.options['TransportMap'] = OpenLayers.i18n('openStreetMapTransportMap');
                                 }
-                                this.baseMaps['Mapnik'] = map;
+                                this.baseMaps['TransportMap'] = map;
                                 break;
-                            case 'Osmarender':
+                            case 'CycleMap':
                                 if (map.mapTag.extension.Options[0].name) {
-                                    this.options['Osmarender'] = map.mapTag.extension.Options[0].name[0];
+                                    this.options['CycleMap'] = map.mapTag.extension.Options[0].name[0];
                                 }
                                 else {
-                                    this.options['Osmarender'] = OpenLayers.i18n('openStreetMapOsmarender');
+                                    this.options['CycleMap'] =  OpenLayers.i18n('openStreetMapCycleMap');
                                 }
-                                this.baseMaps['Osmarender'] = map;
+                                this.baseMaps['CycleMap'] = map;
                                 break;
-                            case 'CycleMap':
+                            default: //Default to Mapnik tileset
                                 if (map.mapTag.extension.Options[0].name) {
-                                    this.options['CycleMap'] = map.mapTag.extension.Options[0].name[0];
+                                    this.options['Mapnik'] = map.mapTag.extension.Options[0].name[0];
                                 }
                                 else {
-                                    this.options['CycleMap'] =  OpenLayers.i18n('openStreetMapCycleMap');
+                                    this.options['Mapnik'] =  OpenLayers.i18n('openStreetMap');
                                 }
-                                this.baseMaps['CycleMap'] = map;
+                                this.baseMaps['Mapnik'] = map;
                                 break;
-                            default:
-                                break;
                         }
                         // The first non-MapGuide basemap will be the default basemap
                         if (!this.defaultBasemap) {



More information about the fusion-commits mailing list