-
Notifications
You must be signed in to change notification settings - Fork 88
/
displayquerygrid.js
193 lines (167 loc) · 5.37 KB
/
displayquerygrid.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
// The MIT License (MIT)
//
// Copyright (c) 2016-2024 Camptocamp SA
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import angular from 'angular';
import './displayquerygrid.css';
import './gmf-hidden.inc.css';
import gmfDatasourceManager from 'gmf/datasource/Manager';
import gmfLayertreeComponent from 'gmf/layertree/component';
import gmfMapComponent from 'gmf/map/component';
import ngeoMapFeatureOverlayMgr from 'ngeo/map/FeatureOverlayMgr';
import gmfQueryGridComponent from 'gmf/query/gridComponent';
import gmfThemeManager from 'gmf/theme/Manager';
import gmfThemeThemes from 'gmf/theme/Themes';
import ngeoGridModule from 'ngeo/grid/module';
import ngeoMapModule from 'ngeo/map/module';
import ngeoMiscBtnComponent from 'ngeo/misc/btnComponent';
import EPSG2056 from 'ngeo/proj/EPSG_2056';
import ngeoQueryComponent from 'ngeo/query/component';
import olMap from 'ol/Map';
import olView from 'ol/View';
import olLayerTile from 'ol/layer/WebGLTile';
import olSourceOSM from 'ol/source/OSM';
import options from './options';
/**
* @type {angular.IModule}
* @hidden
*/
const myModule = angular.module('gmfapp', [
'gettext',
gmfDatasourceManager.name,
gmfLayertreeComponent.name,
gmfMapComponent.name,
gmfQueryGridComponent.name,
gmfThemeManager.name,
gmfThemeThemes.name,
ngeoGridModule.name,
ngeoMapModule.name, // for ngeo.map.FeatureOverlay, perhaps remove me
ngeoMiscBtnComponent.name,
ngeoQueryComponent.name,
]);
/**
* Demo, NOT USED.
* A sample component to display the result.
*
* @type {angular.IComponentOptions}
* @hidden
*/
const queryresultComponent = {
controller: 'gmfappQueryresultController',
// @ts-ignore: webpack
template: require('./partials/queryresult.html'),
};
myModule.component('gmfappQueryresult', queryresultComponent);
/**
* Demo, NOT USED.
*
* @param {import('ngeo/query/MapQuerent').QueryResult} ngeoQueryResult Query service.
* @class
* @ngInject
*/
function QueryresultController(ngeoQueryResult) {
/**
* @type {import('ngeo/query/MapQuerent').QueryResult}
*/
this.result = ngeoQueryResult;
}
myModule.controller('gmfappQueryresultController', QueryresultController);
/**
* @class
* @param {import('gmf/theme/Themes').ThemesService} gmfThemes The gmf themes service.
* @param {import('gmf/datasource/Manager').DatasourceManager} gmfDataSourcesManager The gmf
* data sources manager service.
* @param {import('gmf/theme/Manager').ThemeManagerService} gmfThemeManager gmf Theme Manager service.
* @param {string} defaultTheme The default theme.
* @ngInject
*/
function MainController(gmfThemes, gmfDataSourcesManager, gmfThemeManager, defaultTheme) {
gmfThemes.loadThemes();
/**
* @type {import('ol/Map').default}
*/
this.map = new olMap({
layers: [
new olLayerTile({
source: new olSourceOSM(),
}),
],
view: new olView({
projection: EPSG2056,
resolutions: [200, 100, 50, 20, 10, 5, 2.5, 2, 1, 0.5],
center: [2537635, 1152640],
zoom: 3,
}),
});
/**
* @type {Object<string, string>}
*/
this.dimensions = {};
// Init the datasources with our map.
gmfDataSourcesManager.setDatasourceMap(this.map);
// Give the dimensions to the gmfDataSourcesManager
gmfDataSourcesManager.setDimensions(this.dimensions);
/**
* @type {boolean}
*/
this.queryActive = true;
/**
* @type {import('gmf/themes').GmfTheme[]|undefined}
* export
*/
this.themes = undefined;
/**
* @type {import('gmf/themes').GmfTheme} The selected theme.
*/
this.selectedTheme = null;
this.updateTheme = function () {
gmfThemeManager.addTheme(this.selectedTheme);
};
/**
* @type {boolean}
*/
this.queryGridActive = true;
gmfThemes.getThemesObject().then((themes) => {
if (themes) {
this.themes = themes;
// Select default theme;
themes.forEach((theme) => {
if (theme.name === defaultTheme) {
this.selectedTheme = theme;
return;
}
});
}
});
ngeoMapFeatureOverlayMgr.init(this.map);
}
myModule.controller('MainController', MainController);
myModule.constant('gmfDisplayQueryGridOptions', {
featuresStyle: {
fill: {color: [255, 170, 0, 0.6]},
circle: {
fill: {color: [255, 170, 0, 0.6]},
radius: 5,
stroke: {color: [255, 170, 0, 1], width: 2},
},
stroke: {color: [255, 170, 0, 1], width: 2},
},
});
options(myModule);
export default myModule;