Skip to content

Commit

Permalink
layermanager: continuous loading of layers in manager
Browse files Browse the repository at this point in the history
before all were added to the manager only when all getCapabilites had answered
  • Loading branch information
fgravin committed Jun 5, 2017
1 parent 27d044b commit 44e89c9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@
return {
require: '^gnLayermanager',
restrict: 'A',
replace: true,
templateUrl: '../../catalog/components/viewer/layermanager/' +
'partials/layermanageritem.html',
scope: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div>
<div ng-if="::!layer.get('loading')">
<button class="btn btn-cog" data-ng-click="showInfo(layer)" title="{{'legend'|translate}}">
<span class="fa fa-paint-brush"></span>
</button>
Expand Down Expand Up @@ -97,3 +97,7 @@ <h6 ng-if="layer.get('attribution')" data-translate="">Attribution</h6>
<div gn-ncwms-transect="" map="map" layer="layer" data-ng-if="layer.ncInfo"/>
</div>
</div>
<div ng-if="::layer.get('loading')">
{{::layer.get('label')}}
<span class="pull-right fa fa-spin fa-spinner"></span>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,28 @@
}
}));
}
} else if (layer.server) {
}
// WMS layer not in background
else if (layer.server) {
var server = layer.server[0];
if (server.service == 'urn:ogc:serviceType:WMS') {
var p = self.createLayer(layer, map, undefined, i);
promises.push(p);
p.then(function(layer) {
overlays[layer.get('tree_index')] = layer;

var loadingLayer = new ol.layer.Image({
loading: true,
label: 'loading',
url: '',
visible: false
});
loadingLayer.displayInLayerManager = true;

var layerIndex = map.getLayers().push(loadingLayer);
var p = self.createLayer(layer, map, undefined, i);

(function(idx) {
p.then(function(layer) {
map.getLayers().setAt(idx, layer);
});
})(layerIndex);
}
}
}
Expand Down Expand Up @@ -234,11 +248,6 @@
firstVisibleBgLayer = false;
}
}
if (overlays.length > 0) {
map.getLayers().extend(overlays.filter(function(l) {
return !!l;
}));
}
});
};

Expand Down
2 changes: 1 addition & 1 deletion web-ui/src/main/resources/catalog/style/gn_viewer.less
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
max-width: ~"calc(100% - 4em)";
overflow-y: auto;
transition: opacity @transition-params;
div[gn-layermanager-item] {
li[gn-layermanager-item] {
.fa-arrows-alt,.gn-layer-ordering {
opacity: 0;
transition: opacity @transition-params;
Expand Down

0 comments on commit 44e89c9

Please sign in to comment.