[fusion-commits] r2994 - in trunk: . lib/OpenLayers widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Mon Jun 19 05:47:33 PDT 2017


Author: jng
Date: 2017-06-19 05:47:33 -0700 (Mon, 19 Jun 2017)
New Revision: 2994

Modified:
   trunk/
   trunk/lib/OpenLayers/OpenLayers.js
   trunk/widgets/CursorPosition.js
Log:
Merged revision(s) 2974 from sandbox/adsk/3.2o:
1. Add a null check for map projection in widget cursor position
2. Use layer's serverResolutions if it is defined.
........



Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/fusion-mg24:2560
/branches/fusion-mg26:2855,2869
/sandbox/adsk/2.6l:2911
/sandbox/adsk/3.1n:2925-2927
/sandbox/adsk/3.2o:2969-2972
/sandbox/createruntimemap:2699-2708
/sandbox/jxlib-3.0:1957-2248
/sandbox/mgrfc158:2980-2991
/sandbox/ol213:2801-2803
/sandbox/robust_error_handling:2818-2825
/sandbox/stamen:2873-2875
/sandbox/tiling:2845-2846
   + /branches/fusion-mg24:2560
/branches/fusion-mg26:2855,2869
/sandbox/adsk/2.6l:2911
/sandbox/adsk/3.1n:2925-2927
/sandbox/adsk/3.2o:2969-2972,2974
/sandbox/createruntimemap:2699-2708
/sandbox/jxlib-3.0:1957-2248
/sandbox/mgrfc158:2980-2991
/sandbox/ol213:2801-2803
/sandbox/robust_error_handling:2818-2825
/sandbox/stamen:2873-2875
/sandbox/tiling:2845-2846

Modified: trunk/lib/OpenLayers/OpenLayers.js
===================================================================
--- trunk/lib/OpenLayers/OpenLayers.js	2017-06-19 12:45:03 UTC (rev 2993)
+++ trunk/lib/OpenLayers/OpenLayers.js	2017-06-19 12:47:33 UTC (rev 2994)
@@ -10463,7 +10463,7 @@
         }
 
         if(props.resolutions == null) {
-            props.resolutions = this.RESOLUTIONS;
+            props.resolutions = this.serverResolutions;;
         }
 
         // if we still don't have resolutions then attempt to calculate them

Modified: trunk/widgets/CursorPosition.js
===================================================================
--- trunk/widgets/CursorPosition.js	2017-06-19 12:45:03 UTC (rev 2993)
+++ trunk/widgets/CursorPosition.js	2017-06-19 12:47:33 UTC (rev 2994)
@@ -109,31 +109,33 @@
     formatHTML: function(p) {
         if (!this.displayProjection) {
             var mapProj = this.getMap().projection;
-            var mapUnit = mapProj.getUnits();
+            if (mapProj) {
+                var mapUnit = mapProj.getUnits();
 
-            // convertion from linear units to degree unit.
-            if(this.units == Fusion.DEGREES && mapUnit != 'dd' && mapUnit != 'degrees' ) {
-                // coordinate transformation from map CS to EPSG:4326.
-                var dest = new OpenLayers.Projection("GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]");
-                p = p.transform(this.getMap().projection, dest);
+                // convertion from linear units to degree unit.
+                if(this.units == Fusion.DEGREES && mapUnit != 'dd' && mapUnit != 'degrees' ) {
+                    // coordinate transformation from map CS to EPSG:4326.
+                    var dest = new OpenLayers.Projection("GEOGCS[\"LL84\",DATUM[\"WGS84\",SPHEROID[\"WGS84\",6378137.000,298.25722293]],PRIMEM[\"Greenwich\",0],UNIT[\"Degree\",0.01745329251994]]");
+                    p = p.transform(this.getMap().projection, dest);
+                }
+                //else
+                //{
+                    // TODO: convertion from degree unit to linear units
+                //}
+                
+                /* old code for converting between units */
+                else if (this.units != Fusion.UNKNOWN) {
+                    var convFactor = this.getMap().getMetersPerUnit();
+                    p.lon = Fusion.fromMeter(this.units, p.lon * convFactor);
+                    p.lat = Fusion.fromMeter(this.units, p.lat * convFactor);
+                }
+                
+                if (this.precision >= 0) {
+                    var factor = Math.pow(10,this.precision);
+                    p.lon = Math.round(p.lon * factor)/factor;
+                    p.lat = Math.round(p.lat * factor)/factor;
+                }
             }
-            //else
-            //{
-                // TODO: convertion from degree unit to linear units
-            //}
-            
-            /* old code for converting between units */
-            else if (this.units != Fusion.UNKNOWN) {
-                var convFactor = this.getMap().getMetersPerUnit();
-                p.lon = Fusion.fromMeter(this.units, p.lon * convFactor);
-                p.lat = Fusion.fromMeter(this.units, p.lat * convFactor);
-            }
-            
-            if (this.precision >= 0) {
-                var factor = Math.pow(10,this.precision);
-                p.lon = Math.round(p.lon * factor)/factor;
-                p.lat = Math.round(p.lat * factor)/factor;
-            }
         }
         var unitAbbr = Fusion.unitAbbr(this.units);
         var innerHTML = this.template.replace('{x}',p.lon.toFixed(this.precision));



More information about the fusion-commits mailing list