Merge branch 'master' into clientzoom
This commit is contained in:
@@ -594,7 +594,7 @@
|
||||
}
|
||||
|
||||
function test_Bounds_add(t) {
|
||||
t.plan( 8 );
|
||||
t.plan( 6 );
|
||||
|
||||
origBounds = new OpenLayers.Bounds(1,2,3,4);
|
||||
testBounds = origBounds.clone();
|
||||
@@ -606,19 +606,19 @@
|
||||
t.ok( bounds.equals(b), "bounds is set correctly");
|
||||
|
||||
//null values
|
||||
OpenLayers.Lang.setCode('en');
|
||||
var desiredMsg = "You must pass both x and y values to the add function.";
|
||||
OpenLayers.Console.error = function(msg) {
|
||||
t.eq(msg, desiredMsg, "error correctly reported");
|
||||
try {
|
||||
bounds = testBounds.add(null, 50);
|
||||
} catch(e) {
|
||||
t.ok("exception thrown when passing null value to add()");
|
||||
}
|
||||
|
||||
bounds = testBounds.add(null, 50);
|
||||
t.ok( testBounds.equals(origBounds), "testBounds is not modified by erroneous add operation (null x)");
|
||||
t.ok(bounds == null, "returns null on erroneous add operation (null x)");
|
||||
|
||||
bounds = testBounds.add(5, null);
|
||||
try {
|
||||
bounds = testBounds.add(5, null);
|
||||
} catch(e) {
|
||||
t.ok("exception thrown when passing null value to add()");
|
||||
}
|
||||
t.ok( testBounds.equals(origBounds), "testBounds is not modified by erroneous add operation (null y)");
|
||||
t.ok(bounds == null, "returns null on erroneous add operation (null y)");
|
||||
}
|
||||
|
||||
function test_Bounds_scale(t) {
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
}
|
||||
|
||||
function test_LonLat_add(t) {
|
||||
t.plan(10);
|
||||
t.plan(8);
|
||||
|
||||
origLL = new OpenLayers.LonLat(10,100);
|
||||
lonlatA = origLL.clone();
|
||||
@@ -64,19 +64,19 @@
|
||||
t.ok( addpx.equals(ll), "addpx is set correctly");
|
||||
|
||||
//null values
|
||||
OpenLayers.Lang.setCode('en');
|
||||
var desiredMsg = "You must pass both lon and lat values to the add function.";
|
||||
OpenLayers.Console.error = function(msg) {
|
||||
t.eq(msg, desiredMsg, "error correctly reported");
|
||||
try {
|
||||
addpx = lonlatA.add(null, 50);
|
||||
} catch(e) {
|
||||
t.ok("exception thrown when passing null value to add()");
|
||||
}
|
||||
|
||||
addpx = lonlatA.add(null, 50);
|
||||
t.ok( lonlatA.equals(origLL), "lonlatA is not modified by erroneous add operation (null lon)");
|
||||
t.ok(addpx == null, "returns null on erroneous add operation (null lon)");
|
||||
|
||||
addpx = lonlatA.add(5, null);
|
||||
try {
|
||||
addpx = lonlatA.add(5, null);
|
||||
} catch(e) {
|
||||
t.ok("exception thrown when passing null value to add()");
|
||||
}
|
||||
t.ok( lonlatA.equals(origLL), "lonlatA is not modified by erroneous add operation (null lat)");
|
||||
t.ok(addpx == null, "returns null on erroneous add operation (null lat)");
|
||||
|
||||
// string values
|
||||
addpx = origLL.clone().add("5", "50");
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
}
|
||||
|
||||
function test_Pixel_add(t) {
|
||||
t.plan( 8 );
|
||||
t.plan( 6 );
|
||||
|
||||
var origPX = new OpenLayers.Pixel(5,6);
|
||||
var oldPixel = origPX.clone();
|
||||
@@ -85,19 +85,19 @@
|
||||
t.ok( pixel.equals(px), "returned pixel is correct");
|
||||
|
||||
//null values
|
||||
OpenLayers.Lang.setCode('en');
|
||||
var desiredMsg = "You must pass both x and y values to the add function.";
|
||||
OpenLayers.Console.error = function(msg) {
|
||||
t.eq(msg, desiredMsg, "error correctly reported");
|
||||
try {
|
||||
pixel = oldPixel.add(null, 50);
|
||||
} catch(e) {
|
||||
t.ok("exception thrown when passing null value to add()");
|
||||
}
|
||||
|
||||
pixel = oldPixel.add(null, 50);
|
||||
t.ok( oldPixel.equals(origPX), "oldPixel is not modified by erroneous add operation (null x)");
|
||||
t.ok(pixel == null, "returns null on erroneous add operation (null x)");
|
||||
|
||||
addpx = oldPixel.add(5, null);
|
||||
try {
|
||||
addpx = oldPixel.add(5, null);
|
||||
} catch(e) {
|
||||
t.ok("exception thrown when passing null value to add()");
|
||||
}
|
||||
t.ok( oldPixel.equals(origPX), "oldPixel is not modified by erroneous add operation (null y)");
|
||||
t.ok(pixel == null, "returns null on erroneous add operation (null y)");
|
||||
}
|
||||
|
||||
function test_Pixel_offset(t) {
|
||||
|
||||
@@ -37,6 +37,33 @@
|
||||
t.ok(!control.handler.multi, "handlerOptions.multi respected");
|
||||
|
||||
}
|
||||
|
||||
function test_rendererOptions(t) {
|
||||
t.plan(2);
|
||||
|
||||
var map = new OpenLayers.Map("map");
|
||||
var renderers = ["Canvas", "VML"];
|
||||
|
||||
var layer = new OpenLayers.Layer.Vector(null, {
|
||||
renderers: renderers,
|
||||
rendererOptions: {zIndexing: true},
|
||||
isBaseLayer: true
|
||||
});
|
||||
map.addLayer(layer);
|
||||
|
||||
var control = new OpenLayers.Control.DrawFeature(
|
||||
layer, OpenLayers.Handler.Polygon, {autoActivate: true}
|
||||
);
|
||||
map.addControl(control);
|
||||
|
||||
var sketchLayer = control.handler.layer;
|
||||
|
||||
t.eq(sketchLayer.renderers, renderers, "Preferred renderers");
|
||||
t.eq(sketchLayer.rendererOptions.zIndexing, true, "renderer options");
|
||||
|
||||
map.destroy();
|
||||
|
||||
}
|
||||
|
||||
function test_drawFeature(t) {
|
||||
t.plan(3);
|
||||
|
||||
@@ -133,6 +133,28 @@
|
||||
t.xml_eq(got, expected, snippet + " request without geometry created correctly");
|
||||
}
|
||||
}
|
||||
|
||||
function test_setFilterProperty(t) {
|
||||
t.plan(2);
|
||||
var format = new OpenLayers.Format.WFST({
|
||||
geometryName: "foo"
|
||||
});
|
||||
var filter = new OpenLayers.Filter.Logical({
|
||||
type: OpenLayers.Filter.Logical.AND,
|
||||
filters: [new OpenLayers.Filter.Spatial({
|
||||
type: OpenLayers.Filter.Spatial.BBOX,
|
||||
value: new OpenLayers.Bounds(1,2,3,4)
|
||||
}), new OpenLayers.Filter.Spatial({
|
||||
type: OpenLayers.Filter.Spatial.DWITHIN,
|
||||
property: "bar",
|
||||
value: new OpenLayers.Geometry.Point(1,2),
|
||||
distance: 10
|
||||
})]
|
||||
});
|
||||
format.setFilterProperty(filter);
|
||||
t.eq(filter.filters[0].property, "foo", "property set if not set on filter");
|
||||
t.eq(filter.filters[1].property, "bar", "property not set if set on filter");
|
||||
}
|
||||
|
||||
function test_update_null_geometry(t) {
|
||||
var format = new OpenLayers.Format.WFST({
|
||||
|
||||
@@ -692,9 +692,12 @@
|
||||
{map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'}
|
||||
);
|
||||
|
||||
map.addLayers([layer,layer]);
|
||||
|
||||
t.eq( map.layers.length, 1, "Map does not allow double adding of layers." );
|
||||
map.addLayers([layer]);
|
||||
try {
|
||||
map.addLayers([layer]);
|
||||
} catch(e) {
|
||||
t.ok(true, "Map does not allow double adding of layers." );
|
||||
}
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
@@ -94,8 +94,8 @@
|
||||
var marker = new OpenLayers.Marker(ll);
|
||||
mlayer.addMarker(marker);
|
||||
|
||||
t.ok(marker.icon.imageDiv.firstChild.src.contains("img/marker.png"), "Marker.png is default URL");
|
||||
|
||||
t.ok(OpenLayers.String.contains(marker.icon.imageDiv.firstChild.src, "img/marker.png"), "Marker.png is default URL");
|
||||
|
||||
marker.setUrl("http://example.com/broken.png");
|
||||
t.eq(marker.icon.imageDiv.firstChild.src, "http://example.com/broken.png", "image source changes correctly.");
|
||||
|
||||
|
||||
@@ -176,9 +176,9 @@
|
||||
|
||||
// c) test that label in returned symbolizer is a string even if property value is a number
|
||||
var symbolizer = style.createSymbolizer(
|
||||
new OpenLayers.Feature.Vector(null, {foo: "bar", labelValue: 10})
|
||||
new OpenLayers.Feature.Vector(null, {foo: "bar", labelValue: 0})
|
||||
);
|
||||
t.eq(symbolizer.label, "10", "c) feature property cast to string when used as symbolizer label");
|
||||
t.eq(symbolizer.label, "0", "c) feature property cast to string when used as symbolizer label");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -254,21 +254,6 @@
|
||||
|
||||
}
|
||||
|
||||
function test_Util_imageLoadError(t) {
|
||||
t.plan(2);
|
||||
|
||||
var img = OpenLayers.Util.createImage(null, null, null, null, null, null, null, false);
|
||||
|
||||
// mock up image load failure
|
||||
img._attempts = OpenLayers.IMAGE_RELOAD_ATTEMPTS + 1;
|
||||
OpenLayers.Util.onImageLoadError.call(img);
|
||||
t.ok(OpenLayers.Element.hasClass(img, 'olImageLoadError'), 'broken image has class olImageLoadError');
|
||||
|
||||
// mock up image load success
|
||||
OpenLayers.Util.onImageLoad.call(img);
|
||||
t.ok(!OpenLayers.Element.hasClass(img, 'olImageLoadError'), 'good image does not have class olImageLoadError');
|
||||
}
|
||||
|
||||
function test_Util_applyDefaults(t) {
|
||||
|
||||
t.plan(12);
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="http://maps.google.com/maps/api/js?v=3.5&sensor=false"></script>
|
||||
|
||||
<script src="../../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
@@ -22,18 +20,23 @@
|
||||
var map;
|
||||
|
||||
function init(){
|
||||
map = new OpenLayers.Map('map');
|
||||
var options = {
|
||||
projection: new OpenLayers.Projection("EPSG:900913"),
|
||||
units: "m",
|
||||
maxResolution: 156543.0339,
|
||||
maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508)
|
||||
};
|
||||
map = new OpenLayers.Map('map', options);
|
||||
|
||||
var gmap = new OpenLayers.Layer.Google(
|
||||
"Google Streets",
|
||||
{sphericalMercator: true}
|
||||
var osm = new OpenLayers.Layer.OSM(
|
||||
"OSM", null, {wrapDateLine: true}
|
||||
);
|
||||
var vector = new OpenLayers.Layer.Vector("Editable Vectors");
|
||||
|
||||
map.addLayers([gmap, vector]);
|
||||
map.addLayers([osm, vector]);
|
||||
map.addControl(new OpenLayers.Control.EditingToolbar(vector));
|
||||
|
||||
var extent = new OpenLayers.Bounds(-24225034.496992, -11368938.517442, -14206280.326992, -1350184.3474418);
|
||||
var extent = new OpenLayers.Bounds(15849982.183008, -11368938.517442, -14206280.326992, -1350184.3474418);
|
||||
map.zoomToExtent(extent);
|
||||
}
|
||||
|
||||
|
||||
53
tests/manual/dateline-smallextent.html
Normal file
53
tests/manual/dateline-smallextent.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<title>OpenLayers: Sketch handlers crossing the dateline</title>
|
||||
<link rel="stylesheet" href="../../theme/default/style.css" type="text/css">
|
||||
<link rel="stylesheet" href="../../examples/style.css" type="text/css">
|
||||
<style type="text/css">
|
||||
#map {
|
||||
height: 512px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="../../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
// make map available for easy debugging
|
||||
var map;
|
||||
|
||||
function init(){
|
||||
map = new OpenLayers.Map('map');
|
||||
|
||||
var osm = new OpenLayers.Layer.OSM(
|
||||
"OSM", null,
|
||||
{wrapDateLine: true}
|
||||
);
|
||||
var extent = new OpenLayers.Bounds(15849982.183008, -11368938.517442, -14206280.326992, -1350184.3474419);
|
||||
var wms = new OpenLayers.Layer.WMS( "world",
|
||||
"http://demo.opengeo.org/geoserver/wms",
|
||||
{layers: 'world', transparent: true},
|
||||
{maxExtent: extent}
|
||||
);
|
||||
|
||||
map.addLayers([osm, wms]);
|
||||
|
||||
map.zoomToExtent(extent);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
<h1 id="title">OpenLayers overlays crossing the dateline test</h1>
|
||||
|
||||
<p id="shortdesc">
|
||||
The overlay has an extent smaller than the world extent. The base layer
|
||||
is configured with wrapDateLine set to true. New Zealand and a part of
|
||||
Australia should always be visible on the map.
|
||||
</p>
|
||||
<div id="map" class="smallmap"></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user