Skip to content

Commit

Permalink
Merge pull request openlayers#329 from bartvde/master
Browse files Browse the repository at this point in the history
merge 2.12 into master
  • Loading branch information
Bart van den Eijnden committed Mar 16, 2012
2 parents 9070c2e + b6dff22 commit 1935d6d
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/graticule.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script src="http://proj4js.org/lib/proj4js-compressed.js"></script>
<script src="http://svn.osgeo.org/metacrs/proj4js/trunk/lib/proj4js-compressed.js"></script>
<script type="text/javascript">
Proj4js.defs["EPSG:42304"]="+title=Atlas of Canada, LCC +proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs";

Expand Down
2 changes: 1 addition & 1 deletion examples/using-proj4js.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<title>Using Proj4JS for vector reprojection</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
<script type="text/javascript" src="http://trac.osgeo.org/proj4js/export/2080/trunk/lib/proj4js-compressed.js"></script>
<script type="text/javascript" src="http://svn.osgeo.org/metacrs/proj4js/trunk/lib/proj4js-compressed.js"></script>
<script type="text/javascript" src="http://spatialreference.org/ref/epsg/31467/proj4js/"></script>
<script type="text/javascript" src="../lib/OpenLayers.js"></script>
<script type="text/javascript" src="./using-proj4js.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenLayers/Layer/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
this.numLoadingTiles--;
this.events.triggerEvent("tileloaded", {tile: tile});
//if that was the last tile, then trigger a 'loadend' on the layer
if (this.tileQueue.length === 0 && this.numLoadingTiles === 0) {
if (this.numLoadingTiles === 0) {
this.events.triggerEvent("loadend");
if(this.backBuffer) {
// the removal of the back buffer is delayed to prevent flash
Expand Down
2 changes: 1 addition & 1 deletion lib/OpenLayers/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,7 @@ OpenLayers.Map = OpenLayers.Class({
* options - {Object}
*/
moveTo: function(lonlat, zoom, options) {
if (!(lonlat instanceof OpenLayers.LonLat)) {
if (lonlat != null && !(lonlat instanceof OpenLayers.LonLat)) {
lonlat = new OpenLayers.LonLat(lonlat);
}
if (!options) {
Expand Down
92 changes: 86 additions & 6 deletions notes/2.12.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
A simple control to add zoom in/out buttons on the map that can be entirely styled using CSS.
See it live in this [example](http://openlayers.org/dev/examples/zoom.html).

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/291
* https://github.com/openlayers/openlayers/pull/292

## Builds

This version of OpenLayers ships with three builds:
Expand All @@ -15,6 +20,11 @@ This version of OpenLayers ships with three builds:

See the README.md file and the docs on docs.openlayers.org for more information.

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/254
* https://github.com/openlayers/openlayers/pull/261

## Sensible projection defaults

The geographic and web mercator projections define default values for the maxExtent, and units. This simplifies the map and layer configuration.
Expand All @@ -37,10 +47,18 @@ can now be created with this:
projection: "EPSG:900913"
});

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/219

## Tile Offline Storage

With the new `OpenLayers.Control.CacheRead` and `OpenLayers.Control.CacheWrite` controls, applications can cache tiles for offline use or for use with slow connections.

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/301

## Tile Animation

The displaying of tiles can now be animated, using CSS3 transitions. Transitions operate on the `opacity` property. Here's the CSS rule defined in OpenLayers' default theme:
Expand All @@ -61,11 +79,19 @@ People can override this rule to use other transition settings. To remove tile a
transition: none;
}

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/127

## Tile Queue

The tiling code has been overhauled so tile loading in grid layers is now done in a queue.
The tile queue gives more control on the tile requests sent to the server. Pending requests for tiles that are not needed any more (e.g. after zooming or panning) are avoided, which increases performance and reduces server load.

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/179

## Tile Canvas

Image tiles expose a `getCanvasContext` function that can be used for various
Expand All @@ -74,15 +100,27 @@ things, like changing the image pixels, save the image using the File API, etc.
See the [osm-grayscale
example](http://openlayers.org/dev/examples/osm-grayscale.html).

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/160

## Tile Interaction Event Improvements

The layer's `tileloaded` event now returns a reference to the loaded tile. The new `tileloaderror` event does the same, and is fired when a tile could not be loaded.

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/283

## Tile and Backbuffer Overhaul

The whole image tile and backbuffer code (behind `transitionEffect:resize`) has been redesigned and
rewritten. This overhaul yields better performance and code simplifications.

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/16

## Continuous Zooming

Tile layers can now be displayed at resolutions not supported by their tiling
Expand All @@ -93,15 +131,24 @@ for single tile layers as well as for tiled layers.
See the [client zoom
example](http://openlayers.org/dev/examples/clientzoom.html).

Corresponding issues/pull requests:

* http://trac.osgeo.org/openlayers/ticket/3531
* https://github.com/openlayers/openlayers/pull/5

# Behavior Changes from Past Releases

## GPX API change

The `gpxns` API property has been removed. The GPX namespace is now defined in the `namespaces` property but is not intended to be overriden.

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/221

## Function return values

[Previously][prev] a few functions in the library displayed error messages and returned `undefined`, `null` or `false` if the parameters passed in were bad. In 2.12 these functions now just throw an error/exception. People relying on return values to know if a function call is successful may need to change their code. Here are the modified functions:
Previously a few functions in the library displayed error messages and returned `undefined`, `null` or `false` if the parameters passed in were bad. In 2.12 these functions now just throw an error/exception. People relying on return values to know if a function call is successful may need to change their code. Here are the modified functions:

* `OpenLayers.Bounds.add` throws a `TypeError` exception if `x` or `y` is null
* `OpenLayers.LonLat.add` throws a `TypeError` exception if `lon` or `lat` is null
Expand All @@ -110,7 +157,9 @@ The `gpxns` API property has been removed. The GPX namespace is now defined in t
* `OpenLayers.Layer.PointTrack.addNodes` throws a `TypeError` exception if `endPoint` isn't actually a point
* `OpenLayers.Layer.Vector.getFeatureFromEvent` throws an `Error` exception if the layer has no renderer

[prev]: https://github.com/openlayers/openlayers/commit/6e9a3e4c13e00c29daf28efd92b63c2390e69231
Corresponding issues/pull requests:

* http://trac.osgeo.org/openlayers/ticket/3320

## Changes in formats WMTSCapabilities and SOSCapabilities

Expand All @@ -122,8 +171,10 @@ Likewise for `SOSCapabilities`.

Looking at the tests is a good way to understand what the requires changes are. See [SOSCapabilities/v1_0_0.html](https://github.com/openlayers/openlayers/blob/master/tests/Format/SOSCapabilities/v1_0_0.html) and [WMTSCapabilities/v1_0_0.html](https://github.com/openlayers/openlayers/blob/master/tests/Format/WMTSCapabilities/v1_0_0.html).

* Trac ticket: http://trac.osgeo.org/openlayers/ticket/3568
* GitHub issue: https://github.com/openlayers/openlayers/pull/40
Corresponding issues/pull requests:

* http://trac.osgeo.org/openlayers/ticket/3568
* https://github.com/openlayers/openlayers/pull/40


## Rico deprecation
Expand All @@ -139,19 +190,31 @@ The `roundedCorner` option of `Control.LayerSwitcher` is deprecated, and it now
border-radius: 10px 0 0 10px;
}

See more detail in the Rico deprecation [pull request](https://github.com/openlayers/openlayers/pull/99).

In future releases we intend to move the Rico and `AnchoredBubble` code into deprecated.js. You really should consider stop using Rico-based functionalities in your applications.

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/99

## Changes in Geometry

The base `OpenLayers.Geometry` class no longer depends on `OpenLayers.Format.WKT` or `OpenLayers.Feature.Vector`. If you want to make use of the `OpenLayers.Geometry.fromWKT` method, you must explicitly include the OpenLayers/Format/WKT.js file in your build.

Without the WKT format included (by default), the `OpenLayers.Geometry::toString` method now returns "[object Object]." Previously, it returned the Well-Known Text representation of the geometry. To maintain the previous behavior, include the OpenLayers/Format/WKT.js file in your build.

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/101

## OSM and Bing Layers

`Layer.OSM` is now defined in its own script file, namely `OpenLayers/Layer/OSM.js`. So people using `Layer.OSM` should now include `OpenLayers/Layer/OSM.js`, as opposed to `OpenLayers/Layer/XYZ.js`, in their OpenLayers builds. (See https://github.com/openlayers/openlayers/issues/138)
`Layer.OSM` is now defined in its own script file, namely `OpenLayers/Layer/OSM.js`. So people using `Layer.OSM` should now include `OpenLayers/Layer/OSM.js`, as opposed to `OpenLayers/Layer/XYZ.js`, in their OpenLayers builds.

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/issues/138
* https://github.com/openlayers/openlayers/pull/144

The `OpenLayers.Tile.Image` class now has a method to get a canvas context for processing tiles. Since both OSM and Bing set Access-Control-Allow-Origin headers for their tiles, it is possible to manipulate a canvas that these tiles were rendered to even if the tiles come from a remote origin. Especially when working with custom OSM tilesets from servers that do not send Access-Control-Allow-Origin headers, it is now necessary to configure the layer with

Expand Down Expand Up @@ -192,12 +255,25 @@ New:

In previous releases, coordinate transforms between EPSG:4326 and EPSG:900913 were defined in the SphericalMercator.js script. In 2.12, these default transforms are included in the Projection.js script. The Projection.js script is included as a dependency in builds with any layer types, so no special build configuration is necessary to get the web mercator transforms.

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/219

If you were previously using the `OpenLayers.Layer.SphericalMercator.forwardMercator` or `inverseMercator` methods, you may have to explicitly include the SphericalMercator.js script in your build. The Google layer is the only layer that depends on the SphericalMercator mixin. If you are not using the Google layer but want to use the SphericalMercator methods listed above, you have to explicitly include the SphericalMercator.js script in your build.

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/153

## QueryStringFilter

`OpenLayers.Protocol.HTTP` no longer requires `OpenLayers.Format.QueryStringFilter`. It you need this, make sure it is included in your build config file.

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/issues/147
* https://github.com/openlayers/openlayers/pull/148

## Changes in getURLasync

The internal `OpenLayers.Layer.getURLasync` function now take a bound, a callback and a scope. The function no longer needs update the passed property but simply to return to url.
Expand All @@ -212,6 +288,10 @@ To replace a tile that couldn't be loaded with a static image, create a css sele

For more complex tile loading error handling, register a listener to the layer's `tileerror` event.

Corresponding issues/pull requests:

* https://github.com/openlayers/openlayers/pull/283

## Deprecated Components

A number of properties, methods, and constructors have been marked as deprecated for multiple releases in the 2.x series. For the 2.12 release this deprecated functionality has been moved to a separate deprecated.js file. If you use any of the constructors or methods below, you will have to explicitly include the deprecated.js file in your build (or add it in a separate `<script>` tag after OpenLayers.js).
Expand Down
2 changes: 1 addition & 1 deletion tests/Control/Graticule.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>
<head>
<script src="../OLLoader.js"></script>
<script src="http://proj4js.org/lib/proj4js-compressed.js"></script>
<script src="http://svn.osgeo.org/metacrs/proj4js/trunk/lib/proj4js-compressed.js"></script>
<script type="text/javascript">

function test_initialize(t) {
Expand Down
21 changes: 21 additions & 0 deletions tests/Map.html
Original file line number Diff line number Diff line change
Expand Up @@ -2037,6 +2037,27 @@
map.moveTo([16, 48], 0);
t.eq(map.getCenter().toShortString(), "0, 0", "no panning when moveTo is called with invalid zoom");
}

function test_correctCenterAtZoomLevel0(t) {
t.plan(1);
var map = new OpenLayers.Map({
div: 'map',
maxExtent: new OpenLayers.Bounds(-30, 48.00, 3.50, 64.00),
restrictedExtent: new OpenLayers.Bounds(-30, 48.00, 3.50, 64.00),
projection: "EPSG:4258",
units: "degrees",
layers: [
new OpenLayers.Layer('name', {
isBaseLayer: true
})
]
});
map.setCenter(new OpenLayers.LonLat(-1.3, 50.8), 4);
map.moveTo(null, 0);
var center = map.getCenter();
t.ok(center.equals(new OpenLayers.LonLat(-13.25, 56)), "Center is correct and not equal to maxExtent's center");
}

</script>
</head>
<body>
Expand Down
73 changes: 73 additions & 0 deletions tests/manual/loadend.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!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">
<link rel="stylesheet" href="../../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../../examples/style.css" type="text/css">
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript">
var lon = 5;
var lat = 40;
var zoom = 5;
var map, layer;

var numLoadingLayers = 0;

function init(){
map = new OpenLayers.Map( 'map' );
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'});

layer.events.register('loadstart', this, onloadstart);
layer.events.register('loadend', this, onloadend);

map.addLayer(layer);

map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
}

function log(msg) {
document.getElementById("output").innerHTML += msg + "<br />";
}

function onloadstart(evt) {
numLoadingLayers++;
var msg = ['loadstart', '# layers loading:', numLoadingLayers].join(' ');
log (msg);
};

function onloadend(evt) {
numLoadingLayers--;
var msg = ['loadend ', '# layers loading:', numLoadingLayers].join(' ');
log (msg);
};

</script>
</head>
<body onload="init()">
<h1 id="title">WMS loadstart/loadend events</h1>

<div id="tags">
wms, layer, singletile
</div>
<p id="shortdesc">
Shows the loadstart and loadend events of a WMS layer
</p>

<div id="map" class="smallmap"></div>

<div id="docs">
<p>
This example is helpful in testing whether all loadstart events are followed
by a loadend event.
Test by using scroll-wheel up and down.
</p>
</div>

<h1>loadstart and loadend events</h1>
<pre id="output"></pre>

</body>
</html>

0 comments on commit 1935d6d

Please sign in to comment.