Add Z-index to layers

This commit allows setting a z-index property on the layers and uses
it in the canvas, WEBGL and DOM map renderers for ordering the layers
before rendering.

Default z-index is 0 for managed layers and 1000 for unmanaged ones.
It allows always on bottom, always on top and more complex layer layouts.
This commit is contained in:
Guillaume Beraudo
2015-09-01 17:47:47 +02:00
parent 34f65a8908
commit 3811228ac7
11 changed files with 216 additions and 0 deletions
+30
View File
@@ -2927,6 +2927,7 @@ olx.layer;
* saturation: (number|undefined),
* visible: (boolean|undefined),
* extent: (ol.Extent|undefined),
* zIndex: (number|undefined),
* minResolution: (number|undefined),
* maxResolution: (number|undefined)}}
* @api
@@ -2991,6 +2992,15 @@ olx.layer.BaseOptions.prototype.visible;
olx.layer.BaseOptions.prototype.extent;
/**
* The z-index for layer rendering. At rendering time, the layers will be
* ordered, first by Z-index and then by position. The default Z-index is 0.
* @type {number|undefined}
* @api
*/
olx.layer.BaseOptions.prototype.zIndex;
/**
* The minimum resolution (inclusive) at which this layer will be visible.
* @type {number|undefined}
@@ -3016,6 +3026,7 @@ olx.layer.BaseOptions.prototype.maxResolution;
* source: (ol.source.Source|undefined),
* visible: (boolean|undefined),
* extent: (ol.Extent|undefined),
* zIndex: (number|undefined),
* minResolution: (number|undefined),
* maxResolution: (number|undefined)}}
* @api
@@ -3090,6 +3101,15 @@ olx.layer.LayerOptions.prototype.visible;
olx.layer.LayerOptions.prototype.extent;
/**
* The z-index for layer rendering. At rendering time, the layers will be
* ordered, first by Z-index and then by position. The default Z-index is 0.
* @type {number|undefined}
* @api
*/
olx.layer.LayerOptions.prototype.zIndex;
/**
* The minimum resolution (inclusive) at which this layer will be visible.
* @type {number|undefined}
@@ -3114,6 +3134,7 @@ olx.layer.LayerOptions.prototype.maxResolution;
* saturation: (number|undefined),
* visible: (boolean|undefined),
* extent: (ol.Extent|undefined),
* zIndex: (number|undefined),
* minResolution: (number|undefined),
* maxResolution: (number|undefined),
* layers: (Array.<ol.layer.Base>|ol.Collection.<ol.layer.Base>|undefined)}}
@@ -3179,6 +3200,15 @@ olx.layer.GroupOptions.prototype.visible;
olx.layer.GroupOptions.prototype.extent;
/**
* The z-index for layer rendering. At rendering time, the layers will be
* ordered, first by Z-index and then by position. The default Z-index is 0.
* @type {number|undefined}
* @api
*/
olx.layer.GroupOptions.prototype.zIndex;
/**
* The minimum resolution (inclusive) at which this layer will be visible.
* @type {number|undefined}