diff --git a/lib/OpenLayers/Layer/MapGuide.js b/lib/OpenLayers/Layer/MapGuide.js index 41471f7361..b2e4eddedb 100644 --- a/lib/OpenLayers/Layer/MapGuide.js +++ b/lib/OpenLayers/Layer/MapGuide.js @@ -28,7 +28,7 @@ OpenLayers.Layer.MapGuide = OpenLayers.Class(OpenLayers.Layer.Grid, { * {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. + * during requests if the server fails to respond. **/ singleTile: false, @@ -63,18 +63,29 @@ OpenLayers.Layer.MapGuide = OpenLayers.Class(OpenLayers.Layer.Grid, { * Constructor: OpenLayers.Layer.MapGuide * Create a new Mapguide layer, either tiled or untiled. * - * For tiled layers, the 'groupName' and 'mapDefnition' options - * must be specified as options. + * For tiled layers, the 'groupName' and 'mapDefinition' values + * must be specified as parameters in the constructor. * - * For untiled layers, specify either combination of 'mapName' and - * 'session', or 'mapDefinition' and 'locale'. + * For untiled base layers, specify either combination of 'mapName' and + * 'session', or 'mapDefinition' and 'locale'. + * + * For untiled overlay layers (singleTile=true and isBaseLayer=false), + * 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, + * so these must be adjusted accordingly in your application. + * See the MapGuide example for how to set these values for MGOS. * * Parameters: * name - {String} Name of the layer displayed in the interface * url - {String} Location of the MapGuide mapagent executable * (e.g. http://localhost:8008/mapguide/mapagent/mapagent.fcgi) * params - {Object} hashtable of additional parameters to use. Some - * parameters may require additional code on the serer. The ones that + * parameters may require additional code on the server. The ones that * you may want to use are: * - mapDefinition - {String} The MapGuide resource definition * (e.g. Library://Samples/Gmap/Maps/gmapTiled.MapDefinition) @@ -116,6 +127,7 @@ OpenLayers.Layer.MapGuide = OpenLayers.Class(OpenLayers.Layer.Grid, { this.params, this.SINGLE_TILE_PARAMS ); + } else { //initialize for tiled layers OpenLayers.Util.applyDefaults( @@ -196,16 +208,15 @@ OpenLayers.Layer.MapGuide = OpenLayers.Class(OpenLayers.Layer.Grid, { //but we first need to call GETVISIBLEMAPEXTENT to set the extent var getVisParams = {}; + getVisParams = OpenLayers.Util.extend(getVisParams, params); getVisParams.operation = "GETVISIBLEMAPEXTENT"; getVisParams.version = "1.0.0"; getVisParams.session = this.params.session; getVisParams.mapName = this.params.mapName; getVisParams.format = 'text/xml'; - getVisParams = OpenLayers.Util.extend(getVisParams, params); + url = this.getFullRequestString( getVisParams ); - OpenLayers.Request.GET({ - url: this.url, params: getVisParams, async: false - }); + OpenLayers.Request.GET({url: url, async: false}); } //construct the full URL @@ -225,7 +236,7 @@ OpenLayers.Layer.MapGuide = OpenLayers.Class(OpenLayers.Layer.Grid, { tilerow: rowidx, scaleindex: this.resolutions.length - this.map.zoom - 1 }); - } + } return url; },