Compare commits
	
		
			325 Commits
		
	
	
		
			AW-4620
			...
			8f958e33f1
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 8f958e33f1 | |||
| aa2f305b27 | |||
|  | d02da8f334 | ||
| 253553c534 | |||
| 4641e351fd | |||
|  | 84cf6a3f6e | ||
| 92b29135b5 | |||
|  | f6aebb2f80 | ||
| daf78f32b7 | |||
| 42245612d2 | |||
| a05c1fa874 | |||
| 4bda94c360 | |||
| feaad02c33 | |||
| af9acebaff | |||
|  | 7ba35052ec | ||
| 2e40d023b1 | |||
|  | 4d5ed915ad | ||
| 2fb5967c26 | |||
|  | 820543913f | ||
| ce2f06091b | |||
|  | 5714cdce72 | ||
| 10e43e1ea5 | |||
| 8fa84c6ea8 | |||
|  | 9f872d0af0 | ||
| f6bed668f6 | |||
| f70e30204d | |||
| 7339b91328 | |||
| 88667b3986 | |||
| a996caa73b | |||
| ed6f8f4231 | |||
| 94ef2e269b | |||
| da624f0535 | |||
| 3da646dc4d | |||
| 778e40a26d | |||
|  | 94ff567567 | ||
| b20ab34859 | |||
| 1988b3f74d | |||
| b0587bc4c3 | |||
| 681d372ef3 | |||
| b1922cdb10 | |||
|  | 5774bff8df | ||
| 6254a3be98 | |||
|  | 7943cefddf | ||
| a2a287961c | |||
| 8e8f18ad7c | |||
|  | 5cbb6f32f9 | ||
| b2469f731e | |||
|  | beb439469f | ||
| ef49f62ca2 | |||
|  | 67abc67d9a | ||
|  | 1f7f410916 | ||
| 2f176be8c6 | |||
| 1118c5ca60 | |||
|  | c7831d1d87 | ||
| 31c5e0cb52 | |||
|  | c6a632894d | ||
| e652c7bb5b | |||
| 818e04d1f3 | |||
|  | ebbac409a0 | ||
| 5cc976ddd3 | |||
| 38eae3263e | |||
|  | a3eb2d9617 | ||
| 03e3c7ad95 | |||
| 8fd8675260 | |||
| 187811e4e2 | |||
| 8e304fc6eb | |||
|  | 127dc44917 | ||
|  | aa5a8f0843 | ||
|  | a10aca92f1 | ||
|  | e42e94fcf7 | ||
|  | 2b83ccad1f | ||
|  | e31d428c4b | ||
|  | 429e54ef8d | ||
|  | 02e13337bf | ||
|  | b4eb7aaeac | ||
|  | 7e21c725d8 | ||
|  | dd889ea7cc | ||
|  | 4dab5a00b1 | ||
|  | 5cc58e8988 | ||
|  | 0944e595d3 | ||
|  | 32bebec0df | ||
|  | c0cf210600 | ||
|  | f85a27a8e5 | ||
|  | 88ae8b829f | ||
|  | fcb60ed8bc | ||
|  | 3d535507fb | ||
|  | e89bdac47d | ||
|  | 4038702841 | ||
|  | 7ced2d2a7b | ||
|  | c53981f4a6 | ||
|  | 076dec27d5 | ||
|  | 5354aa8d0a | ||
|  | 12143c8e69 | ||
|  | 50519e9236 | ||
|  | 7f6d007c04 | ||
|  | 98be4f05cc | ||
|  | 79558e2168 | ||
|  | b966241997 | ||
|  | 60a7384f88 | ||
|  | 76f225b996 | ||
|  | 37a25c6b29 | ||
|  | 6c45842387 | ||
|  | d37b0866d5 | ||
|  | 270f244128 | ||
|  | ebddf688c6 | ||
|  | f1c572ecc9 | ||
|  | af5361b6c3 | ||
|  | 6daf0eab4a | ||
|  | 66fe0e9534 | ||
|  | 75ccc6dda4 | ||
|  | e45ec785d7 | ||
|  | b067b50937 | ||
|  | 0c2e6364ac | ||
|  | b232fb2c8e | ||
|  | 4a19694c1a | ||
|  | af766abe54 | ||
|  | 6333d78eab | ||
|  | c06fe315d8 | ||
|  | bc1f44f0b7 | ||
|  | 95bb8da8b7 | ||
|  | 68f8ff9cdd | ||
|  | 9e122fefd3 | ||
|  | b47ead21be | ||
|  | ebe43c3b27 | ||
|  | 686084f5cf | ||
|  | 0abaf15101 | ||
|  | 9dd2b5cdb5 | ||
|  | 2246a98bbb | ||
|  | 6265b66baf | ||
|  | 5488206588 | ||
|  | b4f2042aa0 | ||
|  | 21dca2163b | ||
|  | 2bc02323ae | ||
|  | 8b073fb855 | ||
|  | 5d28b547a1 | ||
|  | f2407dc12a | ||
|  | f02b317cf4 | ||
|  | 270b774c33 | ||
|  | 864b72c82c | ||
|  | c5716b0102 | ||
|  | ad097121da | ||
|  | 79b33cff50 | ||
|  | e01417f3b3 | ||
|  | 68ffc6f7d9 | ||
|  | ef7cf410b9 | ||
|  | 151ba2563e | ||
|  | 78f4dca9a1 | ||
|  | 52bf963afd | ||
|  | e6cfb85b8e | ||
|  | 6576e7cb6d | ||
|  | 7d7528ab4c | ||
|  | 34a79ec833 | ||
|  | 6cd5b0e5d7 | ||
|  | 412ddc01d1 | ||
|  | 10edf0728b | ||
|  | 57189ce4df | ||
|  | e72f933014 | ||
|  | 782e7adb00 | ||
|  | 17b78476ee | ||
|  | 93630d5a09 | ||
|  | 79f09d0e0e | ||
|  | 02016eb404 | ||
|  | 59760ad201 | ||
|  | 6eca90abb6 | ||
|  | b853b4d3f7 | ||
|  | 6e815e3442 | ||
|  | befa82d0f6 | ||
|  | 5df0e6e423 | ||
|  | 669f93a327 | ||
|  | 73ff1fd47f | ||
|  | e07c3aeb3d | ||
|  | 700b29c3d1 | ||
|  | 0ffdbfd3ca | ||
|  | 756db80b77 | ||
|  | b2559be980 | ||
|  | a9754a8eff | ||
|  | d5961d4c96 | ||
|  | 56e35345fc | ||
|  | 9755f5a635 | ||
|  | 2ff1aff9f3 | ||
|  | 164ac7e3ad | ||
|  | 85a7e890bd | ||
|  | 8766293966 | ||
|  | d2cad491b9 | ||
|  | 16d2c6abae | ||
|  | a212b59d73 | ||
|  | 3574e34659 | ||
|  | 13704c6845 | ||
|  | bbe337d115 | ||
|  | e1b6e59b6a | ||
|  | 3685644888 | ||
|  | 050adcbc0f | ||
|  | 0a12005d5d | ||
|  | 8a4644049b | ||
|  | ca7e5e03be | ||
|  | a1ceabec47 | ||
|  | 917b875732 | ||
|  | 7df2004671 | ||
|  | c50a79d723 | ||
|  | 519d789281 | ||
|  | b5038e9661 | ||
|  | bab69698c6 | ||
|  | 5c6ea6a391 | ||
|  | 328edc396b | ||
|  | 9cd8b81149 | ||
|  | 80e1f8042e | ||
|  | 1a1bdb314e | ||
|  | 51ec1bd3b4 | ||
|  | c8440ca536 | ||
|  | 889d1b4f9e | ||
|  | 97b458e812 | ||
|  | 0378565b88 | ||
|  | 8ca8874707 | ||
|  | dc2772aabf | ||
|  | ce0e561a3f | ||
|  | ba9aab03a9 | ||
|  | f10686423d | ||
|  | c1688f68c2 | ||
|  | c916b2f155 | ||
|  | 5df9ac295d | ||
|  | 065a45dc98 | ||
|  | 6b66777699 | ||
|  | 9927ba0929 | ||
|  | a05a29703c | ||
|  | 76952cac67 | ||
|  | 9b27a997f3 | ||
|  | 014e3143fd | ||
|  | 7eaf1686e1 | ||
|  | d4bf2a6667 | ||
|  | 9d7cf637ee | ||
|  | 979f80ce89 | ||
|  | c677a9b639 | ||
|  | 9440b91d90 | ||
|  | 2b18167761 | ||
|  | da8b2f1d3a | ||
|  | 10e4e6abc6 | ||
|  | 6acfe7c32f | ||
|  | d08c1b2008 | ||
|  | a47e1d9a63 | ||
|  | 4187522739 | ||
|  | c0d0088f6e | ||
|  | d43dff3085 | ||
|  | 9a04e1f848 | ||
|  | 621773a6f1 | ||
|  | a9672c44bf | ||
|  | 155c212f89 | ||
|  | ee35c3f1b8 | ||
|  | 0a405f5515 | ||
|  | b618b7c40f | ||
|  | f10e68c4ad | ||
|  | 870c3c2c77 | ||
|  | 1559f15c7f | ||
|  | 96345e54fb | ||
|  | f61590c677 | ||
|  | 6f1ec4a17a | ||
|  | 786e9392b1 | ||
|  | f229c25b8f | ||
|  | 9bdd1ff35f | ||
|  | 4dd7a15b30 | ||
|  | a4aa7dbb7d | ||
|  | 681d2fe273 | ||
| 78b7ef44d9 | |||
| e19ca94653 | |||
|  | a85378374b | ||
| 9e3f6010c3 | |||
| e6a637b866 | |||
|  | ccf77805a0 | ||
| 2b2e1bfafa | |||
| 3fd4ac2f94 | |||
| 9849eaf1e7 | |||
| b516cc07e2 | |||
| c9c9a2ddbf | |||
| 1d0f3b958d | |||
| 45537cb2e9 | |||
| 652ddc0cdc | |||
| fd3b331cc0 | |||
| 9facbe76c8 | |||
| 20dff38cf7 | |||
| e374bb8a73 | |||
| 294b9c6dd3 | |||
| d92bf54c8d | |||
| 914e272fc2 | |||
|  | b182b7fda6 | ||
|  | 22040b43b3 | ||
|  | 50170cf599 | ||
|  | 2deff46a7e | ||
|  | e939a787ba | ||
|  | 4ae9562ce1 | ||
|  | 288e507e6c | ||
| d9848a8ba3 | |||
| a9d42484cc | |||
| a276593c7f | |||
| ff50650c28 | |||
| d7efeb8d59 | |||
| fd71d1f38e | |||
| bc8c9f8bf9 | |||
| 0865ca1a93 | |||
| 1bc3983f55 | |||
| 945d88839f | |||
| 7c06343909 | |||
| b8f8f27794 | |||
| 2a31771ac6 | |||
| 3f17341b2e | |||
| 6165f523cc | |||
| 19dce51a28 | |||
| b29cd8e4c9 | |||
|  | f2e265391c | ||
|  | 3c7adf012f | ||
| 7c8c16362c | |||
| 6555e68145 | |||
| 945c641503 | |||
| 60bc4c1a10 | |||
| 7b42ca252b | |||
| 9ef6c4d308 | |||
|  | ed7f7923ca | ||
|  | 98142fab56 | ||
|  | c460d31522 | ||
|  | 4c5b89852b | ||
|  | fa90eaf1af | ||
| aeded938bd | |||
| c61a4fe7f4 | |||
| 8c3c40cfe6 | |||
| e6e10c835e | |||
| 07a87175b4 | |||
| e9ace73ddd | 
							
								
								
									
										22
									
								
								.eslintrc.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								.eslintrc.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| module.exports = { | ||||
|     "env": { | ||||
|         "browser": true, | ||||
|         "es2021": true | ||||
|     }, | ||||
|     "extends": [ | ||||
|         "eslint:recommended", | ||||
|         "plugin:@typescript-eslint/recommended" | ||||
|     ], | ||||
|     "overrides": [ | ||||
|     ], | ||||
|     "parser": "@typescript-eslint/parser", | ||||
|     "parserOptions": { | ||||
|         "ecmaVersion": "latest", | ||||
|         "sourceType": "module" | ||||
|     }, | ||||
|     "plugins": [ | ||||
|         "@typescript-eslint" | ||||
|     ], | ||||
|     "rules": { | ||||
|     } | ||||
| } | ||||
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -49,3 +49,7 @@ Thumbs.db | ||||
| projects/common/node_modules/ | ||||
| projects/common-map/node_modules/ | ||||
| .angular/* | ||||
| projects/common-map3d/node_modules/ | ||||
| projects/common-map/node_modules/ | ||||
| projects/ngx-openlayers/node_modules/ | ||||
| projects/common/node_modules/ | ||||
|   | ||||
							
								
								
									
										76
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										76
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							| @@ -1,54 +1,24 @@ | ||||
| pipeline { | ||||
|   agent any | ||||
|   environment { | ||||
|      PACKAGE_VERSION_PREFIX=sh(script: 'jq .version package.json |sed "s/\\"//g"', returnStdout: true).trim() | ||||
|      PACKAGE_VERSION="${PACKAGE_VERSION_PREFIX}" | ||||
|   } | ||||
|   stages { | ||||
|     stage('npm install'){ | ||||
|       steps { | ||||
|         sh '''rm -rf node_modules/ | ||||
|         npm install --legacy-peer-deps | ||||
|         cd projects/common | ||||
|         npm install --legacy-peer-deps | ||||
|         cd ../common-map | ||||
|         npm install --legacy-peer-deps | ||||
|         cd ../common-map3d | ||||
|         npm install --legacy-peer-deps | ||||
|         ''' | ||||
|       } | ||||
|     } | ||||
|     stage('build'){ | ||||
|       steps { | ||||
|         sh '''ng build common --configuration production | ||||
|         ng build common-map --configuration production | ||||
|         ng build common-map3d --configuration production''' | ||||
|       } | ||||
|     } | ||||
|     stage('npm publish'){ | ||||
|       steps { | ||||
|         sh '''cd dist/common | ||||
|         npm version ${PACKAGE_VERSION} --allow-same-version | ||||
|         npm publish | ||||
|         cd ../common-map | ||||
|         npm version ${PACKAGE_VERSION} --allow-same-version | ||||
|         npm publish | ||||
|         cd ../common-map3d | ||||
|         npm version ${PACKAGE_VERSION} --allow-same-version | ||||
|         npm publish''' | ||||
|       } | ||||
|     } | ||||
|  | ||||
|   } | ||||
|   post { | ||||
|     always { | ||||
|       emailext ( | ||||
|         body: '${DEFAULT_CONTENT}', | ||||
|         mimeType: 'text/html', | ||||
|         replyTo: '${DEFAULT_REPLYTO}', | ||||
|         subject: '${DEFAULT_SUBJECT}', | ||||
|         to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']]) | ||||
|       ) | ||||
|     } | ||||
|   } | ||||
| @Library('farmmaps-shared-library') _ | ||||
|  | ||||
| pipeline { | ||||
|   agent any; | ||||
|   options { | ||||
|     copyArtifactPermission projectNames: env.allProjectsArtifactPermission; | ||||
|     disableConcurrentBuilds(); | ||||
|   } | ||||
|   stages { | ||||
|     stage('FarmmapsLibBuildAll') { | ||||
|       steps { | ||||
|         stepFarmmapsLibBuildAll(); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   post { | ||||
|     success { | ||||
|       postSuccess(); | ||||
|     } | ||||
|     always { | ||||
|       postAlways(); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @@ -1,54 +1,24 @@ | ||||
| pipeline { | ||||
|   agent any | ||||
|   environment { | ||||
|      PACKAGE_VERSION_PREFIX=sh(script: 'jq .version package.json |sed "s/\\"//g"', returnStdout: true).trim() | ||||
|      PACKAGE_VERSION="${PACKAGE_VERSION_PREFIX + '-prerelease.' + env.BUILD_NUMBER}" | ||||
|   } | ||||
|   stages { | ||||
|     stage('npm install'){ | ||||
|       steps { | ||||
|         sh '''rm -rf node_modules/ | ||||
|         npm install --legacy-peer-deps | ||||
|         cd projects/common | ||||
|         npm install --legacy-peer-deps | ||||
|         cd ../common-map | ||||
|         npm install --legacy-peer-deps | ||||
|         cd ../common-map3d | ||||
|         npm install --legacy-peer-deps | ||||
|         ''' | ||||
|       } | ||||
|     } | ||||
|     stage('build'){ | ||||
|       steps { | ||||
|         sh '''ng build common --configuration production | ||||
|         ng build common-map --configuration production | ||||
|         ng build common-map3d --configuration production''' | ||||
|       } | ||||
|     } | ||||
|     stage('npm publish'){ | ||||
|       steps { | ||||
|         sh '''cd dist/common | ||||
|         npm version ${PACKAGE_VERSION} | ||||
|         npm publish | ||||
|         cd ../common-map | ||||
|         npm version ${PACKAGE_VERSION} | ||||
|         npm publish | ||||
|         cd ../common-map3d | ||||
|         npm version ${PACKAGE_VERSION} | ||||
|         npm publish''' | ||||
|       } | ||||
|     } | ||||
|  | ||||
|   } | ||||
|   post { | ||||
|     always { | ||||
|       emailext ( | ||||
|         body: '${DEFAULT_CONTENT}', | ||||
|         mimeType: 'text/html', | ||||
|         replyTo: '${DEFAULT_REPLYTO}', | ||||
|         subject: '${DEFAULT_SUBJECT}', | ||||
|         to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']]) | ||||
|       ) | ||||
|     } | ||||
|   } | ||||
| @Library('farmmaps-shared-library') _ | ||||
|  | ||||
| pipeline { | ||||
|   agent any; | ||||
|   options { | ||||
|     copyArtifactPermission projectNames: env.allProjectsArtifactPermission; | ||||
|     disableConcurrentBuilds(); | ||||
|   } | ||||
|   stages { | ||||
|     stage('FarmmapsLibBuildAll') { | ||||
|       steps { | ||||
|         stepFarmmapsLibBuildAll(); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   post { | ||||
|     success { | ||||
|       postSuccess(); | ||||
|     } | ||||
|     always { | ||||
|       postAlways(); | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										124
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										124
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,59 +1,65 @@ | ||||
| # Farmmaps viewer | ||||
|  | ||||
| This is a sample FarmMaps client in Angular 7.x. | ||||
|  | ||||
|  | ||||
| ## Quick start | ||||
|  | ||||
| Use one of the two options below to get started. | ||||
|  | ||||
| ## Option 1, Using docker | ||||
|  | ||||
| *Dependencies*   | ||||
|  | ||||
| * docker desktop | ||||
|  | ||||
| *Setup* | ||||
|  | ||||
| ``` | ||||
| docker pull node:12.13.1 | ||||
| docker run -t -i --entrypoint /bin/bash -p 4200:4200 node:12.13.1 | ||||
| ``` | ||||
|  | ||||
| Inside the running container  | ||||
| ``` | ||||
| git clone https://git.akkerweb.nl/FarmMaps/FarmMapsLib.git | ||||
| cd FarmMapsLib | ||||
| npm config set @farmmaps:registry https://repository.akkerweb.nl/repository/npm-group/ | ||||
| npm install -g @angular/cli | ||||
| npm install | ||||
| ng serve --host 0.0.0.0 | ||||
| ``` | ||||
| *Go* | ||||
|  | ||||
| Point your browser to http://localhost:4200 | ||||
|  | ||||
| ## Option 2, Using local machine | ||||
|  | ||||
| *Dependencies* | ||||
|  | ||||
| * npm 6.9.0 | ||||
| * nodejs 10.16.0 | ||||
| * git | ||||
|  | ||||
| *Setup* | ||||
|  | ||||
| ``` | ||||
| git clone https://git.akkerweb.nl/FarmMaps/FarmMapsLib.git | ||||
| cd FarmMapsLib | ||||
| npm config set @farmmaps:registry https://repository.akkerweb.nl/repository/npm-group/ | ||||
| npm install -g @angular/cli | ||||
| npm install | ||||
| ng serve | ||||
| ``` | ||||
| *Go* | ||||
|  | ||||
| Point your browser to http://localhost:4200 | ||||
|  | ||||
|  | ||||
|  | ||||
| # Farmmaps viewer | ||||
|  | ||||
| This is a sample FarmMaps client in Angular 7.x. | ||||
|  | ||||
|  | ||||
| ## Quick start | ||||
|  | ||||
| Use one of the two options below to get started. | ||||
|  | ||||
| ## Option 1, Using docker | ||||
|  | ||||
| *Dependencies*   | ||||
|  | ||||
| * docker desktop | ||||
|  | ||||
| *Setup* | ||||
|  | ||||
| ``` | ||||
| docker pull node:12.13.1 | ||||
| docker run -t -i --entrypoint /bin/bash -p 4200:4200 node:12.13.1 | ||||
| ``` | ||||
|  | ||||
| Inside the running container  | ||||
| ``` | ||||
| git clone https://git.akkerweb.nl/FarmMaps/FarmMapsLib.git | ||||
| cd FarmMapsLib | ||||
| npm config set @farmmaps:registry https://repository.akkerweb.nl/repository/npm-group/ | ||||
| npm install -g @angular/cli | ||||
| npm install | ||||
| ng serve --host 0.0.0.0 | ||||
| ``` | ||||
| *Go* | ||||
|  | ||||
| Point your browser to http://localhost:4200 | ||||
|  | ||||
| ## Option 2, Using local machine | ||||
|  | ||||
| *Dependencies* | ||||
|  | ||||
| * npm 6.9.0 | ||||
| * nodejs 10.16.0 | ||||
| * git | ||||
|  | ||||
| *Setup* | ||||
|  | ||||
| ``` | ||||
| git clone https://git.akkerweb.nl/FarmMaps/FarmMapsLib.git | ||||
| cd FarmMapsLib | ||||
| npm config set @farmmaps:registry https://repository.akkerweb.nl/repository/npm-group/ | ||||
| npm install -g @angular/cli | ||||
| npm install | ||||
| ng serve | ||||
| ``` | ||||
| *Go*` | ||||
|  | ||||
| Point your browser to http://localhost:4200 | ||||
|  | ||||
| *ESLint* | ||||
|  | ||||
| ``` | ||||
| npm run lint src | ||||
| npm run lint projects/common/src | ||||
| npm run lint projects/common-map/src | ||||
| npm run lint projects/common-map3d/src | ||||
| ``` | ||||
							
								
								
									
										39
									
								
								angular.json
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								angular.json
									
									
									
									
									
								
							| @@ -215,7 +215,7 @@ | ||||
|               "tsConfig": "projects/common-map/tsconfig.lib.prod.json" | ||||
|             } | ||||
|           } | ||||
| }, | ||||
|         }, | ||||
|         "test": { | ||||
|           "builder": "@angular-devkit/build-angular:karma", | ||||
|           "options": { | ||||
| @@ -253,6 +253,43 @@ | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     }, | ||||
|     "ngx-openlayers": { | ||||
|       "projectType": "library", | ||||
|       "root": "projects/ngx-openlayers", | ||||
|       "sourceRoot": "projects/ngx-openlayers/src", | ||||
|       "prefix": "lib", | ||||
|       "architect": { | ||||
|         "build": { | ||||
|           "builder": "@angular-devkit/build-angular:ng-packagr", | ||||
|           "options": { | ||||
|             "tsConfig": "projects/ngx-openlayers/tsconfig.lib.json", | ||||
|             "project": "projects/ngx-openlayers/ng-package.json" | ||||
|           }, | ||||
|           "configurations": { | ||||
|             "production": { | ||||
|               "tsConfig": "projects/ngx-openlayers/tsconfig.lib.prod.json" | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         "test": { | ||||
|           "builder": "@angular-devkit/build-angular:karma", | ||||
|           "options": { | ||||
|             "main": "projects/ngx-openlayers/src/test.ts", | ||||
|             "tsConfig": "projects/ngx-openlayers/tsconfig.spec.json", | ||||
|             "karmaConfig": "projects/ngx-openlayers/karma.conf.js" | ||||
|           } | ||||
|         }, | ||||
|         "lint": { | ||||
|           "builder": "@angular-eslint/builder:lint", | ||||
|           "options": { | ||||
|             "lintFilePatterns": [ | ||||
|               "projects/ngx-openlayers/**/*.ts", | ||||
|               "projects/ngx-openlayers/**/*.html" | ||||
|             ] | ||||
|           } | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   "cli": { | ||||
|   | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 143 KiB | 
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -51,7 +51,17 @@ | ||||
|   content: "i"; | ||||
| } | ||||
|  | ||||
| hallo | ||||
| .fm-carbon:before { | ||||
|   content: "j"; | ||||
| } | ||||
|  | ||||
| .fm-bo-akkerbouw:before { | ||||
|   content: "k"; | ||||
| } | ||||
|  | ||||
| .fm-grass:before { | ||||
|   content: "l"; | ||||
| } | ||||
|  | ||||
| @font-face { | ||||
|   font-family: "FarmMaps"; | ||||
|   | ||||
							
								
								
									
										20575
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										20575
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										76
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										76
									
								
								package.json
									
									
									
									
									
								
							| @@ -1,32 +1,34 @@ | ||||
| { | ||||
|   "name": "farmmaps-lib-app", | ||||
|   "version": "3.0.1", | ||||
|   "scripts": { | ||||
|   "version": "4.3.0", | ||||
|   "scripts":   { | ||||
|     "ng": "ng", | ||||
|     "start": "ng serve", | ||||
|     "build": "ng build", | ||||
|     "test": "ng test", | ||||
|     "lint": "ng lint", | ||||
|     "lint": "eslint -c .eslintrc.js --ext .ts", | ||||
|     "e2e": "ng e2e" | ||||
|   }, | ||||
|   "private": true, | ||||
|   "dependencies": { | ||||
|     "@angular/animations": "^14.1.3", | ||||
|     "@angular/common": "^14.1.3", | ||||
|     "@angular/compiler": "^14.1.3", | ||||
|     "@angular/core": "^14.1.3", | ||||
|     "@angular/forms": "^14.1.3", | ||||
|     "@angular/platform-browser": "^14.1.3", | ||||
|     "@angular/platform-browser-dynamic": "^14.1.3", | ||||
|     "@angular/router": "^14.1.3", | ||||
|   "dependencies":   { | ||||
|     "@angular/animations": "^16.2.12", | ||||
|     "@angular/common": "^16.2.12", | ||||
|     "@angular/compiler": "^16.2.12", | ||||
|     "@angular/core": "^16.2.12", | ||||
|     "@angular-eslint/eslint-plugin": "^15.2.1", | ||||
|     "@angular/forms": "^16.2.12", | ||||
|     "@angular/platform-browser": "^16.2.12", | ||||
|     "@angular/platform-browser-dynamic": "^16.2.12", | ||||
|     "@angular/router": "^16.2.12", | ||||
|     "@farmmaps/common": "file:dist/common", | ||||
|     "@farmmaps/common-map": "file:dist/common-map", | ||||
|     "@farmmaps/common-map3d": "file:dist/common-map3d", | ||||
|     "ngx-openlayers": "file:dist/ngx-openlayers", | ||||
|     "@microsoft/signalr": "^3.1.16", | ||||
|     "@ng-bootstrap/ng-bootstrap": "^13.0.0", | ||||
|     "@ngrx/effects": "^14", | ||||
|     "@ngrx/router-store": "^14", | ||||
|     "@ngrx/store": "^14", | ||||
|     "@ng-bootstrap/ng-bootstrap": "^15.0.0", | ||||
|     "@ngrx/effects": "^16", | ||||
|     "@ngrx/router-store": "^16", | ||||
|     "@ngrx/store": "^16", | ||||
|     "@popperjs/core": "^2.11.6", | ||||
|     "angular-oauth2-oidc": "^13", | ||||
|     "assert": "^2.0.0", | ||||
| @@ -37,36 +39,41 @@ | ||||
|     "core-js": "^2.6.12", | ||||
|     "https-browserify": "^1.0.0", | ||||
|     "moment": "^2.29.4", | ||||
|     "ngrx-store-localstorage": "^14", | ||||
|     "ngx-avatar": "^4.1.0", | ||||
|     "ngx-clipboard": "^14.0.1", | ||||
|     "ngx-image-cropper": "^3.3.5", | ||||
|     "ngx-openlayers": "1.0.0-next.19", | ||||
|     "ngrx-store-localstorage": "16.0.0", | ||||
|     "ngx-avatars": "1.5.0", | ||||
|     "ngx-clipboard": "^15.1.0", | ||||
|     "ngx-image-cropper": "^7.2.1", | ||||
|     "ngx-uploadx": "^5.2.0", | ||||
|     "ol": "6.14.1", | ||||
|     "ol": "~6.3.1", | ||||
|     "olcs": "^2.13.1", | ||||
|     "resumablejs": "^1.1.0", | ||||
|     "rxjs": "^6.6.7", | ||||
|     "rxjs": "^7.8.1", | ||||
|     "stream": "^0.0.2", | ||||
|     "stream-http": "^3.2.0", | ||||
|     "tassign": "^1.0.0", | ||||
|     "tslib": "^2.4.0", | ||||
|     "url": "^0.11.0", | ||||
|     "util": "^0.12.4", | ||||
|     "zone.js": "~0.11.4" | ||||
|     "zone.js": "~0.13.3" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@angular-builders/custom-webpack": "^14", | ||||
|     "@angular-devkit/build-angular": "^14.1.3", | ||||
|     "@angular/cli": "^14.1.3", | ||||
|     "@angular/compiler-cli": "^14.1.3", | ||||
|     "@angular/language-service": "^14.1.3", | ||||
|     "@angular/localize": "^14.1.3", | ||||
|   "devDependencies":   { | ||||
|     "@angular-builders/custom-webpack": "^16", | ||||
|     "@angular-devkit/build-angular": "^16.2.11", | ||||
|     "@angular/cli": "^16.2.11", | ||||
|     "@angular/compiler-cli": "^16.2.12", | ||||
|     "@angular/language-service": "^16.2.12", | ||||
|     "@angular/localize": "^16.2.12", | ||||
|     "@types/arcgis-rest-api": "^10.4.5", | ||||
|     "@types/jasmine": "~2.8.8", | ||||
|     "@types/jasminewd2": "^2.0.9", | ||||
|     "@types/node": "^12.20.15", | ||||
|     "@typescript-eslint/eslint-plugin": "^6.18.0", | ||||
|     "@typescript-eslint/eslint-plugin-tslint": "^6.18.0", | ||||
|     "@typescript-eslint/parser": "^6.18.0", | ||||
|     "codelyzer": "^0.0.28", | ||||
|     "eslint": "^8.35.0", | ||||
|     "eslint-config-prettier": "^8.6.0", | ||||
|     "eslint-plugin-import": "^2.27.5", | ||||
|     "jasmine-core": "^4.3.0", | ||||
|     "jasmine-spec-reporter": "^7.0.0", | ||||
|     "karma": "^6.3.20", | ||||
| @@ -74,10 +81,9 @@ | ||||
|     "karma-coverage-istanbul-reporter": "^3.0.3", | ||||
|     "karma-jasmine": "^5.1.0", | ||||
|     "karma-jasmine-html-reporter": "^2.0.0", | ||||
|     "ng-packagr": "^14.1.0", | ||||
|     "ng-packagr": "^16.2.3", | ||||
|     "protractor": "~7.0.0", | ||||
|     "ts-node": "^8.8.1", | ||||
|     "tslint": "~6.1.0", | ||||
|     "typescript": "~4.6.4" | ||||
|     "typescript": "~4.9.3" | ||||
|   } | ||||
| } | ||||
| } | ||||
							
								
								
									
										22
									
								
								projects/common-map/.eslintrc.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								projects/common-map/.eslintrc.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| module.exports = { | ||||
|     "env": { | ||||
|         "browser": true, | ||||
|         "es2021": true | ||||
|     }, | ||||
|     "extends": [ | ||||
|         "eslint:recommended", | ||||
|         "plugin:@typescript-eslint/recommended" | ||||
|     ], | ||||
|     "overrides": [ | ||||
|     ], | ||||
|     "parser": "@typescript-eslint/parser", | ||||
|     "parserOptions": { | ||||
|         "ecmaVersion": "latest", | ||||
|         "sourceType": "module" | ||||
|     }, | ||||
|     "plugins": [ | ||||
|         "@typescript-eslint" | ||||
|     ], | ||||
|     "rules": { | ||||
|     } | ||||
| } | ||||
							
								
								
									
										25
									
								
								projects/common-map/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										25
									
								
								projects/common-map/package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -1,10 +1,27 @@ | ||||
| { | ||||
|   "name": "@farmmaps/common-map", | ||||
|   "version": "0.0.1", | ||||
|   "lockfileVersion": 1, | ||||
|   "version": "2.0.0", | ||||
|   "lockfileVersion": 3, | ||||
|   "requires": true, | ||||
|   "dependencies": { | ||||
|     "tslib": { | ||||
|   "packages": { | ||||
|     "": { | ||||
|       "name": "@farmmaps/common-map", | ||||
|       "version": "2.0.0", | ||||
|       "dependencies": { | ||||
|         "tslib": "^2.0.0" | ||||
|       }, | ||||
|       "peerDependencies": { | ||||
|         "@angular/core": "^16.2.12", | ||||
|         "@ngrx/effects": "^16", | ||||
|         "@ngrx/router-store": "^16", | ||||
|         "@ngrx/store": "^16", | ||||
|         "ngrx-store-localstorage": "16.0.0", | ||||
|         "ngx-openlayers": "file:dist/ngx-openlayers", | ||||
|         "ol": ">=6.8.1", | ||||
|         "tassign": ">1.0.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/tslib": { | ||||
|       "version": "2.0.1", | ||||
|       "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", | ||||
|       "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==" | ||||
|   | ||||
| @@ -8,13 +8,13 @@ | ||||
|     "tslib": "^2.0.0" | ||||
|   }, | ||||
|   "peerDependencies": { | ||||
|     "@angular/core": ">=14.0.0", | ||||
|     "ngrx-store-localstorage": ">=14.0.0", | ||||
|     "@ngrx/effects": ">=14.0.0", | ||||
|     "@ngrx/router-store":">=14.0.0", | ||||
|     "@ngrx/store":">=14.0.0", | ||||
|     "tassign": ">=1.0.0", | ||||
|     "ngx-openlayers": ">=1.0.0-next.19", | ||||
|     "@angular/core": "^16.2.12", | ||||
|     "ngrx-store-localstorage": "16.0.0", | ||||
|     "@ngrx/effects": "^16", | ||||
|     "@ngrx/router-store": "^16", | ||||
|     "@ngrx/store": "^16", | ||||
|     "tassign": ">1.0.0", | ||||
|     "ngx-openlayers": "file:dist/ngx-openlayers", | ||||
|     "ol": ">=6.8.1" | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -18,6 +18,7 @@ export const SETPARENT = '[Map] SetParent'; | ||||
| export const SETPERIOD = '[Map] SetPeriod'; | ||||
| export const STARTSEARCH = '[Map] StartSearch'; | ||||
| export const STARTSEARCHSUCCESS = '[Map] StartSearchSuccess'; | ||||
| export const CLICKFEATURE = '[Map] ClickFeature'; | ||||
| export const SELECTFEATURE = '[Map] SelectFeature'; | ||||
| export const SELECTITEM = '[Map] SelectItem'; | ||||
| export const SELECTITEMSUCCESS = '[Map] SelectItemSuccess'; | ||||
| @@ -56,7 +57,8 @@ export const GETLAYERVALUE = '[Map] GetLayerValue' | ||||
| export const GETLAYERVALUESUCCESS = '[Map] GetLayerValueSuccess' | ||||
| export const TOGGLESHOWDATALAYERSLIDE = '[Map] ToggleShowDataLayerSlide' | ||||
| export const SETVIEWSTATE = '[Map] SetViewState' | ||||
|  | ||||
| export const CLEARFEATURES = '[Map] ClearFeatures'; | ||||
| export const SETPANELEXTRAWIDE = '[Map] SetPanelExtraWide'; | ||||
|  | ||||
| export class Clear implements Action { | ||||
|   readonly type = CLEAR; | ||||
| @@ -111,6 +113,12 @@ export class StartSearchSuccess implements Action { | ||||
|   constructor(public features: Array<Feature<Geometry>>, public query:IQueryState) { } | ||||
| } | ||||
|  | ||||
| export class ClickFeature implements Action { | ||||
|   readonly type = CLICKFEATURE; | ||||
|  | ||||
|   constructor(public feature:Feature<Geometry>) { } | ||||
| } | ||||
|  | ||||
| export class SelectFeature implements Action { | ||||
|   readonly type = SELECTFEATURE; | ||||
|  | ||||
| @@ -329,12 +337,23 @@ export class SetViewState implements Action { | ||||
|   constructor(public enabled:boolean) {} | ||||
| } | ||||
|  | ||||
| export class ClearFeatures implements Action { | ||||
|   readonly type = CLEARFEATURES; | ||||
|   constructor() {} | ||||
| } | ||||
|  | ||||
| export class SetPanelExtraWide implements Action { | ||||
|   readonly type = SETPANELEXTRAWIDE; | ||||
|   constructor(public panelExtraWide:boolean) {} | ||||
| } | ||||
|  | ||||
| export type Actions = SetMapState | ||||
|   | Init | ||||
|   | Clear | ||||
|   | SetParent | ||||
|   | StartSearch | ||||
|   | StartSearchSuccess | ||||
|   | ClickFeature | ||||
|   | SelectFeature | ||||
|   | SelectItem | ||||
|   | SelectItemSuccess | ||||
| @@ -374,5 +393,7 @@ export type Actions = SetMapState | ||||
|   | GetLayerValue | ||||
|   | SetPeriod | ||||
|   | ToggleShowDataLayerSlide | ||||
|   | SetViewState; | ||||
|   | SetViewState | ||||
|   | ClearFeatures | ||||
|   | SetPanelExtraWide; | ||||
|  | ||||
|   | ||||
| @@ -79,13 +79,13 @@ export function LocalStorageSync(reducer: ActionReducer<any>): ActionReducer<any | ||||
|     const r2 = reducer(state, action); | ||||
|  | ||||
|     if(action.type == "@ngrx/store/update-reducers") { | ||||
|         let ms = window.localStorage.getItem(MODULE_NAME+"_mapState"); | ||||
|         const ms = window.localStorage.getItem(MODULE_NAME+"_mapState"); | ||||
|         if(ms) { | ||||
|           r2["mapState"] = JSON.parse(ms); | ||||
|         } | ||||
|         let sp = window.localStorage.getItem(MODULE_NAME+"_searchPeriod"); | ||||
|         const sp = window.localStorage.getItem(MODULE_NAME+"_searchPeriod"); | ||||
|         if(sp) {           | ||||
|           let p = JSON.parse(sp); | ||||
|           const p = JSON.parse(sp); | ||||
|           r2["period"] = { startDate: new Date(Date.parse(p.startDate)),endDate:new Date(Date.parse(p.endDate))}; | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -28,7 +28,7 @@ export class FileDropTargetComponent implements OnInit, OnDestroy { | ||||
|  | ||||
|   ngOnInit() { | ||||
|     this.element = this.map.instance.getViewport(); | ||||
|     let other = this; | ||||
|     const other = this; | ||||
|     this.element.addEventListener('drop', this.onDrop, false); | ||||
|     this.element.addEventListener('dragover', this.preventDefault, false); | ||||
|     this.element.addEventListener('dragenter', this.preventDefault, false); | ||||
| @@ -36,20 +36,20 @@ export class FileDropTargetComponent implements OnInit, OnDestroy { | ||||
|  | ||||
|   private onDrop = (event: DragEvent) => { | ||||
|     this.stopEvent(event); | ||||
|     let geojsonFormat = new GeoJSON();  | ||||
|     var parentCode = this.parentCode; | ||||
|     var coordinate = this.map.instance.getEventCoordinate(event); | ||||
|     const geojsonFormat = new GeoJSON();  | ||||
|     let parentCode = this.parentCode; | ||||
|     const coordinate = this.map.instance.getEventCoordinate(event); | ||||
|     //coordinate = proj.transform(coordinate, this.map.instance.getView().getProjection(), 'EPSG:4326'); | ||||
|     var geometry:Geometry = new Point(coordinate); | ||||
|     var hitFeatures = this.map.instance.getFeaturesAtPixel([event.pageX, event.pageY]); | ||||
|     var hitFeature = hitFeatures && hitFeatures.length > 0 ? hitFeatures[0] : null; | ||||
|     let geometry:Geometry = new Point(coordinate); | ||||
|     const hitFeatures = this.map.instance.getFeaturesAtPixel([event.pageX, event.pageY]); | ||||
|     const hitFeature = hitFeatures && hitFeatures.length > 0 ? hitFeatures[0] : null; | ||||
|     if (hitFeature) { | ||||
|       if (hitFeature.get("code")) { | ||||
|         parentCode = hitFeature.get("code"); | ||||
|       } | ||||
|       geometry = geojsonFormat.readGeometry(geojsonFormat.writeGeometry(geometry)); // create copy instead of reference | ||||
|     } | ||||
|     var projectedGeometry = geometry.transform(this.map.instance.getView().getProjection(), 'EPSG:4326');    | ||||
|     const projectedGeometry = geometry.transform(this.map.instance.getView().getProjection(), 'EPSG:4326');    | ||||
|        | ||||
|     if (event.dataTransfer && event.dataTransfer.files) { | ||||
|       this.onFileDropped.emit({ files: event.dataTransfer.files, event: event, geometry: JSON.parse(geojsonFormat.writeGeometry(projectedGeometry)),parentCode:parentCode}) | ||||
|   | ||||
| @@ -1,6 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
|  | ||||
| .gps-location { | ||||
|   display:none;  | ||||
| } | ||||
| @@ -14,7 +11,7 @@ | ||||
| } | ||||
|  | ||||
| .tolerance { | ||||
|   fill: $primary; | ||||
|   fill: var(--bs-primary); | ||||
|   fill-opacity:0.4; | ||||
| } | ||||
|  | ||||
| @@ -23,20 +20,20 @@ | ||||
| } | ||||
|  | ||||
| .border { | ||||
|   fill: $white; | ||||
|   fill: var(--bs-white); | ||||
| } | ||||
|  | ||||
| .center { | ||||
|   fill: $primary; | ||||
|   fill: var(--bs-primary); | ||||
| } | ||||
|  | ||||
| .stop1 { | ||||
|   stop-color: $primary; | ||||
|   stop-color: var(--bs-primary); | ||||
|   stop-opacity:1; | ||||
| } | ||||
|  | ||||
| .stop2 { | ||||
|   stop-color:$primary; | ||||
|   stop-color:var(--bs-primary); | ||||
|   stop-opacity: 0; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -15,16 +15,16 @@ export class GpsLocation  implements OnInit,OnChanges{ | ||||
|   public instance: Overlay; | ||||
|   @Input() position: GeolocationPosition; | ||||
|   @Input() location: number[]=[0,0]; | ||||
|   @Input() locationTolerance: number = 0; | ||||
|   @Input() showHeading: boolean = false; | ||||
|   @Input() showTolerance: boolean = false; | ||||
|   @Input() heading: number = 0; | ||||
|   @Input() headingTolerance: number = 0; | ||||
|   public locTolerancePixels: number = 0; | ||||
|   public path: string = ""; | ||||
|   public rotate: string = ""; | ||||
|   private resolution: number = 0; | ||||
|   initialized:boolean = false; | ||||
|   @Input() locationTolerance = 0; | ||||
|   @Input() showHeading = false; | ||||
|   @Input() showTolerance = false; | ||||
|   @Input() heading = 0; | ||||
|   @Input() headingTolerance = 0; | ||||
|   public locTolerancePixels = 0; | ||||
|   public path = ""; | ||||
|   public rotate = ""; | ||||
|   private resolution = 0; | ||||
|   initialized = false; | ||||
|   @ViewChild('location', { static: true }) locationElement: ElementRef; | ||||
|  | ||||
|   constructor(private map: MapComponent) { | ||||
| @@ -42,12 +42,12 @@ export class GpsLocation  implements OnInit,OnChanges{ | ||||
|       position: fromLonLat( this.location), | ||||
|       element: this.locationElement.nativeElement | ||||
|     }); | ||||
|     var x = Math.tan(this.headingTolerance * Math.PI / 180)*40; | ||||
|     var y = Math.cos(this.headingTolerance * Math.PI / 180) * 40; | ||||
|     var y1 = Math.round(500 - y); | ||||
|     var x1 = Math.round(500 - x); | ||||
|     var y2 = Math.round(y1); | ||||
|     var x2 = Math.round(500 + x); | ||||
|     const x = Math.tan(this.headingTolerance * Math.PI / 180)*40; | ||||
|     const y = Math.cos(this.headingTolerance * Math.PI / 180) * 40; | ||||
|     const y1 = Math.round(500 - y); | ||||
|     const x1 = Math.round(500 - x); | ||||
|     const y2 = Math.round(y1); | ||||
|     const x2 = Math.round(500 + x); | ||||
|     this.path = "M " + x2 + " " + y2 + " A 45 45,0,0,0, " + x1 + " " + y1 + " L 493 500 L 507 500 Z"; | ||||
|     this.rotate = "rotate(" + Math.round(this.heading) + " 500 500)"; | ||||
|     this.locTolerancePixels = this.locationTolerance; | ||||
| @@ -61,7 +61,7 @@ export class GpsLocation  implements OnInit,OnChanges{ | ||||
|  | ||||
|   ngOnChanges(changes: SimpleChanges) { | ||||
|     if (changes.position && this.instance) { | ||||
|       var p = changes.position.currentValue as GeolocationPosition; | ||||
|       const p = changes.position.currentValue as GeolocationPosition; | ||||
|       if(p && this.initialized) { | ||||
|         this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude])); | ||||
|         this.locationTolerance = p.coords.accuracy; | ||||
|   | ||||
| @@ -35,7 +35,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|   @Output() onFeatureHover: EventEmitter<any> = new EventEmitter<any>(); | ||||
|   @Output() onPrerender: EventEmitter<any> = new EventEmitter<any>(); | ||||
|   private _apiEndPoint: string; | ||||
|   private initialized:boolean = false; | ||||
|   private initialized = false; | ||||
|   private mapEventHandlerInstalled = false; | ||||
|   private topLayerPrerenderEventhandlerInstalled = false; | ||||
|   private selectedFeatures = {}; | ||||
| @@ -49,7 +49,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|   private styleCache = {} | ||||
|  | ||||
|   componentToHex(c) { | ||||
|     var hex = c.toString(16); | ||||
|     const hex = c.toString(16); | ||||
|     return hex.length == 1 ? "0" + hex : hex; | ||||
|   } | ||||
|  | ||||
| @@ -58,28 +58,28 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|   } | ||||
|  | ||||
|   getColorFromGradient(layer: ILayer, value: number): IColor { | ||||
|     var gradient: IGradientstop[] = layer.renderer.colorMap.gradient; | ||||
|     var histogram: IHistogram = layer.renderer.band.histogram; | ||||
|     var index = (value - histogram.min) / histogram.max; | ||||
|     var min = gradient[0]; | ||||
|     var max = gradient[gradient.length - 1]; | ||||
|     for (var n = 0; n < gradient.length; n++) { | ||||
|       var s = gradient[n]; | ||||
|     const gradient: IGradientstop[] = layer.renderer.colorMap.gradient; | ||||
|     const histogram: IHistogram = layer.renderer.band.histogram; | ||||
|     const index = (value - histogram.min) / histogram.max; | ||||
|     let min = gradient[0]; | ||||
|     let max = gradient[gradient.length - 1]; | ||||
|     for (let n = 0; n < gradient.length; n++) { | ||||
|       const s = gradient[n]; | ||||
|       if (s.relativestop <= index && min.relativestop < s.relativestop && n < gradient.length - 1) min = s; | ||||
|       if (s.relativestop >= index && max.relativestop > s.relativestop && n > 0) max = s; | ||||
|     } | ||||
|     var i = index - min.relativestop; | ||||
|     var size = max.relativestop - min.relativestop; | ||||
|     var alpha = Math.round(min.color.alpha + ((max.color.alpha - min.color.alpha) * i / size)); | ||||
|     var red = Math.round(min.color.red + ((max.color.red - min.color.red) * i / size)); | ||||
|     var green = Math.round(min.color.green + ((max.color.green - min.color.green) * i / size)); | ||||
|     var blue = Math.round(min.color.blue + ((max.color.blue - min.color.blue) * i / size)); | ||||
|     const i = index - min.relativestop; | ||||
|     const size = max.relativestop - min.relativestop; | ||||
|     const alpha = Math.round(min.color.alpha + ((max.color.alpha - min.color.alpha) * i / size)); | ||||
|     const red = Math.round(min.color.red + ((max.color.red - min.color.red) * i / size)); | ||||
|     const green = Math.round(min.color.green + ((max.color.green - min.color.green) * i / size)); | ||||
|     const blue = Math.round(min.color.blue + ((max.color.blue - min.color.blue) * i / size)); | ||||
|  | ||||
|     return { alpha: alpha, red: red, green: green, blue: blue }; | ||||
|   } | ||||
|  | ||||
|   getColorForValue(layer: ILayer, value: number): IColor { | ||||
|     var color: IColor =  { alpha:0,red:0,green:0,blue:0}; | ||||
|     let color: IColor =  { alpha:0,red:0,green:0,blue:0}; | ||||
|     if(layer.renderer.colorMap.entries.length>0) { | ||||
|       color=layer.renderer.colorMap.noValue; | ||||
|     } | ||||
| @@ -94,10 +94,10 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|   } | ||||
|  | ||||
|   getColor(item: IItem, layer: ILayer, feature): style.Style { | ||||
|     var value = layer.indexKey ? feature.get(layer.indexKey) : feature.get(layer.name); | ||||
|     var key = item.code + "_" + value; | ||||
|     const value = layer.indexKey ? feature.get(layer.indexKey) : feature.get(layer.name); | ||||
|     const key = item.code + "_" + value; | ||||
|     if (!this.styleCache[key]) { | ||||
|       var color: IColor; | ||||
|       let color: IColor; | ||||
|       if(layer.renderer.colorMap.colormapType == "manual") { | ||||
|         color = this.getColorForValue(layer, value); | ||||
|       } else { | ||||
| @@ -125,32 +125,32 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|   } | ||||
|  | ||||
|   createGeotiffLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> { | ||||
|     var layerIndex = -1; | ||||
|     var layer: Layer<Source> = null;   | ||||
|     let layerIndex = -1; | ||||
|     let layer: Layer<Source> = null;   | ||||
|     layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index; | ||||
|     let source = new XYZ({ maxZoom: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` }); | ||||
|     const source = new XYZ({ maxZoom: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` }); | ||||
|     layer = new Tile({ source: source }); | ||||
|     var data = item.data; | ||||
|     var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null; | ||||
|     const data = item.data; | ||||
|     const l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null; | ||||
|     if (l && l.rendering && l.rendering.renderoutputType == "Tiles") { | ||||
|       var rt = l.rendering as IRenderoutputTiles; | ||||
|       let source = new XYZ({crossOrigin: 'use-credentials', maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` }); | ||||
|       const rt = l.rendering as IRenderoutputTiles; | ||||
|       const source = new XYZ({crossOrigin: 'use-credentials', maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` }); | ||||
|       layer = new Tile({ source: source }); | ||||
|     } | ||||
|     if (l && l.rendering && l.rendering.renderoutputType == "Image") { | ||||
|       var ri = l.rendering as IRenderoutputImage;   | ||||
|       let source = new ImageStatic({ imageExtent:ri.extent,projection:'EPSG:3857',  crossOrigin: 'use-credentials', url: `${this._apiEndPoint}/api/v1/items/${item.code}/mapimage/${layerIndex}?v=${Date.parse(item.updated)}` }); | ||||
|       const ri = l.rendering as IRenderoutputImage;   | ||||
|       const source = new ImageStatic({ imageExtent:ri.extent,projection:'EPSG:3857',  crossOrigin: 'use-credentials', url: `${this._apiEndPoint}/api/v1/items/${item.code}/mapimage/${layerIndex}?v=${Date.parse(item.updated)}` }); | ||||
|       layer = new Image({ source: source }); | ||||
|     } | ||||
|     return layer; | ||||
|   } | ||||
|  | ||||
|   createShapeLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> { | ||||
|     var layerIndex = -1; | ||||
|     var layer: Layer<Source> = null;  | ||||
|     let layerIndex = -1; | ||||
|     let layer: Layer<Source> = null;  | ||||
|     layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index; | ||||
|     var data = item.data; | ||||
|     var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null; | ||||
|     const data = item.data; | ||||
|     const l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null; | ||||
|     if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") { | ||||
|       var rt = l.rendering as IRenderoutputTiles; | ||||
|       layer = new VectorTileLayer({ | ||||
| @@ -175,15 +175,15 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|         }) | ||||
|       }); | ||||
|     } else { | ||||
|       let __this = this; | ||||
|       let format = new GeoJSON(); | ||||
|       let source = new VectorSource({ | ||||
|       const __this = this; | ||||
|       const format = new GeoJSON(); | ||||
|       const source = new VectorSource({ | ||||
|         strategy: loadingstrategy.bbox, | ||||
|         loader: function (extent: Extent, resolution: number, projection: Projection) { | ||||
|           var source = this as VectorSource<Geometry>; | ||||
|           const source = this as VectorSource<Geometry>; | ||||
|           __this.itemService.getItemFeatures(item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) { | ||||
|             var features = format.readFeatures(data); | ||||
|             for (let f of features) { | ||||
|             const features = format.readFeatures(data); | ||||
|             for (const f of features) { | ||||
|               if (f.get("code")) { | ||||
|                 f.setId(f.get("code")); | ||||
|               } | ||||
| @@ -196,9 +196,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|         declutter: true, | ||||
|         source: source, | ||||
|         style: (feature) => { | ||||
|           var key =feature.get("code") + "_" + feature.get("color"); | ||||
|           const key =feature.get("code") + "_" + feature.get("color"); | ||||
|           if (!this.styleCache[key]) { | ||||
|             var color = feature.get("color"); | ||||
|             const color = feature.get("color"); | ||||
|             this.styleCache[key] = new style.Style( | ||||
|               { | ||||
|                 fill: new style.Fill({ | ||||
| @@ -235,11 +235,11 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|   } | ||||
|  | ||||
|   createSelectionLayer(itemLayer:IItemLayer):Layer<Source> { | ||||
|     var layerIndex = -1; | ||||
|     var layer: Layer<Source> = null;  | ||||
|     let layerIndex = -1; | ||||
|     const layer: Layer<Source> = null;  | ||||
|     layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index; | ||||
|     var data = itemLayer.item.data; | ||||
|     var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null; | ||||
|     const data = itemLayer.item.data; | ||||
|     const l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null; | ||||
|     if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") { | ||||
|       return new VectorTileLayer({ | ||||
|         renderMode: 'vector', | ||||
| @@ -250,8 +250,8 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|             return new style.Style( | ||||
|               {                | ||||
|                 stroke: new style.Stroke({ | ||||
|                   color: 'red', | ||||
|                   width: 2 | ||||
|                   color: '#0d6efd', | ||||
|                   width: 3 | ||||
|                 }) | ||||
|               } | ||||
|             ); | ||||
| @@ -265,36 +265,36 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|   } | ||||
|  | ||||
|   createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> { | ||||
|     let data = item.data as ILayerData; | ||||
|     var layer: Layer<Source> = null;  | ||||
|     const data = item.data as ILayerData; | ||||
|     let layer: Layer<Source> = null;  | ||||
|     switch (data.interfaceType) { | ||||
|       case 'OSM': { | ||||
|         let source = new OSM(); | ||||
|         const source = new OSM(); | ||||
|         layer = new Tile({ source: source }); | ||||
|         break; | ||||
|       } | ||||
|       case 'BingMaps': { | ||||
|         let source = new BingMaps(data.options); | ||||
|         const source = new BingMaps(data.options); | ||||
|         layer = new Tile({ source: source }); | ||||
|         break; | ||||
|       } | ||||
|       case 'TileWMS': { | ||||
|         let source = new TileWMS(data.options); | ||||
|         const source = new TileWMS(data.options); | ||||
|         layer = new Tile({ source: source }); | ||||
|         break; | ||||
|       } | ||||
|       case 'TileJSON': { | ||||
|         let source = new TileJSON(data.options); | ||||
|         const source = new TileJSON(data.options); | ||||
|         layer = new Tile({ source: source }); | ||||
|         break; | ||||
|       } | ||||
|       case 'TileArcGISRest': { | ||||
|         let source = new TileArcGISRest(data.options); | ||||
|         const source = new TileArcGISRest(data.options); | ||||
|         layer = new Tile({ source: source }); | ||||
|         break; | ||||
|       } | ||||
|       case 'VectorWFSJson': { | ||||
|         let source = new VectorSource({ | ||||
|         const source = new VectorSource({ | ||||
|           format: new GeoJSON(), | ||||
|           url: function (extent) { | ||||
|             return ( | ||||
| @@ -317,8 +317,8 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|   } | ||||
|  | ||||
|   createLayer(itemLayer: IItemLayer): Layer<Source> { | ||||
|     var layer: Layer<Source> = null;    | ||||
|     var layerIndex = -1; | ||||
|     let layer: Layer<Source> = null;    | ||||
|     const layerIndex = -1; | ||||
|     if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') { | ||||
|       layer = this.createGeotiffLayer(itemLayer.item,itemLayer); | ||||
|     } else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.shape.processed') { | ||||
| @@ -327,8 +327,8 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|       layer = this.createExternalLayer(itemLayer.item,itemLayer); | ||||
|     } | ||||
|     if (layer) { | ||||
|       let geometry = new GeoJSON().readGeometry(itemLayer.item.geometry); | ||||
|       let extent = geometry ? proj.transformExtent(geometry.getExtent(), 'EPSG:4326', 'EPSG:3857') : null; | ||||
|       const geometry = new GeoJSON().readGeometry(itemLayer.item.geometry); | ||||
|       const extent = geometry ? proj.transformExtent(geometry.getExtent(), 'EPSG:4326', 'EPSG:3857') : null; | ||||
|       if (extent) layer.setExtent(extent); | ||||
|     } | ||||
|  | ||||
| @@ -378,7 +378,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|     if(this.topLayerPrerenderEventhandlerInstalled && this.onPrerender.observers.length > 0 ) | ||||
|     { | ||||
|       if(this.instance.getVisible()) { | ||||
|         var olLayers = this.instance.getLayers().getArray().forEach((l:any) => { | ||||
|         const olLayers = this.instance.getLayers().getArray().forEach((l:any) => { | ||||
|           l.un('prerender',this.topLayerPrerenderEventhandler); | ||||
|           l.un('postrender',this.topLayerPostrenderEventhandler); | ||||
|         }); | ||||
| @@ -390,9 +390,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|  | ||||
|   addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer<Source> { | ||||
|     if(!itemLayer) return null; | ||||
|     var olLayers = this.instance.getLayers(); | ||||
|     var layer = itemLayer.layer; | ||||
|     let olIndex = olLayers.getArray().indexOf(layer); | ||||
|     const olLayers = this.instance.getLayers(); | ||||
|     let layer = itemLayer.layer; | ||||
|     const olIndex = olLayers.getArray().indexOf(layer); | ||||
|     if (olIndex < 0) { | ||||
|       // New layer: we add it to the map | ||||
|       layer = this.createLayer(itemLayer); | ||||
| @@ -415,33 +415,33 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|   updateLayers(itemLayers: IItemLayer[] | IItemLayer) { | ||||
|     this.unInstallTopLayerPrerenderEventhandler(); | ||||
|     let dataLayer = false; | ||||
|     var ils:IItemLayer[] = []; | ||||
|     let ils:IItemLayer[] = []; | ||||
|     if(Array.isArray(itemLayers)) { | ||||
|        ils = itemLayers; | ||||
|     } else { | ||||
|       dataLayer=true; | ||||
|        ils=[itemLayers]; | ||||
|     } | ||||
|     let newLayers: Layer<Source>[] = []; | ||||
|     const newLayers: Layer<Source>[] = []; | ||||
|     if (ils) { | ||||
|       ils.forEach((itemLayer, index) => { | ||||
|         if(itemLayer.item.itemType ==  'vnd.farmmaps.itemtype.temporal') { | ||||
|           let il = itemLayer as ITemporalItemLayer; | ||||
|           let previousLayer = this.addOrUpdateOlLayer(il.previousItemLayer,newLayers.length);           | ||||
|           const il = itemLayer as ITemporalItemLayer; | ||||
|           const previousLayer = this.addOrUpdateOlLayer(il.previousItemLayer,newLayers.length);           | ||||
|           if(previousLayer) newLayers.push(previousLayer); | ||||
|           let selectedLayer = this.addOrUpdateOlLayer(il.selectedItemLayer,newLayers.length); | ||||
|           const selectedLayer = this.addOrUpdateOlLayer(il.selectedItemLayer,newLayers.length); | ||||
|           if(selectedLayer) newLayers.push(selectedLayer); | ||||
|           let nextLayer = this.addOrUpdateOlLayer(il.nextItemLayer,newLayers.length); | ||||
|           const nextLayer = this.addOrUpdateOlLayer(il.nextItemLayer,newLayers.length); | ||||
|           if(nextLayer) newLayers.push(nextLayer); | ||||
|           this.installTopLayerPrerenderEventhandler(selectedLayer); | ||||
|         } else { | ||||
|           let layer = this.addOrUpdateOlLayer(itemLayer,newLayers.length); | ||||
|           const layer = this.addOrUpdateOlLayer(itemLayer,newLayers.length); | ||||
|           if(layer) newLayers.push(layer);     | ||||
|           this.installTopLayerPrerenderEventhandler(layer);        | ||||
|         } | ||||
|       }); | ||||
|       // Remove the layers that have disapeared from childrenLayers | ||||
|       var olLayers = this.instance.getLayers(); | ||||
|       const olLayers = this.instance.getLayers(); | ||||
|       while(olLayers.getLength() > newLayers.length) { | ||||
|         olLayers.removeAt(newLayers.length); | ||||
|       } | ||||
| @@ -466,21 +466,21 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|   mapEventHandler = (event) => { | ||||
|     // select only when having observers | ||||
|     if(event.type === 'click' && !this.onFeatureSelected.observers.length) return; | ||||
|     if(event.type === 'pointermove' && !this.onFeatureHover.observers.length) return;     | ||||
|     let itemLayer= this.getItemlayer(this.itemLayer); | ||||
|     if(event.type === 'pointermove' && !this.onFeatureHover.observers.length) return; | ||||
|     const itemLayer= this.getItemlayer(this.itemLayer); | ||||
|     if(itemLayer && itemLayer.layer) { | ||||
|        this.selectedFeatures = {}; | ||||
|        if(itemLayer.layer ) { | ||||
|         let minZoom = itemLayer.layer.getMinZoom(); | ||||
|         let currentZoom = this.map.instance.getView().getZoom(); | ||||
|         const minZoom = itemLayer.layer.getMinZoom(); | ||||
|         const currentZoom = this.map.instance.getView().getZoom(); | ||||
|         if(currentZoom>minZoom) { | ||||
|             itemLayer.layer.getFeatures(event.pixel).then((features) => {       | ||||
|             if(!features.length) { | ||||
|               this.onFeatureHover.emit(null); | ||||
|               return; | ||||
|             } | ||||
|            let fid = features[0].getId(); | ||||
|            let feature = features[0]; | ||||
|            const fid = features[0].getId(); | ||||
|            const feature = features[0]; | ||||
|            if(event.type === 'pointermove') { | ||||
|              this.selectedFeatures[fid] = features[0]; | ||||
|              this.onFeatureHover.emit({ "feature": feature,"itemCode":itemLayer.item.code }); | ||||
| @@ -502,11 +502,11 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange | ||||
|   ngOnChanges(changes: SimpleChanges) { | ||||
|     if (this.instance && this.initialized) { | ||||
|       if (changes['itemLayers']) { | ||||
|         var itemLayers = changes['itemLayers'].currentValue as IItemLayer[]; | ||||
|         const itemLayers = changes['itemLayers'].currentValue as IItemLayer[]; | ||||
|         this.updateLayers(itemLayers); | ||||
|       } | ||||
|       if (changes['itemLayer']) {       | ||||
|         var itemLayer = changes['itemLayer'].currentValue as IItemLayer; | ||||
|         const itemLayer = changes['itemLayer'].currentValue as IItemLayer; | ||||
|         this.itemLayer = itemLayer | ||||
|         if(itemLayer) { | ||||
|           if(this.getItemlayer(this.itemLayer).item.itemType == 'vnd.farmmaps.itemtype.shape.processed') { | ||||
|   | ||||
| @@ -1,9 +1,9 @@ | ||||
| import { Component,  Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken } from '@angular/core'; | ||||
| import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken, OnDestroy, LOCALE_ID } from '@angular/core'; | ||||
| import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-openlayers'; | ||||
| import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common'; | ||||
| import { ItemService, ItemTypeService, IItem, IItemType, FolderService } from '@farmmaps/common'; | ||||
|  | ||||
| import { Feature } from 'ol'; | ||||
| import { Point,Geometry } from 'ol/geom'; | ||||
| import { Point, Geometry } from 'ol/geom'; | ||||
| import { MapBrowserEvent } from 'ol'; | ||||
| import { Types } from 'ol/MapBrowserEventType'; | ||||
| import * as style from 'ol/style'; | ||||
| @@ -11,80 +11,96 @@ import * as color from 'ol/color'; | ||||
| import * as loadingstrategy from 'ol/loadingstrategy'; | ||||
| import * as condition from 'ol/events/condition'; | ||||
| import * as extent from 'ol/extent'; | ||||
| import {Vector,Cluster,Source} from 'ol/source'; | ||||
| import {Layer} from 'ol/layer'; | ||||
| import {GeoJSON} from 'ol/format'; | ||||
| import {Select} from 'ol/interaction'; | ||||
| import {IStyles} from '../../../models/style.cache'; | ||||
| import {FeatureIconService} from '../../../services/feature-icon.service'; | ||||
|   | ||||
| import { Vector, Cluster, Source } from 'ol/source'; | ||||
| import { Layer } from 'ol/layer'; | ||||
| import { GeoJSON } from 'ol/format'; | ||||
| import { Select } from 'ol/interaction'; | ||||
| import { IStyles } from '../../../models/style.cache'; | ||||
| import { FeatureIconService } from '../../../services/feature-icon.service'; | ||||
| import { Subscription } from 'rxjs'; | ||||
| import { getCenter } from 'ol/extent'; | ||||
| import { formatNumber } from '@angular/common'; | ||||
|  | ||||
| @Component({ | ||||
|   selector: 'fm-map-item-source-vector', | ||||
|   template: `<ng-content></ng-content>`, | ||||
|   providers: [ | ||||
|     { provide: SourceVectorComponent , useExisting: forwardRef(() => ItemVectorSourceComponent) } | ||||
|     { provide: SourceVectorComponent, useExisting: forwardRef(() => ItemVectorSourceComponent) } | ||||
|   ] | ||||
| }) | ||||
| export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnChanges { | ||||
| export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnDestroy, OnChanges { | ||||
|   instance: Vector<Geometry>; | ||||
|   private _format: GeoJSON; | ||||
|   private _select: Select; | ||||
|   private _hoverSelect: Select; | ||||
|   private _iconScale: number = 0.05; | ||||
|   private _iconScale = 0.05; | ||||
|   @Input() features: Array<Feature<Geometry>>; | ||||
|   @Input() selectedFeature: Feature<Geometry>; | ||||
|   @Input() selectedItem: IItem; | ||||
|   @Input() styles:IStyles; | ||||
|   @Input() styles: IStyles; | ||||
|   @Output() onFeatureSelected: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>(); | ||||
|   @Output() onFeatureHover: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>(); | ||||
|   private stylesCache:IStyles = {}; | ||||
|   private stylesCache: IStyles = {}; | ||||
|   private sub: Subscription; | ||||
|   private displayMapFeatureSettings: { [code: string]: string[] } = defaultDisplayMapFeatureSettings(); | ||||
|  | ||||
|   constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, private map: MapComponent, private itemTypeService: ItemTypeService,private featureIconService$:FeatureIconService) { | ||||
|   constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, private map: MapComponent, private itemTypeService: ItemTypeService, private featureIconService$: FeatureIconService, private folderService: FolderService, @Inject(LOCALE_ID) private locale: string) { | ||||
|     super(layer); | ||||
|     this._format = new GeoJSON(); | ||||
|   }   | ||||
|   } | ||||
|  | ||||
|   geometry(feature: Feature<Geometry>) { | ||||
|     let view = this.map.instance.getView(); | ||||
|     let resolution = view.getResolution(); | ||||
|     var geometry = feature.getGeometry(); | ||||
|     let e = geometry.getExtent(); | ||||
|     const view = this.map.instance.getView(); | ||||
|     const resolution = view.getResolution(); | ||||
|     let geometry = feature.getGeometry(); | ||||
|     const e = geometry.getExtent(); | ||||
|     //var size = Math.max((e[2] - e[0]) / resolution, (e[3] - e[1]) / resolution); | ||||
|     if (resolution > 12) { | ||||
|       geometry = new Point(extent.getCenter(e)); | ||||
|     } | ||||
|     return geometry; | ||||
|    } | ||||
|   } | ||||
|  | ||||
|   getSelectedStyle(feature:Feature<Geometry>):style.Style { | ||||
|     let key = feature.get('itemType')+"_selected"; | ||||
|     let evaluatedStyle: style.Style =undefined; | ||||
|     var styleEntry = this.stylesCache[key];     | ||||
|     if(styleEntry) { | ||||
|       if(typeof styleEntry === 'function')  { | ||||
|   getSelectedStyle(feature: Feature<Geometry>): style.Style { | ||||
|     const key = feature.get('itemType') + "_selected"; | ||||
|     let evaluatedStyle: style.Style = undefined; | ||||
|     const styleEntry = this.stylesCache[key]; | ||||
|     if (styleEntry) { | ||||
|       if (typeof styleEntry === 'function') { | ||||
|         evaluatedStyle = styleEntry(feature); | ||||
|       } else { | ||||
|         evaluatedStyle = styleEntry; | ||||
|       } | ||||
|     } else { | ||||
|       evaluatedStyle = this.stylesCache["selected"] as style.Style; | ||||
|     }     | ||||
|     if(evaluatedStyle ) { | ||||
|       evaluatedStyle .setGeometry((feature:Feature<Geometry>) => this.geometry(feature)); | ||||
|     }  | ||||
|     } | ||||
|     if (evaluatedStyle) { | ||||
|       evaluatedStyle.setGeometry((feature: Feature<Geometry>) => this.geometry(feature)); | ||||
|     } | ||||
|     return evaluatedStyle as style.Style | ||||
|   } | ||||
|  | ||||
|   ngOnInit() { | ||||
|     this.sub = this.folderService.getFolder('my_settings').subscribe( | ||||
|       userSettingsRoot => { | ||||
|         this.itemService.getChildItemList(userSettingsRoot.code, 'vnd.farmmaps.itemtype.settings.general').subscribe( | ||||
|           items => { | ||||
|             if (items && items.length > 0 && items[0].data?.displayMapFeatureSettings) { | ||||
|               this.displayMapFeatureSettings = items[0].data?.displayMapFeatureSettings; | ||||
|             } | ||||
|           } | ||||
|         ) | ||||
|       } | ||||
|     ); | ||||
|     this.strategy = loadingstrategy.bbox; | ||||
|     this.format = new GeoJSON(); | ||||
|     this._select = new Select({ | ||||
|       style:null, | ||||
|       style: null, | ||||
|       hitTolerance: 10, | ||||
|       layers: [this.layer.instance as Layer<Source>] | ||||
|     }); | ||||
|     this._hoverSelect = new Select({ | ||||
|       style: (feature:Feature<Geometry>) => {         | ||||
|       style: (feature: Feature<Geometry>) => { | ||||
|         return this.getSelectedStyle(feature); | ||||
|       }, | ||||
|       hitTolerance: 10, | ||||
| @@ -94,7 +110,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements | ||||
|       layers: [this.layer.instance as Layer<Source>] | ||||
|     }); | ||||
|     this.map.instance.addInteraction(this._select); | ||||
|     this.map.instance.addInteraction(this._hoverSelect);       | ||||
|     this.map.instance.addInteraction(this._hoverSelect); | ||||
|     this._select.on('select', (e) => { | ||||
|       if (e.selected.length > 0 && e.selected[0]) { | ||||
|         this.onFeatureSelected.emit(e.selected[0]); | ||||
| @@ -111,48 +127,53 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements | ||||
|     }); | ||||
|     this.instance = new Vector(this); | ||||
|     this.host.instance.setSource(this.instance); | ||||
|        | ||||
|     this.host.instance.setStyle((feature) => {      | ||||
|       var itemType = feature.get('itemType'); | ||||
|       var key = itemType + (this.selectedItem?"_I":""); | ||||
|  | ||||
|     this.host.instance.setStyle((feature) => { | ||||
|       const itemType = feature.get('itemType'); | ||||
|       let key = itemType + (this.selectedItem ? "_I" : ""); | ||||
|       if (!this.stylesCache[key]) { | ||||
|         if (this.itemTypeService.itemTypes[itemType]) { | ||||
|           let itemTypeEntry = this.itemTypeService.itemTypes[itemType]; | ||||
|           let fillColor = color.asArray(itemTypeEntry.iconColor); | ||||
|           const itemTypeEntry = this.itemTypeService.itemTypes[itemType]; | ||||
|           const fillColor = color.asArray(itemTypeEntry.iconColor); | ||||
|           fillColor[3] = 0; | ||||
|           this.stylesCache[key] = new style.Style({ | ||||
|               image: itemTypeEntry.icon ? new style.Icon({ | ||||
|                   anchor: [0.5, 1], | ||||
|                   scale: 0.05, | ||||
|                   src: this.featureIconService$.getIconImageDataUrl(itemTypeEntry.icon) | ||||
|                 }):null, | ||||
|               stroke: new style.Stroke({ | ||||
|                 color: 'red', | ||||
|                 width: 1 | ||||
|               }), | ||||
|               fill: new style.Fill({ | ||||
|                 color: fillColor | ||||
|               }), | ||||
|               geometry:(feature:Feature<Geometry>) => this.geometry(feature) | ||||
|             });                    | ||||
|             image: itemTypeEntry.icon ? new style.Icon({ | ||||
|               anchor: [0.5, 1], | ||||
|               scale: 0.05, | ||||
|               src: this.featureIconService$.getIconImageDataUrl(itemTypeEntry.icon) | ||||
|             }) : null, | ||||
|             stroke: new style.Stroke({ | ||||
|               color: 'red', | ||||
|               width: 1 | ||||
|             }), | ||||
|             fill: new style.Fill({ | ||||
|               color: fillColor | ||||
|             }), | ||||
|             geometry: (feature: Feature<Geometry>) => this.geometry(feature), | ||||
|             text: this.getDisplayTextForFeature(feature, this.map.instance.getView().getZoom()) | ||||
|           }); | ||||
|         } else { | ||||
|           key = 'file'; | ||||
|         } | ||||
|       }  | ||||
|       let evaluatedStyle =null; | ||||
|       var styleEntry = this.stylesCache[key];     | ||||
|       if(typeof styleEntry === 'function')  { | ||||
|       } | ||||
|       let evaluatedStyle = null; | ||||
|       const styleEntry = this.stylesCache[key]; | ||||
|       if (typeof styleEntry === 'function') { | ||||
|         evaluatedStyle = styleEntry(feature); | ||||
|       } else { | ||||
|         evaluatedStyle = styleEntry; | ||||
|       } | ||||
|       if(evaluatedStyle && evaluatedStyle.geometry_ == null) { | ||||
|       if (evaluatedStyle && evaluatedStyle.geometry_ == null && !Array.isArray(evaluatedStyle)) { | ||||
|         evaluatedStyle.setGeometry((feature) => this.geometry(feature)); | ||||
|       }  | ||||
|       } | ||||
|       return evaluatedStyle; | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   ngOnDestroy(): void { | ||||
|     if (this.sub) this.sub.unsubscribe(); | ||||
|   } | ||||
|  | ||||
|   ngOnChanges(changes: SimpleChanges) { | ||||
|     if (changes["features"] && this.instance) { | ||||
|       this.instance.clear(true); | ||||
| @@ -161,31 +182,78 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements | ||||
|     } | ||||
|  | ||||
|     if (changes["selectedFeature"] && this.instance) { | ||||
|       var features = this._hoverSelect.getFeatures(); | ||||
|       var feature = changes["selectedFeature"].currentValue | ||||
|       const features = this._hoverSelect.getFeatures(); | ||||
|       const feature = changes["selectedFeature"].currentValue | ||||
|       //this.instance.clear(false); | ||||
|       //this.instance.addFeatures(features.getArray()); | ||||
|       features.clear(); | ||||
|       if (feature) { | ||||
|         //this.instance.removeFeature(feature); | ||||
|         features.push(feature) | ||||
|       }     | ||||
|     } | ||||
|     if (changes["selectedItem"] && this.instance) { | ||||
|       var item = changes["selectedItem"].currentValue | ||||
|       if (item) { | ||||
|         this.map.instance.removeInteraction(this._hoverSelect);   | ||||
|       } else { | ||||
|         this.map.instance.addInteraction(this._hoverSelect);   | ||||
|       } | ||||
|     } | ||||
|     if (changes["styles"] && this.instance) { | ||||
|       let styles = changes["styles"].currentValue; | ||||
|     if (changes["selectedItem"] && this.instance) { | ||||
|       const item = changes["selectedItem"].currentValue | ||||
|       if (item) { | ||||
|         this.map.instance.removeInteraction(this._hoverSelect); | ||||
|       } else { | ||||
|         this.map.instance.addInteraction(this._hoverSelect); | ||||
|       } | ||||
|     } | ||||
|     if (changes["styles"]) { | ||||
|       const styles = changes["styles"].currentValue; | ||||
|       for (const key in styles) { | ||||
|         if (styles.hasOwnProperty(key)) { | ||||
|           this.stylesCache[key]=styles[key];  | ||||
|           this.stylesCache[key] = styles[key]; | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|    | ||||
|   getDisplayTextForFeature(feature: Feature<Geometry>, zoom: number, overrule?: style.Text) { | ||||
|     if (!feature) return null; | ||||
|  | ||||
|     const propertiesToShow: string[] = this.displayMapFeatureSettings[feature.get('itemType')]; | ||||
|     if (!propertiesToShow) return null; | ||||
|     if (propertiesToShow.length <= 0) return null; | ||||
|     if (zoom < 14) return null; | ||||
|  | ||||
|     let displayText = ''; | ||||
|     for (let i = 0; i < propertiesToShow.length; i++) { | ||||
|       let value = feature.get(propertiesToShow[i]); | ||||
|       switch (propertiesToShow[i]) { | ||||
|         case "area": value = formatNumber(value, this.locale, '0.1-2') + ' ha'; break; | ||||
|         case "centroid": { | ||||
|           if (feature.getGeometry()) { | ||||
|             const centroid = getCenter(feature.getGeometry().getExtent()); | ||||
|             value = Math.round(centroid[0]) + ',' + Math.round(centroid[1]); | ||||
|           } | ||||
|         } | ||||
|           if (value) { | ||||
|             displayText += value + (i < propertiesToShow.length ? '\n' : ''); | ||||
|           } | ||||
|       } | ||||
|      | ||||
|       const styleText = new style.Text({ | ||||
|         font: '13px Calibri,sans-serif', | ||||
|         fill: new style.Fill({ color: '#ffffff' }), | ||||
|         stroke: new style.Stroke({ color: '#000000', width: 2 }), | ||||
|         text: displayText | ||||
|       }); | ||||
|  | ||||
|       if (overrule) { | ||||
|         if (overrule.getFont()) styleText.setFont(overrule.getFont()); | ||||
|         if (overrule.getFill()) styleText.setFill(overrule.getFill()); | ||||
|         if (overrule.getStroke()) styleText.setStroke(overrule.getStroke()); | ||||
|       } | ||||
|  | ||||
|       return styleText; | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| function defaultDisplayMapFeatureSettings() { | ||||
|   return { | ||||
|     'vnd.farmmaps.itemtype.cropfield': ['name', 'cropTypeName', 'area'] | ||||
|   }; | ||||
| } | ||||
| @@ -9,8 +9,8 @@ import { IItemLayer } from '../../../models/item.layer'; | ||||
|  | ||||
| export class LayerListComponent  { | ||||
|   @Input() itemLayers: IItemLayer[] = []; | ||||
|   @Input() baseLayers: boolean = false; | ||||
|   @Input() dataLayers: boolean = false; | ||||
|   @Input() baseLayers = false; | ||||
|   @Input() dataLayers = false; | ||||
|   @Output() onToggleVisibility = new EventEmitter<IItemLayer>(); | ||||
|   @Output() onSetOpacity = new EventEmitter<{layer: IItemLayer,opacity:number }>(); | ||||
|   @Output() onDelete = new EventEmitter<IItemLayer>(); | ||||
|   | ||||
| @@ -7,7 +7,7 @@ | ||||
|                <li class="border-top pt-1 pb-1 value" *ngFor="let layerValue of layers"> | ||||
|                    <div>{{layerValue.layerName}}</div> | ||||
|                    <div>{{layerValue.date|date}}</div> | ||||
|                    <div><span *ngIf="layerValue.quantity"><span class="me-1">{{layerValue.quantity}}</span> </span><span class="me-1 font-weight-bold">{{layerValue.value}}</span><span>{{layerValue.unit}}</span></div> | ||||
|                    <div><span *ngIf="layerValue.quantity"><span class="me-1">{{layerValue.quantity}}</span> </span><span class="me-1 font-weight-bold">{{getScaledValue(layerValue)}}</span><span>{{layerValue.unit}}</span></div> | ||||
|                </li> | ||||
|            </ul> | ||||
|            <ng-template #no_data> | ||||
| @@ -15,4 +15,4 @@ | ||||
|            </ng-template> | ||||
|        </div> | ||||
|    </div> | ||||
| </div>> | ||||
| </div> | ||||
|   | ||||
| @@ -1,16 +1,16 @@ | ||||
| import { Component, OnInit,Input,ViewChild,ElementRef,AfterViewInit } from '@angular/core'; | ||||
| import {IItemLayer} from '../../../models/item.layer'; | ||||
| import { Component, OnInit, Input, ViewChild, ElementRef, AfterViewInit } from '@angular/core'; | ||||
| import { IItemLayer } from '../../../models/item.layer'; | ||||
| import { Store } from '@ngrx/store'; | ||||
| import * as mapReducers from '../../../reducers/map.reducer'; | ||||
| import * as mapActions from '../../../actions/map.actions'; | ||||
| import { MapComponent } from 'ngx-openlayers'; | ||||
| import { ILayervalue } from '../../../models/layer.value'; | ||||
| import { Observable,interval,Subject } from 'rxjs'; | ||||
| import { Observable, interval, Subject } from 'rxjs'; | ||||
| import { debounce, throttle } from 'rxjs/operators'; | ||||
| import { toLonLat } from 'ol/proj'; | ||||
| import { toStringHDMS } from 'ol/coordinate'; | ||||
| import { ClipboardService } from 'ngx-clipboard' | ||||
| import {GeoJSON,WKT} from 'ol/format'; | ||||
| import { GeoJSON, WKT } from 'ol/format'; | ||||
| import { Point } from 'ol/geom'; | ||||
|  | ||||
| @Component({ | ||||
| @@ -18,45 +18,53 @@ import { Point } from 'ol/geom'; | ||||
|   templateUrl: './layer-values.component.html', | ||||
|   styleUrls: ['./layer-values.component.scss'] | ||||
| }) | ||||
| export class LayerValuesComponent implements OnInit,AfterViewInit { | ||||
| export class LayerValuesComponent implements OnInit, AfterViewInit { | ||||
|  | ||||
|   @ViewChild('layerValues') containerRef:ElementRef; | ||||
|   offsetX$:number =0; | ||||
|   offsetY$:number =0; | ||||
|   lonlat$: string=""; | ||||
|   wkt$= ""; | ||||
|   layerValues$:Observable<Array<ILayervalue>> = this.store.select(mapReducers.selectGetLayerValues); | ||||
|   enabled$:Observable<boolean> = this.store.select(mapReducers.selectGetLayerValuesEnabled); | ||||
|   wktFormat$:WKT; | ||||
|   @ViewChild('layerValues') containerRef: ElementRef; | ||||
|   offsetX$ = 0; | ||||
|   offsetY$ = 0; | ||||
|   lonlat$ = ""; | ||||
|   wkt$ = ""; | ||||
|   layerValues$: Observable<Array<ILayervalue>> = this.store.select(mapReducers.selectGetLayerValues); | ||||
|   enabled$: Observable<boolean> = this.store.select(mapReducers.selectGetLayerValuesEnabled); | ||||
|   wktFormat$: WKT; | ||||
|  | ||||
|   constructor( private store: Store<mapReducers.State>,private map: MapComponent,private clipboardService$:ClipboardService) {    | ||||
|     this.wktFormat$=new WKT(); | ||||
|   constructor(private store: Store<mapReducers.State>, private map: MapComponent, private clipboardService$: ClipboardService) { | ||||
|     this.wktFormat$ = new WKT(); | ||||
|   } | ||||
|  | ||||
|   ngOnInit(): void { | ||||
|     | ||||
|  | ||||
|   } | ||||
|  | ||||
|   moveEndSubject = new Subject<any>(); | ||||
|  | ||||
|   ngAfterViewInit():void { | ||||
|   ngAfterViewInit(): void { | ||||
|     this.offsetY$ = this.containerRef.nativeElement.offsetTop; | ||||
|     this.offsetX$ = this.containerRef.nativeElement.offsetLeft; | ||||
|     this.map.instance.on('moveend', () => { | ||||
|       this.moveEndSubject.next({});      | ||||
|       this.moveEndSubject.next({}); | ||||
|     }); | ||||
|     this.moveEndSubject.pipe(throttle(ev => interval(100))).subscribe(() =>  this.updateValuesLocation()); | ||||
|     this.moveEndSubject.pipe(throttle(ev => interval(100))).subscribe(() => this.updateValuesLocation()); | ||||
|   } | ||||
|  | ||||
|   updateValuesLocation() { | ||||
|     var xy = this.map.instance.getCoordinateFromPixel([this.offsetX$,this.offsetY$]) | ||||
|     var lonlat = toLonLat(xy); | ||||
|     const xy = this.map.instance.getCoordinateFromPixel([this.offsetX$, this.offsetY$]) | ||||
|     const lonlat = toLonLat(xy); | ||||
|     this.wkt$ = this.wktFormat$.writeGeometry(new Point(lonlat)) | ||||
|     this.lonlat$ = toStringHDMS(lonlat); | ||||
|     this.store.dispatch(new mapActions.SetLayerValuesLocation(xy[0],xy[1])); | ||||
|   }   | ||||
|     this.store.dispatch(new mapActions.SetLayerValuesLocation(xy[0], xy[1])); | ||||
|   } | ||||
|  | ||||
|   copyToClipboard() { | ||||
|     this.clipboardService$.copy(this.wkt$); | ||||
|   } | ||||
|  | ||||
|   public getScaledValue(layerValue: ILayervalue): number { | ||||
|     let v = layerValue.value; | ||||
|     if (layerValue.scale && layerValue.scale != 0) { | ||||
|       v = layerValue.scale * layerValue.value; | ||||
|     } | ||||
|     return v; | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -1,11 +1,8 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
|  | ||||
| .gps-location { | ||||
|   display:block;  | ||||
|   width:2.5em; | ||||
|   height:2.5em; | ||||
|   background-color: $body-bg; | ||||
|   background-color: var(--bs-body-bg); | ||||
|   background-size: contain; | ||||
|   margin-top:0.5em; | ||||
|   border-radius: 1.75em; | ||||
| @@ -17,15 +14,15 @@ | ||||
| } | ||||
|  | ||||
| .pan-to { | ||||
|   fill: $secondary; | ||||
|   fill: var(--bs-secondary); | ||||
| } | ||||
|  | ||||
| div.gps-location:hover .pan-to { | ||||
|   fill: $white; | ||||
|   fill: var(--bs-white); | ||||
| } | ||||
|  | ||||
| .pan-to-centered { | ||||
|   fill: $primary; | ||||
|   fill: var(--bs-primary); | ||||
| } | ||||
|  | ||||
| div.gps-location:hover .pan-to-centered { | ||||
| @@ -33,5 +30,5 @@ div.gps-location:hover .pan-to-centered { | ||||
| } | ||||
|  | ||||
| .pan-to.pan-to-disabled { | ||||
|   fill: $gray-300; | ||||
|   fill: var(--bs-gray-300); | ||||
| } | ||||
|   | ||||
| @@ -43,12 +43,12 @@ export class PanToLocation  implements OnInit,OnChanges{ | ||||
|  | ||||
|   public centered():boolean { | ||||
|     if(this.position && this.mapState) { | ||||
|       let center = this.view.getCenter(); | ||||
|       let newCenter = fromLonLat([this.position.coords.longitude,this.position.coords.latitude]); | ||||
|       let x1 = newCenter[0].toFixed(0); | ||||
|       let x2 = center[0].toFixed(0); | ||||
|       let y1 = newCenter[1].toFixed(0); | ||||
|       let y2 = center[1].toFixed(0); | ||||
|       const center = this.view.getCenter(); | ||||
|       const newCenter = fromLonLat([this.position.coords.longitude,this.position.coords.latitude]); | ||||
|       const x1 = newCenter[0].toFixed(0); | ||||
|       const x2 = center[0].toFixed(0); | ||||
|       const y1 = newCenter[1].toFixed(0); | ||||
|       const y2 = center[1].toFixed(0); | ||||
|       return x1==x2 && y1==y2;   | ||||
|     } | ||||
|     return false; | ||||
| @@ -60,17 +60,17 @@ export class PanToLocation  implements OnInit,OnChanges{ | ||||
|  | ||||
|   handleClick(event:Event) { | ||||
|     if(this.position) { | ||||
|       let view = this.map.instance.getView(); | ||||
|       let newCenter = fromLonLat([this.position.coords.longitude,this.position.coords.latitude]); | ||||
|       let extent = [newCenter[0]-500,newCenter[1]-500,newCenter[0]+500,newCenter[1]+500]; | ||||
|       var options = { padding: [0, 0, 0, 0],minResolution:1 }; | ||||
|       let size = this.map.instance.getSize(); | ||||
|       let rem = parseFloat(getComputedStyle(document.documentElement).fontSize); | ||||
|       let threshold = 44 * rem; | ||||
|       var left = 1 * rem; | ||||
|       var right = 1 * rem; | ||||
|       var bottom = Math.round(size[1] / 2); | ||||
|       var top = 1 * rem; | ||||
|       const view = this.map.instance.getView(); | ||||
|       const newCenter = fromLonLat([this.position.coords.longitude,this.position.coords.latitude]); | ||||
|       const extent = [newCenter[0]-500,newCenter[1]-500,newCenter[0]+500,newCenter[1]+500]; | ||||
|       const options = { padding: [0, 0, 0, 0],minResolution:1 }; | ||||
|       const size = this.map.instance.getSize(); | ||||
|       const rem = parseFloat(getComputedStyle(document.documentElement).fontSize); | ||||
|       const threshold = 44 * rem; | ||||
|       let left = 1 * rem; | ||||
|       const right = 1 * rem; | ||||
|       let bottom = Math.round(size[1] / 2); | ||||
|       const top = 1 * rem; | ||||
|       if (size[0] > threshold) { | ||||
|         bottom = 1 * rem; | ||||
|         left = 23 * rem; | ||||
|   | ||||
| @@ -1,5 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| .compass { | ||||
|   width:2.5em; | ||||
|   height:2.5em; | ||||
| @@ -13,7 +11,7 @@ | ||||
|  | ||||
| #north { | ||||
|   display: none; | ||||
|   fill:$black; | ||||
|   fill:var(--bs-black); | ||||
| } | ||||
|  | ||||
| #top-l { | ||||
| @@ -33,23 +31,23 @@ | ||||
| } | ||||
|  | ||||
| div.compass:hover #top-l { | ||||
|   fill:$white; | ||||
|   fill:var(--bs-white); | ||||
| } | ||||
|  | ||||
| div.compass:hover #top-r { | ||||
|   fill:$gray-300; | ||||
|   fill:var(--bs-gray-300); | ||||
| } | ||||
|  | ||||
| div.compass:hover #bottom-l { | ||||
|   fill:$gray-300; | ||||
|   fill:var(--bs-gray-300); | ||||
| } | ||||
|  | ||||
| div.compass:hover #bottom-r { | ||||
|   fill:$white; | ||||
|   fill:var(--bs-white); | ||||
| } | ||||
|  | ||||
| div.compass:hover #north { | ||||
|   fill:$white; | ||||
|   fill:var(--bs-white); | ||||
| } | ||||
|  | ||||
| .compass-n {     | ||||
|   | ||||
| @@ -14,7 +14,7 @@ export class RotationResetComponent implements OnInit { | ||||
|   view: View; | ||||
|  | ||||
|   public Rotation() { | ||||
|     let rotation =  this.view ? this.view.getRotation() : 0; | ||||
|     const rotation =  this.view ? this.view.getRotation() : 0; | ||||
|     return `rotate(${rotation}rad)`; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -10,19 +10,19 @@ import { ViewComponent, MapComponent } from 'ngx-openlayers'; | ||||
| export class ZoomToExtentComponent implements OnChanges { | ||||
|   view: ViewComponent; | ||||
|   map: MapComponent; | ||||
|   paddingTop: number = 0; | ||||
|   paddingLeft: number = 0; | ||||
|   paddingBottom: number = 0; | ||||
|   paddingRight: number = 0; | ||||
|   paddingTop = 0; | ||||
|   paddingLeft = 0; | ||||
|   paddingBottom = 0; | ||||
|   paddingRight = 0; | ||||
|  | ||||
|   @Input() extent: number[]; | ||||
|   @Input() animate: boolean = false; | ||||
|   @Input() animate = false; | ||||
|  | ||||
|   constructor(@Host() view: ViewComponent, @Host() map: MapComponent,route: ActivatedRoute ) { | ||||
|     this.view = view; | ||||
|     this.map = map; | ||||
|     if(route && route.snapshot && route.snapshot.data && route.snapshot.data["fm-map-zoom-to-extent"]) { | ||||
|       let params = route.snapshot.data["fm-map-zoom-to-extent"]; | ||||
|       const params = route.snapshot.data["fm-map-zoom-to-extent"]; | ||||
|       this.paddingTop = params["padding-top"] ? params["padding-top"] : 0; | ||||
|       this.paddingBottom = params["padding-bottom"] ? params["padding-bottom"] : 0; | ||||
|       this.paddingLeft = params["padding-left"] ? params["padding-left"] : 0; | ||||
| @@ -32,14 +32,14 @@ export class ZoomToExtentComponent implements OnChanges { | ||||
|  | ||||
|   ngOnChanges(changes: SimpleChanges) { | ||||
|     if (this.extent) { | ||||
|       var options = { padding: [0, 0, 0, 0],minResolution:1 }; | ||||
|       let size = this.map.instance.getSize(); | ||||
|       let rem = parseFloat(getComputedStyle(document.documentElement).fontSize); | ||||
|       let threshold = 40 * rem; | ||||
|       var left = 1 * rem; | ||||
|       var right = 1 * rem; | ||||
|       var bottom = Math.round((size[1] / 2) + (4*rem)); | ||||
|       var top = 1 * rem; | ||||
|       const options = { padding: [0, 0, 0, 0],minResolution:1 }; | ||||
|       const size = this.map.instance.getSize(); | ||||
|       const rem = parseFloat(getComputedStyle(document.documentElement).fontSize); | ||||
|       const threshold = 40 * rem; | ||||
|       let left = 1 * rem; | ||||
|       const right = 1 * rem; | ||||
|       let bottom = Math.round((size[1] / 2) + (4*rem)); | ||||
|       const top = 1 * rem; | ||||
|       if (size[0] > threshold) { | ||||
|         bottom = 5 * rem; | ||||
|         left = 23 * rem; | ||||
|   | ||||
| @@ -1,14 +1,10 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
|  | ||||
|  | ||||
| .row { | ||||
|   border-bottom: 1px solid $gray-500; | ||||
|   border-bottom: 1px solid var(--bs-gray-500); | ||||
|   user-select: none; | ||||
| } | ||||
|  | ||||
| .row.selected { | ||||
|   background-color: $gray-100; | ||||
|   background-color: var(--bs-gray-100); | ||||
| } | ||||
|  | ||||
| @media screen and (min-width: 44rem)  { | ||||
|   | ||||
| @@ -33,7 +33,7 @@ export class FeatureListContainerComponent { | ||||
|     let componentFactory: ComponentFactory<AbstractFeatureListComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListComponent); // default | ||||
|     let selected = -1; | ||||
|     let maxMatches =0; | ||||
|     let showItem = true; | ||||
|     const showItem = true; | ||||
|     for (let i = 0; i < this.featureLists.length; i++) { | ||||
|       let matches=0; | ||||
|       let criteria=0; | ||||
| @@ -64,9 +64,9 @@ export class FeatureListContainerComponent { | ||||
|     viewContainerRef.clear(); | ||||
|     if(showItem) { | ||||
|       this.componentRef = viewContainerRef.createComponent(componentFactory); | ||||
|       (<AbstractFeatureListComponent>this.componentRef.instance).features = null; | ||||
|       (<AbstractFeatureListComponent>this.componentRef.instance).queryState = queryState; | ||||
|       (<AbstractFeatureListComponent>this.componentRef.instance).selectedFeature = null; | ||||
|       (<AbstractFeatureListComponent>this.componentRef.instance).features = this.features; | ||||
|       (<AbstractFeatureListComponent>this.componentRef.instance).queryState = this.queryState; | ||||
|       (<AbstractFeatureListComponent>this.componentRef.instance).selectedFeature = this.selectedFeature; | ||||
|     }     | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -1,22 +1,20 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| fm-map-feature-list-feature-container { | ||||
|   width:100%; | ||||
|   pointer-events:none; | ||||
| } | ||||
|  | ||||
| .row { | ||||
|   border-bottom: 1px solid $gray-500; | ||||
|   border-bottom: 1px solid var(--bs-gray-500); | ||||
|   user-select: none; | ||||
|   padding-left:1.5rem; | ||||
| } | ||||
|  | ||||
| .row.selected { | ||||
|   background-color: $gray-100; | ||||
|   background-color: var(--bs-gray-100); | ||||
| } | ||||
|  | ||||
| .cropfields { | ||||
|   border-top: 1px solid $gray-500; | ||||
|   border-top: 1px solid var(--bs-gray-500); | ||||
|   margin-left: -1.25rem; | ||||
|   margin-right: -1.25rem; | ||||
| } | ||||
|   | ||||
| @@ -1,22 +1,20 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| fm-map-feature-list-feature-container { | ||||
|   width:100%; | ||||
|   pointer-events:none; | ||||
| } | ||||
|  | ||||
| .row { | ||||
|   border-bottom: 1px solid $gray-500; | ||||
|   border-bottom: 1px solid var(--bs-gray-500); | ||||
|   user-select: none; | ||||
|   padding-left:1.5rem; | ||||
| } | ||||
|  | ||||
| .row.selected { | ||||
|   background-color: $gray-100; | ||||
|   background-color: var(--bs-gray-100); | ||||
| } | ||||
|  | ||||
| .farms { | ||||
|   border-top: 1px solid $gray-500; | ||||
|   border-top: 1px solid var(--bs-gray-500); | ||||
|   margin-left: -1.25rem; | ||||
|   margin-right: -1.25rem; | ||||
| } | ||||
|   | ||||
| @@ -25,7 +25,7 @@ export class FeatureListCroppingschemeComponent extends AbstractFeatureListCompo | ||||
|     } | ||||
|  | ||||
|     getAction(feature:Feature<Geometry>):Action { | ||||
|         var queryState = tassign(mapReducers.initialState.queryState, { parentCode: feature.get('code'), itemType: "vnd.farmmaps.itemtype.cropfield" }); | ||||
|         const queryState = tassign(mapReducers.initialState.queryState, { parentCode: feature.get('code'), itemType: "vnd.farmmaps.itemtype.cropfield" }); | ||||
|         return new mapActions.DoQuery(queryState); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -24,7 +24,7 @@ export class FeatureListFeatureContainerComponent { | ||||
|   @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;  | ||||
|  | ||||
|   loadComponent() { | ||||
|     var componentFactory: ComponentFactory<AbstractFeatureListFeatureComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListFeatureComponent); // default | ||||
|     let componentFactory: ComponentFactory<AbstractFeatureListFeatureComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListFeatureComponent); // default | ||||
|     | ||||
|     let selected = -1; | ||||
|     let maxMatches =0; | ||||
|   | ||||
| @@ -1,7 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
|  | ||||
|  | ||||
| .card-title { | ||||
|   font-size: 1rem; | ||||
|   white-space: nowrap; | ||||
|   | ||||
| @@ -27,7 +27,7 @@ export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFea | ||||
|   areaInHa(feature:Feature<Geometry>):number { | ||||
|     if(!feature) return 0; | ||||
|     // get area from faeture if 0 calculate from polygon | ||||
|     let a = feature.get('area'); | ||||
|     const a = feature.get('area'); | ||||
|     if(a) return a; | ||||
|     return  getArea(feature.getGeometry(),{projection:"EPSG:3857"}) / 10000; | ||||
|   } | ||||
|   | ||||
| @@ -1,7 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
|  | ||||
|  | ||||
| .card-title { | ||||
|   font-size: 1rem; | ||||
|   white-space: nowrap; | ||||
|   | ||||
| @@ -1,7 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
|  | ||||
|  | ||||
| .card-title { | ||||
|   font-size: 1rem; | ||||
|   white-space: nowrap; | ||||
|   | ||||
| @@ -1,15 +1,13 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| fm-map-feature-list-feature-container { | ||||
|   width: 100%; | ||||
|   pointer-events: none; | ||||
| } | ||||
|  | ||||
| .row { | ||||
|   border-bottom: 1px solid $gray-500; | ||||
|   border-bottom: 1px solid var(--bs-gray-500); | ||||
|   user-select: none; | ||||
| } | ||||
|  | ||||
| .row.selected { | ||||
|   background-color: $gray-100; | ||||
|   background-color: var(--bs-gray-100); | ||||
| } | ||||
|   | ||||
| @@ -23,13 +23,14 @@ export abstract class AbstractFeatureListComponent { | ||||
|  | ||||
|   handleFeatureClick(feature:Feature<Geometry>) { | ||||
|     if(feature) { | ||||
|       let action = this.getAction(feature); | ||||
|       this.store.dispatch(action);   | ||||
|       this.store.dispatch(new mapActions.ClickFeature(feature)); | ||||
|       const action = this.getAction(feature); | ||||
|       this.store.dispatch(action); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   getAction(feature:Feature<Geometry>):Action { | ||||
|       var newQuery: any = tassign(mapReducers.initialState.queryState); | ||||
|       const newQuery: any = tassign(mapReducers.initialState.queryState); | ||||
|       newQuery.parentCode = feature.get('parentCode'); | ||||
|       newQuery.itemCode = feature.get('code'); | ||||
|       newQuery.itemType = feature.get('itemType'); | ||||
|   | ||||
| @@ -30,7 +30,7 @@ export class GeometryThumbnailComponent implements AfterViewInit { | ||||
|       this.geometry, | ||||
|       this.width,  | ||||
|       this.height); | ||||
|   }; | ||||
|   } | ||||
|  | ||||
|   private defaultStyle:style.Style = new style.Style({ | ||||
|     stroke: new style.Stroke({ color: 'black',width:1.5 }) | ||||
| @@ -52,24 +52,24 @@ export class GeometryThumbnailComponent implements AfterViewInit { | ||||
|       this.height); | ||||
|   } | ||||
|  | ||||
|   private width:number = 0; | ||||
|   private height:number = 0; | ||||
|   private width = 0; | ||||
|   private height = 0; | ||||
|  | ||||
|   render(canvas,style:style.Style,geometry:Geometry,width:number,height:number) {   | ||||
|     if(canvas && canvas.nativeElement && geometry && style) { | ||||
|       let renderContext = render.toContext(canvas.nativeElement.getContext( '2d'),{ size: [width, height] });   | ||||
|       const renderContext = render.toContext(canvas.nativeElement.getContext( '2d'),{ size: [width, height] });   | ||||
|  | ||||
|       let geom   = geometry.clone() as Polygon, | ||||
|       const geom   = geometry.clone() as Polygon, | ||||
|       line   = geom.getCoordinates()[0], | ||||
|       e = extent.boundingExtent( line ); | ||||
|    | ||||
|       let dxy = extent.getCenter(e), | ||||
|       const dxy = extent.getCenter(e), | ||||
|       sxy = [  | ||||
|           (width - 2 ) / extent.getWidth(e), | ||||
|           (height - 2 ) / extent.getHeight(e) | ||||
|       ]; | ||||
|    | ||||
|       let dx = dxy[0],  | ||||
|       const dx = dxy[0],  | ||||
|           dy = dxy[1], | ||||
|           sx = sxy[0], | ||||
|           sy = sxy[1]; | ||||
|   | ||||
| @@ -43,9 +43,9 @@ export class ifZoomToShowDirective  implements OnInit { | ||||
|  | ||||
|   checkZoom() { | ||||
|     if(this.layer$ && this.map$.instance) { | ||||
|       let minZoom = this.layer$.getMinZoom(); | ||||
|       let currentZoom = this.map$.instance.getView().getZoom(); | ||||
|       let view = currentZoom < minZoom; | ||||
|       const minZoom = this.layer$.getMinZoom(); | ||||
|       const currentZoom = this.map$.instance.getView().getZoom(); | ||||
|       const view = currentZoom < minZoom; | ||||
|       if(view!= this.showView) { | ||||
|         this.viewContainerRef$.clear(); | ||||
|         this.showView=view; | ||||
|   | ||||
| @@ -23,11 +23,11 @@ export class ItemListItemContainerComponent { | ||||
|   @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;  | ||||
|  | ||||
|   loadComponent() { | ||||
|     var componentFactory: ComponentFactory<AbstractItemListItemComponent> = this.componentFactoryResolver.resolveComponentFactory(ItemListItemComponent); // default | ||||
|     let componentFactory: ComponentFactory<AbstractItemListItemComponent> = this.componentFactoryResolver.resolveComponentFactory(ItemListItemComponent); // default | ||||
|  | ||||
|     let selected = -1; | ||||
|     let maxMatches =0; | ||||
|     let showItem = true; | ||||
|     const showItem = true; | ||||
|     for (let i = 0; i < this.itemComponentList.length; i++) { | ||||
|       let matches=0; | ||||
|       let criteria=0; | ||||
|   | ||||
| @@ -1,5 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| .widget { | ||||
|   padding:0.8rem; | ||||
|   height:100%; | ||||
|   | ||||
| @@ -13,7 +13,7 @@ export abstract class AbstractItemListItemComponent { | ||||
|   constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService) { | ||||
|   }  | ||||
|  | ||||
|   getScaledValue(value:number,scale:number = 0):number { | ||||
|   getScaledValue(value:number,scale = 0):number { | ||||
|     let v = value; | ||||
|     if(scale && scale != 0) { | ||||
|       v=scale*value; | ||||
| @@ -30,7 +30,7 @@ export abstract class AbstractItemWidgetComponent { | ||||
|   constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService) { | ||||
|   } | ||||
|  | ||||
|   getScaledValue(value:number,scale:number = 0):number { | ||||
|   getScaledValue(value:number,scale = 0):number { | ||||
|     let v = value; | ||||
|     if(scale && scale != 0) { | ||||
|       v=scale*value; | ||||
|   | ||||
| @@ -1,5 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| .widget-container { | ||||
|   overflow:auto; | ||||
|   margin-bottom:1rem; | ||||
| @@ -7,7 +5,7 @@ | ||||
|  | ||||
| .widget { | ||||
|   position:relative; | ||||
|   border: 1px solid $gray-500; | ||||
|   border: 1px solid var(--bs-gray-500); | ||||
|   user-select: none; | ||||
|   display:inline-block; | ||||
|   width:50%; | ||||
| @@ -28,7 +26,7 @@ | ||||
| } | ||||
|  | ||||
| .widget:hover { | ||||
|   background-color: $gray-100; | ||||
|   background-color: var(--bs-gray-100); | ||||
| } | ||||
|  | ||||
| .widget-container { | ||||
|   | ||||
| @@ -15,7 +15,7 @@ export abstract class AbstractItemListComponent { | ||||
|   } | ||||
|  | ||||
|   handleItemClick(item:IListItem) { | ||||
|     var newQuery: any = tassign(mapReducers.initialState.query); | ||||
|     const newQuery: any = tassign(mapReducers.initialState.query); | ||||
|     newQuery.itemCode = item.code; | ||||
|     this.store.dispatch(new mapActions.DoQuery(newQuery)); | ||||
|   } | ||||
|   | ||||
| @@ -1,5 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| .widget-container { | ||||
|   overflow:auto; | ||||
|   margin-bottom:1rem; | ||||
| @@ -7,7 +5,7 @@ | ||||
|  | ||||
| .widget { | ||||
|   position:relative; | ||||
|   border: 1px solid $gray-500; | ||||
|   border: 1px solid var(--bs-gray-500); | ||||
|   user-select: none; | ||||
|   display:inline-block; | ||||
|   width:50%; | ||||
| @@ -28,7 +26,7 @@ | ||||
| } | ||||
|  | ||||
| .widget:hover { | ||||
|   background-color: $gray-100; | ||||
|   background-color: var(--bs-gray-100); | ||||
| } | ||||
|  | ||||
| .widget-container { | ||||
|   | ||||
| @@ -23,10 +23,10 @@ export class ItemWidgetListComponent implements AfterViewInit { | ||||
|   } | ||||
|  | ||||
|   ngAfterViewInit() { | ||||
|     let targets = this.widgetTargets.toArray(); | ||||
|     const targets = this.widgetTargets.toArray(); | ||||
|     if(this.widgets) { | ||||
|       for (var i = 0; i < this.widgets.length; i++) { | ||||
|         var componentFactory: ComponentFactory<AbstractItemWidgetComponent> = this.componentFactoryResolver.resolveComponentFactory(this.widgets[i]['constructor'] as any); | ||||
|       for (let i = 0; i < this.widgets.length; i++) { | ||||
|         const componentFactory: ComponentFactory<AbstractItemWidgetComponent> = this.componentFactoryResolver.resolveComponentFactory(this.widgets[i]['constructor'] as any); | ||||
|         const viewContainerRef = targets[i]; | ||||
|         viewContainerRef.clear(); | ||||
|    | ||||
|   | ||||
| @@ -1,18 +1,15 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
|  | ||||
| .layer-switcher {   | ||||
|   display:block;  | ||||
|   width:2.5em; | ||||
|   height:2.5em; | ||||
|   background-color: $body-bg; | ||||
|   background-color: var(--bs-body-bg); | ||||
|   background-size: contain; | ||||
|   margin-top:0.5em; | ||||
|   text-align: center; | ||||
|   line-height: 2.5em;  | ||||
|   border-radius: 1.75em; | ||||
|   padding: 0; | ||||
|   color: $secondary; | ||||
|   color: var(--bs-secondary); | ||||
| } | ||||
|  | ||||
| .layer-switcher i { | ||||
| @@ -24,7 +21,7 @@ | ||||
| } | ||||
|  | ||||
| .layers { | ||||
|   color:$secondary; | ||||
|   color:var(--bs-secondary); | ||||
|   position: absolute; | ||||
|   overflow: hidden; | ||||
|   bottom: -1em; | ||||
|   | ||||
| @@ -62,7 +62,7 @@ export class LayerSwitcher  implements OnInit,OnChanges{ | ||||
|   } | ||||
|  | ||||
|   handleZoomToExtent(itemLayer: IItemLayer) { | ||||
|     var extent =  createEmpty(); | ||||
|     const extent =  createEmpty(); | ||||
|     extend(extent, itemLayer.layer.getExtent()); | ||||
|     if (extent) { | ||||
|       this.store.dispatch(new mapActions.SetExtent(extent)); | ||||
|   | ||||
| @@ -1,15 +1,15 @@ | ||||
| <div class="row ps-3"> | ||||
|   <div class="col-8 nopadding"><span i18n>Average</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{histogram.mean| number:'1.0-2'}}</div> | ||||
|   <div class="col-4 pull-left nopadding">{{ getScaledValue(histogram.mean)| number:'1.0-2'}}</div> | ||||
|   <div class="col-8 nopadding"><span i18n>Standard deviation</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{histogram.stddev| number:'1.0-2'}}</div> | ||||
|   <div class="col-4 pull-left nopadding">{{ getScaledValue(histogram.stddev)| number:'1.0-2'}}</div> | ||||
|   <div class="col-8 nopadding"><span i18n>Min</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{histogram.min| number:'1.0-2'}}</div> | ||||
|   <div class="col-4 pull-left nopadding">{{ getScaledValue(histogram.min)| number:'1.0-2'}}</div> | ||||
|   <div class="col-8 nopadding" ><span i18n>Max</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{histogram.max| number:'1.0-2'}}</div> | ||||
|   <div class="col-4 pull-left nopadding">{{ getScaledValue(histogram.max)| number:'1.0-2'}}</div> | ||||
|  | ||||
|   <ng-container *ngIf="showConfidenceInterval()"> | ||||
|     <div class="col-8 nopadding"><span i18n>Confidence interval</span>:</div> | ||||
|     <div class="col-4 pull-left nopadding">{{histogram.confidence * 100| number:'1.0-0'}}%</div> | ||||
|     <div class="col-4 pull-left nopadding">{{ getScaledValue(histogram.confidence * 100)| number:'1.0-0'}}%</div> | ||||
|   </ng-container> | ||||
| </div> | ||||
|   | ||||
| @@ -14,6 +14,17 @@ export class HistogramDetailsComponent { | ||||
|   @Input() | ||||
|   histogram: IHistogram; | ||||
|  | ||||
|   @Input() | ||||
|   scale: number | null; | ||||
|  | ||||
|   public getScaledValue(value: number): number { | ||||
|     let v = value; | ||||
|     if (this.scale && this.scale != 0) { | ||||
|       v = this.scale * value; | ||||
|     } | ||||
|     return v; | ||||
|   } | ||||
|  | ||||
|   showConfidenceInterval(): boolean { | ||||
|     return this.histogram.confidence != null && this.histogram.confidence !== 1; | ||||
|   } | ||||
|   | ||||
| @@ -31,11 +31,11 @@ | ||||
|     <td colspan="4" class="pb-1 pt-1"> | ||||
|       <div class="info" [ngbCollapse]="hideHistogramDetails"> | ||||
|         <ng-container *ngIf="bandContainsStatistics(); else histogram"> | ||||
|           <fm-map-statistics-details [statistics]="layer.renderer.band.statistics"></fm-map-statistics-details> | ||||
|           <fm-map-statistics-details [statistics]="layer.renderer.band.statistics" [scale]="layer.scale"></fm-map-statistics-details> | ||||
|         </ng-container> | ||||
|  | ||||
|         <ng-template #histogram> | ||||
|           <fm-map-histogram-details [histogram]="layer.renderer.band.histogram"></fm-map-histogram-details> | ||||
|           <fm-map-histogram-details [histogram]="layer.renderer.band.histogram" [scale]="layer.scale"></fm-map-histogram-details> | ||||
|         </ng-template> | ||||
|       </div> | ||||
|     </td> | ||||
|   | ||||
| @@ -29,7 +29,7 @@ export class LegendComponent implements OnInit,AfterViewInit { | ||||
|   histogram: string; | ||||
|  | ||||
|   @Input() | ||||
|   showTitle: boolean = true; | ||||
|   showTitle = true; | ||||
|  | ||||
|   @Input() | ||||
|   histogramenabled: boolean; | ||||
| @@ -40,7 +40,7 @@ export class LegendComponent implements OnInit,AfterViewInit { | ||||
|   @Input() | ||||
|   histogramunit: string; | ||||
|  | ||||
|   public hideHistogramDetails:boolean = true; | ||||
|   public hideHistogramDetails = true; | ||||
|  | ||||
|   onClickHistoGram(): void { | ||||
|     this.histogramenabled = !this.histogramenabled; | ||||
| @@ -63,9 +63,9 @@ export class LegendComponent implements OnInit,AfterViewInit { | ||||
|   } | ||||
|  | ||||
|   public getPart(renderer: IRenderer, index: number): string { | ||||
|     let max = renderer.band.histogram.entries.reduce((max, entry) => entry.freqency > max ? entry.freqency : max, 0); | ||||
|     let scale = 65 / max; | ||||
|     let part = (renderer.band.histogram.entries[index].freqency * scale) + "%"; | ||||
|     const max = renderer.band.histogram.entries.reduce((max, entry) => entry.freqency > max ? entry.freqency : max, 0); | ||||
|     const scale = 65 / max; | ||||
|     const part = (renderer.band.histogram.entries[index].freqency * scale) + "%"; | ||||
|  | ||||
|     return part; | ||||
|   } | ||||
| @@ -79,8 +79,8 @@ export class LegendComponent implements OnInit,AfterViewInit { | ||||
|   } | ||||
|  | ||||
|   public getPercentage(renderer: IRenderer, index: number): number { | ||||
|     let scale = 100 / renderer.band.histogram.entries.reduce((sum, entry) => sum + entry.freqency, 0); | ||||
|     let percent = renderer.band.histogram.entries[index].freqency * scale; | ||||
|     const scale = 100 / renderer.band.histogram.entries.reduce((sum, entry) => sum + entry.freqency, 0); | ||||
|     const percent = renderer.band.histogram.entries[index].freqency * scale; | ||||
|     return percent < 0.1 ? null : percent; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -2,23 +2,23 @@ | ||||
|   <div class="col-8 nopadding"><span i18n>Data points</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{statistics.populationCount}}</div> | ||||
|   <div class="col-8 nopadding"><span i18n>Min</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{statistics.min| number:'1.0-2'}}</div> | ||||
|   <div class="col-4 pull-left nopadding">{{getScaledValue(statistics.min)| number:'1.0-2'}}</div> | ||||
|   <div class="col-8 nopadding"><span i18n>Max</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{statistics.max| number:'1.0-2'}}</div> | ||||
|   <div class="col-4 pull-left nopadding">{{getScaledValue(statistics.max)| number:'1.0-2'}}</div> | ||||
|   <div class="col-8 nopadding"><span i18n>Min+1</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{statistics.minPlus| number:'1.0-2'}}</div> | ||||
|   <div class="col-4 pull-left nopadding">{{getScaledValue(statistics.minPlus)| number:'1.0-2'}}</div> | ||||
|   <div class="col-8 nopadding"><span i18n>Max-1</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{statistics.maxMinus| number:'1.0-2'}}</div> | ||||
|   <div class="col-4 pull-left nopadding">{{getScaledValue(statistics.maxMinus)| number:'1.0-2'}}</div> | ||||
|  | ||||
|   <div class="col-8 nopadding"><span i18n>Average</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{statistics.mean| number:'1.0-2'}}</div> | ||||
|   <div class="col-4 pull-left nopadding">{{getScaledValue(statistics.mean)| number:'1.0-2'}}</div> | ||||
|   <div class="col-8 nopadding"><span i18n>Standard deviation</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{statistics.stddev| number:'1.0-2'}}</div> | ||||
|   <div class="col-4 pull-left nopadding">{{getScaledValue(statistics.stddev)| number:'1.0-2'}}</div> | ||||
|  | ||||
|   <div class="col-8 nopadding"><span i18n>Mode</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{statistics.mode| number:'1.0-2'}}</div> | ||||
|   <div class="col-4 pull-left nopadding">{{getScaledValue(statistics.mode)| number:'1.0-2'}}</div> | ||||
|   <div class="col-8 nopadding"><span i18n>Median</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{statistics.median| number:'1.0-2'}}</div> | ||||
|   <div class="col-4 pull-left nopadding">{{getScaledValue(statistics.median)| number:'1.0-2'}}</div> | ||||
|  | ||||
|   <div class="col-8 nopadding"><span i18n>Kurtosis</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{statistics.curtosis| number:'1.0-2'}}</div> | ||||
| @@ -26,11 +26,11 @@ | ||||
|   <div class="col-4 pull-left nopadding">{{statistics.skewness| number:'1.0-2'}}</div> | ||||
|  | ||||
|   <div class="col-8 nopadding"><span i18n>Variance</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{statistics.variance| number:'1.0-2'}}</div> | ||||
|   <div class="col-4 pull-left nopadding">{{getSquaredScaledValue(statistics.variance)| number:'1.0-2'}}</div> | ||||
|   <div class="col-8 nopadding"><span i18n>Coefficient of variation</span>:</div> | ||||
|   <div class="col-4 pull-left nopadding">{{statistics.variationCoefficient | number:'1.0-2'}}</div> | ||||
|   <ng-container *ngIf="statistics.confidenceIntervalLow !== undefined"> | ||||
|     <div class="col-8 nopadding">90% <span i18n>Confidence interval</span>:</div> | ||||
|     <div class="col-4 pull-left nopadding">{{statistics.confidenceIntervalLow | number:'1.0-2'}} - {{statistics.confidenceIntervalHigh | number:'1.0-2'}}</div> | ||||
|     <div class="col-4 pull-left nopadding">{{getScaledValue(statistics.confidenceIntervalLow) | number:'1.0-2'}} - {{getScaledValue(statistics.confidenceIntervalHigh) | number:'1.0-2'}}</div> | ||||
|   </ng-container> | ||||
| </div> | ||||
|   | ||||
| @@ -1,16 +1,35 @@ | ||||
| import {Component, Input} from '@angular/core'; | ||||
| import {IStatistics} from '../../../models/color.map'; | ||||
| import { Component, Input } from '@angular/core'; | ||||
| import { IStatistics } from '../../../models/color.map'; | ||||
|  | ||||
| @Component({ | ||||
|   selector: 'fm-map-statistics-details', | ||||
|   templateUrl: './statistics-details.component.html', | ||||
|   styles: ['.nopadding{\n' + | ||||
|   '  padding: 0 !important;\n' + | ||||
|   '  margin: 0 !important;\n' + | ||||
|   '}'] | ||||
|     '  padding: 0 !important;\n' + | ||||
|     '  margin: 0 !important;\n' + | ||||
|     '}'] | ||||
| }) | ||||
| export class StatisticsDetailsComponent { | ||||
|  | ||||
|   @Input() | ||||
|   statistics: IStatistics; | ||||
|   @Input() | ||||
|   scale: number | null; | ||||
|  | ||||
|   public getScaledValue(value: number): number { | ||||
|     let v = value; | ||||
|     if (this.scale && this.scale != 0) { | ||||
|       v = this.scale * value; | ||||
|     } | ||||
|     return v; | ||||
|   } | ||||
|  | ||||
|   public getSquaredScaledValue(value: number): number { | ||||
|     let v = value; | ||||
|     if (this.scale && this.scale != 0) { | ||||
|       v = (this.scale * this.scale) * value; | ||||
|     } | ||||
|     return v; | ||||
|   } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -1,5 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| div.map-search { | ||||
|   position: absolute; | ||||
|   top: 0.5rem; | ||||
| @@ -106,7 +104,7 @@ div.map-search.searchcollapsed button[type="submit"] { | ||||
| } | ||||
|  | ||||
| .form-control, .form-control:focus { | ||||
|   border-color: $secondary; | ||||
|   border-color: var(--bs-secondary); | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -50,21 +50,21 @@ export class MapSearchComponent { | ||||
|     }  | ||||
|   } | ||||
|  | ||||
|   public collapsedLocal: boolean = true; | ||||
|   public searchMinifiedLocal: boolean = false; | ||||
|   public collapsedLocal = true; | ||||
|   public searchMinifiedLocal = false; | ||||
|   public periodLocal: IPeriodState = { startDate:new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1), endDate:new Date(Date.now())}; | ||||
|   public filterOptionsLocal: IQueryState; | ||||
|   private extent: number[]; | ||||
|   public searchTextLocal: any; | ||||
|   public searchTextLocalOutput: string;  | ||||
|   public dateFilter: boolean = true;  | ||||
|   public dateFilter = true;  | ||||
|   public startEndCaption: string = this.timespanService.getCaption(this.periodLocal.startDate, this.periodLocal.endDate, 4); | ||||
|  | ||||
|   searching = false; | ||||
|   searchFailed = false; | ||||
|   hideSearchingWhenUnsubscribed = new Observable(() => () => this.searching = false); | ||||
|  | ||||
|   public disabled: boolean = true; | ||||
|   public disabled = true; | ||||
|  | ||||
|   constructor(private typeaheadService: TypeaheadService, private timespanService: TimespanService) { | ||||
|     this.filterOptionsLocal = { query: "", tags: "", startDate: null, endDate: null, bboxFilter: false, itemType: null, itemCode:null,level:0,parentCode:null,bbox:[] };    | ||||
|   | ||||
| @@ -10,6 +10,7 @@ | ||||
|   panelVisible:panelVisible$|async, | ||||
|   openedModalName:openedModalName$|async, | ||||
|   panelCollapsed:panelCollapsed$|async, | ||||
|   panelExtraWide:panelExtraWide$|async, | ||||
|   searchMinified:searchMinified$|async, | ||||
|   selectedItem:selectedItem$|async, | ||||
|   parentItem:parentItem$|async, | ||||
| @@ -64,7 +65,7 @@ | ||||
|     </div> | ||||
|     <div class="side-panel-container"> | ||||
|        | ||||
|       <fm-side-panel [resizeable]="true" (onResize)="handlePanelResize($event)" [visible]="state.panelVisible && noContent" [collapsed]="state.panelCollapsed" [collapsable]="false"> | ||||
|       <fm-side-panel [resizeable]="true" (onResize)="handlePanelResize($event)" [visible]="state.panelVisible && noContent" [collapsed]="state.panelCollapsed" [collapsable]="false" [extrawide]="state.panelExtraWide"> | ||||
|         <div class="panel-wrapper" *ngIf="noContent"> | ||||
|           <div class="panel-top bg-secondary" *ngIf="!(state.searchMinified)"> | ||||
|           </div> | ||||
|   | ||||
| @@ -1,5 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| aol-map { position:absolute;width:100%;height:calc( 100vh );} | ||||
|  | ||||
| .arrow { | ||||
| @@ -195,7 +193,7 @@ timespan.menuVisible { | ||||
|   width: 4rem; | ||||
|   overflow: hidden; | ||||
|   text-overflow: ellipsis; | ||||
|   color: $primary; | ||||
|   color: var(--bs-primary); | ||||
| } | ||||
|  | ||||
| .shortcut-icon > .farm-icon { | ||||
|   | ||||
| @@ -45,7 +45,7 @@ import * as style from 'ol/style'; | ||||
| }) | ||||
|  | ||||
| export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|   title: string = 'Map'; | ||||
|   title = 'Map'; | ||||
|   public openedModalName$: Observable<string> = this.store.select(commonReducers.selectOpenedModalName); | ||||
|   public itemTypes$: Observable<{ [id: string]: IItemType }>; | ||||
|   public mapState$: Observable<IMapState> = this.store.select(mapReducers.selectGetMapState); | ||||
| @@ -66,6 +66,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|   public parentCode$: Observable<string> =this.store.select(mapReducers.selectGetParentCode); | ||||
|   public panelVisible$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelVisible); | ||||
|   public panelCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelCollapsed); | ||||
|   public panelExtraWide$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelExtraWide); | ||||
|   public selectedFeature$: Observable<Feature<Geometry>> = this.store.select(mapReducers.selectGetSelectedFeature); | ||||
|   public clickedFeature: Subject<Feature<Geometry>> = new Subject<Feature<Geometry>>(); | ||||
|   public selectedItem$: Observable<IItem> = this.store.select(mapReducers.selectGetSelectedItem); | ||||
| @@ -81,20 +82,20 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|   public query$: Observable<IQuery> =  this.store.select(mapReducers.selectGetQuery); | ||||
|   public position$: Observable<GeolocationPosition> = this.geolocationService.getCurrentPosition(); | ||||
|   public compassHeading$: Observable<number> = this.deviceorientationService.getCurrentCompassHeading(); | ||||
|   public baseLayersCollapsed:boolean = true; | ||||
|   public overlayLayersCollapsed: boolean = true; | ||||
|   public baseLayersCollapsed = true; | ||||
|   public overlayLayersCollapsed = true; | ||||
|   public extent$: Observable<Extent> = this.store.select(mapReducers.selectGetExtent); | ||||
|   public styles$:Observable<IStyles> = this.store.select(mapReducers.selectGetStyles); | ||||
|   public fullscreen$: Observable<boolean> = this.store.select(commonReducers.selectGetFullScreen); | ||||
|   private lastUrl = ""; | ||||
|   private initialized: boolean = false; | ||||
|   public noContent: boolean = false; | ||||
|   public overrideSelectedItemLayer: boolean = false; | ||||
|   public overrideOverlayLayers: boolean = false; | ||||
|   public dataLayerSlideValue:number = 50; | ||||
|   private initialized = false; | ||||
|   public noContent = false; | ||||
|   public overrideSelectedItemLayer = false; | ||||
|   public overrideOverlayLayers = false; | ||||
|   public dataLayerSlideValue = 50; | ||||
|   public dataLayerSlideEnabled = false; | ||||
|   private visibleAreaBottom = 0; | ||||
|   private viewEnabled: boolean = true; | ||||
|   private viewEnabled = true; | ||||
|    | ||||
|   @ViewChild('map') map; | ||||
|   @ViewChild('contentDiv') contentDiv: ElementRef; | ||||
| @@ -112,18 +113,18 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|     private deviceorientationService:DeviceOrientationService, | ||||
|     public devicesService:DeviceService) { | ||||
|       if(route && route.snapshot && route.snapshot.data && route.snapshot.data["fm-map-map"]) { | ||||
|         let params = route.snapshot.data["fm-map-map"]; | ||||
|         const params = route.snapshot.data["fm-map-map"]; | ||||
|         this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false; | ||||
|         this.overrideOverlayLayers = params["overrideOverlayLayers"] ? params["overrideOverlayLayers"] : false; | ||||
|       } | ||||
|       this.querySub = this.query$.pipe(skip(1), withLatestFrom(this.mapState$)).subscribe(([query,mapState]) =>{ | ||||
|         if(query && query.querystate) { | ||||
|           let newQueryState = tassign(mapReducers.initialQueryState); | ||||
|           console.debug(`Do Query`); | ||||
|           let urlparts=[]; | ||||
|           //console.debug(`Do Query`); | ||||
|           const urlparts=[]; | ||||
|           if (query.querystate.itemCode && query.querystate.itemCode != "") { | ||||
|             if(query.querystate.itemType && query.querystate.itemType!= "") { | ||||
|               let itemType = this.itemTypeService.itemTypes[query.querystate.itemType]; | ||||
|               const itemType = this.itemTypeService.itemTypes[query.querystate.itemType]; | ||||
|               if (itemType && itemType.viewer && itemType.viewer == "edit_in_editor" && itemType.editor) { | ||||
|                 urlparts.push('/editor'); | ||||
|                 urlparts.push(itemType.editor); | ||||
| @@ -154,7 +155,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|  | ||||
|   @HostListener('document:keyup', ['$event']) | ||||
|   escapeClose(event: KeyboardEvent) { | ||||
|     let x = event.keyCode; | ||||
|     const x = event.keyCode; | ||||
|     if (x === 27) { | ||||
|       this.handleCloseModal() | ||||
|     } | ||||
| @@ -192,6 +193,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|   } | ||||
|  | ||||
|   handleFeatureClick(feature: Feature<Geometry>) { | ||||
|     this.store.dispatch(new mapActions.ClickFeature(feature)); | ||||
|     this.clickedFeature.next(feature); | ||||
|   } | ||||
|  | ||||
| @@ -207,12 +209,18 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|    if(component && component.hasOwnProperty('clickedFeature')) { | ||||
|      (component as IClickedFeature).clickedFeature = this.clickedFeature; | ||||
|    } | ||||
|    if(component && component.hasOwnProperty('extrawide')) { | ||||
|     this.store.dispatch(new mapActions.SetPanelExtraWide(true)); | ||||
|   } | ||||
|  } | ||||
|  | ||||
|   handleSidepaneloutletDeactivate(component:any) { | ||||
|     if(component && component.hasOwnProperty('clickedFeature')) { | ||||
|       (component as IClickedFeature).clickedFeature = null; | ||||
|     } | ||||
|     if(component && component.hasOwnProperty('extrawide')) { | ||||
|       this.store.dispatch(new mapActions.SetPanelExtraWide(false)); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   handlePrerender(event:any) { | ||||
| @@ -242,7 +250,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|  | ||||
|   ngOnInit() {     | ||||
|     this.initialized = false; | ||||
|     console.debug("Init"); | ||||
|     //console.debug("Init"); | ||||
|     this.store.dispatch(new mapActions.Clear()); | ||||
|     this.selectedFeatures$.next({x:0,y:0,features:[]}); | ||||
|     this.selectedFeatures$.next(null); | ||||
| @@ -268,19 +276,19 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|   } | ||||
|  | ||||
|   round(value:number,decimals:number):number { | ||||
|     let d = Math.pow(10, decimals); | ||||
|     const d = Math.pow(10, decimals); | ||||
|     return Math.round((value + Number.EPSILON)*d)/d; | ||||
|   } | ||||
|  | ||||
|   getMapStateFromUrl(params:ParamMap):IMapState { | ||||
|     var hasUrlmapState = params.has("xCenter") && params.has("yCenter"); | ||||
|     const hasUrlmapState = params.has("xCenter") && params.has("yCenter"); | ||||
|     if (hasUrlmapState) { | ||||
|       let xCenter = parseFloat(params.get("xCenter")); | ||||
|       let yCenter = parseFloat(params.get("yCenter")); | ||||
|       let zoom = parseFloat(params.get("zoom")); | ||||
|       let rotation = parseFloat(params.get("rotation")); | ||||
|       let baseLayer = params.get("baseLayer")?params.get("baseLayer"):""; | ||||
|       var newMapState = {zoom: zoom, rotation: rotation, xCenter: xCenter, yCenter: yCenter, baseLayerCode: baseLayer }; | ||||
|       const xCenter = parseFloat(params.get("xCenter")); | ||||
|       const yCenter = parseFloat(params.get("yCenter")); | ||||
|       const zoom = parseFloat(params.get("zoom")); | ||||
|       const rotation = parseFloat(params.get("rotation")); | ||||
|       const baseLayer = params.get("baseLayer")?params.get("baseLayer"):""; | ||||
|       const newMapState = {zoom: zoom, rotation: rotation, xCenter: xCenter, yCenter: yCenter, baseLayerCode: baseLayer }; | ||||
|       return newMapState; | ||||
|     } else { | ||||
|       return null; | ||||
| @@ -302,8 +310,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|  | ||||
|   getQueryStateFromUrl(params:ParamMap):IQueryState { | ||||
|     if (params.has("queryState")) { | ||||
|       let queryState = params.get("queryState"); | ||||
|       var newQueryState = tassign(mapReducers.initialQueryState); | ||||
|       const queryState = params.get("queryState"); | ||||
|       let newQueryState = tassign(mapReducers.initialQueryState); | ||||
|       if (queryState != "") { | ||||
|         newQueryState = this.serializeService.deserialize(queryState); | ||||
|       } | ||||
| @@ -314,7 +322,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|   } | ||||
|  | ||||
|   ngAfterViewInit() { | ||||
|     console.debug("View init"); | ||||
|     //console.debug("View init"); | ||||
|     this.noContent=true; | ||||
|     this.route.children.forEach((entry) => { | ||||
|       if(entry.outlet=="primary") { | ||||
| @@ -326,8 +334,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|  | ||||
|     // url to state | ||||
|  | ||||
|       let urlMapState = this.getMapStateFromUrl(this.route.snapshot.paramMap); | ||||
|       let urlQueryState = this.getQueryStateFromUrl(this.route.snapshot.paramMap); | ||||
|       const urlMapState = this.getMapStateFromUrl(this.route.snapshot.paramMap); | ||||
|       const urlQueryState = this.getQueryStateFromUrl(this.route.snapshot.paramMap); | ||||
|       if(urlQueryState && urlMapState && this.noContent) { | ||||
|         this.store.dispatch(new mapActions.SetState(urlMapState,urlQueryState)); | ||||
|         window.localStorage.setItem("FarmMapsCommonMap_mapState",this.serializeMapState(urlMapState)); | ||||
| @@ -339,7 +347,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|  | ||||
|       this.paramSub = this.route.paramMap.pipe(withLatestFrom(this.state$),switchMap(([params,state]) => { | ||||
|          if(this.initialized && this.noContent) { | ||||
|           let urlQueryState = this.getQueryStateFromUrl(params); | ||||
|           const urlQueryState = this.getQueryStateFromUrl(params); | ||||
|           if( this.serializeService.serialize(state.queryState) != this.serializeService.serialize(urlQueryState)) { | ||||
|             return of(new mapActions.SetState(state.mapState,urlQueryState)); | ||||
|           }           | ||||
| @@ -348,7 +356,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|       })).subscribe((action) => { | ||||
|         if(action) { | ||||
|           this.zone.run(() => { | ||||
|             console.debug("Url to state"); | ||||
|             //console.debug("Url to state"); | ||||
|             this.store.dispatch(action); | ||||
|           }); | ||||
|         } | ||||
| @@ -357,7 +365,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|     // state to url | ||||
|  | ||||
|     this.stateSub = this.state$.pipe(switchMap((state) => { | ||||
|       let newUrl = this.serializeMapState(state.mapState) + "_" + this.serializeService.serialize(state.queryState); | ||||
|       const newUrl = this.serializeMapState(state.mapState) + "_" + this.serializeService.serialize(state.queryState); | ||||
|       if(this.lastUrl!=newUrl) { | ||||
|         this.lastUrl=newUrl; | ||||
|         return of(state); | ||||
| @@ -365,9 +373,9 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|       else { | ||||
|         return of(null); | ||||
|       } | ||||
|       })).subscribe((newUrlState) =>{ | ||||
|     })).subscribe((newUrlState: any) => { | ||||
|         if(newUrlState) { | ||||
|           console.debug(`State to url`); | ||||
|           //console.debug(`State to url`); | ||||
|           this.replaceUrl(newUrlState.mapState,newUrlState.queryState,newUrlState.replaceUrl); | ||||
|         } | ||||
|       }); | ||||
| @@ -405,19 +413,19 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|  | ||||
|   handlePredefinedQuery(event: MouseEvent, query: any) { | ||||
|     event.preventDefault(); | ||||
|     var queryState = tassign(mapReducers.initialQueryState, query); | ||||
|     const queryState = tassign(mapReducers.initialQueryState, query); | ||||
|     this.store.dispatch(new mapActions.DoQuery(queryState)); | ||||
|   } | ||||
|  | ||||
|   replaceUrl(mapState: IMapState, queryState: IQueryState, replace: boolean = true) { | ||||
|   replaceUrl(mapState: IMapState, queryState: IQueryState, replace = true) { | ||||
|       if(this.noContent) { | ||||
|         let newMapState = this.serializeMapState(mapState); | ||||
|         let newQueryState = this.serializeService.serialize(queryState); | ||||
|         let currentMapState = this.serializeMapState(this.getMapStateFromUrl(this.route.snapshot.paramMap)); | ||||
|         let urlQueryState = this.getQueryStateFromUrl(this.route.snapshot.paramMap); | ||||
|         let currentQueryState = urlQueryState==null?"":this.serializeService.serialize(urlQueryState); | ||||
|         const newMapState = this.serializeMapState(mapState); | ||||
|         const newQueryState = this.serializeService.serialize(queryState); | ||||
|         const currentMapState = this.serializeMapState(this.getMapStateFromUrl(this.route.snapshot.paramMap)); | ||||
|         const urlQueryState = this.getQueryStateFromUrl(this.route.snapshot.paramMap); | ||||
|         const currentQueryState = urlQueryState==null?"":this.serializeService.serialize(urlQueryState); | ||||
|         if(mapState.baseLayerCode!="" && ((newMapState!= currentMapState)  || (newQueryState!=currentQueryState))) { | ||||
|           let parts =["."]; | ||||
|           const parts =["."]; | ||||
|           parts.push(mapState.xCenter.toFixed(5)); | ||||
|           parts.push(mapState.yCenter.toFixed(5)); | ||||
|           parts.push( mapState.zoom.toFixed(0)); | ||||
| @@ -425,7 +433,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|           parts.push(mapState.baseLayerCode); | ||||
|           parts.push( this.serializeService.serialize(queryState)); | ||||
|            | ||||
|           console.debug("Replace url",parts); | ||||
|           //console.debug("Replace url",parts); | ||||
|           this.router.navigate(parts, { replaceUrl: replace,relativeTo:this.route.parent }); | ||||
|         }   | ||||
|       }      | ||||
| @@ -434,20 +442,20 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|   handleOnMoveEnd(event) {     | ||||
|     if(this.initialized && this.viewEnabled) { | ||||
|       this.zone.run(() =>{ | ||||
|         console.debug("Move end"); | ||||
|         var map = event.map; | ||||
|         var view = map.getView(); | ||||
|         var rotation = view.getRotation(); | ||||
|         var zoom = view.getZoom(); | ||||
|         var center = transform(view.getCenter(), view.getProjection(), "EPSG:4326"); | ||||
|         var viewExtent = view.calculateExtent(this.map.instance.getSize()); | ||||
|         let mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null }; | ||||
|         let state = { mapState: mapState, viewExtent: viewExtent }; | ||||
|         console.debug("Center: ",center[0],center[1] ); | ||||
|         let source = from([state]); | ||||
|         //console.debug("Move end"); | ||||
|         const map = event.map; | ||||
|         const view = map.getView(); | ||||
|         const rotation = view.getRotation(); | ||||
|         const zoom = view.getZoom(); | ||||
|         const center = transform(view.getCenter(), view.getProjection(), "EPSG:4326"); | ||||
|         const viewExtent = view.calculateExtent(this.map.instance.getSize()); | ||||
|         const mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null }; | ||||
|         const state = { mapState: mapState, viewExtent: viewExtent }; | ||||
|         //console.debug("Center: ",center[0],center[1] ); | ||||
|         const source = from([state]); | ||||
|         source.pipe(withLatestFrom(this.selectedBaseLayer$)).subscribe(([state, baselayer]) => { | ||||
|           if (mapState && baselayer) { // do not react on first move | ||||
|             let newMapState = tassign(state.mapState, { baseLayerCode: baselayer.item.code }); | ||||
|             const newMapState = tassign(state.mapState, { baseLayerCode: baselayer.item.code }); | ||||
|             this.store.dispatch(new mapActions.SetMapState(newMapState)); | ||||
|             this.store.dispatch(new mapActions.SetViewExtent(state.viewExtent)); | ||||
|           } | ||||
| @@ -491,7 +499,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|   } | ||||
|  | ||||
|   handleZoomToExtent(itemLayer: IItemLayer) { | ||||
|     var extent =  createEmpty(); | ||||
|     const extent =  createEmpty(); | ||||
|     extend(extent, itemLayer.layer.getExtent()); | ||||
|     if (extent) { | ||||
|       this.store.dispatch(new mapActions.SetExtent(extent)); | ||||
| @@ -513,10 +521,10 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { | ||||
|   handleCitySearch(location:string) { | ||||
|     this.geolocaterService.geocode(location).subscribe(locations => { | ||||
|       if( locations.length > 0) { | ||||
|         let point = new  Point([locations[0].coordinates.lon,locations[0].coordinates.lat]); | ||||
|         const point = new  Point([locations[0].coordinates.lon,locations[0].coordinates.lat]); | ||||
|         point.transform('EPSG:4326', 'EPSG:3857'); | ||||
|         let circle = new Circle(point.getCoordinates(),5000);//  | ||||
|         let extent = createEmpty(); | ||||
|         const circle = new Circle(point.getCoordinates(),5000);//  | ||||
|         const extent = createEmpty(); | ||||
|         extend(extent, circle.getExtent()); | ||||
|         this.store.dispatch(new mapActions.SetExtent(extent)) | ||||
|       } | ||||
|   | ||||
| @@ -15,12 +15,12 @@ export interface IMetaData { | ||||
| }) | ||||
| export class MetaDataModalComponent { | ||||
|  | ||||
|   private modalName: string = 'metaDataModal'; | ||||
|   private modalName = 'metaDataModal'; | ||||
|   private modalRef: NgbModalRef; | ||||
|  | ||||
|   @ViewChild('content', { static: true }) _templateModal:ElementRef; | ||||
|   @Input() droppedFile: IDroppedFile; | ||||
|   @Input() set modalState(_modalState:any) {; | ||||
|   @Input() set modalState(_modalState:any) { | ||||
|     if(_modalState == this.modalName) { | ||||
|       this.openModal() | ||||
|     } else if(this.modalRef) { | ||||
|   | ||||
| @@ -22,7 +22,7 @@ const after = (one: NgbDateStruct, two: NgbDateStruct) => | ||||
| }) | ||||
| export class SelectPeriodModalComponent { | ||||
|  | ||||
|   private modalName: string = 'selectPeriodModal'; | ||||
|   private modalName = 'selectPeriodModal'; | ||||
|   private modalRef: NgbModalRef; | ||||
|   private dateAdapter = new NgbDateNativeAdapter(); | ||||
|   hoveredDate: NgbDateStruct; | ||||
| @@ -31,7 +31,7 @@ export class SelectPeriodModalComponent { | ||||
|  | ||||
|   @ViewChild('content', { static: true }) _templateModal:ElementRef; | ||||
|  | ||||
|   @Input() set modalState(_modalState:any) {; | ||||
|   @Input() set modalState(_modalState:any) { | ||||
|     if(_modalState == this.modalName) { | ||||
|       this.openModal() | ||||
|     } else if(this.modalRef) { | ||||
| @@ -44,7 +44,7 @@ export class SelectPeriodModalComponent { | ||||
|   } | ||||
|  | ||||
|   @Input() set endDate(_modalState: Date) { | ||||
|     var d = new Date(_modalState); | ||||
|     const d = new Date(_modalState); | ||||
|     d.setDate(d.getDate() - 1); | ||||
|     this.toDate = this.dateAdapter.fromModel(d); | ||||
|   } | ||||
| @@ -80,7 +80,7 @@ export class SelectPeriodModalComponent { | ||||
|    handleSelect(event:MouseEvent) { | ||||
|      event.preventDefault(); | ||||
|      if (this.fromDate && this.toDate && before(this.fromDate, this.toDate)) { | ||||
|        var endDate = new Date(this.dateAdapter.toModel(this.toDate)); | ||||
|        const endDate = new Date(this.dateAdapter.toModel(this.toDate)); | ||||
|        endDate.setDate(endDate.getDate() + 1); | ||||
|        this.onSelect.emit({startDate:this.dateAdapter.toModel(this.fromDate),endDate:endDate}) | ||||
|      } | ||||
|   | ||||
| @@ -1,13 +1,9 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
|  | ||||
|  | ||||
| .row { | ||||
|   border-bottom: 1px solid $gray-500; | ||||
|   border-bottom: 1px solid var(--bs-gray-500); | ||||
|   user-select: none; | ||||
| } | ||||
|  | ||||
| .row:hover { | ||||
|   background-color: $gray-100; | ||||
|   background-color: var(--bs-gray-100); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -28,7 +28,7 @@ export class SelectedItemContainerComponent { | ||||
|  | ||||
|     let selected = -1; | ||||
|     let maxMatches =0; | ||||
|     let showItem = true; | ||||
|     const showItem = true; | ||||
|     for (let i = 0; i < this.selectedItemComponents.length; i++) { | ||||
|       let matches=0; | ||||
|       let criteria=0; | ||||
|   | ||||
| @@ -1,5 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| .big-icon { | ||||
|   width: 100%; | ||||
|   color: white; | ||||
|   | ||||
| @@ -31,28 +31,28 @@ export class SelectedItemCropfieldComponent extends AbstractSelectedItemComponen | ||||
|   areaInHa(item:IItem):number { | ||||
|     if(!item) return 0; | ||||
|     // get area from faeture if 0 calculate from polygon | ||||
|     let a = item.data.area; | ||||
|     const a = item.data.area; | ||||
|     if(a) return a; | ||||
|     let format = new GeoJSON(); | ||||
|     let polygon = format.readGeometry(item.geometry); | ||||
|     const format = new GeoJSON(); | ||||
|     const polygon = format.readGeometry(item.geometry); | ||||
|     return getArea(polygon,{projection:"EPSG:4326"}) / 10000; | ||||
|   } | ||||
|  | ||||
|   ngOnInit() { | ||||
|     var childItems = this.folderService$.getItems(this.item.code, 0, 1000); | ||||
|     var atLocationItems = this.itemService$.getItemList(null,null,null,this.item.code,true); | ||||
|     const childItems = this.folderService$.getItems(this.item.code, 0, 1000); | ||||
|     const atLocationItems = this.itemService$.getItemList(null,null,null,this.item.code,true); | ||||
|     this.items =  childItems.pipe( | ||||
|       combineLatest(atLocationItems), | ||||
|       switchMap(([ci,ali]) => { | ||||
|           let retVal:IListItem[] = []; | ||||
|           let codes = {}; | ||||
|           const retVal:IListItem[] = []; | ||||
|           const codes = {}; | ||||
|           ci.forEach((listItem) => { | ||||
|              retVal.push(listItem); | ||||
|              codes[listItem.code]=listItem; | ||||
|           }); | ||||
|           ali.forEach((atlocationitem) => { | ||||
|              let listItem = atlocationitem as IListItem; | ||||
|              let allowedItemTypes = "vnd.farmmaps.itemtype.device.senml"; // this is a hack | ||||
|              const listItem = atlocationitem as IListItem; | ||||
|              const allowedItemTypes = "vnd.farmmaps.itemtype.device.senml"; // this is a hack | ||||
|              if(!codes[listItem.code] && allowedItemTypes.indexOf(listItem.itemType) >= 0) { | ||||
|                retVal.push(listItem); | ||||
|              } | ||||
|   | ||||
| @@ -25,6 +25,7 @@ | ||||
|             <li *ngIf="!getItemLayer(item,itemLayer.layerIndex)"><a   href="#" (click)="handleAddAsLayer(item,itemLayer.layerIndex)"><i class="fas fa-layer-plus" aria-hidden="true" i18n-title title="Add as layer"></i> <span i18n>Add as overlay</span></a></li> | ||||
|             <li *ngIf="getItemLayer(item,itemLayer.layerIndex)"><a  href="#" (click)="handleRemoveLayer(item,itemLayer.layerIndex)"><i class="fas fa-layer-minus" aria-hidden="true" i18n-title title="Remove overlay"></i> <span i18n>Remove overlay</span></a></li> | ||||
|           </ng-container> | ||||
|           <li><fm-item-link class="text-primary p-0" [itemCode]="item.code" pathSuffix="data" [showText]="true"></fm-item-link></li> | ||||
|         </ul> | ||||
|       </div> | ||||
|       <fm-map-zoom-to-show-alert [layer]="itemLayer?.layer"></fm-map-zoom-to-show-alert> | ||||
|   | ||||
| @@ -1,5 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| .big-icon { | ||||
|   width: 100%; | ||||
|   color: white; | ||||
|   | ||||
| @@ -1,5 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| .big-icon { | ||||
|   width: 100%; | ||||
|   color: white; | ||||
|   | ||||
| @@ -23,7 +23,7 @@ export class SelectedItemShapeComponent extends AbstractSelectedItemComponent { | ||||
|   constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) { | ||||
|     super(store, itemTypeService,location,router); | ||||
|   } | ||||
|   public selectedLayer: number = 0; | ||||
|   public selectedLayer = 0; | ||||
|    | ||||
|   onLayerChanged(layerIndex: number) { | ||||
|     this.store.dispatch(new mapActions.SetLayerIndex(layerIndex)); | ||||
|   | ||||
| @@ -1,5 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| .big-icon { | ||||
|   width: 100%; | ||||
|   color: white; | ||||
|   | ||||
| @@ -46,7 +46,7 @@ export class SelectedItemTemporalComponent extends AbstractSelectedItemComponent | ||||
|   } | ||||
|  | ||||
|   selectedItem():IItem { | ||||
|     let temporalItemLayer = this.itemLayer as ITemporalItemLayer; | ||||
|     const temporalItemLayer = this.itemLayer as ITemporalItemLayer; | ||||
|     if(temporalItemLayer && temporalItemLayer.selectedItemLayer) { | ||||
|        return temporalItemLayer.selectedItemLayer.item; | ||||
|     } | ||||
|   | ||||
| @@ -1,5 +1,3 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| .big-icon { | ||||
|   width: 100%; | ||||
|   color: white; | ||||
|   | ||||
| @@ -20,39 +20,39 @@ export abstract class AbstractSelectedItemComponent { | ||||
|  | ||||
|   handleOnView(item: IItem) { | ||||
|     if (this.itemTypeService.hasViewer(item)) { | ||||
|       let viewer = this.itemTypeService.itemTypes[item.itemType].viewer; | ||||
|       let url = `/viewer/${viewer}/item/${item.code}`; | ||||
|       const viewer = this.itemTypeService.itemTypes[item.itemType].viewer; | ||||
|       const url = `/viewer/${viewer}/item/${item.code}`; | ||||
|       this.router.navigate([url]); | ||||
|     } | ||||
|     return false; | ||||
|   } | ||||
|  | ||||
|   handleOnEdit(item: IItem) { | ||||
|     var editor = "property"; | ||||
|     let editor = "property"; | ||||
|     if(this.itemTypeService.hasEditor(item)) { | ||||
|       editor = this.itemTypeService.itemTypes[item.itemType].editor; | ||||
|     } | ||||
|     let url = `/editor/${editor}/item/${item.code}` | ||||
|     const url = `/editor/${editor}/item/${item.code}` | ||||
|     this.router.navigate([url]); | ||||
|     return false; | ||||
|   } | ||||
|  | ||||
|   handleAddAsLayer(item: IItem,layerIndex:number = -1) { | ||||
|   handleAddAsLayer(item: IItem,layerIndex = -1) { | ||||
|     this.store.dispatch(new mapActions.AddLayer(item,layerIndex)); | ||||
|     return false; | ||||
|   } | ||||
|  | ||||
|   handleRemoveLayer(item: IItem,layerIndex:number = -1) { | ||||
|     let itemLayer = this.getItemLayer(item,layerIndex); | ||||
|   handleRemoveLayer(item: IItem,layerIndex = -1) { | ||||
|     const itemLayer = this.getItemLayer(item,layerIndex); | ||||
|     if(itemLayer) { | ||||
|       this.store.dispatch(new mapActions.RemoveLayer(itemLayer)); | ||||
|     } | ||||
|     return false; | ||||
|   } | ||||
|  | ||||
|   getItemLayer(item:IItem,layerIndex:number = -1):IItemLayer { | ||||
|     let li = layerIndex==-1?0:layerIndex; | ||||
|     let selected = this.overlayLayers.filter(ol => ol.item.code == item.code && ol.layerIndex == li); | ||||
|   getItemLayer(item:IItem,layerIndex = -1):IItemLayer { | ||||
|     const li = layerIndex==-1?0:layerIndex; | ||||
|     const selected = this.overlayLayers.filter(ol => ol.item.code == item.code && ol.layerIndex == li); | ||||
|     if(selected.length==0) return null; | ||||
|     return selected[0]; | ||||
|   } | ||||
|   | ||||
| @@ -1,34 +1,34 @@ | ||||
| import { Injectable } from '@angular/core'; | ||||
|  | ||||
| import { Store, Action,createFeatureSelector } from '@ngrx/store'; | ||||
| import { Store, Action, createFeatureSelector } from '@ngrx/store'; | ||||
| import { ROUTER_NAVIGATED, RouterReducerState } from '@ngrx/router-store'; | ||||
| import * as fromRouter from '@ngrx/router-store'; | ||||
| import { createEffect, Actions,ofType } from '@ngrx/effects'; | ||||
| import { createEffect, Actions, ofType } from '@ngrx/effects'; | ||||
|  | ||||
| import { EMPTY, Observable , of} from 'rxjs'; | ||||
| import { EMPTY, Observable, of } from 'rxjs'; | ||||
| import { withLatestFrom, switchMap, map, catchError, mergeMap } from 'rxjs/operators'; | ||||
|  | ||||
| import {GeoJSON,WKT} from 'ol/format'; | ||||
| import {Feature} from 'ol'; | ||||
| import { getCenter,createEmpty,extend } from 'ol/extent'; | ||||
| import {Point,Geometry} from 'ol/geom' | ||||
| import { GeoJSON, WKT } from 'ol/format'; | ||||
| import { Feature } from 'ol'; | ||||
| import { getCenter, createEmpty, extend } from 'ol/extent'; | ||||
| import { Point, Geometry } from 'ol/geom' | ||||
|  | ||||
|  | ||||
| import * as mapActions from '../actions/map.actions'; | ||||
| import * as mapReducers from '../reducers/map.reducer'; | ||||
| import {commonReducers} from '@farmmaps/common'; | ||||
| import { commonReducers } from '@farmmaps/common'; | ||||
|  | ||||
| import {commonActions} from '@farmmaps/common'; | ||||
| import { commonActions } from '@farmmaps/common'; | ||||
|  | ||||
| import { IItem } from '@farmmaps/common'; | ||||
| import { FolderService, ItemService } from '@farmmaps/common'; | ||||
| import { tassign } from 'tassign'; | ||||
|  | ||||
| import {FeatureIconService} from '../services/feature-icon.service'; | ||||
| import { FeatureIconService } from '../services/feature-icon.service'; | ||||
|  | ||||
| import * as style from 'ol/style'; | ||||
|  | ||||
| import { ItemTypeService,IQueryState } from '@farmmaps/common'; | ||||
| import { ItemTypeService, IQueryState } from '@farmmaps/common'; | ||||
| import { TemporalItemLayer } from '../models/item.layer' | ||||
|  | ||||
| export const getRouterState = createFeatureSelector<RouterReducerState>('router'); | ||||
| @@ -41,40 +41,40 @@ export const { | ||||
|   selectRouteParam,     // factory function to select a route param | ||||
|   selectRouteData,      // select the current route data | ||||
|   selectUrl,            // select the current url | ||||
| } = fromRouter.getSelectors(getRouterState); | ||||
| } = fromRouter.getRouterSelectors(getRouterState); | ||||
|  | ||||
|  | ||||
| @Injectable() | ||||
| export class MapEffects { | ||||
|   private _geojsonFormat: GeoJSON; | ||||
|   private _wktFormat: WKT; | ||||
|   private overrideSelectedItemLayer: boolean = false; | ||||
|   private overrideSelectedItemLayer = false; | ||||
|  | ||||
|   private updateFeatureGeometry(feature:Feature<Geometry>, updateEvent:commonActions.DeviceUpdateEvent): Feature<Geometry> { | ||||
|     let newFeature = feature.clone(); | ||||
|     var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{ | ||||
|   private updateFeatureGeometry(feature: Feature<Geometry>, updateEvent: commonActions.DeviceUpdateEvent): Feature<Geometry> { | ||||
|     const newFeature = feature.clone(); | ||||
|     const f = this._wktFormat.readFeature(updateEvent.attributes["geometry"], { | ||||
|       dataProjection: 'EPSG:4326', | ||||
|       featureProjection: 'EPSG:3857' | ||||
|     }); | ||||
|     var centroid = getCenter(f.getGeometry().getExtent()); | ||||
|     const centroid = getCenter(f.getGeometry().getExtent()); | ||||
|     newFeature.setId(feature.getId()); | ||||
|     newFeature.setGeometry(new Point(centroid)); | ||||
|     return newFeature; | ||||
|   } | ||||
|  | ||||
|   init$ =  createEffect(() => this.actions$.pipe( | ||||
|   init$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.INIT), | ||||
|     withLatestFrom(this.store$.select(commonReducers.selectGetRootItems)), | ||||
|     switchMap(([action, rootItems]) => { | ||||
|       let actions=[]; | ||||
|       for (let rootItem of rootItems) { | ||||
|       const actions = []; | ||||
|       for (const rootItem of rootItems) { | ||||
|         if (rootItem.itemType == "UPLOADS_FOLDER") actions.push(new mapActions.SetParent(rootItem.code)); | ||||
|       } | ||||
|       // initialize default feature styles | ||||
|       actions.push(new mapActions.SetStyle('file',new style.Style({ | ||||
|       actions.push(new mapActions.SetStyle('file', new style.Style({ | ||||
|         image: new style.Icon({ | ||||
|             anchor: [0.5, 1], | ||||
|             scale: 0.05, | ||||
|           anchor: [0.5, 1], | ||||
|           scale: 0.05, | ||||
|           src: this.featureIconService$.getIconImageDataUrl("fal fa-file") | ||||
|         }), | ||||
|         stroke: new style.Stroke({ | ||||
| @@ -85,7 +85,7 @@ export class MapEffects { | ||||
|           color: 'rgba(0, 0, 0,0)' | ||||
|         }) | ||||
|       }))); | ||||
|       actions.push(new mapActions.SetStyle('selected',new style.Style({ | ||||
|       actions.push(new mapActions.SetStyle('selected', new style.Style({ | ||||
|         image: new style.Icon({ | ||||
|           anchor: [0.5, 1], | ||||
|           scale: 0.08, | ||||
| @@ -104,13 +104,13 @@ export class MapEffects { | ||||
|     } | ||||
|     ))); | ||||
|  | ||||
|   initBaseLayers$ =  createEffect(() => this.actions$.pipe( | ||||
|   initBaseLayers$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.INIT), | ||||
|     withLatestFrom(this.store$.select(mapReducers.selectGetProjection)), | ||||
|     map(([action, projection]) => new mapActions.LoadBaseLayers(projection))) | ||||
|   ); | ||||
|  | ||||
|   loadBaseLayers$ =  createEffect(() => this.actions$.pipe( | ||||
|   loadBaseLayers$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.LOADBASELAYERS), | ||||
|     switchMap((action: mapActions.LoadBaseLayers) => { | ||||
|       return this.itemService$.getItemList("vnd.farmmaps.itemtype.layer", { "isBaseLayer": true }).pipe( | ||||
| @@ -118,17 +118,17 @@ export class MapEffects { | ||||
|         catchError(error => of(new commonActions.Fail(error)))); | ||||
|     }))); | ||||
|  | ||||
|   startSearch$ =  createEffect(() => this.actions$.pipe( | ||||
|   startSearch$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.STARTSEARCH), | ||||
|     switchMap((action) => { | ||||
|       let a = action as mapActions.StartSearch; | ||||
|       var startDate = a.queryState.startDate; | ||||
|       var endDate = a.queryState.endDate; | ||||
|       var newAction:Observable<Action>; | ||||
|       const a = action as mapActions.StartSearch; | ||||
|       const startDate = a.queryState.startDate; | ||||
|       const endDate = a.queryState.endDate; | ||||
|       let newAction: Observable<Action>; | ||||
|       if (a.queryState.itemCode || a.queryState.parentCode || a.queryState.itemType || a.queryState.query || a.queryState.tags) { | ||||
|         newAction= this.itemService$.getFeatures(a.queryState.bbox, "EPSG:3857", a.queryState.query, a.queryState.tags, startDate, endDate, a.queryState.itemType, a.queryState.parentCode, a.queryState.dataFilter, a.queryState.level).pipe( | ||||
|         newAction = this.itemService$.getFeatures(a.queryState.bbox, "EPSG:3857", a.queryState.query, a.queryState.tags, startDate, endDate, a.queryState.itemType, a.queryState.parentCode, a.queryState.dataFilter, a.queryState.level).pipe( | ||||
|           switchMap((features: any) => { | ||||
|             for (let f of features.features) { | ||||
|             for (const f of features.features) { | ||||
|               if (f.properties && f.properties["code"]) { | ||||
|                 f.id = f.properties["code"]; | ||||
|               } | ||||
| @@ -144,18 +144,18 @@ export class MapEffects { | ||||
|     }))); | ||||
|  | ||||
|  | ||||
|   zoomToExtent$ =  createEffect(() => this.actions$.pipe( | ||||
|   zoomToExtent$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.STARTSEARCHSUCCESS), | ||||
|     mergeMap((action: mapActions.StartSearchSuccess) => { | ||||
|       let actions =[]; | ||||
|       const actions = []; | ||||
|       actions.push(new commonActions.SetMenuVisible(false)); | ||||
|       let extent = createEmpty(); | ||||
|       const extent = createEmpty(); | ||||
|       if (!action.query.bboxFilter) { | ||||
|          if (extent) { | ||||
|           for (let f of action.features) { | ||||
|         if (extent) { | ||||
|           for (const f of action.features) { | ||||
|             extend(extent, (f as Feature<Geometry>).getGeometry().getExtent()); | ||||
|           } | ||||
|           if(action.features && action.features.length >0) { | ||||
|           if (action.features && action.features.length > 0) { | ||||
|             actions.push(new mapActions.SetExtent(extent)); | ||||
|           } | ||||
|         } | ||||
| @@ -163,64 +163,64 @@ export class MapEffects { | ||||
|       return actions; | ||||
|     }))); | ||||
|  | ||||
|     zoomToExtent2$ =  createEffect(() => this.actions$.pipe( | ||||
|       ofType(mapActions.SETFEATURES), | ||||
|       switchMap((action: mapActions.SetFeatures) => { | ||||
|         let extent = createEmpty(); | ||||
|         if (extent) { | ||||
|           for (let f of action.features) { | ||||
|             extend(extent, (f as Feature<Geometry>).getGeometry().getExtent()); | ||||
|           } | ||||
|           if(action.features.length>0) return of(new mapActions.SetExtent(extent)); | ||||
|   zoomToExtent2$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.SETFEATURES), | ||||
|     switchMap((action: mapActions.SetFeatures) => { | ||||
|       const extent = createEmpty(); | ||||
|       if (extent) { | ||||
|         for (const f of action.features) { | ||||
|           extend(extent, (f as Feature<Geometry>).getGeometry().getExtent()); | ||||
|         } | ||||
|         return EMPTY; | ||||
|       }))); | ||||
|         if (action.features.length > 0) return of(new mapActions.SetExtent(extent)); | ||||
|       } | ||||
|       return EMPTY; | ||||
|     }))); | ||||
|  | ||||
|   hideMenu$ =  createEffect(() => this.actions$.pipe( | ||||
|   hideMenu$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.STARTSEARCHSUCCESS), | ||||
|     mergeMap((action: mapActions.StartSearchSuccess) => { | ||||
|       return of(new commonActions.SetMenuVisible(false)); | ||||
|     }))); | ||||
|  | ||||
|   selectItem$ =  createEffect(() => this.actions$.pipe( | ||||
|   selectItem$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.SELECTITEM), | ||||
|     withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)), | ||||
|       switchMap(([action, selectedItem]) => { | ||||
|         let a = action as mapActions.SelectItem; | ||||
|         let itemCode = selectedItem ? selectedItem.code : ""; | ||||
|         if (a.itemCode != itemCode) { | ||||
|           return this.itemService$.getItem(a.itemCode).pipe( | ||||
|             switchMap(child => { | ||||
|               return this.itemService$.getItem(child.parentCode) | ||||
|                 .pipe(map(parent => { | ||||
|                     return {child, parent}; | ||||
|                   }),catchError(() => { let parent:IItem = null;return of({child,parent})}) | ||||
|                 ); | ||||
|             }), | ||||
|             map(data => new mapActions.SelectItemSuccess(data.child, data.parent)), | ||||
|             catchError(error => of(new commonActions.Fail(error)))) | ||||
|         } else { | ||||
|           return []; | ||||
|         } | ||||
|     switchMap(([action, selectedItem]) => { | ||||
|       const a = action as mapActions.SelectItem; | ||||
|       const itemCode = selectedItem ? selectedItem.code : ""; | ||||
|       if (a.itemCode != itemCode) { | ||||
|         return this.itemService$.getItem(a.itemCode).pipe( | ||||
|           switchMap(child => { | ||||
|             return this.itemService$.getItem(child.parentCode) | ||||
|               .pipe(map(parent => { | ||||
|                 return { child, parent }; | ||||
|               }), catchError(() => { const parent: IItem = null; return of({ child, parent }) }) | ||||
|               ); | ||||
|           }), | ||||
|           map(data => new mapActions.SelectItemSuccess(data.child, data.parent)), | ||||
|           catchError(error => of(new commonActions.Fail(error)))) | ||||
|       } else { | ||||
|         return []; | ||||
|       } | ||||
|     } | ||||
|     ))); | ||||
|  | ||||
|     selectItemSuccessSetLayer$ =  createEffect(() => this.actions$.pipe( | ||||
|       ofType(mapActions.SELECTITEMSUCCESS), | ||||
|       map((action:mapActions.SelectItemSuccess) => | ||||
|          new mapActions.SetSelectedItemLayer(action.item) | ||||
|         ) | ||||
|       )); | ||||
|  | ||||
|   selectItemSuccess$ =  createEffect(() => this.actions$.pipe( | ||||
|   selectItemSuccessSetLayer$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.SELECTITEMSUCCESS), | ||||
|     switchMap((action:mapActions.SelectItemSuccess) => { | ||||
|       if(!this.overrideSelectedItemLayer) { | ||||
|     map((action: mapActions.SelectItemSuccess) => | ||||
|       new mapActions.SetSelectedItemLayer(action.item) | ||||
|     ) | ||||
|   )); | ||||
|  | ||||
|   selectItemSuccess$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.SELECTITEMSUCCESS), | ||||
|     switchMap((action: mapActions.SelectItemSuccess) => { | ||||
|       if (!this.overrideSelectedItemLayer) { | ||||
|         return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe( | ||||
|           map((feature: any) => { | ||||
|             let f = this._geojsonFormat.readFeature(feature); | ||||
|             const f = this._geojsonFormat.readFeature(feature); | ||||
|             f.setId(action.item.code); | ||||
|             return new mapActions.AddFeatureSuccess(f ); | ||||
|             return new mapActions.AddFeatureSuccess(f); | ||||
|           }), | ||||
|           catchError(error => of(new commonActions.Fail(error)))); | ||||
|       } else { | ||||
| @@ -229,59 +229,59 @@ export class MapEffects { | ||||
|     } | ||||
|     ))); | ||||
|  | ||||
|     selectItemSuccessTemporal$ =  createEffect(() => this.actions$.pipe( | ||||
|       ofType(mapActions.SELECTITEMSUCCESS), | ||||
|       switchMap((action:mapActions.SelectItemSuccess) => { | ||||
|         if(action.item.itemType == "vnd.farmmaps.itemtype.temporal") { | ||||
|           return this.itemService$.getChildItemList(action.item.code,null).pipe( | ||||
|             map(items => new mapActions.SelectTemporalItemsSuccess( | ||||
|               items.sort((a, b) => | ||||
|                  -(Date.parse(b.dataDate) - Date.parse(a.dataDate)) | ||||
|               ) | ||||
|             )), | ||||
|             catchError(error => of(new commonActions.Fail(error)))); | ||||
|         } else { | ||||
|            return []; | ||||
|         } | ||||
|   selectItemSuccessTemporal$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.SELECTITEMSUCCESS), | ||||
|     switchMap((action: mapActions.SelectItemSuccess) => { | ||||
|       if (action.item.itemType == "vnd.farmmaps.itemtype.temporal") { | ||||
|         return this.itemService$.getChildItemList(action.item.code, null).pipe( | ||||
|           map(items => new mapActions.SelectTemporalItemsSuccess( | ||||
|             items.sort((a, b) => | ||||
|               -(Date.parse(b.dataDate) - Date.parse(a.dataDate)) | ||||
|             ) | ||||
|           )), | ||||
|           catchError(error => of(new commonActions.Fail(error)))); | ||||
|       } else { | ||||
|         return []; | ||||
|       } | ||||
|       ))); | ||||
|  | ||||
|   uploadedItemClick$ =  createEffect(() => this.actions$.pipe( | ||||
|       ofType(commonActions.UPLOADEDFILECLICK), | ||||
|       switchMap((action: commonActions.UploadedFileClick) => of(new mapActions.DoQuery(tassign(mapReducers.initialState.query.querystate, {itemCode:action.itemCode}))) | ||||
|     } | ||||
|     ))); | ||||
|  | ||||
|   featureUpdate$ =  createEffect(() => this.actions$.pipe( | ||||
|   uploadedItemClick$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(commonActions.UPLOADEDFILECLICK), | ||||
|     switchMap((action: commonActions.UploadedFileClick) => of(new mapActions.DoQuery(tassign(mapReducers.initialState.query.querystate, { itemCode: action.itemCode }))) | ||||
|     ))); | ||||
|  | ||||
|   featureUpdate$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(commonActions.DEVICEUPDATEEVENT), | ||||
|     withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)), | ||||
|     mergeMap(([action, features]) => { | ||||
|       let deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent; | ||||
|       var feature: Feature<Geometry> = null; | ||||
|       for (let f of features) { | ||||
|       const deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent; | ||||
|       let feature: Feature<Geometry> = null; | ||||
|       for (const f of features) { | ||||
|         if (f.getId() == deviceUpdateEventAction.itemCode) { | ||||
|           feature = f; | ||||
|           break; | ||||
|         } | ||||
|       } | ||||
|       if (feature) { | ||||
|         return of(new mapActions.UpdateFeatureSuccess(this.updateFeatureGeometry(feature,deviceUpdateEventAction))); | ||||
|         return of(new mapActions.UpdateFeatureSuccess(this.updateFeatureGeometry(feature, deviceUpdateEventAction))); | ||||
|       } else { | ||||
|         return []; | ||||
|       } | ||||
|     }))); | ||||
|  | ||||
|   itemUpdate$ =  createEffect(() => this.actions$.pipe( | ||||
|   itemUpdate$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(commonActions.ITEMCHANGEDEVENT), | ||||
|     withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)), | ||||
|     mergeMap(([action, selectedItem]) => { | ||||
|       let itemChangedAction = action as commonActions.ItemChangedEvent; | ||||
|       const itemChangedAction = action as commonActions.ItemChangedEvent; | ||||
|       if (selectedItem && selectedItem.code == itemChangedAction.itemCode) { | ||||
|         return this.itemService$.getItem(itemChangedAction.itemCode).pipe( | ||||
|           switchMap(child => { | ||||
|             return this.itemService$.getItem(child.parentCode) | ||||
|               .pipe(map(parent => { | ||||
|                   return {child, parent}; | ||||
|                 }) | ||||
|                 return { child, parent }; | ||||
|               }) | ||||
|               ); | ||||
|           }), | ||||
|           map(data => new mapActions.SelectItemSuccess(data.child, data.parent)), | ||||
| @@ -291,13 +291,13 @@ export class MapEffects { | ||||
|       } | ||||
|     }))); | ||||
|  | ||||
|   getActionFromQueryState(queryState:IQueryState, inSearch:boolean):Observable<Action>|[] { | ||||
|     if(!inSearch && (queryState.itemType || queryState.parentCode || queryState.itemCode || queryState.query || queryState.tags)) { | ||||
|       var newAction:Action; | ||||
|   getActionFromQueryState(queryState: IQueryState, inSearch: boolean): Observable<Action> | [] { | ||||
|     if (!inSearch && (queryState.itemType || queryState.parentCode || queryState.itemCode || queryState.query || queryState.tags)) { | ||||
|       var newAction: Action; | ||||
|       if (queryState.itemCode && queryState.itemCode != "") { | ||||
|         newAction= new mapActions.SelectItem(queryState.itemCode); | ||||
|         newAction = new mapActions.SelectItem(queryState.itemCode); | ||||
|       } else { | ||||
|         newAction= new mapActions.StartSearch(queryState); | ||||
|         newAction = new mapActions.StartSearch(queryState); | ||||
|       } | ||||
|  | ||||
|     } else { | ||||
| @@ -306,104 +306,104 @@ export class MapEffects { | ||||
|     return of(newAction); | ||||
|   } | ||||
|  | ||||
|    getLayerValue$ =  createEffect(() => this.actions$.pipe( | ||||
|   getLayerValue$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.GETLAYERVALUE), | ||||
|     mergeMap((action:mapActions.GetLayerValue) => { | ||||
|       var l = action.itemLayer.item.data["layers"][action.itemLayer.layerIndex]; | ||||
|       var scale = l.scale?l.scale:1; | ||||
|       return this.itemService$.getLayerValue(action.itemLayer.item.code,action.itemLayer.layerIndex,action.x,action.y).pipe( | ||||
|     mergeMap((action: mapActions.GetLayerValue) => { | ||||
|       const l = action.itemLayer.item.data["layers"][action.itemLayer.layerIndex]; | ||||
|       const scale = l.scale ? l.scale : 1; | ||||
|       return this.itemService$.getLayerValue(action.itemLayer.item.code, action.itemLayer.layerIndex, action.x, action.y).pipe( | ||||
|         mergeMap((v: number) => { | ||||
|           let a=[]; | ||||
|           if(v !== null) { | ||||
|             if(l.renderer && l.renderer.colorMap && l.renderer.colorMap.colormapType == "manual") { | ||||
|           const a = []; | ||||
|           if (v !== null) { | ||||
|             if (l.renderer && l.renderer.colorMap && l.renderer.colorMap.colormapType == "manual") { | ||||
|               l.renderer.colorMap.entries.forEach((e) => { | ||||
|                   if(e.value == v && e.label) { | ||||
|                     v=e.label; | ||||
|                     return; | ||||
|                   } | ||||
|                 if (e.value == v && e.label) { | ||||
|                   v = e.label; | ||||
|                   return; | ||||
|                 } | ||||
|               }); | ||||
|               a.push(new mapActions.GetLayerValueSuccess({date:action.itemLayer.item.dataDate,value:v,layerName:l.name,quantity:"",unit:l.unit})); | ||||
|               a.push(new mapActions.GetLayerValueSuccess({ date: action.itemLayer.item.dataDate, value: v, layerName: l.name, quantity: "", unit: l.unit, scale: l.scale })); | ||||
|             } else { | ||||
|               a.push(new mapActions.GetLayerValueSuccess({date:action.itemLayer.item.dataDate,value:v*scale,layerName:l.name,quantity:l.quantity,unit:l.unit})); | ||||
|               a.push(new mapActions.GetLayerValueSuccess({ date: action.itemLayer.item.dataDate, value: v * scale, layerName: l.name, quantity: l.quantity, unit: l.unit, scale: l.scale })); | ||||
|             } | ||||
|           } | ||||
|           return a; | ||||
|         })) | ||||
|       } | ||||
|   ))); | ||||
|     } | ||||
|     ))); | ||||
|  | ||||
|   updateLayerValuesOnLayerAddedOrRemoved$ =  createEffect(() => this.actions$.pipe( | ||||
|      ofType(mapActions.ADDLAYER,mapActions.REMOVELAYER,mapActions.SELECTITEMSUCCESS,mapActions.SELECTTEMPORALITEMSSUCCESS, mapActions.NEXTTEMPORAL,mapActions.PREVIOUSTEMPORAL,mapActions.TOGGLELAYERVALUESENABLED,mapActions.SETLAYERINDEX,mapActions.SETSELECTEDITEMLAYER), | ||||
|      withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesX)), | ||||
|      withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesY)), | ||||
|      map(([[action,x],y]) => new mapActions.SetLayerValuesLocation(x,y)) | ||||
|   updateLayerValuesOnLayerAddedOrRemoved$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.ADDLAYER, mapActions.REMOVELAYER, mapActions.SELECTITEMSUCCESS, mapActions.SELECTTEMPORALITEMSSUCCESS, mapActions.NEXTTEMPORAL, mapActions.PREVIOUSTEMPORAL, mapActions.TOGGLELAYERVALUESENABLED, mapActions.SETLAYERINDEX, mapActions.SETSELECTEDITEMLAYER), | ||||
|     withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesX)), | ||||
|     withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesY)), | ||||
|     map(([[action, x], y]) => new mapActions.SetLayerValuesLocation(x, y)) | ||||
|   )); | ||||
|  | ||||
|  | ||||
|   getLayerValues$ =  createEffect(() => this.actions$.pipe( | ||||
|   getLayerValues$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.SETLAYERVALUESLOCATION), | ||||
|     withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItemLayer)), | ||||
|     withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesEnabled)), | ||||
|     withLatestFrom(this.store$.select(mapReducers.selectGetOverlayLayers)), | ||||
|     mergeMap(([[[action, selected], enabled],overlayLayers]) => { | ||||
|       let layers = []; | ||||
|       if(selected) { | ||||
|         if(selected && (selected as TemporalItemLayer).selectedItemLayer ) { | ||||
|            selected=(selected as TemporalItemLayer).selectedItemLayer; | ||||
|     mergeMap(([[[action, selected], enabled], overlayLayers]) => { | ||||
|       const layers = []; | ||||
|       if (selected) { | ||||
|         if (selected && (selected as TemporalItemLayer).selectedItemLayer) { | ||||
|           selected = (selected as TemporalItemLayer).selectedItemLayer; | ||||
|         } | ||||
|         layers.push(selected); | ||||
|       } | ||||
|       overlayLayers.forEach((ol) => { | ||||
|         if(ol!=selected) layers.push(ol); | ||||
|         if (ol != selected) layers.push(ol); | ||||
|       }); | ||||
|       let a = action as mapActions.SetLayerValuesLocation; | ||||
|       let actions = []; | ||||
|       if(enabled) { | ||||
|       const a = action as mapActions.SetLayerValuesLocation; | ||||
|       const actions = []; | ||||
|       if (enabled) { | ||||
|         layers.forEach((ol) => { | ||||
|            if("vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(ol.item.itemType)>=0) { | ||||
|              actions.push(new mapActions.GetLayerValue(ol,a.x,a.y)); | ||||
|            } | ||||
|          }); | ||||
|           if ("vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(ol.item.itemType) >= 0) { | ||||
|             actions.push(new mapActions.GetLayerValue(ol, a.x, a.y)); | ||||
|           } | ||||
|         }); | ||||
|       } | ||||
|       return actions; | ||||
|     }))); | ||||
|  | ||||
|  | ||||
|    setState$ =  createEffect(() => this.actions$.pipe( | ||||
|   setState$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(mapActions.SETSTATE), | ||||
|     withLatestFrom(this.store$.select(mapReducers.selectGetInSearch)), | ||||
|     switchMap(([action,inSearch]) => { | ||||
|       let a = action as mapActions.SetState; | ||||
|       return this.getActionFromQueryState(a.queryState,inSearch); | ||||
|     switchMap(([action, inSearch]) => { | ||||
|       const a = action as mapActions.SetState; | ||||
|       return this.getActionFromQueryState(a.queryState, inSearch); | ||||
|     }))); | ||||
|  | ||||
|     escape$ =  createEffect(() => this.actions$.pipe( | ||||
|       ofType(commonActions.ESCAPE), | ||||
|       switchMap((action) => { | ||||
|         let a = action as commonActions.Escape; | ||||
|         if(a.escapeKey) { | ||||
|           return of(new mapActions.Clear()); | ||||
|         } else { | ||||
|           return EMPTY; | ||||
|         } | ||||
|       }))); | ||||
|   escape$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(commonActions.ESCAPE), | ||||
|     switchMap((action) => { | ||||
|       const a = action as commonActions.Escape; | ||||
|       if (a.escapeKey) { | ||||
|         return of(new mapActions.Clear()); | ||||
|       } else { | ||||
|         return EMPTY; | ||||
|       } | ||||
|     }))); | ||||
|  | ||||
|       setOverride$ = createEffect(() => this.actions$.pipe( | ||||
|         ofType(ROUTER_NAVIGATED), | ||||
|         switchMap(() => this.store$.select(selectRouteData as any)), | ||||
|         switchMap((data: any) => { | ||||
|           if(data && data["fm-map-map"]) { | ||||
|             let params = data["fm-map-map"]; | ||||
|             this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false; | ||||
|           } else { | ||||
|             this.overrideSelectedItemLayer = false; | ||||
|           } | ||||
|           return []; | ||||
|         }) | ||||
|       )); | ||||
|   setOverride$ = createEffect(() => this.actions$.pipe( | ||||
|     ofType(ROUTER_NAVIGATED), | ||||
|     switchMap(() => this.store$.select(selectRouteData as any)), | ||||
|     switchMap((data: any) => { | ||||
|       if (data && data["fm-map-map"]) { | ||||
|         const params = data["fm-map-map"]; | ||||
|         this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false; | ||||
|       } else { | ||||
|         this.overrideSelectedItemLayer = false; | ||||
|       } | ||||
|       return []; | ||||
|     }) | ||||
|   )); | ||||
|  | ||||
|   constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService) { | ||||
|   constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService, private featureIconService$: FeatureIconService, private itemTypeService$: ItemTypeService) { | ||||
|     this._geojsonFormat = new GeoJSON(); | ||||
|     this._wktFormat = new WKT(); | ||||
|    } | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -15,13 +15,13 @@ export interface IItemLayer  { | ||||
| export class ItemLayer implements IItemLayer { | ||||
|   public item: IItem; | ||||
|   public layer: Layer<Source> = null; | ||||
|   public visible: boolean = true; | ||||
|   public legendVisible: boolean = false; | ||||
|   public visible = true; | ||||
|   public legendVisible = false; | ||||
|   public projection: string; | ||||
|   public opacity: number = 1; | ||||
|   public layerIndex: number = -1; | ||||
|   public opacity = 1; | ||||
|   public layerIndex = -1; | ||||
|  | ||||
|   constructor(item:IItem,opacity:number = 1, visible:boolean = true,layerIndex:number=-1) { | ||||
|   constructor(item:IItem,opacity = 1, visible = true,layerIndex=-1) { | ||||
|     this.item = item; | ||||
|     this.opacity = opacity; | ||||
|     this.visible = visible; | ||||
| @@ -42,7 +42,7 @@ export class TemporalItemLayer extends ItemLayer implements ITemporalItemLayer { | ||||
|   public nextItemLayer:IItemLayer = null; | ||||
|   public temporalItems:IItem[] = []; | ||||
|  | ||||
|   constructor(item:IItem,opacity:number = 1, visible:boolean = true) { | ||||
|   constructor(item:IItem,opacity = 1, visible = true) { | ||||
|    super(item,opacity,visible) | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -1,7 +1,8 @@ | ||||
| export interface ILayervalue { | ||||
|     date:string; | ||||
|     layerName:string; | ||||
|     unit:string; | ||||
|     quantity:string; | ||||
|     value:number; | ||||
|     date: string; | ||||
|     layerName: string; | ||||
|     unit: string; | ||||
|     quantity: string; | ||||
|     value: number; | ||||
|     scale: number; | ||||
| } | ||||
| @@ -4,4 +4,4 @@ import {Geometry } from 'ol/geom'; | ||||
|  | ||||
| export interface IStyles{ | ||||
|   [id: string]: Style | ((featue:Feature<Geometry>) => Style); | ||||
| }; | ||||
| } | ||||
| @@ -49,6 +49,7 @@ export interface State { | ||||
|   features: Array<Feature<Geometry>>, | ||||
|   panelVisible: boolean, | ||||
|   panelCollapsed: boolean, | ||||
|   panelExtraWide: boolean, | ||||
|   selectedFeature: Feature<Geometry>, | ||||
|   selectedItem:IItem, | ||||
|   parentItem:IItem, | ||||
| @@ -94,6 +95,7 @@ export const initialState: State = { | ||||
|   features: [], | ||||
|   panelVisible: false, | ||||
|   panelCollapsed: false, | ||||
|   panelExtraWide: false, | ||||
|   selectedFeature: null, | ||||
|   selectedItem: null, | ||||
|   parentItem: null, | ||||
| @@ -123,56 +125,56 @@ export const initialState: State = { | ||||
| export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State { | ||||
|   switch (action.type) { | ||||
|     case ROUTER_NAVIGATION: { | ||||
|       let a = action as RouterNavigationAction; | ||||
|       const a = action as RouterNavigationAction; | ||||
|       return tassign(state); | ||||
|     } | ||||
|     case mapActions.SETMAPSTATE: { | ||||
|       let a = action as mapActions.SetMapState; | ||||
|       const a = action as mapActions.SetMapState; | ||||
|       return tassign(state, { | ||||
|         mapState: a.mapState | ||||
|       }); | ||||
|     } | ||||
|     case mapActions.SETQUERYSTATE: { | ||||
|       let a = action as mapActions.SetQueryState; | ||||
|       const a = action as mapActions.SetQueryState; | ||||
|       return tassign(state, { queryState: tassign(a.queryState ),replaceUrl:a.replaceUrl}); | ||||
|     } | ||||
|     case mapActions.SETSTATE: { | ||||
|       let a = action as mapActions.SetState; | ||||
|       const a = action as mapActions.SetState; | ||||
|       return tassign(state, { mapState: tassign(a.mapState), queryState: tassign(a.queryState)}); | ||||
|     } | ||||
|     case mapActions.SETVIEWEXTENT: { | ||||
|       let a = action as mapActions.SetViewExtent; | ||||
|       const a = action as mapActions.SetViewExtent; | ||||
|       return tassign(state, { viewExtent: a.extent }); | ||||
|     } | ||||
|     case mapActions.SETPARENT: { | ||||
|       let a = action as mapActions.SetParent; | ||||
|       const a = action as mapActions.SetParent; | ||||
|       return tassign(state, { | ||||
|         parentCode : a.parentCode | ||||
|       }); | ||||
|     } | ||||
|     case mapActions.STARTSEARCHSUCCESS: { | ||||
|       let a = action as mapActions.StartSearchSuccess; | ||||
|       const a = action as mapActions.StartSearchSuccess; | ||||
|       return tassign(state, { | ||||
|         features: a.features, | ||||
|         inSearch:false | ||||
|       }); | ||||
|     } | ||||
|     case mapActions.SETFEATURES: { | ||||
|       let a = action as mapActions.SetFeatures; | ||||
|       const a = action as mapActions.SetFeatures; | ||||
|       return tassign(state, { | ||||
|         features: a.features | ||||
|       }); | ||||
|     } | ||||
|     case mapActions.SELECTFEATURE: { | ||||
|       let a = action as mapActions.SelectFeature; | ||||
|       const a = action as mapActions.SelectFeature; | ||||
|       return tassign(state, { | ||||
|         selectedFeature: state.selectedItem?state.selectedFeature: a.feature | ||||
|       }); | ||||
|     } | ||||
|     case mapActions.SELECTITEM: { | ||||
|       let a = action as mapActions.SelectItem; | ||||
|       let itemCode = state.selectedItem ? state.selectedItem.code : ""; | ||||
|       let inSearch = a.itemCode != itemCode; | ||||
|       const a = action as mapActions.SelectItem; | ||||
|       const itemCode = state.selectedItem ? state.selectedItem.code : ""; | ||||
|       const inSearch = a.itemCode != itemCode; | ||||
|       return tassign(state, { | ||||
|         selectedItem: null, | ||||
|         selectedItemLayer: null, | ||||
| @@ -182,7 +184,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|       }); | ||||
|     } | ||||
|     case mapActions.SELECTITEMSUCCESS: { | ||||
|       let a = action as mapActions.SelectItemSuccess; | ||||
|       const a = action as mapActions.SelectItemSuccess; | ||||
|       return tassign(state, { | ||||
|         inSearch:false, | ||||
|         selectedItem: a.item, | ||||
| @@ -195,8 +197,8 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|       }); | ||||
|     } | ||||
|     case mapActions.SETSELECTEDITEMLAYER: { | ||||
|       let a = action as mapActions.SetSelectedItemLayer; | ||||
|       var itemLayer = null; | ||||
|       const a = action as mapActions.SetSelectedItemLayer; | ||||
|       let itemLayer = null; | ||||
|       if (a.item && "vnd.farmmaps.itemtype.layer,vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(a.item.itemType) >=0 ) { | ||||
|         itemLayer = new ItemLayer(a.item); | ||||
|         itemLayer.layerIndex = a.layerIndex>=0?a.layerIndex:a.item.data.layers?a.item.data.layers[0].index:-1; | ||||
| @@ -209,12 +211,12 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|       }); | ||||
|     } | ||||
|     case mapActions.SELECTTEMPORALITEMSSUCCESS:{ | ||||
|       let a = action as mapActions.SelectTemporalItemsSuccess; | ||||
|       let selectedItemLayer=tassign(state.selectedItemLayer) as TemporalItemLayer; | ||||
|       const a = action as mapActions.SelectTemporalItemsSuccess; | ||||
|       const selectedItemLayer=tassign(state.selectedItemLayer) as TemporalItemLayer; | ||||
|       let layerIndex=-1; | ||||
|       selectedItemLayer.temporalItems = a.temporalItems; | ||||
|       if(a.temporalItems.length>0) { | ||||
|         let item = a.temporalItems[a.temporalItems.length-1]; | ||||
|         const item = a.temporalItems[a.temporalItems.length-1]; | ||||
|         layerIndex = item.data.layers[0].index; | ||||
|         selectedItemLayer.selectedItemLayer = new ItemLayer(item,1,true,layerIndex); | ||||
|       } else { | ||||
| @@ -223,16 +225,16 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|       selectedItemLayer.previousItemLayer = a.temporalItems.length>1?new ItemLayer(a.temporalItems[a.temporalItems.length-2],0,true,layerIndex):null; | ||||
|       selectedItemLayer.nextItemLayer = null; | ||||
|       if(selectedItemLayer.selectedItemLayer) { | ||||
|         let layerIndex = selectedItemLayer.selectedItemLayer.item.data.layers[0].index; | ||||
|         const layerIndex = selectedItemLayer.selectedItemLayer.item.data.layers[0].index; | ||||
|         selectedItemLayer.layerIndex = layerIndex; | ||||
|       } | ||||
|  | ||||
|       return tassign(state,{selectedItemLayer:tassign(state.selectedItemLayer,selectedItemLayer as ItemLayer)}); | ||||
|     } | ||||
|     case mapActions.NEXTTEMPORAL: { | ||||
|       let temporalLayer = state.selectedItemLayer as ITemporalItemLayer; | ||||
|       const temporalLayer = state.selectedItemLayer as ITemporalItemLayer; | ||||
|       if(temporalLayer.temporalItems && temporalLayer.temporalItems.length>0) { | ||||
|         let index = temporalLayer.temporalItems.indexOf(temporalLayer.selectedItemLayer.item); | ||||
|         const index = temporalLayer.temporalItems.indexOf(temporalLayer.selectedItemLayer.item); | ||||
|         if(index ==  (temporalLayer.temporalItems.length-1)) { | ||||
|           return state; | ||||
|         } else { | ||||
| @@ -258,9 +260,9 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|       } | ||||
|     } | ||||
|     case mapActions.PREVIOUSTEMPORAL: { | ||||
|       let temporalLayer = state.selectedItemLayer as ITemporalItemLayer; | ||||
|       const temporalLayer = state.selectedItemLayer as ITemporalItemLayer; | ||||
|       if(temporalLayer.temporalItems && temporalLayer.temporalItems.length>0) { | ||||
|         let index = temporalLayer.temporalItems.indexOf(temporalLayer.selectedItemLayer.item); | ||||
|         const index = temporalLayer.temporalItems.indexOf(temporalLayer.selectedItemLayer.item); | ||||
|         if(index ==  0) { | ||||
|           return state; | ||||
|         } else { | ||||
| @@ -289,8 +291,8 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|       //todo implement | ||||
|     } | ||||
|     case mapActions.STARTSEARCH: { | ||||
|       let a = action as mapActions.StartSearch; | ||||
|       let panelVisible = a.queryState.itemCode!=null ||a.queryState.itemType!=null||a.queryState.parentCode!=null || a.queryState.query != null || a.queryState.tags != null; | ||||
|       const a = action as mapActions.StartSearch; | ||||
|       const panelVisible = a.queryState.itemCode!=null ||a.queryState.itemType!=null||a.queryState.parentCode!=null || a.queryState.query != null || a.queryState.tags != null; | ||||
|       return tassign(state, { | ||||
|         selectedItem: null, | ||||
|         features:[], | ||||
| @@ -306,7 +308,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|       return tassign(state,{inSearch:false}); | ||||
|     } | ||||
|     case mapActions.DOQUERY: { | ||||
|       let a = action as mapActions.DoQuery; | ||||
|       const a = action as mapActions.DoQuery; | ||||
|       return tassign(state, { | ||||
|         query: tassign(state.query, | ||||
|           { | ||||
| @@ -321,8 +323,8 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|     } | ||||
|  | ||||
|     case mapActions.ADDFEATURESUCCESS: { | ||||
|       let a = action as mapActions.AddFeatureSuccess; | ||||
|       let features = state.features.slice(); | ||||
|       const a = action as mapActions.AddFeatureSuccess; | ||||
|       const features = state.features.slice(); | ||||
|       features.push(a.feature); | ||||
|       return tassign(state, { | ||||
|         panelVisible: true, | ||||
| @@ -334,8 +336,8 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|       }); | ||||
|     } | ||||
|     case mapActions.UPDATEFEATURESUCCESS: { | ||||
|       let a = action as mapActions.UpdateFeatureSuccess; | ||||
|       let features: any[] = []; | ||||
|       const a = action as mapActions.UpdateFeatureSuccess; | ||||
|       const features: any[] = []; | ||||
|       var index = -1; | ||||
|       for (var i = 0; i < state.features.length; i++) { | ||||
|         if (state.features[i].getId() == a.feature.getId()) { | ||||
| @@ -356,15 +358,15 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|       return tassign(state, { searchCollapsed: state.panelVisible ? false: true,showLayerSwitcher:false}); | ||||
|     } | ||||
|     case mapActions.SETEXTENT: { | ||||
|       let a = action as mapActions.SetExtent; | ||||
|       const a = action as mapActions.SetExtent; | ||||
|       return tassign(state, { extent: a.extent }); | ||||
|     } | ||||
|     case mapActions.ADDLAYER: { | ||||
|       let a = action as mapActions.AddLayer; | ||||
|       let itemLayers = state.overlayLayers.slice(0); | ||||
|       let itemLayer = new ItemLayer(a.item); | ||||
|       const a = action as mapActions.AddLayer; | ||||
|       const itemLayers = state.overlayLayers.slice(0); | ||||
|       const itemLayer = new ItemLayer(a.item); | ||||
|       itemLayer.layerIndex = a.layerIndex == -1 ? 0 : a.layerIndex; | ||||
|       let existing = itemLayers.filter(il => il.item.code == itemLayer.item.code && il.layerIndex == itemLayer.layerIndex); | ||||
|       const existing = itemLayers.filter(il => il.item.code == itemLayer.item.code && il.layerIndex == itemLayer.layerIndex); | ||||
|       if(existing.length==0) { | ||||
|         itemLayers.push(itemLayer); | ||||
|         return tassign(state, { overlayLayers: itemLayers, selectedOverlayLayer: itemLayer }); | ||||
| @@ -374,10 +376,10 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|  | ||||
|     } | ||||
|     case mapActions.REMOVELAYER: { | ||||
|       let a = action as mapActions.RemoveLayer; | ||||
|       let newLayers = state.overlayLayers.slice(0); | ||||
|       let i = state.overlayLayers.indexOf(a.itemLayer); | ||||
|       var selectedOverlayLayer: IItemLayer = null; | ||||
|       const a = action as mapActions.RemoveLayer; | ||||
|       const newLayers = state.overlayLayers.slice(0); | ||||
|       const i = state.overlayLayers.indexOf(a.itemLayer); | ||||
|       let selectedOverlayLayer: IItemLayer = null; | ||||
|       if (i>0 && state.overlayLayers.length > 1) | ||||
|         selectedOverlayLayer = state.overlayLayers[i - 1]; | ||||
|       else if (i == 0 && state.overlayLayers.length > 1) | ||||
| @@ -388,50 +390,53 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|     case mapActions.CLEARLAYERS: { | ||||
|       return tassign(state, {overlayLayers: [], selectedOverlayLayer: null}); | ||||
|     } | ||||
|     case mapActions.CLEARFEATURES: { | ||||
|       return tassign(state, {features: [], selectedFeature: null}); | ||||
|     } | ||||
|     case mapActions.SETVISIBILITY: { | ||||
|       let a = action as mapActions.SetVisibility; | ||||
|       const a = action as mapActions.SetVisibility; | ||||
|       if(state.selectedItemLayer == a.itemLayer) { | ||||
|         return tassign(state,{selectedItemLayer: tassign(state.selectedItemLayer,{visible:a.visibility})}); | ||||
|       } else { | ||||
|         let newLayers = state.overlayLayers.slice(0); | ||||
|         let i = state.overlayLayers.indexOf(a.itemLayer); | ||||
|         const newLayers = state.overlayLayers.slice(0); | ||||
|         const i = state.overlayLayers.indexOf(a.itemLayer); | ||||
|         newLayers[i].visible = a.visibility; | ||||
|         return tassign(state, { overlayLayers: newLayers });   | ||||
|       } | ||||
|     } | ||||
|     case mapActions.SETOPACITY: { | ||||
|       let a = action as mapActions.SetOpacity; | ||||
|       const a = action as mapActions.SetOpacity; | ||||
|       if(state.selectedItemLayer == a.itemLayer) { | ||||
|          return tassign(state,{selectedItemLayer: tassign(state.selectedItemLayer,{opacity:a.opacity})}); | ||||
|       } else { | ||||
|         let newLayers = state.overlayLayers.slice(0); | ||||
|         let i = state.overlayLayers.indexOf(a.itemLayer); | ||||
|         const newLayers = state.overlayLayers.slice(0); | ||||
|         const i = state.overlayLayers.indexOf(a.itemLayer); | ||||
|         newLayers[i].opacity = a.opacity; | ||||
|         return tassign(state, { overlayLayers: newLayers });   | ||||
|       } | ||||
|     } | ||||
|     case mapActions.SETLAYERINDEX: { | ||||
|       let a = action as mapActions.SetLayerIndex; | ||||
|       const a = action as mapActions.SetLayerIndex; | ||||
|       if (a.itemLayer == null) { | ||||
|         if(state.selectedItemLayer.item.itemType == "vnd.farmmaps.itemtype.temporal") { | ||||
|           var newItemlayer = tassign(state.selectedItemLayer,{layerIndex:a.layerIndex}); | ||||
|           let tl = newItemlayer as ITemporalItemLayer; | ||||
|           const tl = newItemlayer as ITemporalItemLayer; | ||||
|           if(tl.previousItemLayer) { | ||||
|             let nl = new ItemLayer(tl.previousItemLayer.item); | ||||
|             const nl = new ItemLayer(tl.previousItemLayer.item); | ||||
|             nl.opacity = tl.previousItemLayer.opacity; | ||||
|             nl.visible = tl.previousItemLayer.visible; | ||||
|             nl.layerIndex = a.layerIndex; | ||||
|             tl.previousItemLayer = nl; | ||||
|           } | ||||
|           if(tl.selectedItemLayer) { | ||||
|             let nl = new ItemLayer(tl.selectedItemLayer.item); | ||||
|             const nl = new ItemLayer(tl.selectedItemLayer.item); | ||||
|             nl.opacity = tl.selectedItemLayer.opacity; | ||||
|             nl.visible = tl.selectedItemLayer.visible; | ||||
|             nl.layerIndex = a.layerIndex; | ||||
|             tl.selectedItemLayer = nl; | ||||
|           } | ||||
|           if(tl.nextItemLayer) { | ||||
|             let nl = new ItemLayer(tl.nextItemLayer.item); | ||||
|             const nl = new ItemLayer(tl.nextItemLayer.item); | ||||
|             nl.opacity = tl.nextItemLayer.opacity; | ||||
|             nl.visible = tl.nextItemLayer.visible; | ||||
|             nl.layerIndex = a.layerIndex; | ||||
| @@ -444,24 +449,24 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|         } | ||||
|         return tassign(state, { selectedItemLayer: newItemlayer}) | ||||
|       } else { | ||||
|         let newLayers = state.overlayLayers.slice(0); | ||||
|         let i = state.overlayLayers.indexOf(a.itemLayer); | ||||
|         const newLayers = state.overlayLayers.slice(0); | ||||
|         const i = state.overlayLayers.indexOf(a.itemLayer); | ||||
|         newLayers[i].layerIndex = a.layerIndex; | ||||
|         return tassign(state, { overlayLayers: newLayers }); | ||||
|       } | ||||
|     } | ||||
|     case mapActions.LOADBASELAYERSSUCCESS: { | ||||
|       let a =action as mapActions.LoadBaseLayersSuccess; | ||||
|       let baseLayers:ItemLayer[] = []; | ||||
|       for (let item of a.items) { | ||||
|         var l = new ItemLayer(item); | ||||
|       const a =action as mapActions.LoadBaseLayersSuccess; | ||||
|       const baseLayers:ItemLayer[] = []; | ||||
|       for (const item of a.items) { | ||||
|         const l = new ItemLayer(item); | ||||
|         l.visible = false; | ||||
|         baseLayers.push(l); | ||||
|       } | ||||
|       var selectedBaseLayer: IItemLayer = null; | ||||
|       let selectedBaseLayer: IItemLayer = null; | ||||
|       var mapState = tassign(state.mapState); | ||||
|       let sb = baseLayers.filter(layer => layer.item.code === mapState.baseLayerCode); | ||||
|       let db = baseLayers.filter(layer => layer.item.data && layer.item.data.default === true); | ||||
|       const sb = baseLayers.filter(layer => layer.item.code === mapState.baseLayerCode); | ||||
|       const db = baseLayers.filter(layer => layer.item.data && layer.item.data.default === true); | ||||
|       if (baseLayers.length > 0 && mapState.baseLayerCode != "" && sb.length>0) { | ||||
|         selectedBaseLayer = sb[0]; | ||||
|         selectedBaseLayer.visible = true; | ||||
| @@ -476,22 +481,22 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|       return tassign(state, { mapState:mapState, baseLayers: baseLayers, selectedBaseLayer: selectedBaseLayer }); | ||||
|     } | ||||
|     case mapActions.SELECTBASELAYER: { | ||||
|       let a = action as mapActions.SelectBaseLayer; | ||||
|       let baseLayers = state.baseLayers.slice(0); | ||||
|       const a = action as mapActions.SelectBaseLayer; | ||||
|       const baseLayers = state.baseLayers.slice(0); | ||||
|       baseLayers.forEach((l) => l.visible = false); | ||||
|       let i = state.baseLayers.indexOf(a.itemLayer); | ||||
|       const i = state.baseLayers.indexOf(a.itemLayer); | ||||
|       baseLayers[i].visible = true; | ||||
|       var mapState = tassign(state.mapState); | ||||
|       mapState.baseLayerCode = a.itemLayer.item.code; | ||||
|       return tassign(state, {mapState:mapState, baseLayers:baseLayers,selectedBaseLayer:a.itemLayer }); | ||||
|     } | ||||
|     case mapActions.SELECTOVERLAYLAYER: { | ||||
|       let a = action as mapActions.SelectOverlayLayer; | ||||
|       const a = action as mapActions.SelectOverlayLayer; | ||||
|       return tassign(state, { selectedOverlayLayer: a.itemLayer }); | ||||
|     } | ||||
|  | ||||
|     case mapActions.CLEAR: { | ||||
|       let newQueryState = tassign(state.queryState, { query: null, tags: null, itemCode: null, parentCode: null, itemType: null }); | ||||
|       const newQueryState = tassign(state.queryState, { query: null, tags: null, itemCode: null, parentCode: null, itemType: null }); | ||||
|       return tassign(state, { | ||||
|         panelVisible: false, | ||||
|         panelCollapsed:false, | ||||
| @@ -511,41 +516,41 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|       }); | ||||
|     } | ||||
|     case mapActions.SETSTYLE:{ | ||||
|       let a = action as mapActions.SetStyle; | ||||
|       let styles = tassign(state.styles); | ||||
|       const a = action as mapActions.SetStyle; | ||||
|       const styles = tassign(state.styles); | ||||
|       styles[a.itemType] = a.style; | ||||
|       return tassign(state,{styles:styles}); | ||||
|     } | ||||
|     case mapActions.SHOWLAYERSWITCHER:{ | ||||
|       let a = action as mapActions.ShowLayerSwitcher; | ||||
|       const a = action as mapActions.ShowLayerSwitcher; | ||||
|       return tassign(state,{showLayerSwitcher:a.show}); | ||||
|     } | ||||
|     case mapActions.TOGGLESHOWDATALAYERSLIDE:{ | ||||
|       return tassign(state,{showDataLayerSlide:!state.showDataLayerSlide}); | ||||
|     } | ||||
|     case mapActions.SETREPLACEURL: { | ||||
|       let a= action as mapActions.SetReplaceUrl; | ||||
|       const a= action as mapActions.SetReplaceUrl; | ||||
|       return tassign(state,{replaceUrl:a.replaceUrl}); | ||||
|     } | ||||
|     case mapActions.TOGGLELAYERVALUESENABLED: { | ||||
|       return tassign(state,{layerValuesEnabled:!state.layerValuesEnabled}); | ||||
|     } | ||||
|     case mapActions.SETLAYERVALUESLOCATION: { | ||||
|       let a= action as mapActions.SetLayerValuesLocation; | ||||
|       const a= action as mapActions.SetLayerValuesLocation; | ||||
|       return tassign(state,{layerValuesX: a.x, layerValuesY:a.y,layerValues:[]}); | ||||
|     } | ||||
|     case mapActions.GETLAYERVALUESUCCESS:{ | ||||
|       let a= action as mapActions.GetLayerValueSuccess; | ||||
|       let v = state.layerValues.slice(0); | ||||
|       const a= action as mapActions.GetLayerValueSuccess; | ||||
|       const v = state.layerValues.slice(0); | ||||
|       v.push(a.layervalue); | ||||
|       return tassign(state,{layerValues:v}); | ||||
|     } | ||||
|     case mapActions.SETVIEWSTATE:{ | ||||
|       let a= action as mapActions.SetViewState; | ||||
|       const a= action as mapActions.SetViewState; | ||||
|       return tassign(state,{viewEnabled:a.enabled}); | ||||
|     } | ||||
|     case commonActions.ITEMDELETEDEVENT:{ | ||||
|       let a= action as commonActions.ItemDeletedEvent; | ||||
|       const a= action as commonActions.ItemDeletedEvent; | ||||
|       if(state.selectedItem && state.selectedItem.code == a.itemCode) { | ||||
|          return tassign(state,{   | ||||
|           selectedItem: null, | ||||
| @@ -562,13 +567,17 @@ export function reducer(state = initialState, action: mapActions.Actions | commo | ||||
|           } | ||||
|         } | ||||
|         if(index>=0) { | ||||
|           let newFeatures = state.features.slice(0); | ||||
|           const newFeatures = state.features.slice(0); | ||||
|           newFeatures.splice(index,1); | ||||
|           return tassign(state,{features:newFeatures}); | ||||
|         } | ||||
|       } | ||||
|       return state; | ||||
|     } | ||||
|     case mapActions.SETPANELEXTRAWIDE:{ | ||||
|       const a= action as mapActions.SetPanelExtraWide; | ||||
|       return tassign(state,{panelExtraWide:a.panelExtraWide}); | ||||
|     } | ||||
|     default: { | ||||
|       return state; | ||||
|     } | ||||
| @@ -580,6 +589,7 @@ export const getParentCode = (state: State) => state.parentCode; | ||||
| export const getFeatures = (state: State) => state.features; | ||||
| export const getPanelVisible = (state: State) => state.panelVisible; | ||||
| export const getPanelCollapsed = (state: State) => state.panelCollapsed; | ||||
| export const getPanelExtraWide = (state: State) => state.panelExtraWide; | ||||
| export const getSelectedFeature = (state: State) => state.selectedFeature; | ||||
| export const getSelectedItem = (state: State) => state.selectedItem; | ||||
| export const getParentItem = (state: State) => state.parentItem; | ||||
| @@ -588,6 +598,7 @@ export const getClearEnabled = (state: State) => state.clearEnabled; | ||||
| export const getSearchCollapsed = (state: State) => state.searchCollapsed; | ||||
| export const getSearchMinified = (state: State) => state.searchMinified; | ||||
| export const getExtent = (state: State) => state.extent; | ||||
| export const getViewExtent = (state: State) => state.viewExtent; | ||||
| export const getOverlayLayers = (state: State) => state.overlayLayers; | ||||
| export const getBaseLayers = (state: State) => state.baseLayers; | ||||
| export const getProjection = (state: State) => state.projection; | ||||
| @@ -614,6 +625,7 @@ export const selectGetParentCode = createSelector(selectMapState, getParentCode) | ||||
| export const selectGetFeatures = createSelector(selectMapState, getFeatures); | ||||
| export const selectGetPanelVisible = createSelector(selectMapState, getPanelVisible); | ||||
| export const selectGetPanelCollapsed = createSelector(selectMapState, getPanelCollapsed); | ||||
| export const selectGetPanelExtraWide = createSelector(selectMapState, getPanelExtraWide); | ||||
| export const selectGetSelectedFeature = createSelector(selectMapState, getSelectedFeature); | ||||
| export const selectGetSelectedItem = createSelector(selectMapState, getSelectedItem); | ||||
| export const selectGetParentItem = createSelector(selectMapState, getParentItem); | ||||
| @@ -622,6 +634,7 @@ export const selectGetClearEnabled = createSelector(selectMapState, getClearEnab | ||||
| export const selectGetSearchCollapsed = createSelector(selectMapState, getSearchCollapsed); | ||||
| export const selectGetSearchMinified = createSelector(selectMapState, getSearchMinified); | ||||
| export const selectGetExtent = createSelector(selectMapState, getExtent); | ||||
| export const selectGetViewExtent = createSelector(selectMapState, getViewExtent); | ||||
| export const selectGetOverlayLayers = createSelector(selectMapState, getOverlayLayers); | ||||
| export const selectGetBaseLayers = createSelector(selectMapState, getBaseLayers); | ||||
| export const selectGetProjection = createSelector(selectMapState, getProjection); | ||||
|   | ||||
| @@ -8,25 +8,25 @@ export class DeviceOrientationService { | ||||
|   compassHeading(alpha, beta, gamma):number { | ||||
|  | ||||
|     // Convert degrees to radians | ||||
|     var alphaRad = alpha * (Math.PI / 180); | ||||
|     var betaRad = beta * (Math.PI / 180); | ||||
|     var gammaRad = gamma * (Math.PI / 180); | ||||
|     const alphaRad = alpha * (Math.PI / 180); | ||||
|     const betaRad = beta * (Math.PI / 180); | ||||
|     const gammaRad = gamma * (Math.PI / 180); | ||||
|    | ||||
|     // Calculate equation components | ||||
|     var cA = Math.cos(alphaRad); | ||||
|     var sA = Math.sin(alphaRad); | ||||
|     var cB = Math.cos(betaRad); | ||||
|     var sB = Math.sin(betaRad); | ||||
|     var cG = Math.cos(gammaRad); | ||||
|     var sG = Math.sin(gammaRad); | ||||
|     const cA = Math.cos(alphaRad); | ||||
|     const sA = Math.sin(alphaRad); | ||||
|     const cB = Math.cos(betaRad); | ||||
|     const sB = Math.sin(betaRad); | ||||
|     const cG = Math.cos(gammaRad); | ||||
|     const sG = Math.sin(gammaRad); | ||||
|    | ||||
|     // Calculate A, B, C rotation components | ||||
|     var rA = - cA * sG - sA * sB * cG; | ||||
|     var rB = - sA * sG + cA * sB * cG; | ||||
|     var rC = - cB * cG; | ||||
|     const rA = - cA * sG - sA * sB * cG; | ||||
|     const rB = - sA * sG + cA * sB * cG; | ||||
|     const rC = - cB * cG; | ||||
|    | ||||
|     // Calculate compass heading | ||||
|     var compassHeading = Math.atan(rA / rB); | ||||
|     let compassHeading = Math.atan(rA / rB); | ||||
|    | ||||
|     // Convert from half unit circle to whole unit circle | ||||
|     if(rB < 0) { | ||||
| @@ -40,7 +40,7 @@ export class DeviceOrientationService { | ||||
|   getCurrentCompassHeading(): Observable<number> { | ||||
|     return Observable.create((observer: Observer<number>) => {   | ||||
|         window.addEventListener("deviceorientation", (event:DeviceOrientationEvent)=>{ | ||||
|           let heading = this.compassHeading(event.alpha,event.beta,event.gamma); | ||||
|           const heading = this.compassHeading(event.alpha,event.beta,event.gamma); | ||||
|           if(!Number.isNaN(heading)) { | ||||
|             observer.next(heading); | ||||
|           } | ||||
|   | ||||
| @@ -7,31 +7,31 @@ import * as extent from 'ol/extent'; | ||||
| @Injectable() | ||||
| export class FeatureIconService {       | ||||
|      | ||||
|       getIconImageDataUrl(iconClass:string, backgroundColor: string = "#c80a6e",color:string = "#ffffff"): string { | ||||
|         var canvas = document.createElement('canvas'); | ||||
|       getIconImageDataUrl(iconClass:string, backgroundColor = "#c80a6e",color = "#ffffff"): string { | ||||
|         const canvas = document.createElement('canvas'); | ||||
|         canvas.width = 365; | ||||
|         canvas.height = 560; | ||||
|         var ctx = canvas.getContext('2d'); | ||||
|         const ctx = canvas.getContext('2d'); | ||||
|         ctx.lineWidth = 6; | ||||
|         ctx.fillStyle = backgroundColor; | ||||
|         ctx.strokeStyle = "#000000"; | ||||
|         var path = new Path2D("m182.9 551.7c0 0.1 0.2 0.3 0.2 0.3s175.2-269 175.2-357.4c0-130.1-88.8-186.7-175.4-186.9-86.6 0.2-175.4 56.8-175.4 186.9 0 88.4 175.3 357.4 175.3 357.4z"); | ||||
|         const path = new Path2D("m182.9 551.7c0 0.1 0.2 0.3 0.2 0.3s175.2-269 175.2-357.4c0-130.1-88.8-186.7-175.4-186.9-86.6 0.2-175.4 56.8-175.4 186.9 0 88.4 175.3 357.4 175.3 357.4z"); | ||||
|         ctx.fill(path) | ||||
|      | ||||
|         var iconCharacter = ""; | ||||
|         let iconCharacter = ""; | ||||
|         if (iconClass != null) { | ||||
|           var element = document.createElement("i"); | ||||
|           const element = document.createElement("i"); | ||||
|           element.style.display = "none"; | ||||
|           element.className = iconClass; | ||||
|           document.body.appendChild(element); | ||||
|           iconCharacter = getComputedStyle(element, "::before").content.replace(/"/g, ''); | ||||
|           let iconFont = "200px " +getComputedStyle(element, "::before").fontFamily | ||||
|           const iconFont = "200px " +getComputedStyle(element, "::before").fontFamily | ||||
|           document.body.removeChild(element); | ||||
|           ctx.strokeStyle = color; | ||||
|           ctx.fillStyle = color; | ||||
|           ctx.lineWidth = 15; | ||||
|           ctx.font = iconFont; | ||||
|           var ts = ctx.measureText(iconCharacter); | ||||
|           const ts = ctx.measureText(iconCharacter); | ||||
|           ctx.fillText(iconCharacter, 182.9 - (ts.width / 2), 250); | ||||
|           ctx.strokeText(iconCharacter, 182.9 - (ts.width / 2), 250); | ||||
|         } | ||||
|   | ||||
| @@ -9,19 +9,19 @@ export class TemporalService { | ||||
|     constructor(private timespanService$:TimespanService,private datePipe$: DatePipe) {} | ||||
|  | ||||
|     hasNext(itemLayer:IItemLayer):boolean { | ||||
|         let temporalItemLayer = itemLayer as  ITemporalItemLayer; | ||||
|         const temporalItemLayer = itemLayer as  ITemporalItemLayer; | ||||
|         return temporalItemLayer && temporalItemLayer.nextItemLayer != null; | ||||
|       } | ||||
|      | ||||
|       selectedDate(itemLayer:IItemLayer):string { | ||||
|         let temporalItemLayer = itemLayer as  ITemporalItemLayer;         | ||||
|         const temporalItemLayer = itemLayer as  ITemporalItemLayer;         | ||||
|         if(temporalItemLayer && temporalItemLayer.selectedItemLayer) { | ||||
|           if(temporalItemLayer && temporalItemLayer.selectedItemLayer.item.dataDate && temporalItemLayer.selectedItemLayer.item.dataEndDate) { | ||||
|             let sd = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate)); | ||||
|             let ed = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataEndDate)); | ||||
|             const sd = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate)); | ||||
|             const ed = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataEndDate)); | ||||
|             return this.timespanService$.getCaption(sd,ed); | ||||
|           } else { | ||||
|             let d = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate)); | ||||
|             const d = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate)); | ||||
|             return this.datePipe$.transform(d, "shortDate");   | ||||
|           } | ||||
|         } | ||||
| @@ -29,14 +29,14 @@ export class TemporalService { | ||||
|       } | ||||
|      | ||||
|       nextDate(itemLayer:IItemLayer):string { | ||||
|         let temporalItemLayer = itemLayer as  ITemporalItemLayer; | ||||
|         const temporalItemLayer = itemLayer as  ITemporalItemLayer; | ||||
|         if(temporalItemLayer && temporalItemLayer.nextItemLayer && temporalItemLayer.nextItemLayer.item) { | ||||
|           if(temporalItemLayer.nextItemLayer.item.dataDate && temporalItemLayer.nextItemLayer.item.dataEndDate) { | ||||
|             let sd = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataDate)); | ||||
|             let ed = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataEndDate)); | ||||
|             const sd = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataDate)); | ||||
|             const ed = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataEndDate)); | ||||
|             return this.timespanService$.getCaption(sd,ed); | ||||
|           } else { | ||||
|             let d = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataDate)); | ||||
|             const d = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataDate)); | ||||
|             return this.datePipe$.transform(d, "shortDate");   | ||||
|           } | ||||
|         } | ||||
| @@ -44,19 +44,19 @@ export class TemporalService { | ||||
|       } | ||||
|      | ||||
|       hasPrevious(itemLayer:IItemLayer):boolean { | ||||
|         let temporalItemLayer = itemLayer as  ITemporalItemLayer; | ||||
|         const temporalItemLayer = itemLayer as  ITemporalItemLayer; | ||||
|         return temporalItemLayer && temporalItemLayer.previousItemLayer != null; | ||||
|       } | ||||
|      | ||||
|       previousDate(itemLayer:IItemLayer):string { | ||||
|         let temporalItemLayer = itemLayer as  ITemporalItemLayer; | ||||
|         const temporalItemLayer = itemLayer as  ITemporalItemLayer; | ||||
|         if(temporalItemLayer && temporalItemLayer.previousItemLayer && temporalItemLayer.previousItemLayer.item)  { | ||||
|           if(temporalItemLayer.previousItemLayer.item.dataDate && temporalItemLayer.previousItemLayer.item.dataEndDate) { | ||||
|             let sd = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataDate)); | ||||
|             let ed = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataEndDate)); | ||||
|             const sd = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataDate)); | ||||
|             const ed = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataEndDate)); | ||||
|             return this.timespanService$.getCaption(sd,ed); | ||||
|           } else { | ||||
|             let d = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataDate)); | ||||
|             const d = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataDate)); | ||||
|             return this.datePipe$.transform(d, "shortDate");   | ||||
|           } | ||||
|         } | ||||
|   | ||||
| @@ -9,8 +9,6 @@ import { | ||||
|   platformBrowserDynamicTesting | ||||
| } from '@angular/platform-browser-dynamic/testing'; | ||||
|  | ||||
| declare const require: any; | ||||
|  | ||||
| // First, initialize the Angular testing environment. | ||||
| getTestBed().initTestEnvironment( | ||||
|   BrowserDynamicTestingModule, | ||||
| @@ -18,7 +16,3 @@ getTestBed().initTestEnvironment( | ||||
|     teardown: { destroyAfterEach: false } | ||||
| } | ||||
| ); | ||||
| // Then we find all the tests. | ||||
| const context = require.context('./', true, /\.spec\.ts$/); | ||||
| // And load the modules. | ||||
| context.keys().map(context); | ||||
|   | ||||
| @@ -2,7 +2,6 @@ | ||||
|   "extends": "../../tsconfig.json", | ||||
|   "compilerOptions": { | ||||
|     "outDir": "../../out-tsc/lib", | ||||
|     "target": "es2020", | ||||
|     "module": "es2015", | ||||
|     "moduleResolution": "node", | ||||
|     "declaration": true, | ||||
| @@ -11,18 +10,27 @@ | ||||
|     "emitDecoratorMetadata": true, | ||||
|     "experimentalDecorators": true, | ||||
|     "importHelpers": true, | ||||
|     "esModuleInterop": true, | ||||
|     "types": [], | ||||
|     "lib": [ | ||||
|       "dom", | ||||
|       "es2018" | ||||
|     ] | ||||
|     ], | ||||
|     "paths": { | ||||
|       "@angular/*": [ | ||||
|  | ||||
|       "node_modules/@angular/*" | ||||
|  | ||||
|       ] | ||||
|     } | ||||
|   }, | ||||
|   "angularCompilerOptions": { | ||||
|     "skipTemplateCodegen": true, | ||||
|     "strictMetadataEmit": true, | ||||
|     "fullTemplateTypeCheck": true, | ||||
|     "strictInjectionParameters": true, | ||||
|     "enableResourceInlining": true | ||||
|     "enableResourceInlining": true, | ||||
|     "compilationMode": "partial" | ||||
|   }, | ||||
|   "exclude": [ | ||||
|     "src/test.ts", | ||||
|   | ||||
| @@ -2,7 +2,6 @@ | ||||
|   "extends": "../../tsconfig.json", | ||||
|   "compilerOptions": { | ||||
|     "outDir": "../../out-tsc/lib", | ||||
|     "target": "es2020", | ||||
|     "module": "es2015", | ||||
|     "moduleResolution": "node", | ||||
|     "declaration": true, | ||||
|   | ||||
| @@ -1,17 +0,0 @@ | ||||
| { | ||||
|   "extends": "../../tslint.json", | ||||
|   "rules": { | ||||
|     "directive-selector": [ | ||||
|       true, | ||||
|       "attribute", | ||||
|       "fm-map", | ||||
|       "camelCase" | ||||
|     ], | ||||
|     "component-selector": [ | ||||
|       true, | ||||
|       "element", | ||||
|       "fm-map", | ||||
|       "kebab-case" | ||||
|     ] | ||||
|   } | ||||
| } | ||||
							
								
								
									
										22
									
								
								projects/common-map3d/.eslintrc.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								projects/common-map3d/.eslintrc.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| module.exports = { | ||||
|     "env": { | ||||
|         "browser": true, | ||||
|         "es2021": true | ||||
|     }, | ||||
|     "extends": [ | ||||
|         "eslint:recommended", | ||||
|         "plugin:@typescript-eslint/recommended" | ||||
|     ], | ||||
|     "overrides": [ | ||||
|     ], | ||||
|     "parser": "@typescript-eslint/parser", | ||||
|     "parserOptions": { | ||||
|         "ecmaVersion": "latest", | ||||
|         "sourceType": "module" | ||||
|     }, | ||||
|     "plugins": [ | ||||
|         "@typescript-eslint" | ||||
|     ], | ||||
|     "rules": { | ||||
|     } | ||||
| } | ||||
							
								
								
									
										27
									
								
								projects/common-map3d/package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								projects/common-map3d/package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| { | ||||
|   "name": "@farmmaps/common-map3d", | ||||
|   "version": "2.0.0", | ||||
|   "lockfileVersion": 3, | ||||
|   "requires": true, | ||||
|   "packages": { | ||||
|     "": { | ||||
|       "name": "@farmmaps/common-map3d", | ||||
|       "version": "2.0.0", | ||||
|       "dependencies": { | ||||
|         "tslib": "^2.0.0" | ||||
|       }, | ||||
|       "peerDependencies": { | ||||
|         "@angular/common": "^16.2.12", | ||||
|         "@angular/core": "^16.2.12", | ||||
|         "cesium": ">=1.82.1", | ||||
|         "ngx-openlayers": "file:dist/ngx-openlayers", | ||||
|         "ol-cesium": ">=2.13.0" | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/tslib": { | ||||
|       "version": "2.5.0", | ||||
|       "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz", | ||||
|       "integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==" | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @@ -5,9 +5,9 @@ | ||||
|     "registry": "https://repository.akkerweb.nl/repository/npm-hosted/" | ||||
|   }, | ||||
|   "peerDependencies": { | ||||
|     "@angular/common":  ">=14.0.0", | ||||
|     "@angular/core":  ">=14.0.0", | ||||
|     "ngx-openlayers": "1.0.0-next.19", | ||||
|     "@angular/common":  "^16.2.12", | ||||
|     "@angular/core":  "^16.2.12", | ||||
|     "ngx-openlayers": "file:dist/ngx-openlayers", | ||||
|     "cesium": ">=1.82.1", | ||||
|     "ol-cesium": ">=2.13.0" | ||||
|   }, | ||||
|   | ||||
| @@ -1,17 +1,15 @@ | ||||
| @import "~bootstrap/scss/bootstrap.scss"; | ||||
|  | ||||
| .twotreed { | ||||
|   display:block;  | ||||
|   width:2.5em; | ||||
|   height:2.5em; | ||||
|   background-color: $body-bg; | ||||
|   background-color: var(--bs-body-bg); | ||||
|   background-size: contain; | ||||
|   margin-top:0.5em; | ||||
|   text-align: center; | ||||
|   line-height: 2.5em;  | ||||
|   border-radius: 1.75em; | ||||
|   padding: 0; | ||||
|   color: $secondary; | ||||
|   color: var(--bs-secondary); | ||||
| } | ||||
|  | ||||
| .fa-spinner { | ||||
|   | ||||
| @@ -15,10 +15,10 @@ import { Store } from '@ngrx/store'; | ||||
| export class Switch2D3DComponent { | ||||
|  | ||||
|   @Input() enable:boolean; | ||||
|   public label: string = "3D"; | ||||
|   public label = "3D"; | ||||
|   private ol3d: OLCesium; | ||||
|   private synchronizers:any[]; | ||||
|   public loading:boolean = true; | ||||
|   public loading = true; | ||||
|   private interactions:Interaction[] = []; | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -8,13 +8,6 @@ import { | ||||
|   platformBrowserDynamicTesting | ||||
| } from '@angular/platform-browser-dynamic/testing'; | ||||
|  | ||||
| declare const require: { | ||||
|   context(path: string, deep?: boolean, filter?: RegExp): { | ||||
|     keys(): string[]; | ||||
|     <T>(id: string): T; | ||||
|   }; | ||||
| }; | ||||
|  | ||||
| // First, initialize the Angular testing environment. | ||||
| getTestBed().initTestEnvironment( | ||||
|   BrowserDynamicTestingModule, | ||||
| @@ -22,7 +15,3 @@ getTestBed().initTestEnvironment( | ||||
|     teardown: { destroyAfterEach: false } | ||||
| } | ||||
| ); | ||||
| // Then we find all the tests. | ||||
| const context = require.context('./', true, /\.spec\.ts$/); | ||||
| // And load the modules. | ||||
| context.keys().map(context); | ||||
|   | ||||
| @@ -11,18 +11,27 @@ | ||||
|     "emitDecoratorMetadata": true, | ||||
|     "experimentalDecorators": true, | ||||
|     "importHelpers": true, | ||||
|     "esModuleInterop": true, | ||||
|     "types": [], | ||||
|     "lib": [ | ||||
|       "dom", | ||||
|       "es2018" | ||||
|     ] | ||||
|     ], | ||||
|     "paths": { | ||||
|       "@angular/*": [ | ||||
|  | ||||
|       "node_modules/@angular/*" | ||||
|  | ||||
|       ] | ||||
|     } | ||||
|   }, | ||||
|   "angularCompilerOptions": { | ||||
|     "skipTemplateCodegen": true, | ||||
|     "strictMetadataEmit": true, | ||||
|     "fullTemplateTypeCheck": true, | ||||
|     "strictInjectionParameters": true, | ||||
|     "enableResourceInlining": true | ||||
|     "enableResourceInlining": true, | ||||
|     "compilationMode": "partial" | ||||
|   }, | ||||
|   "exclude": [ | ||||
|     "src/test.ts", | ||||
|   | ||||
| @@ -1,17 +0,0 @@ | ||||
| { | ||||
|   "extends": "../../tslint.json", | ||||
|   "rules": { | ||||
|     "directive-selector": [ | ||||
|       true, | ||||
|       "attribute", | ||||
|       "lib", | ||||
|       "camelCase" | ||||
|     ], | ||||
|     "component-selector": [ | ||||
|       true, | ||||
|       "element", | ||||
|       "lib", | ||||
|       "kebab-case" | ||||
|     ] | ||||
|   } | ||||
| } | ||||
							
								
								
									
										22
									
								
								projects/common/.eslintrc.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								projects/common/.eslintrc.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| module.exports = { | ||||
|     "env": { | ||||
|         "browser": true, | ||||
|         "es2021": true | ||||
|     }, | ||||
|     "extends": [ | ||||
|         "eslint:recommended", | ||||
|         "plugin:@typescript-eslint/recommended" | ||||
|     ], | ||||
|     "overrides": [ | ||||
|     ], | ||||
|     "parser": "@typescript-eslint/parser", | ||||
|     "parserOptions": { | ||||
|         "ecmaVersion": "latest", | ||||
|         "sourceType": "module" | ||||
|     }, | ||||
|     "plugins": [ | ||||
|         "@typescript-eslint" | ||||
|     ], | ||||
|     "rules": { | ||||
|     } | ||||
| } | ||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user