Add support for MapGuide Open Source layers in OpenLayers. Great work by

Mike Adair on following this one through. Includes example, tests, code, 
etc. r=me (Closes #995)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@6368 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2008-02-26 02:56:40 +00:00
parent 3405e97835
commit 99265c2581
5 changed files with 695 additions and 0 deletions

110
examples/mapguide.html Normal file
View File

@@ -0,0 +1,110 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 400px;
height: 400px;
border: 1px solid black;
float:left;
}
#map2 {
width: 400px;
height: 400px;
border: 1px solid black;
float:left;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
var map, layer;
var url = "http://demo01.dmsolutions.ca/mapguide/mapagent/mapagent.fcgi";
//you can use this URL when MapGuide OS is installed locally
//var url = "/mapguide/mapagent/mapagent.fcgi";
//tiled version
function initTiled(){
OpenLayers.DOTS_PER_INCH = 96;
var extent = new OpenLayers.Bounds(-3631568.75,-1293815.5,4491139.5833333321,4937122);
var tempScales = [50000000,23207944.16806,10772173.45016,5000000,2320794.41681,1077217.34502,500000,232079.44168,107721.7345,50000];
var mapOptions = {
maxExtent: extent,
scales: tempScales,
units: 'm',
projection: 'EPSG:42304'
};
map = new OpenLayers.Map( 'map', mapOptions );
var params = {
mapdefinition: 'Library://Samples/Gmap/Maps/gmapTiled.MapDefinition',
basemaplayergroupname: "BaseLayerGroup"
}
var options = {
singleTile: false
}
var layer = new OpenLayers.Layer.MapGuide( "MapGuide OS tiled layer", url, params, options );
map.addLayer(layer);
map.zoomToMaxExtent();
}
//un-tiled version
function initUntiled() {
OpenLayers.DOTS_PER_INCH = 96;
var extent = new OpenLayers.Bounds(-87.865114442365922,43.665065564837931,-87.595394059497067,43.823852564430069);
var mapOptions = {
maxExtent: extent,
maxResolution: 'auto'
};
map = new OpenLayers.Map( 'map2', mapOptions );
var options = {
buffer: 1,
singleTile: true
};
var params = {
mapdefinition: 'Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition'
};
/*
The MapGuide layer can also be created using mapname and session as follows provided there
is some wrapper code to obtain a valid session id and mapname
var params = {
mapname: 'Sheboygan47b3560bf1071',
session: '043bb716-0000-1000-8000-0017a4e6ff5d_en_7F0000010AFC0AFB0AFA'
};
*/
var layer = new OpenLayers.Layer.MapGuide( "MapGuide OS untiled baselayer", url, params, options );
map.addLayer(layer);
//this is how to set up the layer for transparent overlays. Requires a valid session ID
//and mapName stored in that session.
//If the mapagent URL is on a different server than this OL layer, the OpenLayers proxy script
//must be used since this layer must perform an additional AJAX request before requesting the
//map image
/*
var options = {
isBaseLayer: false,
transparent: true,
buffer: 1,
singleTile: true
};
var params = {
mapName: 'Sheboygan',
session: '0b8cb80e-0000-1000-8003-0017a4e6ff5d_en_C0A802AD0AFC0AFB0AFA',
};
layer = new OpenLayers.Layer.MapGuide( "MapGuide OS Overlay layer", url, params, options );
map.addLayer(layer);
*/
map.zoomToMaxExtent();
}
</script>
</head>
<body onload="initUntiled(); initTiled()">
<p>If prompted for a password, username is Anonymous and an empty password</p>
<div id="map"></div>
<div id="map2"></div>
</body>
</html>

View File

@@ -104,6 +104,7 @@
"OpenLayers/Layer/Yahoo.js",
"OpenLayers/Layer/HTTPRequest.js",
"OpenLayers/Layer/Grid.js",
"OpenLayers/Layer/MapGuide.js",
"OpenLayers/Layer/MapServer.js",
"OpenLayers/Layer/MapServer/Untiled.js",
"OpenLayers/Layer/KaMap.js",

View File

@@ -0,0 +1,332 @@
/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
* licence. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
/**
* @requires OpenLayers/Ajax.js
* @requires OpenLayers/Layer/Grid.js
*
* Class: OpenLayers.Layer.MapGuide
* Instances of OpenLayers.Layer.MapGuide are used to display
* data from a MapGuide OS instance.
*
* Inherits from:
* - <OpenLayers.Layer.Grid>
*/
OpenLayers.Layer.MapGuide = OpenLayers.Class(OpenLayers.Layer.Grid, {
/**
* APIProperty: isBaseLayer
* {Boolean} Treat this layer as a base layer. Default is true.
**/
isBaseLayer: true,
/**
* 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.
**/
singleTile: false,
/**
* Constant: TILE_PARAMS
* {Object} Hashtable of default parameter key/value pairs for tiled layer
*/
TILE_PARAMS: {
operation: 'GETTILEIMAGE',
version: '1.2.0'
},
/**
* Constant: SINGLE_TILE_PARAMS
* {Object} Hashtable of default parameter key/value pairs for untiled layer
*/
SINGLE_TILE_PARAMS: {
operation: 'GETMAPIMAGE',
format: 'PNG',
locale: 'en',
version: '1.0.0'
},
/**
* Property: defaultSize
* {<OpenLayers.Size>} Tile size as produced by MapGuide server
**/
defaultSize: new OpenLayers.Size(300,300),
/**
* 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 untiled layers, specify either combination of 'mapName' and
* 'session', or 'mapDefinition' and 'locale'.
*
* 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
* you may want to use are:
* - mapDefinition - {String} The MapGuide resource definition
* (e.g. Library://Samples/Gmap/Maps/gmapTiled.MapDefinition)
* - locale - Locale setting
* (for untiled overlays layers only)
* - mapName - {String} Name of the map as stored in the MapGuide session.
* (for untiled layers with a session parameter only)
* - session - { String} MapGuide session ID
* (for untiled overlays layers only)
* - basemaplayergroupname - {String} GroupName for tiled MapGuide layers only
* - format - Image format to be returned (for untiled overlay layers only)
* - showLayers - {String} A comma separated list of GUID's for the
* layers to display eg: 'cvc-xcv34,453-345-345sdf'.
* - hideLayers - {String} A comma separated list of GUID's for the
* layers to hide eg: 'cvc-xcv34,453-345-345sdf'.
* - showGroups - {String} A comma separated list of GUID's for the
* groups to display eg: 'cvc-xcv34,453-345-345sdf'.
* - hideGroups - {String} A comma separated list of GUID's for the
* groups to hide eg: 'cvc-xcv34,453-345-345sdf'
* - selectionXml - {String} A selection xml string Some server plumbing
* is required to read such a value.
* options - {Ojbect} Hashtable of extra options to tag onto the layer;
* will vary depending if tiled or untiled maps are being requested
*/
initialize: function(name, url, params, options) {
OpenLayers.Layer.Grid.prototype.initialize.apply(this, arguments);
// unless explicitly set in options, if the layer is transparent,
// it will be an overlay
if (options == null || options.isBaseLayer == null) {
this.isBaseLayer = ((this.transparent != "true") &&
(this.transparent != true));
}
//initialize for untiled layers
if (this.singleTile) {
OpenLayers.Util.applyDefaults(
this.params,
this.SINGLE_TILE_PARAMS
);
} else {
//initialize for tiled layers
OpenLayers.Util.applyDefaults(
this.params,
this.TILE_PARAMS
);
this.setTileSize(this.defaultSize);
}
},
/**
* Method: clone
* Create a clone of this layer
*
* Returns:
* {<OpenLayers.Layer.MapGuide>} An exact clone of this layer
*/
clone: function (obj) {
if (obj == null) {
obj = new OpenLayers.Layer.MapGuide(this.name,
this.url,
this.params,
this.options);
}
//get all additions from superclasses
obj = OpenLayers.Layer.Grid.prototype.clone.apply(this, [obj]);
return obj;
},
/**
* Method: addTile
* Creates a tile, initializes it, and adds it to the layer div.
*
* Parameters:
* bounds - {<OpenLayers.Bounds>}
*
* Returns:
* {<OpenLayers.Tile.Image>} The added OpenLayers.Tile.Image
*/
addTile:function(bounds,position) {
return new OpenLayers.Tile.Image(this, position, bounds,
null, this.tileSize);
},
/**
* Method: getURL
* Return a query string for this layer
*
* Parameters:
* bounds - {<OpenLayers.Bounds>} A bounds representing the bbox
* for the request
*
* Returns:
* {String} A string with the layer's url and parameters and also
* the passed-in bounds and appropriate tile size specified
* as parameters.
*/
getURL: function (bounds) {
var url;
var center = bounds.getCenterLonLat();
var mapSize = this.map.getCurrentSize();
if (this.singleTile) {
//set up the call for GETMAPIMAGE or GETDYNAMICMAPOVERLAY
var params = {};
params.setdisplaydpi = OpenLayers.DOTS_PER_INCH;
params.setdisplayheight = mapSize.h*this.ratio;
params.setdisplaywidth = mapSize.w*this.ratio;
params.setviewcenterx = center.lon;
params.setviewcentery = center.lat;
params.setviewscale = this.map.getScale();
if (!this.isBaseLayer) {
// in this case the main image operation is remapped to this
this.params.operation = "GETDYNAMICMAPOVERLAYIMAGE";
//but we first need to call GETVISIBLEMAPEXTENT to set the extent
var getVisParams = {};
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);
new OpenLayers.Ajax.Request(this.url,
{ parameters: getVisParams,
method: 'get',
asynchronous: false //must be synchronous call to return control here
});
}
//construct the full URL
url = this.getFullRequestString( params );
} else {
//tiled version
var currentRes = this.map.getResolution();
var colidx = Math.floor((bounds.left-this.maxExtent.left)/currentRes);
colidx = Math.round(colidx/this.tileSize.w);
var rowidx = Math.floor((this.maxExtent.top-bounds.top)/currentRes);
rowidx = Math.round(rowidx/this.tileSize.h);
url = this.getFullRequestString(
{
tilecol: colidx,
tilerow: rowidx,
scaleindex: this.resolutions.length - this.map.zoom - 1
});
}
return url;
},
/**
* Method: getFullRequestString
* getFullRequestString on MapGuide layers is special, because we
* do a regular expression replace on ',' in parameters to '+'.
* This is why it is subclassed here.
*
* Parameters:
* altUrl - {String} Alternative base URL to use.
*
* Returns:
* {String} A string with the layer's url appropriately encoded for MapGuide
*/
getFullRequestString:function(newParams, altUrl) {
// use layer's url unless altUrl passed in
var url = (altUrl == null) ? this.url : altUrl;
// if url is not a string, it should be an array of strings,
// in which case we will randomly select one of them in order
// to evenly distribute requests to different urls.
if (typeof url == "object") {
url = url[Math.floor(Math.random()*url.length)];
}
// requestString always starts with url
var requestString = url;
// create a new params hashtable with all the layer params and the
// new params together. then convert to string
var allParams = OpenLayers.Util.extend({}, this.params);
allParams = OpenLayers.Util.extend(allParams, newParams);
// ignore parameters that are already in the url search string
var urlParams = OpenLayers.Util.upperCaseObject(
OpenLayers.Util.getArgs(url));
for(var key in allParams) {
if(key.toUpperCase() in urlParams) {
delete allParams[key];
}
}
var paramsString = OpenLayers.Util.getParameterString(allParams);
/* MapGuide needs '+' seperating things like bounds/height/width.
Since typically this is URL encoded, we use a slight hack: we
depend on the list-like functionality of getParameterString to
leave ',' only in the case of list items (since otherwise it is
encoded) then do a regular expression replace on the , characters
to '+' */
paramsString = paramsString.replace(/,/g, "+");
if (paramsString != "") {
var lastServerChar = url.charAt(url.length - 1);
if ((lastServerChar == "&") || (lastServerChar == "?")) {
requestString += paramsString;
} else {
if (url.indexOf('?') == -1) {
//serverPath has no ? -- add one
requestString += '?' + paramsString;
} else {
//serverPath contains ?, so must already have paramsString at the end
requestString += '&' + paramsString;
}
}
}
return requestString;
},
/**
* Method: calculateGridLayout
* Generate parameters for the grid layout. This
*
* Parameters:
* bounds - {<OpenLayers.Bound>}
* extent - {<OpenLayers.Bounds>}
* resolution - {Number}
*
* Returns:
* Object containing properties tilelon, tilelat, tileoffsetlat,
* tileoffsetlat, tileoffsetx, tileoffsety
*/
calculateGridLayout: function(bounds, extent, resolution) {
var tilelon = resolution * this.tileSize.w;
var tilelat = resolution * this.tileSize.h;
var offsetlon = bounds.left - extent.left;
var tilecol = Math.floor(offsetlon/tilelon) - this.buffer;
var tilecolremain = offsetlon/tilelon - tilecol;
var tileoffsetx = -tilecolremain * this.tileSize.w;
var tileoffsetlon = extent.left + tilecol * tilelon;
var offsetlat = extent.top - bounds.top + tilelat;
var tilerow = Math.floor(offsetlat/tilelat) - this.buffer;
var tilerowremain = tilerow - offsetlat/tilelat;
var tileoffsety = tilerowremain * this.tileSize.h;
var tileoffsetlat = extent.top - tilelat*tilerow;
return {
tilelon: tilelon, tilelat: tilelat,
tileoffsetlon: tileoffsetlon, tileoffsetlat: tileoffsetlat,
tileoffsetx: tileoffsetx, tileoffsety: tileoffsety
}
},
CLASS_NAME: "OpenLayers.Layer.MapGuide"
});

View File

@@ -0,0 +1,251 @@
<html>
<head>
<script type="text/javascript">var oldAlert = window.alert, gMess; window.alert = function(message) {gMess = message; return true;};</script>
<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
<script type="text/javascript">window.alert = oldAlert;</script>
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript">
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var layer;
var name = 'MapGuide Test Layer';
var url = "http://demo01.dmsolutions.ca/mapguide/mapagent/mapagent.fcgi";
var paramsTiled = {
mapdefinition: 'Library://Samples/Gmap/Maps/gmapTiled.MapDefinition',
basemaplayergroupname: "BaseLayerGroup",
}
var paramsUntiled = {
mapdefinition: 'Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition',
};
function test_01_Layer_MapGuide_untiled_constructor (t) {
t.plan( 8 );
var trans_format = "image/png";
var options = {singleTile:true};
if (OpenLayers.Util.alphaHack()) { trans_format = "image/gif"; }
layer = new OpenLayers.Layer.MapGuide(name, url, paramsUntiled, options);
t.ok( layer instanceof OpenLayers.Layer.MapGuide, "new OpenLayers.Layer.MapGuide returns object" );
t.eq( layer.url, "http://demo01.dmsolutions.ca/mapguide/mapagent/mapagent.fcgi", "layer.url is correct (HTTPRequest inited)" );
t.eq( layer.params.mapdefinition, "Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition", "params passed in correctly" );
t.eq( layer.params.operation, "GETMAPIMAGE", "default params set correctly and copied");
t.eq(layer.isBaseLayer, true, "no transparency setting, layer is baselayer");
options.transparent = "true";
var layer2 = new OpenLayers.Layer.MapGuide(name, url, paramsUntiled, options);
t.eq(layer2.isBaseLayer, false, "transparency == 'true', wms is not baselayer");
options.transparent = true;
var layer5 = new OpenLayers.Layer.MapGuide(name, url, paramsUntiled, options);
t.eq(layer5.isBaseLayer, false, "transparency == true, wms is not baselayer");
options.transparent = false;
var layer6 = new OpenLayers.Layer.MapGuide(name, url, paramsUntiled, options);
t.eq(layer6.isBaseLayer, true, "transparency == false, wms is baselayer");
}
function test_02_Layer_MapGuide_tiled_constructor (t) {
t.plan( 5 );
var trans_format = "image/png";
var options = {singleTile:false};
if (OpenLayers.Util.alphaHack()) { trans_format = "image/gif"; }
layer = new OpenLayers.Layer.MapGuide(name, url, paramsTiled, options);
t.ok( layer instanceof OpenLayers.Layer.MapGuide, "new OpenLayers.Layer.MapGuide returns object" );
t.eq( layer.url, "http://demo01.dmsolutions.ca/mapguide/mapagent/mapagent.fcgi", "layer.url is correct (HTTPRequest inited)" );
t.eq( layer.params.basemaplayergroupname, "BaseLayerGroup", "params passed in correctly" );
t.eq( layer.params.operation, "GETTILEIMAGE", "default params correctly uppercased and copied");
t.eq( layer.params.version, "1.2.0", "version params set correctly set");
}
/*
function test_Layer_MapGuide_bboxEncoding (t) {
t.plan( 6 );
var url = "http://octo.metacarta.com/cgi-bin/mapserv";
layer = new OpenLayers.Layer.MapGuide(name, url, params, {encodeBBOX:true});
var map = new OpenLayers.Map('map');
map.addLayer(layer);
var pixel = new OpenLayers.Pixel(5,6);
var tile = layer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
tile.draw();
var img = tile.imgDiv;
var tParams = OpenLayers.Util.extend({},
OpenLayers.Util.upperCaseObject(params));
tParams = OpenLayers.Util.extend(tParams, {
SERVICE: "WMS", VERSION: "1.1.1",
REQUEST: "GetMap", STYLES: "",
EXCEPTIONS: "application/vnd.ogc.se_inimage",
SRS: "EPSG:4326", BBOX: "1,2,3,4",
WIDTH: "256", HEIGHT: "256"
});
t.eq( img.src,
url + "?" + OpenLayers.Util.getParameterString(tParams),
"image src is created correctly via addtile" );
t.eq( tile.frame.style.top, "6px", "image top is set correctly via addtile" );
t.eq( tile.frame.style.left, "5px", "image top is set correctly via addtile" );
var firstChild = layer.div.firstChild.firstChild;
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( firstChild instanceof HTMLElement, "div first child is an image object" );
t.eq( firstChild.src,
url + "?" + OpenLayers.Util.getParameterString(tParams),
"div first child is correct image object" );
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
map.destroy();
}
*/
function test_03_Layer_MapGuide_inittiles (t) {
t.plan( 2 );
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.MapGuide(name, url, paramsTiled);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,400000),5);
t.eq( layer.grid.length, 6, "Grid rows is correct." );
t.eq( layer.grid[0].length, 6, "Grid cols is correct." );
map.destroy();
}
function test_04_Layer_MapGuide_clone (t) {
t.plan(4);
var options = {tileSize: new OpenLayers.Size(500,50)};
var map = new OpenLayers.Map('map', options);
layer = new OpenLayers.Layer.MapGuide(name, url, paramsTiled);
map.addLayer(layer);
layer.grid = [ [6, 7],
[8, 9]];
var clone = layer.clone();
t.eq( layer.tileSize.w, 300, "layer.tileSize fixed to 300x300");
t.ok( clone.grid != layer.grid, "clone does not copy grid");
t.ok( clone.tileSize.equals(layer.tileSize), "tileSize correctly cloned");
layer.tileSize.w += 40;
t.eq( clone.alpha, layer.alpha, "alpha copied correctly");
layer.grid = null;
map.destroy();
}
function test_05_Layer_MapGuide_isBaseLayer(t) {
t.plan(3);
var options = {singleTile:true};
layer = new OpenLayers.Layer.MapGuide(name, url, paramsUntiled, options);
t.ok( layer.isBaseLayer, "baselayer is true by default");
var newParams = OpenLayers.Util.extend({}, paramsUntiled);
options.transparent = "true";
layer = new OpenLayers.Layer.MapGuide(name, url, newParams, options);
t.ok( !layer.isBaseLayer, "baselayer is false when transparent is set to true");
newParams = OpenLayers.Util.extend({}, paramsUntiled);
options.isBaseLayer = false;
layer = new OpenLayers.Layer.MapGuide(name, url, newParams, options);
t.ok( !layer.isBaseLayer, "baselayer is false when option is set to false" );
}
function test_06_Layer_MapGuide_mergeNewParams (t) {
t.plan( 4 );
var options = {singleTile:true};
var map = new OpenLayers.Map("map");
layer = new OpenLayers.Layer.MapGuide(name, url, paramsUntiled, options);
var newParams = { mapDefinition: 'Library://Samples/Gmap/Maps/gmap.MapDefinition',
chickpeas: 'image/png'};
map.addLayer(layer);
map.zoomToMaxExtent();
layer.redraw = function() {
t.ok(true, "layer is redrawn after new params merged");
}
layer.mergeNewParams(newParams);
t.eq( layer.params.mapDefinition, "Library://Samples/Gmap/Maps/gmap.MapDefinition", "mergeNewParams() overwrites well");
t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() adds well");
newParams.chickpeas = 151;
t.eq( layer.params.chickpeas, "image/png", "mergeNewParams() makes clean copy of hashtable");
map.destroy();
}
/*
function test_07_Layer_MapGuide_getFullRequestString (t) {
t.plan( 2 );
var map = new OpenLayers.Map('map');
map.projection = "xx";
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
tParams = { layers: 'basic',
format: 'image/png'};
var tLayer = new OpenLayers.Layer.MapGuide(name, tUrl, tParams);
map.addLayer(tLayer);
str = tLayer.getFullRequestString();
var tParams = {
LAYERS: "basic", FORMAT: "image/png", SERVICE: "WMS",
VERSION: "1.1.1", REQUEST: "GetMap", STYLES: "",
EXCEPTIONS: "application/vnd.ogc.se_inimage", SRS: "xx"
};
t.eq(str,
tUrl + "?" + OpenLayers.Util.getParameterString(tParams),
"getFullRequestString() adds SRS value");
map.removeLayer(tLayer);
tLayer.projection = "none";
map.addLayer(tLayer);
str = tLayer.getFullRequestString();
delete tParams['SRS'];
t.eq(str,
tUrl + "?" + OpenLayers.Util.getParameterString(tParams),
"getFullRequestString() by default does *not* add SRS value if projection is 'none'");
map.destroy();
}*/
function test_99_Layer_MapGuide_destroy (t) {
t.plan( 1 );
var options = {singleTile:true};
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.MapGuide(name, url, paramsUntiled, options);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 5);
//grab a reference to one of the tiles
var tile = layer.grid[0][0];
layer.destroy();
// checks to make sure superclass (grid) destroy() was called
t.ok( layer.grid == null, "grid set to null");
}
</script>
</head>
<body>
<div id="map" style="width:500px;height:550px"></div>
</body>
</html>

View File

@@ -62,6 +62,7 @@
<li>Layer/test_HTTPRequest.html</li>
<li>Layer/test_Image.html</li>
<li>Layer/test_KaMap.html</li>
<li>Layer/test_MapGuide.html</li>
<li>Layer/test_MapServer.html</li>
<li>Layer/test_Markers.html</li>
<li>Layer/test_MultiMap.html</li>