Compare commits
202 Commits
FarmMapsLi
...
8db1edb262
Author | SHA1 | Date | |
---|---|---|---|
8db1edb262 | |||
e279c04e62 | |||
|
0da2167591 | ||
8e0d302fd4 | |||
9c16681b58 | |||
d883553934 | |||
340d07a03f | |||
|
4bbc22cbde | ||
|
80134e5ad0 | ||
|
c777ce75ad | ||
af12682341 | |||
28cfc045fb | |||
9b98f3d91c | |||
0814a6a877 | |||
23eb27cf7f | |||
|
33b15677d2 | ||
|
902c3c629e | ||
|
4169d1a26e | ||
|
7d3679afd2 | ||
|
6921bc7f4a | ||
|
0621b32fba | ||
|
2388968f2a | ||
|
24f41879bf | ||
|
d4ee784460 | ||
|
2434fbf5ee | ||
|
141b5055d7 | ||
|
a8f82f800f | ||
|
5343a4aa98 | ||
|
60c741d935 | ||
|
be885ce917 | ||
|
da1c9c3fe2 | ||
|
a151b73d03 | ||
|
47f77c2819 | ||
|
841999daba | ||
|
8e29e479de | ||
|
3094170cc2 | ||
|
795e8fdf0e | ||
|
007448878b | ||
|
ebf362e9a9 | ||
|
1c70e3495f | ||
|
e75d71d748 | ||
|
6916e4650a | ||
|
38c8def43a | ||
9c103a0c40 | |||
|
d3b10d46ad | ||
|
f8c3a0db98 | ||
|
0eaa3065a3 | ||
|
f91d727c99 | ||
|
fd18d4921b | ||
|
16ad7bfb6f | ||
|
a3e14a94cc | ||
|
2b5bda2a44 | ||
|
85143986ee | ||
|
ba0a60ba09 | ||
|
a1d7f6d4d2 | ||
|
c341b3e42f | ||
|
3a38c24360 | ||
|
abfef73cd1 | ||
|
f82125a486 | ||
|
1a3bbf26f2 | ||
|
616644de6c | ||
|
c16b9ef5c9 | ||
|
7a27df60c2 | ||
|
e8493ef0bd | ||
|
dae5411e6a | ||
|
755475bff7 | ||
|
9c5955bc6f | ||
|
17af34ff94 | ||
92c8b4c1b6 | |||
aa6cd254c7 | |||
|
3baf0b15c7 | ||
|
593fa78f13 | ||
|
a39578e1a4 | ||
|
f5868618b7 | ||
|
2920fd82f1 | ||
|
ad11de53af | ||
|
d7ac9b937a | ||
|
3a4b5dbd9b | ||
|
6eb1b5af55 | ||
|
aa09953b67 | ||
|
a8b079b72b | ||
fcef78dee0 | |||
|
fd28af2f6c | ||
|
81ed89b240 | ||
|
52b4f90b78 | ||
|
79f45631a0 | ||
|
6060a8b86a | ||
|
4814b8fbad | ||
|
da97f06db8 | ||
|
709e964579 | ||
|
3c0bece982 | ||
|
1646119b16 | ||
|
252ce855c9 | ||
|
937dbe9b43 | ||
|
6379b64351 | ||
|
b83aca7969 | ||
|
52170590e3 | ||
|
7a1ba95212 | ||
|
4eb10aa676 | ||
1cab239155 | |||
|
1bec8c2038 | ||
|
9433ef87b2 | ||
|
f0b2b1e774 | ||
123bf2943a | |||
fd3545523e | |||
6c828f6c6d | |||
|
62234b3f9d | ||
e53378a76b | |||
e41b94bb77 | |||
|
975efe5958 | ||
5e8e2388b5 | |||
eea6bbbcb5 | |||
05705afdfe | |||
0ba553cc40 | |||
|
0674b0ac7c | ||
|
252e920848 | ||
|
77e4093d14 | ||
19a8393a3a | |||
|
af1a54ae07 | ||
63ffdf2519 | |||
e3714f4cac | |||
e8537ba916 | |||
|
2fca6d1fba | ||
|
2199a929eb | ||
|
6389331c30 | ||
|
3f27662e3f | ||
313e0c94f7 | |||
a12b45f8f9 | |||
587e484cf8 | |||
e8845a092a | |||
|
3dca804acd | ||
|
761e987067 | ||
|
9277b1fa25 | ||
|
9103753b09 | ||
|
f99dfc965f | ||
|
91fb3ac329 | ||
|
36cc8bea7e | ||
|
e875ed5a12 | ||
|
1a0e0b13e7 | ||
|
f71d96be6e | ||
|
40429a67ef | ||
|
71e7467c17 | ||
|
d860d9edd2 | ||
|
8decff316b | ||
|
f21648386b | ||
|
ab99f6722c | ||
|
46d0f8c060 | ||
|
b46c33d15c | ||
|
d3bc921000 | ||
2c3c8fbff2 | |||
0bf0941bdc | |||
|
c52497af59 | ||
|
6ad23d280d | ||
|
bf0dc15a00 | ||
|
73550b3201 | ||
|
e077aa34df | ||
|
58f7c99ddc | ||
|
50d1d9645a | ||
|
41d55110ea | ||
|
867fdc3fcc | ||
|
64c02614ba | ||
|
ac5efdb40f | ||
|
4b232cc0e4 | ||
70fb5b42ec | |||
719c699981 | |||
456628d014 | |||
76a44a8f95 | |||
f66428d04c | |||
ee925d07b4 | |||
9b03b49028 | |||
15c224ff5d | |||
7cb129dbc4 | |||
2059b48abb | |||
e1ff44ed3c | |||
|
709c76a851 | ||
|
677608c14d | ||
|
fd8025c674 | ||
|
560c426bc0 | ||
|
e1fef2d7f3 | ||
|
f44b079cde | ||
|
8e5383b0f2 | ||
|
615872992f | ||
|
2e0b090fb7 | ||
|
5d7fd63adc | ||
|
0948bacaaf | ||
8fd653afbc | |||
b058cb80b1 | |||
|
490ae1868b | ||
|
4384fd1387 | ||
|
529b1c9bd7 | ||
|
fc84548d8a | ||
|
e57b8297c0 | ||
|
efe38aba62 | ||
|
7bd5dada2b | ||
|
16db063339 | ||
|
5d79dcc7b6 | ||
|
deda769e8b | ||
|
f31e4154b2 | ||
|
7476e4c928 | ||
|
d5258b7c79 | ||
|
04929a1ca3 | ||
|
67e0e5ed5d |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -22,6 +22,7 @@ speed-measure-plugin.json
|
|||||||
*.launch
|
*.launch
|
||||||
.settings/
|
.settings/
|
||||||
*.sublime-workspace
|
*.sublime-workspace
|
||||||
|
.vs/*
|
||||||
|
|
||||||
# IDE - VSCode
|
# IDE - VSCode
|
||||||
.vscode/*
|
.vscode/*
|
||||||
|
1
.npmrc
Normal file
1
.npmrc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
@FarmMaps:registry=https://repository.akkerweb.nl/repository/npm-group/
|
@@ -1,47 +1,47 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
agent any
|
||||||
environment {
|
environment {
|
||||||
PACKAGE_VERSION_PREFIX=sh(script: 'jq .version package.json |sed "s/\\"//g"', returnStdout: true).trim()
|
PACKAGE_VERSION_PREFIX=sh(script: 'jq .version package.json |sed "s/\\"//g"', returnStdout: true).trim()
|
||||||
PACKAGE_VERSION="${PACKAGE_VERSION_PREFIX + '-prerelease.' + env.BUILD_NUMBER}"
|
PACKAGE_VERSION="${PACKAGE_VERSION_PREFIX + '-prerelease.' + env.BUILD_NUMBER}"
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('npm install'){
|
stage('npm install'){
|
||||||
steps {
|
steps {
|
||||||
sh '''npm install
|
sh '''npm install
|
||||||
cd projects/common
|
cd projects/common
|
||||||
npm install
|
npm install
|
||||||
cd ../common-map
|
cd ../common-map
|
||||||
npm install
|
npm install
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('build'){
|
stage('build'){
|
||||||
steps {
|
steps {
|
||||||
sh '''ng build common
|
sh '''ng build common
|
||||||
ng build common-map'''
|
ng build common-map'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('npm publish'){
|
stage('npm publish'){
|
||||||
steps {
|
steps {
|
||||||
sh '''cd dist/common
|
sh '''cd dist/common
|
||||||
npm version ${PACKAGE_VERSION}
|
npm version ${PACKAGE_VERSION}
|
||||||
npm publish
|
npm publish
|
||||||
cd ../common-map
|
cd ../common-map
|
||||||
npm version ${PACKAGE_VERSION}
|
npm version ${PACKAGE_VERSION}
|
||||||
npm publish'''
|
npm publish'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
emailext (
|
emailext (
|
||||||
body: '${DEFAULT_CONTENT}',
|
body: '${DEFAULT_CONTENT}',
|
||||||
mimeType: 'text/html',
|
mimeType: 'text/html',
|
||||||
replyTo: '${DEFAULT_REPLYTO}',
|
replyTo: '${DEFAULT_REPLYTO}',
|
||||||
subject: '${DEFAULT_SUBJECT}',
|
subject: '${DEFAULT_SUBJECT}',
|
||||||
to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])
|
to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
118
README.md
118
README.md
@@ -1,59 +1,59 @@
|
|||||||
# Farmmaps viewer
|
# Farmmaps viewer
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
## Option 1, Using docker
|
## Option 1, Using docker
|
||||||
|
|
||||||
*Dependencies*
|
*Dependencies*
|
||||||
|
|
||||||
* docker desktop
|
* docker desktop
|
||||||
|
|
||||||
*Setup*
|
*Setup*
|
||||||
|
|
||||||
```
|
```
|
||||||
docker pull node:10.16.0
|
docker pull node:12.13.1
|
||||||
docker run -t -i --entrypoint /bin/bash -p 4200:4200 node:10.16.0
|
docker run -t -i --entrypoint /bin/bash -p 4200:4200 node:12.13.1
|
||||||
```
|
```
|
||||||
|
|
||||||
Inside the running container
|
Inside the running container
|
||||||
```
|
```
|
||||||
git clone https://git.akkerweb.nl/FarmMaps/FarmMapsLib.git
|
git clone https://git.akkerweb.nl/FarmMaps/FarmMapsLib.git
|
||||||
cd FarmMapsLib
|
cd FarmMapsLib
|
||||||
npm config set @farmmaps:registry https://repository.akkerweb.nl/repository/npm-group/
|
npm config set @farmmaps:registry https://repository.akkerweb.nl/repository/npm-group/
|
||||||
npm install -g @angular/cli
|
npm install -g @angular/cli
|
||||||
npm install
|
npm install
|
||||||
ng serve --host 0.0.0.0
|
ng serve --host 0.0.0.0
|
||||||
```
|
```
|
||||||
*Go*
|
*Go*
|
||||||
|
|
||||||
Point your browser to http://localhost:4200
|
Point your browser to http://localhost:4200
|
||||||
|
|
||||||
## Option 2, Using local machine
|
## Option 2, Using local machine
|
||||||
|
|
||||||
*Dependencies*
|
*Dependencies*
|
||||||
|
|
||||||
* npm 6.9.0
|
* npm 6.9.0
|
||||||
* nodejs 10.16.0
|
* nodejs 10.16.0
|
||||||
* git
|
* git
|
||||||
|
|
||||||
*Setup*
|
*Setup*
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://git.akkerweb.nl/FarmMaps/FarmMapsLib.git
|
git clone https://git.akkerweb.nl/FarmMaps/FarmMapsLib.git
|
||||||
cd FarmMapsLib
|
cd FarmMapsLib
|
||||||
npm config set @farmmaps:registry https://repository.akkerweb.nl/repository/npm-group/
|
npm config set @farmmaps:registry https://repository.akkerweb.nl/repository/npm-group/
|
||||||
npm install -g @angular/cli
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -66,7 +66,7 @@
|
|||||||
{
|
{
|
||||||
"type": "initial",
|
"type": "initial",
|
||||||
"maximumWarning": "2mb",
|
"maximumWarning": "2mb",
|
||||||
"maximumError": "5mb"
|
"maximumError": "7mb"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
|
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
|
||||||
# For additional information regarding the format and rule options, please see:
|
# For additional information regarding the format and rule options, please see:
|
||||||
# https://github.com/browserslist/browserslist#queries
|
# https://github.com/browserslist/browserslist#queries
|
||||||
#
|
#
|
||||||
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
|
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
|
||||||
|
|
||||||
> 0.5%
|
> 0.5%
|
||||||
last 2 versions
|
last 2 versions
|
||||||
Firefox ESR
|
Firefox ESR
|
||||||
not dead
|
not dead
|
||||||
not IE 9-11
|
not IE 9-11
|
11529
package-lock.json
generated
11529
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
58
package.json
58
package.json
@@ -11,40 +11,42 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "~7.2.0",
|
"@angular/animations": "~8.2.14",
|
||||||
"@angular/common": "~7.2.0",
|
"@angular/common": "~8.2.14",
|
||||||
"@angular/compiler": "~7.2.0",
|
"@angular/compiler": "~8.2.14",
|
||||||
"@angular/core": "~7.2.0",
|
"@angular/core": "~8.2.14",
|
||||||
"@angular/forms": "~7.2.0",
|
"@angular/forms": "~8.2.14",
|
||||||
"@angular/platform-browser": "~7.2.0",
|
"@angular/platform-browser": "~8.2.14",
|
||||||
"@angular/platform-browser-dynamic": "~7.2.0",
|
"@angular/platform-browser-dynamic": "~8.2.14",
|
||||||
"@angular/router": "~7.2.0",
|
"@angular/router": "~8.2.14",
|
||||||
"@aspnet/signalr": "^1.1.4",
|
"@aspnet/signalr": "^1.1.4",
|
||||||
"@farmmaps/common": ">=0.0.1-prerelease.69 <0.0.1",
|
"@farmmaps/common": ">=0.0.1-prerelease.226 <0.0.1",
|
||||||
"@farmmaps/common-map": ">=0.0.1-prerelease.69 <0.0.1",
|
"@farmmaps/common-map": ">=0.0.1-prerelease.226 <0.0.1",
|
||||||
"@ng-bootstrap/ng-bootstrap": "^4.2.1",
|
"@ng-bootstrap/ng-bootstrap": "^4.2.1",
|
||||||
"@ngrx/effects": "^7.2.0",
|
"@ngrx/effects": "^8.6.0",
|
||||||
"@ngrx/router-store": "^7.2.0",
|
"@ngrx/router-store": "^8.6.0",
|
||||||
"@ngrx/store": "^7.2.0",
|
"@ngrx/store": "^8.6.0",
|
||||||
"bootstrap": "^4.3.1",
|
"ngx-uploadx": "^3.3.4",
|
||||||
|
"angular-oauth2-oidc": "^8.0.2",
|
||||||
|
"bootstrap": "^4.4.1",
|
||||||
|
"core-js": "^2.6.11",
|
||||||
"font-awesome": "^4.7.0",
|
"font-awesome": "^4.7.0",
|
||||||
"core-js": "^2.5.4",
|
|
||||||
"ngrx-store-localstorage": "^8.0.0",
|
"ngrx-store-localstorage": "^8.0.0",
|
||||||
"resumablejs": "^1.1.0",
|
"resumablejs": "^1.1.0",
|
||||||
"rxjs": "~6.3.3",
|
"rxjs": "^6.5.4",
|
||||||
"tassign": "^1.0.0",
|
"tassign": "^1.0.0",
|
||||||
"zone.js": "~0.8.26"
|
"zone.js": "~0.9.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "~0.13.0",
|
"@angular-devkit/build-angular": "^0.803.23",
|
||||||
"@angular-devkit/build-ng-packagr": "~0.13.0",
|
"@angular-devkit/build-ng-packagr": "^0.803.25",
|
||||||
"@angular/cli": "~7.3.8",
|
"@angular/cli": "^8.3.25",
|
||||||
"@angular/compiler-cli": "~7.2.0",
|
"@angular/compiler-cli": "~8.2.14",
|
||||||
"@angular/language-service": "~7.2.0",
|
"@angular/language-service": "~8.2.14",
|
||||||
"@types/node": "~8.9.4",
|
|
||||||
"@types/jasmine": "~2.8.8",
|
"@types/jasmine": "~2.8.8",
|
||||||
"@types/jasminewd2": "~2.0.3",
|
"@types/jasminewd2": "~2.0.3",
|
||||||
"codelyzer": "~4.5.0",
|
"@types/node": "~8.9.4",
|
||||||
|
"codelyzer": "^5.2.1",
|
||||||
"jasmine-core": "~2.99.1",
|
"jasmine-core": "~2.99.1",
|
||||||
"jasmine-spec-reporter": "~4.2.1",
|
"jasmine-spec-reporter": "~4.2.1",
|
||||||
"karma": "~4.0.0",
|
"karma": "~4.0.0",
|
||||||
@@ -52,12 +54,12 @@
|
|||||||
"karma-coverage-istanbul-reporter": "~2.0.1",
|
"karma-coverage-istanbul-reporter": "~2.0.1",
|
||||||
"karma-jasmine": "~1.1.2",
|
"karma-jasmine": "~1.1.2",
|
||||||
"karma-jasmine-html-reporter": "^0.2.2",
|
"karma-jasmine-html-reporter": "^0.2.2",
|
||||||
"ng-packagr": "^4.2.0",
|
"ng-packagr": "^5.4.0",
|
||||||
"protractor": "~5.4.0",
|
"protractor": "^5.4.3",
|
||||||
"ts-node": "~7.0.0",
|
"ts-node": "~7.0.0",
|
||||||
"tsickle": ">=0.34.0",
|
"tsickle": "^0.37.0",
|
||||||
"tslib": "^1.9.0",
|
"tslib": "^1.9.0",
|
||||||
"tslint": "~5.11.0",
|
"tslint": "~5.11.0",
|
||||||
"typescript": "~3.2.2"
|
"typescript": "~3.5.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
76
projects/common-map/package-lock.json
generated
76
projects/common-map/package-lock.json
generated
@@ -4,68 +4,42 @@
|
|||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@farmmaps/common": {
|
"@openlayers/pepjs": {
|
||||||
"version": "0.0.1-prerelease.56",
|
"version": "0.5.3",
|
||||||
"resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-0.0.1-prerelease.56.tgz",
|
"resolved": "https://registry.npmjs.org/@openlayers/pepjs/-/pepjs-0.5.3.tgz",
|
||||||
"integrity": "sha512-m9KxWsLkTSz2JI074gIJH1kDR0PCLsFAug8oBjtlU/QxgBySrvqHCRiODpNmNWnFyNTZHqKHJQefn3Q9iAil4g==",
|
"integrity": "sha512-Bgvi5c14BS0FJWyYWWFstNEnXsB30nK8Jt8hkAAdqr7E0gDdBBWVDglF3Ub19wTxvgJ/CVHyTY6VuCtnyRzglg=="
|
||||||
"requires": {
|
|
||||||
"angular-oauth2-oidc": "^5.0.2",
|
|
||||||
"ngx-uploadx": "^3.1.3",
|
|
||||||
"tslib": "^1.9.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"angular-oauth2-oidc": {
|
|
||||||
"version": "5.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/angular-oauth2-oidc/-/angular-oauth2-oidc-5.0.2.tgz",
|
|
||||||
"integrity": "sha512-jtOv4IWEjSFfBHVE4seWGWT/ZfWJ95QJ1JaFhVVGJEF64ibGuPwV3ztwTOUl98QHi/Yg4PXXDAisb31JnIbxBw==",
|
|
||||||
"requires": {
|
|
||||||
"jsrsasign": "^8.0.12",
|
|
||||||
"tslib": "^1.9.0"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"ieee754": {
|
"ieee754": {
|
||||||
"version": "1.1.13",
|
"version": "1.1.13",
|
||||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
|
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
|
||||||
"integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
|
"integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
|
||||||
},
|
},
|
||||||
"jsrsasign": {
|
|
||||||
"version": "8.0.12",
|
|
||||||
"resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-8.0.12.tgz",
|
|
||||||
"integrity": "sha1-Iqu5ZW00owuVMENnIINeicLlwxY="
|
|
||||||
},
|
|
||||||
"ngx-openlayers": {
|
"ngx-openlayers": {
|
||||||
"version": "1.0.0-next.9",
|
"version": "1.0.0-next.13",
|
||||||
"resolved": "https://registry.npmjs.org/ngx-openlayers/-/ngx-openlayers-1.0.0-next.9.tgz",
|
"resolved": "https://registry.npmjs.org/ngx-openlayers/-/ngx-openlayers-1.0.0-next.13.tgz",
|
||||||
"integrity": "sha512-14UFxJX9oeOXtq+HJCJyXn0sBmYmCqj2AnFtetKk1FsDe8EUMFGIRju8UOFegCr2oEu5JsuRjALcfW7lCe+teg==",
|
"integrity": "sha512-6y724s5JV6n1oxEhryxP3wcbwzpierj9RLiMLXInfKOG3l5IO1AtPNkeK9+mKctVDUVm5URIfzzZH02Ld+bvSQ==",
|
||||||
"requires": {
|
|
||||||
"tslib": "^1.9.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"ngx-uploadx": {
|
|
||||||
"version": "3.3.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/ngx-uploadx/-/ngx-uploadx-3.3.2.tgz",
|
|
||||||
"integrity": "sha512-gRdXXq2cRU9HE6dj65qay9GV8NRC7n8y5LtMzJWqsfu2k3CHMQxo2TqZwA9/l/PqJ76RoO7sTPy1OenFQ+krkQ==",
|
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^1.9.0"
|
"tslib": "^1.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ol": {
|
"ol": {
|
||||||
"version": "5.3.3",
|
"version": "6.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/ol/-/ol-5.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/ol/-/ol-6.1.1.tgz",
|
||||||
"integrity": "sha512-7eU4x8YMduNcED1D5wI+AMWDRe7/1HmGfsbV+kFFROI9RNABU/6n4osj6Q3trZbxxKnK2DSRIjIRGwRHT/Z+Ww==",
|
"integrity": "sha512-0dL3i3eJqgOpqIjDKEY3grkeQnjAYfV5L/JCxhOu4SxiaizRwFrFgeas6LILRoxKa03jhQFbut2r2bbgcLGQeA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"pbf": "3.1.0",
|
"@openlayers/pepjs": "^0.5.3",
|
||||||
|
"pbf": "3.2.1",
|
||||||
"pixelworks": "1.1.0",
|
"pixelworks": "1.1.0",
|
||||||
"rbush": "2.0.2"
|
"rbush": "^3.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pbf": {
|
"pbf": {
|
||||||
"version": "3.1.0",
|
"version": "3.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/pbf/-/pbf-3.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/pbf/-/pbf-3.2.1.tgz",
|
||||||
"integrity": "sha512-/hYJmIsTmh7fMkHAWWXJ5b8IKLWdjdlAFb3IHkRBn1XUhIYBChVGfVwmHEAV3UfXTxsP/AKfYTXTS/dCPxJd5w==",
|
"integrity": "sha512-ClrV7pNOn7rtmoQVF4TS1vyU0WhYRnP92fzbfF75jAIwpnzdJXf8iTd4CMEqO4yUenH6NDqLiwjqlh6QgZzgLQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"ieee754": "^1.1.6",
|
"ieee754": "^1.1.12",
|
||||||
"resolve-protobuf-schema": "^2.0.0"
|
"resolve-protobuf-schema": "^2.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"pixelworks": {
|
"pixelworks": {
|
||||||
@@ -79,16 +53,16 @@
|
|||||||
"integrity": "sha512-Xdayp8sB/mU+sUV4G7ws8xtYMGdQnxbeIfLjyO9TZZRJdztBGhlmbI5x1qcY4TG5hBkIKGnc28i7nXxaugu88w=="
|
"integrity": "sha512-Xdayp8sB/mU+sUV4G7ws8xtYMGdQnxbeIfLjyO9TZZRJdztBGhlmbI5x1qcY4TG5hBkIKGnc28i7nXxaugu88w=="
|
||||||
},
|
},
|
||||||
"quickselect": {
|
"quickselect": {
|
||||||
"version": "1.1.1",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/quickselect/-/quickselect-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz",
|
||||||
"integrity": "sha512-qN0Gqdw4c4KGPsBOQafj6yj/PA6c/L63f6CaZ/DCF/xF4Esu3jVmKLUDYxghFx8Kb/O7y9tI7x2RjTSXwdK1iQ=="
|
"integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw=="
|
||||||
},
|
},
|
||||||
"rbush": {
|
"rbush": {
|
||||||
"version": "2.0.2",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/rbush/-/rbush-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/rbush/-/rbush-3.0.1.tgz",
|
||||||
"integrity": "sha512-XBOuALcTm+O/H8G90b6pzu6nX6v2zCKiFG4BJho8a+bY6AER6t8uQUZdi5bomQc0AprCWhEGa7ncAbbRap0bRA==",
|
"integrity": "sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"quickselect": "^1.0.1"
|
"quickselect": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"resolve-protobuf-schema": {
|
"resolve-protobuf-schema": {
|
||||||
|
@@ -5,16 +5,16 @@
|
|||||||
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
|
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ngx-openlayers": "1.0.0-next.9",
|
"ngx-openlayers": "1.0.0-next.13",
|
||||||
"ol": "^5.3.3"
|
"ol": "6.1.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/core": "^7.2.0",
|
"@angular/core": "^8.2.0",
|
||||||
"ngrx-store-localstorage": "^8.0.0",
|
"ngrx-store-localstorage": "^8.0.0",
|
||||||
"@ngrx/effects": "^7.2",
|
"@ngrx/effects": "^8.2",
|
||||||
"@ngrx/router-store": "^7.2",
|
"@ngrx/router-store": "^8.2",
|
||||||
"@ngrx/store": "^7.2",
|
"@ngrx/store": "^8.2",
|
||||||
"tassign": "^1.0.0",
|
"tassign": "^1.0.0",
|
||||||
"@farmmaps/common": ">=0.0.1-prerelease.56 <0.0.1"
|
"@farmmaps/common": ">=0.0.1-prerelease.181 <0.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,2 +0,0 @@
|
|||||||
//$theme-colors: ( "primary": #a7ce39, "secondary": #ffc800 );
|
|
||||||
//$theme-colors: ( "primary": #a7ce39);
|
|
@@ -1,241 +1,282 @@
|
|||||||
import { Action } from '@ngrx/store';
|
import { Action } from '@ngrx/store';
|
||||||
|
|
||||||
import { IMapState,IItemLayer,IQueryState } from '../models';
|
import { IMapState } from '../models/map.state';
|
||||||
import { IItem } from '@farmmaps/common';
|
import { IItemLayer } from '../models/item.layer';
|
||||||
import { Feature } from 'ol';
|
import { IQueryState } from '@farmmaps/common';
|
||||||
import { Extent } from 'ol/extent';
|
import { IItem } from '@farmmaps/common';
|
||||||
|
import { Feature,Style } from 'ol';
|
||||||
export const SETSTATE = '[Map] SetState';
|
import { IListItem } from 'dist/common/public-api';
|
||||||
export const SETMAPSTATE = '[Map] MapState';
|
|
||||||
export const SETVIEWEXTENT = '[Map] SetViewExtent';
|
export const SETSTATE = '[Map] SetState';
|
||||||
export const INIT = '[Map] Init';
|
export const SETMAPSTATE = '[Map] MapState';
|
||||||
export const SETPARENT = '[Map] SetParent';
|
export const SETVIEWEXTENT = '[Map] SetViewExtent';
|
||||||
export const STARTSEARCH = '[Map] StartSearch';
|
export const INIT = '[Map] Init';
|
||||||
export const STARTSEARCHSUCCESS = '[Map] StartSearchSuccess';
|
export const SETPARENT = '[Map] SetParent';
|
||||||
export const SELECTFEATURE = '[Map] SelectFeature';
|
export const STARTSEARCH = '[Map] StartSearch';
|
||||||
export const SELECTITEM = '[Map] SelectItem';
|
export const STARTSEARCHSUCCESS = '[Map] StartSearchSuccess';
|
||||||
export const SELECTITEMSUCCESS = '[Map] SelectItemSuccess';
|
export const SELECTFEATURE = '[Map] SelectFeature';
|
||||||
export const ADDFEATURESUCCESS = '[Map] AddFeatureSuccess';
|
export const SELECTITEM = '[Map] SelectItem';
|
||||||
export const UPDATEFEATURESUCCESS = '[Map] UpdateFeatureSuccess';
|
export const SELECTITEMSUCCESS = '[Map] SelectItemSuccess';
|
||||||
export const EXPANDSEARCH = '[Map] ExpandSearch';
|
export const SELECTTEMPORALITEMSSUCCESS = '[Map] SelectTemporalItemsSuccess';
|
||||||
export const COLLAPSESEARCH = '[Map] CollapseSearch';
|
export const NEXTTEMPORAL = '[Map] NextTemporal';
|
||||||
export const TOGGLEMENU = '[Map] ToggleMenu';
|
export const PREVIOUSTEMPORAL = '[Map] PreviousTemporal';
|
||||||
export const SETEXTENT = '[Map] SetExtent';
|
export const SELECTTEMPORAL = '[Map] SelectTemporal';
|
||||||
export const SETQUERYSTATE = '[Map] SetQueryState';
|
export const ADDFEATURESUCCESS = '[Map] AddFeatureSuccess';
|
||||||
export const SETTIMESPAN = '[Map] SetTimeSpan';
|
export const UPDATEFEATURESUCCESS = '[Map] UpdateFeatureSuccess';
|
||||||
export const ADDLAYER = '[Map] AddLayer';
|
export const EXPANDSEARCH = '[Map] ExpandSearch';
|
||||||
export const SETVISIBILITY = '[Map] SetVisibility';
|
export const COLLAPSESEARCH = '[Map] CollapseSearch';
|
||||||
export const SETOPACITY = '[Map] SetOpacity';
|
export const SETEXTENT = '[Map] SetExtent';
|
||||||
export const SETLAYERINDEX = '[Map] SetLayerIndex';
|
export const SETQUERYSTATE = '[Map] SetQueryState';
|
||||||
export const REMOVELAYER = '[Map] RemoveLayer';
|
export const SETTIMESPAN = '[Map] SetTimeSpan';
|
||||||
export const LOADBASELAYERS = '[Map] LoadLayers';
|
export const ADDLAYER = '[Map] AddLayer';
|
||||||
export const LOADBASELAYERSSUCCESS = '[Map] LoadLayersSuccess';
|
export const SETVISIBILITY = '[Map] SetVisibility';
|
||||||
export const SELECTBASELAYER = '[Map] SelectBaseLayers';
|
export const SETOPACITY = '[Map] SetOpacity';
|
||||||
export const SELECTOVERLAYLAYER = '[Map] SelectOverlayLayers';
|
export const SETLAYERINDEX = '[Map] SetLayerIndex';
|
||||||
export const ZOOMTOEXTENT = '[Map] ZoomToExtent';
|
export const REMOVELAYER = '[Map] RemoveLayer';
|
||||||
export const DOQUERY = '[Map] DoQuery';
|
export const LOADBASELAYERS = '[Map] LoadLayers';
|
||||||
|
export const LOADBASELAYERSSUCCESS = '[Map] LoadLayersSuccess';
|
||||||
export class SetState implements Action {
|
export const SELECTBASELAYER = '[Map] SelectBaseLayers';
|
||||||
readonly type = SETSTATE;
|
export const SELECTOVERLAYLAYER = '[Map] SelectOverlayLayers';
|
||||||
|
export const ZOOMTOEXTENT = '[Map] ZoomToExtent';
|
||||||
constructor(public mapState: IMapState,public queryState:IQueryState) { }
|
export const DOQUERY = '[Map] DoQuery';
|
||||||
}
|
export const SETSTYLE = '[Map] SetStyle';
|
||||||
|
export const SHOWLAYERSWITCHER = '[Map] ShowLayerSwitcher';
|
||||||
export class SetMapState implements Action {
|
|
||||||
readonly type = SETMAPSTATE;
|
export class SetState implements Action {
|
||||||
|
readonly type = SETSTATE;
|
||||||
constructor(public mapState: IMapState) { }
|
|
||||||
}
|
constructor(public mapState: IMapState,public queryState:IQueryState) { }
|
||||||
|
}
|
||||||
export class SetViewExtent implements Action {
|
|
||||||
readonly type = SETVIEWEXTENT;
|
export class SetMapState implements Action {
|
||||||
|
readonly type = SETMAPSTATE;
|
||||||
constructor(public extent:number[]) { }
|
|
||||||
}
|
constructor(public mapState: IMapState) { }
|
||||||
|
}
|
||||||
export class Init implements Action {
|
|
||||||
readonly type = INIT;
|
export class SetViewExtent implements Action {
|
||||||
|
readonly type = SETVIEWEXTENT;
|
||||||
constructor() { }
|
|
||||||
}
|
constructor(public extent:number[]) { }
|
||||||
|
}
|
||||||
export class SetParent implements Action {
|
|
||||||
readonly type = SETPARENT;
|
export class Init implements Action {
|
||||||
|
readonly type = INIT;
|
||||||
constructor(public parentCode:string) { }
|
|
||||||
}
|
constructor() { }
|
||||||
|
}
|
||||||
export class StartSearch implements Action {
|
|
||||||
readonly type = STARTSEARCH;
|
export class SetParent implements Action {
|
||||||
|
readonly type = SETPARENT;
|
||||||
constructor(public queryState: IQueryState) { }
|
|
||||||
}
|
constructor(public parentCode:string) { }
|
||||||
|
}
|
||||||
export class StartSearchSuccess implements Action {
|
|
||||||
readonly type = STARTSEARCHSUCCESS;
|
export class StartSearch implements Action {
|
||||||
|
readonly type = STARTSEARCH;
|
||||||
constructor(public features: Array<Feature>, public query:IQueryState) { }
|
|
||||||
}
|
constructor(public queryState: IQueryState) { }
|
||||||
|
}
|
||||||
export class SelectFeature implements Action {
|
|
||||||
readonly type = SELECTFEATURE;
|
export class StartSearchSuccess implements Action {
|
||||||
|
readonly type = STARTSEARCHSUCCESS;
|
||||||
constructor(public feature:Feature) { }
|
|
||||||
}
|
constructor(public features: Array<Feature>, public query:IQueryState) { }
|
||||||
|
}
|
||||||
export class SelectItem implements Action {
|
|
||||||
readonly type = SELECTITEM;
|
export class SelectFeature implements Action {
|
||||||
|
readonly type = SELECTFEATURE;
|
||||||
constructor(public itemCode:string) { }
|
|
||||||
}
|
constructor(public feature:Feature) { }
|
||||||
|
}
|
||||||
export class SelectItemSuccess implements Action {
|
|
||||||
readonly type = SELECTITEMSUCCESS;
|
export class SelectItem implements Action {
|
||||||
|
readonly type = SELECTITEM;
|
||||||
constructor(public item: IItem) { }
|
|
||||||
}
|
constructor(public itemCode:string) { }
|
||||||
|
}
|
||||||
export class AddFeatureSuccess implements Action {
|
|
||||||
readonly type = ADDFEATURESUCCESS;
|
export class SelectItemSuccess implements Action {
|
||||||
|
readonly type = SELECTITEMSUCCESS;
|
||||||
constructor(public feature: Feature) { }
|
|
||||||
}
|
constructor(public item: IItem) { }
|
||||||
|
}
|
||||||
export class UpdateFeatureSuccess implements Action {
|
|
||||||
readonly type = UPDATEFEATURESUCCESS;
|
export class SelectTemporalItemsSuccess implements Action {
|
||||||
|
readonly type = SELECTTEMPORALITEMSSUCCESS;
|
||||||
constructor(public feature: Feature) { }
|
|
||||||
}
|
constructor(public temporalItems: IItem[]) { }
|
||||||
|
}
|
||||||
export class ExpandSearch implements Action {
|
|
||||||
readonly type = EXPANDSEARCH;
|
export class NextTemporal implements Action {
|
||||||
|
readonly type = NEXTTEMPORAL;
|
||||||
constructor() { }
|
|
||||||
}
|
constructor() { }
|
||||||
|
}
|
||||||
export class CollapseSearch implements Action {
|
|
||||||
readonly type = COLLAPSESEARCH;
|
export class PreviousTemporal implements Action {
|
||||||
|
readonly type = PREVIOUSTEMPORAL;
|
||||||
constructor() { }
|
|
||||||
}
|
constructor() { }
|
||||||
|
}
|
||||||
export class ToggleMenu implements Action {
|
|
||||||
readonly type = TOGGLEMENU;
|
export class SelectTemporal implements Action {
|
||||||
|
readonly type = SELECTTEMPORAL;
|
||||||
constructor() { }
|
|
||||||
}
|
constructor(item:IItem) { }
|
||||||
|
}
|
||||||
export class SetExtent implements Action {
|
|
||||||
readonly type = SETEXTENT;
|
export class AddFeatureSuccess implements Action {
|
||||||
|
readonly type = ADDFEATURESUCCESS;
|
||||||
constructor(public extent:number[]) { }
|
|
||||||
}
|
constructor(public feature: Feature) { }
|
||||||
|
}
|
||||||
export class SetQueryState implements Action {
|
|
||||||
readonly type = SETQUERYSTATE;
|
export class UpdateFeatureSuccess implements Action {
|
||||||
|
readonly type = UPDATEFEATURESUCCESS;
|
||||||
constructor(public queryState: IQueryState) { }
|
|
||||||
}
|
constructor(public feature: Feature) { }
|
||||||
|
}
|
||||||
export class SetTimeSpan implements Action {
|
|
||||||
readonly type = SETTIMESPAN;
|
export class ExpandSearch implements Action {
|
||||||
|
readonly type = EXPANDSEARCH;
|
||||||
constructor(public startDate: Date, public endDate: Date) { }
|
|
||||||
}
|
constructor() { }
|
||||||
|
}
|
||||||
export class AddLayer implements Action {
|
|
||||||
readonly type = ADDLAYER;
|
export class CollapseSearch implements Action {
|
||||||
|
readonly type = COLLAPSESEARCH;
|
||||||
constructor(public item:IItem,public layerIndex=-1) { }
|
|
||||||
}
|
constructor() { }
|
||||||
|
}
|
||||||
export class SetVisibility implements Action {
|
|
||||||
readonly type = SETVISIBILITY;
|
export class SetExtent implements Action {
|
||||||
|
readonly type = SETEXTENT;
|
||||||
constructor(public itemLayer:IItemLayer,public visibility:boolean) { }
|
|
||||||
}
|
constructor(public extent:number[]) { }
|
||||||
|
}
|
||||||
export class SetOpacity implements Action {
|
|
||||||
readonly type = SETOPACITY;
|
export class SetQueryState implements Action {
|
||||||
|
readonly type = SETQUERYSTATE;
|
||||||
constructor(public itemLayer: IItemLayer, public opacity: number) { }
|
|
||||||
}
|
constructor(public queryState: IQueryState) { }
|
||||||
|
}
|
||||||
export class SetLayerIndex implements Action {
|
|
||||||
readonly type = SETLAYERINDEX;
|
export class SetTimeSpan implements Action {
|
||||||
|
readonly type = SETTIMESPAN;
|
||||||
constructor(public layerIndex: number, public itemLayer: IItemLayer = null) { }
|
|
||||||
}
|
constructor(public startDate: Date, public endDate: Date) { }
|
||||||
|
}
|
||||||
export class RemoveLayer implements Action {
|
|
||||||
readonly type = REMOVELAYER;
|
export class AddLayer implements Action {
|
||||||
|
readonly type = ADDLAYER;
|
||||||
constructor(public itemLayer: IItemLayer) { }
|
|
||||||
}
|
constructor(public item:IItem,public layerIndex=-1) { }
|
||||||
|
}
|
||||||
export class LoadBaseLayers implements Action {
|
|
||||||
readonly type = LOADBASELAYERS;
|
export class SetVisibility implements Action {
|
||||||
|
readonly type = SETVISIBILITY;
|
||||||
constructor(public projection: string) { }
|
|
||||||
}
|
constructor(public itemLayer:IItemLayer,public visibility:boolean) { }
|
||||||
|
}
|
||||||
export class LoadBaseLayersSuccess implements Action {
|
|
||||||
readonly type = LOADBASELAYERSSUCCESS;
|
export class SetOpacity implements Action {
|
||||||
|
readonly type = SETOPACITY;
|
||||||
constructor(public items: IItem[] ) { }
|
|
||||||
}
|
constructor(public itemLayer: IItemLayer, public opacity: number) { }
|
||||||
|
}
|
||||||
export class SelectBaseLayer implements Action {
|
|
||||||
readonly type = SELECTBASELAYER;
|
export class SetLayerIndex implements Action {
|
||||||
|
readonly type = SETLAYERINDEX;
|
||||||
constructor(public itemLayer: IItemLayer) { }
|
|
||||||
}
|
constructor(public layerIndex: number, public itemLayer: IItemLayer = null) { }
|
||||||
|
}
|
||||||
export class SelectOverlayLayer implements Action {
|
|
||||||
readonly type = SELECTOVERLAYLAYER;
|
export class RemoveLayer implements Action {
|
||||||
|
readonly type = REMOVELAYER;
|
||||||
constructor(public itemLayer: IItemLayer) { }
|
|
||||||
}
|
constructor(public itemLayer: IItemLayer) { }
|
||||||
|
}
|
||||||
export class ZoomToExtent implements Action {
|
|
||||||
readonly type = ZOOMTOEXTENT;
|
export class LoadBaseLayers implements Action {
|
||||||
|
readonly type = LOADBASELAYERS;
|
||||||
constructor(public itemLayer: IItemLayer) { }
|
|
||||||
}
|
constructor(public projection: string) { }
|
||||||
|
}
|
||||||
export class DoQuery implements Action {
|
|
||||||
readonly type = DOQUERY;
|
export class LoadBaseLayersSuccess implements Action {
|
||||||
|
readonly type = LOADBASELAYERSSUCCESS;
|
||||||
constructor(public query:IQueryState) { }
|
|
||||||
}
|
constructor(public items: IItem[] ) { }
|
||||||
|
}
|
||||||
export type Actions = SetMapState
|
|
||||||
| Init
|
export class SelectBaseLayer implements Action {
|
||||||
| SetParent
|
readonly type = SELECTBASELAYER;
|
||||||
| StartSearch
|
|
||||||
| StartSearchSuccess
|
constructor(public itemLayer: IItemLayer) { }
|
||||||
| SelectFeature
|
}
|
||||||
| SelectItem
|
|
||||||
| SelectItemSuccess
|
export class SelectOverlayLayer implements Action {
|
||||||
| AddFeatureSuccess
|
readonly type = SELECTOVERLAYLAYER;
|
||||||
| UpdateFeatureSuccess
|
|
||||||
| ExpandSearch
|
constructor(public itemLayer: IItemLayer) { }
|
||||||
| CollapseSearch
|
}
|
||||||
| ToggleMenu
|
|
||||||
| SetExtent
|
export class ZoomToExtent implements Action {
|
||||||
| SetQueryState
|
readonly type = ZOOMTOEXTENT;
|
||||||
| SetTimeSpan
|
|
||||||
| AddLayer
|
constructor(public itemLayer: IItemLayer) { }
|
||||||
| RemoveLayer
|
}
|
||||||
| SetVisibility
|
|
||||||
| SetOpacity
|
export class DoQuery implements Action {
|
||||||
| SetLayerIndex
|
readonly type = DOQUERY;
|
||||||
| LoadBaseLayers
|
|
||||||
| LoadBaseLayersSuccess
|
constructor(public query:IQueryState) { }
|
||||||
| SelectBaseLayer
|
}
|
||||||
| SelectOverlayLayer
|
|
||||||
| ZoomToExtent
|
export class SetStyle implements Action {
|
||||||
| SetState
|
readonly type = SETSTYLE;
|
||||||
| SetViewExtent
|
|
||||||
| DoQuery;
|
constructor(public itemType:string,public style: Style | (Feature)) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ShowLayerSwitcher implements Action {
|
||||||
|
readonly type = SHOWLAYERSWITCHER;
|
||||||
|
constructor(public show:boolean) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export type Actions = SetMapState
|
||||||
|
| Init
|
||||||
|
| SetParent
|
||||||
|
| StartSearch
|
||||||
|
| StartSearchSuccess
|
||||||
|
| SelectFeature
|
||||||
|
| SelectItem
|
||||||
|
| SelectItemSuccess
|
||||||
|
| SelectTemporalItemsSuccess
|
||||||
|
| NextTemporal
|
||||||
|
| PreviousTemporal
|
||||||
|
| SelectTemporal
|
||||||
|
| AddFeatureSuccess
|
||||||
|
| UpdateFeatureSuccess
|
||||||
|
| ExpandSearch
|
||||||
|
| CollapseSearch
|
||||||
|
| SetExtent
|
||||||
|
| SetQueryState
|
||||||
|
| SetTimeSpan
|
||||||
|
| AddLayer
|
||||||
|
| RemoveLayer
|
||||||
|
| SetVisibility
|
||||||
|
| SetOpacity
|
||||||
|
| SetLayerIndex
|
||||||
|
| LoadBaseLayers
|
||||||
|
| LoadBaseLayersSuccess
|
||||||
|
| SelectBaseLayer
|
||||||
|
| SelectOverlayLayer
|
||||||
|
| ZoomToExtent
|
||||||
|
| SetState
|
||||||
|
| SetViewExtent
|
||||||
|
| DoQuery
|
||||||
|
| SetStyle
|
||||||
|
| ShowLayerSwitcher;
|
||||||
|
|
||||||
|
@@ -1,29 +1,29 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
import { MapComponent } from './components/map/map.component';
|
import { MapComponent } from './components/map/map.component';
|
||||||
import { AuthGuard } from '@farmmaps/common';
|
import { AuthGuard } from '@farmmaps/common';
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
path: '', canActivateChild: [AuthGuard], children: [
|
path: '', children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: MapComponent
|
component: MapComponent
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: ':xCenter/:yCenter/:zoom/:rotation/:baseLayer/:queryState', canActivateChild: [AuthGuard], children: [
|
path: ':xCenter/:yCenter/:zoom/:rotation/:baseLayer/:queryState', children: [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: MapComponent
|
component: MapComponent
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
exports: [RouterModule]
|
exports: [RouterModule]
|
||||||
})
|
})
|
||||||
export class MapRoutingModule { }
|
export class MapRoutingModule { }
|
||||||
|
@@ -16,12 +16,11 @@ import * as mapReducers from './reducers/map.reducer';
|
|||||||
import * as mapActions from './actions/map.actions';
|
import * as mapActions from './actions/map.actions';
|
||||||
import * as mapEffects from './effects/map.effects';
|
import * as mapEffects from './effects/map.effects';
|
||||||
|
|
||||||
import { IMapState} from './models';
|
import { IMapState} from './models/map.state';
|
||||||
import { ISelectedFeatures } from './models';
|
import { ISelectedFeatures } from './models/selected.features';
|
||||||
import { IItemLayer } from './models';
|
import { IItemLayer } from './models/item.layer';
|
||||||
import { ItemLayer} from './models';
|
import { ItemLayer} from './models/item.layer';
|
||||||
import { IQueryState } from './models';
|
import { IPeriodState } from './models/period.state';
|
||||||
import { IPeriodState } from './models';
|
|
||||||
|
|
||||||
// components
|
// components
|
||||||
import { GpsLocation} from './components/aol/gps-location/gps-location.component';
|
import { GpsLocation} from './components/aol/gps-location/gps-location.component';
|
||||||
@@ -35,6 +34,7 @@ import { AbstractItemListComponent,ItemListComponent} from './components/item-li
|
|||||||
import { AbstractSelectedItemComponent, SelectedItemComponent } from './components/selected-item/selected-item.component';
|
import { AbstractSelectedItemComponent, SelectedItemComponent } from './components/selected-item/selected-item.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 { SelectedItemTemporalComponent} from './components/selected-item-temporal/selected-item-temporal.component';
|
||||||
import {SelectedItemShapeComponent } from './components/selected-item-shape/selected-item-shape.component';
|
import {SelectedItemShapeComponent } from './components/selected-item-shape/selected-item-shape.component';
|
||||||
import { SelectedItemContainerComponent } from './components/selected-item-container/selected-item-container.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 { AbstractFeatureListFeatureComponent, FeatureListFeatureComponent } from './components/feature-list-feature/feature-list-feature.component';
|
||||||
@@ -46,7 +46,6 @@ import { WidgetHostDirective} from './components/widget-host/widget-host.directi
|
|||||||
import { FeatureListComponent,AbstractFeatureListComponent} from './components/feature-list/feature-list.component';
|
import { FeatureListComponent,AbstractFeatureListComponent} from './components/feature-list/feature-list.component';
|
||||||
import { FileDropTargetComponent } from './components/aol/file-drop-target/file-drop-target.component';
|
import { FileDropTargetComponent } from './components/aol/file-drop-target/file-drop-target.component';
|
||||||
import { ItemVectorSourceComponent } from './components/aol/item-vector-source/item-vector-source.component';
|
import { ItemVectorSourceComponent } from './components/aol/item-vector-source/item-vector-source.component';
|
||||||
import { ItemFeaturesSourceComponent } from './components/aol/item-features-source/item-features-source.component';
|
|
||||||
import { ItemLayersComponent } from './components/aol/item-layers/item-layers.component';
|
import { ItemLayersComponent } from './components/aol/item-layers/item-layers.component';
|
||||||
import { ZoomToExtentComponent } from './components/aol/zoom-to-extent/zoom-to-extent.component';
|
import { ZoomToExtentComponent } from './components/aol/zoom-to-extent/zoom-to-extent.component';
|
||||||
import { RotationResetComponent } from './components/aol/rotation-reset/rotation-reset.component';
|
import { RotationResetComponent } from './components/aol/rotation-reset/rotation-reset.component';
|
||||||
@@ -54,18 +53,40 @@ import { LayerListComponent } from './components/aol/layer-list/layer-list.compo
|
|||||||
import { MetaDataModalComponent } from './components/meta-data-modal/meta-data-modal.component';
|
import { MetaDataModalComponent } from './components/meta-data-modal/meta-data-modal.component';
|
||||||
import { SelectPeriodModalComponent } from './components/select-period-modal/select-period-modal.component';
|
import { SelectPeriodModalComponent } from './components/select-period-modal/select-period-modal.component';
|
||||||
import { MapComponent } from './components/map/map.component';
|
import { MapComponent } from './components/map/map.component';
|
||||||
import { MapSearchComponent } from './components/map-search';
|
import { MapSearchComponent } from './components/map-search/map-search.component';
|
||||||
import { MapRoutingModule } from './common-map-routing.module';
|
import { MapRoutingModule } from './common-map-routing.module';
|
||||||
import { LegendComponent } from './components/legend/legend.component';
|
import { LegendComponent } from './components/legend/legend.component';
|
||||||
import { LayerVectorImageComponent } from './components/aol/layer-vector-image/layer-vector-image.component';
|
import { LayerVectorImageComponent } from './components/aol/layer-vector-image/layer-vector-image.component';
|
||||||
import { StateSerializerService } from './services/state-serializer.service';
|
import {FeatureIconService} from './services/feature-icon.service';
|
||||||
import { GeolocationService } from './services/geolocation.service';
|
import { GeolocationService } from './services/geolocation.service';
|
||||||
import { localStorageSync } from 'ngrx-store-localstorage';
|
import {DeviceOrientationService} from './services/device-orientation.service';
|
||||||
import { WidgetStatusComponent } from './components/widget-status/widget-status.component';
|
import { WidgetStatusComponent } from './components/widget-status/widget-status.component';
|
||||||
import { ForChild} from './components/for-item/for-child.decorator';
|
import { ForChild} from './components/for-item/for-child.decorator';
|
||||||
import {ForItemType } from './components/for-item/for-itemtype.decorator';
|
import {ForItemType } from './components/for-item/for-itemtype.decorator';
|
||||||
import { ForSourceTask} from './components/for-item/for-sourcetask.decorator';
|
import { ForSourceTask} from './components/for-item/for-sourcetask.decorator';
|
||||||
|
import { PanToLocation} from './components/aol/pan-to-location/pan-to-location.component';
|
||||||
|
import {LayerSwitcher} from './components/layer-switcher/layer-switcher.component';
|
||||||
|
|
||||||
|
export function LocalStorageSync(reducer: ActionReducer<any>): ActionReducer<any> {
|
||||||
|
const r = function(state, action) {
|
||||||
|
const r2 = reducer(state, action);
|
||||||
|
|
||||||
|
if(action.type == "@ngrx/store/update-reducers") {
|
||||||
|
let ms = window.localStorage.getItem(MODULE_NAME+"_mapState");
|
||||||
|
if(ms) {
|
||||||
|
r2["mapState"] = JSON.parse(ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(action.type == "[Map] MapState" || action.type == "[Map] SetState") {
|
||||||
|
window.localStorage.setItem(MODULE_NAME + "_mapState",JSON.stringify(r2["mapState"]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return r2;
|
||||||
|
};
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
const metaReducers: Array<MetaReducer<any, any>> = [LocalStorageSync];
|
||||||
|
|
||||||
export {
|
export {
|
||||||
mapEffects,
|
mapEffects,
|
||||||
@@ -73,7 +94,6 @@ export {
|
|||||||
mapActions,
|
mapActions,
|
||||||
ZoomToExtentComponent,
|
ZoomToExtentComponent,
|
||||||
ItemVectorSourceComponent,
|
ItemVectorSourceComponent,
|
||||||
ItemFeaturesSourceComponent,
|
|
||||||
ItemLayersComponent,
|
ItemLayersComponent,
|
||||||
FileDropTargetComponent,
|
FileDropTargetComponent,
|
||||||
MapComponent,
|
MapComponent,
|
||||||
@@ -97,6 +117,7 @@ export {
|
|||||||
SelectedItemComponent,
|
SelectedItemComponent,
|
||||||
SelectedItemCropfieldComponent,
|
SelectedItemCropfieldComponent,
|
||||||
SelectedItemGeotiffComponent,
|
SelectedItemGeotiffComponent,
|
||||||
|
SelectedItemTemporalComponent,
|
||||||
SelectedItemShapeComponent,
|
SelectedItemShapeComponent,
|
||||||
ItemListItemComponent,
|
ItemListItemComponent,
|
||||||
ItemListItemContainerComponent,
|
ItemListItemContainerComponent,
|
||||||
@@ -104,19 +125,21 @@ export {
|
|||||||
ItemWidgetListComponent,
|
ItemWidgetListComponent,
|
||||||
WidgetStatusComponent,
|
WidgetStatusComponent,
|
||||||
GpsLocation,
|
GpsLocation,
|
||||||
|
PanToLocation,
|
||||||
|
LayerSwitcher,
|
||||||
AbstractFeatureListComponent,
|
AbstractFeatureListComponent,
|
||||||
AbstractFeatureListFeatureComponent,
|
AbstractFeatureListFeatureComponent,
|
||||||
AbstractSelectedItemComponent,
|
AbstractSelectedItemComponent,
|
||||||
AbstractItemWidgetComponent,
|
AbstractItemWidgetComponent,
|
||||||
AbstractItemListItemComponent,
|
AbstractItemListItemComponent,
|
||||||
AbstractItemListComponent,
|
AbstractItemListComponent,
|
||||||
StateSerializerService,
|
FeatureIconService,
|
||||||
GeolocationService,
|
GeolocationService,
|
||||||
|
DeviceOrientationService,
|
||||||
IMapState,
|
IMapState,
|
||||||
ISelectedFeatures,
|
ISelectedFeatures,
|
||||||
IItemLayer,
|
IItemLayer,
|
||||||
ItemLayer,
|
ItemLayer,
|
||||||
IQueryState,
|
|
||||||
IPeriodState,
|
IPeriodState,
|
||||||
ForChild,
|
ForChild,
|
||||||
ForItemType,
|
ForItemType,
|
||||||
@@ -128,7 +151,7 @@ export {
|
|||||||
CommonModule,
|
CommonModule,
|
||||||
AngularOpenlayersModule,
|
AngularOpenlayersModule,
|
||||||
MapRoutingModule,
|
MapRoutingModule,
|
||||||
StoreModule.forFeature(MODULE_NAME, mapReducers.reducer),
|
StoreModule.forFeature(MODULE_NAME, mapReducers.reducer,{metaReducers:metaReducers}),
|
||||||
EffectsModule.forFeature([mapEffects.MapEffects]),
|
EffectsModule.forFeature([mapEffects.MapEffects]),
|
||||||
NgbModule,
|
NgbModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
@@ -138,7 +161,6 @@ export {
|
|||||||
declarations: [
|
declarations: [
|
||||||
ZoomToExtentComponent,
|
ZoomToExtentComponent,
|
||||||
ItemVectorSourceComponent,
|
ItemVectorSourceComponent,
|
||||||
ItemFeaturesSourceComponent,
|
|
||||||
ItemLayersComponent,
|
ItemLayersComponent,
|
||||||
FileDropTargetComponent,
|
FileDropTargetComponent,
|
||||||
MapComponent,
|
MapComponent,
|
||||||
@@ -162,6 +184,7 @@ export {
|
|||||||
SelectedItemComponent,
|
SelectedItemComponent,
|
||||||
SelectedItemCropfieldComponent,
|
SelectedItemCropfieldComponent,
|
||||||
SelectedItemGeotiffComponent,
|
SelectedItemGeotiffComponent,
|
||||||
|
SelectedItemTemporalComponent,
|
||||||
SelectedItemShapeComponent,
|
SelectedItemShapeComponent,
|
||||||
ItemListItemComponent,
|
ItemListItemComponent,
|
||||||
ItemListItemContainerComponent,
|
ItemListItemContainerComponent,
|
||||||
@@ -169,6 +192,8 @@ export {
|
|||||||
ItemWidgetListComponent,
|
ItemWidgetListComponent,
|
||||||
WidgetStatusComponent,
|
WidgetStatusComponent,
|
||||||
GpsLocation,
|
GpsLocation,
|
||||||
|
PanToLocation,
|
||||||
|
LayerSwitcher
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
FeatureListComponent,
|
FeatureListComponent,
|
||||||
@@ -180,18 +205,20 @@ export {
|
|||||||
SelectedItemComponent,
|
SelectedItemComponent,
|
||||||
SelectedItemCropfieldComponent,
|
SelectedItemCropfieldComponent,
|
||||||
SelectedItemGeotiffComponent,
|
SelectedItemGeotiffComponent,
|
||||||
|
SelectedItemTemporalComponent,
|
||||||
SelectedItemShapeComponent,
|
SelectedItemShapeComponent,
|
||||||
ItemListComponent,
|
ItemListComponent,
|
||||||
ItemListItemComponent,
|
ItemListItemComponent,
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
ItemVectorSourceComponent,
|
ItemVectorSourceComponent,
|
||||||
ItemFeaturesSourceComponent,
|
|
||||||
ItemLayersComponent,
|
ItemLayersComponent,
|
||||||
FileDropTargetComponent,
|
FileDropTargetComponent,
|
||||||
MetaDataModalComponent,
|
MetaDataModalComponent,
|
||||||
MapComponent,
|
MapComponent,
|
||||||
GpsLocation,
|
GpsLocation,
|
||||||
|
PanToLocation,
|
||||||
|
LayerSwitcher,
|
||||||
FeatureListFeatureComponent,
|
FeatureListFeatureComponent,
|
||||||
FeatureListFeatureCropfieldComponent,
|
FeatureListFeatureCropfieldComponent,
|
||||||
FeatureListFeatureCroppingschemeComponent,
|
FeatureListFeatureCroppingschemeComponent,
|
||||||
@@ -199,6 +226,7 @@ export {
|
|||||||
SelectedItemComponent,
|
SelectedItemComponent,
|
||||||
SelectedItemCropfieldComponent,
|
SelectedItemCropfieldComponent,
|
||||||
SelectedItemGeotiffComponent,
|
SelectedItemGeotiffComponent,
|
||||||
|
SelectedItemTemporalComponent,
|
||||||
SelectedItemShapeComponent,
|
SelectedItemShapeComponent,
|
||||||
ItemListItemComponent,
|
ItemListItemComponent,
|
||||||
ItemListItemContainerComponent,
|
ItemListItemContainerComponent,
|
||||||
@@ -221,13 +249,15 @@ export {
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
export class AppCommonMapModule {
|
export class AppCommonMapModule {
|
||||||
static forRoot(): ModuleWithProviders {
|
static forRoot(): ModuleWithProviders {
|
||||||
return {
|
return {
|
||||||
ngModule: AppCommonMapModule,
|
ngModule: AppCommonMapModule,
|
||||||
providers: [
|
providers: [
|
||||||
StateSerializerService,
|
FeatureIconService,
|
||||||
GeolocationService,
|
GeolocationService,
|
||||||
|
DeviceOrientationService,
|
||||||
{ provide: AbstractFeatureListComponent, useClass: FeatureListCroppingschemeComponent, multi: true },
|
{ provide: AbstractFeatureListComponent, useClass: FeatureListCroppingschemeComponent, multi: true },
|
||||||
{ provide: AbstractFeatureListComponent, useClass: FeatureListCropfieldComponent, multi: true },
|
{ provide: AbstractFeatureListComponent, useClass: FeatureListCropfieldComponent, multi: true },
|
||||||
{ provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureComponent, multi: true },
|
{ provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureComponent, multi: true },
|
||||||
@@ -236,6 +266,7 @@ export class AppCommonMapModule {
|
|||||||
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemComponent, multi: true },
|
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemComponent, multi: true },
|
||||||
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemCropfieldComponent, multi: true },
|
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemCropfieldComponent, multi: true },
|
||||||
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemGeotiffComponent, multi: true },
|
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemGeotiffComponent, multi: true },
|
||||||
|
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemTemporalComponent, multi: true },
|
||||||
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemShapeComponent, multi: true },
|
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemShapeComponent, multi: true },
|
||||||
{ provide: AbstractItemListItemComponent, useClass: ItemListItemComponent, multi: true },
|
{ provide: AbstractItemListItemComponent, useClass: ItemListItemComponent, multi: true },
|
||||||
{ provide: AbstractItemListComponent, useClass: ItemListComponent, multi: true }
|
{ provide: AbstractItemListComponent, useClass: ItemListComponent, multi: true }
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
@import "../../../_theme.scss";
|
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
|
|
||||||
|
|
||||||
@@ -11,25 +10,25 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tolerance {
|
.tolerance {
|
||||||
fill: theme-color();
|
fill: $primary;
|
||||||
fill-opacity:0.4;
|
fill-opacity:0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
.border {
|
.border {
|
||||||
fill: white;
|
fill: $white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.center {
|
.center {
|
||||||
fill: theme-color();
|
fill: $primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stop1 {
|
.stop1 {
|
||||||
stop-color: theme-color();
|
stop-color: $primary;
|
||||||
stop-opacity:1;
|
stop-opacity:1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stop2 {
|
.stop2 {
|
||||||
stop-color: theme-color();
|
stop-color:$primary;
|
||||||
stop-opacity: 0;
|
stop-opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,68 +1,70 @@
|
|||||||
import { Component, OnInit, Input, ViewChild, ElementRef, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, OnInit, Input, ViewChild, ElementRef, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { MapComponent } from 'ngx-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';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-gps-location',
|
selector: 'fm-map-gps-location',
|
||||||
templateUrl: './gps-location.component.html',
|
templateUrl: './gps-location.component.html',
|
||||||
styleUrls: ['./gps-location.component.scss']
|
styleUrls: ['./gps-location.component.scss']
|
||||||
})
|
})
|
||||||
export class GpsLocation implements OnInit,OnChanges{
|
export class GpsLocation implements OnInit,OnChanges{
|
||||||
|
|
||||||
@Input() enable:boolean;
|
@Input() enable:boolean;
|
||||||
public instance: Overlay;
|
public instance: Overlay;
|
||||||
@Input() position: Position;
|
@Input() position: Position;
|
||||||
@Input() location: number[]=[0,0];
|
@Input() location: number[]=[0,0];
|
||||||
@Input() locationTolerance: number = 0;
|
@Input() locationTolerance: number = 0;
|
||||||
@Input() showHeading: boolean = false;
|
@Input() showHeading: boolean = false;
|
||||||
@Input() heading: number = 0;
|
@Input() heading: number = 0;
|
||||||
@Input() headingTolerance: number = 0;
|
@Input() headingTolerance: number = 0;
|
||||||
public locTolerancePixels: number = 0;
|
public locTolerancePixels: number = 0;
|
||||||
public path: string = "";
|
public path: string = "";
|
||||||
public rotate: string = "";
|
public rotate: string = "";
|
||||||
private resolution: number = 0;
|
private resolution: number = 0;
|
||||||
@ViewChild('location') locationElement: ElementRef;
|
@ViewChild('location', { static: true }) locationElement: ElementRef;
|
||||||
|
|
||||||
constructor(private map: MapComponent) {
|
constructor(private map: MapComponent) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
recalcLocationTolerance() {
|
recalcLocationTolerance() {
|
||||||
this.locTolerancePixels = this.resolution >0? this.locationTolerance / this.resolution:0;
|
this.locTolerancePixels = this.resolution >0? this.locationTolerance / this.resolution:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.instance = new Overlay({
|
this.instance = new Overlay({
|
||||||
stopEvent:false,
|
stopEvent:false,
|
||||||
positioning: 'center-center',
|
positioning: 'center-center',
|
||||||
position: fromLonLat( this.location),
|
position: fromLonLat( this.location),
|
||||||
element: this.locationElement.nativeElement
|
element: this.locationElement.nativeElement
|
||||||
});
|
});
|
||||||
var x = Math.tan(this.headingTolerance * Math.PI / 180)*40;
|
var x = Math.tan(this.headingTolerance * Math.PI / 180)*40;
|
||||||
var y = Math.cos(this.headingTolerance * Math.PI / 180) * 40;
|
var y = Math.cos(this.headingTolerance * Math.PI / 180) * 40;
|
||||||
var y1 = Math.round(500 - y);
|
var y1 = Math.round(500 - y);
|
||||||
var x1 = Math.round(500 - x);
|
var x1 = Math.round(500 - x);
|
||||||
var y2 = Math.round(y1);
|
var y2 = Math.round(y1);
|
||||||
var 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;
|
||||||
this.map.instance.addOverlay(this.instance);
|
this.map.instance.addOverlay(this.instance);
|
||||||
this.map.instance.getView().on('change:resolution', (evt) => {
|
this.map.instance.getView().on('change:resolution', (evt) => {
|
||||||
this.resolution = evt.target.get('resolution');
|
this.resolution = evt.target.get('resolution');
|
||||||
this.recalcLocationTolerance();
|
this.recalcLocationTolerance();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
if (changes.position && this.instance) {
|
if (changes.position && this.instance) {
|
||||||
var p = changes.position.currentValue as Position;
|
var p = changes.position.currentValue as Position;
|
||||||
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;
|
||||||
this.recalcLocationTolerance();
|
this.recalcLocationTolerance();
|
||||||
this.heading = p.coords.heading;
|
}
|
||||||
}
|
if(changes.heading && this.instance) {
|
||||||
}
|
this.rotate = "rotate(" + Math.round(changes.heading.currentValue) + " 500 500)";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1,90 +0,0 @@
|
|||||||
import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken } from '@angular/core';
|
|
||||||
import { HttpClient } from "@angular/common/http";
|
|
||||||
import { LayerVectorComponent, SourceVectorComponent, MapComponent, LayerImageComponent } from 'ngx-openlayers';
|
|
||||||
import { LayerVectorImageComponent } from '../layer-vector-image/layer-vector-image.component';
|
|
||||||
import { ItemService } from '@farmmaps/common';
|
|
||||||
import { IItem } from '@farmmaps/common';
|
|
||||||
import { ISelectedFeatures } from '../../../models';
|
|
||||||
|
|
||||||
import {Vector} from 'ol/source';
|
|
||||||
import {Feature,Collection} from 'ol';
|
|
||||||
import {Extent} from 'ol/extent';
|
|
||||||
import * as style from 'ol/style';
|
|
||||||
import * as proj from 'ol/proj';
|
|
||||||
import Projection from 'ol/proj/Projection';
|
|
||||||
import * as loadingstrategy from 'ol/loadingstrategy';
|
|
||||||
import {GeoJSON} from 'ol/format';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'fm-map-item-features-source',
|
|
||||||
template: `<ng-content></ng-content>`,
|
|
||||||
providers: [
|
|
||||||
{ provide: SourceVectorComponent, useExisting: forwardRef(() => ItemFeaturesSourceComponent) }
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
export class ItemFeaturesSourceComponent extends SourceVectorComponent implements OnInit, OnChanges {
|
|
||||||
instance:Vector;
|
|
||||||
features: Collection<Feature>;
|
|
||||||
@Input() item: IItem;
|
|
||||||
@Input() layerIndex: number = 0;
|
|
||||||
constructor(@Host() private layer: LayerVectorImageComponent, private itemService: ItemService, @Host() private map: MapComponent) {
|
|
||||||
super(layer);
|
|
||||||
}
|
|
||||||
|
|
||||||
private colorIndex = 0;
|
|
||||||
private styleCache = {};
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
this.instance = new Vector({
|
|
||||||
loader: (extent: Extent, resolution: number, projection: Projection) => {
|
|
||||||
let format = new GeoJSON();
|
|
||||||
this.itemService.getItemFeatures(this.item.code, extent, projection.getCode(), this.layerIndex).subscribe((data) => {
|
|
||||||
var features = format.readFeatures(data);
|
|
||||||
// TODO 13/6/2019 The line below causes an endless loop. Action required?
|
|
||||||
this.instance.addFeatures(features);
|
|
||||||
// TODO 13/6/2019 Action required: check if feature collection hasn't been changed (Willem)
|
|
||||||
// var t = this.vectorSource.getFeatures();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
format: new GeoJSON(),
|
|
||||||
strategy: loadingstrategy.bbox
|
|
||||||
});
|
|
||||||
this.features = new Collection<Feature>();
|
|
||||||
this.layer.instance
|
|
||||||
this.layer.instance.setStyle((feature) => {
|
|
||||||
var resolution = this.map.instance.getView().getResolution();
|
|
||||||
var r = (2 / resolution) / 2;
|
|
||||||
var color = feature.get("color");
|
|
||||||
return new style.Style(
|
|
||||||
{
|
|
||||||
fill: new style.Fill({
|
|
||||||
color: color
|
|
||||||
}),
|
|
||||||
image: new style.Circle({
|
|
||||||
fill: new style.Fill({
|
|
||||||
color: color
|
|
||||||
}),
|
|
||||||
stroke: new style.Stroke({
|
|
||||||
color: color,
|
|
||||||
width: 1.25
|
|
||||||
}),
|
|
||||||
radius: r
|
|
||||||
}),
|
|
||||||
stroke: new style.Stroke({
|
|
||||||
color: color,
|
|
||||||
width: 1.25
|
|
||||||
})
|
|
||||||
});
|
|
||||||
});
|
|
||||||
this.host.instance.setSource(this.instance);
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
|
||||||
if (this.instance) {
|
|
||||||
if (changes['layerIndex']) {
|
|
||||||
this.instance.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,276 +1,316 @@
|
|||||||
import { Component, Host, Input, Output, EventEmitter, Optional, QueryList, OnInit, AfterViewInit, OnChanges, SimpleChanges, SkipSelf, forwardRef, Inject, InjectionToken } from '@angular/core';
|
import { Component, Host, Input, Output, EventEmitter, Optional, QueryList, OnInit, AfterViewInit, OnChanges, SimpleChanges, SkipSelf, forwardRef, Inject, InjectionToken } from '@angular/core';
|
||||||
import { HttpClient } from "@angular/common/http";
|
import { HttpClient } from "@angular/common/http";
|
||||||
import { LayerVectorComponent, LayerTileComponent, LayerGroupComponent, MapComponent } from 'ngx-openlayers';
|
import { LayerVectorComponent, LayerTileComponent, LayerGroupComponent, MapComponent } from 'ngx-openlayers';
|
||||||
import { ItemService } from '@farmmaps/common';
|
import { ItemService,IItem,AppConfig } from '@farmmaps/common';
|
||||||
import { AppConfig } from '@farmmaps/common';
|
import { IItemLayer,ItemLayer, ITemporalItemLayer} from '../../../models/item.layer';
|
||||||
import { IItemLayer, ILayerData, IRenderoutputTiles, IRenderoutputImage, IGradientstop, ILayer, IHistogram } from '../../../models';
|
import { ILayerData} from '../../../models/layer.data';
|
||||||
|
import { IRenderoutputTiles,IRenderoutputImage,IGradientstop,ILayer,IHistogram} from '../../../models/color.map';
|
||||||
import {Extent} from 'ol/extent';
|
import {Extent} from 'ol/extent';
|
||||||
import Projection from 'ol/proj/Projection';
|
import Projection from 'ol/proj/Projection';
|
||||||
import * as proj from 'ol/proj';
|
import * as proj from 'ol/proj';
|
||||||
import * as loadingstrategy from 'ol/loadingstrategy';
|
import * as loadingstrategy from 'ol/loadingstrategy';
|
||||||
import * as style from 'ol/style';
|
import * as style from 'ol/style';
|
||||||
import {Tile,Layer,Image} from 'ol/layer';
|
import {Tile,Layer,Image} from 'ol/layer';
|
||||||
import {XYZ,ImageStatic,OSM,BingMaps,TileWMS,TileArcGISRest} from 'ol/source';
|
import {XYZ,ImageStatic,OSM,BingMaps,TileWMS,TileArcGISRest} from 'ol/source';
|
||||||
import {Vector as VectorSource} from 'ol/source';
|
import {Vector as VectorSource} from 'ol/source';
|
||||||
import { Vector as VectorLayer } from 'ol/layer';
|
import { Vector as VectorLayer } from 'ol/layer';
|
||||||
import VectorTileSource from 'ol/source/VectorTile';
|
import VectorTileSource from 'ol/source/VectorTile';
|
||||||
import VectorTileLayer from 'ol/layer/VectorTile';
|
import VectorTileLayer from 'ol/layer/VectorTile';
|
||||||
import {GeoJSON,MVT} from 'ol/format';
|
import {GeoJSON,MVT} from 'ol/format';
|
||||||
import { from } from 'rxjs';
|
import { from } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-item-layers',
|
selector: 'fm-map-item-layers',
|
||||||
template: `<ng-content></ng-content>`,
|
template: `<ng-content></ng-content>`,
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: LayerGroupComponent, useExisting: forwardRef(() => ItemLayersComponent) }
|
{ provide: LayerGroupComponent, useExisting: forwardRef(() => ItemLayersComponent) }
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
export class ItemLayersComponent extends LayerGroupComponent implements OnChanges, OnInit {
|
export class ItemLayersComponent extends LayerGroupComponent implements OnChanges, OnInit {
|
||||||
@Input() itemLayers: IItemLayer[];
|
@Input() itemLayers: IItemLayer[];
|
||||||
@Input() itemLayer: IItemLayer;
|
@Input() itemLayer: IItemLayer;
|
||||||
private _apiEndPoint: string;
|
private _apiEndPoint: string;
|
||||||
|
|
||||||
constructor(private itemService: ItemService, @Host() private map: MapComponent, public appConfig: AppConfig) {
|
constructor(private itemService: ItemService, @Host() private map: MapComponent, public appConfig: AppConfig) {
|
||||||
super(map);
|
super(map);
|
||||||
this._apiEndPoint = appConfig.getConfig("apiEndPoint");
|
this._apiEndPoint = appConfig.getConfig("apiEndPoint");
|
||||||
}
|
}
|
||||||
|
|
||||||
private styleCache = {}
|
private styleCache = {}
|
||||||
|
|
||||||
componentToHex(c) {
|
componentToHex(c) {
|
||||||
var hex = c.toString(16);
|
var hex = c.toString(16);
|
||||||
return hex.length == 1 ? "0" + hex : hex;
|
return hex.length == 1 ? "0" + hex : hex;
|
||||||
}
|
}
|
||||||
|
|
||||||
rgbaToHex(r, g, b,a) {
|
rgbaToHex(r, g, b,a) {
|
||||||
return "#" + this.componentToHex(r) + this.componentToHex(g) + this.componentToHex(b) + this.componentToHex(a);
|
return "#" + this.componentToHex(r) + this.componentToHex(g) + this.componentToHex(b) + this.componentToHex(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
getColorFromGradient(layer: ILayer, feature): style.Style {
|
getColorFromGradient(layer: ILayer, feature): style.Style {
|
||||||
var value = feature.get(layer.name);
|
var value = feature.get(layer.name);
|
||||||
var gradient: IGradientstop[] = layer.renderer.colorMap.gradient;
|
var gradient: IGradientstop[] = layer.renderer.colorMap.gradient;
|
||||||
var histogram: IHistogram = layer.renderer.band.histogram;
|
var histogram: IHistogram = layer.renderer.band.histogram;
|
||||||
var index = (value - histogram.min) / histogram.max;
|
var index = (value - histogram.min) / histogram.max;
|
||||||
var min = gradient[0];
|
var min = gradient[0];
|
||||||
var max = gradient[gradient.length - 1];
|
var max = gradient[gradient.length - 1];
|
||||||
for (var n = 0; n < gradient.length; n++) {
|
for (var n = 0; n < gradient.length; n++) {
|
||||||
var 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;
|
||||||
}
|
}
|
||||||
var i = index - min.relativestop;
|
var i = index - min.relativestop;
|
||||||
var size = max.relativestop - min.relativestop;
|
var size = max.relativestop - min.relativestop;
|
||||||
var 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));
|
||||||
var 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));
|
||||||
var 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));
|
||||||
var 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 new style.Style(
|
return new style.Style(
|
||||||
{
|
{
|
||||||
image: new style.Circle({
|
image: new style.Circle({
|
||||||
fill: new style.Fill({
|
fill: new style.Fill({
|
||||||
color: this.rgbaToHex(red,green,blue,alpha)
|
color: this.rgbaToHex(red,green,blue,alpha)
|
||||||
}),
|
}),
|
||||||
radius: 3
|
radius: 3
|
||||||
}),
|
}),
|
||||||
fill: new style.Fill({
|
fill: new style.Fill({
|
||||||
color: this.rgbaToHex(red, green, blue, alpha)
|
color: this.rgbaToHex(red, green, blue, alpha)
|
||||||
}),
|
}),
|
||||||
stroke: new style.Stroke({
|
stroke: new style.Stroke({
|
||||||
color: this.rgbaToHex(red, green, blue, alpha),
|
color: this.rgbaToHex(red, green, blue, alpha),
|
||||||
width: 1.25
|
width: 1.25
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
createLayer(itemLayer: IItemLayer): Layer {
|
createGeotiffLayer(item:IItem,itemLayer:IItemLayer):Layer {
|
||||||
var layer: Layer = null;
|
var layerIndex = -1;
|
||||||
if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') {
|
var layer: Layer = null;
|
||||||
let source = new XYZ({ maxZoom: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/tiles/{z}/{x}/{y}.png?v=${itemLayer.item.updated.getTime()}` });
|
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
|
||||||
layer = new Tile({ source: source });
|
let source = new XYZ({ maxZoom: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${item.updated.getTime()}` });
|
||||||
var data = itemLayer.item.data;
|
layer = new Tile({ source: source });
|
||||||
var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null;
|
var data = item.data;
|
||||||
if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
|
var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null;
|
||||||
var rt = l.rendering as IRenderoutputTiles;
|
if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
|
||||||
let source = new XYZ({ maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/tiles/{z}/{x}/{y}.png?v=${itemLayer.item.updated.getTime()}` });
|
var rt = l.rendering as IRenderoutputTiles;
|
||||||
layer = new Tile({ source: source });
|
let source = new XYZ({ maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${item.updated.getTime()}` });
|
||||||
}
|
layer = new Tile({ source: source });
|
||||||
if (l && l.rendering && l.rendering.renderoutputType == "Image") {
|
}
|
||||||
var ri = l.rendering as IRenderoutputImage;
|
if (l && l.rendering && l.rendering.renderoutputType == "Image") {
|
||||||
let projection = new Projection({
|
var ri = l.rendering as IRenderoutputImage;
|
||||||
code: 'image',
|
let projection = new Projection({
|
||||||
units: 'pixels',
|
code: 'image',
|
||||||
extent: ri.extent
|
units: 'pixels',
|
||||||
});
|
extent: ri.extent
|
||||||
let source = new ImageStatic({ imageExtent: ri.extent, projection: projection, url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/mapimage?v=${itemLayer.item.updated.getTime()}` });
|
});
|
||||||
layer = new Image({ source: source });
|
let source = new ImageStatic({ imageExtent: ri.extent, projection: projection, url: `${this._apiEndPoint}/api/v1/items/${item.code}/mapimage/${layerIndex}?v=${item.updated.getTime()}` });
|
||||||
}
|
layer = new Image({ source: source });
|
||||||
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {
|
}
|
||||||
var data = itemLayer.item.data;
|
return layer;
|
||||||
var layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index;
|
}
|
||||||
var l = itemLayer.item.data.layers[layerIndex];
|
|
||||||
if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") {
|
createShapeLayer(item:IItem,itemLayer:IItemLayer):Layer {
|
||||||
var rt = itemLayer.item.data.layers[layerIndex].rendering as IRenderoutputTiles;
|
var layerIndex = -1;
|
||||||
layer = new VectorTileLayer({
|
var layer: Layer = null;
|
||||||
declutter: true,
|
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
|
||||||
source: new VectorTileSource({
|
var data = item.data;
|
||||||
maxZoom: rt.maxzoom,
|
var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null;
|
||||||
minZoom: rt.minzoom,
|
if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") {
|
||||||
format: new MVT(),
|
var rt = item.data.layers[layerIndex].rendering as IRenderoutputTiles;
|
||||||
url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/vectortiles/{z}/{x}/{y}.pbf?v=${itemLayer.item.updated.getTime()}`
|
layer = new VectorTileLayer({
|
||||||
}),
|
declutter: true,
|
||||||
style: (feature) => {
|
source: new VectorTileSource({
|
||||||
return this.getColorFromGradient(l, feature);
|
maxZoom: rt.maxzoom,
|
||||||
}
|
minZoom: rt.minzoom,
|
||||||
})
|
format: new MVT(),
|
||||||
} if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
|
url: `${this._apiEndPoint}/api/v1/items/${item.code}/vectortiles/{z}/{x}/{y}.pbf?v=${item.updated.getTime()}`
|
||||||
var rt = l.rendering as IRenderoutputTiles;
|
}),
|
||||||
layer = new Tile({
|
style: (feature) => {
|
||||||
source: new XYZ({
|
return this.getColorFromGradient(l, feature);
|
||||||
maxZoom: rt.maxzoom,
|
}
|
||||||
minZoom: rt.minzoom,
|
})
|
||||||
url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/vectortiles/image_tiles/${layerIndex}/{z}/{x}/{y}.png?v=${itemLayer.item.updated.getTime()}`
|
} else if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
|
||||||
})
|
var rt = l.rendering as IRenderoutputTiles;
|
||||||
});
|
layer = new Tile({
|
||||||
} else {
|
source: new XYZ({
|
||||||
let __this = this;
|
maxZoom: rt.maxzoom,
|
||||||
let format = new GeoJSON();
|
minZoom: rt.minzoom,
|
||||||
let source = new VectorSource({
|
url: `${this._apiEndPoint}/api/v1/items/${item.code}/vectortiles/image_tiles/${layerIndex}/{z}/{x}/{y}.png?v=${item.updated.getTime()}`
|
||||||
strategy: loadingstrategy.bbox,
|
})
|
||||||
loader: function (extent: Extent, resolution: number, projection: Projection) {
|
});
|
||||||
var source = this as VectorSource;
|
} else {
|
||||||
__this.itemService.getItemFeatures(itemLayer.item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) {
|
let __this = this;
|
||||||
var features = format.readFeatures(data);
|
let format = new GeoJSON();
|
||||||
for (let f of features) {
|
let source = new VectorSource({
|
||||||
if (f.get("code")) {
|
strategy: loadingstrategy.bbox,
|
||||||
f.setId(f.get("code"));
|
loader: function (extent: Extent, resolution: number, projection: Projection) {
|
||||||
}
|
var source = this as VectorSource;
|
||||||
}
|
__this.itemService.getItemFeatures(item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) {
|
||||||
source.addFeatures(features);
|
var features = format.readFeatures(data);
|
||||||
});
|
for (let f of features) {
|
||||||
}
|
if (f.get("code")) {
|
||||||
});
|
f.setId(f.get("code"));
|
||||||
layer = new VectorLayer({
|
}
|
||||||
source: source,
|
}
|
||||||
style: (feature) => {
|
source.addFeatures(features);
|
||||||
var key = feature.get("color");
|
});
|
||||||
if (!this.styleCache[key]) {
|
}
|
||||||
var color = feature.get("color");
|
});
|
||||||
this.styleCache[key] = new style.Style(
|
layer = new VectorLayer({
|
||||||
{
|
source: source,
|
||||||
fill: new style.Fill({
|
style: (feature) => {
|
||||||
color: color
|
var key = feature.get("color");
|
||||||
}),
|
if (!this.styleCache[key]) {
|
||||||
stroke: new style.Stroke({
|
var color = feature.get("color");
|
||||||
color: color,
|
this.styleCache[key] = new style.Style(
|
||||||
width: 1.25
|
{
|
||||||
}),
|
fill: new style.Fill({
|
||||||
image: new style.Circle({
|
color: color
|
||||||
fill: new style.Fill({
|
}),
|
||||||
color: color
|
stroke: new style.Stroke({
|
||||||
}),
|
color: color,
|
||||||
stroke: new style.Stroke({
|
width: 1.25
|
||||||
color: color,
|
}),
|
||||||
width: 1.25
|
image: new style.Circle({
|
||||||
}),
|
fill: new style.Fill({
|
||||||
radius: 5
|
color: color
|
||||||
}),
|
}),
|
||||||
}
|
stroke: new style.Stroke({
|
||||||
)
|
color: color,
|
||||||
}
|
width: 1.25
|
||||||
return this.styleCache[key];
|
}),
|
||||||
}
|
radius: 5
|
||||||
});
|
}),
|
||||||
}
|
}
|
||||||
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.layer') {
|
)
|
||||||
let data = itemLayer.item.data as ILayerData;
|
}
|
||||||
switch (data.interfaceType) {
|
return this.styleCache[key];
|
||||||
case 'OSM': {
|
}
|
||||||
let source = new OSM();
|
});
|
||||||
layer = new Tile({ source: source });
|
}
|
||||||
break;
|
return layer;
|
||||||
}
|
}
|
||||||
case 'BingMaps': {
|
|
||||||
let source = new BingMaps(data.options);
|
createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer {
|
||||||
layer = new Tile({ source: source });
|
let data = item.data as ILayerData;
|
||||||
break;
|
var layer: Layer = null;
|
||||||
}
|
switch (data.interfaceType) {
|
||||||
case 'TileWMS': {
|
case 'OSM': {
|
||||||
let source = new TileWMS(data.options);
|
let source = new OSM();
|
||||||
layer = new Tile({ source: source });
|
layer = new Tile({ source: source });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'TileArcGISRest': {
|
case 'BingMaps': {
|
||||||
let source = new TileArcGISRest(data.options);
|
let source = new BingMaps(data.options);
|
||||||
layer = new Tile({ source: source });
|
layer = new Tile({ source: source });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
case 'TileWMS': {
|
||||||
break;
|
let source = new TileWMS(data.options);
|
||||||
}
|
layer = new Tile({ source: source });
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
if (layer) {
|
case 'TileArcGISRest': {
|
||||||
let geometry = new GeoJSON().readGeometry(itemLayer.item.geometry);
|
let source = new TileArcGISRest(data.options);
|
||||||
let extent = geometry ? proj.transformExtent(geometry.getExtent(), 'EPSG:4326', 'EPSG:3857') : null;
|
layer = new Tile({ source: source });
|
||||||
if (extent) layer.setExtent(extent);
|
break;
|
||||||
}
|
}
|
||||||
|
default: {
|
||||||
return layer;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ngOnInit() {
|
return layer;
|
||||||
super.ngOnInit();
|
}
|
||||||
this.updateLayers(this.itemLayers);
|
|
||||||
}
|
createLayer(itemLayer: IItemLayer): Layer {
|
||||||
|
var layer: Layer = null;
|
||||||
updateLayers(itemLayers: IItemLayer[]) {
|
var layerIndex = -1;
|
||||||
if (itemLayers) {
|
if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') {
|
||||||
var olLayers = this.instance.getLayers();
|
layer = this.createGeotiffLayer(itemLayer.item,itemLayer);
|
||||||
itemLayers.forEach((itemLayer, index) => {
|
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {
|
||||||
|
layer = this.createShapeLayer(itemLayer.item,itemLayer);
|
||||||
var layer = itemLayer.layer;
|
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.layer') {
|
||||||
let olIndex = olLayers.getArray().indexOf(layer);
|
layer = this.createExternalLayer(itemLayer.item,itemLayer);
|
||||||
if (olIndex < 0) {
|
}
|
||||||
// New layer: we add it to the map
|
if (layer) {
|
||||||
layer = this.createLayer(itemLayer);
|
let geometry = new GeoJSON().readGeometry(itemLayer.item.geometry);
|
||||||
if (layer) {
|
let extent = geometry ? proj.transformExtent(geometry.getExtent(), 'EPSG:4326', 'EPSG:3857') : null;
|
||||||
itemLayer.layer = layer;
|
if (extent) layer.setExtent(extent);
|
||||||
}
|
}
|
||||||
olLayers.insertAt(index, layer);
|
|
||||||
} else if (index !== olIndex) {
|
return layer;
|
||||||
// layer has moved inside the layers list
|
}
|
||||||
olLayers.removeAt(olIndex);
|
|
||||||
olLayers.insertAt(index, layer);
|
ngOnInit() {
|
||||||
}
|
super.ngOnInit();
|
||||||
layer.setOpacity(itemLayer.opacity);
|
this.updateLayers(this.itemLayers);
|
||||||
layer.setVisible(itemLayer.visible);
|
}
|
||||||
});
|
|
||||||
// Remove the layers that have disapeared from childrenLayers
|
addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer {
|
||||||
if (olLayers.getLength() > itemLayers.length) {
|
if(!itemLayer) return null;
|
||||||
for (let i = itemLayers.length; i < olLayers.getLength(); i++) {
|
var olLayers = this.instance.getLayers();
|
||||||
olLayers.removeAt(i);
|
var layer = itemLayer.layer;
|
||||||
}
|
let olIndex = olLayers.getArray().indexOf(layer);
|
||||||
}
|
if (olIndex < 0) {
|
||||||
}
|
// New layer: we add it to the map
|
||||||
}
|
layer = this.createLayer(itemLayer);
|
||||||
|
if (layer) {
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
olLayers.insertAt(index, layer);
|
||||||
if (this.instance) {
|
}
|
||||||
if (changes['itemLayers']) {
|
} else if (index !== olIndex) {
|
||||||
var itemLayers = changes['itemLayers'].currentValue as IItemLayer[];
|
// layer has moved inside the layers list
|
||||||
this.updateLayers(itemLayers);
|
olLayers.removeAt(olIndex);
|
||||||
}
|
olLayers.insertAt(index, layer);
|
||||||
if (changes['itemLayer']) {
|
}
|
||||||
var itemLayer = changes['itemLayer'].currentValue as IItemLayer;
|
if(layer) {
|
||||||
if(itemLayer) {
|
itemLayer.layer = layer;
|
||||||
this.updateLayers([itemLayer]);
|
layer.setOpacity(itemLayer.opacity);
|
||||||
} else {
|
layer.setVisible(itemLayer.visible);
|
||||||
this.updateLayers([]);
|
}
|
||||||
}
|
return layer;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
updateLayers(itemLayers: IItemLayer[]) {
|
||||||
}
|
let newLayers: IItemLayer[] = [];
|
||||||
|
if (itemLayers) {
|
||||||
|
itemLayers.forEach((itemLayer, index) => {
|
||||||
|
if(itemLayer.item.itemType == 'vnd.farmmaps.itemtype.temporal') {
|
||||||
|
let il = itemLayer as ITemporalItemLayer;
|
||||||
|
let previousLayer = this.addOrUpdateOlLayer(il.previousItemLayer,newLayers.length);
|
||||||
|
if(previousLayer) newLayers.push(previousLayer);
|
||||||
|
let selectedLayer = this.addOrUpdateOlLayer(il.selectedItemLayer,newLayers.length);
|
||||||
|
if(selectedLayer) newLayers.push(selectedLayer);
|
||||||
|
let nextLayer = this.addOrUpdateOlLayer(il.nextItemLayer,newLayers.length);
|
||||||
|
if(nextLayer) newLayers.push(nextLayer);
|
||||||
|
} else {
|
||||||
|
let layer = this.addOrUpdateOlLayer(itemLayer,newLayers.length);
|
||||||
|
if(layer) newLayers.push(layer);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Remove the layers that have disapeared from childrenLayers
|
||||||
|
var olLayers = this.instance.getLayers();
|
||||||
|
while(olLayers.getLength() > newLayers.length) {
|
||||||
|
olLayers.removeAt(newLayers.length);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
if (this.instance) {
|
||||||
|
if (changes['itemLayers']) {
|
||||||
|
var itemLayers = changes['itemLayers'].currentValue as IItemLayer[];
|
||||||
|
this.updateLayers(itemLayers);
|
||||||
|
}
|
||||||
|
if (changes['itemLayer']) {
|
||||||
|
var itemLayer = changes['itemLayer'].currentValue as IItemLayer;
|
||||||
|
if(itemLayer) {
|
||||||
|
this.updateLayers([itemLayer]);
|
||||||
|
} else {
|
||||||
|
this.updateLayers([]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1,207 +1,183 @@
|
|||||||
import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken } from '@angular/core';
|
import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken } from '@angular/core';
|
||||||
import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-openlayers';
|
import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-openlayers';
|
||||||
import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common';
|
import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common';
|
||||||
|
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
import { Point } from 'ol/geom';
|
import { Point } from 'ol/geom';
|
||||||
import { MapBrowserEvent } from 'ol';
|
import { MapBrowserEvent } from 'ol';
|
||||||
import * as style from 'ol/style';
|
import * as style from 'ol/style';
|
||||||
import * as color from 'ol/color';
|
import * as color from 'ol/color';
|
||||||
import * as loadingstrategy from 'ol/loadingstrategy';
|
import * as loadingstrategy from 'ol/loadingstrategy';
|
||||||
import * as condition from 'ol/events/condition';
|
import * as condition from 'ol/events/condition';
|
||||||
import * as extent from 'ol/extent';
|
import * as extent from 'ol/extent';
|
||||||
import {Vector,Cluster} from 'ol/source';
|
import {Vector,Cluster} from 'ol/source';
|
||||||
import {Layer} from 'ol/layer';
|
import {Layer} from 'ol/layer';
|
||||||
import {GeoJSON} from 'ol/format';
|
import {GeoJSON} from 'ol/format';
|
||||||
import {Select} from 'ol/interaction';
|
import {Select} from 'ol/interaction';
|
||||||
|
import {IStyles} from '../../../models/style.cache';
|
||||||
@Component({
|
import {FeatureIconService} from '../../../services/feature-icon.service';
|
||||||
selector: 'fm-map-item-source-vector',
|
|
||||||
template: `<ng-content></ng-content>`,
|
@Component({
|
||||||
providers: [
|
selector: 'fm-map-item-source-vector',
|
||||||
{ provide: SourceVectorComponent , useExisting: forwardRef(() => ItemVectorSourceComponent) }
|
template: `<ng-content></ng-content>`,
|
||||||
]
|
providers: [
|
||||||
})
|
{ provide: SourceVectorComponent , useExisting: forwardRef(() => ItemVectorSourceComponent) }
|
||||||
export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnChanges {
|
]
|
||||||
instance: Vector;
|
})
|
||||||
private _format: GeoJSON;
|
export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnChanges {
|
||||||
private _select: Select;
|
instance: Vector;
|
||||||
private _hoverSelect: Select;
|
private _format: GeoJSON;
|
||||||
private _iconScale: number = 0.05;
|
private _select: Select;
|
||||||
@Input() features: Array<Feature>;
|
private _hoverSelect: Select;
|
||||||
@Input() selectedFeature: Feature;
|
private _iconScale: number = 0.05;
|
||||||
@Input() selectedItem: IItem;
|
@Input() features: Array<Feature>;
|
||||||
@Output() onFeaturesSelected: EventEmitter<Feature> = new EventEmitter<Feature>();
|
@Input() selectedFeature: Feature;
|
||||||
private styleCache = {
|
@Input() selectedItem: IItem;
|
||||||
'file': new style.Style({
|
@Input() styles:IStyles;
|
||||||
image: new style.Icon({
|
@Output() onFeaturesSelected: EventEmitter<Feature> = new EventEmitter<Feature>();
|
||||||
anchor: [0.5, 1],
|
private stylesCache:IStyles = {};
|
||||||
scale: 0.05,
|
|
||||||
src: this.getIconImageDataUrl("fa fa-file-o")
|
constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, @Host() private map: MapComponent, private itemTypeService: ItemTypeService,private featureIconService$:FeatureIconService) {
|
||||||
}),
|
super(layer);
|
||||||
stroke: new style.Stroke({
|
this._format = new GeoJSON();
|
||||||
color: 'red',
|
}
|
||||||
width: 1
|
|
||||||
}),
|
geometry(feature: Feature) {
|
||||||
fill: new style.Fill({
|
let view = this.map.instance.getView();
|
||||||
color: 'rgba(0, 0, 255, 0.1)'
|
let resolution = view.getResolution();
|
||||||
}),
|
var geometry = feature.getGeometry();
|
||||||
geometry: (feature) => this.geometry(feature)
|
let e = geometry.getExtent();
|
||||||
}),
|
//var size = Math.max((e[2] - e[0]) / resolution, (e[3] - e[1]) / resolution);
|
||||||
'selected': new style.Style({
|
if (resolution > 12) {
|
||||||
image: new style.Icon({
|
geometry = new Point(extent.getCenter(e));
|
||||||
anchor: [0.5, 1],
|
}
|
||||||
scale: 0.08,
|
return geometry;
|
||||||
src: this.getIconImageDataUrl(null)
|
}
|
||||||
}),
|
|
||||||
stroke: new style.Stroke({
|
getSelectedStyle(feature:Feature):style.Style {
|
||||||
color: 'red',
|
let key = feature.get('itemType')+"_selected";
|
||||||
width: 3
|
let evaluatedStyle =null;
|
||||||
}),
|
var styleEntry = this.stylesCache[key];
|
||||||
fill: new style.Fill({
|
if(styleEntry) {
|
||||||
color: 'rgba(0, 0, 255, 0.1)'
|
if(typeof styleEntry === 'function') {
|
||||||
}),
|
evaluatedStyle = styleEntry(feature);
|
||||||
geometry: (feature) => this.geometry(feature)
|
} else {
|
||||||
})
|
evaluatedStyle = styleEntry;
|
||||||
};
|
}
|
||||||
|
} else {
|
||||||
constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, @Host() private map: MapComponent, private itemTypeService: ItemTypeService) {
|
evaluatedStyle = this.stylesCache["selected"];
|
||||||
super(layer);
|
}
|
||||||
this._format = new GeoJSON();
|
if(evaluatedStyle && evaluatedStyle.geometry_ == null) {
|
||||||
}
|
evaluatedStyle.setGeometry((feature) => this.geometry(feature));
|
||||||
|
}
|
||||||
geometry(feature: Feature) {
|
return evaluatedStyle
|
||||||
let view = this.map.instance.getView();
|
}
|
||||||
let resolution = view.getResolution();
|
|
||||||
var geometry = feature.getGeometry();
|
ngOnInit() {
|
||||||
let e = geometry.getExtent();
|
this.strategy = loadingstrategy.bbox;
|
||||||
//var size = Math.max((e[2] - e[0]) / resolution, (e[3] - e[1]) / resolution);
|
this.format = new GeoJSON();
|
||||||
if (resolution > 12) {
|
this._select = new Select({
|
||||||
geometry = new Point(extent.getCenter(e));
|
style: (feature) => {
|
||||||
}
|
return this.getSelectedStyle(feature);
|
||||||
return geometry;
|
},
|
||||||
}
|
hitTolerance: 10,
|
||||||
|
layers: [this.layer.instance as Layer]
|
||||||
getIconImageDataUrl(iconClass:string, backgroundColor: string = "#c80a6e",color:string = "#ffffff"): string {
|
});
|
||||||
var canvas = document.createElement('canvas');
|
this._hoverSelect = new Select({
|
||||||
canvas.width = 365;
|
style: (feature) => {
|
||||||
canvas.height = 560;
|
return this.getSelectedStyle(feature);
|
||||||
var ctx = canvas.getContext('2d');
|
},
|
||||||
ctx.lineWidth = 6;
|
hitTolerance: 10,
|
||||||
ctx.fillStyle = backgroundColor;
|
condition: (e: MapBrowserEvent) => {
|
||||||
ctx.strokeStyle = "#000000";
|
return e.type == 'pointermove';
|
||||||
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)
|
layers: [this.layer.instance as Layer]
|
||||||
|
});
|
||||||
var iconCharacter = "";
|
this.map.instance.addInteraction(this._select);
|
||||||
if (iconClass != null) {
|
this.map.instance.addInteraction(this._hoverSelect);
|
||||||
var element = document.createElement("i");
|
this._select.on('select', (e) => {
|
||||||
element.style.display = "none";
|
if (e.selected.length > 0 && e.selected[0]) {
|
||||||
element.className = iconClass;
|
this.onFeaturesSelected.emit(e.selected[0]);
|
||||||
document.body.appendChild(element);
|
} else {
|
||||||
iconCharacter = getComputedStyle(element, "::before").content.replace(/"/g, '');
|
this.onFeaturesSelected.emit(null);
|
||||||
let iconFont = "200px " +getComputedStyle(element, "::before").fontFamily
|
}
|
||||||
document.body.removeChild(element);
|
});
|
||||||
ctx.strokeStyle = color;
|
this.instance = new Vector(this);
|
||||||
ctx.fillStyle = color;
|
this.host.instance.setSource(this.instance);
|
||||||
ctx.lineWidth = 15;
|
|
||||||
ctx.font = iconFont;
|
this.host.instance.setStyle((feature) => {
|
||||||
var ts = ctx.measureText(iconCharacter);
|
var key = feature.get('itemType') + (this.selectedItem?"_I":"");
|
||||||
ctx.fillText(iconCharacter, 182.9 - (ts.width / 2), 250);
|
if (!this.stylesCache[key]) {
|
||||||
ctx.strokeText(iconCharacter, 182.9 - (ts.width / 2), 250);
|
if (this.itemTypeService.itemTypes[key]) {
|
||||||
}
|
let itemType = this.itemTypeService.itemTypes[key];
|
||||||
|
let fillColor = color.asArray(itemType.iconColor);
|
||||||
return canvas.toDataURL();
|
fillColor[3] = this.selectedItem?0:0.5;
|
||||||
}
|
this.stylesCache[key] = new style.Style({
|
||||||
|
image: itemType.icon ? new style.Icon({
|
||||||
ngOnInit() {
|
anchor: [0.5, 1],
|
||||||
this.strategy = loadingstrategy.bbox;
|
scale: 0.05,
|
||||||
this.format = new GeoJSON();
|
src: this.featureIconService$.getIconImageDataUrl(itemType.icon)
|
||||||
this._select = new Select({
|
}):null,
|
||||||
style: (feature) => {
|
stroke: new style.Stroke({
|
||||||
return this.styleCache['selected'];
|
color: 'red',
|
||||||
},
|
width: 1
|
||||||
hitTolerance: 10,
|
}),
|
||||||
layers: [this.layer.instance as Layer]
|
fill: new style.Fill({
|
||||||
});
|
color: fillColor
|
||||||
this._hoverSelect = new Select({
|
}),
|
||||||
style: (feature) => {
|
geometry:(feature) => this.geometry(feature)
|
||||||
return this.styleCache['selected'];
|
});
|
||||||
},
|
} else {
|
||||||
hitTolerance: 10,
|
key = 'file';
|
||||||
condition: (e: MapBrowserEvent) => {
|
}
|
||||||
return e.type == 'pointermove';
|
}
|
||||||
},
|
let evaluatedStyle =null;
|
||||||
layers: [this.layer.instance as Layer]
|
var styleEntry = this.stylesCache[key];
|
||||||
});
|
if(typeof styleEntry === 'function') {
|
||||||
this.map.instance.addInteraction(this._select);
|
evaluatedStyle = styleEntry(feature);
|
||||||
this.map.instance.addInteraction(this._hoverSelect);
|
} else {
|
||||||
this._select.on('select', (e) => {
|
evaluatedStyle = styleEntry;
|
||||||
if (e.selected.length > 0 && e.selected[0]) {
|
}
|
||||||
this.onFeaturesSelected.emit(e.selected[0]);
|
if(evaluatedStyle && evaluatedStyle.geometry_ == null) {
|
||||||
} else {
|
evaluatedStyle.setGeometry((feature) => this.geometry(feature));
|
||||||
this.onFeaturesSelected.emit(null);
|
}
|
||||||
}
|
return evaluatedStyle;
|
||||||
});
|
});
|
||||||
this.instance = new Vector(this);
|
}
|
||||||
this.host.instance.setSource(this.instance);
|
|
||||||
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
this.host.instance.setStyle((feature) => {
|
if (changes["features"] && this.instance) {
|
||||||
var key = feature.get('itemType') + (this.selectedItem?"_I":"");
|
this.instance.clear(true);
|
||||||
if (!this.styleCache[key]) {
|
this._select.getFeatures().clear();
|
||||||
if (this.itemTypeService.itemTypes[key]) {
|
this.instance.addFeatures(changes["features"].currentValue);
|
||||||
let itemType = this.itemTypeService.itemTypes[key];
|
}
|
||||||
let fillColor = color.asArray(itemType.iconColor);
|
|
||||||
fillColor[3] = this.selectedItem?0:0.5;
|
if (changes["selectedFeature"] && this.instance) {
|
||||||
this.styleCache[key] = new style.Style({
|
var features = this._select.getFeatures();
|
||||||
image: itemType.icon ? new style.Icon({
|
var feature = changes["selectedFeature"].currentValue
|
||||||
anchor: [0.5, 1],
|
//this.instance.clear(false);
|
||||||
scale: 0.05,
|
//this.instance.addFeatures(features.getArray());
|
||||||
src: this.getIconImageDataUrl(itemType.icon)
|
features.clear();
|
||||||
}):null,
|
if (feature) {
|
||||||
stroke: new style.Stroke({
|
//this.instance.removeFeature(feature);
|
||||||
color: 'red',
|
features.push(feature)
|
||||||
width: 1
|
}
|
||||||
}),
|
}
|
||||||
fill: new style.Fill({
|
if (changes["selectedItem"] && this.instance) {
|
||||||
color: fillColor
|
var item = changes["selectedItem"].currentValue
|
||||||
}),
|
if (item) {
|
||||||
geometry: (feature) => this.geometry(feature)
|
this.map.instance.removeInteraction(this._hoverSelect);
|
||||||
});
|
} else {
|
||||||
} else {
|
this.map.instance.addInteraction(this._hoverSelect);
|
||||||
key = 'file';
|
}
|
||||||
}
|
}
|
||||||
}
|
if (changes["styles"] && this.instance) {
|
||||||
var styleEntry = this.styleCache[key];
|
let styles = changes["styles"].currentValue;
|
||||||
return styleEntry;
|
for (const key in styles) {
|
||||||
});
|
if (styles.hasOwnProperty(key)) {
|
||||||
}
|
this.stylesCache[key]=styles[key];
|
||||||
|
}
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
}
|
||||||
if (changes["features"] && this.instance) {
|
}
|
||||||
this.instance.clear(true);
|
}
|
||||||
this._select.getFeatures().clear();
|
}
|
||||||
this.instance.addFeatures(changes["features"].currentValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changes["selectedFeature"] && this.instance) {
|
|
||||||
var features = this._select.getFeatures();
|
|
||||||
var feature = changes["selectedFeature"].currentValue
|
|
||||||
//this.instance.clear(false);
|
|
||||||
//this.instance.addFeatures(features.getArray());
|
|
||||||
features.clear();
|
|
||||||
if (feature) {
|
|
||||||
//this.instance.removeFeature(feature);
|
|
||||||
features.push(feature)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (changes["selectedItem"] && this.instance) {
|
|
||||||
var item = changes["selectedItem"].currentValue
|
|
||||||
if (item) {
|
|
||||||
this.map.instance.removeInteraction(this._hoverSelect);
|
|
||||||
} else {
|
|
||||||
this.map.instance.addInteraction(this._hoverSelect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { Component,Input,Output,EventEmitter } from '@angular/core';
|
import { Component,Input,Output,EventEmitter } from '@angular/core';
|
||||||
import { IItemLayer } from '../../../models';
|
import { IItemLayer } from '../../../models/item.layer';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-layer-list',
|
selector: 'fm-map-layer-list',
|
||||||
|
@@ -0,0 +1,13 @@
|
|||||||
|
<div (click)="handleClick($event)" class="btn btn-outline-secondary gps-location">
|
||||||
|
<svg height="100%" width="100%" viewBox="0 0 96 96">
|
||||||
|
<g
|
||||||
|
id="XMLID_1_"><circle
|
||||||
|
class="pan-to" [ngClass]="{'pan-to-centered':centered(),'pan-to-disabled':disabled()}"
|
||||||
|
cx="48"
|
||||||
|
cy="48"
|
||||||
|
r="9.8000002"/><path
|
||||||
|
class="pan-to" [ngClass]="{'pan-to-centered':centered(),'pan-to-disabled':disabled()}"
|
||||||
|
d="M 80.5,44.8 H 73.8 C 72.3,33 63,23.7 51.3,22.2 v -6.7 h -6.5 v 6.7 C 33,23.7 23.7,33 22.2,44.8 h -6.7 v 6.5 h 6.7 C 23.7,63 33,72.3 44.8,73.8 v 6.7 h 6.5 V 73.8 C 63,72.3 72.3,63 73.8,51.3 h 6.7 z M 48,67.5 C 37.2,67.5 28.5,58.8 28.5,48 28.5,37.2 37.2,28.5 48,28.5 c 10.8,0 19.5,8.7 19.5,19.5 0,10.8 -8.7,19.5 -19.5,19.5 z"
|
||||||
|
inkscape:connector-curvature="0"/></g>
|
||||||
|
</svg>
|
||||||
|
</div>
|
@@ -0,0 +1,37 @@
|
|||||||
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
|
|
||||||
|
|
||||||
|
.gps-location {
|
||||||
|
display:block;
|
||||||
|
width:2.5em;
|
||||||
|
height:2.5em;
|
||||||
|
background-color: $body-bg;
|
||||||
|
background-size: contain;
|
||||||
|
margin-top:0.5em;
|
||||||
|
border-radius: 1.75em;
|
||||||
|
padding:0
|
||||||
|
}
|
||||||
|
|
||||||
|
.center, .tolerance, .border {
|
||||||
|
stroke-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pan-to {
|
||||||
|
fill: $secondary;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.gps-location:hover .pan-to {
|
||||||
|
fill: $white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pan-to-centered {
|
||||||
|
fill: $primary;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.gps-location:hover .pan-to-centered {
|
||||||
|
fill: theme-color-level($color-name: "primary", $level: -10)
|
||||||
|
}
|
||||||
|
|
||||||
|
.pan-to.pan-to-disabled {
|
||||||
|
fill: $gray-300;
|
||||||
|
}
|
@@ -0,0 +1,84 @@
|
|||||||
|
import { Component, OnInit, Input, Host, OnChanges, SimpleChanges,ChangeDetectorRef } from '@angular/core';
|
||||||
|
import { MapComponent } from 'ngx-openlayers';
|
||||||
|
import {IMapState} from '../../../models/map.state'
|
||||||
|
import {View} from 'ol';
|
||||||
|
import { fromLonLat } from 'ol/proj';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'fm-map-pan-to-location',
|
||||||
|
templateUrl: './pan-to-location.component.html',
|
||||||
|
styleUrls: ['./pan-to-location.component.scss']
|
||||||
|
})
|
||||||
|
export class PanToLocation implements OnInit,OnChanges{
|
||||||
|
|
||||||
|
view: View;
|
||||||
|
map: MapComponent;
|
||||||
|
@Input() position: Position;
|
||||||
|
@Input() mapState: IMapState;
|
||||||
|
@Input() animate: boolean;
|
||||||
|
|
||||||
|
constructor(@Host() map: MapComponent,private changeDetectorRef$: ChangeDetectorRef ) {
|
||||||
|
this.map = map;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.view = this.map.instance.getView();
|
||||||
|
this.view.on('change:center', () => {
|
||||||
|
this.changeDetectorRef$.detectChanges();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
// if (changes.position && this.instance) {
|
||||||
|
// var p = changes.position.currentValue as Position;
|
||||||
|
// this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude]));
|
||||||
|
// this.locationTolerance = p.coords.accuracy;
|
||||||
|
// this.recalcLocationTolerance();
|
||||||
|
// this.heading = p.coords.heading;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
p
|
||||||
|
|
||||||
|
public centered():boolean {
|
||||||
|
if(this.position && this.mapState) {
|
||||||
|
let center = this.view.getCenter();
|
||||||
|
let newCenter = fromLonLat([this.position.coords.longitude,this.position.coords.latitude]);
|
||||||
|
let x1 = newCenter[0].toFixed(0);
|
||||||
|
let x2 = center[0].toFixed(0);
|
||||||
|
let y1 = newCenter[1].toFixed(0);
|
||||||
|
let y2 = center[1].toFixed(0);
|
||||||
|
return x1==x2 && y1==y2;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public disabled():boolean {
|
||||||
|
return !this.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleClick(event:Event) {
|
||||||
|
if(this.position) {
|
||||||
|
let view = this.map.instance.getView();
|
||||||
|
let newCenter = fromLonLat([this.position.coords.longitude,this.position.coords.latitude]);
|
||||||
|
let extent = [newCenter[0]-500,newCenter[1]-500,newCenter[0]+500,newCenter[1]+500];
|
||||||
|
var options = { padding: [0, 0, 0, 0],minResolution:1 };
|
||||||
|
let size = this.map.instance.getSize();
|
||||||
|
let rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
||||||
|
let threshold = 44 * rem;
|
||||||
|
var left = 1 * rem;
|
||||||
|
var right = 1 * rem;
|
||||||
|
var bottom = Math.round(size[1] / 2);
|
||||||
|
var top = 1 * rem;
|
||||||
|
if (size[0] > threshold) {
|
||||||
|
bottom = 1 * rem;
|
||||||
|
left = 23 * rem;
|
||||||
|
}
|
||||||
|
//options.padding = [top, right, bottom, left];
|
||||||
|
if (this.animate) options["duration"] = 2000;
|
||||||
|
view.fit(extent, options);
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,35 @@
|
|||||||
|
<div (click)="handleClick($event)" class="btn btn-outline-secondary compass" [style.transform]="Rotation()" [ngClass]="{'compass-n':IsNorth()}">
|
||||||
|
<svg height="100%" width="100%" viewBox="0 0 132.29166 132.29167">
|
||||||
|
<g
|
||||||
|
inkscape:label="Laag 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-164.70832)">
|
||||||
|
<g
|
||||||
|
id="g4550"
|
||||||
|
transform="translate(2.3213753,-1.8555167)">
|
||||||
|
<path
|
||||||
|
id="top-r"
|
||||||
|
d="m 63.824458,179.82737 v 52.8823 H 48.380953 Z"
|
||||||
|
style="stroke:none;stroke-width:0.15389842px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||||
|
<path
|
||||||
|
id="top-l"
|
||||||
|
d="m 63.824458,179.82737 v 52.8823 h 15.443505 z"
|
||||||
|
style="stroke:none;stroke-width:0.15389842px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||||
|
<path
|
||||||
|
id="bottom-l"
|
||||||
|
d="m 63.824458,285.59197 v -52.8823 h -15.4435 z"
|
||||||
|
style="stroke:none;stroke-width:0.15389842px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||||
|
<path
|
||||||
|
id="bottom-r"
|
||||||
|
d="m 63.824458,285.59197 v -52.8823 h 15.443505 z"
|
||||||
|
style="stroke:none;stroke-width:0.15389842px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
|
||||||
|
|
||||||
|
<path
|
||||||
|
id="north"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:2.95481014"
|
||||||
|
d="m 50.702335,239.32724 h 9.926315 l 12.534859,23.63848 v -23.63848 h 8.425825 v 34.46509 H 71.663019 L 59.12816,250.15385 v 23.63848 h -8.425825 z" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</div>
|
@@ -0,0 +1,67 @@
|
|||||||
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
|
|
||||||
|
.compass {
|
||||||
|
width:2.5em;
|
||||||
|
height:2.5em;
|
||||||
|
background-color: white;
|
||||||
|
opacity: 1;
|
||||||
|
border-radius:1.75em;
|
||||||
|
padding:0;
|
||||||
|
margin-top:0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#north {
|
||||||
|
display: none;
|
||||||
|
fill:$black;
|
||||||
|
}
|
||||||
|
|
||||||
|
#top-l {
|
||||||
|
fill:#d40000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#top-r {
|
||||||
|
fill:#ff0000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bottom-l {
|
||||||
|
fill:#000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bottom-r {
|
||||||
|
fill:#666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.compass:hover #top-l {
|
||||||
|
fill:$white;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.compass:hover #top-r {
|
||||||
|
fill:$gray-300;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.compass:hover #bottom-l {
|
||||||
|
fill:$gray-300;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.compass:hover #bottom-r {
|
||||||
|
fill:$white;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.compass:hover #north {
|
||||||
|
fill:$white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compass-n {
|
||||||
|
transition: opacity 1s ease-out 2s,height 1s ease-out 3s,margin-top 1s ease-out 3s;
|
||||||
|
opacity:0;
|
||||||
|
height:0;
|
||||||
|
margin-top:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compass-n #bottom-l, .compass-n #bottom-r {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compass-n #north {
|
||||||
|
display: inline;
|
||||||
|
}
|
@@ -1,53 +1,39 @@
|
|||||||
import { Component, Host, Input, OnInit, ChangeDetectorRef } from '@angular/core';
|
import { Component, Host, Input, OnInit, ChangeDetectorRef } from '@angular/core';
|
||||||
import { ViewComponent, MapComponent } from 'ngx-openlayers';
|
import { ViewComponent, MapComponent } from 'ngx-openlayers';
|
||||||
|
|
||||||
import {View} from 'ol';
|
import {View} from 'ol';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-rotation-reset',
|
selector: 'fm-map-rotation-reset',
|
||||||
template: `<div (click)="handleClick($event)" class="rounded-circle compass" [style.transform]="Rotation()" [ngClass]="{'compass-n':IsNorth()}"></div>`,
|
templateUrl: './rotation-reset.component.html',
|
||||||
styles: [`.compass {
|
styleUrls: ['./rotation-reset.component.scss']
|
||||||
width:2.5em;
|
})
|
||||||
height:2.5em;
|
export class RotationResetComponent implements OnInit {
|
||||||
background-color: white;
|
view: View;
|
||||||
background-size: contain;
|
|
||||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAF6AAABegB0iYb4wAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAmlSURBVHic7d39c1xVHcfxz92kCVh0BojVRpABRGBAKj6P4+io1LYp/hv9O/I/dNqmmU2mP9sf7SMFsSBaRMU+ZUAFB8HC1FKqJLR52D3+cJNm0ySb3XvPOd9zN+/XTGfa3eTe76T7yT3n3Hu/VwIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMlz0iMXpEes68CymnUBWGGkJu2xLgLLCEha9i7+AdDKSXc76bNL0s0/SZ+zrgc5jiDpeE7S3ZLuGpR+Zl0McgQkHSNLf6m1/B22CEg6bk/OnfS8ZSFYRkAS4KRvSHqo5aUHp6SnrerBMgKShlUrV01Ws5JAQNKwas7hmIckIbMuYLNz0r2Srkrql6TLi69nUkPStqek61a1gSNICnZpMRytnNTXlHYa1IMWBMTeunONGvMQcwTEkMt//r9o8/4ex/+RKX74tr4naVub94empO/GKgarERBbGw6hHMMsUwTEFgFJHAEx4qTtkr650ddl0rNvScMRSsIaCIidEXV2Hiqbl3aHLgZrIyB2Oh46ZQyzzHAm3YCTBiRdk/T5O9+7vPrLJWl6UBp6TJoNWxnuxBHExo+1RjjauGdO+lGoYrA+AmKj6wsRuXjRBgGx0fWcgnmIDQISmcv7Xn29wPc9fln6WoCS0AYBie+XRb+xyTArOgISX+EPeUZAomOZNyInbVW+vHvXel+zzjLvktlMGnpKmvZbGdbDESSu59QmHB0YFD2zoiIgcZVeieLixbgISFy7PGxjxDE0joaAROKkHZK+6mFTD1zK+2ghAgISj7ehEfeqx0NA4vH2oWYeEg9j2QicdJ/y3ld9G33tBsu8kvKeWTXpS09KH5cuDm1xBIljtzoIR6ec1Ndo0w0F/hCQOLwPiRhmxUFAAnP5kcPH8u4KmbTnVx6PSlgbAQnvB5LuD7Dd+56Uvh9gu2hBQMILdoEhT6IKj4CEF2yuwDwkPAISkMv7WT0TcBc7zksPBNz+pkdAwnpeYc81ZX0tzzaEfwQkrOBzBJo5hMWZ9EBcfu/Gf9Rde5+OzqTfYWZQup+eWWFwBAnnJ+oyHAVtvZX32UIABCScaEMf7lUPh4CEE/NDW7hTCtojIAG4vO/VYxF3+ehU3P1tGgQkjOgn8JqcNAyCgIQRfU7APCQMlnk9c9I9yntfDRb5/gLLvEvm+qWhJ6RPi28Cd+II4t9OFQxHSQNN6ecG++1pBMQ/s7kA8xD/CIhHi/2qLJ8nuJeeWX4REL+elfQVw/1vn+rgybnoHAHxy3wliUck+EVA/DKfA9BUzi/Gq544aUjSRyrZSKHEMu+SZkPaviPvw4WSOIL4s0dpdBmp1eiZ5Q0B8SeZsT9n1f0hIB4s9r7aaV1Hi90vS/3WRfQCAuLHDxWm91VR927L+3GhJALiR3JDGpZ7/SAgfiS3tJolWFMVEZCSnPSgpKet61jDM1PSQ9ZFVB0BKW+vEj2f5GyvC+sJBKS8ZMf69MwqL8nffFWx2PvqmvKbpLzwcCa91cxWaehh6ZbfzW4eHEHK+ak8hiOArTN5fy4UREDKSX6liA7w5RCQcpJvHF3LG2ijIAJSkJOekPSodR0bcdLD56XHreuoKgJSXGWGLv0VqjU1BKS4ynzomIcUxzJvAU76gvJHGwz43rbnZd4l87ekL35H+m+YzfcujiDF7FSAcAS0ZZCeWYUQkGIqN2ThXvViCEiXFvtO7bKuo1tOGqFnVvcISPe+rfzptVXz5YvSt6yLqBpuy+xS6F/B+/btC7btZrMp1evBtt+LOIJ078+SrlgXUcBH9Xr9L9ZFVA0B6Z6TdNq6iAJOKK8dXSAgxRy3LqBbWZZVruYUEJBizkiasy6iC/POuZesi6giAlLM/yS9Zl1Ep7Ise3V8fJyz6AUQkOKqNGSpUq1JISDFVeZDV6vVKlNraghIcW9Jese6iA7889ChQ29bF1FVBKSck9YFbMQ5d8y6hiojIOVUYehShRqTRUDKeVnStHURbczMz8+ftS6iyghIObPKQ5Kql44cOUJPrBIISHknrAtoI+XaKoGAlHdciV7j1Gg0TlnXUHUEpLz3JV2yLmINFyYmJt6zLqLqCIgfya0UcXGiHwTEj+TG+s655GqqIgLix+8lfWxdRItPhoeHz1kX0QsIiB8N5ZfAJ8E5d2p0dHTBuo5eQED8SWZIU6vVkqml6giIPyeVH0msNbMse8G6iF5BQPy5JukN6yIkvT42NnbVuoheQUD8SmFpNYUaegYB8ct87M/8wy8C4tebkv5tuP8Px8bG/mq4/55DQPxykiyvf0r2urCqIiD+Wc4BmH94RkD8O6P8PpHY5hYWFuh95RkB8W9a0quxd+qcOzs5Oflp7P32OgISRvSVpCzLWL0KgICEEX0uwOXtYRCQMP4m6e8R9/fO4cOHY+5v0yAg4cQc8vw64r42FQISTrSAMP8Ih4CEc1ZSjFWlmYGBgVci7GdTIiDhzEr6TYT9nNm/f7/FeZdNgYCEFXzow73nYRGQsI4p7LVRzjmXfAPtKiMgYV2RdCHg9s/X6/UPAm5/0yMg4YU8gcfJwcAISHjB5gjMP8IjIOGdU5ieWddv3LjxeoDtogUBCa8h6bTvjWZZdvLo0aMpdFHpaQQkjhBzBeYfERCQOE7Jb8+sRn9/P72vIiAgcVyX5G2+4Jw7d+DAgZR6AfcsAhKPzyERw6tICEg83j7UzjkCEgkBiee8pH952M4H9Xr9ooftoAMEJC4fy70nRO+raAhIXKWHRgyv4iIgcb0oqcxzy2e3bNkS4x4TLCIgcc1IKnz3X5Zlvz148OC0x3qwAQISX+ELDLk4MT4CEl/hDiSNRoOAREZA4ntXed+sbr09MTHxD9/FoD0CYqPrlShWr2wQEBtdD5V4cpQNAmLjFXXXM2t6YGDgd6GKwfoIiI055edEOvUCva9sEBA7Hc8pmH/YISB2Or2myjUaDcvnHm5qBMTOh5I6eSLtm5OTk1dCF4O1ERBbnQydGF4ZIiC2CEjiCIitP0q62ub9a8PDw2/EKgarERBbTUntupOcHB0dbcYqBqsREHvrDqF4MKc9AmLvtKSFNV5vLCwsnIldDFYiIPY+kfSHNV5/bWJi4nrsYrASAUnDqgsReTBnGghIGlbNNZh/pIGApOGipPda/v3+2NjYJatisIyApKP1WYPHzKrACgQkHbfnHDRnSEe/dQG47UVJNyVlWZbR+yoRBCQdNyWdleTGx8c/sy4GOQKSluOi725SCEhaTvT19VnXAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOvB/FOHOpgoUlk8AAAAASUVORK5CYII=);
|
public Rotation() {
|
||||||
opacity: 1;
|
let rotation = this.view ? this.view.getRotation() : 0;
|
||||||
}
|
return `rotate(${rotation}rad)`;
|
||||||
.compass-n {
|
}
|
||||||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAF6AAABegB0iYb4wAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAe9SURBVHic7d07jB1XHcfx712vDXYinDhegw2YOOERYhzLxAhhAhhE4sSORUdDKioaKpoIEBHhIR4NSomgBEEdCQqKCImKAhHwxilAbpASiC3iOMkGr3cPxXizu/Zd37kz5zW734+0ze6Zmb/u3d89Z87MnAuSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSpE0qwCjAqHQdWjVTugCtc3QeHihdhFbNli5A65wJEIDnSxeihj1IXc6M4EzpIqTqBNgT4No8XDsPd5WuRw17kHo8BmwLsG0ZTpUuRg0DUo+3h1bBYZa0KjQ9x8UA4Vzzc+k5J1CqYA9Sh0+x/rxjzxx8slQxWmVA6nD6xl+MxvxO+RmQOtx0zuF5SB0MSGEB3gccGfOno/NwMHc9Ws+AlHeGje+/ejRnIbqZASlvw3ON4HlIcd45WlCAdwAXgdtXfje/vskbt8HeQ/BW3sq0wh6krJOsCccYt70On81Ui8YwIGVNHELNOMwqyoCUNfGfP8DZHIVoPANSSICPAB9s0fSe8/Dh1PVoPANSTusLgUteNCzGgJQzzT+9ASnEad4CQjNzdZFmmned+ZubA1ydhb33wZW0lelG9iBlPMKYcNzCjkX4YqpitDEDUsbUQ6YZh1lFGJDMrq97NfU9VgFOu2ZWfgYkv48DBzpst/88HItdjG7NgOTX+cr4slfVszMg+XU+l/Ahqvwc02YUYA54mVt8MG0wzbtieQn2H4X/xK1MG7EHyesx+r3mMzOumZWVAcmr9zmEiznkZUAyCbANeDjCrk65ZlY+BiSfTwN7Iuznzn3NOlrKwIDkE21o5LPq+RiQfKJN0foVCfkYkAwCvB/4WMT9HXkBPhBrf9qYAcnj8dg7XGqmjJWYAckj+jmD0715eCU9sQDvBC4Bu9q0n3Al/W0jWLgMd52Ahc7FaSJ7kPQ+T8twTCPAzt3wudj71XoGJL1kM07evJieAUkv2QLUTvemZ0ASCvBR4N6E+z/0N7gv1f5lQFJL/gm/zV4kKQOSVvJ/Xs9D0nKaN5EA76JZ+2r7NNu1neZdY3ER9h2DV6ffVJPYg6RziinD0dH2Ha6ZlYwBSSfblW4Xc0jHgCQQmtc12/cLjuBM8L1Mwhc1jQeB92Q83r5zzXpbisyApJF9ZsmlSdMwIGlkPyfwKcM0nOaNLMA+4CU6fvh0mOZdsRzgwBH4d/dd6Eb2IPGdpszrOjPKODGwVRiQ+IoNdRxmxecQK6LQrFf1CnBH1330GGIxgssLMHccFnvsRmvYg8T1ED3C0VeA3TvgRKnjb0YGJK7iU63e3RuXAYmr+DmA5yFxGZBIAhwE7i9dB3D4PNxduojNwoDEc7Z0ASuW7EWiMSDxVDP29yGqeJzmjSDATpqHo3ov79NnmnfFCBYWYO9xeDPC7rY0e5A4vkCCta+6CrBzF5wsXcdmYEDiqG5Is1xhTUNkQOKocSHp6Atmb0UGpKfQfK3B3aXrGOPgPBwuXcTQGZD+qp1S9Vn1/gxIf9WO9X3KsD+neXsIsJvm7t1oy/vEmOZd49oizLlmVnf2IP08Sp61r7qanYVHShcxZAakn+rH+H4TVT8GpKPr61CdKl3HJCM47ZpZ3fnCdfcJ4N2li5gkwNwLcLx0HUNlQLobzAyRNy92Z0C6G9LYfki1VsWAdBCaZUWHtNTngy/CgdJFDJEB6eY0w7qGNFoawIRCjQxIN4Mb03se0s2QPgWrEJoLg6/QXEWPLvKV9LVeG8HcYbia7hCbz2zpAgbofuAfqXae8hPr+rfuPp/wEJIkSZIkSZIkSZI0fN5q0s+dwB+m3OYtmpsdX+tx3GeB/S3bPgz8t8expM7mgNDh5+mex70wxbHmeh5L6qxrQK7Q73FdA5KJt7uXcTvwzdJFaDIDUs7XgHtKF6FbMyDl7ACeKl2Ebs2AlPUEcLR0EdqYASlrBvhu6SK0MQNS3peAE6WL0HgGpA4/Kl2AxjMgdfgMzUrxqowBqceP8f2ojm9IPR4Avly6CK1nQOryNHV/Ic+WY0DyuQRcntDmQ8BXM9SilgxIPleAn7Zo9xSwK3EtasmA5PUz4OUJbfYDX89Qi1owIHm9AXy/RbsngT2Ja1ELBiS/nwP/nNDmDuAbGWqRkprmgakLa7Z7okX7N4H3bnBcH5jKxB6kjF8Df53QZic+VKWB69qDAJxtsc1V4N4xx7UHycQepJxngT9OaLMdb4fXgPXpQQAearHdEnDshu3sQTKxBynrT8DvJrSZAb6XoRYpur49CMARml5i0vYn12xjD5KJPUh5fwd+06JdmwuMUlVi9CAAh4D/tdjH49fb24NkYg9ShwvAL1u0+yG+ZxqQWD0INDcpvt5iP1/BHiQbP43q8RLwTIt2PlSlwYjZg0Bzk+KlKfZpD5KYPUhdXgV+UroIrTIg9XkG+FfpItQwIPVZAH5Qugg1DEidfgG8WLoIGZBaXcO7eKtgQOr1W+AvpYvY6gxIvQLw7dJFbHUGpG6/B54rXcRWZkDq9yRNb6ICDEj9/kzzeK4KMCDD8C2ah6qUmQEZhnPAr0oXsRUZkOH4Ds1DVZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkbSX/B0lc8D0skvAeAAAAAElFTkSuQmCC);
|
|
||||||
transition: opacity 1s ease-out;
|
public IsNorth() {
|
||||||
transition-delay: 2s;
|
return this.view ? this.view.getRotation() == 0 : true;
|
||||||
opacity:0;
|
}
|
||||||
}
|
|
||||||
`]
|
ngOnInit(): void {
|
||||||
})
|
this.view = this.map.instance.getView();
|
||||||
export class RotationResetComponent implements OnInit {
|
this.view.on('change:rotation', () => {
|
||||||
view: View;
|
this.changeDetectorRef$.detectChanges();
|
||||||
|
});
|
||||||
public Rotation() {
|
}
|
||||||
let rotation = this.view ? this.view.getRotation() : 0;
|
|
||||||
return `rotate(${rotation}rad)`;
|
constructor( @Host() private map: MapComponent, private changeDetectorRef$: ChangeDetectorRef ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IsNorth() {
|
handleClick(event:Event) {
|
||||||
return this.view ? this.view.getRotation() == 0 : true;
|
this.view.animate({ rotation: 0 });
|
||||||
}
|
event.preventDefault();
|
||||||
|
}
|
||||||
ngOnInit(): void {
|
}
|
||||||
this.view = this.map.instance.getView();
|
|
||||||
this.view.on('change:rotation', () => {
|
|
||||||
this.changeDetectorRef$.detectChanges();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor( @Host() private map: MapComponent, private changeDetectorRef$: ChangeDetectorRef ) {
|
|
||||||
}
|
|
||||||
|
|
||||||
handleClick(event:Event) {
|
|
||||||
this.view.animate({ rotation: 0 });
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -1,39 +1,39 @@
|
|||||||
import { Component, Host, Input, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core';
|
import { Component, Host, Input, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core';
|
||||||
import { ViewComponent, MapComponent } from 'ngx-openlayers';
|
import { ViewComponent, MapComponent } from 'ngx-openlayers';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-zoom-to-extent',
|
selector: 'fm-map-zoom-to-extent',
|
||||||
template: `<ng-content></ng-content>`
|
template: `<ng-content></ng-content>`
|
||||||
})
|
})
|
||||||
export class ZoomToExtentComponent implements OnChanges {
|
export class ZoomToExtentComponent implements OnChanges {
|
||||||
view: ViewComponent;
|
view: ViewComponent;
|
||||||
map: MapComponent;
|
map: MapComponent;
|
||||||
@Input() extent: number[];
|
@Input() extent: number[];
|
||||||
@Input() animate: boolean = false;
|
@Input() animate: boolean = false;
|
||||||
|
|
||||||
constructor(@Host() view: ViewComponent, @Host() map: MapComponent) {
|
constructor(@Host() view: ViewComponent, @Host() map: MapComponent) {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
this.map = map;
|
this.map = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
if (this.extent) {
|
if (this.extent) {
|
||||||
var options = { padding: [0, 0, 0, 0],minResolution:1 };
|
var options = { padding: [0, 0, 0, 0],minResolution:1 };
|
||||||
let size = this.map.instance.getSize();
|
let size = this.map.instance.getSize();
|
||||||
let rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
let rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
||||||
let threshold = 44 * rem;
|
let threshold = 40 * rem;
|
||||||
var left = 1 * rem;
|
var left = 1 * rem;
|
||||||
var right = 1 * rem;
|
var right = 1 * rem;
|
||||||
var bottom = Math.round(size[1] / 2);
|
var bottom = Math.round(size[1] / 2);
|
||||||
var 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;
|
||||||
}
|
}
|
||||||
options.padding = [top, right, bottom, left];
|
options.padding = [top, right, bottom, left];
|
||||||
if (this.animate) options["duration"] = 2000;
|
if (this.animate) options["duration"] = 2000;
|
||||||
this.view.instance.fit(this.extent, options);
|
this.view.instance.fit(this.extent, options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,19 +1,18 @@
|
|||||||
@import "../../_theme.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
|
||||||
|
|
||||||
|
|
||||||
|
.row {
|
||||||
.row {
|
border-bottom: 1px solid gray('500');
|
||||||
border-bottom: 1px solid gray('500');
|
user-select: none;
|
||||||
user-select: none;
|
}
|
||||||
}
|
|
||||||
|
.row:hover {
|
||||||
.row:hover {
|
background-color: gray('100');
|
||||||
background-color: gray('100');
|
}
|
||||||
}
|
|
||||||
|
@media screen and (min-width: 44rem) {
|
||||||
@media screen and (min-width: 44rem) {
|
.feature-list-container {
|
||||||
.feature-list-container {
|
margin-top: 4rem;
|
||||||
margin-top: 4rem;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@@ -1,59 +1,59 @@
|
|||||||
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
|
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
import { FeatureListComponent,AbstractFeatureListComponent } from '../feature-list/feature-list.component';
|
import { FeatureListComponent,AbstractFeatureListComponent } from '../feature-list/feature-list.component';
|
||||||
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
||||||
import {IQueryState } from '../../models/query.state';
|
import {IQueryState } from '@farmmaps/common';
|
||||||
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 { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-feature-list-container',
|
selector: 'fm-map-feature-list-container',
|
||||||
templateUrl: './feature-list-container.component.html',
|
templateUrl: './feature-list-container.component.html',
|
||||||
styleUrls: ['./feature-list-container.component.scss']
|
styleUrls: ['./feature-list-container.component.scss']
|
||||||
})
|
})
|
||||||
export class FeatureListContainerComponent {
|
export class FeatureListContainerComponent {
|
||||||
|
|
||||||
constructor(private store: Store<mapReducers.State>,private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractFeatureListComponent) public featureLists: AbstractFeatureListComponent[] ) {
|
constructor(private store: Store<mapReducers.State>,private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractFeatureListComponent) public featureLists: AbstractFeatureListComponent[] ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input() features: Array<Feature>
|
@Input() features: Array<Feature>
|
||||||
@Input() queryState: IQueryState;
|
@Input() queryState: IQueryState;
|
||||||
|
|
||||||
@ViewChild(WidgetHostDirective) widgetHost: WidgetHostDirective;
|
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
|
||||||
|
|
||||||
loadComponent(queryState:IQueryState) {
|
loadComponent(queryState:IQueryState) {
|
||||||
var componentFactory: ComponentFactory<AbstractFeatureListComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListComponent); // default
|
var componentFactory: ComponentFactory<AbstractFeatureListComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListComponent); // default
|
||||||
var selected = -1;
|
var selected = -1;
|
||||||
for (var i = 0; i < this.featureLists.length; i++) {
|
for (var i = 0; i < this.featureLists.length; i++) {
|
||||||
if (this.featureLists[i]['forItemType'] == queryState.itemType && this.featureLists[i]['forChild'] && queryState.parentCode && queryState.parentCode != "") {
|
if (this.featureLists[i]['forItemType'] == queryState.itemType && this.featureLists[i]['forChild'] && queryState.parentCode && queryState.parentCode != "") {
|
||||||
selected = i;
|
selected = i;
|
||||||
break;
|
break;
|
||||||
} else if (this.featureLists[i]['forItemType'] == queryState.itemType) {
|
} else if (this.featureLists[i]['forItemType'] == queryState.itemType) {
|
||||||
selected = i;
|
selected = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (selected >= 0) {
|
if (selected >= 0) {
|
||||||
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.featureLists[i]['constructor'] as any);
|
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.featureLists[i]['constructor'] as any);
|
||||||
if (this.featureLists[selected]['collapseSearch'] === true) {
|
if (this.featureLists[selected]['collapseSearch'] === true) {
|
||||||
this.store.dispatch(new mapActions.CollapseSearch());
|
this.store.dispatch(new mapActions.CollapseSearch());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const viewContainerRef = this.widgetHost.viewContainerRef;
|
const viewContainerRef = this.widgetHost.viewContainerRef;
|
||||||
viewContainerRef.clear();
|
viewContainerRef.clear();
|
||||||
|
|
||||||
const componentRef = viewContainerRef.createComponent(componentFactory);
|
const componentRef = viewContainerRef.createComponent(componentFactory);
|
||||||
(<AbstractFeatureListComponent>componentRef.instance).features = this.features;
|
(<AbstractFeatureListComponent>componentRef.instance).features = this.features;
|
||||||
(<AbstractFeatureListComponent>componentRef.instance).queryState = this.queryState;
|
(<AbstractFeatureListComponent>componentRef.instance).queryState = this.queryState;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
if (changes["features"] && changes["features"].currentValue) {
|
if (changes["features"] && changes["features"].currentValue) {
|
||||||
if (this.queryState) {
|
if (this.queryState) {
|
||||||
this.loadComponent(this.queryState);
|
this.loadComponent(this.queryState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
<div *ngIf="features;let features">
|
<div *ngIf="features;let features">
|
||||||
<div class="card border-0">
|
<div class="card border-0">
|
||||||
<div class="card-body" *ngIf="(schemeItem|async);let schemeItem">
|
<div class="card-body" *ngIf="(schemeItem|async);let schemeItem">
|
||||||
<div><a href="#" (click)="handleBackClick($event)" i18n>back</a></div>
|
<div><a href="#" (click)="handleBackClick($event)" i18n>back</a></div>
|
||||||
<h4 i18n>Farm</h4>
|
<h4 i18n>Farm</h4>
|
||||||
<h3>{{schemeItem.name}}</h3>
|
<h3>{{schemeItem.name}}</h3>
|
||||||
<div class="cropfields">
|
<div class="cropfields">
|
||||||
<div class="row m-0" *ngFor="let feature of features" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
|
<div class="row m-0 pl-3 pr-3" *ngFor="let feature of features" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
|
||||||
<fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
|
<fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,23 +1,22 @@
|
|||||||
@import "../../_theme.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
|
||||||
|
fm-map-feature-list-feature-container {
|
||||||
feature-list-feature-container {
|
width:100%;
|
||||||
width:100%;
|
pointer-events:none;
|
||||||
pointer-events:none;
|
}
|
||||||
}
|
|
||||||
|
.row {
|
||||||
.row {
|
border-bottom: 1px solid gray('500');
|
||||||
border-bottom: 1px solid gray('500');
|
user-select: none;
|
||||||
user-select: none;
|
padding-left:1.5rem;
|
||||||
padding-left:1.5rem;
|
}
|
||||||
}
|
|
||||||
|
.row:hover {
|
||||||
.row:hover {
|
background-color: gray('100');
|
||||||
background-color: gray('100');
|
}
|
||||||
}
|
|
||||||
|
.cropfields {
|
||||||
.cropfields {
|
border-top: 1px solid gray('500');
|
||||||
border-top: 1px solid gray('500');
|
margin-left: -1.25rem;
|
||||||
margin-left: -1.5rem;
|
margin-right: -1.25rem;
|
||||||
margin-right: -1.5rem;
|
}
|
||||||
}
|
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
<div *ngIf="features;let features">
|
<div *ngIf="features;let features">
|
||||||
<div class="card border-0">
|
<div class="card border-0">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div><a href="#" (click)="handleBackClick($event)" i18n>Back</a></div>
|
<div><a href="#" (click)="handleBackClick($event)" i18n>Back</a></div>
|
||||||
<h3 i18n><i class="fm fm-farm"></i> Farms</h3>
|
<h3 i18n><i class="fm fm-farm"></i> Farms</h3>
|
||||||
<div class="farms">
|
<div class="farms">
|
||||||
<div class="row m-0" *ngFor="let feature of features" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
|
<div class="row m-0 pl-3 pr-3" *ngFor="let feature of features" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
|
||||||
<fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
|
<fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,23 +1,22 @@
|
|||||||
@import "../../_theme.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
|
||||||
|
fm-map-feature-list-feature-container {
|
||||||
feature-list-feature-container {
|
width:100%;
|
||||||
width:100%;
|
pointer-events:none;
|
||||||
pointer-events:none;
|
}
|
||||||
}
|
|
||||||
|
.row {
|
||||||
.row {
|
border-bottom: 1px solid gray('500');
|
||||||
border-bottom: 1px solid gray('500');
|
user-select: none;
|
||||||
user-select: none;
|
padding-left:1.5rem;
|
||||||
padding-left:1.5rem;
|
}
|
||||||
}
|
|
||||||
|
.row:hover {
|
||||||
.row:hover {
|
background-color: gray('100');
|
||||||
background-color: gray('100');
|
}
|
||||||
}
|
|
||||||
|
.farms {
|
||||||
.farms {
|
border-top: 1px solid gray('500');
|
||||||
border-top: 1px solid gray('500');
|
margin-left: -1.25rem;
|
||||||
margin-left: -1.5rem;
|
margin-right: -1.25rem;
|
||||||
margin-right: -1.5rem;
|
}
|
||||||
}
|
|
||||||
|
@@ -1,43 +1,43 @@
|
|||||||
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
|
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
import { AbstractFeatureListFeatureComponent,FeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
|
import { AbstractFeatureListFeatureComponent,FeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
|
||||||
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-feature-list-feature-container',
|
selector: 'fm-map-feature-list-feature-container',
|
||||||
template: `
|
template: `
|
||||||
<div>
|
<div>
|
||||||
<ng-template fm-map-widget-host></ng-template>
|
<ng-template fm-map-widget-host></ng-template>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class FeatureListFeatureContainerComponent {
|
export class FeatureListFeatureContainerComponent {
|
||||||
|
|
||||||
constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractFeatureListFeatureComponent) public featureLists: AbstractFeatureListFeatureComponent[] ) {
|
constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractFeatureListFeatureComponent) public featureLists: AbstractFeatureListFeatureComponent[] ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input() feature: Feature;
|
@Input() feature: Feature;
|
||||||
|
|
||||||
@ViewChild(WidgetHostDirective) widgetHost: WidgetHostDirective;
|
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
|
||||||
|
|
||||||
loadComponent() {
|
loadComponent() {
|
||||||
var componentFactory: ComponentFactory<AbstractFeatureListFeatureComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListFeatureComponent); // default
|
var componentFactory: ComponentFactory<AbstractFeatureListFeatureComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListFeatureComponent); // default
|
||||||
for (var i = 0; i < this.featureLists.length; i++) {
|
for (var i = 0; i < this.featureLists.length; i++) {
|
||||||
if (this.featureLists[i]['forItemType'] == this.feature.get("itemType")) {
|
if (this.featureLists[i]['forItemType'] == this.feature.get("itemType")) {
|
||||||
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.featureLists[i]['constructor'] as any);
|
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.featureLists[i]['constructor'] as any);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const viewContainerRef = this.widgetHost.viewContainerRef;
|
const viewContainerRef = this.widgetHost.viewContainerRef;
|
||||||
viewContainerRef.clear();
|
viewContainerRef.clear();
|
||||||
|
|
||||||
const componentRef = viewContainerRef.createComponent(componentFactory);
|
const componentRef = viewContainerRef.createComponent(componentFactory);
|
||||||
(<AbstractFeatureListFeatureComponent>componentRef.instance).feature = this.feature;
|
(<AbstractFeatureListFeatureComponent>componentRef.instance).feature = this.feature;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
if (changes["feature"] && changes["feature"].currentValue) {
|
if (changes["feature"] && changes["feature"].currentValue) {
|
||||||
this.loadComponent();
|
this.loadComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,12 @@
|
|||||||
<div *ngIf="feature;let feature" class="row m-0">
|
<div *ngIf="feature;let feature" class="d-flex m-0">
|
||||||
<div class="col p-2">
|
<div class="p-2">
|
||||||
<h1 class="card-title" title="{{feature.get('name')}}">{{feature.get('name')}}</h1>
|
<div #container class="thumbnail">
|
||||||
<div class="card-text"><span>{{feature.get('datadate')|date}}</span> - <span>{{feature.get('dataenddate')|date}}</span> </div>
|
<canvas #canvas ></canvas>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex-grow p-2 overflow-hidden">
|
||||||
|
<h1 class="card-title" title="{{feature.get('name')}}">{{feature.get('name')}}</h1>
|
||||||
|
<div class="card-text"><span>{{areaInHa(feature)| number:'1.2-2'}} ha</span> <span>{{feature.get('cropTypeName')}}</span> </div>
|
||||||
|
<div class="card-text"><span>{{feature.get('datadate')|date}}</span> - <span>{{feature.get('dataenddate')|date}}</span> </div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@@ -1,30 +1,26 @@
|
|||||||
@import "../../_theme.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
|
||||||
|
|
||||||
|
|
||||||
|
.card-title {
|
||||||
.card-title {
|
font-size: 1rem;
|
||||||
font-size: 1rem;
|
white-space: nowrap;
|
||||||
white-space: nowrap;
|
overflow: hidden;
|
||||||
overflow: hidden;
|
text-overflow: ellipsis;
|
||||||
text-overflow: ellipsis;
|
}
|
||||||
}
|
|
||||||
|
.card-text {
|
||||||
.thumbnail > img {
|
overflow: hidden;
|
||||||
width: 100%;
|
white-space: nowrap;
|
||||||
height: auto;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumbnail > div {
|
.col {
|
||||||
width: 100%;
|
overflow: hidden;
|
||||||
font-size: 2rem;
|
}
|
||||||
text-align: center;
|
|
||||||
min-height: 3rem;
|
.thumbnail {
|
||||||
color: white;
|
width: 4em;
|
||||||
padding-top: 0.5rem;
|
height: 4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.col {
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -1,22 +1,75 @@
|
|||||||
import { Component, Input, Injectable} from '@angular/core';
|
import { Component, Injectable,ViewChild,AfterViewInit} from '@angular/core';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
import { Store } from '@ngrx/store';
|
import * as extent from 'ol/extent';
|
||||||
import * as mapReducers from '../../reducers/map.reducer';
|
import * as render from 'ol/render';
|
||||||
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
import { Store } from '@ngrx/store';
|
||||||
import { AbstractFeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
||||||
|
import { AbstractFeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
|
||||||
|
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
||||||
@ForItemType("vnd.farmmaps.itemtype.cropfield")
|
import {getArea} from 'ol/sphere';
|
||||||
@Injectable()
|
import * as style from 'ol/style';
|
||||||
@Component({
|
|
||||||
selector: 'fm-map-feature-list-feature-cropfield',
|
|
||||||
templateUrl: './feature-list-feature-cropfield.component.html',
|
@ForItemType("vnd.farmmaps.itemtype.cropfield")
|
||||||
styleUrls: ['./feature-list-feature-cropfield.component.scss']
|
@Injectable()
|
||||||
})
|
@Component({
|
||||||
export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFeatureComponent {
|
selector: 'fm-map-feature-list-feature-cropfield',
|
||||||
|
templateUrl: './feature-list-feature-cropfield.component.html',
|
||||||
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService,config:AppConfig) {
|
styleUrls: ['./feature-list-feature-cropfield.component.scss']
|
||||||
super(store, itemTypeService,config);
|
})
|
||||||
}
|
export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFeatureComponent implements AfterViewInit {
|
||||||
}
|
|
||||||
|
@ViewChild('canvas', { static: false }) canvas;
|
||||||
|
@ViewChild('container', { static: false }) container;
|
||||||
|
|
||||||
|
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService,config:AppConfig) {
|
||||||
|
super(store, itemTypeService,config);
|
||||||
|
}
|
||||||
|
|
||||||
|
areaInHa(feature:Feature):number {
|
||||||
|
if(!feature) return 0;
|
||||||
|
// get area from faeture if 0 calculate from polygon
|
||||||
|
let a = feature.get('area');
|
||||||
|
if(a) return a;
|
||||||
|
return getArea(feature.getGeometry(),{projectio:"EPSG:3857"}) / 10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render(canvas,width,height,feature:Feature) {
|
||||||
|
let renderContext = render.toContext(canvas.getContext( '2d'),{ size: [width, height] });
|
||||||
|
|
||||||
|
let strokeStyle = new style.Style({
|
||||||
|
stroke: new style.Stroke({ color: 'black',width:1.5 })
|
||||||
|
});
|
||||||
|
|
||||||
|
let geom = feature.getGeometry().clone(),
|
||||||
|
line = geom.getCoordinates()[0],
|
||||||
|
e = extent.boundingExtent( line );
|
||||||
|
|
||||||
|
let dxy = extent.getCenter(e),
|
||||||
|
sxy = [
|
||||||
|
(width - 2 ) / extent.getWidth(e),
|
||||||
|
(height - 2 ) / extent.getHeight(e)
|
||||||
|
];
|
||||||
|
|
||||||
|
let dx = dxy[0],
|
||||||
|
dy = dxy[1],
|
||||||
|
sx = sxy[0],
|
||||||
|
sy = sxy[1];
|
||||||
|
|
||||||
|
geom.translate( -dx, -dy );
|
||||||
|
geom.scale( Math.min(sx, sy), -Math.min(sx, sy));
|
||||||
|
geom.translate( width / 2, height / 2 );
|
||||||
|
|
||||||
|
renderContext.setStyle( strokeStyle );
|
||||||
|
renderContext.drawGeometry( geom );
|
||||||
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
|
this.render(this.canvas.nativeElement,
|
||||||
|
this.container.nativeElement.offsetWidth,
|
||||||
|
this.container.nativeElement.offsetHeight,
|
||||||
|
this.feature);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1,30 +1,29 @@
|
|||||||
@import "../../_theme.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
|
||||||
|
|
||||||
|
|
||||||
|
.card-title {
|
||||||
.card-title {
|
font-size: 1rem;
|
||||||
font-size: 1rem;
|
white-space: nowrap;
|
||||||
white-space: nowrap;
|
overflow: hidden;
|
||||||
overflow: hidden;
|
text-overflow: ellipsis;
|
||||||
text-overflow: ellipsis;
|
}
|
||||||
}
|
|
||||||
|
.thumbnail > img {
|
||||||
.thumbnail > img {
|
width: 100%;
|
||||||
width: 100%;
|
height: auto;
|
||||||
height: auto;
|
}
|
||||||
}
|
|
||||||
|
.thumbnail > div {
|
||||||
.thumbnail > div {
|
width: 100%;
|
||||||
width: 100%;
|
font-size: 2rem;
|
||||||
font-size: 2rem;
|
text-align: center;
|
||||||
text-align: center;
|
min-height: 3rem;
|
||||||
min-height: 3rem;
|
color: white;
|
||||||
color: white;
|
padding-top: 0.5rem;
|
||||||
padding-top: 0.5rem;
|
}
|
||||||
}
|
|
||||||
|
.col {
|
||||||
.col {
|
overflow: hidden;
|
||||||
overflow: hidden;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -1,30 +1,29 @@
|
|||||||
@import "../../_theme.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
|
||||||
|
|
||||||
|
|
||||||
|
.card-title {
|
||||||
.card-title {
|
font-size: 1rem;
|
||||||
font-size: 1rem;
|
white-space: nowrap;
|
||||||
white-space: nowrap;
|
overflow: hidden;
|
||||||
overflow: hidden;
|
text-overflow: ellipsis;
|
||||||
text-overflow: ellipsis;
|
}
|
||||||
}
|
|
||||||
|
.thumbnail > img {
|
||||||
.thumbnail > img {
|
width: 100%;
|
||||||
width: 100%;
|
height: auto;
|
||||||
height: auto;
|
}
|
||||||
}
|
|
||||||
|
.thumbnail > div {
|
||||||
.thumbnail > div {
|
width: 100%;
|
||||||
width: 100%;
|
font-size: 2rem;
|
||||||
font-size: 2rem;
|
text-align: center;
|
||||||
text-align: center;
|
min-height: 3rem;
|
||||||
min-height: 3rem;
|
color: white;
|
||||||
color: white;
|
padding-top: 0.5rem;
|
||||||
padding-top: 0.5rem;
|
}
|
||||||
}
|
|
||||||
|
.col {
|
||||||
.col {
|
overflow: hidden;
|
||||||
overflow: hidden;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<div *ngIf="features;let features">
|
<div *ngIf="features;let features">
|
||||||
<a href="#" (click)="handleBackClick($event)">Go back</a>
|
<a href="#" (click)="handleBackClick($event)">Go back</a>
|
||||||
<div class="row m-0" *ngFor="let feature of features" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
|
<div class="row m-0 pl-3 pr-3" *ngFor="let feature of features" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
|
||||||
<fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
|
<fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,16 +1,15 @@
|
|||||||
@import "../../_theme.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
|
||||||
|
fm-map-feature-list-feature-container {
|
||||||
feature-list-feature-container {
|
width: 100%;
|
||||||
width: 100%;
|
pointer-events: none;
|
||||||
pointer-events: none;
|
}
|
||||||
}
|
|
||||||
|
.row {
|
||||||
.row {
|
border-bottom: 1px solid gray('500');
|
||||||
border-bottom: 1px solid gray('500');
|
user-select: none;
|
||||||
user-select: none;
|
}
|
||||||
}
|
|
||||||
|
.row:hover {
|
||||||
.row:hover {
|
background-color: gray('100');
|
||||||
background-color: gray('100');
|
}
|
||||||
}
|
|
||||||
|
@@ -1,52 +1,52 @@
|
|||||||
import { Component, Input, Injectable } from '@angular/core';
|
import { Component, Input, Injectable } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
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 { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common';
|
import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common';
|
||||||
import * as mapActions from '../../actions/map.actions';
|
import * as mapActions from '../../actions/map.actions';
|
||||||
import { Observable, from } from 'rxjs';
|
import { Observable, from } from 'rxjs';
|
||||||
import { withLatestFrom } from 'rxjs/operators';
|
import { withLatestFrom } from 'rxjs/operators';
|
||||||
import { tassign } from 'tassign';
|
import { tassign } from 'tassign';
|
||||||
import { IQueryState } from '../../models';
|
import { IQueryState } from '@farmmaps/common';
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export abstract class AbstractFeatureListComponent {
|
export abstract class AbstractFeatureListComponent {
|
||||||
@Input() features: Array<Feature>;
|
@Input() features: Array<Feature>;
|
||||||
@Input() queryState: IQueryState;
|
@Input() queryState: IQueryState;
|
||||||
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location) {
|
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location) {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFeatureClick(feature:Feature) {
|
handleFeatureClick(feature:Feature) {
|
||||||
var newQuery: any = tassign(mapReducers.initialState.query);
|
var newQuery: any = tassign(mapReducers.initialState.query);
|
||||||
newQuery.itemCode = feature.get('code');
|
newQuery.itemCode = feature.get('code');
|
||||||
this.store.dispatch(new mapActions.DoQuery(newQuery));
|
this.store.dispatch(new mapActions.DoQuery(newQuery));
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFeatureMouseEnter(feature) {
|
handleFeatureMouseEnter(feature) {
|
||||||
this.store.dispatch(new mapActions.SelectFeature(feature));
|
this.store.dispatch(new mapActions.SelectFeature(feature));
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFeatureMouseLeave(feature) {
|
handleFeatureMouseLeave(feature) {
|
||||||
this.store.dispatch(new mapActions.SelectFeature(null));
|
this.store.dispatch(new mapActions.SelectFeature(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
handleBackClick(event: MouseEvent) {
|
handleBackClick(event: MouseEvent) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.location.back();
|
this.location.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-feature-list',
|
selector: 'fm-map-feature-list',
|
||||||
templateUrl: './feature-list.component.html',
|
templateUrl: './feature-list.component.html',
|
||||||
styleUrls: ['./feature-list.component.scss']
|
styleUrls: ['./feature-list.component.scss']
|
||||||
})
|
})
|
||||||
export class FeatureListComponent extends AbstractFeatureListComponent {
|
export class FeatureListComponent extends AbstractFeatureListComponent {
|
||||||
|
|
||||||
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService,location:Location) {
|
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService,location:Location) {
|
||||||
super(store, itemTypeService,location);
|
super(store, itemTypeService,location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,47 +1,47 @@
|
|||||||
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
|
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
|
||||||
import { AbstractItemListItemComponent,ItemListItemComponent } from '../item-list-item/item-list-item.component';
|
import { AbstractItemListItemComponent,ItemListItemComponent } from '../item-list-item/item-list-item.component';
|
||||||
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
||||||
import { IItem, IListItem } from '@farmmaps/common';
|
import { IItem, IListItem } from '@farmmaps/common';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-item-list-item-container',
|
selector: 'fm-map-item-list-item-container',
|
||||||
template: `
|
template: `
|
||||||
<div style="height:100%">
|
<div style="height:100%">
|
||||||
<ng-template fm-map-widget-host></ng-template>
|
<ng-template fm-map-widget-host></ng-template>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
})
|
})
|
||||||
export class ItemListItemContainerComponent {
|
export class ItemListItemContainerComponent {
|
||||||
|
|
||||||
constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractItemListItemComponent) public itemComponentList: AbstractItemListItemComponent[] ) {
|
constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractItemListItemComponent) public itemComponentList: AbstractItemListItemComponent[] ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input() item: IListItem;
|
@Input() item: IListItem;
|
||||||
|
|
||||||
@ViewChild(WidgetHostDirective) widgetHost: WidgetHostDirective;
|
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
|
||||||
|
|
||||||
loadComponent() {
|
loadComponent() {
|
||||||
var componentFactory: ComponentFactory<AbstractItemListItemComponent> = this.componentFactoryResolver.resolveComponentFactory(ItemListItemComponent); // default
|
var componentFactory: ComponentFactory<AbstractItemListItemComponent> = this.componentFactoryResolver.resolveComponentFactory(ItemListItemComponent); // default
|
||||||
for (var i = 0; i < this.itemComponentList.length; i++) {
|
for (var i = 0; i < this.itemComponentList.length; i++) {
|
||||||
if (this.itemComponentList[i]['forItemType'] &&
|
if (this.itemComponentList[i]['forItemType'] &&
|
||||||
this.itemComponentList[i]['forItemType'].indexOf(this.item.itemType) >= 0 &&
|
this.itemComponentList[i]['forItemType'].indexOf(this.item.itemType) >= 0 &&
|
||||||
this.itemComponentList[i]['forSourceTask'] &&
|
this.itemComponentList[i]['forSourceTask'] &&
|
||||||
this.itemComponentList[i]['forSourceTask'].indexOf(this.item.sourceTask) >= 0 )
|
this.itemComponentList[i]['forSourceTask'].indexOf(this.item.sourceTask) >= 0 )
|
||||||
{
|
{
|
||||||
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.itemComponentList[i]['constructor'] as any);
|
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.itemComponentList[i]['constructor'] as any);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const viewContainerRef = this.widgetHost.viewContainerRef;
|
const viewContainerRef = this.widgetHost.viewContainerRef;
|
||||||
viewContainerRef.clear();
|
viewContainerRef.clear();
|
||||||
|
|
||||||
const componentRef = viewContainerRef.createComponent(componentFactory);
|
const componentRef = viewContainerRef.createComponent(componentFactory);
|
||||||
(<AbstractItemListItemComponent>componentRef.instance).item = this.item;
|
(<AbstractItemListItemComponent>componentRef.instance).item = this.item;
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
if (changes["item"] && changes["item"].currentValue) {
|
if (changes["item"] && changes["item"].currentValue) {
|
||||||
this.loadComponent();
|
this.loadComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,27 +1,26 @@
|
|||||||
@import "../../_theme.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
|
||||||
|
.widget {
|
||||||
.widget {
|
padding:0.8rem;
|
||||||
padding:0.8rem;
|
height:100%;
|
||||||
height:100%;
|
width:100%;
|
||||||
width:100%;
|
color:#ffffff;
|
||||||
color:#ffffff;
|
position:relative;
|
||||||
position:relative;
|
}
|
||||||
}
|
|
||||||
|
.icon {
|
||||||
.icon {
|
display:block;
|
||||||
display:block;
|
font-size:6rem;
|
||||||
font-size:6rem;
|
text-align:center;
|
||||||
text-align:center;
|
}
|
||||||
}
|
.title {
|
||||||
.title {
|
display:block;
|
||||||
display:block;
|
position:absolute;
|
||||||
position:absolute;
|
width:calc(100% - 1.6rem );
|
||||||
width:calc(100% - 1.6rem );
|
padding-top:0.5rem;
|
||||||
padding-top:0.5rem;
|
bottom:0.8rem;
|
||||||
bottom:0.8rem;
|
height:2rem;
|
||||||
height:2rem;
|
overflow:hidden;
|
||||||
overflow:hidden;
|
white-space:nowrap;
|
||||||
white-space:nowrap;
|
text-overflow:ellipsis;
|
||||||
text-overflow:ellipsis;
|
}
|
||||||
}
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<div *ngIf="items;let items" class="widget-container">
|
<div *ngIf="items;let items" class="widget-container pt-0">
|
||||||
<div class="widget" *ngFor="let item of items" (click)="handleItemClick(item)">
|
<div class="widget" *ngFor="let item of items" (click)="handleItemClick(item)">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<fm-map-item-list-item-container [item]="item" class="item-container"></fm-map-item-list-item-container>
|
<fm-map-item-list-item-container [item]="item" class="item-container"></fm-map-item-list-item-container>
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
@import "../../_theme.scss";
|
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
|
|
||||||
.widget-container {
|
.widget-container {
|
||||||
@@ -19,7 +18,7 @@
|
|||||||
.widget:after {
|
.widget:after {
|
||||||
content: "";
|
content: "";
|
||||||
display: block;
|
display: block;
|
||||||
padding-bottom: 100%;
|
padding-bottom: 66%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
|
@@ -1,14 +1,10 @@
|
|||||||
import { Component, Input, Injectable } from '@angular/core';
|
import { Component, Input, Injectable } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { Feature } from 'ol';
|
|
||||||
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 { commonReducers,ItemTypeService, IItem, Item,IListItem } from '@farmmaps/common';
|
import { commonReducers,ItemTypeService,IListItem } from '@farmmaps/common';
|
||||||
import * as mapActions from '../../actions/map.actions';
|
import * as mapActions from '../../actions/map.actions';
|
||||||
import { Observable, from } from 'rxjs';
|
|
||||||
import { withLatestFrom } from 'rxjs/operators';
|
|
||||||
import { tassign } from 'tassign';
|
import { tassign } from 'tassign';
|
||||||
import { IQueryState } from '../../models';
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<div *ngIf="widgets;let widgets" class="widget-container">
|
<div *ngIf="widgets;let widgets" class="widget-container pt-0">
|
||||||
<div class="widget" *ngFor="let widget of widgets">
|
<div class="widget" *ngFor="let widget of widgets">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<ng-template #widgetTemplate></ng-template>
|
<ng-template #widgetTemplate></ng-template>
|
||||||
|
@@ -1,42 +1,41 @@
|
|||||||
@import "../../_theme.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
|
||||||
|
.widget-container {
|
||||||
.widget-container {
|
overflow:auto;
|
||||||
overflow:auto;
|
margin-bottom:1rem;
|
||||||
margin-bottom:1rem;
|
}
|
||||||
}
|
|
||||||
|
.widget {
|
||||||
.widget {
|
position:relative;
|
||||||
position:relative;
|
border: 1px solid gray('500');
|
||||||
border: 1px solid gray('500');
|
user-select: none;
|
||||||
user-select: none;
|
display:inline-block;
|
||||||
display:inline-block;
|
width:50%;
|
||||||
width:50%;
|
overflow:hidden;
|
||||||
overflow:hidden;
|
float:left;
|
||||||
float:left;
|
}
|
||||||
}
|
|
||||||
|
.widget:after {
|
||||||
.widget:after {
|
content: "";
|
||||||
content: "";
|
display: block;
|
||||||
display: block;
|
padding-bottom: 100%;
|
||||||
padding-bottom: 100%;
|
}
|
||||||
}
|
|
||||||
|
.content {
|
||||||
.content {
|
position:absolute;
|
||||||
position:absolute;
|
width:100%;
|
||||||
width:100%;
|
height:100%;
|
||||||
height:100%;
|
}
|
||||||
}
|
|
||||||
|
.widget:hover {
|
||||||
.widget:hover {
|
background-color: gray('100');
|
||||||
background-color: gray('100');
|
}
|
||||||
}
|
|
||||||
|
.widget-container {
|
||||||
.widget-container {
|
padding:1rem;
|
||||||
padding:1rem;
|
}
|
||||||
}
|
|
||||||
|
.item-container {
|
||||||
.item-container {
|
display:block;
|
||||||
display:block;
|
height:100%;
|
||||||
height:100%;
|
}
|
||||||
}
|
|
||||||
|
@@ -0,0 +1,25 @@
|
|||||||
|
<div class="btn btn-outline-secondary layer-switcher" (click)="handleClick($event)">
|
||||||
|
<i class="fa fa-map-o"></i>
|
||||||
|
<div class="layers hidden" [ngClass]="{'hidden':!(showLayerSwitcher|async)}" (click)="$event.stopPropagation();">
|
||||||
|
<div class="card layers-card m-1">
|
||||||
|
<div class="card-header" i18n>
|
||||||
|
Layers
|
||||||
|
<i class="float-right fa fa-close" (click)="close($event)"></i>
|
||||||
|
</div>
|
||||||
|
<ul class="navbar-nav">
|
||||||
|
<li class="nav-item py-0">
|
||||||
|
<span i18n><i class="fa fa-map-o" aria-hidden="true"></i> Base maps</span>
|
||||||
|
<div class="mb-4">
|
||||||
|
<fm-map-layer-list [baseLayers]="true" [itemLayers]="baseLayers|async" [selectedLayer]="selectedBaseLayer|async" (onSelectLayer)="handleSelectBaseLayer($event)"></fm-map-layer-list>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item py-0">
|
||||||
|
<span i18n><i class="fa fa-map-o" aria-hidden="true"></i> Overlays</span>
|
||||||
|
<div class="mb-4">
|
||||||
|
<fm-map-layer-list [itemLayers]="overlayLayers|async" [selectedLayer]="selectedOverlayLayer|async" (onDelete)="handleOnDelete($event)" (onToggleVisibility)="handleOnToggleVisibility($event)" (onSetOpacity)="handleOnSetOpacity($event)" (onZoomToExtent)="handleZoomToExtent($event)" (onSelectLayer)="handleSelectOverlayLayer($event)"></fm-map-layer-list>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@@ -0,0 +1,71 @@
|
|||||||
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
|
|
||||||
|
|
||||||
|
.layer-switcher {
|
||||||
|
display:block;
|
||||||
|
width:2.5em;
|
||||||
|
height:2.5em;
|
||||||
|
background-color: $body-bg;
|
||||||
|
background-size: contain;
|
||||||
|
margin-top:0.5em;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 2.5em;
|
||||||
|
border-radius: 1.75em;
|
||||||
|
padding: 0;
|
||||||
|
color: $secondary;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layer-switcher i {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layers {
|
||||||
|
color:$secondary;
|
||||||
|
position: absolute;
|
||||||
|
overflow: hidden;
|
||||||
|
bottom: -1em;
|
||||||
|
right: -1em;
|
||||||
|
text-align: left;
|
||||||
|
min-width: 100vw;
|
||||||
|
z-index: 4;
|
||||||
|
// transition: max-height 0.3s ease-out,max-width 0.3s ease-out,min-height 0.3s ease-out,min-width 0.3s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
max-width:0;
|
||||||
|
max-height: 0;
|
||||||
|
min-height: 0;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-nav {
|
||||||
|
padding-left: 7px;
|
||||||
|
padding-right: 7px;
|
||||||
|
margin-bottom: 7px;
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
bottom:-3rem;
|
||||||
|
height: 50vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width:44rem) {
|
||||||
|
.layer-switcher {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layers {
|
||||||
|
max-width: 100%;
|
||||||
|
min-width: 22em;
|
||||||
|
bottom: 2.5em;
|
||||||
|
right: 2.5em;
|
||||||
|
min-height: 0;
|
||||||
|
max-height: calc(100vh - 9rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden {
|
||||||
|
max-width:0;
|
||||||
|
max-height: 0;
|
||||||
|
min-height: 0;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,75 @@
|
|||||||
|
import { Component, OnInit, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
|
import {IItemLayer} from '../../models/item.layer';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
|
import * as mapActions from '../../actions/map.actions';
|
||||||
|
import {createEmpty,extend } from 'ol/extent';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'fm-map-layer-switcher',
|
||||||
|
templateUrl: './layer-switcher.component.html',
|
||||||
|
styleUrls: ['./layer-switcher.component.scss']
|
||||||
|
})
|
||||||
|
export class LayerSwitcher implements OnInit,OnChanges{
|
||||||
|
|
||||||
|
public showLayerSwitcher:Observable<boolean>;
|
||||||
|
public overlayLayers: Observable<Array<IItemLayer>>;
|
||||||
|
public selectedOverlayLayer: Observable<IItemLayer>;
|
||||||
|
public baseLayers: Observable<Array<IItemLayer>>;
|
||||||
|
public selectedBaseLayer: Observable<IItemLayer>;
|
||||||
|
|
||||||
|
constructor( private store: Store<mapReducers.State>) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.overlayLayers = this.store.select(mapReducers.selectGetOverlayLayers);
|
||||||
|
this.selectedOverlayLayer = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
|
||||||
|
this.baseLayers = this.store.select(mapReducers.selectGetBaseLayers);
|
||||||
|
this.selectedBaseLayer = this.store.select(mapReducers.selectGetSelectedBaseLayer);
|
||||||
|
this.showLayerSwitcher = this.store.select(mapReducers.selectGetShowLayerSwitcher);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
handleClick(event:Event) {
|
||||||
|
this.store.dispatch(new mapActions.ShowLayerSwitcher(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
close(event:Event) {
|
||||||
|
this.store.dispatch(new mapActions.ShowLayerSwitcher(false));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
handleOnToggleVisibility(itemLayer: IItemLayer) {
|
||||||
|
this.store.dispatch(new mapActions.SetVisibility(itemLayer,!itemLayer.visible));
|
||||||
|
}
|
||||||
|
|
||||||
|
handleOnSetOpacity(event:{ layer: IItemLayer,opacity:number }) {
|
||||||
|
this.store.dispatch(new mapActions.SetOpacity(event.layer, event.opacity));
|
||||||
|
}
|
||||||
|
|
||||||
|
handleOnDelete(itemLayer: IItemLayer) {
|
||||||
|
this.store.dispatch(new mapActions.RemoveLayer(itemLayer));
|
||||||
|
}
|
||||||
|
|
||||||
|
handleZoomToExtent(itemLayer: IItemLayer) {
|
||||||
|
var extent = createEmpty();
|
||||||
|
extend(extent, itemLayer.layer.getExtent());
|
||||||
|
if (extent) {
|
||||||
|
this.store.dispatch(new mapActions.SetExtent(extent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSelectOverlayLayer(itemLayer: IItemLayer) {
|
||||||
|
this.store.dispatch(new mapActions.SelectOverlayLayer(itemLayer));
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSelectBaseLayer(itemLayer: IItemLayer) {
|
||||||
|
this.store.dispatch(new mapActions.SelectBaseLayer(itemLayer));
|
||||||
|
}
|
||||||
|
}
|
@@ -1,39 +1,41 @@
|
|||||||
<table class="container" *ngIf="layer">
|
<table class="container" *ngIf="showLegend()">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<h4 *ngIf="showTitle">{{layer.name}}</h4>
|
<h4 *ngIf="showTitle">{{layer.name}}</h4>
|
||||||
<b *ngIf="layer.unit">({{layer.unit}})</b>
|
<b *ngIf="layer.unit">({{layer.unit}})</b>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td colspan="2">
|
<td colspan="2">
|
||||||
<div class="title" *ngIf="histogramenabled">
|
<div class="title" *ngIf="histogramenabled">
|
||||||
<h4>{{histogram}}</h4>
|
<h4>{{histogram}}</h4>
|
||||||
<b *ngIf="histogramunit">({{histogramunit}})</b>
|
<b *ngIf="histogramunit">({{histogramunit}})</b>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr *ngFor="let entry of layer.renderer.colorMap.entries; let i = index ">
|
<tr *ngFor="let entry of layer.renderer.colorMap.entries; let i = index ">
|
||||||
<td class="legend-items"><div [style.background-color]="getHex(entry.color)"></div></td>
|
<td class="legend-items"><span [style.background-color]="getHex(entry.color)" class="color"></span></td>
|
||||||
<td class="legend-items-text">{{entry.value | number:'1.0-2'}} {{legendunit}}</td>
|
<td class="legend-items-text"><span *ngIf="!entry.label">{{entry.value | number:'1.0-2'}} {{legendunit}}</span><span *ngIf="entry.label">{{entry.label}}</span></td>
|
||||||
<!--<td class="histogram-items-text"><span *ngIf="histogramenabled">{{entry.value}} {{histogramunit}}</span></td>
|
<td class="histogram-items">
|
||||||
<td class="histogram-items">
|
<div *ngIf="showHistogram()">
|
||||||
<div *ngIf="histogramenabled" [style.background-color]="getHex(selectedColorMap.noValue)" [style.width]="getPart(selectedColorMap, entry)">
|
<span class="bar" [style.background-color]="getHex(entry.color)" [style.width]="getPart(layer.renderer, i)">
|
||||||
</div>
|
</span>
|
||||||
</td>-->
|
<span class="bar-label">{{getLabel(layer.renderer,i)}}</span>
|
||||||
</tr>
|
</div>
|
||||||
<tr>
|
</td>
|
||||||
<td colspan="4"></td>
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<!--<tr>
|
<td colspan="4"></td>
|
||||||
<td>
|
</tr>
|
||||||
<i class="fas fa-chart-bar" (click)="onClickHistoGram()"></i>
|
<!--<tr *ngIf="layer.renderer.colorMap.entries.length > 0">
|
||||||
</td>
|
<td>
|
||||||
<td colspan="3"></td>
|
<i title="Show histogram" class="fa fa-bar-chart fa-rotate-90" (click)="onClickHistoGram()"></i>
|
||||||
</tr>-->
|
</td>
|
||||||
</table>
|
<td colspan="3"></td>
|
||||||
|
</tr>-->
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,58 +1,67 @@
|
|||||||
|
|
||||||
.container {
|
.container {
|
||||||
max-width: 40em;
|
max-width: 40em;
|
||||||
border-spacing: 0.5em;
|
border-spacing: 0.5em;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
padding: 7px;
|
padding: 7px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
line-height: 28px;
|
line-height: 28px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title > h4 {
|
.title > h4 {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.legend-items {
|
span.color {
|
||||||
width: 1.5em;
|
display:inline-block;
|
||||||
height: 1.5em;
|
width: 1.5em;
|
||||||
padding: 0.1em;
|
height: 1.5em;
|
||||||
border-style: none;
|
}
|
||||||
border-width: 0.05em;
|
|
||||||
}
|
.legend-items {
|
||||||
|
padding: 0.1em;
|
||||||
.legend-items div {
|
border-style: none;
|
||||||
width:100%;
|
border-width: 0.05em;
|
||||||
height:100%;
|
}
|
||||||
}
|
|
||||||
|
.legend-items div {
|
||||||
.legend-items-text {
|
width:100%;
|
||||||
max-width: 20em;
|
height:100%;
|
||||||
padding-left: 0.5em;
|
}
|
||||||
text-align: left;
|
|
||||||
}
|
.legend-items-text {
|
||||||
|
max-width: 20em;
|
||||||
.histogram-items {
|
padding-left: 0.5em;
|
||||||
width: 5em;
|
text-align: left;
|
||||||
padding-left: 1em;
|
}
|
||||||
}
|
|
||||||
|
.histogram-items {
|
||||||
.histogram-items > div {
|
width: 100%;
|
||||||
height: 1em;
|
padding-left: 1em;
|
||||||
border-style: solid;
|
}
|
||||||
border-width: 0.05em;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
.histogram-items-text {
|
||||||
|
max-width: 20em;
|
||||||
.histogram-items-text {
|
font-size: 14pt;
|
||||||
max-width: 20em;
|
padding-left: 1em;
|
||||||
font-size: 14pt;
|
text-align: left;
|
||||||
padding-left: 1em;
|
}
|
||||||
text-align: left;
|
|
||||||
}
|
.bar {
|
||||||
|
display:inline-block;
|
||||||
|
height: 1em;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bar-label {
|
||||||
|
margin-left:0.3em;
|
||||||
|
font-size:0.7em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,66 +1,83 @@
|
|||||||
import { Component, OnInit, Input,AfterViewInit } from '@angular/core';
|
import { Component, OnInit, Input,AfterViewInit } from '@angular/core';
|
||||||
import { IColorMap, IColor, IColorEntry,ILayer } from '../../models';
|
import { IColorMap, IColor, IColorEntry,ILayer, IRenderer } from '../../models/color.map';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-layer-legend',
|
selector: 'fm-map-layer-legend',
|
||||||
templateUrl: './legend.component.html',
|
templateUrl: './legend.component.html',
|
||||||
styleUrls: ['./legend.component.scss']
|
styleUrls: ['./legend.component.scss']
|
||||||
})
|
})
|
||||||
export class LegendComponent implements OnInit,AfterViewInit {
|
export class LegendComponent implements OnInit,AfterViewInit {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
layer: ILayer;
|
layer: ILayer;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
legend: string;
|
legend: string;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
histogram: string;
|
histogram: string;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
showTitle: boolean = true;
|
showTitle: boolean = true;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
histogramenabled: boolean;
|
histogramenabled: boolean;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
legendunit: string;
|
legendunit: string;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
histogramunit: string;
|
histogramunit: string;
|
||||||
|
|
||||||
|
|
||||||
onClickHistoGram(): void {
|
onClickHistoGram(): void {
|
||||||
this.histogramenabled = !this.histogramenabled;
|
this.histogramenabled = !this.histogramenabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getHex(color: IColor): string {
|
|
||||||
return '#' + this.componentToHex(color.red) + this.componentToHex(color.green) + this.componentToHex(color.blue);
|
|
||||||
}
|
|
||||||
|
public getHex(color: IColor): string {
|
||||||
public componentToHex(c: number): string {
|
return '#' + this.componentToHex(color.red) + this.componentToHex(color.green) + this.componentToHex(color.blue);
|
||||||
const hex = c.toString(16);
|
}
|
||||||
return hex.length === 1 ? `0${hex}` : hex;
|
|
||||||
}
|
private componentToHex(c: number): string {
|
||||||
|
const hex = c.toString(16);
|
||||||
private getPart(colorMap: IColorMap, colorEntry: IColorEntry): string {
|
return hex.length === 1 ? `0${hex}` : hex;
|
||||||
let sumOfValue = colorMap.entries.reduce((sum, item) => sum + item.value, 0);
|
}
|
||||||
let part = ((colorEntry.value / sumOfValue) * 100) + "%";
|
|
||||||
|
public getPart(renderer: IRenderer, index: number): string {
|
||||||
return part;
|
let max = renderer.band.histogram.entries.reduce((max, entry) => entry.freqency > max ? entry.freqency : max, 0);
|
||||||
}
|
let scale = 65 / max;
|
||||||
|
let part = (renderer.band.histogram.entries[index].freqency * scale) + "%";
|
||||||
}
|
|
||||||
|
return part;
|
||||||
|
}
|
||||||
|
|
||||||
|
public getLabel(renderer: IRenderer, index: number): string {
|
||||||
|
let scale = 100 / renderer.band.histogram.entries.reduce((sum, entry) => sum + entry.freqency, 0);
|
||||||
|
let percent = renderer.band.histogram.entries[index].freqency * scale;
|
||||||
|
return percent < 0.1 ? "" : percent.toFixed(1) + " %";
|
||||||
|
}
|
||||||
|
|
||||||
|
showLegend(): boolean {
|
||||||
|
return this.layer && this.layer.renderer && this.layer.renderer.renderType != "MULTIBAND_COLOR";
|
||||||
|
}
|
||||||
|
|
||||||
|
showHistogram(): boolean {
|
||||||
|
return this.histogramenabled && this.layer.renderer.band.histogram.entries && this.layer.renderer.band.histogram.entries.length > 0 && this.layer.renderer.colorMap.colormapType == "minmax";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
export * from './map-search.component';
|
|
@@ -1,33 +1,36 @@
|
|||||||
<ng-template #rt let-r="result" let-t="term">
|
<ng-template #rt let-r="result" let-t="term">
|
||||||
<i class="fa fa-search" aria-hidden="true" style="width:2rem"></i>
|
<i class="fa fa-search" aria-hidden="true" style="width:2rem"></i>
|
||||||
<ngb-highlight [result]="formatter(r)" [term]="t"></ngb-highlight>
|
<ngb-highlight [result]="formatter(r)" [term]="t"></ngb-highlight>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<div class="map-search collapsed" [ngClass]="{'collapsed':collapsedLocal,searchcollapsed:searchMinifiedLocal}" (click)="$event.stopPropagation()">
|
<div class="map-search collapsed" [ngClass]="{'collapsed':collapsedLocal,searchcollapsed:searchMinifiedLocal}" (click)="$event.stopPropagation()">
|
||||||
<div class="card p-2">
|
<div class="card p-2">
|
||||||
<form class="form" (ngSubmit)="handleSearch($event)">
|
<form class="form" (ngSubmit)="handleSearch($event)">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="input-group-prepend">
|
<div class="input-group-prepend">
|
||||||
<button type="button" class="btn btn-outline-secondary" (click)="handleToggleMenu($event)"><i class="fa fa-bars" aria-hidden="true"></i></button>
|
<button type="button" class="btn btn-outline-secondary" (click)="handleToggleMenu($event)"><i class="fa fa-bars" aria-hidden="true"></i></button>
|
||||||
</div>
|
</div>
|
||||||
<input #searchText class="form-control" type="text" (focus)="handleFocus($event)" [ngModel]="searchTextLocal" name="searchTextLocal" (ngModelChange)="handleChange($event)" [ngbTypeahead]="search" [resultTemplate]="rt" [inputFormatter]="formatter" (selectItem)="handleSelect($event)" placeholder="Search" i18n-placeholder />
|
<input #searchText class="form-control" type="text" (focus)="handleFocus($event)" [ngModel]="searchTextLocal" name="searchTextLocal" (ngModelChange)="handleChange($event)" [ngbTypeahead]="search" [resultTemplate]="rt" [inputFormatter]="formatter" (selectItem)="handleSelect($event)" placeholder="Search" i18n-placeholder />
|
||||||
<div class="input-group-append">
|
<div class="input-group-append">
|
||||||
<button type="submit" class="btn btn-outline-secondary" [disabled]="disabled"><i class="fa fa-search"></i></button>
|
<button type="submit" class="btn btn-outline-secondary" [disabled]="disabled"><i class="fa fa-search"></i></button>
|
||||||
<button type="button" class="clear btn btn-outline-secondary" [disabled]="!clearEnabled" (click)="handleClearClick($event)"><i class="fa fa-remove"></i></button>
|
<button type="button" class="clear btn btn-outline-secondary" [disabled]="!clearEnabled" (click)="handleClearClick($event)"><i class="fa fa-remove"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="options">
|
<div class="options">
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" (ngModelChange)="handleChangeEnableDateFilter($event)" [ngModel]="dateFilter" name="datefilterEnabled" type="checkbox" value="" id="filtercheck1">
|
<input class="form-check-input" (ngModelChange)="handleChangeEnableDateFilter($event)" [ngModel]="dateFilter" name="datefilterEnabled" type="checkbox" value="" id="filtercheck1">
|
||||||
<label class="form-check-label" for="filtercheck1">from <a (click)="handleOpenSelectPeriodModal($event)" href="#">{{startEndCaption}}</a></label>
|
<label class="form-check-label" for="filtercheck1">from <a (click)="handleOpenSelectPeriodModal($event)" href="#">{{startEndCaption}}</a></label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input class="form-check-input" (ngModelChange)="handleChangeEnableBBOXFilter($event)" [ngModel]="filterOptionsLocal.bboxFilter" name="bboxfilterEnabled" type="checkbox" value="" id="filtercheck2">
|
<input class="form-check-input" (ngModelChange)="handleChangeEnableBBOXFilter($event)" [ngModel]="filterOptionsLocal.bboxFilter" name="bboxfilterEnabled" type="checkbox" value="" id="filtercheck2">
|
||||||
<label class="form-check-label" for="filtercheck2">Restrict to visible area</label>
|
<label class="form-check-label" for="filtercheck2">Restrict to visible area</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
<div class="shortcuts">
|
||||||
<ng-content></ng-content>
|
<router-outlet name="map-search"></router-outlet>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
<fm-map-select-period-modal [modalState]="openedModalName" (onCloseModal)="handleCloseModal()" (onSelect)="handleSelectPeriod($event)" [startDate]="startDate" [endDate]="endDate"></fm-map-select-period-modal>
|
<ng-content></ng-content>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<fm-map-select-period-modal [modalState]="openedModalName" (onCloseModal)="handleCloseModal()" (onSelect)="handleSelectPeriod($event)" [startDate]="startDate" [endDate]="endDate"></fm-map-select-period-modal>
|
||||||
|
@@ -1,94 +1,122 @@
|
|||||||
div.map-search {
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
position: absolute;
|
|
||||||
top: 0.5rem;
|
div.map-search {
|
||||||
left: 0.5rem;
|
position: absolute;
|
||||||
transition: opacity 0.5s ease-out, left 0.3s,max-height 0.3s ease-out,max-width 0.3s ease-out;
|
top: 0.5rem;
|
||||||
max-height: 10rem;
|
left: 0.5rem;
|
||||||
width: 21rem;
|
transition: opacity 0.5s ease-out, left 0.3s,max-height 0.3s ease-out,max-width 0.3s ease-out;
|
||||||
max-width: 21rem;
|
max-height: 10rem;
|
||||||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
|
min-width: calc(100vw - 1rem);
|
||||||
z-index:3;
|
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
|
||||||
}
|
z-index:3;
|
||||||
|
}
|
||||||
.input-group {
|
|
||||||
flex-wrap:nowrap;
|
.input-group {
|
||||||
}
|
flex-wrap:nowrap;
|
||||||
|
}
|
||||||
.disabled {
|
|
||||||
color:lighten(#000000,80%);
|
.disabled {
|
||||||
}
|
color:lighten(#000000,80%);
|
||||||
|
}
|
||||||
:host ::ng-deep ngb-typeahead-window.dropdown-menu {
|
|
||||||
width: 20rem;
|
:host ::ng-deep ngb-typeahead-window.dropdown-menu {
|
||||||
left:-2.5rem !important;
|
width: 20rem;
|
||||||
}
|
left:-2.5rem !important;
|
||||||
|
}
|
||||||
:host ::ng-deep button.dropdown-item {
|
|
||||||
overflow:hidden;
|
:host ::ng-deep button.dropdown-item {
|
||||||
text-overflow:ellipsis;
|
overflow:hidden;
|
||||||
padding: 0.375rem 0.75rem;
|
text-overflow:ellipsis;
|
||||||
}
|
padding: 0.375rem 0.75rem;
|
||||||
|
}
|
||||||
div.map-search input[type=text] {
|
|
||||||
transition: width 0.3s ease-out;
|
div.map-search input[type=text] {
|
||||||
}
|
transition: width 0.3s ease-out;
|
||||||
|
}
|
||||||
div.map-search button {
|
|
||||||
transition: width 0.3s ease-out;
|
div.map-search button {
|
||||||
}
|
transition: width 0.3s ease-out;
|
||||||
|
}
|
||||||
div.map-search.collapsed {
|
|
||||||
max-height:3.5rem;
|
div.map-search.collapsed {
|
||||||
max-width:10rem;
|
max-height:3.5rem;
|
||||||
}
|
max-width:10rem;
|
||||||
|
min-width: 0;
|
||||||
div.map-search.searchcollapsed {
|
}
|
||||||
max-height: 3.5rem;
|
|
||||||
max-width: 6rem;
|
div.map-search.searchcollapsed {
|
||||||
}
|
max-height: 3.5rem;
|
||||||
|
max-width: 6rem;
|
||||||
div.map-search div.options {
|
min-width: unset;
|
||||||
padding-top: 0.5rem;
|
}
|
||||||
line-height: 1.5rem;
|
|
||||||
overflow: hidden;
|
div.map-search div.options {
|
||||||
transition: max-height 0.3s ease-in-out;
|
padding-top: 0.5rem;
|
||||||
max-height:4.5rem;
|
line-height: 1.5rem;
|
||||||
}
|
overflow: hidden;
|
||||||
|
transition: max-height 0.3s ease-in-out;
|
||||||
div.map-search.collapsed div.options, div.map-search.searchcollapsed div.options {
|
max-height:4.5rem;
|
||||||
max-height: 0;
|
}
|
||||||
padding:0;
|
|
||||||
}
|
div.map-search div.shortcuts {
|
||||||
|
padding-top: 0.5rem;
|
||||||
div.map-search button {
|
line-height: 1.5rem;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
max-height: 50vh;
|
||||||
|
transition: max-height 0.3s ease-in-out;
|
||||||
div.map-search.collapsed input[type=text] {
|
}
|
||||||
border-top-right-radius: 0.25rem;
|
|
||||||
border-bottom-right-radius: 0.25rem;
|
div.map-search.collapsed div.options, div.map-search.searchcollapsed div.options {
|
||||||
}
|
max-height: 0;
|
||||||
|
padding:0;
|
||||||
div.map-search.searchcollapsed input[type=text] {
|
}
|
||||||
display: none;
|
|
||||||
}
|
div.map-search.collapsed div.shortcuts, div.map-search.searchcollapsed div.shortcuts {
|
||||||
|
max-height: 0;
|
||||||
div.map-search.collapsed button.clear, div.map-search.collapsed button[type="submit"] {
|
padding:0;
|
||||||
width: 0;
|
}
|
||||||
padding: 0;
|
|
||||||
border-color:transparent;
|
div.map-search button {
|
||||||
}
|
overflow: hidden;
|
||||||
|
}
|
||||||
div.map-search.searchcollapsed button[type="submit"] {
|
|
||||||
width: 0;
|
div.map-search.collapsed input[type=text] {
|
||||||
padding: 0;
|
border-top-right-radius: 0.25rem;
|
||||||
border-color: transparent;
|
border-bottom-right-radius: 0.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.options label {
|
div.map-search.searchcollapsed input[type=text] {
|
||||||
white-space:nowrap;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.map-search.collapsed button.clear, div.map-search.collapsed button[type="submit"] {
|
||||||
|
width: 0;
|
||||||
|
padding: 0;
|
||||||
|
border-color:transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.map-search.searchcollapsed button[type="submit"] {
|
||||||
|
width: 0;
|
||||||
|
padding: 0;
|
||||||
|
border-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.options label {
|
||||||
|
white-space:nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-control, .form-control:focus {
|
||||||
|
border-color: $secondary;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@media screen and (min-width:44rem) {
|
||||||
|
div.map-search {
|
||||||
|
width: 21rem;
|
||||||
|
max-width: 21rem;
|
||||||
|
min-width:0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,178 +1,178 @@
|
|||||||
import { Component, Input, Output, OnInit, EventEmitter, SimpleChanges, OnChanges, ViewChild } from '@angular/core';
|
import { Component, Input, Output, OnInit, EventEmitter, SimpleChanges, OnChanges, ViewChild } from '@angular/core';
|
||||||
import { Observable , of } from 'rxjs';
|
import { Observable , of } from 'rxjs';
|
||||||
import { debounceTime,distinctUntilChanged,tap,switchMap,merge,catchError} from 'rxjs/operators';
|
import { debounceTime,distinctUntilChanged,tap,switchMap,merge,catchError} from 'rxjs/operators';
|
||||||
import { TypeaheadService, TimespanService } from '@farmmaps/common';
|
import { TypeaheadService, TimespanService } from '@farmmaps/common';
|
||||||
import { IQueryState,IPeriodState } from '../../models';
|
import { IQueryState } from '@farmmaps/common';
|
||||||
import { fillProperties } from '@angular/core/src/util/property';
|
import { IPeriodState } from '../../models/period.state';
|
||||||
import { tassign } from 'tassign';
|
import { tassign } from 'tassign';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-map-search',
|
selector: 'fm-map-map-search',
|
||||||
templateUrl: './map-search.component.html',
|
templateUrl: './map-search.component.html',
|
||||||
styleUrls: ['./map-search.component.scss']
|
styleUrls: ['./map-search.component.scss']
|
||||||
})
|
})
|
||||||
export class MapSearchComponent {
|
export class MapSearchComponent {
|
||||||
|
|
||||||
@ViewChild('searchText') searchText;
|
@ViewChild('searchText', { static: true }) searchText;
|
||||||
@Input() clearEnabled: boolean
|
@Input() clearEnabled: boolean
|
||||||
@Input() set collapsed(collapsed: boolean) {
|
@Input() set collapsed(collapsed: boolean) {
|
||||||
this.collapsedLocal = collapsed;
|
this.collapsedLocal = collapsed;
|
||||||
if (collapsed) this.searchText.nativeElement.blur();
|
if (collapsed) this.searchText.nativeElement.blur();
|
||||||
}
|
}
|
||||||
@Input() set searchMinified(minified: boolean) {
|
@Input() set searchMinified(minified: boolean) {
|
||||||
this.searchMinifiedLocal = minified;
|
this.searchMinifiedLocal = minified;
|
||||||
}
|
}
|
||||||
@Input() period: IPeriodState
|
@Input() period: IPeriodState
|
||||||
@Output() onSearch = new EventEmitter<IQueryState>();
|
@Output() onSearch = new EventEmitter<IQueryState>();
|
||||||
@Output() onClear = new EventEmitter<any>();
|
@Output() onClear = new EventEmitter<any>();
|
||||||
@Output() onSearchCollapse = new EventEmitter<any>();
|
@Output() onSearchCollapse = new EventEmitter<any>();
|
||||||
@Output() onSearchExpand = new EventEmitter<any>();
|
@Output() onSearchExpand = new EventEmitter<any>();
|
||||||
@Output() onToggleMenu = new EventEmitter<any>();
|
@Output() onToggleMenu = new EventEmitter<any>();
|
||||||
@Output() onOpenModal = new EventEmitter<string>();
|
@Output() onOpenModal = new EventEmitter<string>();
|
||||||
@Output() onCloseModal = new EventEmitter<any>();
|
@Output() onCloseModal = new EventEmitter<any>();
|
||||||
@Input() openedModalName: string;
|
@Input() openedModalName: string;
|
||||||
@Input() set filterOptions(filterOptions: IQueryState) {
|
@Input() set filterOptions(filterOptions: IQueryState) {
|
||||||
if (filterOptions && filterOptions.query && filterOptions.query.length > 0) {
|
if (filterOptions && filterOptions.query && filterOptions.query.length > 0) {
|
||||||
this.disabled = false;
|
this.disabled = false;
|
||||||
} else {
|
} else {
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
}
|
}
|
||||||
this.filterOptionsLocal = tassign(this.filterOptionsLocal, { tags: filterOptions.tags, query: filterOptions.query,bbox:filterOptions.bbox });
|
this.filterOptionsLocal = tassign(this.filterOptionsLocal, { tags: filterOptions.tags, query: filterOptions.query,bbox:filterOptions.bbox });
|
||||||
if (filterOptions.tags) {
|
if (filterOptions.tags) {
|
||||||
this.searchTextLocal = { name: filterOptions.tags };
|
this.searchTextLocal = { name: filterOptions.tags };
|
||||||
} else {
|
} else {
|
||||||
this.searchTextLocal = { name: filterOptions.query };
|
this.searchTextLocal = { name: filterOptions.query };
|
||||||
}
|
}
|
||||||
if (this.dateFilter) {
|
if (this.dateFilter) {
|
||||||
this.filterOptionsLocal.startDate = this.startDate;
|
this.filterOptionsLocal.startDate = this.startDate;
|
||||||
this.filterOptionsLocal.endDate = this.endDate;
|
this.filterOptionsLocal.endDate = this.endDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public collapsedLocal: boolean = true;
|
public collapsedLocal: boolean = true;
|
||||||
public searchMinifiedLocal: boolean = false;
|
public searchMinifiedLocal: boolean = false;
|
||||||
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: boolean = true;
|
public dateFilter: boolean = true;
|
||||||
public startDate: Date = new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1);
|
public startDate: Date = new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1);
|
||||||
public endDate: Date = new Date(Date.now());
|
public endDate: Date = new Date(Date.now());
|
||||||
public startEndCaption: string = this.timespanService.getCaption(this.startDate, this.endDate, 4);
|
public startEndCaption: string = this.timespanService.getCaption(this.startDate, this.endDate, 4);
|
||||||
|
|
||||||
searching = false;
|
searching = false;
|
||||||
searchFailed = false;
|
searchFailed = false;
|
||||||
hideSearchingWhenUnsubscribed = new Observable(() => () => this.searching = false);
|
hideSearchingWhenUnsubscribed = new Observable(() => () => this.searching = false);
|
||||||
|
|
||||||
public disabled: boolean = 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: true, itemType: null, itemCode:null,level:0,parentCode:null,bbox:[] };
|
this.filterOptionsLocal = { query: "", tags: "", startDate: null, endDate: null, bboxFilter: true, itemType: null, itemCode:null,level:0,parentCode:null,bbox:[] };
|
||||||
}
|
}
|
||||||
|
|
||||||
search = (text$: Observable<string>) =>
|
search = (text$: Observable<string>) =>
|
||||||
text$.pipe(
|
text$.pipe(
|
||||||
debounceTime(300),
|
debounceTime(300),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
tap(() => this.searching = true),
|
tap(() => this.searching = true),
|
||||||
switchMap(term => term.length < 1 ? of([]) :
|
switchMap(term => term.length < 1 ? of([]) :
|
||||||
this.typeaheadService.getSearchTypeaheadItems(term).pipe(
|
this.typeaheadService.getSearchTypeaheadItems(term).pipe(
|
||||||
tap(() => this.searchFailed = false),
|
tap(() => this.searchFailed = false),
|
||||||
catchError(() => {
|
catchError(() => {
|
||||||
this.searchFailed = true;
|
this.searchFailed = true;
|
||||||
return of([]);
|
return of([]);
|
||||||
})) ),
|
})) ),
|
||||||
tap(() => this.searching = false),
|
tap(() => this.searching = false),
|
||||||
merge(this.hideSearchingWhenUnsubscribed));
|
merge(this.hideSearchingWhenUnsubscribed));
|
||||||
|
|
||||||
formatter = (x: { name: string }) => x.name;
|
formatter = (x: { name: string }) => x.name;
|
||||||
|
|
||||||
handleSearch(event) {
|
handleSearch(event) {
|
||||||
this.filterOptionsLocal.tags = null;
|
this.filterOptionsLocal.tags = null;
|
||||||
this.filterOptionsLocal.itemType = null;
|
this.filterOptionsLocal.itemType = null;
|
||||||
this.filterOptionsLocal.itemCode = null;
|
this.filterOptionsLocal.itemCode = null;
|
||||||
this.filterOptionsLocal.parentCode = null;
|
this.filterOptionsLocal.parentCode = null;
|
||||||
this.filterOptionsLocal.query = this.searchTextLocalOutput;
|
this.filterOptionsLocal.query = this.searchTextLocalOutput;
|
||||||
if (this.dateFilter) {
|
if (this.dateFilter) {
|
||||||
this.filterOptionsLocal.startDate = this.startDate;
|
this.filterOptionsLocal.startDate = this.startDate;
|
||||||
this.filterOptionsLocal.endDate = this.endDate;
|
this.filterOptionsLocal.endDate = this.endDate;
|
||||||
}
|
}
|
||||||
this.onSearch.emit(this.filterOptionsLocal);
|
this.onSearch.emit(this.filterOptionsLocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleOpenSelectPeriodModal(event: MouseEvent) {
|
handleOpenSelectPeriodModal(event: MouseEvent) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.onOpenModal.emit('selectPeriodModal');
|
this.onOpenModal.emit('selectPeriodModal');
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCloseModal() {
|
handleCloseModal() {
|
||||||
this.onCloseModal.emit({});
|
this.onCloseModal.emit({});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSelect(event) {
|
handleSelect(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.filterOptionsLocal.query = null;
|
this.filterOptionsLocal.query = null;
|
||||||
this.filterOptionsLocal.itemType = null;
|
this.filterOptionsLocal.itemType = null;
|
||||||
this.filterOptionsLocal.itemCode = null;
|
this.filterOptionsLocal.itemCode = null;
|
||||||
this.filterOptionsLocal.parentCode = null;
|
this.filterOptionsLocal.parentCode = null;
|
||||||
this.filterOptionsLocal.tags = event.item.name;
|
this.filterOptionsLocal.tags = event.item.name;
|
||||||
if (this.dateFilter) {
|
if (this.dateFilter) {
|
||||||
this.filterOptionsLocal.startDate = this.startDate;
|
this.filterOptionsLocal.startDate = this.startDate;
|
||||||
this.filterOptionsLocal.endDate = this.endDate;
|
this.filterOptionsLocal.endDate = this.endDate;
|
||||||
}
|
}
|
||||||
this.onSearch.emit(this.filterOptionsLocal);
|
this.onSearch.emit(this.filterOptionsLocal);
|
||||||
this.searchTextLocal = { name: this.filterOptionsLocal.tags };
|
this.searchTextLocal = { name: this.filterOptionsLocal.tags };
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSelectPeriod(event: { startDate: Date, endDate: Date }) {
|
handleSelectPeriod(event: { startDate: Date, endDate: Date }) {
|
||||||
this.startDate = event.startDate;
|
this.startDate = event.startDate;
|
||||||
this.endDate = event.endDate;
|
this.endDate = event.endDate;
|
||||||
this.handleCloseModal();
|
this.handleCloseModal();
|
||||||
this.startEndCaption = this.timespanService.getCaption(event.startDate, event.endDate, 4);
|
this.startEndCaption = this.timespanService.getCaption(event.startDate, event.endDate, 4);
|
||||||
this.onSearch.emit(this.filterOptionsLocal);
|
this.onSearch.emit(this.filterOptionsLocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChangeEnableDateFilter(enabled) {
|
handleChangeEnableDateFilter(enabled) {
|
||||||
this.dateFilter = enabled;
|
this.dateFilter = enabled;
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
this.filterOptionsLocal.startDate = this.startDate;
|
this.filterOptionsLocal.startDate = this.startDate;
|
||||||
this.filterOptionsLocal.endDate = this.endDate;
|
this.filterOptionsLocal.endDate = this.endDate;
|
||||||
} else {
|
} else {
|
||||||
this.filterOptionsLocal.startDate = null;
|
this.filterOptionsLocal.startDate = null;
|
||||||
this.filterOptionsLocal.endDate = null;
|
this.filterOptionsLocal.endDate = null;
|
||||||
}
|
}
|
||||||
if(this.filterOptionsLocal.query || this.filterOptionsLocal.tags)
|
if(this.filterOptionsLocal.query || this.filterOptionsLocal.tags)
|
||||||
this.onSearch.emit(this.filterOptionsLocal);
|
this.onSearch.emit(this.filterOptionsLocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChangeEnableBBOXFilter(enabled) {
|
handleChangeEnableBBOXFilter(enabled) {
|
||||||
this.filterOptionsLocal.bboxFilter = enabled;
|
this.filterOptionsLocal.bboxFilter = enabled;
|
||||||
if (this.filterOptionsLocal.query || this.filterOptionsLocal.tags)
|
if (this.filterOptionsLocal.query || this.filterOptionsLocal.tags)
|
||||||
this.onSearch.emit(this.filterOptionsLocal);
|
this.onSearch.emit(this.filterOptionsLocal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
handleToggleMenu(event) {
|
handleToggleMenu(event) {
|
||||||
this.onToggleMenu.emit({});
|
this.onToggleMenu.emit({});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFocus(event) {
|
handleFocus(event) {
|
||||||
this.onSearchExpand.emit({});
|
this.onSearchExpand.emit({});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChange(event: string) {
|
handleChange(event: string) {
|
||||||
this.searchTextLocalOutput = event;
|
this.searchTextLocalOutput = event;
|
||||||
if (event && event.length == 1) {
|
if (event && event.length == 1) {
|
||||||
this.onSearchExpand.emit({});
|
this.onSearchExpand.emit({});
|
||||||
}
|
}
|
||||||
if (event && event.length > 0)
|
if (event && event.length > 0)
|
||||||
this.disabled = false;
|
this.disabled = false;
|
||||||
else
|
else
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleClearClick(event) {
|
handleClearClick(event) {
|
||||||
this.onClear.emit({});
|
this.onClear.emit({});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,58 +1,71 @@
|
|||||||
<aol-map #map (onMoveEnd)="handleOnMoveEnd($event)" (click)="handleOnMouseDown($event)" [ngClass]="{'panel-visible':(panelVisible|async)}" class="map">
|
<ng-container *ngIf="{
|
||||||
<div>
|
mapState:mapState$|async,
|
||||||
|
extent:extent$|async,
|
||||||
</div>
|
baseLayers:baseLayers$|async,
|
||||||
<aol-view [zoom]="(mapState|async).zoom" [rotation]="(mapState|async).rotation">
|
overlayLayers:overlayLayers$|async,
|
||||||
<aol-coordinate [x]="(mapState|async).xCenter" [y]="(mapState|async).yCenter" [srid]="'EPSG:4326'"></aol-coordinate>
|
selectedItemLayer:selectedItemLayer$|async,
|
||||||
<fm-map-zoom-to-extent [extent]="extent|async" [animate]="true"></fm-map-zoom-to-extent>
|
features:features$|async,
|
||||||
</aol-view>
|
position:position$|async,
|
||||||
<aol-interaction-default></aol-interaction-default>
|
parentCode:parentCode$|async,
|
||||||
<aol-interaction-dragrotateandzoom></aol-interaction-dragrotateandzoom>
|
panelVisible:panelVisible$|async,
|
||||||
<fm-map-item-layers [itemLayers]="baseLayers|async"></fm-map-item-layers>
|
openedModalName:openedModalName$|async,
|
||||||
<fm-map-item-layers [itemLayers]="overlayLayers|async"></fm-map-item-layers>
|
panelCollapsed:panelCollapsed$|async,
|
||||||
<fm-map-item-layers [itemLayer]="selectedItemLayer|async"></fm-map-item-layers>
|
searchMinified:searchMinified$|async,
|
||||||
<aol-layer-vector>
|
selectedItem:selectedItem$|async,
|
||||||
<fm-map-item-source-vector [features]="features|async" (onFeaturesSelected)="handleFeaturesSelected($event)" [selectedFeature]="selectedFeature|async" [selectedItem]="selectedItem|async"></fm-map-item-source-vector>
|
queryState:queryState$|async,
|
||||||
</aol-layer-vector>
|
searchCollapsed:searchCollapsed$|async,
|
||||||
<fm-map-gps-location [position]="position|async" [headingTolerance]="20" [showHeading]="true"></fm-map-gps-location>
|
clearEnabled:clearEnabled$|async,
|
||||||
<div class="control-container">
|
period:period$|async,
|
||||||
<!-- <switch2d3d></switch2d3d>-->
|
compassHeading:compassHeading$|async,
|
||||||
<fm-map-rotation-reset></fm-map-rotation-reset>
|
styles:styles$|async,
|
||||||
</div>
|
selectedFeature:selectedFeature$|async
|
||||||
<fm-map-file-drop-target [parentCode]="(parentCode | async)" (onFileDropped)="handleFileDropped($event)"></fm-map-file-drop-target>
|
} as state">
|
||||||
</aol-map>
|
<aol-map #map (moveEnd)="handleOnMoveEnd($event)" (click)="handleOnMouseDown($event)" [ngClass]="{'panel-visible':state.panelVisible}" class="map">
|
||||||
<fm-map-map-search #mapSearch [openedModalName]="openedModalName|async" (onOpenModal)="handleOpenModal($event)" (onCloseModal)="handleCloseModal()" [ngClass]="{'menuVisible':(menuVisible|async)}" (onToggleMenu)="handleToggleMenu($event)" (onSearchCollapse)="handleSearchCollapse($event)" (onSearchExpand)="handleSearchExpand($event)" [collapsed]="searchCollapsed|async" [searchMinified]="(searchMinified | async)" (onSearch)="handleSearch($event)" (onClear)="handleClearSearch($event)" [filterOptions]="queryState|async" [clearEnabled]="clearEnabled|async" [period]="period|async"></fm-map-map-search>
|
<div>
|
||||||
<fm-side-panel [resizeable]="true" [visible]="(panelVisible|async)" [collapsed]="(panelCollapsed|async)" [collapsable]="false">
|
|
||||||
<div class="panel-wrapper">
|
</div>
|
||||||
<div class="panel-top bg-secondary" *ngIf="!(searchMinified | async)">
|
<aol-view [zoom]="state.mapState.zoom" [rotation]="state.mapState.rotation">
|
||||||
</div>
|
<aol-coordinate [x]="state.mapState.xCenter" [y]="state.mapState.yCenter" [srid]="'EPSG:4326'"></aol-coordinate>
|
||||||
<div class="panel-bottom">
|
<fm-map-zoom-to-extent [extent]="state.extent" [animate]="true"></fm-map-zoom-to-extent>
|
||||||
|
</aol-view>
|
||||||
<div *ngIf="!(selectedItem|async)">
|
<aol-interaction-default></aol-interaction-default>
|
||||||
<fm-map-feature-list-container [features]="(features | async)" [queryState]="(queryState|async)"></fm-map-feature-list-container>
|
<aol-interaction-dragrotateandzoom></aol-interaction-dragrotateandzoom>
|
||||||
</div>
|
<fm-map-item-layers [itemLayers]="state.baseLayers"></fm-map-item-layers>
|
||||||
|
<fm-map-item-layers [itemLayers]="state.overlayLayers"></fm-map-item-layers>
|
||||||
<div *ngIf="(selectedItem | async);let item">
|
<fm-map-item-layers [itemLayer]="state.selectedItemLayer"></fm-map-item-layers>
|
||||||
<fm-map-selected-item-container [item]="item"></fm-map-selected-item-container>
|
<aol-layer-vector>
|
||||||
</div>
|
<fm-map-item-source-vector [styles]="state.styles" [features]="state.features" (onFeaturesSelected)="handleFeaturesSelected($event)" [selectedFeature]="state.selectedFeature" [selectedItem]="state.selectedItem"></fm-map-item-source-vector>
|
||||||
<div *ngIf="(features|async).length == 0" class="no-results m-2">
|
</aol-layer-vector>
|
||||||
<div *ngIf="(queryState|async)?.query">Cannot find <span>{{(queryState|async)?.query}}</span></div>
|
<fm-map-gps-location [position]="state.position" [headingTolerance]="20" [showHeading]="true" [heading]="state.compassHeading"></fm-map-gps-location>
|
||||||
<div *ngIf="(queryState|async)?.tags">Cannot find tag <span>{{(queryState|async)?.tags}}</span></div>
|
<div class="control-container">
|
||||||
</div>
|
<!-- <switch2d3d></switch2d3d>-->
|
||||||
</div>
|
<fm-map-layer-switcher></fm-map-layer-switcher>
|
||||||
</div>
|
<fm-map-pan-to-location [position]="state.position" [mapState]="state.mapState" [animate]="true"></fm-map-pan-to-location>
|
||||||
</fm-side-panel>
|
<fm-map-rotation-reset></fm-map-rotation-reset>
|
||||||
<fm-side-panel [visible]="(menuVisible|async)" class="menu">
|
</div>
|
||||||
<div class="container-fluid">
|
<fm-map-file-drop-target [parentCode]="state.parentCode" (onFileDropped)="handleFileDropped($event)"></fm-map-file-drop-target>
|
||||||
<div class="body">
|
</aol-map>
|
||||||
<div class="d-flex flex-row">
|
<fm-map-map-search #mapSearch [openedModalName]="state.openedModalName" (onOpenModal)="handleOpenModal($event)" (onCloseModal)="handleCloseModal()" [ngClass]="{'menuVisible':state.menuVisible}" (onToggleMenu)="handleToggleMenu($event)" (onSearchCollapse)="handleSearchCollapse($event)" (onSearchExpand)="handleSearchExpand($event)" [collapsed]="state.searchCollapsed" [searchMinified]="state.searchMinified" (onSearch)="handleSearch($event)" (onClear)="handleClearSearch($event)" [filterOptions]="state.queryState" [clearEnabled]="state.clearEnabled" [period]="state.period"></fm-map-map-search>
|
||||||
<div class="mt-2 mb-2 flex-grow-1 logo"><router-outlet name="side-panel-logo"></router-outlet></div>
|
<fm-side-panel [resizeable]="true" [visible]="state.panelVisible" [collapsed]="state.panelCollapsed" [collapsable]="false">
|
||||||
<div class="mt-2 mb-2 ml-2"><button type="button" class="btn btn-outline-secondary" (click)="handleToggleMenu($event)"><i class="fa fa-times" aria-hidden="true"></i></button></div>
|
<div class="panel-wrapper">
|
||||||
</div>
|
<div class="panel-top bg-secondary" *ngIf="!(state.searchMinified)">
|
||||||
<div class="d-flex flex-column cards">
|
</div>
|
||||||
<router-outlet name="side-panel-menu"></router-outlet>
|
<div class="panel-bottom">
|
||||||
</div>
|
|
||||||
</div>
|
<div *ngIf="!(state.selectedItem)">
|
||||||
</div>
|
<fm-map-feature-list-container [features]="state.features" [queryState]="state.queryState"></fm-map-feature-list-container>
|
||||||
</fm-side-panel>
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="state.selectedItem;let item">
|
||||||
|
<fm-map-selected-item-container [item]="item" [itemLayer]="state.selectedItemLayer"></fm-map-selected-item-container>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="state.features.length == 0" class="no-results m-2">
|
||||||
|
<div *ngIf="state.queryState.query">Cannot find <span>{{state.queryState?.query}}</span></div>
|
||||||
|
<div *ngIf="state.queryState?.tags">Cannot find tag <span>{{state.queryState?.tags}}</span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fm-side-panel>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,171 +1,166 @@
|
|||||||
@import "../../_theme.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
|
||||||
|
aol-map { position:absolute;width:100%;height:100%;}
|
||||||
aol-map { position:absolute;width:100%;height:100%;}
|
|
||||||
|
.arrow {
|
||||||
.arrow {
|
top: 3rem;
|
||||||
top: 3rem;
|
}
|
||||||
}
|
|
||||||
|
.popover {
|
||||||
.popover {
|
max-height:22rem;
|
||||||
max-height:22rem;
|
min-width:15rem;
|
||||||
min-width:15rem;
|
}
|
||||||
}
|
|
||||||
|
.popover-body {
|
||||||
.popover-body {
|
max-height:19rem;
|
||||||
max-height:19rem;
|
overflow:hidden;
|
||||||
overflow:hidden;
|
overflow-y:auto;
|
||||||
overflow-y:auto;
|
}
|
||||||
}
|
|
||||||
|
.card-title {
|
||||||
.card-title {
|
font-size:1rem;
|
||||||
font-size:1rem;
|
}
|
||||||
}
|
|
||||||
|
.menu-card {
|
||||||
.menu-card {
|
margin-left:-7px;
|
||||||
margin-left:-7px;
|
padding-left:7px;
|
||||||
padding-left:7px;
|
margin-right:-7px;
|
||||||
margin-right:-7px;
|
padding-right:7px;
|
||||||
padding-right:7px;
|
margin-bottom:7px;
|
||||||
margin-bottom:7px;
|
}
|
||||||
}
|
|
||||||
|
.icon-top {
|
||||||
.icon-top {
|
font-size: 6rem;
|
||||||
font-size: 6rem;
|
text-align: center;
|
||||||
text-align: center;
|
height: 9.75rem;
|
||||||
height: 9.75rem;
|
}
|
||||||
}
|
|
||||||
|
.icon-top i {
|
||||||
.icon-top i {
|
padding-top: 1.875rem;
|
||||||
padding-top: 1.875rem;
|
}
|
||||||
}
|
|
||||||
|
.card-title {
|
||||||
.card-title {
|
white-space:nowrap;
|
||||||
white-space:nowrap;
|
overflow:hidden;
|
||||||
overflow:hidden;
|
text-overflow:ellipsis;
|
||||||
text-overflow:ellipsis;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
.control-container {
|
||||||
.control-container {
|
position: absolute;
|
||||||
position: absolute;
|
right: 1em;
|
||||||
right: 1em;
|
bottom: 1em;
|
||||||
bottom: 1em;
|
}
|
||||||
}
|
|
||||||
|
switch2d3d {
|
||||||
switch2d3d {
|
position: absolute;
|
||||||
position: absolute;
|
right: 1em;
|
||||||
right: 1em;
|
bottom: 1em;
|
||||||
bottom: 1em;
|
}
|
||||||
}
|
|
||||||
|
.panel-wrapper {
|
||||||
.panel-wrapper {
|
display: flex;
|
||||||
display: flex;
|
flex-direction: column;
|
||||||
flex-direction: column;
|
align-items: stretch;
|
||||||
align-items: stretch;
|
width: 100%;
|
||||||
width: 100%;
|
height: 100%;
|
||||||
height: 100%;
|
}
|
||||||
}
|
|
||||||
|
.panel-top {
|
||||||
.panel-top {
|
display: block;
|
||||||
display: block;
|
height:0;
|
||||||
height:0;
|
}
|
||||||
}
|
|
||||||
|
.panel-bottom {
|
||||||
.panel-bottom {
|
overflow:auto;
|
||||||
overflow:auto;
|
flex:1;
|
||||||
flex:1;
|
}
|
||||||
}
|
|
||||||
|
.no-results {
|
||||||
.no-results {
|
font-weight:bold;
|
||||||
font-weight:bold;
|
}
|
||||||
}
|
|
||||||
|
.no-results > span {
|
||||||
.no-results > span {
|
font-style:italic;
|
||||||
font-style:italic;
|
}
|
||||||
}
|
|
||||||
|
div.header {
|
||||||
div.header {
|
display:flex;
|
||||||
display:flex;
|
padding-top:1em;
|
||||||
padding-top:1em;
|
margin-bottom:1em;
|
||||||
margin-bottom:1em;
|
}
|
||||||
}
|
|
||||||
|
div.header button {
|
||||||
div.header button {
|
margin-left:1em;
|
||||||
margin-left:1em;
|
}
|
||||||
}
|
|
||||||
|
.logo {
|
||||||
.logo {
|
overflow: hidden;
|
||||||
overflow: hidden;
|
max-height: 2.5em;
|
||||||
max-height: 2.5em;
|
}
|
||||||
}
|
|
||||||
|
timespan {
|
||||||
timespan {
|
position: absolute;
|
||||||
position: absolute;
|
transition: left 0.5s;
|
||||||
transition: left 0.5s;
|
bottom: 0;
|
||||||
bottom: 0;
|
left: 0;
|
||||||
left: 0;
|
right: 0;
|
||||||
right: 0;
|
background-color: rgba(255, 255, 255, 0.5);
|
||||||
background-color: rgba(255, 255, 255, 0.5);
|
}
|
||||||
}
|
|
||||||
|
timespan.menuVisible {
|
||||||
timespan.menuVisible {
|
left: 22rem;
|
||||||
left: 22rem;
|
}
|
||||||
}
|
|
||||||
|
:host ::ng-deep .timespan div.clearfix {
|
||||||
:host ::ng-deep .timespan div.clearfix {
|
transition: height 0.5s;
|
||||||
transition: height 0.5s;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
:host ::ng-deep .menu .side-panel {
|
@media screen and (min-width:44rem) {
|
||||||
z-index: 100;
|
.panel-top {
|
||||||
background-color: rgb(245,245,245);
|
height: 8.1rem;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@media screen and (min-width:44rem) {
|
|
||||||
.panel-top {
|
.map {
|
||||||
height: 8.1rem;
|
transition: margin-left 0.3s;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
.shortcut-icon {
|
||||||
.map {
|
display: inline-block;
|
||||||
transition: margin-left 0.3s;
|
text-align: center;
|
||||||
}
|
margin: 0.5rem;
|
||||||
|
cursor:pointer;
|
||||||
.shortcut-icon {
|
}
|
||||||
display: inline-block;
|
|
||||||
text-align: center;
|
.shortcut-icon > .icon {
|
||||||
margin: 0.5rem;
|
width: 3rem;
|
||||||
cursor:pointer;
|
height: 3rem;
|
||||||
}
|
background-color: #731e64;
|
||||||
|
display: inline-block;
|
||||||
.shortcut-icon > .icon {
|
text-align: center;
|
||||||
width: 3rem;
|
line-height: 3rem;
|
||||||
height: 3rem;
|
color: #ffffff;
|
||||||
background-color: #731e64;
|
font-size: 2rem;
|
||||||
display: inline-block;
|
}
|
||||||
text-align: center;
|
|
||||||
line-height: 3rem;
|
.shortcut-icon > .caption {
|
||||||
color: #ffffff;
|
text-align: center;
|
||||||
font-size: 2rem;
|
width: 4rem;
|
||||||
}
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
.shortcut-icon > .caption {
|
color: theme-color();
|
||||||
text-align: center;
|
}
|
||||||
width: 4rem;
|
|
||||||
overflow: hidden;
|
.shortcut-icon > .farm-icon {
|
||||||
text-overflow: ellipsis;
|
background-color: #731E64;
|
||||||
color: theme-color();
|
}
|
||||||
}
|
|
||||||
|
.shortcut-icon > .trijntje-icon {
|
||||||
.shortcut-icon > .farm-icon {
|
background-color: #FAA33F;
|
||||||
background-color: #731E64;
|
}
|
||||||
}
|
|
||||||
|
/*.panel-visible {
|
||||||
.shortcut-icon > .trijntje-icon {
|
margin-left:22rem;
|
||||||
background-color: #FAA33F;
|
}*/
|
||||||
}
|
|
||||||
|
|
||||||
/*.panel-visible {
|
|
||||||
margin-left:22rem;
|
|
||||||
}*/
|
|
||||||
|
@@ -1,303 +1,325 @@
|
|||||||
import { Component, OnInit, OnDestroy, HostListener, Inject, ViewChild, AfterViewInit } from '@angular/core';
|
import { Component, OnInit, OnDestroy, HostListener, Inject, ViewChild, AfterViewInit,ChangeDetectorRef,NgZone } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { Observable, Subject, Subscription,combineLatest, from } from 'rxjs';
|
import { Observable, Subject, Subscription,combineLatest, from } from 'rxjs';
|
||||||
import { debounce, withLatestFrom, first, combineAll } from 'rxjs/operators';
|
import { debounce, withLatestFrom, first, combineAll } from 'rxjs/operators';
|
||||||
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
//import { proj,Map } from 'openlayers';
|
//import { proj,Map } from 'openlayers';
|
||||||
|
|
||||||
// Map
|
// Map
|
||||||
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 { IMapState,ISelectedFeatures,IItemLayer, ItemLayer,IQueryState,IPeriodState } from '../../models';
|
import { IMapState} from '../../models/map.state';
|
||||||
import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component';
|
import { ISelectedFeatures } from '../../models/selected.features';
|
||||||
import { IMetaData } from '../meta-data-modal/meta-data-modal.component';
|
import { IItemLayer } from '../../models/item.layer';
|
||||||
import { StateSerializerService } from '../../services/state-serializer.service';
|
import { IQueryState } from '@farmmaps/common';
|
||||||
import { GeolocationService} from '../../services/geolocation.service';
|
import { IPeriodState } from '../../models/period.state';
|
||||||
|
import {IStyles} from '../../models/style.cache';
|
||||||
// AppCommon
|
import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component';
|
||||||
import { ResumableFileUploadService, ItemTypeService } from '@farmmaps/common';
|
import { IMetaData } from '../meta-data-modal/meta-data-modal.component';
|
||||||
import { IItemType, IItem } from '@farmmaps/common';
|
import { StateSerializerService } from '@farmmaps/common';
|
||||||
import {commonReducers} from '@farmmaps/common';
|
import { GeolocationService} from '../../services/geolocation.service';
|
||||||
import {commonActions} from '@farmmaps/common';
|
import {DeviceOrientationService} from '../../services/device-orientation.service';
|
||||||
|
|
||||||
import {Feature} from 'ol';
|
// AppCommon
|
||||||
import {Extent,createEmpty,extend } from 'ol/extent';
|
import { ResumableFileUploadService, ItemTypeService } from '@farmmaps/common';
|
||||||
import {transform} from 'ol/proj';
|
import { IItemType, IItem } from '@farmmaps/common';
|
||||||
import { query } from '@angular/animations';
|
import {commonReducers} from '@farmmaps/common';
|
||||||
import { tassign } from 'tassign';
|
import {commonActions} from '@farmmaps/common';
|
||||||
|
|
||||||
|
import {Feature} from 'ol';
|
||||||
@Component({
|
import {Extent,createEmpty,extend } from 'ol/extent';
|
||||||
selector: 'fm-map-map',
|
import {transform} from 'ol/proj';
|
||||||
templateUrl: './map.component.html',
|
import { query } from '@angular/animations';
|
||||||
styleUrls: ['./map.component.scss']
|
import { tassign } from 'tassign';
|
||||||
})
|
import * as style from 'ol/style';
|
||||||
|
|
||||||
export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
|
||||||
title: string = 'Map';
|
@Component({
|
||||||
public openedModalName: Observable<string>;
|
selector: 'fm-map-map',
|
||||||
public itemTypes: Observable<{ [id: string]: IItemType }>;
|
templateUrl: './map.component.html',
|
||||||
public mapState: Observable<IMapState>;
|
styleUrls: ['./map.component.scss']
|
||||||
public features: Observable<Array<Feature>>;
|
})
|
||||||
public overlayLayers: Observable<Array<IItemLayer>>;
|
|
||||||
public selectedOverlayLayer: Observable<IItemLayer>;
|
export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
||||||
public selectedItemLayer: Observable<IItemLayer>;
|
title: string = 'Map';
|
||||||
public baseLayers: Observable<Array<IItemLayer>>;
|
public openedModalName$: Observable<string> = this.store.select(commonReducers.selectOpenedModalName);
|
||||||
public selectedBaseLayer: Observable<IItemLayer>;
|
public itemTypes$: Observable<{ [id: string]: IItemType }>;
|
||||||
public projection: Observable<string>;
|
public mapState$: Observable<IMapState> = this.store.select(mapReducers.selectGetMapState);
|
||||||
public selectedFeatures: Subject<ISelectedFeatures> = new Subject<ISelectedFeatures>();
|
public features$: Observable<Array<Feature>> = this.store.select(mapReducers.selectGetFeatures);
|
||||||
public droppedFile: Subject<IDroppedFile> = new Subject<IDroppedFile>();
|
public overlayLayers$: Observable<Array<IItemLayer>> = this.store.select(mapReducers.selectGetOverlayLayers);
|
||||||
private paramSub: Subscription;
|
public selectedOverlayLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
|
||||||
private itemTypeSub: Subscription;
|
public selectedItemLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedItemLayer);
|
||||||
private mapStateSub: Subscription;
|
public baseLayers$: Observable<Array<IItemLayer>> = this.store.select(mapReducers.selectGetBaseLayers);
|
||||||
private queryStateSub: Subscription;
|
public selectedBaseLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedBaseLayer);
|
||||||
public parentCode: Observable<string>;
|
public projection$: Observable<string> = this.store.select(mapReducers.selectGetProjection);
|
||||||
public panelVisible: Observable<boolean>;
|
public selectedFeatures$: Subject<ISelectedFeatures> = new Subject<ISelectedFeatures>();
|
||||||
public panelCollapsed: Observable<boolean>;
|
public droppedFile$: Subject<IDroppedFile> = new Subject<IDroppedFile>();
|
||||||
public selectedFeature: Observable<Feature>;
|
private paramSub: Subscription;
|
||||||
public selectedItem: Observable<IItem>;
|
private itemTypeSub: Subscription;
|
||||||
public queryState: Observable<IQueryState>;
|
private mapStateSub: Subscription;
|
||||||
public period: Observable<IPeriodState>;
|
private queryStateSub: Subscription;
|
||||||
public clearEnabled: Observable<boolean>;
|
public parentCode$: Observable<string> =this.store.select(mapReducers.selectGetParentCode);
|
||||||
public searchCollapsed: Observable<boolean>;
|
public panelVisible$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelVisible);
|
||||||
public searchMinified: Observable<boolean>;
|
public panelCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelCollapsed);
|
||||||
public menuVisible: Observable<boolean>;
|
public selectedFeature$: Observable<Feature> = this.store.select(mapReducers.selectGetSelectedFeature);
|
||||||
public query: Observable<IQueryState>;
|
public selectedItem$: Observable<IItem> = this.store.select(mapReducers.selectGetSelectedItem);
|
||||||
public position: Observable<Position>;
|
public queryState$: Observable<IQueryState> = this.store.select(mapReducers.selectGetQueryState);
|
||||||
public baseLayersCollapsed:boolean = true;
|
public period$: Observable<IPeriodState> = this.store.select(mapReducers.selectGetPeriod);
|
||||||
public overlayLayersCollapsed: boolean = true;
|
public clearEnabled$: Observable<boolean> = this.store.select(mapReducers.selectGetClearEnabled);
|
||||||
public extent: Observable<Extent>;
|
public searchCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetSearchCollapsed);
|
||||||
@ViewChild('map') map;
|
public searchMinified$: Observable<boolean> = this.store.select(mapReducers.selectGetSearchMinified);
|
||||||
|
public menuVisible$: Observable<boolean>;
|
||||||
constructor(private store: Store<mapReducers.State | commonReducers.State>, private route: ActivatedRoute, private router: Router, private uploadService: ResumableFileUploadService, private serializeService: StateSerializerService, public itemTypeService: ItemTypeService, private location: Location, private geolocationService: GeolocationService ) {
|
public query$: Observable<IQueryState> = this.store.select(mapReducers.selectGetQuery);
|
||||||
}
|
public position$: Observable<Position> = this.geolocationService.getCurrentPosition();
|
||||||
|
public compassHeading$: Observable<number> = this.deviceorientationService.getCurrentCompassHeading();
|
||||||
@HostListener('document:keyup', ['$event'])
|
public baseLayersCollapsed:boolean = true;
|
||||||
escapeClose(event: KeyboardEvent) {
|
public overlayLayersCollapsed: boolean = true;
|
||||||
let x = event.keyCode;
|
public extent$: Observable<Extent> = this.store.select(mapReducers.selectGetExtent);
|
||||||
if (x === 27) {
|
public styles$:Observable<IStyles> = this.store.select(mapReducers.selectGetStyles);
|
||||||
this.handleCloseModal()
|
private setStateCount$:Observable<number> = this.store.select(mapReducers.selectgetSetStateCount);
|
||||||
}
|
|
||||||
}
|
@ViewChild('map', { static: false }) map;
|
||||||
|
|
||||||
handleOpenModal(modalName: string) {
|
constructor(private store: Store<mapReducers.State | commonReducers.State>,
|
||||||
this.store.dispatch(new commonActions.OpenModal(modalName));
|
private route: ActivatedRoute,
|
||||||
}
|
private router: Router,
|
||||||
|
private uploadService: ResumableFileUploadService,
|
||||||
handleCloseModal() {
|
private serializeService: StateSerializerService,
|
||||||
this.store.dispatch(new commonActions.CloseModal());
|
public itemTypeService: ItemTypeService,
|
||||||
}
|
private location: Location,
|
||||||
|
private geolocationService: GeolocationService,
|
||||||
handleFileDropped(droppedFile: IDroppedFile) {
|
private zone: NgZone,
|
||||||
this.uploadService.addFiles(droppedFile.files, droppedFile.event, { parentCode:droppedFile.parentCode, geometry:droppedFile.geometry });
|
private deviceorientationService:DeviceOrientationService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFeaturesSelected(feature: Feature) {
|
@HostListener('document:keyup', ['$event'])
|
||||||
if (feature) {
|
escapeClose(event: KeyboardEvent) {
|
||||||
let newQuery = tassign(mapReducers.initialQueryState, { itemCode: feature.get('code') });
|
let x = event.keyCode;
|
||||||
this.store.dispatch(new mapActions.DoQuery(newQuery));
|
if (x === 27) {
|
||||||
}
|
this.handleCloseModal()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
handleSearch(queryState: IQueryState) {
|
|
||||||
this.store.dispatch(new mapActions.DoQuery(queryState));
|
handleOpenModal(modalName: string) {
|
||||||
}
|
this.store.dispatch(new commonActions.OpenModal(modalName));
|
||||||
|
}
|
||||||
ngOnInit() {
|
|
||||||
this.store.dispatch(new mapActions.Init());
|
handleCloseModal() {
|
||||||
this.selectedFeatures.next({x:0,y:0,features:[]});
|
this.store.dispatch(new commonActions.CloseModal());
|
||||||
this.mapState = this.store.select(mapReducers.selectGetMapState);
|
}
|
||||||
this.parentCode = this.store.select(mapReducers.selectGetParentCode);
|
|
||||||
this.features = this.store.select(mapReducers.selectGetFeatures);
|
handleFileDropped(droppedFile: IDroppedFile) {
|
||||||
this.overlayLayers = this.store.select(mapReducers.selectGetOverlayLayers);
|
this.uploadService.addFiles(droppedFile.files, droppedFile.event, { parentCode:droppedFile.parentCode, geometry:droppedFile.geometry });
|
||||||
this.selectedOverlayLayer = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
|
}
|
||||||
this.baseLayers = this.store.select(mapReducers.selectGetBaseLayers);
|
|
||||||
this.projection = this.store.select(mapReducers.selectGetProjection);
|
handleFeaturesSelected(feature: Feature) {
|
||||||
this.selectedBaseLayer = this.store.select(mapReducers.selectGetSelectedBaseLayer);
|
if (feature) {
|
||||||
this.panelVisible = this.store.select(mapReducers.selectGetPanelVisible);
|
let newQuery = tassign(mapReducers.initialQueryState, { parentCode: feature.get('parentCode'), itemCode: feature.get('code'),itemType:feature.get('itemType') });
|
||||||
this.panelCollapsed = this.store.select(mapReducers.selectGetPanelCollapsed);
|
this.store.dispatch(new mapActions.DoQuery(newQuery));
|
||||||
this.selectedFeature = this.store.select(mapReducers.selectGetSelectedFeature);
|
}
|
||||||
this.selectedItem = this.store.select(mapReducers.selectGetSelectedItem);
|
}
|
||||||
this.queryState = this.store.select(mapReducers.selectGetQueryState);
|
|
||||||
this.clearEnabled = this.store.select(mapReducers.selectGetClearEnabled);
|
handleSearch(queryState: IQueryState) {
|
||||||
this.searchCollapsed = this.store.select(mapReducers.selectGetSearchCollapsed);
|
this.store.dispatch(new mapActions.DoQuery(queryState));
|
||||||
this.searchMinified = this.store.select(mapReducers.selectGetSearchMinified);
|
}
|
||||||
this.menuVisible = this.store.select(mapReducers.selectGetMenuVisible);
|
|
||||||
this.openedModalName = this.store.select(commonReducers.selectOpenedModalName);
|
ngOnInit() {
|
||||||
this.query = this.store.select(mapReducers.selectGetQuery);
|
this.store.dispatch(new mapActions.Init());
|
||||||
this.extent = this.store.select(mapReducers.selectGetExtent);
|
this.selectedFeatures$.next({x:0,y:0,features:[]});
|
||||||
this.selectedFeatures.next(null);
|
this.selectedFeatures$.next(null);
|
||||||
this.selectedItemLayer = this.store.select(mapReducers.selectGetSelectedItemLayer);
|
this.query$.pipe(withLatestFrom(this.mapState$),withLatestFrom(this.setStateCount$)).subscribe(([[queryState,mapState],setStateCount]) =>{
|
||||||
this.period = this.store.select(mapReducers.selectGetPeriod);
|
if(setStateCount>0) {
|
||||||
this.position = this.geolocationService.getCurrentPosition();
|
this.replaceUrl(mapState,queryState,false);
|
||||||
|
}
|
||||||
this.mapState.pipe(withLatestFrom(this.queryState)).subscribe((state) => {
|
});
|
||||||
this.replaceUrl(state[0], state[1], true);
|
this.mapState$.pipe(withLatestFrom(this.queryState$),withLatestFrom(this.setStateCount$)).subscribe(([[mapState,queryState],setStateCount]) =>{
|
||||||
});
|
if(setStateCount>0) {
|
||||||
this.query.pipe(withLatestFrom(this.mapState)).subscribe((state) => {
|
this.replaceUrl(mapState,queryState,true);
|
||||||
this.replaceUrl(state[1], state[0],false);
|
}
|
||||||
});
|
});
|
||||||
}
|
this.queryState$.pipe(withLatestFrom(this.mapState$),withLatestFrom(this.setStateCount$)).subscribe(([[queryState,mapState],setStateCount]) =>{
|
||||||
|
if(setStateCount>0) {
|
||||||
private stateSetCount: number = 0;
|
this.replaceUrl(mapState,queryState,true);
|
||||||
private lastQueryState: string = this.serializeService.serialize(mapReducers.initialQueryState);
|
}
|
||||||
private lastMapState: string = "";
|
})
|
||||||
ngAfterViewInit() {
|
}
|
||||||
this.paramSub = this.route.paramMap.subscribe((params: ParamMap) => {
|
|
||||||
//console.log("Param sub");
|
initCustomStyles() {
|
||||||
var newMapState: IMapState = null;
|
this.store.dispatch(new mapActions.SetStyle('vnd.farmmaps.itemtype.layer',new style.Style({
|
||||||
var newQueryState: IQueryState = null;
|
stroke: new style.Stroke({
|
||||||
var mapStateChanged = false;
|
color: 'red',
|
||||||
var queryStateChanged = false;
|
lineDash: [ 5,5],
|
||||||
if (params.has("xCenter") && params.has("yCenter")) {
|
width: 1
|
||||||
let xCenter = parseFloat(params.get("xCenter"));
|
}),
|
||||||
let yCenter = parseFloat(params.get("yCenter"));
|
geometry:(feature) =>feature.getGeometry()
|
||||||
let zoom = parseFloat(params.get("zoom"));
|
})));
|
||||||
let rotation = parseFloat(params.get("rotation"));
|
this.store.dispatch(new mapActions.SetStyle('vnd.farmmaps.itemtype.layer_selected',new style.Style({
|
||||||
let baseLayer = params.get("baseLayer")?params.get("baseLayer"):"";
|
stroke: new style.Stroke({
|
||||||
newMapState = { xCenter: xCenter, yCenter: yCenter, zoom: zoom, rotation: rotation, baseLayerCode: baseLayer }
|
color: 'red',
|
||||||
mapStateChanged = this.lastMapState != JSON.stringify(newMapState) && this.stateSetCount == 0;
|
lineDash: [ 5,5],
|
||||||
this.lastMapState = JSON.stringify(newMapState);
|
width: 3
|
||||||
}
|
}),
|
||||||
if (params.has("queryState")) {
|
geometry:(feature) =>feature.getGeometry()
|
||||||
let queryState = params.get("queryState");
|
})));
|
||||||
newQueryState = tassign(mapReducers.initialQueryState);
|
}
|
||||||
if (queryState != "") {
|
|
||||||
newQueryState = this.serializeService.deserialize(queryState);
|
ngAfterViewInit() {
|
||||||
}
|
this.initCustomStyles();
|
||||||
queryStateChanged = this.lastQueryState != queryState;
|
this.paramSub = this.route.paramMap.pipe(withLatestFrom(this.setStateCount$),withLatestFrom(this.queryState$),withLatestFrom(this.mapState$)).subscribe( (state) => {
|
||||||
this.lastQueryState = queryState;
|
let params: ParamMap = state[0][0][0];
|
||||||
}
|
let setStateCount:number = state[0][0][1];
|
||||||
|
let lastQueryState:IQueryState = state[0][1];
|
||||||
if (mapStateChanged && queryStateChanged) {
|
let lastMapState:IMapState = state[1];
|
||||||
//console.log("Both states");
|
var newMapState: IMapState = null;
|
||||||
this.store.dispatch(new mapActions.SetState(newMapState, newQueryState));
|
var newQueryState: IQueryState = null;
|
||||||
} else if (mapStateChanged) {
|
var mapStateChanged = false;
|
||||||
//console.log("Map state");
|
var queryStateChanged = false;
|
||||||
this.store.dispatch(new mapActions.SetMapState(newMapState));
|
if (params.has("xCenter") && params.has("yCenter")) {
|
||||||
} else if (queryStateChanged) {
|
let xCenter = parseFloat(params.get("xCenter"));
|
||||||
//console.log("Query state");
|
let yCenter = parseFloat(params.get("yCenter"));
|
||||||
this.store.dispatch(new mapActions.SetQueryState(newQueryState));
|
let zoom = parseFloat(params.get("zoom"));
|
||||||
}
|
let rotation = parseFloat(params.get("rotation"));
|
||||||
this.stateSetCount += 1;
|
let baseLayer = params.get("baseLayer")?params.get("baseLayer"):"";
|
||||||
});
|
newMapState = { xCenter: xCenter, yCenter: yCenter, zoom: zoom, rotation: rotation, baseLayerCode: baseLayer }
|
||||||
setTimeout(() => {
|
mapStateChanged = (JSON.stringify(lastMapState) != JSON.stringify(newMapState)) && setStateCount == 0 ;
|
||||||
this.map.instance.updateSize();
|
window.localStorage.setItem("FarmMapsCommonMap_mapState",JSON.stringify(newMapState));
|
||||||
}, 500);
|
}
|
||||||
}
|
if (params.has("queryState")) {
|
||||||
|
let queryState = params.get("queryState");
|
||||||
handleSearchCollapse(event) {
|
newQueryState = tassign(mapReducers.initialQueryState);
|
||||||
this.store.dispatch(new mapActions.CollapseSearch());
|
if (queryState != "") {
|
||||||
}
|
newQueryState = this.serializeService.deserialize(queryState);
|
||||||
|
queryState = this.serializeService.serialize(newQueryState);
|
||||||
handleSearchExpand(event) {
|
}
|
||||||
this.store.dispatch(new mapActions.ExpandSearch());
|
queryStateChanged = this.serializeService.serialize(lastQueryState) != queryState;
|
||||||
}
|
}
|
||||||
|
let t =0;
|
||||||
handleToggleMenu(event) {
|
if(setStateCount==0) t=600;
|
||||||
this.store.dispatch(new mapActions.ToggleMenu());
|
setTimeout(() => {
|
||||||
}
|
this.zone.run(()=> {
|
||||||
|
if ( queryStateChanged && mapStateChanged) {
|
||||||
handleToggleBaseLayers(event:MouseEvent) {
|
this.store.dispatch(new mapActions.SetState(newMapState,newQueryState));
|
||||||
this.baseLayersCollapsed = !this.baseLayersCollapsed;
|
} else if(queryStateChanged) {
|
||||||
event.preventDefault();
|
this.store.dispatch(new mapActions.SetQueryState(newQueryState));
|
||||||
}
|
} else if (mapStateChanged) {
|
||||||
|
this.store.dispatch(new mapActions.SetMapState(newMapState));
|
||||||
handleToggleOverlayLayers(event: MouseEvent) {
|
}
|
||||||
this.overlayLayersCollapsed = !this.overlayLayersCollapsed;
|
})
|
||||||
event.preventDefault();
|
},t);
|
||||||
}
|
});
|
||||||
|
setTimeout(() => {
|
||||||
handlePredefinedQuery(event: MouseEvent, query: any) {
|
this.map.instance.updateSize();
|
||||||
event.preventDefault();
|
}, 500);
|
||||||
var queryState = tassign(mapReducers.initialQueryState, query);
|
}
|
||||||
this.store.dispatch(new mapActions.DoQuery(queryState));
|
|
||||||
}
|
handleSearchCollapse(event) {
|
||||||
|
this.store.dispatch(new mapActions.CollapseSearch());
|
||||||
handleTrijntjeClick(event: MouseEvent, query: any) {
|
}
|
||||||
event.preventDefault();
|
|
||||||
var queryState = tassign(mapReducers.initialQueryState, query);
|
handleSearchExpand(event) {
|
||||||
var mapState = JSON.parse(this.lastMapState);
|
this.store.dispatch(new mapActions.ExpandSearch());
|
||||||
this.router.navigate(["app","trijntje" , mapState.xCenter.toFixed(5), mapState.yCenter.toFixed(5), mapState.zoom, mapState.rotation.toFixed(2), mapState.baseLayerCode, this.serializeService.serialize(queryState)], { replaceUrl: false });
|
}
|
||||||
}
|
|
||||||
|
handleToggleMenu(event) {
|
||||||
replaceUrl(mapState: IMapState, queryState: IQueryState, replace: boolean = true) {
|
this.store.dispatch(new commonActions.ToggleMenu());
|
||||||
console.debug(`Replace url : Baselayer(${mapState.baseLayerCode}) Querystate(${this.serializeService.serialize(queryState)})`);
|
}
|
||||||
let parts =["."];
|
|
||||||
parts.push(mapState.xCenter.toFixed(5));
|
handleToggleBaseLayers(event:MouseEvent) {
|
||||||
parts.push(mapState.yCenter.toFixed(5));
|
this.baseLayersCollapsed = !this.baseLayersCollapsed;
|
||||||
parts.push( mapState.zoom.toFixed(0));
|
event.preventDefault();
|
||||||
parts.push( mapState.rotation.toFixed(2));
|
}
|
||||||
if(mapState.baseLayerCode!="") {
|
|
||||||
parts.push(mapState.baseLayerCode);
|
handleToggleOverlayLayers(event: MouseEvent) {
|
||||||
parts.push( this.serializeService.serialize(queryState));
|
this.overlayLayersCollapsed = !this.overlayLayersCollapsed;
|
||||||
this.router.navigate(parts, { replaceUrl: replace,relativeTo:this.route.parent });
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
handlePredefinedQuery(event: MouseEvent, query: any) {
|
||||||
handleOnMoveEnd(event) {
|
event.preventDefault();
|
||||||
var map = event.map;
|
var queryState = tassign(mapReducers.initialQueryState, query);
|
||||||
var view = map.getView();
|
this.store.dispatch(new mapActions.DoQuery(queryState));
|
||||||
var rotation = view.getRotation();
|
}
|
||||||
var zoom = view.getZoom();
|
|
||||||
var center = transform(view.getCenter(), view.getProjection(), "EPSG:4326");
|
replaceUrl(mapState: IMapState, queryState: IQueryState, replace: boolean = true) {
|
||||||
var extent = view.calculateExtent(this.map.instance.getSize());
|
let parts =["."];
|
||||||
let mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null };
|
parts.push(mapState.xCenter.toFixed(5));
|
||||||
let state = { mapState: mapState, extent: extent };
|
parts.push(mapState.yCenter.toFixed(5));
|
||||||
let source = from([state]);
|
parts.push( mapState.zoom.toFixed(0));
|
||||||
source.pipe(withLatestFrom(this.selectedBaseLayer), withLatestFrom(this.queryState)).subscribe(([[state, baselayer], queryState]) => {
|
parts.push( mapState.rotation.toFixed(2));
|
||||||
if (mapState && baselayer && queryState) {
|
if(mapState.baseLayerCode!="") {
|
||||||
let newMapState = tassign(state.mapState, { baseLayerCode: baselayer.item.code });
|
parts.push(mapState.baseLayerCode);
|
||||||
this.replaceUrl(newMapState, tassign(queryState, { bbox: queryState.bboxFilter ? state.extent : queryState.bbox }));
|
parts.push( this.serializeService.serialize(queryState));
|
||||||
this.store.dispatch(new mapActions.SetViewExtent(state.extent));
|
this.router.navigate(parts, { replaceUrl: replace,relativeTo:this.route.parent });
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
handleOnMoveEnd(event) {
|
||||||
handleOnMouseDown(event: MouseEvent) {
|
this.zone.run(() =>{
|
||||||
this.store.dispatch(new mapActions.CollapseSearch());
|
var map = event.map;
|
||||||
}
|
var view = map.getView();
|
||||||
|
var rotation = view.getRotation();
|
||||||
handleOnDownload(event) {
|
var zoom = view.getZoom();
|
||||||
|
var center = transform(view.getCenter(), view.getProjection(), "EPSG:4326");
|
||||||
}
|
var extent = view.calculateExtent(this.map.instance.getSize());
|
||||||
|
let mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null };
|
||||||
handleClearSearch(event) {
|
let state = { mapState: mapState, extent: extent };
|
||||||
this.store.dispatch(new commonActions.Escape(true, false));
|
let source = from([state]);
|
||||||
}
|
source.pipe(withLatestFrom(this.selectedBaseLayer$)).subscribe(([state, baselayer]) => {
|
||||||
|
if (mapState && baselayer) {
|
||||||
handleOnDelete(itemLayer: IItemLayer) {
|
let newMapState = tassign(state.mapState, { baseLayerCode: baselayer.item.code });
|
||||||
this.store.dispatch(new mapActions.RemoveLayer(itemLayer));
|
this.store.dispatch(new mapActions.SetMapState(newMapState));
|
||||||
}
|
this.store.dispatch(new mapActions.SetViewExtent(state.extent));
|
||||||
|
}
|
||||||
handleOnToggleVisibility(itemLayer: IItemLayer) {
|
});
|
||||||
this.store.dispatch(new mapActions.SetVisibility(itemLayer,!itemLayer.visible));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleOnSetOpacity(event:{ layer: IItemLayer,opacity:number }) {
|
handleOnMouseDown(event: MouseEvent) {
|
||||||
this.store.dispatch(new mapActions.SetOpacity(event.layer, event.opacity));
|
this.zone.run(() =>{
|
||||||
}
|
this.store.dispatch(new mapActions.CollapseSearch());
|
||||||
|
});
|
||||||
handleZoomToExtent(itemLayer: IItemLayer) {
|
}
|
||||||
var extent = createEmpty();
|
|
||||||
extend(extent, itemLayer.layer.getExtent());
|
handleOnDownload(event) {
|
||||||
if (extent) {
|
|
||||||
this.store.dispatch(new mapActions.SetExtent(extent));
|
}
|
||||||
}
|
|
||||||
}
|
handleClearSearch(event) {
|
||||||
|
this.store.dispatch(new commonActions.Escape(true, false));
|
||||||
handleSelectBaseLayer(itemLayer: IItemLayer) {
|
}
|
||||||
this.store.dispatch(new mapActions.SelectBaseLayer(itemLayer));
|
|
||||||
}
|
handleOnDelete(itemLayer: IItemLayer) {
|
||||||
|
this.store.dispatch(new mapActions.RemoveLayer(itemLayer));
|
||||||
handleSelectOverlayLayer(itemLayer: IItemLayer) {
|
}
|
||||||
this.store.dispatch(new mapActions.SelectOverlayLayer(itemLayer));
|
|
||||||
}
|
handleOnToggleVisibility(itemLayer: IItemLayer) {
|
||||||
|
this.store.dispatch(new mapActions.SetVisibility(itemLayer,!itemLayer.visible));
|
||||||
ngOnDestroy() {
|
}
|
||||||
this.paramSub.unsubscribe();
|
|
||||||
if (this.itemTypeSub) this.itemTypeSub.unsubscribe();
|
handleOnSetOpacity(event:{ layer: IItemLayer,opacity:number }) {
|
||||||
if (this.mapStateSub) this.mapStateSub.unsubscribe();
|
this.store.dispatch(new mapActions.SetOpacity(event.layer, event.opacity));
|
||||||
if (this.queryStateSub) this.queryStateSub.unsubscribe(); }
|
}
|
||||||
}
|
|
||||||
|
handleZoomToExtent(itemLayer: IItemLayer) {
|
||||||
|
var extent = createEmpty();
|
||||||
|
extend(extent, itemLayer.layer.getExtent());
|
||||||
|
if (extent) {
|
||||||
|
this.store.dispatch(new mapActions.SetExtent(extent));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSelectBaseLayer(itemLayer: IItemLayer) {
|
||||||
|
this.store.dispatch(new mapActions.SelectBaseLayer(itemLayer));
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSelectOverlayLayer(itemLayer: IItemLayer) {
|
||||||
|
this.store.dispatch(new mapActions.SelectOverlayLayer(itemLayer));
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.paramSub.unsubscribe();
|
||||||
|
if (this.itemTypeSub) this.itemTypeSub.unsubscribe();
|
||||||
|
if (this.mapStateSub) this.mapStateSub.unsubscribe();
|
||||||
|
if (this.queryStateSub) this.queryStateSub.unsubscribe(); }
|
||||||
|
}
|
||||||
|
@@ -1,61 +1,61 @@
|
|||||||
import { Component, Output, ViewChild, EventEmitter, Input, ElementRef, HostListener } from '@angular/core';
|
import { Component, Output, ViewChild, EventEmitter, Input, ElementRef, HostListener } from '@angular/core';
|
||||||
import { FormGroup,FormBuilder, Validators } from '@angular/forms';
|
import { FormGroup,FormBuilder, Validators } from '@angular/forms';
|
||||||
import { IListItem } from '@farmmaps/common';
|
import { IListItem } from '@farmmaps/common';
|
||||||
import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component';
|
import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component';
|
||||||
import {NgbModal, NgbModalRef} from "@ng-bootstrap/ng-bootstrap";
|
import {NgbModal, NgbModalRef} from "@ng-bootstrap/ng-bootstrap";
|
||||||
|
|
||||||
export interface IMetaData {
|
export interface IMetaData {
|
||||||
droppedFile: IDroppedFile,
|
droppedFile: IDroppedFile,
|
||||||
attributes: any
|
attributes: any
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-meta-data-modal',
|
selector: 'fm-map-meta-data-modal',
|
||||||
templateUrl: 'meta-data-modal.component.html'
|
templateUrl: 'meta-data-modal.component.html'
|
||||||
})
|
})
|
||||||
export class MetaDataModalComponent {
|
export class MetaDataModalComponent {
|
||||||
|
|
||||||
private modalName: string = 'metaDataModal';
|
private modalName: string = 'metaDataModal';
|
||||||
private modalRef: NgbModalRef;
|
private modalRef: NgbModalRef;
|
||||||
|
|
||||||
@ViewChild('content') _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) {
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input() event: IListItem;
|
@Input() event: IListItem;
|
||||||
|
|
||||||
@Output() onCloseModal = new EventEmitter<any>();
|
@Output() onCloseModal = new EventEmitter<any>();
|
||||||
@Output() onAddFilesWithMetaData = new EventEmitter<IMetaData>();
|
@Output() onAddFilesWithMetaData = new EventEmitter<IMetaData>();
|
||||||
|
|
||||||
constructor(private modalService: NgbModal, public fb: FormBuilder) { }
|
constructor(private modalService: NgbModal, public fb: FormBuilder) { }
|
||||||
|
|
||||||
public metaDataForm: FormGroup;
|
public metaDataForm: FormGroup;
|
||||||
|
|
||||||
handleMetaDataEntered(event) {
|
handleMetaDataEntered(event) {
|
||||||
if (this.metaDataForm.valid) {
|
if (this.metaDataForm.valid) {
|
||||||
this.onAddFilesWithMetaData.emit({ droppedFile: this.droppedFile, attributes: { name: this.metaDataForm.value.name } });
|
this.onAddFilesWithMetaData.emit({ droppedFile: this.droppedFile, attributes: { name: this.metaDataForm.value.name } });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openModal() {
|
openModal() {
|
||||||
//Timeout trick to avoid ExpressionChangedAfterItHasBeenCheckedError
|
//Timeout trick to avoid ExpressionChangedAfterItHasBeenCheckedError
|
||||||
setTimeout(() => this.modalRef = this.modalService.open(this._templateModal, { backdrop: 'static', keyboard: false }));
|
setTimeout(() => this.modalRef = this.modalService.open(this._templateModal, { backdrop: 'static', keyboard: false }));
|
||||||
}
|
}
|
||||||
|
|
||||||
closeModal() {
|
closeModal() {
|
||||||
this.modalRef.close();
|
this.modalRef.close();
|
||||||
this.metaDataForm.patchValue({ name: "" });
|
this.metaDataForm.patchValue({ name: "" });
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.metaDataForm = this.fb.group({
|
this.metaDataForm = this.fb.group({
|
||||||
name: ["", Validators.compose([Validators.required, Validators.pattern("[a-zA-Z0-9_].*")])]
|
name: ["", Validators.compose([Validators.required, Validators.pattern("[a-zA-Z0-9_].*")])]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,93 +1,93 @@
|
|||||||
import { Component, Output, ViewChild, EventEmitter, Input, ElementRef, HostListener } from '@angular/core';
|
import { Component, Output, ViewChild, EventEmitter, Input, ElementRef, HostListener } from '@angular/core';
|
||||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||||
import { NgbModal, NgbModalRef, NgbDateStruct, NgbCalendar, NgbDateAdapter } from "@ng-bootstrap/ng-bootstrap";
|
import { NgbModal, NgbModalRef, NgbDateStruct, NgbCalendar, NgbDateAdapter } from "@ng-bootstrap/ng-bootstrap";
|
||||||
import { NgbDateNativeAdapter } from '@farmmaps/common';
|
import { NgbDateNativeAdapter } from '@farmmaps/common';
|
||||||
|
|
||||||
|
|
||||||
const equals = (one: NgbDateStruct, two: NgbDateStruct) =>
|
const equals = (one: NgbDateStruct, two: NgbDateStruct) =>
|
||||||
one && two && two.year === one.year && two.month === one.month && two.day === one.day;
|
one && two && two.year === one.year && two.month === one.month && two.day === one.day;
|
||||||
|
|
||||||
const before = (one: NgbDateStruct, two: NgbDateStruct) =>
|
const before = (one: NgbDateStruct, two: NgbDateStruct) =>
|
||||||
!one || !two ? false : one.year === two.year ? one.month === two.month ? one.day === two.day
|
!one || !two ? false : one.year === two.year ? one.month === two.month ? one.day === two.day
|
||||||
? false : one.day < two.day : one.month < two.month : one.year < two.year;
|
? false : one.day < two.day : one.month < two.month : one.year < two.year;
|
||||||
|
|
||||||
const after = (one: NgbDateStruct, two: NgbDateStruct) =>
|
const after = (one: NgbDateStruct, two: NgbDateStruct) =>
|
||||||
!one || !two ? false : one.year === two.year ? one.month === two.month ? one.day === two.day
|
!one || !two ? false : one.year === two.year ? one.month === two.month ? one.day === two.day
|
||||||
? false : one.day > two.day : one.month > two.month : one.year > two.year;
|
? false : one.day > two.day : one.month > two.month : one.year > two.year;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-select-period-modal',
|
selector: 'fm-map-select-period-modal',
|
||||||
templateUrl: 'select-period-modal.component.html',
|
templateUrl: 'select-period-modal.component.html',
|
||||||
styleUrls: ['select-period-modal.component.scss']
|
styleUrls: ['select-period-modal.component.scss']
|
||||||
})
|
})
|
||||||
export class SelectPeriodModalComponent {
|
export class SelectPeriodModalComponent {
|
||||||
|
|
||||||
private modalName: string = 'selectPeriodModal';
|
private modalName: string = 'selectPeriodModal';
|
||||||
private modalRef: NgbModalRef;
|
private modalRef: NgbModalRef;
|
||||||
private dateAdapter = new NgbDateNativeAdapter();
|
private dateAdapter = new NgbDateNativeAdapter();
|
||||||
hoveredDate: NgbDateStruct;
|
hoveredDate: NgbDateStruct;
|
||||||
fromDate: NgbDateStruct;
|
fromDate: NgbDateStruct;
|
||||||
toDate: NgbDateStruct;
|
toDate: NgbDateStruct;
|
||||||
|
|
||||||
@ViewChild('content') _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) {
|
||||||
this.closeModal();
|
this.closeModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input() set startDate(_modalState: Date) {
|
@Input() set startDate(_modalState: Date) {
|
||||||
this.fromDate = this.dateAdapter.fromModel(_modalState);
|
this.fromDate = this.dateAdapter.fromModel(_modalState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input() set endDate(_modalState: Date) {
|
@Input() set endDate(_modalState: Date) {
|
||||||
var 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Output() onCloseModal = new EventEmitter<any>();
|
@Output() onCloseModal = new EventEmitter<any>();
|
||||||
@Output() onSelect = new EventEmitter<{ startDate: Date, endDate: Date }>();
|
@Output() onSelect = new EventEmitter<{ startDate: Date, endDate: Date }>();
|
||||||
|
|
||||||
constructor(private modalService: NgbModal, private calendar: NgbCalendar) { }
|
constructor(private modalService: NgbModal, private calendar: NgbCalendar) { }
|
||||||
|
|
||||||
openModal() {
|
openModal() {
|
||||||
//Timeout trick to avoid ExpressionChangedAfterItHasBeenCheckedError
|
//Timeout trick to avoid ExpressionChangedAfterItHasBeenCheckedError
|
||||||
setTimeout(() => this.modalRef = this.modalService.open(this._templateModal, { backdrop: 'static', keyboard: false}));
|
setTimeout(() => this.modalRef = this.modalService.open(this._templateModal, { backdrop: 'static', keyboard: false}));
|
||||||
}
|
}
|
||||||
|
|
||||||
closeModal() {
|
closeModal() {
|
||||||
this.modalRef.close();
|
this.modalRef.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
onDateChange(date: NgbDateStruct) {
|
onDateChange(date: NgbDateStruct) {
|
||||||
if (!this.fromDate && !this.toDate) {
|
if (!this.fromDate && !this.toDate) {
|
||||||
this.fromDate = date;
|
this.fromDate = date;
|
||||||
} else if (this.fromDate && !this.toDate && after(date, this.fromDate)) {
|
} else if (this.fromDate && !this.toDate && after(date, this.fromDate)) {
|
||||||
this.toDate = date;
|
this.toDate = date;
|
||||||
} else {
|
} else {
|
||||||
this.toDate = null;
|
this.toDate = null;
|
||||||
this.fromDate = date;
|
this.fromDate = date;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)) {
|
||||||
var 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})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isHovered = date => this.fromDate && !this.toDate && this.hoveredDate && after(date, this.fromDate) && before(date, this.hoveredDate);
|
isHovered = date => this.fromDate && !this.toDate && this.hoveredDate && after(date, this.fromDate) && before(date, this.hoveredDate);
|
||||||
isInside = date => after(date, this.fromDate) && before(date, this.toDate);
|
isInside = date => after(date, this.fromDate) && before(date, this.toDate);
|
||||||
isFrom = date => equals(date, this.fromDate);
|
isFrom = date => equals(date, this.fromDate);
|
||||||
isTo = date => equals(date, this.toDate);
|
isTo = date => equals(date, this.toDate);
|
||||||
}
|
}
|
||||||
|
@@ -1,14 +1,13 @@
|
|||||||
@import "../../_theme.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
|
||||||
|
|
||||||
|
|
||||||
|
.row {
|
||||||
.row {
|
border-bottom: 1px solid gray('500');
|
||||||
border-bottom: 1px solid gray('500');
|
user-select: none;
|
||||||
user-select: none;
|
}
|
||||||
}
|
|
||||||
|
.row:hover {
|
||||||
.row:hover {
|
background-color: gray('100');
|
||||||
background-color: gray('100');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -1,40 +1,57 @@
|
|||||||
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
|
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
|
||||||
import { IItem } from '@farmmaps/common';
|
import { IItem } from '@farmmaps/common';
|
||||||
import { AbstractSelectedItemComponent, SelectedItemComponent } from '../selected-item/selected-item.component';
|
import { AbstractSelectedItemComponent, SelectedItemComponent } from '../selected-item/selected-item.component';
|
||||||
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
||||||
|
import { IItemLayer } from '../../models/item.layer';
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'fm-map-selected-item-container',
|
@Component({
|
||||||
templateUrl: './selected-item-container.component.html',
|
selector: 'fm-map-selected-item-container',
|
||||||
styleUrls: ['./selected-item-container.component.scss']
|
templateUrl: './selected-item-container.component.html',
|
||||||
})
|
styleUrls: ['./selected-item-container.component.scss']
|
||||||
export class SelectedItemContainerComponent {
|
})
|
||||||
|
export class SelectedItemContainerComponent {
|
||||||
constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractSelectedItemComponent) public selectedItemComponents: AbstractSelectedItemComponent[] ) {
|
|
||||||
}
|
constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractSelectedItemComponent) public selectedItemComponents: AbstractSelectedItemComponent[] ) {
|
||||||
|
}
|
||||||
@Input() item: IItem;
|
|
||||||
|
@Input() item: IItem;
|
||||||
@ViewChild(WidgetHostDirective) widgetHost: WidgetHostDirective;
|
@Input() itemLayer:IItemLayer
|
||||||
|
|
||||||
loadComponent() {
|
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
|
||||||
var componentFactory: ComponentFactory<AbstractSelectedItemComponent> = this.componentFactoryResolver.resolveComponentFactory(SelectedItemComponent); // default
|
|
||||||
for (var i = 0; i < this.selectedItemComponents.length; i++) {
|
loadComponent() {
|
||||||
if (this.selectedItemComponents[i]['forItemType'] == this.item.itemType) {
|
let componentFactory: ComponentFactory<AbstractSelectedItemComponent> = this.componentFactoryResolver.resolveComponentFactory(SelectedItemComponent); // default
|
||||||
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.selectedItemComponents[i]['constructor'] as any);
|
let firstComponentWithTypeAndTask = this.selectedItemComponents
|
||||||
}
|
.find(value => value['forSourceTask'] == this.item.sourceTask &&
|
||||||
}
|
value['forItemType'] == this.item.itemType
|
||||||
const viewContainerRef = this.widgetHost.viewContainerRef;
|
);
|
||||||
viewContainerRef.clear();
|
|
||||||
|
if (firstComponentWithTypeAndTask) {
|
||||||
const componentRef = viewContainerRef.createComponent(componentFactory);
|
componentFactory = this.componentFactoryResolver.resolveComponentFactory(firstComponentWithTypeAndTask['constructor'] as any);
|
||||||
(<AbstractSelectedItemComponent>componentRef.instance).item = this.item;
|
} else {
|
||||||
}
|
let firstComponentWithType = this.selectedItemComponents
|
||||||
|
.find(value => value['forSourceTask'] == null &&
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
value['forItemType'] == this.item.itemType);
|
||||||
if (changes["item"] && changes["item"].currentValue) {
|
|
||||||
this.loadComponent();
|
if (firstComponentWithType) {
|
||||||
}
|
componentFactory = this.componentFactoryResolver.resolveComponentFactory(firstComponentWithType['constructor'] as any);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const viewContainerRef = this.widgetHost.viewContainerRef;
|
||||||
|
viewContainerRef.clear();
|
||||||
|
|
||||||
|
const componentRef = viewContainerRef.createComponent(componentFactory);
|
||||||
|
(<AbstractSelectedItemComponent>componentRef.instance).item = this.item;
|
||||||
|
(<AbstractSelectedItemComponent>componentRef.instance).itemLayer = this.itemLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
|
if (changes["item"] && changes["item"].currentValue) {
|
||||||
|
this.loadComponent();
|
||||||
|
}
|
||||||
|
if (changes["itemLayer"] && changes["itemLayer"].currentValue) {
|
||||||
|
this.loadComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -3,11 +3,15 @@
|
|||||||
<div class="card border-0">
|
<div class="card border-0">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
|
<div><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
|
||||||
<h4>Cropfield</h4>
|
<div class="card menu-card">
|
||||||
<h1>{{item.name}}</h1>
|
<h1>Cropfield</h1>
|
||||||
<div>{{item.data.cropTypeName}}</div>
|
<h4>{{item.name}}</h4>
|
||||||
<div><span>{{item.data.startDate|date}}</span> - <span>{{item.data.endDate|date}}</span> </div>
|
<div class="card-text"><span>{{areaInHa(item)| number:'1.2-2'}} ha</span> <span>{{item.data.cropTypeName}}</span></div>
|
||||||
<div class="mt-1"><a href="#" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></div>
|
<div class="card-text"><span>{{item.data.startDate|date}}</span> - <span>{{item.data.endDate|date}}</span> </div>
|
||||||
|
<ul class="p-0 mt-2">
|
||||||
|
<li *ngIf="item.isEditable"><a href="#" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<fm-map-item-list [items]="(items|async)"></fm-map-item-list>
|
<fm-map-item-list [items]="(items|async)"></fm-map-item-list>
|
||||||
<fm-map-item-widget-list [item]="item"></fm-map-item-widget-list>
|
<fm-map-item-widget-list [item]="item"></fm-map-item-widget-list>
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
@import "../../_theme.scss";
|
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
|
|
||||||
.big-icon {
|
.big-icon {
|
||||||
@@ -13,6 +12,10 @@
|
|||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card-body {
|
||||||
|
padding-bottom: unset;
|
||||||
|
}
|
||||||
|
|
||||||
.spacer {
|
.spacer {
|
||||||
display: none;
|
display: none;
|
||||||
height: 4rem;
|
height: 4rem;
|
||||||
@@ -23,3 +26,11 @@
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.menu-card {
|
||||||
|
margin-left: -7px;
|
||||||
|
padding-left: 7px;
|
||||||
|
margin-right: -7px;
|
||||||
|
padding-right: 7px;
|
||||||
|
margin-bottom: 7px;
|
||||||
|
}
|
||||||
|
@@ -1,30 +1,43 @@
|
|||||||
import { Component, Input, Injectable, OnInit } from '@angular/core';
|
import { Component, Input, Injectable, OnInit } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
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 { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common';
|
import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common';
|
||||||
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
||||||
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
||||||
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
|
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import {GeoJSON} from 'ol/format';
|
||||||
|
import {getArea} from 'ol/sphere';
|
||||||
@ForItemType("vnd.farmmaps.itemtype.cropfield")
|
|
||||||
@Injectable()
|
|
||||||
@Component({
|
@ForItemType("vnd.farmmaps.itemtype.cropfield")
|
||||||
selector: 'fm-map-selected-item-cropfield',
|
@Injectable()
|
||||||
templateUrl: './selected-item-cropfield.component.html',
|
@Component({
|
||||||
styleUrls: ['./selected-item-cropfield.component.scss']
|
selector: 'fm-map-selected-item-cropfield',
|
||||||
})
|
templateUrl: './selected-item-cropfield.component.html',
|
||||||
export class SelectedItemCropfieldComponent extends AbstractSelectedItemComponent implements OnInit{
|
styleUrls: ['./selected-item-cropfield.component.scss']
|
||||||
|
})
|
||||||
public items: Observable<IListItem[]>;
|
export class SelectedItemCropfieldComponent extends AbstractSelectedItemComponent implements OnInit{
|
||||||
|
|
||||||
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
|
public items: Observable<IListItem[]>;
|
||||||
super(store, itemTypeService,location,router);
|
|
||||||
}
|
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
|
||||||
ngOnInit() {
|
super(store, itemTypeService,location,router);
|
||||||
this.items = this.folderService$.getItems(this.item.code, 0, 1000);
|
}
|
||||||
}
|
|
||||||
}
|
areaInHa(item:IItem):number {
|
||||||
|
if(!item) return 0;
|
||||||
|
// get area from faeture if 0 calculate from polygon
|
||||||
|
let a = item.data.area;
|
||||||
|
if(a) return a;
|
||||||
|
let format = new GeoJSON();
|
||||||
|
let polygon = format.readGeometry(item.geometry);
|
||||||
|
return getArea(polygon,{projection:"EPSG:4326"}) / 10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this. items = this.folderService$.getItems(this.item.code, 0, 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1,22 +1,28 @@
|
|||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
<div *ngIf="item;let item">
|
<div *ngIf="item;let item">
|
||||||
<div class="card border-0">
|
<div class="card border-0">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
|
<div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
|
||||||
<h1>{{item.name}}</h1>
|
<div class="card menu-card">
|
||||||
<div class="legend-container" *ngIf="item?.data.layers;let layers">
|
<h1>{{item.name}}</h1>
|
||||||
<!--<div *ngIf="layers.length>1">
|
</div>
|
||||||
<select (change)="onLayerChanged($event.target.value)">
|
<div class="legend-container" *ngIf="item?.data.layers;let layers">
|
||||||
<option *ngFor="let l of layers;let layerIndex = index" [value]="layerIndex">{{l.name}}</option>
|
<div class="card menu-card">
|
||||||
</select>
|
<div *ngIf="layers.length>1">
|
||||||
</div>-->
|
<select (change)="onLayerChanged($event.target.value)" [value]="itemLayer.layerIndex">
|
||||||
<fm-map-layer-legend [layer]="layers[selectedLayer]" [histogramenabled]="false" histogramunit="ha"></fm-map-layer-legend>
|
<option *ngFor="let l of layers;" [value]="l.index">{{l.name}}</option>
|
||||||
</div>
|
</select>
|
||||||
<ul class="p-0 mt-2">
|
</div>
|
||||||
<!--<li><a href="/api/v1/items/{{item.code}}/file" class="mt-1 mr-1" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a></li>-->
|
<fm-map-layer-legend [layer]="layer(layers,itemLayer.layerIndex)" [histogramenabled]="true"></fm-map-layer-legend>
|
||||||
<li><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li>
|
</div>
|
||||||
<li *ngIf="itemTypeService.isLayer(item)"><a href="#" (click)="handleAddAsLayer(item)" class="mt-1 mr-1" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a></li>
|
</div>
|
||||||
</ul>
|
<div class="card menu-card">
|
||||||
</div>
|
<ul class="p-0 mt-2">
|
||||||
</div>
|
<!--<li><a href="/api/v1/items/{{item.code}}/file" class="mt-1 mr-1" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a></li>-->
|
||||||
</div>
|
<li *ngIf="item.isEditable"><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li>
|
||||||
|
<li *ngIf="itemTypeService.isLayer(item)"><a href="#" (click)="handleAddAsLayer(item,itemLayer.layerIndex)" class="mt-1 mr-1" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@@ -1,33 +1,41 @@
|
|||||||
@import "../../_theme.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
|
||||||
|
.big-icon {
|
||||||
.big-icon {
|
width: 100%;
|
||||||
width: 100%;
|
color: white;
|
||||||
color: white;
|
font-size: 9rem;
|
||||||
font-size: 9rem;
|
padding: 3rem;
|
||||||
padding: 3rem;
|
text-align: center;
|
||||||
text-align: center;
|
}
|
||||||
}
|
|
||||||
|
.card-title {
|
||||||
.card-title {
|
font-size: 1rem;
|
||||||
font-size: 1rem;
|
}
|
||||||
}
|
|
||||||
|
ul {
|
||||||
ul {
|
list-style:none;
|
||||||
list-style:none;
|
}
|
||||||
}
|
|
||||||
|
li {
|
||||||
li {
|
margin-top:1rem;
|
||||||
margin-top:1rem;
|
}
|
||||||
}
|
|
||||||
|
.spacer {
|
||||||
.spacer {
|
display:none;
|
||||||
display:none;
|
height:4rem;
|
||||||
height:4rem;
|
}
|
||||||
}
|
|
||||||
|
@media screen and (min-width:44rem) {
|
||||||
@media screen and (min-width:44rem) {
|
.spacer {
|
||||||
.spacer {
|
display:block;
|
||||||
display:block;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
.menu-card {
|
||||||
|
margin-left: -7px;
|
||||||
|
padding-left: 7px;
|
||||||
|
margin-right: -7px;
|
||||||
|
padding-right: 7px;
|
||||||
|
margin-bottom: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1,30 +1,34 @@
|
|||||||
import { Component, Input, Injectable, OnInit } from '@angular/core';
|
import { Component, Injectable } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { Feature } from 'ol';
|
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 { commonReducers, ItemTypeService, ItemService, FolderService } from '@farmmaps/common';
|
||||||
import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common';
|
import { Router } from '@angular/router';
|
||||||
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
||||||
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
|
||||||
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
|
import * as mapActions from '../../actions/map.actions';
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
|
|
||||||
|
@ForItemType("vnd.farmmaps.itemtype.geotiff.processed")
|
||||||
@ForItemType("vnd.farmmaps.itemtype.geotiff.processed")
|
@Injectable()
|
||||||
@Injectable()
|
@Component({
|
||||||
@Component({
|
selector: 'fm-map-selected-item-geotiff',
|
||||||
selector: 'fm-map-selected-item-geotiff',
|
templateUrl: './selected-item-geotiff.component.html',
|
||||||
templateUrl: './selected-item-geotiff.component.html',
|
styleUrls: ['./selected-item-geotiff.component.scss']
|
||||||
styleUrls: ['./selected-item-geotiff.component.scss']
|
})
|
||||||
})
|
export class SelectedItemGeotiffComponent extends AbstractSelectedItemComponent {
|
||||||
export class SelectedItemGeotiffComponent 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: number = 0;
|
||||||
public selectedLayer: number = 0;
|
|
||||||
|
onLayerChanged(layerIndex: number) {
|
||||||
onLayerChanged(layerIndex: number) {
|
this.selectedLayer = layerIndex;
|
||||||
this.selectedLayer = layerIndex;
|
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
layer(layers:any,layerIndex:number) {
|
||||||
|
return layers.find(l => l.index == layerIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -3,20 +3,26 @@
|
|||||||
<div class="card border-0">
|
<div class="card border-0">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
|
<div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
|
||||||
<h1>{{item.name}}</h1>
|
<div class="card menu-card">
|
||||||
<div class="legend-container" *ngIf="item?.data.layers;let layers">
|
<h1>{{item.name}}</h1>
|
||||||
<div *ngIf="layers.length>1">
|
|
||||||
<select (change)="onLayerChanged($event.target.value)">
|
|
||||||
<option *ngFor="let l of layers;" [value]="l.index">{{l.name}}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<fm-map-layer-legend [showTitle]="layers.length==1" [layer]="layers[selectedLayer]" [histogramenabled]="false" histogramunit="ha"></fm-map-layer-legend>
|
|
||||||
</div>
|
</div>
|
||||||
<ul class="p-0 mt-2">
|
<div class="legend-container" *ngIf="item?.data.layers;let layers">
|
||||||
<!--<li><a href="/api/v1/items/{{item.code}}/file" class="mt-1 mr-1" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a></li>-->
|
<div class="card menu-card">
|
||||||
<li><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li>
|
<div *ngIf="layers.length>1">
|
||||||
<li *ngIf="itemTypeService.isLayer(item)"><a href="#" (click)="handleAddAsLayer(item,selectedLayer)" class="mt-1 mr-1" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a></li>
|
<select (change)="onLayerChanged($event.target.value)" [value]="itemLayer.layerIndex">
|
||||||
</ul>
|
<option *ngFor="let l of layers;" [value]="l.index">{{l.name}}</option>
|
||||||
</div>
|
</select>
|
||||||
|
</div>
|
||||||
|
<fm-map-layer-legend [showTitle]="layers.length==1" [layer]="layer(layers,itemLayer.layerIndex)" [histogramenabled]="true"></fm-map-layer-legend>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card menu-card">
|
||||||
|
<ul class="p-0 mt-2">
|
||||||
|
<!--<li><a href="/api/v1/items/{{item.code}}/file" class="mt-1 mr-1" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a></li>-->
|
||||||
|
<li *ngIf="item.isEditable"><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li>
|
||||||
|
<li *ngIf="itemTypeService.isLayer(item)"><a href="#" (click)="handleAddAsLayer(item,itemLayer.layerIndex)" class="mt-1 mr-1" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
@import "../../_theme.scss";
|
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
|
|
||||||
.big-icon {
|
.big-icon {
|
||||||
@@ -39,3 +38,11 @@ li {
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.menu-card {
|
||||||
|
margin-left: -7px;
|
||||||
|
padding-left: 7px;
|
||||||
|
margin-right: -7px;
|
||||||
|
padding-right: 7px;
|
||||||
|
margin-bottom: 7px;
|
||||||
|
}
|
||||||
|
@@ -1,32 +1,34 @@
|
|||||||
import { Component, Input, Injectable, OnInit } from '@angular/core';
|
import { Component, Input, Injectable, OnInit } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
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 { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common';
|
import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common';
|
||||||
import * as mapActions from '../../actions/map.actions';
|
import * as mapActions from '../../actions/map.actions';
|
||||||
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
||||||
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
||||||
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
|
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
|
||||||
@ForItemType("vnd.farmmaps.itemtype.shape.processed")
|
@ForItemType("vnd.farmmaps.itemtype.shape.processed")
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-selected-item-shape',
|
selector: 'fm-map-selected-item-shape',
|
||||||
templateUrl: './selected-item-shape.component.html',
|
templateUrl: './selected-item-shape.component.html',
|
||||||
styleUrls: ['./selected-item-shape.component.scss']
|
styleUrls: ['./selected-item-shape.component.scss']
|
||||||
})
|
})
|
||||||
export class SelectedItemShapeComponent extends AbstractSelectedItemComponent {
|
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: number = 0;
|
|
||||||
|
onLayerChanged(layerIndex: number) {
|
||||||
onLayerChanged(layerIndex: number) {
|
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
|
||||||
this.selectedLayer = layerIndex;
|
}
|
||||||
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
|
|
||||||
}
|
layer(layers:any,layerIndex:number) {
|
||||||
}
|
return layers.find(l => l.index == layerIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -0,0 +1,43 @@
|
|||||||
|
<div class="spacer"></div>
|
||||||
|
<div *ngIf="selectedItem();let item">
|
||||||
|
<div class="card border-0">
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
|
||||||
|
<div class="card menu-card">
|
||||||
|
<h1>{{item.name}}</h1>
|
||||||
|
</div>
|
||||||
|
<div class="legend-container" *ngIf="item?.data.layers;let layers">
|
||||||
|
<div class="card menu-card">
|
||||||
|
<h5>Date image: {{item.dataDate | date:'shortDate'}}</h5>
|
||||||
|
<div class="d-flex justify-content-between">
|
||||||
|
<div *ngIf="hasPrevious()">
|
||||||
|
<button type="button" class="btn btn-link p-0" (click)="handlePreviousTemporal($event)" i18n>
|
||||||
|
<i class="fa fa-arrow-circle-left" aria-hidden="true" title="Previous"></i> {{ previousDate() | date:'shortDate'}}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="hasNext()">
|
||||||
|
<button type="button" class="btn btn-link p-0" (click)="handleNextTemporal($event)" i18n>
|
||||||
|
{{ nextDate()| date:'shortDate' }} <i class="fa fa-arrow-circle-right" aria-hidden="true" title="Next"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card menu-card pt-2">
|
||||||
|
<div *ngIf="layers.length>1">
|
||||||
|
<select (change)="onLayerChanged($event.target.value)" [value]="itemLayer.layerIndex">
|
||||||
|
<option *ngFor="let l of layers;" [value]="l.index">{{l.name}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<fm-map-layer-legend [layer]="layer(layers,itemLayer.layerIndex)" [histogramenabled]="true"></fm-map-layer-legend>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="card menu-card">
|
||||||
|
<ul class="p-0 mt-2">
|
||||||
|
<li *ngIf="item.isEditable"><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li>
|
||||||
|
<li *ngIf="itemTypeService.isLayer(item)"><a href="#" (click)="handleAddAsLayer(item,itemLayer.layerIndex)" class="mt-1 mr-1" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a></li>
|
||||||
|
<li><a href="#" (click)="handleGoToChart(item)" i18n><i class="fa fa-line-chart" aria-hidden="true" title="Edit"></i> Show chart</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@@ -0,0 +1,41 @@
|
|||||||
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
|
|
||||||
|
.big-icon {
|
||||||
|
width: 100%;
|
||||||
|
color: white;
|
||||||
|
font-size: 9rem;
|
||||||
|
padding: 3rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-title {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
list-style:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
margin-top:1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spacer {
|
||||||
|
display:none;
|
||||||
|
height:4rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width:44rem) {
|
||||||
|
.spacer {
|
||||||
|
display:block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-card {
|
||||||
|
margin-left: -7px;
|
||||||
|
padding-left: 7px;
|
||||||
|
margin-right: -7px;
|
||||||
|
padding-right: 7px;
|
||||||
|
margin-bottom: 7px;
|
||||||
|
}
|
||||||
|
|
@@ -0,0 +1,80 @@
|
|||||||
|
import { Component, Injectable } from '@angular/core';
|
||||||
|
import { Location } from '@angular/common';
|
||||||
|
import { Store } from '@ngrx/store';
|
||||||
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
|
import { commonReducers, ItemTypeService, ItemService, FolderService,IItem } from '@farmmaps/common';
|
||||||
|
import { Router } from '@angular/router';
|
||||||
|
import { ForItemType } from '../for-item/for-itemtype.decorator';
|
||||||
|
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
|
||||||
|
import { ITemporalItemLayer} from '../../models/item.layer';
|
||||||
|
import * as mapActions from '../../actions/map.actions';
|
||||||
|
|
||||||
|
|
||||||
|
@ForItemType("vnd.farmmaps.itemtype.temporal")
|
||||||
|
@Injectable()
|
||||||
|
@Component({
|
||||||
|
selector: 'fm-map-selected-item-temporal',
|
||||||
|
templateUrl: './selected-item-temporal.component.html',
|
||||||
|
styleUrls: ['./selected-item-temporal.component.scss']
|
||||||
|
})
|
||||||
|
export class SelectedItemTemporalComponent extends AbstractSelectedItemComponent {
|
||||||
|
|
||||||
|
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
|
||||||
|
super(store, itemTypeService,location,router);
|
||||||
|
}
|
||||||
|
|
||||||
|
onLayerChanged(layerIndex: number) {
|
||||||
|
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
|
||||||
|
}
|
||||||
|
|
||||||
|
hasNext():boolean {
|
||||||
|
let temporalItemLayer = this.itemLayer as ITemporalItemLayer;
|
||||||
|
return temporalItemLayer && temporalItemLayer.nextItemLayer != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
nextDate():Date {
|
||||||
|
let temporalItemLayer = this.itemLayer as ITemporalItemLayer;
|
||||||
|
if(temporalItemLayer.nextItemLayer.item)
|
||||||
|
return temporalItemLayer.nextItemLayer.item.dataDate;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
hasPrevious():boolean {
|
||||||
|
let temporalItemLayer = this.itemLayer as ITemporalItemLayer;
|
||||||
|
return temporalItemLayer && temporalItemLayer.previousItemLayer != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
previousDate():Date {
|
||||||
|
let temporalItemLayer = this.itemLayer as ITemporalItemLayer;
|
||||||
|
if(temporalItemLayer.previousItemLayer.item)
|
||||||
|
return temporalItemLayer.previousItemLayer.item.dataDate;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleNextTemporal(event:MouseEvent) {
|
||||||
|
this.store.dispatch(new mapActions.NextTemporal());
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
handlePreviousTemporal(event:MouseEvent) {
|
||||||
|
this.store.dispatch(new mapActions.PreviousTemporal());
|
||||||
|
event.preventDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedItem():IItem {
|
||||||
|
let temporalItemLayer = this.itemLayer as ITemporalItemLayer;
|
||||||
|
if(temporalItemLayer && temporalItemLayer.selectedItemLayer) {
|
||||||
|
return temporalItemLayer.selectedItemLayer.item;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
layer(layers:any,layerIndex:number) {
|
||||||
|
return layers.find(l => l.index == layerIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleGoToChart(item: IItem) {
|
||||||
|
this.router.navigate(['/viewer', 'temporal', 'item', item.parentCode, item.dataDate.getUTCFullYear()]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,16 +1,18 @@
|
|||||||
<div *ngIf="item;let item">
|
<div *ngIf="item;let item">
|
||||||
<div class="card border-0">
|
<div class="card border-0">
|
||||||
<img *ngIf="item.thumbnail" class="card-img-top" [src]="'/api/v1/items/'+item.code+'/thumbnail?v='+item.updated.getTime()" />
|
<img *ngIf="item.thumbnail" class="card-img-top" [src]="config.getConfig('apiEndPoint') +'/api/v1/items/'+item.code+'/thumbnail?v='+item.updated.getTime()" />
|
||||||
<div *ngIf="!item.thumbnail" class="big-icon" [style.background-color]="itemTypeService.getColor(item.itemType)">
|
<div *ngIf="!item.thumbnail" class="big-icon" [style.background-color]="itemTypeService.getColor(item.itemType)">
|
||||||
<i [ngClass]="itemTypeService.getIcon(item.itemType)"></i>
|
<i [ngClass]="itemTypeService.getIcon(item.itemType)"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
</div>
|
||||||
<div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
|
<div class="card">
|
||||||
<h1 class="card-title">{{item.name}}</h1>
|
<div class="card-body">
|
||||||
<a *ngIf="itemTypeService.hasViewer(item)" href="#" (click)="handleOnView(item)" class="btn btn-outline-secondary" i18n><i class="fa fa-eye" aria-hidden="true" title="View"></i> View</a>
|
<div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
|
||||||
<a href="/api/v1/items/{{item.code}}/data" class="btn btn-outline-secondary" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a>
|
<h1 class="card-title">{{item.name}}</h1>
|
||||||
<a href="#" class="btn btn-outline-secondary" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a>
|
<a *ngIf="itemTypeService.hasViewer(item)" href="#" (click)="handleOnView(item)" class="btn btn-outline-secondary" i18n><i class="fa fa-eye" aria-hidden="true" title="View"></i> View</a>
|
||||||
<a *ngIf="itemTypeService.isLayer(item)" href="#" (click)="handleAddAsLayer(item)" class="btn btn-outline-secondary" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a>
|
<!-- <a [href]="config.getConfig('apiEndPoint')+ '/api/v1/items/'+ item.code+ '/download'" class="btn btn-outline-secondary" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a> -->
|
||||||
</div>
|
<a *ngIf="item.isEditable" href="#" class="btn btn-outline-secondary" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a>
|
||||||
</div>
|
<a *ngIf="itemTypeService.isLayer(item)" href="#" (click)="handleAddAsLayer(item)" class="btn btn-outline-secondary" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@@ -1,14 +1,13 @@
|
|||||||
@import "../../theme.scss";
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
|
||||||
|
.big-icon {
|
||||||
.big-icon {
|
width: 100%;
|
||||||
width: 100%;
|
color: white;
|
||||||
color: white;
|
font-size: 9rem;
|
||||||
font-size: 9rem;
|
padding: 3rem;
|
||||||
padding: 3rem;
|
text-align: center;
|
||||||
text-align: center;
|
}
|
||||||
}
|
|
||||||
|
.card-title {
|
||||||
.card-title {
|
font-size: 1rem;
|
||||||
font-size: 1rem;
|
}
|
||||||
}
|
|
||||||
|
@@ -1,56 +1,59 @@
|
|||||||
import { Component, Input, Injectable } from '@angular/core';
|
import {Component, Injectable, Input} from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import {Location} from '@angular/common';
|
||||||
import { Feature } from 'ol';
|
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 {AppConfig, commonReducers, IItem, ItemTypeService} from '@farmmaps/common';
|
||||||
import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common';
|
import * as mapActions from '../../actions/map.actions';
|
||||||
import * as mapActions from '../../actions/map.actions';
|
import {Router} from '@angular/router';
|
||||||
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
|
import { IItemLayer } from '../../models/item.layer';
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export abstract class AbstractSelectedItemComponent {
|
export abstract class AbstractSelectedItemComponent {
|
||||||
@Input() item: IItem
|
@Input() item: IItem
|
||||||
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location, private router: Router) {
|
@Input() itemLayer: IItemLayer
|
||||||
}
|
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location, public router: Router) {
|
||||||
|
}
|
||||||
handleOnView(item: IItem) {
|
|
||||||
var itemType = this.itemTypeService.itemTypes[item.itemType];
|
handleOnView(item: IItem) {
|
||||||
if (itemType) {
|
if (this.itemTypeService.hasViewer(item)) {
|
||||||
if (itemType.viewer) {
|
let viewer = this.itemTypeService.itemTypes[item.itemType].viewer;
|
||||||
let url = `/viewer/${itemType.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) {
|
var editor = "property";
|
||||||
let url = `/editor/property/item/${item.code}`;
|
if(this.itemTypeService.hasEditor(item)) {
|
||||||
this.router.navigate([url]);
|
editor = this.itemTypeService.itemTypes[item.itemType].editor;
|
||||||
return false;
|
}
|
||||||
}
|
let url = `/editor/${editor}/item/${item.code}`
|
||||||
|
this.router.navigate([url]);
|
||||||
handleAddAsLayer(item: IItem,layerIndex:number = -1) {
|
return false;
|
||||||
this.store.dispatch(new mapActions.AddLayer(item,layerIndex));
|
}
|
||||||
return false;
|
|
||||||
}
|
handleAddAsLayer(item: IItem,layerIndex:number = -1) {
|
||||||
|
this.store.dispatch(new mapActions.AddLayer(item,layerIndex));
|
||||||
handleBackToList(event: MouseEvent) {
|
return false;
|
||||||
event.preventDefault();
|
}
|
||||||
this.location.back();
|
|
||||||
}
|
handleBackToList(event: MouseEvent) {
|
||||||
}
|
event.preventDefault();
|
||||||
|
this.location.back();
|
||||||
@Injectable()
|
}
|
||||||
@Component({
|
}
|
||||||
selector: 'fm-map-selected-item',
|
|
||||||
templateUrl: './selected-item.component.html',
|
@Injectable()
|
||||||
styleUrls: ['./selected-item.component.scss']
|
@Component({
|
||||||
})
|
selector: 'fm-map-selected-item',
|
||||||
export class SelectedItemComponent extends AbstractSelectedItemComponent {
|
templateUrl: './selected-item.component.html',
|
||||||
|
styleUrls: ['./selected-item.component.scss']
|
||||||
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router) {
|
})
|
||||||
super(store, itemTypeService,location,router);
|
export class SelectedItemComponent extends AbstractSelectedItemComponent {
|
||||||
}
|
|
||||||
}
|
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, public config:AppConfig) {
|
||||||
|
super(store, itemTypeService,location,router);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1,230 +1,298 @@
|
|||||||
import { Injectable, Inject } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
|
||||||
|
import { Store, Action } from '@ngrx/store';
|
||||||
import { Store, Action } from '@ngrx/store';
|
import { Effect, Actions,ofType } from '@ngrx/effects';
|
||||||
import { Effect, Actions,ofType } from '@ngrx/effects';
|
|
||||||
|
import { Observable , of } from 'rxjs';
|
||||||
import { Observable , of } from 'rxjs';
|
import { withLatestFrom, switchMap, map, catchError, mergeMap } from 'rxjs/operators';
|
||||||
import { withLatestFrom, switchMap, map, catchError, mergeMap, delay} from 'rxjs/operators';
|
|
||||||
|
import {GeoJSON,WKT} from 'ol/format';
|
||||||
import {GeoJSON} from 'ol/format';
|
import {Feature} from 'ol';
|
||||||
import {Feature} from 'ol';
|
import { getCenter } from 'ol/extent';
|
||||||
import { getCenter, Extent, createEmpty, extend} from 'ol/extent';
|
import {Point} from 'ol/geom'
|
||||||
import {Point} from 'ol/geom'
|
|
||||||
|
|
||||||
|
import * as mapActions from '../actions/map.actions';
|
||||||
import * as mapActions from '../actions/map.actions';
|
import * as mapReducers from '../reducers/map.reducer';
|
||||||
import * as mapReducers from '../reducers/map.reducer';
|
import {commonReducers} from '@farmmaps/common';
|
||||||
import {commonReducers} from '@farmmaps/common';
|
|
||||||
|
import {commonActions} from '@farmmaps/common';
|
||||||
import {commonActions} from '@farmmaps/common';
|
|
||||||
|
import { IItem } from '@farmmaps/common';
|
||||||
import { IListItem, IItem } from '@farmmaps/common';
|
import { FolderService, ItemService } from '@farmmaps/common';
|
||||||
import { FolderService, ItemService } from '@farmmaps/common';
|
import { tassign } from 'tassign';
|
||||||
import { tassign } from 'tassign';
|
|
||||||
|
import {FeatureIconService} from '../services/feature-icon.service';
|
||||||
@Injectable()
|
|
||||||
export class MapEffects {
|
import * as style from 'ol/style';
|
||||||
private _format: GeoJSON;
|
|
||||||
|
import { ItemTypeService } from '@farmmaps/common';
|
||||||
private toPointFeature(feature: any): Feature {
|
import { Router } from '@angular/router';
|
||||||
var f = this._format.readFeature(feature);
|
|
||||||
var centroid = getCenter(f.getGeometry().getExtent());
|
|
||||||
f.setGeometry(new Point(centroid));
|
|
||||||
return f;
|
@Injectable()
|
||||||
}
|
export class MapEffects {
|
||||||
|
private _geojsonFormat: GeoJSON;
|
||||||
@Effect()
|
private _wktFormat: WKT;
|
||||||
init$: Observable<Action> = this.actions$.pipe(
|
|
||||||
ofType(mapActions.INIT),
|
private toPointFeature(updateEvent:commonActions.DeviceUpdateEvent): Feature {
|
||||||
withLatestFrom(this.store$.select(commonReducers.selectGetRootItems)),
|
var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
|
||||||
switchMap(([action, rootItems]) => {
|
dataProjection: 'EPSG:4326',
|
||||||
for (let rootItem of rootItems) {
|
featureProjection: 'EPSG:3857'
|
||||||
if (rootItem.itemType == "UPLOADS_FOLDER") return of(new mapActions.SetParent(rootItem.code));
|
});
|
||||||
}
|
f.setId(updateEvent.itemCode);
|
||||||
return [];
|
var centroid = getCenter(f.getGeometry().getExtent());
|
||||||
}
|
f.setGeometry(new Point(centroid));
|
||||||
));
|
return f;
|
||||||
|
}
|
||||||
@Effect()
|
|
||||||
initBaseLayers$: Observable<Action> = this.actions$.pipe(
|
@Effect()
|
||||||
ofType(mapActions.INIT),
|
init$: Observable<Action> = this.actions$.pipe(
|
||||||
withLatestFrom(this.store$.select(mapReducers.selectGetProjection)),
|
ofType(mapActions.INIT),
|
||||||
map(([action, projection]) => new mapActions.LoadBaseLayers(projection)));
|
withLatestFrom(this.store$.select(commonReducers.selectGetRootItems)),
|
||||||
|
switchMap(([action, rootItems]) => {
|
||||||
@Effect()
|
let actions=[];
|
||||||
loadBaseLayers$: Observable<Action> = this.actions$.pipe(
|
for (let rootItem of rootItems) {
|
||||||
ofType(mapActions.LOADBASELAYERS),
|
if (rootItem.itemType == "UPLOADS_FOLDER") actions.push(new mapActions.SetParent(rootItem.code));
|
||||||
switchMap((action: mapActions.LoadBaseLayers) => {
|
}
|
||||||
return this.itemService$.getItemList("vnd.farmmaps.itemtype.layer", { "isBaseLayer": true }).pipe(
|
// initialize default feature styles
|
||||||
map((items: IItem[]) => new mapActions.LoadBaseLayersSuccess(items)),
|
actions.push(new mapActions.SetStyle('file',new style.Style({
|
||||||
catchError(error => of(new commonActions.Fail(error))));
|
image: new style.Icon({
|
||||||
}));
|
anchor: [0.5, 1],
|
||||||
|
scale: 0.05,
|
||||||
@Effect()
|
src: this.featureIconService$.getIconImageDataUrl("fa fa-file-o")
|
||||||
initRootItems$: Observable<Action> = this.actions$.pipe(
|
}),
|
||||||
ofType(commonActions.INITROOTSUCCESS),
|
stroke: new style.Stroke({
|
||||||
map((action) => new mapActions.Init()
|
color: 'red',
|
||||||
));
|
width: 1
|
||||||
|
}),
|
||||||
@Effect()
|
fill: new style.Fill({
|
||||||
startSearch$: Observable<Action> = this.actions$.pipe(
|
color: 'rgba(0, 0, 255, 0.1)'
|
||||||
ofType(mapActions.STARTSEARCH),
|
})
|
||||||
switchMap((action: mapActions.StartSearch) => {
|
})));
|
||||||
console.debug("Start search");
|
actions.push(new mapActions.SetStyle('selected',new style.Style({
|
||||||
var startDate = action.queryState.startDate;
|
image: new style.Icon({
|
||||||
var endDate = action.queryState.endDate;
|
anchor: [0.5, 1],
|
||||||
var newAction;
|
scale: 0.08,
|
||||||
if (action.queryState.itemCode || action.queryState.parentCode || action.queryState.itemType || action.queryState.query || action.queryState.tags) {
|
src: this.featureIconService$.getIconImageDataUrl(null)
|
||||||
newAction= this.itemService$.getFeatures(action.queryState.bbox, "EPSG:3857", action.queryState.query, action.queryState.tags, startDate, endDate, action.queryState.itemType, action.queryState.parentCode).pipe(
|
}),
|
||||||
switchMap((features: any) => {
|
stroke: new style.Stroke({
|
||||||
for (let f of features.features) {
|
color: 'red',
|
||||||
if (f.properties && f.properties["code"]) {
|
width: 3
|
||||||
f.id = f.properties["code"];
|
}),
|
||||||
}
|
fill: new style.Fill({
|
||||||
}
|
color: 'rgba(0, 0, 255, 0.1)'
|
||||||
return of(new mapActions.StartSearchSuccess(this._format.readFeatures(features), action.queryState));
|
})
|
||||||
}
|
})));
|
||||||
),
|
|
||||||
catchError(error => of(new commonActions.Fail(error))));
|
return actions;
|
||||||
} else {
|
}
|
||||||
newAction= of(new commonActions.Escape(true,false));
|
));
|
||||||
}
|
|
||||||
return newAction;
|
@Effect()
|
||||||
}));
|
initBaseLayers$: Observable<Action> = this.actions$.pipe(
|
||||||
|
ofType(mapActions.INIT),
|
||||||
|
withLatestFrom(this.store$.select(mapReducers.selectGetProjection)),
|
||||||
@Effect()
|
map(([action, projection]) => new mapActions.LoadBaseLayers(projection)));
|
||||||
startSearchSucces$: Observable<Action> = this.actions$.pipe(
|
|
||||||
ofType(mapActions.STARTSEARCHSUCCESS),
|
@Effect()
|
||||||
mergeMap((action: mapActions.StartSearchSuccess) => {
|
loadBaseLayers$: Observable<Action> = this.actions$.pipe(
|
||||||
if (action.query.bboxFilter) {
|
ofType(mapActions.LOADBASELAYERS),
|
||||||
return [];
|
switchMap((action: mapActions.LoadBaseLayers) => {
|
||||||
} else {
|
return this.itemService$.getItemList("vnd.farmmaps.itemtype.layer", { "isBaseLayer": true }).pipe(
|
||||||
var extent = createEmpty();
|
map((items: IItem[]) => new mapActions.LoadBaseLayersSuccess(items)),
|
||||||
|
catchError(error => of(new commonActions.Fail(error))));
|
||||||
if (extent) {
|
}));
|
||||||
for (let f of action.features) {
|
|
||||||
extend(extent, (f as Feature).getGeometry().getExtent());
|
@Effect()
|
||||||
}
|
initRootItems$: Observable<Action> = this.actions$.pipe(
|
||||||
}
|
ofType(commonActions.INITROOTSUCCESS),
|
||||||
//return [];
|
map((action) => new mapActions.Init()
|
||||||
return of(new mapActions.SetExtent(extent));
|
));
|
||||||
}
|
|
||||||
}));
|
@Effect()
|
||||||
|
startSearch$: Observable<Action> = this.actions$.pipe(
|
||||||
@Effect()
|
ofType(mapActions.STARTSEARCH),
|
||||||
selectItem$: Observable<Action> = this.actions$.pipe(
|
switchMap((action: mapActions.StartSearch) => {
|
||||||
ofType(mapActions.SELECTITEM),
|
console.debug("Start search");
|
||||||
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
|
var startDate = action.queryState.startDate;
|
||||||
switchMap(([action, selectedItem]) => {
|
var endDate = action.queryState.endDate;
|
||||||
let a = action as mapActions.SelectItem;
|
var newAction:Observable<Action>;
|
||||||
let itemCode = selectedItem ? selectedItem.code : "";
|
if (action.queryState.itemCode || action.queryState.parentCode || action.queryState.itemType || action.queryState.query || action.queryState.tags) {
|
||||||
if (a.itemCode != itemCode) {
|
newAction= this.itemService$.getFeatures(action.queryState.bbox, "EPSG:3857", action.queryState.query, action.queryState.tags, startDate, endDate, action.queryState.itemType, action.queryState.parentCode).pipe(
|
||||||
return this.itemService$.getItem(a.itemCode).pipe(
|
switchMap((features: any) => {
|
||||||
map((item: IItem) => new mapActions.SelectItemSuccess(item)),
|
for (let f of features.features) {
|
||||||
catchError(error => of(new commonActions.Fail(error))))
|
if (f.properties && f.properties["code"]) {
|
||||||
} else {
|
f.id = f.properties["code"];
|
||||||
return [];
|
}
|
||||||
}
|
}
|
||||||
}
|
return of(new mapActions.StartSearchSuccess(this._geojsonFormat.readFeatures(features), action.queryState));
|
||||||
));
|
}
|
||||||
|
),
|
||||||
@Effect()
|
catchError(error => of(new commonActions.Fail(error))));
|
||||||
selectItemSuccess$: Observable<Action> = this.actions$.pipe(
|
} else {
|
||||||
ofType(mapActions.SELECTITEMSUCCESS),
|
newAction= of(new commonActions.Escape(true,false));
|
||||||
switchMap((action:mapActions.SelectItemSuccess) => {
|
}
|
||||||
return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe(
|
return newAction;
|
||||||
map((feature: IItem) => new mapActions.AddFeatureSuccess(this._format.readFeature(feature) )),
|
}));
|
||||||
catchError(error => of(new commonActions.Fail(error))));
|
|
||||||
}
|
|
||||||
));
|
@Effect()
|
||||||
|
startSearchSucces$: Observable<Action> = this.actions$.pipe(
|
||||||
@Effect()
|
ofType(mapActions.STARTSEARCHSUCCESS),
|
||||||
uploadedItemClick$: Observable<Action> = this.actions$.pipe(
|
mergeMap((action: mapActions.StartSearchSuccess) => {
|
||||||
ofType(commonActions.UPLOADEDFILECLICK),
|
return [new commonActions.SetMenuVisible(false)];
|
||||||
switchMap((action: commonActions.UploadedFileClick) => of(new mapActions.DoQuery(tassign(mapReducers.initialState.query, {itemCode:action.itemCode})))
|
}));
|
||||||
));
|
|
||||||
|
@Effect()
|
||||||
//@Effect()
|
selectItem$: Observable<Action> = this.actions$.pipe(
|
||||||
//itemAdded$: Observable<Action> = this.actions$.pipe(
|
ofType(mapActions.SELECTITEM),
|
||||||
// ofType(commonActions.ITEMADDEDEVENT),
|
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
|
||||||
// withLatestFrom(this.store$.select(mapReducers.selectGetParentCode)),
|
switchMap(([action, selectedItem]) => {
|
||||||
// mergeMap(([action, parentCode]) => {
|
let a = action as mapActions.SelectItem;
|
||||||
// let itemAddedAction = action as commonActions.ItemAddedEvent;
|
let itemCode = selectedItem ? selectedItem.code : "";
|
||||||
// if (parentCode && itemAddedAction.attributes["parentCode"] == parentCode) {
|
if (a.itemCode != itemCode) {
|
||||||
// return this.itemService$.getFeature(itemAddedAction.itemCode,"EPSG:3857").pipe(
|
return this.itemService$.getItem(a.itemCode).pipe(
|
||||||
// map((feature: Feature) => new mapActions.AddFeatureSuccess(this.toPointFeature(feature))),
|
map((item: IItem) => new mapActions.SelectItemSuccess(item)),
|
||||||
// catchError(error => of(new commonActions.Fail(error))))
|
catchError(error => of(new commonActions.Fail(error))))
|
||||||
// } else
|
} else {
|
||||||
// return [
|
return [];
|
||||||
// ];
|
}
|
||||||
// }));
|
}
|
||||||
|
));
|
||||||
@Effect()
|
|
||||||
featureUpdate$: Observable<Action> = this.actions$.pipe(
|
@Effect()
|
||||||
ofType(commonActions.ITEMCHANGEDEVENT),
|
selectItemSuccess$: Observable<Action> = this.actions$.pipe(
|
||||||
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
|
ofType(mapActions.SELECTITEMSUCCESS),
|
||||||
mergeMap(([action, features]) => {
|
switchMap((action:mapActions.SelectItemSuccess) => {
|
||||||
let itemChangedAction = action as commonActions.ItemChangedEvent;
|
return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe(
|
||||||
var feature: Feature = null;
|
map((feature: any) => {
|
||||||
for (let f of features) {
|
let f = this._geojsonFormat.readFeature(feature);
|
||||||
if (f.get("code") == itemChangedAction.itemCode) {
|
f.setId(action.item.code);
|
||||||
feature = f;
|
return new mapActions.AddFeatureSuccess(f );
|
||||||
break;
|
}),
|
||||||
}
|
catchError(error => of(new commonActions.Fail(error))));
|
||||||
}
|
}
|
||||||
if (feature) {
|
));
|
||||||
return this.itemService$.getFeature(itemChangedAction.itemCode, "EPSG:3857").pipe(
|
|
||||||
map((feature: any) => new mapActions.UpdateFeatureSuccess(this.toPointFeature(feature))),
|
@Effect()
|
||||||
catchError(error => of(new commonActions.Fail(error))));
|
selectItemSuccessTemporal$: Observable<Action> = this.actions$.pipe(
|
||||||
} else {
|
ofType(mapActions.SELECTITEMSUCCESS),
|
||||||
return [];
|
switchMap((action:mapActions.SelectItemSuccess) => {
|
||||||
}
|
if(action.item.itemType == "vnd.farmmaps.itemtype.temporal") {
|
||||||
}));
|
return this.itemService$.getChildItemList(action.item.code,null).pipe(
|
||||||
|
map(items => new mapActions.SelectTemporalItemsSuccess(
|
||||||
@Effect()
|
items.sort((a, b) =>
|
||||||
itemUpdate$: Observable<Action> = this.actions$.pipe(
|
-(b.dataDate.getTime() - a.dataDate.getTime())
|
||||||
ofType(commonActions.ITEMCHANGEDEVENT),
|
)
|
||||||
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
|
)),
|
||||||
mergeMap(([action, selectedItem]) => {
|
catchError(error => of(new commonActions.Fail(error))));
|
||||||
let itemChangedAction = action as commonActions.ItemChangedEvent;
|
} else {
|
||||||
if (selectedItem && selectedItem.code == itemChangedAction.itemCode) {
|
return [];
|
||||||
return this.itemService$.getItem(itemChangedAction.itemCode).pipe(
|
}
|
||||||
map((item: IItem) => new mapActions.SelectItemSuccess(item)),
|
}
|
||||||
catchError(error => of(new commonActions.Fail(error))));
|
));
|
||||||
} else {
|
|
||||||
return [];
|
@Effect()
|
||||||
}
|
uploadedItemClick$: Observable<Action> = this.actions$.pipe(
|
||||||
}));
|
ofType(commonActions.UPLOADEDFILECLICK),
|
||||||
|
switchMap((action: commonActions.UploadedFileClick) => of(new mapActions.DoQuery(tassign(mapReducers.initialState.query, {itemCode:action.itemCode})))
|
||||||
@Effect()
|
));
|
||||||
setQueryState$: Observable<Action> = this.actions$.pipe(
|
|
||||||
ofType(mapActions.SETQUERYSTATE),
|
//@Effect()
|
||||||
switchMap((action: mapActions.SetQueryState) => {
|
//itemAdded$: Observable<Action> = this.actions$.pipe(
|
||||||
var newAction:Action;
|
// ofType(commonActions.ITEMADDEDEVENT),
|
||||||
if (action.queryState.itemCode && action.queryState.itemCode != "") {
|
// withLatestFrom(this.store$.select(mapReducers.selectGetParentCode)),
|
||||||
newAction= new mapActions.SelectItem(action.queryState.itemCode);
|
// mergeMap(([action, parentCode]) => {
|
||||||
} else {
|
// let itemAddedAction = action as commonActions.ItemAddedEvent;
|
||||||
newAction= new mapActions.StartSearch(action.queryState);
|
// if (parentCode && itemAddedAction.attributes["parentCode"] == parentCode) {
|
||||||
}
|
// return this.itemService$.getFeature(itemAddedAction.itemCode,"EPSG:3857").pipe(
|
||||||
return of(newAction);
|
// map((feature: Feature) => new mapActions.AddFeatureSuccess(this.toPointFeature(feature))),
|
||||||
}));
|
// catchError(error => of(new commonActions.Fail(error))))
|
||||||
|
// } else
|
||||||
@Effect()
|
// return [
|
||||||
setState$: Observable<Action> = this.actions$.pipe(
|
// ];
|
||||||
ofType(mapActions.SETSTATE),
|
// }));
|
||||||
switchMap((action: mapActions.SetState) => {
|
|
||||||
var newAction:Action;
|
@Effect()
|
||||||
if (action.queryState.itemCode && action.queryState.itemCode != "") {
|
featureUpdate$: Observable<Action> = this.actions$.pipe(
|
||||||
newAction= new mapActions.SelectItem(action.queryState.itemCode);
|
ofType(commonActions.DEVICEUPDATEEVENT),
|
||||||
} else {
|
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
|
||||||
newAction= new mapActions.StartSearch(action.queryState);
|
mergeMap(([action, features]) => {
|
||||||
}
|
let deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent;
|
||||||
return of(newAction);
|
var feature: Feature = null;
|
||||||
}));
|
for (let f of features) {
|
||||||
|
if (f.getId() == deviceUpdateEventAction.itemCode) {
|
||||||
constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService) {
|
feature = f;
|
||||||
this._format = new GeoJSON();
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (feature) {
|
||||||
|
return of(new mapActions.UpdateFeatureSuccess(this.toPointFeature(deviceUpdateEventAction)));
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
@Effect()
|
||||||
|
itemUpdate$: Observable<Action> = this.actions$.pipe(
|
||||||
|
ofType(commonActions.ITEMCHANGEDEVENT),
|
||||||
|
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
|
||||||
|
mergeMap(([action, selectedItem]) => {
|
||||||
|
let itemChangedAction = action as commonActions.ItemChangedEvent;
|
||||||
|
if (selectedItem && selectedItem.code == itemChangedAction.itemCode) {
|
||||||
|
return this.itemService$.getItem(itemChangedAction.itemCode).pipe(
|
||||||
|
map((item: IItem) => new mapActions.SelectItemSuccess(item)),
|
||||||
|
catchError(error => of(new commonActions.Fail(error))));
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
@Effect()
|
||||||
|
setQueryState$: Observable<Action> = this.actions$.pipe(
|
||||||
|
ofType(mapActions.SETQUERYSTATE),
|
||||||
|
switchMap((action: mapActions.SetQueryState) => {
|
||||||
|
var newAction:Action;
|
||||||
|
if (action.queryState.itemCode && action.queryState.itemCode != "") {
|
||||||
|
let urlparts=[];
|
||||||
|
if(action.queryState.itemType && action.queryState.itemType!= "") {
|
||||||
|
let itemType = this.itemTypeService$.itemTypes[action.queryState.itemType];
|
||||||
|
if (itemType.viewer == "edit_in_editor" && itemType.editor) {
|
||||||
|
urlparts.push('/editor');
|
||||||
|
urlparts.push(itemType.editor);
|
||||||
|
urlparts.push('item');
|
||||||
|
urlparts.push(action.queryState.itemCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(urlparts.length==0 ) {
|
||||||
|
newAction= new mapActions.SelectItem(action.queryState.itemCode);
|
||||||
|
} else {
|
||||||
|
this.router$.navigate(urlparts);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
newAction= new mapActions.StartSearch(action.queryState);
|
||||||
|
}
|
||||||
|
return of(newAction);
|
||||||
|
}));
|
||||||
|
|
||||||
|
@Effect()
|
||||||
|
setState$: Observable<Action> = this.actions$.pipe(
|
||||||
|
ofType(mapActions.SETSTATE),
|
||||||
|
switchMap((action: mapActions.SetState) => {
|
||||||
|
var newAction:Action;
|
||||||
|
if (action.queryState.itemCode && action.queryState.itemCode != "") {
|
||||||
|
newAction= new mapActions.SelectItem(action.queryState.itemCode);
|
||||||
|
} else {
|
||||||
|
newAction= new mapActions.StartSearch(action.queryState);
|
||||||
|
}
|
||||||
|
return of(newAction);
|
||||||
|
}));
|
||||||
|
|
||||||
|
constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService,private router$:Router) {
|
||||||
|
this._geojsonFormat = new GeoJSON();
|
||||||
|
this._wktFormat = new WKT();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -1,69 +1,72 @@
|
|||||||
export interface IColor {
|
export interface IColor {
|
||||||
red: number,
|
red: number,
|
||||||
green: number,
|
green: number,
|
||||||
blue: number,
|
blue: number,
|
||||||
alpha: number,
|
alpha: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IColorEntry {
|
export interface IColorEntry {
|
||||||
value: number,
|
value: number,
|
||||||
color: IColor
|
color: IColor,
|
||||||
}
|
label: string
|
||||||
|
}
|
||||||
export interface IHistogramEntry {
|
|
||||||
value: number,
|
export interface IHistogramEntry {
|
||||||
freqency: number
|
value: number,
|
||||||
}
|
freqency: number
|
||||||
|
}
|
||||||
export interface IHistogram {
|
|
||||||
min: number,
|
export interface IHistogram {
|
||||||
max: number,
|
min: number,
|
||||||
mean: number,
|
max: number,
|
||||||
stddev: number,
|
mean: number,
|
||||||
classes: number,
|
stddev: number,
|
||||||
entries: IHistogramEntry[]
|
classes: number,
|
||||||
}
|
entries: IHistogramEntry[]
|
||||||
|
}
|
||||||
export interface IGradientstop {
|
|
||||||
relativestop: number,
|
export interface IGradientstop {
|
||||||
color: IColor
|
relativestop: number,
|
||||||
}
|
color: IColor
|
||||||
|
}
|
||||||
export interface IColorMap {
|
|
||||||
gradient: IGradientstop[],
|
export interface IColorMap {
|
||||||
noValue: IColorEntry,
|
gradient: IGradientstop[],
|
||||||
entries: IColorEntry[]
|
noValue: IColorEntry,
|
||||||
}
|
entries: IColorEntry[],
|
||||||
|
colormapType: string
|
||||||
export interface IBand {
|
}
|
||||||
histogram: IHistogram
|
|
||||||
}
|
export interface IBand {
|
||||||
|
histogram: IHistogram
|
||||||
|
}
|
||||||
export interface IRenderer {
|
|
||||||
band:IBand,
|
|
||||||
colorMap: IColorMap
|
export interface IRenderer {
|
||||||
}
|
band:IBand,
|
||||||
|
colorMap: IColorMap,
|
||||||
export interface IRenderoutput {
|
renderType:string
|
||||||
renderoutputType: string
|
}
|
||||||
}
|
|
||||||
|
export interface IRenderoutput {
|
||||||
export interface IRenderoutputTiles {
|
renderoutputType: string
|
||||||
renderoutputType: string,
|
}
|
||||||
minzoom: number,
|
|
||||||
maxzoom: number
|
export interface IRenderoutputTiles {
|
||||||
}
|
renderoutputType: string,
|
||||||
|
minzoom: number,
|
||||||
export interface IRenderoutputImage {
|
maxzoom: number
|
||||||
renderoutputType: string,
|
}
|
||||||
extent: [number,number,number,number]
|
|
||||||
}
|
export interface IRenderoutputImage {
|
||||||
|
renderoutputType: string,
|
||||||
export interface ILayer {
|
extent: [number,number,number,number]
|
||||||
name: string,
|
}
|
||||||
unit: string,
|
|
||||||
index: number,
|
export interface ILayer {
|
||||||
renderer: IRenderer,
|
name: string,
|
||||||
rendering: IRenderoutput
|
unit: string,
|
||||||
}
|
index: number,
|
||||||
|
renderer: IRenderer,
|
||||||
|
rendering: IRenderoutput
|
||||||
|
}
|
||||||
|
@@ -1,7 +0,0 @@
|
|||||||
export * from './map.state';
|
|
||||||
export * from './selected.features';
|
|
||||||
export * from './item.layer'
|
|
||||||
export * from './layer.data'
|
|
||||||
export * from './color.map';
|
|
||||||
export * from './query.state';
|
|
||||||
export * from './period.state';
|
|
@@ -1,26 +1,50 @@
|
|||||||
import { IItem } from '@farmmaps/common';
|
import { IItem,IListItem } from '@farmmaps/common';
|
||||||
import {Layer} from 'ol/layer';
|
import {Layer} from 'ol/layer';
|
||||||
|
|
||||||
export interface IItemLayer {
|
export interface IItemLayer {
|
||||||
item: IItem,
|
item: IItem,
|
||||||
layer: Layer,
|
layer: Layer,
|
||||||
visible: boolean,
|
visible: boolean,
|
||||||
legendVisible:boolean,
|
legendVisible:boolean,
|
||||||
projection: string,
|
projection: string,
|
||||||
opacity: number,
|
opacity: number,
|
||||||
layerIndex:number
|
layerIndex:number
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ItemLayer implements IItemLayer {
|
export class ItemLayer implements IItemLayer {
|
||||||
public item: IItem;
|
public item: IItem;
|
||||||
public layer: Layer = null;
|
public layer: Layer = null;
|
||||||
public visible: boolean = true;
|
public visible: boolean = true;
|
||||||
public legendVisible: boolean = false;
|
public legendVisible: boolean = false;
|
||||||
public projection: string;
|
public projection: string;
|
||||||
public opacity: number = 1;
|
public opacity: number = 1;
|
||||||
public layerIndex: number = -1;
|
public layerIndex: number = -1;
|
||||||
|
|
||||||
constructor(item:IItem) {
|
constructor(item:IItem,opacity:number = 1, visible:boolean = true,layerIndex:number=-1) {
|
||||||
this.item = item;
|
this.item = item;
|
||||||
}
|
this.opacity = opacity;
|
||||||
}
|
this.visible = visible;
|
||||||
|
this.layerIndex = layerIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ITemporalItemLayer extends IItemLayer {
|
||||||
|
previousItemLayer: IItemLayer,
|
||||||
|
selectedItemLayer: IItemLayer,
|
||||||
|
nextItemLayer: IItemLayer,
|
||||||
|
temporalItems: IItem[],
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TemporalItemLayer extends ItemLayer implements ITemporalItemLayer {
|
||||||
|
public previousItemLayer:IItemLayer = null;
|
||||||
|
public selectedItemLayer:IItemLayer =null;
|
||||||
|
public nextItemLayer:IItemLayer = null;
|
||||||
|
public temporalItems:IItem[] = [];
|
||||||
|
|
||||||
|
constructor(item:IItem,opacity:number = 1, visible:boolean = true) {
|
||||||
|
super(item,opacity,visible)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
5
projects/common-map/src/fm-map/models/style.cache.ts
Normal file
5
projects/common-map/src/fm-map/models/style.cache.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import {Style,Feature} from 'ol';
|
||||||
|
|
||||||
|
export interface IStyles{
|
||||||
|
[id: string]: Style | (Feature);
|
||||||
|
};
|
@@ -1,369 +1,513 @@
|
|||||||
import { tassign } from 'tassign';
|
import { tassign } from 'tassign';
|
||||||
import { IItem,Item } from '@farmmaps/common';
|
import { IItem,Item } from '@farmmaps/common';
|
||||||
import { IItemLayer,ItemLayer, IMapState,IQueryState,IPeriodState} from '../models'
|
import { IItemLayer,ItemLayer,ITemporalItemLayer,TemporalItemLayer} from '../models/item.layer';
|
||||||
import * as mapActions from '../actions/map.actions';
|
import { IMapState} from '../models/map.state';
|
||||||
import {commonActions} from '@farmmaps/common';
|
import { IQueryState} from '@farmmaps/common';
|
||||||
import { createSelector, createFeatureSelector } from '@ngrx/store';
|
import { IPeriodState} from '../models/period.state';
|
||||||
|
import { IStyles} from '../models/style.cache';
|
||||||
import {Feature} from 'ol';
|
import * as mapActions from '../actions/map.actions';
|
||||||
|
import {commonActions} from '@farmmaps/common';
|
||||||
import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';
|
import { createSelector, createFeatureSelector } from '@ngrx/store';
|
||||||
|
|
||||||
import { MODULE_NAME } from '../module-name';
|
import {Feature} from 'ol';
|
||||||
|
import { createEmpty, extend} from 'ol/extent';
|
||||||
const startDate:Date = new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1);
|
|
||||||
const endDate:Date = new Date(Date.now());
|
import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';
|
||||||
|
|
||||||
export const initialQueryState: IQueryState = {
|
import { MODULE_NAME } from '../module-name';
|
||||||
itemCode: null,
|
|
||||||
parentCode: null,
|
const startDate:Date = new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1);
|
||||||
level: 1,
|
const endDate:Date = new Date(Date.now());
|
||||||
itemType: null,
|
|
||||||
bboxFilter: false,
|
export const initialQueryState: IQueryState = {
|
||||||
query: null,
|
itemCode: null,
|
||||||
tags: null,
|
parentCode: null,
|
||||||
endDate: null,
|
level: 1,
|
||||||
startDate: null,
|
itemType: null,
|
||||||
bbox: []
|
bboxFilter: false,
|
||||||
};
|
query: null,
|
||||||
|
tags: null,
|
||||||
export interface State {
|
endDate: null,
|
||||||
period:IPeriodState,
|
startDate: null,
|
||||||
mapState: IMapState,
|
bbox: []
|
||||||
viewExtent: number[],
|
};
|
||||||
queryState: IQueryState,
|
|
||||||
query:IQueryState,
|
export interface State {
|
||||||
parentCode: string,
|
period:IPeriodState,
|
||||||
features: Array<Feature>,
|
mapState: IMapState,
|
||||||
panelVisible: boolean,
|
viewExtent: number[],
|
||||||
panelCollapsed: boolean,
|
queryState: IQueryState,
|
||||||
selectedFeature: Feature,
|
query:IQueryState,
|
||||||
selectedItem:IItem,
|
parentCode: string,
|
||||||
clearEnabled: boolean,
|
features: Array<Feature>,
|
||||||
searchCollapsed: boolean,
|
panelVisible: boolean,
|
||||||
searchMinified: boolean,
|
panelCollapsed: boolean,
|
||||||
menuVisible: boolean,
|
selectedFeature: Feature,
|
||||||
extent: number[],
|
selectedItem:IItem,
|
||||||
baseLayers: Array<IItemLayer>
|
clearEnabled: boolean,
|
||||||
overlayLayers: Array<IItemLayer>,
|
searchCollapsed: boolean,
|
||||||
selectedItemLayer: IItemLayer,
|
searchMinified: boolean,
|
||||||
projection: string,
|
extent: number[],
|
||||||
selectedBaseLayer: IItemLayer,
|
baseLayers: Array<IItemLayer>
|
||||||
selectedOverlayLayer: IItemLayer
|
overlayLayers: Array<IItemLayer>,
|
||||||
}
|
selectedItemLayer: IItemLayer,
|
||||||
|
projection: string,
|
||||||
export const initialState: State = {
|
selectedBaseLayer: IItemLayer,
|
||||||
period: {
|
selectedOverlayLayer: IItemLayer,
|
||||||
startDate: startDate,
|
styles:IStyles,
|
||||||
endDate: endDate
|
showLayerSwitcher:boolean,
|
||||||
},
|
setStateCount:number
|
||||||
mapState: {
|
}
|
||||||
zoom: 8,
|
|
||||||
rotation: 0,
|
export const initialState: State = {
|
||||||
xCenter: 5.377554,
|
period: {
|
||||||
yCenter: 52.162422,
|
startDate: startDate,
|
||||||
baseLayerCode: ""
|
endDate: endDate
|
||||||
},
|
},
|
||||||
viewExtent:[],
|
mapState: {
|
||||||
queryState: tassign(initialQueryState),
|
zoom: 8,
|
||||||
query: tassign(initialQueryState),
|
rotation: 0,
|
||||||
parentCode: null,
|
xCenter: 5.377554,
|
||||||
features: [],
|
yCenter: 52.162422,
|
||||||
panelVisible: false,
|
baseLayerCode: ""
|
||||||
panelCollapsed: false,
|
},
|
||||||
selectedFeature: null,
|
viewExtent:[],
|
||||||
selectedItem: null,
|
queryState: tassign(initialQueryState),
|
||||||
clearEnabled: false,
|
query: tassign(initialQueryState),
|
||||||
searchCollapsed: true,
|
parentCode: null,
|
||||||
searchMinified:false,
|
features: [],
|
||||||
menuVisible: true,
|
panelVisible: false,
|
||||||
extent: null,
|
panelCollapsed: false,
|
||||||
baseLayers: [],
|
selectedFeature: null,
|
||||||
overlayLayers: [],
|
selectedItem: null,
|
||||||
projection: "EPSG:3857",
|
clearEnabled: false,
|
||||||
selectedBaseLayer: null,
|
searchCollapsed: true,
|
||||||
selectedOverlayLayer: null,
|
searchMinified:false,
|
||||||
selectedItemLayer: null
|
extent: null,
|
||||||
}
|
baseLayers: [],
|
||||||
|
overlayLayers: [],
|
||||||
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State {
|
projection: "EPSG:3857",
|
||||||
switch (action.type) {
|
selectedBaseLayer: null,
|
||||||
case ROUTER_NAVIGATION: {
|
selectedOverlayLayer: null,
|
||||||
let a = action as RouterNavigationAction;
|
selectedItemLayer: null,
|
||||||
return tassign(state);
|
styles: {},
|
||||||
}
|
showLayerSwitcher: false,
|
||||||
case mapActions.SETMAPSTATE: {
|
setStateCount: 0
|
||||||
let a = action as mapActions.SetMapState;
|
}
|
||||||
return tassign(state, {
|
|
||||||
mapState: a.mapState
|
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State {
|
||||||
});
|
switch (action.type) {
|
||||||
}
|
case ROUTER_NAVIGATION: {
|
||||||
case mapActions.SETQUERYSTATE: {
|
let a = action as RouterNavigationAction;
|
||||||
let a = action as mapActions.SetQueryState;
|
return tassign(state);
|
||||||
return tassign(state, { queryState: tassign(a.queryState )});
|
}
|
||||||
}
|
case mapActions.SETMAPSTATE: {
|
||||||
case mapActions.SETSTATE: {
|
let a = action as mapActions.SetMapState;
|
||||||
let a = action as mapActions.SetState;
|
return tassign(state, {
|
||||||
return tassign(state, { mapState: tassign(a.mapState), queryState: tassign(a.queryState)});
|
mapState: a.mapState,setStateCount: state.setStateCount+1
|
||||||
}
|
});
|
||||||
case mapActions.SETVIEWEXTENT: {
|
}
|
||||||
let a = action as mapActions.SetViewExtent;
|
case mapActions.SETQUERYSTATE: {
|
||||||
return tassign(state, { viewExtent: a.extent });
|
let a = action as mapActions.SetQueryState;
|
||||||
}
|
return tassign(state, { queryState: tassign(a.queryState ),setStateCount: state.setStateCount+1});
|
||||||
case mapActions.SETPARENT: {
|
}
|
||||||
let a = action as mapActions.SetParent;
|
case mapActions.SETSTATE: {
|
||||||
return tassign(state, {
|
let a = action as mapActions.SetState;
|
||||||
parentCode : a.parentCode
|
return tassign(state, { mapState: tassign(a.mapState), queryState: tassign(a.queryState),setStateCount: state.setStateCount+1});
|
||||||
});
|
}
|
||||||
}
|
case mapActions.SETVIEWEXTENT: {
|
||||||
case mapActions.STARTSEARCHSUCCESS: {
|
let a = action as mapActions.SetViewExtent;
|
||||||
let a = action as mapActions.StartSearchSuccess;
|
return tassign(state, { viewExtent: a.extent });
|
||||||
return tassign(state, {
|
}
|
||||||
panelVisible: true,
|
case mapActions.SETPARENT: {
|
||||||
clearEnabled: true,
|
let a = action as mapActions.SetParent;
|
||||||
searchMinified: true,
|
return tassign(state, {
|
||||||
features: a.features
|
parentCode : a.parentCode
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
case mapActions.SELECTFEATURE: {
|
case mapActions.STARTSEARCHSUCCESS: {
|
||||||
let a = action as mapActions.SelectFeature;
|
let a = action as mapActions.StartSearchSuccess;
|
||||||
return tassign(state, {
|
let extent = state.extent;
|
||||||
selectedFeature: state.selectedItem?state.selectedFeature: a.feature
|
if (!action.query.bboxFilter) {
|
||||||
});
|
console.debug("Set extent");
|
||||||
}
|
extent = createEmpty();
|
||||||
case mapActions.SELECTITEM: {
|
if (extent) {
|
||||||
return tassign(state, {
|
for (let f of action.features) {
|
||||||
selectedItem: null,
|
extend(extent, (f as Feature).getGeometry().getExtent());
|
||||||
searchMinified:false,
|
}
|
||||||
selectedItemLayer: null,
|
}
|
||||||
features:[]
|
}
|
||||||
});
|
return tassign(state, {
|
||||||
}
|
panelVisible: true,
|
||||||
case mapActions.SELECTITEMSUCCESS: {
|
clearEnabled: true,
|
||||||
let a = action as mapActions.SelectItemSuccess;
|
searchMinified: true,
|
||||||
var itemLayer = null;
|
features: a.features,
|
||||||
if (a.item && "vnd.farmmaps.itemtype.layer,vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(a.item.itemType) >=0 ) {
|
extent:extent
|
||||||
itemLayer = new ItemLayer(a.item);
|
});
|
||||||
}
|
}
|
||||||
return tassign(state, {
|
case mapActions.SELECTFEATURE: {
|
||||||
selectedItem: a.item,
|
let a = action as mapActions.SelectFeature;
|
||||||
selectedItemLayer: itemLayer,
|
return tassign(state, {
|
||||||
panelVisible: a.item != null,
|
selectedFeature: state.selectedItem?state.selectedFeature: a.feature
|
||||||
clearEnabled: a.item != null,
|
});
|
||||||
searchCollapsed: false,
|
}
|
||||||
searchMinified: true,
|
case mapActions.SELECTITEM: {
|
||||||
queryState: tassign(state.queryState, {itemCode:a.item ? a.item.code:null})
|
return tassign(state, {
|
||||||
});
|
selectedItem: null,
|
||||||
}
|
searchMinified:false,
|
||||||
case mapActions.STARTSEARCH: {
|
selectedItemLayer: null,
|
||||||
let a = action as mapActions.StartSearch;
|
features:[]
|
||||||
return tassign(state, {
|
});
|
||||||
selectedItem: null,
|
}
|
||||||
selectedItemLayer:null,
|
case mapActions.SELECTITEMSUCCESS: {
|
||||||
queryState: tassign(a.queryState),
|
let a = action as mapActions.SelectItemSuccess;
|
||||||
searchCollapsed: false,
|
var itemLayer = null;
|
||||||
searchMinified: true,
|
if (a.item && "vnd.farmmaps.itemtype.layer,vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(a.item.itemType) >=0 ) {
|
||||||
menuVisible:false
|
itemLayer = new ItemLayer(a.item);
|
||||||
});
|
itemLayer.layerIndex = a.item.data.layers?a.item.data.layers[0].index:-1;
|
||||||
}
|
} else if (a.item && a.item.itemType == "vnd.farmmaps.itemtype.temporal") {
|
||||||
case mapActions.DOQUERY: {
|
itemLayer = new TemporalItemLayer(a.item);
|
||||||
let a = action as mapActions.DoQuery;
|
}
|
||||||
return tassign(state, {
|
return tassign(state, {
|
||||||
query: tassign(a.query, { bbox: a.query.bboxFilter ? state.viewExtent : [] })});
|
selectedItem: a.item,
|
||||||
}
|
selectedItemLayer: itemLayer,
|
||||||
case mapActions.ADDFEATURESUCCESS: {
|
panelVisible: a.item != null,
|
||||||
let a = action as mapActions.AddFeatureSuccess;
|
clearEnabled: a.item != null,
|
||||||
let features = state.features.slice();
|
searchCollapsed: false,
|
||||||
features.push(a.feature);
|
searchMinified: true,
|
||||||
return tassign(state, {
|
queryState: tassign(state.queryState, {itemCode:a.item ? a.item.code:null})
|
||||||
panelVisible: true,
|
});
|
||||||
selectedFeature: a.feature,
|
}
|
||||||
menuVisible: false,
|
case mapActions.SELECTTEMPORALITEMSSUCCESS:{
|
||||||
extent: a.feature.getGeometry().getExtent(),
|
let a = action as mapActions.SelectTemporalItemsSuccess;
|
||||||
searchCollapsed: false,
|
let selectedItemLayer=tassign(state.selectedItemLayer) as TemporalItemLayer;
|
||||||
clearEnabled:true,
|
let layerIndex=-1;
|
||||||
features:features
|
selectedItemLayer.temporalItems = a.temporalItems;
|
||||||
});
|
if(a.temporalItems.length>0) {
|
||||||
}
|
let item = a.temporalItems[a.temporalItems.length-1];
|
||||||
case mapActions.UPDATEFEATURESUCCESS: {
|
layerIndex = item.data.layers[0].index;
|
||||||
let a = action as mapActions.UpdateFeatureSuccess;
|
selectedItemLayer.selectedItemLayer = new ItemLayer(item,1,true,layerIndex);
|
||||||
let features: any[] = [];
|
} else {
|
||||||
var index = -1;
|
selectedItemLayer.selectedItemLayer = null;
|
||||||
for (var i = 0; i < state.features.length; i++) {
|
}
|
||||||
if (state.features[i].get("code") == a.feature.get("code")) {
|
selectedItemLayer.previousItemLayer = a.temporalItems.length>1?new ItemLayer(a.temporalItems[a.temporalItems.length-2],0,true,layerIndex):null;
|
||||||
features.push(a.feature);
|
selectedItemLayer.nextItemLayer = null;
|
||||||
} else {
|
if(selectedItemLayer.selectedItemLayer) {
|
||||||
features.push(state.features[i]);
|
let layerIndex = selectedItemLayer.selectedItemLayer.item.data.layers[0].index;
|
||||||
}
|
selectedItemLayer.layerIndex = layerIndex;
|
||||||
}
|
}
|
||||||
return tassign(state, { features: features });
|
|
||||||
}
|
return tassign(state,{selectedItemLayer:tassign(state.selectedItemLayer,selectedItemLayer as ItemLayer)});
|
||||||
case mapActions.EXPANDSEARCH: {
|
}
|
||||||
return tassign(state, { searchCollapsed: false });
|
case mapActions.NEXTTEMPORAL: {
|
||||||
}
|
let temporalLayer = state.selectedItemLayer as ITemporalItemLayer;
|
||||||
case mapActions.COLLAPSESEARCH: {
|
if(temporalLayer.temporalItems && temporalLayer.temporalItems.length>0) {
|
||||||
return tassign(state, { searchCollapsed: state.panelVisible ? false: true});
|
let index = temporalLayer.temporalItems.indexOf(temporalLayer.selectedItemLayer.item);
|
||||||
}
|
if(index == (temporalLayer.temporalItems.length-1)) {
|
||||||
case mapActions.TOGGLEMENU: {
|
return state;
|
||||||
return tassign(state, { menuVisible: !state.menuVisible });
|
} else {
|
||||||
}
|
temporalLayer.previousItemLayer = temporalLayer.selectedItemLayer;
|
||||||
case mapActions.SETEXTENT: {
|
if( temporalLayer.previousItemLayer) {
|
||||||
let a = action as mapActions.SetExtent;
|
temporalLayer.previousItemLayer.opacity=0;
|
||||||
return tassign(state, { extent: a.extent });
|
temporalLayer.previousItemLayer.layerIndex = temporalLayer.layerIndex;
|
||||||
}
|
}
|
||||||
case mapActions.ADDLAYER: {
|
temporalLayer.selectedItemLayer = temporalLayer.nextItemLayer;
|
||||||
let a = action as mapActions.AddLayer;
|
if( temporalLayer.selectedItemLayer) {
|
||||||
let itemLayers = state.overlayLayers.slice(0);
|
temporalLayer.selectedItemLayer.opacity=1;
|
||||||
let itemLayer = new ItemLayer(a.item);
|
temporalLayer.selectedItemLayer.layerIndex=temporalLayer.layerIndex;
|
||||||
itemLayer.layerIndex = a.layerIndex == -1 ? 0 : a.layerIndex;
|
}
|
||||||
itemLayers.push(itemLayer);
|
temporalLayer.nextItemLayer = index+2 < temporalLayer.temporalItems.length ? new ItemLayer(temporalLayer.temporalItems[index+2],0,true,temporalLayer.layerIndex):null;
|
||||||
return tassign(state, { overlayLayers: itemLayers, selectedOverlayLayer: itemLayer });
|
if( temporalLayer.nextItemLayer) {
|
||||||
}
|
temporalLayer.nextItemLayer.opacity=0;
|
||||||
case mapActions.REMOVELAYER: {
|
temporalLayer.nextItemLayer.layerIndex = temporalLayer.layerIndex;
|
||||||
let a = action as mapActions.RemoveLayer;
|
}
|
||||||
let newLayers = state.overlayLayers.slice(0);
|
return tassign(state,{selectedItemLayer:tassign(state.selectedItemLayer,temporalLayer as ItemLayer)});
|
||||||
let i = state.overlayLayers.indexOf(a.itemLayer);
|
}
|
||||||
var selectedOverlayLayer: IItemLayer = null;
|
} else {
|
||||||
if (i>0 && state.overlayLayers.length > 1)
|
return state;
|
||||||
selectedOverlayLayer = state.overlayLayers[i - 1];
|
}
|
||||||
else if (i == 0 && state.overlayLayers.length > 1)
|
}
|
||||||
selectedOverlayLayer = state.overlayLayers[i + 1];
|
case mapActions.PREVIOUSTEMPORAL: {
|
||||||
newLayers.splice(i, 1);
|
let temporalLayer = state.selectedItemLayer as ITemporalItemLayer;
|
||||||
return tassign(state, { overlayLayers: newLayers, selectedOverlayLayer: selectedOverlayLayer });
|
if(temporalLayer.temporalItems && temporalLayer.temporalItems.length>0) {
|
||||||
}
|
let index = temporalLayer.temporalItems.indexOf(temporalLayer.selectedItemLayer.item);
|
||||||
case mapActions.SETVISIBILITY: {
|
if(index == 0) {
|
||||||
let a = action as mapActions.SetVisibility;
|
return state;
|
||||||
let newLayers = state.overlayLayers.slice(0);
|
} else {
|
||||||
let i = state.overlayLayers.indexOf(a.itemLayer);
|
temporalLayer.nextItemLayer = temporalLayer.selectedItemLayer;
|
||||||
newLayers[i].visible = a.visibility;
|
if( temporalLayer.nextItemLayer) {
|
||||||
return tassign(state, { overlayLayers: newLayers });
|
temporalLayer.nextItemLayer.opacity=0;
|
||||||
}
|
temporalLayer.nextItemLayer.layerIndex = temporalLayer.layerIndex;
|
||||||
case mapActions.SETOPACITY: {
|
}
|
||||||
let a = action as mapActions.SetOpacity;
|
temporalLayer.selectedItemLayer = temporalLayer.previousItemLayer;
|
||||||
let newLayers = state.overlayLayers.slice(0);
|
if( temporalLayer.selectedItemLayer) {
|
||||||
let i = state.overlayLayers.indexOf(a.itemLayer);
|
temporalLayer.selectedItemLayer.opacity=1;
|
||||||
newLayers[i].opacity = a.opacity;
|
temporalLayer.selectedItemLayer.layerIndex = temporalLayer.layerIndex;
|
||||||
return tassign(state, { overlayLayers: newLayers });
|
}
|
||||||
}
|
temporalLayer.previousItemLayer = index-2 >=0? new ItemLayer(temporalLayer.temporalItems[index-2],0,true,temporalLayer.layerIndex):null;
|
||||||
case mapActions.SETLAYERINDEX: {
|
if( temporalLayer.previousItemLayer) {
|
||||||
let a = action as mapActions.SetLayerIndex;
|
temporalLayer.previousItemLayer.opacity=0;
|
||||||
if (a.itemLayer == null) {
|
temporalLayer.previousItemLayer.layerIndex = temporalLayer.layerIndex;
|
||||||
var newItemlayer = new ItemLayer(state.selectedItemLayer.item);
|
}
|
||||||
newItemlayer.layerIndex = a.layerIndex;
|
return tassign(state,{selectedItemLayer:tassign(state.selectedItemLayer,temporalLayer as ItemLayer)});
|
||||||
return tassign(state, { selectedItemLayer: newItemlayer})
|
}
|
||||||
} else {
|
} else {
|
||||||
let newLayers = state.overlayLayers.slice(0);
|
return state;
|
||||||
let i = state.overlayLayers.indexOf(a.itemLayer);
|
}
|
||||||
newLayers[i].layerIndex = a.layerIndex;
|
}
|
||||||
return tassign(state, { overlayLayers: newLayers });
|
case mapActions.SELECTTEMPORAL:{
|
||||||
}
|
//todo implement
|
||||||
}
|
}
|
||||||
case mapActions.LOADBASELAYERSSUCCESS: {
|
case mapActions.STARTSEARCH: {
|
||||||
let a =action as mapActions.LoadBaseLayersSuccess;
|
let a = action as mapActions.StartSearch;
|
||||||
let baseLayers:ItemLayer[] = [];
|
return tassign(state, {
|
||||||
for (let item of a.items) {
|
selectedItem: null,
|
||||||
var l = new ItemLayer(item);
|
selectedItemLayer:null,
|
||||||
l.visible = false;
|
queryState: tassign(a.queryState),
|
||||||
baseLayers.push(l);
|
searchCollapsed: false,
|
||||||
}
|
searchMinified: true
|
||||||
var selectedBaseLayer: IItemLayer = null;
|
});
|
||||||
var mapState = tassign(state.mapState);
|
}
|
||||||
console.debug(`Base layerload: ${mapState.baseLayerCode}`)
|
case mapActions.DOQUERY: {
|
||||||
if (baseLayers.length > 0 && mapState.baseLayerCode != "") {
|
let a = action as mapActions.DoQuery;
|
||||||
selectedBaseLayer = baseLayers.filter(layer => layer.item.code === mapState.baseLayerCode)[0];
|
return tassign(state, {
|
||||||
selectedBaseLayer.visible = true;
|
setStateCount:state.setStateCount+1,
|
||||||
} else if (baseLayers.length > 0) {
|
query: tassign(a.query, { bbox: a.query.bboxFilter ? state.viewExtent : [] })});
|
||||||
selectedBaseLayer = baseLayers[0];
|
}
|
||||||
selectedBaseLayer.visible = true;
|
case mapActions.ADDFEATURESUCCESS: {
|
||||||
mapState.baseLayerCode = selectedBaseLayer.item.code;
|
let a = action as mapActions.AddFeatureSuccess;
|
||||||
}
|
let features = state.features.slice();
|
||||||
return tassign(state, { mapState:mapState, baseLayers: baseLayers, selectedBaseLayer: selectedBaseLayer });
|
features.push(a.feature);
|
||||||
}
|
return tassign(state, {
|
||||||
case mapActions.SELECTBASELAYER: {
|
panelVisible: true,
|
||||||
let a = action as mapActions.SelectBaseLayer;
|
selectedFeature: a.feature,
|
||||||
let baseLayers = state.baseLayers.slice(0);
|
extent: a.feature.getGeometry().getExtent(),
|
||||||
baseLayers.forEach((l) => l.visible = false);
|
searchCollapsed: false,
|
||||||
let i = state.baseLayers.indexOf(a.itemLayer);
|
clearEnabled:true,
|
||||||
baseLayers[i].visible = true;
|
features:features
|
||||||
var mapState = tassign(state.mapState);
|
});
|
||||||
mapState.baseLayerCode = a.itemLayer.item.code;
|
}
|
||||||
return tassign(state, {mapState:mapState, baseLayers:baseLayers,selectedBaseLayer:a.itemLayer });
|
case mapActions.UPDATEFEATURESUCCESS: {
|
||||||
}
|
let a = action as mapActions.UpdateFeatureSuccess;
|
||||||
case mapActions.SELECTOVERLAYLAYER: {
|
let features: any[] = [];
|
||||||
let a = action as mapActions.SelectOverlayLayer;
|
var index = -1;
|
||||||
return tassign(state, { selectedOverlayLayer: a.itemLayer });
|
for (var i = 0; i < state.features.length; i++) {
|
||||||
}
|
if (state.features[i].getId() == a.feature.getId()) {
|
||||||
case commonActions.ESCAPE: {
|
features.push(a.feature);
|
||||||
let a = action as commonActions.Escape;
|
} else {
|
||||||
let newQueryState = tassign(state.queryState, { query: null, tags: null, itemCode: null, parentCode: null, itemType: null });
|
features.push(state.features[i]);
|
||||||
if (a.escapeKey) {
|
}
|
||||||
return tassign(state, {
|
}
|
||||||
panelVisible: false,
|
return tassign(state, { features: features });
|
||||||
panelCollapsed:false,
|
}
|
||||||
selectedItem: null,
|
case mapActions.EXPANDSEARCH: {
|
||||||
selectedItemLayer: null,
|
return tassign(state, { searchCollapsed: false });
|
||||||
selectedFeature: null,
|
}
|
||||||
queryState: newQueryState,
|
case mapActions.COLLAPSESEARCH: {
|
||||||
clearEnabled: false,
|
return tassign(state, { searchCollapsed: state.panelVisible ? false: true});
|
||||||
searchCollapsed: true,
|
}
|
||||||
searchMinified: false,
|
case mapActions.SETEXTENT: {
|
||||||
menuVisible:false,
|
console.debug("Set extent 2");
|
||||||
features: [],
|
let a = action as mapActions.SetExtent;
|
||||||
query:initialState.query
|
return tassign(state, { extent: a.extent });
|
||||||
});
|
}
|
||||||
} else {
|
case mapActions.ADDLAYER: {
|
||||||
return tassign(state, {});
|
let a = action as mapActions.AddLayer;
|
||||||
}
|
let itemLayers = state.overlayLayers.slice(0);
|
||||||
}
|
let itemLayer = new ItemLayer(a.item);
|
||||||
default: {
|
itemLayer.layerIndex = a.layerIndex == -1 ? 0 : a.layerIndex;
|
||||||
return state;
|
itemLayers.push(itemLayer);
|
||||||
}
|
return tassign(state, { overlayLayers: itemLayers, selectedOverlayLayer: itemLayer });
|
||||||
}
|
}
|
||||||
}
|
case mapActions.REMOVELAYER: {
|
||||||
|
let a = action as mapActions.RemoveLayer;
|
||||||
export const getMapState = (state: State) => state.mapState;
|
let newLayers = state.overlayLayers.slice(0);
|
||||||
export const getParentCode = (state: State) => state.parentCode;
|
let i = state.overlayLayers.indexOf(a.itemLayer);
|
||||||
export const getFeatures = (state: State) => state.features;
|
var selectedOverlayLayer: IItemLayer = null;
|
||||||
export const getPanelVisible = (state: State) => state.panelVisible;
|
if (i>0 && state.overlayLayers.length > 1)
|
||||||
export const getPanelCollapsed = (state: State) => state.panelCollapsed;
|
selectedOverlayLayer = state.overlayLayers[i - 1];
|
||||||
export const getSelectedFeature = (state: State) => state.selectedFeature;
|
else if (i == 0 && state.overlayLayers.length > 1)
|
||||||
export const getSelectedItem = (state: State) => state.selectedItem;
|
selectedOverlayLayer = state.overlayLayers[i + 1];
|
||||||
export const getQueryState = (state: State) => state.queryState;
|
newLayers.splice(i, 1);
|
||||||
export const getClearEnabled = (state: State) => state.clearEnabled;
|
return tassign(state, { overlayLayers: newLayers, selectedOverlayLayer: selectedOverlayLayer });
|
||||||
export const getSearchCollapsed = (state: State) => state.searchCollapsed;
|
}
|
||||||
export const getSearchMinified = (state: State) => state.searchMinified;
|
case mapActions.SETVISIBILITY: {
|
||||||
export const getMenuVisible = (state: State) => state.menuVisible;
|
let a = action as mapActions.SetVisibility;
|
||||||
export const getExtent = (state: State) => state.extent;
|
let newLayers = state.overlayLayers.slice(0);
|
||||||
export const getOverlayLayers = (state: State) => state.overlayLayers;
|
let i = state.overlayLayers.indexOf(a.itemLayer);
|
||||||
export const getBaseLayers = (state: State) => state.baseLayers;
|
newLayers[i].visible = a.visibility;
|
||||||
export const getProjection = (state: State) => state.projection;
|
return tassign(state, { overlayLayers: newLayers });
|
||||||
export const getSelectedBaseLayer = (state: State) => state.selectedBaseLayer;
|
}
|
||||||
export const getSelectedOverlayLayer = (state: State) => state.selectedOverlayLayer;
|
case mapActions.SETOPACITY: {
|
||||||
export const getQuery = (state: State) => state.query;
|
let a = action as mapActions.SetOpacity;
|
||||||
export const getSelectedItemLayer = (state: State) => state.selectedItemLayer;
|
let newLayers = state.overlayLayers.slice(0);
|
||||||
export const getPeriod = (state:State) => state.period;
|
let i = state.overlayLayers.indexOf(a.itemLayer);
|
||||||
|
newLayers[i].opacity = a.opacity;
|
||||||
export const selectMapState = createFeatureSelector<State>(MODULE_NAME);
|
return tassign(state, { overlayLayers: newLayers });
|
||||||
export const selectGetMapState= createSelector(selectMapState, getMapState);
|
}
|
||||||
export const selectGetParentCode = createSelector(selectMapState, getParentCode);
|
case mapActions.SETLAYERINDEX: {
|
||||||
export const selectGetFeatures = createSelector(selectMapState, getFeatures);
|
let a = action as mapActions.SetLayerIndex;
|
||||||
export const selectGetPanelVisible = createSelector(selectMapState, getPanelVisible);
|
if (a.itemLayer == null) {
|
||||||
export const selectGetPanelCollapsed = createSelector(selectMapState, getPanelCollapsed);
|
if(state.selectedItemLayer.item.itemType == "vnd.farmmaps.itemtype.temporal") {
|
||||||
export const selectGetSelectedFeature = createSelector(selectMapState, getSelectedFeature);
|
var newItemlayer = tassign(state.selectedItemLayer,{layerIndex:a.layerIndex});
|
||||||
export const selectGetSelectedItem = createSelector(selectMapState, getSelectedItem);
|
let tl = newItemlayer as ITemporalItemLayer;
|
||||||
export const selectGetQueryState = createSelector(selectMapState, getQueryState);
|
if(tl.previousItemLayer) {
|
||||||
export const selectGetClearEnabled = createSelector(selectMapState, getClearEnabled);
|
let nl = new ItemLayer(tl.previousItemLayer.item);
|
||||||
export const selectGetSearchCollapsed = createSelector(selectMapState, getSearchCollapsed);
|
nl.opacity = tl.previousItemLayer.opacity;
|
||||||
export const selectGetSearchMinified = createSelector(selectMapState, getSearchMinified);
|
nl.visible = tl.previousItemLayer.visible;
|
||||||
export const selectGetMenuVisible = createSelector(selectMapState, getMenuVisible);
|
nl.layerIndex = a.layerIndex;
|
||||||
export const selectGetExtent = createSelector(selectMapState, getExtent);
|
tl.previousItemLayer = nl;
|
||||||
export const selectGetOverlayLayers = createSelector(selectMapState, getOverlayLayers);
|
}
|
||||||
export const selectGetBaseLayers = createSelector(selectMapState, getBaseLayers);
|
if(tl.selectedItemLayer) {
|
||||||
export const selectGetProjection = createSelector(selectMapState, getProjection);
|
let nl = new ItemLayer(tl.selectedItemLayer.item);
|
||||||
export const selectGetSelectedBaseLayer = createSelector(selectMapState, getSelectedBaseLayer);
|
nl.opacity = tl.selectedItemLayer.opacity;
|
||||||
export const selectGetSelectedOverlayLayer = createSelector(selectMapState, getSelectedOverlayLayer);
|
nl.visible = tl.selectedItemLayer.visible;
|
||||||
export const selectGetQuery = createSelector(selectMapState, getQuery);
|
nl.layerIndex = a.layerIndex;
|
||||||
export const selectGetSelectedItemLayer = createSelector(selectMapState, getSelectedItemLayer);
|
tl.selectedItemLayer = nl;
|
||||||
export const selectGetPeriod = createSelector(selectMapState, getPeriod);
|
}
|
||||||
|
if(tl.nextItemLayer) {
|
||||||
|
let nl = new ItemLayer(tl.nextItemLayer.item);
|
||||||
|
nl.opacity = tl.nextItemLayer.opacity;
|
||||||
|
nl.visible = tl.nextItemLayer.visible;
|
||||||
|
nl.layerIndex = a.layerIndex;
|
||||||
|
tl.nextItemLayer = nl;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var newItemlayer = new ItemLayer(state.selectedItemLayer.item);
|
||||||
|
newItemlayer.layerIndex = a.layerIndex;
|
||||||
|
|
||||||
|
}
|
||||||
|
return tassign(state, { selectedItemLayer: newItemlayer})
|
||||||
|
} else {
|
||||||
|
let newLayers = state.overlayLayers.slice(0);
|
||||||
|
let i = state.overlayLayers.indexOf(a.itemLayer);
|
||||||
|
newLayers[i].layerIndex = a.layerIndex;
|
||||||
|
return tassign(state, { overlayLayers: newLayers });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case mapActions.LOADBASELAYERSSUCCESS: {
|
||||||
|
let a =action as mapActions.LoadBaseLayersSuccess;
|
||||||
|
let baseLayers:ItemLayer[] = [];
|
||||||
|
for (let item of a.items) {
|
||||||
|
var l = new ItemLayer(item);
|
||||||
|
l.visible = false;
|
||||||
|
baseLayers.push(l);
|
||||||
|
}
|
||||||
|
var selectedBaseLayer: IItemLayer = null;
|
||||||
|
var mapState = tassign(state.mapState);
|
||||||
|
console.debug(`Base layerload: ${mapState.baseLayerCode}`)
|
||||||
|
if (baseLayers.length > 0 && mapState.baseLayerCode != "") {
|
||||||
|
selectedBaseLayer = baseLayers.filter(layer => layer.item.code === mapState.baseLayerCode)[0];
|
||||||
|
selectedBaseLayer.visible = true;
|
||||||
|
} else if (baseLayers.length > 0) {
|
||||||
|
selectedBaseLayer = baseLayers[0];
|
||||||
|
selectedBaseLayer.visible = true;
|
||||||
|
mapState.baseLayerCode = selectedBaseLayer.item.code;
|
||||||
|
}
|
||||||
|
return tassign(state, { mapState:mapState, baseLayers: baseLayers, selectedBaseLayer: selectedBaseLayer });
|
||||||
|
}
|
||||||
|
case mapActions.SELECTBASELAYER: {
|
||||||
|
let a = action as mapActions.SelectBaseLayer;
|
||||||
|
let baseLayers = state.baseLayers.slice(0);
|
||||||
|
baseLayers.forEach((l) => l.visible = false);
|
||||||
|
let i = state.baseLayers.indexOf(a.itemLayer);
|
||||||
|
baseLayers[i].visible = true;
|
||||||
|
var mapState = tassign(state.mapState);
|
||||||
|
mapState.baseLayerCode = a.itemLayer.item.code;
|
||||||
|
return tassign(state, {mapState:mapState, baseLayers:baseLayers,selectedBaseLayer:a.itemLayer });
|
||||||
|
}
|
||||||
|
case mapActions.SELECTOVERLAYLAYER: {
|
||||||
|
let a = action as mapActions.SelectOverlayLayer;
|
||||||
|
return tassign(state, { selectedOverlayLayer: a.itemLayer });
|
||||||
|
}
|
||||||
|
case commonActions.ESCAPE: {
|
||||||
|
let a = action as commonActions.Escape;
|
||||||
|
let newQueryState = tassign(state.queryState, { query: null, tags: null, itemCode: null, parentCode: null, itemType: null });
|
||||||
|
if (a.escapeKey) {
|
||||||
|
return tassign(state, {
|
||||||
|
panelVisible: false,
|
||||||
|
panelCollapsed:false,
|
||||||
|
selectedItem: null,
|
||||||
|
selectedItemLayer: null,
|
||||||
|
selectedFeature: null,
|
||||||
|
queryState: newQueryState,
|
||||||
|
clearEnabled: false,
|
||||||
|
searchCollapsed: true,
|
||||||
|
searchMinified: false,
|
||||||
|
features: [],
|
||||||
|
query:initialState.query,
|
||||||
|
showLayerSwitcher: false
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return tassign(state, {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case mapActions.SETSTYLE:{
|
||||||
|
let a = action as mapActions.SetStyle;
|
||||||
|
let styles = tassign(state.styles);
|
||||||
|
styles[a.itemType] = a.style;
|
||||||
|
return tassign(state,{styles:styles});
|
||||||
|
}
|
||||||
|
case mapActions.SHOWLAYERSWITCHER:{
|
||||||
|
let a = action as mapActions.ShowLayerSwitcher;
|
||||||
|
return tassign(state,{showLayerSwitcher:a.show});
|
||||||
|
}
|
||||||
|
case mapActions.INIT:{
|
||||||
|
return tassign(state,{setStateCount:0});
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getMapState = (state: State) => state.mapState;
|
||||||
|
export const getParentCode = (state: State) => state.parentCode;
|
||||||
|
export const getFeatures = (state: State) => state.features;
|
||||||
|
export const getPanelVisible = (state: State) => state.panelVisible;
|
||||||
|
export const getPanelCollapsed = (state: State) => state.panelCollapsed;
|
||||||
|
export const getSelectedFeature = (state: State) => state.selectedFeature;
|
||||||
|
export const getSelectedItem = (state: State) => state.selectedItem;
|
||||||
|
export const getQueryState = (state: State) => state.queryState;
|
||||||
|
export const getClearEnabled = (state: State) => state.clearEnabled;
|
||||||
|
export const getSearchCollapsed = (state: State) => state.searchCollapsed;
|
||||||
|
export const getSearchMinified = (state: State) => state.searchMinified;
|
||||||
|
export const getExtent = (state: State) => state.extent;
|
||||||
|
export const getOverlayLayers = (state: State) => state.overlayLayers;
|
||||||
|
export const getBaseLayers = (state: State) => state.baseLayers;
|
||||||
|
export const getProjection = (state: State) => state.projection;
|
||||||
|
export const getSelectedBaseLayer = (state: State) => state.selectedBaseLayer;
|
||||||
|
export const getSelectedOverlayLayer = (state: State) => state.selectedOverlayLayer;
|
||||||
|
export const getQuery = (state: State) => state.query;
|
||||||
|
export const getSelectedItemLayer = (state: State) => state.selectedItemLayer;
|
||||||
|
export const getPeriod = (state:State) => state.period;
|
||||||
|
export const getStyles = (state:State) => state.styles;
|
||||||
|
export const getShowLayerSwitcher = (state:State) => state.showLayerSwitcher;
|
||||||
|
export const getSetStateCount = (state:State) => state.setStateCount;
|
||||||
|
|
||||||
|
export const selectMapState = createFeatureSelector<State>(MODULE_NAME);
|
||||||
|
export const selectGetMapState= createSelector(selectMapState, getMapState);
|
||||||
|
export const selectGetParentCode = createSelector(selectMapState, getParentCode);
|
||||||
|
export const selectGetFeatures = createSelector(selectMapState, getFeatures);
|
||||||
|
export const selectGetPanelVisible = createSelector(selectMapState, getPanelVisible);
|
||||||
|
export const selectGetPanelCollapsed = createSelector(selectMapState, getPanelCollapsed);
|
||||||
|
export const selectGetSelectedFeature = createSelector(selectMapState, getSelectedFeature);
|
||||||
|
export const selectGetSelectedItem = createSelector(selectMapState, getSelectedItem);
|
||||||
|
export const selectGetQueryState = createSelector(selectMapState, getQueryState);
|
||||||
|
export const selectGetClearEnabled = createSelector(selectMapState, getClearEnabled);
|
||||||
|
export const selectGetSearchCollapsed = createSelector(selectMapState, getSearchCollapsed);
|
||||||
|
export const selectGetSearchMinified = createSelector(selectMapState, getSearchMinified);
|
||||||
|
export const selectGetExtent = createSelector(selectMapState, getExtent);
|
||||||
|
export const selectGetOverlayLayers = createSelector(selectMapState, getOverlayLayers);
|
||||||
|
export const selectGetBaseLayers = createSelector(selectMapState, getBaseLayers);
|
||||||
|
export const selectGetProjection = createSelector(selectMapState, getProjection);
|
||||||
|
export const selectGetSelectedBaseLayer = createSelector(selectMapState, getSelectedBaseLayer);
|
||||||
|
export const selectGetSelectedOverlayLayer = createSelector(selectMapState, getSelectedOverlayLayer);
|
||||||
|
export const selectGetQuery = createSelector(selectMapState, getQuery);
|
||||||
|
export const selectGetSelectedItemLayer = createSelector(selectMapState, getSelectedItemLayer);
|
||||||
|
export const selectGetPeriod = createSelector(selectMapState, getPeriod);
|
||||||
|
export const selectGetStyles = createSelector(selectMapState, getStyles);
|
||||||
|
export const selectGetShowLayerSwitcher = createSelector(selectMapState,getShowLayerSwitcher);
|
||||||
|
export const selectgetSetStateCount = createSelector(selectMapState,getSetStateCount);
|
||||||
|
|
||||||
|
|
||||||
|
@@ -0,0 +1,51 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Observer, Observable } from 'rxjs';
|
||||||
|
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class DeviceOrientationService {
|
||||||
|
|
||||||
|
compassHeading(alpha, beta, gamma):number {
|
||||||
|
|
||||||
|
// Convert degrees to radians
|
||||||
|
var alphaRad = alpha * (Math.PI / 180);
|
||||||
|
var betaRad = beta * (Math.PI / 180);
|
||||||
|
var gammaRad = gamma * (Math.PI / 180);
|
||||||
|
|
||||||
|
// Calculate equation components
|
||||||
|
var cA = Math.cos(alphaRad);
|
||||||
|
var sA = Math.sin(alphaRad);
|
||||||
|
var cB = Math.cos(betaRad);
|
||||||
|
var sB = Math.sin(betaRad);
|
||||||
|
var cG = Math.cos(gammaRad);
|
||||||
|
var sG = Math.sin(gammaRad);
|
||||||
|
|
||||||
|
// Calculate A, B, C rotation components
|
||||||
|
var rA = - cA * sG - sA * sB * cG;
|
||||||
|
var rB = - sA * sG + cA * sB * cG;
|
||||||
|
var rC = - cB * cG;
|
||||||
|
|
||||||
|
// Calculate compass heading
|
||||||
|
var compassHeading = Math.atan(rA / rB);
|
||||||
|
|
||||||
|
// Convert from half unit circle to whole unit circle
|
||||||
|
if(rB < 0) {
|
||||||
|
compassHeading += Math.PI;
|
||||||
|
}else if(rA < 0) {
|
||||||
|
compassHeading += 2 * Math.PI;
|
||||||
|
}
|
||||||
|
return compassHeading * (180/Math.PI);
|
||||||
|
}
|
||||||
|
|
||||||
|
getCurrentCompassHeading(): Observable<number> {
|
||||||
|
return Observable.create((observer: Observer<number>) => {
|
||||||
|
window.addEventListener("deviceorientation", (event:DeviceOrientationEvent)=>{
|
||||||
|
let heading = this.compassHeading(event.alpha,event.beta,event.gamma);
|
||||||
|
if(!Number.isNaN(heading)) {
|
||||||
|
observer.next(heading);
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,41 @@
|
|||||||
|
import { Injectable} from '@angular/core';
|
||||||
|
import { Feature } from 'ol';
|
||||||
|
import { Point } from 'ol/geom';
|
||||||
|
import * as extent from 'ol/extent';
|
||||||
|
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class FeatureIconService {
|
||||||
|
|
||||||
|
getIconImageDataUrl(iconClass:string, backgroundColor: string = "#c80a6e",color:string = "#ffffff"): string {
|
||||||
|
var canvas = document.createElement('canvas');
|
||||||
|
canvas.width = 365;
|
||||||
|
canvas.height = 560;
|
||||||
|
var ctx = canvas.getContext('2d');
|
||||||
|
ctx.lineWidth = 6;
|
||||||
|
ctx.fillStyle = backgroundColor;
|
||||||
|
ctx.strokeStyle = "#000000";
|
||||||
|
var path = new Path2D("m182.9 551.7c0 0.1 0.2 0.3 0.2 0.3s175.2-269 175.2-357.4c0-130.1-88.8-186.7-175.4-186.9-86.6 0.2-175.4 56.8-175.4 186.9 0 88.4 175.3 357.4 175.3 357.4z");
|
||||||
|
ctx.fill(path)
|
||||||
|
|
||||||
|
var iconCharacter = "";
|
||||||
|
if (iconClass != null) {
|
||||||
|
var element = document.createElement("i");
|
||||||
|
element.style.display = "none";
|
||||||
|
element.className = iconClass;
|
||||||
|
document.body.appendChild(element);
|
||||||
|
iconCharacter = getComputedStyle(element, "::before").content.replace(/"/g, '');
|
||||||
|
let iconFont = "200px " +getComputedStyle(element, "::before").fontFamily
|
||||||
|
document.body.removeChild(element);
|
||||||
|
ctx.strokeStyle = color;
|
||||||
|
ctx.fillStyle = color;
|
||||||
|
ctx.lineWidth = 15;
|
||||||
|
ctx.font = iconFont;
|
||||||
|
var ts = ctx.measureText(iconCharacter);
|
||||||
|
ctx.fillText(iconCharacter, 182.9 - (ts.width / 2), 250);
|
||||||
|
ctx.strokeText(iconCharacter, 182.9 - (ts.width / 2), 250);
|
||||||
|
}
|
||||||
|
|
||||||
|
return canvas.toDataURL();
|
||||||
|
}
|
||||||
|
}
|
@@ -1,39 +1,39 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observer, Observable } from 'rxjs';
|
import { Observer, Observable } from 'rxjs';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GeolocationService class.
|
* GeolocationService class.
|
||||||
* https://developers.google.com/maps/documentation/javascript/
|
* https://developers.google.com/maps/documentation/javascript/
|
||||||
* https://dev.w3.org/geo/api/spec-source.html
|
* https://dev.w3.org/geo/api/spec-source.html
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GeolocationService {
|
export class GeolocationService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries HTML5 geolocation.
|
* Tries HTML5 geolocation.
|
||||||
*
|
*
|
||||||
* Wraps the Geolocation API into an observable.
|
* Wraps the Geolocation API into an observable.
|
||||||
*
|
*
|
||||||
* @return An observable of Position
|
* @return An observable of Position
|
||||||
*/
|
*/
|
||||||
getCurrentPosition(): Observable<Position> {
|
getCurrentPosition(): Observable<Position> {
|
||||||
return Observable.create((observer: Observer<Position>) => {
|
return Observable.create((observer: Observer<Position>) => {
|
||||||
// Invokes getCurrentPosition method of Geolocation API.
|
// Invokes getCurrentPosition method of Geolocation API.
|
||||||
navigator.geolocation.watchPosition(
|
navigator.geolocation.watchPosition(
|
||||||
(position: Position) => {
|
(position: Position) => {
|
||||||
observer.next(position);
|
observer.next(position);
|
||||||
},
|
},
|
||||||
(error: PositionError) => {
|
(error: PositionError) => {
|
||||||
console.debug('Geolocation service: ' + error.message);
|
console.debug('Geolocation service: ' + error.message);
|
||||||
observer.error(error);
|
//observer.error(error);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
enableHighAccuracy: true,
|
enableHighAccuracy: true,
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
maximumAge: 0
|
maximumAge: 0
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
70
projects/common/package-lock.json
generated
70
projects/common/package-lock.json
generated
@@ -1,35 +1,35 @@
|
|||||||
{
|
{
|
||||||
"name": "@farmmaps/common",
|
"name": "@farmmaps/common",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"angular-oauth2-oidc": {
|
"angular-oauth2-oidc": {
|
||||||
"version": "5.0.2",
|
"version": "8.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/angular-oauth2-oidc/-/angular-oauth2-oidc-5.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/angular-oauth2-oidc/-/angular-oauth2-oidc-8.0.4.tgz",
|
||||||
"integrity": "sha512-jtOv4IWEjSFfBHVE4seWGWT/ZfWJ95QJ1JaFhVVGJEF64ibGuPwV3ztwTOUl98QHi/Yg4PXXDAisb31JnIbxBw==",
|
"integrity": "sha512-7/3niJBqD7rnElcW+SudE36g7zMWChW4gSq7NpJSzDA4aQadBgvg0hn317MfPm9tpYGrpE3G/z2NMnbzek4TMA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"jsrsasign": "^8.0.12",
|
"jsrsasign": "^8.0.12",
|
||||||
"tslib": "^1.9.0"
|
"tslib": "^1.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jsrsasign": {
|
"jsrsasign": {
|
||||||
"version": "8.0.12",
|
"version": "8.0.12",
|
||||||
"resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-8.0.12.tgz",
|
"resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-8.0.12.tgz",
|
||||||
"integrity": "sha1-Iqu5ZW00owuVMENnIINeicLlwxY="
|
"integrity": "sha1-Iqu5ZW00owuVMENnIINeicLlwxY="
|
||||||
},
|
},
|
||||||
"ngx-uploadx": {
|
"ngx-uploadx": {
|
||||||
"version": "3.1.3",
|
"version": "3.3.2",
|
||||||
"resolved": "https://registry.npmjs.org/ngx-uploadx/-/ngx-uploadx-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/ngx-uploadx/-/ngx-uploadx-3.3.2.tgz",
|
||||||
"integrity": "sha512-RX3uEaqMTpjTv5mtdnTQYsDOED3Qg5V3OBU5ohOyL35uL+dllF7I0y+kojJprm9thzHNAWih1DLeTlVWZKo+hQ==",
|
"integrity": "sha512-gRdXXq2cRU9HE6dj65qay9GV8NRC7n8y5LtMzJWqsfu2k3CHMQxo2TqZwA9/l/PqJ76RoO7sTPy1OenFQ+krkQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "^1.9.0"
|
"tslib": "^1.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tslib": {
|
"tslib": {
|
||||||
"version": "1.10.0",
|
"version": "1.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz",
|
||||||
"integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ=="
|
"integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ=="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,24 +1,22 @@
|
|||||||
{
|
{
|
||||||
"name": "@farmmaps/common",
|
"name": "@farmmaps/common",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
|
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"peerDependencies": {
|
||||||
"angular-oauth2-oidc": "^5.0.2",
|
"@ng-bootstrap/ng-bootstrap": "^4.2.1",
|
||||||
"ngx-uploadx": "^3.1.3"
|
"@angular/common": "^8.2.0",
|
||||||
},
|
"@angular/core": "^8.2.0",
|
||||||
"peerDependencies": {
|
"@angular/forms": "^8.2.0",
|
||||||
"@ng-bootstrap/ng-bootstrap": "^4.2.1",
|
"@ngrx/effects": "^8.2",
|
||||||
"@angular/common": "^7.2.0",
|
"@ngrx/router-store": "^8.2",
|
||||||
"@angular/core": "^7.2.0",
|
"@ngrx/store": "^8.2",
|
||||||
"@angular/forms": "^7.2.0",
|
"tassign": "^1.0.0",
|
||||||
"@ngrx/effects": "^7.2",
|
"bootstrap": "^4.3.1",
|
||||||
"@ngrx/router-store": "^7.2",
|
"@aspnet/signalr": "^1.1.4",
|
||||||
"@ngrx/store": "^7.2",
|
"font-awesome": "^4.7.0",
|
||||||
"tassign": "^1.0.0",
|
"ngx-uploadx": "^3.3.2",
|
||||||
"bootstrap": "^4.3.1",
|
"angular-oauth2-oidc": "^8.0.2"
|
||||||
"@aspnet/signalr": "^1.1.4",
|
}
|
||||||
"font-awesome": "^4.7.0"
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -1,2 +0,0 @@
|
|||||||
//$theme-colors: ( "primary": #a7ce39, "secondary": #ffc800 );
|
|
||||||
//$theme-colors: ( "primary": #a7ce39);
|
|
@@ -1,234 +1,253 @@
|
|||||||
import { Action } from '@ngrx/store';
|
import { Action } from '@ngrx/store';
|
||||||
|
|
||||||
import { IItemTypes } from '../models/item.types';
|
import { IItemTypes } from '../models/item.types';
|
||||||
import { IListItem } from '../models/list.item';
|
import { IListItem } from '../models/list.item';
|
||||||
import { IUser } from '../models/user';
|
import { IUser } from '../models/user';
|
||||||
|
|
||||||
export const INITUSER = '[AppCommon] InitUser';
|
export const INITUSER = '[AppCommon] InitUser';
|
||||||
export const INITUSERSUCCESS = '[AppCommon] InitUserSuccess';
|
export const INITUSERSUCCESS = '[AppCommon] InitUserSuccess';
|
||||||
|
|
||||||
export const INITROOT = '[Explorer] InitRoot';
|
export const INITROOT = '[Explorer] InitRoot';
|
||||||
export const INITROOTSUCCESS = '[Explorer] InitRootSuccess';
|
export const INITROOTSUCCESS = '[Explorer] InitRootSuccess';
|
||||||
|
|
||||||
export const OPENMODAL = '[AppCommon] OpenModal';
|
export const OPENMODAL = '[AppCommon] OpenModal';
|
||||||
export const CLOSEMODAL = '[AppCommon] CloseModal';
|
export const CLOSEMODAL = '[AppCommon] CloseModal';
|
||||||
export const LOGIN = '[AppCommon] Login';
|
export const LOGIN = '[AppCommon] Login';
|
||||||
export const INITIALIZED = '[AppCommon] Initialized';
|
export const ESCAPE = '[AppCommon] Escape';
|
||||||
export const ESCAPE = '[AppCommon] Escape';
|
|
||||||
|
export const LOADITEMTYPES = '[AppCommon] LoadItemTypes';
|
||||||
export const LOADITEMTYPES = '[AppCommon] LoadItemTypes';
|
export const LOADITEMTYPESSUCCESS = '[AppCommon] LoadItemTypesSuccess';
|
||||||
export const LOADITEMTYPESSUCCESS = '[AppCommon] LoadItemTypesSuccess';
|
|
||||||
|
export const ITEMCHANGEDEVENT = '[AppCommon] ItemChangedEvent';
|
||||||
export const ITEMCHANGEDEVENT = '[AppCommon] ItemChangedEvent';
|
export const ITEMADDEDEVENT = '[AppCommon] ItemAddedEvent';
|
||||||
export const ITEMADDEDEVENT = '[AppCommon] ItemAddedEvent';
|
export const ITEMDELETEDEVENT = '[AppCommon] ItemDeletedEvent';
|
||||||
export const ITEMDELETEDEVENT = '[AppCommon] ItemDeletedEvent';
|
|
||||||
|
export const TASKSTARTEVENT = '[AppCommon] TaskStartEvent';
|
||||||
export const TASKSTARTEVENT = '[AppCommon] TaskStartEvent';
|
export const TASKENDEVENT = '[AppCommon] TaskEndEvent';
|
||||||
export const TASKENDEVENT = '[AppCommon] TaskEndEvent';
|
export const TASKERRORTEVENT = '[AppCommon] TaskErrorEvent';
|
||||||
export const TASKERRORTEVENT = '[AppCommon] TaskErrorEvent';
|
|
||||||
|
export const DEVICEUPDATEEVENT = '[AppCommon] DeviceUpdateEvent';
|
||||||
export const DELETEITEMS = '[AppCommon] DeleteItems';
|
|
||||||
export const DELETEITEMSSUCCESS = '[AppCommon] DeleteItemsSuccess';
|
export const DELETEITEMS = '[AppCommon] DeleteItems';
|
||||||
|
export const DELETEITEMSSUCCESS = '[AppCommon] DeleteItemsSuccess';
|
||||||
export const STARTROUTELOADING = '[AppCommon] StartRouteLoading';
|
|
||||||
export const ENDROUTELOADING = '[AppCommon] EndRouteLoading';
|
export const STARTROUTELOADING = '[AppCommon] StartRouteLoading';
|
||||||
|
export const ENDROUTELOADING = '[AppCommon] EndRouteLoading';
|
||||||
export const FULLSCREEN = '[AppCommon] FullScreen';
|
|
||||||
export const SHOWNAVBAR = '[AppCommon] ShowNavBar';
|
export const FULLSCREEN = '[AppCommon] FullScreen';
|
||||||
|
export const SHOWNAVBAR = '[AppCommon] ShowNavBar';
|
||||||
export const EDITITEM = "[AppCommon] EditItem";
|
|
||||||
|
export const EDITITEM = "[AppCommon] EditItem";
|
||||||
export const VIEWITEM = "[AppCommon] ViewItem";
|
|
||||||
|
export const VIEWITEM = "[AppCommon] ViewItem";
|
||||||
export const FAIL = '[AppCommon] Fail';
|
|
||||||
|
export const FAIL = '[AppCommon] Fail';
|
||||||
export const UPLOADEDFILECLICK = '[AppCommon] UploadedFileClick';
|
|
||||||
|
export const UPLOADEDFILECLICK = '[AppCommon] UploadedFileClick';
|
||||||
export class InitUser implements Action {
|
|
||||||
readonly type = INITUSER;
|
export const TOGGLEMENU = '[AppCommon] ToggleMenu';
|
||||||
|
|
||||||
constructor() { }
|
export const SETMENUVISIBLE = '[AppCommon] SetMenuVisible';
|
||||||
}
|
|
||||||
|
export class InitUser implements Action {
|
||||||
export class InitUserSuccess implements Action {
|
readonly type = INITUSER;
|
||||||
readonly type = INITUSERSUCCESS;
|
|
||||||
|
constructor() { }
|
||||||
constructor(public user:IUser ) { }
|
}
|
||||||
}
|
|
||||||
|
export class InitUserSuccess implements Action {
|
||||||
export class InitRoot implements Action {
|
readonly type = INITUSERSUCCESS;
|
||||||
readonly type = INITROOT;
|
|
||||||
|
constructor(public user:IUser ) { }
|
||||||
constructor() { }
|
}
|
||||||
}
|
|
||||||
|
export class InitRoot implements Action {
|
||||||
export class InitRootSuccess implements Action {
|
readonly type = INITROOT;
|
||||||
readonly type = INITROOTSUCCESS;
|
|
||||||
|
constructor() { }
|
||||||
constructor(public items:IListItem[]) { }
|
}
|
||||||
}
|
|
||||||
|
export class InitRootSuccess implements Action {
|
||||||
export class OpenModal implements Action {
|
readonly type = INITROOTSUCCESS;
|
||||||
readonly type = OPENMODAL;
|
|
||||||
|
constructor(public items:IListItem[]) { }
|
||||||
constructor(public modalName: string) { }
|
}
|
||||||
}
|
|
||||||
|
export class OpenModal implements Action {
|
||||||
export class CloseModal implements Action {
|
readonly type = OPENMODAL;
|
||||||
readonly type = CLOSEMODAL;
|
|
||||||
|
constructor(public modalName: string) { }
|
||||||
constructor() { }
|
}
|
||||||
}
|
|
||||||
|
export class CloseModal implements Action {
|
||||||
export class StartRouteLoading implements Action {
|
readonly type = CLOSEMODAL;
|
||||||
readonly type = STARTROUTELOADING;
|
|
||||||
|
constructor() { }
|
||||||
constructor() { }
|
}
|
||||||
}
|
|
||||||
|
export class StartRouteLoading implements Action {
|
||||||
export class EndRouteLoading implements Action {
|
readonly type = STARTROUTELOADING;
|
||||||
readonly type = ENDROUTELOADING;
|
|
||||||
|
constructor() { }
|
||||||
constructor() { }
|
}
|
||||||
}
|
|
||||||
|
export class EndRouteLoading implements Action {
|
||||||
export class Login implements Action {
|
readonly type = ENDROUTELOADING;
|
||||||
readonly type = LOGIN;
|
|
||||||
|
constructor() { }
|
||||||
constructor(public url: string) { }
|
}
|
||||||
}
|
|
||||||
|
export class Login implements Action {
|
||||||
export class Initialized implements Action {
|
readonly type = LOGIN;
|
||||||
readonly type = INITIALIZED;
|
|
||||||
|
constructor(public url: string) { }
|
||||||
constructor() { }
|
}
|
||||||
}
|
|
||||||
|
export class Escape implements Action {
|
||||||
export class Escape implements Action {
|
readonly type = ESCAPE;
|
||||||
readonly type = ESCAPE;
|
|
||||||
|
constructor(public escapeKey:boolean, public click:boolean) { }
|
||||||
constructor(public escapeKey:boolean, public click:boolean) { }
|
}
|
||||||
}
|
|
||||||
|
export class LoadItemTypes implements Action {
|
||||||
export class LoadItemTypes implements Action {
|
readonly type = LOADITEMTYPES;
|
||||||
readonly type = LOADITEMTYPES;
|
|
||||||
|
constructor() { }
|
||||||
constructor() { }
|
}
|
||||||
}
|
|
||||||
|
export class LoadItemTypesSuccess implements Action {
|
||||||
export class LoadItemTypesSuccess implements Action {
|
readonly type = LOADITEMTYPESSUCCESS;
|
||||||
readonly type = LOADITEMTYPESSUCCESS;
|
|
||||||
|
constructor(public itemTypes: IItemTypes) { }
|
||||||
constructor(public itemTypes: IItemTypes) { }
|
}
|
||||||
}
|
|
||||||
|
export class Fail implements Action {
|
||||||
export class Fail implements Action {
|
readonly type = FAIL;
|
||||||
readonly type = FAIL;
|
|
||||||
|
constructor(public payload: string) { }
|
||||||
constructor(public payload: string) { }
|
}
|
||||||
}
|
|
||||||
|
export class ItemChangedEvent implements Action {
|
||||||
export class ItemChangedEvent implements Action {
|
readonly type = ITEMCHANGEDEVENT;
|
||||||
readonly type = ITEMCHANGEDEVENT;
|
|
||||||
|
constructor(public itemCode: string, public attributes: any) { }
|
||||||
constructor(public itemCode: string, public attributes: any) { }
|
}
|
||||||
}
|
|
||||||
|
export class ItemAddedEvent implements Action {
|
||||||
export class ItemAddedEvent implements Action {
|
readonly type = ITEMADDEDEVENT;
|
||||||
readonly type = ITEMADDEDEVENT;
|
|
||||||
|
constructor(public itemCode: string, public attributes: any) { }
|
||||||
constructor(public itemCode: string, public attributes: any) { }
|
}
|
||||||
}
|
|
||||||
|
export class ItemDeletedEvent implements Action {
|
||||||
export class ItemDeletedEvent implements Action {
|
readonly type = ITEMDELETEDEVENT;
|
||||||
readonly type = ITEMDELETEDEVENT;
|
|
||||||
|
constructor(public itemCode: string, public attributes: any) { }
|
||||||
constructor(public itemCode: string, public attributes: any) { }
|
}
|
||||||
}
|
|
||||||
|
export class TaskStartEvent implements Action {
|
||||||
export class TaskStartEvent implements Action {
|
readonly type = TASKSTARTEVENT;
|
||||||
readonly type = TASKSTARTEVENT;
|
|
||||||
|
constructor(public itemCode: string, public attributes: any) { }
|
||||||
constructor(public itemCode: string, public attributes: any) { }
|
}
|
||||||
}
|
|
||||||
|
export class TaskEndEvent implements Action {
|
||||||
export class TaskEndEvent implements Action {
|
readonly type = TASKENDEVENT;
|
||||||
readonly type = TASKENDEVENT;
|
|
||||||
|
constructor(public itemCode: string, public attributes: any) { }
|
||||||
constructor(public itemCode: string, public attributes: any) { }
|
}
|
||||||
}
|
|
||||||
|
export class TaskErrorEvent implements Action {
|
||||||
export class TaskErrorEvent implements Action {
|
readonly type = TASKERRORTEVENT;
|
||||||
readonly type = TASKERRORTEVENT;
|
|
||||||
|
constructor(public itemCode: string, public attributes: any) { }
|
||||||
constructor(public itemCode: string, public attributes: any) { }
|
}
|
||||||
}
|
|
||||||
|
export class DeviceUpdateEvent implements Action {
|
||||||
export class DeleteItems implements Action {
|
readonly type = DEVICEUPDATEEVENT;
|
||||||
readonly type = DELETEITEMS;
|
|
||||||
|
constructor(public itemCode: string, public attributes: any) { }
|
||||||
constructor(public itemCodes: string[]) { }
|
}
|
||||||
}
|
|
||||||
|
export class DeleteItems implements Action {
|
||||||
export class DeleteItemsSuccess implements Action {
|
readonly type = DELETEITEMS;
|
||||||
readonly type = DELETEITEMSSUCCESS;
|
|
||||||
|
constructor(public itemCodes: string[]) { }
|
||||||
constructor(public deletedItemCodes: string[]) { }
|
}
|
||||||
}
|
|
||||||
|
export class DeleteItemsSuccess implements Action {
|
||||||
export class EditItem implements Action {
|
readonly type = DELETEITEMSSUCCESS;
|
||||||
readonly type = EDITITEM;
|
|
||||||
|
constructor(public deletedItemCodes: string[]) { }
|
||||||
constructor(public item: IListItem) { }
|
}
|
||||||
}
|
|
||||||
|
export class EditItem implements Action {
|
||||||
export class ViewItem implements Action {
|
readonly type = EDITITEM;
|
||||||
readonly type = VIEWITEM;
|
|
||||||
|
constructor(public item: IListItem) { }
|
||||||
constructor(public item: IListItem) { }
|
}
|
||||||
}
|
|
||||||
|
export class ViewItem implements Action {
|
||||||
export class FullScreen implements Action {
|
readonly type = VIEWITEM;
|
||||||
readonly type = FULLSCREEN;
|
|
||||||
|
constructor(public item: IListItem) { }
|
||||||
constructor() { }
|
}
|
||||||
}
|
|
||||||
|
export class FullScreen implements Action {
|
||||||
export class ShowNavBar implements Action {
|
readonly type = FULLSCREEN;
|
||||||
readonly type = SHOWNAVBAR;
|
|
||||||
|
constructor() { }
|
||||||
constructor() { }
|
}
|
||||||
}
|
|
||||||
|
export class ShowNavBar implements Action {
|
||||||
export class UploadedFileClick implements Action {
|
readonly type = SHOWNAVBAR;
|
||||||
readonly type = UPLOADEDFILECLICK;
|
|
||||||
constructor(public itemCode:string) { }
|
constructor() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class UploadedFileClick implements Action {
|
||||||
export type Actions = OpenModal
|
readonly type = UPLOADEDFILECLICK;
|
||||||
| InitRoot
|
constructor(public itemCode:string) { }
|
||||||
| InitRootSuccess
|
}
|
||||||
| CloseModal
|
|
||||||
| Login
|
export class ToggleMenu implements Action {
|
||||||
| Initialized
|
readonly type = TOGGLEMENU;
|
||||||
| ItemChangedEvent
|
|
||||||
| ItemAddedEvent
|
constructor() { }
|
||||||
| ItemDeletedEvent
|
}
|
||||||
| Escape
|
|
||||||
| LoadItemTypes
|
export class SetMenuVisible implements Action {
|
||||||
| LoadItemTypesSuccess
|
readonly type = SETMENUVISIBLE;
|
||||||
| DeleteItems
|
|
||||||
| DeleteItemsSuccess
|
constructor(public visible:boolean) { }
|
||||||
| Fail
|
}
|
||||||
| EditItem
|
|
||||||
| ViewItem
|
|
||||||
| FullScreen
|
export type Actions = OpenModal
|
||||||
| ShowNavBar
|
| InitRoot
|
||||||
| StartRouteLoading
|
| InitRootSuccess
|
||||||
| EndRouteLoading
|
| CloseModal
|
||||||
| InitUser
|
| Login
|
||||||
| InitUserSuccess
|
| ItemChangedEvent
|
||||||
| TaskStartEvent
|
| ItemAddedEvent
|
||||||
| TaskEndEvent
|
| ItemDeletedEvent
|
||||||
| TaskErrorEvent;
|
| Escape
|
||||||
|
| LoadItemTypes
|
||||||
|
| LoadItemTypesSuccess
|
||||||
|
| DeleteItems
|
||||||
|
| DeleteItemsSuccess
|
||||||
|
| Fail
|
||||||
|
| EditItem
|
||||||
|
| ViewItem
|
||||||
|
| FullScreen
|
||||||
|
| ShowNavBar
|
||||||
|
| StartRouteLoading
|
||||||
|
| EndRouteLoading
|
||||||
|
| InitUser
|
||||||
|
| InitUserSuccess
|
||||||
|
| TaskStartEvent
|
||||||
|
| TaskEndEvent
|
||||||
|
| TaskErrorEvent
|
||||||
|
| DeviceUpdateEvent
|
||||||
|
| ToggleMenu
|
||||||
|
| SetMenuVisible;
|
||||||
|
@@ -1,41 +1,34 @@
|
|||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import {RouterModule} from '@angular/router';
|
import {RouterModule} from '@angular/router';
|
||||||
|
|
||||||
import {AuthCallbackComponent} from './components/auth-callback/auth-callback.component';
|
import {AuthCallbackComponent} from './components/auth-callback/auth-callback.component';
|
||||||
import {AuthCallbackGuard} from './components/auth-callback/auth-callback.guard';
|
import {AuthCallbackGuard} from './components/auth-callback/auth-callback.guard';
|
||||||
import {FullScreenGuard} from './services/full-screen-guard.service';
|
import {NavBarGuard} from './services/nav-bar-guard.service';
|
||||||
import {SessionClearedComponent} from './components/session-cleared/session-cleared.component';
|
import {FullScreenGuard} from './services/full-screen-guard.service';
|
||||||
import {NotFoundComponent} from './components/not-found/not-found.component';
|
import {SessionClearedComponent} from './components/session-cleared/session-cleared.component';
|
||||||
|
import {NotFoundComponent} from './components/not-found/not-found.component';
|
||||||
|
|
||||||
const routes = [
|
|
||||||
{
|
const routes = [
|
||||||
path: 'cb',
|
{
|
||||||
component: AuthCallbackComponent,
|
path: 'cb',
|
||||||
canActivate: [AuthCallbackGuard],
|
component: AuthCallbackComponent,
|
||||||
},
|
canActivate: [AuthCallbackGuard],
|
||||||
{
|
},
|
||||||
path: 'loggedout',
|
{
|
||||||
component: SessionClearedComponent,
|
path: 'loggedout',
|
||||||
canActivate: [FullScreenGuard],
|
component: SessionClearedComponent,
|
||||||
},
|
canActivate: [FullScreenGuard],
|
||||||
{
|
},
|
||||||
path: '**', component: NotFoundComponent,
|
{
|
||||||
data: {
|
path: '**', component: NotFoundComponent,
|
||||||
title: '404 - Not found',
|
canActivate: [NavBarGuard]
|
||||||
meta: [{name: 'description', content: '404 - Error'}],
|
}
|
||||||
links: [],
|
];
|
||||||
// links: [
|
|
||||||
// { rel: 'canonical', href: 'http://blogs.example.com/bootstrap/something' },
|
@NgModule({
|
||||||
// { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/bootstrap-demo' }
|
imports: [RouterModule.forChild(routes)],
|
||||||
//]
|
exports: [RouterModule],
|
||||||
},
|
})
|
||||||
},
|
export class AppCommonRoutingModule {
|
||||||
];
|
}
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [RouterModule.forChild(routes)],
|
|
||||||
exports: [RouterModule],
|
|
||||||
})
|
|
||||||
export class AppCommonRoutingModule {
|
|
||||||
}
|
|
||||||
|
86
projects/common/src/fm/common-service.module.ts
Normal file
86
projects/common/src/fm/common-service.module.ts
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
// angular modules
|
||||||
|
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf } from '@angular/core';
|
||||||
|
import { DatePipe } from '@angular/common';
|
||||||
|
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||||
|
|
||||||
|
// external modules
|
||||||
|
import { OAuthModule, OAuthService, OAuthStorage } from 'angular-oauth2-oidc';
|
||||||
|
|
||||||
|
|
||||||
|
//components
|
||||||
|
import { ItemTypeService } from './services/itemtype.service';
|
||||||
|
import { FolderService } from './services/folder.service';
|
||||||
|
import { TimespanService } from './services/timespan.service';
|
||||||
|
import { ItemService } from './services/item.service';
|
||||||
|
import { EventService } from './services/event.service';
|
||||||
|
import { TypeaheadService } from './services/typeahead.service';
|
||||||
|
import { UserService } from './services/user.service';
|
||||||
|
import { WeatherService} from './services/weather.service';
|
||||||
|
import { AppConfig } from './shared/app.config';
|
||||||
|
import { AccessTokenInterceptor } from "./shared/accesstoken.interceptor";
|
||||||
|
import { appConfigFactory } from "./shared/app.config.factory";
|
||||||
|
import { AuthGuard } from './services/auth-guard.service';
|
||||||
|
import { NavBarGuard } from './services/nav-bar-guard.service';
|
||||||
|
import { FullScreenGuard } from './services/full-screen-guard.service';
|
||||||
|
import { CodeListItemService } from './services/codelistitem.service';
|
||||||
|
import { AuthCallbackGuard } from './components/auth-callback/auth-callback.guard';
|
||||||
|
import { ResumableFileUploadService } from './components/resumable-file-upload/resumable-file-upload.service';
|
||||||
|
import { NgbDateNativeAdapter } from './services/date-adapter.service'
|
||||||
|
import { AuthConfigFactory } from './shared/authconfigFactory';
|
||||||
|
import { StateSerializerService } from './services/state-serializer.service';
|
||||||
|
|
||||||
|
export {
|
||||||
|
FolderService,
|
||||||
|
ItemTypeService,
|
||||||
|
TimespanService,
|
||||||
|
ItemService,
|
||||||
|
EventService,
|
||||||
|
TypeaheadService,
|
||||||
|
UserService,
|
||||||
|
WeatherService,
|
||||||
|
CodeListItemService,
|
||||||
|
AppConfig,
|
||||||
|
AccessTokenInterceptor,
|
||||||
|
AuthGuard,
|
||||||
|
NavBarGuard,
|
||||||
|
FullScreenGuard,
|
||||||
|
AuthCallbackGuard,
|
||||||
|
ResumableFileUploadService,
|
||||||
|
NgbDateNativeAdapter,
|
||||||
|
StateSerializerService
|
||||||
|
};
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
OAuthModule.forRoot(),
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AppCommonServiceModule {
|
||||||
|
constructor(@Optional() @SkipSelf() parentModule: AppCommonServiceModule) {
|
||||||
|
if (parentModule) {
|
||||||
|
throw new Error(
|
||||||
|
'AppCommonServiceModule is already loaded. Import it in the AppModule only');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static forRoot(): ModuleWithProviders {
|
||||||
|
return {
|
||||||
|
ngModule: AppCommonServiceModule,
|
||||||
|
providers: [
|
||||||
|
AppConfig,
|
||||||
|
ItemTypeService,
|
||||||
|
{
|
||||||
|
provide: APP_INITIALIZER,
|
||||||
|
useFactory: appConfigFactory,
|
||||||
|
deps: [Injector, AppConfig, OAuthService, AuthConfigFactory, OAuthStorage,ItemTypeService],
|
||||||
|
multi: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: HTTP_INTERCEPTORS,
|
||||||
|
useClass: AccessTokenInterceptor,
|
||||||
|
multi: true
|
||||||
|
},
|
||||||
|
DatePipe
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@@ -1,86 +1,64 @@
|
|||||||
// angular modules
|
// angular modules
|
||||||
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector,Optional,SkipSelf } from '@angular/core';
|
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf } from '@angular/core';
|
||||||
import { CommonModule, DatePipe } from '@angular/common';
|
import { CommonModule, DatePipe } from '@angular/common';
|
||||||
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
|
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
|
|
||||||
// external modules
|
// external modules
|
||||||
import { OAuthModule,AuthConfig, OAuthService, OAuthStorage } from 'angular-oauth2-oidc';
|
import { OAuthModule, AuthConfig, OAuthService, OAuthStorage } from 'angular-oauth2-oidc';
|
||||||
import { StoreModule,Store } from '@ngrx/store';
|
import { StoreModule, Store } from '@ngrx/store';
|
||||||
import { EffectsModule } from '@ngrx/effects';
|
import { EffectsModule } from '@ngrx/effects';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import {UploadxModule } from 'ngx-uploadx';
|
import { UploadxModule } from 'ngx-uploadx';
|
||||||
|
|
||||||
|
|
||||||
// routing module
|
// routing module
|
||||||
import { AppCommonRoutingModule } from './common-routing.module';
|
import { AppCommonRoutingModule } from './common-routing.module';
|
||||||
|
|
||||||
import { MODULE_NAME } from './module-name';
|
import { MODULE_NAME } from './module-name';
|
||||||
|
|
||||||
//components
|
//components
|
||||||
import { ItemTypeService } from './services/itemtype.service';
|
|
||||||
import { FolderService } from './services/folder.service';
|
|
||||||
import { TimespanService} from './services/timespan.service';
|
|
||||||
import { ItemService} from './services/item.service';
|
|
||||||
import { EventService } from './services/event.service';
|
|
||||||
import { TypeaheadService } from './services/typeahead.service';
|
|
||||||
import { UserService } from './services/user.service';
|
|
||||||
import { AppConfig } from './shared/app.config';
|
|
||||||
import { AccessTokenInterceptor } from "./shared/accesstoken.interceptor";
|
|
||||||
import { appConfigFactory } from "./shared/app.config.factory";
|
|
||||||
import { AuthGuard } from './services/auth-guard.service';
|
|
||||||
import { NavBarGuard } from './services/nav-bar-guard.service';
|
|
||||||
import { FullScreenGuard } from './services/full-screen-guard.service';
|
|
||||||
import { SafePipe } from './shared/safe.pipe';
|
import { SafePipe } from './shared/safe.pipe';
|
||||||
import { AppComponent} from './components/app/app.component';
|
import { AuthConfigFactory, IAuthconfigFactory } from './shared/authconfigFactory';
|
||||||
|
import { AppComponent } from './components/app/app.component';
|
||||||
import { AuthCallbackComponent } from './components/auth-callback/auth-callback.component';
|
import { AuthCallbackComponent } from './components/auth-callback/auth-callback.component';
|
||||||
import { AuthCallbackGuard } from './components/auth-callback/auth-callback.guard';
|
|
||||||
import { SessionClearedComponent } from './components/session-cleared/session-cleared.component';
|
import { SessionClearedComponent } from './components/session-cleared/session-cleared.component';
|
||||||
import { ResumableFileUploadService } from './components/resumable-file-upload/resumable-file-upload.service';
|
|
||||||
import { ResumableFileUploadComponent } from './components/resumable-file-upload/resumable-file-upload.component';
|
import { ResumableFileUploadComponent } from './components/resumable-file-upload/resumable-file-upload.component';
|
||||||
import { NotFoundComponent } from './components/not-found/not-found.component';
|
import { NotFoundComponent } from './components/not-found/not-found.component';
|
||||||
import { NotImplementedComponent } from './components/not-implemented/not-implemented.component';
|
import { NotImplementedComponent } from './components/not-implemented/not-implemented.component';
|
||||||
import { SidePanelComponent } from './components/side-panel/side-panel.component';
|
import { SidePanelComponent } from './components/side-panel/side-panel.component';
|
||||||
import { TimespanComponent } from './components/timespan/timespan.component';
|
import { TimespanComponent } from './components/timespan/timespan.component';
|
||||||
import { TagInputComponent } from './components/tag-input/tag-input.component';
|
import { TagInputComponent } from './components/tag-input/tag-input.component';
|
||||||
import {IEventMessage } from './models/event.message';
|
import { MenuBackgroundComponent } from './components/menu-background/menu-background.component';
|
||||||
|
import { Alert } from './enumerations/alert.enum';
|
||||||
|
import { IEventMessage } from './models/event.message';
|
||||||
import { IItem, Item } from './models/item';
|
import { IItem, Item } from './models/item';
|
||||||
import {IItemType} from './models/item.type';
|
import { WeatherCurrentObservation } from './models/weatherCurrentObservation';
|
||||||
import {IItemTypes} from './models/item.types';
|
import { IItemType } from './models/item.type';
|
||||||
import {IItemTask,ItemTask} from './models/itemTask';
|
import { IItemTypes } from './models/item.types';
|
||||||
import {IListItem} from './models/list.item';
|
import { IItemTask, ItemTask } from './models/itemTask';
|
||||||
import {ITypeaheadItem} from './models/typeahead.item';
|
import { IListItem } from './models/list.item';
|
||||||
import {IUser} from './models/user';
|
import { ITypeaheadItem } from './models/typeahead.item';
|
||||||
|
import { IUser } from './models/user';
|
||||||
|
import { IQueryState } from './models/query.state';
|
||||||
|
import { ICodeListItem } from './models/code.list.item';
|
||||||
import * as commonActions from './actions/app-common.actions';
|
import * as commonActions from './actions/app-common.actions';
|
||||||
import * as commonReducers from './reducers/app-common.reducer';
|
import * as commonReducers from './reducers/app-common.reducer';
|
||||||
import * as commonEffects from './effects/app-common.effects';
|
import * as commonEffects from './effects/app-common.effects';
|
||||||
import {NgbDateNativeAdapter} from './services/date-adapter.service'
|
import { SecureOAuthStorage} from './shared/secureOAuthStorage';
|
||||||
import { from } from 'rxjs';
|
|
||||||
|
|
||||||
export {FolderService,
|
export {
|
||||||
ItemTypeService,
|
|
||||||
TimespanService,
|
|
||||||
ItemService,
|
|
||||||
EventService,
|
|
||||||
TypeaheadService,
|
|
||||||
UserService,
|
|
||||||
AppConfig,
|
|
||||||
AccessTokenInterceptor,
|
|
||||||
AuthGuard,
|
|
||||||
NavBarGuard,
|
|
||||||
FullScreenGuard,
|
|
||||||
SafePipe,
|
SafePipe,
|
||||||
AuthCallbackComponent,
|
AuthCallbackComponent,
|
||||||
AuthCallbackGuard,
|
|
||||||
AppComponent,
|
AppComponent,
|
||||||
SessionClearedComponent,
|
SessionClearedComponent,
|
||||||
ResumableFileUploadService,
|
|
||||||
ResumableFileUploadComponent,
|
ResumableFileUploadComponent,
|
||||||
NotFoundComponent,
|
NotFoundComponent,
|
||||||
NotImplementedComponent,
|
NotImplementedComponent,
|
||||||
SidePanelComponent,
|
SidePanelComponent,
|
||||||
TimespanComponent,
|
TimespanComponent,
|
||||||
TagInputComponent,
|
TagInputComponent,
|
||||||
|
Alert,
|
||||||
IEventMessage,
|
IEventMessage,
|
||||||
IItem,
|
IItem,
|
||||||
Item,
|
Item,
|
||||||
@@ -91,9 +69,15 @@ export {FolderService,
|
|||||||
IListItem,
|
IListItem,
|
||||||
ITypeaheadItem,
|
ITypeaheadItem,
|
||||||
IUser,
|
IUser,
|
||||||
|
ICodeListItem,
|
||||||
|
IQueryState,
|
||||||
commonActions,
|
commonActions,
|
||||||
commonReducers,
|
commonReducers,
|
||||||
NgbDateNativeAdapter
|
IAuthconfigFactory,
|
||||||
|
AuthConfigFactory,
|
||||||
|
MenuBackgroundComponent,
|
||||||
|
SecureOAuthStorage,
|
||||||
|
WeatherCurrentObservation
|
||||||
};
|
};
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -101,16 +85,13 @@ export {FolderService,
|
|||||||
CommonModule,
|
CommonModule,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
AppCommonRoutingModule,
|
AppCommonRoutingModule,
|
||||||
StoreModule.forFeature(MODULE_NAME, commonReducers.reducer ),
|
StoreModule.forFeature(MODULE_NAME, commonReducers.reducer),
|
||||||
EffectsModule.forFeature([commonEffects.AppCommonEffects]),
|
EffectsModule.forFeature([commonEffects.AppCommonEffects]),
|
||||||
OAuthModule.forRoot(),
|
OAuthModule.forRoot(),
|
||||||
NgbModule,
|
NgbModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
UploadxModule
|
UploadxModule
|
||||||
],
|
],
|
||||||
providers: [
|
|
||||||
DatePipe
|
|
||||||
],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
AuthCallbackComponent,
|
AuthCallbackComponent,
|
||||||
@@ -121,14 +102,15 @@ export {FolderService,
|
|||||||
ResumableFileUploadComponent,
|
ResumableFileUploadComponent,
|
||||||
TimespanComponent,
|
TimespanComponent,
|
||||||
TagInputComponent,
|
TagInputComponent,
|
||||||
SessionClearedComponent
|
SessionClearedComponent,
|
||||||
|
MenuBackgroundComponent
|
||||||
],
|
],
|
||||||
exports: [
|
exports: [
|
||||||
NgbModule,
|
NgbModule,
|
||||||
UploadxModule,
|
UploadxModule,
|
||||||
CommonModule,
|
CommonModule,
|
||||||
AppComponent,
|
AppComponent,
|
||||||
ResumableFileUploadComponent,
|
ResumableFileUploadComponent,
|
||||||
AuthCallbackComponent,
|
AuthCallbackComponent,
|
||||||
SidePanelComponent,
|
SidePanelComponent,
|
||||||
SafePipe,
|
SafePipe,
|
||||||
@@ -137,33 +119,9 @@ export {FolderService,
|
|||||||
ResumableFileUploadComponent,
|
ResumableFileUploadComponent,
|
||||||
TimespanComponent,
|
TimespanComponent,
|
||||||
TagInputComponent,
|
TagInputComponent,
|
||||||
SessionClearedComponent
|
SessionClearedComponent,
|
||||||
]
|
MenuBackgroundComponent
|
||||||
|
]
|
||||||
})
|
})
|
||||||
export class AppCommonModule {
|
export class AppCommonModule {
|
||||||
constructor (@Optional() @SkipSelf() parentModule: AppCommonModule) {
|
|
||||||
if (parentModule) {
|
|
||||||
throw new Error(
|
|
||||||
'AppCommonModule is already loaded. Import it in the AppModule only');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static forRoot(): ModuleWithProviders {
|
|
||||||
return {
|
|
||||||
ngModule: AppCommonModule,
|
|
||||||
providers: [
|
|
||||||
AppConfig,
|
|
||||||
{
|
|
||||||
provide: APP_INITIALIZER,
|
|
||||||
useFactory: appConfigFactory,
|
|
||||||
deps: [Injector, AppConfig, OAuthService],
|
|
||||||
multi: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: HTTP_INTERCEPTORS,
|
|
||||||
useClass: AccessTokenInterceptor,
|
|
||||||
multi: true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -1,14 +1,26 @@
|
|||||||
<div class="app fullscreen" (click)="handleClick($event)" [ngClass]="{'fullscreen' :(fullScreen|async)}">
|
<div class="app fullscreen" (click)="handleClick($event)" [ngClass]="{'fullscreen' :(fullScreen|async)}">
|
||||||
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
|
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
|
||||||
<a class="navbar-brand" [routerLink]="['/']">Farm Maps <span *ngIf="routeLoading|async"><i class="fa fa-spinner fa-spin"></i></span></a>
|
<button type="button" class="btn btn-outline-light" (click)="handleToggleMenu($event)"><i class="fa fa-bars" aria-hidden="true"></i></button>
|
||||||
<ul class="navbar-nav">
|
<router-outlet name="menu" class="ml-4"></router-outlet>
|
||||||
<li class="nav-item py-0"><a [routerLinkActive]="['active']" [routerLink]="['/map']" class="nav-link"><span><i class="fa fa-globe" aria-hidden="true"></i> Map</span></a></li>
|
</nav>
|
||||||
<li class="nav-item py-0"><a [routerLinkActive]="['active']" [routerLink]="['/explorer']" class="nav-link"><span><i class="fa fa-folder" aria-hidden="true"></i> Explorer</span></a></li>
|
<div class="body">
|
||||||
</ul>
|
<router-outlet></router-outlet>
|
||||||
<router-outlet name="menu"></router-outlet>
|
</div>
|
||||||
</nav>
|
<fm-menu-background [visible]="menuVisible|async"></fm-menu-background>
|
||||||
<div class="body">
|
<fm-side-panel [visible]="menuVisible|async" [left]="true" class="menu" (click)="handleStopBubble($event)">
|
||||||
<router-outlet></router-outlet>
|
<div class="container-fluid">
|
||||||
</div>
|
<div class="body">
|
||||||
<fm-resumable-file-upload></fm-resumable-file-upload>
|
<div class="d-flex flex-row">
|
||||||
</div>
|
<div class="mt-2 mb-2 flex-grow-1 logo"><router-outlet name="side-panel-logo"></router-outlet></div>
|
||||||
|
<div class="mt-2 mb-2 ml-2"><button type="button" class="btn btn-outline-secondary" (click)="handleToggleMenu($event)"><i class="fa fa-times" aria-hidden="true"></i></button></div>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex flex-column cards">
|
||||||
|
<router-outlet name="side-panel-menu"></router-outlet>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</fm-side-panel>
|
||||||
|
<ng-container *ngIf="showUploadProgress">
|
||||||
|
<fm-resumable-file-upload></fm-resumable-file-upload>
|
||||||
|
</ng-container>
|
||||||
|
</div>
|
||||||
|
@@ -1,72 +1,78 @@
|
|||||||
//@import "theme.scss";
|
/* Import Bootstrap & Fonts */
|
||||||
|
|
||||||
/* Import Bootstrap & Fonts */
|
@import "~bootstrap/scss/bootstrap.scss";
|
||||||
|
|
||||||
@import "~bootstrap/scss/bootstrap.scss";
|
|
||||||
|
// custom styles
|
||||||
|
|
||||||
// custom styles
|
.btn:focus {
|
||||||
|
box-shadow:none;
|
||||||
.btn:focus {
|
}
|
||||||
box-shadow:none;
|
|
||||||
}
|
.input-group > .form-control:focus {
|
||||||
|
z-index: auto;
|
||||||
.input-group > .form-control:focus {
|
}
|
||||||
z-index: auto;
|
|
||||||
}
|
.form-control:focus {
|
||||||
|
box-shadow: none;
|
||||||
.form-control:focus {
|
border-color: $input-border-color;
|
||||||
box-shadow: none;
|
}
|
||||||
border-color: $input-border-color;
|
|
||||||
}
|
|
||||||
|
/* *** Overall APP Styling can go here ***
|
||||||
|
--------------------------------------------
|
||||||
/* *** Overall APP Styling can go here ***
|
Note: This Component has ViewEncapsulation.None so the styles will bleed out
|
||||||
--------------------------------------------
|
|
||||||
Note: This Component has ViewEncapsulation.None so the styles will bleed out
|
*/
|
||||||
|
|
||||||
*/
|
body { background: #f1f1f1; line-height: 18px; user-select:none;}
|
||||||
|
|
||||||
body { background: #f1f1f1; line-height: 18px; user-select:none;}
|
.navbar-brand {
|
||||||
|
padding-top: .5rem;
|
||||||
.navbar-brand {
|
padding-bottom: .5rem;
|
||||||
padding-top: .5rem;
|
}
|
||||||
padding-bottom: .5rem;
|
|
||||||
}
|
.app {
|
||||||
|
width:100vw;
|
||||||
.app {
|
height:100vh;
|
||||||
width:100vw;
|
}
|
||||||
height:100vh;
|
|
||||||
}
|
.app > .navbar {
|
||||||
|
position: absolute;
|
||||||
.app > .navbar {
|
transition: top 0.5s ease-out;
|
||||||
position: absolute;
|
top:0;
|
||||||
transition: top 0.5s ease-out;
|
left: 0;
|
||||||
top:0;
|
right: 0;
|
||||||
left: 0;
|
height: 3.1rem;
|
||||||
right: 0;
|
}
|
||||||
height: 3.1rem;
|
|
||||||
}
|
.app > .body {
|
||||||
|
position: absolute;
|
||||||
.app > .body {
|
transition: top 0.5s ease-out;
|
||||||
position: absolute;
|
top: 3.1rem;
|
||||||
transition: top 0.5s ease-out;
|
bottom: 0;
|
||||||
top: 3.1rem;
|
left: 0;
|
||||||
bottom: 0;
|
right: 0;
|
||||||
left: 0;
|
overflow:hidden;
|
||||||
right: 0;
|
}
|
||||||
overflow:hidden;
|
|
||||||
}
|
.app.fullscreen > .navbar {
|
||||||
|
top: -3.1rem;
|
||||||
.app.fullscreen > .navbar {
|
}
|
||||||
top: -3.1rem;
|
|
||||||
}
|
.app.fullscreen > .body {
|
||||||
|
top:0;
|
||||||
.app.fullscreen > .body {
|
}
|
||||||
top:0;
|
|
||||||
}
|
.btn-primary, .btn-primary:hover {
|
||||||
|
color: #ffffff;
|
||||||
.btn-primary, .btn-primary:hover {
|
}
|
||||||
color: #ffffff;
|
|
||||||
}
|
.menu .side-panel {
|
||||||
|
z-index: 100;
|
||||||
|
background-color: rgb(245,245,245);
|
||||||
|
}
|
||||||
|
|
||||||
|
.logo {
|
||||||
|
margin-left: 1rem;
|
||||||
|
}
|
||||||
|
@@ -1,129 +1,145 @@
|
|||||||
import { Component, OnInit, OnDestroy, Inject, ViewEncapsulation, RendererFactory2, PLATFORM_ID, ChangeDetectionStrategy, HostListener } from '@angular/core';
|
import { Component, OnInit, OnDestroy, Inject, ViewEncapsulation, RendererFactory2, PLATFORM_ID, ChangeDetectionStrategy, HostListener, Input } from '@angular/core';
|
||||||
import { Router, NavigationEnd, RouteConfigLoadStart, RouteConfigLoadEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router';
|
import { Router, NavigationStart, NavigationEnd, RouteConfigLoadStart, RouteConfigLoadEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router';
|
||||||
import { Meta, Title, DOCUMENT, MetaDefinition } from '@angular/platform-browser';
|
import { Meta, Title, MetaDefinition } from '@angular/platform-browser';import { DOCUMENT } from "@angular/common";
|
||||||
import { Subscription , Observable } from 'rxjs';
|
import { Subscription , Observable } from 'rxjs';
|
||||||
import { Store, Action } from '@ngrx/store';
|
import { Store, Action } from '@ngrx/store';
|
||||||
|
|
||||||
//AppCommon
|
//AppCommon
|
||||||
import { IEventMessage } from '../../models/event.message';
|
import { IEventMessage } from '../../models/event.message';
|
||||||
import { IListItem} from '../../models/list.item';
|
import { IListItem} from '../../models/list.item';
|
||||||
import { EventService } from '../../services/event.service';
|
import { EventService } from '../../services/event.service';
|
||||||
import * as commonActions from '../../actions/app-common.actions';
|
import * as commonActions from '../../actions/app-common.actions';
|
||||||
|
|
||||||
import * as appReducers from '../../reducers/app-common.reducer';
|
import * as appReducers from '../../reducers/app-common.reducer';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-app',
|
selector: 'fm-app',
|
||||||
templateUrl: './app.component.html',
|
templateUrl: './app.component.html',
|
||||||
styleUrls: ['./app.component.scss'],
|
styleUrls: ['./app.component.scss'],
|
||||||
encapsulation: ViewEncapsulation.None,
|
encapsulation: ViewEncapsulation.None,
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush
|
changeDetection: ChangeDetectionStrategy.OnPush
|
||||||
})
|
})
|
||||||
export class AppComponent implements OnInit, OnDestroy {
|
export class AppComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
// This will go at the END of your title for example "Home - Angular Universal..." <-- after the dash (-)
|
// This will go at the END of your title for example "Home - Angular Universal..." <-- after the dash (-)
|
||||||
private endPageTitle: string = 'Farmmaps';
|
private endPageTitle: string = 'Farmmaps';
|
||||||
// If no Title is provided, we'll use a default one before the dash(-)
|
// If no Title is provided, we'll use a default one before the dash(-)
|
||||||
private defaultPageTitle: string = 'Farmmaps';
|
private defaultPageTitle: string = 'Farmmaps';
|
||||||
|
|
||||||
private routerSub$: Subscription;
|
private routerSub$: Subscription;
|
||||||
private eventSub$: Subscription;
|
private eventSub$: Subscription;
|
||||||
|
|
||||||
public currentFolder: Observable<IListItem>;
|
public currentFolder: Observable<IListItem>;
|
||||||
public folderParents: Observable<IListItem[]>;
|
public folderParents: Observable<IListItem[]>;
|
||||||
public browseFileElement: any;
|
public fullScreen: Observable<boolean>;
|
||||||
public browseDirectoryElement: any;
|
public routeLoading: Observable<boolean>;
|
||||||
public fileDroptarget: any;
|
public menuVisible: Observable<boolean>;
|
||||||
public fullScreen: Observable<boolean>;
|
@Input() showUploadProgress: boolean =true;
|
||||||
public routeLoading: Observable<boolean>;
|
|
||||||
|
constructor(
|
||||||
constructor(
|
private router: Router,
|
||||||
private router: Router,
|
private activatedRoute: ActivatedRoute,
|
||||||
private activatedRoute: ActivatedRoute,
|
private title: Title,
|
||||||
private title: Title,
|
private meta: Meta,
|
||||||
private meta: Meta,
|
private store: Store<appReducers.State>,
|
||||||
private store: Store<appReducers.State>,
|
private eventService: EventService,
|
||||||
private eventService: EventService,
|
) {
|
||||||
) {
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
getActionFromEvent(event: IEventMessage): Action {
|
||||||
getActionFromEvent(event: IEventMessage): Action {
|
var action: Action = null;
|
||||||
var action: Action = null;
|
console.debug(`${event.eventType} Event received`);
|
||||||
console.debug(`${event.eventType} Event received`);
|
switch (event.eventType) {
|
||||||
switch (event.eventType) {
|
case "ItemChanged": {
|
||||||
case "ItemChanged": {
|
action = new commonActions.ItemChangedEvent(event.itemCode, event.attributes);
|
||||||
action = new commonActions.ItemChangedEvent(event.itemCode, event.attributes);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
case "ItemAdded": {
|
||||||
case "ItemAdded": {
|
action = new commonActions.ItemAddedEvent(event.itemCode, event.attributes);
|
||||||
action = new commonActions.ItemAddedEvent(event.itemCode, event.attributes);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
case "ItemDeleted": {
|
||||||
case "ItemDeleted": {
|
action = new commonActions.ItemDeletedEvent(event.itemCode, event.attributes);
|
||||||
action = new commonActions.ItemDeletedEvent(event.itemCode, event.attributes);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
case "taskStart": {
|
||||||
case "taskStart": {
|
action = new commonActions.TaskStartEvent(event.itemCode, event.attributes);
|
||||||
action = new commonActions.TaskStartEvent(event.itemCode, event.attributes);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
case "taskEnd": {
|
||||||
case "taskEnd": {
|
action = new commonActions.TaskEndEvent(event.itemCode, event.attributes);
|
||||||
action = new commonActions.TaskEndEvent(event.itemCode, event.attributes);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
case "taskError": {
|
||||||
case "taskError": {
|
action = new commonActions.TaskErrorEvent(event.itemCode, event.attributes);
|
||||||
action = new commonActions.TaskErrorEvent(event.itemCode, event.attributes);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
case "deviceUpdate": {
|
||||||
}
|
action = new commonActions.DeviceUpdateEvent(event.itemCode, event.attributes);
|
||||||
return action;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ngOnInit() {
|
return action;
|
||||||
this.fullScreen = this.store.select(appReducers.selectGetFullScreen);
|
}
|
||||||
this.routeLoading = this.store.select(appReducers.selectGetRouteLoading);
|
|
||||||
this.InstallRouteEventHandler();
|
ngOnInit() {
|
||||||
this.InstallEventServiceEventHandler();
|
this.fullScreen = this.store.select(appReducers.selectGetFullScreen);
|
||||||
}
|
this.routeLoading = this.store.select(appReducers.selectGetRouteLoading);
|
||||||
|
this.menuVisible = this.store.select(appReducers.SelectGetMenuVisible);
|
||||||
@HostListener('document:keyup', ['$event'])
|
this.InstallRouteEventHandler();
|
||||||
keyUp(event: KeyboardEvent) {
|
this.InstallEventServiceEventHandler();
|
||||||
let x = event.keyCode;
|
}
|
||||||
if (x === 27) {
|
|
||||||
this.store.dispatch(new commonActions.Escape(true,false));
|
@HostListener('document:keyup', ['$event'])
|
||||||
}
|
keyUp(event: KeyboardEvent) {
|
||||||
}
|
let x = event.keyCode;
|
||||||
|
if (x === 27) {
|
||||||
ngOnDestroy() {
|
this.store.dispatch(new commonActions.Escape(true,false));
|
||||||
// Subscription clean-up
|
}
|
||||||
if(this.routerSub$) this.routerSub$.unsubscribe();
|
}
|
||||||
if(this.eventSub$) this.eventSub$.unsubscribe();
|
|
||||||
}
|
ngOnDestroy() {
|
||||||
|
// Subscription clean-up
|
||||||
private InstallRouteEventHandler() {
|
if(this.routerSub$) this.routerSub$.unsubscribe();
|
||||||
var other = this;
|
if(this.eventSub$) this.eventSub$.unsubscribe();
|
||||||
this.routerSub$ = this.router.events.subscribe(event => {
|
}
|
||||||
if (event instanceof RouteConfigLoadStart) {
|
|
||||||
other.store.dispatch(new commonActions.StartRouteLoading());
|
private InstallRouteEventHandler() {
|
||||||
}
|
var other = this;
|
||||||
if (event instanceof RouteConfigLoadEnd) {
|
this.routerSub$ = this.router.events.subscribe(event => {
|
||||||
other.store.dispatch(new commonActions.EndRouteLoading());
|
if (event instanceof RouteConfigLoadStart) {
|
||||||
}
|
other.store.dispatch(new commonActions.StartRouteLoading());
|
||||||
});
|
}
|
||||||
}
|
if (event instanceof RouteConfigLoadEnd) {
|
||||||
|
other.store.dispatch(new commonActions.EndRouteLoading());
|
||||||
private InstallEventServiceEventHandler() {
|
}
|
||||||
var other = this;
|
if(event instanceof NavigationStart) {
|
||||||
this.eventSub$ = this.eventService.event.subscribe(event => {
|
other.store.dispatch(new commonActions.SetMenuVisible(false));
|
||||||
var action = other.getActionFromEvent(event);
|
}
|
||||||
if (action) other.store.dispatch(action);
|
});
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
private InstallEventServiceEventHandler() {
|
||||||
handleClick(event: MouseEvent) {
|
var other = this;
|
||||||
this.store.dispatch(new commonActions.Escape(false,true));
|
this.eventSub$ = this.eventService.event.subscribe(event => {
|
||||||
}
|
var action = other.getActionFromEvent(event);
|
||||||
}
|
if (action) other.store.dispatch(action);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleClick(event: MouseEvent) {
|
||||||
|
this.store.dispatch(new commonActions.Escape(false,true));
|
||||||
|
}
|
||||||
|
|
||||||
|
handleStopBubble(event: MouseEvent) {
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
handleToggleMenu(event:MouseEvent) {
|
||||||
|
event.stopPropagation();
|
||||||
|
this.store.dispatch(new commonActions.ToggleMenu());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user