Compare commits

..

No commits in common. "develop" and "AW-4620" have entirely different histories.

287 changed files with 20115 additions and 20089 deletions

View File

@ -1,22 +0,0 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"overrides": [
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
}
}

4
.gitignore vendored
View File

@ -49,7 +49,3 @@ Thumbs.db
projects/common/node_modules/ projects/common/node_modules/
projects/common-map/node_modules/ projects/common-map/node_modules/
.angular/* .angular/*
projects/common-map3d/node_modules/
projects/common-map/node_modules/
projects/ng-openlayers/node_modules/
projects/common/node_modules/

54
Jenkinsfile vendored
View File

@ -1,24 +1,54 @@
@Library('farmmaps-shared-library') _
pipeline { pipeline {
agent any; agent any
options { environment {
copyArtifactPermission projectNames: env.allProjectsArtifactPermission; PACKAGE_VERSION_PREFIX=sh(script: 'jq .version package.json |sed "s/\\"//g"', returnStdout: true).trim()
disableConcurrentBuilds(); PACKAGE_VERSION="${PACKAGE_VERSION_PREFIX}"
} }
stages { stages {
stage('FarmmapsLibBuildAll') { stage('npm install'){
steps { steps {
stepFarmmapsLibBuildAll(); sh '''rm -rf node_modules/
npm install --legacy-peer-deps
cd projects/common
npm install --legacy-peer-deps
cd ../common-map
npm install --legacy-peer-deps
cd ../common-map3d
npm install --legacy-peer-deps
'''
} }
} }
stage('build'){
steps {
sh '''ng build common --configuration production
ng build common-map --configuration production
ng build common-map3d --configuration production'''
}
}
stage('npm publish'){
steps {
sh '''cd dist/common
npm version ${PACKAGE_VERSION} --allow-same-version
npm publish
cd ../common-map
npm version ${PACKAGE_VERSION} --allow-same-version
npm publish
cd ../common-map3d
npm version ${PACKAGE_VERSION} --allow-same-version
npm publish'''
}
}
} }
post { post {
success {
postSuccess();
}
always { always {
postAlways(); emailext (
body: '${DEFAULT_CONTENT}',
mimeType: 'text/html',
replyTo: '${DEFAULT_REPLYTO}',
subject: '${DEFAULT_SUBJECT}',
to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])
)
} }
} }
} }

View File

@ -1,24 +1,54 @@
@Library('farmmaps-shared-library') _
pipeline { pipeline {
agent any; agent any
options { environment {
copyArtifactPermission projectNames: env.allProjectsArtifactPermission; PACKAGE_VERSION_PREFIX=sh(script: 'jq .version package.json |sed "s/\\"//g"', returnStdout: true).trim()
disableConcurrentBuilds(); PACKAGE_VERSION="${PACKAGE_VERSION_PREFIX + '-prerelease.' + env.BUILD_NUMBER}"
} }
stages { stages {
stage('FarmmapsLibBuildAll') { stage('npm install'){
steps { steps {
stepFarmmapsLibBuildAll(); sh '''rm -rf node_modules/
npm install --legacy-peer-deps
cd projects/common
npm install --legacy-peer-deps
cd ../common-map
npm install --legacy-peer-deps
cd ../common-map3d
npm install --legacy-peer-deps
'''
} }
} }
stage('build'){
steps {
sh '''ng build common --configuration production
ng build common-map --configuration production
ng build common-map3d --configuration production'''
}
}
stage('npm publish'){
steps {
sh '''cd dist/common
npm version ${PACKAGE_VERSION}
npm publish
cd ../common-map
npm version ${PACKAGE_VERSION}
npm publish
cd ../common-map3d
npm version ${PACKAGE_VERSION}
npm publish'''
}
}
} }
post { post {
success {
postSuccess();
}
always { always {
postAlways(); emailext (
body: '${DEFAULT_CONTENT}',
mimeType: 'text/html',
replyTo: '${DEFAULT_REPLYTO}',
subject: '${DEFAULT_SUBJECT}',
to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])
)
} }
} }
} }

View File

@ -2,6 +2,7 @@
This is a sample FarmMaps client in Angular 7.x. This is a sample FarmMaps client in Angular 7.x.
## Quick start ## Quick start
Use one of the two options below to get started. Use one of the two options below to get started.
@ -50,15 +51,9 @@ npm install -g @angular/cli
npm install npm install
ng serve ng serve
``` ```
*Go*` *Go*
Point your browser to http://localhost:4200 Point your browser to http://localhost:4200
*ESLint*
```
npm run lint src
npm run lint projects/common/src
npm run lint projects/common-map/src
npm run lint projects/common-map3d/src
```

View File

@ -209,8 +209,8 @@
"options": { "options": {
"tsConfig": "projects/common-map/tsconfig.lib.json", "tsConfig": "projects/common-map/tsconfig.lib.json",
"project": "projects/common-map/ng-package.json" "project": "projects/common-map/ng-package.json"
}, }
"configurations": { , "configurations": {
"production": { "production": {
"tsConfig": "projects/common-map/tsconfig.lib.prod.json" "tsConfig": "projects/common-map/tsconfig.lib.prod.json"
} }
@ -253,43 +253,6 @@
} }
} }
} }
},
"ng-openlayers": {
"projectType": "library",
"root": "projects/ng-openlayers",
"sourceRoot": "projects/ng-openlayers/src",
"prefix": "ng-openlayers",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "projects/ng-openlayers/tsconfig.lib.json",
"project": "projects/ng-openlayers/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/ng-openlayers/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/ng-openlayers/src/test.ts",
"tsConfig": "projects/ng-openlayers/tsconfig.spec.json",
"karmaConfig": "projects/ng-openlayers/karma.conf.js"
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"projects/ng-openlayers/**/*.ts",
"projects/ng-openlayers/**/*.html"
]
}
}
}
} }
}, },
"cli": { "cli": {

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 143 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -51,17 +51,7 @@
content: "i"; content: "i";
} }
.fm-carbon:before { hallo
content: "j";
}
.fm-bo-akkerbouw:before {
content: "k";
}
.fm-grass:before {
content: "l";
}
@font-face { @font-face {
font-family: "FarmMaps"; font-family: "FarmMaps";

26404
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,83 +1,72 @@
{ {
"name": "farmmaps-lib-app", "name": "farmmaps-lib-app",
"version": "4.12.0", "version": "3.0.1",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
"build": "ng build", "build": "ng build",
"test": "ng test", "test": "ng test",
"lint": "eslint -c .eslintrc.js --ext .ts", "lint": "ng lint",
"e2e": "ng e2e" "e2e": "ng e2e"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular-eslint/eslint-plugin": "^18.2.0", "@angular/animations": "^14.1.3",
"@angular/animations": "^18.2.3", "@angular/common": "^14.1.3",
"@angular/common": "^18.2.3", "@angular/compiler": "^14.1.3",
"@angular/compiler": "^18.2.3", "@angular/core": "^14.1.3",
"@angular/core": "^18.2.3", "@angular/forms": "^14.1.3",
"@angular/forms": "^18.2.3", "@angular/platform-browser": "^14.1.3",
"@angular/platform-browser": "^18.2.3", "@angular/platform-browser-dynamic": "^14.1.3",
"@angular/platform-browser-dynamic": "^18.2.3", "@angular/router": "^14.1.3",
"@angular/router": "^18.2.3",
"@farmmaps/common": "file:dist/common", "@farmmaps/common": "file:dist/common",
"@farmmaps/common-map": "file:dist/common-map", "@farmmaps/common-map": "file:dist/common-map",
"@farmmaps/common-map3d": "file:dist/common-map3d", "@farmmaps/common-map3d": "file:dist/common-map3d",
"@farmmaps/ng-openlayers": "file:dist/ng-openlayers",
"@microsoft/signalr": "^3.1.16", "@microsoft/signalr": "^3.1.16",
"@ng-bootstrap/ng-bootstrap": "^17.0.1", "@ng-bootstrap/ng-bootstrap": "^13.0.0",
"@ngrx/effects": "^18.0.2", "@ngrx/effects": "^14",
"@ngrx/router-store": "^18.0.2", "@ngrx/router-store": "^14",
"@ngrx/store": "^18.0.2", "@ngrx/store": "^14",
"@popperjs/core": "^2.11.8", "@popperjs/core": "^2.11.6",
"angular-oauth2-oidc": "^17.0.2", "angular-oauth2-oidc": "^13",
"assert": "^2.0.0", "assert": "^2.0.0",
"bootstrap": "^5.3.3", "bootstrap": "^5.2.0",
"browserify-zlib": "^0.2.0", "browserify-zlib": "^0.2.0",
"buffer": "^6.0.3", "buffer": "^6.0.3",
"cesium": "^1.97.0", "cesium": "^1.97.0",
"core-js": "^2.6.12", "core-js": "^2.6.12",
"https-browserify": "^1.0.0", "https-browserify": "^1.0.0",
"moment": "^2.29.4", "moment": "^2.29.4",
"ngrx-store-localstorage": "^18.0.0", "ngrx-store-localstorage": "^14",
"ngx-avatars": "^1.8.0", "ngx-avatar": "^4.1.0",
"ngx-clipboard": "^16.0.0", "ngx-clipboard": "^14.0.1",
"ngx-image-cropper": "^7.0.0", "ngx-image-cropper": "^3.3.5",
"ngx-uploadx": "^6.2.0", "ngx-openlayers": "1.0.0-next.19",
"ol": "^8.2.0", "ngx-uploadx": "^5.2.0",
"ol": "6.14.1",
"olcs": "^2.13.1", "olcs": "^2.13.1",
"resumablejs": "^1.1.0", "resumablejs": "^1.1.0",
"rxjs": "^7.8.1", "rxjs": "^6.6.7",
"stream": "^0.0.2", "stream": "^0.0.2",
"stream-http": "^3.2.0", "stream-http": "^3.2.0",
"tassign": "^1.0.0", "tassign": "^1.0.0",
"tslib": "^2.4.0", "tslib": "^2.4.0",
"url": "^0.11.0", "url": "^0.11.0",
"util": "^0.12.4", "util": "^0.12.4",
"zone.js": "~0.14.10" "zone.js": "~0.11.4"
},
"optionalDependencies": {
"@lmdb/lmdb-linux-x64": "^3.1.0",
"@rollup/rollup-linux-x64-gnu": "^4.21.2"
}, },
"devDependencies": { "devDependencies": {
"@angular-builders/custom-webpack": "^18.0.0", "@angular-builders/custom-webpack": "^14",
"@angular-devkit/build-angular": "^18.2.3", "@angular-devkit/build-angular": "^14.1.3",
"@angular/cli": "^18.2.3", "@angular/cli": "^14.1.3",
"@angular/compiler-cli": "^18.2.3", "@angular/compiler-cli": "^14.1.3",
"@angular/language-service": "^18.2.3", "@angular/language-service": "^14.1.3",
"@angular/localize": "^18.2.3", "@angular/localize": "^14.1.3",
"@types/arcgis-rest-api": "^10.4.5", "@types/arcgis-rest-api": "^10.4.5",
"@types/jasmine": "~2.8.8", "@types/jasmine": "~2.8.8",
"@types/jasminewd2": "^2.0.9", "@types/jasminewd2": "^2.0.9",
"@types/node": "^22.5.4", "@types/node": "^12.20.15",
"@typescript-eslint/eslint-plugin": "^6.18.0", "codelyzer": "^0.0.28",
"@typescript-eslint/eslint-plugin-tslint": "^6.18.0",
"@typescript-eslint/parser": "^6.18.0",
"codelyzer": "^6.0.2",
"eslint": "^8.35.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.27.5",
"jasmine-core": "^4.3.0", "jasmine-core": "^4.3.0",
"jasmine-spec-reporter": "^7.0.0", "jasmine-spec-reporter": "^7.0.0",
"karma": "^6.3.20", "karma": "^6.3.20",
@ -85,9 +74,10 @@
"karma-coverage-istanbul-reporter": "^3.0.3", "karma-coverage-istanbul-reporter": "^3.0.3",
"karma-jasmine": "^5.1.0", "karma-jasmine": "^5.1.0",
"karma-jasmine-html-reporter": "^2.0.0", "karma-jasmine-html-reporter": "^2.0.0",
"ng-packagr": "^18.2.1", "ng-packagr": "^14.1.0",
"protractor": "~7.0.0", "protractor": "~7.0.0",
"ts-node": "^8.8.1", "ts-node": "^8.8.1",
"typescript": "~5.4.4" "tslint": "~6.1.0",
"typescript": "~4.6.4"
} }
} }

View File

@ -1,22 +0,0 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"overrides": [
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
}
}

View File

@ -1,217 +1,13 @@
{ {
"name": "@farmmaps/common-map", "name": "@farmmaps/common-map",
"version": "2.0.0", "version": "0.0.1",
"lockfileVersion": 3, "lockfileVersion": 1,
"requires": true, "requires": true,
"packages": {
"": {
"name": "@farmmaps/common-map",
"version": "2.0.0",
"dependencies": { "dependencies": {
"tslib": "^2.0.0" "tslib": {
}, "version": "2.0.1",
"peerDependencies": { "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz",
"@angular/core": "^18.2.3", "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ=="
"@ngrx/effects": "^18.0.2",
"@ngrx/router-store": "^18.0.2",
"@ngrx/store": "^18.0.2",
"ngrx-store-localstorage": "^18",
"tassign": "^1.0.0"
}
},
"../../dist/libs/ng-openlayers": {
"version": "18.0.0",
"extraneous": true,
"license": "MPL-2.0",
"dependencies": {
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/common": "^18.2.3",
"@angular/core": "^18.2.3",
"ol": "^8.2.0"
}
},
"dist/ng-openlayers": {
"extraneous": true
},
"node_modules/@angular/common": {
"version": "18.2.3",
"resolved": "https://registry.npmjs.org/@angular/common/-/common-18.2.3.tgz",
"integrity": "sha512-NFL4yXXImSCH7i1xnHykUjHa9vl9827fGiwSV2mnf7LjSUsyDzFD8/54dNuYN9OY8AUD+PnK0YdNro6cczVyIA==",
"peer": true,
"dependencies": {
"tslib": "^2.3.0"
},
"engines": {
"node": "^18.19.1 || ^20.11.1 || >=22.0.0"
},
"peerDependencies": {
"@angular/core": "18.2.3",
"rxjs": "^6.5.3 || ^7.4.0"
}
},
"node_modules/@angular/core": {
"version": "18.2.3",
"resolved": "https://registry.npmjs.org/@angular/core/-/core-18.2.3.tgz",
"integrity": "sha512-VGhMJxj7d0rYpqVfQrcGRB7EE/BCziotft/I/YPl6bOMPSAvMukG7DXQuJdYpNrr62ks78mlzHlZX/cdmB9Prw==",
"peer": true,
"dependencies": {
"tslib": "^2.3.0"
},
"engines": {
"node": "^18.19.1 || ^20.11.1 || >=22.0.0"
},
"peerDependencies": {
"rxjs": "^6.5.3 || ^7.4.0",
"zone.js": "~0.14.10"
}
},
"node_modules/@angular/platform-browser": {
"version": "18.2.3",
"resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-18.2.3.tgz",
"integrity": "sha512-M2ob4zN7tAcL2mx7U6KnZNqNFPFl9MlPBE0FrjQjIzAjU0wSYPIJXmaPu9aMUp9niyo+He5iX98I+URi2Yc99g==",
"peer": true,
"dependencies": {
"tslib": "^2.3.0"
},
"engines": {
"node": "^18.19.1 || ^20.11.1 || >=22.0.0"
},
"peerDependencies": {
"@angular/animations": "18.2.3",
"@angular/common": "18.2.3",
"@angular/core": "18.2.3"
},
"peerDependenciesMeta": {
"@angular/animations": {
"optional": true
}
}
},
"node_modules/@angular/router": {
"version": "18.2.3",
"resolved": "https://registry.npmjs.org/@angular/router/-/router-18.2.3.tgz",
"integrity": "sha512-fvD9eSDIiIbeYoUokoWkXzu7/ZaxlzKPUHFqX1JuKuH5ciQDeT/d7lp4mj31Bxammhohzi3+z12THJYsCkj/iQ==",
"peer": true,
"dependencies": {
"tslib": "^2.3.0"
},
"engines": {
"node": "^18.19.1 || ^20.11.1 || >=22.0.0"
},
"peerDependencies": {
"@angular/common": "18.2.3",
"@angular/core": "18.2.3",
"@angular/platform-browser": "18.2.3",
"rxjs": "^6.5.3 || ^7.4.0"
}
},
"node_modules/@ngrx/effects": {
"version": "18.0.2",
"resolved": "https://registry.npmjs.org/@ngrx/effects/-/effects-18.0.2.tgz",
"integrity": "sha512-YojXcOD9Lsq4kl2HCjENccyUM/mOlgBdtddsg9j/ojzSUgu3ZuBVKLN3atrL2TJYkbMX1MN0RzafSkL3TPGFIA==",
"peer": true,
"dependencies": {
"@ngrx/operators": "18.0.1",
"tslib": "^2.0.0"
},
"peerDependencies": {
"@angular/core": "^18.0.0",
"@ngrx/store": "18.0.2",
"rxjs": "^6.5.3 || ^7.5.0"
}
},
"node_modules/@ngrx/operators": {
"version": "18.0.1",
"resolved": "https://registry.npmjs.org/@ngrx/operators/-/operators-18.0.1.tgz",
"integrity": "sha512-M+QMrHNKgcuiLaRGZxJ4aQi5/OCRfKC4+T/63dsHyLFZ53/FFpF6a/ytSO1Q+tzOplZ5o99S+i8FVaZqNQ3LmQ==",
"peer": true,
"dependencies": {
"tslib": "^2.3.0"
},
"peerDependencies": {
"rxjs": "^6.5.3 || ^7.4.0"
}
},
"node_modules/@ngrx/router-store": {
"version": "18.0.2",
"resolved": "https://registry.npmjs.org/@ngrx/router-store/-/router-store-18.0.2.tgz",
"integrity": "sha512-jUrQ/uJJ53x8O1XbN2YxH2GpRREZlwS5gRxlCoc4fWL4Us/uS1/K6+QfRmKBPtpTKBIixqsOb+dIUV5iwBrivA==",
"peer": true,
"dependencies": {
"tslib": "^2.0.0"
},
"peerDependencies": {
"@angular/common": "^18.0.0",
"@angular/core": "^18.0.0",
"@angular/router": "^18.0.0",
"@ngrx/store": "18.0.2",
"rxjs": "^6.5.3 || ^7.5.0"
}
},
"node_modules/@ngrx/store": {
"version": "18.0.2",
"resolved": "https://registry.npmjs.org/@ngrx/store/-/store-18.0.2.tgz",
"integrity": "sha512-ajwv0+njsO4vzArp9esnFvs1wyUb1U1W8E8LSCKrcW2hWWo9o1Pezj+JRsdQwatxHfrrPFuTDyajsl6GQM/JSA==",
"peer": true,
"dependencies": {
"tslib": "^2.0.0"
},
"peerDependencies": {
"@angular/core": "^18.0.0",
"rxjs": "^6.5.3 || ^7.5.0"
}
},
"node_modules/deepmerge": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz",
"integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/ngrx-store-localstorage": {
"version": "18.0.0",
"resolved": "https://registry.npmjs.org/ngrx-store-localstorage/-/ngrx-store-localstorage-18.0.0.tgz",
"integrity": "sha512-WoDePvMWiWF9LQHe+dTqbpm8lxoKCPoIvA0/1enIPTmdLQsOpdDKhMSD5YgwuqDusNfEik3QslProTFGyXZwtw==",
"peer": true,
"dependencies": {
"deepmerge": "^4.2.2",
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/common": "^18.0.1",
"@angular/core": "^18.0.1",
"@ngrx/store": "^18.0.0"
}
},
"node_modules/rxjs": {
"version": "7.8.1",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz",
"integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==",
"peer": true,
"dependencies": {
"tslib": "^2.1.0"
}
},
"node_modules/tassign": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/tassign/-/tassign-1.0.0.tgz",
"integrity": "sha512-k0Ti9f+A1R0BRdArEbiUHldd+A40kZ5qsiNSNk4czx61wkAoSZYjqkaQs0jC63AfgPdCXVPstDq2ZW5ZLRTCgw==",
"peer": true
},
"node_modules/tslib": {
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz",
"integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA=="
},
"node_modules/zone.js": {
"version": "0.14.10",
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.14.10.tgz",
"integrity": "sha512-YGAhaO7J5ywOXW6InXNlLmfU194F8lVgu7bRntUF3TiG8Y3nBK0x1UJJuHUP/e8IyihkjCYqhCScpSwnlaSRkQ==",
"peer": true
} }
} }
} }

View File

@ -8,11 +8,13 @@
"tslib": "^2.0.0" "tslib": "^2.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@angular/core": "^18.2.3", "@angular/core": ">=14.0.0",
"ngrx-store-localstorage": "^18.0.0", "ngrx-store-localstorage": ">=14.0.0",
"@ngrx/effects": "^18.0.2", "@ngrx/effects": ">=14.0.0",
"@ngrx/router-store": "^18.0.2", "@ngrx/router-store":">=14.0.0",
"@ngrx/store": "^18.0.2", "@ngrx/store":">=14.0.0",
"tassign": "^1.0.0" "tassign": ">=1.0.0",
"ngx-openlayers": ">=1.0.0-next.19",
"ol": ">=6.8.1"
} }
} }

View File

@ -18,7 +18,6 @@ export const SETPARENT = '[Map] SetParent';
export const SETPERIOD = '[Map] SetPeriod'; export const SETPERIOD = '[Map] SetPeriod';
export const STARTSEARCH = '[Map] StartSearch'; export const STARTSEARCH = '[Map] StartSearch';
export const STARTSEARCHSUCCESS = '[Map] StartSearchSuccess'; export const STARTSEARCHSUCCESS = '[Map] StartSearchSuccess';
export const CLICKFEATURE = '[Map] ClickFeature';
export const SELECTFEATURE = '[Map] SelectFeature'; export const SELECTFEATURE = '[Map] SelectFeature';
export const SELECTITEM = '[Map] SelectItem'; export const SELECTITEM = '[Map] SelectItem';
export const SELECTITEMSUCCESS = '[Map] SelectItemSuccess'; export const SELECTITEMSUCCESS = '[Map] SelectItemSuccess';
@ -57,8 +56,7 @@ export const GETLAYERVALUE = '[Map] GetLayerValue'
export const GETLAYERVALUESUCCESS = '[Map] GetLayerValueSuccess' export const GETLAYERVALUESUCCESS = '[Map] GetLayerValueSuccess'
export const TOGGLESHOWDATALAYERSLIDE = '[Map] ToggleShowDataLayerSlide' export const TOGGLESHOWDATALAYERSLIDE = '[Map] ToggleShowDataLayerSlide'
export const SETVIEWSTATE = '[Map] SetViewState' export const SETVIEWSTATE = '[Map] SetViewState'
export const CLEARFEATURES = '[Map] ClearFeatures';
export const SETPANELEXTRAWIDE = '[Map] SetPanelExtraWide';
export class Clear implements Action { export class Clear implements Action {
readonly type = CLEAR; readonly type = CLEAR;
@ -113,12 +111,6 @@ export class StartSearchSuccess implements Action {
constructor(public features: Array<Feature<Geometry>>, public query:IQueryState) { } constructor(public features: Array<Feature<Geometry>>, public query:IQueryState) { }
} }
export class ClickFeature implements Action {
readonly type = CLICKFEATURE;
constructor(public feature:Feature<Geometry>) { }
}
export class SelectFeature implements Action { export class SelectFeature implements Action {
readonly type = SELECTFEATURE; readonly type = SELECTFEATURE;
@ -337,23 +329,12 @@ export class SetViewState implements Action {
constructor(public enabled:boolean) {} constructor(public enabled:boolean) {}
} }
export class ClearFeatures implements Action {
readonly type = CLEARFEATURES;
constructor() {}
}
export class SetPanelExtraWide implements Action {
readonly type = SETPANELEXTRAWIDE;
constructor(public panelExtraWide:boolean) {}
}
export type Actions = SetMapState export type Actions = SetMapState
| Init | Init
| Clear | Clear
| SetParent | SetParent
| StartSearch | StartSearch
| StartSearchSuccess | StartSearchSuccess
| ClickFeature
| SelectFeature | SelectFeature
| SelectItem | SelectItem
| SelectItemSuccess | SelectItemSuccess
@ -393,7 +374,5 @@ export type Actions = SetMapState
| GetLayerValue | GetLayerValue
| SetPeriod | SetPeriod
| ToggleShowDataLayerSlide | ToggleShowDataLayerSlide
| SetViewState | SetViewState;
| ClearFeatures
| SetPanelExtraWide;

View File

@ -1,91 +1,91 @@
import { NgModule ,ModuleWithProviders} from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
//external modules //external modules
import { NgbModule } from "@ng-bootstrap/ng-bootstrap"; import { AngularOpenlayersModule } from 'ngx-openlayers';
import { StoreModule, ActionReducer, MetaReducer } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects'; import { EffectsModule } from '@ngrx/effects';
import { ActionReducer, MetaReducer, StoreModule } from '@ngrx/store'; import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
import { AngularOpenlayersModule } from '@farmmaps/ng-openlayers';
//common modules //common modules
import { AppCommonModule } from '@farmmaps/common'; import { AppCommonModule } from '@farmmaps/common';
import * as mapActions from './actions/map.actions';
import * as mapEffects from './effects/map.effects';
import { MODULE_NAME } from './module-name'; import { MODULE_NAME } from './module-name';
import * as mapReducers from './reducers/map.reducer'; import * as mapReducers from './reducers/map.reducer';
import * as mapActions from './actions/map.actions';
import * as mapEffects from './effects/map.effects';
import { IClickedFeature } from './models/clicked.feature';
import { IItemLayer, ItemLayer, ITemporalItemLayer, TemporalItemLayer } from './models/item.layer';
import { IMapState} from './models/map.state'; import { IMapState} from './models/map.state';
import { IPeriodState } from './models/period.state';
import { ISelectedFeatures } from './models/selected.features'; 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 // components
import { MapRoutingModule } from './common-map-routing.module';
import { FileDropTargetComponent } from './components/aol/file-drop-target/file-drop-target.component';
import { GpsLocation} from './components/aol/gps-location/gps-location.component'; import { GpsLocation} from './components/aol/gps-location/gps-location.component';
import { ItemLayersComponent } from './components/aol/item-layers/item-layers.component';
import { ItemVectorSourceComponent } from './components/aol/item-vector-source/item-vector-source.component';
import { LayerListComponent } from './components/aol/layer-list/layer-list.component';
import { LayerValuesComponent } from './components/aol/layer-values/layer-values.component';
import { LayerVectorImageComponent } from './components/aol/layer-vector-image/layer-vector-image.component';
import { PanToLocation } from './components/aol/pan-to-location/pan-to-location.component';
import { RotationResetComponent } from './components/aol/rotation-reset/rotation-reset.component';
import { ZoomToExtentComponent } from './components/aol/zoom-to-extent/zoom-to-extent.component';
import { FeatureListContainerComponent } from './components/feature-list-container/feature-list-container.component';
import { FeatureListCropfieldComponent } from './components/feature-list-cropfield/feature-list-cropfield.component';
import { FeatureListCroppingschemeComponent } from './components/feature-list-croppingscheme/feature-list-croppingscheme.component';
import { FeatureListFeatureContainerComponent } from './components/feature-list-feature-container/feature-list-feature-container.component';
import {FeatureListFeatureCropfieldComponent } from './components/feature-list-feature-cropfield/feature-list-feature-cropfield.component'; import {FeatureListFeatureCropfieldComponent } from './components/feature-list-feature-cropfield/feature-list-feature-cropfield.component';
import { FeatureListFeatureCroppingschemeComponent} from './components/feature-list-feature-croppingscheme/feature-list-feature-croppingscheme.component'; import { FeatureListFeatureCroppingschemeComponent} from './components/feature-list-feature-croppingscheme/feature-list-feature-croppingscheme.component';
import { AbstractFeatureListFeatureComponent, FeatureListFeatureComponent } from './components/feature-list-feature/feature-list-feature.component';
import { AbstractFeatureListComponent, FeatureListComponent } from './components/feature-list/feature-list.component';
import { GeometryThumbnailComponent } from './components/feature-thumbnail/feature-thumbnail.component';
import { ForChild } from './components/for-item/for-child.decorator';
import { ForItemType } from './components/for-item/for-itemtype.decorator';
import { ForPackage } from './components/for-item/for-package.decorator';
import { ForSourceTask } from './components/for-item/for-sourcetask.decorator';
import { ifZoomToShowDirective } from './components/if-zoom-to-show/if-zoom-to-show.directive';
import { ItemListItemContainerComponent } from './components/item-list-item-container/item-list-item-container.component';
import { AbstractItemListItemComponent, AbstractItemWidgetComponent, ItemListItemComponent } from './components/item-list-item/item-list-item.component';
import { AbstractItemListComponent, ItemListComponent } from './components/item-list/item-list.component';
import { ItemWidgetListComponent} from './components/item-widget-list/item-widget-list.component'; import { ItemWidgetListComponent} from './components/item-widget-list/item-widget-list.component';
import { LayerSwitcher } from './components/layer-switcher/layer-switcher.component'; import { AbstractItemListItemComponent, ItemListItemComponent, AbstractItemWidgetComponent } from './components/item-list-item/item-list-item.component';
import { HistogramDetailsComponent } from './components/legend/histogram-details/histogram-details.component'; import { ItemListItemContainerComponent } from './components/item-list-item-container/item-list-item-container.component';
import { LegendComponent } from './components/legend/legend.component'; import { AbstractItemListComponent,ItemListComponent} from './components/item-list/item-list.component';
import { StatisticsDetailsComponent } from './components/legend/statistics-details/statistics-details.component'; import { AbstractSelectedItemComponent, SelectedItemComponent } from './components/selected-item/selected-item.component';
import { MapSearchComponent } from './components/map-search/map-search.component';
import { MapComponent } from './components/map/map.component';
import { MetaDataModalComponent } from './components/meta-data-modal/meta-data-modal.component';
import { SelectPeriodModalComponent } from './components/select-period-modal/select-period-modal.component';
import { SelectedItemContainerComponent } from './components/selected-item-container/selected-item-container.component';
import { SelectedItemCropfieldComponent } from './components/selected-item-cropfield/selected-item-cropfield.component'; import { SelectedItemCropfieldComponent } from './components/selected-item-cropfield/selected-item-cropfield.component';
import { SelectedItemGeotiffComponent } from './components/selected-item-geotiff/selected-item-geotiff.component'; import { SelectedItemGeotiffComponent } from './components/selected-item-geotiff/selected-item-geotiff.component';
import { SelectedItemShapeComponent } from './components/selected-item-shape/selected-item-shape.component';
import { SelectedItemTemporalComponent} from './components/selected-item-temporal/selected-item-temporal.component'; import { SelectedItemTemporalComponent} from './components/selected-item-temporal/selected-item-temporal.component';
import { AbstractSelectedItemComponent, SelectedItemComponent } from './components/selected-item/selected-item.component'; import {SelectedItemShapeComponent } from './components/selected-item-shape/selected-item-shape.component';
import { SelectedItemContainerComponent } from './components/selected-item-container/selected-item-container.component';
import { AbstractFeatureListFeatureComponent, FeatureListFeatureComponent } from './components/feature-list-feature/feature-list-feature.component';
import {FeatureListFeatureContainerComponent } from './components/feature-list-feature-container/feature-list-feature-container.component';
import { FeatureListCroppingschemeComponent } from './components/feature-list-croppingscheme/feature-list-croppingscheme.component';
import {FeatureListCropfieldComponent } from './components/feature-list-cropfield/feature-list-cropfield.component';
import {FeatureListContainerComponent } from './components/feature-list-container/feature-list-container.component';
import { WidgetHostDirective} from './components/widget-host/widget-host.directive'; import { WidgetHostDirective} from './components/widget-host/widget-host.directive';
import { WidgetStatusComponent } from './components/widget-status/widget-status.component'; import { FeatureListComponent,AbstractFeatureListComponent} from './components/feature-list/feature-list.component';
import { ZoomToShowAlert } from './components/zoom-to-show-alert/zoom-to-show-alert.component'; import { FileDropTargetComponent } from './components/aol/file-drop-target/file-drop-target.component';
import { DeviceOrientationService } from './services/device-orientation.service'; import { ItemVectorSourceComponent } from './components/aol/item-vector-source/item-vector-source.component';
import { ItemLayersComponent } from './components/aol/item-layers/item-layers.component';
import { ZoomToExtentComponent } from './components/aol/zoom-to-extent/zoom-to-extent.component';
import { RotationResetComponent } from './components/aol/rotation-reset/rotation-reset.component';
import { LayerListComponent } from './components/aol/layer-list/layer-list.component';
import { MetaDataModalComponent } from './components/meta-data-modal/meta-data-modal.component';
import { SelectPeriodModalComponent } from './components/select-period-modal/select-period-modal.component';
import { MapComponent } from './components/map/map.component';
import { MapSearchComponent } from './components/map-search/map-search.component';
import { MapRoutingModule } from './common-map-routing.module';
import { LegendComponent } from './components/legend/legend.component';
import { LayerVectorImageComponent } from './components/aol/layer-vector-image/layer-vector-image.component';
import {FeatureIconService} from './services/feature-icon.service'; import {FeatureIconService} from './services/feature-icon.service';
import { GeolocationService } from './services/geolocation.service'; import { GeolocationService } from './services/geolocation.service';
import {DeviceOrientationService} from './services/device-orientation.service';
import { TemporalService} from './services/temporal.service'; import { TemporalService} from './services/temporal.service';
import { WidgetStatusComponent } from './components/widget-status/widget-status.component';
import { ForChild} from './components/for-item/for-child.decorator';
import {ForItemType } from './components/for-item/for-itemtype.decorator';
import { ForSourceTask} from './components/for-item/for-sourcetask.decorator';
import { ForPackage } from './components/for-item/for-package.decorator';
import { PanToLocation} from './components/aol/pan-to-location/pan-to-location.component';
import {LayerSwitcher} from './components/layer-switcher/layer-switcher.component';
import {HistogramDetailsComponent} from './components/legend/histogram-details/histogram-details.component';
import {StatisticsDetailsComponent} from './components/legend/statistics-details/statistics-details.component';
import { ifZoomToShowDirective} from './components/if-zoom-to-show/if-zoom-to-show.directive';
import { ZoomToShowAlert} from './components/zoom-to-show-alert/zoom-to-show-alert.component';
import { LayerValuesComponent } from './components/aol/layer-values/layer-values.component';
import { GeometryThumbnailComponent } from './components/feature-thumbnail/feature-thumbnail.component';
export function LocalStorageSync(reducer: ActionReducer<any>): ActionReducer<any> { export function LocalStorageSync(reducer: ActionReducer<any>): ActionReducer<any> {
const r = function(state, action) { const r = function(state, action) {
const r2 = reducer(state, action); const r2 = reducer(state, action);
if(action.type == "@ngrx/store/update-reducers") { if(action.type == "@ngrx/store/update-reducers") {
const ms = window.localStorage.getItem(MODULE_NAME+"_mapState"); let ms = window.localStorage.getItem(MODULE_NAME+"_mapState");
if(ms) { if(ms) {
r2["mapState"] = JSON.parse(ms); r2["mapState"] = JSON.parse(ms);
} }
const sp = window.localStorage.getItem(MODULE_NAME+"_searchPeriod"); let sp = window.localStorage.getItem(MODULE_NAME+"_searchPeriod");
if(sp) { if(sp) {
const p = JSON.parse(sp); let p = JSON.parse(sp);
r2["period"] = { startDate: new Date(Date.parse(p.startDate)),endDate:new Date(Date.parse(p.endDate))}; r2["period"] = { startDate: new Date(Date.parse(p.startDate)),endDate:new Date(Date.parse(p.endDate))};
} }
} }
@ -104,13 +104,70 @@ export function LocalStorageSync(reducer: ActionReducer<any>): ActionReducer<any
const metaReducers: Array<MetaReducer<any, any>> = [LocalStorageSync]; const metaReducers: Array<MetaReducer<any, any>> = [LocalStorageSync];
export { export {
mapEffects,
mapReducers,
mapActions,
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,
AbstractFeatureListComponent, AbstractFeatureListComponent,
AbstractFeatureListFeatureComponent, AbstractItemListComponent, AbstractItemListItemComponent, AbstractItemWidgetComponent, AbstractSelectedItemComponent, DeviceOrientationService, FeatureIconService, FeatureListComponent, FeatureListContainerComponent, FeatureListCropfieldComponent, FeatureListCroppingschemeComponent, FeatureListFeatureComponent, FeatureListFeatureContainerComponent, FeatureListFeatureCropfieldComponent, FeatureListFeatureCroppingschemeComponent, FileDropTargetComponent, ForChild, AbstractFeatureListFeatureComponent,
ForItemType, ForPackage, ForSourceTask, GeolocationService, GeometryThumbnailComponent, GpsLocation, IClickedFeature, ifZoomToShowDirective, IItemLayer, IMapState, IPeriodState, ISelectedFeatures, ItemLayer, ItemLayersComponent, ItemListComponent, ItemListItemComponent, AbstractSelectedItemComponent,
ItemListItemContainerComponent, ITemporalItemLayer, ItemVectorSourceComponent, ItemWidgetListComponent, LayerListComponent, LayerSwitcher, LayerVectorImageComponent, LegendComponent, mapActions, MapComponent, mapEffects, AbstractItemWidgetComponent,
mapReducers, MapSearchComponent, MetaDataModalComponent, PanToLocation, RotationResetComponent, SelectedItemComponent, SelectedItemContainerComponent, SelectedItemCropfieldComponent, AbstractItemListItemComponent,
SelectedItemGeotiffComponent, SelectedItemShapeComponent, SelectedItemTemporalComponent, SelectPeriodModalComponent, TemporalItemLayer, TemporalService, WidgetHostDirective, WidgetStatusComponent, ZoomToExtentComponent, ZoomToShowAlert AbstractItemListComponent,
}; FeatureIconService,
GeolocationService,
DeviceOrientationService,
TemporalService,
IMapState,
ISelectedFeatures,
IItemLayer,
ItemLayer,
IPeriodState,
ForChild,
ForItemType,
ForSourceTask,
ForPackage ,
ITemporalItemLayer,
TemporalItemLayer,
ifZoomToShowDirective,
ZoomToShowAlert,
IClickedFeature,
GeometryThumbnailComponent
}
@NgModule({ @NgModule({
imports: [ imports: [

View File

@ -1,5 +1,5 @@
import { Component, Input, OnDestroy, OnInit, EventEmitter, Output, Inject } from '@angular/core'; import { Component, Input, OnDestroy, OnInit, EventEmitter, Output, Inject } from '@angular/core';
import { MapComponent } from '@farmmaps/ng-openlayers'; import { MapComponent } from 'ngx-openlayers';
import * as proj from 'ol/proj'; import * as proj from 'ol/proj';
import {Point,Geometry} from 'ol/geom'; import {Point,Geometry} from 'ol/geom';
@ -28,7 +28,7 @@ export class FileDropTargetComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.element = this.map.instance.getViewport(); this.element = this.map.instance.getViewport();
const other = this; let other = this;
this.element.addEventListener('drop', this.onDrop, false); this.element.addEventListener('drop', this.onDrop, false);
this.element.addEventListener('dragover', this.preventDefault, false); this.element.addEventListener('dragover', this.preventDefault, false);
this.element.addEventListener('dragenter', this.preventDefault, false); this.element.addEventListener('dragenter', this.preventDefault, false);
@ -36,20 +36,20 @@ export class FileDropTargetComponent implements OnInit, OnDestroy {
private onDrop = (event: DragEvent) => { private onDrop = (event: DragEvent) => {
this.stopEvent(event); this.stopEvent(event);
const geojsonFormat = new GeoJSON(); let geojsonFormat = new GeoJSON();
let parentCode = this.parentCode; var parentCode = this.parentCode;
const coordinate = this.map.instance.getEventCoordinate(event); var coordinate = this.map.instance.getEventCoordinate(event);
//coordinate = proj.transform(coordinate, this.map.instance.getView().getProjection(), 'EPSG:4326'); //coordinate = proj.transform(coordinate, this.map.instance.getView().getProjection(), 'EPSG:4326');
let geometry:Geometry = new Point(coordinate); var geometry:Geometry = new Point(coordinate);
const hitFeatures = this.map.instance.getFeaturesAtPixel([event.pageX, event.pageY]); var hitFeatures = this.map.instance.getFeaturesAtPixel([event.pageX, event.pageY]);
const hitFeature = hitFeatures && hitFeatures.length > 0 ? hitFeatures[0] : null; var hitFeature = hitFeatures && hitFeatures.length > 0 ? hitFeatures[0] : null;
if (hitFeature) { if (hitFeature) {
if (hitFeature.get("code")) { if (hitFeature.get("code")) {
parentCode = hitFeature.get("code"); parentCode = hitFeature.get("code");
} }
geometry = geojsonFormat.readGeometry(geojsonFormat.writeGeometry(geometry)); // create copy instead of reference geometry = geojsonFormat.readGeometry(geojsonFormat.writeGeometry(geometry)); // create copy instead of reference
} }
const projectedGeometry = geometry.transform(this.map.instance.getView().getProjection(), 'EPSG:4326'); var projectedGeometry = geometry.transform(this.map.instance.getView().getProjection(), 'EPSG:4326');
if (event.dataTransfer && event.dataTransfer.files) { if (event.dataTransfer && event.dataTransfer.files) {
this.onFileDropped.emit({ files: event.dataTransfer.files, event: event, geometry: JSON.parse(geojsonFormat.writeGeometry(projectedGeometry)),parentCode:parentCode}) this.onFileDropped.emit({ files: event.dataTransfer.files, event: event, geometry: JSON.parse(geojsonFormat.writeGeometry(projectedGeometry)),parentCode:parentCode})

View File

@ -1,3 +1,6 @@
@import "~bootstrap/scss/bootstrap.scss";
.gps-location { .gps-location {
display:none; display:none;
} }
@ -11,7 +14,7 @@
} }
.tolerance { .tolerance {
fill: var(--bs-primary); fill: $primary;
fill-opacity:0.4; fill-opacity:0.4;
} }
@ -20,20 +23,20 @@
} }
.border { .border {
fill: var(--bs-white); fill: $white;
} }
.center { .center {
fill: var(--bs-primary); fill: $primary;
} }
.stop1 { .stop1 {
stop-color: var(--bs-primary); stop-color: $primary;
stop-opacity:1; stop-opacity:1;
} }
.stop2 { .stop2 {
stop-color:var(--bs-primary); stop-color:$primary;
stop-opacity: 0; stop-opacity: 0;
} }

View File

@ -1,5 +1,5 @@
import { Component, OnInit, Input, ViewChild, ElementRef, OnChanges, SimpleChanges ,Host} from '@angular/core'; import { Component, OnInit, Input, ViewChild, ElementRef, OnChanges, SimpleChanges ,Host} from '@angular/core';
import { MapComponent } from '@farmmaps/ng-openlayers'; import { MapComponent } from 'ngx-openlayers';
import Overlay from 'ol/Overlay'; import Overlay from 'ol/Overlay';
import { fromLonLat, toLonLat } from 'ol/proj'; import { fromLonLat, toLonLat } from 'ol/proj';
@ -15,16 +15,16 @@ export class GpsLocation implements OnInit,OnChanges{
public instance: Overlay; public instance: Overlay;
@Input() position: GeolocationPosition; @Input() position: GeolocationPosition;
@Input() location: number[]=[0,0]; @Input() location: number[]=[0,0];
@Input() locationTolerance = 0; @Input() locationTolerance: number = 0;
@Input() showHeading = false; @Input() showHeading: boolean = false;
@Input() showTolerance = false; @Input() showTolerance: boolean = false;
@Input() heading = 0; @Input() heading: number = 0;
@Input() headingTolerance = 0; @Input() headingTolerance: number = 0;
public locTolerancePixels = 0; public locTolerancePixels: number = 0;
public path = ""; public path: string = "";
public rotate = ""; public rotate: string = "";
private resolution = 0; private resolution: number = 0;
initialized = false; initialized:boolean = false;
@ViewChild('location', { static: true }) locationElement: ElementRef; @ViewChild('location', { static: true }) locationElement: ElementRef;
constructor(private map: MapComponent) { constructor(private map: MapComponent) {
@ -42,12 +42,12 @@ export class GpsLocation implements OnInit,OnChanges{
position: fromLonLat( this.location), position: fromLonLat( this.location),
element: this.locationElement.nativeElement element: this.locationElement.nativeElement
}); });
const x = Math.tan(this.headingTolerance * Math.PI / 180)*40; var x = Math.tan(this.headingTolerance * Math.PI / 180)*40;
const y = Math.cos(this.headingTolerance * Math.PI / 180) * 40; var y = Math.cos(this.headingTolerance * Math.PI / 180) * 40;
const y1 = Math.round(500 - y); var y1 = Math.round(500 - y);
const x1 = Math.round(500 - x); var x1 = Math.round(500 - x);
const y2 = Math.round(y1); var y2 = Math.round(y1);
const x2 = Math.round(500 + x); var x2 = Math.round(500 + x);
this.path = "M " + x2 + " " + y2 + " A 45 45,0,0,0, " + x1 + " " + y1 + " L 493 500 L 507 500 Z"; this.path = "M " + x2 + " " + y2 + " A 45 45,0,0,0, " + x1 + " " + y1 + " L 493 500 L 507 500 Z";
this.rotate = "rotate(" + Math.round(this.heading) + " 500 500)"; this.rotate = "rotate(" + Math.round(this.heading) + " 500 500)";
this.locTolerancePixels = this.locationTolerance; this.locTolerancePixels = this.locationTolerance;
@ -61,7 +61,7 @@ export class GpsLocation implements OnInit,OnChanges{
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
if (changes.position && this.instance) { if (changes.position && this.instance) {
const p = changes.position.currentValue as GeolocationPosition; var p = changes.position.currentValue as GeolocationPosition;
if(p && this.initialized) { if(p && this.initialized) {
this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude])); this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude]));
this.locationTolerance = p.coords.accuracy; this.locationTolerance = p.coords.accuracy;

View File

@ -1,5 +1,5 @@
import { Component, Host, Input, Output, EventEmitter,OnDestroy, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core'; import { Component, Host, Input, Output, EventEmitter,OnDestroy, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core';
import { LayerGroupComponent, MapComponent } from '@farmmaps/ng-openlayers'; import { LayerGroupComponent, MapComponent } from 'ngx-openlayers';
import { ItemService,IItem,AppConfig } from '@farmmaps/common'; import { ItemService,IItem,AppConfig } from '@farmmaps/common';
import { IItemLayer, ITemporalItemLayer} from '../../../models/item.layer'; import { IItemLayer, ITemporalItemLayer} from '../../../models/item.layer';
import { ILayerData} from '../../../models/layer.data'; import { ILayerData} from '../../../models/layer.data';
@ -19,7 +19,6 @@ import VectorTileLayer from 'ol/layer/VectorTile';
import {GeoJSON,MVT} from 'ol/format'; import {GeoJSON,MVT} from 'ol/format';
import { Geometry } from 'ol/geom'; import { Geometry } from 'ol/geom';
import BaseLayer from 'ol/layer/Base'; import BaseLayer from 'ol/layer/Base';
import Feature from 'ol/Feature';
@Component({ @Component({
selector: 'fm-map-item-layers', selector: 'fm-map-item-layers',
@ -36,7 +35,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
@Output() onFeatureHover: EventEmitter<any> = new EventEmitter<any>(); @Output() onFeatureHover: EventEmitter<any> = new EventEmitter<any>();
@Output() onPrerender: EventEmitter<any> = new EventEmitter<any>(); @Output() onPrerender: EventEmitter<any> = new EventEmitter<any>();
private _apiEndPoint: string; private _apiEndPoint: string;
private initialized = false; private initialized:boolean = false;
private mapEventHandlerInstalled = false; private mapEventHandlerInstalled = false;
private topLayerPrerenderEventhandlerInstalled = false; private topLayerPrerenderEventhandlerInstalled = false;
private selectedFeatures = {}; private selectedFeatures = {};
@ -50,7 +49,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
private styleCache = {} private styleCache = {}
componentToHex(c) { componentToHex(c) {
const hex = c.toString(16); var hex = c.toString(16);
return hex.length == 1 ? "0" + hex : hex; return hex.length == 1 ? "0" + hex : hex;
} }
@ -59,28 +58,28 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
} }
getColorFromGradient(layer: ILayer, value: number): IColor { getColorFromGradient(layer: ILayer, value: number): IColor {
const gradient: IGradientstop[] = layer.renderer.colorMap.gradient; var gradient: IGradientstop[] = layer.renderer.colorMap.gradient;
const histogram: IHistogram = layer.renderer.band.histogram; var histogram: IHistogram = layer.renderer.band.histogram;
const index = (value - histogram.min) / histogram.max; var index = (value - histogram.min) / histogram.max;
let min = gradient[0]; var min = gradient[0];
let max = gradient[gradient.length - 1]; var max = gradient[gradient.length - 1];
for (let n = 0; n < gradient.length; n++) { for (var n = 0; n < gradient.length; n++) {
const s = gradient[n]; var s = gradient[n];
if (s.relativestop <= index && min.relativestop < s.relativestop && n < gradient.length - 1) min = s; if (s.relativestop <= index && min.relativestop < s.relativestop && n < gradient.length - 1) min = s;
if (s.relativestop >= index && max.relativestop > s.relativestop && n > 0) max = s; if (s.relativestop >= index && max.relativestop > s.relativestop && n > 0) max = s;
} }
const i = index - min.relativestop; var i = index - min.relativestop;
const size = max.relativestop - min.relativestop; var size = max.relativestop - min.relativestop;
const alpha = Math.round(min.color.alpha + ((max.color.alpha - min.color.alpha) * i / size)); var alpha = Math.round(min.color.alpha + ((max.color.alpha - min.color.alpha) * i / size));
const red = Math.round(min.color.red + ((max.color.red - min.color.red) * i / size)); var red = Math.round(min.color.red + ((max.color.red - min.color.red) * i / size));
const green = Math.round(min.color.green + ((max.color.green - min.color.green) * i / size)); var green = Math.round(min.color.green + ((max.color.green - min.color.green) * i / size));
const blue = Math.round(min.color.blue + ((max.color.blue - min.color.blue) * i / size)); var blue = Math.round(min.color.blue + ((max.color.blue - min.color.blue) * i / size));
return { alpha: alpha, red: red, green: green, blue: blue }; return { alpha: alpha, red: red, green: green, blue: blue };
} }
getColorForValue(layer: ILayer, value: number): IColor { getColorForValue(layer: ILayer, value: number): IColor {
let color: IColor = { alpha:0,red:0,green:0,blue:0}; var color: IColor = { alpha:0,red:0,green:0,blue:0};
if(layer.renderer.colorMap.entries.length>0) { if(layer.renderer.colorMap.entries.length>0) {
color=layer.renderer.colorMap.noValue; color=layer.renderer.colorMap.noValue;
} }
@ -95,10 +94,10 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
} }
getColor(item: IItem, layer: ILayer, feature): style.Style { getColor(item: IItem, layer: ILayer, feature): style.Style {
const value = layer.indexKey ? feature.get(layer.indexKey) : feature.get(layer.name); var value = layer.indexKey ? feature.get(layer.indexKey) : feature.get(layer.name);
const key = item.code + "_" + value; var key = item.code + "_" + value;
if (!this.styleCache[key]) { if (!this.styleCache[key]) {
let color: IColor; var color: IColor;
if(layer.renderer.colorMap.colormapType == "manual") { if(layer.renderer.colorMap.colormapType == "manual") {
color = this.getColorForValue(layer, value); color = this.getColorForValue(layer, value);
} else { } else {
@ -126,32 +125,32 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
} }
createGeotiffLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> { createGeotiffLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
let layerIndex = -1; var layerIndex = -1;
let layer: Layer<Source> = null; var layer: Layer<Source> = null;
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index; layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
const source = new XYZ({ maxZoom: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` }); 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 }); layer = new Tile({ source: source });
const data = item.data; var data = item.data;
const l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null; var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null;
if (l && l.rendering && l.rendering.renderoutputType == "Tiles") { if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
const rt = l.rendering as IRenderoutputTiles; var rt = l.rendering as IRenderoutputTiles;
const source = new XYZ({crossOrigin: 'use-credentials', maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` }); let source = new XYZ({crossOrigin: 'use-credentials', maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` });
layer = new Tile({ source: source }); layer = new Tile({ source: source });
} }
if (l && l.rendering && l.rendering.renderoutputType == "Image") { if (l && l.rendering && l.rendering.renderoutputType == "Image") {
const ri = l.rendering as IRenderoutputImage; var ri = l.rendering as IRenderoutputImage;
const source = new ImageStatic({ imageExtent:ri.extent,projection:'EPSG:3857', crossOrigin: 'use-credentials', url: `${this._apiEndPoint}/api/v1/items/${item.code}/mapimage/${layerIndex}?v=${Date.parse(item.updated)}` }); let source = new ImageStatic({ imageExtent:ri.extent,projection:'EPSG:3857', crossOrigin: 'use-credentials', url: `${this._apiEndPoint}/api/v1/items/${item.code}/mapimage/${layerIndex}?v=${Date.parse(item.updated)}` });
layer = new Image({ source: source }); layer = new Image({ source: source });
} }
return layer; return layer;
} }
createShapeLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> { createShapeLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
let layerIndex = -1; var layerIndex = -1;
let layer: Layer<Source> = null; var layer: Layer<Source> = null;
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index; layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
const data = item.data; var data = item.data;
const l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null; var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null;
if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") { if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") {
var rt = l.rendering as IRenderoutputTiles; var rt = l.rendering as IRenderoutputTiles;
layer = new VectorTileLayer({ layer = new VectorTileLayer({
@ -176,15 +175,15 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
}) })
}); });
} else { } else {
const __this = this; let __this = this;
const format = new GeoJSON(); let format = new GeoJSON();
const source = new VectorSource({ let source = new VectorSource({
strategy: loadingstrategy.bbox, strategy: loadingstrategy.bbox,
loader: function (extent: Extent, resolution: number, projection: Projection) { loader: function (extent: Extent, resolution: number, projection: Projection) {
const source = this as VectorSource<Feature<Geometry>>; var source = this as VectorSource<Geometry>;
__this.itemService.getItemFeatures(item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) { __this.itemService.getItemFeatures(item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) {
const features = format.readFeatures(data).filter(feature => feature instanceof Feature) as Feature[]; var features = format.readFeatures(data);
for (const f of features) { for (let f of features) {
if (f.get("code")) { if (f.get("code")) {
f.setId(f.get("code")); f.setId(f.get("code"));
} }
@ -197,9 +196,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
declutter: true, declutter: true,
source: source, source: source,
style: (feature) => { style: (feature) => {
const key =feature.get("code") + "_" + feature.get("color"); var key =feature.get("code") + "_" + feature.get("color");
if (!this.styleCache[key]) { if (!this.styleCache[key]) {
const color = feature.get("color"); var color = feature.get("color");
this.styleCache[key] = new style.Style( this.styleCache[key] = new style.Style(
{ {
fill: new style.Fill({ fill: new style.Fill({
@ -236,11 +235,11 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
} }
createSelectionLayer(itemLayer:IItemLayer):Layer<Source> { createSelectionLayer(itemLayer:IItemLayer):Layer<Source> {
let layerIndex = -1; var layerIndex = -1;
const layer: Layer<Source> = null; var layer: Layer<Source> = null;
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index; layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index;
const data = itemLayer.item.data; var data = itemLayer.item.data;
const l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null; var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null;
if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") { if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") {
return new VectorTileLayer({ return new VectorTileLayer({
renderMode: 'vector', renderMode: 'vector',
@ -251,8 +250,8 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
return new style.Style( return new style.Style(
{ {
stroke: new style.Stroke({ stroke: new style.Stroke({
color: '#0d6efd', color: 'red',
width: 3 width: 2
}) })
} }
); );
@ -266,36 +265,36 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
} }
createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> { createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
const data = item.data as ILayerData; let data = item.data as ILayerData;
let layer: Layer<Source> = null; var layer: Layer<Source> = null;
switch (data.interfaceType) { switch (data.interfaceType) {
case 'OSM': { case 'OSM': {
const source = new OSM(); let source = new OSM();
layer = new Tile({ source: source }); layer = new Tile({ source: source });
break; break;
} }
case 'BingMaps': { case 'BingMaps': {
const source = new BingMaps(data.options); let source = new BingMaps(data.options);
layer = new Tile({ source: source }); layer = new Tile({ source: source });
break; break;
} }
case 'TileWMS': { case 'TileWMS': {
const source = new TileWMS(data.options); let source = new TileWMS(data.options);
layer = new Tile({ source: source }); layer = new Tile({ source: source });
break; break;
} }
case 'TileJSON': { case 'TileJSON': {
const source = new TileJSON(data.options); let source = new TileJSON(data.options);
layer = new Tile({ source: source }); layer = new Tile({ source: source });
break; break;
} }
case 'TileArcGISRest': { case 'TileArcGISRest': {
const source = new TileArcGISRest(data.options); let source = new TileArcGISRest(data.options);
layer = new Tile({ source: source }); layer = new Tile({ source: source });
break; break;
} }
case 'VectorWFSJson': { case 'VectorWFSJson': {
const source = new VectorSource({ let source = new VectorSource({
format: new GeoJSON(), format: new GeoJSON(),
url: function (extent) { url: function (extent) {
return ( return (
@ -318,8 +317,8 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
} }
createLayer(itemLayer: IItemLayer): Layer<Source> { createLayer(itemLayer: IItemLayer): Layer<Source> {
let layer: Layer<Source> = null; var layer: Layer<Source> = null;
const layerIndex = -1; var layerIndex = -1;
if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') { if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') {
layer = this.createGeotiffLayer(itemLayer.item,itemLayer); layer = this.createGeotiffLayer(itemLayer.item,itemLayer);
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.shape.processed') { } else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {
@ -328,8 +327,8 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
layer = this.createExternalLayer(itemLayer.item,itemLayer); layer = this.createExternalLayer(itemLayer.item,itemLayer);
} }
if (layer) { if (layer) {
const geometry = new GeoJSON().readGeometry(itemLayer.item.geometry); let geometry = new GeoJSON().readGeometry(itemLayer.item.geometry);
const extent = geometry ? proj.transformExtent(geometry.getExtent(), 'EPSG:4326', 'EPSG:3857') : null; let extent = geometry ? proj.transformExtent(geometry.getExtent(), 'EPSG:4326', 'EPSG:3857') : null;
if (extent) layer.setExtent(extent); if (extent) layer.setExtent(extent);
} }
@ -379,7 +378,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
if(this.topLayerPrerenderEventhandlerInstalled && this.onPrerender.observers.length > 0 ) if(this.topLayerPrerenderEventhandlerInstalled && this.onPrerender.observers.length > 0 )
{ {
if(this.instance.getVisible()) { if(this.instance.getVisible()) {
const olLayers = this.instance.getLayers().getArray().forEach((l:any) => { var olLayers = this.instance.getLayers().getArray().forEach((l:any) => {
l.un('prerender',this.topLayerPrerenderEventhandler); l.un('prerender',this.topLayerPrerenderEventhandler);
l.un('postrender',this.topLayerPostrenderEventhandler); l.un('postrender',this.topLayerPostrenderEventhandler);
}); });
@ -391,9 +390,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer<Source> { addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer<Source> {
if(!itemLayer) return null; if(!itemLayer) return null;
const olLayers = this.instance.getLayers(); var olLayers = this.instance.getLayers();
let layer = itemLayer.layer; var layer = itemLayer.layer;
const olIndex = olLayers.getArray().indexOf(layer); let olIndex = olLayers.getArray().indexOf(layer);
if (olIndex < 0) { if (olIndex < 0) {
// New layer: we add it to the map // New layer: we add it to the map
layer = this.createLayer(itemLayer); layer = this.createLayer(itemLayer);
@ -416,33 +415,33 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
updateLayers(itemLayers: IItemLayer[] | IItemLayer) { updateLayers(itemLayers: IItemLayer[] | IItemLayer) {
this.unInstallTopLayerPrerenderEventhandler(); this.unInstallTopLayerPrerenderEventhandler();
let dataLayer = false; let dataLayer = false;
let ils:IItemLayer[] = []; var ils:IItemLayer[] = [];
if(Array.isArray(itemLayers)) { if(Array.isArray(itemLayers)) {
ils = itemLayers; ils = itemLayers;
} else { } else {
dataLayer=true; dataLayer=true;
ils=[itemLayers]; ils=[itemLayers];
} }
const newLayers: Layer<Source>[] = []; let newLayers: Layer<Source>[] = [];
if (ils) { if (ils) {
ils.forEach((itemLayer, index) => { ils.forEach((itemLayer, index) => {
if(itemLayer.item.itemType == 'vnd.farmmaps.itemtype.temporal') { if(itemLayer.item.itemType == 'vnd.farmmaps.itemtype.temporal') {
const il = itemLayer as ITemporalItemLayer; let il = itemLayer as ITemporalItemLayer;
const previousLayer = this.addOrUpdateOlLayer(il.previousItemLayer,newLayers.length); let previousLayer = this.addOrUpdateOlLayer(il.previousItemLayer,newLayers.length);
if(previousLayer) newLayers.push(previousLayer); if(previousLayer) newLayers.push(previousLayer);
const selectedLayer = this.addOrUpdateOlLayer(il.selectedItemLayer,newLayers.length); let selectedLayer = this.addOrUpdateOlLayer(il.selectedItemLayer,newLayers.length);
if(selectedLayer) newLayers.push(selectedLayer); if(selectedLayer) newLayers.push(selectedLayer);
const nextLayer = this.addOrUpdateOlLayer(il.nextItemLayer,newLayers.length); let nextLayer = this.addOrUpdateOlLayer(il.nextItemLayer,newLayers.length);
if(nextLayer) newLayers.push(nextLayer); if(nextLayer) newLayers.push(nextLayer);
this.installTopLayerPrerenderEventhandler(selectedLayer); this.installTopLayerPrerenderEventhandler(selectedLayer);
} else { } else {
const layer = this.addOrUpdateOlLayer(itemLayer,newLayers.length); let layer = this.addOrUpdateOlLayer(itemLayer,newLayers.length);
if(layer) newLayers.push(layer); if(layer) newLayers.push(layer);
this.installTopLayerPrerenderEventhandler(layer); this.installTopLayerPrerenderEventhandler(layer);
} }
}); });
// Remove the layers that have disapeared from childrenLayers // Remove the layers that have disapeared from childrenLayers
const olLayers = this.instance.getLayers(); var olLayers = this.instance.getLayers();
while(olLayers.getLength() > newLayers.length) { while(olLayers.getLength() > newLayers.length) {
olLayers.removeAt(newLayers.length); olLayers.removeAt(newLayers.length);
} }
@ -468,20 +467,20 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
// select only when having observers // select only when having observers
if(event.type === 'click' && !this.onFeatureSelected.observers.length) return; 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;
const itemLayer= this.getItemlayer(this.itemLayer); let itemLayer= this.getItemlayer(this.itemLayer);
if(itemLayer && itemLayer.layer) { if(itemLayer && itemLayer.layer) {
this.selectedFeatures = {}; this.selectedFeatures = {};
if(itemLayer.layer ) { if(itemLayer.layer ) {
const minZoom = itemLayer.layer.getMinZoom(); let minZoom = itemLayer.layer.getMinZoom();
const currentZoom = this.map.instance.getView().getZoom(); let currentZoom = this.map.instance.getView().getZoom();
if(currentZoom>minZoom) { if(currentZoom>minZoom) {
itemLayer.layer.getFeatures(event.pixel).then((features) => { itemLayer.layer.getFeatures(event.pixel).then((features) => {
if(!features.length) { if(!features.length) {
this.onFeatureHover.emit(null); this.onFeatureHover.emit(null);
return; return;
} }
const fid = features[0].getId(); let fid = features[0].getId();
const feature = features[0]; let feature = features[0];
if(event.type === 'pointermove') { if(event.type === 'pointermove') {
this.selectedFeatures[fid] = features[0]; this.selectedFeatures[fid] = features[0];
this.onFeatureHover.emit({ "feature": feature,"itemCode":itemLayer.item.code }); this.onFeatureHover.emit({ "feature": feature,"itemCode":itemLayer.item.code });
@ -503,11 +502,11 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
if (this.instance && this.initialized) { if (this.instance && this.initialized) {
if (changes['itemLayers']) { if (changes['itemLayers']) {
const itemLayers = changes['itemLayers'].currentValue as IItemLayer[]; var itemLayers = changes['itemLayers'].currentValue as IItemLayer[];
this.updateLayers(itemLayers); this.updateLayers(itemLayers);
} }
if (changes['itemLayer']) { if (changes['itemLayer']) {
const itemLayer = changes['itemLayer'].currentValue as IItemLayer; var itemLayer = changes['itemLayer'].currentValue as IItemLayer;
this.itemLayer = itemLayer this.itemLayer = itemLayer
if(itemLayer) { if(itemLayer) {
if(this.getItemlayer(this.itemLayer).item.itemType == 'vnd.farmmaps.itemtype.shape.processed') { if(this.getItemlayer(this.itemLayer).item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {

View File

@ -1,6 +1,6 @@
import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken, OnDestroy, LOCALE_ID } from '@angular/core'; import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken } from '@angular/core';
import { LayerVectorComponent, SourceVectorComponent, MapComponent } from '@farmmaps/ng-openlayers'; import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-openlayers';
import { ItemService, ItemTypeService, IItem, IItemType, FolderService } from '@farmmaps/common'; import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common';
import { Feature } from 'ol'; import { Feature } from 'ol';
import { Point,Geometry } from 'ol/geom'; import { Point,Geometry } from 'ol/geom';
@ -17,9 +17,6 @@ import { GeoJSON } from 'ol/format';
import {Select} from 'ol/interaction'; import {Select} from 'ol/interaction';
import {IStyles} from '../../../models/style.cache'; import {IStyles} from '../../../models/style.cache';
import {FeatureIconService} from '../../../services/feature-icon.service'; import {FeatureIconService} from '../../../services/feature-icon.service';
import { Subscription } from 'rxjs';
import { getCenter } from 'ol/extent';
import { formatNumber } from '@angular/common';
@Component({ @Component({
selector: 'fm-map-item-source-vector', selector: 'fm-map-item-source-vector',
@ -28,12 +25,12 @@ import { formatNumber } from '@angular/common';
{ provide: SourceVectorComponent , useExisting: forwardRef(() => ItemVectorSourceComponent) } { provide: SourceVectorComponent , useExisting: forwardRef(() => ItemVectorSourceComponent) }
] ]
}) })
export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnDestroy, OnChanges { export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnChanges {
instance: Vector<Feature<Geometry>>; instance: Vector<Geometry>;
private _format: GeoJSON; private _format: GeoJSON;
private _select: Select; private _select: Select;
private _hoverSelect: Select; private _hoverSelect: Select;
private _iconScale = 0.05; private _iconScale: number = 0.05;
@Input() features: Array<Feature<Geometry>>; @Input() features: Array<Feature<Geometry>>;
@Input() selectedFeature: Feature<Geometry>; @Input() selectedFeature: Feature<Geometry>;
@Input() selectedItem: IItem; @Input() selectedItem: IItem;
@ -41,19 +38,17 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
@Output() onFeatureSelected: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>(); @Output() onFeatureSelected: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>();
@Output() onFeatureHover: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>(); @Output() onFeatureHover: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>();
private stylesCache:IStyles = {}; private stylesCache:IStyles = {};
private sub: Subscription;
private displayMapFeatureSettings: { [code: string]: string[] } = defaultDisplayMapFeatureSettings();
constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, private map: MapComponent, private itemTypeService: ItemTypeService, private featureIconService$: FeatureIconService, private folderService: FolderService, @Inject(LOCALE_ID) private locale: string) { constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, private map: MapComponent, private itemTypeService: ItemTypeService,private featureIconService$:FeatureIconService) {
super(layer); super(layer);
this._format = new GeoJSON(); this._format = new GeoJSON();
} }
geometry(feature: Feature<Geometry>) { geometry(feature: Feature<Geometry>) {
const view = this.map.instance.getView(); let view = this.map.instance.getView();
const resolution = view.getResolution(); let resolution = view.getResolution();
let geometry = feature.getGeometry(); var geometry = feature.getGeometry();
const e = geometry.getExtent(); let e = geometry.getExtent();
//var size = Math.max((e[2] - e[0]) / resolution, (e[3] - e[1]) / resolution); //var size = Math.max((e[2] - e[0]) / resolution, (e[3] - e[1]) / resolution);
if (resolution > 12) { if (resolution > 12) {
geometry = new Point(extent.getCenter(e)); geometry = new Point(extent.getCenter(e));
@ -62,9 +57,9 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
} }
getSelectedStyle(feature:Feature<Geometry>):style.Style { getSelectedStyle(feature:Feature<Geometry>):style.Style {
const key = feature.get('itemType') + "_selected"; let key = feature.get('itemType')+"_selected";
let evaluatedStyle: style.Style =undefined; let evaluatedStyle: style.Style =undefined;
const styleEntry = this.stylesCache[key]; var styleEntry = this.stylesCache[key];
if(styleEntry) { if(styleEntry) {
if(typeof styleEntry === 'function') { if(typeof styleEntry === 'function') {
evaluatedStyle = styleEntry(feature); evaluatedStyle = styleEntry(feature);
@ -81,18 +76,6 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
} }
ngOnInit() { ngOnInit() {
this.sub = this.folderService.getFolder('my_settings').subscribe(
userSettingsRoot => {
if (userSettingsRoot == undefined) return;
this.itemService.getChildItemList(userSettingsRoot.code, 'vnd.farmmaps.itemtype.settings.general').subscribe(
items => {
if (items && items.length > 0 && items[0].data?.displayMapFeatureSettings) {
this.displayMapFeatureSettings = items[0].data?.displayMapFeatureSettings;
}
}
)
}
);
this.strategy = loadingstrategy.bbox; this.strategy = loadingstrategy.bbox;
this.format = new GeoJSON(); this.format = new GeoJSON();
this._select = new Select({ this._select = new Select({
@ -130,12 +113,12 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
this.host.instance.setSource(this.instance); this.host.instance.setSource(this.instance);
this.host.instance.setStyle((feature) => { this.host.instance.setStyle((feature) => {
const itemType = feature.get('itemType'); var itemType = feature.get('itemType');
let key = itemType + (this.selectedItem ? "_I" : ""); var key = itemType + (this.selectedItem?"_I":"");
if (!this.stylesCache[key]) { if (!this.stylesCache[key]) {
if (this.itemTypeService.itemTypes[itemType]) { if (this.itemTypeService.itemTypes[itemType]) {
const itemTypeEntry = this.itemTypeService.itemTypes[itemType]; let itemTypeEntry = this.itemTypeService.itemTypes[itemType];
const fillColor = color.asArray(itemTypeEntry.iconColor); let fillColor = color.asArray(itemTypeEntry.iconColor);
fillColor[3] = 0; fillColor[3] = 0;
this.stylesCache[key] = new style.Style({ this.stylesCache[key] = new style.Style({
image: itemTypeEntry.icon ? new style.Icon({ image: itemTypeEntry.icon ? new style.Icon({
@ -150,31 +133,26 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
fill: new style.Fill({ fill: new style.Fill({
color: fillColor color: fillColor
}), }),
geometry: (feature: Feature<Geometry>) => this.geometry(feature), geometry:(feature:Feature<Geometry>) => this.geometry(feature)
text: this.getDisplayTextForFeature(feature, this.map.instance.getView().getZoom())
}); });
} else { } else {
key = 'file'; key = 'file';
} }
} }
let evaluatedStyle =null; let evaluatedStyle =null;
const styleEntry = this.stylesCache[key]; var styleEntry = this.stylesCache[key];
if(typeof styleEntry === 'function') { if(typeof styleEntry === 'function') {
evaluatedStyle = styleEntry(feature); evaluatedStyle = styleEntry(feature);
} else { } else {
evaluatedStyle = styleEntry; evaluatedStyle = styleEntry;
} }
if (evaluatedStyle && evaluatedStyle.geometry_ == null && !Array.isArray(evaluatedStyle)) { if(evaluatedStyle && evaluatedStyle.geometry_ == null) {
evaluatedStyle.setGeometry((feature) => this.geometry(feature)); evaluatedStyle.setGeometry((feature) => this.geometry(feature));
} }
return evaluatedStyle; return evaluatedStyle;
}); });
} }
ngOnDestroy(): void {
if (this.sub) this.sub.unsubscribe();
}
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
if (changes["features"] && this.instance) { if (changes["features"] && this.instance) {
this.instance.clear(true); this.instance.clear(true);
@ -183,8 +161,8 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
} }
if (changes["selectedFeature"] && this.instance) { if (changes["selectedFeature"] && this.instance) {
const features = this._hoverSelect.getFeatures(); var features = this._hoverSelect.getFeatures();
const feature = changes["selectedFeature"].currentValue var feature = changes["selectedFeature"].currentValue
//this.instance.clear(false); //this.instance.clear(false);
//this.instance.addFeatures(features.getArray()); //this.instance.addFeatures(features.getArray());
features.clear(); features.clear();
@ -194,15 +172,15 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
} }
} }
if (changes["selectedItem"] && this.instance) { if (changes["selectedItem"] && this.instance) {
const item = changes["selectedItem"].currentValue var item = changes["selectedItem"].currentValue
if (item) { if (item) {
this.map.instance.removeInteraction(this._hoverSelect); this.map.instance.removeInteraction(this._hoverSelect);
} else { } else {
this.map.instance.addInteraction(this._hoverSelect); this.map.instance.addInteraction(this._hoverSelect);
} }
} }
if (changes["styles"]) { if (changes["styles"] && this.instance) {
const styles = changes["styles"].currentValue; let styles = changes["styles"].currentValue;
for (const key in styles) { for (const key in styles) {
if (styles.hasOwnProperty(key)) { if (styles.hasOwnProperty(key)) {
this.stylesCache[key]=styles[key]; this.stylesCache[key]=styles[key];
@ -210,51 +188,4 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
} }
} }
} }
getDisplayTextForFeature(feature: Feature<Geometry>, zoom: number, overrule?: style.Text) {
if (!feature) return null;
const propertiesToShow: string[] = this.displayMapFeatureSettings[feature.get('itemType')];
if (!propertiesToShow) return null;
if (propertiesToShow.length <= 0) return null;
if (zoom < 14) return null;
let displayText = '';
for (let i = 0; i < propertiesToShow.length; i++) {
let value = feature.get(propertiesToShow[i]);
switch (propertiesToShow[i]) {
case "area": value = formatNumber(value, this.locale, '0.1-2') + ' ha'; break;
case "centroid": {
if (feature.getGeometry()) {
const centroid = getCenter(feature.getGeometry().getExtent());
value = Math.round(centroid[0]) + ',' + Math.round(centroid[1]);
}
}
if (value) {
displayText += value + (i < propertiesToShow.length ? '\n' : '');
}
}
const styleText = new style.Text({
font: '13px Calibri,sans-serif',
fill: new style.Fill({ color: '#ffffff' }),
stroke: new style.Stroke({ color: '#000000', width: 2 }),
text: displayText
});
if (overrule) {
if (overrule.getFont()) styleText.setFont(overrule.getFont());
if (overrule.getFill()) styleText.setFill(overrule.getFill());
if (overrule.getStroke()) styleText.setStroke(overrule.getStroke());
}
return styleText;
}
}
}
function defaultDisplayMapFeatureSettings() {
return {
'vnd.farmmaps.itemtype.cropfield': ['name', 'cropTypeName', 'area']
};
} }

View File

@ -9,8 +9,8 @@ import { IItemLayer } from '../../../models/item.layer';
export class LayerListComponent { export class LayerListComponent {
@Input() itemLayers: IItemLayer[] = []; @Input() itemLayers: IItemLayer[] = [];
@Input() baseLayers = false; @Input() baseLayers: boolean = false;
@Input() dataLayers = false; @Input() dataLayers: boolean = false;
@Output() onToggleVisibility = new EventEmitter<IItemLayer>(); @Output() onToggleVisibility = new EventEmitter<IItemLayer>();
@Output() onSetOpacity = new EventEmitter<{layer: IItemLayer,opacity:number }>(); @Output() onSetOpacity = new EventEmitter<{layer: IItemLayer,opacity:number }>();
@Output() onDelete = new EventEmitter<IItemLayer>(); @Output() onDelete = new EventEmitter<IItemLayer>();

View File

@ -7,7 +7,7 @@
<li class="border-top pt-1 pb-1 value" *ngFor="let layerValue of layers"> <li class="border-top pt-1 pb-1 value" *ngFor="let layerValue of layers">
<div>{{layerValue.layerName}}</div> <div>{{layerValue.layerName}}</div>
<div>{{layerValue.date|date}}</div> <div>{{layerValue.date|date}}</div>
<div><span *ngIf="layerValue.quantity"><span class="me-1">{{layerValue.quantity}}</span> </span><span class="me-1 font-weight-bold">{{getScaledValue(layerValue)}}</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> </li>
</ul> </ul>
<ng-template #no_data> <ng-template #no_data>
@ -15,4 +15,4 @@
</ng-template> </ng-template>
</div> </div>
</div> </div>
</div> </div>>

View File

@ -3,7 +3,7 @@ import { IItemLayer } from '../../../models/item.layer';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import * as mapReducers from '../../../reducers/map.reducer'; import * as mapReducers from '../../../reducers/map.reducer';
import * as mapActions from '../../../actions/map.actions'; import * as mapActions from '../../../actions/map.actions';
import { MapComponent } from '@farmmaps/ng-openlayers'; import { MapComponent } from 'ngx-openlayers';
import { ILayervalue } from '../../../models/layer.value'; import { ILayervalue } from '../../../models/layer.value';
import { Observable,interval,Subject } from 'rxjs'; import { Observable,interval,Subject } from 'rxjs';
import { debounce, throttle } from 'rxjs/operators'; import { debounce, throttle } from 'rxjs/operators';
@ -21,9 +21,9 @@ import { Point } from 'ol/geom';
export class LayerValuesComponent implements OnInit,AfterViewInit { export class LayerValuesComponent implements OnInit,AfterViewInit {
@ViewChild('layerValues') containerRef:ElementRef; @ViewChild('layerValues') containerRef:ElementRef;
offsetX$ = 0; offsetX$:number =0;
offsetY$ = 0; offsetY$:number =0;
lonlat$ = ""; lonlat$: string="";
wkt$= ""; wkt$= "";
layerValues$:Observable<Array<ILayervalue>> = this.store.select(mapReducers.selectGetLayerValues); layerValues$:Observable<Array<ILayervalue>> = this.store.select(mapReducers.selectGetLayerValues);
enabled$:Observable<boolean> = this.store.select(mapReducers.selectGetLayerValuesEnabled); enabled$:Observable<boolean> = this.store.select(mapReducers.selectGetLayerValuesEnabled);
@ -49,8 +49,8 @@ export class LayerValuesComponent implements OnInit, AfterViewInit {
} }
updateValuesLocation() { updateValuesLocation() {
const xy = this.map.instance.getCoordinateFromPixel([this.offsetX$, this.offsetY$]) var xy = this.map.instance.getCoordinateFromPixel([this.offsetX$,this.offsetY$])
const lonlat = toLonLat(xy); var lonlat = toLonLat(xy);
this.wkt$ = this.wktFormat$.writeGeometry(new Point(lonlat)) this.wkt$ = this.wktFormat$.writeGeometry(new Point(lonlat))
this.lonlat$ = toStringHDMS(lonlat); this.lonlat$ = toStringHDMS(lonlat);
this.store.dispatch(new mapActions.SetLayerValuesLocation(xy[0],xy[1])); this.store.dispatch(new mapActions.SetLayerValuesLocation(xy[0],xy[1]));
@ -59,12 +59,4 @@ export class LayerValuesComponent implements OnInit, AfterViewInit {
copyToClipboard() { copyToClipboard() {
this.clipboardService$.copy(this.wkt$); this.clipboardService$.copy(this.wkt$);
} }
public getScaledValue(layerValue: ILayervalue): number {
let v = layerValue.value;
if (layerValue.scale && layerValue.scale != 0) {
v = layerValue.scale * layerValue.value;
}
return v;
}
} }

View File

@ -1,9 +1,8 @@
import { Component, OnDestroy, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core'; import { Component, OnDestroy, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core';
import { LayerVectorComponent, MapComponent } from '@farmmaps/ng-openlayers'; import { LayerVectorComponent, MapComponent } from 'ngx-openlayers';
import RenderType from 'ol/layer/Vector'; import RenderType from 'ol/layer/Vector';
import { Vector as VectorSource } from 'ol/source'; import { Vector as VectorSource } from 'ol/source';
import { Geometry } from 'ol/geom'; import { Geometry } from 'ol/geom';
import Feature from 'ol/Feature';
@Component({ @Component({
selector: 'fm-map-aol-layer-vector-image', selector: 'fm-map-aol-layer-vector-image',
@ -15,7 +14,7 @@ export class LayerVectorImageComponent extends LayerVectorComponent implements O
//public source: Vector; //public source: Vector;
@Input() @Input()
renderMode: RenderType<VectorSource<Feature<Geometry>>> | string = "image"; renderMode: RenderType<VectorSource<Geometry>> | string = "image";
constructor(map: MapComponent) { constructor(map: MapComponent) {
super(map); super(map);

View File

@ -1,8 +1,11 @@
@import "~bootstrap/scss/bootstrap.scss";
.gps-location { .gps-location {
display:block; display:block;
width:2.5em; width:2.5em;
height:2.5em; height:2.5em;
background-color: var(--bs-body-bg); background-color: $body-bg;
background-size: contain; background-size: contain;
margin-top:0.5em; margin-top:0.5em;
border-radius: 1.75em; border-radius: 1.75em;
@ -14,15 +17,15 @@
} }
.pan-to { .pan-to {
fill: var(--bs-secondary); fill: $secondary;
} }
div.gps-location:hover .pan-to { div.gps-location:hover .pan-to {
fill: var(--bs-white); fill: $white;
} }
.pan-to-centered { .pan-to-centered {
fill: var(--bs-primary); fill: $primary;
} }
div.gps-location:hover .pan-to-centered { div.gps-location:hover .pan-to-centered {
@ -30,5 +33,5 @@ div.gps-location:hover .pan-to-centered {
} }
.pan-to.pan-to-disabled { .pan-to.pan-to-disabled {
fill: var(--bs-gray-300); fill: $gray-300;
} }

View File

@ -1,5 +1,5 @@
import { Component, OnInit, Input, Host, OnChanges, SimpleChanges,ChangeDetectorRef } from '@angular/core'; import { Component, OnInit, Input, Host, OnChanges, SimpleChanges,ChangeDetectorRef } from '@angular/core';
import { MapComponent } from '@farmmaps/ng-openlayers'; import { MapComponent } from 'ngx-openlayers';
import {IMapState} from '../../../models/map.state' import {IMapState} from '../../../models/map.state'
import {View} from 'ol'; import {View} from 'ol';
import { fromLonLat } from 'ol/proj'; import { fromLonLat } from 'ol/proj';
@ -43,12 +43,12 @@ export class PanToLocation implements OnInit,OnChanges{
public centered():boolean { public centered():boolean {
if(this.position && this.mapState) { if(this.position && this.mapState) {
const center = this.view.getCenter(); let center = this.view.getCenter();
const newCenter = fromLonLat([this.position.coords.longitude,this.position.coords.latitude]); let newCenter = fromLonLat([this.position.coords.longitude,this.position.coords.latitude]);
const x1 = newCenter[0].toFixed(0); let x1 = newCenter[0].toFixed(0);
const x2 = center[0].toFixed(0); let x2 = center[0].toFixed(0);
const y1 = newCenter[1].toFixed(0); let y1 = newCenter[1].toFixed(0);
const y2 = center[1].toFixed(0); let y2 = center[1].toFixed(0);
return x1==x2 && y1==y2; return x1==x2 && y1==y2;
} }
return false; return false;
@ -60,17 +60,17 @@ export class PanToLocation implements OnInit,OnChanges{
handleClick(event:Event) { handleClick(event:Event) {
if(this.position) { if(this.position) {
const view = this.map.instance.getView(); let view = this.map.instance.getView();
const newCenter = fromLonLat([this.position.coords.longitude,this.position.coords.latitude]); let newCenter = fromLonLat([this.position.coords.longitude,this.position.coords.latitude]);
const extent = [newCenter[0]-500,newCenter[1]-500,newCenter[0]+500,newCenter[1]+500]; let extent = [newCenter[0]-500,newCenter[1]-500,newCenter[0]+500,newCenter[1]+500];
const options = { padding: [0, 0, 0, 0],minResolution:1 }; var options = { padding: [0, 0, 0, 0],minResolution:1 };
const size = this.map.instance.getSize(); let size = this.map.instance.getSize();
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize); let rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
const threshold = 44 * rem; let threshold = 44 * rem;
let left = 1 * rem; var left = 1 * rem;
const right = 1 * rem; var right = 1 * rem;
let bottom = Math.round(size[1] / 2); var bottom = Math.round(size[1] / 2);
const top = 1 * rem; var top = 1 * rem;
if (size[0] > threshold) { if (size[0] > threshold) {
bottom = 1 * rem; bottom = 1 * rem;
left = 23 * rem; left = 23 * rem;

View File

@ -1,3 +1,5 @@
@import "~bootstrap/scss/bootstrap.scss";
.compass { .compass {
width:2.5em; width:2.5em;
height:2.5em; height:2.5em;
@ -11,7 +13,7 @@
#north { #north {
display: none; display: none;
fill:var(--bs-black); fill:$black;
} }
#top-l { #top-l {
@ -31,23 +33,23 @@
} }
div.compass:hover #top-l { div.compass:hover #top-l {
fill:var(--bs-white); fill:$white;
} }
div.compass:hover #top-r { div.compass:hover #top-r {
fill:var(--bs-gray-300); fill:$gray-300;
} }
div.compass:hover #bottom-l { div.compass:hover #bottom-l {
fill:var(--bs-gray-300); fill:$gray-300;
} }
div.compass:hover #bottom-r { div.compass:hover #bottom-r {
fill:var(--bs-white); fill:$white;
} }
div.compass:hover #north { div.compass:hover #north {
fill:var(--bs-white); fill:$white;
} }
.compass-n { .compass-n {

View File

@ -1,5 +1,5 @@
import { Component, Host, Input, OnInit, ChangeDetectorRef } from '@angular/core'; import { Component, Host, Input, OnInit, ChangeDetectorRef } from '@angular/core';
import { ViewComponent, MapComponent } from '@farmmaps/ng-openlayers'; import { ViewComponent, MapComponent } from 'ngx-openlayers';
import {View} from 'ol'; import {View} from 'ol';
@ -14,7 +14,7 @@ export class RotationResetComponent implements OnInit {
view: View; view: View;
public Rotation() { public Rotation() {
const rotation = this.view ? this.view.getRotation() : 0; let rotation = this.view ? this.view.getRotation() : 0;
return `rotate(${rotation}rad)`; return `rotate(${rotation}rad)`;
} }

View File

@ -1,6 +1,6 @@
import { Component, Host, Input, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core'; import { Component, Host, Input, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { ViewComponent, MapComponent } from '@farmmaps/ng-openlayers'; import { ViewComponent, MapComponent } from 'ngx-openlayers';
@Component({ @Component({
@ -10,19 +10,19 @@ import { ViewComponent, MapComponent } from '@farmmaps/ng-openlayers';
export class ZoomToExtentComponent implements OnChanges { export class ZoomToExtentComponent implements OnChanges {
view: ViewComponent; view: ViewComponent;
map: MapComponent; map: MapComponent;
paddingTop = 0; paddingTop: number = 0;
paddingLeft = 0; paddingLeft: number = 0;
paddingBottom = 0; paddingBottom: number = 0;
paddingRight = 0; paddingRight: number = 0;
@Input() extent: number[]; @Input() extent: number[];
@Input() animate = false; @Input() animate: boolean = false;
constructor(@Host() view: ViewComponent, @Host() map: MapComponent,route: ActivatedRoute ) { constructor(@Host() view: ViewComponent, @Host() map: MapComponent,route: ActivatedRoute ) {
this.view = view; this.view = view;
this.map = map; this.map = map;
if(route && route.snapshot && route.snapshot.data && route.snapshot.data["fm-map-zoom-to-extent"]) { if(route && route.snapshot && route.snapshot.data && route.snapshot.data["fm-map-zoom-to-extent"]) {
const params = route.snapshot.data["fm-map-zoom-to-extent"]; let params = route.snapshot.data["fm-map-zoom-to-extent"];
this.paddingTop = params["padding-top"] ? params["padding-top"] : 0; this.paddingTop = params["padding-top"] ? params["padding-top"] : 0;
this.paddingBottom = params["padding-bottom"] ? params["padding-bottom"] : 0; this.paddingBottom = params["padding-bottom"] ? params["padding-bottom"] : 0;
this.paddingLeft = params["padding-left"] ? params["padding-left"] : 0; this.paddingLeft = params["padding-left"] ? params["padding-left"] : 0;
@ -32,14 +32,14 @@ export class ZoomToExtentComponent implements OnChanges {
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
if (this.extent) { if (this.extent) {
const options = { padding: [0, 0, 0, 0],minResolution:1 }; var options = { padding: [0, 0, 0, 0],minResolution:1 };
const size = this.map.instance.getSize(); let size = this.map.instance.getSize();
const rem = parseFloat(getComputedStyle(document.documentElement).fontSize); let rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
const threshold = 40 * rem; let threshold = 40 * rem;
let left = 1 * rem; var left = 1 * rem;
const right = 1 * rem; var right = 1 * rem;
let bottom = Math.round((size[1] / 2) + (4*rem)); var bottom = Math.round((size[1] / 2) + (4*rem));
const top = 1 * rem; var top = 1 * rem;
if (size[0] > threshold) { if (size[0] > threshold) {
bottom = 5 * rem; bottom = 5 * rem;
left = 23 * rem; left = 23 * rem;

View File

@ -1,10 +1,14 @@
@import "~bootstrap/scss/bootstrap.scss";
.row { .row {
border-bottom: 1px solid var(--bs-gray-500); border-bottom: 1px solid $gray-500;
user-select: none; user-select: none;
} }
.row.selected { .row.selected {
background-color: var(--bs-gray-100); background-color: $gray-100;
} }
@media screen and (min-width: 44rem) { @media screen and (min-width: 44rem) {

View File

@ -33,7 +33,7 @@ export class FeatureListContainerComponent {
let componentFactory: ComponentFactory<AbstractFeatureListComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListComponent); // default let componentFactory: ComponentFactory<AbstractFeatureListComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListComponent); // default
let selected = -1; let selected = -1;
let maxMatches =0; let maxMatches =0;
const showItem = true; let showItem = true;
for (let i = 0; i < this.featureLists.length; i++) { for (let i = 0; i < this.featureLists.length; i++) {
let matches=0; let matches=0;
let criteria=0; let criteria=0;
@ -64,9 +64,9 @@ export class FeatureListContainerComponent {
viewContainerRef.clear(); viewContainerRef.clear();
if(showItem) { if(showItem) {
this.componentRef = viewContainerRef.createComponent(componentFactory); this.componentRef = viewContainerRef.createComponent(componentFactory);
(<AbstractFeatureListComponent>this.componentRef.instance).features = this.features; (<AbstractFeatureListComponent>this.componentRef.instance).features = null;
(<AbstractFeatureListComponent>this.componentRef.instance).queryState = this.queryState; (<AbstractFeatureListComponent>this.componentRef.instance).queryState = queryState;
(<AbstractFeatureListComponent>this.componentRef.instance).selectedFeature = this.selectedFeature; (<AbstractFeatureListComponent>this.componentRef.instance).selectedFeature = null;
} }
} }

View File

@ -1,20 +1,22 @@
@import "~bootstrap/scss/bootstrap.scss";
fm-map-feature-list-feature-container { fm-map-feature-list-feature-container {
width:100%; width:100%;
pointer-events:none; pointer-events:none;
} }
.row { .row {
border-bottom: 1px solid var(--bs-gray-500); border-bottom: 1px solid $gray-500;
user-select: none; user-select: none;
padding-left:1.5rem; padding-left:1.5rem;
} }
.row.selected { .row.selected {
background-color: var(--bs-gray-100); background-color: $gray-100;
} }
.cropfields { .cropfields {
border-top: 1px solid var(--bs-gray-500); border-top: 1px solid $gray-500;
margin-left: -1.25rem; margin-left: -1.25rem;
margin-right: -1.25rem; margin-right: -1.25rem;
} }

View File

@ -1,20 +1,22 @@
@import "~bootstrap/scss/bootstrap.scss";
fm-map-feature-list-feature-container { fm-map-feature-list-feature-container {
width:100%; width:100%;
pointer-events:none; pointer-events:none;
} }
.row { .row {
border-bottom: 1px solid var(--bs-gray-500); border-bottom: 1px solid $gray-500;
user-select: none; user-select: none;
padding-left:1.5rem; padding-left:1.5rem;
} }
.row.selected { .row.selected {
background-color: var(--bs-gray-100); background-color: $gray-100;
} }
.farms { .farms {
border-top: 1px solid var(--bs-gray-500); border-top: 1px solid $gray-500;
margin-left: -1.25rem; margin-left: -1.25rem;
margin-right: -1.25rem; margin-right: -1.25rem;
} }

View File

@ -25,7 +25,7 @@ export class FeatureListCroppingschemeComponent extends AbstractFeatureListCompo
} }
getAction(feature:Feature<Geometry>):Action { getAction(feature:Feature<Geometry>):Action {
const queryState = tassign(mapReducers.initialState.queryState, { parentCode: feature.get('code'), itemType: "vnd.farmmaps.itemtype.cropfield" }); var queryState = tassign(mapReducers.initialState.queryState, { parentCode: feature.get('code'), itemType: "vnd.farmmaps.itemtype.cropfield" });
return new mapActions.DoQuery(queryState); return new mapActions.DoQuery(queryState);
} }
} }

View File

@ -24,7 +24,7 @@ export class FeatureListFeatureContainerComponent {
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective; @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
loadComponent() { loadComponent() {
let componentFactory: ComponentFactory<AbstractFeatureListFeatureComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListFeatureComponent); // default var componentFactory: ComponentFactory<AbstractFeatureListFeatureComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListFeatureComponent); // default
let selected = -1; let selected = -1;
let maxMatches =0; let maxMatches =0;

View File

@ -1,3 +1,7 @@
@import "~bootstrap/scss/bootstrap.scss";
.card-title { .card-title {
font-size: 1rem; font-size: 1rem;
white-space: nowrap; white-space: nowrap;

View File

@ -27,7 +27,7 @@ export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFea
areaInHa(feature:Feature<Geometry>):number { areaInHa(feature:Feature<Geometry>):number {
if(!feature) return 0; if(!feature) return 0;
// get area from faeture if 0 calculate from polygon // get area from faeture if 0 calculate from polygon
const a = feature.get('area'); let a = feature.get('area');
if(a) return a; if(a) return a;
return getArea(feature.getGeometry(),{projection:"EPSG:3857"}) / 10000; return getArea(feature.getGeometry(),{projection:"EPSG:3857"}) / 10000;
} }

View File

@ -1,3 +1,7 @@
@import "~bootstrap/scss/bootstrap.scss";
.card-title { .card-title {
font-size: 1rem; font-size: 1rem;
white-space: nowrap; white-space: nowrap;

View File

@ -1,3 +1,7 @@
@import "~bootstrap/scss/bootstrap.scss";
.card-title { .card-title {
font-size: 1rem; font-size: 1rem;
white-space: nowrap; white-space: nowrap;

View File

@ -1,13 +1,15 @@
@import "~bootstrap/scss/bootstrap.scss";
fm-map-feature-list-feature-container { fm-map-feature-list-feature-container {
width: 100%; width: 100%;
pointer-events: none; pointer-events: none;
} }
.row { .row {
border-bottom: 1px solid var(--bs-gray-500); border-bottom: 1px solid $gray-500;
user-select: none; user-select: none;
} }
.row.selected { .row.selected {
background-color: var(--bs-gray-100); background-color: $gray-100;
} }

View File

@ -23,14 +23,13 @@ export abstract class AbstractFeatureListComponent {
handleFeatureClick(feature:Feature<Geometry>) { handleFeatureClick(feature:Feature<Geometry>) {
if(feature) { if(feature) {
this.store.dispatch(new mapActions.ClickFeature(feature)); let action = this.getAction(feature);
const action = this.getAction(feature);
this.store.dispatch(action); this.store.dispatch(action);
} }
} }
getAction(feature:Feature<Geometry>):Action { getAction(feature:Feature<Geometry>):Action {
const newQuery: any = tassign(mapReducers.initialState.queryState); var newQuery: any = tassign(mapReducers.initialState.queryState);
newQuery.parentCode = feature.get('parentCode'); newQuery.parentCode = feature.get('parentCode');
newQuery.itemCode = feature.get('code'); newQuery.itemCode = feature.get('code');
newQuery.itemType = feature.get('itemType'); newQuery.itemType = feature.get('itemType');

View File

@ -30,7 +30,7 @@ export class GeometryThumbnailComponent implements AfterViewInit {
this.geometry, this.geometry,
this.width, this.width,
this.height); this.height);
} };
private defaultStyle:style.Style = new style.Style({ private defaultStyle:style.Style = new style.Style({
stroke: new style.Stroke({ color: 'black',width:1.5 }) stroke: new style.Stroke({ color: 'black',width:1.5 })
@ -52,24 +52,24 @@ export class GeometryThumbnailComponent implements AfterViewInit {
this.height); this.height);
} }
private width = 0; private width:number = 0;
private height = 0; private height:number = 0;
render(canvas,style:style.Style,geometry:Geometry,width:number,height:number) { render(canvas,style:style.Style,geometry:Geometry,width:number,height:number) {
if(canvas && canvas.nativeElement && geometry && style) { if(canvas && canvas.nativeElement && geometry && style) {
const renderContext = render.toContext(canvas.nativeElement.getContext( '2d'),{ size: [width, height] }); let renderContext = render.toContext(canvas.nativeElement.getContext( '2d'),{ size: [width, height] });
const geom = geometry.clone() as Polygon, let geom = geometry.clone() as Polygon,
line = geom.getCoordinates()[0], line = geom.getCoordinates()[0],
e = extent.boundingExtent( line ); e = extent.boundingExtent( line );
const dxy = extent.getCenter(e), let dxy = extent.getCenter(e),
sxy = [ sxy = [
(width - 2 ) / extent.getWidth(e), (width - 2 ) / extent.getWidth(e),
(height - 2 ) / extent.getHeight(e) (height - 2 ) / extent.getHeight(e)
]; ];
const dx = dxy[0], let dx = dxy[0],
dy = dxy[1], dy = dxy[1],
sx = sxy[0], sx = sxy[0],
sy = sxy[1]; sy = sxy[1];

View File

@ -1,7 +1,7 @@
import { Directive, ViewContainerRef,TemplateRef,OnInit,Input, OnChanges } from '@angular/core'; import { Directive, ViewContainerRef,TemplateRef,OnInit,Input, OnChanges } from '@angular/core';
import { Layer } from 'ol/layer'; import { Layer } from 'ol/layer';
import { Source } from 'ol/source'; import { Source } from 'ol/source';
import { MapComponent } from '@farmmaps/ng-openlayers'; import { MapComponent } from 'ngx-openlayers';
@Directive({ @Directive({
selector: '[fmMapIfZoomToShow]', selector: '[fmMapIfZoomToShow]',
@ -43,9 +43,9 @@ export class ifZoomToShowDirective implements OnInit {
checkZoom() { checkZoom() {
if(this.layer$ && this.map$.instance) { if(this.layer$ && this.map$.instance) {
const minZoom = this.layer$.getMinZoom(); let minZoom = this.layer$.getMinZoom();
const currentZoom = this.map$.instance.getView().getZoom(); let currentZoom = this.map$.instance.getView().getZoom();
const view = currentZoom < minZoom; let view = currentZoom < minZoom;
if(view!= this.showView) { if(view!= this.showView) {
this.viewContainerRef$.clear(); this.viewContainerRef$.clear();
this.showView=view; this.showView=view;

View File

@ -23,11 +23,11 @@ export class ItemListItemContainerComponent {
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective; @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
loadComponent() { loadComponent() {
let componentFactory: ComponentFactory<AbstractItemListItemComponent> = this.componentFactoryResolver.resolveComponentFactory(ItemListItemComponent); // default var componentFactory: ComponentFactory<AbstractItemListItemComponent> = this.componentFactoryResolver.resolveComponentFactory(ItemListItemComponent); // default
let selected = -1; let selected = -1;
let maxMatches =0; let maxMatches =0;
const showItem = true; let showItem = true;
for (let i = 0; i < this.itemComponentList.length; i++) { for (let i = 0; i < this.itemComponentList.length; i++) {
let matches=0; let matches=0;
let criteria=0; let criteria=0;

View File

@ -1,3 +1,5 @@
@import "~bootstrap/scss/bootstrap.scss";
.widget { .widget {
padding:0.8rem; padding:0.8rem;
height:100%; height:100%;

View File

@ -13,7 +13,7 @@ export abstract class AbstractItemListItemComponent {
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService) { constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService) {
} }
getScaledValue(value:number,scale = 0):number { getScaledValue(value:number,scale:number = 0):number {
let v = value; let v = value;
if(scale && scale != 0) { if(scale && scale != 0) {
v=scale*value; v=scale*value;
@ -30,7 +30,7 @@ export abstract class AbstractItemWidgetComponent {
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService) { constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService) {
} }
getScaledValue(value:number,scale = 0):number { getScaledValue(value:number,scale:number = 0):number {
let v = value; let v = value;
if(scale && scale != 0) { if(scale && scale != 0) {
v=scale*value; v=scale*value;

View File

@ -1,3 +1,5 @@
@import "~bootstrap/scss/bootstrap.scss";
.widget-container { .widget-container {
overflow:auto; overflow:auto;
margin-bottom:1rem; margin-bottom:1rem;
@ -5,7 +7,7 @@
.widget { .widget {
position:relative; position:relative;
border: 1px solid var(--bs-gray-500); border: 1px solid $gray-500;
user-select: none; user-select: none;
display:inline-block; display:inline-block;
width:50%; width:50%;
@ -26,7 +28,7 @@
} }
.widget:hover { .widget:hover {
background-color: var(--bs-gray-100); background-color: $gray-100;
} }
.widget-container { .widget-container {

View File

@ -15,7 +15,7 @@ export abstract class AbstractItemListComponent {
} }
handleItemClick(item:IListItem) { handleItemClick(item:IListItem) {
const newQuery: any = tassign(mapReducers.initialState.query); var newQuery: any = tassign(mapReducers.initialState.query);
newQuery.itemCode = item.code; newQuery.itemCode = item.code;
this.store.dispatch(new mapActions.DoQuery(newQuery)); this.store.dispatch(new mapActions.DoQuery(newQuery));
} }

View File

@ -1,3 +1,5 @@
@import "~bootstrap/scss/bootstrap.scss";
.widget-container { .widget-container {
overflow:auto; overflow:auto;
margin-bottom:1rem; margin-bottom:1rem;
@ -5,7 +7,7 @@
.widget { .widget {
position:relative; position:relative;
border: 1px solid var(--bs-gray-500); border: 1px solid $gray-500;
user-select: none; user-select: none;
display:inline-block; display:inline-block;
width:50%; width:50%;
@ -26,7 +28,7 @@
} }
.widget:hover { .widget:hover {
background-color: var(--bs-gray-100); background-color: $gray-100;
} }
.widget-container { .widget-container {

View File

@ -23,10 +23,10 @@ export class ItemWidgetListComponent implements AfterViewInit {
} }
ngAfterViewInit() { ngAfterViewInit() {
const targets = this.widgetTargets.toArray(); let targets = this.widgetTargets.toArray();
if(this.widgets) { if(this.widgets) {
for (let i = 0; i < this.widgets.length; i++) { for (var i = 0; i < this.widgets.length; i++) {
const componentFactory: ComponentFactory<AbstractItemWidgetComponent> = this.componentFactoryResolver.resolveComponentFactory(this.widgets[i]['constructor'] as any); var componentFactory: ComponentFactory<AbstractItemWidgetComponent> = this.componentFactoryResolver.resolveComponentFactory(this.widgets[i]['constructor'] as any);
const viewContainerRef = targets[i]; const viewContainerRef = targets[i];
viewContainerRef.clear(); viewContainerRef.clear();

View File

@ -1,15 +1,18 @@
@import "~bootstrap/scss/bootstrap.scss";
.layer-switcher { .layer-switcher {
display:block; display:block;
width:2.5em; width:2.5em;
height:2.5em; height:2.5em;
background-color: var(--bs-body-bg); background-color: $body-bg;
background-size: contain; background-size: contain;
margin-top:0.5em; margin-top:0.5em;
text-align: center; text-align: center;
line-height: 2.5em; line-height: 2.5em;
border-radius: 1.75em; border-radius: 1.75em;
padding: 0; padding: 0;
color: var(--bs-secondary); color: $secondary;
} }
.layer-switcher i { .layer-switcher i {
@ -21,7 +24,7 @@
} }
.layers { .layers {
color:var(--bs-secondary); color:$secondary;
position: absolute; position: absolute;
overflow: hidden; overflow: hidden;
bottom: -1em; bottom: -1em;

View File

@ -62,7 +62,7 @@ export class LayerSwitcher implements OnInit,OnChanges{
} }
handleZoomToExtent(itemLayer: IItemLayer) { handleZoomToExtent(itemLayer: IItemLayer) {
const extent = createEmpty(); var extent = createEmpty();
extend(extent, itemLayer.layer.getExtent()); extend(extent, itemLayer.layer.getExtent());
if (extent) { if (extent) {
this.store.dispatch(new mapActions.SetExtent(extent)); this.store.dispatch(new mapActions.SetExtent(extent));

View File

@ -1,15 +1,15 @@
<div class="row ps-3"> <div class="row ps-3">
<div class="col-8 nopadding"><span i18n>Average</span>:</div> <div class="col-8 nopadding"><span i18n>Average</span>:</div>
<div class="col-4 pull-left nopadding">{{ getScaledValue(histogram.mean)| number:'1.0-2'}}</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> <div class="col-8 nopadding"><span i18n>Standard deviation</span>:</div>
<div class="col-4 pull-left nopadding">{{ getScaledValue(histogram.stddev)| number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{histogram.stddev| number:'1.0-2'}}</div>
<div class="col-8 nopadding"><span i18n>Min</span>:</div> <div class="col-8 nopadding"><span i18n>Min</span>:</div>
<div class="col-4 pull-left nopadding">{{ getScaledValue(histogram.min)| number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{histogram.min| number:'1.0-2'}}</div>
<div class="col-8 nopadding" ><span i18n>Max</span>:</div> <div class="col-8 nopadding" ><span i18n>Max</span>:</div>
<div class="col-4 pull-left nopadding">{{ getScaledValue(histogram.max)| number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{histogram.max| number:'1.0-2'}}</div>
<ng-container *ngIf="showConfidenceInterval()"> <ng-container *ngIf="showConfidenceInterval()">
<div class="col-8 nopadding"><span i18n>Confidence interval</span>:</div> <div class="col-8 nopadding"><span i18n>Confidence interval</span>:</div>
<div class="col-4 pull-left nopadding">{{ getScaledValue(histogram.confidence * 100)| number:'1.0-0'}}%</div> <div class="col-4 pull-left nopadding">{{histogram.confidence * 100| number:'1.0-0'}}%</div>
</ng-container> </ng-container>
</div> </div>

View File

@ -14,17 +14,6 @@ export class HistogramDetailsComponent {
@Input() @Input()
histogram: IHistogram; histogram: IHistogram;
@Input()
scale: number | null;
public getScaledValue(value: number): number {
let v = value;
if (this.scale && this.scale != 0) {
v = this.scale * value;
}
return v;
}
showConfidenceInterval(): boolean { showConfidenceInterval(): boolean {
return this.histogram.confidence != null && this.histogram.confidence !== 1; return this.histogram.confidence != null && this.histogram.confidence !== 1;
} }

View File

@ -31,11 +31,11 @@
<td colspan="4" class="pb-1 pt-1"> <td colspan="4" class="pb-1 pt-1">
<div class="info" [ngbCollapse]="hideHistogramDetails"> <div class="info" [ngbCollapse]="hideHistogramDetails">
<ng-container *ngIf="bandContainsStatistics(); else histogram"> <ng-container *ngIf="bandContainsStatistics(); else histogram">
<fm-map-statistics-details [statistics]="layer.renderer.band.statistics" [scale]="layer.scale"></fm-map-statistics-details> <fm-map-statistics-details [statistics]="layer.renderer.band.statistics"></fm-map-statistics-details>
</ng-container> </ng-container>
<ng-template #histogram> <ng-template #histogram>
<fm-map-histogram-details [histogram]="layer.renderer.band.histogram" [scale]="layer.scale"></fm-map-histogram-details> <fm-map-histogram-details [histogram]="layer.renderer.band.histogram"></fm-map-histogram-details>
</ng-template> </ng-template>
</div> </div>
</td> </td>

View File

@ -29,7 +29,7 @@ export class LegendComponent implements OnInit,AfterViewInit {
histogram: string; histogram: string;
@Input() @Input()
showTitle = true; showTitle: boolean = true;
@Input() @Input()
histogramenabled: boolean; histogramenabled: boolean;
@ -40,7 +40,7 @@ export class LegendComponent implements OnInit,AfterViewInit {
@Input() @Input()
histogramunit: string; histogramunit: string;
public hideHistogramDetails = true; public hideHistogramDetails:boolean = true;
onClickHistoGram(): void { onClickHistoGram(): void {
this.histogramenabled = !this.histogramenabled; this.histogramenabled = !this.histogramenabled;
@ -63,9 +63,9 @@ export class LegendComponent implements OnInit,AfterViewInit {
} }
public getPart(renderer: IRenderer, index: number): string { public getPart(renderer: IRenderer, index: number): string {
const max = renderer.band.histogram.entries.reduce((max, entry) => entry.freqency > max ? entry.freqency : max, 0); let max = renderer.band.histogram.entries.reduce((max, entry) => entry.freqency > max ? entry.freqency : max, 0);
const scale = 65 / max; let scale = 65 / max;
const part = (renderer.band.histogram.entries[index].freqency * scale) + "%"; let part = (renderer.band.histogram.entries[index].freqency * scale) + "%";
return part; return part;
} }
@ -79,8 +79,8 @@ export class LegendComponent implements OnInit,AfterViewInit {
} }
public getPercentage(renderer: IRenderer, index: number): number { public getPercentage(renderer: IRenderer, index: number): number {
const scale = 100 / renderer.band.histogram.entries.reduce((sum, entry) => sum + entry.freqency, 0); let scale = 100 / renderer.band.histogram.entries.reduce((sum, entry) => sum + entry.freqency, 0);
const percent = renderer.band.histogram.entries[index].freqency * scale; let percent = renderer.band.histogram.entries[index].freqency * scale;
return percent < 0.1 ? null : percent; return percent < 0.1 ? null : percent;
} }

View File

@ -2,23 +2,23 @@
<div class="col-8 nopadding"><span i18n>Data points</span>:</div> <div class="col-8 nopadding"><span i18n>Data points</span>:</div>
<div class="col-4 pull-left nopadding">{{statistics.populationCount}}</div> <div class="col-4 pull-left nopadding">{{statistics.populationCount}}</div>
<div class="col-8 nopadding"><span i18n>Min</span>:</div> <div class="col-8 nopadding"><span i18n>Min</span>:</div>
<div class="col-4 pull-left nopadding">{{getScaledValue(statistics.min)| number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{statistics.min| number:'1.0-2'}}</div>
<div class="col-8 nopadding"><span i18n>Max</span>:</div> <div class="col-8 nopadding"><span i18n>Max</span>:</div>
<div class="col-4 pull-left nopadding">{{getScaledValue(statistics.max)| number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{statistics.max| number:'1.0-2'}}</div>
<div class="col-8 nopadding"><span i18n>Min+1</span>:</div> <div class="col-8 nopadding"><span i18n>Min+1</span>:</div>
<div class="col-4 pull-left nopadding">{{getScaledValue(statistics.minPlus)| number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{statistics.minPlus| number:'1.0-2'}}</div>
<div class="col-8 nopadding"><span i18n>Max-1</span>:</div> <div class="col-8 nopadding"><span i18n>Max-1</span>:</div>
<div class="col-4 pull-left nopadding">{{getScaledValue(statistics.maxMinus)| number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{statistics.maxMinus| number:'1.0-2'}}</div>
<div class="col-8 nopadding"><span i18n>Average</span>:</div> <div class="col-8 nopadding"><span i18n>Average</span>:</div>
<div class="col-4 pull-left nopadding">{{getScaledValue(statistics.mean)| number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{statistics.mean| number:'1.0-2'}}</div>
<div class="col-8 nopadding"><span i18n>Standard deviation</span>:</div> <div class="col-8 nopadding"><span i18n>Standard deviation</span>:</div>
<div class="col-4 pull-left nopadding">{{getScaledValue(statistics.stddev)| number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{statistics.stddev| number:'1.0-2'}}</div>
<div class="col-8 nopadding"><span i18n>Mode</span>:</div> <div class="col-8 nopadding"><span i18n>Mode</span>:</div>
<div class="col-4 pull-left nopadding">{{getScaledValue(statistics.mode)| number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{statistics.mode| number:'1.0-2'}}</div>
<div class="col-8 nopadding"><span i18n>Median</span>:</div> <div class="col-8 nopadding"><span i18n>Median</span>:</div>
<div class="col-4 pull-left nopadding">{{getScaledValue(statistics.median)| number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{statistics.median| number:'1.0-2'}}</div>
<div class="col-8 nopadding"><span i18n>Kurtosis</span>:</div> <div class="col-8 nopadding"><span i18n>Kurtosis</span>:</div>
<div class="col-4 pull-left nopadding">{{statistics.curtosis| number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{statistics.curtosis| number:'1.0-2'}}</div>
@ -26,11 +26,11 @@
<div class="col-4 pull-left nopadding">{{statistics.skewness| number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{statistics.skewness| number:'1.0-2'}}</div>
<div class="col-8 nopadding"><span i18n>Variance</span>:</div> <div class="col-8 nopadding"><span i18n>Variance</span>:</div>
<div class="col-4 pull-left nopadding">{{getSquaredScaledValue(statistics.variance)| number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{statistics.variance| number:'1.0-2'}}</div>
<div class="col-8 nopadding"><span i18n>Coefficient of variation</span>:</div> <div class="col-8 nopadding"><span i18n>Coefficient of variation</span>:</div>
<div class="col-4 pull-left nopadding">{{statistics.variationCoefficient | number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{statistics.variationCoefficient | number:'1.0-2'}}</div>
<ng-container *ngIf="statistics.confidenceIntervalLow !== undefined"> <ng-container *ngIf="statistics.confidenceIntervalLow !== undefined">
<div class="col-8 nopadding">90% <span i18n>Confidence interval</span>:</div> <div class="col-8 nopadding">90% <span i18n>Confidence interval</span>:</div>
<div class="col-4 pull-left nopadding">{{getScaledValue(statistics.confidenceIntervalLow) | number:'1.0-2'}} - {{getScaledValue(statistics.confidenceIntervalHigh) | number:'1.0-2'}}</div> <div class="col-4 pull-left nopadding">{{statistics.confidenceIntervalLow | number:'1.0-2'}} - {{statistics.confidenceIntervalHigh | number:'1.0-2'}}</div>
</ng-container> </ng-container>
</div> </div>

View File

@ -13,23 +13,4 @@ export class StatisticsDetailsComponent {
@Input() @Input()
statistics: IStatistics; statistics: IStatistics;
@Input()
scale: number | null;
public getScaledValue(value: number): number {
let v = value;
if (this.scale && this.scale != 0) {
v = this.scale * value;
}
return v;
}
public getSquaredScaledValue(value: number): number {
let v = value;
if (this.scale && this.scale != 0) {
v = (this.scale * this.scale) * value;
}
return v;
}
} }

View File

@ -1,3 +1,5 @@
@import "~bootstrap/scss/bootstrap.scss";
div.map-search { div.map-search {
position: absolute; position: absolute;
top: 0.5rem; top: 0.5rem;
@ -104,7 +106,7 @@ div.map-search.searchcollapsed button[type="submit"] {
} }
.form-control, .form-control:focus { .form-control, .form-control:focus {
border-color: var(--bs-secondary); border-color: $secondary;
} }

View File

@ -50,21 +50,21 @@ export class MapSearchComponent {
} }
} }
public collapsedLocal = true; public collapsedLocal: boolean = true;
public searchMinifiedLocal = false; public searchMinifiedLocal: boolean = false;
public periodLocal: IPeriodState = { startDate:new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1), endDate:new Date(Date.now())}; public periodLocal: IPeriodState = { startDate:new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1), endDate:new Date(Date.now())};
public filterOptionsLocal: IQueryState; public filterOptionsLocal: IQueryState;
private extent: number[]; private extent: number[];
public searchTextLocal: any; public searchTextLocal: any;
public searchTextLocalOutput: string; public searchTextLocalOutput: string;
public dateFilter = true; public dateFilter: boolean = true;
public startEndCaption: string = this.timespanService.getCaption(this.periodLocal.startDate, this.periodLocal.endDate, 4); public startEndCaption: string = this.timespanService.getCaption(this.periodLocal.startDate, this.periodLocal.endDate, 4);
searching = false; searching = false;
searchFailed = false; searchFailed = false;
hideSearchingWhenUnsubscribed = new Observable(() => () => this.searching = false); hideSearchingWhenUnsubscribed = new Observable(() => () => this.searching = false);
public disabled = true; public disabled: boolean = true;
constructor(private typeaheadService: TypeaheadService, private timespanService: TimespanService) { constructor(private typeaheadService: TypeaheadService, private timespanService: TimespanService) {
this.filterOptionsLocal = { query: "", tags: "", startDate: null, endDate: null, bboxFilter: false, itemType: null, itemCode:null,level:0,parentCode:null,bbox:[] }; this.filterOptionsLocal = { query: "", tags: "", startDate: null, endDate: null, bboxFilter: false, itemType: null, itemCode:null,level:0,parentCode:null,bbox:[] };

View File

@ -10,7 +10,6 @@
panelVisible:panelVisible$|async, panelVisible:panelVisible$|async,
openedModalName:openedModalName$|async, openedModalName:openedModalName$|async,
panelCollapsed:panelCollapsed$|async, panelCollapsed:panelCollapsed$|async,
panelExtraWide:panelExtraWide$|async,
searchMinified:searchMinified$|async, searchMinified:searchMinified$|async,
selectedItem:selectedItem$|async, selectedItem:selectedItem$|async,
parentItem:parentItem$|async, parentItem:parentItem$|async,
@ -65,7 +64,7 @@
</div> </div>
<div class="side-panel-container"> <div class="side-panel-container">
<fm-side-panel [resizeable]="true" (onResize)="handlePanelResize($event)" [visible]="state.panelVisible && noContent" [collapsed]="state.panelCollapsed" [collapsable]="false" [extrawide]="state.panelExtraWide"> <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-wrapper" *ngIf="noContent">
<div class="panel-top bg-secondary" *ngIf="!(state.searchMinified)"> <div class="panel-top bg-secondary" *ngIf="!(state.searchMinified)">
</div> </div>
@ -85,7 +84,7 @@
</div> </div>
</div> </div>
</fm-side-panel> </fm-side-panel>
<fm-side-panel [resizeable]="true" [visible]="!noContent" [extrawide]="state.panelExtraWide"> <fm-side-panel [resizeable]="true" [visible]="!noContent">
<router-outlet (activate)="handleSidepaneloutletActivate($event)" (deactivate)="handleSidepaneloutletDeactivate($event)"></router-outlet> <router-outlet (activate)="handleSidepaneloutletActivate($event)" (deactivate)="handleSidepaneloutletDeactivate($event)"></router-outlet>
</fm-side-panel> </fm-side-panel>
</div> </div>

View File

@ -1,3 +1,5 @@
@import "~bootstrap/scss/bootstrap.scss";
aol-map { position:absolute;width:100%;height:calc( 100vh );} aol-map { position:absolute;width:100%;height:calc( 100vh );}
.arrow { .arrow {
@ -193,7 +195,7 @@ timespan.menuVisible {
width: 4rem; width: 4rem;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
color: var(--bs-primary); color: $primary;
} }
.shortcut-icon > .farm-icon { .shortcut-icon > .farm-icon {

View File

@ -45,7 +45,7 @@ import * as style from 'ol/style';
}) })
export class MapComponent implements OnInit, OnDestroy,AfterViewInit { export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
title = 'Map'; title: string = 'Map';
public openedModalName$: Observable<string> = this.store.select(commonReducers.selectOpenedModalName); public openedModalName$: Observable<string> = this.store.select(commonReducers.selectOpenedModalName);
public itemTypes$: Observable<{ [id: string]: IItemType }>; public itemTypes$: Observable<{ [id: string]: IItemType }>;
public mapState$: Observable<IMapState> = this.store.select(mapReducers.selectGetMapState); public mapState$: Observable<IMapState> = this.store.select(mapReducers.selectGetMapState);
@ -66,7 +66,6 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
public parentCode$: Observable<string> =this.store.select(mapReducers.selectGetParentCode); public parentCode$: Observable<string> =this.store.select(mapReducers.selectGetParentCode);
public panelVisible$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelVisible); public panelVisible$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelVisible);
public panelCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelCollapsed); public panelCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelCollapsed);
public panelExtraWide$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelExtraWide);
public selectedFeature$: Observable<Feature<Geometry>> = this.store.select(mapReducers.selectGetSelectedFeature); public selectedFeature$: Observable<Feature<Geometry>> = this.store.select(mapReducers.selectGetSelectedFeature);
public clickedFeature: Subject<Feature<Geometry>> = new Subject<Feature<Geometry>>(); public clickedFeature: Subject<Feature<Geometry>> = new Subject<Feature<Geometry>>();
public selectedItem$: Observable<IItem> = this.store.select(mapReducers.selectGetSelectedItem); public selectedItem$: Observable<IItem> = this.store.select(mapReducers.selectGetSelectedItem);
@ -82,20 +81,20 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
public query$: Observable<IQuery> = this.store.select(mapReducers.selectGetQuery); public query$: Observable<IQuery> = this.store.select(mapReducers.selectGetQuery);
public position$: Observable<GeolocationPosition> = this.geolocationService.getCurrentPosition(); public position$: Observable<GeolocationPosition> = this.geolocationService.getCurrentPosition();
public compassHeading$: Observable<number> = this.deviceorientationService.getCurrentCompassHeading(); public compassHeading$: Observable<number> = this.deviceorientationService.getCurrentCompassHeading();
public baseLayersCollapsed = true; public baseLayersCollapsed:boolean = true;
public overlayLayersCollapsed = true; public overlayLayersCollapsed: boolean = true;
public extent$: Observable<Extent> = this.store.select(mapReducers.selectGetExtent); public extent$: Observable<Extent> = this.store.select(mapReducers.selectGetExtent);
public styles$:Observable<IStyles> = this.store.select(mapReducers.selectGetStyles); public styles$:Observable<IStyles> = this.store.select(mapReducers.selectGetStyles);
public fullscreen$: Observable<boolean> = this.store.select(commonReducers.selectGetFullScreen); public fullscreen$: Observable<boolean> = this.store.select(commonReducers.selectGetFullScreen);
private lastUrl = ""; private lastUrl = "";
private initialized = false; private initialized: boolean = false;
public noContent = false; public noContent: boolean = false;
public overrideSelectedItemLayer = false; public overrideSelectedItemLayer: boolean = false;
public overrideOverlayLayers = false; public overrideOverlayLayers: boolean = false;
public dataLayerSlideValue = 50; public dataLayerSlideValue:number = 50;
public dataLayerSlideEnabled = false; public dataLayerSlideEnabled = false;
private visibleAreaBottom = 0; private visibleAreaBottom = 0;
private viewEnabled = true; private viewEnabled: boolean = true;
@ViewChild('map') map; @ViewChild('map') map;
@ViewChild('contentDiv') contentDiv: ElementRef; @ViewChild('contentDiv') contentDiv: ElementRef;
@ -113,18 +112,18 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
private deviceorientationService:DeviceOrientationService, private deviceorientationService:DeviceOrientationService,
public devicesService:DeviceService) { public devicesService:DeviceService) {
if(route && route.snapshot && route.snapshot.data && route.snapshot.data["fm-map-map"]) { if(route && route.snapshot && route.snapshot.data && route.snapshot.data["fm-map-map"]) {
const params = route.snapshot.data["fm-map-map"]; let params = route.snapshot.data["fm-map-map"];
this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false; this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false;
this.overrideOverlayLayers = params["overrideOverlayLayers"] ? params["overrideOverlayLayers"] : false; this.overrideOverlayLayers = params["overrideOverlayLayers"] ? params["overrideOverlayLayers"] : false;
} }
this.querySub = this.query$.pipe(skip(1), withLatestFrom(this.mapState$)).subscribe(([query,mapState]) =>{ this.querySub = this.query$.pipe(skip(1), withLatestFrom(this.mapState$)).subscribe(([query,mapState]) =>{
if(query && query.querystate) { if(query && query.querystate) {
let newQueryState = tassign(mapReducers.initialQueryState); let newQueryState = tassign(mapReducers.initialQueryState);
//console.debug(`Do Query`); console.debug(`Do Query`);
const urlparts=[]; let urlparts=[];
if (query.querystate.itemCode && query.querystate.itemCode != "") { if (query.querystate.itemCode && query.querystate.itemCode != "") {
if(query.querystate.itemType && query.querystate.itemType!= "") { if(query.querystate.itemType && query.querystate.itemType!= "") {
const itemType = this.itemTypeService.itemTypes[query.querystate.itemType]; let itemType = this.itemTypeService.itemTypes[query.querystate.itemType];
if (itemType && itemType.viewer && itemType.viewer == "edit_in_editor" && itemType.editor) { if (itemType && itemType.viewer && itemType.viewer == "edit_in_editor" && itemType.editor) {
urlparts.push('/editor'); urlparts.push('/editor');
urlparts.push(itemType.editor); urlparts.push(itemType.editor);
@ -155,7 +154,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
@HostListener('document:keyup', ['$event']) @HostListener('document:keyup', ['$event'])
escapeClose(event: KeyboardEvent) { escapeClose(event: KeyboardEvent) {
const x = event.keyCode; let x = event.keyCode;
if (x === 27) { if (x === 27) {
this.handleCloseModal() this.handleCloseModal()
} }
@ -193,7 +192,6 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
} }
handleFeatureClick(feature: Feature<Geometry>) { handleFeatureClick(feature: Feature<Geometry>) {
this.store.dispatch(new mapActions.ClickFeature(feature));
this.clickedFeature.next(feature); this.clickedFeature.next(feature);
} }
@ -209,18 +207,12 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
if(component && component.hasOwnProperty('clickedFeature')) { if(component && component.hasOwnProperty('clickedFeature')) {
(component as IClickedFeature).clickedFeature = this.clickedFeature; (component as IClickedFeature).clickedFeature = this.clickedFeature;
} }
if(component && component.hasOwnProperty('extrawide')) {
this.store.dispatch(new mapActions.SetPanelExtraWide(true));
}
} }
handleSidepaneloutletDeactivate(component:any) { handleSidepaneloutletDeactivate(component:any) {
if(component && component.hasOwnProperty('clickedFeature')) { if(component && component.hasOwnProperty('clickedFeature')) {
(component as IClickedFeature).clickedFeature = null; (component as IClickedFeature).clickedFeature = null;
} }
if(component && component.hasOwnProperty('extrawide')) {
this.store.dispatch(new mapActions.SetPanelExtraWide(false));
}
} }
handlePrerender(event:any) { handlePrerender(event:any) {
@ -250,7 +242,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
ngOnInit() { ngOnInit() {
this.initialized = false; this.initialized = false;
//console.debug("Init"); console.debug("Init");
this.store.dispatch(new mapActions.Clear()); this.store.dispatch(new mapActions.Clear());
this.selectedFeatures$.next({x:0,y:0,features:[]}); this.selectedFeatures$.next({x:0,y:0,features:[]});
this.selectedFeatures$.next(null); this.selectedFeatures$.next(null);
@ -276,19 +268,19 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
} }
round(value:number,decimals:number):number { round(value:number,decimals:number):number {
const d = Math.pow(10, decimals); let d = Math.pow(10, decimals);
return Math.round((value + Number.EPSILON)*d)/d; return Math.round((value + Number.EPSILON)*d)/d;
} }
getMapStateFromUrl(params:ParamMap):IMapState { getMapStateFromUrl(params:ParamMap):IMapState {
const hasUrlmapState = params.has("xCenter") && params.has("yCenter"); var hasUrlmapState = params.has("xCenter") && params.has("yCenter");
if (hasUrlmapState) { if (hasUrlmapState) {
const xCenter = parseFloat(params.get("xCenter")); let xCenter = parseFloat(params.get("xCenter"));
const yCenter = parseFloat(params.get("yCenter")); let yCenter = parseFloat(params.get("yCenter"));
const zoom = parseFloat(params.get("zoom")); let zoom = parseFloat(params.get("zoom"));
const rotation = parseFloat(params.get("rotation")); let rotation = parseFloat(params.get("rotation"));
const baseLayer = params.get("baseLayer")?params.get("baseLayer"):""; let baseLayer = params.get("baseLayer")?params.get("baseLayer"):"";
const newMapState = {zoom: zoom, rotation: rotation, xCenter: xCenter, yCenter: yCenter, baseLayerCode: baseLayer }; var newMapState = {zoom: zoom, rotation: rotation, xCenter: xCenter, yCenter: yCenter, baseLayerCode: baseLayer };
return newMapState; return newMapState;
} else { } else {
return null; return null;
@ -310,8 +302,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
getQueryStateFromUrl(params:ParamMap):IQueryState { getQueryStateFromUrl(params:ParamMap):IQueryState {
if (params.has("queryState")) { if (params.has("queryState")) {
const queryState = params.get("queryState"); let queryState = params.get("queryState");
let newQueryState = tassign(mapReducers.initialQueryState); var newQueryState = tassign(mapReducers.initialQueryState);
if (queryState != "") { if (queryState != "") {
newQueryState = this.serializeService.deserialize(queryState); newQueryState = this.serializeService.deserialize(queryState);
} }
@ -322,7 +314,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
} }
ngAfterViewInit() { ngAfterViewInit() {
//console.debug("View init"); console.debug("View init");
this.noContent=true; this.noContent=true;
this.route.children.forEach((entry) => { this.route.children.forEach((entry) => {
if(entry.outlet=="primary") { if(entry.outlet=="primary") {
@ -334,8 +326,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
// url to state // url to state
const urlMapState = this.getMapStateFromUrl(this.route.snapshot.paramMap); let urlMapState = this.getMapStateFromUrl(this.route.snapshot.paramMap);
const urlQueryState = this.getQueryStateFromUrl(this.route.snapshot.paramMap); let urlQueryState = this.getQueryStateFromUrl(this.route.snapshot.paramMap);
if(urlQueryState && urlMapState && this.noContent) { if(urlQueryState && urlMapState && this.noContent) {
this.store.dispatch(new mapActions.SetState(urlMapState,urlQueryState)); this.store.dispatch(new mapActions.SetState(urlMapState,urlQueryState));
window.localStorage.setItem("FarmMapsCommonMap_mapState",this.serializeMapState(urlMapState)); window.localStorage.setItem("FarmMapsCommonMap_mapState",this.serializeMapState(urlMapState));
@ -347,7 +339,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
this.paramSub = this.route.paramMap.pipe(withLatestFrom(this.state$),switchMap(([params,state]) => { this.paramSub = this.route.paramMap.pipe(withLatestFrom(this.state$),switchMap(([params,state]) => {
if(this.initialized && this.noContent) { if(this.initialized && this.noContent) {
const urlQueryState = this.getQueryStateFromUrl(params); let urlQueryState = this.getQueryStateFromUrl(params);
if( this.serializeService.serialize(state.queryState) != this.serializeService.serialize(urlQueryState)) { if( this.serializeService.serialize(state.queryState) != this.serializeService.serialize(urlQueryState)) {
return of(new mapActions.SetState(state.mapState,urlQueryState)); return of(new mapActions.SetState(state.mapState,urlQueryState));
} }
@ -356,7 +348,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
})).subscribe((action) => { })).subscribe((action) => {
if(action) { if(action) {
this.zone.run(() => { this.zone.run(() => {
//console.debug("Url to state"); console.debug("Url to state");
this.store.dispatch(action); this.store.dispatch(action);
}); });
} }
@ -365,7 +357,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
// state to url // state to url
this.stateSub = this.state$.pipe(switchMap((state) => { this.stateSub = this.state$.pipe(switchMap((state) => {
const newUrl = this.serializeMapState(state.mapState) + "_" + this.serializeService.serialize(state.queryState); let newUrl = this.serializeMapState(state.mapState) + "_" + this.serializeService.serialize(state.queryState);
if(this.lastUrl!=newUrl) { if(this.lastUrl!=newUrl) {
this.lastUrl=newUrl; this.lastUrl=newUrl;
return of(state); return of(state);
@ -373,9 +365,9 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
else { else {
return of(null); return of(null);
} }
})).subscribe((newUrlState: any) => { })).subscribe((newUrlState) =>{
if(newUrlState) { if(newUrlState) {
//console.debug(`State to url`); console.debug(`State to url`);
this.replaceUrl(newUrlState.mapState,newUrlState.queryState,newUrlState.replaceUrl); this.replaceUrl(newUrlState.mapState,newUrlState.queryState,newUrlState.replaceUrl);
} }
}); });
@ -413,19 +405,19 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
handlePredefinedQuery(event: MouseEvent, query: any) { handlePredefinedQuery(event: MouseEvent, query: any) {
event.preventDefault(); event.preventDefault();
const queryState = tassign(mapReducers.initialQueryState, query); var queryState = tassign(mapReducers.initialQueryState, query);
this.store.dispatch(new mapActions.DoQuery(queryState)); this.store.dispatch(new mapActions.DoQuery(queryState));
} }
replaceUrl(mapState: IMapState, queryState: IQueryState, replace = true) { replaceUrl(mapState: IMapState, queryState: IQueryState, replace: boolean = true) {
if(this.noContent) { if(this.noContent) {
const newMapState = this.serializeMapState(mapState); let newMapState = this.serializeMapState(mapState);
const newQueryState = this.serializeService.serialize(queryState); let newQueryState = this.serializeService.serialize(queryState);
const currentMapState = this.serializeMapState(this.getMapStateFromUrl(this.route.snapshot.paramMap)); let currentMapState = this.serializeMapState(this.getMapStateFromUrl(this.route.snapshot.paramMap));
const urlQueryState = this.getQueryStateFromUrl(this.route.snapshot.paramMap); let urlQueryState = this.getQueryStateFromUrl(this.route.snapshot.paramMap);
const currentQueryState = urlQueryState==null?"":this.serializeService.serialize(urlQueryState); let currentQueryState = urlQueryState==null?"":this.serializeService.serialize(urlQueryState);
if(mapState.baseLayerCode!="" && ((newMapState!= currentMapState) || (newQueryState!=currentQueryState))) { if(mapState.baseLayerCode!="" && ((newMapState!= currentMapState) || (newQueryState!=currentQueryState))) {
const parts =["."]; let parts =["."];
parts.push(mapState.xCenter.toFixed(5)); parts.push(mapState.xCenter.toFixed(5));
parts.push(mapState.yCenter.toFixed(5)); parts.push(mapState.yCenter.toFixed(5));
parts.push( mapState.zoom.toFixed(0)); parts.push( mapState.zoom.toFixed(0));
@ -433,7 +425,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
parts.push(mapState.baseLayerCode); parts.push(mapState.baseLayerCode);
parts.push( this.serializeService.serialize(queryState)); parts.push( this.serializeService.serialize(queryState));
//console.debug("Replace url",parts); console.debug("Replace url",parts);
this.router.navigate(parts, { replaceUrl: replace,relativeTo:this.route.parent }); this.router.navigate(parts, { replaceUrl: replace,relativeTo:this.route.parent });
} }
} }
@ -442,20 +434,20 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
handleOnMoveEnd(event) { handleOnMoveEnd(event) {
if(this.initialized && this.viewEnabled) { if(this.initialized && this.viewEnabled) {
this.zone.run(() =>{ this.zone.run(() =>{
//console.debug("Move end"); console.debug("Move end");
const map = event.map; var map = event.map;
const view = map.getView(); var view = map.getView();
const rotation = view.getRotation(); var rotation = view.getRotation();
const zoom = view.getZoom(); var zoom = view.getZoom();
const center = transform(view.getCenter(), view.getProjection(), "EPSG:4326"); var center = transform(view.getCenter(), view.getProjection(), "EPSG:4326");
const viewExtent = view.calculateExtent(this.map.instance.getSize()); var viewExtent = view.calculateExtent(this.map.instance.getSize());
const mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null }; let mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null };
const state = { mapState: mapState, viewExtent: viewExtent }; let state = { mapState: mapState, viewExtent: viewExtent };
//console.debug("Center: ",center[0],center[1] ); console.debug("Center: ",center[0],center[1] );
const source = from([state]); let source = from([state]);
source.pipe(withLatestFrom(this.selectedBaseLayer$)).subscribe(([state, baselayer]) => { source.pipe(withLatestFrom(this.selectedBaseLayer$)).subscribe(([state, baselayer]) => {
if (mapState && baselayer) { // do not react on first move if (mapState && baselayer) { // do not react on first move
const newMapState = tassign(state.mapState, { baseLayerCode: baselayer.item.code }); let newMapState = tassign(state.mapState, { baseLayerCode: baselayer.item.code });
this.store.dispatch(new mapActions.SetMapState(newMapState)); this.store.dispatch(new mapActions.SetMapState(newMapState));
this.store.dispatch(new mapActions.SetViewExtent(state.viewExtent)); this.store.dispatch(new mapActions.SetViewExtent(state.viewExtent));
} }
@ -499,7 +491,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
} }
handleZoomToExtent(itemLayer: IItemLayer) { handleZoomToExtent(itemLayer: IItemLayer) {
const extent = createEmpty(); var extent = createEmpty();
extend(extent, itemLayer.layer.getExtent()); extend(extent, itemLayer.layer.getExtent());
if (extent) { if (extent) {
this.store.dispatch(new mapActions.SetExtent(extent)); this.store.dispatch(new mapActions.SetExtent(extent));
@ -521,10 +513,10 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
handleCitySearch(location:string) { handleCitySearch(location:string) {
this.geolocaterService.geocode(location).subscribe(locations => { this.geolocaterService.geocode(location).subscribe(locations => {
if( locations.length > 0) { if( locations.length > 0) {
const point = new Point([locations[0].coordinates.lon,locations[0].coordinates.lat]); let point = new Point([locations[0].coordinates.lon,locations[0].coordinates.lat]);
point.transform('EPSG:4326', 'EPSG:3857'); point.transform('EPSG:4326', 'EPSG:3857');
const circle = new Circle(point.getCoordinates(),5000);// let circle = new Circle(point.getCoordinates(),5000);//
const extent = createEmpty(); let extent = createEmpty();
extend(extent, circle.getExtent()); extend(extent, circle.getExtent());
this.store.dispatch(new mapActions.SetExtent(extent)) this.store.dispatch(new mapActions.SetExtent(extent))
} }

View File

@ -15,12 +15,12 @@ export interface IMetaData {
}) })
export class MetaDataModalComponent { export class MetaDataModalComponent {
private modalName = 'metaDataModal'; private modalName: string = 'metaDataModal';
private modalRef: NgbModalRef; private modalRef: NgbModalRef;
@ViewChild('content', { static: true }) _templateModal:ElementRef; @ViewChild('content', { static: true }) _templateModal:ElementRef;
@Input() droppedFile: IDroppedFile; @Input() droppedFile: IDroppedFile;
@Input() set modalState(_modalState:any) { @Input() set modalState(_modalState:any) {;
if(_modalState == this.modalName) { if(_modalState == this.modalName) {
this.openModal() this.openModal()
} else if(this.modalRef) { } else if(this.modalRef) {

View File

@ -22,7 +22,7 @@ const after = (one: NgbDateStruct, two: NgbDateStruct) =>
}) })
export class SelectPeriodModalComponent { export class SelectPeriodModalComponent {
private modalName = 'selectPeriodModal'; private modalName: string = 'selectPeriodModal';
private modalRef: NgbModalRef; private modalRef: NgbModalRef;
private dateAdapter = new NgbDateNativeAdapter(); private dateAdapter = new NgbDateNativeAdapter();
hoveredDate: NgbDateStruct; hoveredDate: NgbDateStruct;
@ -31,7 +31,7 @@ export class SelectPeriodModalComponent {
@ViewChild('content', { static: true }) _templateModal:ElementRef; @ViewChild('content', { static: true }) _templateModal:ElementRef;
@Input() set modalState(_modalState:any) { @Input() set modalState(_modalState:any) {;
if(_modalState == this.modalName) { if(_modalState == this.modalName) {
this.openModal() this.openModal()
} else if(this.modalRef) { } else if(this.modalRef) {
@ -44,7 +44,7 @@ export class SelectPeriodModalComponent {
} }
@Input() set endDate(_modalState: Date) { @Input() set endDate(_modalState: Date) {
const d = new Date(_modalState); var d = new Date(_modalState);
d.setDate(d.getDate() - 1); d.setDate(d.getDate() - 1);
this.toDate = this.dateAdapter.fromModel(d); this.toDate = this.dateAdapter.fromModel(d);
} }
@ -80,7 +80,7 @@ export class SelectPeriodModalComponent {
handleSelect(event:MouseEvent) { handleSelect(event:MouseEvent) {
event.preventDefault(); event.preventDefault();
if (this.fromDate && this.toDate && before(this.fromDate, this.toDate)) { if (this.fromDate && this.toDate && before(this.fromDate, this.toDate)) {
const endDate = new Date(this.dateAdapter.toModel(this.toDate)); var endDate = new Date(this.dateAdapter.toModel(this.toDate));
endDate.setDate(endDate.getDate() + 1); endDate.setDate(endDate.getDate() + 1);
this.onSelect.emit({startDate:this.dateAdapter.toModel(this.fromDate),endDate:endDate}) this.onSelect.emit({startDate:this.dateAdapter.toModel(this.fromDate),endDate:endDate})
} }

View File

@ -1,9 +1,13 @@
@import "~bootstrap/scss/bootstrap.scss";
.row { .row {
border-bottom: 1px solid var(--bs-gray-500); border-bottom: 1px solid $gray-500;
user-select: none; user-select: none;
} }
.row:hover { .row:hover {
background-color: var(--bs-gray-100); background-color: $gray-100;
} }

View File

@ -28,7 +28,7 @@ export class SelectedItemContainerComponent {
let selected = -1; let selected = -1;
let maxMatches =0; let maxMatches =0;
const showItem = true; let showItem = true;
for (let i = 0; i < this.selectedItemComponents.length; i++) { for (let i = 0; i < this.selectedItemComponents.length; i++) {
let matches=0; let matches=0;
let criteria=0; let criteria=0;

View File

@ -1,3 +1,5 @@
@import "~bootstrap/scss/bootstrap.scss";
.big-icon { .big-icon {
width: 100%; width: 100%;
color: white; color: white;

View File

@ -31,28 +31,28 @@ export class SelectedItemCropfieldComponent extends AbstractSelectedItemComponen
areaInHa(item:IItem):number { areaInHa(item:IItem):number {
if(!item) return 0; if(!item) return 0;
// get area from faeture if 0 calculate from polygon // get area from faeture if 0 calculate from polygon
const a = item.data.area; let a = item.data.area;
if(a) return a; if(a) return a;
const format = new GeoJSON(); let format = new GeoJSON();
const polygon = format.readGeometry(item.geometry); let polygon = format.readGeometry(item.geometry);
return getArea(polygon,{projection:"EPSG:4326"}) / 10000; return getArea(polygon,{projection:"EPSG:4326"}) / 10000;
} }
ngOnInit() { ngOnInit() {
const childItems = this.folderService$.getItems(this.item.code, 0, 1000); var childItems = this.folderService$.getItems(this.item.code, 0, 1000);
const atLocationItems = this.itemService$.getItemList(null,null,null,this.item.code,true); var atLocationItems = this.itemService$.getItemList(null,null,null,this.item.code,true);
this.items = childItems.pipe( this.items = childItems.pipe(
combineLatest(atLocationItems), combineLatest(atLocationItems),
switchMap(([ci,ali]) => { switchMap(([ci,ali]) => {
const retVal:IListItem[] = []; let retVal:IListItem[] = [];
const codes = {}; let codes = {};
ci.forEach((listItem) => { ci.forEach((listItem) => {
retVal.push(listItem); retVal.push(listItem);
codes[listItem.code]=listItem; codes[listItem.code]=listItem;
}); });
ali.forEach((atlocationitem) => { ali.forEach((atlocationitem) => {
const listItem = atlocationitem as IListItem; let listItem = atlocationitem as IListItem;
const allowedItemTypes = "vnd.farmmaps.itemtype.device.senml"; // this is a hack let allowedItemTypes = "vnd.farmmaps.itemtype.device.senml"; // this is a hack
if(!codes[listItem.code] && allowedItemTypes.indexOf(listItem.itemType) >= 0) { if(!codes[listItem.code] && allowedItemTypes.indexOf(listItem.itemType) >= 0) {
retVal.push(listItem); retVal.push(listItem);
} }

View File

@ -25,7 +25,6 @@
<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>&nbsp;<span i18n>Add as overlay</span></a></li> <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>&nbsp;<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>&nbsp;<span i18n>Remove 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>&nbsp;<span i18n>Remove overlay</span></a></li>
</ng-container> </ng-container>
<li><fm-item-link class="text-primary p-0" [itemCode]="item.code" pathSuffix="data" [showText]="true"></fm-item-link></li>
</ul> </ul>
</div> </div>
<fm-map-zoom-to-show-alert [layer]="itemLayer?.layer"></fm-map-zoom-to-show-alert> <fm-map-zoom-to-show-alert [layer]="itemLayer?.layer"></fm-map-zoom-to-show-alert>

View File

@ -1,3 +1,5 @@
@import "~bootstrap/scss/bootstrap.scss";
.big-icon { .big-icon {
width: 100%; width: 100%;
color: white; color: white;

View File

@ -1,3 +1,5 @@
@import "~bootstrap/scss/bootstrap.scss";
.big-icon { .big-icon {
width: 100%; width: 100%;
color: white; color: white;

View File

@ -23,7 +23,7 @@ export class SelectedItemShapeComponent extends AbstractSelectedItemComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) { constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
super(store, itemTypeService,location,router); super(store, itemTypeService,location,router);
} }
public selectedLayer = 0; public selectedLayer: number = 0;
onLayerChanged(layerIndex: number) { onLayerChanged(layerIndex: number) {
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex)); this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));

View File

@ -1,3 +1,5 @@
@import "~bootstrap/scss/bootstrap.scss";
.big-icon { .big-icon {
width: 100%; width: 100%;
color: white; color: white;

View File

@ -46,7 +46,7 @@ export class SelectedItemTemporalComponent extends AbstractSelectedItemComponent
} }
selectedItem():IItem { selectedItem():IItem {
const temporalItemLayer = this.itemLayer as ITemporalItemLayer; let temporalItemLayer = this.itemLayer as ITemporalItemLayer;
if(temporalItemLayer && temporalItemLayer.selectedItemLayer) { if(temporalItemLayer && temporalItemLayer.selectedItemLayer) {
return temporalItemLayer.selectedItemLayer.item; return temporalItemLayer.selectedItemLayer.item;
} }

View File

@ -1,3 +1,5 @@
@import "~bootstrap/scss/bootstrap.scss";
.big-icon { .big-icon {
width: 100%; width: 100%;
color: white; color: white;

View File

@ -20,39 +20,39 @@ export abstract class AbstractSelectedItemComponent {
handleOnView(item: IItem) { handleOnView(item: IItem) {
if (this.itemTypeService.hasViewer(item)) { if (this.itemTypeService.hasViewer(item)) {
const viewer = this.itemTypeService.itemTypes[item.itemType].viewer; let viewer = this.itemTypeService.itemTypes[item.itemType].viewer;
const url = `/viewer/${viewer}/item/${item.code}`; let url = `/viewer/${viewer}/item/${item.code}`;
this.router.navigate([url]); this.router.navigate([url]);
} }
return false; return false;
} }
handleOnEdit(item: IItem) { handleOnEdit(item: IItem) {
let editor = "property"; var editor = "property";
if(this.itemTypeService.hasEditor(item)) { if(this.itemTypeService.hasEditor(item)) {
editor = this.itemTypeService.itemTypes[item.itemType].editor; editor = this.itemTypeService.itemTypes[item.itemType].editor;
} }
const url = `/editor/${editor}/item/${item.code}` let url = `/editor/${editor}/item/${item.code}`
this.router.navigate([url]); this.router.navigate([url]);
return false; return false;
} }
handleAddAsLayer(item: IItem,layerIndex = -1) { handleAddAsLayer(item: IItem,layerIndex:number = -1) {
this.store.dispatch(new mapActions.AddLayer(item,layerIndex)); this.store.dispatch(new mapActions.AddLayer(item,layerIndex));
return false; return false;
} }
handleRemoveLayer(item: IItem,layerIndex = -1) { handleRemoveLayer(item: IItem,layerIndex:number = -1) {
const itemLayer = this.getItemLayer(item,layerIndex); let itemLayer = this.getItemLayer(item,layerIndex);
if(itemLayer) { if(itemLayer) {
this.store.dispatch(new mapActions.RemoveLayer(itemLayer)); this.store.dispatch(new mapActions.RemoveLayer(itemLayer));
} }
return false; return false;
} }
getItemLayer(item:IItem,layerIndex = -1):IItemLayer { getItemLayer(item:IItem,layerIndex:number = -1):IItemLayer {
const li = layerIndex==-1?0:layerIndex; let li = layerIndex==-1?0:layerIndex;
const selected = this.overlayLayers.filter(ol => ol.item.code == item.code && ol.layerIndex == li); let selected = this.overlayLayers.filter(ol => ol.item.code == item.code && ol.layerIndex == li);
if(selected.length==0) return null; if(selected.length==0) return null;
return selected[0]; return selected[0];
} }

View File

@ -41,22 +41,22 @@ export const {
selectRouteParam, // factory function to select a route param selectRouteParam, // factory function to select a route param
selectRouteData, // select the current route data selectRouteData, // select the current route data
selectUrl, // select the current url selectUrl, // select the current url
} = fromRouter.getRouterSelectors(getRouterState); } = fromRouter.getSelectors(getRouterState);
@Injectable() @Injectable()
export class MapEffects { export class MapEffects {
private _geojsonFormat: GeoJSON; private _geojsonFormat: GeoJSON;
private _wktFormat: WKT; private _wktFormat: WKT;
private overrideSelectedItemLayer = false; private overrideSelectedItemLayer: boolean = false;
private updateFeatureGeometry(feature:Feature<Geometry>, updateEvent:commonActions.DeviceUpdateEvent): Feature<Geometry> { private updateFeatureGeometry(feature:Feature<Geometry>, updateEvent:commonActions.DeviceUpdateEvent): Feature<Geometry> {
const newFeature = feature.clone(); let newFeature = feature.clone();
const f = this._wktFormat.readFeature(updateEvent.attributes["geometry"], { var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
dataProjection: 'EPSG:4326', dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857' featureProjection: 'EPSG:3857'
}); });
const centroid = getCenter(f.getGeometry().getExtent()); var centroid = getCenter(f.getGeometry().getExtent());
newFeature.setId(feature.getId()); newFeature.setId(feature.getId());
newFeature.setGeometry(new Point(centroid)); newFeature.setGeometry(new Point(centroid));
return newFeature; return newFeature;
@ -66,8 +66,8 @@ export class MapEffects {
ofType(mapActions.INIT), ofType(mapActions.INIT),
withLatestFrom(this.store$.select(commonReducers.selectGetRootItems)), withLatestFrom(this.store$.select(commonReducers.selectGetRootItems)),
switchMap(([action, rootItems]) => { switchMap(([action, rootItems]) => {
const actions = []; let actions=[];
for (const rootItem of rootItems) { for (let rootItem of rootItems) {
if (rootItem.itemType == "UPLOADS_FOLDER") actions.push(new mapActions.SetParent(rootItem.code)); if (rootItem.itemType == "UPLOADS_FOLDER") actions.push(new mapActions.SetParent(rootItem.code));
} }
// initialize default feature styles // initialize default feature styles
@ -121,19 +121,19 @@ export class MapEffects {
startSearch$ = createEffect(() => this.actions$.pipe( startSearch$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.STARTSEARCH), ofType(mapActions.STARTSEARCH),
switchMap((action) => { switchMap((action) => {
const a = action as mapActions.StartSearch; let a = action as mapActions.StartSearch;
const startDate = a.queryState.startDate; var startDate = a.queryState.startDate;
const endDate = a.queryState.endDate; var endDate = a.queryState.endDate;
let newAction: Observable<Action>; var newAction:Observable<Action>;
if (a.queryState.itemCode || a.queryState.parentCode || a.queryState.itemType || a.queryState.query || a.queryState.tags) { if (a.queryState.itemCode || a.queryState.parentCode || a.queryState.itemType || a.queryState.query || a.queryState.tags) {
newAction= this.itemService$.getFeatures(a.queryState.bbox, "EPSG:3857", a.queryState.query, a.queryState.tags, startDate, endDate, a.queryState.itemType, a.queryState.parentCode, a.queryState.dataFilter, a.queryState.level).pipe( newAction= this.itemService$.getFeatures(a.queryState.bbox, "EPSG:3857", a.queryState.query, a.queryState.tags, startDate, endDate, a.queryState.itemType, a.queryState.parentCode, a.queryState.dataFilter, a.queryState.level).pipe(
switchMap((features: any) => { switchMap((features: any) => {
for (const f of features.features) { for (let f of features.features) {
if (f.properties && f.properties["code"]) { if (f.properties && f.properties["code"]) {
f.id = f.properties["code"]; f.id = f.properties["code"];
} }
} }
return of(new mapActions.StartSearchSuccess(this._geojsonFormat.readFeatures(features).filter(feature => feature instanceof Feature) as Feature[], a.queryState)); return of(new mapActions.StartSearchSuccess(this._geojsonFormat.readFeatures(features), a.queryState));
} }
), ),
catchError(error => of(new commonActions.Fail(error)))); catchError(error => of(new commonActions.Fail(error))));
@ -147,12 +147,12 @@ export class MapEffects {
zoomToExtent$ = createEffect(() => this.actions$.pipe( zoomToExtent$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.STARTSEARCHSUCCESS), ofType(mapActions.STARTSEARCHSUCCESS),
mergeMap((action: mapActions.StartSearchSuccess) => { mergeMap((action: mapActions.StartSearchSuccess) => {
const actions = []; let actions =[];
actions.push(new commonActions.SetMenuVisible(false)); actions.push(new commonActions.SetMenuVisible(false));
const extent = createEmpty(); let extent = createEmpty();
if (!action.query.bboxFilter) { if (!action.query.bboxFilter) {
if (extent) { if (extent) {
for (const f of action.features) { for (let f of action.features) {
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent()); extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
} }
if(action.features && action.features.length >0) { if(action.features && action.features.length >0) {
@ -166,9 +166,9 @@ export class MapEffects {
zoomToExtent2$ = createEffect(() => this.actions$.pipe( zoomToExtent2$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SETFEATURES), ofType(mapActions.SETFEATURES),
switchMap((action: mapActions.SetFeatures) => { switchMap((action: mapActions.SetFeatures) => {
const extent = createEmpty(); let extent = createEmpty();
if (extent) { if (extent) {
for (const f of action.features) { for (let f of action.features) {
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent()); extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
} }
if(action.features.length>0) return of(new mapActions.SetExtent(extent)); if(action.features.length>0) return of(new mapActions.SetExtent(extent));
@ -186,15 +186,15 @@ export class MapEffects {
ofType(mapActions.SELECTITEM), ofType(mapActions.SELECTITEM),
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)), withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
switchMap(([action, selectedItem]) => { switchMap(([action, selectedItem]) => {
const a = action as mapActions.SelectItem; let a = action as mapActions.SelectItem;
const itemCode = selectedItem ? selectedItem.code : ""; let itemCode = selectedItem ? selectedItem.code : "";
if (a.itemCode != itemCode) { if (a.itemCode != itemCode) {
return this.itemService$.getItem(a.itemCode).pipe( return this.itemService$.getItem(a.itemCode).pipe(
switchMap(child => { switchMap(child => {
return this.itemService$.getItem(child.parentCode) return this.itemService$.getItem(child.parentCode)
.pipe(map(parent => { .pipe(map(parent => {
return {child, parent}; return {child, parent};
}), catchError(() => { const parent: IItem = null; return of({ child, parent }) }) }),catchError(() => { let parent:IItem = null;return of({child,parent})})
); );
}), }),
map(data => new mapActions.SelectItemSuccess(data.child, data.parent)), map(data => new mapActions.SelectItemSuccess(data.child, data.parent)),
@ -218,7 +218,7 @@ export class MapEffects {
if(!this.overrideSelectedItemLayer) { if(!this.overrideSelectedItemLayer) {
return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe( return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe(
map((feature: any) => { map((feature: any) => {
const f = this._geojsonFormat.readFeature(feature) as Feature; let f = this._geojsonFormat.readFeature(feature);
f.setId(action.item.code); f.setId(action.item.code);
return new mapActions.AddFeatureSuccess(f ); return new mapActions.AddFeatureSuccess(f );
}), }),
@ -255,9 +255,9 @@ export class MapEffects {
ofType(commonActions.DEVICEUPDATEEVENT), ofType(commonActions.DEVICEUPDATEEVENT),
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)), withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
mergeMap(([action, features]) => { mergeMap(([action, features]) => {
const deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent; let deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent;
let feature: Feature<Geometry> = null; var feature: Feature<Geometry> = null;
for (const f of features) { for (let f of features) {
if (f.getId() == deviceUpdateEventAction.itemCode) { if (f.getId() == deviceUpdateEventAction.itemCode) {
feature = f; feature = f;
break; break;
@ -274,7 +274,7 @@ export class MapEffects {
ofType(commonActions.ITEMCHANGEDEVENT), ofType(commonActions.ITEMCHANGEDEVENT),
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)), withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
mergeMap(([action, selectedItem]) => { mergeMap(([action, selectedItem]) => {
const itemChangedAction = action as commonActions.ItemChangedEvent; let itemChangedAction = action as commonActions.ItemChangedEvent;
if (selectedItem && selectedItem.code == itemChangedAction.itemCode) { if (selectedItem && selectedItem.code == itemChangedAction.itemCode) {
return this.itemService$.getItem(itemChangedAction.itemCode).pipe( return this.itemService$.getItem(itemChangedAction.itemCode).pipe(
switchMap(child => { switchMap(child => {
@ -309,11 +309,11 @@ export class MapEffects {
getLayerValue$ = createEffect(() => this.actions$.pipe( getLayerValue$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.GETLAYERVALUE), ofType(mapActions.GETLAYERVALUE),
mergeMap((action:mapActions.GetLayerValue) => { mergeMap((action:mapActions.GetLayerValue) => {
const l = action.itemLayer.item.data["layers"][action.itemLayer.layerIndex]; var l = action.itemLayer.item.data["layers"][action.itemLayer.layerIndex];
const scale = l.scale ? l.scale : 1; var scale = l.scale?l.scale:1;
return this.itemService$.getLayerValue(action.itemLayer.item.code,action.itemLayer.layerIndex,action.x,action.y).pipe( return this.itemService$.getLayerValue(action.itemLayer.item.code,action.itemLayer.layerIndex,action.x,action.y).pipe(
mergeMap((v: number) => { mergeMap((v: number) => {
const a = []; let a=[];
if(v !== null) { if(v !== null) {
if(l.renderer && l.renderer.colorMap && l.renderer.colorMap.colormapType == "manual") { if(l.renderer && l.renderer.colorMap && l.renderer.colorMap.colormapType == "manual") {
l.renderer.colorMap.entries.forEach((e) => { l.renderer.colorMap.entries.forEach((e) => {
@ -322,9 +322,9 @@ export class MapEffects {
return; return;
} }
}); });
a.push(new mapActions.GetLayerValueSuccess({ date: action.itemLayer.item.dataDate, value: v, layerName: l.name, quantity: "", unit: l.unit, scale: l.scale })); a.push(new mapActions.GetLayerValueSuccess({date:action.itemLayer.item.dataDate,value:v,layerName:l.name,quantity:"",unit:l.unit}));
} else { } else {
a.push(new mapActions.GetLayerValueSuccess({ date: action.itemLayer.item.dataDate, value: v * scale, layerName: l.name, quantity: l.quantity, unit: l.unit, scale: l.scale })); a.push(new mapActions.GetLayerValueSuccess({date:action.itemLayer.item.dataDate,value:v*scale,layerName:l.name,quantity:l.quantity,unit:l.unit}));
} }
} }
return a; return a;
@ -346,7 +346,7 @@ export class MapEffects {
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesEnabled)), withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesEnabled)),
withLatestFrom(this.store$.select(mapReducers.selectGetOverlayLayers)), withLatestFrom(this.store$.select(mapReducers.selectGetOverlayLayers)),
mergeMap(([[[action, selected], enabled],overlayLayers]) => { mergeMap(([[[action, selected], enabled],overlayLayers]) => {
const layers = []; let layers = [];
if(selected) { if(selected) {
if(selected && (selected as TemporalItemLayer).selectedItemLayer ) { if(selected && (selected as TemporalItemLayer).selectedItemLayer ) {
selected=(selected as TemporalItemLayer).selectedItemLayer; selected=(selected as TemporalItemLayer).selectedItemLayer;
@ -356,8 +356,8 @@ export class MapEffects {
overlayLayers.forEach((ol) => { overlayLayers.forEach((ol) => {
if(ol!=selected) layers.push(ol); if(ol!=selected) layers.push(ol);
}); });
const a = action as mapActions.SetLayerValuesLocation; let a = action as mapActions.SetLayerValuesLocation;
const actions = []; let actions = [];
if(enabled) { if(enabled) {
layers.forEach((ol) => { layers.forEach((ol) => {
if("vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(ol.item.itemType)>=0) { if("vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(ol.item.itemType)>=0) {
@ -373,14 +373,14 @@ export class MapEffects {
ofType(mapActions.SETSTATE), ofType(mapActions.SETSTATE),
withLatestFrom(this.store$.select(mapReducers.selectGetInSearch)), withLatestFrom(this.store$.select(mapReducers.selectGetInSearch)),
switchMap(([action,inSearch]) => { switchMap(([action,inSearch]) => {
const a = action as mapActions.SetState; let a = action as mapActions.SetState;
return this.getActionFromQueryState(a.queryState,inSearch); return this.getActionFromQueryState(a.queryState,inSearch);
}))); })));
escape$ = createEffect(() => this.actions$.pipe( escape$ = createEffect(() => this.actions$.pipe(
ofType(commonActions.ESCAPE), ofType(commonActions.ESCAPE),
switchMap((action) => { switchMap((action) => {
const a = action as commonActions.Escape; let a = action as commonActions.Escape;
if(a.escapeKey) { if(a.escapeKey) {
return of(new mapActions.Clear()); return of(new mapActions.Clear());
} else { } else {
@ -393,7 +393,7 @@ export class MapEffects {
switchMap(() => this.store$.select(selectRouteData as any)), switchMap(() => this.store$.select(selectRouteData as any)),
switchMap((data: any) => { switchMap((data: any) => {
if(data && data["fm-map-map"]) { if(data && data["fm-map-map"]) {
const params = data["fm-map-map"]; let params = data["fm-map-map"];
this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false; this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false;
} else { } else {
this.overrideSelectedItemLayer = false; this.overrideSelectedItemLayer = false;

View File

@ -15,13 +15,13 @@ export interface IItemLayer {
export class ItemLayer implements IItemLayer { export class ItemLayer implements IItemLayer {
public item: IItem; public item: IItem;
public layer: Layer<Source> = null; public layer: Layer<Source> = null;
public visible = true; public visible: boolean = true;
public legendVisible = false; public legendVisible: boolean = false;
public projection: string; public projection: string;
public opacity = 1; public opacity: number = 1;
public layerIndex = -1; public layerIndex: number = -1;
constructor(item:IItem,opacity = 1, visible = true,layerIndex=-1) { constructor(item:IItem,opacity:number = 1, visible:boolean = true,layerIndex:number=-1) {
this.item = item; this.item = item;
this.opacity = opacity; this.opacity = opacity;
this.visible = visible; this.visible = visible;
@ -42,7 +42,7 @@ export class TemporalItemLayer extends ItemLayer implements ITemporalItemLayer {
public nextItemLayer:IItemLayer = null; public nextItemLayer:IItemLayer = null;
public temporalItems:IItem[] = []; public temporalItems:IItem[] = [];
constructor(item:IItem,opacity = 1, visible = true) { constructor(item:IItem,opacity:number = 1, visible:boolean = true) {
super(item,opacity,visible) super(item,opacity,visible)
} }
} }

View File

@ -4,5 +4,4 @@ export interface ILayervalue {
unit:string; unit:string;
quantity:string; quantity:string;
value:number; value:number;
scale: number;
} }

View File

@ -4,4 +4,4 @@ import {Geometry } from 'ol/geom';
export interface IStyles{ export interface IStyles{
[id: string]: Style | ((featue:Feature<Geometry>) => Style); [id: string]: Style | ((featue:Feature<Geometry>) => Style);
} };

View File

@ -49,7 +49,6 @@ export interface State {
features: Array<Feature<Geometry>>, features: Array<Feature<Geometry>>,
panelVisible: boolean, panelVisible: boolean,
panelCollapsed: boolean, panelCollapsed: boolean,
panelExtraWide: boolean,
selectedFeature: Feature<Geometry>, selectedFeature: Feature<Geometry>,
selectedItem:IItem, selectedItem:IItem,
parentItem:IItem, parentItem:IItem,
@ -95,7 +94,6 @@ export const initialState: State = {
features: [], features: [],
panelVisible: false, panelVisible: false,
panelCollapsed: false, panelCollapsed: false,
panelExtraWide: false,
selectedFeature: null, selectedFeature: null,
selectedItem: null, selectedItem: null,
parentItem: null, parentItem: null,
@ -125,56 +123,56 @@ export const initialState: State = {
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State { export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State {
switch (action.type) { switch (action.type) {
case ROUTER_NAVIGATION: { case ROUTER_NAVIGATION: {
const a = action as RouterNavigationAction; let a = action as RouterNavigationAction;
return tassign(state); return tassign(state);
} }
case mapActions.SETMAPSTATE: { case mapActions.SETMAPSTATE: {
const a = action as mapActions.SetMapState; let a = action as mapActions.SetMapState;
return tassign(state, { return tassign(state, {
mapState: a.mapState mapState: a.mapState
}); });
} }
case mapActions.SETQUERYSTATE: { case mapActions.SETQUERYSTATE: {
const a = action as mapActions.SetQueryState; let a = action as mapActions.SetQueryState;
return tassign(state, { queryState: tassign(a.queryState ),replaceUrl:a.replaceUrl}); return tassign(state, { queryState: tassign(a.queryState ),replaceUrl:a.replaceUrl});
} }
case mapActions.SETSTATE: { case mapActions.SETSTATE: {
const a = action as mapActions.SetState; let a = action as mapActions.SetState;
return tassign(state, { mapState: tassign(a.mapState), queryState: tassign(a.queryState)}); return tassign(state, { mapState: tassign(a.mapState), queryState: tassign(a.queryState)});
} }
case mapActions.SETVIEWEXTENT: { case mapActions.SETVIEWEXTENT: {
const a = action as mapActions.SetViewExtent; let a = action as mapActions.SetViewExtent;
return tassign(state, { viewExtent: a.extent }); return tassign(state, { viewExtent: a.extent });
} }
case mapActions.SETPARENT: { case mapActions.SETPARENT: {
const a = action as mapActions.SetParent; let a = action as mapActions.SetParent;
return tassign(state, { return tassign(state, {
parentCode : a.parentCode parentCode : a.parentCode
}); });
} }
case mapActions.STARTSEARCHSUCCESS: { case mapActions.STARTSEARCHSUCCESS: {
const a = action as mapActions.StartSearchSuccess; let a = action as mapActions.StartSearchSuccess;
return tassign(state, { return tassign(state, {
features: a.features, features: a.features,
inSearch:false inSearch:false
}); });
} }
case mapActions.SETFEATURES: { case mapActions.SETFEATURES: {
const a = action as mapActions.SetFeatures; let a = action as mapActions.SetFeatures;
return tassign(state, { return tassign(state, {
features: a.features features: a.features
}); });
} }
case mapActions.SELECTFEATURE: { case mapActions.SELECTFEATURE: {
const a = action as mapActions.SelectFeature; let a = action as mapActions.SelectFeature;
return tassign(state, { return tassign(state, {
selectedFeature: state.selectedItem?state.selectedFeature: a.feature selectedFeature: state.selectedItem?state.selectedFeature: a.feature
}); });
} }
case mapActions.SELECTITEM: { case mapActions.SELECTITEM: {
const a = action as mapActions.SelectItem; let a = action as mapActions.SelectItem;
const itemCode = state.selectedItem ? state.selectedItem.code : ""; let itemCode = state.selectedItem ? state.selectedItem.code : "";
const inSearch = a.itemCode != itemCode; let inSearch = a.itemCode != itemCode;
return tassign(state, { return tassign(state, {
selectedItem: null, selectedItem: null,
selectedItemLayer: null, selectedItemLayer: null,
@ -184,7 +182,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
}); });
} }
case mapActions.SELECTITEMSUCCESS: { case mapActions.SELECTITEMSUCCESS: {
const a = action as mapActions.SelectItemSuccess; let a = action as mapActions.SelectItemSuccess;
return tassign(state, { return tassign(state, {
inSearch:false, inSearch:false,
selectedItem: a.item, selectedItem: a.item,
@ -197,8 +195,8 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
}); });
} }
case mapActions.SETSELECTEDITEMLAYER: { case mapActions.SETSELECTEDITEMLAYER: {
const a = action as mapActions.SetSelectedItemLayer; let a = action as mapActions.SetSelectedItemLayer;
let itemLayer = null; var itemLayer = null;
if (a.item && "vnd.farmmaps.itemtype.layer,vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(a.item.itemType) >=0 ) { if (a.item && "vnd.farmmaps.itemtype.layer,vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(a.item.itemType) >=0 ) {
itemLayer = new ItemLayer(a.item); itemLayer = new ItemLayer(a.item);
itemLayer.layerIndex = a.layerIndex>=0?a.layerIndex:a.item.data.layers?a.item.data.layers[0].index:-1; itemLayer.layerIndex = a.layerIndex>=0?a.layerIndex:a.item.data.layers?a.item.data.layers[0].index:-1;
@ -211,12 +209,12 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
}); });
} }
case mapActions.SELECTTEMPORALITEMSSUCCESS:{ case mapActions.SELECTTEMPORALITEMSSUCCESS:{
const a = action as mapActions.SelectTemporalItemsSuccess; let a = action as mapActions.SelectTemporalItemsSuccess;
const selectedItemLayer=tassign(state.selectedItemLayer) as TemporalItemLayer; let selectedItemLayer=tassign(state.selectedItemLayer) as TemporalItemLayer;
let layerIndex=-1; let layerIndex=-1;
selectedItemLayer.temporalItems = a.temporalItems; selectedItemLayer.temporalItems = a.temporalItems;
if(a.temporalItems.length>0) { if(a.temporalItems.length>0) {
const item = a.temporalItems[a.temporalItems.length-1]; let item = a.temporalItems[a.temporalItems.length-1];
layerIndex = item.data.layers[0].index; layerIndex = item.data.layers[0].index;
selectedItemLayer.selectedItemLayer = new ItemLayer(item,1,true,layerIndex); selectedItemLayer.selectedItemLayer = new ItemLayer(item,1,true,layerIndex);
} else { } else {
@ -225,16 +223,16 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
selectedItemLayer.previousItemLayer = a.temporalItems.length>1?new ItemLayer(a.temporalItems[a.temporalItems.length-2],0,true,layerIndex):null; selectedItemLayer.previousItemLayer = a.temporalItems.length>1?new ItemLayer(a.temporalItems[a.temporalItems.length-2],0,true,layerIndex):null;
selectedItemLayer.nextItemLayer = null; selectedItemLayer.nextItemLayer = null;
if(selectedItemLayer.selectedItemLayer) { if(selectedItemLayer.selectedItemLayer) {
const layerIndex = selectedItemLayer.selectedItemLayer.item.data.layers[0].index; let layerIndex = selectedItemLayer.selectedItemLayer.item.data.layers[0].index;
selectedItemLayer.layerIndex = layerIndex; selectedItemLayer.layerIndex = layerIndex;
} }
return tassign(state,{selectedItemLayer:tassign(state.selectedItemLayer,selectedItemLayer as ItemLayer)}); return tassign(state,{selectedItemLayer:tassign(state.selectedItemLayer,selectedItemLayer as ItemLayer)});
} }
case mapActions.NEXTTEMPORAL: { case mapActions.NEXTTEMPORAL: {
const temporalLayer = state.selectedItemLayer as ITemporalItemLayer; let temporalLayer = state.selectedItemLayer as ITemporalItemLayer;
if(temporalLayer.temporalItems && temporalLayer.temporalItems.length>0) { if(temporalLayer.temporalItems && temporalLayer.temporalItems.length>0) {
const index = temporalLayer.temporalItems.indexOf(temporalLayer.selectedItemLayer.item); let index = temporalLayer.temporalItems.indexOf(temporalLayer.selectedItemLayer.item);
if(index == (temporalLayer.temporalItems.length-1)) { if(index == (temporalLayer.temporalItems.length-1)) {
return state; return state;
} else { } else {
@ -260,9 +258,9 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
} }
} }
case mapActions.PREVIOUSTEMPORAL: { case mapActions.PREVIOUSTEMPORAL: {
const temporalLayer = state.selectedItemLayer as ITemporalItemLayer; let temporalLayer = state.selectedItemLayer as ITemporalItemLayer;
if(temporalLayer.temporalItems && temporalLayer.temporalItems.length>0) { if(temporalLayer.temporalItems && temporalLayer.temporalItems.length>0) {
const index = temporalLayer.temporalItems.indexOf(temporalLayer.selectedItemLayer.item); let index = temporalLayer.temporalItems.indexOf(temporalLayer.selectedItemLayer.item);
if(index == 0) { if(index == 0) {
return state; return state;
} else { } else {
@ -291,8 +289,8 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
//todo implement //todo implement
} }
case mapActions.STARTSEARCH: { case mapActions.STARTSEARCH: {
const a = action as mapActions.StartSearch; let a = action as mapActions.StartSearch;
const panelVisible = a.queryState.itemCode!=null ||a.queryState.itemType!=null||a.queryState.parentCode!=null || a.queryState.query != null || a.queryState.tags != null; let panelVisible = a.queryState.itemCode!=null ||a.queryState.itemType!=null||a.queryState.parentCode!=null || a.queryState.query != null || a.queryState.tags != null;
return tassign(state, { return tassign(state, {
selectedItem: null, selectedItem: null,
features:[], features:[],
@ -308,7 +306,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
return tassign(state,{inSearch:false}); return tassign(state,{inSearch:false});
} }
case mapActions.DOQUERY: { case mapActions.DOQUERY: {
const a = action as mapActions.DoQuery; let a = action as mapActions.DoQuery;
return tassign(state, { return tassign(state, {
query: tassign(state.query, query: tassign(state.query,
{ {
@ -323,8 +321,8 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
} }
case mapActions.ADDFEATURESUCCESS: { case mapActions.ADDFEATURESUCCESS: {
const a = action as mapActions.AddFeatureSuccess; let a = action as mapActions.AddFeatureSuccess;
const features = state.features.slice(); let features = state.features.slice();
features.push(a.feature); features.push(a.feature);
return tassign(state, { return tassign(state, {
panelVisible: true, panelVisible: true,
@ -336,8 +334,8 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
}); });
} }
case mapActions.UPDATEFEATURESUCCESS: { case mapActions.UPDATEFEATURESUCCESS: {
const a = action as mapActions.UpdateFeatureSuccess; let a = action as mapActions.UpdateFeatureSuccess;
const features: any[] = []; let features: any[] = [];
var index = -1; var index = -1;
for (var i = 0; i < state.features.length; i++) { for (var i = 0; i < state.features.length; i++) {
if (state.features[i].getId() == a.feature.getId()) { if (state.features[i].getId() == a.feature.getId()) {
@ -358,15 +356,15 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
return tassign(state, { searchCollapsed: state.panelVisible ? false: true,showLayerSwitcher:false}); return tassign(state, { searchCollapsed: state.panelVisible ? false: true,showLayerSwitcher:false});
} }
case mapActions.SETEXTENT: { case mapActions.SETEXTENT: {
const a = action as mapActions.SetExtent; let a = action as mapActions.SetExtent;
return tassign(state, { extent: a.extent }); return tassign(state, { extent: a.extent });
} }
case mapActions.ADDLAYER: { case mapActions.ADDLAYER: {
const a = action as mapActions.AddLayer; let a = action as mapActions.AddLayer;
const itemLayers = state.overlayLayers.slice(0); let itemLayers = state.overlayLayers.slice(0);
const itemLayer = new ItemLayer(a.item); let itemLayer = new ItemLayer(a.item);
itemLayer.layerIndex = a.layerIndex == -1 ? 0 : a.layerIndex; itemLayer.layerIndex = a.layerIndex == -1 ? 0 : a.layerIndex;
const existing = itemLayers.filter(il => il.item.code == itemLayer.item.code && il.layerIndex == itemLayer.layerIndex); let existing = itemLayers.filter(il => il.item.code == itemLayer.item.code && il.layerIndex == itemLayer.layerIndex);
if(existing.length==0) { if(existing.length==0) {
itemLayers.push(itemLayer); itemLayers.push(itemLayer);
return tassign(state, { overlayLayers: itemLayers, selectedOverlayLayer: itemLayer }); return tassign(state, { overlayLayers: itemLayers, selectedOverlayLayer: itemLayer });
@ -376,10 +374,10 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
} }
case mapActions.REMOVELAYER: { case mapActions.REMOVELAYER: {
const a = action as mapActions.RemoveLayer; let a = action as mapActions.RemoveLayer;
const newLayers = state.overlayLayers.slice(0); let newLayers = state.overlayLayers.slice(0);
const i = state.overlayLayers.indexOf(a.itemLayer); let i = state.overlayLayers.indexOf(a.itemLayer);
let selectedOverlayLayer: IItemLayer = null; var selectedOverlayLayer: IItemLayer = null;
if (i>0 && state.overlayLayers.length > 1) if (i>0 && state.overlayLayers.length > 1)
selectedOverlayLayer = state.overlayLayers[i - 1]; selectedOverlayLayer = state.overlayLayers[i - 1];
else if (i == 0 && state.overlayLayers.length > 1) else if (i == 0 && state.overlayLayers.length > 1)
@ -390,53 +388,50 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
case mapActions.CLEARLAYERS: { case mapActions.CLEARLAYERS: {
return tassign(state, {overlayLayers: [], selectedOverlayLayer: null}); return tassign(state, {overlayLayers: [], selectedOverlayLayer: null});
} }
case mapActions.CLEARFEATURES: {
return tassign(state, {features: [], selectedFeature: null});
}
case mapActions.SETVISIBILITY: { case mapActions.SETVISIBILITY: {
const a = action as mapActions.SetVisibility; let a = action as mapActions.SetVisibility;
if(state.selectedItemLayer == a.itemLayer) { if(state.selectedItemLayer == a.itemLayer) {
return tassign(state,{selectedItemLayer: tassign(state.selectedItemLayer,{visible:a.visibility})}); return tassign(state,{selectedItemLayer: tassign(state.selectedItemLayer,{visible:a.visibility})});
} else { } else {
const newLayers = state.overlayLayers.slice(0); let newLayers = state.overlayLayers.slice(0);
const i = state.overlayLayers.indexOf(a.itemLayer); let i = state.overlayLayers.indexOf(a.itemLayer);
newLayers[i].visible = a.visibility; newLayers[i].visible = a.visibility;
return tassign(state, { overlayLayers: newLayers }); return tassign(state, { overlayLayers: newLayers });
} }
} }
case mapActions.SETOPACITY: { case mapActions.SETOPACITY: {
const a = action as mapActions.SetOpacity; let a = action as mapActions.SetOpacity;
if(state.selectedItemLayer == a.itemLayer) { if(state.selectedItemLayer == a.itemLayer) {
return tassign(state,{selectedItemLayer: tassign(state.selectedItemLayer,{opacity:a.opacity})}); return tassign(state,{selectedItemLayer: tassign(state.selectedItemLayer,{opacity:a.opacity})});
} else { } else {
const newLayers = state.overlayLayers.slice(0); let newLayers = state.overlayLayers.slice(0);
const i = state.overlayLayers.indexOf(a.itemLayer); let i = state.overlayLayers.indexOf(a.itemLayer);
newLayers[i].opacity = a.opacity; newLayers[i].opacity = a.opacity;
return tassign(state, { overlayLayers: newLayers }); return tassign(state, { overlayLayers: newLayers });
} }
} }
case mapActions.SETLAYERINDEX: { case mapActions.SETLAYERINDEX: {
const a = action as mapActions.SetLayerIndex; let a = action as mapActions.SetLayerIndex;
if (a.itemLayer == null) { if (a.itemLayer == null) {
if(state.selectedItemLayer.item.itemType == "vnd.farmmaps.itemtype.temporal") { if(state.selectedItemLayer.item.itemType == "vnd.farmmaps.itemtype.temporal") {
var newItemlayer = tassign(state.selectedItemLayer,{layerIndex:a.layerIndex}); var newItemlayer = tassign(state.selectedItemLayer,{layerIndex:a.layerIndex});
const tl = newItemlayer as ITemporalItemLayer; let tl = newItemlayer as ITemporalItemLayer;
if(tl.previousItemLayer) { if(tl.previousItemLayer) {
const nl = new ItemLayer(tl.previousItemLayer.item); let nl = new ItemLayer(tl.previousItemLayer.item);
nl.opacity = tl.previousItemLayer.opacity; nl.opacity = tl.previousItemLayer.opacity;
nl.visible = tl.previousItemLayer.visible; nl.visible = tl.previousItemLayer.visible;
nl.layerIndex = a.layerIndex; nl.layerIndex = a.layerIndex;
tl.previousItemLayer = nl; tl.previousItemLayer = nl;
} }
if(tl.selectedItemLayer) { if(tl.selectedItemLayer) {
const nl = new ItemLayer(tl.selectedItemLayer.item); let nl = new ItemLayer(tl.selectedItemLayer.item);
nl.opacity = tl.selectedItemLayer.opacity; nl.opacity = tl.selectedItemLayer.opacity;
nl.visible = tl.selectedItemLayer.visible; nl.visible = tl.selectedItemLayer.visible;
nl.layerIndex = a.layerIndex; nl.layerIndex = a.layerIndex;
tl.selectedItemLayer = nl; tl.selectedItemLayer = nl;
} }
if(tl.nextItemLayer) { if(tl.nextItemLayer) {
const nl = new ItemLayer(tl.nextItemLayer.item); let nl = new ItemLayer(tl.nextItemLayer.item);
nl.opacity = tl.nextItemLayer.opacity; nl.opacity = tl.nextItemLayer.opacity;
nl.visible = tl.nextItemLayer.visible; nl.visible = tl.nextItemLayer.visible;
nl.layerIndex = a.layerIndex; nl.layerIndex = a.layerIndex;
@ -449,24 +444,24 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
} }
return tassign(state, { selectedItemLayer: newItemlayer}) return tassign(state, { selectedItemLayer: newItemlayer})
} else { } else {
const newLayers = state.overlayLayers.slice(0); let newLayers = state.overlayLayers.slice(0);
const i = state.overlayLayers.indexOf(a.itemLayer); let i = state.overlayLayers.indexOf(a.itemLayer);
newLayers[i].layerIndex = a.layerIndex; newLayers[i].layerIndex = a.layerIndex;
return tassign(state, { overlayLayers: newLayers }); return tassign(state, { overlayLayers: newLayers });
} }
} }
case mapActions.LOADBASELAYERSSUCCESS: { case mapActions.LOADBASELAYERSSUCCESS: {
const a =action as mapActions.LoadBaseLayersSuccess; let a =action as mapActions.LoadBaseLayersSuccess;
const baseLayers:ItemLayer[] = []; let baseLayers:ItemLayer[] = [];
for (const item of a.items) { for (let item of a.items) {
const l = new ItemLayer(item); var l = new ItemLayer(item);
l.visible = false; l.visible = false;
baseLayers.push(l); baseLayers.push(l);
} }
let selectedBaseLayer: IItemLayer = null; var selectedBaseLayer: IItemLayer = null;
var mapState = tassign(state.mapState); var mapState = tassign(state.mapState);
const sb = baseLayers.filter(layer => layer.item.code === mapState.baseLayerCode); let sb = baseLayers.filter(layer => layer.item.code === mapState.baseLayerCode);
const db = baseLayers.filter(layer => layer.item.data && layer.item.data.default === true); let db = baseLayers.filter(layer => layer.item.data && layer.item.data.default === true);
if (baseLayers.length > 0 && mapState.baseLayerCode != "" && sb.length>0) { if (baseLayers.length > 0 && mapState.baseLayerCode != "" && sb.length>0) {
selectedBaseLayer = sb[0]; selectedBaseLayer = sb[0];
selectedBaseLayer.visible = true; selectedBaseLayer.visible = true;
@ -481,22 +476,22 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
return tassign(state, { mapState:mapState, baseLayers: baseLayers, selectedBaseLayer: selectedBaseLayer }); return tassign(state, { mapState:mapState, baseLayers: baseLayers, selectedBaseLayer: selectedBaseLayer });
} }
case mapActions.SELECTBASELAYER: { case mapActions.SELECTBASELAYER: {
const a = action as mapActions.SelectBaseLayer; let a = action as mapActions.SelectBaseLayer;
const baseLayers = state.baseLayers.slice(0); let baseLayers = state.baseLayers.slice(0);
baseLayers.forEach((l) => l.visible = false); baseLayers.forEach((l) => l.visible = false);
const i = state.baseLayers.indexOf(a.itemLayer); let i = state.baseLayers.indexOf(a.itemLayer);
baseLayers[i].visible = true; baseLayers[i].visible = true;
var mapState = tassign(state.mapState); var mapState = tassign(state.mapState);
mapState.baseLayerCode = a.itemLayer.item.code; mapState.baseLayerCode = a.itemLayer.item.code;
return tassign(state, {mapState:mapState, baseLayers:baseLayers,selectedBaseLayer:a.itemLayer }); return tassign(state, {mapState:mapState, baseLayers:baseLayers,selectedBaseLayer:a.itemLayer });
} }
case mapActions.SELECTOVERLAYLAYER: { case mapActions.SELECTOVERLAYLAYER: {
const a = action as mapActions.SelectOverlayLayer; let a = action as mapActions.SelectOverlayLayer;
return tassign(state, { selectedOverlayLayer: a.itemLayer }); return tassign(state, { selectedOverlayLayer: a.itemLayer });
} }
case mapActions.CLEAR: { case mapActions.CLEAR: {
const newQueryState = tassign(state.queryState, { query: null, tags: null, itemCode: null, parentCode: null, itemType: null }); let newQueryState = tassign(state.queryState, { query: null, tags: null, itemCode: null, parentCode: null, itemType: null });
return tassign(state, { return tassign(state, {
panelVisible: false, panelVisible: false,
panelCollapsed:false, panelCollapsed:false,
@ -516,41 +511,41 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
}); });
} }
case mapActions.SETSTYLE:{ case mapActions.SETSTYLE:{
const a = action as mapActions.SetStyle; let a = action as mapActions.SetStyle;
const styles = tassign(state.styles); let styles = tassign(state.styles);
styles[a.itemType] = a.style; styles[a.itemType] = a.style;
return tassign(state,{styles:styles}); return tassign(state,{styles:styles});
} }
case mapActions.SHOWLAYERSWITCHER:{ case mapActions.SHOWLAYERSWITCHER:{
const a = action as mapActions.ShowLayerSwitcher; let a = action as mapActions.ShowLayerSwitcher;
return tassign(state,{showLayerSwitcher:a.show}); return tassign(state,{showLayerSwitcher:a.show});
} }
case mapActions.TOGGLESHOWDATALAYERSLIDE:{ case mapActions.TOGGLESHOWDATALAYERSLIDE:{
return tassign(state,{showDataLayerSlide:!state.showDataLayerSlide}); return tassign(state,{showDataLayerSlide:!state.showDataLayerSlide});
} }
case mapActions.SETREPLACEURL: { case mapActions.SETREPLACEURL: {
const a= action as mapActions.SetReplaceUrl; let a= action as mapActions.SetReplaceUrl;
return tassign(state,{replaceUrl:a.replaceUrl}); return tassign(state,{replaceUrl:a.replaceUrl});
} }
case mapActions.TOGGLELAYERVALUESENABLED: { case mapActions.TOGGLELAYERVALUESENABLED: {
return tassign(state,{layerValuesEnabled:!state.layerValuesEnabled}); return tassign(state,{layerValuesEnabled:!state.layerValuesEnabled});
} }
case mapActions.SETLAYERVALUESLOCATION: { case mapActions.SETLAYERVALUESLOCATION: {
const a= action as mapActions.SetLayerValuesLocation; let a= action as mapActions.SetLayerValuesLocation;
return tassign(state,{layerValuesX: a.x, layerValuesY:a.y,layerValues:[]}); return tassign(state,{layerValuesX: a.x, layerValuesY:a.y,layerValues:[]});
} }
case mapActions.GETLAYERVALUESUCCESS:{ case mapActions.GETLAYERVALUESUCCESS:{
const a= action as mapActions.GetLayerValueSuccess; let a= action as mapActions.GetLayerValueSuccess;
const v = state.layerValues.slice(0); let v = state.layerValues.slice(0);
v.push(a.layervalue); v.push(a.layervalue);
return tassign(state,{layerValues:v}); return tassign(state,{layerValues:v});
} }
case mapActions.SETVIEWSTATE:{ case mapActions.SETVIEWSTATE:{
const a= action as mapActions.SetViewState; let a= action as mapActions.SetViewState;
return tassign(state,{viewEnabled:a.enabled}); return tassign(state,{viewEnabled:a.enabled});
} }
case commonActions.ITEMDELETEDEVENT:{ case commonActions.ITEMDELETEDEVENT:{
const a= action as commonActions.ItemDeletedEvent; let a= action as commonActions.ItemDeletedEvent;
if(state.selectedItem && state.selectedItem.code == a.itemCode) { if(state.selectedItem && state.selectedItem.code == a.itemCode) {
return tassign(state,{ return tassign(state,{
selectedItem: null, selectedItem: null,
@ -567,17 +562,13 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
} }
} }
if(index>=0) { if(index>=0) {
const newFeatures = state.features.slice(0); let newFeatures = state.features.slice(0);
newFeatures.splice(index,1); newFeatures.splice(index,1);
return tassign(state,{features:newFeatures}); return tassign(state,{features:newFeatures});
} }
} }
return state; return state;
} }
case mapActions.SETPANELEXTRAWIDE:{
const a= action as mapActions.SetPanelExtraWide;
return tassign(state,{panelExtraWide:a.panelExtraWide});
}
default: { default: {
return state; return state;
} }
@ -589,7 +580,6 @@ export const getParentCode = (state: State) => state.parentCode;
export const getFeatures = (state: State) => state.features; export const getFeatures = (state: State) => state.features;
export const getPanelVisible = (state: State) => state.panelVisible; export const getPanelVisible = (state: State) => state.panelVisible;
export const getPanelCollapsed = (state: State) => state.panelCollapsed; export const getPanelCollapsed = (state: State) => state.panelCollapsed;
export const getPanelExtraWide = (state: State) => state.panelExtraWide;
export const getSelectedFeature = (state: State) => state.selectedFeature; export const getSelectedFeature = (state: State) => state.selectedFeature;
export const getSelectedItem = (state: State) => state.selectedItem; export const getSelectedItem = (state: State) => state.selectedItem;
export const getParentItem = (state: State) => state.parentItem; export const getParentItem = (state: State) => state.parentItem;
@ -598,7 +588,6 @@ export const getClearEnabled = (state: State) => state.clearEnabled;
export const getSearchCollapsed = (state: State) => state.searchCollapsed; export const getSearchCollapsed = (state: State) => state.searchCollapsed;
export const getSearchMinified = (state: State) => state.searchMinified; export const getSearchMinified = (state: State) => state.searchMinified;
export const getExtent = (state: State) => state.extent; export const getExtent = (state: State) => state.extent;
export const getViewExtent = (state: State) => state.viewExtent;
export const getOverlayLayers = (state: State) => state.overlayLayers; export const getOverlayLayers = (state: State) => state.overlayLayers;
export const getBaseLayers = (state: State) => state.baseLayers; export const getBaseLayers = (state: State) => state.baseLayers;
export const getProjection = (state: State) => state.projection; export const getProjection = (state: State) => state.projection;
@ -625,7 +614,6 @@ export const selectGetParentCode = createSelector(selectMapState, getParentCode)
export const selectGetFeatures = createSelector(selectMapState, getFeatures); export const selectGetFeatures = createSelector(selectMapState, getFeatures);
export const selectGetPanelVisible = createSelector(selectMapState, getPanelVisible); export const selectGetPanelVisible = createSelector(selectMapState, getPanelVisible);
export const selectGetPanelCollapsed = createSelector(selectMapState, getPanelCollapsed); export const selectGetPanelCollapsed = createSelector(selectMapState, getPanelCollapsed);
export const selectGetPanelExtraWide = createSelector(selectMapState, getPanelExtraWide);
export const selectGetSelectedFeature = createSelector(selectMapState, getSelectedFeature); export const selectGetSelectedFeature = createSelector(selectMapState, getSelectedFeature);
export const selectGetSelectedItem = createSelector(selectMapState, getSelectedItem); export const selectGetSelectedItem = createSelector(selectMapState, getSelectedItem);
export const selectGetParentItem = createSelector(selectMapState, getParentItem); export const selectGetParentItem = createSelector(selectMapState, getParentItem);
@ -634,7 +622,6 @@ export const selectGetClearEnabled = createSelector(selectMapState, getClearEnab
export const selectGetSearchCollapsed = createSelector(selectMapState, getSearchCollapsed); export const selectGetSearchCollapsed = createSelector(selectMapState, getSearchCollapsed);
export const selectGetSearchMinified = createSelector(selectMapState, getSearchMinified); export const selectGetSearchMinified = createSelector(selectMapState, getSearchMinified);
export const selectGetExtent = createSelector(selectMapState, getExtent); export const selectGetExtent = createSelector(selectMapState, getExtent);
export const selectGetViewExtent = createSelector(selectMapState, getViewExtent);
export const selectGetOverlayLayers = createSelector(selectMapState, getOverlayLayers); export const selectGetOverlayLayers = createSelector(selectMapState, getOverlayLayers);
export const selectGetBaseLayers = createSelector(selectMapState, getBaseLayers); export const selectGetBaseLayers = createSelector(selectMapState, getBaseLayers);
export const selectGetProjection = createSelector(selectMapState, getProjection); export const selectGetProjection = createSelector(selectMapState, getProjection);

View File

@ -8,25 +8,25 @@ export class DeviceOrientationService {
compassHeading(alpha, beta, gamma):number { compassHeading(alpha, beta, gamma):number {
// Convert degrees to radians // Convert degrees to radians
const alphaRad = alpha * (Math.PI / 180); var alphaRad = alpha * (Math.PI / 180);
const betaRad = beta * (Math.PI / 180); var betaRad = beta * (Math.PI / 180);
const gammaRad = gamma * (Math.PI / 180); var gammaRad = gamma * (Math.PI / 180);
// Calculate equation components // Calculate equation components
const cA = Math.cos(alphaRad); var cA = Math.cos(alphaRad);
const sA = Math.sin(alphaRad); var sA = Math.sin(alphaRad);
const cB = Math.cos(betaRad); var cB = Math.cos(betaRad);
const sB = Math.sin(betaRad); var sB = Math.sin(betaRad);
const cG = Math.cos(gammaRad); var cG = Math.cos(gammaRad);
const sG = Math.sin(gammaRad); var sG = Math.sin(gammaRad);
// Calculate A, B, C rotation components // Calculate A, B, C rotation components
const rA = - cA * sG - sA * sB * cG; var rA = - cA * sG - sA * sB * cG;
const rB = - sA * sG + cA * sB * cG; var rB = - sA * sG + cA * sB * cG;
const rC = - cB * cG; var rC = - cB * cG;
// Calculate compass heading // Calculate compass heading
let compassHeading = Math.atan(rA / rB); var compassHeading = Math.atan(rA / rB);
// Convert from half unit circle to whole unit circle // Convert from half unit circle to whole unit circle
if(rB < 0) { if(rB < 0) {
@ -40,7 +40,7 @@ export class DeviceOrientationService {
getCurrentCompassHeading(): Observable<number> { getCurrentCompassHeading(): Observable<number> {
return Observable.create((observer: Observer<number>) => { return Observable.create((observer: Observer<number>) => {
window.addEventListener("deviceorientation", (event:DeviceOrientationEvent)=>{ window.addEventListener("deviceorientation", (event:DeviceOrientationEvent)=>{
const heading = this.compassHeading(event.alpha,event.beta,event.gamma); let heading = this.compassHeading(event.alpha,event.beta,event.gamma);
if(!Number.isNaN(heading)) { if(!Number.isNaN(heading)) {
observer.next(heading); observer.next(heading);
} }

View File

@ -7,31 +7,31 @@ import * as extent from 'ol/extent';
@Injectable() @Injectable()
export class FeatureIconService { export class FeatureIconService {
getIconImageDataUrl(iconClass:string, backgroundColor = "#c80a6e",color = "#ffffff"): string { getIconImageDataUrl(iconClass:string, backgroundColor: string = "#c80a6e",color:string = "#ffffff"): string {
const canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
canvas.width = 365; canvas.width = 365;
canvas.height = 560; canvas.height = 560;
const ctx = canvas.getContext('2d'); var ctx = canvas.getContext('2d');
ctx.lineWidth = 6; ctx.lineWidth = 6;
ctx.fillStyle = backgroundColor; ctx.fillStyle = backgroundColor;
ctx.strokeStyle = "#000000"; ctx.strokeStyle = "#000000";
const path = new Path2D("m182.9 551.7c0 0.1 0.2 0.3 0.2 0.3s175.2-269 175.2-357.4c0-130.1-88.8-186.7-175.4-186.9-86.6 0.2-175.4 56.8-175.4 186.9 0 88.4 175.3 357.4 175.3 357.4z"); var path = new Path2D("m182.9 551.7c0 0.1 0.2 0.3 0.2 0.3s175.2-269 175.2-357.4c0-130.1-88.8-186.7-175.4-186.9-86.6 0.2-175.4 56.8-175.4 186.9 0 88.4 175.3 357.4 175.3 357.4z");
ctx.fill(path) ctx.fill(path)
let iconCharacter = ""; var iconCharacter = "";
if (iconClass != null) { if (iconClass != null) {
const element = document.createElement("i"); var element = document.createElement("i");
element.style.display = "none"; element.style.display = "none";
element.className = iconClass; element.className = iconClass;
document.body.appendChild(element); document.body.appendChild(element);
iconCharacter = getComputedStyle(element, "::before").content.replace(/"/g, ''); iconCharacter = getComputedStyle(element, "::before").content.replace(/"/g, '');
const iconFont = "200px " +getComputedStyle(element, "::before").fontFamily let iconFont = "200px " +getComputedStyle(element, "::before").fontFamily
document.body.removeChild(element); document.body.removeChild(element);
ctx.strokeStyle = color; ctx.strokeStyle = color;
ctx.fillStyle = color; ctx.fillStyle = color;
ctx.lineWidth = 15; ctx.lineWidth = 15;
ctx.font = iconFont; ctx.font = iconFont;
const ts = ctx.measureText(iconCharacter); var ts = ctx.measureText(iconCharacter);
ctx.fillText(iconCharacter, 182.9 - (ts.width / 2), 250); ctx.fillText(iconCharacter, 182.9 - (ts.width / 2), 250);
ctx.strokeText(iconCharacter, 182.9 - (ts.width / 2), 250); ctx.strokeText(iconCharacter, 182.9 - (ts.width / 2), 250);
} }

View File

@ -9,19 +9,19 @@ export class TemporalService {
constructor(private timespanService$:TimespanService,private datePipe$: DatePipe) {} constructor(private timespanService$:TimespanService,private datePipe$: DatePipe) {}
hasNext(itemLayer:IItemLayer):boolean { hasNext(itemLayer:IItemLayer):boolean {
const temporalItemLayer = itemLayer as ITemporalItemLayer; let temporalItemLayer = itemLayer as ITemporalItemLayer;
return temporalItemLayer && temporalItemLayer.nextItemLayer != null; return temporalItemLayer && temporalItemLayer.nextItemLayer != null;
} }
selectedDate(itemLayer:IItemLayer):string { selectedDate(itemLayer:IItemLayer):string {
const temporalItemLayer = itemLayer as ITemporalItemLayer; let temporalItemLayer = itemLayer as ITemporalItemLayer;
if(temporalItemLayer && temporalItemLayer.selectedItemLayer) { if(temporalItemLayer && temporalItemLayer.selectedItemLayer) {
if(temporalItemLayer && temporalItemLayer.selectedItemLayer.item.dataDate && temporalItemLayer.selectedItemLayer.item.dataEndDate) { if(temporalItemLayer && temporalItemLayer.selectedItemLayer.item.dataDate && temporalItemLayer.selectedItemLayer.item.dataEndDate) {
const sd = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate)); let sd = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate));
const ed = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataEndDate)); let ed = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataEndDate));
return this.timespanService$.getCaption(sd,ed); return this.timespanService$.getCaption(sd,ed);
} else { } else {
const d = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate)); let d = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate));
return this.datePipe$.transform(d, "shortDate"); return this.datePipe$.transform(d, "shortDate");
} }
} }
@ -29,14 +29,14 @@ export class TemporalService {
} }
nextDate(itemLayer:IItemLayer):string { nextDate(itemLayer:IItemLayer):string {
const temporalItemLayer = itemLayer as ITemporalItemLayer; let temporalItemLayer = itemLayer as ITemporalItemLayer;
if(temporalItemLayer && temporalItemLayer.nextItemLayer && temporalItemLayer.nextItemLayer.item) { if(temporalItemLayer && temporalItemLayer.nextItemLayer && temporalItemLayer.nextItemLayer.item) {
if(temporalItemLayer.nextItemLayer.item.dataDate && temporalItemLayer.nextItemLayer.item.dataEndDate) { if(temporalItemLayer.nextItemLayer.item.dataDate && temporalItemLayer.nextItemLayer.item.dataEndDate) {
const sd = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataDate)); let sd = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataDate));
const ed = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataEndDate)); let ed = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataEndDate));
return this.timespanService$.getCaption(sd,ed); return this.timespanService$.getCaption(sd,ed);
} else { } else {
const d = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataDate)); let d = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataDate));
return this.datePipe$.transform(d, "shortDate"); return this.datePipe$.transform(d, "shortDate");
} }
} }
@ -44,19 +44,19 @@ export class TemporalService {
} }
hasPrevious(itemLayer:IItemLayer):boolean { hasPrevious(itemLayer:IItemLayer):boolean {
const temporalItemLayer = itemLayer as ITemporalItemLayer; let temporalItemLayer = itemLayer as ITemporalItemLayer;
return temporalItemLayer && temporalItemLayer.previousItemLayer != null; return temporalItemLayer && temporalItemLayer.previousItemLayer != null;
} }
previousDate(itemLayer:IItemLayer):string { previousDate(itemLayer:IItemLayer):string {
const temporalItemLayer = itemLayer as ITemporalItemLayer; let temporalItemLayer = itemLayer as ITemporalItemLayer;
if(temporalItemLayer && temporalItemLayer.previousItemLayer && temporalItemLayer.previousItemLayer.item) { if(temporalItemLayer && temporalItemLayer.previousItemLayer && temporalItemLayer.previousItemLayer.item) {
if(temporalItemLayer.previousItemLayer.item.dataDate && temporalItemLayer.previousItemLayer.item.dataEndDate) { if(temporalItemLayer.previousItemLayer.item.dataDate && temporalItemLayer.previousItemLayer.item.dataEndDate) {
const sd = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataDate)); let sd = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataDate));
const ed = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataEndDate)); let ed = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataEndDate));
return this.timespanService$.getCaption(sd,ed); return this.timespanService$.getCaption(sd,ed);
} else { } else {
const d = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataDate)); let d = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataDate));
return this.datePipe$.transform(d, "shortDate"); return this.datePipe$.transform(d, "shortDate");
} }
} }

View File

@ -9,6 +9,8 @@ import {
platformBrowserDynamicTesting platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing'; } from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment. // First, initialize the Angular testing environment.
getTestBed().initTestEnvironment( getTestBed().initTestEnvironment(
BrowserDynamicTestingModule, BrowserDynamicTestingModule,
@ -16,3 +18,7 @@ getTestBed().initTestEnvironment(
teardown: { destroyAfterEach: false } teardown: { destroyAfterEach: false }
} }
); );
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

View File

@ -2,6 +2,7 @@
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"outDir": "../../out-tsc/lib", "outDir": "../../out-tsc/lib",
"target": "es2020",
"module": "es2015", "module": "es2015",
"moduleResolution": "node", "moduleResolution": "node",
"declaration": true, "declaration": true,
@ -10,27 +11,18 @@
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"importHelpers": true, "importHelpers": true,
"esModuleInterop": true,
"types": [], "types": [],
"lib": [ "lib": [
"dom", "dom",
"es2018" "es2018"
],
"paths": {
"@angular/*": [
"node_modules/@angular/*"
] ]
}
}, },
"angularCompilerOptions": { "angularCompilerOptions": {
"skipTemplateCodegen": true, "skipTemplateCodegen": true,
"strictMetadataEmit": true, "strictMetadataEmit": true,
"fullTemplateTypeCheck": true, "fullTemplateTypeCheck": true,
"strictInjectionParameters": true, "strictInjectionParameters": true,
"enableResourceInlining": true, "enableResourceInlining": true
"compilationMode": "partial"
}, },
"exclude": [ "exclude": [
"src/test.ts", "src/test.ts",

View File

@ -2,6 +2,7 @@
"extends": "../../tsconfig.json", "extends": "../../tsconfig.json",
"compilerOptions": { "compilerOptions": {
"outDir": "../../out-tsc/lib", "outDir": "../../out-tsc/lib",
"target": "es2020",
"module": "es2015", "module": "es2015",
"moduleResolution": "node", "moduleResolution": "node",
"declaration": true, "declaration": true,

View File

@ -0,0 +1,17 @@
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"fm-map",
"camelCase"
],
"component-selector": [
true,
"element",
"fm-map",
"kebab-case"
]
}
}

View File

@ -1,22 +0,0 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"overrides": [
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
}
}

View File

@ -1,565 +0,0 @@
{
"name": "@farmmaps/common-map3d",
"version": "2.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@farmmaps/common-map3d",
"version": "2.0.0",
"dependencies": {
"tslib": "^2.0.0"
},
"peerDependencies": {
"@angular/common": "^18.2.3",
"@angular/core": "^18.2.3",
"cesium": "^1.97.0",
"ol-cesium": ">=2.13.0"
}
},
"../../dist/libs/ng-openlayers": {
"version": "18.0.0",
"extraneous": true,
"license": "MPL-2.0",
"dependencies": {
"tslib": "^2.3.0"
},
"peerDependencies": {
"@angular/common": "^18.2.3",
"@angular/core": "^18.2.3",
"ol": "^8.2.0"
}
},
"dist/ng-openlayers": {
"extraneous": true
},
"node_modules/@angular/common": {
"version": "18.2.3",
"resolved": "https://registry.npmjs.org/@angular/common/-/common-18.2.3.tgz",
"integrity": "sha512-NFL4yXXImSCH7i1xnHykUjHa9vl9827fGiwSV2mnf7LjSUsyDzFD8/54dNuYN9OY8AUD+PnK0YdNro6cczVyIA==",
"peer": true,
"dependencies": {
"tslib": "^2.3.0"
},
"engines": {
"node": "^18.19.1 || ^20.11.1 || >=22.0.0"
},
"peerDependencies": {
"@angular/core": "18.2.3",
"rxjs": "^6.5.3 || ^7.4.0"
}
},
"node_modules/@angular/core": {
"version": "18.2.3",
"resolved": "https://registry.npmjs.org/@angular/core/-/core-18.2.3.tgz",
"integrity": "sha512-VGhMJxj7d0rYpqVfQrcGRB7EE/BCziotft/I/YPl6bOMPSAvMukG7DXQuJdYpNrr62ks78mlzHlZX/cdmB9Prw==",
"peer": true,
"dependencies": {
"tslib": "^2.3.0"
},
"engines": {
"node": "^18.19.1 || ^20.11.1 || >=22.0.0"
},
"peerDependencies": {
"rxjs": "^6.5.3 || ^7.4.0",
"zone.js": "~0.14.10"
}
},
"node_modules/@cesium/engine": {
"version": "11.0.0",
"resolved": "https://registry.npmjs.org/@cesium/engine/-/engine-11.0.0.tgz",
"integrity": "sha512-0z3mJNNly407h3/bAvGoGnjA0ygprkVz32z9x1VNmPXf9AuybKu7Q4wRrChUhC/qsNj3L45kP6KqyDuHSe2bhw==",
"peer": true,
"dependencies": {
"@tweenjs/tween.js": "^25.0.0",
"@zip.js/zip.js": "^2.7.34",
"autolinker": "^4.0.0",
"bitmap-sdf": "^1.0.3",
"dompurify": "^3.0.2",
"draco3d": "^1.5.1",
"earcut": "^3.0.0",
"grapheme-splitter": "^1.0.4",
"jsep": "^1.3.8",
"kdbush": "^4.0.1",
"ktx-parse": "^0.7.0",
"lerc": "^2.0.0",
"mersenne-twister": "^1.1.0",
"meshoptimizer": "^0.21.0",
"pako": "^2.0.4",
"protobufjs": "^7.1.0",
"rbush": "^4.0.0",
"topojson-client": "^3.1.0",
"urijs": "^1.19.7"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@cesium/widgets": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@cesium/widgets/-/widgets-8.0.0.tgz",
"integrity": "sha512-Rnid5BbLBZjwFdbr3lgOwK3fhql/BeEbf5l9ZZE+Zc7V8Fb6wgKM8QmrL+bbJ+BtuiELp+SkNxcF97Ktifxb4g==",
"peer": true,
"dependencies": {
"@cesium/engine": "^11.0.0",
"nosleep.js": "^0.12.0"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@petamoriken/float16": {
"version": "3.8.7",
"resolved": "https://registry.npmjs.org/@petamoriken/float16/-/float16-3.8.7.tgz",
"integrity": "sha512-/Ri4xDDpe12NT6Ex/DRgHzLlobiQXEW/hmG08w1wj/YU7hLemk97c+zHQFp0iZQ9r7YqgLEXZR2sls4HxBf9NA==",
"peer": true
},
"node_modules/@protobufjs/aspromise": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
"integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==",
"peer": true
},
"node_modules/@protobufjs/base64": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
"integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==",
"peer": true
},
"node_modules/@protobufjs/codegen": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
"integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==",
"peer": true
},
"node_modules/@protobufjs/eventemitter": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
"integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==",
"peer": true
},
"node_modules/@protobufjs/fetch": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
"integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==",
"peer": true,
"dependencies": {
"@protobufjs/aspromise": "^1.1.1",
"@protobufjs/inquire": "^1.1.0"
}
},
"node_modules/@protobufjs/float": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
"integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==",
"peer": true
},
"node_modules/@protobufjs/inquire": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
"integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==",
"peer": true
},
"node_modules/@protobufjs/path": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
"integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==",
"peer": true
},
"node_modules/@protobufjs/pool": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
"integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==",
"peer": true
},
"node_modules/@protobufjs/utf8": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
"integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==",
"peer": true
},
"node_modules/@tweenjs/tween.js": {
"version": "25.0.0",
"resolved": "https://registry.npmjs.org/@tweenjs/tween.js/-/tween.js-25.0.0.tgz",
"integrity": "sha512-XKLA6syeBUaPzx4j3qwMqzzq+V4uo72BnlbOjmuljLrRqdsd3qnzvZZoxvMHZ23ndsRS4aufU6JOZYpCbU6T1A==",
"peer": true
},
"node_modules/@types/node": {
"version": "22.5.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz",
"integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==",
"peer": true,
"dependencies": {
"undici-types": "~6.19.2"
}
},
"node_modules/@types/rbush": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/@types/rbush/-/rbush-3.0.4.tgz",
"integrity": "sha512-knSt9cCW8jj1ZSFcFeBZaX++OucmfPxxHiRwTahZfJlnQsek7O0bazTJHWD2RVj9LEoejUYF2de3/stf+QXcXw==",
"peer": true
},
"node_modules/@zip.js/zip.js": {
"version": "2.7.52",
"resolved": "https://registry.npmjs.org/@zip.js/zip.js/-/zip.js-2.7.52.tgz",
"integrity": "sha512-+5g7FQswvrCHwYKNMd/KFxZSObctLSsQOgqBSi0LzwHo3li9Eh1w5cF5ndjQw9Zbr3ajVnd2+XyiX85gAetx1Q==",
"peer": true,
"engines": {
"bun": ">=0.7.0",
"deno": ">=1.0.0",
"node": ">=16.5.0"
}
},
"node_modules/autolinker": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/autolinker/-/autolinker-4.0.0.tgz",
"integrity": "sha512-fl5Kh6BmEEZx+IWBfEirnRUU5+cOiV0OK7PEt0RBKvJMJ8GaRseIOeDU3FKf4j3CE5HVefcjHmhYPOcaVt0bZw==",
"peer": true,
"dependencies": {
"tslib": "^2.3.0"
}
},
"node_modules/bitmap-sdf": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/bitmap-sdf/-/bitmap-sdf-1.0.4.tgz",
"integrity": "sha512-1G3U4n5JE6RAiALMxu0p1XmeZkTeCwGKykzsLTCqVzfSDaN6S7fKnkIkfejogz+iwqBWc0UYAIKnKHNN7pSfDg==",
"peer": true
},
"node_modules/cesium": {
"version": "1.121.1",
"resolved": "https://registry.npmjs.org/cesium/-/cesium-1.121.1.tgz",
"integrity": "sha512-WpdaGFd8qCOHiE9khV0sWWjCMXAX1U9Aou8MzMC/F0Akp6YqcOk4HLk4LLhZKeOjO/Bh27iTIW2mxEZ5+dtCxg==",
"peer": true,
"dependencies": {
"@cesium/engine": "^11.0.0",
"@cesium/widgets": "^8.0.0"
},
"engines": {
"node": ">=18.18.0"
}
},
"node_modules/color-name": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-2.0.0.tgz",
"integrity": "sha512-SbtvAMWvASO5TE2QP07jHBMXKafgdZz8Vrsrn96fiL+O92/FN/PLARzUW5sKt013fjAprK2d2iCn2hk2Xb5oow==",
"peer": true,
"engines": {
"node": ">=12.20"
}
},
"node_modules/color-parse": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/color-parse/-/color-parse-2.0.2.tgz",
"integrity": "sha512-eCtOz5w5ttWIUcaKLiktF+DxZO1R9KLNY/xhbV6CkhM7sR3GhVghmt6X6yOnzeaM24po+Z9/S1apbXMwA3Iepw==",
"peer": true,
"dependencies": {
"color-name": "^2.0.0"
}
},
"node_modules/color-rgba": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/color-rgba/-/color-rgba-3.0.0.tgz",
"integrity": "sha512-PPwZYkEY3M2THEHHV6Y95sGUie77S7X8v+h1r6LSAPF3/LL2xJ8duUXSrkic31Nzc4odPwHgUbiX/XuTYzQHQg==",
"peer": true,
"dependencies": {
"color-parse": "^2.0.0",
"color-space": "^2.0.0"
}
},
"node_modules/color-space": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-space/-/color-space-2.0.1.tgz",
"integrity": "sha512-nKqUYlo0vZATVOFHY810BSYjmCARrG7e5R3UE3CQlyjJTvv5kSSmPG1kzm/oDyyqjehM+lW1RnEt9It9GNa5JA==",
"peer": true
},
"node_modules/commander": {
"version": "2.20.3",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
"peer": true
},
"node_modules/dompurify": {
"version": "3.1.6",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.6.tgz",
"integrity": "sha512-cTOAhc36AalkjtBpfG6O8JimdTMWNXjiePT2xQH/ppBGi/4uIpmj8eKyIkMJErXWARyINV/sB38yf8JCLF5pbQ==",
"peer": true
},
"node_modules/draco3d": {
"version": "1.5.7",
"resolved": "https://registry.npmjs.org/draco3d/-/draco3d-1.5.7.tgz",
"integrity": "sha512-m6WCKt/erDXcw+70IJXnG7M3awwQPAsZvJGX5zY7beBqpELw6RDGkYVU0W43AFxye4pDZ5i2Lbyc/NNGqwjUVQ==",
"peer": true
},
"node_modules/earcut": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/earcut/-/earcut-3.0.0.tgz",
"integrity": "sha512-41Fs7Q/PLq1SDbqjsgcY7GA42T0jvaCNGXgGtsNdvg+Yv8eIu06bxv4/PoREkZ9nMDNwnUSG9OFB9+yv8eKhDg==",
"peer": true
},
"node_modules/geotiff": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/geotiff/-/geotiff-2.1.3.tgz",
"integrity": "sha512-PT6uoF5a1+kbC3tHmZSUsLHBp2QJlHasxxxxPW47QIY1VBKpFB+FcDvX+MxER6UzgLQZ0xDzJ9s48B9JbOCTqA==",
"peer": true,
"dependencies": {
"@petamoriken/float16": "^3.4.7",
"lerc": "^3.0.0",
"pako": "^2.0.4",
"parse-headers": "^2.0.2",
"quick-lru": "^6.1.1",
"web-worker": "^1.2.0",
"xml-utils": "^1.0.2",
"zstddec": "^0.1.0"
},
"engines": {
"node": ">=10.19"
}
},
"node_modules/geotiff/node_modules/lerc": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/lerc/-/lerc-3.0.0.tgz",
"integrity": "sha512-Rm4J/WaHhRa93nCN2mwWDZFoRVF18G1f47C+kvQWyHGEZxFpTUi73p7lMVSAndyxGt6lJ2/CFbOcf9ra5p8aww==",
"peer": true
},
"node_modules/grapheme-splitter": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz",
"integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==",
"peer": true
},
"node_modules/jsep": {
"version": "1.3.9",
"resolved": "https://registry.npmjs.org/jsep/-/jsep-1.3.9.tgz",
"integrity": "sha512-i1rBX5N7VPl0eYb6+mHNp52sEuaS2Wi8CDYx1X5sn9naevL78+265XJqy1qENEk7mRKwS06NHpUqiBwR7qeodw==",
"peer": true,
"engines": {
"node": ">= 10.16.0"
}
},
"node_modules/kdbush": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/kdbush/-/kdbush-4.0.2.tgz",
"integrity": "sha512-WbCVYJ27Sz8zi9Q7Q0xHC+05iwkm3Znipc2XTlrnJbsHMYktW4hPhXUE8Ys1engBrvffoSCqbil1JQAa7clRpA==",
"peer": true
},
"node_modules/ktx-parse": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/ktx-parse/-/ktx-parse-0.7.1.tgz",
"integrity": "sha512-FeA3g56ksdFNwjXJJsc1CCc7co+AJYDp6ipIp878zZ2bU8kWROatLYf39TQEd4/XRSUvBXovQ8gaVKWPXsCLEQ==",
"peer": true
},
"node_modules/lerc": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/lerc/-/lerc-2.0.0.tgz",
"integrity": "sha512-7qo1Mq8ZNmaR4USHHm615nEW2lPeeWJ3bTyoqFbd35DLx0LUH7C6ptt5FDCTAlbIzs3+WKrk5SkJvw8AFDE2hg==",
"peer": true
},
"node_modules/long": {
"version": "5.2.3",
"resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz",
"integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==",
"peer": true
},
"node_modules/mersenne-twister": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/mersenne-twister/-/mersenne-twister-1.1.0.tgz",
"integrity": "sha512-mUYWsMKNrm4lfygPkL3OfGzOPTR2DBlTkBNHM//F6hGp8cLThY897crAlk3/Jo17LEOOjQUrNAx6DvgO77QJkA==",
"peer": true
},
"node_modules/meshoptimizer": {
"version": "0.21.0",
"resolved": "https://registry.npmjs.org/meshoptimizer/-/meshoptimizer-0.21.0.tgz",
"integrity": "sha512-WabtlpnK/GgD0GMwYd1fBTfYHf4MIcQPEg6dt7y4GuDcY51RzLSkSNE8ZogD7U3Vs2/fIf4z89TOLpA80EOnhg==",
"peer": true
},
"node_modules/nosleep.js": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/nosleep.js/-/nosleep.js-0.12.0.tgz",
"integrity": "sha512-9d1HbpKLh3sdWlhXMhU6MMH+wQzKkrgfRkYV0EBdvt99YJfj0ilCJrWRDYG2130Tm4GXbEoTCx5b34JSaP+HhA==",
"peer": true
},
"node_modules/ol": {
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/ol/-/ol-10.1.0.tgz",
"integrity": "sha512-/efepydpzhFoeczA9KAN5t7G0WpFhP46ZXEfSl6JbZ7ipQZ2axpkYB2qt0qcOUlPFYMt7/XQFApH652KB08tTg==",
"peer": true,
"dependencies": {
"@types/rbush": "^3.0.3",
"color-rgba": "^3.0.0",
"color-space": "^2.0.1",
"earcut": "^3.0.0",
"geotiff": "^2.0.7",
"pbf": "4.0.1",
"rbush": "^4.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/openlayers"
}
},
"node_modules/ol-cesium": {
"version": "2.17.0",
"resolved": "https://registry.npmjs.org/ol-cesium/-/ol-cesium-2.17.0.tgz",
"integrity": "sha512-XaMXjQYuq2eMPAgAx2e1wjN4I4QwfmPC+9YgU4xoMCj/MBj8oDQusyloQ4TaovypqbZg+0jJDDSZc7BhXckBwA==",
"peer": true,
"peerDependencies": {
"cesium": ">= 1.62.0",
"ol": ">= 6.0.1 || 7 || 8"
}
},
"node_modules/pako": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz",
"integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==",
"peer": true
},
"node_modules/parse-headers": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz",
"integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==",
"peer": true
},
"node_modules/pbf": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/pbf/-/pbf-4.0.1.tgz",
"integrity": "sha512-SuLdBvS42z33m8ejRbInMapQe8n0D3vN/Xd5fmWM3tufNgRQFBpaW2YVJxQZV4iPNqb0vEFvssMEo5w9c6BTIA==",
"peer": true,
"dependencies": {
"resolve-protobuf-schema": "^2.1.0"
},
"bin": {
"pbf": "bin/pbf"
}
},
"node_modules/protobufjs": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.4.0.tgz",
"integrity": "sha512-mRUWCc3KUU4w1jU8sGxICXH/gNS94DvI1gxqDvBzhj1JpcsimQkYiOJfwsPUykUI5ZaspFbSgmBLER8IrQ3tqw==",
"hasInstallScript": true,
"peer": true,
"dependencies": {
"@protobufjs/aspromise": "^1.1.2",
"@protobufjs/base64": "^1.1.2",
"@protobufjs/codegen": "^2.0.4",
"@protobufjs/eventemitter": "^1.1.0",
"@protobufjs/fetch": "^1.1.0",
"@protobufjs/float": "^1.0.2",
"@protobufjs/inquire": "^1.1.0",
"@protobufjs/path": "^1.1.2",
"@protobufjs/pool": "^1.1.0",
"@protobufjs/utf8": "^1.1.0",
"@types/node": ">=13.7.0",
"long": "^5.0.0"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/protocol-buffers-schema": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz",
"integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==",
"peer": true
},
"node_modules/quick-lru": {
"version": "6.1.2",
"resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-6.1.2.tgz",
"integrity": "sha512-AAFUA5O1d83pIHEhJwWCq/RQcRukCkn/NSm2QsTEMle5f2hP0ChI2+3Xb051PZCkLryI/Ir1MVKviT2FIloaTQ==",
"peer": true,
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/quickselect": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/quickselect/-/quickselect-3.0.0.tgz",
"integrity": "sha512-XdjUArbK4Bm5fLLvlm5KpTFOiOThgfWWI4axAZDWg4E/0mKdZyI9tNEfds27qCi1ze/vwTR16kvmmGhRra3c2g==",
"peer": true
},
"node_modules/rbush": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/rbush/-/rbush-4.0.1.tgz",
"integrity": "sha512-IP0UpfeWQujYC8Jg162rMNc01Rf0gWMMAb2Uxus/Q0qOFw4lCcq6ZnQEZwUoJqWyUGJ9th7JjwI4yIWo+uvoAQ==",
"peer": true,
"dependencies": {
"quickselect": "^3.0.0"
}
},
"node_modules/resolve-protobuf-schema": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz",
"integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==",
"peer": true,
"dependencies": {
"protocol-buffers-schema": "^3.3.1"
}
},
"node_modules/rxjs": {
"version": "7.8.1",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz",
"integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==",
"peer": true,
"dependencies": {
"tslib": "^2.1.0"
}
},
"node_modules/topojson-client": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/topojson-client/-/topojson-client-3.1.0.tgz",
"integrity": "sha512-605uxS6bcYxGXw9qi62XyrV6Q3xwbndjachmNxu8HWTtVPxZfEJN9fd/SZS1Q54Sn2y0TMyMxFj/cJINqGHrKw==",
"peer": true,
"dependencies": {
"commander": "2"
},
"bin": {
"topo2geo": "bin/topo2geo",
"topomerge": "bin/topomerge",
"topoquantize": "bin/topoquantize"
}
},
"node_modules/tslib": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz",
"integrity": "sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg=="
},
"node_modules/undici-types": {
"version": "6.19.8",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
"peer": true
},
"node_modules/urijs": {
"version": "1.19.11",
"resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz",
"integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==",
"peer": true
},
"node_modules/web-worker": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.3.0.tgz",
"integrity": "sha512-BSR9wyRsy/KOValMgd5kMyr3JzpdeoR9KVId8u5GVlTTAtNChlsE4yTxeY7zMdNSyOmoKBv8NH2qeRY9Tg+IaA==",
"peer": true
},
"node_modules/xml-utils": {
"version": "1.10.1",
"resolved": "https://registry.npmjs.org/xml-utils/-/xml-utils-1.10.1.tgz",
"integrity": "sha512-Dn6vJ1Z9v1tepSjvnCpwk5QqwIPcEFKdgnjqfYOABv1ngSofuAhtlugcUC3ehS1OHdgDWSG6C5mvj+Qm15udTQ==",
"peer": true
},
"node_modules/zone.js": {
"version": "0.14.10",
"resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.14.10.tgz",
"integrity": "sha512-YGAhaO7J5ywOXW6InXNlLmfU194F8lVgu7bRntUF3TiG8Y3nBK0x1UJJuHUP/e8IyihkjCYqhCScpSwnlaSRkQ==",
"peer": true
},
"node_modules/zstddec": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/zstddec/-/zstddec-0.1.0.tgz",
"integrity": "sha512-w2NTI8+3l3eeltKAdK8QpiLo/flRAr2p8AGeakfMZOXBxOg9HIu4LVDxBi81sYgVhFhdJjv1OrB5ssI8uFPoLg==",
"peer": true
}
}
}

View File

@ -4,13 +4,14 @@
"publishConfig": { "publishConfig": {
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/" "registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
}, },
"peerDependencies": {
"@angular/common": ">=14.0.0",
"@angular/core": ">=14.0.0",
"ngx-openlayers": "1.0.0-next.19",
"cesium": ">=1.82.1",
"ol-cesium": ">=2.13.0"
},
"dependencies": { "dependencies": {
"tslib": "^2.0.0" "tslib": "^2.0.0"
},
"peerDependencies": {
"@angular/common": "^18.2.3",
"@angular/core": "^18.2.3",
"cesium": "^1.97.0",
"ol-cesium": ">=2.13.0"
} }
} }

View File

@ -1,15 +1,14 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { Switch2D3DComponent } from './components/olcs/switch2d3d/switch2d3d.component';
import { AppCommonModule} from '@farmmaps/common'; import { AppCommonModule} from '@farmmaps/common';
import { AppCommonMapModule} from '@farmmaps/common-map'; import { AppCommonMapModule} from '@farmmaps/common-map';
import { AngularOpenlayersModule } from '@farmmaps/ng-openlayers';
import { Switch2D3DComponent } from './components/olcs/switch2d3d/switch2d3d.component';
@NgModule({ @NgModule({
declarations: [Switch2D3DComponent], declarations: [Switch2D3DComponent],
imports: [ imports: [
AppCommonModule, AppCommonModule,
AppCommonMapModule, AppCommonMapModule
AngularOpenlayersModule,
], ],
exports: [Switch2D3DComponent] exports: [Switch2D3DComponent]
}) })

View File

@ -1,15 +1,17 @@
@import "~bootstrap/scss/bootstrap.scss";
.twotreed { .twotreed {
display:block; display:block;
width:2.5em; width:2.5em;
height:2.5em; height:2.5em;
background-color: var(--bs-body-bg); background-color: $body-bg;
background-size: contain; background-size: contain;
margin-top:0.5em; margin-top:0.5em;
text-align: center; text-align: center;
line-height: 2.5em; line-height: 2.5em;
border-radius: 1.75em; border-radius: 1.75em;
padding: 0; padding: 0;
color: var(--bs-secondary); color: $secondary;
} }
.fa-spinner { .fa-spinner {

View File

@ -1,6 +1,6 @@
import { Component, OnInit,Input,Host } from '@angular/core'; import { Component, OnInit,Input,Host } from '@angular/core';
import { Interaction} from 'ol/interaction'; import { Interaction} from 'ol/interaction';
import { MapComponent } from '@farmmaps/ng-openlayers'; import { MapComponent } from 'ngx-openlayers';
import OLCesium from 'olcs/OLCesium'; import OLCesium from 'olcs/OLCesium';
import RasterSynchronizer from 'olcs/RasterSynchronizer'; import RasterSynchronizer from 'olcs/RasterSynchronizer';
import VectorSynchronizer from 'olcs/VectorSynchronizer'; import VectorSynchronizer from 'olcs/VectorSynchronizer';
@ -15,10 +15,10 @@ import { Store } from '@ngrx/store';
export class Switch2D3DComponent { export class Switch2D3DComponent {
@Input() enable:boolean; @Input() enable:boolean;
public label = "3D"; public label: string = "3D";
private ol3d: OLCesium; private ol3d: OLCesium;
private synchronizers:any[]; private synchronizers:any[];
public loading = true; public loading:boolean = true;
private interactions:Interaction[] = []; private interactions:Interaction[] = [];
@ -49,11 +49,7 @@ export class Switch2D3DComponent {
this.interactions=[]; this.interactions=[];
this.map.instance.getInteractions().forEach((i) => { this.map.instance.getInteractions().forEach((i) => {
if(i.getActive()) { if(i.getActive()) {
// AW-6241 TODO How to fix? this.interactions.push(i);
// error TS2345: Argument of type 'import("C:/Project/Farmmaps/FarmMapsLib/node_modules/ol/interaction/Interaction").default'
// is not assignable to parameter of type 'import("C:/Project/Farmmaps/FarmMapsLib/projects/common-map3d/node_modules/ol/interaction/Interaction").default'.
// Line below commented out
// this.interactions.push(i);
i.setActive(false); i.setActive(false);
} }
}); });

View File

@ -8,6 +8,13 @@ import {
platformBrowserDynamicTesting platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing'; } from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};
// First, initialize the Angular testing environment. // First, initialize the Angular testing environment.
getTestBed().initTestEnvironment( getTestBed().initTestEnvironment(
BrowserDynamicTestingModule, BrowserDynamicTestingModule,
@ -15,3 +22,7 @@ getTestBed().initTestEnvironment(
teardown: { destroyAfterEach: false } teardown: { destroyAfterEach: false }
} }
); );
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

View File

@ -11,27 +11,18 @@
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"importHelpers": true, "importHelpers": true,
"esModuleInterop": true,
"types": [], "types": [],
"lib": [ "lib": [
"dom", "dom",
"es2018" "es2018"
],
"paths": {
"@angular/*": [
"node_modules/@angular/*"
] ]
}
}, },
"angularCompilerOptions": { "angularCompilerOptions": {
"skipTemplateCodegen": true, "skipTemplateCodegen": true,
"strictMetadataEmit": true, "strictMetadataEmit": true,
"fullTemplateTypeCheck": true, "fullTemplateTypeCheck": true,
"strictInjectionParameters": true, "strictInjectionParameters": true,
"enableResourceInlining": true, "enableResourceInlining": true
"compilationMode": "partial"
}, },
"exclude": [ "exclude": [
"src/test.ts", "src/test.ts",

Some files were not shown because too many files have changed in this diff Show More