forked from hslayers/hslayers-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
executable file
·112 lines (105 loc) · 2.57 KB
/
app.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
'use strict';
import './components/add-layers/add-layers.module';
import './components/datasource-selector/datasource-selector.module';
import './components/draw/draw.module';
import './components/info/info.module';
import './components/measure/measure.module';
import './components/permalink/permalink.module';
import './components/print/print.module';
import './components/query/query.module';
import './components/search/search.module';
import './components/sidebar/sidebar.module';
import './components/styles/styles.module';
import './components/toolbar/toolbar.module';
const mainModuleBs = angular.module('hs', [
'hs.sidebar',
'hs.toolbar',
'hs.layermanager',
'hs.draw',
'hs.map',
'hs.query',
'hs.search',
'hs.print',
'hs.permalink',
'hs.measure',
'hs.legend',
'hs.geolocation',
'hs.core',
'hs.datasource_selector',
'hs.save-map',
'hs.addLayers',
'gettext',
'hs.compositions',
'hs.info',
'hs.styles',
]);
mainModuleBs.directive('hs', (HsConfig, HsCore) => {
'ngInject';
return {
template: require('hslayers.html'),
link: function (scope, element, attrs) {
if (
typeof HsConfig.sizeMode == 'undefined' ||
HsConfig.sizeMode == 'fullscreen'
) {
HsCore.fullScreenMap(element);
}
},
};
});
import * as proj from 'ol/proj';
import Feature from 'ol/Feature';
import GeoJSON from 'ol/format/GeoJSON';
import VectorLayer from 'ol/layer/Vector';
import View from 'ol/View';
import {BingMaps, OSM, TileArcGISRest, TileWMS, WMTS, XYZ} from 'ol/source';
import {GeometryType, LineString, Point, Polygon} from 'ol/geom';
import {Group, Image as ImageLayer, Tile} from 'ol/layer';
import {ImageArcGISRest, ImageWMS} from 'ol/source';
import {Vector} from 'ol/source';
import {Style, Fill, Stroke, Circle} from 'ol/style';
import {register} from 'ol/proj/proj4';
window.ol = {
layer: {
Tile,
Group,
Image: ImageLayer,
Vector: VectorLayer
},
source: {
OSM,
XYZ,
TileWMS,
Vector,
WMTS,
TileArcGISRest,
BingMaps,
ImageWMS,
ImageArcGISRest
},
format: {
GeoJSON
},
style: {
Style,
Fill,
Stroke,
Circle
},
View,
proj
};
if (window.hslayersNgConfig) {
mainModuleBs.value('HsConfig', window.hslayersNgConfig(window.ol));
}
mainModuleBs.controller('Main', ($scope, HsCore, HsMapService, HsConfig) => {
'ngInject';
$scope.HsCore = HsCore;
let lastConfigBuster = HsConfig.buster;
setInterval(() => {
if (lastConfigBuster != HsConfig.buster) {
lastConfigBuster = HsConfig.buster;
HsMapService.reset();
}
}, 100);
});