7
7
<script >
8
8
import { CoordinateSystem , WEBMERCATOR } from ' @/utils/coordinateSystems'
9
9
import { ImageryLayer , Rectangle , WebMapServiceImageryProvider } from ' cesium'
10
- import { WGS84_EXTENT } from ' @/config'
10
+ import { TILEGRID_EXTENT_EPSG_4326 } from ' @/config'
11
11
import { mapState } from ' vuex'
12
12
import { YEAR_TO_DESCRIBE_ALL_OR_CURRENT_DATA } from ' @/api/layers/LayerTimeConfigEntry.class'
13
13
import GeoAdminWMSLayer from ' @/api/layers/GeoAdminWMSLayer.class'
14
14
import addImageryLayerMixins from ' @/modules/map/components/cesium/utils/addImageryLayer-mixins'
15
+ import { getWMSTimestampFromConfig } from ' @/utils/wmsLayerUtils'
15
16
16
17
// todo should we adapt LOD to resolution?
17
18
const MAXIMUM_LEVEL_OF_DETAILS = 18
@@ -20,7 +21,7 @@ export default {
20
21
mixins: [addImageryLayerMixins],
21
22
props: {
22
23
wmsLayerConfig: {
23
- type: [ GeoAdminWMSLayer] ,
24
+ type: GeoAdminWMSLayer,
24
25
required: true ,
25
26
},
26
27
previewYear: {
@@ -53,35 +54,14 @@ export default {
53
54
return this .wmsLayerConfig .format || ' png'
54
55
},
55
56
url () {
56
- return this .wmsLayerConfig .getURL (this . previewYear , this . projection . epsgNumber )
57
+ return this .wmsLayerConfig .getURL ()
57
58
},
58
59
timestamp () {
59
- if (this .wmsLayerConfig .timeConfig ) {
60
- // if there is a preview year set, we search for the matching timestamp
61
- if (this .previewYear ) {
62
- const matchingTimeEntry = this .wmsLayerConfig .getTimeEntryForYear (
63
- this .previewYear
64
- )
65
- if (matchingTimeEntry) {
66
- return matchingTimeEntry .timestamp
67
- }
68
- }
69
- // if a time entry is defined, and is different from 'all'
70
- // (no need to pass 'all' to our WMS, that's the default timestamp used under the hood)
71
- if (
72
- this .wmsLayerConfig .timeConfig .currentYear !==
73
- YEAR_TO_DESCRIBE_ALL_OR_CURRENT_DATA
74
- ) {
75
- return this .wmsLayerConfig .timeConfig .currentTimestamp
76
- }
77
- }
78
- return ' '
60
+ return getWMSTimestampFromConfig (this .wmsLayerConfig )
79
61
},
80
62
/**
81
- * Definition of all relevant URL param for our WMS backends. This is because both
82
- * https://openlayers.org/en/latest/apidoc/module-ol_source_TileWMS-TileWMS.html and
83
- * https://openlayers.org/en/latest/apidoc/module-ol_source_ImageWMS-ImageWMS.html have this
84
- * option.
63
+ * Definition of all relevant URL param for our WMS backends. Passes as parameters to
64
+ * https://cesium.com/learn/cesiumjs/ref-doc/WebMapServiceImageryProvider.html#.ConstructorOptions
85
65
*
86
66
* If we let the URL have all the param beforehand (sending all URL param through the url
87
67
* option), most of our wanted params will be doubled, resulting in longer and more
@@ -111,7 +91,7 @@ export default {
111
91
subdomains: ' 0123' ,
112
92
layers: this .wmsLayerConfig .geoAdminID ,
113
93
maximumLevel: MAXIMUM_LEVEL_OF_DETAILS ,
114
- rectangle: Rectangle .fromDegrees (... WGS84_EXTENT ),
94
+ rectangle: Rectangle .fromDegrees (... TILEGRID_EXTENT_EPSG_4326 ),
115
95
}),
116
96
{
117
97
show: this .wmsLayerConfig .visible ,
0 commit comments