[fusion-commits] r2151 - in sandbox/adsk/2.2gp: layers/MapGuide lib/OpenLayers

svn_fusion at osgeo.org svn_fusion at osgeo.org
Thu Apr 22 17:26:08 EDT 2010


Author: chrisclaydon
Date: 2010-04-22 17:26:05 -0400 (Thu, 22 Apr 2010)
New Revision: 2151

Modified:
   sandbox/adsk/2.2gp/layers/MapGuide/MapGuide.js
   sandbox/adsk/2.2gp/lib/OpenLayers/OpenLayers.js
Log:
Re #310 - Don't attempt to use a Proj4 projection if we can't get the EPSG code corresponding to the projection we require.

Modified: sandbox/adsk/2.2gp/layers/MapGuide/MapGuide.js
===================================================================
--- sandbox/adsk/2.2gp/layers/MapGuide/MapGuide.js	2010-04-22 16:21:53 UTC (rev 2150)
+++ sandbox/adsk/2.2gp/layers/MapGuide/MapGuide.js	2010-04-22 21:26:05 UTC (rev 2151)
@@ -52,7 +52,7 @@
         var newTheme = Fusion.getQueryParam('theme');
         if (newTheme != '') {
           this.sMapResourceId = newTheme;
-          //clear the query param after it has been used once 
+          //clear the query param after it has been used once
           Fusion.queryParams['theme'] = null;
         }
 
@@ -85,7 +85,7 @@
             this.nTolerance = 2; //pixels, default pixel tolernace for a point click; TBD make this configurable
           }
         }
-        
+
         //copy over projection info from maptag
         this.projCode = mapTag.projCode;
 
@@ -305,6 +305,10 @@
             //set projection units and code if supplied
             if (o.epsg != 0) {
               this.projCode = "EPSG:" + o.epsg;
+            } else if(window.Proj4js) {
+                // By setting the projection code to this unsupported value,
+                // we prevent the use of the default EPSG:4326 projection.
+                this.projCode = "UNKNOWN";
             }
             //TODO: consider passing the metersPerUnit value into the framework
             //to allow for scaling that doesn't match any of the pre-canned units
@@ -333,7 +337,7 @@
             this.oLayerOL.events.register("loadend", this, this.loadEnd);
             this.oLayerOL.events.register("loadcancel", this, this.loadEnd);
 
-            
+
             //remove the dynamic overlay layer if it was already created
             if (this.oLayerOL2) {
                 this.oLayerOL2.destroy();
@@ -343,7 +347,7 @@
             this.bMapLoaded = true;
             if (this.bIsMapWidgetLayer) {
                 this.mapWidget.addMap(this);
-                
+
                 //if we have a tiled map that also contains dynamic layers, we need to create
                 //an additional overlay layer to render them on top of the tiles
                 if(!this.bSingleTile && o.hasDynamicLayers) {
@@ -555,7 +559,7 @@
         } else {
             this.oLayerOL.mergeNewParams(params);
         }
-        
+
     },
 
     drawSelection: function() {
@@ -577,7 +581,7 @@
       if (!this.useAsyncOverlay) {          //v2.0.1 or earlier
         this.selectionAsOverlay = false;
       }
-      
+
       var layerOptions = {
         units: this.units,
         projection: this.projCode,
@@ -628,7 +632,7 @@
           params.selectioncolor = this.selectionColor;
           params.format = this.selectionFormat;
         }
-        
+
         if(forceAsOverlay)
         {
             layerOptions.isBaseLayer = false;
@@ -642,7 +646,7 @@
           clientagent: this.clientAgent
         };
       }
-      
+
       //Fix for IE6 PNG transparency
       if (params.format && params.format.toLowerCase().indexOf('png') >= 0) {
         layerOptions.alpha = true;
@@ -1166,7 +1170,7 @@
 
       return queryParams;
     },
-    
+
     getMapTip: function(mapTipWidget) {
       //console.log('showMaptip');
         var oBroker = Fusion.oBroker;
@@ -1194,11 +1198,11 @@
                                         sGeometry,
                                         maxFeatures, persist, selection, layerNames,
                                         layerAttributeFilter);
-        oBroker.dispatchRequest(r, 
-            OpenLayers.Function.bind(Fusion.xml2json, this, 
+        oBroker.dispatchRequest(r,
+            OpenLayers.Function.bind(Fusion.xml2json, this,
                   OpenLayers.Function.bind(this.parseMapTip, this)));
     },
-    
+
     parseMapTip: function(xhr) {
         var o;
         eval("tooltip="+xhr.responseText);
@@ -1213,7 +1217,7 @@
         }
         this.mapWidget.triggerEvent(Fusion.Event.MAP_MAPTIP_REQ_FINISHED, this.oMaptip);
     },
-    
+
     getLegendImageURL: function(fScale, layer, style,defaultIcon) {
         if(layer.layerTypes[0] == 4){
             return defaultIcon;
@@ -1223,7 +1227,7 @@
             var url = Fusion.getConfigurationItem('mapguide', 'mapAgentUrl');
             url += "?OPERATION=GETLEGENDIMAGE&SESSION=" + layer.oMap.getSessionID();
             url += "&VERSION=1.0.0&SCALE=" + fScale;
-            op = /\(/g; cp = /\)/g; 
+            op = /\(/g; cp = /\)/g;
             url += "&LAYERDEFINITION=" + encodeURIComponent(layer.resourceId).replace(op, "%28").replace(cp, "%29");
             url += "&THEMECATEGORY=" + style.categoryIndex;
             url += "&TYPE=" + style.geometryType;

Modified: sandbox/adsk/2.2gp/lib/OpenLayers/OpenLayers.js
===================================================================
--- sandbox/adsk/2.2gp/lib/OpenLayers/OpenLayers.js	2010-04-22 16:21:53 UTC (rev 2150)
+++ sandbox/adsk/2.2gp/lib/OpenLayers/OpenLayers.js	2010-04-22 21:26:05 UTC (rev 2151)
@@ -10852,7 +10852,7 @@
     initialize: function(projCode, options) {
         OpenLayers.Util.extend(this, options);
         this.projCode = projCode;
-        if (window.Proj4js) {
+        if (window.Proj4js && projCode != "UNKNOWN") {
             this.proj = new Proj4js.Proj(projCode);
         }
     },



More information about the fusion-commits mailing list