Compare commits
	
		
			115 Commits
		
	
	
		
			2021.09
			...
			a4c34fe21c
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					a4c34fe21c | ||
| 
						 | 
					9196358842 | ||
| 
						 | 
					f4cbb1ff68 | ||
| 
						 | 
					f008e97e39 | ||
| 
						 | 
					61d2fc8d54 | ||
| 
						 | 
					80760a8fdd | ||
| 
						 | 
					a7f53a841b | ||
| 
						 | 
					9d64fce22c | ||
| e39c0b055d | |||
| 
						 | 
					237fd27489 | ||
| 
						 | 
					296385ab33 | ||
| 
						 | 
					402bbcea0d | ||
| 
						 | 
					161717bc7b | ||
| 
						 | 
					0b8dbf4e2e | ||
| 2acf13cbac | |||
| 
						 | 
					a408f4bffa | ||
| 
						 | 
					ac5bd7d635 | ||
| 
						 | 
					cf84f8c93d | ||
| 
						 | 
					4872dee094 | ||
| 
						 | 
					b76a933dba | ||
| 
						 | 
					41c7ab15f3 | ||
| 
						 | 
					a9185b86af | ||
| 
						 | 
					eb1b8f18eb | ||
| 
						 | 
					bce562fb8e | ||
| 
						 | 
					2825ce4ccc | ||
| 
						 | 
					5d83293540 | ||
| 
						 | 
					b652555f37 | ||
| 
						 | 
					3db09c1e2a | ||
| 
						 | 
					0d40141b2d | ||
| 
						 | 
					33e7a2310d | ||
| 
						 | 
					ddb112b989 | ||
| 
						 | 
					7502bc54d1 | ||
| 
						 | 
					15cc2c33f1 | ||
| 
						 | 
					eb0e928c6f | ||
| 
						 | 
					5631d23355 | ||
| 
						 | 
					0470cb0fa1 | ||
| 
						 | 
					1656b465ee | ||
| 
						 | 
					a558b23a98 | ||
| 
						 | 
					c569076c5d | ||
| 
						 | 
					be2516a3b8 | ||
| 
						 | 
					7f62a74877 | ||
| 
						 | 
					3b296a1fba | ||
| 
						 | 
					28c9cd353d | ||
| 
						 | 
					83a5c1a7d2 | ||
| 
						 | 
					a767502d66 | ||
| 
						 | 
					897ac3dab5 | ||
| 
						 | 
					2f165b4b48 | ||
| 
						 | 
					3994818b6a | ||
| 7b2dbc1777 | |||
| 8c59976de6 | |||
| d551a2cf7a | |||
| a3a09507a6 | |||
| 9bbde64147 | |||
| 0c4259d72e | |||
| 
						 | 
					57e0a37c78 | ||
| 
						 | 
					713af307cd | ||
| 
						 | 
					521b882798 | ||
| 
						 | 
					b850f5d621 | ||
| 
						 | 
					d8730e77ad | ||
| e62c185f35 | |||
| f81b16b966 | |||
| b9ee39399c | |||
| be9b01dbab | |||
| feacfd8bb3 | |||
| 2f0362e730 | |||
| 
						 | 
					f4ba89920c | ||
| 
						 | 
					f5b312a888 | ||
| 
						 | 
					97142bc986 | ||
| 
						 | 
					67335a0a4a | ||
| 
						 | 
					b752b377da | ||
| 
						 | 
					74c77bae5e | ||
| 
						 | 
					b22278a75f | ||
| 
						 | 
					37854d43fc | ||
| 
						 | 
					2161951cbb | ||
| 66e492d2f8 | |||
| e944064053 | |||
| a1a4fc14ab | |||
| 122563a0bd | |||
| 33f322424e | |||
| 519b81d1fd | |||
| b7c80dfdd8 | |||
| 
						 | 
					77d2433d63 | ||
| 
						 | 
					9bc78dc302 | ||
| ac0fe962a0 | |||
| d89670f669 | |||
| d025e2e3f6 | |||
| 
						 | 
					c22cede59b | ||
| 
						 | 
					48574dc0b0 | ||
| 
						 | 
					57407d83d3 | ||
| 
						 | 
					f83549b5af | ||
| 
						 | 
					132556da81 | ||
| 
						 | 
					c2350eec52 | ||
| aa1ad9f844 | |||
| 
						 | 
					c6d14e6c9c | ||
| 
						 | 
					8e4364bd08 | ||
| 
						 | 
					af3340ed70 | ||
| 
						 | 
					cc4726e85c | ||
| 
						 | 
					ff19d830a7 | ||
| 
						 | 
					29914cfb1b | ||
| 
						 | 
					7bca0a57c4 | ||
| 
						 | 
					fdba357e9c | ||
| 
						 | 
					e28564c88a | ||
| 
						 | 
					90c3fa25a4 | ||
| 
						 | 
					3b8b812c55 | ||
| 
						 | 
					025889b390 | ||
| 
						 | 
					eabaa1db19 | ||
| 
						 | 
					ba541c4e08 | ||
| 
						 | 
					b994bc51cd | ||
| 
						 | 
					960275dd38 | ||
| 
						 | 
					5b7fef689a | ||
| 
						 | 
					1c1315a580 | ||
| 
						 | 
					5d21d66589 | ||
| 
						 | 
					160eb10aba | ||
| 
						 | 
					4ef077f8d7 | ||
| 
						 | 
					df84a7c217 | 
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -33,6 +33,7 @@ speed-measure-plugin.json
 | 
			
		||||
.history/*
 | 
			
		||||
 | 
			
		||||
# misc
 | 
			
		||||
/.angular/cache
 | 
			
		||||
/.sass-cache
 | 
			
		||||
/connect.lock
 | 
			
		||||
/coverage
 | 
			
		||||
@@ -47,3 +48,4 @@ testem.log
 | 
			
		||||
Thumbs.db
 | 
			
		||||
projects/common/node_modules/
 | 
			
		||||
projects/common-map/node_modules/
 | 
			
		||||
.angular/*
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								Jenkinsfile
									
									
									
									
										vendored
									
									
								
							@@ -8,21 +8,21 @@ pipeline {
 | 
			
		||||
    stage('npm install'){
 | 
			
		||||
      steps {
 | 
			
		||||
        sh '''rm -rf node_modules/
 | 
			
		||||
        npm install
 | 
			
		||||
        npm install --legacy-peer-deps
 | 
			
		||||
        cd projects/common
 | 
			
		||||
        npm install
 | 
			
		||||
        npm install --legacy-peer-deps
 | 
			
		||||
        cd ../common-map
 | 
			
		||||
        npm install
 | 
			
		||||
        npm install --legacy-peer-deps
 | 
			
		||||
        cd ../common-map3d
 | 
			
		||||
        npm install
 | 
			
		||||
        npm install --legacy-peer-deps
 | 
			
		||||
        '''
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    stage('build'){
 | 
			
		||||
      steps {
 | 
			
		||||
        sh '''ng build common
 | 
			
		||||
        ng build common-map
 | 
			
		||||
        ng build common-map3d'''
 | 
			
		||||
        sh '''ng build common --configuration production
 | 
			
		||||
        ng build common-map --configuration production
 | 
			
		||||
        ng build common-map3d --configuration production'''
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    stage('npm publish'){
 | 
			
		||||
 
 | 
			
		||||
@@ -8,21 +8,21 @@ pipeline {
 | 
			
		||||
    stage('npm install'){
 | 
			
		||||
      steps {
 | 
			
		||||
        sh '''rm -rf node_modules/
 | 
			
		||||
        npm install
 | 
			
		||||
        npm install --legacy-peer-deps
 | 
			
		||||
        cd projects/common
 | 
			
		||||
        npm install
 | 
			
		||||
        npm install --legacy-peer-deps
 | 
			
		||||
        cd ../common-map
 | 
			
		||||
        npm install
 | 
			
		||||
        npm install --legacy-peer-deps
 | 
			
		||||
        cd ../common-map3d
 | 
			
		||||
        npm install
 | 
			
		||||
        npm install --legacy-peer-deps
 | 
			
		||||
        '''
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    stage('build'){
 | 
			
		||||
      steps {
 | 
			
		||||
        sh '''ng build common
 | 
			
		||||
        ng build common-map
 | 
			
		||||
        ng build common-map3d'''
 | 
			
		||||
        sh '''ng build common --configuration production
 | 
			
		||||
        ng build common-map --configuration production
 | 
			
		||||
        ng build common-map3d --configuration production'''
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    stage('npm publish'){
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										92
									
								
								angular.json
									
									
									
									
									
								
							
							
						
						
									
										92
									
								
								angular.json
									
									
									
									
									
								
							@@ -83,6 +83,31 @@
 | 
			
		||||
                  "maximumWarning": "6kb"
 | 
			
		||||
                }
 | 
			
		||||
              ]
 | 
			
		||||
            },
 | 
			
		||||
            "development": {
 | 
			
		||||
              "fileReplacements": [
 | 
			
		||||
                {
 | 
			
		||||
                  "replace": "src/environments/environment.ts",
 | 
			
		||||
                  "with": "src/environments/environment.prod.ts"
 | 
			
		||||
                }
 | 
			
		||||
              ],
 | 
			
		||||
              "optimization": false,
 | 
			
		||||
              "sourceMap": true,
 | 
			
		||||
              "namedChunks": true,
 | 
			
		||||
              "extractLicenses": false,
 | 
			
		||||
              "vendorChunk": false,
 | 
			
		||||
              "buildOptimizer": false,
 | 
			
		||||
              "budgets": [
 | 
			
		||||
                {
 | 
			
		||||
                  "type": "initial",
 | 
			
		||||
                  "maximumWarning": "2mb",
 | 
			
		||||
                  "maximumError": "7mb"
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                  "type": "anyComponentStyle",
 | 
			
		||||
                  "maximumWarning": "6kb"
 | 
			
		||||
                }
 | 
			
		||||
              ]
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
@@ -94,8 +119,12 @@
 | 
			
		||||
          "configurations": {
 | 
			
		||||
            "production": {
 | 
			
		||||
              "browserTarget": "farmmaps-lib-app:build:production"
 | 
			
		||||
            },
 | 
			
		||||
            "development": {
 | 
			
		||||
              "browserTarget": "farmmaps-lib-app:build:development"
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          },
 | 
			
		||||
          "defaultConfiguration": "development"
 | 
			
		||||
        },
 | 
			
		||||
        "extract-i18n": {
 | 
			
		||||
          "builder": "@angular-devkit/build-angular:extract-i18n",
 | 
			
		||||
@@ -119,18 +148,6 @@
 | 
			
		||||
              "src/assets"
 | 
			
		||||
            ]
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "lint": {
 | 
			
		||||
          "builder": "@angular-devkit/build-angular:tslint",
 | 
			
		||||
          "options": {
 | 
			
		||||
            "tsConfig": [
 | 
			
		||||
              "src/tsconfig.app.json",
 | 
			
		||||
              "src/tsconfig.spec.json"
 | 
			
		||||
            ],
 | 
			
		||||
            "exclude": [
 | 
			
		||||
              "**/node_modules/**"
 | 
			
		||||
            ]
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -150,15 +167,6 @@
 | 
			
		||||
              "devServerTarget": "farmmaps-lib-app:serve:production"
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "lint": {
 | 
			
		||||
          "builder": "@angular-devkit/build-angular:tslint",
 | 
			
		||||
          "options": {
 | 
			
		||||
            "tsConfig": "e2e/tsconfig.e2e.json",
 | 
			
		||||
            "exclude": [
 | 
			
		||||
              "**/node_modules/**"
 | 
			
		||||
            ]
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -187,18 +195,6 @@
 | 
			
		||||
            "tsConfig": "projects/common/tsconfig.spec.json",
 | 
			
		||||
            "karmaConfig": "projects/common/karma.conf.js"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "lint": {
 | 
			
		||||
          "builder": "@angular-devkit/build-angular:tslint",
 | 
			
		||||
          "options": {
 | 
			
		||||
            "tsConfig": [
 | 
			
		||||
              "projects/common/tsconfig.lib.json",
 | 
			
		||||
              "projects/common/tsconfig.spec.json"
 | 
			
		||||
            ],
 | 
			
		||||
            "exclude": [
 | 
			
		||||
              "**/node_modules/**"
 | 
			
		||||
            ]
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -227,18 +223,6 @@
 | 
			
		||||
            "tsConfig": "projects/common-map/tsconfig.spec.json",
 | 
			
		||||
            "karmaConfig": "projects/common-map/karma.conf.js"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "lint": {
 | 
			
		||||
          "builder": "@angular-devkit/build-angular:tslint",
 | 
			
		||||
          "options": {
 | 
			
		||||
            "tsConfig": [
 | 
			
		||||
              "projects/common-map/tsconfig.lib.json",
 | 
			
		||||
              "projects/common-map/tsconfig.spec.json"
 | 
			
		||||
            ],
 | 
			
		||||
            "exclude": [
 | 
			
		||||
              "**/node_modules/**"
 | 
			
		||||
            ]
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
@@ -267,21 +251,11 @@
 | 
			
		||||
            "tsConfig": "projects/common-map3d/tsconfig.spec.json",
 | 
			
		||||
            "karmaConfig": "projects/common-map3d/karma.conf.js"
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        "lint": {
 | 
			
		||||
          "builder": "@angular-devkit/build-angular:tslint",
 | 
			
		||||
          "options": {
 | 
			
		||||
            "tsConfig": [
 | 
			
		||||
              "projects/common-map3d/tsconfig.lib.json",
 | 
			
		||||
              "projects/common-map3d/tsconfig.spec.json"
 | 
			
		||||
            ],
 | 
			
		||||
            "exclude": [
 | 
			
		||||
              "**/node_modules/**"
 | 
			
		||||
            ]
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "defaultProject": "farmmaps-lib-app"
 | 
			
		||||
  "cli": {
 | 
			
		||||
    "analytics": false
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +1,16 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
    node: {
 | 
			
		||||
  resolve: {
 | 
			
		||||
    fallback: {
 | 
			
		||||
      // Resolve node module use of fs
 | 
			
		||||
      fs: "empty",
 | 
			
		||||
      Buffer: false,
 | 
			
		||||
      http: "empty",
 | 
			
		||||
      https: "empty",
 | 
			
		||||
      zlib: "empty"
 | 
			
		||||
      http: require.resolve("stream-http"),
 | 
			
		||||
      https: require.resolve("https-browserify"),
 | 
			
		||||
      url: require.resolve("url/"),
 | 
			
		||||
      zlib: require.resolve('browserify-zlib'),
 | 
			
		||||
      assert: require.resolve("assert/"),
 | 
			
		||||
      util: require.resolve("util/"),
 | 
			
		||||
      buffer: require.resolve("buffer/")
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										31252
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										31252
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										93
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										93
									
								
								package.json
									
									
									
									
									
								
							@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "farmmaps-lib-app",
 | 
			
		||||
  "version": "1.1.1",
 | 
			
		||||
  "version": "3.0.1",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "ng": "ng",
 | 
			
		||||
    "start": "ng serve",
 | 
			
		||||
@@ -11,62 +11,73 @@
 | 
			
		||||
  },
 | 
			
		||||
  "private": true,
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@angular/animations": "~11.2.14",
 | 
			
		||||
    "@angular/common": "~11.2.14",
 | 
			
		||||
    "@angular/compiler": "~11.2.14",
 | 
			
		||||
    "@angular/core": "~11.2.14",
 | 
			
		||||
    "@angular/forms": "~11.2.14",
 | 
			
		||||
    "@angular/platform-browser": "~11.2.14",
 | 
			
		||||
    "@angular/platform-browser-dynamic": "~11.2.14",
 | 
			
		||||
    "@angular/router": "~11.2.14",
 | 
			
		||||
    "@farmmaps/common": "1.1.1-prerelease.2031",
 | 
			
		||||
    "@farmmaps/common-map": "1.1.1-prerelease.2031",
 | 
			
		||||
    "@farmmaps/common-map3d": "1.1.1-prerelease.2031",
 | 
			
		||||
    "@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",
 | 
			
		||||
    "@farmmaps/common": "file:dist/common",
 | 
			
		||||
    "@farmmaps/common-map": "file:dist/common-map",
 | 
			
		||||
    "@farmmaps/common-map3d": "file:dist/common-map3d",
 | 
			
		||||
    "@microsoft/signalr": "^3.1.16",
 | 
			
		||||
    "@ng-bootstrap/ng-bootstrap": "^9.0",
 | 
			
		||||
    "@ngrx/effects": "^11.0",
 | 
			
		||||
    "@ngrx/router-store": "^11.0",
 | 
			
		||||
    "@ngrx/store": "^11.0",
 | 
			
		||||
    "angular-oauth2-oidc": "^10.0.3",
 | 
			
		||||
    "bootstrap": "^4.6.0",
 | 
			
		||||
    "cesium": "^1.82.1",
 | 
			
		||||
    "@ng-bootstrap/ng-bootstrap": "^13.0.0",
 | 
			
		||||
    "@ngrx/effects": "^14",
 | 
			
		||||
    "@ngrx/router-store": "^14",
 | 
			
		||||
    "@ngrx/store": "^14",
 | 
			
		||||
    "@popperjs/core": "^2.11.6",
 | 
			
		||||
    "angular-oauth2-oidc": "^13",
 | 
			
		||||
    "assert": "^2.0.0",
 | 
			
		||||
    "bootstrap": "^5.2.0",
 | 
			
		||||
    "browserify-zlib": "^0.2.0",
 | 
			
		||||
    "buffer": "^6.0.3",
 | 
			
		||||
    "cesium": "^1.97.0",
 | 
			
		||||
    "core-js": "^2.6.12",
 | 
			
		||||
    "moment": "^2.29.1",
 | 
			
		||||
    "ngrx-store-localstorage": "^11.0.0",
 | 
			
		||||
    "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.17",
 | 
			
		||||
    "ngx-uploadx": "^3.5.1",
 | 
			
		||||
    "ol": "6.5.0",
 | 
			
		||||
    "ol-cesium": "^2.13.0",
 | 
			
		||||
    "ngx-openlayers": "1.0.0-next.19",
 | 
			
		||||
    "ngx-uploadx": "^5.2.0",
 | 
			
		||||
    "ol": "6.14.1",
 | 
			
		||||
    "olcs": "^2.13.1",
 | 
			
		||||
    "resumablejs": "^1.1.0",
 | 
			
		||||
    "rxjs": "^6.6.7",
 | 
			
		||||
    "stream": "^0.0.2",
 | 
			
		||||
    "stream-http": "^3.2.0",
 | 
			
		||||
    "tassign": "^1.0.0",
 | 
			
		||||
    "tslib": "^2.2.0",
 | 
			
		||||
    "zone.js": "~0.10.2"
 | 
			
		||||
    "tslib": "^2.4.0",
 | 
			
		||||
    "url": "^0.11.0",
 | 
			
		||||
    "util": "^0.12.4",
 | 
			
		||||
    "zone.js": "~0.11.4"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@angular-builders/custom-webpack": "^11.1.1",
 | 
			
		||||
    "@angular-devkit/build-angular": "^0.1102.14",
 | 
			
		||||
    "@angular/cli": "^11.2.14",
 | 
			
		||||
    "@angular/compiler-cli": "~11.2.14",
 | 
			
		||||
    "@angular/language-service": "~11.2.14",
 | 
			
		||||
    "@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",
 | 
			
		||||
    "@types/arcgis-rest-api": "^10.4.5",
 | 
			
		||||
    "@types/jasmine": "~2.8.8",
 | 
			
		||||
    "@types/jasminewd2": "^2.0.9",
 | 
			
		||||
    "@types/node": "^12.20.15",
 | 
			
		||||
    "codelyzer": "^5.1.2",
 | 
			
		||||
    "jasmine-core": "~3.5.0",
 | 
			
		||||
    "jasmine-spec-reporter": "~5.0.0",
 | 
			
		||||
    "karma": "~6.3.3",
 | 
			
		||||
    "codelyzer": "^0.0.28",
 | 
			
		||||
    "jasmine-core": "^4.3.0",
 | 
			
		||||
    "jasmine-spec-reporter": "^7.0.0",
 | 
			
		||||
    "karma": "^6.3.20",
 | 
			
		||||
    "karma-chrome-launcher": "~3.1.0",
 | 
			
		||||
    "karma-coverage-istanbul-reporter": "~3.0.2",
 | 
			
		||||
    "karma-jasmine": "~4.0.0",
 | 
			
		||||
    "karma-jasmine-html-reporter": "^1.6.0",
 | 
			
		||||
    "ng-packagr": "^11.2.4",
 | 
			
		||||
    "karma-coverage-istanbul-reporter": "^3.0.3",
 | 
			
		||||
    "karma-jasmine": "^5.1.0",
 | 
			
		||||
    "karma-jasmine-html-reporter": "^2.0.0",
 | 
			
		||||
    "ng-packagr": "^14.1.0",
 | 
			
		||||
    "protractor": "~7.0.0",
 | 
			
		||||
    "ts-node": "^8.8.1",
 | 
			
		||||
    "tslint": "~6.1.0",
 | 
			
		||||
    "typescript": "~4.1.0"
 | 
			
		||||
    "typescript": "~4.6.4"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
  "lib": {
 | 
			
		||||
    "entryFile": "src/public-api.ts"
 | 
			
		||||
  },
 | 
			
		||||
  "whitelistedNonPeerDependencies": [
 | 
			
		||||
  "allowedNonPeerDependencies": [
 | 
			
		||||
    "."
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "@farmmaps/common-map",
 | 
			
		||||
  "version": "1.0.0",
 | 
			
		||||
  "version": "2.0.0",
 | 
			
		||||
  "publishConfig": {
 | 
			
		||||
    "registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
 | 
			
		||||
  },
 | 
			
		||||
@@ -8,14 +8,14 @@
 | 
			
		||||
    "tslib": "^2.0.0"
 | 
			
		||||
  },
 | 
			
		||||
  "peerDependencies": {
 | 
			
		||||
    "@angular/core": "^10.2.4",
 | 
			
		||||
    "ngrx-store-localstorage": "^10.0",
 | 
			
		||||
    "@ngrx/effects": "^10.0",
 | 
			
		||||
    "@ngrx/router-store": "^10.0",
 | 
			
		||||
    "@ngrx/store": "^10.0",
 | 
			
		||||
    "tassign": "^1.0.0",
 | 
			
		||||
    "@farmmaps/common": "~1.0",
 | 
			
		||||
    "ngx-openlayers": "1.0.0-next.17",
 | 
			
		||||
    "ol": "6.4.3"
 | 
			
		||||
    "@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",
 | 
			
		||||
    "@farmmaps/common": ">=2.0.0",
 | 
			
		||||
    "ngx-openlayers": ">=1.0.0-next.19",
 | 
			
		||||
    "ol": ">=6.8.1"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,9 @@ import { IItemLayer } from '../models/item.layer';
 | 
			
		||||
import { ILayervalue } from '../models/layer.value';
 | 
			
		||||
import { IQueryState } from '@farmmaps/common';
 | 
			
		||||
import { IItem } from '@farmmaps/common';
 | 
			
		||||
import { Feature,Style } from 'ol';
 | 
			
		||||
import { Feature } from 'ol';
 | 
			
		||||
import { Style } from 'ol/style';
 | 
			
		||||
import { Geometry } from 'ol/geom';
 | 
			
		||||
import { IPeriodState } from '../models/period.state';
 | 
			
		||||
 | 
			
		||||
export const SETSTATE = '[Map] SetState';
 | 
			
		||||
@@ -52,6 +54,9 @@ export const SETLAYERVALUESLOCATION = '[Map] SetLayerValuesLocation'
 | 
			
		||||
export const TOGGLELAYERVALUESENABLED = '[Map] ToggleLayerValuesEnabled'
 | 
			
		||||
export const GETLAYERVALUE = '[Map] GetLayerValue'
 | 
			
		||||
export const GETLAYERVALUESUCCESS = '[Map] GetLayerValueSuccess'
 | 
			
		||||
export const TOGGLESHOWDATALAYERSLIDE = '[Map] ToggleShowDataLayerSlide'
 | 
			
		||||
export const SETVIEWSTATE = '[Map] SetViewState'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export class Clear implements Action {
 | 
			
		||||
  readonly type = CLEAR;
 | 
			
		||||
@@ -103,13 +108,13 @@ export class StartSearch implements Action {
 | 
			
		||||
export class StartSearchSuccess implements Action {
 | 
			
		||||
  readonly type = STARTSEARCHSUCCESS;
 | 
			
		||||
 | 
			
		||||
  constructor(public features: Array<Feature>, public query:IQueryState) { }
 | 
			
		||||
  constructor(public features: Array<Feature<Geometry>>, public query:IQueryState) { }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class SelectFeature implements Action {
 | 
			
		||||
  readonly type = SELECTFEATURE;
 | 
			
		||||
 | 
			
		||||
  constructor(public feature:Feature) { }
 | 
			
		||||
  constructor(public feature:Feature<Geometry>) { }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class SelectItem implements Action {
 | 
			
		||||
@@ -151,13 +156,13 @@ export class SelectTemporal implements Action {
 | 
			
		||||
export class AddFeatureSuccess implements Action {
 | 
			
		||||
  readonly type = ADDFEATURESUCCESS;
 | 
			
		||||
 | 
			
		||||
  constructor(public feature: Feature) { }
 | 
			
		||||
  constructor(public feature: Feature<Geometry>) { }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class UpdateFeatureSuccess implements Action {
 | 
			
		||||
  readonly type = UPDATEFEATURESUCCESS;
 | 
			
		||||
 | 
			
		||||
  constructor(public feature: Feature) { }
 | 
			
		||||
  constructor(public feature: Feature<Geometry>) { }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class ExpandSearch implements Action {
 | 
			
		||||
@@ -271,7 +276,7 @@ export class DoQuery implements Action {
 | 
			
		||||
export class SetStyle implements Action {
 | 
			
		||||
  readonly type = SETSTYLE;
 | 
			
		||||
 | 
			
		||||
  constructor(public itemType:string,public style: Style | (Feature)) { }
 | 
			
		||||
  constructor(public itemType:string,public style: Style | ((feature:Feature<Geometry>) => Style )) { }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class ShowLayerSwitcher implements Action {
 | 
			
		||||
@@ -287,7 +292,7 @@ export class SetReplaceUrl implements Action {
 | 
			
		||||
export class SetFeatures implements Action {
 | 
			
		||||
  readonly type = SETFEATURES;
 | 
			
		||||
 | 
			
		||||
  constructor(public features: Array<Feature>) { }
 | 
			
		||||
  constructor(public features: Array<Feature<Geometry>>) { }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class SetLayerValuesLocation implements Action {
 | 
			
		||||
@@ -314,6 +319,16 @@ export class GetLayerValueSuccess implements Action {
 | 
			
		||||
  constructor(public layervalue:ILayervalue) { }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class ToggleShowDataLayerSlide implements Action {
 | 
			
		||||
  readonly type = TOGGLESHOWDATALAYERSLIDE;
 | 
			
		||||
  constructor() {}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class SetViewState implements Action {
 | 
			
		||||
  readonly type = SETVIEWSTATE;
 | 
			
		||||
  constructor(public enabled:boolean) {}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export type Actions = SetMapState
 | 
			
		||||
  | Init
 | 
			
		||||
  | Clear
 | 
			
		||||
@@ -357,5 +372,7 @@ export type Actions = SetMapState
 | 
			
		||||
  | ToggleLayerValuesEnabled
 | 
			
		||||
  | GetLayerValueSuccess
 | 
			
		||||
  | GetLayerValue
 | 
			
		||||
  | SetPeriod;
 | 
			
		||||
  | SetPeriod
 | 
			
		||||
  | ToggleShowDataLayerSlide
 | 
			
		||||
  | SetViewState;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -19,6 +19,7 @@ import * as mapEffects from './effects/map.effects';
 | 
			
		||||
import { IMapState} from './models/map.state';
 | 
			
		||||
import { ISelectedFeatures } from './models/selected.features';
 | 
			
		||||
import { IItemLayer,ItemLayer,ITemporalItemLayer,TemporalItemLayer } from './models/item.layer';
 | 
			
		||||
import { IClickedFeature } from './models/clicked.feature';
 | 
			
		||||
import { IPeriodState } from './models/period.state';
 | 
			
		||||
 | 
			
		||||
// components
 | 
			
		||||
@@ -163,136 +164,124 @@ export {
 | 
			
		||||
  ITemporalItemLayer,
 | 
			
		||||
  TemporalItemLayer,
 | 
			
		||||
  ifZoomToShowDirective,
 | 
			
		||||
  ZoomToShowAlert
 | 
			
		||||
  ZoomToShowAlert,
 | 
			
		||||
  IClickedFeature,
 | 
			
		||||
  GeometryThumbnailComponent
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@NgModule({
 | 
			
		||||
  imports: [
 | 
			
		||||
    CommonModule,
 | 
			
		||||
    AngularOpenlayersModule,
 | 
			
		||||
    MapRoutingModule,
 | 
			
		||||
    StoreModule.forFeature(MODULE_NAME, mapReducers.reducer,{metaReducers:metaReducers}),
 | 
			
		||||
    EffectsModule.forFeature([mapEffects.MapEffects]),
 | 
			
		||||
    NgbModule,
 | 
			
		||||
    FormsModule,
 | 
			
		||||
    ReactiveFormsModule,
 | 
			
		||||
    AppCommonModule
 | 
			
		||||
  ],
 | 
			
		||||
  declarations: [
 | 
			
		||||
    ZoomToExtentComponent,
 | 
			
		||||
    ItemVectorSourceComponent,
 | 
			
		||||
    ItemLayersComponent,
 | 
			
		||||
    FileDropTargetComponent,
 | 
			
		||||
    MapComponent,
 | 
			
		||||
    MetaDataModalComponent,
 | 
			
		||||
    RotationResetComponent,
 | 
			
		||||
    MapSearchComponent,
 | 
			
		||||
    SelectPeriodModalComponent,
 | 
			
		||||
    LayerListComponent,
 | 
			
		||||
    LegendComponent,
 | 
			
		||||
    LayerVectorImageComponent,
 | 
			
		||||
    FeatureListComponent,
 | 
			
		||||
    WidgetHostDirective,
 | 
			
		||||
    FeatureListContainerComponent,
 | 
			
		||||
    FeatureListCroppingschemeComponent,
 | 
			
		||||
    FeatureListCropfieldComponent,
 | 
			
		||||
    FeatureListFeatureContainerComponent,
 | 
			
		||||
    FeatureListFeatureComponent,
 | 
			
		||||
    FeatureListFeatureCroppingschemeComponent,
 | 
			
		||||
    FeatureListFeatureCropfieldComponent,
 | 
			
		||||
    SelectedItemContainerComponent,
 | 
			
		||||
    SelectedItemComponent,
 | 
			
		||||
    SelectedItemCropfieldComponent,
 | 
			
		||||
    SelectedItemGeotiffComponent,
 | 
			
		||||
    SelectedItemTemporalComponent,
 | 
			
		||||
    SelectedItemShapeComponent,
 | 
			
		||||
    ItemListItemComponent,
 | 
			
		||||
    ItemListItemContainerComponent,
 | 
			
		||||
    ItemListComponent,
 | 
			
		||||
    ItemWidgetListComponent,
 | 
			
		||||
    WidgetStatusComponent,
 | 
			
		||||
    GpsLocation,
 | 
			
		||||
    PanToLocation,
 | 
			
		||||
    LayerSwitcher,
 | 
			
		||||
    HistogramDetailsComponent,
 | 
			
		||||
    StatisticsDetailsComponent,
 | 
			
		||||
    ifZoomToShowDirective,
 | 
			
		||||
    ZoomToShowAlert,
 | 
			
		||||
    LayerValuesComponent,
 | 
			
		||||
    GeometryThumbnailComponent
 | 
			
		||||
  ],
 | 
			
		||||
  entryComponents: [
 | 
			
		||||
    FeatureListComponent,
 | 
			
		||||
    FeatureListCroppingschemeComponent,
 | 
			
		||||
    FeatureListCropfieldComponent,
 | 
			
		||||
    FeatureListFeatureComponent,
 | 
			
		||||
    FeatureListFeatureCroppingschemeComponent,
 | 
			
		||||
    FeatureListFeatureCropfieldComponent,
 | 
			
		||||
    SelectedItemComponent,
 | 
			
		||||
    SelectedItemCropfieldComponent,
 | 
			
		||||
    SelectedItemGeotiffComponent,
 | 
			
		||||
    SelectedItemTemporalComponent,
 | 
			
		||||
    SelectedItemShapeComponent,
 | 
			
		||||
    ItemListComponent,
 | 
			
		||||
    ItemListItemComponent,
 | 
			
		||||
  ],
 | 
			
		||||
  exports: [
 | 
			
		||||
       ItemVectorSourceComponent,
 | 
			
		||||
       ItemLayersComponent,
 | 
			
		||||
       FileDropTargetComponent,
 | 
			
		||||
       MetaDataModalComponent,
 | 
			
		||||
       MapComponent,
 | 
			
		||||
       GpsLocation,
 | 
			
		||||
       PanToLocation,
 | 
			
		||||
       LayerSwitcher,
 | 
			
		||||
       FeatureListFeatureComponent,
 | 
			
		||||
       FeatureListFeatureCropfieldComponent,
 | 
			
		||||
       FeatureListFeatureCroppingschemeComponent,
 | 
			
		||||
       SelectedItemContainerComponent,
 | 
			
		||||
       SelectedItemComponent,
 | 
			
		||||
       SelectedItemCropfieldComponent,
 | 
			
		||||
       SelectedItemGeotiffComponent,
 | 
			
		||||
       SelectedItemTemporalComponent,
 | 
			
		||||
       SelectedItemShapeComponent,
 | 
			
		||||
       ItemListItemComponent,
 | 
			
		||||
       ItemListItemContainerComponent,
 | 
			
		||||
       ItemListComponent,
 | 
			
		||||
       ItemWidgetListComponent,
 | 
			
		||||
       WidgetStatusComponent,
 | 
			
		||||
       RotationResetComponent,
 | 
			
		||||
       MapSearchComponent,
 | 
			
		||||
       SelectPeriodModalComponent,
 | 
			
		||||
       LayerListComponent,
 | 
			
		||||
       LegendComponent,
 | 
			
		||||
       LayerVectorImageComponent,
 | 
			
		||||
       FeatureListComponent,
 | 
			
		||||
       WidgetHostDirective,
 | 
			
		||||
       FeatureListContainerComponent,
 | 
			
		||||
       FeatureListCroppingschemeComponent,
 | 
			
		||||
       FeatureListCropfieldComponent,
 | 
			
		||||
       FeatureListFeatureContainerComponent,
 | 
			
		||||
       ZoomToExtentComponent,
 | 
			
		||||
       ifZoomToShowDirective,
 | 
			
		||||
       ZoomToShowAlert
 | 
			
		||||
  ],
 | 
			
		||||
  providers: [
 | 
			
		||||
    FeatureIconService,
 | 
			
		||||
    GeolocationService,
 | 
			
		||||
    DeviceOrientationService,
 | 
			
		||||
    TemporalService,
 | 
			
		||||
    { provide: AbstractFeatureListComponent, useClass: FeatureListCroppingschemeComponent, multi: true },
 | 
			
		||||
    { provide: AbstractFeatureListComponent, useClass: FeatureListCropfieldComponent, multi: true },
 | 
			
		||||
    { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureComponent, multi: true },
 | 
			
		||||
    { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureCroppingschemeComponent, multi: true },
 | 
			
		||||
    { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureCropfieldComponent, multi: true },
 | 
			
		||||
    { provide: AbstractSelectedItemComponent, useClass: SelectedItemComponent, multi: true },
 | 
			
		||||
    { provide: AbstractSelectedItemComponent, useClass: SelectedItemCropfieldComponent, multi: true },
 | 
			
		||||
    { provide: AbstractSelectedItemComponent, useClass: SelectedItemGeotiffComponent, multi: true },
 | 
			
		||||
    { provide: AbstractSelectedItemComponent, useClass: SelectedItemTemporalComponent, multi: true },
 | 
			
		||||
    { provide: AbstractSelectedItemComponent, useClass: SelectedItemShapeComponent, multi: true },
 | 
			
		||||
    { provide: AbstractItemListItemComponent, useClass: ItemListItemComponent, multi: true },
 | 
			
		||||
    { provide: AbstractItemListComponent, useClass: ItemListComponent, multi: true }
 | 
			
		||||
  ]
 | 
			
		||||
@NgModule({
 | 
			
		||||
    imports: [
 | 
			
		||||
        CommonModule,
 | 
			
		||||
        AngularOpenlayersModule,
 | 
			
		||||
        MapRoutingModule,
 | 
			
		||||
        StoreModule.forFeature(MODULE_NAME, mapReducers.reducer, { metaReducers: metaReducers }),
 | 
			
		||||
        EffectsModule.forFeature([mapEffects.MapEffects]),
 | 
			
		||||
        NgbModule,
 | 
			
		||||
        FormsModule,
 | 
			
		||||
        ReactiveFormsModule,
 | 
			
		||||
        AppCommonModule
 | 
			
		||||
    ],
 | 
			
		||||
    declarations: [
 | 
			
		||||
        ZoomToExtentComponent,
 | 
			
		||||
        ItemVectorSourceComponent,
 | 
			
		||||
        ItemLayersComponent,
 | 
			
		||||
        FileDropTargetComponent,
 | 
			
		||||
        MapComponent,
 | 
			
		||||
        MetaDataModalComponent,
 | 
			
		||||
        RotationResetComponent,
 | 
			
		||||
        MapSearchComponent,
 | 
			
		||||
        SelectPeriodModalComponent,
 | 
			
		||||
        LayerListComponent,
 | 
			
		||||
        LegendComponent,
 | 
			
		||||
        LayerVectorImageComponent,
 | 
			
		||||
        FeatureListComponent,
 | 
			
		||||
        WidgetHostDirective,
 | 
			
		||||
        FeatureListContainerComponent,
 | 
			
		||||
        FeatureListCroppingschemeComponent,
 | 
			
		||||
        FeatureListCropfieldComponent,
 | 
			
		||||
        FeatureListFeatureContainerComponent,
 | 
			
		||||
        FeatureListFeatureComponent,
 | 
			
		||||
        FeatureListFeatureCroppingschemeComponent,
 | 
			
		||||
        FeatureListFeatureCropfieldComponent,
 | 
			
		||||
        SelectedItemContainerComponent,
 | 
			
		||||
        SelectedItemComponent,
 | 
			
		||||
        SelectedItemCropfieldComponent,
 | 
			
		||||
        SelectedItemGeotiffComponent,
 | 
			
		||||
        SelectedItemTemporalComponent,
 | 
			
		||||
        SelectedItemShapeComponent,
 | 
			
		||||
        ItemListItemComponent,
 | 
			
		||||
        ItemListItemContainerComponent,
 | 
			
		||||
        ItemListComponent,
 | 
			
		||||
        ItemWidgetListComponent,
 | 
			
		||||
        WidgetStatusComponent,
 | 
			
		||||
        GpsLocation,
 | 
			
		||||
        PanToLocation,
 | 
			
		||||
        LayerSwitcher,
 | 
			
		||||
        HistogramDetailsComponent,
 | 
			
		||||
        StatisticsDetailsComponent,
 | 
			
		||||
        ifZoomToShowDirective,
 | 
			
		||||
        ZoomToShowAlert,
 | 
			
		||||
        LayerValuesComponent,
 | 
			
		||||
        GeometryThumbnailComponent
 | 
			
		||||
    ],
 | 
			
		||||
    exports: [
 | 
			
		||||
        ItemVectorSourceComponent,
 | 
			
		||||
        ItemLayersComponent,
 | 
			
		||||
        FileDropTargetComponent,
 | 
			
		||||
        MetaDataModalComponent,
 | 
			
		||||
        MapComponent,
 | 
			
		||||
        GpsLocation,
 | 
			
		||||
        PanToLocation,
 | 
			
		||||
        LayerSwitcher,
 | 
			
		||||
        FeatureListFeatureComponent,
 | 
			
		||||
        FeatureListFeatureCropfieldComponent,
 | 
			
		||||
        FeatureListFeatureCroppingschemeComponent,
 | 
			
		||||
        SelectedItemContainerComponent,
 | 
			
		||||
        SelectedItemComponent,
 | 
			
		||||
        SelectedItemCropfieldComponent,
 | 
			
		||||
        SelectedItemGeotiffComponent,
 | 
			
		||||
        SelectedItemTemporalComponent,
 | 
			
		||||
        SelectedItemShapeComponent,
 | 
			
		||||
        ItemListItemComponent,
 | 
			
		||||
        ItemListItemContainerComponent,
 | 
			
		||||
        ItemListComponent,
 | 
			
		||||
        ItemWidgetListComponent,
 | 
			
		||||
        WidgetStatusComponent,
 | 
			
		||||
        RotationResetComponent,
 | 
			
		||||
        MapSearchComponent,
 | 
			
		||||
        SelectPeriodModalComponent,
 | 
			
		||||
        LayerListComponent,
 | 
			
		||||
        LegendComponent,
 | 
			
		||||
        LayerVectorImageComponent,
 | 
			
		||||
        FeatureListComponent,
 | 
			
		||||
        WidgetHostDirective,
 | 
			
		||||
        FeatureListContainerComponent,
 | 
			
		||||
        FeatureListCroppingschemeComponent,
 | 
			
		||||
        FeatureListCropfieldComponent,
 | 
			
		||||
        FeatureListFeatureContainerComponent,
 | 
			
		||||
        ZoomToExtentComponent,
 | 
			
		||||
        ifZoomToShowDirective,
 | 
			
		||||
        ZoomToShowAlert,
 | 
			
		||||
        GeometryThumbnailComponent
 | 
			
		||||
    ],
 | 
			
		||||
    providers: [
 | 
			
		||||
        FeatureIconService,
 | 
			
		||||
        GeolocationService,
 | 
			
		||||
        DeviceOrientationService,
 | 
			
		||||
        TemporalService,
 | 
			
		||||
        { provide: AbstractFeatureListComponent, useClass: FeatureListCroppingschemeComponent, multi: true },
 | 
			
		||||
        { provide: AbstractFeatureListComponent, useClass: FeatureListCropfieldComponent, multi: true },
 | 
			
		||||
        { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureComponent, multi: true },
 | 
			
		||||
        { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureCroppingschemeComponent, multi: true },
 | 
			
		||||
        { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureCropfieldComponent, multi: true },
 | 
			
		||||
        { provide: AbstractSelectedItemComponent, useClass: SelectedItemComponent, multi: true },
 | 
			
		||||
        { provide: AbstractSelectedItemComponent, useClass: SelectedItemCropfieldComponent, multi: true },
 | 
			
		||||
        { provide: AbstractSelectedItemComponent, useClass: SelectedItemGeotiffComponent, multi: true },
 | 
			
		||||
        { provide: AbstractSelectedItemComponent, useClass: SelectedItemTemporalComponent, multi: true },
 | 
			
		||||
        { provide: AbstractSelectedItemComponent, useClass: SelectedItemShapeComponent, multi: true },
 | 
			
		||||
        { provide: AbstractItemListItemComponent, useClass: ItemListItemComponent, multi: true },
 | 
			
		||||
        { provide: AbstractItemListComponent, useClass: ItemListComponent, multi: true }
 | 
			
		||||
    ]
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ import { MapComponent } from 'ngx-openlayers';
 | 
			
		||||
import * as proj  from 'ol/proj';
 | 
			
		||||
import {Point,Geometry} from 'ol/geom';
 | 
			
		||||
import { GeoJSON } from 'ol/format';
 | 
			
		||||
import { Feature } from 'ol';
 | 
			
		||||
import { Feature} from 'ol';
 | 
			
		||||
 | 
			
		||||
export interface IDroppedFile {
 | 
			
		||||
  files: any,
 | 
			
		||||
@@ -21,7 +21,7 @@ export class FileDropTargetComponent implements OnInit, OnDestroy {
 | 
			
		||||
  element: Element;
 | 
			
		||||
  @Output() onFileDropped = new EventEmitter<IDroppedFile>();
 | 
			
		||||
  @Input() parentCode: string;
 | 
			
		||||
  @Input() features: Array<Feature>;
 | 
			
		||||
  @Input() features: Array<Feature<Geometry>>;
 | 
			
		||||
 | 
			
		||||
  constructor(private map: MapComponent) {
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { Component, OnInit, Input, ViewChild, ElementRef, OnChanges, SimpleChanges ,Host} from '@angular/core';
 | 
			
		||||
import { MapComponent } from 'ngx-openlayers';
 | 
			
		||||
import Overlay from 'ol/Overlay';
 | 
			
		||||
import  Overlay  from 'ol/Overlay';
 | 
			
		||||
import { fromLonLat, toLonLat } from 'ol/proj';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -52,7 +52,7 @@ export class GpsLocation  implements OnInit,OnChanges{
 | 
			
		||||
    this.rotate = "rotate(" + Math.round(this.heading) + " 500 500)";
 | 
			
		||||
    this.locTolerancePixels = this.locationTolerance;
 | 
			
		||||
    this.map.instance.addOverlay(this.instance);
 | 
			
		||||
    this.map.instance.getView().on('change:resolution', (evt) => {
 | 
			
		||||
    this.map.instance.getView().on('change:resolution', (evt:any) => {
 | 
			
		||||
      this.resolution = evt.target.get('resolution');
 | 
			
		||||
      this.recalcLocationTolerance();
 | 
			
		||||
    });
 | 
			
		||||
 
 | 
			
		||||
@@ -10,12 +10,15 @@ import * as proj from 'ol/proj';
 | 
			
		||||
import * as loadingstrategy from 'ol/loadingstrategy';
 | 
			
		||||
import * as style from 'ol/style';
 | 
			
		||||
import {Tile,Layer,Image} from 'ol/layer';
 | 
			
		||||
import {XYZ,ImageStatic,OSM,BingMaps,TileWMS,TileArcGISRest,TileJSON} from 'ol/source';
 | 
			
		||||
import {XYZ,ImageStatic,OSM,BingMaps,TileWMS,TileArcGISRest,TileJSON,Source} from 'ol/source';
 | 
			
		||||
import {Vector as VectorSource} from 'ol/source';
 | 
			
		||||
import { Vector as VectorLayer } from 'ol/layer';
 | 
			
		||||
import { VectorImage as VectorImageLayer } from 'ol/layer';
 | 
			
		||||
import VectorTileSource from 'ol/source/VectorTile';
 | 
			
		||||
import VectorTileLayer from 'ol/layer/VectorTile';
 | 
			
		||||
import {GeoJSON,MVT} from 'ol/format';
 | 
			
		||||
import { Geometry } from 'ol/geom';
 | 
			
		||||
import BaseLayer from 'ol/layer/Base';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'fm-map-item-layers',
 | 
			
		||||
@@ -30,11 +33,13 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
 | 
			
		||||
  @Input() itemLayer: IItemLayer;
 | 
			
		||||
  @Output() onFeatureSelected: EventEmitter<any> = new EventEmitter<any>();
 | 
			
		||||
  @Output() onFeatureHover: EventEmitter<any> = new EventEmitter<any>();
 | 
			
		||||
  @Output() onPrerender: EventEmitter<any> = new EventEmitter<any>();
 | 
			
		||||
  private _apiEndPoint: string;
 | 
			
		||||
  private initialized:boolean = false;
 | 
			
		||||
  private mapEventHandlerInstalled = false;
 | 
			
		||||
  private topLayerPrerenderEventhandlerInstalled = false;
 | 
			
		||||
  private selectedFeatures = {};
 | 
			
		||||
  private selectionLayer:Layer = null;
 | 
			
		||||
  private selectionLayer:Layer<Source> = null;
 | 
			
		||||
  
 | 
			
		||||
  constructor(private itemService: ItemService, private map: MapComponent, public appConfig: AppConfig) {
 | 
			
		||||
    super(map);
 | 
			
		||||
@@ -119,9 +124,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
 | 
			
		||||
    return this.styleCache[key];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createGeotiffLayer(item:IItem,itemLayer:IItemLayer):Layer {
 | 
			
		||||
  createGeotiffLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
 | 
			
		||||
    var layerIndex = -1;
 | 
			
		||||
    var layer: Layer = null;  
 | 
			
		||||
    var 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)}` });
 | 
			
		||||
    layer = new Tile({ source: source });
 | 
			
		||||
@@ -142,9 +147,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
 | 
			
		||||
    return layer;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createShapeLayer(item:IItem,itemLayer:IItemLayer):Layer {
 | 
			
		||||
  createShapeLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
 | 
			
		||||
    var layerIndex = -1;
 | 
			
		||||
    var layer: Layer = null; 
 | 
			
		||||
    var 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;
 | 
			
		||||
@@ -177,7 +182,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
 | 
			
		||||
      let source = new VectorSource({
 | 
			
		||||
        strategy: loadingstrategy.bbox,
 | 
			
		||||
        loader: function (extent: Extent, resolution: number, projection: Projection) {
 | 
			
		||||
          var source = this as VectorSource;
 | 
			
		||||
          var 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) {
 | 
			
		||||
@@ -189,7 +194,8 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
 | 
			
		||||
          });
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
      layer = new VectorLayer({
 | 
			
		||||
      layer = new VectorImageLayer({
 | 
			
		||||
        declutter: true,
 | 
			
		||||
        source: source,
 | 
			
		||||
        style: (feature) => {
 | 
			
		||||
          var key =feature.get("code") + "_" + feature.get("color");
 | 
			
		||||
@@ -230,16 +236,16 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
 | 
			
		||||
    return layer;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createSelectionLayer(itemLayer:IItemLayer):Layer {
 | 
			
		||||
  createSelectionLayer(itemLayer:IItemLayer):Layer<Source> {
 | 
			
		||||
    var layerIndex = -1;
 | 
			
		||||
    var layer: Layer = null; 
 | 
			
		||||
    var 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;
 | 
			
		||||
    if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") {
 | 
			
		||||
      return new VectorTileLayer({
 | 
			
		||||
        renderMode: 'vector',
 | 
			
		||||
        source: itemLayer.layer.getSource(),
 | 
			
		||||
        source: (itemLayer.layer as VectorTileLayer).getSource(),
 | 
			
		||||
        style: (feature) => {
 | 
			
		||||
          if (feature.getId() in this.selectedFeatures) {
 | 
			
		||||
 | 
			
		||||
@@ -260,9 +266,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer {
 | 
			
		||||
  createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
 | 
			
		||||
    let data = item.data as ILayerData;
 | 
			
		||||
    var layer: Layer = null; 
 | 
			
		||||
    var layer: Layer<Source> = null; 
 | 
			
		||||
    switch (data.interfaceType) {
 | 
			
		||||
      case 'OSM': {
 | 
			
		||||
        let source = new OSM();
 | 
			
		||||
@@ -312,8 +318,8 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
 | 
			
		||||
    return layer;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  createLayer(itemLayer: IItemLayer): Layer {
 | 
			
		||||
    var layer: Layer = null;   
 | 
			
		||||
  createLayer(itemLayer: IItemLayer): Layer<Source> {
 | 
			
		||||
    var layer: Layer<Source> = null;   
 | 
			
		||||
    var layerIndex = -1;
 | 
			
		||||
    if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') {
 | 
			
		||||
      layer = this.createGeotiffLayer(itemLayer.item,itemLayer);
 | 
			
		||||
@@ -360,7 +366,31 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer {
 | 
			
		||||
  installTopLayerPrerenderEventhandler(olLayer : Layer<Source>) {
 | 
			
		||||
    if(!this.topLayerPrerenderEventhandlerInstalled  && this.onPrerender.observers.length > 0  && olLayer) {
 | 
			
		||||
      if(this.instance.getVisible()) {
 | 
			
		||||
        olLayer.on('prerender',this.topLayerPrerenderEventhandler);
 | 
			
		||||
        olLayer.on('postrender',this.topLayerPostrenderEventhandler);
 | 
			
		||||
        this.topLayerPrerenderEventhandlerInstalled = true;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  unInstallTopLayerPrerenderEventhandler() {
 | 
			
		||||
    if(this.topLayerPrerenderEventhandlerInstalled && this.onPrerender.observers.length > 0 )
 | 
			
		||||
    {
 | 
			
		||||
      if(this.instance.getVisible()) {
 | 
			
		||||
        var olLayers = this.instance.getLayers().getArray().forEach((l:any) => {
 | 
			
		||||
          l.un('prerender',this.topLayerPrerenderEventhandler);
 | 
			
		||||
          l.un('postrender',this.topLayerPostrenderEventhandler);
 | 
			
		||||
        });
 | 
			
		||||
        this.topLayerPrerenderEventhandlerInstalled = false;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer<Source> {
 | 
			
		||||
    if(!itemLayer) return null;
 | 
			
		||||
    var olLayers = this.instance.getLayers();
 | 
			
		||||
    var layer = itemLayer.layer;
 | 
			
		||||
@@ -384,10 +414,19 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
 | 
			
		||||
    return layer;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  updateLayers(itemLayers: IItemLayer[]) {
 | 
			
		||||
    let newLayers: IItemLayer[] = [];
 | 
			
		||||
    if (itemLayers) {
 | 
			
		||||
      itemLayers.forEach((itemLayer, index) => {
 | 
			
		||||
  updateLayers(itemLayers: IItemLayer[] | IItemLayer) {
 | 
			
		||||
    this.unInstallTopLayerPrerenderEventhandler();
 | 
			
		||||
    let dataLayer = false;
 | 
			
		||||
    var ils:IItemLayer[] = [];
 | 
			
		||||
    if(Array.isArray(itemLayers)) {
 | 
			
		||||
       ils = itemLayers;
 | 
			
		||||
    } else {
 | 
			
		||||
      dataLayer=true;
 | 
			
		||||
       ils=[itemLayers];
 | 
			
		||||
    }
 | 
			
		||||
    let 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);          
 | 
			
		||||
@@ -396,9 +435,11 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
 | 
			
		||||
          if(selectedLayer) newLayers.push(selectedLayer);
 | 
			
		||||
          let nextLayer = this.addOrUpdateOlLayer(il.nextItemLayer,newLayers.length);
 | 
			
		||||
          if(nextLayer) newLayers.push(nextLayer);
 | 
			
		||||
          this.installTopLayerPrerenderEventhandler(selectedLayer);
 | 
			
		||||
        } else {
 | 
			
		||||
          let layer = this.addOrUpdateOlLayer(itemLayer,newLayers.length);
 | 
			
		||||
          if(layer) newLayers.push(layer);           
 | 
			
		||||
          if(layer) newLayers.push(layer);    
 | 
			
		||||
          this.installTopLayerPrerenderEventhandler(layer);       
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
      // Remove the layers that have disapeared from childrenLayers
 | 
			
		||||
@@ -407,17 +448,27 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
 | 
			
		||||
        olLayers.removeAt(newLayers.length);
 | 
			
		||||
      }
 | 
			
		||||
      this.selectionLayer=null;
 | 
			
		||||
      if(this.mapEventHandlerInstalled && itemLayers.length==1 && this.getItemlayer(itemLayers[0]).item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {
 | 
			
		||||
      if(this.mapEventHandlerInstalled && ils.length==1 && this.getItemlayer(itemLayers[0]).item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {
 | 
			
		||||
        this.selectionLayer = this.createSelectionLayer(this.getItemlayer(itemLayers[0]));
 | 
			
		||||
        if(this.selectionLayer) olLayers.push(this.selectionLayer)
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  topLayerPrerenderEventhandler = (event) => {
 | 
			
		||||
     this.onPrerender.emit(event);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  topLayerPostrenderEventhandler = (event) => {
 | 
			
		||||
    const ctx = event.context;
 | 
			
		||||
    ctx.restore();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  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;
 | 
			
		||||
    if(event.type === 'pointermove' && !this.onFeatureHover.observers.length) return;    
 | 
			
		||||
    let itemLayer= this.getItemlayer(this.itemLayer);
 | 
			
		||||
    if(itemLayer && itemLayer.layer) {
 | 
			
		||||
       this.selectedFeatures = {};
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +1,17 @@
 | 
			
		||||
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 } from '@angular/core';
 | 
			
		||||
import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-openlayers';
 | 
			
		||||
import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common';
 | 
			
		||||
 | 
			
		||||
import { Feature } from 'ol';
 | 
			
		||||
import { Point } from 'ol/geom';
 | 
			
		||||
import { Point,Geometry } from 'ol/geom';
 | 
			
		||||
import { MapBrowserEvent } from 'ol';
 | 
			
		||||
import { Types } from 'ol/MapBrowserEventType';
 | 
			
		||||
import * as style from 'ol/style';
 | 
			
		||||
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} from 'ol/source';
 | 
			
		||||
import {Vector,Cluster,Source} from 'ol/source';
 | 
			
		||||
import {Layer} from 'ol/layer';
 | 
			
		||||
import {GeoJSON} from 'ol/format';
 | 
			
		||||
import {Select} from 'ol/interaction';
 | 
			
		||||
@@ -25,17 +26,17 @@ import {FeatureIconService} from '../../../services/feature-icon.service';
 | 
			
		||||
  ]
 | 
			
		||||
})
 | 
			
		||||
export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnChanges {
 | 
			
		||||
  instance: Vector;
 | 
			
		||||
  instance: Vector<Geometry>;
 | 
			
		||||
  private _format: GeoJSON;
 | 
			
		||||
  private _select: Select;
 | 
			
		||||
  private _hoverSelect: Select;
 | 
			
		||||
  private _iconScale: number = 0.05;
 | 
			
		||||
  @Input() features: Array<Feature>;
 | 
			
		||||
  @Input() selectedFeature: Feature;
 | 
			
		||||
  @Input() features: Array<Feature<Geometry>>;
 | 
			
		||||
  @Input() selectedFeature: Feature<Geometry>;
 | 
			
		||||
  @Input() selectedItem: IItem;
 | 
			
		||||
  @Input() styles:IStyles;
 | 
			
		||||
  @Output() onFeatureSelected: EventEmitter<Feature> = new EventEmitter<Feature>();
 | 
			
		||||
  @Output() onFeatureHover: EventEmitter<Feature> = new EventEmitter<Feature>();
 | 
			
		||||
  @Output() onFeatureSelected: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>();
 | 
			
		||||
  @Output() onFeatureHover: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>();
 | 
			
		||||
  private stylesCache:IStyles = {};
 | 
			
		||||
 | 
			
		||||
  constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, private map: MapComponent, private itemTypeService: ItemTypeService,private featureIconService$:FeatureIconService) {
 | 
			
		||||
@@ -43,7 +44,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
 | 
			
		||||
    this._format = new GeoJSON();
 | 
			
		||||
  }  
 | 
			
		||||
 | 
			
		||||
  geometry(feature: Feature) {
 | 
			
		||||
  geometry(feature: Feature<Geometry>) {
 | 
			
		||||
    let view = this.map.instance.getView();
 | 
			
		||||
    let resolution = view.getResolution();
 | 
			
		||||
    var geometry = feature.getGeometry();
 | 
			
		||||
@@ -55,9 +56,9 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
 | 
			
		||||
    return geometry;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
  getSelectedStyle(feature:Feature):style.Style {
 | 
			
		||||
  getSelectedStyle(feature:Feature<Geometry>):style.Style {
 | 
			
		||||
    let key = feature.get('itemType')+"_selected";
 | 
			
		||||
    let evaluatedStyle =null;
 | 
			
		||||
    let evaluatedStyle: style.Style =undefined;
 | 
			
		||||
    var styleEntry = this.stylesCache[key];    
 | 
			
		||||
    if(styleEntry) {
 | 
			
		||||
      if(typeof styleEntry === 'function')  {
 | 
			
		||||
@@ -66,12 +67,12 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
 | 
			
		||||
        evaluatedStyle = styleEntry;
 | 
			
		||||
      }
 | 
			
		||||
    } else {
 | 
			
		||||
      evaluatedStyle = this.stylesCache["selected"];
 | 
			
		||||
      evaluatedStyle = this.stylesCache["selected"] as style.Style;
 | 
			
		||||
    }    
 | 
			
		||||
    if(evaluatedStyle ) {
 | 
			
		||||
      evaluatedStyle.setGeometry((feature) => this.geometry(feature));
 | 
			
		||||
      evaluatedStyle .setGeometry((feature:Feature<Geometry>) => this.geometry(feature));
 | 
			
		||||
    } 
 | 
			
		||||
    return evaluatedStyle
 | 
			
		||||
    return evaluatedStyle as style.Style
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnInit() {
 | 
			
		||||
@@ -80,17 +81,17 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
 | 
			
		||||
    this._select = new Select({
 | 
			
		||||
      style:null,
 | 
			
		||||
      hitTolerance: 10,
 | 
			
		||||
      layers: [this.layer.instance as Layer]
 | 
			
		||||
      layers: [this.layer.instance as Layer<Source>]
 | 
			
		||||
    });
 | 
			
		||||
    this._hoverSelect = new Select({
 | 
			
		||||
      style: (feature) => {        
 | 
			
		||||
      style: (feature:Feature<Geometry>) => {        
 | 
			
		||||
        return this.getSelectedStyle(feature);
 | 
			
		||||
      },
 | 
			
		||||
      hitTolerance: 10,
 | 
			
		||||
      condition: (e: MapBrowserEvent) => {
 | 
			
		||||
      condition: (e: MapBrowserEvent<UIEvent>) => {
 | 
			
		||||
        return e.type == 'pointermove';
 | 
			
		||||
      },
 | 
			
		||||
      layers: [this.layer.instance as Layer]
 | 
			
		||||
      layers: [this.layer.instance as Layer<Source>]
 | 
			
		||||
    });
 | 
			
		||||
    this.map.instance.addInteraction(this._select);
 | 
			
		||||
    this.map.instance.addInteraction(this._hoverSelect);      
 | 
			
		||||
@@ -132,7 +133,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
 | 
			
		||||
              fill: new style.Fill({
 | 
			
		||||
                color: fillColor
 | 
			
		||||
              }),
 | 
			
		||||
              geometry:(feature) => this.geometry(feature)
 | 
			
		||||
              geometry:(feature:Feature<Geometry>) => this.geometry(feature)
 | 
			
		||||
            });                   
 | 
			
		||||
        } else {
 | 
			
		||||
          key = 'file';
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@
 | 
			
		||||
            </span>
 | 
			
		||||
            <a href="#" title="Zoom to extent" class="btn btn-light btn-sm" (click)="handleZoomToExtent($event,itemLayer)"><i class="far fa-search-plus" aria-hidden="true"></i></a>
 | 
			
		||||
            <span *ngIf="firstLayer(itemLayer)"><a href="#" title="Toggle legend" class="btn btn-light btn-sm" (click)="itemLayer.legendVisible=toggleLegend($event,itemLayer.legendVisible)"><i class="far fa-chart-bar" aria-hidden="true"></i></a></span>
 | 
			
		||||
            <span class="float-right"><a href="#" title="Remove overlay" class="btn btn-light btn-sm" (click)="handleDelete($event,itemLayer)"><i class="fas fa-layer-minus" aria-hidden="true"></i></a></span>
 | 
			
		||||
            <span *ngIf="!dataLayers" class="float-end"><a href="#" title="Remove overlay" class="btn btn-light btn-sm" (click)="handleDelete($event,itemLayer)"><i class="fas fa-layer-minus" aria-hidden="true"></i></a></span>
 | 
			
		||||
          </div>
 | 
			
		||||
          <div *ngIf="itemLayer.legendVisible">
 | 
			
		||||
            <div class="card legend">
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,7 @@ import { IItemLayer } from '../../../models/item.layer';
 | 
			
		||||
export class LayerListComponent  {
 | 
			
		||||
  @Input() itemLayers: IItemLayer[] = [];
 | 
			
		||||
  @Input() baseLayers: boolean = false;
 | 
			
		||||
  @Input() dataLayers: boolean = false;
 | 
			
		||||
  @Output() onToggleVisibility = new EventEmitter<IItemLayer>();
 | 
			
		||||
  @Output() onSetOpacity = new EventEmitter<{layer: IItemLayer,opacity:number }>();
 | 
			
		||||
  @Output() onDelete = new EventEmitter<IItemLayer>();
 | 
			
		||||
 
 | 
			
		||||
@@ -2,12 +2,12 @@
 | 
			
		||||
   <div class="cross"  *ngIf="enabled$ | async">
 | 
			
		||||
       <div class="pointer"></div>
 | 
			
		||||
       <div class="values-container border border-dark rounded p-2" *ngIf="(layerValues$ | async ) as layers">
 | 
			
		||||
           <div class="lonlat pb-2 "><span class="font-weight-bold">{{lonlat$}}</span><i class="ml-2 fal fa-copy" (click)="copyToClipboard()"></i> </div>
 | 
			
		||||
           <div class="lonlat pb-2 "><span class="font-weight-bold">{{lonlat$}}</span><i class="ms-2 fal fa-copy" (click)="copyToClipboard()"></i> </div>
 | 
			
		||||
           <ul class="value-list p-0 mb-0" *ngIf="layers.length>0 ;else no_data">
 | 
			
		||||
               <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="mr-1">{{layerValue.quantity}}</span> </span><span class="mr-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">{{layerValue.value}}</span><span>{{layerValue.unit}}</span></div>
 | 
			
		||||
               </li>
 | 
			
		||||
           </ul>
 | 
			
		||||
           <ng-template #no_data>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,9 +1,8 @@
 | 
			
		||||
import { Component, OnDestroy, OnInit, Input, Optional, OnChanges, SimpleChanges } from '@angular/core';
 | 
			
		||||
import { Vector } from 'ol/layer';
 | 
			
		||||
import { Style } from 'ol/style';
 | 
			
		||||
import { StyleFunction } from 'ol/style/Style';
 | 
			
		||||
import { LayerVectorComponent, LayerGroupComponent, MapComponent } from 'ngx-openlayers';
 | 
			
		||||
import { RenderType  } from 'ol/layer/Vector';
 | 
			
		||||
import { Component, OnDestroy, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core';
 | 
			
		||||
import { LayerVectorComponent, MapComponent } from 'ngx-openlayers';
 | 
			
		||||
import  RenderType  from 'ol/layer/Vector';
 | 
			
		||||
import { Vector as VectorSource } from 'ol/source';
 | 
			
		||||
import { Geometry } from 'ol/geom';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'fm-map-aol-layer-vector-image',
 | 
			
		||||
@@ -12,10 +11,10 @@ import { RenderType  } from 'ol/layer/Vector';
 | 
			
		||||
  `,
 | 
			
		||||
})
 | 
			
		||||
export class LayerVectorImageComponent extends LayerVectorComponent implements OnInit, OnDestroy, OnChanges {
 | 
			
		||||
  public source: Vector;
 | 
			
		||||
  //public source: Vector;
 | 
			
		||||
 | 
			
		||||
  @Input()
 | 
			
		||||
  renderMode: RenderType | string = "image";  
 | 
			
		||||
  renderMode: RenderType<VectorSource<Geometry>> | string = "image";  
 | 
			
		||||
 | 
			
		||||
  constructor(map: MapComponent) {
 | 
			
		||||
    super(map);
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ div.gps-location:hover .pan-to {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
div.gps-location:hover .pan-to-centered {
 | 
			
		||||
  fill: theme-color-level($color-name: "primary", $level: -10) 
 | 
			
		||||
  fill: theme-color-level(primary, -10) 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.pan-to.pan-to-disabled {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject} from '@angular/core';
 | 
			
		||||
import { Feature } from 'ol';
 | 
			
		||||
import { Geometry} from 'ol/geom';
 | 
			
		||||
import { FeatureListComponent,AbstractFeatureListComponent } from '../feature-list/feature-list.component';
 | 
			
		||||
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
 | 
			
		||||
import  {IQueryState,PackageService } from '@farmmaps/common';
 | 
			
		||||
@@ -20,10 +21,10 @@ export class FeatureListContainerComponent {
 | 
			
		||||
    this.featureLists = [...this.featureLists].reverse();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Input() features: Array<Feature>
 | 
			
		||||
  @Input() features: Array<Feature<Geometry>>
 | 
			
		||||
  @Input() queryState: IQueryState;
 | 
			
		||||
  @Input() selectedFeature: Feature;
 | 
			
		||||
  @Input() clickedFeature:Observable<Feature>;
 | 
			
		||||
  @Input() selectedFeature: Feature<Geometry>;
 | 
			
		||||
  @Input() clickedFeature:Observable<Feature<Geometry>>;
 | 
			
		||||
 | 
			
		||||
  @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective; 
 | 
			
		||||
  componentRef:any;
 | 
			
		||||
@@ -38,7 +39,7 @@ export class FeatureListContainerComponent {
 | 
			
		||||
      let criteria=0;
 | 
			
		||||
      if (this.featureLists[i]['forItemType']) {
 | 
			
		||||
        criteria++;
 | 
			
		||||
        if( this.featureLists[i]['forItemType'].indexOf(queryState.itemType) >= 0) {
 | 
			
		||||
        if( this.featureLists[i]['forItemType'].split(",").filter(part => part == queryState.itemType).length == 1) {
 | 
			
		||||
          matches++;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
    <h3>{{schemeItem.name}}</h3>
 | 
			
		||||
    <div *ngIf="features;let features">
 | 
			
		||||
        <div class="cropfields">
 | 
			
		||||
          <div class="row m-0 pl-3 pr-3" *ngFor="let feature of features" [ngClass]="{'selected':isFeatureSelected(feature)}" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
 | 
			
		||||
          <div class="row m-0 ps-3 pe-3" *ngFor="let feature of features" [ngClass]="{'selected':isFeatureSelected(feature)}" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
 | 
			
		||||
          <fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,10 @@
 | 
			
		||||
<div class="card border-0">
 | 
			
		||||
  <div class="card-body">
 | 
			
		||||
      <fm-back-button></fm-back-button>
 | 
			
		||||
      <h3><i class="fm fm-farm"></i> <span i18n>Farms</span></h3>
 | 
			
		||||
      <h3><i class="far fa-farm"></i> <span i18n>Farms</span></h3>
 | 
			
		||||
      <div *ngIf="features;let features">
 | 
			
		||||
      <div class="farms">
 | 
			
		||||
        <div class="row m-0 pl-3 pr-3" *ngFor="let feature of features"[ngClass]="{'selected':isFeatureSelected(feature)}" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
 | 
			
		||||
        <div class="row m-0 ps-3 pe-3" *ngFor="let feature of features"[ngClass]="{'selected':isFeatureSelected(feature)}" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
 | 
			
		||||
          <fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
 | 
			
		||||
        </div>
 | 
			
		||||
      </div>      
 | 
			
		||||
 
 | 
			
		||||
@@ -9,6 +9,7 @@ import * as mapActions from '../../actions/map.actions';
 | 
			
		||||
import { tassign } from 'tassign';
 | 
			
		||||
import { Router } from '@angular/router';
 | 
			
		||||
import { Feature } from 'ol';
 | 
			
		||||
import { Geometry} from 'ol/geom';
 | 
			
		||||
 | 
			
		||||
@ForItemType("vnd.farmmaps.itemtype.croppingscheme")
 | 
			
		||||
@Injectable()
 | 
			
		||||
@@ -23,7 +24,7 @@ export class FeatureListCroppingschemeComponent extends AbstractFeatureListCompo
 | 
			
		||||
        super(store, itemTypeService, location);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    getAction(feature:Feature):Action {
 | 
			
		||||
    getAction(feature:Feature<Geometry>):Action {
 | 
			
		||||
        var queryState = tassign(mapReducers.initialState.queryState, { parentCode: feature.get('code'), itemType: "vnd.farmmaps.itemtype.cropfield" });
 | 
			
		||||
        return new mapActions.DoQuery(queryState);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
 | 
			
		||||
import { Feature } from 'ol';
 | 
			
		||||
import { Geometry } from 'ol/geom';
 | 
			
		||||
import { AbstractFeatureListFeatureComponent,FeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
 | 
			
		||||
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
 | 
			
		||||
 | 
			
		||||
@@ -18,7 +19,7 @@ export class FeatureListFeatureContainerComponent {
 | 
			
		||||
    this.featureLists = [...this.featureLists].reverse();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Input() feature: Feature;
 | 
			
		||||
  @Input() feature: Feature<Geometry>;
 | 
			
		||||
 | 
			
		||||
  @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective; 
 | 
			
		||||
 | 
			
		||||
@@ -32,7 +33,7 @@ export class FeatureListFeatureContainerComponent {
 | 
			
		||||
      let criteria=0;
 | 
			
		||||
      if (this.featureLists[i]['forItemType']) {
 | 
			
		||||
        criteria++;
 | 
			
		||||
        if(this.featureLists[i]['forItemType'].indexOf(this.feature.get("itemType")) >= 0) {
 | 
			
		||||
        if(this.featureLists[i]['forItemType'].split(",").filter(part => part == this.feature.get("itemType")).length == 1) {
 | 
			
		||||
          matches++;
 | 
			
		||||
        }
 | 
			
		||||
      }         
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
import { Component, Injectable,ViewChild,AfterViewInit} from '@angular/core';
 | 
			
		||||
import { Feature } from 'ol';
 | 
			
		||||
import { Geometry } from 'ol/geom';
 | 
			
		||||
import { Store } from '@ngrx/store';
 | 
			
		||||
import * as mapReducers from '../../reducers/map.reducer';
 | 
			
		||||
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
 | 
			
		||||
@@ -23,11 +24,11 @@ export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFea
 | 
			
		||||
    super(store, itemTypeService,config);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  areaInHa(feature:Feature):number {
 | 
			
		||||
  areaInHa(feature:Feature<Geometry>):number {
 | 
			
		||||
    if(!feature) return 0;
 | 
			
		||||
    // get area from faeture if 0 calculate from polygon
 | 
			
		||||
    let a = feature.get('area');
 | 
			
		||||
    if(a) return a;
 | 
			
		||||
    return  getArea(feature.getGeometry(),{projectio:"EPSG:3857"}) / 10000;
 | 
			
		||||
    return  getArea(feature.getGeometry(),{projection:"EPSG:3857"}) / 10000;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
import { Component, Input, Injectable,Directive} from '@angular/core';
 | 
			
		||||
import { Feature } from 'ol';
 | 
			
		||||
import { Geometry } from 'ol/geom';
 | 
			
		||||
import { Store } from '@ngrx/store';
 | 
			
		||||
import * as mapReducers from '../../reducers/map.reducer';
 | 
			
		||||
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
 | 
			
		||||
@@ -9,7 +10,7 @@ import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
 | 
			
		||||
@Injectable()
 | 
			
		||||
@Directive()
 | 
			
		||||
export abstract class AbstractFeatureListFeatureComponent {
 | 
			
		||||
  @Input() feature: Feature
 | 
			
		||||
  @Input() feature: Feature<Geometry>
 | 
			
		||||
 | 
			
		||||
  constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService,public config:AppConfig) {
 | 
			
		||||
  } 
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<div *ngIf="features;let features">
 | 
			
		||||
  <fm-back-button></fm-back-button>
 | 
			
		||||
  <div class="row m-0 pl-3 pr-3" *ngFor="let feature of features" [ngClass]="{'selected':isFeatureSelected(feature)}" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
 | 
			
		||||
  <div class="row m-0 ps-3 pe-3" *ngFor="let feature of features" [ngClass]="{'selected':isFeatureSelected(feature)}" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
 | 
			
		||||
    <fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
 | 
			
		||||
  </div>
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
import { Component, Input, Injectable,Directive,SimpleChanges } from '@angular/core';
 | 
			
		||||
import { Location } from '@angular/common';
 | 
			
		||||
import { Feature } from 'ol';
 | 
			
		||||
import { Geometry} from 'ol/geom';
 | 
			
		||||
import { Store,Action} from '@ngrx/store';
 | 
			
		||||
import * as mapReducers from '../../reducers/map.reducer';
 | 
			
		||||
import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common';
 | 
			
		||||
@@ -14,20 +15,20 @@ import { IQueryState } from '@farmmaps/common';
 | 
			
		||||
@Injectable()
 | 
			
		||||
@Directive()
 | 
			
		||||
export abstract class AbstractFeatureListComponent {
 | 
			
		||||
  @Input() features: Array<Feature>;
 | 
			
		||||
  @Input() features: Array<Feature<Geometry>>;
 | 
			
		||||
  @Input() queryState: IQueryState;
 | 
			
		||||
  @Input() selectedFeature: Feature;
 | 
			
		||||
  @Input() selectedFeature: Feature<Geometry>;
 | 
			
		||||
  constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location) {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleFeatureClick(feature:Feature) {
 | 
			
		||||
  handleFeatureClick(feature:Feature<Geometry>) {
 | 
			
		||||
    if(feature) {
 | 
			
		||||
      let action = this.getAction(feature);
 | 
			
		||||
      this.store.dispatch(action);  
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getAction(feature:Feature):Action {
 | 
			
		||||
  getAction(feature:Feature<Geometry>):Action {
 | 
			
		||||
      var newQuery: any = tassign(mapReducers.initialState.queryState);
 | 
			
		||||
      newQuery.parentCode = feature.get('parentCode');
 | 
			
		||||
      newQuery.itemCode = feature.get('code');
 | 
			
		||||
@@ -48,7 +49,7 @@ export abstract class AbstractFeatureListComponent {
 | 
			
		||||
    this.location.back();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  isFeatureSelected(feature:Feature):boolean {
 | 
			
		||||
  isFeatureSelected(feature:Feature<Geometry>):boolean {
 | 
			
		||||
    if(!this.selectedFeature) return false;
 | 
			
		||||
    return feature.getId() == this.selectedFeature.getId();
 | 
			
		||||
  }  
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { Component, Input, OnInit,ViewChild } from '@angular/core';
 | 
			
		||||
import { Component, Input, AfterViewInit, ViewChild } from '@angular/core';
 | 
			
		||||
import { Feature} from 'ol';
 | 
			
		||||
import { Geometry } from 'ol/geom';
 | 
			
		||||
import { Geometry,Polygon,MultiPolygon } from 'ol/geom';
 | 
			
		||||
import * as extent from 'ol/extent';
 | 
			
		||||
import * as render from 'ol/render';
 | 
			
		||||
import * as style from 'ol/style';
 | 
			
		||||
@@ -10,51 +10,86 @@ import * as style from 'ol/style';
 | 
			
		||||
  templateUrl: './feature-thumbnail.component.html',
 | 
			
		||||
  styleUrls: ['./feature-thumbnail.component.scss']
 | 
			
		||||
})
 | 
			
		||||
export class GeometryThumbnailComponent implements OnInit {
 | 
			
		||||
export class GeometryThumbnailComponent implements AfterViewInit {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  constructor() { }
 | 
			
		||||
 | 
			
		||||
  @ViewChild('canvas') canvas;
 | 
			
		||||
  @ViewChild('container') container;
 | 
			
		||||
  @Input('feature') feature:Feature;
 | 
			
		||||
 | 
			
		||||
  ngOnInit(): void {
 | 
			
		||||
  private geometry:Geometry = null;
 | 
			
		||||
  @Input() set feature(value:Feature<Geometry>) {
 | 
			
		||||
    if(value) {
 | 
			
		||||
      this.geometry = value.getGeometry();
 | 
			
		||||
    } else {
 | 
			
		||||
      this.geometry = null;
 | 
			
		||||
    }
 | 
			
		||||
    this.render(this.canvas,
 | 
			
		||||
      this.geometryStyle,
 | 
			
		||||
      this.geometry,
 | 
			
		||||
      this.width, 
 | 
			
		||||
      this.height);
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  private defaultStyle:style.Style = new style.Style({
 | 
			
		||||
    stroke: new style.Stroke({ color: 'black',width:1.5 })
 | 
			
		||||
  });  
 | 
			
		||||
  private geometryStyle:style.Style = this.defaultStyle;
 | 
			
		||||
  @Input() set fillColor(value:string) {
 | 
			
		||||
    if(style) {
 | 
			
		||||
      this.geometryStyle = new style.Style({
 | 
			
		||||
        stroke: new style.Stroke({ color: 'black',width:1.5 }),
 | 
			
		||||
        fill: new style.Fill({color: value})
 | 
			
		||||
      });  
 | 
			
		||||
    } else {
 | 
			
		||||
      this.geometryStyle = this.defaultStyle
 | 
			
		||||
    }
 | 
			
		||||
    this.render(this.canvas,
 | 
			
		||||
      this.geometryStyle,
 | 
			
		||||
      this.geometry,
 | 
			
		||||
      this.width, 
 | 
			
		||||
      this.height);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  render(canvas,width,height,geometry:Geometry) {  
 | 
			
		||||
    let renderContext = render.toContext(canvas.getContext( '2d'),{ size: [width, height] });  
 | 
			
		||||
   
 | 
			
		||||
    let strokeStyle  = new style.Style({
 | 
			
		||||
      stroke: new style.Stroke({ color: 'black',width:1.5 })
 | 
			
		||||
    });
 | 
			
		||||
  private width:number = 0;
 | 
			
		||||
  private height:number = 0;
 | 
			
		||||
 | 
			
		||||
    let geom   = geometry.clone(),
 | 
			
		||||
        line   = geom.getCoordinates()[0],
 | 
			
		||||
        e = extent.boundingExtent( line );
 | 
			
		||||
  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] });  
 | 
			
		||||
 | 
			
		||||
    let dxy = extent.getCenter(e),
 | 
			
		||||
        sxy = [ 
 | 
			
		||||
            (width - 2 ) / extent.getWidth(e),
 | 
			
		||||
            (height - 2 ) / extent.getHeight(e)
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
    let dx = dxy[0], 
 | 
			
		||||
        dy = dxy[1],
 | 
			
		||||
        sx = sxy[0],
 | 
			
		||||
        sy = sxy[1];
 | 
			
		||||
 | 
			
		||||
    geom.translate( -dx, -dy );
 | 
			
		||||
    geom.scale( Math.min(sx, sy), -Math.min(sx, sy));
 | 
			
		||||
    geom.translate( width / 2, height / 2 );
 | 
			
		||||
 | 
			
		||||
    renderContext.setStyle( strokeStyle );  
 | 
			
		||||
    renderContext.drawGeometry( geom );
 | 
			
		||||
      let geom   = geometry.clone() as Polygon,
 | 
			
		||||
      line   = geom.getCoordinates()[0],
 | 
			
		||||
      e = extent.boundingExtent( line );
 | 
			
		||||
  
 | 
			
		||||
      let dxy = extent.getCenter(e),
 | 
			
		||||
      sxy = [ 
 | 
			
		||||
          (width - 2 ) / extent.getWidth(e),
 | 
			
		||||
          (height - 2 ) / extent.getHeight(e)
 | 
			
		||||
      ];
 | 
			
		||||
  
 | 
			
		||||
      let dx = dxy[0], 
 | 
			
		||||
          dy = dxy[1],
 | 
			
		||||
          sx = sxy[0],
 | 
			
		||||
          sy = sxy[1];
 | 
			
		||||
  
 | 
			
		||||
      geom.translate( -dx, -dy );
 | 
			
		||||
      geom.scale( Math.min(sx, sy), -Math.min(sx, sy));
 | 
			
		||||
      geom.translate(width / 2,height / 2 );
 | 
			
		||||
      renderContext.setStyle( style );  
 | 
			
		||||
      renderContext.drawGeometry( geom );
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngAfterViewInit() {
 | 
			
		||||
    this.render(this.canvas.nativeElement,
 | 
			
		||||
      this.container.nativeElement.offsetWidth, 
 | 
			
		||||
      this.container.nativeElement.offsetHeight,
 | 
			
		||||
      this.feature.getGeometry());
 | 
			
		||||
    this.width = this.container.nativeElement.offsetWidth;
 | 
			
		||||
    this.height = this.container.nativeElement.offsetHeight;
 | 
			
		||||
    this.render(this.canvas,
 | 
			
		||||
      this.geometryStyle,
 | 
			
		||||
      this.geometry,
 | 
			
		||||
      this.width, 
 | 
			
		||||
      this.height);
 | 
			
		||||
  }  
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
import { Directive, ViewContainerRef,TemplateRef,OnInit,Input, OnChanges } from '@angular/core';
 | 
			
		||||
import { layer } from 'ol';
 | 
			
		||||
import { Layer } from 'ol/layer';
 | 
			
		||||
import { Source } from 'ol/source';
 | 
			
		||||
import { MapComponent } from 'ngx-openlayers';
 | 
			
		||||
 | 
			
		||||
@Directive({
 | 
			
		||||
@@ -7,7 +8,7 @@ import { MapComponent } from 'ngx-openlayers';
 | 
			
		||||
})
 | 
			
		||||
export class ifZoomToShowDirective  implements OnInit {
 | 
			
		||||
  @Input() 
 | 
			
		||||
  set fmMapIfZoomToShow(layer:layer) {
 | 
			
		||||
  set fmMapIfZoomToShow(layer:Layer<Source>) {
 | 
			
		||||
    this.layer$=layer;
 | 
			
		||||
    this.checkZoom();
 | 
			
		||||
  }
 | 
			
		||||
@@ -24,7 +25,7 @@ export class ifZoomToShowDirective  implements OnInit {
 | 
			
		||||
    this.checkZoom();
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  private layer$:layer;
 | 
			
		||||
  private layer$:Layer<Source>;
 | 
			
		||||
  private thenTemplate$:TemplateRef<any>;
 | 
			
		||||
  private elseTemplate$:TemplateRef<any>;
 | 
			
		||||
  private showView = false;
 | 
			
		||||
 
 | 
			
		||||
@@ -33,13 +33,13 @@ export class ItemListItemContainerComponent {
 | 
			
		||||
      let criteria=0;
 | 
			
		||||
      if (this.itemComponentList[i]['forItemType']) {
 | 
			
		||||
        criteria++;
 | 
			
		||||
        if(this.itemComponentList[i]['forItemType'].indexOf(this.item.itemType) >= 0) {
 | 
			
		||||
        if(this.itemComponentList[i]['forItemType'].split(",").filter(part => part ==this.item.itemType).length == 1) {
 | 
			
		||||
          matches++;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      if (this.itemComponentList[i]['forSourceTask']) {
 | 
			
		||||
        criteria++;
 | 
			
		||||
        if(this.itemComponentList[i]['forSourceTask'].indexOf(this.item.sourceTask) >= 0) {
 | 
			
		||||
        if(this.itemComponentList[i]['forSourceTask'].split(",").filter(part => part ==this.item.sourceTask).length ==1) {
 | 
			
		||||
          matches++;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
    <div class="card layers-card m-1">
 | 
			
		||||
      <div class="card-header">
 | 
			
		||||
        <span i18n>Layers</span>
 | 
			
		||||
        <i class="float-right fas fa-times" (click)="close($event)"></i>
 | 
			
		||||
        <i class="float-end fas fa-times" (click)="close($event)"></i>
 | 
			
		||||
      </div>
 | 
			
		||||
      <ul class="navbar-nav">
 | 
			
		||||
        <li class="nav-item py-0">
 | 
			
		||||
@@ -19,6 +19,13 @@
 | 
			
		||||
            <fm-map-layer-list [itemLayers]="overlayLayers|async" [selectedLayer]="selectedOverlayLayer|async" (onDelete)="handleOnDelete($event)" (onToggleVisibility)="handleOnToggleVisibility($event)" (onSetOpacity)="handleOnSetOpacity($event)" (onZoomToExtent)="handleZoomToExtent($event)" (onSelectLayer)="handleSelectOverlayLayer($event)"></fm-map-layer-list>
 | 
			
		||||
          </div>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li class="nav-item py-0" *ngIf="selectedItemLayer$ | async as selectedItemLayer">
 | 
			
		||||
          <span><i class="fal fa-layer-group" aria-hidden="true"></i> <span i18n>Data</span><span class="slideButton"><a href="#" title="Compare" class="btn btn-light btn-sm" (click)="handleToggleShowDatalayerSlide($event)"><i class="fal fa-sliders-h-square"></i></a></span></span>
 | 
			
		||||
          <div class="mb-4">
 | 
			
		||||
            <fm-map-layer-list [dataLayers]="true" [itemLayers]="[selectedItemLayer]" [selectedLayer]="selectedItemLayer" (onToggleVisibility)="handleOnToggleVisibility($event)" (onSetOpacity)="handleOnSetOpacity($event)" (onZoomToExtent)="handleZoomToExtent($event)" (onSelectLayer)="handleSelectOverlayLayer($event)"></fm-map-layer-list>
 | 
			
		||||
          </div>
 | 
			
		||||
        </li>
 | 
			
		||||
 | 
			
		||||
      </ul>
 | 
			
		||||
  </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -19,6 +19,10 @@
 | 
			
		||||
  font-weight: bold;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.slideButton {
 | 
			
		||||
  margin-left: 1em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.layers {
 | 
			
		||||
  color:$secondary;
 | 
			
		||||
  position: absolute;
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,7 @@ export class LayerSwitcher  implements OnInit,OnChanges{
 | 
			
		||||
  public showLayerSwitcher:Observable<boolean>;
 | 
			
		||||
  public overlayLayers: Observable<Array<IItemLayer>>;
 | 
			
		||||
  public selectedOverlayLayer: Observable<IItemLayer>;
 | 
			
		||||
  public selectedItemLayer$: Observable<IItemLayer>;
 | 
			
		||||
  public baseLayers: Observable<Array<IItemLayer>>;
 | 
			
		||||
  public selectedBaseLayer: Observable<IItemLayer>;
 | 
			
		||||
 | 
			
		||||
@@ -27,6 +28,7 @@ export class LayerSwitcher  implements OnInit,OnChanges{
 | 
			
		||||
    this.selectedOverlayLayer = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
 | 
			
		||||
    this.baseLayers = this.store.select(mapReducers.selectGetBaseLayers);
 | 
			
		||||
    this.selectedBaseLayer = this.store.select(mapReducers.selectGetSelectedBaseLayer);
 | 
			
		||||
    this.selectedItemLayer$ = this.store.select(mapReducers.selectGetSelectedItemLayer)
 | 
			
		||||
    this.showLayerSwitcher = this.store.select(mapReducers.selectGetShowLayerSwitcher);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -74,4 +76,10 @@ export class LayerSwitcher  implements OnInit,OnChanges{
 | 
			
		||||
  handleSelectBaseLayer(itemLayer: IItemLayer) {
 | 
			
		||||
    this.store.dispatch(new mapActions.SelectBaseLayer(itemLayer));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleToggleShowDatalayerSlide(event:Event) {
 | 
			
		||||
    this.store.dispatch(new mapActions.ShowLayerSwitcher(false));    
 | 
			
		||||
    this.store.dispatch(new mapActions.ToggleShowDataLayerSlide());
 | 
			
		||||
    event.preventDefault();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
<div class="row pl-3">
 | 
			
		||||
<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-8 nopadding"><span i18n>Standard deviation</span>:</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
<div class="row pl-3">
 | 
			
		||||
<div class="row ps-3">
 | 
			
		||||
  <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>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
<ng-template #rt let-r="result" let-t="term">
 | 
			
		||||
  <i class="fal fa-search" aria-hidden="true" style="width:2rem"></i>
 | 
			
		||||
  <i [class]="getIcon(r.type)" aria-hidden="true" style="width:2rem"></i>
 | 
			
		||||
  <ngb-highlight [result]="formatter(r)" [term]="t"></ngb-highlight> 
 | 
			
		||||
</ng-template>
 | 
			
		||||
 | 
			
		||||
@@ -7,14 +7,10 @@
 | 
			
		||||
  <div class="card p-2">
 | 
			
		||||
    <form class="form" (ngSubmit)="handleSearch($event)">
 | 
			
		||||
      <div class="input-group">
 | 
			
		||||
        <div class="input-group-prepend">
 | 
			
		||||
          <button type="button" class="btn btn-outline-secondary" (click)="handleToggleMenu($event)"><i class="fal fa-bars" aria-hidden="true"></i></button>
 | 
			
		||||
        </div>
 | 
			
		||||
        <button type="button" class="btn btn-outline-secondary" (click)="handleToggleMenu($event)"><i class="fal fa-bars" aria-hidden="true"></i></button>
 | 
			
		||||
        <input #searchText class="form-control" type="text" (focus)="handleFocus($event)" [ngModel]="searchTextLocal" name="searchTextLocal" (ngModelChange)="handleChange($event)" [ngbTypeahead]="search" [resultTemplate]="rt" [inputFormatter]="formatter" (selectItem)="handleSelect($event)" placeholder="Search" i18n-placeholder />
 | 
			
		||||
        <div class="input-group-append">
 | 
			
		||||
          <button type="submit" class="btn btn-outline-secondary" [disabled]="disabled"><i class="fal fa-search"></i></button>
 | 
			
		||||
          <button type="button" class="clear btn btn-outline-secondary" [disabled]="!clearEnabled" (click)="handleClearClick($event)"><i class="fas fa-times"></i></button>
 | 
			
		||||
        </div>
 | 
			
		||||
        <button type="submit" class="btn btn-outline-secondary" [disabled]="disabled"><i class="fal fa-search"></i></button>
 | 
			
		||||
        <button type="button" class="clear btn btn-outline-secondary" [disabled]="!clearEnabled" (click)="handleClearClick($event)"><i class="fas fa-times"></i></button>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="options">
 | 
			
		||||
        <div class="form-check">
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { Component, Input, Output, OnInit, EventEmitter, SimpleChanges, OnChanges, ViewChild } from '@angular/core';
 | 
			
		||||
import { Observable ,  of } from 'rxjs';
 | 
			
		||||
import { debounceTime,distinctUntilChanged,tap,switchMap,merge,catchError} from 'rxjs/operators';
 | 
			
		||||
import { Observable ,  of,merge,forkJoin } from 'rxjs';
 | 
			
		||||
import { debounceTime,distinctUntilChanged,tap,switchMap,catchError,map} from 'rxjs/operators';
 | 
			
		||||
import { TypeaheadService, TimespanService } from '@farmmaps/common';
 | 
			
		||||
import { IQueryState } from '@farmmaps/common';
 | 
			
		||||
import { IPeriodState } from '../../models/period.state';
 | 
			
		||||
@@ -26,7 +26,8 @@ export class MapSearchComponent {
 | 
			
		||||
    this.periodLocal =  tassign(this.periodLocal,{startDate: period.startDate,endDate:period.endDate});
 | 
			
		||||
    this.startEndCaption = this.timespanService.getCaption(period.startDate, period.endDate, 4)
 | 
			
		||||
  }
 | 
			
		||||
  @Output() onSearch = new EventEmitter<IQueryState>();
 | 
			
		||||
  @Output() onSearch = new EventEmitter<IQueryState>()
 | 
			
		||||
  @Output() onCitySearch = new EventEmitter<string>()
 | 
			
		||||
  @Output() onClear = new EventEmitter<any>();
 | 
			
		||||
  @Output() onSearchCollapse = new EventEmitter<any>();
 | 
			
		||||
  @Output() onSearchExpand = new EventEmitter<any>();
 | 
			
		||||
@@ -69,20 +70,27 @@ export class MapSearchComponent {
 | 
			
		||||
    this.filterOptionsLocal = { query: "", tags: "", startDate: null, endDate: null, bboxFilter: false, itemType: null, itemCode:null,level:0,parentCode:null,bbox:[] };   
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  search = (text$: Observable<string>) =>
 | 
			
		||||
  search = (text$: Observable<string>) => 
 | 
			
		||||
    text$.pipe(
 | 
			
		||||
      debounceTime(300),
 | 
			
		||||
      distinctUntilChanged(),
 | 
			
		||||
      tap(() => this.searching = true),
 | 
			
		||||
      switchMap(term => term.length < 1 ? of([]) :
 | 
			
		||||
        this.typeaheadService.getSearchTypeaheadItems(term).pipe(
 | 
			
		||||
          tap(() => this.searchFailed = false),
 | 
			
		||||
      tap(() => {this.searching = true;this.searchFailed=false;}),
 | 
			
		||||
      switchMap(term => term.length < 1 ? of([]) : 
 | 
			
		||||
      forkJoin(
 | 
			
		||||
        this.typeaheadService.getTagTypeaheadItems(term).pipe(
 | 
			
		||||
          catchError(() => {
 | 
			
		||||
            this.searchFailed = true;
 | 
			
		||||
            return of([]);
 | 
			
		||||
          })) ),
 | 
			
		||||
          }),map( (sa:string[]) => sa.map((s,i) => ({"name":s,"type":"tag"})))),
 | 
			
		||||
          this.typeaheadService.getCityTypeaheadItems(term).pipe(
 | 
			
		||||
            catchError(() => {
 | 
			
		||||
              this.searchFailed = true;
 | 
			
		||||
              return of([]);
 | 
			
		||||
            }),map( (sa:string[]) => sa.map((s,i) => ({"name":s,"type":"city"})))),
 | 
			
		||||
        ).pipe(map(([a1,a2]) => [...a1, ...a2] ),map(a => a.sort((a, b) => (a.name.toUpperCase() > b.name.toUpperCase()) ? 1 : -1)))
 | 
			
		||||
      ),
 | 
			
		||||
      tap(() => this.searching = false),
 | 
			
		||||
      merge(this.hideSearchingWhenUnsubscribed));
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
  formatter = (x: { name: string }) => x.name;
 | 
			
		||||
 | 
			
		||||
@@ -109,18 +117,23 @@ export class MapSearchComponent {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleSelect(event) {
 | 
			
		||||
    event.preventDefault();
 | 
			
		||||
    this.filterOptionsLocal.query = null;
 | 
			
		||||
    this.filterOptionsLocal.itemType = null;
 | 
			
		||||
    this.filterOptionsLocal.itemCode = null;
 | 
			
		||||
    this.filterOptionsLocal.parentCode = null;
 | 
			
		||||
    this.filterOptionsLocal.tags = event.item.name;
 | 
			
		||||
    if (this.dateFilter) {
 | 
			
		||||
      this.filterOptionsLocal.startDate = this.periodLocal.startDate;
 | 
			
		||||
      this.filterOptionsLocal.endDate = this.periodLocal.endDate;
 | 
			
		||||
    if(event.item.type == "tag") {
 | 
			
		||||
      event.preventDefault();
 | 
			
		||||
      this.filterOptionsLocal.query = null;
 | 
			
		||||
      this.filterOptionsLocal.itemType = null;
 | 
			
		||||
      this.filterOptionsLocal.itemCode = null;
 | 
			
		||||
      this.filterOptionsLocal.parentCode = null;
 | 
			
		||||
      this.filterOptionsLocal.tags = event.item.name;
 | 
			
		||||
      if (this.dateFilter) {
 | 
			
		||||
        this.filterOptionsLocal.startDate = this.periodLocal.startDate;
 | 
			
		||||
        this.filterOptionsLocal.endDate = this.periodLocal.endDate;
 | 
			
		||||
      }
 | 
			
		||||
      this.onSearch.emit(this.filterOptionsLocal);
 | 
			
		||||
      this.searchTextLocal = { name: this.filterOptionsLocal.tags };  
 | 
			
		||||
    } else if (event.item.type == "city") {
 | 
			
		||||
      this.clearEnabled = true;
 | 
			
		||||
      this.onCitySearch.emit(event.item.name);
 | 
			
		||||
    }
 | 
			
		||||
    this.onSearch.emit(this.filterOptionsLocal);
 | 
			
		||||
    this.searchTextLocal = { name: this.filterOptionsLocal.tags };
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleSelectPeriod(event: { startDate: Date, endDate: Date }) {
 | 
			
		||||
@@ -177,5 +190,15 @@ export class MapSearchComponent {
 | 
			
		||||
  handleClearClick(event) {
 | 
			
		||||
    this.onClear.emit({});
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getIcon(type):string {
 | 
			
		||||
    if(type == "tag")
 | 
			
		||||
      return "fal fa-tag";
 | 
			
		||||
    else if(type == "city")
 | 
			
		||||
      return "fal fa-map-marker-alt";
 | 
			
		||||
    else if(type == "search")
 | 
			
		||||
      return "fal fa-search";
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -20,40 +20,51 @@
 | 
			
		||||
  compassHeading:compassHeading$|async,
 | 
			
		||||
  styles:styles$|async,
 | 
			
		||||
  selectedFeature:selectedFeature$|async,
 | 
			
		||||
  fullscreen:fullscreen$|async
 | 
			
		||||
  fullscreen:fullscreen$|async,
 | 
			
		||||
  showDataLayerSlide:showDataLayerSlide$|async
 | 
			
		||||
} as state">
 | 
			
		||||
  <aol-map #map (moveEnd)="handleOnMoveEnd($event)" (click)="handleOnMouseDown($event)" (dblClick)="handleShowLayerValues($event)" [ngClass]="{'panel-visible':state.panelVisible,'fullscreen':state.fullscreen}" class="map">
 | 
			
		||||
  <aol-map #map (moveEnd)="handleOnMoveEnd($event)" (click)="handleOnMouseDown($event)" (dblClick)="handleShowLayerValues($event)" [ngClass]="{'panel-visible':state.panelVisible,'fullscreen':state.fullscreen }" class="map">
 | 
			
		||||
    <div>
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
    <aol-view [zoom]="state.mapState.zoom" [rotation]="state.mapState.rotation">
 | 
			
		||||
       <aol-coordinate [x]="state.mapState.xCenter" [y]="state.mapState.yCenter" [srid]="'EPSG:4326'"></aol-coordinate>
 | 
			
		||||
       <fm-map-zoom-to-extent [extent]="state.extent" [animate]="true"></fm-map-zoom-to-extent>
 | 
			
		||||
    </aol-view>
 | 
			
		||||
   
 | 
			
		||||
      <aol-view [zoom]="state.mapState.zoom" [rotation]="state.mapState.rotation">
 | 
			
		||||
        <aol-coordinate [x]="state.mapState.xCenter" [y]="state.mapState.yCenter" [srid]="'EPSG:4326'"></aol-coordinate>
 | 
			
		||||
        <fm-map-zoom-to-extent [extent]="state.extent" [animate]="true"></fm-map-zoom-to-extent>
 | 
			
		||||
     </aol-view> 
 | 
			
		||||
 | 
			
		||||
    <aol-interaction-default></aol-interaction-default>
 | 
			
		||||
    <aol-interaction-dragrotateandzoom></aol-interaction-dragrotateandzoom>
 | 
			
		||||
    <fm-map-item-layers [itemLayers]="state.baseLayers"></fm-map-item-layers>
 | 
			
		||||
    <fm-map-item-layers *ngIf="!overrideOverlayLayers" [itemLayers]="state.overlayLayers"></fm-map-item-layers>
 | 
			
		||||
    <fm-map-item-layers *ngIf="!overrideSelectedItemLayer" [itemLayer]="state.selectedItemLayer"></fm-map-item-layers>
 | 
			
		||||
    <fm-map-item-layers *ngIf="!overrideSelectedItemLayer" [itemLayer]="state.selectedItemLayer" (onPrerender)="handlePrerender($event)"></fm-map-item-layers>
 | 
			
		||||
    <aol-layer-vector>
 | 
			
		||||
      <fm-map-item-source-vector [styles]="state.styles" [features]="state.features" (onFeatureSelected)="handleFeatureClick($event)" (onFeatureHover)="handleFeatureHover($event)" [selectedFeature]="state.selectedFeature" [selectedItem]="state.selectedItem"></fm-map-item-source-vector>
 | 
			
		||||
    </aol-layer-vector>
 | 
			
		||||
    <router-outlet name="map-layers"></router-outlet>
 | 
			
		||||
    <fm-map-gps-location [position]="state.position" [headingTolerance]="20" [showHeading]="devicesService.IsMobile()" [showTolerance]="devicesService.IsMobile()" [heading]="state.compassHeading"></fm-map-gps-location>
 | 
			
		||||
    <fm-map-layer-values></fm-map-layer-values>
 | 
			
		||||
    <div class="control-container" >
 | 
			
		||||
      <router-outlet name="map-controls"></router-outlet>
 | 
			
		||||
      <fm-map-layer-switcher></fm-map-layer-switcher>
 | 
			
		||||
      <fm-map-pan-to-location [position]="state.position" [mapState]="state.mapState" [animate]="true"></fm-map-pan-to-location>
 | 
			
		||||
      <fm-map-rotation-reset></fm-map-rotation-reset>
 | 
			
		||||
    <div class="viewport-container" [ngStyle]="{'bottom': bottom(state.panelVisible)}">
 | 
			
		||||
      <div class="control-container">
 | 
			
		||||
        <router-outlet name="map-controls"></router-outlet>
 | 
			
		||||
        <fm-map-layer-switcher></fm-map-layer-switcher>
 | 
			
		||||
        <fm-map-pan-to-location [position]="state.position" [mapState]="state.mapState" [animate]="true"></fm-map-pan-to-location>
 | 
			
		||||
        <fm-map-rotation-reset></fm-map-rotation-reset>
 | 
			
		||||
      </div>  
 | 
			
		||||
      <div class="slide-container"  [ngClass]="{'showDataLayerSlide':state.showDataLayerSlide}">
 | 
			
		||||
        <form>
 | 
			
		||||
          <input class="dataLayerSlide" (input)="handleSlideChange($event)" type="range" style="width: 100%" value="{{dataLayerSlideValue}}"/>
 | 
			
		||||
        </form>
 | 
			
		||||
      </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <fm-map-file-drop-target [parentCode]="state.parentCode" (onFileDropped)="handleFileDropped($event)"></fm-map-file-drop-target>
 | 
			
		||||
 | 
			
		||||
    <div *ngIf="noContent">
 | 
			
		||||
      <fm-map-map-search #mapSearch [openedModalName]="state.openedModalName" (onOpenModal)="handleOpenModal($event)" (onCloseModal)="handleCloseModal()" [ngClass]="{'menuVisible':state.menuVisible}" (onToggleMenu)="handleToggleMenu($event)" (onSearchCollapse)="handleSearchCollapse($event)" (onSearchExpand)="handleSearchExpand($event)" [collapsed]="state.searchCollapsed" [searchMinified]="state.searchMinified" (onSearch)="handleSearch($event)" (onClear)="handleClearSearch($event)" [filterOptions]="state.queryState" [clearEnabled]="state.clearEnabled" [period]="state.period" (onPeriodChange)="handlePeriodChange($event)"></fm-map-map-search>
 | 
			
		||||
      <fm-map-map-search #mapSearch [openedModalName]="state.openedModalName" (onOpenModal)="handleOpenModal($event)" (onCloseModal)="handleCloseModal()" [ngClass]="{'menuVisible':state.menuVisible}" (onToggleMenu)="handleToggleMenu($event)" (onSearchCollapse)="handleSearchCollapse($event)" (onSearchExpand)="handleSearchExpand($event)" [collapsed]="state.searchCollapsed" [searchMinified]="state.searchMinified" (onSearch)="handleSearch($event)" (onClear)="handleClearSearch($event)" [filterOptions]="state.queryState" [clearEnabled]="state.clearEnabled" [period]="state.period" (onPeriodChange)="handlePeriodChange($event)" (onCitySearch)="handleCitySearch($event)"></fm-map-map-search>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="side-panel-container">
 | 
			
		||||
      <fm-side-panel [resizeable]="true" [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">
 | 
			
		||||
        <div class="panel-wrapper" *ngIf="noContent">
 | 
			
		||||
          <div class="panel-top bg-secondary" *ngIf="!(state.searchMinified)">
 | 
			
		||||
          </div>
 | 
			
		||||
@@ -74,7 +85,7 @@
 | 
			
		||||
        </div>  
 | 
			
		||||
      </fm-side-panel>
 | 
			
		||||
      <fm-side-panel [resizeable]="true" [visible]="!noContent">
 | 
			
		||||
        <router-outlet></router-outlet>
 | 
			
		||||
        <router-outlet (activate)="handleSidepaneloutletActivate($event)" (deactivate)="handleSidepaneloutletDeactivate($event)"></router-outlet>
 | 
			
		||||
      </fm-side-panel>
 | 
			
		||||
    </div>   
 | 
			
		||||
  </aol-map>  
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
@import "~bootstrap/scss/bootstrap.scss";
 | 
			
		||||
 | 
			
		||||
aol-map { position:absolute;width:100%;height:calc(100vh + 4rem);}
 | 
			
		||||
aol-map { position:absolute;width:100%;height:calc( 100vh );}
 | 
			
		||||
 | 
			
		||||
.arrow {
 | 
			
		||||
  top: 3rem;
 | 
			
		||||
@@ -45,29 +45,39 @@ aol-map { position:absolute;width:100%;height:calc(100vh + 4rem);}
 | 
			
		||||
  text-overflow:ellipsis;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
.control-container {
 | 
			
		||||
.viewport-container {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  right: 1em;
 | 
			
		||||
  bottom: 8.1em;
 | 
			
		||||
  left:0;
 | 
			
		||||
  right:0;
 | 
			
		||||
  bottom:0;
 | 
			
		||||
  margin-bottom:4em;
 | 
			
		||||
  pointer-events: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.fullscreen .control-container {
 | 
			
		||||
  bottom: 5em;
 | 
			
		||||
 | 
			
		||||
.control-container {
 | 
			
		||||
  float:right;
 | 
			
		||||
  margin-right: 1em;
 | 
			
		||||
  pointer-events: all;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.fullscreen .viewport-container {
 | 
			
		||||
  margin-bottom: 1em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.side-panel-container {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  top:0em;
 | 
			
		||||
  bottom: 7.1em;
 | 
			
		||||
  bottom: 3em;
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  pointer-events: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.fullscreen .side-panel-container {
 | 
			
		||||
  bottom: 4em;
 | 
			
		||||
  bottom:0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
switch2d3d {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  right: 1em;
 | 
			
		||||
@@ -115,6 +125,21 @@ div.header button {
 | 
			
		||||
  max-height: 2.5em;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.slide-container {
 | 
			
		||||
  display: none;
 | 
			
		||||
  pointer-events: all;
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  overflow: hidden;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.dataLayerSlide {
 | 
			
		||||
  width:100%
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.slide-container.showDataLayerSlide {
 | 
			
		||||
  display: block;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
timespan {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  transition: left 0.5s;
 | 
			
		||||
@@ -170,7 +195,7 @@ timespan.menuVisible {
 | 
			
		||||
  width: 4rem;
 | 
			
		||||
  overflow: hidden;
 | 
			
		||||
  text-overflow: ellipsis;
 | 
			
		||||
  color: theme-color();
 | 
			
		||||
  color: $primary;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.shortcut-icon > .farm-icon {
 | 
			
		||||
 
 | 
			
		||||
@@ -5,12 +5,13 @@ import { withLatestFrom, switchMap,skip  } from 'rxjs/operators';
 | 
			
		||||
import { Router, ActivatedRoute, ParamMap } from '@angular/router';
 | 
			
		||||
import { Store } from '@ngrx/store';
 | 
			
		||||
import { DeviceService } from '@farmmaps/common';
 | 
			
		||||
//import { proj,Map } from 'openlayers';
 | 
			
		||||
import {getRenderPixel} from 'ol/render';
 | 
			
		||||
 | 
			
		||||
// Map
 | 
			
		||||
import * as mapReducers from '../../reducers/map.reducer';
 | 
			
		||||
import * as mapActions from '../../actions/map.actions';
 | 
			
		||||
import { IMapState} from '../../models/map.state';
 | 
			
		||||
import { IClickedFeature} from '../../models/clicked.feature';
 | 
			
		||||
import { IQuery } from '../../reducers/map.reducer'
 | 
			
		||||
import { ISelectedFeatures } from '../../models/selected.features';
 | 
			
		||||
import { IItemLayer } from '../../models/item.layer';
 | 
			
		||||
@@ -20,6 +21,7 @@ import {IStyles} from '../../models/style.cache';
 | 
			
		||||
import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component';
 | 
			
		||||
import { StateSerializerService } from '@farmmaps/common';
 | 
			
		||||
import { GeolocationService} from '../../services/geolocation.service';
 | 
			
		||||
import { GeolocatorService } from '@farmmaps/common';
 | 
			
		||||
import {DeviceOrientationService} from '../../services/device-orientation.service';
 | 
			
		||||
 | 
			
		||||
// AppCommon
 | 
			
		||||
@@ -29,6 +31,7 @@ import {commonReducers} from '@farmmaps/common';
 | 
			
		||||
import {commonActions} from '@farmmaps/common';
 | 
			
		||||
 | 
			
		||||
import {Feature} from 'ol';
 | 
			
		||||
import {Geometry,Point,Circle} from 'ol/geom';
 | 
			
		||||
import {Extent,createEmpty,extend } from 'ol/extent';
 | 
			
		||||
import {transform} from 'ol/proj';
 | 
			
		||||
import { tassign } from 'tassign';
 | 
			
		||||
@@ -46,7 +49,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
 | 
			
		||||
  public openedModalName$: Observable<string> = this.store.select(commonReducers.selectOpenedModalName);
 | 
			
		||||
  public itemTypes$: Observable<{ [id: string]: IItemType }>;
 | 
			
		||||
  public mapState$: Observable<IMapState> = this.store.select(mapReducers.selectGetMapState);
 | 
			
		||||
  public features$: Observable<Array<Feature>> = this.store.select(mapReducers.selectGetFeatures);
 | 
			
		||||
  public features$: Observable<Array<Feature<Geometry>>> = this.store.select(mapReducers.selectGetFeatures);
 | 
			
		||||
  public overlayLayers$: Observable<Array<IItemLayer>> = this.store.select(mapReducers.selectGetOverlayLayers);
 | 
			
		||||
  public selectedOverlayLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
 | 
			
		||||
  public selectedItemLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedItemLayer);
 | 
			
		||||
@@ -63,8 +66,8 @@ 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 selectedFeature$: Observable<Feature> = this.store.select(mapReducers.selectGetSelectedFeature);
 | 
			
		||||
  public clickedFeature: Subject<Feature> = new Subject<Feature>();
 | 
			
		||||
  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);
 | 
			
		||||
  public parentItem$: Observable<IItem> =this.store.select(mapReducers.selectGetParentItem);
 | 
			
		||||
  public queryState$: Observable<IQueryState> = this.store.select(mapReducers.selectGetQueryState);
 | 
			
		||||
@@ -73,6 +76,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
 | 
			
		||||
  public clearEnabled$: Observable<boolean> = this.store.select(mapReducers.selectGetClearEnabled);
 | 
			
		||||
  public searchCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetSearchCollapsed);
 | 
			
		||||
  public searchMinified$: Observable<boolean> = this.store.select(mapReducers.selectGetSearchMinified);
 | 
			
		||||
  public showDataLayerSlide$: Observable<boolean> = this.store.select(mapReducers.selectGetShowdataLayerSlide);
 | 
			
		||||
  public menuVisible$: Observable<boolean>;
 | 
			
		||||
  public query$: Observable<IQuery> =  this.store.select(mapReducers.selectGetQuery);
 | 
			
		||||
  public position$: Observable<GeolocationPosition> = this.geolocationService.getCurrentPosition();
 | 
			
		||||
@@ -87,6 +91,10 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
 | 
			
		||||
  public noContent: boolean = false;
 | 
			
		||||
  public overrideSelectedItemLayer: boolean = false;
 | 
			
		||||
  public overrideOverlayLayers: boolean = false;
 | 
			
		||||
  public dataLayerSlideValue:number = 50;
 | 
			
		||||
  public dataLayerSlideEnabled = false;
 | 
			
		||||
  private visibleAreaBottom = 0;
 | 
			
		||||
  private viewEnabled: boolean = true;
 | 
			
		||||
  
 | 
			
		||||
  @ViewChild('map') map;
 | 
			
		||||
  @ViewChild('contentDiv') contentDiv: ElementRef;
 | 
			
		||||
@@ -99,6 +107,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
 | 
			
		||||
    public itemTypeService: ItemTypeService,
 | 
			
		||||
    private location: Location,
 | 
			
		||||
    private geolocationService: GeolocationService,
 | 
			
		||||
    private geolocaterService: GeolocatorService,
 | 
			
		||||
    private zone: NgZone,
 | 
			
		||||
    private deviceorientationService:DeviceOrientationService,
 | 
			
		||||
    public devicesService:DeviceService) {
 | 
			
		||||
@@ -151,6 +160,25 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handlePanelResize(resizeTop:number) {
 | 
			
		||||
    if(resizeTop==100 || !this.devicesService.IsMobile() ) {
 | 
			
		||||
      this.visibleAreaBottom=0;
 | 
			
		||||
    } else {
 | 
			
		||||
      this.visibleAreaBottom=100-resizeTop;
 | 
			
		||||
      if(this.visibleAreaBottom>60) {
 | 
			
		||||
        this.visibleAreaBottom=60;
 | 
			
		||||
      }
 | 
			
		||||
    }      
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  bottom(panelVisible:boolean) {
 | 
			
		||||
    if(panelVisible) {
 | 
			
		||||
      return this.visibleAreaBottom + '%';     
 | 
			
		||||
    } else {
 | 
			
		||||
      return "0%";
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleOpenModal(modalName: string) {
 | 
			
		||||
    this.store.dispatch(new  commonActions.OpenModal(modalName));
 | 
			
		||||
  }
 | 
			
		||||
@@ -163,11 +191,11 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
 | 
			
		||||
    this.uploadService.addFiles(droppedFile.files, droppedFile.event, { parentCode:droppedFile.parentCode, geometry:droppedFile.geometry });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleFeatureClick(feature: Feature) {
 | 
			
		||||
  handleFeatureClick(feature: Feature<Geometry>) {
 | 
			
		||||
    this.clickedFeature.next(feature);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleFeatureHover(feature: Feature) {
 | 
			
		||||
  handleFeatureHover(feature: Feature<Geometry>) {
 | 
			
		||||
    this.store.dispatch(new mapActions.SelectFeature(feature));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -175,6 +203,43 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
 | 
			
		||||
    this.store.dispatch(new mapActions.DoQuery(queryState));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleSidepaneloutletActivate(component:any) {
 | 
			
		||||
   if(component && component.hasOwnProperty('clickedFeature')) {
 | 
			
		||||
     (component as IClickedFeature).clickedFeature = this.clickedFeature;
 | 
			
		||||
   }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleSidepaneloutletDeactivate(component:any) {
 | 
			
		||||
    if(component && component.hasOwnProperty('clickedFeature')) {
 | 
			
		||||
      (component as IClickedFeature).clickedFeature = null;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handlePrerender(event:any) {
 | 
			
		||||
    if(!this.dataLayerSlideEnabled) return;
 | 
			
		||||
    const ctx = event.context;
 | 
			
		||||
    const mapSize = this.map.instance.getSize();
 | 
			
		||||
    const width = mapSize[0] * (this.dataLayerSlideValue / 100);
 | 
			
		||||
    const tl = getRenderPixel(event, [width, 0]);
 | 
			
		||||
    const tr = getRenderPixel(event, [mapSize[0], 0]);
 | 
			
		||||
    const bl = getRenderPixel(event, [width, mapSize[1]]);
 | 
			
		||||
    const br = getRenderPixel(event, mapSize);
 | 
			
		||||
 | 
			
		||||
    ctx.save();
 | 
			
		||||
    ctx.beginPath();
 | 
			
		||||
    ctx.moveTo(tl[0], tl[1]);
 | 
			
		||||
    ctx.lineTo(bl[0], bl[1]);
 | 
			
		||||
    ctx.lineTo(br[0], br[1]);
 | 
			
		||||
    ctx.lineTo(tr[0], tr[1]);
 | 
			
		||||
    ctx.closePath();
 | 
			
		||||
    ctx.clip();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleSlideChange(event:any) {
 | 
			
		||||
     this.dataLayerSlideValue = event.target.value;
 | 
			
		||||
     this.map.instance.render();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnInit() {    
 | 
			
		||||
    this.initialized = false;
 | 
			
		||||
    console.debug("Init");
 | 
			
		||||
@@ -307,6 +372,13 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
    this.initialized = true;   
 | 
			
		||||
    this.showDataLayerSlide$.subscribe((v) => {
 | 
			
		||||
      this.dataLayerSlideEnabled=v;
 | 
			
		||||
      this.map.instance.render();
 | 
			
		||||
    });
 | 
			
		||||
    this.store.select(mapReducers.selectGetViewEnabled).subscribe((v) => {
 | 
			
		||||
      this.viewEnabled = v;
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleSearchCollapse(event) {
 | 
			
		||||
@@ -360,7 +432,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleOnMoveEnd(event) {    
 | 
			
		||||
    if(this.initialized) {
 | 
			
		||||
    if(this.initialized && this.viewEnabled) {
 | 
			
		||||
      this.zone.run(() =>{
 | 
			
		||||
        console.debug("Move end");
 | 
			
		||||
        var map = event.map;
 | 
			
		||||
@@ -438,6 +510,19 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
 | 
			
		||||
    this.store.dispatch(new mapActions.SetPeriod(period));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  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]);
 | 
			
		||||
        point.transform('EPSG:4326', 'EPSG:3857');
 | 
			
		||||
        let circle = new Circle(point.getCoordinates(),5000);// 
 | 
			
		||||
        let extent = createEmpty();
 | 
			
		||||
        extend(extent, circle.getExtent());
 | 
			
		||||
        this.store.dispatch(new mapActions.SetExtent(extent))
 | 
			
		||||
      }
 | 
			
		||||
     });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnDestroy() {
 | 
			
		||||
    if (this.paramSub) this.paramSub.unsubscribe();
 | 
			
		||||
    if (this.itemTypeSub) this.itemTypeSub.unsubscribe();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
import { Component, Output, ViewChild, EventEmitter, Input, ElementRef, HostListener } from '@angular/core';
 | 
			
		||||
import { FormGroup,FormBuilder, Validators } from '@angular/forms';
 | 
			
		||||
import { UntypedFormGroup,UntypedFormBuilder, Validators } from '@angular/forms';
 | 
			
		||||
import { IListItem } from '@farmmaps/common';
 | 
			
		||||
import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component';
 | 
			
		||||
import {NgbModal, NgbModalRef} from "@ng-bootstrap/ng-bootstrap";
 | 
			
		||||
@@ -33,9 +33,9 @@ export class MetaDataModalComponent {
 | 
			
		||||
  @Output() onCloseModal = new EventEmitter<any>();
 | 
			
		||||
  @Output() onAddFilesWithMetaData = new EventEmitter<IMetaData>();
 | 
			
		||||
 | 
			
		||||
  constructor(private modalService: NgbModal, public fb: FormBuilder) { }
 | 
			
		||||
  constructor(private modalService: NgbModal, public fb: UntypedFormBuilder) { }
 | 
			
		||||
 | 
			
		||||
  public metaDataForm: FormGroup;
 | 
			
		||||
  public metaDataForm: UntypedFormGroup;
 | 
			
		||||
 | 
			
		||||
  handleMetaDataEntered(event) {
 | 
			
		||||
    if (this.metaDataForm.valid) {
 | 
			
		||||
 
 | 
			
		||||
@@ -34,13 +34,13 @@ export class SelectedItemContainerComponent {
 | 
			
		||||
      let criteria=0;
 | 
			
		||||
      if (this.selectedItemComponents[i]['forItemType'] ) {
 | 
			
		||||
        criteria++;
 | 
			
		||||
        if(this.selectedItemComponents[i]['forItemType'].indexOf(this.item.itemType) >= 0) {
 | 
			
		||||
        if(this.selectedItemComponents[i]['forItemType'].split(",").filter(part => part ==this.item.itemType).length == 1) {
 | 
			
		||||
          matches++;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      if (this.selectedItemComponents[i]['forSourceTask']) {
 | 
			
		||||
        criteria++;
 | 
			
		||||
        if( this.selectedItemComponents[i]['forSourceTask'].indexOf(this.item.sourceTask) >= 0) {
 | 
			
		||||
        if( this.selectedItemComponents[i]['forSourceTask'].split(",").filter(part => part ==this.item.sourceTask).length == 1) {
 | 
			
		||||
          matches++;
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="card menu-card">
 | 
			
		||||
        <ul class="p-0 mt-2">
 | 
			
		||||
          <li *ngIf="item.isEditable"><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)"><i class="fal fa-pencil" aria-hidden="true" i18n-title title="Edit"></i> <span i18n>Edit</span></a></li>
 | 
			
		||||
          <li *ngIf="item.isEditable"><a href="#" class="ms-1 me-1" (click)="handleOnEdit(item)"><i class="fal fa-pencil" aria-hidden="true" i18n-title title="Edit"></i> <span i18n>Edit</span></a></li>
 | 
			
		||||
          <ng-container *ngIf="itemTypeService.isLayer(item)">
 | 
			
		||||
            <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>
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="card menu-card">
 | 
			
		||||
        <ul class="p-0 mt-2">
 | 
			
		||||
          <li *ngIf="item.isEditable"><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)" ><i class="fal fa-pencil" aria-hidden="true" i18n-title title="Edit"></i> <span i18n>Edit</span></a></li>
 | 
			
		||||
          <li *ngIf="item.isEditable"><a href="#" class="mt-1 me-1" (click)="handleOnEdit(item)" ><i class="fal fa-pencil" aria-hidden="true" i18n-title title="Edit"></i> <span i18n>Edit</span></a></li>
 | 
			
		||||
          <ng-container *ngIf="itemTypeService.isLayer(item)">
 | 
			
		||||
            <li *ngIf="!getItemLayer(item,itemLayer.layerIndex)"><a   href="#" (click)="handleAddAsLayer(item,itemLayer.layerIndex)" ><i class="fas fa-layer-olus" 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>
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="card menu-card">
 | 
			
		||||
        <ul class="p-0 mt-2">
 | 
			
		||||
          <li *ngIf="item.isEditable"><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)"><i class="fal fa-pencil" aria-hidden="true" i18n-title title="Edit"></i> <span i18n>Edit</span></a></li>
 | 
			
		||||
          <li *ngIf="item.isEditable"><a href="#" class="mt-1 me-1" (click)="handleOnEdit(item)"><i class="fal fa-pencil" aria-hidden="true" i18n-title title="Edit"></i> <span i18n>Edit</span></a></li>
 | 
			
		||||
          <ng-container *ngIf="itemTypeService.isLayer(item)">
 | 
			
		||||
            <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>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,15 @@
 | 
			
		||||
import { Component, Input } from '@angular/core';
 | 
			
		||||
import { layer } from 'ol';
 | 
			
		||||
import { Layer } from 'ol/layer';
 | 
			
		||||
import { Source } from 'ol/source';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'fm-map-zoom-to-show-alert',
 | 
			
		||||
  template: '<div *fmMapIfZoomToShow="layer$" class="alert alert-info"><i class="fas fa-search-plus" aria-hidden="true" i18n-title title="Add as layer"></i> <span i18n>Zoom in to show layer</span></div>'
 | 
			
		||||
})
 | 
			
		||||
export class ZoomToShowAlert {
 | 
			
		||||
  public layer$: layer;
 | 
			
		||||
  public layer$: Layer<Source>;
 | 
			
		||||
  @Input() 
 | 
			
		||||
  set layer(layer:layer) {
 | 
			
		||||
  set layer(layer:Layer<Source>) {
 | 
			
		||||
     this.layer$ = layer;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ import { withLatestFrom, switchMap, map, catchError, mergeMap } from 'rxjs/opera
 | 
			
		||||
import {GeoJSON,WKT} from 'ol/format';
 | 
			
		||||
import {Feature} from 'ol';
 | 
			
		||||
import { getCenter,createEmpty,extend } from 'ol/extent';
 | 
			
		||||
import {Point} from 'ol/geom'
 | 
			
		||||
import {Point,Geometry} from 'ol/geom'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import * as mapActions from '../actions/map.actions';
 | 
			
		||||
@@ -50,7 +50,7 @@ export class MapEffects {
 | 
			
		||||
  private _wktFormat: WKT;
 | 
			
		||||
  private overrideSelectedItemLayer: boolean = false;
 | 
			
		||||
 | 
			
		||||
  private updateFeatureGeometry(feature:Feature, updateEvent:commonActions.DeviceUpdateEvent): Feature {
 | 
			
		||||
  private updateFeatureGeometry(feature:Feature<Geometry>, updateEvent:commonActions.DeviceUpdateEvent): Feature<Geometry> {
 | 
			
		||||
    let newFeature = feature.clone();
 | 
			
		||||
    var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
 | 
			
		||||
      dataProjection: 'EPSG:4326',
 | 
			
		||||
@@ -126,7 +126,7 @@ export class MapEffects {
 | 
			
		||||
      var endDate = a.queryState.endDate;
 | 
			
		||||
      var 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, null, 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) {
 | 
			
		||||
              if (f.properties && f.properties["code"]) {
 | 
			
		||||
@@ -153,11 +153,11 @@ export class MapEffects {
 | 
			
		||||
      if (!action.query.bboxFilter) {
 | 
			
		||||
         if (extent) {
 | 
			
		||||
          for (let f of action.features) {
 | 
			
		||||
            extend(extent, (f as Feature).getGeometry().getExtent());
 | 
			
		||||
            extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
 | 
			
		||||
          }
 | 
			
		||||
          if(action.features && action.features.length >0) {
 | 
			
		||||
            actions.push(new mapActions.SetExtent(extent));
 | 
			
		||||
          }  
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      return actions;
 | 
			
		||||
@@ -169,10 +169,10 @@ export class MapEffects {
 | 
			
		||||
        let extent = createEmpty();
 | 
			
		||||
        if (extent) {
 | 
			
		||||
          for (let f of action.features) {
 | 
			
		||||
            extend(extent, (f as Feature).getGeometry().getExtent());
 | 
			
		||||
            extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
 | 
			
		||||
          }
 | 
			
		||||
          if(action.features.length>0) return of(new mapActions.SetExtent(extent));
 | 
			
		||||
        }        
 | 
			
		||||
        }
 | 
			
		||||
        return EMPTY;
 | 
			
		||||
      })));
 | 
			
		||||
 | 
			
		||||
@@ -207,14 +207,14 @@ export class MapEffects {
 | 
			
		||||
 | 
			
		||||
    selectItemSuccessSetLayer$ =  createEffect(() => this.actions$.pipe(
 | 
			
		||||
      ofType(mapActions.SELECTITEMSUCCESS),
 | 
			
		||||
      map((action:mapActions.SelectItemSuccess) => 
 | 
			
		||||
      map((action:mapActions.SelectItemSuccess) =>
 | 
			
		||||
         new mapActions.SetSelectedItemLayer(action.item)
 | 
			
		||||
        )
 | 
			
		||||
      ));
 | 
			
		||||
 | 
			
		||||
  selectItemSuccess$ =  createEffect(() => this.actions$.pipe(
 | 
			
		||||
    ofType(mapActions.SELECTITEMSUCCESS),
 | 
			
		||||
    switchMap((action:mapActions.SelectItemSuccess) => {  
 | 
			
		||||
    switchMap((action:mapActions.SelectItemSuccess) => {
 | 
			
		||||
      if(!this.overrideSelectedItemLayer) {
 | 
			
		||||
        return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe(
 | 
			
		||||
          map((feature: any) => {
 | 
			
		||||
@@ -222,7 +222,7 @@ export class MapEffects {
 | 
			
		||||
            f.setId(action.item.code);
 | 
			
		||||
            return new mapActions.AddFeatureSuccess(f );
 | 
			
		||||
          }),
 | 
			
		||||
          catchError(error => of(new commonActions.Fail(error))));  
 | 
			
		||||
          catchError(error => of(new commonActions.Fail(error))));
 | 
			
		||||
      } else {
 | 
			
		||||
        return EMPTY;
 | 
			
		||||
      }
 | 
			
		||||
@@ -256,7 +256,7 @@ export class MapEffects {
 | 
			
		||||
    withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
 | 
			
		||||
    mergeMap(([action, features]) => {
 | 
			
		||||
      let deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent;
 | 
			
		||||
      var feature: Feature = null;
 | 
			
		||||
      var feature: Feature<Geometry> = null;
 | 
			
		||||
      for (let f of features) {
 | 
			
		||||
        if (f.getId() == deviceUpdateEventAction.itemCode) {
 | 
			
		||||
          feature = f;
 | 
			
		||||
@@ -299,7 +299,7 @@ export class MapEffects {
 | 
			
		||||
      } else {
 | 
			
		||||
        newAction= new mapActions.StartSearch(queryState);
 | 
			
		||||
      }
 | 
			
		||||
      
 | 
			
		||||
 | 
			
		||||
    } else {
 | 
			
		||||
      newAction = new mapActions.Clear();
 | 
			
		||||
    }
 | 
			
		||||
@@ -322,9 +322,9 @@ export class MapEffects {
 | 
			
		||||
                    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}));
 | 
			
		||||
            } 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}));
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
          return a;
 | 
			
		||||
@@ -346,7 +346,7 @@ export class MapEffects {
 | 
			
		||||
    withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesEnabled)),
 | 
			
		||||
    withLatestFrom(this.store$.select(mapReducers.selectGetOverlayLayers)),
 | 
			
		||||
    mergeMap(([[[action, selected], enabled],overlayLayers]) => {
 | 
			
		||||
      let layers = [];      
 | 
			
		||||
      let layers = [];
 | 
			
		||||
      if(selected) {
 | 
			
		||||
        if(selected && (selected as TemporalItemLayer).selectedItemLayer ) {
 | 
			
		||||
           selected=(selected as TemporalItemLayer).selectedItemLayer;
 | 
			
		||||
@@ -358,16 +358,16 @@ export class MapEffects {
 | 
			
		||||
      });
 | 
			
		||||
      let a = action as mapActions.SetLayerValuesLocation;
 | 
			
		||||
      let actions = [];
 | 
			
		||||
      if(enabled) {      
 | 
			
		||||
      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));
 | 
			
		||||
           }
 | 
			
		||||
         });
 | 
			
		||||
      } 
 | 
			
		||||
      }
 | 
			
		||||
      return actions;
 | 
			
		||||
    })));
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   setState$ =  createEffect(() => this.actions$.pipe(
 | 
			
		||||
    ofType(mapActions.SETSTATE),
 | 
			
		||||
@@ -385,7 +385,7 @@ export class MapEffects {
 | 
			
		||||
          return of(new mapActions.Clear());
 | 
			
		||||
        } else {
 | 
			
		||||
          return EMPTY;
 | 
			
		||||
        }       
 | 
			
		||||
        }
 | 
			
		||||
      })));
 | 
			
		||||
 | 
			
		||||
      setOverride$ = createEffect(() => this.actions$.pipe(
 | 
			
		||||
@@ -404,6 +404,6 @@ export class MapEffects {
 | 
			
		||||
 | 
			
		||||
  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();  
 | 
			
		||||
   }  
 | 
			
		||||
    this._wktFormat = new WKT();
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								projects/common-map/src/fm-map/models/clicked.feature.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								projects/common-map/src/fm-map/models/clicked.feature.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
import {Feature} from 'ol';
 | 
			
		||||
import {Geometry} from 'ol/geom';
 | 
			
		||||
import { Observable } from 'rxjs';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @deprecated This interface will be removed soon
 | 
			
		||||
 */
 | 
			
		||||
export interface IClickedFeature  {
 | 
			
		||||
    clickedFeature: Observable<Feature<Geometry>> 
 | 
			
		||||
}
 | 
			
		||||
@@ -1,9 +1,10 @@
 | 
			
		||||
import { IItem,IListItem } from '@farmmaps/common';
 | 
			
		||||
import {Layer} from 'ol/layer';
 | 
			
		||||
import { Source } from 'ol/source';
 | 
			
		||||
 | 
			
		||||
export interface IItemLayer  {
 | 
			
		||||
  item: IItem,
 | 
			
		||||
  layer: Layer,
 | 
			
		||||
  layer: Layer<Source>,
 | 
			
		||||
  visible: boolean,
 | 
			
		||||
  legendVisible:boolean,
 | 
			
		||||
  projection: string,
 | 
			
		||||
@@ -13,7 +14,7 @@ export interface IItemLayer  {
 | 
			
		||||
 | 
			
		||||
export class ItemLayer implements IItemLayer {
 | 
			
		||||
  public item: IItem;
 | 
			
		||||
  public layer: Layer = null;
 | 
			
		||||
  public layer: Layer<Source> = null;
 | 
			
		||||
  public visible: boolean = true;
 | 
			
		||||
  public legendVisible: boolean = false;
 | 
			
		||||
  public projection: string;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,7 @@
 | 
			
		||||
import {Style,Feature} from 'ol';
 | 
			
		||||
import {Feature} from 'ol';
 | 
			
		||||
import { Style } from 'ol/style';
 | 
			
		||||
import {Geometry } from 'ol/geom';
 | 
			
		||||
 | 
			
		||||
export interface IStyles{
 | 
			
		||||
  [id: string]: Style | (Feature);
 | 
			
		||||
  [id: string]: Style | ((featue:Feature<Geometry>) => Style);
 | 
			
		||||
};
 | 
			
		||||
@@ -11,6 +11,7 @@ import {commonActions} from '@farmmaps/common';
 | 
			
		||||
import { createSelector, createFeatureSelector } from '@ngrx/store';
 | 
			
		||||
 | 
			
		||||
import {Feature} from 'ol';
 | 
			
		||||
import {Geometry} from 'ol/geom';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';
 | 
			
		||||
@@ -45,10 +46,10 @@ export interface State {
 | 
			
		||||
  queryState: IQueryState,
 | 
			
		||||
  query:IQuery,
 | 
			
		||||
  parentCode: string,
 | 
			
		||||
  features: Array<Feature>,
 | 
			
		||||
  features: Array<Feature<Geometry>>,
 | 
			
		||||
  panelVisible: boolean,
 | 
			
		||||
  panelCollapsed: boolean,
 | 
			
		||||
  selectedFeature: Feature,
 | 
			
		||||
  selectedFeature: Feature<Geometry>,
 | 
			
		||||
  selectedItem:IItem,
 | 
			
		||||
  parentItem:IItem,
 | 
			
		||||
  clearEnabled: boolean,
 | 
			
		||||
@@ -68,8 +69,10 @@ export interface State {
 | 
			
		||||
  replaceUrl:boolean,
 | 
			
		||||
  layerValuesX:number,
 | 
			
		||||
  layerValuesY:number,
 | 
			
		||||
  layerValuesEnabled:boolean;
 | 
			
		||||
  layerValues: Array<ILayervalue>;
 | 
			
		||||
  layerValuesEnabled:boolean,
 | 
			
		||||
  layerValues: Array<ILayervalue>
 | 
			
		||||
  showDataLayerSlide:boolean,
 | 
			
		||||
  viewEnabled:boolean
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const initialState: State = {
 | 
			
		||||
@@ -112,7 +115,9 @@ export const initialState: State = {
 | 
			
		||||
  layerValuesX:0,
 | 
			
		||||
  layerValuesY:0,
 | 
			
		||||
  layerValuesEnabled:false,
 | 
			
		||||
  layerValues:[]
 | 
			
		||||
  layerValues:[],
 | 
			
		||||
  showDataLayerSlide:false,
 | 
			
		||||
  viewEnabled:true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State {
 | 
			
		||||
@@ -171,6 +176,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
 | 
			
		||||
      return tassign(state, {
 | 
			
		||||
        selectedItem: null,
 | 
			
		||||
        selectedItemLayer: null,
 | 
			
		||||
        showDataLayerSlide: false,
 | 
			
		||||
        features:[],
 | 
			
		||||
        inSearch:inSearch
 | 
			
		||||
      });
 | 
			
		||||
@@ -384,17 +390,25 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
 | 
			
		||||
    }
 | 
			
		||||
    case mapActions.SETVISIBILITY: {
 | 
			
		||||
      let a = action as mapActions.SetVisibility;
 | 
			
		||||
      let newLayers = state.overlayLayers.slice(0);
 | 
			
		||||
      let i = state.overlayLayers.indexOf(a.itemLayer);
 | 
			
		||||
      newLayers[i].visible = a.visibility;
 | 
			
		||||
      return tassign(state, { overlayLayers: newLayers });
 | 
			
		||||
      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);
 | 
			
		||||
        newLayers[i].visible = a.visibility;
 | 
			
		||||
        return tassign(state, { overlayLayers: newLayers });  
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    case mapActions.SETOPACITY: {
 | 
			
		||||
      let a = action as mapActions.SetOpacity;
 | 
			
		||||
      let newLayers = state.overlayLayers.slice(0);
 | 
			
		||||
      let i = state.overlayLayers.indexOf(a.itemLayer);
 | 
			
		||||
      newLayers[i].opacity = a.opacity;
 | 
			
		||||
      return tassign(state, { overlayLayers: newLayers });
 | 
			
		||||
      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);
 | 
			
		||||
        newLayers[i].opacity = a.opacity;
 | 
			
		||||
        return tassign(state, { overlayLayers: newLayers });  
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    case mapActions.SETLAYERINDEX: {
 | 
			
		||||
      let a = action as mapActions.SetLayerIndex;
 | 
			
		||||
@@ -492,7 +506,8 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
 | 
			
		||||
        features: [],
 | 
			
		||||
        query:initialState.query,
 | 
			
		||||
        showLayerSwitcher: false,
 | 
			
		||||
        extent: null
 | 
			
		||||
        extent: null,
 | 
			
		||||
        showDataLayerSlide: false
 | 
			
		||||
      });
 | 
			
		||||
    }
 | 
			
		||||
    case mapActions.SETSTYLE:{
 | 
			
		||||
@@ -505,6 +520,9 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
 | 
			
		||||
      let 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;
 | 
			
		||||
      return tassign(state,{replaceUrl:a.replaceUrl});
 | 
			
		||||
@@ -522,12 +540,17 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
 | 
			
		||||
      v.push(a.layervalue);
 | 
			
		||||
      return tassign(state,{layerValues:v});
 | 
			
		||||
    }
 | 
			
		||||
    case mapActions.SETVIEWSTATE:{
 | 
			
		||||
      let a= action as mapActions.SetViewState;
 | 
			
		||||
      return tassign(state,{viewEnabled:a.enabled});
 | 
			
		||||
    }
 | 
			
		||||
    case commonActions.ITEMDELETEDEVENT:{
 | 
			
		||||
      let a= action as commonActions.ItemDeletedEvent;
 | 
			
		||||
      if(state.selectedItem && state.selectedItem.code == a.itemCode) {
 | 
			
		||||
         return tassign(state,{  
 | 
			
		||||
          selectedItem: null,
 | 
			
		||||
          selectedItemLayer: null,
 | 
			
		||||
          showDataLayerSlide: false,
 | 
			
		||||
          features:[]
 | 
			
		||||
         });
 | 
			
		||||
      }
 | 
			
		||||
@@ -575,12 +598,14 @@ export const getSelectedItemLayer = (state: State) => state.selectedItemLayer;
 | 
			
		||||
export const getPeriod = (state:State) => state.period;
 | 
			
		||||
export const getStyles = (state:State) => state.styles;
 | 
			
		||||
export const getShowLayerSwitcher = (state:State) => state.showLayerSwitcher;
 | 
			
		||||
export const getShowDataLayerSlide = (state:State) => state.showDataLayerSlide;
 | 
			
		||||
export const getInSearch = (state:State) => state.inSearch;
 | 
			
		||||
export const getState = (state:State) => {return {mapState:state.mapState,queryState:state.queryState,replaceUrl:state.replaceUrl};}
 | 
			
		||||
export const getLayerValuesEnabled = (state:State) => state.layerValuesEnabled;
 | 
			
		||||
export const getLayerValues = (state:State) => state.layerValues;
 | 
			
		||||
export const getLayerValuesX = (state:State) => state.layerValuesX;
 | 
			
		||||
export const getLayerValuesY = (state:State) => state.layerValuesY;
 | 
			
		||||
export const getViewEnabled = (state:State) => state.viewEnabled;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export const selectMapState = createFeatureSelector<State>(MODULE_NAME);
 | 
			
		||||
@@ -607,11 +632,13 @@ export const selectGetSelectedItemLayer = createSelector(selectMapState, getSele
 | 
			
		||||
export const selectGetPeriod = createSelector(selectMapState, getPeriod);
 | 
			
		||||
export const selectGetStyles = createSelector(selectMapState, getStyles);
 | 
			
		||||
export const selectGetShowLayerSwitcher = createSelector(selectMapState,getShowLayerSwitcher);
 | 
			
		||||
export const selectGetShowdataLayerSlide = createSelector(selectMapState,getShowDataLayerSlide);
 | 
			
		||||
export const selectGetInSearch = createSelector(selectMapState,getInSearch);
 | 
			
		||||
export const selectGetState = createSelector(selectMapState,getState);
 | 
			
		||||
export const selectGetLayerValuesEnabled = createSelector(selectMapState,getLayerValuesEnabled);
 | 
			
		||||
export const selectGetLayerValues = createSelector(selectMapState,getLayerValues);
 | 
			
		||||
export const selectGetLayerValuesX = createSelector(selectMapState,getLayerValuesX);
 | 
			
		||||
export const selectGetLayerValuesY = createSelector(selectMapState,getLayerValuesY);
 | 
			
		||||
export const selectGetViewEnabled = createSelector(selectMapState,getViewEnabled);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,8 @@
 | 
			
		||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
 | 
			
		||||
 | 
			
		||||
import 'core-js/es7/reflect';
 | 
			
		||||
import 'zone.js/dist/zone';
 | 
			
		||||
import 'zone.js/dist/zone-testing';
 | 
			
		||||
import 'zone.js';
 | 
			
		||||
import 'zone.js/testing';
 | 
			
		||||
import { getTestBed } from '@angular/core/testing';
 | 
			
		||||
import {
 | 
			
		||||
  BrowserDynamicTestingModule,
 | 
			
		||||
@@ -14,7 +14,9 @@ declare const require: any;
 | 
			
		||||
// First, initialize the Angular testing environment.
 | 
			
		||||
getTestBed().initTestEnvironment(
 | 
			
		||||
  BrowserDynamicTestingModule,
 | 
			
		||||
  platformBrowserDynamicTesting()
 | 
			
		||||
  platformBrowserDynamicTesting(), {
 | 
			
		||||
    teardown: { destroyAfterEach: false }
 | 
			
		||||
}
 | 
			
		||||
);
 | 
			
		||||
// Then we find all the tests.
 | 
			
		||||
const context = require.context('./', true, /\.spec\.ts$/);
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
  "extends": "../../tsconfig.json",
 | 
			
		||||
  "compilerOptions": {
 | 
			
		||||
    "outDir": "../../out-tsc/lib",
 | 
			
		||||
    "target": "es2015",
 | 
			
		||||
    "target": "es2020",
 | 
			
		||||
    "module": "es2015",
 | 
			
		||||
    "moduleResolution": "node",
 | 
			
		||||
    "declaration": true,
 | 
			
		||||
@@ -22,8 +22,7 @@
 | 
			
		||||
    "strictMetadataEmit": true,
 | 
			
		||||
    "fullTemplateTypeCheck": true,
 | 
			
		||||
    "strictInjectionParameters": true,
 | 
			
		||||
    "enableResourceInlining": true,
 | 
			
		||||
    "enableIvy": false
 | 
			
		||||
    "enableResourceInlining": true
 | 
			
		||||
  },
 | 
			
		||||
  "exclude": [
 | 
			
		||||
    "src/test.ts",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										40
									
								
								projects/common-map/tsconfig.lib.prod.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								projects/common-map/tsconfig.lib.prod.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,40 @@
 | 
			
		||||
{
 | 
			
		||||
  "extends": "../../tsconfig.json",
 | 
			
		||||
  "compilerOptions": {
 | 
			
		||||
    "outDir": "../../out-tsc/lib",
 | 
			
		||||
    "target": "es2020",
 | 
			
		||||
    "module": "es2015",
 | 
			
		||||
    "moduleResolution": "node",
 | 
			
		||||
    "declaration": true,
 | 
			
		||||
    "sourceMap": true,
 | 
			
		||||
    "inlineSources": true,
 | 
			
		||||
    "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,
 | 
			
		||||
    "compilationMode": "partial"
 | 
			
		||||
  },
 | 
			
		||||
  "exclude": [
 | 
			
		||||
    "src/test.ts",
 | 
			
		||||
    "**/*.spec.ts"
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
@@ -1,15 +1,15 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "@farmmaps/common-map3d",
 | 
			
		||||
  "version": "1.0.0",
 | 
			
		||||
  "version": "2.0.0",
 | 
			
		||||
  "publishConfig": {
 | 
			
		||||
    "registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
 | 
			
		||||
  },
 | 
			
		||||
  "peerDependencies": {
 | 
			
		||||
    "@angular/common": "^10.1.3",
 | 
			
		||||
    "@angular/core": "^10.1.3",
 | 
			
		||||
    "ngx-openlayers": "1.0.0-next.16",
 | 
			
		||||
    "cesium": "^1.73.0",
 | 
			
		||||
    "ol-cesium": "^2.11.3"
 | 
			
		||||
    "@angular/common":  ">=14.0.0",
 | 
			
		||||
    "@angular/core":  ">=14.0.0",
 | 
			
		||||
    "ngx-openlayers": "1.0.0-next.19",
 | 
			
		||||
    "cesium": ">=1.82.1",
 | 
			
		||||
    "ol-cesium": ">=2.13.0"
 | 
			
		||||
  },
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "tslib": "^2.0.0"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,14 @@
 | 
			
		||||
import { NgModule } from '@angular/core';
 | 
			
		||||
import { Switch2D3DComponent } from './components/olcs/switch2d3d/switch2d3d.component';
 | 
			
		||||
import { AppCommonModule} from '@farmmaps/common';
 | 
			
		||||
import { AppCommonMapModule} from '@farmmaps/common-map';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@NgModule({
 | 
			
		||||
  declarations: [Switch2D3DComponent],
 | 
			
		||||
  imports: [
 | 
			
		||||
    AppCommonModule
 | 
			
		||||
    AppCommonModule,
 | 
			
		||||
    AppCommonMapModule
 | 
			
		||||
  ],
 | 
			
		||||
  exports: [Switch2D3DComponent]
 | 
			
		||||
})
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,11 @@
 | 
			
		||||
import { Component, OnInit,Input,Host  } from '@angular/core';
 | 
			
		||||
import { Interaction} from 'ol/interaction';
 | 
			
		||||
import { MapComponent } from 'ngx-openlayers';
 | 
			
		||||
import OLCesium from 'ol-cesium';
 | 
			
		||||
 | 
			
		||||
declare var olcs: any;
 | 
			
		||||
import OLCesium from 'olcs/OLCesium';
 | 
			
		||||
import RasterSynchronizer from 'olcs/RasterSynchronizer';
 | 
			
		||||
import VectorSynchronizer from 'olcs/VectorSynchronizer';
 | 
			
		||||
import { mapReducers,mapActions } from '@farmmaps/common-map';
 | 
			
		||||
import { Store } from '@ngrx/store';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'fm-map3d-switch2d3d',
 | 
			
		||||
@@ -16,9 +19,10 @@ export class Switch2D3DComponent {
 | 
			
		||||
  private ol3d: OLCesium;
 | 
			
		||||
  private synchronizers:any[];
 | 
			
		||||
  public loading:boolean = true;
 | 
			
		||||
  private interactions:Interaction[] = [];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  constructor(private map: MapComponent) {
 | 
			
		||||
  constructor(private map: MapComponent,private store: Store<mapReducers.State>) {
 | 
			
		||||
    
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -26,8 +30,8 @@ export class Switch2D3DComponent {
 | 
			
		||||
   
 | 
			
		||||
    this.ol3d = new OLCesium({ map: this.map.instance, createSynchronizers: (map,scene) => {
 | 
			
		||||
        this.synchronizers = [
 | 
			
		||||
            new olcs.RasterSynchronizer(map,scene),
 | 
			
		||||
            new olcs.VectorSynchronizer(map,scene)
 | 
			
		||||
            new RasterSynchronizer(map,scene),
 | 
			
		||||
            new VectorSynchronizer(map,scene)
 | 
			
		||||
        ];
 | 
			
		||||
        this.loading=false;
 | 
			
		||||
        return this.synchronizers;
 | 
			
		||||
@@ -41,12 +45,35 @@ export class Switch2D3DComponent {
 | 
			
		||||
      });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  disableInteractions() {
 | 
			
		||||
      this.interactions=[];
 | 
			
		||||
      this.map.instance.getInteractions().forEach((i) => {
 | 
			
		||||
        if(i.getActive()) {
 | 
			
		||||
          this.interactions.push(i);
 | 
			
		||||
          i.setActive(false);
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  enableInteractions() {
 | 
			
		||||
    this.interactions.forEach((i) => {
 | 
			
		||||
      i.setActive(true);
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleClick(event) {
 | 
			
		||||
    this.enable = !this.enable; 
 | 
			
		||||
    if(this.enable) {
 | 
			
		||||
        this.synchronize();
 | 
			
		||||
      this.store.dispatch(new mapActions.SetViewState(false));
 | 
			
		||||
      this.disableInteractions();
 | 
			
		||||
      this.synchronize();
 | 
			
		||||
      this.ol3d.setEnabled(true);
 | 
			
		||||
    } else {
 | 
			
		||||
      this.ol3d.setEnabled(false);
 | 
			
		||||
      this.enableInteractions();
 | 
			
		||||
      this.store.dispatch(new mapActions.SetViewState(true));
 | 
			
		||||
    }
 | 
			
		||||
    this.ol3d.setEnabled(this.enable);
 | 
			
		||||
    
 | 
			
		||||
    this.label = this.enable?"2D":"3D";    
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
 | 
			
		||||
 | 
			
		||||
import 'zone.js/dist/zone';
 | 
			
		||||
import 'zone.js/dist/zone-testing';
 | 
			
		||||
import 'zone.js';
 | 
			
		||||
import 'zone.js/testing';
 | 
			
		||||
import { getTestBed } from '@angular/core/testing';
 | 
			
		||||
import {
 | 
			
		||||
  BrowserDynamicTestingModule,
 | 
			
		||||
@@ -18,7 +18,9 @@ declare const require: {
 | 
			
		||||
// First, initialize the Angular testing environment.
 | 
			
		||||
getTestBed().initTestEnvironment(
 | 
			
		||||
  BrowserDynamicTestingModule,
 | 
			
		||||
  platformBrowserDynamicTesting()
 | 
			
		||||
  platformBrowserDynamicTesting(), {
 | 
			
		||||
    teardown: { destroyAfterEach: false }
 | 
			
		||||
}
 | 
			
		||||
);
 | 
			
		||||
// Then we find all the tests.
 | 
			
		||||
const context = require.context('./', true, /\.spec\.ts$/);
 | 
			
		||||
 
 | 
			
		||||
@@ -22,8 +22,7 @@
 | 
			
		||||
    "strictMetadataEmit": true,
 | 
			
		||||
    "fullTemplateTypeCheck": true,
 | 
			
		||||
    "strictInjectionParameters": true,
 | 
			
		||||
    "enableResourceInlining": true,
 | 
			
		||||
    "enableIvy": false
 | 
			
		||||
    "enableResourceInlining": true
 | 
			
		||||
  },
 | 
			
		||||
  "exclude": [
 | 
			
		||||
    "src/test.ts",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,40 @@
 | 
			
		||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
 | 
			
		||||
{
 | 
			
		||||
  "extends": "./tsconfig.lib.json",
 | 
			
		||||
  "extends": "../../tsconfig.json",
 | 
			
		||||
  "compilerOptions": {
 | 
			
		||||
    "declarationMap": false
 | 
			
		||||
    "outDir": "../../out-tsc/lib",
 | 
			
		||||
    "target": "es2015",
 | 
			
		||||
    "module": "es2015",
 | 
			
		||||
    "moduleResolution": "node",
 | 
			
		||||
    "declaration": true,
 | 
			
		||||
    "sourceMap": true,
 | 
			
		||||
    "inlineSources": true,
 | 
			
		||||
    "emitDecoratorMetadata": true,
 | 
			
		||||
    "experimentalDecorators": true,
 | 
			
		||||
    "importHelpers": true,
 | 
			
		||||
    "esModuleInterop": true,
 | 
			
		||||
    "types": [],
 | 
			
		||||
    "lib": [
 | 
			
		||||
      "dom",
 | 
			
		||||
      "es2018"
 | 
			
		||||
    ],
 | 
			
		||||
    "paths": {
 | 
			
		||||
      "@angular/*": [
 | 
			
		||||
 | 
			
		||||
      "node_modules/@angular/*"
 | 
			
		||||
 | 
			
		||||
      ]
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "angularCompilerOptions": {
 | 
			
		||||
    "enableIvy": false
 | 
			
		||||
  }
 | 
			
		||||
    "skipTemplateCodegen": true,
 | 
			
		||||
    "strictMetadataEmit": true,
 | 
			
		||||
    "fullTemplateTypeCheck": true,
 | 
			
		||||
    "strictInjectionParameters": true,
 | 
			
		||||
    "enableResourceInlining": true,
 | 
			
		||||
    "compilationMode": "partial"
 | 
			
		||||
  },
 | 
			
		||||
  "exclude": [
 | 
			
		||||
    "src/test.ts",
 | 
			
		||||
    "**/*.spec.ts"
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,12 +2,9 @@
 | 
			
		||||
  "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
 | 
			
		||||
  "dest": "../../dist/common",
 | 
			
		||||
  "lib": {
 | 
			
		||||
    "entryFile": "src/public-api.ts",
 | 
			
		||||
    "umdModuleIds": {
 | 
			
		||||
      "my-data": "my-data"
 | 
			
		||||
    }
 | 
			
		||||
    "entryFile": "src/public-api.ts"
 | 
			
		||||
  },
 | 
			
		||||
  "whitelistedNonPeerDependencies": [
 | 
			
		||||
  "allowedNonPeerDependencies": [
 | 
			
		||||
    "."
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										43
									
								
								projects/common/package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										43
									
								
								projects/common/package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -1,27 +1,30 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "@farmmaps/common",
 | 
			
		||||
  "version": "0.0.1",
 | 
			
		||||
  "lockfileVersion": 1,
 | 
			
		||||
  "version": "2.0.0",
 | 
			
		||||
  "lockfileVersion": 2,
 | 
			
		||||
  "requires": true,
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "is-retina": {
 | 
			
		||||
      "version": "1.0.3",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/is-retina/-/is-retina-1.0.3.tgz",
 | 
			
		||||
      "integrity": "sha1-10AbKGvqKuN/Ykd1iN5QTQuGR+M="
 | 
			
		||||
    },
 | 
			
		||||
    "ngx-avatar": {
 | 
			
		||||
      "version": "4.0.0",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/ngx-avatar/-/ngx-avatar-4.0.0.tgz",
 | 
			
		||||
      "integrity": "sha512-Uk40UXl26RvDy1ori9NDsGFB+f84AaxMnsIwZA6JPJK0pLcbo3F4vZTmzLZeOusOw1Qtgk5IzF630jo06keXwQ==",
 | 
			
		||||
      "requires": {
 | 
			
		||||
        "is-retina": "^1.0.3",
 | 
			
		||||
        "ts-md5": "^1.2.4"
 | 
			
		||||
  "packages": {
 | 
			
		||||
    "": {
 | 
			
		||||
      "name": "@farmmaps/common",
 | 
			
		||||
      "version": "2.0.0",
 | 
			
		||||
      "peerDependencies": {
 | 
			
		||||
        "@angular/common": "^14.0.0",
 | 
			
		||||
        "@angular/core": "^14.0.0",
 | 
			
		||||
        "@angular/forms": "^14",
 | 
			
		||||
        "@microsoft/signalr": "^3.1.3",
 | 
			
		||||
        "@ng-bootstrap/ng-bootstrap": ">=10.0.0",
 | 
			
		||||
        "@ngrx/effects": "^14.0.0",
 | 
			
		||||
        "@ngrx/router-store": "^14.0.0",
 | 
			
		||||
        "@ngrx/store": "^14.0.0",
 | 
			
		||||
        "angular-oauth2-oidc": "^13",
 | 
			
		||||
        "bootstrap": "^4.4.1",
 | 
			
		||||
        "moment": "^2.27.0",
 | 
			
		||||
        "ngx-avatar": "^4.1.0",
 | 
			
		||||
        "ngx-clipboard": "^14.0.1",
 | 
			
		||||
        "ngx-image-cropper": "^3.3.5",
 | 
			
		||||
        "ngx-uploadx": "^5.2.0",
 | 
			
		||||
        "tassign": "^1.0.0"
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "ts-md5": {
 | 
			
		||||
      "version": "1.2.7",
 | 
			
		||||
      "resolved": "https://registry.npmjs.org/ts-md5/-/ts-md5-1.2.7.tgz",
 | 
			
		||||
      "integrity": "sha512-emODogvKGWi1KO1l9c6YxLMBn6CEH3VrH5mVPIyOtxBG52BvV4jP3GWz6bOZCz61nLgBc3ffQYE4+EHfCD+V7w=="
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,25 +1,25 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "@farmmaps/common",
 | 
			
		||||
  "version": "1.0.0",
 | 
			
		||||
  "version": "2.0.0",
 | 
			
		||||
  "publishConfig": {
 | 
			
		||||
    "registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
 | 
			
		||||
  },
 | 
			
		||||
  "peerDependencies": {
 | 
			
		||||
    "@ng-bootstrap/ng-bootstrap": "^7.0",
 | 
			
		||||
    "@angular/common": "~10.2.4",
 | 
			
		||||
    "@angular/core": "~10.2.4",
 | 
			
		||||
    "@angular/forms": "~10.2.4",
 | 
			
		||||
    "@ngrx/effects": "^10.0",
 | 
			
		||||
    "@ngrx/router-store": "^10.0",
 | 
			
		||||
    "@ngrx/store": "^10.0",
 | 
			
		||||
    "tassign": "^1.0.0",
 | 
			
		||||
    "bootstrap": "^4.4.1",
 | 
			
		||||
    "@microsoft/signalr": "^3.1.3",
 | 
			
		||||
    "ngx-uploadx": "^3.3.4",
 | 
			
		||||
    "angular-oauth2-oidc": "^10.0.3",
 | 
			
		||||
    "moment": "^2.27.0",
 | 
			
		||||
    "ngx-avatar": "^4.0.0",
 | 
			
		||||
    "ngx-image-cropper": "^3.3.5",
 | 
			
		||||
    "ngx-clipboard": "^14.0.1"
 | 
			
		||||
    "@ng-bootstrap/ng-bootstrap": ">=10.0.0",
 | 
			
		||||
    "@angular/common": ">=14.0.0",
 | 
			
		||||
    "@angular/core": ">=14.0.0",
 | 
			
		||||
    "@angular/forms": ">=14.0.0",
 | 
			
		||||
    "@ngrx/effects": ">=14.0.0",
 | 
			
		||||
    "@ngrx/router-store": ">=14.0.0",
 | 
			
		||||
    "@ngrx/store": ">=14.0.0",
 | 
			
		||||
    "tassign": ">=1.0.0",
 | 
			
		||||
    "bootstrap": ">=4.4.1",
 | 
			
		||||
    "@microsoft/signalr": ">=3.1.3",
 | 
			
		||||
    "ngx-uploadx": ">=5.1.0",
 | 
			
		||||
    "angular-oauth2-oidc": ">=13.0.0",
 | 
			
		||||
    "moment": ">=2.27.0",
 | 
			
		||||
    "ngx-avatar": ">=4.1.0",
 | 
			
		||||
    "ngx-image-cropper": ">=3.3.5",
 | 
			
		||||
    "ngx-clipboard": ">=14.0.1"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -12,6 +12,9 @@ export const INITUSERSUCCESS = '[AppCommon] InitUserSuccess';
 | 
			
		||||
export const INITUSERPACKAGES = '[AppCommon] InitUserPackages';
 | 
			
		||||
export const INITUSERPACKAGESSUCCESS = '[AppCommon] InitUserPackagesSuccess';
 | 
			
		||||
 | 
			
		||||
export const INITPACKAGES = '[AppCommon] InitPackages';
 | 
			
		||||
export const INITPACKAGESSUCCESS = '[AppCommon] InitPackagesSuccess';
 | 
			
		||||
 | 
			
		||||
export const INITUSERSETTINGSROOT = '[AppCommon] InitUserSettingsRoot';
 | 
			
		||||
export const INITUSERSETTINGSROOTSUCCESS = '[AppCommon] InitUserSettingsRootSuccess';
 | 
			
		||||
 | 
			
		||||
@@ -102,6 +105,18 @@ export class InitUserPackagesSuccess implements Action {
 | 
			
		||||
  constructor(public items:IItem[] ) { }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class InitPackages implements Action {
 | 
			
		||||
  readonly type = INITPACKAGES;
 | 
			
		||||
 | 
			
		||||
  constructor() {}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class InitPackagesSuccess implements Action {
 | 
			
		||||
  readonly type = INITPACKAGESSUCCESS;
 | 
			
		||||
 | 
			
		||||
  constructor(public items:IItem[] ) { }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class InitUserSettingsRoot implements Action {
 | 
			
		||||
  readonly type = INITUSERSETTINGSROOT;
 | 
			
		||||
 | 
			
		||||
@@ -381,6 +396,8 @@ export type Actions = OpenModal
 | 
			
		||||
  | SetMenuVisible
 | 
			
		||||
  | InitUserPackages
 | 
			
		||||
  | InitUserPackagesSuccess
 | 
			
		||||
  | InitPackages
 | 
			
		||||
  | InitPackagesSuccess
 | 
			
		||||
  | InitUserSettingsRoot
 | 
			
		||||
  | InitUserSettingsRootSuccess
 | 
			
		||||
  | ToggleAccountMenu
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,7 @@ import { PackageService } from './services/package.service';
 | 
			
		||||
import { PackagePreloadStrategy } from './services/package-preload-strategy.service';
 | 
			
		||||
import { SenmlService } from './services/senml-service';
 | 
			
		||||
import { DeviceService } from './services/device.service';
 | 
			
		||||
import { GradientService} from './services/gradient.service';
 | 
			
		||||
 | 
			
		||||
export {
 | 
			
		||||
  FolderService,
 | 
			
		||||
@@ -61,7 +62,8 @@ export {
 | 
			
		||||
  PackageService,
 | 
			
		||||
  SenmlService,
 | 
			
		||||
  PackagePreloadStrategy,
 | 
			
		||||
  DeviceService
 | 
			
		||||
  DeviceService,
 | 
			
		||||
  GradientService
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@NgModule({
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
// angular modules
 | 
			
		||||
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf } from '@angular/core';
 | 
			
		||||
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf,InjectionToken } from '@angular/core';
 | 
			
		||||
import { CommonModule, DatePipe } from '@angular/common';
 | 
			
		||||
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
 | 
			
		||||
import { FormsModule } from '@angular/forms';
 | 
			
		||||
@@ -32,6 +32,7 @@ import { TimespanComponent } from './components/timespan/timespan.component';
 | 
			
		||||
import { TagInputComponent } from './components/tag-input/tag-input.component';
 | 
			
		||||
import { MenuBackgroundComponent } from './components/menu-background/menu-background.component';
 | 
			
		||||
import { HasPackageDirective} from './components/has-package/has-package.directive';
 | 
			
		||||
import { PackageExistsDirective} from './components/package-exists/package-exists.directive';
 | 
			
		||||
import { HasClaimDirective} from './components/has-claim/has-claim.directive';
 | 
			
		||||
import { UserMenuComponent} from './components/user-menu/user-menu.component';
 | 
			
		||||
import { ThumbnailComponent } from './components/thumbnail/thumbnail.component';
 | 
			
		||||
@@ -66,6 +67,7 @@ import { AvatarComponent } from './components/avatar/avatar.component';
 | 
			
		||||
import { AvatarModule } from 'ngx-avatar';
 | 
			
		||||
import { ImageCropperModule } from 'ngx-image-cropper';
 | 
			
		||||
 | 
			
		||||
export const FM_COMMON_STARTPAGE = new InjectionToken<string>('fm-common-startpage');
 | 
			
		||||
 | 
			
		||||
export {
 | 
			
		||||
  SafePipe,
 | 
			
		||||
@@ -81,6 +83,7 @@ export {
 | 
			
		||||
  UserMenuComponent,
 | 
			
		||||
  ThumbnailComponent,
 | 
			
		||||
  HasPackageDirective,
 | 
			
		||||
  PackageExistsDirective,
 | 
			
		||||
  HasClaimDirective,
 | 
			
		||||
  Alert,
 | 
			
		||||
  IEventMessage,
 | 
			
		||||
@@ -110,7 +113,9 @@ export {
 | 
			
		||||
  IGradientstop,
 | 
			
		||||
  BackButtonComponent,
 | 
			
		||||
  AvatarComponent,
 | 
			
		||||
  EditImageModalComponent
 | 
			
		||||
  EditImageModalComponent,
 | 
			
		||||
  GradientComponent,
 | 
			
		||||
  GradientSelectComponent
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@NgModule({
 | 
			
		||||
@@ -141,6 +146,7 @@ export {
 | 
			
		||||
    SessionClearedComponent,
 | 
			
		||||
    MenuBackgroundComponent,
 | 
			
		||||
    HasPackageDirective,
 | 
			
		||||
    PackageExistsDirective,
 | 
			
		||||
    HasClaimDirective,
 | 
			
		||||
    UserMenuComponent,
 | 
			
		||||
    GradientComponent,
 | 
			
		||||
@@ -171,6 +177,7 @@ export {
 | 
			
		||||
    SessionClearedComponent,
 | 
			
		||||
    MenuBackgroundComponent,
 | 
			
		||||
    HasPackageDirective,
 | 
			
		||||
    PackageExistsDirective,
 | 
			
		||||
    HasClaimDirective,
 | 
			
		||||
    UserMenuComponent,
 | 
			
		||||
    GradientComponent,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
 | 
			
		||||
 | 
			
		||||
import { AppMenuComponent } from './app-menu.component';
 | 
			
		||||
 | 
			
		||||
describe('AppMenuComponent', () => {
 | 
			
		||||
  let component: AppMenuComponent;
 | 
			
		||||
  let fixture: ComponentFixture<AppMenuComponent>;
 | 
			
		||||
 | 
			
		||||
  beforeEach(async () => {
 | 
			
		||||
    await TestBed.configureTestingModule({
 | 
			
		||||
      declarations: [ AppMenuComponent ]
 | 
			
		||||
    })
 | 
			
		||||
    .compileComponents();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  beforeEach(() => {
 | 
			
		||||
    fixture = TestBed.createComponent(AppMenuComponent);
 | 
			
		||||
    component = fixture.componentInstance;
 | 
			
		||||
    fixture.detectChanges();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('should create', () => {
 | 
			
		||||
    expect(component).toBeTruthy();
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,13 +1,15 @@
 | 
			
		||||
<div class="app fullscreen" (click)="handleClick($event)" [ngClass]="{'fullscreen' :(fullScreen|async),'pagemode':(isPageMode|async),'appmode':!(isPageMode|async)}">
 | 
			
		||||
  <nav class="navbar navbar-light navbar-expand bg-light navigation-clean">
 | 
			
		||||
    <div class="header-logo pageonly"><router-outlet name="header-logo"></router-outlet></div> 
 | 
			
		||||
    <button type="button" class="btn btn-outline-secondary apponly" (click)="handleToggleMenu($event)"><i class="fal fa-bars" aria-hidden="true"></i></button>
 | 
			
		||||
    <router-outlet name="menu" class="ml-4"></router-outlet>
 | 
			
		||||
    <div class="collapse navbar-collapse pageonly">      
 | 
			
		||||
      <a class="btn btn-primary ml-auto" role="button" [routerLink]="['/map']">
 | 
			
		||||
        <span *ngIf="(user|async)==null" i18n>Sign in</span>
 | 
			
		||||
        <span *ngIf="(user|async)!=null" i18n>To app</span>
 | 
			
		||||
      </a>
 | 
			
		||||
    <div class="container-fluid">
 | 
			
		||||
      <div class="header-logo pageonly"><router-outlet name="header-logo"></router-outlet></div> 
 | 
			
		||||
      <button type="button" class="btn btn-outline-secondary apponly" (click)="handleToggleMenu($event)"><i class="fal fa-bars" aria-hidden="true"></i></button>
 | 
			
		||||
      <router-outlet name="menu" class="ms-4"></router-outlet>
 | 
			
		||||
      <div class="collapse navbar-collapse pageonly">      
 | 
			
		||||
        <a class="btn btn-primary ms-auto" role="button" [routerLink]="[ startPage == null?'/map':startPage]">
 | 
			
		||||
          <span *ngIf="(user|async)==null" i18n>Sign in</span>
 | 
			
		||||
          <span *ngIf="(user|async)!=null" i18n>To app</span>
 | 
			
		||||
        </a>
 | 
			
		||||
      </div>  
 | 
			
		||||
    </div>
 | 
			
		||||
  </nav>
 | 
			
		||||
  <div class="body">
 | 
			
		||||
@@ -19,7 +21,7 @@
 | 
			
		||||
      <div class="body">
 | 
			
		||||
        <div class="d-flex flex-row">
 | 
			
		||||
          <div class="mt-2 mb-2 flex-grow-1 logo" (click)="handleHome($event)"><router-outlet name="side-panel-logo"></router-outlet></div>
 | 
			
		||||
          <div class="mt-2 mb-2 ml-2"><button type="button" class="btn btn-outline-secondary" (click)="handleToggleMenu($event)"><i class="fal fa-times" aria-hidden="true"></i></button></div>
 | 
			
		||||
          <div class="mt-2 mb-2 ms-2"><button type="button" class="btn btn-outline-secondary" (click)="handleToggleMenu($event)"><i class="fal fa-times" aria-hidden="true"></i></button></div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="d-flex flex-column cards"> 
 | 
			
		||||
            <router-outlet name="side-panel-menu"></router-outlet>          
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { Component, OnInit, OnDestroy, Inject, ViewEncapsulation, RendererFactory2, PLATFORM_ID, ChangeDetectionStrategy, HostListener, Input } from '@angular/core';
 | 
			
		||||
import { Component, OnInit, OnDestroy, Inject, Optional,ViewEncapsulation, RendererFactory2, PLATFORM_ID, ChangeDetectionStrategy, HostListener, Input } from '@angular/core';
 | 
			
		||||
import { Router, NavigationStart, NavigationEnd, RouteConfigLoadStart, RouteConfigLoadEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router';
 | 
			
		||||
import { Meta, Title, MetaDefinition } from '@angular/platform-browser'; import { DOCUMENT } from "@angular/common";
 | 
			
		||||
import { Subscription, Observable } from 'rxjs';
 | 
			
		||||
@@ -6,6 +6,7 @@ import { distinctUntilChanged } from 'rxjs/operators';
 | 
			
		||||
import { Store, Action } from '@ngrx/store';
 | 
			
		||||
import { IUser } from '../../models/user';
 | 
			
		||||
import { OAuthService, OAuthErrorEvent } from 'angular-oauth2-oidc';
 | 
			
		||||
import { FM_COMMON_STARTPAGE} from '../../common.module';
 | 
			
		||||
 | 
			
		||||
//AppCommon
 | 
			
		||||
import { IEventMessage } from '../../models/event.message';
 | 
			
		||||
@@ -51,6 +52,7 @@ export class AppComponent implements OnInit, OnDestroy {
 | 
			
		||||
  @Input() showUploadProgress: boolean = true;
 | 
			
		||||
 | 
			
		||||
  constructor(
 | 
			
		||||
    @Optional() @Inject(FM_COMMON_STARTPAGE) public startPage: string,
 | 
			
		||||
    public router: Router,
 | 
			
		||||
    private activatedRoute$: ActivatedRoute,
 | 
			
		||||
    private title$: Title,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
 | 
			
		||||
 | 
			
		||||
import { AvatarComponent } from './avatar.component';
 | 
			
		||||
 | 
			
		||||
describe('AvatarComponent', () => {
 | 
			
		||||
  let component: AvatarComponent;
 | 
			
		||||
  let fixture: ComponentFixture<AvatarComponent>;
 | 
			
		||||
 | 
			
		||||
  beforeEach(async () => {
 | 
			
		||||
    await TestBed.configureTestingModule({
 | 
			
		||||
      declarations: [ AvatarComponent ]
 | 
			
		||||
    })
 | 
			
		||||
    .compileComponents();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  beforeEach(() => {
 | 
			
		||||
    fixture = TestBed.createComponent(AvatarComponent);
 | 
			
		||||
    component = fixture.componentInstance;
 | 
			
		||||
    fixture.detectChanges();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('should create', () => {
 | 
			
		||||
    expect(component).toBeTruthy();
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
 | 
			
		||||
 | 
			
		||||
import { EditImageModalComponent } from './edit-image-modal.component';
 | 
			
		||||
 | 
			
		||||
describe('EditImageModalComponent', () => {
 | 
			
		||||
  let component: EditImageModalComponent;
 | 
			
		||||
  let fixture: ComponentFixture<EditImageModalComponent>;
 | 
			
		||||
 | 
			
		||||
  beforeEach(async () => {
 | 
			
		||||
    await TestBed.configureTestingModule({
 | 
			
		||||
      declarations: [ EditImageModalComponent ]
 | 
			
		||||
    })
 | 
			
		||||
    .compileComponents();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  beforeEach(() => {
 | 
			
		||||
    fixture = TestBed.createComponent(EditImageModalComponent);
 | 
			
		||||
    component = fixture.componentInstance;
 | 
			
		||||
    fixture.detectChanges();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('should create', () => {
 | 
			
		||||
    expect(component).toBeTruthy();
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
 | 
			
		||||
 | 
			
		||||
import { GradientSelectComponent } from './gradient-select.component';
 | 
			
		||||
 | 
			
		||||
describe('GradientSelectComponent', () => {
 | 
			
		||||
  let component: GradientSelectComponent;
 | 
			
		||||
  let fixture: ComponentFixture<GradientSelectComponent>;
 | 
			
		||||
 | 
			
		||||
  beforeEach(async () => {
 | 
			
		||||
    await TestBed.configureTestingModule({
 | 
			
		||||
      declarations: [ GradientSelectComponent ]
 | 
			
		||||
    })
 | 
			
		||||
    .compileComponents();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  beforeEach(() => {
 | 
			
		||||
    fixture = TestBed.createComponent(GradientSelectComponent);
 | 
			
		||||
    component = fixture.componentInstance;
 | 
			
		||||
    fixture.detectChanges();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('should create', () => {
 | 
			
		||||
    expect(component).toBeTruthy();
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
 | 
			
		||||
 | 
			
		||||
import { GradientComponent } from './gradient.component';
 | 
			
		||||
 | 
			
		||||
describe('GradientComponent', () => {
 | 
			
		||||
  let component: GradientComponent;
 | 
			
		||||
  let fixture: ComponentFixture<GradientComponent>;
 | 
			
		||||
 | 
			
		||||
  beforeEach(async () => {
 | 
			
		||||
    await TestBed.configureTestingModule({
 | 
			
		||||
      declarations: [ GradientComponent ]
 | 
			
		||||
    })
 | 
			
		||||
    .compileComponents();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  beforeEach(() => {
 | 
			
		||||
    fixture = TestBed.createComponent(GradientComponent);
 | 
			
		||||
    component = fixture.componentInstance;
 | 
			
		||||
    fixture.detectChanges();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('should create', () => {
 | 
			
		||||
    expect(component).toBeTruthy();
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
import { Component, Input, OnInit ,OnChanges, SimpleChanges,ChangeDetectorRef} from '@angular/core';
 | 
			
		||||
import { IItem} from '../../models/item'
 | 
			
		||||
import { IGradientstop } from '../../models/gradient';
 | 
			
		||||
import { GradientService } from '../../common-service.module';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -14,23 +15,12 @@ export class GradientComponent implements OnInit,OnChanges {
 | 
			
		||||
  @Input() gradientItem:IItem;
 | 
			
		||||
  public gradientStyle:any = {};
 | 
			
		||||
 | 
			
		||||
  constructor(private ref: ChangeDetectorRef) { }
 | 
			
		||||
  constructor(private ref: ChangeDetectorRef,private gradientService:GradientService) { }
 | 
			
		||||
 | 
			
		||||
  getGradientStyle(item:IItem):any {
 | 
			
		||||
    if(item.data && item.data.gradient) {
 | 
			
		||||
      let gradient = item.data.gradient as IGradientstop[];
 | 
			
		||||
      let gd = '{ "background": "linear-gradient(to right,';
 | 
			
		||||
      for(var i=0;i<gradient.length;i++) {
 | 
			
		||||
        let gs = gradient[i];
 | 
			
		||||
        if(i>0) gd+=",";
 | 
			
		||||
        gd += `rgba(${gs.color.red},${gs.color.green},${gs.color.blue},${gs.color.alpha/255})`;          
 | 
			
		||||
        gd +=` ${gs.relativestop*100}%`
 | 
			
		||||
      }
 | 
			
		||||
      gradient.forEach((gs) => {
 | 
			
		||||
      });
 | 
			
		||||
      gd+=')"}';
 | 
			
		||||
      
 | 
			
		||||
      return JSON.parse(gd);
 | 
			
		||||
      return this.gradientService.getGradientStyle(gradient);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -49,5 +39,4 @@ export class GradientComponent implements OnInit,OnChanges {
 | 
			
		||||
      }      
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,61 +1,61 @@
 | 
			
		||||
import { Directive, ViewContainerRef,TemplateRef,OnInit,Input,OnDestroy } from '@angular/core';
 | 
			
		||||
import { Store} from '@ngrx/store';
 | 
			
		||||
import * as appCommonReducer from '../../reducers/app-common.reducer'
 | 
			
		||||
import { IPackages } from '../../models/package';
 | 
			
		||||
import { Observable, Subscription } from 'rxjs';
 | 
			
		||||
import {AfterViewInit, Directive, Input, OnDestroy, TemplateRef, ViewContainerRef} from '@angular/core';
 | 
			
		||||
import {Subscription} from 'rxjs';
 | 
			
		||||
import {PackageService} from '../../services/package.service';
 | 
			
		||||
import * as appCommonReducer from '../../reducers/app-common.reducer';
 | 
			
		||||
import {Store} from '@ngrx/store';
 | 
			
		||||
 | 
			
		||||
@Directive({
 | 
			
		||||
  selector: '[fmHasPackage]',
 | 
			
		||||
})
 | 
			
		||||
export class HasPackageDirective  implements OnDestroy{
 | 
			
		||||
export class HasPackageDirective implements OnDestroy, AfterViewInit {
 | 
			
		||||
 | 
			
		||||
  @Input()
 | 
			
		||||
  set fmHasPackage(packageIdentifier:string) {
 | 
			
		||||
    this.packageIdentifier$ = packageIdentifier;
 | 
			
		||||
    this.updateView(); 
 | 
			
		||||
  set fmHasPackage(packageIdentifier: string) {
 | 
			
		||||
    this.packageIdentifier = packageIdentifier;
 | 
			
		||||
    this.updateView();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Input()
 | 
			
		||||
  set fmHasPackageThen(thenTemplate:TemplateRef<any>) {
 | 
			
		||||
    this.thenTemplate$ = thenTemplate;
 | 
			
		||||
    this.updateView(); 
 | 
			
		||||
  set fmHasPackageThen(thenTemplate: TemplateRef<any>) {
 | 
			
		||||
    this.thenTemplate = thenTemplate;
 | 
			
		||||
    this.updateView();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Input()
 | 
			
		||||
  set fmHasPackageElse(thenTemplate:TemplateRef<any>) {
 | 
			
		||||
    this.elseTemplate$ = thenTemplate;
 | 
			
		||||
    this.updateView(); 
 | 
			
		||||
  set fmHasPackageElse(thenTemplate: TemplateRef<any>) {
 | 
			
		||||
    this.elseTemplate = thenTemplate;
 | 
			
		||||
    this.updateView();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private packageIdentifier$:string;
 | 
			
		||||
  private thenTemplate$:TemplateRef<any>;
 | 
			
		||||
  private elseTemplate$:TemplateRef<any>;
 | 
			
		||||
  private packages$:any = {};
 | 
			
		||||
  private packagesObservable$:Observable<IPackages> = this.store$.select(appCommonReducer.SelectGetUserPackages);
 | 
			
		||||
  private packSub:Subscription;
 | 
			
		||||
  private packageIdentifier: string;
 | 
			
		||||
  private thenTemplate: TemplateRef<any>;
 | 
			
		||||
  private elseTemplate: TemplateRef<any>;
 | 
			
		||||
  private packSub: Subscription;
 | 
			
		||||
 | 
			
		||||
  constructor(private templateRef$: TemplateRef<any>,private viewContainerRef$: ViewContainerRef,private store$: Store<appCommonReducer.State>) { 
 | 
			
		||||
    this.thenTemplate$=templateRef$;
 | 
			
		||||
    this.packSub = this.store$.select(appCommonReducer.SelectGetUserPackages).subscribe((packages) => {
 | 
			
		||||
      this.packages$ = packages;
 | 
			
		||||
        this.updateView();     
 | 
			
		||||
  constructor(private hostTemplateRef: TemplateRef<any>, private viewContainerRef: ViewContainerRef,
 | 
			
		||||
              private store: Store<appCommonReducer.State>, private packageService: PackageService) {
 | 
			
		||||
    this.thenTemplate = hostTemplateRef;
 | 
			
		||||
    this.packSub = this.store.select(appCommonReducer.SelectGetValidUserPackages).subscribe((_) => {
 | 
			
		||||
      this.updateView();
 | 
			
		||||
    });
 | 
			
		||||
    this.updateView(); 
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngAfterViewInit() {
 | 
			
		||||
    this.updateView();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  updateView() {
 | 
			
		||||
    this.viewContainerRef$.clear();
 | 
			
		||||
    const today = new Date(new Date(Date.now()).toUTCString()).setHours(0, 0, 0, 0);
 | 
			
		||||
    if (this.packages$[this.packageIdentifier$] &&
 | 
			
		||||
      (this.packages$[this.packageIdentifier$].dataDate && new Date(this.packages$[this.packageIdentifier$].dataDate).setHours(0, 0, 0, 0) <= today) &&
 | 
			
		||||
      (this.packages$[this.packageIdentifier$].dataEndDate == null || new Date(this.packages$[this.packageIdentifier$].dataEndDate).setHours(0, 0, 0, 0) >= today)) {
 | 
			
		||||
      this.viewContainerRef$.createEmbeddedView(this.thenTemplate$);
 | 
			
		||||
    } else if (this.elseTemplate$) {
 | 
			
		||||
      this.viewContainerRef$.createEmbeddedView(this.elseTemplate$);
 | 
			
		||||
    } 
 | 
			
		||||
    this.viewContainerRef.clear();
 | 
			
		||||
    if (this.packageService.hasPackage(this.packageIdentifier)) {
 | 
			
		||||
      this.viewContainerRef.createEmbeddedView(this.thenTemplate);
 | 
			
		||||
    } else if (this.elseTemplate) {
 | 
			
		||||
      this.viewContainerRef.createEmbeddedView(this.elseTemplate);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnDestroy() {
 | 
			
		||||
    if(this.packSub) this.packSub.unsubscribe();
 | 
			
		||||
    if (this.packSub) {
 | 
			
		||||
      this.packSub.unsubscribe();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
<div>
 | 
			
		||||
<div class="mobile-hide">
 | 
			
		||||
    <div   (click)="toggle($event)" class="rounded-circle menu-button hidden"  [ngClass]="{'hidden':!user || noContent}">
 | 
			
		||||
        <span i18n-title title="Help"><i class="fas fa-question" aria-hidden="true"></i></span>
 | 
			
		||||
        <div class="menu hidden" [ngClass]="{'hidden':!showMenu}">                                     
 | 
			
		||||
 
 | 
			
		||||
@@ -68,6 +68,16 @@ div.menu-button > span {
 | 
			
		||||
    }
 | 
			
		||||
}    
 | 
			
		||||
 | 
			
		||||
.mobile-hide {
 | 
			
		||||
    display: inherit;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@media screen and (max-width: 768px) {
 | 
			
		||||
    .mobile-hide {
 | 
			
		||||
        display: none;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.unread {
 | 
			
		||||
    display: block;
 | 
			
		||||
    position: absolute;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
 | 
			
		||||
 | 
			
		||||
import { HelpMenuComponent } from './help-menu.component';
 | 
			
		||||
 | 
			
		||||
describe('HelpMenuComponent', () => {
 | 
			
		||||
  let component: HelpMenuComponent;
 | 
			
		||||
  let fixture: ComponentFixture<HelpMenuComponent>;
 | 
			
		||||
 | 
			
		||||
  beforeEach(async () => {
 | 
			
		||||
    await TestBed.configureTestingModule({
 | 
			
		||||
      declarations: [ HelpMenuComponent ]
 | 
			
		||||
    })
 | 
			
		||||
    .compileComponents();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  beforeEach(() => {
 | 
			
		||||
    fixture = TestBed.createComponent(HelpMenuComponent);
 | 
			
		||||
    component = fixture.componentInstance;
 | 
			
		||||
    fixture.detectChanges();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('should create', () => {
 | 
			
		||||
    expect(component).toBeTruthy();
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
 | 
			
		||||
 | 
			
		||||
import { NotificationMenuComponent } from './notification-menu.component';
 | 
			
		||||
 | 
			
		||||
describe('NotificationMenuComponent', () => {
 | 
			
		||||
  let component: NotificationMenuComponent;
 | 
			
		||||
  let fixture: ComponentFixture<NotificationMenuComponent>;
 | 
			
		||||
 | 
			
		||||
  beforeEach(async () => {
 | 
			
		||||
    await TestBed.configureTestingModule({
 | 
			
		||||
      declarations: [ NotificationMenuComponent ]
 | 
			
		||||
    })
 | 
			
		||||
    .compileComponents();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  beforeEach(() => {
 | 
			
		||||
    fixture = TestBed.createComponent(NotificationMenuComponent);
 | 
			
		||||
    component = fixture.componentInstance;
 | 
			
		||||
    fixture.detectChanges();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('should create', () => {
 | 
			
		||||
    expect(component).toBeTruthy();
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
@@ -0,0 +1,61 @@
 | 
			
		||||
import {AfterViewInit, Directive, Input, OnDestroy, TemplateRef, ViewContainerRef} from '@angular/core';
 | 
			
		||||
import {Subscription} from 'rxjs';
 | 
			
		||||
import {PackageService} from '../../services/package.service';
 | 
			
		||||
import * as appCommonReducer from '../../reducers/app-common.reducer';
 | 
			
		||||
import {Store} from '@ngrx/store';
 | 
			
		||||
 | 
			
		||||
@Directive({
 | 
			
		||||
  selector: '[fmPackageExists]',
 | 
			
		||||
})
 | 
			
		||||
export class PackageExistsDirective implements OnDestroy, AfterViewInit {
 | 
			
		||||
 | 
			
		||||
  @Input()
 | 
			
		||||
  set fmPackageExists(packageIdentifier: string) {
 | 
			
		||||
    this.packageIdentifier = packageIdentifier;
 | 
			
		||||
    this.updateView();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Input()
 | 
			
		||||
  set fmPackageExistsThen(thenTemplate: TemplateRef<any>) {
 | 
			
		||||
    this.thenTemplate = thenTemplate;
 | 
			
		||||
    this.updateView();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @Input()
 | 
			
		||||
  set fmPackageExistsElse(thenTemplate: TemplateRef<any>) {
 | 
			
		||||
    this.elseTemplate = thenTemplate;
 | 
			
		||||
    this.updateView();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private packageIdentifier: string;
 | 
			
		||||
  private thenTemplate: TemplateRef<any>;
 | 
			
		||||
  private elseTemplate: TemplateRef<any>;
 | 
			
		||||
  private packSub: Subscription;
 | 
			
		||||
 | 
			
		||||
  constructor(private hostTemplateRef: TemplateRef<any>, private viewContainerRef: ViewContainerRef,
 | 
			
		||||
              private store: Store<appCommonReducer.State>, private packageService: PackageService) {
 | 
			
		||||
    this.thenTemplate = hostTemplateRef;
 | 
			
		||||
    this.packSub = this.store.select(appCommonReducer.SelectGetPackages).subscribe((_) => {
 | 
			
		||||
      this.updateView();
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngAfterViewInit() {
 | 
			
		||||
    this.updateView();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  updateView() {
 | 
			
		||||
    this.viewContainerRef.clear();
 | 
			
		||||
    if (this.packageService.packageExists(this.packageIdentifier)) {
 | 
			
		||||
      this.viewContainerRef.createEmbeddedView(this.thenTemplate);
 | 
			
		||||
    } else if (this.elseTemplate) {
 | 
			
		||||
      this.viewContainerRef.createEmbeddedView(this.elseTemplate);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ngOnDestroy() {
 | 
			
		||||
    if (this.packSub) {
 | 
			
		||||
      this.packSub.unsubscribe();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
      <div class="card-header  p-3 bg-primary text-white">
 | 
			
		||||
        <span *ngIf="uploadService.isUploading">Uploading files (<span>{{uploadService.totalProgress | number:'1.1-1'}}</span> %)</span>
 | 
			
		||||
        <span *ngIf="uploadService.isUploading == false">Uploaded <span>{{uploadService.files.length}}</span> files</span>
 | 
			
		||||
        <span title="Cancel" class="fal fa-times float-right" (click)="uploadService.close()"></span><span title="Minimize" class="fal fa-chevron-down float-right mr-2" (click)="uploadService.toggleMinimize()" [ngClass]="{'fa-chevron-down': uploadService.isMinimized == false, 'fa-chevron-up':uploadService.isMinimized}"></span>
 | 
			
		||||
        <span title="Cancel" class="fal fa-times float-end" (click)="uploadService.close()"></span><span title="Minimize" class="fal fa-chevron-down float-end me-2" (click)="uploadService.toggleMinimize()" [ngClass]="{'fa-chevron-down': uploadService.isMinimized == false, 'fa-chevron-up':uploadService.isMinimized}"></span>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div [ngClass]="{'minimized': uploadService.isMinimized }">
 | 
			
		||||
        <div class="card-block p-3">
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@ div.card-header span.fa {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
.upload-file.busy > div > span.fa-times {
 | 
			
		||||
  color: theme-color("danger");
 | 
			
		||||
  color: $danger;
 | 
			
		||||
  width: 20px;
 | 
			
		||||
  display: inline-block;
 | 
			
		||||
  vertical-align: middle;
 | 
			
		||||
@@ -94,7 +94,7 @@ div.card-header span.fa {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  .upload-file > div.errormessage {
 | 
			
		||||
    color: theme-color("danger");
 | 
			
		||||
    color: $danger;
 | 
			
		||||
    display: none;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -89,7 +89,7 @@ export class ResumableFileUploadService implements OnDestroy{
 | 
			
		||||
  addFiles = (files: any[], event: any, metadata:any) => {
 | 
			
		||||
    for (let f of files) {
 | 
			
		||||
      var options:UploadxOptions = {metadata:metadata};
 | 
			
		||||
      this.uploadService.handleFile(f,options);
 | 
			
		||||
      this.uploadService.handleFiles(f,options);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
<div class="side-panel hidden" [ngClass]="{'hidden':!visible,'collapsed':collapsed,'resizeable':(resizeable && mobile),'resizing':resizing,'left':left}" [ngStyle]="{'top':top}">
 | 
			
		||||
  <div *ngIf="collapsable" class="arrow rounded-right p-2" (click)="handleToggleClick($event)">
 | 
			
		||||
  <div *ngIf="collapsable" class="arrow rounded-end p-2" (click)="handleToggleClick($event)">
 | 
			
		||||
    <i class="fal fa-chevron-left" aria-hidden="true"></i>
 | 
			
		||||
  </div>
 | 
			
		||||
  <div  draggable="true" class="resizegrip" (dragstart)="handleStartGripDrag($event)" (touchstart)="handleStartGripDrag($event)" (dragend)="handleEndGripDrag()" (touchend)="handleEndGripDrag()" (drag)="handleGripDrag($event)" (touchmove)="handleGripDrag($event)">
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { Component, Input,ViewChild,ElementRef,OnChanges,SimpleChanges,HostListener,ChangeDetectorRef  } from '@angular/core';
 | 
			
		||||
import { Component, Input,Output,ViewChild,EventEmitter, ElementRef,OnChanges,SimpleChanges,HostListener,ChangeDetectorRef  } from '@angular/core';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'fm-side-panel',
 | 
			
		||||
@@ -12,7 +12,8 @@ export class SidePanelComponent  implements OnChanges {
 | 
			
		||||
  @Input() public collapsed: boolean;
 | 
			
		||||
  @Input() public collapsable: boolean;
 | 
			
		||||
  @Input() public resizeable: boolean = false;
 | 
			
		||||
  @Input() public left: boolean = false;
 | 
			
		||||
  @Input() public left: boolean = false;  
 | 
			
		||||
  @Output() onResize: EventEmitter<number> = new EventEmitter<number>();
 | 
			
		||||
  @ViewChild("resizeGrip") elementView: ElementRef;
 | 
			
		||||
  public mobile:boolean = true;
 | 
			
		||||
  private parentHeight:number = 0;
 | 
			
		||||
@@ -35,6 +36,7 @@ export class SidePanelComponent  implements OnChanges {
 | 
			
		||||
  setTop() {
 | 
			
		||||
    this.mobile = this.left?false: this.checkMobile();
 | 
			
		||||
    this.resizeTop = this.mobile?50:0;
 | 
			
		||||
    this.onResize.emit(this.resizeTop);
 | 
			
		||||
    this.top =  (this.visible?this.resizeTop: (this.mobile? 100:0)) + "%";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -71,6 +73,7 @@ export class SidePanelComponent  implements OnChanges {
 | 
			
		||||
      clientY=(event as DragEvent).clientY;
 | 
			
		||||
    }
 | 
			
		||||
    this.resizeTop =  Math.min(98, Math.max(0, clientY / (this.parentHeight  / 100)));
 | 
			
		||||
    this.onResize.emit(this.resizeTop);
 | 
			
		||||
    this.top =  (this.visible? this.resizeTop:(this.mobile? 100:0)) + "%";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -81,7 +84,7 @@ export class SidePanelComponent  implements OnChanges {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @HostListener('window:resize', ['$event'])
 | 
			
		||||
  onResize(event) {
 | 
			
		||||
  handleResize(event) {
 | 
			
		||||
    this.setTop();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,11 @@
 | 
			
		||||
<div class="tags">
 | 
			
		||||
  <span class="tag rounded bg-primary text-white" *ngFor="let tag of tags;"><span>{{tag}}</span> <i (click)="handleDeleteTag(tag)" class="fal fa-times" aria-hidden="true"></i></span><input type="text" #taginput (blur)="handleAddTag($event)" (keyup)="handleCheckAddTag($event)" [(ngModel)]="tag" [ngbTypeahead]="findTag" (selectItem)="handleSelect($event)" placeholder="New tag"/>
 | 
			
		||||
</div>
 | 
			
		||||
<div class="tags">
 | 
			
		||||
  <span class="tag rounded bg-primary text-white" *ngFor="let tag of tags;"><span>{{tag}}</span> <i
 | 
			
		||||
    (click)="handleDeleteTag(tag)" class="fal fa-times" aria-hidden="true"></i></span><input
 | 
			
		||||
  type="text" #tagInputElement
 | 
			
		||||
  (blur)="handleBlur($event, false)"
 | 
			
		||||
  (keyup)="handleKeyUp($event)"
 | 
			
		||||
  [(ngModel)]="tag"
 | 
			
		||||
  [ngbTypeahead]="findTag"
 | 
			
		||||
  (selectItem)="handleSelect($event)"
 | 
			
		||||
  placeholder="New tag"/>
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,104 +1,122 @@
 | 
			
		||||
import { Component, Input, forwardRef,ElementRef,ViewChild } from '@angular/core';
 | 
			
		||||
import { ControlValueAccessor, NG_VALUE_ACCESSOR,NgModel } from '@angular/forms';
 | 
			
		||||
import { Observable,of } from 'rxjs';
 | 
			
		||||
import { tap,catchError,debounceTime,distinctUntilChanged,switchMap } from 'rxjs/operators'
 | 
			
		||||
import { TypeaheadService } from '../../services/typeahead.service';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'fm-tag-input',
 | 
			
		||||
  templateUrl: 'tag-input.component.html',
 | 
			
		||||
  styleUrls: ['tag-input.component.scss'],
 | 
			
		||||
  providers: [
 | 
			
		||||
    {
 | 
			
		||||
      provide: NG_VALUE_ACCESSOR,
 | 
			
		||||
      useExisting: forwardRef(() => TagInputComponent),
 | 
			
		||||
      multi: true
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
export class TagInputComponent implements ControlValueAccessor  {
 | 
			
		||||
  @Input() tags: string[]
 | 
			
		||||
  @ViewChild('taginput', { static: true }) tagInputElement: ElementRef;
 | 
			
		||||
  public tag: string;
 | 
			
		||||
  searching = false;
 | 
			
		||||
  searchFailed = false;
 | 
			
		||||
 | 
			
		||||
  constructor(private typeaheadService: TypeaheadService) {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  tagExists(tag) {
 | 
			
		||||
    if (tag.length == 0) return true;
 | 
			
		||||
    for (let t of this.tags) {
 | 
			
		||||
      if (t.toLowerCase() == tag.toLowerCase()) return true;
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleDeleteTag(tag) {
 | 
			
		||||
    let tags = [];
 | 
			
		||||
    for (let t of this.tags) {
 | 
			
		||||
      if (t != tag) tags.push(t);
 | 
			
		||||
    }
 | 
			
		||||
    this.tags = tags;
 | 
			
		||||
    this.propagateChange(tags);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleAddTag(event) {
 | 
			
		||||
    if (!this.tagExists(this.tag)) {
 | 
			
		||||
      this.tags.push(this.tag);
 | 
			
		||||
      this.propagateChange(this.tags);
 | 
			
		||||
    }
 | 
			
		||||
    this.tag = "";
 | 
			
		||||
    this.tagInputElement.nativeElement.focus();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleCheckAddTag(event: KeyboardEvent) {
 | 
			
		||||
    if (event.keyCode == 188) {
 | 
			
		||||
      let tag = this.tag.substr(0, this.tag.length - 1); // strip ,
 | 
			
		||||
      if (!this.tagExists(tag)) {
 | 
			
		||||
        this.tags.push(tag);
 | 
			
		||||
        this.propagateChange(this.tags);
 | 
			
		||||
      }
 | 
			
		||||
      this.tag = "";
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleSelect(event) {
 | 
			
		||||
    if (!this.tagExists(event.item)) {
 | 
			
		||||
      this.tags.push(event.item);
 | 
			
		||||
      this.propagateChange(this.tags);
 | 
			
		||||
    }
 | 
			
		||||
    event.preventDefault();
 | 
			
		||||
    this.tag = "";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  propagateChange = (_: any) => { };
 | 
			
		||||
 | 
			
		||||
  registerOnChange(fn) {
 | 
			
		||||
    this.propagateChange = fn;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  findTag = (text$: Observable<string>) =>
 | 
			
		||||
  text$.pipe(
 | 
			
		||||
        debounceTime(200),
 | 
			
		||||
        distinctUntilChanged(), 
 | 
			
		||||
        tap(() => this.searching = true),
 | 
			
		||||
        switchMap(term => term.length < 1 ? of([]) :
 | 
			
		||||
           this.typeaheadService.getTagTypeaheadItems(term).pipe(
 | 
			
		||||
            tap(() => this.searchFailed = false),
 | 
			
		||||
            catchError(() => {
 | 
			
		||||
                this.searchFailed = true;
 | 
			
		||||
                return of([]);
 | 
			
		||||
            }))
 | 
			
		||||
         ),
 | 
			
		||||
         tap(() => this.searching = false)
 | 
			
		||||
  );
 | 
			
		||||
 | 
			
		||||
  writeValue(value: any) {
 | 
			
		||||
    this.tags = value;
 | 
			
		||||
    this.tag = "";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  registerOnTouched() { }
 | 
			
		||||
}
 | 
			
		||||
import {Component, ElementRef, forwardRef, Input, ViewChild} from '@angular/core';
 | 
			
		||||
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
 | 
			
		||||
import {Observable, of} from 'rxjs';
 | 
			
		||||
import {catchError, debounceTime, distinctUntilChanged, switchMap, tap} from 'rxjs/operators';
 | 
			
		||||
import {TypeaheadService} from '../../services/typeahead.service';
 | 
			
		||||
import {NgbTypeahead} from '@ng-bootstrap/ng-bootstrap';
 | 
			
		||||
 | 
			
		||||
@Component({
 | 
			
		||||
  selector: 'fm-tag-input',
 | 
			
		||||
  templateUrl: 'tag-input.component.html',
 | 
			
		||||
  styleUrls: ['tag-input.component.scss'],
 | 
			
		||||
  providers: [
 | 
			
		||||
    {
 | 
			
		||||
      provide: NG_VALUE_ACCESSOR,
 | 
			
		||||
      useExisting: forwardRef(() => TagInputComponent),
 | 
			
		||||
      multi: true
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
export class TagInputComponent implements ControlValueAccessor {
 | 
			
		||||
  @Input() tags: string[] = [];
 | 
			
		||||
  @ViewChild('tagInputElement', {static: true}) tagInputElement: ElementRef;
 | 
			
		||||
  @ViewChild(NgbTypeahead, {static: true}) typeahead: NgbTypeahead;
 | 
			
		||||
 | 
			
		||||
  public tag: string;
 | 
			
		||||
  searching = false;
 | 
			
		||||
  searchFailed = false;
 | 
			
		||||
 | 
			
		||||
  constructor(private typeaheadService: TypeaheadService) {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  tagExists(tag) {
 | 
			
		||||
    if (tag.length === 0) {
 | 
			
		||||
      return true;
 | 
			
		||||
    }
 | 
			
		||||
    for (const t of this.tags) {
 | 
			
		||||
      if (t.toLowerCase() === tag.toLowerCase()) {
 | 
			
		||||
        return true;
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  addTag(tag, keepFocus = true) {
 | 
			
		||||
    if (!this.tagExists(tag)) {
 | 
			
		||||
      this.tags.push(tag);
 | 
			
		||||
      this.propagateChange(this.tags);
 | 
			
		||||
    }
 | 
			
		||||
    this.tag = '';
 | 
			
		||||
 | 
			
		||||
    if (keepFocus) {
 | 
			
		||||
      this.tagInputElement.nativeElement.focus();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleDeleteTag(tag) {
 | 
			
		||||
    const tags = [];
 | 
			
		||||
    for (const t of this.tags) {
 | 
			
		||||
      if (t !== tag) {
 | 
			
		||||
        tags.push(t);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    this.tags = tags;
 | 
			
		||||
    this.propagateChange(tags);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleBlur(event, keepFocus = true) {
 | 
			
		||||
    if (!this.typeahead.isPopupOpen()) {
 | 
			
		||||
      this.addTag(this.tag, keepFocus);
 | 
			
		||||
    } else {
 | 
			
		||||
      this.tag = '';
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleKeyUp(event: KeyboardEvent) {
 | 
			
		||||
    if (event.keyCode === 188) {
 | 
			
		||||
      const tag = this.tag.substr(0, this.tag.length - 1); // strip ,
 | 
			
		||||
      this.addTag(tag);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  handleSelect(event) {
 | 
			
		||||
    if (!this.tagExists(event.item)) {
 | 
			
		||||
      this.tags.push(event.item);
 | 
			
		||||
      this.propagateChange(this.tags);
 | 
			
		||||
    }
 | 
			
		||||
    event.preventDefault();
 | 
			
		||||
    this.tag = '';
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  propagateChange = (_: any) => {
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  registerOnChange(fn) {
 | 
			
		||||
    this.propagateChange = fn;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  findTag = (text$: Observable<string>) =>
 | 
			
		||||
    text$.pipe(
 | 
			
		||||
      distinctUntilChanged(),
 | 
			
		||||
      debounceTime(200),
 | 
			
		||||
      tap(() => this.searching = true),
 | 
			
		||||
      switchMap(term => term.length < 1 ? of([]) :
 | 
			
		||||
        this.typeaheadService.getTagTypeaheadItems(term).pipe(
 | 
			
		||||
          tap(() => this.searchFailed = false),
 | 
			
		||||
          catchError(() => {
 | 
			
		||||
            this.searchFailed = true;
 | 
			
		||||
            return of([]);
 | 
			
		||||
          }))
 | 
			
		||||
      ),
 | 
			
		||||
      tap(() => this.searching = false)
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
  writeValue(value: any) {
 | 
			
		||||
    this.tags = value;
 | 
			
		||||
    this.tag = '';
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  registerOnTouched() {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@
 | 
			
		||||
   <div class="popover-anchor" [style.left.px] = "endPopoverLeft" [ngbPopover]="popoverContent" #popoverEnd="ngbPopover"> </div>
 | 
			
		||||
   <div class="collapsed clearfix" [ngClass]="{'collapsed':collapsed}">
 | 
			
		||||
     <!-- <div class="clearfix">
 | 
			
		||||
        <select class="form-control float-right" [value]="unitScale">
 | 
			
		||||
        <select class="form-control float-end" [value]="unitScale">
 | 
			
		||||
            <option value="0">Millisecond</option>
 | 
			
		||||
            <option value="1">Second</option>
 | 
			
		||||
            <option value="2">Minute</option>
 | 
			
		||||
@@ -21,9 +21,9 @@
 | 
			
		||||
        <canvas #timeLine (mousedown)="handleViewPanMouseDown($event)" (touchstart)="handleViewPanMouseDown($event)" (mousemove)="handleCanvasMouseMove($event)" (mouseleave)="handleCanvasMouseLeave($event)">
 | 
			
		||||
        </canvas>
 | 
			
		||||
        <div class="control-container"  [style.margin-left.px]="marginLeft" [style.height.px]="lineHeight" >
 | 
			
		||||
            <div class="leftGrip rounded-left" (mousedown)="handleLeftGripMouseDown($event)" (touchstart)="handleLeftGripMouseDown($event)"   (mouseenter)="handleLeftGripMouseEnter($event)" (mouseleave)="handleLeftGripMouseLeave($event)"><i class="fal fa-ellipsis-v" aria-hidden="true"></i></div>
 | 
			
		||||
            <div class="leftGrip rounded-start" (mousedown)="handleLeftGripMouseDown($event)" (touchstart)="handleLeftGripMouseDown($event)"   (mouseenter)="handleLeftGripMouseEnter($event)" (mouseleave)="handleLeftGripMouseLeave($event)"><i class="fal fa-ellipsis-v" aria-hidden="true"></i></div>
 | 
			
		||||
            <div class="range" [style.width.px]="rangeWidth" (mousedown)="handleRangeGripMouseDown($event)" (touchstart)="handleRangeGripMouseDown($event)" (mouseenter)="handleRangeGripMouseEnter($event)"></div>
 | 
			
		||||
            <div class="rightGrip rounded-right" (mousedown)="handleRightGripMouseDown($event)" (touchstart)="handleRightGripMouseDown($event)" (mouseenter)="handleRightGripMouseEnter($event)" (mouseleave)="handleRightGripMouseLeave($event)"><i class="fal fa-ellipsis-v" aria-hidden="true"></i></div>
 | 
			
		||||
            <div class="rightGrip rounded-end" (mousedown)="handleRightGripMouseDown($event)" (touchstart)="handleRightGripMouseDown($event)" (mouseenter)="handleRightGripMouseEnter($event)" (mouseleave)="handleRightGripMouseLeave($event)"><i class="fal fa-ellipsis-v" aria-hidden="true"></i></div>
 | 
			
		||||
        </div>
 | 
			
		||||
     </div>
 | 
			
		||||
     <!-- <div>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
			
		||||
 | 
			
		||||
import { UserMenuComponent } from './user-menu.component';
 | 
			
		||||
 | 
			
		||||
describe('UserMenuComponent', () => {
 | 
			
		||||
  let component: UserMenuComponent;
 | 
			
		||||
  let fixture: ComponentFixture<UserMenuComponent>;
 | 
			
		||||
 | 
			
		||||
  beforeEach(async(() => {
 | 
			
		||||
    TestBed.configureTestingModule({
 | 
			
		||||
      declarations: [ UserMenuComponent ]
 | 
			
		||||
    })
 | 
			
		||||
    .compileComponents();
 | 
			
		||||
  }));
 | 
			
		||||
 | 
			
		||||
  beforeEach(() => {
 | 
			
		||||
    fixture = TestBed.createComponent(UserMenuComponent);
 | 
			
		||||
    component = fixture.componentInstance;
 | 
			
		||||
    fixture.detectChanges();
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('should create', () => {
 | 
			
		||||
    expect(component).toBeTruthy();
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
@@ -62,6 +62,15 @@ export class AppCommonEffects {
 | 
			
		||||
      )
 | 
			
		||||
    })
 | 
			
		||||
  ));
 | 
			
		||||
  initPackages$ =  createEffect(() => this.actions$.pipe(
 | 
			
		||||
    ofType(appCommonActions.INITPACKAGES),
 | 
			
		||||
    switchMap(() => {
 | 
			
		||||
      return this.itemService$.getItemList('vnd.farmmaps.itemtype.package.template').pipe(
 | 
			
		||||
        switchMap((items) => of(new appCommonActions.InitPackagesSuccess(items))),
 | 
			
		||||
        catchError(error =>  of(new appCommonActions.Fail(error)))
 | 
			
		||||
      )
 | 
			
		||||
    })
 | 
			
		||||
  ));
 | 
			
		||||
 | 
			
		||||
  userPackagesChanged$ =  createEffect(() => this.actions$.pipe(
 | 
			
		||||
    ofType(appCommonActions.ITEMCHANGEDEVENT),
 | 
			
		||||
@@ -99,7 +108,7 @@ export class AppCommonEffects {
 | 
			
		||||
  initUserSuccess$ =  createEffect(() => this.actions$.pipe(
 | 
			
		||||
    ofType(appCommonActions.INITUSERSUCCESS),
 | 
			
		||||
    switchMap(() => {
 | 
			
		||||
      return [new appCommonActions.InitRoot(),new appCommonActions.InitUserPackages(),new appCommonActions.InitUserSettingsRoot()];
 | 
			
		||||
      return [new appCommonActions.InitRoot(),new appCommonActions.InitUserPackages(),new appCommonActions.InitPackages(),new appCommonActions.InitUserSettingsRoot()];
 | 
			
		||||
    }
 | 
			
		||||
    )));
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,5 +7,10 @@ export interface IPackage {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPackages {
 | 
			
		||||
    [id: string]: IPackage[];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export interface IPackageMap {
 | 
			
		||||
    [id: string]: IPackage;
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
export interface IQueryState {
 | 
			
		||||
  itemCode: string;
 | 
			
		||||
  parentCode: string;
 | 
			
		||||
  dataFilter?: string;
 | 
			
		||||
  level: number;
 | 
			
		||||
  itemType: string;
 | 
			
		||||
  query: string;
 | 
			
		||||
 
 | 
			
		||||
@@ -2,12 +2,13 @@ import { tassign } from 'tassign';
 | 
			
		||||
import { IItemTypes} from '../models/item.types';
 | 
			
		||||
import { IListItem } from '../models/list.item';
 | 
			
		||||
import { IUser } from '../models/user';
 | 
			
		||||
import { IPackage,IPackages} from '../models/package';
 | 
			
		||||
import { IPackage,IPackageMap,IPackages} from '../models/package';
 | 
			
		||||
import * as appCommonActions from '../actions/app-common.actions';
 | 
			
		||||
import { createSelector, createFeatureSelector, ActionReducerMap } from '@ngrx/store';
 | 
			
		||||
 | 
			
		||||
import { MODULE_NAME } from '../module-name';
 | 
			
		||||
import { IItem } from '../models/item';
 | 
			
		||||
import {getValidPackages, isValidPackage} from '../services/package.service';
 | 
			
		||||
 | 
			
		||||
export interface State {
 | 
			
		||||
  openedModalName: string,
 | 
			
		||||
@@ -19,6 +20,7 @@ export interface State {
 | 
			
		||||
  routeLoading:boolean,
 | 
			
		||||
  menuVisible: boolean,
 | 
			
		||||
  userPackages: IPackages,
 | 
			
		||||
  packages: IPackageMap,
 | 
			
		||||
  userSettingsRoot: IItem,
 | 
			
		||||
  accountMenuVisible: boolean,
 | 
			
		||||
  appMenuVisible: boolean,
 | 
			
		||||
@@ -39,6 +41,7 @@ export const initialState: State = {
 | 
			
		||||
  routeLoading: false,
 | 
			
		||||
  menuVisible: false,
 | 
			
		||||
  userPackages: {},
 | 
			
		||||
  packages: {},
 | 
			
		||||
  userSettingsRoot: null,
 | 
			
		||||
  accountMenuVisible: false,
 | 
			
		||||
  appMenuVisible: false,
 | 
			
		||||
@@ -57,16 +60,16 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
 | 
			
		||||
    case appCommonActions.INITUSERSUCCESS: {
 | 
			
		||||
      let a = action as appCommonActions.InitUserSuccess;
 | 
			
		||||
      let claims = {}
 | 
			
		||||
      Object.getOwnPropertyNames(a.userinfo).forEach((k) => {
 | 
			
		||||
      Object.getOwnPropertyNames(a.userinfo.info).forEach((k) => {
 | 
			
		||||
         claims[k] = a.userinfo[k];
 | 
			
		||||
      });
 | 
			
		||||
      var user:IUser = {
 | 
			
		||||
        code:a.user.code,
 | 
			
		||||
        email:a.userinfo["email"],
 | 
			
		||||
        name:a.userinfo["name"],
 | 
			
		||||
        email:claims["email"]!== undefined ? claims["email"] : a.user.name,
 | 
			
		||||
        name:claims["name"]!== undefined?claims["name"] : a.user.email,
 | 
			
		||||
        claims:claims,
 | 
			
		||||
        searchable: false
 | 
			
		||||
      };     
 | 
			
		||||
      };
 | 
			
		||||
      return tassign(state, { user: user });
 | 
			
		||||
    }
 | 
			
		||||
    case appCommonActions.INITROOTSUCCESS: {
 | 
			
		||||
@@ -75,10 +78,10 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
 | 
			
		||||
    }
 | 
			
		||||
    case appCommonActions.OPENMODAL: {
 | 
			
		||||
      return tassign(state, { openedModalName: action.modalName });
 | 
			
		||||
    }      
 | 
			
		||||
    }
 | 
			
		||||
    case appCommonActions.CLOSEMODAL: {
 | 
			
		||||
      return tassign(state, { openedModalName: null });
 | 
			
		||||
    }    
 | 
			
		||||
    }
 | 
			
		||||
    case appCommonActions.LOADITEMTYPESSUCCESS: {
 | 
			
		||||
      let a = action as appCommonActions.LoadItemTypesSuccess;
 | 
			
		||||
      return tassign(state, { itemTypes: a.itemTypes });
 | 
			
		||||
@@ -131,11 +134,23 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
 | 
			
		||||
      a.items.forEach((item) => {
 | 
			
		||||
        item.data.dataDate = item.dataDate;
 | 
			
		||||
        item.data.dataEndDate = item.dataEndDate;
 | 
			
		||||
        packages[item.data.id]=item.data;
 | 
			
		||||
        if (!packages[item.data.id]) {
 | 
			
		||||
          packages[item.data.id] = [];
 | 
			
		||||
        }
 | 
			
		||||
        packages[item.data.id].push(item.data);
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      return tassign(state,{userPackages:packages});
 | 
			
		||||
    }
 | 
			
		||||
    case appCommonActions.INITPACKAGESSUCCESS:{
 | 
			
		||||
      let a = action as appCommonActions.InitPackagesSuccess;
 | 
			
		||||
      let packages = {}
 | 
			
		||||
      a.items.forEach((item) => {
 | 
			
		||||
        packages[item.data.id] = item.data;
 | 
			
		||||
      });
 | 
			
		||||
 | 
			
		||||
      return tassign(state,{packages:packages});
 | 
			
		||||
    }
 | 
			
		||||
    case appCommonActions.INITUSERSETTINGSROOTSUCCESS:{
 | 
			
		||||
      let a = action as appCommonActions.InitUserSettingsRootSuccess;
 | 
			
		||||
      return tassign(state, { userSettingsRoot : a.item });
 | 
			
		||||
@@ -183,6 +198,7 @@ export const getRouteLoading = (state: State) => state.routeLoading;
 | 
			
		||||
export const getMenuVisible = (state: State) => state.menuVisible;
 | 
			
		||||
export const getUser = (state: State) => state.user;
 | 
			
		||||
export const getUserPackages = (state: State) => state.userPackages;
 | 
			
		||||
export const getPackages = (state: State) => state.packages;
 | 
			
		||||
export const getUserSettingsRoot = (state: State) => state.userSettingsRoot;
 | 
			
		||||
export const getAccountMenuVisible = (state: State) => state.accountMenuVisible;
 | 
			
		||||
export const getAppMenuVisible = (state: State) => state.appMenuVisible;
 | 
			
		||||
@@ -203,6 +219,10 @@ export const selectGetRouteLoading = createSelector(selectAppCommonState, getRou
 | 
			
		||||
export const SelectGetMenuVisible = createSelector(selectAppCommonState,getMenuVisible);
 | 
			
		||||
export const SelectGetUser = createSelector(selectAppCommonState,getUser);
 | 
			
		||||
export const SelectGetUserPackages = createSelector(selectAppCommonState,getUserPackages);
 | 
			
		||||
export const SelectGetPackages = createSelector(selectAppCommonState,getPackages);
 | 
			
		||||
export const SelectGetValidUserPackages = createSelector(SelectGetUserPackages, (packageMap) => {
 | 
			
		||||
  return getValidPackages(packageMap);
 | 
			
		||||
});
 | 
			
		||||
export const SelectGetUserSettingsRoot = createSelector(selectAppCommonState,getUserSettingsRoot);
 | 
			
		||||
export const SelectGetAccountMenuVisible = createSelector(selectAppCommonState,getAccountMenuVisible);
 | 
			
		||||
export const SelectGetAppMenuVisible = createSelector(selectAppCommonState,getAppMenuVisible);
 | 
			
		||||
@@ -213,3 +233,4 @@ export const SelectgetUnreadNotifications = createSelector(selectAppCommonState,
 | 
			
		||||
export const SelectGetIsOnline = createSelector(selectAppCommonState,getIsOnline);
 | 
			
		||||
export const SelectGetIsPageMode = createSelector(selectAppCommonState,getIsPageMode);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										25
									
								
								projects/common/src/fm/services/gradient.service.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								projects/common/src/fm/services/gradient.service.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
import { Injectable } from '@angular/core';
 | 
			
		||||
import {IGradientstop } from '../models/gradient'
 | 
			
		||||
 | 
			
		||||
@Injectable({
 | 
			
		||||
  providedIn: 'root',
 | 
			
		||||
})
 | 
			
		||||
export class GradientService {
 | 
			
		||||
  constructor() {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getGradientStyle(gradient:IGradientstop[],portrait:boolean = false ):any {
 | 
			
		||||
      let gd = '{ "background": "linear-gradient(to ' + (portrait?'bottom':'right') +',';
 | 
			
		||||
      for(var i=0;i<gradient.length;i++) {
 | 
			
		||||
        let gs = gradient[i];
 | 
			
		||||
        if(i>0) gd+=",";
 | 
			
		||||
        gd += `rgba(${gs.color.red},${gs.color.green},${gs.color.blue},${gs.color.alpha/255})`;          
 | 
			
		||||
        gd +=` ${gs.relativestop*100}%`
 | 
			
		||||
      }
 | 
			
		||||
      gradient.forEach((gs) => {
 | 
			
		||||
      });
 | 
			
		||||
      gd+=')"}';
 | 
			
		||||
      
 | 
			
		||||
      return JSON.parse(gd);
 | 
			
		||||
    }  
 | 
			
		||||
}
 | 
			
		||||
@@ -24,7 +24,7 @@ export class ItemService {
 | 
			
		||||
    return this.httpClient.get<{ [id: string]: IItemType }>(`${this.ApiEndpoint()}/api/v1/itemtypes/`);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getFeatures(extent: number[], crs: string, searchText?: string, searchTags?:string,startDate?:Date,endDate?:Date,itemType?:string,parentCode?:string,dataFilter?:string,level?:number): Observable<any> {
 | 
			
		||||
  getFeatures(extent: number[], crs: string, searchText?: string, searchTags?:string,startDate?:Date,endDate?:Date,itemType?:string,parentCode?:string,dataFilter?:string,level?:number,indexed?:boolean): Observable<any> {
 | 
			
		||||
    var params = new HttpParams();
 | 
			
		||||
    params = params.append("crs", crs);
 | 
			
		||||
    if (extent) params =params.append("bbox", extent.join(","));
 | 
			
		||||
@@ -42,6 +42,7 @@ export class ItemService {
 | 
			
		||||
    if (parentCode) params = params.append("pc", parentCode);
 | 
			
		||||
    if (dataFilter) params = params.append("df", dataFilter);
 | 
			
		||||
    if (level) params = params.append("lvl", level.toString());
 | 
			
		||||
    params = params.append("ind", indexed ?? true);
 | 
			
		||||
    return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/features/`, {params:params});
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -73,16 +74,17 @@ export class ItemService {
 | 
			
		||||
 | 
			
		||||
  getItemList(itemType?: string, dataFilter?: any, level?: number, atItemLocationItemCode?: string, indexed?: boolean, validToday?: boolean): Observable<IItem[]> {
 | 
			
		||||
    var params = new HttpParams();
 | 
			
		||||
    if(itemType)  params = params.append("it", itemType);   
 | 
			
		||||
    if(dataFilter) params = params.append("df", JSON.stringify(dataFilter));    
 | 
			
		||||
    if(atItemLocationItemCode) params = params.append("ail",atItemLocationItemCode);    
 | 
			
		||||
    if(indexed) params = params.append("ind",indexed?"true":"false");    
 | 
			
		||||
    if(itemType)  params = params.append("it", itemType);
 | 
			
		||||
    if(dataFilter) params = params.append("df", JSON.stringify(dataFilter));
 | 
			
		||||
    if(atItemLocationItemCode) params = params.append("ail",atItemLocationItemCode);
 | 
			
		||||
    if(indexed) params = params.append("ind",indexed?"true":"false");
 | 
			
		||||
    if (level) params = params.append("lvl", level.toFixed());
 | 
			
		||||
    if (validToday) params = params.append("vt", validToday ? "true" : "false");
 | 
			
		||||
    return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/`, { params: params });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  getChildItemList(parentcode: string, itemType: string, dataFilter?: any, level: number = 1, deep: boolean = true): Observable<IItem[]> {
 | 
			
		||||
  getChildItemList(parentcode: string, itemType: string, dataFilter?: any, level: number = 1, deep: boolean = true,
 | 
			
		||||
                   startDate?: Date, endDate?: Date): Observable<IItem[]> {
 | 
			
		||||
    var params = new HttpParams();
 | 
			
		||||
    if(itemType != null) {
 | 
			
		||||
      params = params.append("it", itemType);
 | 
			
		||||
@@ -92,6 +94,8 @@ export class ItemService {
 | 
			
		||||
    }
 | 
			
		||||
    params = params.append("lvl", level.toString());
 | 
			
		||||
    params = params.append("deep", deep.toString());
 | 
			
		||||
    if (startDate) params = params.append("sDate", startDate.toISOString());
 | 
			
		||||
    if (endDate) params = params.append("eDate", endDate.toISOString());
 | 
			
		||||
    return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@@ -127,11 +131,11 @@ export class ItemService {
 | 
			
		||||
    else
 | 
			
		||||
      return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${code}/features`, { params: params });
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  postItem(item:IItem): Observable<IItem> {
 | 
			
		||||
    return this.httpClient.post<IItem>(`${this.ApiEndpoint()}/api/v1/items`,item);
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  putItem(item:IItem): Observable<IItem> {
 | 
			
		||||
    return this.httpClient.put<IItem>(`${this.ApiEndpoint()}/api/v1/items/${item.code}`,item);
 | 
			
		||||
  }
 | 
			
		||||
@@ -158,7 +162,7 @@ export class ItemService {
 | 
			
		||||
  postItemTask(item: IItem, task: IItemTask): Observable<IItemTask> {
 | 
			
		||||
    return this.httpClient.post<IItemTask>(`${this.ApiEndpoint()}/api/v1/items/${item.code}/tasks`, task);
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  getItemTaskList(itemcode: string, unfinishedOnly?: boolean): Observable<IItemTask[]> {
 | 
			
		||||
    var params = new HttpParams();
 | 
			
		||||
    if (unfinishedOnly) params = params.append("unfinishedOnly", unfinishedOnly.toString());
 | 
			
		||||
@@ -167,8 +171,8 @@ export class ItemService {
 | 
			
		||||
 | 
			
		||||
  getItemListUsingRelationship(itemType: string, relationshipItemType: string, relationshipDataFilter: any): Observable<IItem[]> {
 | 
			
		||||
    var params = new HttpParams();
 | 
			
		||||
    params = params.append("it", itemType);   
 | 
			
		||||
    params = params.append("rsit", relationshipItemType);   
 | 
			
		||||
    params = params.append("it", itemType);
 | 
			
		||||
    params = params.append("rsit", relationshipItemType);
 | 
			
		||||
    params = params.append("rsdf", JSON.stringify(relationshipDataFilter));
 | 
			
		||||
    return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/userelationship`, { params: params });
 | 
			
		||||
  }
 | 
			
		||||
@@ -177,4 +181,4 @@ export class ItemService {
 | 
			
		||||
    return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${itemCode}/value/layer/${layerIndex}?c=${x},${y}&crs=${crs}`);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										122
									
								
								projects/common/src/fm/services/package.service.spec.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										122
									
								
								projects/common/src/fm/services/package.service.spec.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,122 @@
 | 
			
		||||
import {getValidPackages, isValidPackage, PackageService} from './package.service';
 | 
			
		||||
import {MockStore, provideMockStore} from '@ngrx/store/testing';
 | 
			
		||||
import {TestBed} from '@angular/core/testing';
 | 
			
		||||
import * as appCommonReducer from '../reducers/app-common.reducer';
 | 
			
		||||
import {reducer, State} from '../reducers/app-common.reducer';
 | 
			
		||||
import * as appCommonActions from '../actions/app-common.actions';
 | 
			
		||||
import {IItem} from '../models/item';
 | 
			
		||||
import {IPackage} from '../models/package';
 | 
			
		||||
 | 
			
		||||
describe('PackageService', () => {
 | 
			
		||||
  const initialState = {userPackages: {}} as State;
 | 
			
		||||
  let serviceUnderTest: PackageService;
 | 
			
		||||
  let items;
 | 
			
		||||
 | 
			
		||||
  beforeEach(() => {
 | 
			
		||||
    TestBed.configureTestingModule({
 | 
			
		||||
      providers: [
 | 
			
		||||
        provideMockStore({
 | 
			
		||||
          initialState,
 | 
			
		||||
          selectors: [
 | 
			
		||||
            {
 | 
			
		||||
              selector: appCommonReducer.SelectGetValidUserPackages,
 | 
			
		||||
              value: {
 | 
			
		||||
                'vnd.farmmaps.package.zoning': {
 | 
			
		||||
                  id: 'vnd.farmmaps.package.zoning',
 | 
			
		||||
                  name: 'zoning package',
 | 
			
		||||
                  dataDate: '2022-01-25T00:00:00.000000Z'
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
          ]
 | 
			
		||||
        }),
 | 
			
		||||
      ]
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    const store = TestBed.inject(MockStore);
 | 
			
		||||
    serviceUnderTest = new PackageService(store, null, null);
 | 
			
		||||
 | 
			
		||||
    items = [
 | 
			
		||||
      {
 | 
			
		||||
        code: '123132',
 | 
			
		||||
        dataDate: '2021-01-25T00:00:00Z',
 | 
			
		||||
        dataEndDate: '2021-05-25T00:00:00Z',
 | 
			
		||||
        data: {
 | 
			
		||||
          id: 'vnd.farmmaps.package.zoning'
 | 
			
		||||
        }
 | 
			
		||||
      } as IItem,
 | 
			
		||||
      {
 | 
			
		||||
        code: '1231325',
 | 
			
		||||
        dataDate: '2021-01-25T00:00:00Z',
 | 
			
		||||
        dataEndDate: null,
 | 
			
		||||
        data: {
 | 
			
		||||
          id: 'vnd.farmmaps.package.zoning'
 | 
			
		||||
        }
 | 
			
		||||
      } as IItem,
 | 
			
		||||
      {
 | 
			
		||||
        code: '1231325',
 | 
			
		||||
        dataDate: '2022-01-25T00:00:00Z',
 | 
			
		||||
        dataEndDate: '2022-05-25T00:00:00Z',
 | 
			
		||||
        data: {
 | 
			
		||||
          id: 'vnd.farmmaps.package.tipstar'
 | 
			
		||||
        }
 | 
			
		||||
      } as IItem,
 | 
			
		||||
      {
 | 
			
		||||
        code: '1231325',
 | 
			
		||||
        dataDate: '2022-01-25T00:00:00Z',
 | 
			
		||||
        dataEndDate: null,
 | 
			
		||||
        data: {
 | 
			
		||||
          id: 'vnd.farmmaps.package.weather'
 | 
			
		||||
        }
 | 
			
		||||
      } as IItem
 | 
			
		||||
    ];
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('Does not have a tipstar package', () => {
 | 
			
		||||
    const hasPackage = serviceUnderTest.hasPackage('vnd.farmmaps.package.tipstar');
 | 
			
		||||
    expect(hasPackage).toBe(false);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('Does have a zoning package', () => {
 | 
			
		||||
    const hasPackage = serviceUnderTest.hasPackage('vnd.farmmaps.package.zoning');
 | 
			
		||||
    expect(hasPackage).toBe(true);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('reducer.INITUSERPACKAGESSUCCESS alter state correctly', () => {
 | 
			
		||||
    const action = new appCommonActions.InitUserPackagesSuccess(items);
 | 
			
		||||
 | 
			
		||||
    expect(Object.keys(initialState.userPackages).length).toBe(0);
 | 
			
		||||
    const state = reducer(initialState, action);
 | 
			
		||||
    expect(Object.keys(state.userPackages).length).toBe(3);
 | 
			
		||||
    expect(state.userPackages['vnd.farmmaps.package.zoning'].length).toBe(2);
 | 
			
		||||
    expect(state.userPackages['vnd.farmmaps.package.tipstar'].length).toBe(1);
 | 
			
		||||
    expect(state.userPackages['vnd.farmmaps.package.weather'].length).toBe(1);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('to validatePackage', () => {
 | 
			
		||||
    const action = new appCommonActions.InitUserPackagesSuccess(items);
 | 
			
		||||
    const state = reducer(initialState, action);
 | 
			
		||||
 | 
			
		||||
    expect(isValidPackage(null)).toBe(false);
 | 
			
		||||
    expect(isValidPackage(state.userPackages['vnd.farmmaps.package.tipstar'][0])).toBe(true);
 | 
			
		||||
    expect(isValidPackage(state.userPackages['vnd.farmmaps.package.zoning'][0])).toBe(false);
 | 
			
		||||
    expect(isValidPackage(state.userPackages['vnd.farmmaps.package.zoning'][1])).toBe(true);
 | 
			
		||||
    expect(isValidPackage(state.userPackages['vnd.farmmaps.package.weather'][0])).toBe(true);
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  it('to getValidPackages', () => {
 | 
			
		||||
    const action = new appCommonActions.InitUserPackagesSuccess(items);
 | 
			
		||||
    const state = reducer(initialState, action);
 | 
			
		||||
 | 
			
		||||
    const validPackages = getValidPackages(state.userPackages);
 | 
			
		||||
 | 
			
		||||
    expect(Object.keys(validPackages).length).toBe(3);
 | 
			
		||||
 | 
			
		||||
    // today is 27-01-2022, so the below package is not valid
 | 
			
		||||
    expect(validPackages['vnd.farmmaps.package.zoning']).not.toEqual({
 | 
			
		||||
      id: 'vnd.farmmaps.package.zoning',
 | 
			
		||||
      dataDate: '2021-01-25T00:00:00Z',
 | 
			
		||||
      dataEndDate: '2021-05-25T00:00:00Z'
 | 
			
		||||
    } as unknown as IPackage);
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,37 +1,77 @@
 | 
			
		||||
import { Injectable } from '@angular/core';
 | 
			
		||||
import { Store} from '@ngrx/store';
 | 
			
		||||
import * as appCommonReducer from '../reducers/app-common.reducer'
 | 
			
		||||
import { IPackages } from '../models/package';
 | 
			
		||||
import {Injectable} from '@angular/core';
 | 
			
		||||
import {Store} from '@ngrx/store';
 | 
			
		||||
import * as appCommonReducer from '../reducers/app-common.reducer';
 | 
			
		||||
import {IPackage, IPackages} from '../models/package';
 | 
			
		||||
 | 
			
		||||
import { IItem } from '../models/item';
 | 
			
		||||
import { IItemTask } from '../models/itemTask';
 | 
			
		||||
import { HttpClient } from "@angular/common/http";
 | 
			
		||||
import { AppConfig } from "../shared/app.config";
 | 
			
		||||
import { Observable } from 'rxjs';
 | 
			
		||||
import {IItem} from '../models/item';
 | 
			
		||||
import {IItemTask} from '../models/itemTask';
 | 
			
		||||
import {HttpClient} from '@angular/common/http';
 | 
			
		||||
import {AppConfig} from '../shared/app.config';
 | 
			
		||||
import {Observable,iif,of} from 'rxjs';
 | 
			
		||||
import {switchMap} from 'rxjs/operators';
 | 
			
		||||
 | 
			
		||||
@Injectable({
 | 
			
		||||
  providedIn: 'root',
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
export class PackageService {
 | 
			
		||||
    private packages$:IPackages = {};
 | 
			
		||||
  private userPackages: { [key: string]: IPackage } = {};
 | 
			
		||||
  private packages: { [key: string]: IPackage } = {};
 | 
			
		||||
  private packagesObservable = this.store$.select(appCommonReducer.SelectGetPackages);
 | 
			
		||||
 | 
			
		||||
    constructor(private store$: Store<appCommonReducer.State>, public httpClient: HttpClient, public appConfig: AppConfig) {
 | 
			
		||||
        store$.select(appCommonReducer.SelectGetUserPackages).subscribe((packages) => {
 | 
			
		||||
            this.packages$ = packages;
 | 
			
		||||
        })
 | 
			
		||||
    }
 | 
			
		||||
  constructor(private store$: Store<appCommonReducer.State>, public httpClient: HttpClient, public appConfig: AppConfig) {
 | 
			
		||||
    store$.select(appCommonReducer.SelectGetValidUserPackages).subscribe((packages) => {
 | 
			
		||||
      this.userPackages = packages;
 | 
			
		||||
    });
 | 
			
		||||
    this.packagesObservable.subscribe((packages) => {
 | 
			
		||||
      this.packages = packages;
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
    ApiEndpoint() {
 | 
			
		||||
        return this.appConfig.getConfig("apiEndPoint");
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    hasPackage(id:string):boolean {
 | 
			
		||||
       if(!this.packages$[id]) return false;
 | 
			
		||||
       return this.packages$[id].enabled ? this.packages$[id].enabled == true : true;
 | 
			
		||||
    }
 | 
			
		||||
  ApiEndpoint() {
 | 
			
		||||
    return this.appConfig.getConfig('apiEndPoint');
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
    postItemPackageTask(item: IItem, task: IItemTask): Observable<IItemTask> {
 | 
			
		||||
        return this.httpClient.post<IItemTask>(`${this.ApiEndpoint()}/api/v1/items/${item.code}/packagetasks`, task);
 | 
			
		||||
    } 
 | 
			
		||||
}
 | 
			
		||||
  hasPackage(id: string): boolean {
 | 
			
		||||
    return id in this.userPackages;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  packageExists(id: string): boolean {
 | 
			
		||||
    return id in this.packages;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  postItemPackageTask(item: IItem, task: IItemTask): Observable<IItemTask> {
 | 
			
		||||
    return this.httpClient.post<IItemTask>(`${this.ApiEndpoint()}/api/v1/items/${item.code}/packagetasks`, task);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ifPackageListExists<Type>(packageList: Array<string>, ifTrue:Observable<Type>,ifFalse:Observable<Type>):Observable<Type> {
 | 
			
		||||
    return this.packagesObservable.pipe(switchMap(packages => 
 | 
			
		||||
        iif(( )=> Object.keys(packages).some(id => packageList.includes(id)),
 | 
			
		||||
            ifTrue,
 | 
			
		||||
            ifFalse) 
 | 
			
		||||
    )); 
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function getValidPackages(packageMap: IPackages): {[key: string]: IPackage} {
 | 
			
		||||
  const keys = Object.keys(packageMap);
 | 
			
		||||
  return keys.filter(k => {
 | 
			
		||||
    const packages = packageMap[k]
 | 
			
		||||
      .filter((p) => isValidPackage(p));
 | 
			
		||||
 | 
			
		||||
    return packages.length > 0;
 | 
			
		||||
  }).reduce((map, key) => {
 | 
			
		||||
    const packages = packageMap[key];
 | 
			
		||||
    const newMap = {...map};
 | 
			
		||||
    newMap[key] = packages.find(p => isValidPackage(p));
 | 
			
		||||
    return newMap;
 | 
			
		||||
  }, {});
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function isValidPackage(pack: IPackage): boolean {
 | 
			
		||||
  const now = new Date(Date.now());
 | 
			
		||||
  const utcToday = Date.UTC(now.getUTCFullYear(),now.getUTCMonth(),now.getUTCDate());
 | 
			
		||||
  return pack !== null && new Date(pack.dataDate).getTime() <= utcToday
 | 
			
		||||
    && (!pack.dataEndDate || new Date(pack.dataEndDate).getTime() >= utcToday);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -22,4 +22,8 @@ export class TypeaheadService {
 | 
			
		||||
  getTagTypeaheadItems(searchText: string, skip: number = 0, take: number = 10): Observable<ITypeaheadItem[]> {
 | 
			
		||||
    return this.httpClient.get<ITypeaheadItem[]>(`${this.ApiEndpoint()}/api/v1/typeahead/tag/?q=${searchText}&skip=${skip}&take=${take}`);
 | 
			
		||||
  }  
 | 
			
		||||
 | 
			
		||||
  getCityTypeaheadItems(searchText: string, skip: number = 0, take: number = 10): Observable<ITypeaheadItem[]> {
 | 
			
		||||
    return this.httpClient.get<ITypeaheadItem[]>(`${this.ApiEndpoint()}/api/v1/typeahead/city/?q=${searchText}&skip=${skip}&take=${take}`);
 | 
			
		||||
  }  
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user