[fusion-commits] r2974 - in sandbox/adsk/3.2o: lib/OpenLayers widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Wed Mar 29 00:10:28 PDT 2017
Author: liuar
Date: 2017-03-29 00:10:28 -0700 (Wed, 29 Mar 2017)
New Revision: 2974
Modified:
sandbox/adsk/3.2o/lib/OpenLayers/OpenLayers.js
sandbox/adsk/3.2o/widgets/CursorPosition.js
Log:
1. Add a null check for map projection in widget cursor position
2. Use layer's serverResolutions if it is defined.
Modified: sandbox/adsk/3.2o/lib/OpenLayers/OpenLayers.js
===================================================================
--- sandbox/adsk/3.2o/lib/OpenLayers/OpenLayers.js 2017-03-28 09:11:11 UTC (rev 2973)
+++ sandbox/adsk/3.2o/lib/OpenLayers/OpenLayers.js 2017-03-29 07:10:28 UTC (rev 2974)
@@ -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: sandbox/adsk/3.2o/widgets/CursorPosition.js
===================================================================
--- sandbox/adsk/3.2o/widgets/CursorPosition.js 2017-03-28 09:11:11 UTC (rev 2973)
+++ sandbox/adsk/3.2o/widgets/CursorPosition.js 2017-03-29 07:10:28 UTC (rev 2974)
@@ -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