1- /* eslint-disable max-lines-per-function */
21import client from '@polar/core'
32import merge from 'lodash.merge'
43import packageInfo from '../package.json'
@@ -9,6 +8,7 @@ import { getMapConfiguration } from './mapConfigurations/mapConfig'
98import { CONTENT_ENUM } from './plugins/Modal/store'
109import './styles.css'
1110import { zoomToFeatureById } from './utils/zoomToFeatureById'
11+ import { DishUrlParams } from './types'
1212
1313// eslint-disable-next-line no-console
1414console . log ( `DISH map client running in version ${ packageInfo . version } .` )
@@ -37,27 +37,9 @@ export default {
3737 // using naming from backend to avoid multiple names for same thing
3838 const objektId = parameters . get ( 'ObjektID' )
3939 if ( mode === 'INTERN' ) {
40- map . subscribe ( 'plugin/export/exportedMap' , ( screenshot ) => {
41- if ( screenshot ) {
42- const newWindow = window . open ( )
43- newWindow ?. document . write (
44- `<img src="${ screenshot } " alt="Screenshot">`
45- )
46- }
47- } )
40+ subscribeToExportedMap ( map )
4841 if ( typeof objektId === 'string' && objektId !== '' ) {
49- zoomToFeatureById (
50- map ,
51- objektId ,
52- `${ urlParams . internServicesBaseUrl } /wfs` ,
53- {
54- fieldName : 'objektid' ,
55- featurePrefix : 'app' ,
56- typeName : 'TBLGIS_ORA' ,
57- xmlns : 'http://www.deegree.org/app' ,
58- useRightHandWildcard : false ,
59- }
60- )
42+ zoomToInternalFeature ( map , objektId , urlParams )
6143 }
6244 } else if ( typeof objektId === 'string' && mode === 'EXTERN' ) {
6345 navigateToDenkmal ( map , objektId )
@@ -73,3 +55,31 @@ export default {
7355 } )
7456 } ,
7557}
58+
59+ function subscribeToExportedMap ( instance ) {
60+ instance . subscribe ( 'plugin/export/exportedMap' , ( screenshot ) => {
61+ if ( screenshot ) {
62+ const newWindow = window . open ( )
63+ newWindow ?. document . write ( `<img src="${ screenshot } " alt="Screenshot">` )
64+ }
65+ } )
66+ }
67+
68+ function zoomToInternalFeature (
69+ instance ,
70+ objektId : string ,
71+ urlParams : DishUrlParams
72+ ) {
73+ zoomToFeatureById (
74+ instance ,
75+ objektId ,
76+ `${ urlParams . internServicesBaseUrl } /wfs` ,
77+ {
78+ fieldName : 'objektid' ,
79+ featurePrefix : 'app' ,
80+ typeName : 'TBLGIS_ORA' ,
81+ xmlns : 'http://www.deegree.org/app' ,
82+ useRightHandWildcard : false ,
83+ }
84+ )
85+ }
0 commit comments