Skip to content

Commit

Permalink
update layermanager
Browse files Browse the repository at this point in the history
  • Loading branch information
fgravin committed Jun 24, 2014
1 parent cf42993 commit 52e1bc6
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@
var module = angular.module('gn_layermanager_directive', [
]);

/**
* @ngdoc filter
* @name gn_wmsimport_directive.filter:gnReverse
*
* @description
* Filter for the gnLayermanager directive's ngRepeat. The filter
* reverses the array of layers so layers in the layer manager UI
* have the same order as in the map.
*/
module.filter('gnReverse', function() {
return function(items) {
return items.slice().reverse();
};
});

/**
* @ngdoc directive
* @name gn_wmsimport_directive.directive:gnWmsImport
Expand All @@ -24,14 +39,15 @@
},
link: function (scope, element, attrs) {

scope.layers = scope.map.getLayers().getArray();
scope.layerFilterFn = gnLayerFilters.selected;

scope.removeLayerFromMap = function(layer) {
scope.map.removeLayer(layer);
};

scope.moveLayer = function(layer, delta) {
var index = scope.filterLayers.indexOf(layer);
var index = scope.layers.indexOf(layer);
var layersCollection = scope.map.getLayers();
layersCollection.removeAt(index);
layersCollection.insertAt(index + delta, layer);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,37 +1,18 @@
<ul class="list-group">
<li ng-repeat="layer in (map.getLayers().getArray() | filter:layerFilterFn)" class="list-group-item">
<li ng-repeat="layer in (layers | gnReverse | filter:layerFilterFn)" class="list-group-item">
<span class="badge fa fa-cog"></span>

<label for="checkbox">{{layer.label}}</label>
<input id="checkbox" type="checkbox" ng-model="layer.visible" />
<input id="range" type="range" min="0" max="1" step="0.05" ng-model="layer.opacity" />
</li>
</ul>
<label for="checkbox">{{layer.label}}</label>
<input id="checkbox" type="checkbox" ng-model="layer.visible" />
<input id="range" type="range" min="0" max="1" step="0.05" ng-model="layer.opacity" />

<!--
<ul>
<li ng-if="!(filteredLayers = (layers | filter:layerFilter)).length" translate>no_layers_info</li>
<li ng-repeat="layer in filteredLayers" class="ga-layer-folded {{layer.time ? 'ga-layer-time-enabled' : ''}}">
<button type="button" ng-click="toggleVisibility(layer)" class="btn btn-primary btn-xs">&times;</button>
<label class="ga-checkbox">
<input type="checkbox" data-ng-model="layer.visible"/>
<span></span>
{{layer.label}}
</label>
<span class="ga-layer-tools">
<label class="ga-layer-transparency">
<span translate>transparency</span>&nbsp;
<input type="range" min="0" max="1" step="0.05" value="1" ng-model="layer.invertedOpacity"/>
</select>
</label>
<a href="#" class="ga-layer-info" ng-click="displayLayerMetadata($event, layer)"><i class="fa fa-info-circle"></i></a>
<div class="ga-layer-ordering">
<a href="#" class="fa fa-arrow-up" ng-if="!$first" ng-click="moveLayer(layer, 1)"></a>
<i class="fa fa-arrow-up" ng-if="$first"></i>
<a href="#" class="icon-arrow-down" ng-if="!$last" ng-click="moveLayer(layer, -1)"></a>
<i class="fa fa-arrow-down" ng-if="$last"></i>
</div>
</span>
<i class="icon-gear"></i>
<div>
<a href="#" class="fa fa-arrow-up" ng-if="!$first" ng-click="moveLayer(layer, 1)"></a>
<i class="fa fa-arrow-up" ng-if="$first"></i>
<a href="#" class="fa fa-arrow-down" ng-if="!$last" ng-click="moveLayer(layer, -1)"></a>
<i class="fa fa-arrow-down" ng-if="$last"></i>
</div>

<button type="button" ng-click="removeLayerFromMap(layer)" class="btn btn-primary btn-xs">&times;</button>
</li>
</ul>-->
</ul>
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
<span class="fa fa-tasks"></span>
<span role="tooltip">Couches</span>
</button>
<button class="btn btn-default" type="submit" rel="#measures">
<span class="fa fa-pencil"></span>
<span role="tooltip">Mesures</span>
</button>
<div gn-measure="" gn-measure-map="map"></div>
<button class="btn btn-default" type="submit" rel="#contexts">
<span class="fa fa-book"></span>
<span role="tooltip">Contextes</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
'http://ids.pigma.org/geoserver/ign/wms',
'http://www.ifremer.fr/services/wms/oceanographie_physique'
];
scope.url = 'http://www.ifremer.fr/services/wms/oceanographie_physique';

scope.load = function (url) {
gnOwsCapabilities.getCapabilities(url)
.then(function (layers) {
Expand Down
1 change: 1 addition & 0 deletions web-ui/src/main/resources/catalog/lib/ngeo.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 52e1bc6

Please sign in to comment.