-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
131 lines (116 loc) · 4.54 KB
/
config.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
* Copyright (C) 2001-2016 Food and Agriculture Organization of the
* United Nations (FAO-UN), United Nations World Food Programme (WFP)
* and United Nations Environment Programme (UNEP)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
* Rome - Italy. email: [email protected]
*/
(function() {
goog.provide('gn_search_inspireportal_config');
var module = angular.module('gn_search_inspireportal_config', []);
module.value('gnTplResultlistLinksbtn',
'../../catalog/views/inspireportal/directives/partials/linksbtn.html');
module
.run([
'gnSearchSettings',
'gnViewerSettings',
'gnOwsContextService',
'gnMap',
'gnMapsManager',
'gnDefaultGazetteer',
function(searchSettings, viewerSettings, gnOwsContextService,
gnMap, gnMapsManager, gnDefaultGazetteer) {
if(viewerSettings.mapConfig.viewerMapLayers) {
console.warn('[geonetwork] Use of "mapConfig.viewerMapLayers" is deprecated. ' +
'Please configure layer per map type.')
}
// Keep one layer in the background
// while the context is not yet loaded.
viewerSettings.bgLayers = [
gnMap.createLayerForType('osm')
];
viewerSettings.servicesUrl =
viewerSettings.mapConfig.listOfServices || {};
// WMS settings
// If 3D mode is activated, single tile WMS mode is
// not supported by olcesium, so force tiling.
if (viewerSettings.mapConfig.is3DModeAllowed) {
viewerSettings.singleTileWMS = false;
// Configure Cesium to use a proxy. This is required when
// WMS does not have CORS headers. BTW, proxy will slow
// down rendering.
viewerSettings.cesiumProxy = true;
} else {
viewerSettings.singleTileWMS = true;
}
var bboxStyle = new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(255,0,0,1)',
width: 2
}),
fill: new ol.style.Fill({
color: 'rgba(255,0,0,0.3)'
})
});
searchSettings.olStyles = {
drawBbox: bboxStyle,
mdExtent: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'orange',
width: 2
})
}),
mdExtentHighlight: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'orange',
width: 3
}),
fill: new ol.style.Fill({
color: 'rgba(255,255,0,0.3)'
})
})
};
gnMapsManager.initProjections(viewerSettings.mapConfig.switcherProjectionList);
var searchMap = gnMapsManager.createMap(gnMapsManager.SEARCH_MAP);
var viewerMap = gnMapsManager.createMap(gnMapsManager.VIEWER_MAP);
// To configure a gazetteer provider
viewerSettings.gazetteerProvider = gnDefaultGazetteer;
// Map protocols used to load layers/services in the map viewer
searchSettings.mapProtocols = {
layers: [
'OGC:WMS',
'OGC:WMTS',
'OGC:WMS-1.1.1-http-get-map',
'OGC:WMS-1.3.0-http-get-map',
'OGC:WFS',
'ESRI:REST'
],
services: [
'OGC:WMS-1.3.0-http-get-capabilities',
'OGC:WMS-1.1.1-http-get-capabilities',
'OGC:WMTS-1.0.0-http-get-capabilities',
'OGC:WFS-1.0.0-http-get-capabilities'
]
};
// Set custom config in gnSearchSettings
angular.extend(searchSettings, {
viewerMap: viewerMap,
searchMap: searchMap
});
}]);
})();