Merge branch '2.12'

This commit is contained in:
Éric Lemoine
2012-04-02 21:10:19 +02:00
9 changed files with 115 additions and 40 deletions

View File

@@ -2,14 +2,14 @@
OpenLayers.js -- OpenLayers Map Viewer Library
Copyright 2005-2012 OpenLayers Contributors, released under the FreeBSD
license. Please see http://svn.openlayers.org/trunk/openlayers/license.txt
for the full text of the license.
Copyright (c) 2006-2012 by OpenLayers Contributors
Published under the 2-clause BSD license.
See http://openlayers.org/dev/license.txt for the full text of the license, and http://openlayers.org/dev/authors.txt for full list of contributors.
Includes compressed code under the following licenses:
(For uncompressed versions of the code used please see the
OpenLayers SVN repository: <http://openlayers.org/>)
(For uncompressed versions of the code used, please see the
OpenLayers Github repository: <https://github.com/openlayers/openlayers>)
*/

View File

@@ -43,7 +43,7 @@ div.olControlZoom a:hover {
background: rgba(0, 60, 136, 0.5);
}
}
.olTileImage {
.olLayerGridTile .olTileImage {
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;

View File

@@ -320,20 +320,6 @@ OpenLayers.Layer = OpenLayers.Class({
*/
wrapDateLine: false,
/**
* APIProperty: transitionEffect
* {String} The transition effect to use when the map is panned or
* zoomed.
*
* There are currently two supported values:
* - *null* No transition effect (the default).
* - *resize* Existing tiles are resized on zoom to provide a visual
* effect of the zoom having taken place immediately. As the
* new tiles become available, they are drawn over top of the
* resized tiles.
*/
transitionEffect: null,
/**
* Property: metadata
* {Object} This object can be used to store additional information on a

View File

@@ -91,6 +91,22 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
*/
buffer: 0,
/**
* APIProperty: transitionEffect
* {String} The transition effect to use when the map is zoomed.
* Two posible values:
*
* null - No transition effect (the default).
* "resize" - Existing tiles are resized on zoom to provide a visual
* effect of the zoom having taken place immediately. As the
* new tiles become available, they are drawn over top of the
* resized tiles.
*
* Using "resize" on non-opaque layers can cause undesired visual
* effects. This is therefore discouraged.
*/
transitionEffect: null,
/**
* APIProperty: numLoadingTiles
* {Integer} How many tiles are still loading?
@@ -184,9 +200,45 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
* APIProperty: removeBackBufferDelay
* {Number} Delay for removing the backbuffer when all tiles have finished
* loading. Can be set to 0 when no css opacity transitions for the
* olTileImage class are used. Default is 2500.
* olTileImage class are used. Default is 0 for <singleTile> layers,
* 2500 for tiled layers. See <className> for more information on
* tile animation.
*/
removeBackBufferDelay: 2500,
removeBackBufferDelay: null,
/**
* APIProperty: className
* {String} Name of the class added to the layer div. If not set in the
* options passed to the constructor then className defaults to
* "olLayerGridSingleTile" for single tile layers (see <singleTile>),
* and "olLayerGridTile" for non single tile layers.
*
* Note:
*
* The displaying of tiles is not animated by default for single tile
* layers - OpenLayers' default theme (style.css) includes this:
* (code)
* .olLayerGridTile .olTileImage {
* -webkit-transition: opacity 0.2s linear;
* -moz-transition: opacity 0.2s linear;
* -o-transition: opacity 0.2s linear;
* transition: opacity 0.2s linear;
* }
* (end)
* To animate tile displaying for any grid layer the following
* CSS rule can be used:
* (code)
* .olTileImage {
* -webkit-transition: opacity 0.2s linear;
* -moz-transition: opacity 0.2s linear;
* -o-transition: opacity 0.2s linear;
* transition: opacity 0.2s linear;
* }
* (end)
* In that case, to avoid flash effects, <removeBackBufferDelay>
* should not be zero.
*/
className: null,
/**
* Register a listener for a particular event with the following syntax:
@@ -232,7 +284,16 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
arguments);
this.grid = [];
this.tileQueue = [];
if (this.removeBackBufferDelay === null) {
this.removeBackBufferDelay = this.singleTile ? 0 : 2500;
}
if (this.className === null) {
this.className = this.singleTile ? 'olLayerGridSingleTile' :
'olLayerGridTile';
}
if (!OpenLayers.Animation.isNative) {
this.deferMoveGriddedTiles = OpenLayers.Function.bind(function() {
this.moveGriddedTiles(true);
@@ -241,6 +302,17 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
}
},
/**
* Method: setMap
*
* Parameters:
* map - {<OpenLayers.Map>} The map.
*/
setMap: function(map) {
OpenLayers.Layer.HTTPRequest.prototype.setMap.call(this, map);
OpenLayers.Element.addClass(this.div, this.className);
},
/**
* Method: removeMap
* Called when the layer is removed from the map.

View File

@@ -63,7 +63,7 @@ Corresponding issues/pull requests:
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:
.olTileImage {
.olLayerGridTile .olTileImage {
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;
@@ -72,13 +72,15 @@ The displaying of tiles can now be animated, using CSS3 transitions. Transitions
People can override this rule to use other transition settings. To remove tile animation entirely use:
.olTileImage {
.olLayerGridTile .olTileImage {
-webkit-transition: none;
-moz-transition: none;
-o-transition: all 0 none;
transition: none;
}
Note that by default tile animation is not enabled for single tile layers.
Corresponding issues/pull requests:
* https://github.com/openlayers/openlayers/pull/127

View File

@@ -24,8 +24,8 @@
*/
function test_Layer_Grid_constructor (t) {
t.plan( 6 );
function test_constructor (t) {
t.plan( 8 );
layer = new OpenLayers.Layer.Grid(name, url, params, null);
t.ok( layer instanceof OpenLayers.Layer.Grid, "returns OpenLayers.Layer.Grid object" );
@@ -33,6 +33,8 @@
t.eq( layer.ratio, 1.5, "ratio default is 1.5");
t.eq( layer.numLoadingTiles, 0, "numLoadingTiles starts at 0");
t.ok( layer.tileClass === OpenLayers.Tile.Image, "tileClass default is OpenLayers.Tile.Image");
t.eq( layer.className, 'olLayerGridTile', "className default is olLayerGridTile");
t.eq( layer.removeBackBufferDelay, 2500, "removeBackBufferDelay default is 2500");
var obj = {};
var func = function() {};
@@ -41,6 +43,32 @@
t.ok( layer.events.listeners['tileloaded'].length == 1, "one listener for tileloaded after register");
}
function test_constructor_singleTile(t) {
t.plan(2);
layer = new OpenLayers.Layer.Grid(name, url, params, {singleTile: true});
t.eq( layer.className, 'olLayerGridSingleTile', "className default is olLayerGridSingleTile");
t.eq( layer.removeBackBufferDelay, 0, "removeBackBufferDelay default is 0");
}
function test_setMap(t) {
t.plan(1);
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.Grid(name, url, params, null);
map.addLayer(layer);
t.ok(OpenLayers.Element.hasClass(layer.div, "olLayerGridTile"),
"olLayerGridTile class assigned to layer div");
map.destroy();
}
function test_setMap_singleTile(t) {
t.plan(1);
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.Grid(name, url, params, {singleTile: true});
map.addLayer(layer);
t.ok(OpenLayers.Element.hasClass(layer.div, "olLayerGridSingleTile"),
"olLayerGridSingleTile class assigned to layer div");
map.destroy();
}
function test_Layer_Grid_inittiles (t) {
t.plan( 2 );

View File

@@ -476,7 +476,7 @@ a.olControlZoomOut {
* Animations
*/
.olTileImage {
.olLayerGridTile .olTileImage {
-webkit-transition: opacity 0.2s linear;
-moz-transition: opacity 0.2s linear;
-o-transition: opacity 0.2s linear;

View File

@@ -1,13 +0,0 @@
#!/bin/sh
RELEASE=$1
RC=$2
svn co http://svn.openlayers.org/branches/openlayers/$RELEASE
cd $RELEASE
sed -i -e "s/OpenLayers.VERSION_NUMBER=.*/OpenLayers.VERSION_NUMBER=\"Release $1-$2\";/" lib/OpenLayers.js
sed -i -e "s/VERSION_NUMBER: .*,/VERSION_NUMBER: \"Release $1-$2\",/" lib/OpenLayers/SingleFile.js
svn diff;
sleep 10;
svn ci -m "Updating version numbers for $1-$2".
svn cp -m "Tagging the $1-$2 release." http://svn.openlayers.org/branches/openlayers/$1 http://svn.openlayers.org/tags/openlayers/release-$1-$2