Pullup changes to trunk for RC2. Includes drag-fires click changes
(Closes #982), comment/documentation/requires changes (Closes #983, #993, #988), Fixing post support in proxy.cgi (Closes #991), baseLayer zoom level change (Closes #990), typo in Layer.Image.setURL (Closes #985), and a fix or the Layer.Google bug caused by Google's changing internals (#994). RC2, here we come. git-svn-id: http://svn.openlayers.org/branches/openlayers/2.5@4390 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -43,21 +43,33 @@
|
||||
var overviewZoom = control.ovmap.getZoom();
|
||||
t.eq(overviewCenter.lon, -71, "Overviewmap center lon correct");
|
||||
t.eq(overviewCenter.lat, 42, "Overviewmap center lat correct");
|
||||
t.eq(overviewZoom, 8, "Overviewmap zoomcorrect");
|
||||
t.eq(overviewZoom, 9, "Overviewmap zoomcorrect");
|
||||
|
||||
control.mapDivClick({'xy':new OpenLayers.Pixel(5,5)});
|
||||
|
||||
// There are box model issues that keep browsers from giving us
|
||||
// identical results here. Test the normalized difference against
|
||||
// a tolerance instead of testing equality.
|
||||
function normalizedDiff(a, b) {
|
||||
return Math.abs((a - b) / (a + b));
|
||||
}
|
||||
var tolerance = 1e-4;
|
||||
|
||||
var cent = map.getCenter();
|
||||
t.eq(cent.lon, -71.3515625, "Clicking on the Overview Map has the correct effect on map lon");
|
||||
t.eq(cent.lat, 42.17578125, "Clicking on the Overview Map has the correct effect on map lat");
|
||||
t.ok(normalizedDiff(cent.lon, -71.00390625) < tolerance,
|
||||
"Clicking on the Overview Map has the correct effect on map lon");
|
||||
t.ok(normalizedDiff(cent.lat, 42.00390625) < tolerance,
|
||||
"Clicking on the Overview Map has the correct effect on map lat");
|
||||
|
||||
control.rectMouseDown({'xy':new OpenLayers.Pixel(5,5), 'which':1});
|
||||
control.rectMouseMove({'xy':new OpenLayers.Pixel(15,15), 'which':1});
|
||||
control.rectMouseUp({'xy':new OpenLayers.Pixel(15,15), 'which':1});
|
||||
|
||||
var cent = map.getCenter();
|
||||
t.eq(cent.lon, -71.2734375, "Dragging on the Overview Map has the correct effect on map lon");
|
||||
t.eq(cent.lat, 42.09765625, "Dragging on the Overview Map has the correct effect on map lat");
|
||||
t.ok(normalizedDiff(cent.lon, -70.83984375) < tolerance,
|
||||
"Dragging on the Overview Map has the correct effect on map lon");
|
||||
t.ok(normalizedDiff(cent.lat, 41.84765625) < tolerance,
|
||||
"Dragging on the Overview Map has the correct effect on map lat");
|
||||
|
||||
map.setCenter(new OpenLayers.LonLat(0,0), 0);
|
||||
var overviewCenter = control.ovmap.getCenter();
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
}
|
||||
|
||||
function test_Handler_Drag_callbacks(t) {
|
||||
t.plan(30);
|
||||
t.plan(27);
|
||||
|
||||
var map = new OpenLayers.Map('map', {controls: []});
|
||||
|
||||
@@ -227,24 +227,25 @@
|
||||
t.ok(!handler.dragging, "mouseout sets dragging flag to false");
|
||||
OpenLayers.Util.mouseLeft = oldMouseLeft;
|
||||
|
||||
// test click
|
||||
handler.dragging = true;
|
||||
handler.started = "foo";
|
||||
map.events.triggerEvent("click", null);
|
||||
t.ok(!handler.dragging,
|
||||
"click while dragging sets dragging to false");
|
||||
t.eq(handler.started, "foo",
|
||||
"click while dragging doesn't mess with started");
|
||||
|
||||
handler.dragging = null;
|
||||
handler.started = true;
|
||||
map.events.triggerEvent("click", null);
|
||||
t.ok(handler.dragging == null,
|
||||
"click while not dragging doesn't mess with dragging flag");
|
||||
t.ok(!handler.started,
|
||||
"click while not dragging sets started to false");
|
||||
// test click with the click.html example - the click method on the
|
||||
// drag handler returns (handler.start == handler.last), stopping
|
||||
// propagation of the click event if the mouse moved during a drag.
|
||||
|
||||
|
||||
// regression tests will assure that the drag handler doesn't mess
|
||||
// with anything else on a click
|
||||
function getProperties(obj) {
|
||||
var props = {};
|
||||
for(key in obj) {
|
||||
if(typeof obj[key] != "function" && typeof obj[key] != "object") {
|
||||
props[key] = obj[key];
|
||||
}
|
||||
}
|
||||
return props;
|
||||
}
|
||||
var before = getProperties(handler);
|
||||
map.events.triggerEvent("click", null);
|
||||
var after = getProperties(handler);
|
||||
t.eq(before, after, "click doesn't mess with handler");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -140,25 +140,25 @@
|
||||
});
|
||||
}
|
||||
|
||||
function test_04_Layer_GeoRSS_icon(t) {
|
||||
t.plan( 3 );
|
||||
layer = new OpenLayers.Layer.GeoRSS('Test Layer', georss_txt);
|
||||
function test_04_Layer_GeoRSS_icon(t) {
|
||||
t.plan( 3 );
|
||||
layer = new OpenLayers.Layer.GeoRSS('Test Layer', georss_txt);
|
||||
var the_icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png');
|
||||
var otherLayer = new OpenLayers.Layer.GeoRSS('Test Layer', georss_txt,{icon:the_icon});
|
||||
var map = new OpenLayers.Map('map');
|
||||
var otherLayer = new OpenLayers.Layer.GeoRSS('Test Layer', georss_txt,{icon:the_icon});
|
||||
var map = new OpenLayers.Map('map');
|
||||
var baseLayer = new OpenLayers.Layer.WMS("Test Layer",
|
||||
"http://octo.metacarta.com/cgi-bin/mapserv?",
|
||||
{map: "/mapdata/vmap_wms.map", layers: "basic"});
|
||||
map.addLayer(baseLayer);
|
||||
map.addLayers([layer,otherLayer]);
|
||||
map.setCenter(new OpenLayers.LonLat(0,0),0);
|
||||
var defaultIcon = OpenLayers.Marker.defaultIcon();
|
||||
t.delay_call( 1, function() {
|
||||
t.ok(layer.markers[0].icon, "The layer has a icon");
|
||||
t.eq(layer.markers[0].icon.url, defaultIcon.url, "The layer without icon has the default icon.");
|
||||
t.eq(otherLayer.markers[0].icon.url, the_icon.url,"The layer with an icon has that icon.");
|
||||
});
|
||||
}
|
||||
var defaultIcon = OpenLayers.Marker.defaultIcon();
|
||||
t.delay_call( 1, function() {
|
||||
t.ok(layer.markers[0].icon, "The layer has a icon");
|
||||
t.eq(layer.markers[0].icon.url, defaultIcon.url, "The layer without icon has the default icon.");
|
||||
t.eq(otherLayer.markers[0].icon.url, the_icon.url,"The layer with an icon has that icon.");
|
||||
});
|
||||
}
|
||||
function test_Layer_GeoRSS_loadend_Event(t) {
|
||||
var browserCode = OpenLayers.Util.getBrowserName();
|
||||
if (browserCode == "msie") {
|
||||
|
||||
@@ -150,12 +150,26 @@
|
||||
bounds = new OpenLayers.Bounds(10,10,12,12);
|
||||
zoom = layer.getZoomForExtent(bounds);
|
||||
|
||||
t.eq( zoom, 8, "getZoomForExtent() returns correct value");
|
||||
/**
|
||||
* ideal resolution: 2 map units / 500px = 0.004
|
||||
* layer.resolutions = [1.40625, 0.703125, 0.3515625, 0.17578125,
|
||||
* 0.087890625, 0.0439453125, 0.02197265625,
|
||||
* 0.010986328125, 0.0054931640625, 0.00274658203125,
|
||||
* 0.001373291015625, 0.0006866455078125, 0.00034332275390625,
|
||||
* 0.000171661376953125, 0.0000858306884765625, 0.00004291534423828125]
|
||||
*
|
||||
* So, we expect a zoom of 9 because it is the closest resolution.
|
||||
*/
|
||||
t.eq( zoom, 9, "getZoomForExtent() returns correct value");
|
||||
|
||||
bounds = new OpenLayers.Bounds(10,10,100,100);
|
||||
zoom = layer.getZoomForExtent(bounds);
|
||||
|
||||
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
|
||||
/**
|
||||
* ideal resolution: 90 map units / 500px = 0.18
|
||||
* So, we expect a zoom of 3 because it is the closest.
|
||||
*/
|
||||
t.eq( zoom, 3, "getZoomForExtent() returns correct value");
|
||||
}
|
||||
|
||||
function test_07_Layer_Grid_moveTo(t) {
|
||||
@@ -515,10 +529,10 @@
|
||||
}
|
||||
|
||||
function test_16_Layer_Grid_tileSizeIsInteger(t) {
|
||||
t.plan(1);
|
||||
|
||||
t.plan(1);
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
var layer = new OpenLayers.Layer.Grid(name, url, params, {
|
||||
var layer = new OpenLayers.Layer.Grid(name, url, params, {
|
||||
singleTile: true,
|
||||
ratio: 1.5
|
||||
});
|
||||
@@ -541,10 +555,10 @@
|
||||
map.zoomToMaxExtent();
|
||||
map.zoomIn();
|
||||
var bounds = layer.getTileBounds(new OpenLayers.Pixel(200,200));
|
||||
t.eq(bounds.toBBOX(), "-180,-90,0,90", "get tile bounds returns correct bounds");
|
||||
t.eq(bounds.toBBOX(), "-90,0,0,90", "get tile bounds returns correct bounds");
|
||||
map.pan(200,0);
|
||||
var bounds = layer.getTileBounds(new OpenLayers.Pixel(200,200));
|
||||
t.eq(bounds.toBBOX(), "0,-90,180,90", "get tile bounds returns correct bounds after pan");
|
||||
t.eq(bounds.toBBOX(), "0,0,90,90", "get tile bounds returns correct bounds after pan");
|
||||
}
|
||||
|
||||
function test_Layer_Grid_moveTo_buffer_calculation (t) {
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
|
||||
function test_50_Layer_Image_tileTests (t) {
|
||||
t.plan(6);
|
||||
t.plan(7);
|
||||
var map = new OpenLayers.Map('map');
|
||||
|
||||
layer = new OpenLayers.Layer.Image('Test Layer',
|
||||
@@ -63,6 +63,8 @@
|
||||
t.eq(layer.tile.imgDiv.src, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
|
||||
map.zoomIn();
|
||||
t.eq(layer.tile.imgDiv.src, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
|
||||
layer.setUrl('http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&BBOX=-180,-90,0,90&WIDTH=256&HEIGHT=256');
|
||||
t.eq(layer.tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&BBOX=-180,-90,0,90&WIDTH=256&HEIGHT=256", "URL is correct after setURL");
|
||||
}
|
||||
/******
|
||||
*
|
||||
|
||||
@@ -128,12 +128,26 @@
|
||||
bounds = new OpenLayers.Bounds(10,10,12,12);
|
||||
zoom = layer.getZoomForExtent(bounds);
|
||||
|
||||
t.eq( zoom, 8, "getZoomForExtent() returns correct value");
|
||||
/**
|
||||
* ideal resolution: 2 map units / 500px = 0.004
|
||||
* layer.resolutions = [1.40625, 0.703125, 0.3515625, 0.17578125,
|
||||
* 0.087890625, 0.0439453125, 0.02197265625,
|
||||
* 0.010986328125, 0.0054931640625, 0.00274658203125,
|
||||
* 0.001373291015625, 0.0006866455078125, 0.00034332275390625,
|
||||
* 0.000171661376953125, 0.0000858306884765625, 0.00004291534423828125]
|
||||
*
|
||||
* So, we expect a zoom of 9 because it is the closest resolution.
|
||||
*/
|
||||
t.eq( zoom, 9, "getZoomForExtent() returns correct value");
|
||||
|
||||
bounds = new OpenLayers.Bounds(10,10,100,100);
|
||||
zoom = layer.getZoomForExtent(bounds);
|
||||
|
||||
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
|
||||
/**
|
||||
* ideal resolution: 90 map units / 500px = 0.18
|
||||
* So, we expect a zoom of 3 because it is the closest.
|
||||
*/
|
||||
t.eq( zoom, 3, "getZoomForExtent() returns correct value");
|
||||
}
|
||||
|
||||
function test_06_Layer_kaMap_mergeNewParams (t) {
|
||||
@@ -236,10 +250,10 @@
|
||||
map.zoomToMaxExtent();
|
||||
map.zoomIn();
|
||||
var bounds = layer.getTileBounds(new OpenLayers.Pixel(200,200));
|
||||
t.eq(bounds.toBBOX(), "-180,0,0,180", "get tile bounds returns correct bounds");
|
||||
t.eq(bounds.toBBOX(), "-90,0,0,90", "get tile bounds returns correct bounds");
|
||||
map.pan(200,0);
|
||||
var bounds = layer.getTileBounds(new OpenLayers.Pixel(200,200));
|
||||
t.eq(bounds.toBBOX(), "0,0,180,180", "get tile bounds returns correct bounds after pan");
|
||||
t.eq(bounds.toBBOX(), "0,0,90,90", "get tile bounds returns correct bounds after pan");
|
||||
}
|
||||
|
||||
function test_99_Layer_KaMap_destroy (t) {
|
||||
|
||||
@@ -77,13 +77,26 @@
|
||||
|
||||
bounds = new OpenLayers.Bounds(10,10,12,12);
|
||||
zoom = layer.getZoomForExtent(bounds);
|
||||
|
||||
t.eq( zoom, 8, "getZoomForExtent() returns correct value");
|
||||
/**
|
||||
* ideal resolution: 2 map units / 500px = 0.004
|
||||
* layer.resolutions = [1.40625, 0.703125, 0.3515625, 0.17578125,
|
||||
* 0.087890625, 0.0439453125, 0.02197265625,
|
||||
* 0.010986328125, 0.0054931640625, 0.00274658203125,
|
||||
* 0.001373291015625, 0.0006866455078125, 0.00034332275390625,
|
||||
* 0.000171661376953125, 0.0000858306884765625, 0.00004291534423828125]
|
||||
*
|
||||
* So, we expect a zoom of 9 because it is the closest resolution.
|
||||
*/
|
||||
|
||||
t.eq( zoom, 9, "getZoomForExtent() returns correct value");
|
||||
|
||||
bounds = new OpenLayers.Bounds(10,10,100,100);
|
||||
zoom = layer.getZoomForExtent(bounds);
|
||||
|
||||
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
|
||||
/**
|
||||
* ideal resolution: 90 map units / 500px = 0.18
|
||||
* So, we expect a zoom of 3 because it is the closest.
|
||||
*/
|
||||
t.eq( zoom, 3, "getZoomForExtent() returns correct value");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
}
|
||||
function test_Layer_Text_loadend_Event(t) {
|
||||
t.plan(2);
|
||||
layer = new OpenLayers.Layer.Text('Test Layer', {location:datafile});
|
||||
layer = new OpenLayers.Layer.Text('Test Layer', {location:datafile});
|
||||
t.delay_call(2, function() {
|
||||
layer.events.register('loadend', layer, function() {
|
||||
t.ok(true, "Loadend event fired");
|
||||
|
||||
@@ -78,13 +78,27 @@
|
||||
|
||||
bounds = new OpenLayers.Bounds(10,10,12,12);
|
||||
zoom = layer.getZoomForExtent(bounds);
|
||||
|
||||
t.eq( zoom, 7, "getZoomForExtent() returns correct value");
|
||||
/**
|
||||
* ideal resolution: 2 map units / 500px = 0.004
|
||||
* layer.resolutions = [0.703125, 0.3515625, 0.17578125,
|
||||
* 0.087890625, 0.0439453125, 0.02197265625,
|
||||
* 0.010986328125, 0.0054931640625, 0.00274658203125,
|
||||
* 0.001373291015625, 0.0006866455078125, 0.00034332275390625,
|
||||
* 0.000171661376953125, 0.0000858306884765625, 0.00004291534423828125,
|
||||
* 0.000021457672119140625]
|
||||
*
|
||||
* So, we expect a zoom of 8 because it is the closest resolution.
|
||||
*/
|
||||
t.eq( zoom, 8, "getZoomForExtent() returns correct value");
|
||||
|
||||
bounds = new OpenLayers.Bounds(10,10,100,100);
|
||||
zoom = layer.getZoomForExtent(bounds);
|
||||
/**
|
||||
* ideal resolution: 90 map units / 500px = 0.18
|
||||
* So, we expect a zoom of 2 because it is the closest.
|
||||
*/
|
||||
|
||||
t.eq( zoom, 1, "getZoomForExtent() returns correct value");
|
||||
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -165,9 +165,9 @@
|
||||
var baseLayer = new OpenLayers.Layer.WMS("Base Layer",
|
||||
"http://octo.metacarta.com/cgi-bin/mapserv",
|
||||
{ map: '/mapdata/vmap_wms.map',
|
||||
layers: 'basic',
|
||||
format: 'image/png'});
|
||||
|
||||
layers: 'basic',
|
||||
format: 'image/png'});
|
||||
|
||||
var layer = new OpenLayers.Layer.Vector("Test Layer");
|
||||
var renderer = layer.renderer;
|
||||
var map = new OpenLayers.Map('map');
|
||||
@@ -181,25 +181,25 @@
|
||||
map.zoomToMaxExtent();
|
||||
|
||||
var customStyle1 = new Object({
|
||||
externalGraphic: 'test.png',
|
||||
pointRadius: 10
|
||||
externalGraphic: 'test.png',
|
||||
pointRadius: 10
|
||||
});
|
||||
var customStyle2 = new Object({
|
||||
externalGraphic: 'test.png',
|
||||
graphicWidth: 12
|
||||
externalGraphic: 'test.png',
|
||||
graphicWidth: 12
|
||||
});
|
||||
var customStyle3 = new Object({
|
||||
externalGraphic: 'test.png',
|
||||
graphicHeight: 14
|
||||
externalGraphic: 'test.png',
|
||||
graphicHeight: 14
|
||||
});
|
||||
var customStyle4 = new Object({
|
||||
externalGraphic: 'test.png',
|
||||
graphicWidth: 24,
|
||||
graphicHeight: 16
|
||||
externalGraphic: 'test.png',
|
||||
graphicWidth: 24,
|
||||
graphicHeight: 16
|
||||
});
|
||||
var customStyle5 = new Object({
|
||||
externalGraphic: 'test.png',
|
||||
graphicWidth: 24,
|
||||
graphicWidth: 24,
|
||||
graphicOpacity: 1
|
||||
});
|
||||
var customStyle6 = new Object({
|
||||
@@ -212,43 +212,43 @@
|
||||
|
||||
var root = renderer.root;
|
||||
if (layer.renderer.CLASS_NAME == 'OpenLayers.Renderer.SVG') {
|
||||
feature.style = customStyle1;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'width'),
|
||||
(2*customStyle1.pointRadius).toString(),
|
||||
"given a pointRadius, width equals 2*pointRadius");
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'height'),
|
||||
(2*customStyle1.pointRadius).toString(),
|
||||
"given a pointRadius, height equals 2*pointRadius");
|
||||
feature.style = customStyle2;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'width'),
|
||||
root.firstChild.getAttributeNS(null, 'height'),
|
||||
"given a graphicWidth, width equals height");
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'width'),
|
||||
customStyle2.graphicWidth.toString(),
|
||||
"width is set correctly");
|
||||
feature.style = customStyle3;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'height'),
|
||||
root.firstChild.getAttributeNS(null, 'width'),
|
||||
"given a graphicHeight, height equals width");
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'height'),
|
||||
customStyle3.graphicHeight.toString(),
|
||||
"height is set correctly");
|
||||
feature.style = customStyle4;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'height'),
|
||||
customStyle4.graphicHeight.toString(),
|
||||
"given graphicHeight and graphicWidth, both are set: height");
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'width'),
|
||||
customStyle4.graphicWidth.toString(),
|
||||
"given graphicHeight and graphicWidth, both are set: width");
|
||||
feature.style = customStyle1;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'width'),
|
||||
(2*customStyle1.pointRadius).toString(),
|
||||
"given a pointRadius, width equals 2*pointRadius");
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'height'),
|
||||
(2*customStyle1.pointRadius).toString(),
|
||||
"given a pointRadius, height equals 2*pointRadius");
|
||||
feature.style = customStyle2;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'width'),
|
||||
root.firstChild.getAttributeNS(null, 'height'),
|
||||
"given a graphicWidth, width equals height");
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'width'),
|
||||
customStyle2.graphicWidth.toString(),
|
||||
"width is set correctly");
|
||||
feature.style = customStyle3;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'height'),
|
||||
root.firstChild.getAttributeNS(null, 'width'),
|
||||
"given a graphicHeight, height equals width");
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'height'),
|
||||
customStyle3.graphicHeight.toString(),
|
||||
"height is set correctly");
|
||||
feature.style = customStyle4;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'height'),
|
||||
customStyle4.graphicHeight.toString(),
|
||||
"given graphicHeight and graphicWidth, both are set: height");
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'width'),
|
||||
customStyle4.graphicWidth.toString(),
|
||||
"given graphicHeight and graphicWidth, both are set: width");
|
||||
feature.style = customStyle5;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'style'),
|
||||
'opacity: '+customStyle5.graphicOpacity.toString()+';',
|
||||
"graphicOpacity correctly set");
|
||||
t.eq(root.firstChild.getAttributeNS(null, 'style'),
|
||||
'opacity: '+customStyle5.graphicOpacity.toString()+';',
|
||||
"graphicOpacity correctly set");
|
||||
feature.style = customStyle6;
|
||||
layer.drawFeature(feature);
|
||||
var x = geometryX / renderer.getResolution() + renderer.left;
|
||||
@@ -268,46 +268,46 @@
|
||||
"graphicYOffset correctly set");
|
||||
}
|
||||
if (layer.renderer.CLASS_NAME == 'OpenLayers.Renderer.VML') {
|
||||
feature.style = customStyle1;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.style.width,
|
||||
(2*customStyle1.pointRadius).toString()+'px',
|
||||
"given a pointRadius, width equals 2*pointRadius");
|
||||
t.eq(root.firstChild.style.height,
|
||||
(2*customStyle1.pointRadius).toString()+'px',
|
||||
"given a pointRadius, height equals 2*pointRadius");
|
||||
feature.style = customStyle2;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.style.width,
|
||||
root.firstChild.style.height,
|
||||
"given a graphicWidth, width equals height");
|
||||
t.eq(root.firstChild.style.width,
|
||||
customStyle2.graphicWidth.toString()+'px',
|
||||
"width is set correctly");
|
||||
feature.style = customStyle3;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.style.height,
|
||||
root.firstChild.style.width,
|
||||
"given a graphicHeight, height equals width");
|
||||
t.eq(root.firstChild.style.height,
|
||||
customStyle3.graphicHeight.toString()+'px',
|
||||
"height is set correctly");
|
||||
feature.style = customStyle4;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.style.height,
|
||||
customStyle4.graphicHeight.toString()+'px',
|
||||
"given graphicHeight and graphicWidth, both are set: height");
|
||||
t.eq(root.firstChild.style.width,
|
||||
customStyle4.graphicWidth.toString()+'px',
|
||||
"given graphicHeight and graphicWidth, both are set: width");
|
||||
feature.style = customStyle1;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.style.width,
|
||||
(2*customStyle1.pointRadius).toString()+'px',
|
||||
"given a pointRadius, width equals 2*pointRadius");
|
||||
t.eq(root.firstChild.style.height,
|
||||
(2*customStyle1.pointRadius).toString()+'px',
|
||||
"given a pointRadius, height equals 2*pointRadius");
|
||||
feature.style = customStyle2;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.style.width,
|
||||
root.firstChild.style.height,
|
||||
"given a graphicWidth, width equals height");
|
||||
t.eq(root.firstChild.style.width,
|
||||
customStyle2.graphicWidth.toString()+'px',
|
||||
"width is set correctly");
|
||||
feature.style = customStyle3;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.style.height,
|
||||
root.firstChild.style.width,
|
||||
"given a graphicHeight, height equals width");
|
||||
t.eq(root.firstChild.style.height,
|
||||
customStyle3.graphicHeight.toString()+'px',
|
||||
"height is set correctly");
|
||||
feature.style = customStyle4;
|
||||
layer.drawFeature(feature);
|
||||
t.eq(root.firstChild.style.height,
|
||||
customStyle4.graphicHeight.toString()+'px',
|
||||
"given graphicHeight and graphicWidth, both are set: height");
|
||||
t.eq(root.firstChild.style.width,
|
||||
customStyle4.graphicWidth.toString()+'px',
|
||||
"given graphicHeight and graphicWidth, both are set: width");
|
||||
feature.style = customStyle5;
|
||||
layer.drawFeature(feature);
|
||||
var fill = root.firstChild.getElementsByTagName("fill")[0];
|
||||
if (fill == null) fill = root.firstChild.getElementsByTagName("v:fill");
|
||||
var opacity = fill.getAttribute('opacity');
|
||||
t.eq(opacity,
|
||||
customStyle5.graphicOpacity,
|
||||
"graphicOpacity correctly set");
|
||||
customStyle5.graphicOpacity,
|
||||
"graphicOpacity correctly set");
|
||||
feature.style = customStyle6;
|
||||
layer.drawFeature(feature);
|
||||
var x = geometryX / renderer.getResolution();
|
||||
|
||||
@@ -131,9 +131,9 @@
|
||||
var m = new OpenLayers.Map('map');
|
||||
m.addLayer(layer);
|
||||
m.zoomToMaxExtent();
|
||||
t.eq(layer.grid[3][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C-90%2C180%2C90&WIDTH=256&HEIGHT=256", "cell [3][0] is wrapped around the world.");
|
||||
t.eq(layer.grid[0][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C450%2C180%2C630&WIDTH=256&HEIGHT=256", "cell [0][0] is wrapped around the world lon, but not lat");
|
||||
t.eq(layer.grid[0][3].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-180%2C450%2C0%2C630&WIDTH=256&HEIGHT=256", "cell [3][0] is not wrapped at all.");
|
||||
t.eq(layer.grid[3][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C0%2C90%2C90&WIDTH=256&HEIGHT=256", "cell [3][0] is wrapped around the world.");
|
||||
t.eq(layer.grid[0][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C270%2C90%2C360&WIDTH=256&HEIGHT=256", "cell [0][0] is wrapped around the world lon, but not lat");
|
||||
t.eq(layer.grid[0][3].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-90%2C270%2C0%2C360&WIDTH=256&HEIGHT=256", "cell [3][0] is not wrapped at all.");
|
||||
|
||||
}
|
||||
function test_Layer_WrapDateLine_KaMap (t) {
|
||||
@@ -146,9 +146,9 @@
|
||||
var m = new OpenLayers.Map('map');
|
||||
m.addLayer(layer);
|
||||
m.zoomToMaxExtent();
|
||||
t.eq(layer.grid[0][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-1280&l=0&s=221471921.25", "grid[0][0] kamap is okay");
|
||||
t.eq(layer.grid[0][3].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-1280&l=-256&s=221471921.25", "grid[0][3] kamap is okay");
|
||||
t.eq(layer.grid[3][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-512&l=0&s=221471921.25", "grid[3][0] is okay");
|
||||
t.eq(layer.grid[0][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-1280&l=0&s=110735960.625", "grid[0][0] kamap is okay");
|
||||
t.eq(layer.grid[0][3].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-1280&l=-256&s=110735960.625", "grid[0][3] kamap is okay");
|
||||
t.eq(layer.grid[3][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-512&l=0&s=110735960.625", "grid[3][0] is okay");
|
||||
}
|
||||
function test_Layer_WrapDateLine_WMS_Overlay (t) {
|
||||
t.plan( 3 );
|
||||
@@ -163,9 +163,9 @@
|
||||
var m = new OpenLayers.Map('map');
|
||||
m.addLayers([baselayer,layer]);
|
||||
m.zoomToMaxExtent();
|
||||
t.eq(layer.grid[0][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C450%2C180%2C630&WIDTH=256&HEIGHT=256", "grid[0][0] wms overlay is okay");
|
||||
t.eq(layer.grid[0][3].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-180%2C450%2C0%2C630&WIDTH=256&HEIGHT=256", "grid[0][3] wms overlay is okay");
|
||||
t.eq(layer.grid[3][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C-90%2C180%2C90&WIDTH=256&HEIGHT=256", "grid[3][0] wms overlay okay");
|
||||
t.eq(layer.grid[0][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C270%2C90%2C360&WIDTH=256&HEIGHT=256", "grid[0][0] wms overlay is okay");
|
||||
t.eq(layer.grid[0][3].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-90%2C270%2C0%2C360&WIDTH=256&HEIGHT=256", "grid[0][3] wms overlay is okay");
|
||||
t.eq(layer.grid[3][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C0%2C90%2C90&WIDTH=256&HEIGHT=256", "grid[3][0] wms overlay okay");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
|
||||
function test_06_Layer_getZoomForResolution(t) {
|
||||
|
||||
t.plan(4);
|
||||
t.plan(6);
|
||||
|
||||
var layer = new OpenLayers.Layer('Test Layer');
|
||||
|
||||
@@ -163,6 +163,8 @@
|
||||
layer.resolutions = [128, 64, 32, 16, 8, 4, 2];
|
||||
|
||||
t.eq(layer.getZoomForResolution(200), 0, "zoom all the way out");
|
||||
t.eq(layer.getZoomForResolution(65), 1, "index closest to 65");
|
||||
t.eq(layer.getZoomForResolution(63), 1, "index closest to 63");
|
||||
t.eq(layer.getZoomForResolution(25), 2, "zoom in middle");
|
||||
t.eq(layer.getZoomForResolution(3), 5, "zoom allmost all the way in");
|
||||
t.eq(layer.getZoomForResolution(1), 6, "zoom all the way in");
|
||||
|
||||
Reference in New Issue
Block a user