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
+9
View File
@@ -54,6 +54,7 @@ describe('ol.layer.Group', function() {
managed: true,
sourceState: ol.source.State.READY,
extent: undefined,
zIndex: 0,
maxResolution: Infinity,
minResolution: 0
});
@@ -160,6 +161,7 @@ describe('ol.layer.Group', function() {
opacity: 0.5,
saturation: 5,
visible: false,
zIndex: 10,
maxResolution: 500,
minResolution: 0.25
});
@@ -183,6 +185,7 @@ describe('ol.layer.Group', function() {
managed: true,
sourceState: ol.source.State.READY,
extent: undefined,
zIndex: 10,
maxResolution: 500,
minResolution: 0.25
});
@@ -235,6 +238,7 @@ describe('ol.layer.Group', function() {
managed: true,
sourceState: ol.source.State.READY,
extent: groupExtent,
zIndex: 0,
maxResolution: 500,
minResolution: 0.25
});
@@ -266,6 +270,7 @@ describe('ol.layer.Group', function() {
layerGroup.setOpacity(0.3);
layerGroup.setSaturation(0.3);
layerGroup.setVisible(false);
layerGroup.setZIndex(10);
var groupExtent = [-100, 50, 100, 50];
layerGroup.setExtent(groupExtent);
layerGroup.setMaxResolution(500);
@@ -281,6 +286,7 @@ describe('ol.layer.Group', function() {
managed: true,
sourceState: ol.source.State.READY,
extent: groupExtent,
zIndex: 10,
maxResolution: 500,
minResolution: 0.25
});
@@ -304,6 +310,7 @@ describe('ol.layer.Group', function() {
managed: true,
sourceState: ol.source.State.READY,
extent: undefined,
zIndex: 0,
maxResolution: Infinity,
minResolution: 0
});
@@ -325,6 +332,7 @@ describe('ol.layer.Group', function() {
managed: true,
sourceState: ol.source.State.READY,
extent: undefined,
zIndex: 0,
maxResolution: Infinity,
minResolution: 0
});
@@ -500,6 +508,7 @@ describe('ol.layer.Group', function() {
managed: true,
sourceState: ol.source.State.READY,
extent: undefined,
zIndex: 0,
maxResolution: 150,
minResolution: 0.25
});