[fusion-commits] r2996 - in branches/fusion-mg31: . layers/Generic layers/MapGuide lib lib/OpenLayers widgets widgets/Redline/classes widgets/SelectWithin

svn_fusion at osgeo.org svn_fusion at osgeo.org
Mon Jun 19 07:05:57 PDT 2017


Author: jng
Date: 2017-06-19 07:05:56 -0700 (Mon, 19 Jun 2017)
New Revision: 2996

Modified:
   branches/fusion-mg31/
   branches/fusion-mg31/layers/Generic/Generic.js
   branches/fusion-mg31/layers/MapGuide/MapGuide.js
   branches/fusion-mg31/lib/OpenLayers/OpenLayers.js
   branches/fusion-mg31/lib/fusion.js
   branches/fusion-mg31/widgets/CursorPosition.js
   branches/fusion-mg31/widgets/Redline/classes/markupeditor.php
   branches/fusion-mg31/widgets/SelectWithin/SelectWithin.php
Log:
Merged revision(s) 2993-2995 from trunk:
Ticket 2763

The javascript method - createSessionId in fusion.js will send the HTTP  request with  the "GET" method. The user name and the password are  visible. So the "GET" method is changed to the "POST" method.
........
#656 Error when select redline object.

Not quite sure why the error happens, just add some checks to avoid error.
........
Use OpenLayers.Layer.Bing instead of deprecated OpenLayers.Layer.VirtualEarth.

Microsoft will not support Bing map v6/v7 in the middle of 2017. As a result, we have to use OpenLayers.Layer.Bing for Bing map. The new class uses Bing map tile service, which an application key is required. We will store AIMS application key in application definition xml, and read the key when opening the xml.

This submission also fixed 2 small issues of flexible web layout.
1. Update the INCH_PER_METER to 39.370078, which is more precise.
2. Use 'post' in MgQueryMapFeatures2 because the URL may be too long.

........
Handle the case that the map hasn't a CS assigned in widget SelectWithin.
........

........
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.
........

........
Merged revision(s) 2978-2984 from sandbox/adsk/3.2o:
Set projection and units for additional overlay layer.
........
Bing map zoom 0 doesn't work. Set zoom = 1 when the calculated zoom is 0.
........

........



Property changes on: branches/fusion-mg31
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/fusion-mg24:2560
/branches/fusion-mg26:2855,2869
/sandbox/adsk/2.6l:2911
/sandbox/adsk/3.1n:2925-2927
/sandbox/createruntimemap:2699-2708
/sandbox/jxlib-3.0:1957-2248
/sandbox/ol213:2801-2803
/sandbox/robust_error_handling:2818-2825
/sandbox/stamen:2873-2875
/sandbox/tiling:2845-2846
/trunk:2946,2950,2954,2956,2960,2964
   + /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,2978-2984
/sandbox/createruntimemap:2699-2708
/sandbox/jxlib-3.0:1957-2248
/sandbox/ol213:2801-2803
/sandbox/robust_error_handling:2818-2825
/sandbox/stamen:2873-2875
/sandbox/tiling:2845-2846
/trunk:2946,2950,2954,2956,2960,2964,2993-2995

Modified: branches/fusion-mg31/layers/Generic/Generic.js
===================================================================
--- branches/fusion-mg31/layers/Generic/Generic.js	2017-06-19 12:51:51 UTC (rev 2995)
+++ branches/fusion-mg31/layers/Generic/Generic.js	2017-06-19 14:05:56 UTC (rev 2996)
@@ -139,20 +139,16 @@
              switch (this.mapTag.layerOptions.type) {   //VE layer types are enumerated values
                case 'Aerial':              //defined in VEMapStyle from the VE api
                case 'a':
-                 this.mapTag.layerOptions.type = VEMapStyle.Aerial;
+                 this.mapTag.layerOptions.type = 'Aerial';
                  break;
-               case 'Shaded':
-               case 's':
-                 this.mapTag.layerOptions.type = VEMapStyle.Shaded;
-                 break;
-               case 'Hybrid':
-               case 'h':
-                 this.mapTag.layerOptions.type = VEMapStyle.Hybrid;
-                 break;
                default:
-                 this.mapTag.layerOptions.type = VEMapStyle.Road;
+                 this.mapTag.layerOptions.type = 'Road';
                  break;
              }
+             this.oLayerOL = new OpenLayers.Layer.Bing({
+                key: Fusion.bingMapKey,
+                type: this.mapTag.layerOptions.type
+             });
              break;
          case 'Yahoo':
             switch (this.mapTag.layerOptions.type) {   //Yahoo is similar to google

Modified: branches/fusion-mg31/layers/MapGuide/MapGuide.js
===================================================================
--- branches/fusion-mg31/layers/MapGuide/MapGuide.js	2017-06-19 12:51:51 UTC (rev 2995)
+++ branches/fusion-mg31/layers/MapGuide/MapGuide.js	2017-06-19 14:05:56 UTC (rev 2996)
@@ -653,6 +653,10 @@
             //an additional overlay layer to render them on top of the tiles
             if(!this.bSingleTile) {
                 this.oLayerOL2 = this.createOLLayer(this._sMapname + "_DynamicOverlay",true,2,true, "");
+                if (wktProj && wktProj.proj && wktProj.proj.readyToUse) {
+                  this.oLayerOL2.projection = wktProj;
+                  this.oLayerOL2.projection.proj.units = this.mapTag.layerOptions.units;
+                }
                 this.mapWidget.oMapOL.addLayer(this.oLayerOL2);
                 this.oLayerOL2.setVisibility(true);
             }
@@ -1083,7 +1087,7 @@
       
       var oNewLayerOL = new OpenLayers.Layer.MapGuide( layerName, url, params, layerOptions );
       if (!bSingleTile) {
-        if (oNewLayerOL.scales.length == this.aCmsScales.length) { 
+        if (oNewLayerOL.scales != null && oNewLayerOL.scales.length == this.aCmsScales.length) { 
             //NOTE: This is not a property of OpenLayers.Layer.MapGuide, it is something we've bolted on
             oNewLayerOL.bUsesCommercialLayerScaleList = false;
             for (var i = 0; i < this.aCmsScales.length; i++) {
@@ -1453,10 +1457,12 @@
                 resp.hasSelection = true;
                 var layerId = layer.getName();
                 var oLayer = this.getLayerById(layerId);
-                resp.layers.push(oLayer.layerName);
-                resp[oLayer.layerName] = {
-                    featureCount: nFeatures
-                };
+                if (oLayer) {
+                    resp.layers.push(oLayer.layerName);
+                    resp[oLayer.layerName] = {
+                        featureCount: nFeatures
+                    };
+                }
             }
         }
         if (this.previousAttributes) {
@@ -1561,7 +1567,12 @@
                                                                 this.selectionColor,
                                                                 this.selectionImageFormat);
             var callback = (options.extendSelection == true) ? OpenLayers.Function.bind(this.processAndMergeExtendedFeatureInfo, this) : OpenLayers.Function.bind(this.processExtendedFeatureInfo, this);
+            // use 'post' because filter could be a long string.
+            var method = Fusion.oBroker.method;
+            Fusion.oBroker.method = 'post';
+            r.options.contentType = 'application/x-www-form-urlencoded';
             Fusion.oBroker.dispatchRequest(r, callback);
+            Fusion.oBroker.method = method;
         } else {
             var r = new Fusion.Lib.MGRequest.MGQueryMapFeatures(this.getSessionID(),
                                                                 this._sMapname,

Modified: branches/fusion-mg31/lib/OpenLayers/OpenLayers.js
===================================================================
--- branches/fusion-mg31/lib/OpenLayers/OpenLayers.js	2017-06-19 12:51:51 UTC (rev 2995)
+++ branches/fusion-mg31/lib/OpenLayers/OpenLayers.js	2017-06-19 14:05:56 UTC (rev 2996)
@@ -3590,7 +3590,7 @@
     'inches': 1.0,
     'ft': 12.0,
     'mi': 63360.0,
-    'm': 39.37,
+    'm': 39.370079,
     'km': 39370,
     'dd': 4374754,
     'yd': 36
@@ -10462,6 +10462,10 @@
             props.resolutions = this.resolutionsFromScales(props.scales);
         }
 
+        if(props.resolutions == null) {
+            props.resolutions = this.serverResolutions;;
+        }
+
         // if we still don't have resolutions then attempt to calculate them
         if(props.resolutions == null) {
             props.resolutions = this.calculateResolutions(props);
@@ -10822,7 +10826,9 @@
                     }
                 }
             }
-            zoom = Math.max(0, i-1);
+            zoom = Math.max(0, i-1);
+            if (zoom == 0 && this.CLASS_NAME.indexOf('OpenLayers.Layer.Bing') > -1)
+                zoom = 1;
         }
         return zoom;
     },
@@ -42700,11 +42706,11 @@
                     });
 
           } else {
-            url = this.getFullRequestString(
-                   {
-                       tilecol: colidx,
-                       tilerow: rowidx,
-                       scaleindex: this.resolutions.length - this.map.zoom - 1
+            url = this.getFullRequestString(
+                   {
+                       tilecol: colidx,
+                       tilerow: rowidx,
+                       scaleindex: this.resolutions.length - this.map.zoom - 1
                     });
           }
        }
@@ -56391,3 +56397,338 @@
 
     CLASS_NAME: "OpenLayers.Control.ArgParser"
 });
+
+/* Copyright (c) 2006-2013 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the 2-clause BSD license.
+ * See license.txt in the OpenLayers distribution or repository for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Layer/XYZ.js
+ */
+
+/** 
+ * Class: OpenLayers.Layer.Bing
+ * Bing layer using direct tile access as provided by Bing Maps REST Services.
+ * See http://msdn.microsoft.com/en-us/library/ff701713.aspx for more
+ * information. Note: Terms of Service compliant use requires the map to be
+ * configured with an <OpenLayers.Control.Attribution> control and the
+ * attribution placed on or near the map.
+ * 
+ * Inherits from:
+ *  - <OpenLayers.Layer.XYZ>
+ */
+OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, {
+
+    /**
+     * Property: key
+     * {String} API key for Bing maps, get your own key 
+     *     at http://bingmapsportal.com/ .
+     */
+    key: null,
+
+    /**
+     * Property: serverResolutions
+     * {Array} the resolutions provided by the Bing servers.
+     */
+    serverResolutions: [
+        156543.03390625, 78271.516953125, 39135.7584765625,
+        19567.87923828125, 9783.939619140625, 4891.9698095703125,
+        2445.9849047851562, 1222.9924523925781, 611.4962261962891,
+        305.74811309814453, 152.87405654907226, 76.43702827453613,
+        38.218514137268066, 19.109257068634033, 9.554628534317017,
+        4.777314267158508, 2.388657133579254, 1.194328566789627,
+        0.5971642833948135, 0.29858214169740677, 0.14929107084870338,
+        0.07464553542435169
+    ],
+    
+    /**
+     * Property: attributionTemplate
+     * {String}
+     */
+    attributionTemplate: '<span class="olBingAttribution ${type}">' +
+         '<div><a target="_blank" href="http://www.bing.com/maps/">' +
+         '<img src="${logo}" /></a></div>${copyrights}' +
+         '<a style="white-space: nowrap" target="_blank" '+
+         'href="http://www.microsoft.com/maps/product/terms.html">' +
+         'Terms of Use</a></span>',
+
+    /**
+     * Property: metadata
+     * {Object} Metadata for this layer, as returned by the callback script
+     */
+    metadata: null,
+
+    /**
+     * Property: protocolRegex
+     * {RegExp} Regular expression to match and replace http: in bing urls
+     */
+    protocolRegex: /^http:/i,
+    
+    /**
+     * APIProperty: type
+     * {String} The layer identifier.  Any non-birdseye imageryType
+     *     from http://msdn.microsoft.com/en-us/library/ff701716.aspx can be
+     *     used.  Default is "Road".
+     */
+    type: "Road",
+    
+    /**
+     * APIProperty: culture
+     * {String} The culture identifier.  See http://msdn.microsoft.com/en-us/library/ff701709.aspx
+     * for the definition and the possible values.  Default is "en-US".
+     */
+    culture: "en-US",
+    
+    /**
+     * APIProperty: metadataParams
+     * {Object} Optional url parameters for the Get Imagery Metadata request
+     * as described here: http://msdn.microsoft.com/en-us/library/ff701716.aspx
+     */
+    metadataParams: null,
+
+    /** APIProperty: tileOptions
+     *  {Object} optional configuration options for <OpenLayers.Tile> instances
+     *  created by this Layer. Default is
+     *
+     *  (code)
+     *  {crossOriginKeyword: 'anonymous'}
+     *  (end)
+     */
+    tileOptions: null,
+
+    /** APIProperty: protocol
+     *  {String} Protocol to use to fetch Imagery Metadata, tiles and bing logo
+     *  Can be 'http:' 'https:' or ''
+     *
+     *  Warning: tiles may not be available under both HTTP and HTTPS protocols.
+     *  Microsoft approved use of both HTTP and HTTPS urls for tiles. However
+     *  this is undocumented and the Imagery Metadata API always returns HTTP
+     *  urls.
+     *
+     *  Default is '', unless when executed from a file:/// uri, in which case
+     *  it is 'http:'.
+     */
+    protocol: ~window.location.href.indexOf('http') ? '' : 'http:',
+
+    /**
+     * Constructor: OpenLayers.Layer.Bing
+     * Create a new Bing layer.
+     *
+     * Example:
+     * (code)
+     * var road = new OpenLayers.Layer.Bing({
+     *     name: "My Bing Aerial Layer",
+     *     type: "Aerial",
+     *     key: "my-api-key-here",
+     * });
+     * (end)
+     *
+     * Parameters:
+     * options - {Object} Configuration properties for the layer.
+     *
+     * Required configuration properties:
+     * key - {String} Bing Maps API key for your application. Get one at
+     *     http://bingmapsportal.com/.
+     * type - {String} The layer identifier.  Any non-birdseye imageryType
+     *     from http://msdn.microsoft.com/en-us/library/ff701716.aspx can be
+     *     used.
+     *
+     * Any other documented layer properties can be provided in the config object.
+     */
+    initialize: function(options) {
+        options = OpenLayers.Util.applyDefaults({
+            sphericalMercator: true
+        }, options);
+        var name = options.name || "Bing " + (options.type || this.type);
+        
+        var newArgs = [name, null, options];
+        OpenLayers.Layer.XYZ.prototype.initialize.apply(this, newArgs);
+        this.tileOptions = OpenLayers.Util.extend({
+            crossOriginKeyword: 'anonymous'
+        }, this.options.tileOptions);
+        this.loadMetadata(); 
+    },
+
+    /**
+     * Method: loadMetadata
+     */
+    loadMetadata: function() {
+        this._callbackId = "_callback_" + this.id.replace(/\./g, "_");
+        // link the processMetadata method to the global scope and bind it
+        // to this instance
+        window[this._callbackId] = OpenLayers.Function.bind(
+            OpenLayers.Layer.Bing.processMetadata, this
+        );
+        var params = OpenLayers.Util.applyDefaults({
+            key: this.key,
+            jsonp: this._callbackId,
+            include: "ImageryProviders"
+        }, this.metadataParams);
+        var url = this.protocol + "//dev.virtualearth.net/REST/v1/Imagery/Metadata/" +
+            this.type + "?" + OpenLayers.Util.getParameterString(params);
+        var script = document.createElement("script");
+        script.type = "text/javascript";
+        script.src = url;
+        script.id = this._callbackId;
+        document.getElementsByTagName("head")[0].appendChild(script);
+    },
+    
+    /**
+     * Method: initLayer
+     *
+     * Sets layer properties according to the metadata provided by the API
+     */
+    initLayer: function() {
+        var res = this.metadata.resourceSets[0].resources[0];
+        var url = res.imageUrl.replace("{quadkey}", "${quadkey}");
+        url = url.replace("{culture}", this.culture);
+        url = url.replace(this.protocolRegex, this.protocol);
+        this.url = [];
+        for (var i=0; i<res.imageUrlSubdomains.length; ++i) {
+            this.url.push(url.replace("{subdomain}", res.imageUrlSubdomains[i]));
+        }
+        this.addOptions({
+            maxResolution: Math.min(
+                this.serverResolutions[res.zoomMin],
+                this.maxResolution || Number.POSITIVE_INFINITY
+            ),
+            numZoomLevels: Math.min(
+                res.zoomMax + 1 - res.zoomMin, this.numZoomLevels
+            )
+        }, true);
+        if (!this.isBaseLayer) {
+            this.redraw();
+        }
+        this.updateAttribution();
+    },
+    
+    /**
+     * Method: getURL
+     *
+     * Paramters:
+     * bounds - {<OpenLayers.Bounds>}
+     */
+    getURL: function(bounds) {
+        if (!this.url) {
+            return;
+        }
+        var xyz = this.getXYZ(bounds), x = xyz.x, y = xyz.y, z = xyz.z;
+        var quadDigits = [];
+        for (var i = z; i > 0; --i) {
+            var digit = '0';
+            var mask = 1 << (i - 1);
+            if ((x & mask) != 0) {
+                digit++;
+            }
+            if ((y & mask) != 0) {
+                digit++;
+                digit++;
+            }
+            quadDigits.push(digit);
+        }
+        var quadKey = quadDigits.join("");
+        var url = this.selectUrl('' + x + y + z, this.url);
+
+        return OpenLayers.String.format(url, {'quadkey': quadKey});
+    },
+    
+    /**
+     * Method: updateAttribution
+     * Updates the attribution according to the requirements outlined in
+     * http://gis.638310.n2.nabble.com/Bing-imagery-td5789168.html
+     */
+    updateAttribution: function() {
+        var metadata = this.metadata;
+        if (!metadata.resourceSets || !this.map || !this.map.center) {
+            return;
+        }
+        var res = metadata.resourceSets[0].resources[0];
+        var extent = this.map.getExtent().transform(
+            this.map.getProjectionObject(),
+            new OpenLayers.Projection("EPSG:4326")
+        );
+        var providers = res.imageryProviders || [],
+            zoom = OpenLayers.Util.indexOf(this.serverResolutions,
+                                           this.getServerResolution()),
+            copyrights = "", provider, i, ii, j, jj, bbox, coverage;
+        for (i=0,ii=providers.length; i<ii; ++i) {
+            provider = providers[i];
+            for (j=0,jj=provider.coverageAreas.length; j<jj; ++j) {
+                coverage = provider.coverageAreas[j];
+                // axis order provided is Y,X
+                bbox = OpenLayers.Bounds.fromArray(coverage.bbox, true);
+                if (extent.intersectsBounds(bbox) &&
+                        zoom <= coverage.zoomMax && zoom >= coverage.zoomMin) {
+                    copyrights += provider.attribution + " ";
+                }
+            }
+        }
+        var logo = metadata.brandLogoUri.replace(this.protocolRegex, this.protocol);
+        this.attribution = OpenLayers.String.format(this.attributionTemplate, {
+            type: this.type.toLowerCase(),
+            logo: logo,
+            copyrights: copyrights
+        });
+        this.map && this.map.events.triggerEvent("changelayer", {
+            layer: this,
+            property: "attribution"
+        });
+    },
+    
+    /**
+     * Method: setMap
+     */
+    setMap: function() {
+        OpenLayers.Layer.XYZ.prototype.setMap.apply(this, arguments);
+        this.map.events.register("moveend", this, this.updateAttribution);
+    },
+    
+    /**
+     * APIMethod: clone
+     * 
+     * Parameters:
+     * obj - {Object}
+     * 
+     * Returns:
+     * {<OpenLayers.Layer.Bing>} An exact clone of this <OpenLayers.Layer.Bing>
+     */
+    clone: function(obj) {
+        if (obj == null) {
+            obj = new OpenLayers.Layer.Bing(this.options);
+        }
+        //get all additions from superclasses
+        obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]);
+        // copy/set any non-init, non-simple values here
+        return obj;
+    },
+    
+    /**
+     * Method: destroy
+     */
+    destroy: function() {
+        this.map &&
+            this.map.events.unregister("moveend", this, this.updateAttribution);
+        OpenLayers.Layer.XYZ.prototype.destroy.apply(this, arguments);
+    },
+    
+    CLASS_NAME: "OpenLayers.Layer.Bing"
+});
+
+/**
+ * Function: OpenLayers.Layer.Bing.processMetadata
+ * This function will be bound to an instance, linked to the global scope with
+ * an id, and called by the JSONP script returned by the API.
+ *
+ * Parameters:
+ * metadata - {Object} metadata as returned by the API
+ */
+OpenLayers.Layer.Bing.processMetadata = function(metadata) {
+    this.metadata = metadata;
+    this.initLayer();
+    var script = document.getElementById(this._callbackId);
+    script.parentNode.removeChild(script);
+    window[this._callbackId] = undefined; // cannot delete from window in IE
+    delete this._callbackId;
+};
+

Modified: branches/fusion-mg31/lib/fusion.js
===================================================================
--- branches/fusion-mg31/lib/fusion.js	2017-06-19 12:51:51 UTC (rev 2995)
+++ branches/fusion-mg31/lib/fusion.js	2017-06-19 14:05:56 UTC (rev 2996)
@@ -265,7 +265,7 @@
         * conversion factors to go from the specified units to meters
         */
         aUnitPerMeter: [1.0, /* 0 - UNKNOWN */
-                        39.37, /* 1 - INCHES */
+                        39.370079, /* 1 - INCHES */
                         3.2808, /* 2 - FEET */
                         1.0936133, /* 3 - YARDS */
                         0.00062137, /* 4 - MILES */
@@ -1645,14 +1645,20 @@
     var createSessionId = function(user, pass){
         var xhr = getXmlHttpRequest();
         var url = Fusion.fusionURL+"layers/MapGuide/php/CreateSession.php";
+		var params = "";
         if (user != null && user != "")
         {
-            url += "?username=" + user;
-            if (pass != null && pass != "")
-                url += "&password=" + pass;
+			params += "username=" + user;
+			if (pass != null && pass != "") {
+				params += "&password=" + pass;
+			}
         }
-        xhr.open("GET", url, false);
-        xhr.send(null); 
+		xhr.open("POST", url, false);
+		xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+		xhr.setRequestHeader("Content-length", params.length);
+		xhr.setRequestHeader("Connection", "close");
+		xhr.send(params);
+		
         var o = Fusion.parseJSON(xhr.responseText);
         Fusion.sessionId = o.sessionId;
         var version = o.siteVersion;
@@ -1688,6 +1694,14 @@
                 addElement(veElement);
                 addElement(osmElement);
                 addElement(stamenElement);
+
+                var bingMapKeyElement = appDefXML.getElementsByTagName("BingMapKey")[0];
+                if (bingMapKeyElement) {
+                    var bingMapKey = bingMapKeyElement.textContent;
+                    if (!bingMapKey)
+                        bingMapKey = bingMapKeyElement.text;
+                    Fusion.bingMapKey = bingMapKey;
+                }
             }
         };
         
@@ -1717,4 +1731,3 @@
     }
     
 })();
-

Modified: branches/fusion-mg31/widgets/CursorPosition.js
===================================================================
--- branches/fusion-mg31/widgets/CursorPosition.js	2017-06-19 12:51:51 UTC (rev 2995)
+++ branches/fusion-mg31/widgets/CursorPosition.js	2017-06-19 14:05:56 UTC (rev 2996)
@@ -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));

Modified: branches/fusion-mg31/widgets/Redline/classes/markupeditor.php
===================================================================
--- branches/fusion-mg31/widgets/Redline/classes/markupeditor.php	2017-06-19 12:51:51 UTC (rev 2995)
+++ branches/fusion-mg31/widgets/Redline/classes/markupeditor.php	2017-06-19 14:05:56 UTC (rev 2996)
@@ -71,7 +71,11 @@
         $idName = $keyProp->GetName();
         while ($featureReader->ReadNext())
         {
-            $id = $featureReader->GetInt32($idName);
+            $propType = $featureReader->GetPropertyType($idName);
+            if ($propType == MgPropertyType::Int64)
+                $id = $featureReader->GetInt64($idName);
+            else
+                $id = $featureReader->GetInt32($idName);
             $text = $featureReader->IsNull('Text') ? '' : trim($featureReader->GetString('Text'));
             $features[$id] = $text;
         }

Modified: branches/fusion-mg31/widgets/SelectWithin/SelectWithin.php
===================================================================
--- branches/fusion-mg31/widgets/SelectWithin/SelectWithin.php	2017-06-19 12:51:51 UTC (rev 2995)
+++ branches/fusion-mg31/widgets/SelectWithin/SelectWithin.php	2017-06-19 14:05:56 UTC (rev 2996)
@@ -180,8 +180,13 @@
                 }
                 else if($type != MgGeometryType::Polygon)
                     continue;
-                $trans = GetLayerToMapCSTrans($classDef, $geomPropName, $featureSrvc, $featureSource, $map);
-                $geomColl->Add($geom->Transform($trans));
+                if ($map->GetMapSRS())
+                {
+                    $trans = GetLayerToMapCSTrans($classDef, $geomPropName, $featureSrvc, $featureSource, $map);
+                    $geomColl->Add($geom->Transform($trans));
+                }
+                else
+                    $geomColl->Add($geom);
             }
             $features->Close();
         }



More information about the fusion-commits mailing list