145 Commits

Author SHA1 Message Date
Willem Dantuma
b5d00f5619 Merge branch 'develop'
All checks were successful
FarmMaps/FarmMapsLib/pipeline/head This commit looks good
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-08-25 08:19:12 +02:00
Willem Dantuma
89a0fb13a5 AW-2757
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-08-19 15:25:22 +02:00
Willem Dantuma
2861ba220e Revert "Help menu invisible in release sep 2021."
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This reverts commit a454f2306d.
2021-08-18 14:37:41 +02:00
Willem Dantuma
45e0d5e836 Revert "Hide help menu"
This reverts commit 4c1d4137ea.
2021-08-18 14:37:31 +02:00
Willem Dantuma
312611cdc1 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop 2021-08-18 14:34:53 +02:00
Willem Dantuma
54b8a3bf24 AW-1855 2021-08-18 14:34:45 +02:00
4c1d4137ea Hide help menu
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-08-18 14:31:28 +02:00
a454f2306d Help menu invisible in release sep 2021.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-08-18 14:21:02 +02:00
Willem Dantuma
52a72b042c Fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-08-17 19:41:20 +02:00
Willem Dantuma
c0c9864b07 AW-2714
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2021-08-17 19:36:30 +02:00
Willem Dantuma
e0f36b043f Oops
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-08-12 21:40:40 +02:00
Willem Dantuma
b52bfd4f57 Fix icon
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-08-12 21:02:55 +02:00
Willem Dantuma
6ff3c0ec96 Fix device geometry update
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-08-12 17:13:40 +02:00
Willem Dantuma
eb1157d608 Fix thumbnail editing, add blobtodataurl method
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-08-05 16:33:31 +02:00
Willem Dantuma
1daa8e257f make Observable
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-08-04 16:12:22 +02:00
Willem Dantuma
5db24cc63d Add geolocator service
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-08-04 16:01:41 +02:00
ff018d9db1 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-08-04 12:05:09 +02:00
8c49965df8 Fix optional has package check/ 2021-08-04 12:05:02 +02:00
Willem Dantuma
f880623337 Fix AW-2620
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-07-30 14:06:31 +02:00
Willem Dantuma
2da4f88683 Fix AW-2617
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-07-29 16:36:18 +02:00
Willem Dantuma
bd125b6f72 Fix check
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-07-29 13:24:59 +02:00
Willem Dantuma
610408d17c Add optional replace parameter
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-07-29 12:52:26 +02:00
Willem Dantuma
52e3117771 Implement ItemDeleteEvent handling
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-07-29 08:21:25 +02:00
Willem Dantuma
1b000c6112 Fix initialization error
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-07-28 17:12:54 +02:00
Willem Dantuma
28e75d5a0d Replace @Effect() with createEffect
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-07-27 16:26:57 +02:00
Willem Dantuma
76c431b9c2 Use latest snapshot
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-07-27 09:31:14 +02:00
Willem Dantuma
122c49d516 Move the check here
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-07-27 09:16:58 +02:00
Willem Dantuma
5c549c5851 Use route parameters here also
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-07-27 08:51:56 +02:00
Willem Dantuma
3fcf80c1a0 Add override route parameters
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-07-26 21:53:55 +02:00
Willem Dantuma
519e5c9032 Make zoom-to padding configurable per route
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-07-21 11:17:15 +02:00
9c19595597 Revert "Patch lib"
Some checks failed
FarmMaps/FarmMapsLib/pipeline/head There was a failure building this commit
This reverts commit ea1b22ed41.
2021-06-23 13:52:52 +02:00
ea1b22ed41 Patch lib
All checks were successful
FarmMaps/FarmMapsLib/pipeline/head This commit looks good
2021-06-23 13:18:46 +02:00
8d3c098f4e Upgraded custom-webpack and typescript.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-06-16 09:15:53 +02:00
22209cfaf6 Update bootstrap to angular 11 compatible version
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-06-11 10:54:23 +02:00
8b45e431a7 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-06-11 10:43:50 +02:00
74c792b96a Update references 2021-06-11 10:43:38 +02:00
d833f321d1 aw-1837 add language to user
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-06-11 08:40:13 +02:00
0d9789d8c6 Version
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-06-09 14:04:48 +02:00
93513f9dc7 AW-2316 Angular upgrade 11 2021-06-09 14:00:21 +02:00
Willem Dantuma
e465142be0 Increase minor
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-06-03 10:03:59 +02:00
Willem Dantuma
92173c9847 Increase patch level
All checks were successful
FarmMaps/FarmMapsLib/pipeline/head This commit looks good
2021-06-03 10:02:41 +02:00
Willem Dantuma
05292f1e5d Depend on released versions
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
FarmMaps/FarmMapsLib/pipeline/head There was a failure building this commit
2021-06-03 09:53:41 +02:00
Willem Dantuma
e672e28795 Allow same version in master
All checks were successful
FarmMaps/FarmMapsLib/pipeline/head This commit looks good
2021-06-03 09:47:17 +02:00
Willem Dantuma
4b7b639046 Remobve build number from version
Some checks failed
FarmMaps/FarmMapsLib/pipeline/head There was a failure building this commit
2021-06-03 09:42:59 +02:00
Willem Dantuma
34b067fd28 Add jenkins file for master
Some checks failed
FarmMaps/FarmMapsLib/pipeline/head There was a failure building this commit
2021-06-03 09:37:13 +02:00
Willem Dantuma
fb9a046ff8 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-06-03 09:34:11 +02:00
Willem Dantuma
c4934d799d release 1.0.0 2021-06-03 09:34:03 +02:00
469bc6f1c1 AW-2390
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-06-02 16:39:33 +02:00
d140d4bd4c AW-2390
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-05-27 19:44:29 +02:00
1ce259a152 Add %
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-05-26 16:34:04 +02:00
00ae86ecf2 AW-2388
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-05-26 16:11:21 +02:00
880eb26a99 getPercentage
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-05-26 14:59:03 +02:00
bcfa13de60 AW-2388 Fixed mixed decimal in histogram 2021-05-26 14:58:03 +02:00
Willem Dantuma
6f77df0f61 Fix AW-2361
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-05-25 22:12:32 +02:00
fbe0413c6a Merge branch 'feature/AW-2268' into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-05-18 13:05:16 +02:00
115f53e93c AW-2268 fix .fullscreen .control-container 2021-05-18 09:49:50 +02:00
ca40ca0927 renamed package guard and added it to public api 2021-05-17 14:23:44 +02:00
29968a736c Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-05-06 14:05:49 +02:00
077afcb0d7 Fix validToday 2021-05-06 14:05:43 +02:00
Willem Dantuma
6e79afd115 Logout on deleteuser event
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-05-05 18:56:53 +02:00
4f9cdf1588 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-05-04 16:23:00 +02:00
fa69dee550 Fix expected selector /deep/ 2021-05-04 16:22:46 +02:00
Willem Dantuma
06e353ee94 Reverse /deep/
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-05-04 16:21:57 +02:00
8d723477d3 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2021-05-04 11:28:49 +02:00
771e388f0e AW-2081 Align avatar 2021-05-04 11:28:43 +02:00
Willem Dantuma
040b5b8c4d Cancel only not allready uploaded files
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-05-03 19:00:20 +02:00
3504990708 Add ability to retrieve only items that are valid today.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-04-30 10:36:58 +02:00
798ec8d1ca Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-04-29 14:06:41 +02:00
8f5dd0969c casing 2021-04-29 14:06:35 +02:00
Willem Dantuma
861a8a48fc Add dataFilter to children/count
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-04-29 13:49:38 +02:00
86a545d7e6 Add IUser.newsLetter
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-04-29 10:29:31 +02:00
Willem Dantuma
8a1c4b5e20 Only show prent namewhen of type ..cropfield
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-04-26 08:01:43 +02:00
b24e47e39b AW-2214 Fix refactored itemtype.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-04-23 10:54:52 +02:00
c0d8e6d615 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-04-23 10:50:50 +02:00
7192f66420 AW-2211 Update *fmHasPackage directive 2021-04-23 10:50:45 +02:00
Willem Dantuma
dcc24aa149 Fix setExtent
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-04-19 08:43:20 +02:00
Willem Dantuma
0485c163ad Fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-04-12 15:55:38 +02:00
Willem Dantuma
1380d7169a Fix trigger
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2021-04-12 15:52:42 +02:00
Willem Dantuma
a6d3b208b0 Hide buttons when no routing to sink
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-04-12 15:10:29 +02:00
Willem Dantuma
cbf805e1ff Fix novalue
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-20 20:29:27 +01:00
Willem Dantuma
8907dca091 Set color default to no value color
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-20 20:07:31 +01:00
Willem Dantuma
fe1fddd211 Update layer
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-20 18:35:22 +01:00
Willem Dantuma
fa146f2c6e Refactor fmMapIfZoomToShow
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-20 18:26:01 +01:00
Willem Dantuma
c9fac05aa6 Refactor to fm-map-feature-thumbnail
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-20 12:00:04 +01:00
Willem Dantuma
75d8909997 Fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-20 11:29:08 +01:00
Willem Dantuma
36d9c98e47 Clear view
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2021-03-20 11:25:23 +01:00
Willem Dantuma
e2255164fc Run npm audit fix 2021-03-20 11:09:26 +01:00
Willem Dantuma
4c5b77000f Update libs 2021-03-20 11:08:54 +01:00
Willem Dantuma
997ebb24a7 Implement then else for haspackage
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-20 11:06:04 +01:00
00346a963e Pfff
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-17 19:33:54 +01:00
a42059627a Added level to get features call
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2021-03-16 21:30:20 +01:00
Willem Dantuma
5b710ce200 Refactor getcolor
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-15 16:26:05 +01:00
Willem Dantuma
f8a0e1e167 Add SetUnreadNotifications action
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-08 08:45:13 +01:00
Willem Dantuma
eb46b3496a Fix type check
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-06 14:29:01 +01:00
Willem Dantuma
e8bbb74185 Fix temporal and initial loading
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-06 14:06:31 +01:00
Willem Dantuma
3d8ce7ee74 Fix null check
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-05 19:03:50 +01:00
Willem Dantuma
aa308abbb0 Fix request canceling
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-05 18:41:09 +01:00
Willem Dantuma
9d5cd0fa88 Add layer values
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-05 17:19:30 +01:00
Willem Dantuma
5760c2b8ea oops
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-05 12:40:52 +01:00
Willem Dantuma
1e6c9e9363 Fix build
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2021-03-05 12:39:41 +01:00
Willem Dantuma
8f06a56e52 Add ngx-clipboard
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2021-03-05 12:37:10 +01:00
Willem Dantuma
2f74f43c8e Add getLayerValue
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-05 11:10:39 +01:00
Willem Dantuma
c093ffae50 run npm audit fix 2021-03-05 07:52:05 +01:00
Willem Dantuma
c7da0866ef Fix mime type
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-02 17:21:54 +01:00
Willem Dantuma
b000d5119a Return correct file
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-02 16:51:16 +01:00
2dd10f04a3 Return selected file as well
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-02 15:36:01 +01:00
4d62184e5b Revert "Return modal reference for client side handling."
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This reverts commit 8ad9d56b07.
2021-03-02 15:13:42 +01:00
8ad9d56b07 Return modal reference for client side handling.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-02 14:48:49 +01:00
Willem Dantuma
2b1cb1ac8f Add save image parameter
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-02 13:15:16 +01:00
Willem Dantuma
08163f86bf Add more open options
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-02 12:20:53 +01:00
Willem Dantuma
33adb35923 Export image editor
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-02 09:35:39 +01:00
Willem Dantuma
855bd8fe2d Re add thumbnail component
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-02 08:16:16 +01:00
Willem Dantuma
fad257c6e2 Fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-02 08:13:07 +01:00
Willem Dantuma
e262f7c65d Merge branch 'feature/thumbnail_upload' into develop
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2021-03-02 08:10:10 +01:00
Willem Dantuma
cabdeaa875 Reload image on change 2021-03-02 08:09:42 +01:00
Willem Dantuma
2f1c5210ea Save image 2021-03-01 22:03:18 +01:00
Willem Dantuma
47f3238edd Add no-image placeholder 2021-03-01 17:25:40 +01:00
Willem Dantuma
01488ae2e0 Remove background color 2021-03-01 17:01:57 +01:00
Willem Dantuma
ae02dd0b53 Merge branch 'develop' into feature/thumbnail_upload 2021-03-01 16:57:15 +01:00
Willem Dantuma
7768387f58 Basic edit-image-modal 2021-03-01 16:56:48 +01:00
3c0f220ee3 Span required instead of div
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-01 12:49:12 +01:00
38e64a0713 Fix
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-03-01 12:38:16 +01:00
0bb5406773 AW-1881
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2021-03-01 12:32:14 +01:00
7c125f1771 AW-1881
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-27 14:47:16 +01:00
3673e0b349 Fixes
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-27 10:27:49 +01:00
ece6096064 AW-1881 Avatar
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-27 10:16:07 +01:00
Willem Dantuma
dd71b49502 Merge branch 'develop' into feature/thumbnail_upload
# Conflicts:
#	package-lock.json
#	projects/common/src/fm/common.module.ts
2021-02-25 20:18:59 +01:00
Willem Dantuma
a098f72b1a Start of thumbnail upload dialog 2021-02-25 19:57:09 +01:00
535f6bd064 Add ngx avatar
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-25 17:32:58 +01:00
74e7f41583 Added avatar
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2021-02-25 17:17:52 +01:00
b537239c96 AW-1881 Avatar based on first letters of firstname and lastname
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-18 16:09:25 +01:00
f9ba4fd5e2 Revert "Update version"
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This reverts commit 8326255ce9.
2021-02-17 12:30:54 +01:00
8326255ce9 Update version
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-17 12:27:13 +01:00
3d60d0127b AW-1959 Fix?
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-16 17:23:15 +01:00
697708710e Fix help-menu.component.ts
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-16 17:07:40 +01:00
102d96ded9 AW-1959 Add global help-menu
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-16 16:49:23 +01:00
Willem Dantuma
f802f41bbb Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-15 11:34:27 +01:00
Willem Dantuma
d134240b8b Add fm-thumbnail component 2021-02-15 11:34:21 +01:00
3242058c4f refactor user api
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-15 11:03:24 +01:00
3f6863845b renamed package guard and added it to public api
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-11 17:43:19 +01:00
Willem Dantuma
231fbf9ee8 Add test
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-11 11:49:28 +01:00
Willem Dantuma
142a1c9e58 Add notification menu
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-11 11:44:34 +01:00
39993e75da added a package guard
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-05 12:51:43 +01:00
Willem Dantuma
b7b168dffb Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2021-02-03 17:28:42 +01:00
Willem Dantuma
fb9c11fce6 Some fixes update libs 2021-02-03 17:28:35 +01:00
104 changed files with 7137 additions and 4607 deletions

54
Jenkinsfile vendored Normal file
View File

@@ -0,0 +1,54 @@
pipeline {
agent any
environment {
PACKAGE_VERSION_PREFIX=sh(script: 'jq .version package.json |sed "s/\\"//g"', returnStdout: true).trim()
PACKAGE_VERSION="${PACKAGE_VERSION_PREFIX}"
}
stages {
stage('npm install'){
steps {
sh '''rm -rf node_modules/
npm install
cd projects/common
npm install
cd ../common-map
npm install
cd ../common-map3d
npm install
'''
}
}
stage('build'){
steps {
sh '''ng build common
ng build common-map
ng build common-map3d'''
}
}
stage('npm publish'){
steps {
sh '''cd dist/common
npm version ${PACKAGE_VERSION} --allow-same-version
npm publish
cd ../common-map
npm version ${PACKAGE_VERSION} --allow-same-version
npm publish
cd ../common-map3d
npm version ${PACKAGE_VERSION} --allow-same-version
npm publish'''
}
}
}
post {
always {
emailext (
body: '${DEFAULT_CONTENT}',
mimeType: 'text/html',
replyTo: '${DEFAULT_REPLYTO}',
subject: '${DEFAULT_SUBJECT}',
to: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])
)
}
}
}

View File

@@ -169,7 +169,7 @@
"prefix": "fm",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "projects/common/tsconfig.lib.json",
"project": "projects/common/ng-package.json"
@@ -209,7 +209,7 @@
"prefix": "fm-map",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"tsConfig": "projects/common-map/tsconfig.lib.json",
"project": "projects/common-map/ng-package.json"

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -47,6 +47,12 @@
content: "h";
}
.fm-blight-holes:before {
content: "i";
}
hallo
@font-face {
font-family: "FarmMaps";
src: url("./FMIconFont.woff") format("woff"), /* Modern Browsers */

9041
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "farmmaps-lib-app",
"version": "0.0.1",
"version": "1.1.1",
"scripts": {
"ng": "ng",
"start": "ng serve",
@@ -11,61 +11,62 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~10.2.4",
"@angular/common": "~10.2.4",
"@angular/compiler": "~10.2.4",
"@angular/core": "~10.2.4",
"@angular/forms": "~10.2.4",
"@angular/platform-browser": "~10.2.4",
"@angular/platform-browser-dynamic": "~10.2.4",
"@angular/router": "~10.2.4",
"@farmmaps/common": ">=0.0.1-prerelease.517 <0.0.1",
"@farmmaps/common-map": ">=0.0.1-prerelease.517 <0.0.1",
"@farmmaps/common-map3d": ">=0.0.1-prerelease.517 <0.0.1",
"@microsoft/signalr": "^3.1.3",
"@ng-bootstrap/ng-bootstrap": "^7.0",
"@ngrx/effects": "^10.0",
"@ngrx/router-store": "^10.0",
"@ngrx/store": "^10.0",
"@angular/animations": "~11.2.14",
"@angular/common": "~11.2.14",
"@angular/compiler": "~11.2.14",
"@angular/core": "~11.2.14",
"@angular/forms": "~11.2.14",
"@angular/platform-browser": "~11.2.14",
"@angular/platform-browser-dynamic": "~11.2.14",
"@angular/router": "~11.2.14",
"@farmmaps/common": "1.1.1-prerelease.2031",
"@farmmaps/common-map": "1.1.1-prerelease.2031",
"@farmmaps/common-map3d": "1.1.1-prerelease.2031",
"@microsoft/signalr": "^3.1.16",
"@ng-bootstrap/ng-bootstrap": "^9.0",
"@ngrx/effects": "^11.0",
"@ngrx/router-store": "^11.0",
"@ngrx/store": "^11.0",
"angular-oauth2-oidc": "^10.0.3",
"bootstrap": "^4.4.1",
"cesium": "^1.77.0",
"core-js": "^2.6.11",
"ngrx-store-localstorage": "^10.0",
"ngx-bootstrap": "^5.6.1",
"bootstrap": "^4.6.0",
"cesium": "^1.82.1",
"core-js": "^2.6.12",
"moment": "^2.29.1",
"ngrx-store-localstorage": "^11.0.0",
"ngx-avatar": "^4.1.0",
"ngx-clipboard": "^14.0.1",
"ngx-image-cropper": "^3.3.5",
"ngx-openlayers": "1.0.0-next.17",
"ngx-uploadx": "^3.5.1",
"ol": "6.5.0",
"ol-cesium": "^2.12.0",
"ol-cesium": "^2.13.0",
"resumablejs": "^1.1.0",
"rxjs": "^6.5.4",
"rxjs": "^6.6.7",
"tassign": "^1.0.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2",
"moment": "^2.27.0"
"tslib": "^2.2.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-builders/custom-webpack": "~10.0.1",
"@angular-devkit/build-angular": "^0.1002.1",
"@angular-devkit/build-ng-packagr": "~0.1002.1",
"@angular/cli": "^10.2.1",
"@angular/compiler-cli": "~10.2.4",
"@angular/language-service": "~10.2.4",
"@angular-builders/custom-webpack": "^11.1.1",
"@angular-devkit/build-angular": "^0.1102.14",
"@angular/cli": "^11.2.14",
"@angular/compiler-cli": "~11.2.14",
"@angular/language-service": "~11.2.14",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"@types/jasminewd2": "^2.0.9",
"@types/node": "^12.20.15",
"codelyzer": "^5.1.2",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma": "~6.3.3",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"ng-packagr": "^10.1.0",
"karma-jasmine-html-reporter": "^1.6.0",
"ng-packagr": "^11.2.4",
"protractor": "~7.0.0",
"ts-node": "^8.8.1",
"tslint": "~6.1.0",
"typescript": "~4.0.3"
"typescript": "~4.1.0"
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@farmmaps/common-map",
"version": "0.0.1",
"version": "1.0.0",
"publishConfig": {
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
},
@@ -14,7 +14,7 @@
"@ngrx/router-store": "^10.0",
"@ngrx/store": "^10.0",
"tassign": "^1.0.0",
"@farmmaps/common": ">=0.0.1-prerelease.508 <0.0.1",
"@farmmaps/common": "~1.0",
"ngx-openlayers": "1.0.0-next.17",
"ol": "6.4.3"
}

View File

@@ -2,15 +2,18 @@ import { Action } from '@ngrx/store';
import { IMapState } from '../models/map.state';
import { IItemLayer } from '../models/item.layer';
import { ILayervalue } from '../models/layer.value';
import { IQueryState } from '@farmmaps/common';
import { IItem } from '@farmmaps/common';
import { Feature,Style } from 'ol';
import { IPeriodState } from '../models/period.state';
export const SETSTATE = '[Map] SetState';
export const SETMAPSTATE = '[Map] MapState';
export const SETVIEWEXTENT = '[Map] SetViewExtent';
export const INIT = '[Map] Init';
export const SETPARENT = '[Map] SetParent';
export const SETPERIOD = '[Map] SetPeriod';
export const STARTSEARCH = '[Map] StartSearch';
export const STARTSEARCHSUCCESS = '[Map] StartSearchSuccess';
export const SELECTFEATURE = '[Map] SelectFeature';
@@ -45,6 +48,10 @@ export const SHOWLAYERSWITCHER = '[Map] ShowLayerSwitcher';
export const CLEAR = '[Map] Clear';
export const SETREPLACEURL = '[Map] SetReplaceUrl';
export const SETFEATURES = '[Map] SetFeatures'
export const SETLAYERVALUESLOCATION = '[Map] SetLayerValuesLocation'
export const TOGGLELAYERVALUESENABLED = '[Map] ToggleLayerValuesEnabled'
export const GETLAYERVALUE = '[Map] GetLayerValue'
export const GETLAYERVALUESUCCESS = '[Map] GetLayerValueSuccess'
export class Clear implements Action {
readonly type = CLEAR;
@@ -81,6 +88,12 @@ export class SetParent implements Action {
constructor(public parentCode:string) { }
}
export class SetPeriod implements Action {
readonly type = SETPERIOD;
constructor(public period:IPeriodState) { }
}
export class StartSearch implements Action {
readonly type = STARTSEARCH;
@@ -252,7 +265,7 @@ export class ZoomToExtent implements Action {
export class DoQuery implements Action {
readonly type = DOQUERY;
constructor(public query:IQueryState) { }
constructor(public query:IQueryState,public replace:boolean = false) { }
}
export class SetStyle implements Action {
@@ -277,6 +290,30 @@ export class SetFeatures implements Action {
constructor(public features: Array<Feature>) { }
}
export class SetLayerValuesLocation implements Action {
readonly type = SETLAYERVALUESLOCATION;
constructor(public x:number, public y:number) { }
}
export class ToggleLayerValuesEnabled implements Action {
readonly type = TOGGLELAYERVALUESENABLED;
constructor() { }
}
export class GetLayerValue implements Action {
readonly type = GETLAYERVALUE;
constructor(public itemLayer:IItemLayer,public x:number,public y:number) { }
}
export class GetLayerValueSuccess implements Action {
readonly type = GETLAYERVALUESUCCESS;
constructor(public layervalue:ILayervalue) { }
}
export type Actions = SetMapState
| Init
| Clear
@@ -315,5 +352,10 @@ export type Actions = SetMapState
| ShowLayerSwitcher
| SetReplaceUrl
| SetFeatures
| SetSelectedItemLayer;
| SetSelectedItemLayer
| SetLayerValuesLocation
| ToggleLayerValuesEnabled
| GetLayerValueSuccess
| GetLayerValue
| SetPeriod;

View File

@@ -70,6 +70,8 @@ import {HistogramDetailsComponent} from './components/legend/histogram-details/h
import {StatisticsDetailsComponent} from './components/legend/statistics-details/statistics-details.component';
import { ifZoomToShowDirective} from './components/if-zoom-to-show/if-zoom-to-show.directive';
import { ZoomToShowAlert} from './components/zoom-to-show-alert/zoom-to-show-alert.component';
import { LayerValuesComponent } from './components/aol/layer-values/layer-values.component';
import { GeometryThumbnailComponent } from './components/feature-thumbnail/feature-thumbnail.component';
export function LocalStorageSync(reducer: ActionReducer<any>): ActionReducer<any> {
const r = function(state, action) {
@@ -80,10 +82,18 @@ export function LocalStorageSync(reducer: ActionReducer<any>): ActionReducer<any
if(ms) {
r2["mapState"] = JSON.parse(ms);
}
let sp = window.localStorage.getItem(MODULE_NAME+"_searchPeriod");
if(sp) {
let p = JSON.parse(sp);
r2["period"] = { startDate: new Date(Date.parse(p.startDate)),endDate:new Date(Date.parse(p.endDate))};
}
}
if(action.type == "[Map] MapState" || action.type == "[Map] SetState") {
window.localStorage.setItem(MODULE_NAME + "_mapState",JSON.stringify(r2["mapState"]));
}
if(action.type == "[Map] SetPeriod" ) {
window.localStorage.setItem(MODULE_NAME + "_searchPeriod",JSON.stringify(r2["period"]));
}
return r2;
};
@@ -207,7 +217,9 @@ export {
HistogramDetailsComponent,
StatisticsDetailsComponent,
ifZoomToShowDirective,
ZoomToShowAlert
ZoomToShowAlert,
LayerValuesComponent,
GeometryThumbnailComponent
],
entryComponents: [
FeatureListComponent,

View File

@@ -6,8 +6,8 @@
<stop offset="100%" class="stop2" />
</linearGradient>
</defs>
<circle class="tolerance hidden" [class]="{'hidden':!showTolerance}" cx="500" cy="500" stroke="none" [attr.r]="locTolerancePixels" />
<path class="heading hidden" [class]="{'hidden': !showHeading }" stroke="none" [attr.d]="path" fill="url(#grad1)" [attr.transform]="rotate"></path>
<circle class="tolerance hidden" [ngClass]="{'hidden':!showTolerance}" cx="500" cy="500" stroke="none" [attr.r]="locTolerancePixels" />
<path class="heading hidden" [ngClass]="{'hidden': !showHeading }" stroke="none" [attr.d]="path" fill="url(#grad1)" [attr.transform]="rotate"></path>
<circle class="border" cx="500" cy="500" r="7" stroke="none" />
<circle class="center" cx="500" cy="500" r="6" stroke="none" />

View File

@@ -13,7 +13,7 @@ export class GpsLocation implements OnInit,OnChanges{
@Input() enable:boolean;
public instance: Overlay;
@Input() position: Position;
@Input() position: GeolocationPosition;
@Input() location: number[]=[0,0];
@Input() locationTolerance: number = 0;
@Input() showHeading: boolean = false;
@@ -61,7 +61,7 @@ export class GpsLocation implements OnInit,OnChanges{
ngOnChanges(changes: SimpleChanges) {
if (changes.position && this.instance) {
var p = changes.position.currentValue as Position;
var p = changes.position.currentValue as GeolocationPosition;
if(p && this.initialized) {
this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude]));
this.locationTolerance = p.coords.accuracy;

View File

@@ -3,7 +3,7 @@ import { LayerGroupComponent, MapComponent } from 'ngx-openlayers';
import { ItemService,IItem,AppConfig } from '@farmmaps/common';
import { IItemLayer, ITemporalItemLayer} from '../../../models/item.layer';
import { ILayerData} from '../../../models/layer.data';
import { IRenderoutputTiles,IRenderoutputImage,IGradientstop,ILayer,IHistogram} from '../../../models/color.map';
import { IRenderoutputTiles,IRenderoutputImage,IGradientstop,ILayer,IHistogram,IColor} from '../../../models/color.map';
import {Extent} from 'ol/extent';
import Projection from 'ol/proj/Projection';
import * as proj from 'ol/proj';
@@ -52,10 +52,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
return "#" + this.componentToHex(r) + this.componentToHex(g) + this.componentToHex(b) + this.componentToHex(a);
}
getColorFromGradient(item:IItem,layer: ILayer, feature): style.Style {
var value = layer.indexKey ? feature.get(layer.indexKey): feature.get(layer.name);
var key = item.code + "_" + value;
if(!this.styleCache[key]) {
getColorFromGradient(layer: ILayer, value: number): IColor {
var gradient: IGradientstop[] = layer.renderer.colorMap.gradient;
var histogram: IHistogram = layer.renderer.band.histogram;
var index = (value - histogram.min) / histogram.max;
@@ -68,24 +65,53 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
}
var i = index - min.relativestop;
var size = max.relativestop - min.relativestop;
var alpha = Math.round( min.color.alpha + ((max.color.alpha - min.color.alpha) * i / size));
var alpha = Math.round(min.color.alpha + ((max.color.alpha - min.color.alpha) * i / size));
var red = Math.round(min.color.red + ((max.color.red - min.color.red) * i / size));
var green = Math.round(min.color.green + ((max.color.green - min.color.green) * i / size));
var blue = Math.round(min.color.blue + ((max.color.blue - min.color.blue) * i / size));
return { alpha: alpha, red: red, green: green, blue: blue };
}
getColorForValue(layer: ILayer, value: number): IColor {
var color: IColor = { alpha:0,red:0,green:0,blue:0};
if(layer.renderer.colorMap.entries.length>0) {
color=layer.renderer.colorMap.noValue;
}
layer.renderer.colorMap.entries.forEach((entry) => {
if(entry.value==value) {
color =entry.color;
return;
}
});
return color;
}
getColor(item: IItem, layer: ILayer, feature): style.Style {
var value = layer.indexKey ? feature.get(layer.indexKey) : feature.get(layer.name);
var key = item.code + "_" + value;
if (!this.styleCache[key]) {
var color: IColor;
if(layer.renderer.colorMap.colormapType == "manual") {
color = this.getColorForValue(layer, value);
} else {
color = this.getColorFromGradient(layer, value);
}
this.styleCache[key] = new style.Style(
{
image: new style.Circle({
fill: new style.Fill({
color: this.rgbaToHex(red,green,blue,alpha)
color: this.rgbaToHex(color.red, color.green, color.blue, color.alpha)
}),
radius: 3
}),
fill: new style.Fill({
color: this.rgbaToHex(red, green, blue, alpha)
color: this.rgbaToHex(color.red, color.green, color.blue, color.alpha)
}),
stroke: new style.Stroke({
color: this.rgbaToHex(red, green, blue, 255),
color: this.rgbaToHex(color.red, color.green, color.blue, 255),
width: 1.25
}),
});
@@ -133,7 +159,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
url: `${this._apiEndPoint}/api/v1/items/${item.code}/vectortiles/{z}/{x}/{y}.pbf?v=${Date.parse(item.updated)}`
}),
style: (feature) => {
return this.getColorFromGradient(item,l, feature);
return this.getColor(item,l, feature);
}
})
} else if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {

View File

@@ -112,17 +112,18 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
this.host.instance.setSource(this.instance);
this.host.instance.setStyle((feature) => {
var key = feature.get('itemType') + (this.selectedItem?"_I":"");
var itemType = feature.get('itemType');
var key = itemType + (this.selectedItem?"_I":"");
if (!this.stylesCache[key]) {
if (this.itemTypeService.itemTypes[key]) {
let itemType = this.itemTypeService.itemTypes[key];
let fillColor = color.asArray(itemType.iconColor);
if (this.itemTypeService.itemTypes[itemType]) {
let itemTypeEntry = this.itemTypeService.itemTypes[itemType];
let fillColor = color.asArray(itemTypeEntry.iconColor);
fillColor[3] = 0;
this.stylesCache[key] = new style.Style({
image: itemType.icon ? new style.Icon({
image: itemTypeEntry.icon ? new style.Icon({
anchor: [0.5, 1],
scale: 0.05,
src: this.featureIconService$.getIconImageDataUrl(itemType.icon)
src: this.featureIconService$.getIconImageDataUrl(itemTypeEntry.icon)
}):null,
stroke: new style.Stroke({
color: 'red',

View File

@@ -17,7 +17,7 @@
</div>
<div *ngIf="itemLayer.legendVisible">
<div class="card legend">
<fm-map-layer-legend [layer]="firstLayer(itemLayer)" (click)="handleLegendClick($event,itemLayer);"></fm-map-layer-legend>
<fm-map-layer-legend [layer]="firstLayer(itemLayer)" (click)="handleLegendClick($event,itemLayer);" [histogramenabled]="true"></fm-map-layer-legend>
</div>
</div>
</div>

View File

@@ -0,0 +1,18 @@
<div #layerValues class="layer-values">
<div class="cross" *ngIf="enabled$ | async">
<div class="pointer"></div>
<div class="values-container border border-dark rounded p-2" *ngIf="(layerValues$ | async ) as layers">
<div class="lonlat pb-2 "><span class="font-weight-bold">{{lonlat$}}</span><i class="ml-2 fal fa-copy" (click)="copyToClipboard()"></i> </div>
<ul class="value-list p-0 mb-0" *ngIf="layers.length>0 ;else no_data">
<li class="border-top pt-1 pb-1 value" *ngFor="let layerValue of layers">
<div>{{layerValue.layerName}}</div>
<div>{{layerValue.date|date}}</div>
<div><span *ngIf="layerValue.quantity"><span class="mr-1">{{layerValue.quantity}}</span> </span><span class="mr-1 font-weight-bold">{{layerValue.value}}</span><span>{{layerValue.unit}}</span></div>
</li>
</ul>
<ng-template #no_data>
<div i18n class="border-top pt-1 pb-1">No data at location</div>
</ng-template>
</div>
</div>
</div>>

View File

@@ -0,0 +1,37 @@
.layer-values {
position: absolute;
left: 50%;
top: 30%;
}
.cross {
display: block;
position: relative;
width: 1em;
height: 1em;
left: -0.5em;
top: -0.5em;
}
.values-container {
position: relative;
background-color: white;
left: calc( 1em - 1px);
top: -1.3em;
min-width: 15em;
}
.value-list {
list-style: none;
}
.pointer {
position: relative;
width: 0px;
height: 0px;
left: 0.5em;
border-top: 0.5em solid transparent;
border-bottom: 0.5em solid transparent;
border-right: 0.5em solid black;
}

View File

@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LayerValuesComponent } from './layer-values.component';
describe('LayerValuesComponent', () => {
let component: LayerValuesComponent;
let fixture: ComponentFixture<LayerValuesComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LayerValuesComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(LayerValuesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,62 @@
import { Component, OnInit,Input,ViewChild,ElementRef,AfterViewInit } from '@angular/core';
import {IItemLayer} from '../../../models/item.layer';
import { Store } from '@ngrx/store';
import * as mapReducers from '../../../reducers/map.reducer';
import * as mapActions from '../../../actions/map.actions';
import { MapComponent } from 'ngx-openlayers';
import { ILayervalue } from '../../../models/layer.value';
import { Observable,interval,Subject } from 'rxjs';
import { debounce, throttle } from 'rxjs/operators';
import { toLonLat } from 'ol/proj';
import { toStringHDMS } from 'ol/coordinate';
import { ClipboardService } from 'ngx-clipboard'
import {GeoJSON,WKT} from 'ol/format';
import { Point } from 'ol/geom';
@Component({
selector: 'fm-map-layer-values',
templateUrl: './layer-values.component.html',
styleUrls: ['./layer-values.component.scss']
})
export class LayerValuesComponent implements OnInit,AfterViewInit {
@ViewChild('layerValues') containerRef:ElementRef;
offsetX$:number =0;
offsetY$:number =0;
lonlat$: string="";
wkt$= "";
layerValues$:Observable<Array<ILayervalue>> = this.store.select(mapReducers.selectGetLayerValues);
enabled$:Observable<boolean> = this.store.select(mapReducers.selectGetLayerValuesEnabled);
wktFormat$:WKT;
constructor( private store: Store<mapReducers.State>,private map: MapComponent,private clipboardService$:ClipboardService) {
this.wktFormat$=new WKT();
}
ngOnInit(): void {
}
moveEndSubject = new Subject<any>();
ngAfterViewInit():void {
this.offsetY$ = this.containerRef.nativeElement.offsetTop;
this.offsetX$ = this.containerRef.nativeElement.offsetLeft;
this.map.instance.on('moveend', () => {
this.moveEndSubject.next({});
});
this.moveEndSubject.pipe(throttle(ev => interval(100))).subscribe(() => this.updateValuesLocation());
}
updateValuesLocation() {
var xy = this.map.instance.getCoordinateFromPixel([this.offsetX$,this.offsetY$])
var lonlat = toLonLat(xy);
this.wkt$ = this.wktFormat$.writeGeometry(new Point(lonlat))
this.lonlat$ = toStringHDMS(lonlat);
this.store.dispatch(new mapActions.SetLayerValuesLocation(xy[0],xy[1]));
}
copyToClipboard() {
this.clipboardService$.copy(this.wkt$);
}
}

View File

@@ -14,7 +14,7 @@ export class PanToLocation implements OnInit,OnChanges{
view: View;
map: MapComponent;
@Input() position: Position;
@Input() position: GeolocationPosition;
@Input() mapState: IMapState;
@Input() animate: boolean;

View File

@@ -1,4 +1,5 @@
import { Component, Host, Input, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ViewComponent, MapComponent } from 'ngx-openlayers';
@@ -9,12 +10,24 @@ import { ViewComponent, MapComponent } from 'ngx-openlayers';
export class ZoomToExtentComponent implements OnChanges {
view: ViewComponent;
map: MapComponent;
paddingTop: number = 0;
paddingLeft: number = 0;
paddingBottom: number = 0;
paddingRight: number = 0;
@Input() extent: number[];
@Input() animate: boolean = false;
constructor(@Host() view: ViewComponent, @Host() map: MapComponent) {
constructor(@Host() view: ViewComponent, @Host() map: MapComponent,route: ActivatedRoute ) {
this.view = view;
this.map = map;
if(route && route.snapshot && route.snapshot.data && route.snapshot.data["fm-map-zoom-to-extent"]) {
let params = route.snapshot.data["fm-map-zoom-to-extent"];
this.paddingTop = params["padding-top"] ? params["padding-top"] : 0;
this.paddingBottom = params["padding-bottom"] ? params["padding-bottom"] : 0;
this.paddingLeft = params["padding-left"] ? params["padding-left"] : 0;
this.paddingRight = params["padding-right"] ? params["padding-right"] : 0;
}
}
ngOnChanges(changes: SimpleChanges) {
@@ -31,7 +44,7 @@ export class ZoomToExtentComponent implements OnChanges {
bottom = 5 * rem;
left = 23 * rem;
}
options.padding = [top, right, bottom, left];
options.padding = [top + (this.paddingTop*rem), right+ (this.paddingRight*rem), bottom + (this.paddingBottom*rem), left+ (this.paddingLeft*rem)];
if (this.animate) options["duration"] = 1000;
this.view.instance.fit(this.extent, options);
}

View File

@@ -1,12 +1,14 @@
<div *ngIf="feature;let feature" class="d-flex m-0">
<div class="p-2">
<div #container class="thumbnail">
<canvas #canvas ></canvas>
<div class="thumbnail">
<fm-map-feature-thumbnail [feature]="feature"></fm-map-feature-thumbnail>
</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>&nbsp;<span>{{feature.get('cropTypeName')}}</span> </div>
<div class="card-text"><span>{{feature.get('datadate')|date}}</span> - <span>{{feature.get('dataenddate')|date}}</span> </div>
<div class="card-text"><span>{{areaInHa(feature)| number:'1.2-2'}}
ha</span>&nbsp;<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>

View File

@@ -1,14 +1,12 @@
import { Component, Injectable,ViewChild,AfterViewInit} from '@angular/core';
import { Feature } from 'ol';
import * as extent from 'ol/extent';
import * as render from 'ol/render';
import { Store } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer';
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';
import {getArea} from 'ol/sphere';
import * as style from 'ol/style';
@ForItemType("vnd.farmmaps.itemtype.cropfield")
@@ -18,10 +16,8 @@ import * as style from 'ol/style';
templateUrl: './feature-list-feature-cropfield.component.html',
styleUrls: ['./feature-list-feature-cropfield.component.scss']
})
export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFeatureComponent implements AfterViewInit {
export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFeatureComponent {
@ViewChild('canvas') canvas;
@ViewChild('container') container;
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService,config:AppConfig) {
super(store, itemTypeService,config);
@@ -34,42 +30,4 @@ export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFea
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);
}
}

View File

@@ -0,0 +1,4 @@
<div #container class="container">
<canvas #canvas ></canvas>
</div>

View File

@@ -0,0 +1,5 @@
.container {
padding: 0;
width: 100%;
height: 100%;
}

View File

@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { GeometryThumbnailComponent } from './feature-thumbnail.component';
describe('GeometryThumbnailComponent', () => {
let component: GeometryThumbnailComponent;
let fixture: ComponentFixture<GeometryThumbnailComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ GeometryThumbnailComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(GeometryThumbnailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,60 @@
import { Component, Input, OnInit,ViewChild } from '@angular/core';
import { Feature} from 'ol';
import { Geometry } from 'ol/geom';
import * as extent from 'ol/extent';
import * as render from 'ol/render';
import * as style from 'ol/style';
@Component({
selector: 'fm-map-feature-thumbnail',
templateUrl: './feature-thumbnail.component.html',
styleUrls: ['./feature-thumbnail.component.scss']
})
export class GeometryThumbnailComponent implements OnInit {
constructor() { }
@ViewChild('canvas') canvas;
@ViewChild('container') container;
@Input('feature') feature:Feature;
ngOnInit(): void {
}
render(canvas,width,height,geometry:Geometry) {
let renderContext = render.toContext(canvas.getContext( '2d'),{ size: [width, height] });
let strokeStyle = new style.Style({
stroke: new style.Stroke({ color: 'black',width:1.5 })
});
let geom = geometry.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.getGeometry());
}
}

View File

@@ -3,35 +3,55 @@ import { layer } from 'ol';
import { MapComponent } from 'ngx-openlayers';
@Directive({
selector: '[fm-map-ifZoomToShow]',
selector: '[fmMapIfZoomToShow]',
})
export class ifZoomToShowDirective implements OnInit,OnChanges {
@Input('fm-map-ifZoomToShow') layer$:layer;
export class ifZoomToShowDirective implements OnInit {
@Input()
set fmMapIfZoomToShow(layer:layer) {
this.layer$=layer;
this.checkZoom();
}
constructor(private templateRef$: TemplateRef<any>,private viewContainerRef$: ViewContainerRef,private map$: MapComponent) { }
@Input()
set fmMapIfZoomToShowThen(templateRef: TemplateRef<any>) {
this.thenTemplate$ = templateRef;
this.checkZoom();
}
@Input()
set fmMapIfZoomToShowElse(templateRef: TemplateRef<any>) {
this.elseTemplate$ = templateRef;
this.checkZoom();
}
private layer$:layer;
private thenTemplate$:TemplateRef<any>;
private elseTemplate$:TemplateRef<any>;
private showView = false;
constructor(private templateRef$: TemplateRef<any>,private viewContainerRef$: ViewContainerRef,private map$: MapComponent) {
this.thenTemplate$ = templateRef$;
this.checkZoom();
}
ngOnInit() {
this.map$.instance.on('moveend', (e) => {
this.checkZoom();
});
}
ngOnChanges() {
this.checkZoom();
}
checkZoom() {
if(this.layer$ && this.map$.instance) {
let minZoom = this.layer$.getMinZoom();
let currentZoom = this.map$.instance.getView().getZoom();
let view = currentZoom < minZoom;
if(view!= this.showView) {
this.showView=view;
if ( !this.showView) {
this.viewContainerRef$.clear();
} else {
this.showView=view;
if (this.showView && this.thenTemplate$ ) {
this.viewContainerRef$.createEmbeddedView(this.templateRef$);
} else if(this.elseTemplate$ ) {
this.viewContainerRef$.createEmbeddedView(this.elseTemplate$);
}
}
}

View File

@@ -23,7 +23,7 @@
<div *ngIf="showHistogram()">
<span class="bar" [style.background-color]="getHex(entry.color)" [style.width]="getPart(layer.renderer, i)">
</span>
<span class="bar-label">{{getLabel(layer.renderer,i)}}</span>
<span *ngIf="getPercentage(layer.renderer,i) as percentage" class="bar-label">{{percentage | number:'1.0-2'}} %</span>
</div>
</td>
</tr>

View File

@@ -78,10 +78,10 @@ export class LegendComponent implements OnInit,AfterViewInit {
return v;
}
public getLabel(renderer: IRenderer, index: number): string {
public getPercentage(renderer: IRenderer, index: number): number {
let scale = 100 / renderer.band.histogram.entries.reduce((sum, entry) => sum + entry.freqency, 0);
let percent = renderer.band.histogram.entries[index].freqency * scale;
return percent < 0.1 ? "" : percent.toFixed(1) + " %";
return percent < 0.1 ? null : percent;
}
showLegend(): boolean {
@@ -89,12 +89,10 @@ export class LegendComponent implements OnInit,AfterViewInit {
}
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";
return this.histogramenabled && this.layer.renderer.band.histogram.entries && this.layer.renderer.band.histogram.entries.length > 0 && this.layer.renderer.band.histogram.entries.length == this.layer.renderer.colorMap.entries.length;
}
bandContainsStatistics(): boolean {
return this.layer.renderer.band.statistics != null;
}
}

View File

@@ -33,4 +33,4 @@
<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>
<fm-map-select-period-modal [modalState]="openedModalName" (onCloseModal)="handleCloseModal()" (onSelect)="handleSelectPeriod($event)" [startDate]="periodLocal.startDate" [endDate]="periodLocal.endDate"></fm-map-select-period-modal>

View File

@@ -22,7 +22,10 @@ export class MapSearchComponent {
@Input() set searchMinified(minified: boolean) {
this.searchMinifiedLocal = minified;
}
@Input() period: IPeriodState
@Input() set period(period:IPeriodState) {
this.periodLocal = tassign(this.periodLocal,{startDate: period.startDate,endDate:period.endDate});
this.startEndCaption = this.timespanService.getCaption(period.startDate, period.endDate, 4)
}
@Output() onSearch = new EventEmitter<IQueryState>();
@Output() onClear = new EventEmitter<any>();
@Output() onSearchCollapse = new EventEmitter<any>();
@@ -30,6 +33,7 @@ export class MapSearchComponent {
@Output() onToggleMenu = new EventEmitter<any>();
@Output() onOpenModal = new EventEmitter<string>();
@Output() onCloseModal = new EventEmitter<any>();
@Output() onPeriodChange = new EventEmitter<IPeriodState>();
@Input() openedModalName: string;
@Input() set filterOptions(filterOptions: IQueryState) {
if (filterOptions && filterOptions.query && filterOptions.query.length > 0) {
@@ -43,22 +47,17 @@ export class MapSearchComponent {
} else {
this.searchTextLocal = { name: filterOptions.query };
}
if (this.dateFilter) {
this.filterOptionsLocal.startDate = this.startDate;
this.filterOptionsLocal.endDate = this.endDate;
}
}
public collapsedLocal: boolean = true;
public searchMinifiedLocal: boolean = false;
public periodLocal: IPeriodState = { startDate:new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1), endDate:new Date(Date.now())};
public filterOptionsLocal: IQueryState;
private extent: number[];
public searchTextLocal: any;
public searchTextLocalOutput: string;
public dateFilter: boolean = true;
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 startEndCaption: string = this.timespanService.getCaption(this.startDate, this.endDate, 4);
public startEndCaption: string = this.timespanService.getCaption(this.periodLocal.startDate, this.periodLocal.endDate, 4);
searching = false;
searchFailed = false;
@@ -94,8 +93,8 @@ export class MapSearchComponent {
this.filterOptionsLocal.parentCode = null;
this.filterOptionsLocal.query = this.searchTextLocalOutput;
if (this.dateFilter) {
this.filterOptionsLocal.startDate = this.startDate;
this.filterOptionsLocal.endDate = this.endDate;
this.filterOptionsLocal.startDate = this.periodLocal.startDate;
this.filterOptionsLocal.endDate = this.periodLocal.endDate;
}
this.onSearch.emit(this.filterOptionsLocal);
}
@@ -117,26 +116,30 @@ export class MapSearchComponent {
this.filterOptionsLocal.parentCode = null;
this.filterOptionsLocal.tags = event.item.name;
if (this.dateFilter) {
this.filterOptionsLocal.startDate = this.startDate;
this.filterOptionsLocal.endDate = this.endDate;
this.filterOptionsLocal.startDate = this.periodLocal.startDate;
this.filterOptionsLocal.endDate = this.periodLocal.endDate;
}
this.onSearch.emit(this.filterOptionsLocal);
this.searchTextLocal = { name: this.filterOptionsLocal.tags };
}
handleSelectPeriod(event: { startDate: Date, endDate: Date }) {
this.startDate = event.startDate;
this.endDate = event.endDate;
this.handleCloseModal();
this.periodLocal = { startDate: event.startDate, endDate: event.endDate}
this.onPeriodChange.emit(this.periodLocal);
this.startEndCaption = this.timespanService.getCaption(event.startDate, event.endDate, 4);
if(this.dateFilter) {
this.filterOptionsLocal.startDate =event.startDate;
this.filterOptionsLocal.endDate = event.endDate;
this.onSearch.emit(this.filterOptionsLocal);
}
this.handleCloseModal();
}
handleChangeEnableDateFilter(enabled) {
this.dateFilter = enabled;
if (enabled) {
this.filterOptionsLocal.startDate = this.startDate;
this.filterOptionsLocal.endDate = this.endDate;
this.filterOptionsLocal.startDate = this.periodLocal.startDate;
this.filterOptionsLocal.endDate = this.periodLocal.endDate;
} else {
this.filterOptionsLocal.startDate = null;
this.filterOptionsLocal.endDate = null;

View File

@@ -22,7 +22,7 @@
selectedFeature:selectedFeature$|async,
fullscreen:fullscreen$|async
} as state">
<aol-map #map (moveEnd)="handleOnMoveEnd($event)" (click)="handleOnMouseDown($event)" [ngClass]="{'panel-visible':state.panelVisible,'fullscreen':state.fullscreen}" class="map">
<aol-map #map (moveEnd)="handleOnMoveEnd($event)" (click)="handleOnMouseDown($event)" (dblClick)="handleShowLayerValues($event)" [ngClass]="{'panel-visible':state.panelVisible,'fullscreen':state.fullscreen}" class="map">
<div>
</div>
@@ -33,13 +33,14 @@
<aol-interaction-default></aol-interaction-default>
<aol-interaction-dragrotateandzoom></aol-interaction-dragrotateandzoom>
<fm-map-item-layers [itemLayers]="state.baseLayers"></fm-map-item-layers>
<fm-map-item-layers [itemLayers]="state.overlayLayers"></fm-map-item-layers>
<fm-map-item-layers [itemLayer]="state.selectedItemLayer"></fm-map-item-layers>
<fm-map-item-layers *ngIf="!overrideOverlayLayers" [itemLayers]="state.overlayLayers"></fm-map-item-layers>
<fm-map-item-layers *ngIf="!overrideSelectedItemLayer" [itemLayer]="state.selectedItemLayer"></fm-map-item-layers>
<aol-layer-vector>
<fm-map-item-source-vector [styles]="state.styles" [features]="state.features" (onFeatureSelected)="handleFeatureClick($event)" (onFeatureHover)="handleFeatureHover($event)" [selectedFeature]="state.selectedFeature" [selectedItem]="state.selectedItem"></fm-map-item-source-vector>
</aol-layer-vector>
<router-outlet name="map-layers"></router-outlet>
<fm-map-gps-location [position]="state.position" [headingTolerance]="20" [showHeading]="devicesService.IsMobile()" [showTolerance]="devicesService.IsMobile()" [heading]="state.compassHeading"></fm-map-gps-location>
<fm-map-layer-values></fm-map-layer-values>
<div class="control-container" >
<router-outlet name="map-controls"></router-outlet>
<fm-map-layer-switcher></fm-map-layer-switcher>
@@ -49,8 +50,9 @@
<fm-map-file-drop-target [parentCode]="state.parentCode" (onFileDropped)="handleFileDropped($event)"></fm-map-file-drop-target>
<div *ngIf="noContent">
<fm-map-map-search #mapSearch [openedModalName]="state.openedModalName" (onOpenModal)="handleOpenModal($event)" (onCloseModal)="handleCloseModal()" [ngClass]="{'menuVisible':state.menuVisible}" (onToggleMenu)="handleToggleMenu($event)" (onSearchCollapse)="handleSearchCollapse($event)" (onSearchExpand)="handleSearchExpand($event)" [collapsed]="state.searchCollapsed" [searchMinified]="state.searchMinified" (onSearch)="handleSearch($event)" (onClear)="handleClearSearch($event)" [filterOptions]="state.queryState" [clearEnabled]="state.clearEnabled" [period]="state.period"></fm-map-map-search>
<fm-map-map-search #mapSearch [openedModalName]="state.openedModalName" (onOpenModal)="handleOpenModal($event)" (onCloseModal)="handleCloseModal()" [ngClass]="{'menuVisible':state.menuVisible}" (onToggleMenu)="handleToggleMenu($event)" (onSearchCollapse)="handleSearchCollapse($event)" (onSearchExpand)="handleSearchExpand($event)" [collapsed]="state.searchCollapsed" [searchMinified]="state.searchMinified" (onSearch)="handleSearch($event)" (onClear)="handleClearSearch($event)" [filterOptions]="state.queryState" [clearEnabled]="state.clearEnabled" [period]="state.period" (onPeriodChange)="handlePeriodChange($event)"></fm-map-map-search>
</div>
<div class="side-panel-container">
<fm-side-panel [resizeable]="true" [visible]="state.panelVisible && noContent" [collapsed]="state.panelCollapsed" [collapsable]="false">
<div class="panel-wrapper" *ngIf="noContent">
<div class="panel-top bg-secondary" *ngIf="!(state.searchMinified)">
@@ -74,6 +76,7 @@
<fm-side-panel [resizeable]="true" [visible]="!noContent">
<router-outlet></router-outlet>
</fm-side-panel>
</div>
</aol-map>
</ng-container>

View File

@@ -56,6 +56,18 @@ aol-map { position:absolute;width:100%;height:calc(100vh + 4rem);}
bottom: 5em;
}
.side-panel-container {
position: absolute;
top:0em;
bottom: 7.1em;
width: 100%;
pointer-events: none;
}
.fullscreen .side-panel-container {
bottom: 4em;
}
switch2d3d {
position: absolute;
right: 1em;
@@ -125,6 +137,10 @@ timespan.menuVisible {
.panel-top {
height: 8.1rem;
}
.side-panel-container {
width: auto;
}
}
.map {

View File

@@ -11,6 +11,7 @@ import { DeviceService } from '@farmmaps/common';
import * as mapReducers from '../../reducers/map.reducer';
import * as mapActions from '../../actions/map.actions';
import { IMapState} from '../../models/map.state';
import { IQuery } from '../../reducers/map.reducer'
import { ISelectedFeatures } from '../../models/selected.features';
import { IItemLayer } from '../../models/item.layer';
import { IListItem, IQueryState } from '@farmmaps/common';
@@ -73,8 +74,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
public searchCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetSearchCollapsed);
public searchMinified$: Observable<boolean> = this.store.select(mapReducers.selectGetSearchMinified);
public menuVisible$: Observable<boolean>;
public query$: Observable<IQueryState> = this.store.select(mapReducers.selectGetQuery);
public position$: Observable<Position> = this.geolocationService.getCurrentPosition();
public query$: Observable<IQuery> = this.store.select(mapReducers.selectGetQuery);
public position$: Observable<GeolocationPosition> = this.geolocationService.getCurrentPosition();
public compassHeading$: Observable<number> = this.deviceorientationService.getCurrentCompassHeading();
public baseLayersCollapsed:boolean = true;
public overlayLayersCollapsed: boolean = true;
@@ -84,6 +85,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
private lastUrl = "";
private initialized: boolean = false;
public noContent: boolean = false;
public overrideSelectedItemLayer: boolean = false;
public overrideOverlayLayers: boolean = false;
@ViewChild('map') map;
@ViewChild('contentDiv') contentDiv: ElementRef;
@@ -99,28 +102,33 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
private zone: NgZone,
private deviceorientationService:DeviceOrientationService,
public devicesService:DeviceService) {
this.querySub = this.query$.pipe(skip(1), withLatestFrom(this.mapState$)).subscribe(([queryState,mapState]) =>{
if(queryState) {
if(route && route.snapshot && route.snapshot.data && route.snapshot.data["fm-map-map"]) {
let params = route.snapshot.data["fm-map-map"];
this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false;
this.overrideOverlayLayers = params["overrideOverlayLayers"] ? params["overrideOverlayLayers"] : false;
}
this.querySub = this.query$.pipe(skip(1), withLatestFrom(this.mapState$)).subscribe(([query,mapState]) =>{
if(query && query.querystate) {
let newQueryState = tassign(mapReducers.initialQueryState);
console.debug(`Do Query`);
let urlparts=[];
if (queryState.itemCode && queryState.itemCode != "") {
if(queryState.itemType && queryState.itemType!= "") {
let itemType = this.itemTypeService.itemTypes[queryState.itemType];
if (query.querystate.itemCode && query.querystate.itemCode != "") {
if(query.querystate.itemType && query.querystate.itemType!= "") {
let itemType = this.itemTypeService.itemTypes[query.querystate.itemType];
if (itemType && itemType.viewer && itemType.viewer == "edit_in_editor" && itemType.editor) {
urlparts.push('/editor');
urlparts.push(itemType.editor);
urlparts.push('item');
urlparts.push(queryState.itemCode);
urlparts.push(query.querystate.itemCode);
}
}
} else {
newQueryState= queryState;
newQueryState= query.querystate;
}
if(urlparts.length==0 ) {
newQueryState.itemCode = queryState.itemCode;
newQueryState.itemCode = query.querystate.itemCode;
this.zone.run(() => {
this.replaceUrl(mapState,newQueryState,false);
this.replaceUrl(mapState,newQueryState,query.replace);
})
} else {
this.router.navigate(urlparts);
@@ -383,6 +391,13 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
});
}
handleShowLayerValues(event: MouseEvent) {
event.stopPropagation();
this.zone.run(() =>{
this.store.dispatch(new mapActions.ToggleLayerValuesEnabled());
});
}
handleOnDownload(event) {
}
@@ -419,6 +434,10 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
this.store.dispatch(new mapActions.SelectOverlayLayer(itemLayer));
}
handlePeriodChange(period:IPeriodState) {
this.store.dispatch(new mapActions.SetPeriod(period));
}
ngOnDestroy() {
if (this.paramSub) this.paramSub.unsubscribe();
if (this.itemTypeSub) this.itemTypeSub.unsubscribe();

View File

@@ -4,7 +4,7 @@
<div class="card-body">
<fm-back-button></fm-back-button>
<div class="card menu-card">
<h2 *ngIf="parentItem">{{parentItem.name}}</h2>
<h2 *ngIf="parentOfItemType('vnd.farmmaps.itemtype.cropfield')">{{parentItem.name}}</h2>
<h1>{{item.name}}</h1>
</div>
<div class="legend-container" *ngIf="item?.data.layers;let layers">

View File

@@ -4,7 +4,7 @@
<div class="card-body">
<fm-back-button></fm-back-button>
<div class="card menu-card">
<h2 *ngIf="parentItem">{{parentItem.name}}</h2>
<h2 *ngIf="parentOfItemType('vnd.farmmaps.itemtype.cropfield')">{{parentItem.name}}</h2>
<h1>{{item.name}}</h1>
</div>
<div class="legend-container" *ngIf="item?.data.layers;let layers">

View File

@@ -4,7 +4,7 @@
<div class="card-body">
<fm-back-button></fm-back-button>
<div class="card menu-card">
<h2 *ngIf="parentItem">{{parentItem.name}}</h2>
<h2 *ngIf="parentOfItemType('vnd.farmmaps.itemtype.cropfield')">{{parentItem.name}}</h2>
<h1>{{item.name}}</h1>
</div>
<div class="legend-container" *ngIf="item?.data.layers;let layers">

View File

@@ -1,9 +1,6 @@
<div *ngIf="item;let item">
<div class="card border-0">
<img *ngIf="item.thumbnail" class="card-img-top" [src]="getThumbnailUrl(item)" />
<div *ngIf="!item.thumbnail" class="big-icon" [style.background-color]="itemTypeService.getColor(item.itemType)">
<i [ngClass]="itemTypeService.getIcon(item.itemType)"></i>
</div>
<fm-thumbnail [item]="item" [edit]="item.isEditable"></fm-thumbnail>
</div>
<div class="card">
<div class="card-body">

View File

@@ -62,6 +62,10 @@ export abstract class AbstractSelectedItemComponent {
this.location.back();
}
parentOfItemType(itemType:string):boolean {
if(this.parentItem && this.parentItem.itemType == itemType) return true;
return false;
}
}
@Injectable()

View File

@@ -3,9 +3,13 @@ import { layer } from 'ol';
@Component({
selector: 'fm-map-zoom-to-show-alert',
template: '<div *fm-map-ifZoomToShow="layer" class="alert alert-info"><i class="fas fa-search-plus" aria-hidden="true" i18n-title title="Add as layer"></i>&nbsp;<span i18n>Zoom in to show layer</span></div>'
template: '<div *fmMapIfZoomToShow="layer$" class="alert alert-info"><i class="fas fa-search-plus" aria-hidden="true" i18n-title title="Add as layer"></i>&nbsp;<span i18n>Zoom in to show layer</span></div>'
})
export class ZoomToShowAlert {
@Input() layer: layer;
public layer$: layer;
@Input()
set layer(layer:layer) {
this.layer$ = layer;
}
}

View File

@@ -1,9 +1,11 @@
import { Injectable } from '@angular/core';
import { Store, Action } from '@ngrx/store';
import { Effect, Actions,ofType } from '@ngrx/effects';
import { Store, Action,createFeatureSelector } from '@ngrx/store';
import { ROUTER_NAVIGATED, RouterReducerState } from '@ngrx/router-store';
import * as fromRouter from '@ngrx/router-store';
import { createEffect, Actions,ofType } from '@ngrx/effects';
import { EMPTY, Observable , of } from 'rxjs';
import { EMPTY, Observable , of} from 'rxjs';
import { withLatestFrom, switchMap, map, catchError, mergeMap } from 'rxjs/operators';
import {GeoJSON,WKT} from 'ol/format';
@@ -27,26 +29,40 @@ import {FeatureIconService} from '../services/feature-icon.service';
import * as style from 'ol/style';
import { ItemTypeService,IQueryState } from '@farmmaps/common';
import { TemporalItemLayer } from '../models/item.layer'
export const getRouterState = createFeatureSelector<RouterReducerState>('router');
export const {
selectCurrentRoute, // select the current route
selectQueryParams, // select the current route query params
selectQueryParam, // factory function to select a query param
selectRouteParams, // select the current route params
selectRouteParam, // factory function to select a route param
selectRouteData, // select the current route data
selectUrl, // select the current url
} = fromRouter.getSelectors(getRouterState);
@Injectable()
export class MapEffects {
private _geojsonFormat: GeoJSON;
private _wktFormat: WKT;
private overrideSelectedItemLayer: boolean = false;
private toPointFeature(updateEvent:commonActions.DeviceUpdateEvent): Feature {
private updateFeatureGeometry(feature:Feature, updateEvent:commonActions.DeviceUpdateEvent): Feature {
let newFeature = feature.clone();
var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857'
});
f.setId(updateEvent.itemCode);
var centroid = getCenter(f.getGeometry().getExtent());
f.setGeometry(new Point(centroid));
return f;
newFeature.setId(feature.getId());
newFeature.setGeometry(new Point(centroid));
return newFeature;
}
@Effect()
init$: Observable<Action> = this.actions$.pipe(
init$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.INIT),
withLatestFrom(this.store$.select(commonReducers.selectGetRootItems)),
switchMap(([action, rootItems]) => {
@@ -86,25 +102,23 @@ export class MapEffects {
return actions;
}
));
)));
@Effect()
initBaseLayers$: Observable<Action> = this.actions$.pipe(
initBaseLayers$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.INIT),
withLatestFrom(this.store$.select(mapReducers.selectGetProjection)),
map(([action, projection]) => new mapActions.LoadBaseLayers(projection)));
map(([action, projection]) => new mapActions.LoadBaseLayers(projection)))
);
@Effect()
loadBaseLayers$: Observable<Action> = this.actions$.pipe(
loadBaseLayers$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.LOADBASELAYERS),
switchMap((action: mapActions.LoadBaseLayers) => {
return this.itemService$.getItemList("vnd.farmmaps.itemtype.layer", { "isBaseLayer": true }).pipe(
map((items: IItem[]) => new mapActions.LoadBaseLayersSuccess(items)),
catchError(error => of(new commonActions.Fail(error))));
}));
})));
@Effect()
startSearch$: Observable<Action> = this.actions$.pipe(
startSearch$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.STARTSEARCH),
switchMap((action) => {
let a = action as mapActions.StartSearch;
@@ -112,7 +126,7 @@ export class MapEffects {
var endDate = a.queryState.endDate;
var newAction:Observable<Action>;
if (a.queryState.itemCode || a.queryState.parentCode || a.queryState.itemType || a.queryState.query || a.queryState.tags) {
newAction= this.itemService$.getFeatures(a.queryState.bbox, "EPSG:3857", a.queryState.query, a.queryState.tags, startDate, endDate, a.queryState.itemType, a.queryState.parentCode).pipe(
newAction= this.itemService$.getFeatures(a.queryState.bbox, "EPSG:3857", a.queryState.query, a.queryState.tags, startDate, endDate, a.queryState.itemType, a.queryState.parentCode, null, a.queryState.level).pipe(
switchMap((features: any) => {
for (let f of features.features) {
if (f.properties && f.properties["code"]) {
@@ -127,11 +141,10 @@ export class MapEffects {
return [];
}
return newAction;
}));
})));
@Effect()
zoomToExtent$: Observable<Action> = this.actions$.pipe(
zoomToExtent$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.STARTSEARCHSUCCESS),
mergeMap((action: mapActions.StartSearchSuccess) => {
let actions =[];
@@ -148,30 +161,28 @@ export class MapEffects {
}
}
return actions;
}));
})));
@Effect()
zoomToExtent2$: Observable<Action> = this.actions$.pipe(
zoomToExtent2$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SETFEATURES),
map((action: mapActions.SetFeatures) => {
switchMap((action: mapActions.SetFeatures) => {
let extent = createEmpty();
if (extent) {
for (let f of action.features) {
extend(extent, (f as Feature).getGeometry().getExtent());
}
if(action.features.length>0) return of(new mapActions.SetExtent(extent));
}
return new mapActions.SetExtent(extent);
}));
return EMPTY;
})));
@Effect()
hideMenu$: Observable<Action> = this.actions$.pipe(
hideMenu$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.STARTSEARCHSUCCESS),
mergeMap((action: mapActions.StartSearchSuccess) => {
return of(new commonActions.SetMenuVisible(false));
}));
})));
@Effect()
selectItem$: Observable<Action> = this.actions$.pipe(
selectItem$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SELECTITEM),
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
switchMap(([action, selectedItem]) => {
@@ -192,20 +203,19 @@ export class MapEffects {
return [];
}
}
));
)));
@Effect()
selectItemSuccessSetLayer$: Observable<Action> = this.actions$.pipe(
selectItemSuccessSetLayer$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS),
map((action:mapActions.SelectItemSuccess) =>
new mapActions.SetSelectedItemLayer(action.item)
)
);
));
@Effect()
selectItemSuccess$: Observable<Action> = this.actions$.pipe(
selectItemSuccess$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS),
switchMap((action:mapActions.SelectItemSuccess) => {
if(!this.overrideSelectedItemLayer) {
return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe(
map((feature: any) => {
let f = this._geojsonFormat.readFeature(feature);
@@ -213,11 +223,13 @@ export class MapEffects {
return new mapActions.AddFeatureSuccess(f );
}),
catchError(error => of(new commonActions.Fail(error))));
} else {
return EMPTY;
}
));
}
)));
@Effect()
selectItemSuccessTemporal$: Observable<Action> = this.actions$.pipe(
selectItemSuccessTemporal$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS),
switchMap((action:mapActions.SelectItemSuccess) => {
if(action.item.itemType == "vnd.farmmaps.itemtype.temporal") {
@@ -232,16 +244,14 @@ export class MapEffects {
return [];
}
}
));
)));
@Effect()
uploadedItemClick$: Observable<Action> = this.actions$.pipe(
uploadedItemClick$ = createEffect(() => this.actions$.pipe(
ofType(commonActions.UPLOADEDFILECLICK),
switchMap((action: commonActions.UploadedFileClick) => of(new mapActions.DoQuery(tassign(mapReducers.initialState.query, {itemCode:action.itemCode})))
));
switchMap((action: commonActions.UploadedFileClick) => of(new mapActions.DoQuery(tassign(mapReducers.initialState.query.querystate, {itemCode:action.itemCode})))
)));
@Effect()
featureUpdate$: Observable<Action> = this.actions$.pipe(
featureUpdate$ = createEffect(() => this.actions$.pipe(
ofType(commonActions.DEVICEUPDATEEVENT),
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
mergeMap(([action, features]) => {
@@ -254,14 +264,13 @@ export class MapEffects {
}
}
if (feature) {
return of(new mapActions.UpdateFeatureSuccess(this.toPointFeature(deviceUpdateEventAction)));
return of(new mapActions.UpdateFeatureSuccess(this.updateFeatureGeometry(feature,deviceUpdateEventAction)));
} else {
return [];
}
}));
})));
@Effect()
itemUpdate$: Observable<Action> = this.actions$.pipe(
itemUpdate$ = createEffect(() => this.actions$.pipe(
ofType(commonActions.ITEMCHANGEDEVENT),
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
mergeMap(([action, selectedItem]) => {
@@ -280,7 +289,7 @@ export class MapEffects {
} else {
return [];
}
}));
})));
getActionFromQueryState(queryState:IQueryState, inSearch:boolean):Observable<Action>|[] {
if(!inSearch && (queryState.itemType || queryState.parentCode || queryState.itemCode || queryState.query || queryState.tags)) {
@@ -297,17 +306,78 @@ export class MapEffects {
return of(newAction);
}
@Effect()
setState$: Observable<Action> = this.actions$.pipe(
getLayerValue$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.GETLAYERVALUE),
mergeMap((action:mapActions.GetLayerValue) => {
var l = action.itemLayer.item.data["layers"][action.itemLayer.layerIndex];
var scale = l.scale?l.scale:1;
return this.itemService$.getLayerValue(action.itemLayer.item.code,action.itemLayer.layerIndex,action.x,action.y).pipe(
mergeMap((v: number) => {
let a=[];
if(v !== null) {
if(l.renderer && l.renderer.colorMap && l.renderer.colorMap.colormapType == "manual") {
l.renderer.colorMap.entries.forEach((e) => {
if(e.value == v && e.label) {
v=e.label;
return;
}
});
a.push(new mapActions.GetLayerValueSuccess({date:action.itemLayer.item.dataDate,value:v,layerName:l.name,quantity:"",unit:l.unit}));
} else {
a.push(new mapActions.GetLayerValueSuccess({date:action.itemLayer.item.dataDate,value:v*scale,layerName:l.name,quantity:l.quantity,unit:l.unit}));
}
}
return a;
}))
}
)));
updateLayerValuesOnLayerAddedOrRemoved$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.ADDLAYER,mapActions.REMOVELAYER,mapActions.SELECTITEMSUCCESS,mapActions.SELECTTEMPORALITEMSSUCCESS, mapActions.NEXTTEMPORAL,mapActions.PREVIOUSTEMPORAL,mapActions.TOGGLELAYERVALUESENABLED,mapActions.SETLAYERINDEX,mapActions.SETSELECTEDITEMLAYER),
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesX)),
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesY)),
map(([[action,x],y]) => new mapActions.SetLayerValuesLocation(x,y))
));
getLayerValues$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SETLAYERVALUESLOCATION),
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItemLayer)),
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesEnabled)),
withLatestFrom(this.store$.select(mapReducers.selectGetOverlayLayers)),
mergeMap(([[[action, selected], enabled],overlayLayers]) => {
let layers = [];
if(selected) {
if(selected && (selected as TemporalItemLayer).selectedItemLayer ) {
selected=(selected as TemporalItemLayer).selectedItemLayer;
}
layers.push(selected);
}
overlayLayers.forEach((ol) => {
if(ol!=selected) layers.push(ol);
});
let a = action as mapActions.SetLayerValuesLocation;
let actions = [];
if(enabled) {
layers.forEach((ol) => {
if("vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(ol.item.itemType)>=0) {
actions.push(new mapActions.GetLayerValue(ol,a.x,a.y));
}
});
}
return actions;
})));
setState$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SETSTATE),
withLatestFrom(this.store$.select(mapReducers.selectGetInSearch)),
switchMap(([action,inSearch]) => {
let a = action as mapActions.SetState;
return this.getActionFromQueryState(a.queryState,inSearch);
}));
})));
@Effect()
escape$:Observable<Action> = this.actions$.pipe(
escape$ = createEffect(() => this.actions$.pipe(
ofType(commonActions.ESCAPE),
switchMap((action) => {
let a = action as commonActions.Escape;
@@ -316,7 +386,21 @@ export class MapEffects {
} else {
return EMPTY;
}
}));
})));
setOverride$ = createEffect(() => this.actions$.pipe(
ofType(ROUTER_NAVIGATED),
switchMap(() => this.store$.select(selectRouteData as any)),
switchMap((data: any) => {
if(data && data["fm-map-map"]) {
let params = data["fm-map-map"];
this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false;
} else {
this.overrideSelectedItemLayer = false;
}
return [];
})
));
constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService) {
this._geojsonFormat = new GeoJSON();

View File

@@ -54,7 +54,7 @@ export interface IGradientstop {
export interface IColorMap {
gradient: IGradientstop[],
noValue: IColorEntry,
noValue: IColor,
entries: IColorEntry[],
colormapType: string
}

View File

@@ -0,0 +1,7 @@
export interface ILayervalue {
date:string;
layerName:string;
unit:string;
quantity:string;
value:number;
}

View File

@@ -3,8 +3,9 @@ import { IItem,Item } from '@farmmaps/common';
import { IItemLayer,ItemLayer,ITemporalItemLayer,TemporalItemLayer} from '../models/item.layer';
import { IMapState} from '../models/map.state';
import { IQueryState} from '@farmmaps/common';
import { IPeriodState} from '../models/period.state';
import { IPeriodState } from '../models/period.state';
import { IStyles} from '../models/style.cache';
import { ILayervalue } from '../models/layer.value';
import * as mapActions from '../actions/map.actions';
import {commonActions} from '@farmmaps/common';
import { createSelector, createFeatureSelector } from '@ngrx/store';
@@ -32,12 +33,17 @@ export const initialQueryState: IQueryState = {
bbox: []
};
export interface IQuery {
querystate: IQueryState,
replace: boolean
}
export interface State {
period:IPeriodState,
mapState: IMapState,
viewExtent: number[],
queryState: IQueryState,
query:IQueryState,
query:IQuery,
parentCode: string,
features: Array<Feature>,
panelVisible: boolean,
@@ -59,7 +65,11 @@ export interface State {
showLayerSwitcher:boolean,
inSearch:boolean,
inZoom:boolean,
replaceUrl:boolean
replaceUrl:boolean,
layerValuesX:number,
layerValuesY:number,
layerValuesEnabled:boolean;
layerValues: Array<ILayervalue>;
}
export const initialState: State = {
@@ -98,7 +108,11 @@ export const initialState: State = {
showLayerSwitcher: false,
inSearch:false,
inZoom:false,
replaceUrl:true
replaceUrl:true,
layerValuesX:0,
layerValuesY:0,
layerValuesEnabled:false,
layerValues:[]
}
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State {
@@ -288,8 +302,18 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
case mapActions.DOQUERY: {
let a = action as mapActions.DoQuery;
return tassign(state, {
query: tassign(a.query, { bbox: a.query.bboxFilter ? state.viewExtent : [] })});
query: tassign(state.query,
{
querystate: tassign(a.query, { bbox: a.query.bboxFilter ? state.viewExtent : [] }),
replace:a.replace
})
})
}
case mapActions.SETPERIOD: {
return tassign(state,{ period: action.period});
}
case mapActions.ADDFEATURESUCCESS: {
let a = action as mapActions.AddFeatureSuccess;
let features = state.features.slice();
@@ -462,6 +486,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
selectedFeature: null,
queryState: newQueryState,
clearEnabled: false,
layerValuesEnabled: false,
searchCollapsed: true,
searchMinified: false,
features: [],
@@ -484,6 +509,43 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
let a= action as mapActions.SetReplaceUrl;
return tassign(state,{replaceUrl:a.replaceUrl});
}
case mapActions.TOGGLELAYERVALUESENABLED: {
return tassign(state,{layerValuesEnabled:!state.layerValuesEnabled});
}
case mapActions.SETLAYERVALUESLOCATION: {
let a= action as mapActions.SetLayerValuesLocation;
return tassign(state,{layerValuesX: a.x, layerValuesY:a.y,layerValues:[]});
}
case mapActions.GETLAYERVALUESUCCESS:{
let a= action as mapActions.GetLayerValueSuccess;
let v = state.layerValues.slice(0);
v.push(a.layervalue);
return tassign(state,{layerValues:v});
}
case commonActions.ITEMDELETEDEVENT:{
let a= action as commonActions.ItemDeletedEvent;
if(state.selectedItem && state.selectedItem.code == a.itemCode) {
return tassign(state,{
selectedItem: null,
selectedItemLayer: null,
features:[]
});
}
if(state.features.length>0) {
var index = -1;
for (var i = 0; i < state.features.length; i++) {
if (state.features[i].getId() == a.itemCode ) {
index=i;
}
}
if(index>=0) {
let newFeatures = state.features.slice(0);
newFeatures.splice(index,1);
return tassign(state,{features:newFeatures});
}
}
return state;
}
default: {
return state;
}
@@ -515,6 +577,11 @@ export const getStyles = (state:State) => state.styles;
export const getShowLayerSwitcher = (state:State) => state.showLayerSwitcher;
export const getInSearch = (state:State) => state.inSearch;
export const getState = (state:State) => {return {mapState:state.mapState,queryState:state.queryState,replaceUrl:state.replaceUrl};}
export const getLayerValuesEnabled = (state:State) => state.layerValuesEnabled;
export const getLayerValues = (state:State) => state.layerValues;
export const getLayerValuesX = (state:State) => state.layerValuesX;
export const getLayerValuesY = (state:State) => state.layerValuesY;
export const selectMapState = createFeatureSelector<State>(MODULE_NAME);
export const selectGetMapState= createSelector(selectMapState, getMapState);
@@ -542,5 +609,9 @@ export const selectGetStyles = createSelector(selectMapState, getStyles);
export const selectGetShowLayerSwitcher = createSelector(selectMapState,getShowLayerSwitcher);
export const selectGetInSearch = createSelector(selectMapState,getInSearch);
export const selectGetState = createSelector(selectMapState,getState);
export const selectGetLayerValuesEnabled = createSelector(selectMapState,getLayerValuesEnabled);
export const selectGetLayerValues = createSelector(selectMapState,getLayerValues);
export const selectGetLayerValuesX = createSelector(selectMapState,getLayerValuesX);
export const selectGetLayerValuesY = createSelector(selectMapState,getLayerValuesY);

View File

@@ -9,14 +9,14 @@ import { Observer, Observable,BehaviorSubject } from 'rxjs';
@Injectable()
export class GeolocationService {
private positionObserver$:BehaviorSubject<Position> = new BehaviorSubject<Position>(null);
private positionObserver$:BehaviorSubject<GeolocationPosition> = new BehaviorSubject<GeolocationPosition>(null);
constructor() {
navigator.geolocation.watchPosition(
(position: Position) => {
(position: GeolocationPosition) => {
this.positionObserver$.next(position);
},
(error: PositionError) => {
(error: GeolocationPositionError) => {
console.debug('Geolocation service: ' + error.message);
},
{
@@ -28,7 +28,7 @@ export class GeolocationService {
}
getCurrentPosition(): Observable<Position> {
getCurrentPosition(): Observable<GeolocationPosition> {
return this.positionObserver$;
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@farmmaps/common-map3d",
"version": "0.0.1",
"version": "1.0.0",
"publishConfig": {
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
},

View File

@@ -1 +1 @@
<div *fm-haspackage="'vnd.farmmaps.package.3d'" (click)="handleClick($event)" class="btn btn-outline-primary twotreed"><i class="fas fa-spinner fa-spin loading" [class]="{'loading':loading}"></i>{{label}}</div>
<div *fmHasPackage="'vnd.farmmaps.itemtype.package.3d'" (click)="handleClick($event)" class="btn btn-outline-primary twotreed"><i class="fas fa-spinner fa-spin loading" [ngClass]="{'loading':loading}"></i>{{label}}</div>

View File

@@ -32,6 +32,7 @@ export class Switch2D3DComponent {
this.loading=false;
return this.synchronizers;
}, stopOpenLayersEventsPropagation:true});
this.ol3d.warmUp(3000,5000);
}
synchronize() {

View File

@@ -1,5 +1,27 @@
{
"name": "@farmmaps/common",
"version": "0.0.1",
"lockfileVersion": 1
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"is-retina": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/is-retina/-/is-retina-1.0.3.tgz",
"integrity": "sha1-10AbKGvqKuN/Ykd1iN5QTQuGR+M="
},
"ngx-avatar": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/ngx-avatar/-/ngx-avatar-4.0.0.tgz",
"integrity": "sha512-Uk40UXl26RvDy1ori9NDsGFB+f84AaxMnsIwZA6JPJK0pLcbo3F4vZTmzLZeOusOw1Qtgk5IzF630jo06keXwQ==",
"requires": {
"is-retina": "^1.0.3",
"ts-md5": "^1.2.4"
}
},
"ts-md5": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/ts-md5/-/ts-md5-1.2.7.tgz",
"integrity": "sha512-emODogvKGWi1KO1l9c6YxLMBn6CEH3VrH5mVPIyOtxBG52BvV4jP3GWz6bOZCz61nLgBc3ffQYE4+EHfCD+V7w=="
}
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@farmmaps/common",
"version": "0.0.1",
"version": "1.0.0",
"publishConfig": {
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
},
@@ -17,6 +17,9 @@
"@microsoft/signalr": "^3.1.3",
"ngx-uploadx": "^3.3.4",
"angular-oauth2-oidc": "^10.0.3",
"moment": "^2.27.0"
"moment": "^2.27.0",
"ngx-avatar": "^4.0.0",
"ngx-image-cropper": "^3.3.5",
"ngx-clipboard": "^14.0.1"
}
}

View File

@@ -39,6 +39,8 @@ export const TASKPROGRESSEVENT = '[AppCommon] TaskProgressEvent';
export const DEVICEUPDATEEVENT = '[AppCommon] DeviceUpdateEvent';
export const NOTIFICATIONEVENT = '[AppCommon] NotificationEvent';
export const DELETEITEMS = '[AppCommon] DeleteItems';
export const DELETEITEMSSUCCESS = '[AppCommon] DeleteItemsSuccess';
@@ -62,6 +64,10 @@ export const TOGGLEACCOUNTMENU = '[AppCommon] ToggleAccountMenu';
export const TOGGLEAPPMENU = '[AppCommon] ToggleAppMenu';
export const TOGGLENOTIFICATIONMENU = '[AppCommon] ToggleNotificationMenu';
export const TOGGLEHELPMENU = '[AppCommon] ToggleHelpMenu';
export const SETMENUVISIBLE = '[AppCommon] SetMenuVisible';
export const ONLINE = '[AppCommon] Online';
@@ -70,6 +76,8 @@ export const OFFLINE = '[AppCommon] Offline';
export const SETPAGEMODE = '[AppCommon] SetPageMode';
export const SETUNREADNOTIFICATIONS = '[AppCommon] SetUnreadNotifications';
export class InitUser implements Action {
readonly type = INITUSER;
@@ -232,6 +240,12 @@ export class DeviceUpdateEvent implements Action {
constructor(public itemCode: string, public attributes: any) { }
}
export class NotificationEvent implements Action {
readonly type = NOTIFICATIONEVENT;
constructor(public attributes: any) { }
}
export class DeleteItems implements Action {
readonly type = DELETEITEMS;
@@ -291,6 +305,18 @@ export class ToggleAppMenu implements Action {
constructor() { }
}
export class ToggleNotificationMenu implements Action {
readonly type = TOGGLENOTIFICATIONMENU;
constructor() { }
}
export class ToggleHelpMenu implements Action {
readonly type = TOGGLEHELPMENU;
constructor() { }
}
export class SetMenuVisible implements Action {
readonly type = SETMENUVISIBLE;
@@ -315,6 +341,13 @@ export class SetPageMode implements Action {
constructor(public pageMode:boolean) {}
}
export class SetUnreadNotifications implements Action {
readonly type = SETUNREADNOTIFICATIONS;
constructor(public unread:number) {}
}
export type Actions = OpenModal
| InitRoot
@@ -355,6 +388,10 @@ export type Actions = OpenModal
| Online
| Offline
| SetPageMode
| ToggleAppMenu;
| ToggleAppMenu
| ToggleNotificationMenu
| ToggleHelpMenu
| NotificationEvent
| SetUnreadNotifications;

View File

@@ -16,12 +16,15 @@ 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 { ImageService } from './services/image.service';
import { GeolocatorService } from './services/geolocator.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 { PackageGuard } from './services/package-guard.service';
import { FullScreenGuard } from './services/full-screen-guard.service';
import { AuthCallbackGuard } from './components/auth-callback/auth-callback.guard';
import { ResumableFileUploadService } from './components/resumable-file-upload/resumable-file-upload.service';
@@ -41,11 +44,14 @@ export {
EventService,
TypeaheadService,
UserService,
ImageService,
GeolocatorService,
WeatherService,
AppConfig,
AccessTokenInterceptor,
AuthGuard,
NavBarGuard,
PackageGuard,
FullScreenGuard,
AuthCallbackGuard,
ResumableFileUploadService,

View File

@@ -10,6 +10,7 @@ import { StoreModule, Store } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { UploadxModule } from 'ngx-uploadx';
import { ClipboardModule } from 'ngx-clipboard';
// routing module
@@ -33,6 +34,7 @@ import { MenuBackgroundComponent } from './components/menu-background/menu-backg
import { HasPackageDirective} from './components/has-package/has-package.directive';
import { HasClaimDirective} from './components/has-claim/has-claim.directive';
import { UserMenuComponent} from './components/user-menu/user-menu.component';
import { ThumbnailComponent } from './components/thumbnail/thumbnail.component';
import { Alert } from './enumerations/alert.enum';
import { IEventMessage } from './models/event.message';
import { IItem, Item } from './models/item';
@@ -56,7 +58,14 @@ import { SecureOAuthStorage} from './shared/secureOAuthStorage';
import { GradientComponent } from './components/gradient/gradient.component';
import { GradientSelectComponent } from './components/gradient-select/gradient-select.component';
import { AppMenuComponent } from './components/app-menu/app-menu.component';
import { NotificationMenuComponent} from './components/notification-menu/notification-menu.component';
import { HelpMenuComponent} from './components/help-menu/help-menu.component';
import { BackButtonComponent } from './components/back-button/back-button.component';
import { EditImageModalComponent } from './components/edit-image-modal/edit-image-modal.component';
import { AvatarComponent } from './components/avatar/avatar.component';
import { AvatarModule } from 'ngx-avatar';
import { ImageCropperModule } from 'ngx-image-cropper';
export {
SafePipe,
@@ -70,6 +79,7 @@ export {
TimespanComponent,
TagInputComponent,
UserMenuComponent,
ThumbnailComponent,
HasPackageDirective,
HasClaimDirective,
Alert,
@@ -98,7 +108,9 @@ export {
IDataLayer,
IColor,
IGradientstop,
BackButtonComponent
BackButtonComponent,
AvatarComponent,
EditImageModalComponent
};
@NgModule({
@@ -111,7 +123,10 @@ export {
OAuthModule.forRoot(),
NgbModule,
FormsModule,
UploadxModule
UploadxModule,
ClipboardModule,
AvatarModule,
ImageCropperModule
],
declarations: [
AppComponent,
@@ -131,11 +146,17 @@ export {
GradientComponent,
GradientSelectComponent,
AppMenuComponent,
BackButtonComponent
NotificationMenuComponent,
HelpMenuComponent,
BackButtonComponent,
ThumbnailComponent,
EditImageModalComponent,
AvatarComponent
],
exports: [
NgbModule,
UploadxModule,
ClipboardModule,
CommonModule,
AppComponent,
ResumableFileUploadComponent,
@@ -154,7 +175,10 @@ export {
UserMenuComponent,
GradientComponent,
GradientSelectComponent,
BackButtonComponent
BackButtonComponent,
ThumbnailComponent,
AvatarComponent,
EditImageModalComponent
]
})
export class AppCommonModule {

View File

@@ -1,8 +1,8 @@
<div>
<div (click)="toggle($event)" class="rounded-circle menu-button hidden" [ngClass]="{'hidden':!user}">
<div (click)="toggle($event)" class="rounded-circle menu-button hidden" [ngClass]="{'hidden':!user || noContent}">
<span i18n-title title="Apps"><i class="fas fa-th" aria-hidden="true"></i></span>
<div class="menu hidden" [ngClass]="{'hidden':!showMenu}">
<router-outlet name="app-menu"></router-outlet>
<router-outlet name="app-menu" (activate)="activateRoute()" (deactivate)="deActivateRoute()"></router-outlet>
</div>
</div>
</div>

View File

@@ -1,6 +1,5 @@
import { Component, OnInit, Input } from '@angular/core';
import { IUser } from '../../models/user';
import {Store} from '@ngrx/store';
import * as appReducers from '../../reducers/app-common.reducer';
@@ -15,6 +14,7 @@ export class AppMenuComponent implements OnInit {
@Input() user:IUser;
@Input() showMenu:boolean;
public noContent: boolean = true;
constructor(private store: Store<appReducers.State>) { }
@@ -26,4 +26,12 @@ export class AppMenuComponent implements OnInit {
this.store.dispatch(new appActions.ToggleAppMenu());
}
activateRoute() {
this.noContent=false;
}
deActivateRoute() {
this.noContent=true;
}
}

View File

@@ -31,6 +31,8 @@
<fm-resumable-file-upload></fm-resumable-file-upload>
</ng-container>
<div class="user-menu apponly">
<fm-help-menu [user]="user|async" [showMenu]="helpMenuVisible|async"></fm-help-menu>
<fm-notification-menu [user]="user|async" [unread]="unreadNotifications|async" [showMenu]="notificationMenuVisible|async"></fm-notification-menu>
<fm-app-menu [user]="user|async" [showMenu]="appMenuVisible|async"></fm-app-menu>
<fm-user-menu [user]="user|async" [showMenu]="accountMenuVisible|async"></fm-user-menu>
</div>

View File

@@ -125,7 +125,7 @@ body { background: #f1f1f1; line-height: 18px; user-select:none;font-family: Lat
max-height:0em;
}
fm-app-menu,fm-user-menu {
fm-help-menu,fm-app-menu,fm-user-menu,fm-notification-menu {
display: inline-block;
margin-left: 1rem;
}

View File

@@ -43,6 +43,9 @@ export class AppComponent implements OnInit, OnDestroy {
public menuVisible: Observable<boolean> = this.store$.select(appReducers.SelectGetMenuVisible);
public accountMenuVisible: Observable<boolean> = this.store$.select(appReducers.SelectGetAccountMenuVisible);
public appMenuVisible: Observable<boolean> = this.store$.select(appReducers.SelectGetAppMenuVisible);
public notificationMenuVisible: Observable<boolean> = this.store$.select(appReducers.SelectGetNotificationMenuVisible);
public helpMenuVisible: Observable<boolean> = this.store$.select(appReducers.SelectGetHelpMenuVisible);
public unreadNotifications: Observable<number> = this.store$.select(appReducers.SelectgetUnreadNotifications);
public user: Observable<IUser> = this.store$.select(appReducers.SelectGetUser);
public isPageMode: Observable<boolean> = this.store$.select(appReducers.SelectGetIsPageMode);
@Input() showUploadProgress: boolean = true;
@@ -98,6 +101,14 @@ export class AppComponent implements OnInit, OnDestroy {
action = new commonActions.DeviceUpdateEvent(event.itemCode, event.attributes);
break;
}
case "notification": {
action = new commonActions.NotificationEvent(event.attributes);
break;
}
case "DeleteUser": {
action = new commonActions.Logout();
break;
}
}
return action;
}

View File

@@ -0,0 +1,14 @@
.avatar-container {
position: relative;
}
.avatar-text {
position: absolute;
top: 25px;
left: 10px;
bottom: 20px;
right: 20px;
color: white;
padding-left: 20px;
padding-right: 20px;
}

View File

@@ -0,0 +1,10 @@
<span class="avatar-container" [title]="name">
<ngx-avatar
class="farmmaps-avatar"
[src]="src"
[name]="name"
[size]="size"
[round]='true'
>
</ngx-avatar>
</span>

View File

@@ -1,20 +1,20 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { BackButtonComponent } from './back-button.component';
import { AvatarComponent } from './avatar.component';
describe('BackButtonComponent', () => {
let component: BackButtonComponent;
let fixture: ComponentFixture<BackButtonComponent>;
describe('AvatarComponent', () => {
let component: AvatarComponent;
let fixture: ComponentFixture<AvatarComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ BackButtonComponent ]
declarations: [ AvatarComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(BackButtonComponent);
fixture = TestBed.createComponent(AvatarComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

View File

@@ -0,0 +1,48 @@
import { Component, EventEmitter, Input, OnInit, Output, SimpleChanges } from '@angular/core';
import { IUser } from '../../models/user';
import { AppConfig } from '../../shared/app.config';
@Component({
selector: 'fm-avatar',
templateUrl: './avatar.component.html',
styleUrls: ['./avatar.component.css']
})
export class AvatarComponent implements OnInit {
@Input() user: IUser;
@Input() bgColor: string;
@Input() fgColor: string;
@Input() size: number = 75;
@Input() round: boolean = true;
@Output() click = new EventEmitter();
src : string = null;
name : string = null;
constructor(private appConfig: AppConfig) {
}
ngOnInit(): void {
}
ngOnChanges(changes: SimpleChanges): void {
if (changes['user']) {
const user: IUser = changes['user'].currentValue;
this.refresh(user);
}
}
onClick(event: MouseEvent) {
event.stopPropagation();
this.click.emit();
}
refresh(user: IUser) {
if (!user) return null;
const apiEndpoint = this.appConfig.getConfig("apiEndPoint");
this.src = `${apiEndpoint}/api/v1/users/${user.code}/avatar`;
this.name = user.firstName && user.lastName ?
user.firstName + ' ' + user.lastName : user.name;
}
}

View File

@@ -0,0 +1,36 @@
<ng-template #upload_modal let-modal>
<div class="modal-header">
<h4 class="modal-title" i18n>Edit image</h4>
<button type="button" class="close" aria-label="Close" (click)="modal.dismiss('Cross click')">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="cropper">
<div *ngIf="!isImageLoaded" class="no-image" (click)="fileInput.click()">
<i class="fal fa-image"></i>
<div i18n>No image selected</div>
</div>
<image-cropper #imageCropper
[imageChangedEvent]="imageChangedEvent"
[maintainAspectRatio]="true"
[format]="imageType"
[aspectRatio]="aspectRatio"
[autoCrop]="true"
[resizeToWidth]="maxWidth"
[roundCropper]="roundImage"
(imageCropped)="imageCropped($event)"
(imageLoaded)="imageLoaded($event)"
(cropperReady)="cropperReady()"
(loadImageFailed)="loadImageFailed()"
[imageURL]="imageUrl"
></image-cropper>
</div>
<input #fileInput type="file" (change)="fileChangeEvent($event)" style="display:none" accept="image/*"/>
<span class="btn btn-primary" (click)="fileInput.click()" i18n>Select image</span>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" i18n [disabled]="!isImageLoaded" (click)="save()">Apply</button>
<button type="button" autofocus class="btn btn-secondary" (click)="modal.close('Save click')" i18n="@@buttonCancel">Cancel</button>
</div>
</ng-template>

View File

@@ -0,0 +1,13 @@
.cropper {
position: relative;
height: calc(60vh);
}
.no-image {
text-align: center;
}
.no-image i {
font-size: calc(50vh);
color: gray;
}

View File

@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { EditImageModalComponent } from './edit-image-modal.component';
describe('EditImageModalComponent', () => {
let component: EditImageModalComponent;
let fixture: ComponentFixture<EditImageModalComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ EditImageModalComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(EditImageModalComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,73 @@
import { Component, OnInit,ViewChild,ElementRef,EventEmitter, Output } from '@angular/core';
import { HttpClient, HttpParams,HttpHeaders } from "@angular/common/http";
import {NgbModal} from "@ng-bootstrap/ng-bootstrap"
import { ImageCroppedEvent,LoadedImage } from 'ngx-image-cropper';
import {ImageService } from '../../services/image.service';
@Component({
selector: 'fm-edit-image-modal',
templateUrl: './edit-image-modal.component.html',
styleUrls: ['./edit-image-modal.component.scss']
})
export class EditImageModalComponent implements OnInit {
@Output() changed = new EventEmitter();
@ViewChild('upload_modal') modal:ElementRef;
constructor(private modalService: NgbModal,public imageService:ImageService) { }
isImageLoaded:boolean = false;
aspectRatio:number = 4/3;
imageChangedEvent: any = '';
croppedImage: string = '';
endpointUrl:string = null;
imageUrl:string = null;
maxWidth:number = 200;
roundImage:boolean = false;
imageType:string = "jpeg";
saveImage:boolean = true;
ngOnInit(): void {
}
open(endpoint:string,aspectRatio:number,roundImage?:boolean,maxWidth?:number,saveImage?:boolean, imageType?:string) {
this.endpointUrl = endpoint;
this.imageUrl = endpoint;
this.aspectRatio= aspectRatio;
this.roundImage = roundImage === undefined?this.roundImage:roundImage;
this.maxWidth = maxWidth === undefined?this.maxWidth:maxWidth;
this.imageType = imageType === undefined?this.imageType:imageType.substr(6);
this.saveImage = saveImage === undefined?this.saveImage:saveImage;
this.modalService.open(this.modal,{ size: 'lg' });
}
fileChangeEvent(event: any): void {
this.imageChangedEvent = event;
}
imageCropped(event: ImageCroppedEvent) {
this.croppedImage = event.base64;
}
imageLoaded(image: LoadedImage) {
this.isImageLoaded=true;
}
cropperReady() {
// cropper ready
}
loadImageFailed() {
// show message
}
save() {
if(this.croppedImage) {
var blob = this.imageService.dataUrltoBlob(this.croppedImage);
if(this.saveImage) {
this.imageService.putImage(this.endpointUrl,blob).subscribe(() => {
this.changed.emit({});
});
} else {
this.changed.emit({ "croppedImage": this.imageService.blobToFile(blob,"croppedimage.jpg")} );
}
this.modalService.dismissAll("Save");
}
}
}

View File

@@ -5,29 +5,54 @@ import { IPackages } from '../../models/package';
import { Observable, Subscription } from 'rxjs';
@Directive({
selector: '[fm-haspackage]',
selector: '[fmHasPackage]',
})
export class HasPackageDirective implements OnInit,OnDestroy{
@Input('fm-haspackage') package:string;
constructor(private templateRef$: TemplateRef<any>,private viewContainerRef$: ViewContainerRef,private store$: Store<appCommonReducer.State>) { }
private packages$:Observable<IPackages> = this.store$.select(appCommonReducer.SelectGetUserPackages);
private hasView = false;
private packSub:Subscription;
ngOnInit() {
this.packages$.subscribe((packages) => {
const today = new Date(new Date(Date.now()).toUTCString()).setHours(0,0,0,0);
if (packages[this.package] &&
packages[this.package].enabled &&
(packages[this.package].dataDate && new Date(packages[this.package].dataDate).setHours(0, 0, 0, 0) <= today) &&
(packages[this.package].dataEndDate == null || new Date(packages[this.package].dataEndDate).setHours(0, 0, 0, 0) >= today)) {
this.viewContainerRef$.createEmbeddedView(this.templateRef$);
this.hasView=true;
} else if (this.hasView) {
this.viewContainerRef$.clear();
this.hasView = false;
export class HasPackageDirective implements OnDestroy{
@Input()
set fmHasPackage(packageIdentifier:string) {
this.packageIdentifier$ = packageIdentifier;
this.updateView();
}
@Input()
set fmHasPackageThen(thenTemplate:TemplateRef<any>) {
this.thenTemplate$ = thenTemplate;
this.updateView();
}
@Input()
set fmHasPackageElse(thenTemplate:TemplateRef<any>) {
this.elseTemplate$ = thenTemplate;
this.updateView();
}
private packageIdentifier$:string;
private thenTemplate$:TemplateRef<any>;
private elseTemplate$:TemplateRef<any>;
private packages$:any = {};
private packagesObservable$:Observable<IPackages> = this.store$.select(appCommonReducer.SelectGetUserPackages);
private packSub:Subscription;
constructor(private templateRef$: TemplateRef<any>,private viewContainerRef$: ViewContainerRef,private store$: Store<appCommonReducer.State>) {
this.thenTemplate$=templateRef$;
this.packSub = this.store$.select(appCommonReducer.SelectGetUserPackages).subscribe((packages) => {
this.packages$ = packages;
this.updateView();
});
this.updateView();
}
updateView() {
this.viewContainerRef$.clear();
const today = new Date(new Date(Date.now()).toUTCString()).setHours(0, 0, 0, 0);
if (this.packages$[this.packageIdentifier$] &&
(this.packages$[this.packageIdentifier$].dataDate && new Date(this.packages$[this.packageIdentifier$].dataDate).setHours(0, 0, 0, 0) <= today) &&
(this.packages$[this.packageIdentifier$].dataEndDate == null || new Date(this.packages$[this.packageIdentifier$].dataEndDate).setHours(0, 0, 0, 0) >= today)) {
this.viewContainerRef$.createEmbeddedView(this.thenTemplate$);
} else if (this.elseTemplate$) {
this.viewContainerRef$.createEmbeddedView(this.elseTemplate$);
}
}
ngOnDestroy() {

View File

@@ -0,0 +1,8 @@
<div>
<div (click)="toggle($event)" class="rounded-circle menu-button hidden" [ngClass]="{'hidden':!user || noContent}">
<span i18n-title title="Help"><i class="fas fa-question" aria-hidden="true"></i></span>
<div class="menu hidden" [ngClass]="{'hidden':!showMenu}">
<router-outlet name="help-menu" (activate)="activateRoute()" (deactivate)="deActivateRoute()"></router-outlet>
</div>
</div>
</div>

View File

@@ -0,0 +1,80 @@
.menu-button {
background-color: gray;
display: inline-block;
width: 2.5em;
height: 2.5em;
line-height: 2.5em;
text-align: center;
font-size: 1rem;
position: relative;
}
div.menu-button > span {
color:white;
}
.menu {
max-height: calc( 100vh - 4rem);
//transition: max-height 0.2s;
overflow: hidden;
box-shadow: 0 0 20px rgba(0,0,0,.3);
position: fixed;
top: 3.4rem;
right:0.5rem;
left:0.5rem;
background-color: #fff;
border-radius: 0.25rem;
padding: 0.5rem;
z-index: 3;
}
:host-context(.fullscreen) .menu {
top:4em;
}
.card {
padding:0.5rem;
min-width: 10rem;
}
.card-body {
text-align: left;
}
.hidden {
max-height: 0;
}
.menu.hidden {
padding: 0;
}
.menu-button.hidden {
overflow: hidden;
}
@media screen and (min-width: 44rem) {
.menu {
position: absolute;
top: 3rem;
right:0;
left: unset;
max-width: 30em;
}
:host-context(.fullscreen) .menu {
top: 3rem;
}
}
.unread {
display: block;
position: absolute;
top:-0.5em;
right: -0.5em;
}
.unread.hidden {
display: none;
}

View File

@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HelpMenuComponent } from './help-menu.component';
describe('HelpMenuComponent', () => {
let component: HelpMenuComponent;
let fixture: ComponentFixture<HelpMenuComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ HelpMenuComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HelpMenuComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,37 @@
import { Input } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { IUser } from '../../models/user';
import {Store} from '@ngrx/store';
import * as appReducers from '../../reducers/app-common.reducer';
import * as appActions from '../../actions/app-common.actions';
@Component({
selector: 'fm-help-menu',
templateUrl: './help-menu.component.html',
styleUrls: ['./help-menu.component.scss']
})
export class HelpMenuComponent implements OnInit {
@Input() user:IUser;
@Input() showMenu:boolean;
public noContent: boolean = true;
constructor(private store: Store<appReducers.State>) { }
ngOnInit(): void {
}
toggle(event:MouseEvent) {
event.stopPropagation();
this.store.dispatch(new appActions.ToggleHelpMenu());
}
activateRoute() {
this.noContent=false;
}
deActivateRoute() {
this.noContent=true;
}
}

View File

@@ -0,0 +1,10 @@
<div>
<div (click)="toggle($event)" class="rounded-circle menu-button hidden" [ngClass]="{'hidden':!user || noContent}">
<span class="unread badge bg-info notification rounded-pill hidden" [ngClass]="{'hidden':unread==0}">{{unread}}</span>
<span i18n-title title="Notifications"><i class="fas fa-bell" [ngClass]="{'fa-bell-on':unread!=0}" aria-hidden="true"></i></span>
<div class="menu hidden" [ngClass]="{'hidden':!showMenu}">
<router-outlet name="notification-menu" (activate)="activateRoute()" (deactivate)="deActivateRoute()"></router-outlet>
</div>
</div>
</div>

View File

@@ -0,0 +1,80 @@
.menu-button {
background-color: gray;
display: inline-block;
width: 2.5em;
height: 2.5em;
line-height: 2.5em;
text-align: center;
font-size: 1rem;
position: relative;
}
div.menu-button > span {
color:white;
}
.menu {
max-height: calc( 100vh - 4rem);
//transition: max-height 0.2s;
overflow: hidden;
box-shadow: 0 0 20px rgba(0,0,0,.3);
position: fixed;
top: 3.4rem;
right:0.5rem;
left:0.5rem;
background-color: #fff;
border-radius: 0.25rem;
padding: 0.5rem;
z-index: 3;
}
:host-context(.fullscreen) .menu {
top:4em;
}
.card {
padding:0.5rem;
min-width: 10rem;
}
.card-body {
text-align: left;
}
.hidden {
max-height: 0;
}
.menu.hidden {
padding: 0;
}
.menu-button.hidden {
overflow: hidden;
}
@media screen and (min-width: 44rem) {
.menu {
position: absolute;
top: 3rem;
right:0;
left: unset;
max-width: 30em;
}
:host-context(.fullscreen) .menu {
top: 3rem;
}
}
.unread {
display: block;
position: absolute;
top:-0.5em;
right: -0.5em;
}
.unread.hidden {
display: none;
}

View File

@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NotificationMenuComponent } from './notification-menu.component';
describe('NotificationMenuComponent', () => {
let component: NotificationMenuComponent;
let fixture: ComponentFixture<NotificationMenuComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ NotificationMenuComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(NotificationMenuComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,38 @@
import { Component, OnInit, Input } from '@angular/core';
import { IUser } from '../../models/user';
import {Store} from '@ngrx/store';
import * as appReducers from '../../reducers/app-common.reducer';
import * as appActions from '../../actions/app-common.actions';
@Component({
selector: 'fm-notification-menu',
templateUrl: './notification-menu.component.html',
styleUrls: ['./notification-menu.component.scss']
})
export class NotificationMenuComponent implements OnInit {
@Input() unread:number;
@Input() user:IUser;
@Input() showMenu:boolean;
public noContent: boolean = true;
constructor(private store: Store<appReducers.State>) { }
ngOnInit(): void {
}
toggle(event:MouseEvent) {
event.stopPropagation();
this.store.dispatch(new appActions.ToggleNotificationMenu());
}
activateRoute() {
this.noContent=false;
}
deActivateRoute() {
this.noContent=true;
}
}

View File

@@ -109,7 +109,10 @@ export class ResumableFileUploadService implements OnDestroy{
};
doClose = function () {
this.uploadService.control({action:'cancelAll'});
var toCancel = this.files.filter((f) => !f.success);
toCancel.forEach(f => {
this.uploadService.control({action:'cancel',uploadId:f.identifier});
});
this.files = new Array<File>();
this.isClosed = true;
}

View File

@@ -7,6 +7,7 @@
transition: left 0.2s, top 0.2s;
background-color: white;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
pointer-events: all;
}
.side-panel.resizing {

View File

@@ -0,0 +1,9 @@
<div #thumbnail class="thumbnail" [style.background-color]="itemTypeService.getColor(item.itemType)" >
<div class="content">
<img *ngIf="hasThumbnail()" class="card-img-top" [src]="getThumbnailUrl(item)" />
<div *ngIf="!hasThumbnail()" class="large-icon" [style.font-size]="getFontSize()" [style.line-height]="getLineHeight()"><i [ngClass]="itemTypeService.getIcon(item.itemType)"></i></div>
<div *ngIf="canEdit()" class="edit btn btn-secondary rounded-circle" (click)="onEditClick()"><i class="fal fa-camera"></i></div>
</div>
</div>
<fm-edit-image-modal #modal (changed)="onChanged($event)"></fm-edit-image-modal>

View File

@@ -0,0 +1,28 @@
.thumbnail {
width: 100%;
position: relative;
padding-top: 75%;
}
.content {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
text-align: center;
}
.large-icon i {
color: white;
}
.edit {
position: absolute;
bottom: 1rem;
right: 1rem;
width: 2.5rem;
height: 2.5rem;
padding: 0;
line-height: 2.5rem;
}

View File

@@ -0,0 +1,86 @@
import { Component,Input ,ViewChild,ElementRef,ChangeDetectorRef, Output,EventEmitter} from '@angular/core';
import { Store } from '@ngrx/store';
import { IListItem } from '../../models/list.item';
import { ImageService } from '../../services/image.service';
import { commonReducers,ItemTypeService } from '../../../public-api'
import { EditImageModalComponent} from '../edit-image-modal/edit-image-modal.component';
import { AppConfig } from "../../shared/app.config";
@Component({
selector: 'fm-thumbnail',
templateUrl: 'thumbnail.component.html',
styleUrls: ['thumbnail.component.scss']
})
export class ThumbnailComponent {
@Input() public item: IListItem;
@Input() public edit: boolean = false;
@Input() public save: boolean = true;
@Output() changed = new EventEmitter();
@ViewChild('thumbnail') el:ElementRef;
@ViewChild('modal') modal:EditImageModalComponent;
public image = null;
private endpoint = "";
public thumnailUrl = "";
constructor(public store: Store<commonReducers.State>, public itemTypeService: ItemTypeService,public appConfig: AppConfig,private changeDetector:ChangeDetectorRef,public imageService:ImageService) {
}
getThumbnailUrl(item:IListItem):string {
if(this.image == null && this.item.thumbnail) {
this.thumnailUrl = this.appConfig.getConfig("apiEndPoint")+item.url+'/thumbnail?v=' + Date.parse(item.updated);
} else if (this.image == null) {
this.thumnailUrl = "";
}
return this.thumnailUrl;
}
getFontSize():string {
if(this.el) {
var h = this.el.nativeElement.offsetHeight - (this.el.nativeElement.offsetHeight / 5 )
return h + "px";
} else {
return "1em";
}
}
getLineHeight():string {
if(this.el) {
return this.el.nativeElement.offsetHeight + "px";
} else {
return "1em";
}
}
canEdit():boolean {
return this.edit && this.item != null;
}
hasThumbnail():boolean {
return (this.item && this.item.thumbnail) || this.image != null;
}
onEditClick() {
this.endpoint = `${this.appConfig.getConfig("apiEndPoint")}/api/v1/items/${this.item.code}/thumbnail`;
this.modal.open(this.endpoint,4/3,false,200,false);
}
onChanged(event:any) {
this.image = event.croppedImage;
this.imageService.blobToDataUrl(event.croppedImage).then(url => {
this.thumnailUrl = url
this.changeDetector.detectChanges();
if(this.save) this.saveImage();
this.changed.emit(event.croppedImage);
});
}
saveImage() {
if(this.image) {
this.imageService.putImage(this.endpoint,this.image).subscribe(() => {});
}
}
}

View File

@@ -1,6 +1,6 @@
<div>
<div (click)="toggle($event)" class="rounded-circle menu-button hidden" [ngClass]="{'hidden':!user}">
<span *ngIf="user"><span [title]="user.name">{{getLetter()}}</span></span>
<span *ngIf="user"><fm-avatar [user]="user" size="40"></fm-avatar></span>
<div class="menu hidden" [ngClass]="{'hidden':!showMenu}">
<div class="card" *ngIf="user">
<div class="card-body">

View File

@@ -1,5 +1,4 @@
.menu-button {
background-color: purple;
display: inline-block;
width: 2.5em;
height: 2.5em;

View File

@@ -21,6 +21,9 @@ export class UserMenuComponent implements OnInit {
}
getLetter():string {
if (this.user && this.user.firstName && this.user.lastName)
return this.user.firstName.substr(0,1).toUpperCase() +
this.user.lastName.substr(0,1).toUpperCase();
return this.user && this.user.name ? this.user.name.substr(0,1).toUpperCase():"";
}

View File

@@ -1,9 +1,9 @@
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { OAuthService,UserInfo } from 'angular-oauth2-oidc';
import { Store, Action } from '@ngrx/store';
import { Effect, Actions,ofType } from '@ngrx/effects';
import { Observable , defer , of,from,zip } from 'rxjs';
import { Store } from '@ngrx/store';
import { Actions,ofType,createEffect } from '@ngrx/effects';
import { of,from,zip } from 'rxjs';
import { withLatestFrom,mergeMap,switchMap,map,catchError,first} from 'rxjs/operators';
import * as appCommonActions from '../actions/app-common.actions';
import * as appCommonReducers from '../reducers/app-common.reducer';
@@ -12,43 +12,37 @@ import { FolderService } from '../services/folder.service';
import { UserService } from '../services/user.service';
import { IItemTypes } from '../models/item.types';
import { IListItem } from '../models/list.item';
import { IUser } from '../models/user';
import {IQueryState} from '../models/query.state';
import {StateSerializerService} from '../services/state-serializer.service';
@Injectable()
export class AppCommonEffects {
@Effect({ dispatch: false })
login$: Observable<Action> = this.actions$.pipe(
login$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.LOGIN),
withLatestFrom(this.store$.select(appCommonReducers.selectGetInitialized)),
mergeMap(([action, initialized]) => {
var a = (action as appCommonActions.Login);
this.oauthService$.initCodeFlow(a.url,{"prompt":"login"});
return [];
}));
})),{dispatch:false});
@Effect({ dispatch: false })
logout$: Observable<Action> = this.actions$.pipe(
logout$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.LOGOUT),
mergeMap((action) => {
this.oauthService$.revokeTokenAndLogout();
return [];
}));
})),{dispatch:false});
@Effect()
loadItemTypes$: Observable<Action> = this.actions$.pipe(
loadItemTypes$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.LOADITEMTYPES),
switchMap((action) => {
return this.itemService$.getItemTypes().pipe(
map((itemTypes: IItemTypes) => new appCommonActions.LoadItemTypesSuccess(itemTypes)),
catchError(error => of(new appCommonActions.Fail(error))))
}
));
)));
@Effect()
initUser$: Observable<Action> = this.actions$.pipe(
initUser$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.INITUSER),
first(),
switchMap((action) => {
@@ -56,11 +50,10 @@ export class AppCommonEffects {
switchMap(([user,userInfo]) => {return of(new appCommonActions.InitUserSuccess(user,userInfo as UserInfo))} ),
catchError(error => of(new appCommonActions.Fail(error))))
}
));
)));
@Effect()
initUserPackages$:Observable<Action> = this.actions$.pipe(
initUserPackages$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.INITUSERPACKAGES),
switchMap(() => {
return this.itemService$.getItemList('vnd.farmmaps.itemtype.package').pipe(
@@ -68,10 +61,9 @@ export class AppCommonEffects {
catchError(error => of(new appCommonActions.Fail(error)))
)
})
);
));
@Effect()
userPackagesChanged$:Observable<Action> = this.actions$.pipe(
userPackagesChanged$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.ITEMCHANGEDEVENT),
switchMap((action) => {
let a = action as appCommonActions.ItemChangedEvent;
@@ -80,10 +72,9 @@ export class AppCommonEffects {
else
return [];
})
);
));
@Effect()
initUserSettingsRoot$:Observable<Action> = this.actions$.pipe(
initUserSettingsRoot$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.INITUSERSETTINGSROOT),
withLatestFrom(this.store$.select(appCommonReducers.SelectGetUser)),
switchMap(([, user]) => {
@@ -92,10 +83,9 @@ export class AppCommonEffects {
catchError(error => of(new appCommonActions.Fail(error)))
)
})
);
));
@Effect()
initUserSettingsRootChanged$:Observable<Action> = this.actions$.pipe(
initUserSettingsRootChanged$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.ITEMCHANGEDEVENT),
switchMap((action) => {
let a = action as appCommonActions.ItemChangedEvent;
@@ -104,38 +94,34 @@ export class AppCommonEffects {
else
return [];
})
);
));
@Effect()
initUserSuccess$: Observable<Action> = this.actions$.pipe(
initUserSuccess$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.INITUSERSUCCESS),
switchMap(() => {
return [new appCommonActions.InitRoot(),new appCommonActions.InitUserPackages(),new appCommonActions.InitUserSettingsRoot()];
}
));
)));
@Effect()
initRoot$: Observable<Action> = this.actions$.pipe(
initRoot$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.INITROOT),
switchMap(() => {
return this.folderService$.getMyRoots().pipe(
map((folders: IListItem[]) => new appCommonActions.InitRootSuccess(folders)),
catchError(error => of(new appCommonActions.Fail(error))))
}
));
)));
@Effect()
deleteItems$: Observable<Action> = this.actions$.pipe(
deleteItems$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.DELETEITEMS),
switchMap((action:appCommonActions.DeleteItems) => {
return this.itemService$.deleteItems(action.itemCodes).pipe(
map((deletedItemCodes: string[]) => new appCommonActions.DeleteItemsSuccess(deletedItemCodes)),
catchError(error => of(new appCommonActions.Fail(error))))
}
));
)));
@Effect()
editItem$: Observable<Action> = this.actions$.pipe(
editItem$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.EDITITEM),
withLatestFrom(this.store$.select(appCommonReducers.selectGetItemTypes)),
switchMap(([action, itemtypes]) => {
@@ -148,10 +134,9 @@ export class AppCommonEffects {
this.router$.navigate(['/editor',editor,'item', a.item.code])
return [];
}
));
)));
@Effect()
viewItem$: Observable<Action> = this.actions$.pipe(
viewItem$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.VIEWITEM),
withLatestFrom(this.store$.select(appCommonReducers.selectGetItemTypes)),
switchMap(([action, itemtypes]) => {
@@ -181,20 +166,18 @@ export class AppCommonEffects {
}
return [];
}
));
)));
@Effect({ dispatch: false })
fail$: Observable<Action> = this.actions$.pipe(
fail$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.FAIL),
map((action) => {
let failAction = action as appCommonActions.Fail;
console.debug(failAction.payload)
return null;
}));
})),{dispatch:false});
@Effect({ dispatch: false })
online$: Observable<Action> = this.actions$.pipe(
online$ = createEffect(() => this.actions$.pipe(
ofType(appCommonActions.ONLINE),
switchMap((action) => {
console.debug("Online: Check token");
@@ -206,7 +189,7 @@ export class AppCommonEffects {
}
}
return of(undefined);
}));
})),{dispatch:false});

View File

@@ -14,4 +14,6 @@ export interface IUser {
organisation?: string;
cocNumber?: string;
searchable: boolean;
newsletter?: boolean;
language?: string;
}

View File

@@ -22,6 +22,9 @@ export interface State {
userSettingsRoot: IItem,
accountMenuVisible: boolean,
appMenuVisible: boolean,
notificationMenuVisible: boolean,
helpMenuVisible: boolean,
unreadNotifications: number,
isOnline: boolean,
isPageMode:boolean
}
@@ -39,6 +42,9 @@ export const initialState: State = {
userSettingsRoot: null,
accountMenuVisible: false,
appMenuVisible: false,
notificationMenuVisible: false,
helpMenuVisible: false,
unreadNotifications: 0,
isOnline: true,
isPageMode: true
}
@@ -98,20 +104,26 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
});
}
case appCommonActions.TOGGLEMENU: {
return tassign(state, { menuVisible: !state.menuVisible,accountMenuVisible:!state.menuVisible?false:state.accountMenuVisible,appMenuVisible:!state.menuVisible?false:state.appMenuVisible });
return tassign(state, { menuVisible: !state.menuVisible,accountMenuVisible:!state.menuVisible?false:state.accountMenuVisible,appMenuVisible:!state.menuVisible?false:state.appMenuVisible,notificationMenuVisible:!state.menuVisible?false:state.notificationMenuVisible,helpMenuVisible:!state.menuVisible?false:state.helpMenuVisible });
}
case appCommonActions.TOGGLEACCOUNTMENU: {
return tassign(state, { accountMenuVisible: !state.accountMenuVisible,appMenuVisible:false });
return tassign(state, { accountMenuVisible: !state.accountMenuVisible,appMenuVisible:false,notificationMenuVisible:false,helpMenuVisible:false });
}
case appCommonActions.TOGGLEAPPMENU: {
return tassign(state, { appMenuVisible: !state.appMenuVisible,accountMenuVisible:false });
return tassign(state, { appMenuVisible: !state.appMenuVisible,accountMenuVisible:false,notificationMenuVisible:false,helpMenuVisible:false });
}
case appCommonActions.TOGGLENOTIFICATIONMENU: {
return tassign(state, { notificationMenuVisible : !state.notificationMenuVisible,accountMenuVisible:false,appMenuVisible:false,helpMenuVisible:false });
}
case appCommonActions.TOGGLEHELPMENU: {
return tassign(state, { helpMenuVisible : !state.helpMenuVisible,accountMenuVisible:false,appMenuVisible:false,notificationMenuVisible:false });
}
case appCommonActions.ESCAPE: {
return tassign(state, { menuVisible: false,accountMenuVisible:false,appMenuVisible: false });
return tassign(state, { menuVisible: false,accountMenuVisible:false,appMenuVisible: false,notificationMenuVisible:false,helpMenuVisible:false });
}
case appCommonActions.SETMENUVISIBLE: {
let a = action as appCommonActions.SetMenuVisible;
return tassign(state, { menuVisible: a.visible,accountMenuVisible:a.visible?false:state.accountMenuVisible,appMenuVisible:a.visible?false:state.appMenuVisible });
return tassign(state, { menuVisible: a.visible,accountMenuVisible:a.visible?false:state.accountMenuVisible,appMenuVisible:a.visible?false:state.appMenuVisible,notificationMenuVisible:a.visible?false:state.notificationMenuVisible,helpMenuVisible:a.visible?false:state.helpMenuVisible });
}
case appCommonActions.INITUSERPACKAGESSUCCESS:{
let a = action as appCommonActions.InitUserPackagesSuccess;
@@ -144,6 +156,18 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
let a = action as appCommonActions.SetPageMode;
return tassign(state,{isPageMode:a.pageMode});
}
case appCommonActions.NOTIFICATIONEVENT: {
let a = action as appCommonActions.NotificationEvent;
let unread = 0;
if(a.attributes["unread"]) {
unread = parseInt(a.attributes["unread"]);
}
return tassign(state,{unreadNotifications:unread});
}
case appCommonActions.SETUNREADNOTIFICATIONS: {
let a = action as appCommonActions.SetUnreadNotifications;
return tassign(state,{unreadNotifications:a.unread});
}
default: {
return state;
}
@@ -162,6 +186,9 @@ export const getUserPackages = (state: State) => state.userPackages;
export const getUserSettingsRoot = (state: State) => state.userSettingsRoot;
export const getAccountMenuVisible = (state: State) => state.accountMenuVisible;
export const getAppMenuVisible = (state: State) => state.appMenuVisible;
export const getNotificationMenuVisible = (state: State) => state.notificationMenuVisible;
export const getHelpMenuVisible = (state: State) => state.helpMenuVisible;
export const getUnreadNotifications = (state: State) => state.unreadNotifications;
export const getIsOnline = (state: State) => state.isOnline;
export const getIsPageMode = (state: State) => state.isPageMode;
@@ -179,6 +206,10 @@ export const SelectGetUserPackages = createSelector(selectAppCommonState,getUser
export const SelectGetUserSettingsRoot = createSelector(selectAppCommonState,getUserSettingsRoot);
export const SelectGetAccountMenuVisible = createSelector(selectAppCommonState,getAccountMenuVisible);
export const SelectGetAppMenuVisible = createSelector(selectAppCommonState,getAppMenuVisible);
export const SelectGetNotificationMenuVisible = createSelector(selectAppCommonState,getNotificationMenuVisible);
export const SelectGetHelpMenuVisible = createSelector(selectAppCommonState,getHelpMenuVisible);
export const SelectgetUnreadNotifications = createSelector(selectAppCommonState,getUnreadNotifications);
export const SelectGetIsOnline = createSelector(selectAppCommonState,getIsOnline);
export const SelectGetIsPageMode = createSelector(selectAppCommonState,getIsPageMode);

View File

@@ -0,0 +1,21 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { IUser } from '../models/user';
import { HttpClient,HttpHeaders } from "@angular/common/http";
import { AppConfig } from "../shared/app.config";
@Injectable({
providedIn: 'root',
})
export class GeolocatorService {
constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
}
ApiEndpoint() {
return this.appConfig.getConfig("apiEndPoint");
}
geocode(address:string): Observable<any> {
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/service/geocode?address=${address}`)
}
}

View File

@@ -0,0 +1,65 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { IUser } from '../models/user';
import { HttpClient,HttpHeaders } from "@angular/common/http";
import { AppConfig } from "../shared/app.config";
@Injectable({
providedIn: 'root',
})
export class ImageService {
constructor(public httpClient: HttpClient, public appConfig: AppConfig) {
}
ApiEndpoint() {
return this.appConfig.getConfig("apiEndPoint");
}
putImage(endpoint:string,blob:Blob) {
const formData = new FormData();
formData.append('file', blob,blob.type);
return this.httpClient.put<any>(endpoint,formData);
}
dataUrltoBlob(dataURI:string):Blob {
var mime = dataURI.split( ';base64,')[0].split(':')[1];
var byteCharacters = atob(dataURI.split( ';base64,')[1]);
const sliceSize = 512;
const byteArrays = [];
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
const slice = byteCharacters.slice(offset, offset + sliceSize);
const byteNumbers = new Array(slice.length);
for (let i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
const byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
const blob = new Blob(byteArrays, {type: mime});
return blob;
}
blobToFile(blob:Blob, filename:string):File {
return new File([blob],filename,{type:blob.type});
}
blobToDataUrl(blob:File):Promise<string> {
return new Promise<string>((resolve) => {
let reader = new FileReader();
reader.addEventListener('error', () => {
resolve("");
});
reader.addEventListener("load", function () {
resolve(reader.result as string);
}, false);
reader.readAsDataURL(blob);
});
}
}

View File

@@ -41,7 +41,7 @@ export class ItemService {
}
if (parentCode) params = params.append("pc", parentCode);
if (dataFilter) params = params.append("df", dataFilter);
if (level) params = params.append("lvl", dataFilter);
if (level) params = params.append("lvl", level.toString());
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/features/`, {params:params});
}
@@ -71,13 +71,14 @@ export class ItemService {
return this.httpClient.get<IItem>(`${this.ApiEndpoint()}/api/v1/items/${code}/${itemType}`);
}
getItemList(itemType?: string, dataFilter?: any, level?:number ,atItemLocationItemCode?:string,indexed?:boolean): Observable<IItem[]> {
getItemList(itemType?: string, dataFilter?: any, level?: number, atItemLocationItemCode?: string, indexed?: boolean, validToday?: boolean): Observable<IItem[]> {
var params = new HttpParams();
if(itemType) params = params.append("it", itemType);
if(dataFilter) params = params.append("df", JSON.stringify(dataFilter));
if(atItemLocationItemCode) params = params.append("ail",atItemLocationItemCode);
if(indexed) params = params.append("ind",indexed?"true":"false");
if(level) params = params.append("lvl", level.toFixed());
if (level) params = params.append("lvl", level.toFixed());
if (validToday) params = params.append("vt", validToday ? "true" : "false");
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/`, { params: params });
}
@@ -94,9 +95,12 @@ export class ItemService {
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children`, { params: params });
}
getChildItemListCount(parentcode: string, itemType: string): Observable<Number> {
getChildItemListCount(parentcode: string, itemType: string,dataFilter?: any): Observable<Number> {
var params = new HttpParams();
params = params.append("it", itemType);
if (dataFilter != null) {
params = params.append("df", JSON.stringify(dataFilter));
}
return this.httpClient.get<Number>(`${this.ApiEndpoint()}/api/v1/items/${parentcode}/children/count`, { params: params });
}
@@ -168,4 +172,9 @@ export class ItemService {
params = params.append("rsdf", JSON.stringify(relationshipDataFilter));
return this.httpClient.get<IItem[]>(`${this.ApiEndpoint()}/api/v1/items/userelationship`, { params: params });
}
getLayerValue(itemCode: string, layerIndex:number,x:number,y:number,crs:string = "EPSG:3857"): Observable<number> {
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/${itemCode}/value/layer/${layerIndex}?c=${x},${y}&crs=${crs}`);
}
}

View File

@@ -65,7 +65,7 @@ export class ItemTypeService {
})
.catch(error => this.itemTypes = null);
} else {
return new Promise((resolve) => {resolve()});
return new Promise<void>((resolve) => {resolve()});
}
};
}

View File

@@ -0,0 +1,19 @@
import {Injectable} from '@angular/core';
import {ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot} from '@angular/router';
import {PackageService} from './package.service';
@Injectable({
providedIn: 'root',
})
export class PackageGuard implements CanActivate {
constructor(private packageService: PackageService) { }
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
return route.data && route.data.package && this.hasPackageForRoute(route.data.package);
}
private hasPackageForRoute(packageId: string): boolean {
return this.packageService.hasPackage(packageId);
}
}

View File

@@ -28,7 +28,7 @@ export class PackageService {
hasPackage(id:string):boolean {
if(!this.packages$[id]) return false;
return this.packages$[id].enabled == true;
return this.packages$[id].enabled ? this.packages$[id].enabled == true : true;
}
postItemPackageTask(item: IItem, task: IItemTask): Observable<IItemTask> {

View File

@@ -16,10 +16,10 @@ export class UserService {
}
getCurrentUser(): Observable<IUser> {
return this.httpClient.get<IUser>(`${this.ApiEndpoint()}/api/v1/currentuser`);
return this.httpClient.get<IUser>(`${this.ApiEndpoint()}/api/v1/users/currentuser`);
}
updateCurrentUser(user: IUser): Observable<IUser> {
return this.httpClient.put<IUser>(`${this.ApiEndpoint()}/api/v1/currentuser`, user);
return this.httpClient.put<IUser>(`${this.ApiEndpoint()}/api/v1/users/${user.code}`, user);
}
}

View File

@@ -10,7 +10,7 @@ import { IAuthconfigFactory } from './authconfigFactory';
export function appConfigFactory(injector:Injector, appConfig: AppConfig, oauthService: OAuthService, authconfigFactory:IAuthconfigFactory,authStorage:OAuthStorage,itemtypeService:ItemTypeService): () => Promise<any> {
return (): Promise<any> => {
return new Promise((resolve,reject) => {
return new Promise<void>((resolve,reject) => {
appConfig.load().then(() => {
oauthService.configure(authconfigFactory.getAuthConfig(appConfig));
oauthService.setStorage(authStorage);

View File

@@ -0,0 +1,40 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"module": "es2015",
"moduleResolution": "node",
"declaration": true,
"sourceMap": true,
"inlineSources": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"esModuleInterop": true,
"types": [],
"lib": [
"dom",
"es2018"
],
"paths": {
"@angular/*": [
"node_modules/@angular/*"
]
}
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true,
"enableResourceInlining": true,
"enableIvy": false
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}

View File

@@ -1,5 +1,5 @@
import { NgModule } from '@angular/core';
import { RouterModule, UrlSegment } from '@angular/router';
import { RouterModule, UrlSegment, ExtraOptions } from '@angular/router';
import { AuthGuard, FullScreenGuard } from '@farmmaps/common';
//import { MapComponent } from '@farmmaps/common-map';
@@ -33,6 +33,16 @@ const routes = [
component: TestComponent,
outlet: 'app-menu'
},
{
path: '',
component: TestComponent,
outlet: 'notification-menu'
},
{
path: '',
component: TestComponent,
outlet: 'help-menu'
},
{
path: '',
component: LogoComponent,
@@ -68,7 +78,7 @@ const routes = [
@NgModule({
imports: [RouterModule.forRoot(routes,
{ initialNavigation: true })], // , enableTracing: true
{ initialNavigation: 'enabledBlocking' })], // , enableTracing: true
exports: [RouterModule]
})
export class AppRoutingModule { }

View File

@@ -13,7 +13,7 @@ import {AppRootComponent} from './app.component';
import {StoreModule, ActionReducer,MetaReducer} from '@ngrx/store';
import {EffectsModule, EffectSources} from '@ngrx/effects';
import { StoreRouterConnectingModule} from '@ngrx/router-store';
import { StoreRouterConnectingModule,routerReducer} from '@ngrx/router-store';
import {AppRoutingModule} from './app-routing.module';
import { LogoComponent } from './logo/logo.component';
@@ -76,13 +76,14 @@ export const metaReducers: MetaReducer<any>[] = [debug];
AppCommonModule,
AppCommonServiceModule.forRoot(),
BrowserModule,
StoreModule.forRoot({},{metaReducers,runtimeChecks: { // TODO fix this should all be true
StoreModule.forRoot({router:routerReducer},{metaReducers,runtimeChecks: { // TODO fix this should all be true
strictStateImmutability: false,
strictActionImmutability: false,
strictStateSerializability: false,
strictActionSerializability: false
}}),
EffectsModule.forRoot([])
StoreRouterConnectingModule.forRoot({stateKey:"router"}),
EffectsModule.forRoot([]),
],
providers: [
AuthConfigFactory,

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