-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathtoolAddLayerService.js
39 lines (37 loc) · 1.36 KB
/
toolAddLayerService.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
(function (angular) {
'use strict';
/**
* @memberof spApp
* @ngdoc service
* @name ToolAddLayerService
* @description
* Client side tool to add spatial-service layers to the map
*/
angular.module('tool-add-layer-service', [])
.factory("ToolAddLayerService", ["$http", "$q", "MapService", "LayersService", function ($http, $q, MapService, LayersService) {
return {
// Override text with view-config.json
spec: {
"input": [
{
"description": $i18n(298),
"type": "layer",
"constraints": {
"min": 1,
"optional": false
}
}],
"description": $i18n(415)
},
execute: function (inputs) {
var promises = [];
for (var i = 0; i < inputs[0].length; i++) {
var item = LayersService.convertFieldIdToMapLayer(inputs[0][i])
item.log = false
promises.push(MapService.add(item))
}
return $q.all(promises)
}
};
}])
}(angular));