@@ -2,6 +2,7 @@ import proj4 from 'proj4'
2
2
3
3
import { DISABLE_DRAWING_MENU_FOR_LEGACY_ON_HOSTNAMES } from '@/config'
4
4
import { transformLayerIntoUrlString } from '@/router/storeSync/LayerParamConfig.class'
5
+ import { backgroundMatriceBetween2dAnd3d as backgroundMatriceBetweenLegacyAndNew } from '@/store/plugins/2d-to-3d-management.plugin'
5
6
import { LV95 , WEBMERCATOR , WGS84 } from '@/utils/coordinates/coordinateSystems'
6
7
import CustomCoordinateSystem from '@/utils/coordinates/CustomCoordinateSystem.class'
7
8
import SwissCoordinateSystem from '@/utils/coordinates/SwissCoordinateSystem.class'
@@ -51,7 +52,8 @@ const handleLegacyParam = (
51
52
store ,
52
53
newQuery ,
53
54
latlongCoordinates ,
54
- legacyCoordinates
55
+ legacyCoordinates ,
56
+ cameraPosition
55
57
) => {
56
58
const { projection } = store . state . position
57
59
let newValue
@@ -83,9 +85,11 @@ const handleLegacyParam = (
83
85
84
86
case 'lon' :
85
87
latlongCoordinates [ 0 ] = Number ( legacyValue )
88
+ cameraPosition [ 0 ] = Number ( legacyValue )
86
89
break
87
90
case 'lat' :
88
91
latlongCoordinates [ 1 ] = Number ( legacyValue )
92
+ cameraPosition [ 1 ] = Number ( legacyValue )
89
93
break
90
94
91
95
// taking all layers related param aside so that they can be processed later (see below)
@@ -123,6 +127,18 @@ const handleLegacyParam = (
123
127
newValue = legacyValue
124
128
break
125
129
130
+ case 'elevation' :
131
+ cameraPosition [ 2 ] = Number ( legacyValue )
132
+ break
133
+
134
+ case 'pitch' :
135
+ cameraPosition [ 3 ] = Number ( legacyValue )
136
+ break
137
+
138
+ case 'heading' :
139
+ cameraPosition [ 4 ] = Number ( legacyValue )
140
+ break
141
+
126
142
// if no special work to do, we just copy past legacy params to the new viewer
127
143
default :
128
144
newValue = legacyValue
@@ -145,6 +161,7 @@ const handleLegacyParams = (legacyParams, store, to, next) => {
145
161
const { projection } = store . state . position
146
162
let legacyCoordinates = [ ]
147
163
let latlongCoordinates = [ ]
164
+ let cameraPosition = [ ]
148
165
// TODO BGDIINF_SB-2685: remove once legacy prod is decommissioned
149
166
const isOnDevelopmentHost = DISABLE_DRAWING_MENU_FOR_LEGACY_ON_HOSTNAMES . some (
150
167
( hostname ) => hostname === store . state . ui . hostname
@@ -157,9 +174,24 @@ const handleLegacyParams = (legacyParams, store, to, next) => {
157
174
store ,
158
175
newQuery ,
159
176
latlongCoordinates ,
160
- legacyCoordinates
177
+ legacyCoordinates ,
178
+ cameraPosition
161
179
)
162
180
} )
181
+ if ( cameraPosition . length >= 3 ) {
182
+ cameraPosition . push ( '' )
183
+ newQuery [ 'camera' ] = cameraPosition . join ( ',' )
184
+ newQuery [ '3d' ] = true
185
+ newQuery [ 'sr' ] = WEBMERCATOR . epsgNumber
186
+
187
+ // Handle different background layer from legacy 3D parameter
188
+ if ( newQuery [ 'bgLayer' ] ) {
189
+ const newBackgroundLayer = backgroundMatriceBetweenLegacyAndNew [ newQuery [ 'bgLayer' ] ]
190
+ if ( newBackgroundLayer ) {
191
+ newQuery [ 'bgLayer' ] = newBackgroundLayer
192
+ }
193
+ }
194
+ }
163
195
164
196
// Convert legacies coordinates if needed
165
197
if ( latlongCoordinates . length === 2 ) {
@@ -241,7 +273,6 @@ const legacyPermalinkManagementRouterPlugin = (router, store) => {
241
273
// to.query only parse the query after the /#? and legacy params are at the root /?
242
274
const legacyParams =
243
275
window . location && window . location . search ? parseLegacyParams ( window . location . search ) : null
244
-
245
276
router . beforeEach ( ( to , from , next ) => {
246
277
// Waiting for the app to enter the MapView before dealing with legacy param, otherwise
247
278
// the storeSync plugin might overwrite some parameters. To handle legacy param we also
0 commit comments