[fusion-commits] r1648 - in trunk: MapGuide lib/OpenLayers

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Nov 7 13:52:22 EST 2008


Author: madair
Date: 2008-11-07 13:52:22 -0500 (Fri, 07 Nov 2008)
New Revision: 1648

Modified:
   trunk/MapGuide/MapGuide.js
   trunk/lib/OpenLayers/OpenLayers.js
Log:
closes #143: remove arbitrary maxScale of 100M; add OL inches per unit value for millimeters - full patch for OL to support more CS-MAP units to come

Modified: trunk/MapGuide/MapGuide.js
===================================================================
--- trunk/MapGuide/MapGuide.js	2008-11-06 21:53:24 UTC (rev 1647)
+++ trunk/MapGuide/MapGuide.js	2008-11-07 18:52:22 UTC (rev 1648)
@@ -1236,7 +1236,7 @@
         this.minScale = o.minScale;
         this.maxScale = o.maxScale;
         if (this.maxScale == 'infinity') {
-          this.maxScale = 100000000;
+          this.maxScale = Infinity;
         }
         this.scaleRanges = [];
 

Modified: trunk/lib/OpenLayers/OpenLayers.js
===================================================================
--- trunk/lib/OpenLayers/OpenLayers.js	2008-11-06 21:53:24 UTC (rev 1647)
+++ trunk/lib/OpenLayers/OpenLayers.js	2008-11-07 18:52:22 UTC (rev 1648)
@@ -1349,6 +1349,7 @@
 OpenLayers.INCHES_PER_UNIT["in"]= OpenLayers.INCHES_PER_UNIT.inches;
 OpenLayers.INCHES_PER_UNIT["degrees"] = OpenLayers.INCHES_PER_UNIT.dd;
 OpenLayers.INCHES_PER_UNIT["nmi"] = 1852 * OpenLayers.INCHES_PER_UNIT.m;
+OpenLayers.INCHES_PER_UNIT["mm"] = OpenLayers.INCHES_PER_UNIT.m / 1000.0;
 
 /** 
  * Constant: DOTS_PER_INCH
@@ -1654,7 +1655,7 @@
                 var postChunk = relStr.substr(index + 3);                
                 relStr = prevChunk + postChunk;
             }
-        } while(index != -1);
+        } while(index != -1)
 
         var windowAnchor = document.createElement("a");
         var windowUrl = window.location.href;
@@ -2863,7 +2864,14 @@
      * Property: top
      * {Number} Maximum vertical coordinate.
      */
-    top: null,    
+    top: null,
+    
+    /**
+     * Property: centerLonLat
+     * {<OpenLayers.LonLat>} A cached center location.  This should not be
+     *     accessed directly.  Use <getCenterLonLat> instead.
+     */
+    centerLonLat: null,
 
     /**
      * Constructor: OpenLayers.Bounds
@@ -3040,8 +3048,12 @@
      * {<OpenLayers.LonLat>} The center of the bounds in map space.
      */
     getCenterLonLat:function() {
-        return new OpenLayers.LonLat( (this.left + this.right) / 2,
-                                      (this.bottom + this.top) / 2);
+        if(!this.centerLonLat) {
+            this.centerLonLat = new OpenLayers.LonLat(
+                (this.left + this.right) / 2, (this.bottom + this.top) / 2
+            );
+        }
+        return this.centerLonLat;
     },
 
     /**
@@ -3082,7 +3094,7 @@
         var bottom = (this.bottom - origy) * ratio + origy;
         var right = (this.right - origx) * ratio + origx;
         var top = (this.top - origy) * ratio + origy;
-
+        
         return new OpenLayers.Bounds(left, bottom, right, top);
     },
 
@@ -3118,6 +3130,7 @@
     extend:function(object) {
         var bounds = null;
         if (object) {
+            // clear cached center location
             switch(object.CLASS_NAME) {
                 case "OpenLayers.LonLat":    
                     bounds = new OpenLayers.Bounds(object.lon, object.lat,
@@ -3134,6 +3147,7 @@
             }
     
             if (bounds) {
+                this.centerLonLat = null;
                 if ( (this.left == null) || (bounds.left < this.left)) {
                     this.left = bounds.left;
                 }
@@ -3324,6 +3338,8 @@
      * {<OpenLayers.Bounds>} Itself, for use in chaining operations.
      */
     transform: function(source, dest) {
+        // clear cached center location
+        this.centerLonLat = null;
         var ll = OpenLayers.Projection.transform(
             {'x': this.left, 'y': this.bottom}, source, dest);
         var lr = OpenLayers.Projection.transform(
@@ -5980,7 +5996,10 @@
     /**
      * APIMethod: issue
      * Create a new XMLHttpRequest object, open it, set any headers, bind
-     *     a callback to done state, and send any data.
+     *     a callback to done state, and send any data.  It is recommended that
+     *     you use one <GET>, <POST>, <PUT>, <DELETE>, <OPTIONS>, or <HEAD>.
+     *     This method is only documented to provide detail on the configuration
+     *     options available to all request methods.
      *
      * Parameters:
      * config - {Object} Object containing properties for configuring the
@@ -6000,12 +6019,20 @@
      *     <OpenLayers.ProxyHost>.
      * params - {Object} Any key:value pairs to be appended to the
      *     url as a query string.  Assumes url doesn't already include a query
-     *     string or hash.  Parameter values that are arrays will be
+     *     string or hash.  Typically, this is only appropriate for <GET>
+     *     requests where the query string will be appended to the url.
+     *     Parameter values that are arrays will be
      *     concatenated with a comma (note that this goes against form-encoding)
      *     as is done with <OpenLayers.Util.getParameterString>.
      * headers - {Object} Object with header:value pairs to be set on
      *     the request.
-     * data - {Object} Any data to send with the request.
+     * data - {String | Document} Optional data to send with the request.
+     *     Typically, this is only used with <POST> and <PUT> requests.
+     *     Make sure to provide the appropriate "Content-Type" header for your
+     *     data.  For <POST> and <PUT> requests, the content type defaults to
+     *     "application-xml".  If your data is a different content type, or
+     *     if you are using a different HTTP method, set the "Content-Type"
+     *     header to match your data type.
      * callback - {Function} Function to call when request is done.
      *     To determine if the request failed, check request.status (200
      *     indicates success).
@@ -19012,6 +19039,17 @@
      * {Boolean} Whether or not to handle right clicks. Default is false.
      */
     handleRightClicks: false,
+
+    /**
+     * APIProperty: zoomBoxKeyMask
+     * {Integer} <OpenLayers.Handler> key code of the key, which has to be
+     *    pressed, while drawing the zoom box with the mouse on the screen. 
+     *    You should probably set handleRightClicks to true if you use this
+     *    with MOD_CTRL, to disable the context menu for machines which use
+     *    CTRL-Click as a right click.
+     * Default: <OpenLayers.Handler.MOD_SHIFT
+     */
+    zoomBoxKeyMask: OpenLayers.Handler.MOD_SHIFT,
     
     /**
      * Constructor: OpenLayers.Control.Navigation
@@ -19095,7 +19133,7 @@
             OpenLayers.Util.extend({map: this.map}, this.dragPanOptions)
         );
         this.zoomBox = new OpenLayers.Control.ZoomBox(
-                    {map: this.map, keyMask: OpenLayers.Handler.MOD_SHIFT});
+                    {map: this.map, keyMask: this.zoomBoxKeyMask});
         this.dragPan.draw();
         this.zoomBox.draw();
         this.handlers.wheel = new OpenLayers.Handler.MouseWheel(
@@ -19496,10 +19534,7 @@
     
     /** 
      * APIProperty: singleTile
-     * {Boolean} use tile server or request single tile image. Note that using
-     *    singleTile *and* isBaseLayer false is *not recommend*: it uses synchronous
-     *    XMLHttpRequests to load tiles, and this will *lock up users browsers*
-     *    during requests if the server fails to respond.
+     * {Boolean} use tile server or request single tile image. 
      **/
     singleTile: false,
     
@@ -19507,8 +19542,9 @@
      * APIProperty: useOverlay
      * {Boolean} flag to indicate if the layer should be retrieved using
      * GETMAPIMAGE (default) or using GETDYNAMICOVERLAY requests.
-     * Using an Ooerlay image is only available in MapGuide Enterprise 2010
-     * and MapGuide Open Source v2.0.3 or higher. 
+     * Using an overlay image is only available in MapGuide Enterprise 2010
+     * and MapGuide Open Source v2.0.3 or higher, but it allows selections
+     * to be drawn separately from the map and offers styling options
      **/
     useOverlay: false,
     
@@ -19561,11 +19597,8 @@
      * For untiled base layers, specify either combination of 'mapName' and
      * 'session', or 'mapDefinition' and 'locale'.  
      *
-     * For untiled overlay layers (singleTile=true and isBaseLayer=false), 
+     * For untiled overlay layers (useOverlay=true), 
      * mapName and session are required parameters for the Layer constructor.  
-     * Also NOTE: untiled overlay layers issues a synchronous AJAX request 
-     * before the image request can be issued so the users browser may lock
-     * up if the MG Web tier does not respond in a timely fashion.
      *
      * NOTE: MapGuide OS uses a DPI value and degrees to meters conversion 
      * factor that are different than the defaults used in OpenLayers, 
@@ -19695,7 +19728,8 @@
         var mapSize = this.map.getCurrentSize();
 
         if (this.singleTile) {
-          //set up the call for GETMAPIMAGE or GETDYNAMICMAPOVERLAY
+          //set up the call for GETMAPIMAGE or GETDYNAMICMAPOVERLAY with
+          //dynamic map parameters
           var params = {
             setdisplaydpi: OpenLayers.DOTS_PER_INCH,
             setdisplayheight: mapSize.h*this.ratio,



More information about the fusion-commits mailing list