[fusion-commits] r2221 - in trunk: . layers/Generic lib text widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Sep 10 03:08:47 EDT 2010


Author: liuar
Date: 2010-09-10 07:08:47 +0000 (Fri, 10 Sep 2010)
New Revision: 2221

Modified:
   trunk/fusion.cfg
   trunk/layers/Generic/Generic.js
   trunk/lib/fusion.js
   trunk/text/en.json
   trunk/text/fr.json
   trunk/widgets/BasemapSwitcher.js
Log:
Ticket #404 New Commercial Map Service Layer support - Open Street Map



Modified: trunk/fusion.cfg
===================================================================
--- trunk/fusion.cfg	2010-09-09 18:39:22 UTC (rev 2220)
+++ trunk/fusion.cfg	2010-09-10 07:08:47 UTC (rev 2221)
@@ -32,6 +32,7 @@
 OpenLayers/Layer/Yahoo.js
 OpenLayers/Layer/Vector.js
 OpenLayers/Layer/Markers.js
+OpenLayers/Layer/XYZ.js
 OpenLayers/Tile.js
 OpenLayers/Tile/Image.js
 OpenLayers/Control/OverviewMap.js

Modified: trunk/layers/Generic/Generic.js
===================================================================
--- trunk/layers/Generic/Generic.js	2010-09-09 18:39:22 UTC (rev 2220)
+++ trunk/layers/Generic/Generic.js	2010-09-10 07:08:47 UTC (rev 2221)
@@ -155,6 +155,14 @@
                 break;
             }
             break;
+         case 'OpenStreetMap':
+            if (this.mapTag.layerOptions.type) {
+                this.mapTag.layerOptions.type = this.mapTag.layerOptions.type;
+            }
+            else {
+                this.mapTag.layerOptions.type = 'Mapnik';
+            }
+            break;
           default:
             this.oLayerOL = new OpenLayers.Layer[this.layerType](
                                   this.getMapName(), 
@@ -185,7 +193,12 @@
             if (typeof this.mapTag.layerOptions.numZoomLevels == 'undefined') {
                 this.mapTag.layerOptions.numZoomLevels = 20;
             }
-            this.oLayerOL = new OpenLayers.Layer[this.layerType](this.getMapName(), this.mapTag.layerOptions );
+            if(this.layerType == 'OpenStreetMap') {
+                this.oLayerOL = new OpenLayers.Layer.OSM[this.mapTag.layerOptions.type](this.getMapName(), this.mapTag.layerOptions );
+            }
+            else {
+                this.oLayerOL = new OpenLayers.Layer[this.layerType](this.getMapName(), this.mapTag.layerOptions );
+            }
             this.mapWidget.fractionalZoom = false;        //fractionalZoom not permitted with Google layers
             this.mapWidget.oMapOL.setOptions({fractionalZoom: false});
         }

Modified: trunk/lib/fusion.js
===================================================================
--- trunk/lib/fusion.js	2010-09-09 18:39:22 UTC (rev 2220)
+++ trunk/lib/fusion.js	2010-09-10 07:08:47 UTC (rev 2221)
@@ -1511,11 +1511,13 @@
         if(appDefXML){
             var googleElement = appDefXML.getElementsByTagName("GoogleScript")[0]; 
             var yahooElement = appDefXML.getElementsByTagName("YahooScript")[0]; 
-            var veElement = appDefXML.getElementsByTagName("VirtualEarthScript")[0]; 
+            var veElement = appDefXML.getElementsByTagName("VirtualEarthScript")[0];
+            var osmElement = appDefXML.getElementsByTagName("OpenStreetMapScript")[0];
 
             addElement(googleElement); 
             addElement(yahooElement); 
             addElement(veElement);
+            addElement(osmElement);
         }
     }
     

Modified: trunk/text/en.json
===================================================================
--- trunk/text/en.json	2010-09-09 18:39:22 UTC (rev 2220)
+++ trunk/text/en.json	2010-09-10 07:08:47 UTC (rev 2221)
@@ -60,5 +60,19 @@
 'printShowNorthArrow':'Show North Arrow?',
 
 'quickPlotResolutionWarning':'The current settings exceed the map resolution. Zooming out or increasing the scaling will help create a more legible plot',
+'noCommercialMapLayers':'NONE',
+'googleStreet':'Google Street',
+'googleSatellite':'Google Satellite',
+'googleTerrain':'Google Terrain',
+'googleHybrid':'Google Hybrid',
+'yahooStreet':'Yahoo Street',
+'yahooSatellite':'Yahoo Satellite',
+'yahooHybrid':'Yahoo Hybrid',
+'bingStreet':'Bing Street',
+'bingSatellite':'Bing Satellite',
+'bingHybrid':'Bing Hybrid',
+'openStreetMap':'Open Street Map',
+'openStreetMapOsmarender':'Open Street Map (Osmarender)',
+'openStreetMapCycleMap':'Open Street Map (CycleMap)',
 'end': ''
 };

Modified: trunk/text/fr.json
===================================================================
--- trunk/text/fr.json	2010-09-09 18:39:22 UTC (rev 2220)
+++ trunk/text/fr.json	2010-09-10 07:08:47 UTC (rev 2221)
@@ -51,5 +51,19 @@
 'maptipLinkText': 'Cliquer pour plus d information',
 
 'quickPlotResolutionWarning':'The current settings exceed the map resolution. Zooming out or increasing the scaling will help create a more legible plot',
+'noCommercialMapLayers':'NONE',
+'googleStreet':'Google Street',
+'googleSatellite':'Google Satellite',
+'googleTerrain':'Google Terrain',
+'googleHybrid':'Google Hybrid',
+'yahooStreet':'Yahoo Street',
+'yahooSatellite':'Yahoo Satellite',
+'yahooHybrid':'Yahoo Hybrid',
+'bingStreet':'Bing Street',
+'bingSatellite':'Bing Satellite',
+'bingHybrid':'Bing Hybrid',
+'openStreetMap':'Open Street Map',
+'openStreetMapOsmarender':'Open Street Map (Osmarender)',
+'openStreetMapCycleMap':'Open Street Map (CycleMap)',
 'end': ''
 };

Modified: trunk/widgets/BasemapSwitcher.js
===================================================================
--- trunk/widgets/BasemapSwitcher.js	2010-09-09 18:39:22 UTC (rev 2220)
+++ trunk/widgets/BasemapSwitcher.js	2010-09-10 07:08:47 UTC (rev 2221)
@@ -50,6 +50,9 @@
             'Road': null,
             'Aerial': null,
             'Hybrid': null,
+            'Mapnik': null,
+            'Osmarender': null,
+            'CycleMap': null,
             'None': null
         };
     },
@@ -63,13 +66,13 @@
             var map = maps[i];
             switch (map.layerType) {
                 case 'MapGuide':
-                    this.options['None'] = 'None';
+                    this.options['None'] = OpenLayers.i18n('noCommercialMapLayers');
                     this.baseMaps['None'] = map;
                     break;
                 case 'Google':
                     // if user didn't indicate basemap types, use the default Google Street
                     if (!map.mapTag.extension.Options || !map.mapTag.extension.Options[0].type) {
-                        this.options['G_NORMAL_MAP'] = "Google Street";
+                        this.options['G_NORMAL_MAP'] = OpenLayers.i18n('googleStreet');
                         this.baseMaps['G_NORMAL_MAP'] = map;
 
                         // The first non-MapGuide basemap will be the default basemap
@@ -80,31 +83,39 @@
                     else {
                         switch (map.mapTag.extension.Options[0].type[0]) {
                             case 'G_NORMAL_MAP':
-                                if (map.mapTag.extension.Options[0].name)
+                                if (map.mapTag.extension.Options[0].name) {
                                     this.options['G_NORMAL_MAP'] = map.mapTag.extension.Options[0].name[0];
-                                else
-                                    this.options['G_NORMAL_MAP'] = "Google Street";
+                                }
+                                else {
+                                    this.options['G_NORMAL_MAP'] = OpenLayers.i18n('googleStreet');
+                                }
                                 this.baseMaps['G_NORMAL_MAP'] = map;
                                 break;
                             case 'G_SATELLITE_MAP':
-                                if (map.mapTag.extension.Options[0].name)
+                                if (map.mapTag.extension.Options[0].name) {
                                     this.options['G_SATELLITE_MAP'] = map.mapTag.extension.Options[0].name[0];
-                                else
-                                    this.options['G_SATELLITE_MAP'] = "Google Satellite";
+                                }
+                                else {
+                                    this.options['G_SATELLITE_MAP'] = OpenLayers.i18n('googleSatellite');
+                                }
                                 this.baseMaps['G_SATELLITE_MAP'] = map;
                                 break;
                             case 'G_HYBRID_MAP':
-                                if (map.mapTag.extension.Options[0].name)
+                                if (map.mapTag.extension.Options[0].name) {
                                     this.options['G_HYBRID_MAP'] = map.mapTag.extension.Options[0].name[0];
-                                else
-                                    this.options['G_HYBRID_MAP'] = "Google Hybrid";
+                                }
+                                else {
+                                    this.options['G_HYBRID_MAP'] = OpenLayers.i18n('googleHybrid');
+                                }
                                 this.baseMaps['G_HYBRID_MAP'] = map;
                                 break;
                             case 'G_PHYSICAL_MAP':
-                                if (map.mapTag.extension.Options[0].name)
+                                if (map.mapTag.extension.Options[0].name) {
                                     this.options['G_PHYSICAL_MAP'] = map.mapTag.extension.Options[0].name[0];
-                                else
-                                    this.options['G_PHYSICAL_MAP'] = "Google Terrain";
+                                }
+                                else {
+                                    this.options['G_PHYSICAL_MAP'] = OpenLayers.i18n('googleTerrain');
+                                }
                                 this.baseMaps['G_PHYSICAL_MAP'] = map;
                                 break;
                             default:
@@ -121,7 +132,7 @@
                 case 'Yahoo':
                     // if user didn't indicate basemap types, use the default Yahoo Street
                     if (!map.mapTag.extension.Options || !map.mapTag.extension.Options[0].type) {
-                        this.options['YAHOO_MAP_REG'] = "Yahoo Street";
+                        this.options['YAHOO_MAP_REG'] = OpenLayers.i18n('yahooStreet');
                         this.baseMaps['YAHOO_MAP_REG'] = map;
 
                         // The first non-MapGuide basemap will be the default basemap
@@ -132,24 +143,30 @@
                     else {
                         switch (map.mapTag.extension.Options[0].type[0]) {
                             case 'YAHOO_MAP_REG':
-                                if (map.mapTag.extension.Options[0].name)
+                                if (map.mapTag.extension.Options[0].name) {
                                     this.options['YAHOO_MAP_REG'] = map.mapTag.extension.Options[0].name[0];
-                                else
+                                }
+                                else {
                                     this.options['YAHOO_MAP_REG'] = "Yahoo Street";
+                                }
                                 this.baseMaps['YAHOO_MAP_REG'] = map;
                                 break;
                             case 'YAHOO_MAP_SAT':
-                                if (map.mapTag.extension.Options[0].name)
+                                if (map.mapTag.extension.Options[0].name) {
                                     this.options['YAHOO_MAP_SAT'] = map.mapTag.extension.Options[0].name[0];
-                                else
-                                    this.options['YAHOO_MAP_SAT'] = "Yahoo Satellite";
+                                }
+                                else {
+                                    this.options['YAHOO_MAP_SAT'] = OpenLayers.i18n('yahooStreet');
+                                }
                                 this.baseMaps['YAHOO_MAP_SAT'] = map;
                                 break;
                             case 'YAHOO_MAP_HYB':
-                                if (map.mapTag.extension.Options[0].name)
+                                if (map.mapTag.extension.Options[0].name) {
                                     this.options['YAHOO_MAP_HYB'] = map.mapTag.extension.Options[0].name[0];
-                                else
-                                    this.options['YAHOO_MAP_HYB'] = "Yahoo Hybrid";
+                                }
+                                else {
+                                    this.options['YAHOO_MAP_HYB'] = OpenLayers.i18n('yahooHybrid');
+                                }
                                 this.baseMaps['YAHOO_MAP_HYB'] = map;
                                 break;
                             default:
@@ -164,7 +181,7 @@
                 case 'VirtualEarth':
                     // if user didn't indicate basemap types, use the default Bing Street
                     if (!map.mapTag.extension.Options || !map.mapTag.extension.Options[0].type) {
-                        this.options['Road'] = "Bing Street";
+                        this.options['Road'] = OpenLayers.i18n('bingStreet');
                         this.baseMaps['Road'] = map;
                         // The first non-MapGuide basemap will be the default basemap
                         if (!this.defaultBasemap) {
@@ -175,24 +192,30 @@
 
                         switch (map.mapTag.extension.Options[0].type[0]) {
                             case 'Road':
-                                if (map.mapTag.extension.Options[0].name)
+                                if (map.mapTag.extension.Options[0].name) {
                                     this.options['Road'] = map.mapTag.extension.Options[0].name[0];
-                                else
-                                    this.options['Road'] = "Bing Street";
+                                }
+                                else {
+                                    this.options['Road'] = OpenLayers.i18n('bingStreet');
+                                }
                                 this.baseMaps['Road'] = map;
                                 break;
                             case 'Aerial':
-                                if (map.mapTag.extension.Options[0].name)
+                                if (map.mapTag.extension.Options[0].name) {
                                     this.options['Aerial'] = map.mapTag.extension.Options[0].name[0];
-                                else
-                                    this.options['Aerial'] = "Bing Satellite";
+                                }
+                                else {
+                                    this.options['Aerial'] = OpenLayers.i18n('bingSatellite');
+                                }
                                 this.baseMaps['Aerial'] = map;
                                 break;
                             case 'Hybrid':
-                                if (map.mapTag.extension.Options[0].name)
+                                if (map.mapTag.extension.Options[0].name) {
                                     this.options['Hybrid'] = map.mapTag.extension.Options[0].name[0];
-                                else
-                                    this.options['Hybrid'] = "Bing Hybrid";
+                                }
+                                else {
+                                    this.options['Hybrid'] = OpenLayers.i18n('bingHybrid');
+                                }
                                 this.baseMaps['Hybrid'] = map;
                                 break;
                             default:
@@ -204,6 +227,55 @@
                         }
                     }
                     break;
+                case 'OpenStreetMap':
+                    // if user didn't indicate basemap types, use the default OSM Mapnik render
+                    if (!map.mapTag.extension.Options || !map.mapTag.extension.Options[0].type) {
+                        this.options['Mapnik'] = OpenLayers.i18n('openStreetMap');
+                        this.baseMaps['Mapnik'] = map;
+                        // The first non-MapGuide basemap will be the default basemap
+                        if (!this.defaultBasemap) {
+                            this.defaultBasemap = "Mapnik";
+                        }
+                    }
+                    else {
+
+                        switch (map.mapTag.extension.Options[0].type[0]) {
+                            case 'Mapnik':
+                                if (map.mapTag.extension.Options[0].name) {
+                                    this.options['Mapnik'] = map.mapTag.extension.Options[0].name[0];
+                                }
+                                else {
+                                    this.options['Mapnik'] =  OpenLayers.i18n('openStreetMap');
+                                }
+                                this.baseMaps['Mapnik'] = map;
+                                break;
+                            case 'Osmarender':
+                                if (map.mapTag.extension.Options[0].name) {
+                                    this.options['Osmarender'] = map.mapTag.extension.Options[0].name[0];
+                                }
+                                else {
+                                    this.options['Osmarender'] = OpenLayers.i18n('openStreetMapOsmarender');
+                                }
+                                this.baseMaps['Osmarender'] = map;
+                                break;
+                            case 'CycleMap':
+                                if (map.mapTag.extension.Options[0].name) {
+                                    this.options['CycleMap'] = map.mapTag.extension.Options[0].name[0];
+                                }
+                                else {
+                                    this.options['CycleMap'] =  OpenLayers.i18n('openStreetMapCycleMap');
+                                }
+                                this.baseMaps['CycleMap'] = map;
+                                break;
+                            default:
+                                break;
+                        }
+                        // The first non-MapGuide basemap will be the default basemap
+                        if (!this.defaultBasemap) {
+                            this.defaultBasemap = map.mapTag.extension.Options[0].type[0];
+                        }
+                    }
+                    break;
                 default:
                     break;
             }



More information about the fusion-commits mailing list