200 Commits

Author SHA1 Message Date
Willem Dantuma
0da2167591 Update dependencies
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-26 14:01:28 +01:00
8e0d302fd4 Revert "AW-1079 Only add one item to overlay."
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
This reverts commit 9c16681b58.
2020-03-26 13:28:36 +01:00
9c16681b58 AW-1079 Only add one item to overlay.
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-26 10:38:39 +01:00
d883553934 AW-1104 Pfffft
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-25 14:59:17 +01:00
340d07a03f AW-1104 Fixed link to temporal viewer (graph broken).
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2020-03-25 14:56:17 +01:00
Willem Dantuma
4bbc22cbde Merge branch 'feature/fix_zoom_issue_after_edit_take2' into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-22 20:25:36 +01:00
Willem Dantuma
80134e5ad0 Remove logging 2020-03-22 20:22:52 +01:00
Willem Dantuma
c777ce75ad Fix zoom issue 2020-03-22 20:08:53 +01:00
af12682341 AW-1084 Fix "An unhandled exception occurred: projects/common-map/src/fm-map/components/selected-item-temporal/selected-item-temporal.component.ts(5,70): error TS2300: Duplicate identifier 'IItem'.
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
projects/common-map/src/fm-map/components/selected-item-temporal/selected-item-temporal.component.ts(11,10): error TS2300: Duplicate identifier 'IItem'".
2020-03-20 11:19:30 +01:00
28cfc045fb AW-1084 Van der Sat: cropyear to viewer.
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2020-03-20 11:15:47 +01:00
9b98f3d91c AW-1072 VanderSat: Balkjes wat dichter bij getallen: % staat soms op volgende regel
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-20 10:47:57 +01:00
0814a6a877 AW-981 Also export type.
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-04 10:28:42 +01:00
23eb27cf7f AW-981 Add Alert enum.
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-04 10:19:10 +01:00
Willem Dantuma
33b15677d2 Enable chart button
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-04 09:35:54 +01:00
Willem Dantuma
902c3c629e Fix thematic map click
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-03 22:18:01 +01:00
Willem Dantuma
4169d1a26e Fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-03 21:16:01 +01:00
Willem Dantuma
7d3679afd2 Add goto chart
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2020-03-03 21:06:39 +01:00
Willem Dantuma
6921bc7f4a Styling changes
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-03 21:02:33 +01:00
Willem Dantuma
0621b32fba Fix legend
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-03 19:43:17 +01:00
Willem Dantuma
2388968f2a Fix layer selection
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-03 19:24:01 +01:00
Willem Dantuma
24f41879bf Fix query
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-03 16:32:25 +01:00
Willem Dantuma
d4ee784460 Fix import
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-03 10:54:57 +01:00
Willem Dantuma
2434fbf5ee Update libs
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-03 10:32:15 +01:00
Willem Dantuma
141b5055d7 Merge branch 'feature/Temporal_item' into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-03 10:22:27 +01:00
Willem Dantuma
a8f82f800f Fixed some issue 2020-03-03 10:21:24 +01:00
Willem Dantuma
5343a4aa98 Basic working version 2020-03-02 13:48:10 +01:00
Willem Dantuma
60c741d935 Implement next and preious temporal 2020-03-02 09:22:16 +01:00
Willem Dantuma
be885ce917 Merge branch 'develop' into feature/Temporal_item 2020-03-02 08:57:20 +01:00
Willem Dantuma
da1c9c3fe2 More refactoring 2020-03-02 08:55:11 +01:00
Willem Dantuma
a151b73d03 Some refactoring 2020-02-29 11:56:19 +01:00
Willem Dantuma
47f77c2819 Display last 2020-02-27 21:41:52 +01:00
Willem Dantuma
841999daba Make itemtype optional
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-27 18:01:17 +01:00
Willem Dantuma
8e29e479de Add selecttemporalitemssuccess 2020-02-27 17:59:00 +01:00
Willem Dantuma
3094170cc2 Some refactoring 2020-02-27 16:28:10 +01:00
Willem Dantuma
795e8fdf0e Fix double scaling issue
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-26 19:29:34 +01:00
Willem Dantuma
007448878b Revert "Revert "Fix thumbnail scaling on zoomed browser""
This reverts commit ebf362e9a9.
2020-02-26 17:21:02 +01:00
Willem Dantuma
ebf362e9a9 Revert "Fix thumbnail scaling on zoomed browser"
This reverts commit 1c70e3495f.
2020-02-26 17:03:00 +01:00
Willem Dantuma
1c70e3495f Fix thumbnail scaling on zoomed browser
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-26 08:44:32 +01:00
Willem Dantuma
e75d71d748 Implement client side thumbnail renderer for features
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-25 20:19:28 +01:00
Willem Dantuma
6916e4650a Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-25 15:14:46 +01:00
Willem Dantuma
38c8def43a Add area to selected-item-cropfield 2020-02-25 15:14:29 +01:00
9c103a0c40 AW-942 Add (optional) deep parameter to getChildItemList.
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-25 15:04:12 +01:00
Willem Dantuma
d3b10d46ad Add area and croptype to feature-list-feature-cropfield
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-25 14:37:06 +01:00
Willem Dantuma
f8c3a0db98 Select better threshold for mobile detection
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-25 11:52:27 +01:00
Willem Dantuma
0eaa3065a3 Add margin 2020-02-25 11:26:57 +01:00
Willem Dantuma
f91d727c99 Convert to svg and style rotation-reset
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-25 10:37:03 +01:00
Willem Dantuma
fd18d4921b Fix border color search input
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-24 23:53:32 +01:00
Willem Dantuma
16ad7bfb6f Style map controls as buttons
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-24 23:26:28 +01:00
Willem Dantuma
a3e14a94cc Remove old theming, use correct theme colors and a friendlier icon
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-22 09:45:41 +01:00
Willem Dantuma
2b5bda2a44 Try to fix loop
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-21 11:51:42 +01:00
Willem Dantuma
85143986ee remove show_as_featurelist again
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-21 11:28:46 +01:00
Willem Dantuma
ba0a60ba09 Fixes for explorer
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-21 11:16:30 +01:00
Willem Dantuma
a1d7f6d4d2 Fix for diffrent action on feature select on map
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-21 11:06:16 +01:00
Willem Dantuma
c341b3e42f Another attemt to fix zooming
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-21 00:51:10 +01:00
Willem Dantuma
3a38c24360 Fix several issues, attemt to fix zooming issue
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-21 00:11:18 +01:00
Willem Dantuma
abfef73cd1 Refactoring map, place state where it belongs
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-20 21:20:50 +01:00
Willem Dantuma
f82125a486 Fix navigation issue
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-20 17:38:05 +01:00
Willem Dantuma
1a3bbf26f2 Set layerindex
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-19 16:08:46 +01:00
Willem Dantuma
616644de6c Merge branch 'features/geotiff_band_rendering' into develop 2020-02-19 14:56:22 +01:00
Willem Dantuma
c16b9ef5c9 Fix download link on local 2020-02-19 14:55:29 +01:00
Willem Dantuma
7a27df60c2 Implement select_as_mapitem
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-19 12:02:56 +01:00
Willem Dantuma
e8493ef0bd Fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-19 11:48:57 +01:00
Willem Dantuma
dae5411e6a Update peer dependency
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2020-02-19 11:44:07 +01:00
Willem Dantuma
755475bff7 Remove stateserializerservice from common-map
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2020-02-19 11:37:21 +01:00
Willem Dantuma
9c5955bc6f Forgot to export stateserializerservice
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-19 11:23:43 +01:00
Willem Dantuma
17af34ff94 Move query state to common
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-19 11:15:31 +01:00
92c8b4c1b6 changed selected item geotiff to show layer changer 2020-02-19 10:57:11 +01:00
aa6cd254c7 changed image api 2020-02-19 10:53:14 +01:00
Willem Dantuma
3baf0b15c7 Show edit action only when item editable
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-19 09:34:35 +01:00
Willem Dantuma
593fa78f13 Make isEditable optional
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-19 09:03:02 +01:00
Willem Dantuma
a39578e1a4 Add iseditable to interface
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-18 22:09:58 +01:00
Willem Dantuma
f5868618b7 Add isEditable
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-18 22:02:34 +01:00
Willem Dantuma
2920fd82f1 Fix viewer
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-18 17:00:19 +01:00
Willem Dantuma
ad11de53af Fix z-index layer switcher
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-18 16:41:24 +01:00
Willem Dantuma
d7ac9b937a Update libs
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-18 08:20:32 +01:00
Willem Dantuma
3a4b5dbd9b Fix collopsed search box size on mobile
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-18 08:16:51 +01:00
Willem Dantuma
6eb1b5af55 Update app to match library changes
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-18 08:03:42 +01:00
Willem Dantuma
aa09953b67 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-17 18:31:40 +01:00
Willem Dantuma
a8b079b72b Add layerswitcher 2020-02-17 18:31:23 +01:00
fcef78dee0 AW-915 Use proper container (not just the first).
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-17 12:49:08 +01:00
Willem Dantuma
fd28af2f6c Fix lost styling after navigation
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-17 10:23:17 +01:00
Willem Dantuma
81ed89b240 Fix select on hover ( null ref)
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-14 10:21:49 +01:00
Willem Dantuma
52b4f90b78 Fix selected style
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-13 16:51:23 +01:00
Willem Dantuma
79f45631a0 Fix Set style Geometry
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-13 16:14:18 +01:00
Willem Dantuma
6060a8b86a Use a Style or a Style function as parameter to setStyle action 2020-02-13 16:01:05 +01:00
Willem Dantuma
4814b8fbad Change configuration for identityserver
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-13 14:45:10 +01:00
Willem Dantuma
da97f06db8 npm update
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-13 11:29:55 +01:00
Willem Dantuma
709e964579 Add custom style for vnd.farmmaps.itemntype.layer
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-13 11:24:23 +01:00
Willem Dantuma
3c0bece982 Fix select feature on hover in list
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-13 09:56:17 +01:00
Willem Dantuma
1646119b16 Merge branch 'feature/AW-847' into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-12 21:34:43 +01:00
Willem Dantuma
252ce855c9 Add id4AuthconfigFactory 2020-02-12 21:34:11 +01:00
Willem Dantuma
937dbe9b43 Use refactored styles 2020-02-12 21:33:28 +01:00
Willem Dantuma
6379b64351 Refactor style cache 2020-02-12 20:38:14 +01:00
Willem Dantuma
b83aca7969 Refactor itemtype loading
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-11 18:55:43 +01:00
Willem Dantuma
52170590e3 Remove fm-map-item-features-source ( obsolete )
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-11 14:48:40 +01:00
Willem Dantuma
7a1ba95212 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-05 14:57:35 +01:00
Willem Dantuma
4eb10aa676 AW-900 2020-02-05 14:57:12 +01:00
1cab239155 AW-811: Changed weatherservice
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-04 17:38:04 +01:00
Willem Dantuma
1bec8c2038 Fix menu
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-04 14:21:40 +01:00
Willem Dantuma
9433ef87b2 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop 2020-02-04 14:20:48 +01:00
Willem Dantuma
f0b2b1e774 Add register device placeholder 2020-02-04 14:20:32 +01:00
123bf2943a AW-811: Added weather service to common
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-04 13:57:33 +01:00
fd3545523e Remove annoying 'debugger' statement.
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-03 10:32:15 +01:00
6c828f6c6d AW-803 Add count childitems for widget.
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-02-03 09:28:24 +01:00
Willem Dantuma
62234b3f9d Refactor authentication flow
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-31 11:24:45 +01:00
e53378a76b AW-803 Fixed -> ERROR: projects/common/src/fm/services/item.service.ts(114,78): error TS2559: Type 'string' has no properties in common with type '{ headers?: HttpHeaders | { [header: string]: string | string[]; }; observe?: "body"; params?: HttpParams | { [param: string]: string | string[]; }; reportProgress?: boolean; responseType?: "json"; withCredentials?: boolean; }'.
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-30 14:13:59 +01:00
e41b94bb77 AW-803 Add deleteItem.
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2020-01-30 13:58:01 +01:00
Willem Dantuma
975efe5958 Make upload progress panel optional
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-29 10:23:07 +01:00
5e8e2388b5 AW-803 Ooops
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-28 11:39:09 +01:00
eea6bbbcb5 AW-803 Refactor add
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-28 11:37:33 +01:00
05705afdfe AW-803 Fix casing issue. Remove unused parms.
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-28 09:50:33 +01:00
0ba553cc40 AW-803 Add postItem.
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-28 09:03:29 +01:00
Willem Dantuma
0674b0ac7c Close menu on navigation
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-27 17:28:17 +01:00
Willem Dantuma
252e920848 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-27 17:01:39 +01:00
Willem Dantuma
77e4093d14 Close menu on navigation 2020-01-27 17:01:35 +01:00
19a8393a3a AW-814: Changed widget component height
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-27 15:03:01 +01:00
Willem Dantuma
af1a54ae07 Fix container width and spacing
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-23 12:20:35 +01:00
63ffdf2519 AW-803 Pass array (take 2).
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-22 14:18:09 +01:00
e3714f4cac AW-803 Added CodeListItemService.
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2020-01-22 14:12:57 +01:00
e8537ba916 AW-803 Pass string array.
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-22 13:57:56 +01:00
Willem Dantuma
2fca6d1fba Update more deps
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-22 11:44:52 +01:00
Willem Dantuma
2199a929eb Update deps 2020-01-22 11:42:20 +01:00
Willem Dantuma
6389331c30 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
# Conflicts:
#	projects/common/src/fm/common-service.module.ts
2020-01-22 11:34:32 +01:00
Willem Dantuma
3f27662e3f Make authstorage configurable 2020-01-22 11:33:33 +01:00
313e0c94f7 AW-835 Fixed ERROR: projects/common/src/fm/services/codelistitem.service.ts(23,5): error TS2322: Type 'Observable<ICodeListItem>' is not assignable to type 'Observable<ICodeListItem[]>'.
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-22 10:05:03 +01:00
a12b45f8f9 AW-835 Added CodeListItem. Some cleanup.
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2020-01-22 09:52:40 +01:00
587e484cf8 AW-835 Remove validFrom/To filter from interface.
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-21 18:15:50 +01:00
e8845a092a AW-803 Add CodeListItem + service.
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-21 14:52:36 +01:00
Willem Dantuma
3dca804acd Re login after refresh error
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-20 18:05:45 +01:00
Willem Dantuma
761e987067 navigate after refresh
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-20 18:03:04 +01:00
Willem Dantuma
9277b1fa25 Remove authguard
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-20 17:31:09 +01:00
Willem Dantuma
9103753b09 Try to refresh on startup
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-20 17:26:35 +01:00
Willem Dantuma
f99dfc965f Fix z-index menu overlay
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-17 17:38:53 +01:00
Willem Dantuma
91fb3ac329 Fix menu sliding
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-17 16:39:08 +01:00
Willem Dantuma
36cc8bea7e AW-821 use local storage for tokens
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-15 13:48:49 +01:00
Willem Dantuma
e875ed5a12 Update deps
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-14 16:52:24 +01:00
Willem Dantuma
1a0e0b13e7 Make granttype configurable
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-14 16:46:59 +01:00
Willem Dantuma
f71d96be6e Fix width
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-13 14:43:02 +01:00
Willem Dantuma
40429a67ef Fix menu height
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-08 17:46:52 +01:00
Willem Dantuma
71e7467c17 Realy fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-08 14:52:35 +01:00
Willem Dantuma
d860d9edd2 Fix build
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2020-01-08 14:46:49 +01:00
Willem Dantuma
8decff316b Fix menu outlet
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2020-01-08 14:43:44 +01:00
Willem Dantuma
f21648386b AW-823 implementcorrect editor navigation 2020-01-08 14:43:24 +01:00
Willem Dantuma
ab99f6722c Implement menu button
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-08 14:23:24 +01:00
Willem Dantuma
46d0f8c060 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-08 11:38:13 +01:00
Willem Dantuma
b46c33d15c Show navbar 2020-01-08 11:37:57 +01:00
Willem Dantuma
d3bc921000 Add menu background 2020-01-08 11:37:37 +01:00
2c3c8fbff2 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-08 10:28:15 +01:00
0bf0941bdc Ignore Visual Studio generated files 2020-01-08 10:28:05 +01:00
Willem Dantuma
c52497af59 Fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-07 22:31:56 +01:00
Willem Dantuma
6ad23d280d Fix build
Some checks reported errors
FarmMaps.Develop/FarmMapsLib/develop Something is wrong with the build of this commit
2020-01-07 22:31:27 +01:00
Willem Dantuma
bf0dc15a00 Refactor map for menu removal
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2020-01-07 22:27:46 +01:00
Willem Dantuma
73550b3201 Some menu fixes
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-07 21:43:48 +01:00
Willem Dantuma
e077aa34df Refactor menu panel
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-07 16:33:56 +01:00
Willem Dantuma
58f7c99ddc Store mapstate in localstorage
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-06 18:36:47 +01:00
Willem Dantuma
50d1d9645a Implement copassheading
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-03 16:40:14 +01:00
Willem Dantuma
41d55110ea Fix zone
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-03 15:00:11 +01:00
Willem Dantuma
867fdc3fcc Update libs
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-02 18:22:59 +01:00
Willem Dantuma
64c02614ba Implement pan to, fix zooming on map change
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-01-02 18:11:02 +01:00
Willem Dantuma
ac5efdb40f Mark for check on navigation
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-12-27 13:26:39 +01:00
Willem Dantuma
4b232cc0e4 Use location for path
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-12-23 17:33:43 +01:00
70fb5b42ec AW-784 Fixed 1 │ @import "../../../app/theme.scss";
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
projects/common-map/src/fm-map/components/selected-item-cropfield/selected-item-cropfield.component.scss 1:9  root stylesheet
An unhandled exception occurred: Can't find stylesheet to import.
2019-12-20 10:05:49 +01:00
719c699981 Merge branch 'feature/AW784_MergeFarmMapsMap_FarmMapsLibMap' into develop
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2019-12-20 09:59:04 +01:00
456628d014 AW-784 Reapply from Farmmaps commits
- cd035366: AW-718 Layout as requested by Thomas.
2019-12-20 09:53:22 +01:00
76a44a8f95 AW-784 Reapply from Farmmaps commits
- cd035366: AW-718 Layout as requested by Thomas.
2019-12-20 09:50:21 +01:00
f66428d04c AW-784 Reapply from Farmmaps commits
- cd035366: AW-718 Layout as requested by Thomas.
2019-12-20 09:47:33 +01:00
ee925d07b4 AW-784 Reapply from Farmmaps commits
- 47deb5f6: AW-772 Panels
2019-12-20 09:41:06 +01:00
9b03b49028 AW-784 Reapply from Farmmaps commits
- 47deb5f6: AW-772 Panels
2019-12-20 09:39:29 +01:00
15c224ff5d AW-784 Reapply from Farmmaps commits
- 5d11bfe8: Enable histogram for shape
2019-12-20 09:36:55 +01:00
7cb129dbc4 AW-784 Reapply from Farmmaps commits
- cd035366: AW-718 Layout as requested by Thomas.
2019-12-20 09:25:09 +01:00
2059b48abb AW-784 Reapply from Farmmaps commits
- a4bb051a: AW-738 fixed bug
2019-12-20 09:19:53 +01:00
e1ff44ed3c AW-784 Reapply from Farmmaps commits
- 6f79b625: AW-738 changed selected-item-container to allow forSourceTask annotation.
2019-12-20 09:18:00 +01:00
Willem Dantuma
709c76a851 Hack for cordova
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-12-19 18:29:44 +01:00
Willem Dantuma
677608c14d Fix configuration loading
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-12-19 17:03:10 +01:00
Willem Dantuma
fd8025c674 Update sample app
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-12-19 13:41:59 +01:00
Willem Dantuma
560c426bc0 Refactor authconfig
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-12-19 13:32:51 +01:00
Willem Dantuma
e1fef2d7f3 Show histogram
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-12-18 10:21:25 +01:00
Willem Dantuma
f44b079cde Fix thumbnail source
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-12-11 18:03:37 +01:00
Willem Dantuma
8e5383b0f2 Update deps
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-12-11 10:47:32 +01:00
Willem Dantuma
615872992f Implement device update event
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-12-11 10:29:47 +01:00
Willem Dantuma
2e0b090fb7 Added deviceUpdateEvent
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-12-10 18:14:48 +01:00
Willem Dantuma
5d7fd63adc Oops remember to test it next time..
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-11-29 12:52:18 +01:00
Willem Dantuma
0948bacaaf Merge latest changes
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2019-11-29 12:24:34 +01:00
8fd653afbc AW-698 Round percentage "Uploading files".
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-11-29 09:18:35 +01:00
b058cb80b1 AW-716 Spacing
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-11-29 09:17:45 +01:00
Willem Dantuma
490ae1868b Update README
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-11-25 16:22:55 +01:00
Willem Dantuma
4384fd1387 Update example to angular 8.2 and ol 6
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-11-25 15:52:02 +01:00
Willem Dantuma
529b1c9bd7 Upgrade @farmmaps/common-map to angular 8.2
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-11-25 15:31:42 +01:00
Willem Dantuma
fc84548d8a Oops forgot ng build
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-11-25 14:49:46 +01:00
Willem Dantuma
e57b8297c0 Disable common-map temporarily
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2019-11-25 14:47:20 +01:00
Willem Dantuma
efe38aba62 Update @farmmaps/common to angular 8.2
Some checks failed
FarmMaps.Develop/FarmMapsLib/develop There was a failure building this commit
2019-11-25 14:43:26 +01:00
Willem Dantuma
7bd5dada2b Update to angular 8.2 2019-11-25 14:34:51 +01:00
Willem Dantuma
16db063339 Make bbox optional
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-11-18 09:42:05 +01:00
Willem Dantuma
5d79dcc7b6 Update library versions
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-11-13 11:46:23 +01:00
Willem Dantuma
deda769e8b Add service module
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-11-12 22:50:57 +01:00
Willem Dantuma
f31e4154b2 Fix date parsing for lists
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-11-12 16:27:08 +01:00
Willem Dantuma
7476e4c928 Set configuration correctly
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-11-11 17:38:49 +01:00
Willem Dantuma
d5258b7c79 Update versions
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-11-11 15:42:50 +01:00
Willem Dantuma
04929a1ca3 Removed index.ts files
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2019-11-11 15:39:19 +01:00
Willem Dantuma
67e0e5ed5d Use label instead of value if it is available 2019-11-11 11:08:23 +01:00
148 changed files with 15816 additions and 10220 deletions

1
.gitignore vendored
View File

@@ -22,6 +22,7 @@ speed-measure-plugin.json
*.launch *.launch
.settings/ .settings/
*.sublime-workspace *.sublime-workspace
.vs/*
# IDE - VSCode # IDE - VSCode
.vscode/* .vscode/*

1
.npmrc Normal file
View File

@@ -0,0 +1 @@
@FarmMaps:registry=https://repository.akkerweb.nl/repository/npm-group/

View File

@@ -16,8 +16,8 @@ Use one of the two options below to get started.
*Setup* *Setup*
``` ```
docker pull node:10.16.0 docker pull node:12.13.1
docker run -t -i --entrypoint /bin/bash -p 4200:4200 node:10.16.0 docker run -t -i --entrypoint /bin/bash -p 4200:4200 node:12.13.1
``` ```
Inside the running container Inside the running container

View File

@@ -66,7 +66,7 @@
{ {
"type": "initial", "type": "initial",
"maximumWarning": "2mb", "maximumWarning": "2mb",
"maximumError": "5mb" "maximumError": "7mb"
} }
] ]
} }

15975
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -11,40 +11,42 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "~7.2.0", "@angular/animations": "~8.2.14",
"@angular/common": "~7.2.0", "@angular/common": "~8.2.14",
"@angular/compiler": "~7.2.0", "@angular/compiler": "~8.2.14",
"@angular/core": "~7.2.0", "@angular/core": "~8.2.14",
"@angular/forms": "~7.2.0", "@angular/forms": "~8.2.14",
"@angular/platform-browser": "~7.2.0", "@angular/platform-browser": "~8.2.14",
"@angular/platform-browser-dynamic": "~7.2.0", "@angular/platform-browser-dynamic": "~8.2.14",
"@angular/router": "~7.2.0", "@angular/router": "~8.2.14",
"@aspnet/signalr": "^1.1.4", "@aspnet/signalr": "^1.1.4",
"@farmmaps/common": ">=0.0.1-prerelease.69 <0.0.1", "@farmmaps/common": ">=0.0.1-prerelease.226 <0.0.1",
"@farmmaps/common-map": ">=0.0.1-prerelease.69 <0.0.1", "@farmmaps/common-map": ">=0.0.1-prerelease.226 <0.0.1",
"@ng-bootstrap/ng-bootstrap": "^4.2.1", "@ng-bootstrap/ng-bootstrap": "^4.2.1",
"@ngrx/effects": "^7.2.0", "@ngrx/effects": "^8.6.0",
"@ngrx/router-store": "^7.2.0", "@ngrx/router-store": "^8.6.0",
"@ngrx/store": "^7.2.0", "@ngrx/store": "^8.6.0",
"bootstrap": "^4.3.1", "ngx-uploadx": "^3.3.4",
"angular-oauth2-oidc": "^8.0.2",
"bootstrap": "^4.4.1",
"core-js": "^2.6.11",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"core-js": "^2.5.4",
"ngrx-store-localstorage": "^8.0.0", "ngrx-store-localstorage": "^8.0.0",
"resumablejs": "^1.1.0", "resumablejs": "^1.1.0",
"rxjs": "~6.3.3", "rxjs": "^6.5.4",
"tassign": "^1.0.0", "tassign": "^1.0.0",
"zone.js": "~0.8.26" "zone.js": "~0.9.1"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "~0.13.0", "@angular-devkit/build-angular": "^0.803.23",
"@angular-devkit/build-ng-packagr": "~0.13.0", "@angular-devkit/build-ng-packagr": "^0.803.25",
"@angular/cli": "~7.3.8", "@angular/cli": "^8.3.25",
"@angular/compiler-cli": "~7.2.0", "@angular/compiler-cli": "~8.2.14",
"@angular/language-service": "~7.2.0", "@angular/language-service": "~8.2.14",
"@types/node": "~8.9.4",
"@types/jasmine": "~2.8.8", "@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3", "@types/jasminewd2": "~2.0.3",
"codelyzer": "~4.5.0", "@types/node": "~8.9.4",
"codelyzer": "^5.2.1",
"jasmine-core": "~2.99.1", "jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1", "jasmine-spec-reporter": "~4.2.1",
"karma": "~4.0.0", "karma": "~4.0.0",
@@ -52,12 +54,12 @@
"karma-coverage-istanbul-reporter": "~2.0.1", "karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2", "karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2", "karma-jasmine-html-reporter": "^0.2.2",
"ng-packagr": "^4.2.0", "ng-packagr": "^5.4.0",
"protractor": "~5.4.0", "protractor": "^5.4.3",
"ts-node": "~7.0.0", "ts-node": "~7.0.0",
"tsickle": ">=0.34.0", "tsickle": "^0.37.0",
"tslib": "^1.9.0", "tslib": "^1.9.0",
"tslint": "~5.11.0", "tslint": "~5.11.0",
"typescript": "~3.2.2" "typescript": "~3.5.3"
} }
} }

View File

@@ -4,68 +4,42 @@
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@farmmaps/common": { "@openlayers/pepjs": {
"version": "0.0.1-prerelease.56", "version": "0.5.3",
"resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-0.0.1-prerelease.56.tgz", "resolved": "https://registry.npmjs.org/@openlayers/pepjs/-/pepjs-0.5.3.tgz",
"integrity": "sha512-m9KxWsLkTSz2JI074gIJH1kDR0PCLsFAug8oBjtlU/QxgBySrvqHCRiODpNmNWnFyNTZHqKHJQefn3Q9iAil4g==", "integrity": "sha512-Bgvi5c14BS0FJWyYWWFstNEnXsB30nK8Jt8hkAAdqr7E0gDdBBWVDglF3Ub19wTxvgJ/CVHyTY6VuCtnyRzglg=="
"requires": {
"angular-oauth2-oidc": "^5.0.2",
"ngx-uploadx": "^3.1.3",
"tslib": "^1.9.0"
}
},
"angular-oauth2-oidc": {
"version": "5.0.2",
"resolved": "https://registry.npmjs.org/angular-oauth2-oidc/-/angular-oauth2-oidc-5.0.2.tgz",
"integrity": "sha512-jtOv4IWEjSFfBHVE4seWGWT/ZfWJ95QJ1JaFhVVGJEF64ibGuPwV3ztwTOUl98QHi/Yg4PXXDAisb31JnIbxBw==",
"requires": {
"jsrsasign": "^8.0.12",
"tslib": "^1.9.0"
}
}, },
"ieee754": { "ieee754": {
"version": "1.1.13", "version": "1.1.13",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
"integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
}, },
"jsrsasign": {
"version": "8.0.12",
"resolved": "https://registry.npmjs.org/jsrsasign/-/jsrsasign-8.0.12.tgz",
"integrity": "sha1-Iqu5ZW00owuVMENnIINeicLlwxY="
},
"ngx-openlayers": { "ngx-openlayers": {
"version": "1.0.0-next.9", "version": "1.0.0-next.13",
"resolved": "https://registry.npmjs.org/ngx-openlayers/-/ngx-openlayers-1.0.0-next.9.tgz", "resolved": "https://registry.npmjs.org/ngx-openlayers/-/ngx-openlayers-1.0.0-next.13.tgz",
"integrity": "sha512-14UFxJX9oeOXtq+HJCJyXn0sBmYmCqj2AnFtetKk1FsDe8EUMFGIRju8UOFegCr2oEu5JsuRjALcfW7lCe+teg==", "integrity": "sha512-6y724s5JV6n1oxEhryxP3wcbwzpierj9RLiMLXInfKOG3l5IO1AtPNkeK9+mKctVDUVm5URIfzzZH02Ld+bvSQ==",
"requires": {
"tslib": "^1.9.0"
}
},
"ngx-uploadx": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/ngx-uploadx/-/ngx-uploadx-3.3.2.tgz",
"integrity": "sha512-gRdXXq2cRU9HE6dj65qay9GV8NRC7n8y5LtMzJWqsfu2k3CHMQxo2TqZwA9/l/PqJ76RoO7sTPy1OenFQ+krkQ==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }
}, },
"ol": { "ol": {
"version": "5.3.3", "version": "6.1.1",
"resolved": "https://registry.npmjs.org/ol/-/ol-5.3.3.tgz", "resolved": "https://registry.npmjs.org/ol/-/ol-6.1.1.tgz",
"integrity": "sha512-7eU4x8YMduNcED1D5wI+AMWDRe7/1HmGfsbV+kFFROI9RNABU/6n4osj6Q3trZbxxKnK2DSRIjIRGwRHT/Z+Ww==", "integrity": "sha512-0dL3i3eJqgOpqIjDKEY3grkeQnjAYfV5L/JCxhOu4SxiaizRwFrFgeas6LILRoxKa03jhQFbut2r2bbgcLGQeA==",
"requires": { "requires": {
"pbf": "3.1.0", "@openlayers/pepjs": "^0.5.3",
"pbf": "3.2.1",
"pixelworks": "1.1.0", "pixelworks": "1.1.0",
"rbush": "2.0.2" "rbush": "^3.0.1"
} }
}, },
"pbf": { "pbf": {
"version": "3.1.0", "version": "3.2.1",
"resolved": "https://registry.npmjs.org/pbf/-/pbf-3.1.0.tgz", "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.2.1.tgz",
"integrity": "sha512-/hYJmIsTmh7fMkHAWWXJ5b8IKLWdjdlAFb3IHkRBn1XUhIYBChVGfVwmHEAV3UfXTxsP/AKfYTXTS/dCPxJd5w==", "integrity": "sha512-ClrV7pNOn7rtmoQVF4TS1vyU0WhYRnP92fzbfF75jAIwpnzdJXf8iTd4CMEqO4yUenH6NDqLiwjqlh6QgZzgLQ==",
"requires": { "requires": {
"ieee754": "^1.1.6", "ieee754": "^1.1.12",
"resolve-protobuf-schema": "^2.0.0" "resolve-protobuf-schema": "^2.1.0"
} }
}, },
"pixelworks": { "pixelworks": {
@@ -79,16 +53,16 @@
"integrity": "sha512-Xdayp8sB/mU+sUV4G7ws8xtYMGdQnxbeIfLjyO9TZZRJdztBGhlmbI5x1qcY4TG5hBkIKGnc28i7nXxaugu88w==" "integrity": "sha512-Xdayp8sB/mU+sUV4G7ws8xtYMGdQnxbeIfLjyO9TZZRJdztBGhlmbI5x1qcY4TG5hBkIKGnc28i7nXxaugu88w=="
}, },
"quickselect": { "quickselect": {
"version": "1.1.1", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/quickselect/-/quickselect-1.1.1.tgz", "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz",
"integrity": "sha512-qN0Gqdw4c4KGPsBOQafj6yj/PA6c/L63f6CaZ/DCF/xF4Esu3jVmKLUDYxghFx8Kb/O7y9tI7x2RjTSXwdK1iQ==" "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw=="
}, },
"rbush": { "rbush": {
"version": "2.0.2", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/rbush/-/rbush-2.0.2.tgz", "resolved": "https://registry.npmjs.org/rbush/-/rbush-3.0.1.tgz",
"integrity": "sha512-XBOuALcTm+O/H8G90b6pzu6nX6v2zCKiFG4BJho8a+bY6AER6t8uQUZdi5bomQc0AprCWhEGa7ncAbbRap0bRA==", "integrity": "sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==",
"requires": { "requires": {
"quickselect": "^1.0.1" "quickselect": "^2.0.0"
} }
}, },
"resolve-protobuf-schema": { "resolve-protobuf-schema": {

View File

@@ -5,16 +5,16 @@
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/" "registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
}, },
"dependencies": { "dependencies": {
"ngx-openlayers": "1.0.0-next.9", "ngx-openlayers": "1.0.0-next.13",
"ol": "^5.3.3" "ol": "6.1.1"
}, },
"peerDependencies": { "peerDependencies": {
"@angular/core": "^7.2.0", "@angular/core": "^8.2.0",
"ngrx-store-localstorage": "^8.0.0", "ngrx-store-localstorage": "^8.0.0",
"@ngrx/effects": "^7.2", "@ngrx/effects": "^8.2",
"@ngrx/router-store": "^7.2", "@ngrx/router-store": "^8.2",
"@ngrx/store": "^7.2", "@ngrx/store": "^8.2",
"tassign": "^1.0.0", "tassign": "^1.0.0",
"@farmmaps/common": ">=0.0.1-prerelease.56 <0.0.1" "@farmmaps/common": ">=0.0.1-prerelease.181 <0.0.1"
} }
} }

View File

@@ -1,2 +0,0 @@
//$theme-colors: ( "primary": #a7ce39, "secondary": #ffc800 );
//$theme-colors: ( "primary": #a7ce39);

View File

@@ -1,9 +1,11 @@
import { Action } from '@ngrx/store'; import { Action } from '@ngrx/store';
import { IMapState,IItemLayer,IQueryState } from '../models'; import { IMapState } from '../models/map.state';
import { IItemLayer } from '../models/item.layer';
import { IQueryState } from '@farmmaps/common';
import { IItem } from '@farmmaps/common'; import { IItem } from '@farmmaps/common';
import { Feature } from 'ol'; import { Feature,Style } from 'ol';
import { Extent } from 'ol/extent'; import { IListItem } from 'dist/common/public-api';
export const SETSTATE = '[Map] SetState'; export const SETSTATE = '[Map] SetState';
export const SETMAPSTATE = '[Map] MapState'; export const SETMAPSTATE = '[Map] MapState';
@@ -15,11 +17,14 @@ export const STARTSEARCHSUCCESS = '[Map] StartSearchSuccess';
export const SELECTFEATURE = '[Map] SelectFeature'; export const SELECTFEATURE = '[Map] SelectFeature';
export const SELECTITEM = '[Map] SelectItem'; export const SELECTITEM = '[Map] SelectItem';
export const SELECTITEMSUCCESS = '[Map] SelectItemSuccess'; export const SELECTITEMSUCCESS = '[Map] SelectItemSuccess';
export const SELECTTEMPORALITEMSSUCCESS = '[Map] SelectTemporalItemsSuccess';
export const NEXTTEMPORAL = '[Map] NextTemporal';
export const PREVIOUSTEMPORAL = '[Map] PreviousTemporal';
export const SELECTTEMPORAL = '[Map] SelectTemporal';
export const ADDFEATURESUCCESS = '[Map] AddFeatureSuccess'; export const ADDFEATURESUCCESS = '[Map] AddFeatureSuccess';
export const UPDATEFEATURESUCCESS = '[Map] UpdateFeatureSuccess'; export const UPDATEFEATURESUCCESS = '[Map] UpdateFeatureSuccess';
export const EXPANDSEARCH = '[Map] ExpandSearch'; export const EXPANDSEARCH = '[Map] ExpandSearch';
export const COLLAPSESEARCH = '[Map] CollapseSearch'; export const COLLAPSESEARCH = '[Map] CollapseSearch';
export const TOGGLEMENU = '[Map] ToggleMenu';
export const SETEXTENT = '[Map] SetExtent'; export const SETEXTENT = '[Map] SetExtent';
export const SETQUERYSTATE = '[Map] SetQueryState'; export const SETQUERYSTATE = '[Map] SetQueryState';
export const SETTIMESPAN = '[Map] SetTimeSpan'; export const SETTIMESPAN = '[Map] SetTimeSpan';
@@ -34,6 +39,8 @@ export const SELECTBASELAYER = '[Map] SelectBaseLayers';
export const SELECTOVERLAYLAYER = '[Map] SelectOverlayLayers'; export const SELECTOVERLAYLAYER = '[Map] SelectOverlayLayers';
export const ZOOMTOEXTENT = '[Map] ZoomToExtent'; export const ZOOMTOEXTENT = '[Map] ZoomToExtent';
export const DOQUERY = '[Map] DoQuery'; export const DOQUERY = '[Map] DoQuery';
export const SETSTYLE = '[Map] SetStyle';
export const SHOWLAYERSWITCHER = '[Map] ShowLayerSwitcher';
export class SetState implements Action { export class SetState implements Action {
readonly type = SETSTATE; readonly type = SETSTATE;
@@ -95,6 +102,30 @@ export class SelectItemSuccess implements Action {
constructor(public item: IItem) { } constructor(public item: IItem) { }
} }
export class SelectTemporalItemsSuccess implements Action {
readonly type = SELECTTEMPORALITEMSSUCCESS;
constructor(public temporalItems: IItem[]) { }
}
export class NextTemporal implements Action {
readonly type = NEXTTEMPORAL;
constructor() { }
}
export class PreviousTemporal implements Action {
readonly type = PREVIOUSTEMPORAL;
constructor() { }
}
export class SelectTemporal implements Action {
readonly type = SELECTTEMPORAL;
constructor(item:IItem) { }
}
export class AddFeatureSuccess implements Action { export class AddFeatureSuccess implements Action {
readonly type = ADDFEATURESUCCESS; readonly type = ADDFEATURESUCCESS;
@@ -119,12 +150,6 @@ export class CollapseSearch implements Action {
constructor() { } constructor() { }
} }
export class ToggleMenu implements Action {
readonly type = TOGGLEMENU;
constructor() { }
}
export class SetExtent implements Action { export class SetExtent implements Action {
readonly type = SETEXTENT; readonly type = SETEXTENT;
@@ -209,6 +234,17 @@ export class DoQuery implements Action {
constructor(public query:IQueryState) { } constructor(public query:IQueryState) { }
} }
export class SetStyle implements Action {
readonly type = SETSTYLE;
constructor(public itemType:string,public style: Style | (Feature)) { }
}
export class ShowLayerSwitcher implements Action {
readonly type = SHOWLAYERSWITCHER;
constructor(public show:boolean) {}
}
export type Actions = SetMapState export type Actions = SetMapState
| Init | Init
| SetParent | SetParent
@@ -217,11 +253,14 @@ export type Actions = SetMapState
| SelectFeature | SelectFeature
| SelectItem | SelectItem
| SelectItemSuccess | SelectItemSuccess
| SelectTemporalItemsSuccess
| NextTemporal
| PreviousTemporal
| SelectTemporal
| AddFeatureSuccess | AddFeatureSuccess
| UpdateFeatureSuccess | UpdateFeatureSuccess
| ExpandSearch | ExpandSearch
| CollapseSearch | CollapseSearch
| ToggleMenu
| SetExtent | SetExtent
| SetQueryState | SetQueryState
| SetTimeSpan | SetTimeSpan
@@ -237,5 +276,7 @@ export type Actions = SetMapState
| ZoomToExtent | ZoomToExtent
| SetState | SetState
| SetViewExtent | SetViewExtent
| DoQuery; | DoQuery
| SetStyle
| ShowLayerSwitcher;

View File

@@ -5,7 +5,7 @@ import { AuthGuard } from '@farmmaps/common';
const routes = [ const routes = [
{ {
path: '', canActivateChild: [AuthGuard], children: [ path: '', children: [
{ {
path: '', path: '',
component: MapComponent component: MapComponent
@@ -13,7 +13,7 @@ const routes = [
] ]
}, },
{ {
path: ':xCenter/:yCenter/:zoom/:rotation/:baseLayer/:queryState', canActivateChild: [AuthGuard], children: [ path: ':xCenter/:yCenter/:zoom/:rotation/:baseLayer/:queryState', children: [
{ {
path: '', path: '',
component: MapComponent component: MapComponent

View File

@@ -16,12 +16,11 @@ import * as mapReducers from './reducers/map.reducer';
import * as mapActions from './actions/map.actions'; import * as mapActions from './actions/map.actions';
import * as mapEffects from './effects/map.effects'; import * as mapEffects from './effects/map.effects';
import { IMapState} from './models'; import { IMapState} from './models/map.state';
import { ISelectedFeatures } from './models'; import { ISelectedFeatures } from './models/selected.features';
import { IItemLayer } from './models'; import { IItemLayer } from './models/item.layer';
import { ItemLayer} from './models'; import { ItemLayer} from './models/item.layer';
import { IQueryState } from './models'; import { IPeriodState } from './models/period.state';
import { IPeriodState } from './models';
// components // components
import { GpsLocation} from './components/aol/gps-location/gps-location.component'; import { GpsLocation} from './components/aol/gps-location/gps-location.component';
@@ -35,6 +34,7 @@ import { AbstractItemListComponent,ItemListComponent} from './components/item-li
import { AbstractSelectedItemComponent, SelectedItemComponent } from './components/selected-item/selected-item.component'; import { AbstractSelectedItemComponent, SelectedItemComponent } from './components/selected-item/selected-item.component';
import { SelectedItemCropfieldComponent } from './components/selected-item-cropfield/selected-item-cropfield.component'; import { SelectedItemCropfieldComponent } from './components/selected-item-cropfield/selected-item-cropfield.component';
import { SelectedItemGeotiffComponent } from './components/selected-item-geotiff/selected-item-geotiff.component'; import { SelectedItemGeotiffComponent } from './components/selected-item-geotiff/selected-item-geotiff.component';
import { SelectedItemTemporalComponent} from './components/selected-item-temporal/selected-item-temporal.component';
import {SelectedItemShapeComponent } from './components/selected-item-shape/selected-item-shape.component'; import {SelectedItemShapeComponent } from './components/selected-item-shape/selected-item-shape.component';
import { SelectedItemContainerComponent } from './components/selected-item-container/selected-item-container.component'; import { SelectedItemContainerComponent } from './components/selected-item-container/selected-item-container.component';
import { AbstractFeatureListFeatureComponent, FeatureListFeatureComponent } from './components/feature-list-feature/feature-list-feature.component'; import { AbstractFeatureListFeatureComponent, FeatureListFeatureComponent } from './components/feature-list-feature/feature-list-feature.component';
@@ -46,7 +46,6 @@ import { WidgetHostDirective} from './components/widget-host/widget-host.directi
import { FeatureListComponent,AbstractFeatureListComponent} from './components/feature-list/feature-list.component'; import { FeatureListComponent,AbstractFeatureListComponent} from './components/feature-list/feature-list.component';
import { FileDropTargetComponent } from './components/aol/file-drop-target/file-drop-target.component'; import { FileDropTargetComponent } from './components/aol/file-drop-target/file-drop-target.component';
import { ItemVectorSourceComponent } from './components/aol/item-vector-source/item-vector-source.component'; import { ItemVectorSourceComponent } from './components/aol/item-vector-source/item-vector-source.component';
import { ItemFeaturesSourceComponent } from './components/aol/item-features-source/item-features-source.component';
import { ItemLayersComponent } from './components/aol/item-layers/item-layers.component'; import { ItemLayersComponent } from './components/aol/item-layers/item-layers.component';
import { ZoomToExtentComponent } from './components/aol/zoom-to-extent/zoom-to-extent.component'; import { ZoomToExtentComponent } from './components/aol/zoom-to-extent/zoom-to-extent.component';
import { RotationResetComponent } from './components/aol/rotation-reset/rotation-reset.component'; import { RotationResetComponent } from './components/aol/rotation-reset/rotation-reset.component';
@@ -54,18 +53,40 @@ import { LayerListComponent } from './components/aol/layer-list/layer-list.compo
import { MetaDataModalComponent } from './components/meta-data-modal/meta-data-modal.component'; import { MetaDataModalComponent } from './components/meta-data-modal/meta-data-modal.component';
import { SelectPeriodModalComponent } from './components/select-period-modal/select-period-modal.component'; import { SelectPeriodModalComponent } from './components/select-period-modal/select-period-modal.component';
import { MapComponent } from './components/map/map.component'; import { MapComponent } from './components/map/map.component';
import { MapSearchComponent } from './components/map-search'; import { MapSearchComponent } from './components/map-search/map-search.component';
import { MapRoutingModule } from './common-map-routing.module'; import { MapRoutingModule } from './common-map-routing.module';
import { LegendComponent } from './components/legend/legend.component'; import { LegendComponent } from './components/legend/legend.component';
import { LayerVectorImageComponent } from './components/aol/layer-vector-image/layer-vector-image.component'; import { LayerVectorImageComponent } from './components/aol/layer-vector-image/layer-vector-image.component';
import { StateSerializerService } from './services/state-serializer.service'; import {FeatureIconService} from './services/feature-icon.service';
import { GeolocationService } from './services/geolocation.service'; import { GeolocationService } from './services/geolocation.service';
import { localStorageSync } from 'ngrx-store-localstorage'; import {DeviceOrientationService} from './services/device-orientation.service';
import { WidgetStatusComponent } from './components/widget-status/widget-status.component'; import { WidgetStatusComponent } from './components/widget-status/widget-status.component';
import { ForChild} from './components/for-item/for-child.decorator'; import { ForChild} from './components/for-item/for-child.decorator';
import {ForItemType } from './components/for-item/for-itemtype.decorator'; import {ForItemType } from './components/for-item/for-itemtype.decorator';
import { ForSourceTask} from './components/for-item/for-sourcetask.decorator'; import { ForSourceTask} from './components/for-item/for-sourcetask.decorator';
import { PanToLocation} from './components/aol/pan-to-location/pan-to-location.component';
import {LayerSwitcher} from './components/layer-switcher/layer-switcher.component';
export function LocalStorageSync(reducer: ActionReducer<any>): ActionReducer<any> {
const r = function(state, action) {
const r2 = reducer(state, action);
if(action.type == "@ngrx/store/update-reducers") {
let ms = window.localStorage.getItem(MODULE_NAME+"_mapState");
if(ms) {
r2["mapState"] = JSON.parse(ms);
}
}
if(action.type == "[Map] MapState" || action.type == "[Map] SetState") {
window.localStorage.setItem(MODULE_NAME + "_mapState",JSON.stringify(r2["mapState"]));
}
return r2;
};
return r;
}
const metaReducers: Array<MetaReducer<any, any>> = [LocalStorageSync];
export { export {
mapEffects, mapEffects,
@@ -73,7 +94,6 @@ export {
mapActions, mapActions,
ZoomToExtentComponent, ZoomToExtentComponent,
ItemVectorSourceComponent, ItemVectorSourceComponent,
ItemFeaturesSourceComponent,
ItemLayersComponent, ItemLayersComponent,
FileDropTargetComponent, FileDropTargetComponent,
MapComponent, MapComponent,
@@ -97,6 +117,7 @@ export {
SelectedItemComponent, SelectedItemComponent,
SelectedItemCropfieldComponent, SelectedItemCropfieldComponent,
SelectedItemGeotiffComponent, SelectedItemGeotiffComponent,
SelectedItemTemporalComponent,
SelectedItemShapeComponent, SelectedItemShapeComponent,
ItemListItemComponent, ItemListItemComponent,
ItemListItemContainerComponent, ItemListItemContainerComponent,
@@ -104,19 +125,21 @@ export {
ItemWidgetListComponent, ItemWidgetListComponent,
WidgetStatusComponent, WidgetStatusComponent,
GpsLocation, GpsLocation,
PanToLocation,
LayerSwitcher,
AbstractFeatureListComponent, AbstractFeatureListComponent,
AbstractFeatureListFeatureComponent, AbstractFeatureListFeatureComponent,
AbstractSelectedItemComponent, AbstractSelectedItemComponent,
AbstractItemWidgetComponent, AbstractItemWidgetComponent,
AbstractItemListItemComponent, AbstractItemListItemComponent,
AbstractItemListComponent, AbstractItemListComponent,
StateSerializerService, FeatureIconService,
GeolocationService, GeolocationService,
DeviceOrientationService,
IMapState, IMapState,
ISelectedFeatures, ISelectedFeatures,
IItemLayer, IItemLayer,
ItemLayer, ItemLayer,
IQueryState,
IPeriodState, IPeriodState,
ForChild, ForChild,
ForItemType, ForItemType,
@@ -128,7 +151,7 @@ export {
CommonModule, CommonModule,
AngularOpenlayersModule, AngularOpenlayersModule,
MapRoutingModule, MapRoutingModule,
StoreModule.forFeature(MODULE_NAME, mapReducers.reducer), StoreModule.forFeature(MODULE_NAME, mapReducers.reducer,{metaReducers:metaReducers}),
EffectsModule.forFeature([mapEffects.MapEffects]), EffectsModule.forFeature([mapEffects.MapEffects]),
NgbModule, NgbModule,
FormsModule, FormsModule,
@@ -138,7 +161,6 @@ export {
declarations: [ declarations: [
ZoomToExtentComponent, ZoomToExtentComponent,
ItemVectorSourceComponent, ItemVectorSourceComponent,
ItemFeaturesSourceComponent,
ItemLayersComponent, ItemLayersComponent,
FileDropTargetComponent, FileDropTargetComponent,
MapComponent, MapComponent,
@@ -162,6 +184,7 @@ export {
SelectedItemComponent, SelectedItemComponent,
SelectedItemCropfieldComponent, SelectedItemCropfieldComponent,
SelectedItemGeotiffComponent, SelectedItemGeotiffComponent,
SelectedItemTemporalComponent,
SelectedItemShapeComponent, SelectedItemShapeComponent,
ItemListItemComponent, ItemListItemComponent,
ItemListItemContainerComponent, ItemListItemContainerComponent,
@@ -169,6 +192,8 @@ export {
ItemWidgetListComponent, ItemWidgetListComponent,
WidgetStatusComponent, WidgetStatusComponent,
GpsLocation, GpsLocation,
PanToLocation,
LayerSwitcher
], ],
entryComponents: [ entryComponents: [
FeatureListComponent, FeatureListComponent,
@@ -180,18 +205,20 @@ export {
SelectedItemComponent, SelectedItemComponent,
SelectedItemCropfieldComponent, SelectedItemCropfieldComponent,
SelectedItemGeotiffComponent, SelectedItemGeotiffComponent,
SelectedItemTemporalComponent,
SelectedItemShapeComponent, SelectedItemShapeComponent,
ItemListComponent, ItemListComponent,
ItemListItemComponent, ItemListItemComponent,
], ],
exports: [ exports: [
ItemVectorSourceComponent, ItemVectorSourceComponent,
ItemFeaturesSourceComponent,
ItemLayersComponent, ItemLayersComponent,
FileDropTargetComponent, FileDropTargetComponent,
MetaDataModalComponent, MetaDataModalComponent,
MapComponent, MapComponent,
GpsLocation, GpsLocation,
PanToLocation,
LayerSwitcher,
FeatureListFeatureComponent, FeatureListFeatureComponent,
FeatureListFeatureCropfieldComponent, FeatureListFeatureCropfieldComponent,
FeatureListFeatureCroppingschemeComponent, FeatureListFeatureCroppingschemeComponent,
@@ -199,6 +226,7 @@ export {
SelectedItemComponent, SelectedItemComponent,
SelectedItemCropfieldComponent, SelectedItemCropfieldComponent,
SelectedItemGeotiffComponent, SelectedItemGeotiffComponent,
SelectedItemTemporalComponent,
SelectedItemShapeComponent, SelectedItemShapeComponent,
ItemListItemComponent, ItemListItemComponent,
ItemListItemContainerComponent, ItemListItemContainerComponent,
@@ -221,13 +249,15 @@ export {
] ]
}) })
export class AppCommonMapModule { export class AppCommonMapModule {
static forRoot(): ModuleWithProviders { static forRoot(): ModuleWithProviders {
return { return {
ngModule: AppCommonMapModule, ngModule: AppCommonMapModule,
providers: [ providers: [
StateSerializerService, FeatureIconService,
GeolocationService, GeolocationService,
DeviceOrientationService,
{ provide: AbstractFeatureListComponent, useClass: FeatureListCroppingschemeComponent, multi: true }, { provide: AbstractFeatureListComponent, useClass: FeatureListCroppingschemeComponent, multi: true },
{ provide: AbstractFeatureListComponent, useClass: FeatureListCropfieldComponent, multi: true }, { provide: AbstractFeatureListComponent, useClass: FeatureListCropfieldComponent, multi: true },
{ provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureComponent, multi: true }, { provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureComponent, multi: true },
@@ -236,6 +266,7 @@ export class AppCommonMapModule {
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemComponent, multi: true }, { provide: AbstractSelectedItemComponent, useClass: SelectedItemComponent, multi: true },
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemCropfieldComponent, multi: true }, { provide: AbstractSelectedItemComponent, useClass: SelectedItemCropfieldComponent, multi: true },
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemGeotiffComponent, multi: true }, { provide: AbstractSelectedItemComponent, useClass: SelectedItemGeotiffComponent, multi: true },
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemTemporalComponent, multi: true },
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemShapeComponent, multi: true }, { provide: AbstractSelectedItemComponent, useClass: SelectedItemShapeComponent, multi: true },
{ provide: AbstractItemListItemComponent, useClass: ItemListItemComponent, multi: true }, { provide: AbstractItemListItemComponent, useClass: ItemListItemComponent, multi: true },
{ provide: AbstractItemListComponent, useClass: ItemListComponent, multi: true } { provide: AbstractItemListComponent, useClass: ItemListComponent, multi: true }

View File

@@ -1,4 +1,3 @@
@import "../../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";
@@ -11,25 +10,25 @@
} }
.tolerance { .tolerance {
fill: theme-color(); fill: $primary;
fill-opacity:0.4; fill-opacity:0.4;
} }
.border { .border {
fill: white; fill: $white;
} }
.center { .center {
fill: theme-color(); fill: $primary;
} }
.stop1 { .stop1 {
stop-color: theme-color(); stop-color: $primary;
stop-opacity:1; stop-opacity:1;
} }
.stop2 { .stop2 {
stop-color: theme-color(); stop-color:$primary;
stop-opacity: 0; stop-opacity: 0;
} }

View File

@@ -23,7 +23,7 @@ export class GpsLocation implements OnInit,OnChanges{
public path: string = ""; public path: string = "";
public rotate: string = ""; public rotate: string = "";
private resolution: number = 0; private resolution: number = 0;
@ViewChild('location') locationElement: ElementRef; @ViewChild('location', { static: true }) locationElement: ElementRef;
constructor(private map: MapComponent) { constructor(private map: MapComponent) {
@@ -62,7 +62,9 @@ export class GpsLocation implements OnInit,OnChanges{
this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude])); this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude]));
this.locationTolerance = p.coords.accuracy; this.locationTolerance = p.coords.accuracy;
this.recalcLocationTolerance(); this.recalcLocationTolerance();
this.heading = p.coords.heading; }
if(changes.heading && this.instance) {
this.rotate = "rotate(" + Math.round(changes.heading.currentValue) + " 500 500)";
} }
} }
} }

View File

@@ -1,90 +0,0 @@
import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken } from '@angular/core';
import { HttpClient } from "@angular/common/http";
import { LayerVectorComponent, SourceVectorComponent, MapComponent, LayerImageComponent } from 'ngx-openlayers';
import { LayerVectorImageComponent } from '../layer-vector-image/layer-vector-image.component';
import { ItemService } from '@farmmaps/common';
import { IItem } from '@farmmaps/common';
import { ISelectedFeatures } from '../../../models';
import {Vector} from 'ol/source';
import {Feature,Collection} from 'ol';
import {Extent} from 'ol/extent';
import * as style from 'ol/style';
import * as proj from 'ol/proj';
import Projection from 'ol/proj/Projection';
import * as loadingstrategy from 'ol/loadingstrategy';
import {GeoJSON} from 'ol/format';
@Component({
selector: 'fm-map-item-features-source',
template: `<ng-content></ng-content>`,
providers: [
{ provide: SourceVectorComponent, useExisting: forwardRef(() => ItemFeaturesSourceComponent) }
]
})
export class ItemFeaturesSourceComponent extends SourceVectorComponent implements OnInit, OnChanges {
instance:Vector;
features: Collection<Feature>;
@Input() item: IItem;
@Input() layerIndex: number = 0;
constructor(@Host() private layer: LayerVectorImageComponent, private itemService: ItemService, @Host() private map: MapComponent) {
super(layer);
}
private colorIndex = 0;
private styleCache = {};
ngOnInit() {
this.instance = new Vector({
loader: (extent: Extent, resolution: number, projection: Projection) => {
let format = new GeoJSON();
this.itemService.getItemFeatures(this.item.code, extent, projection.getCode(), this.layerIndex).subscribe((data) => {
var features = format.readFeatures(data);
// TODO 13/6/2019 The line below causes an endless loop. Action required?
this.instance.addFeatures(features);
// TODO 13/6/2019 Action required: check if feature collection hasn't been changed (Willem)
// var t = this.vectorSource.getFeatures();
});
},
format: new GeoJSON(),
strategy: loadingstrategy.bbox
});
this.features = new Collection<Feature>();
this.layer.instance
this.layer.instance.setStyle((feature) => {
var resolution = this.map.instance.getView().getResolution();
var r = (2 / resolution) / 2;
var color = feature.get("color");
return new style.Style(
{
fill: new style.Fill({
color: color
}),
image: new style.Circle({
fill: new style.Fill({
color: color
}),
stroke: new style.Stroke({
color: color,
width: 1.25
}),
radius: r
}),
stroke: new style.Stroke({
color: color,
width: 1.25
})
});
});
this.host.instance.setSource(this.instance);
}
ngOnChanges(changes: SimpleChanges) {
if (this.instance) {
if (changes['layerIndex']) {
this.instance.clear();
}
}
}
}

View File

@@ -1,10 +1,10 @@
import { Component, Host, Input, Output, EventEmitter, Optional, QueryList, OnInit, AfterViewInit, OnChanges, SimpleChanges, SkipSelf, forwardRef, Inject, InjectionToken } from '@angular/core'; import { Component, Host, Input, Output, EventEmitter, Optional, QueryList, OnInit, AfterViewInit, OnChanges, SimpleChanges, SkipSelf, forwardRef, Inject, InjectionToken } from '@angular/core';
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { LayerVectorComponent, LayerTileComponent, LayerGroupComponent, MapComponent } from 'ngx-openlayers'; import { LayerVectorComponent, LayerTileComponent, LayerGroupComponent, MapComponent } from 'ngx-openlayers';
import { ItemService } from '@farmmaps/common'; import { ItemService,IItem,AppConfig } from '@farmmaps/common';
import { AppConfig } from '@farmmaps/common'; import { IItemLayer,ItemLayer, ITemporalItemLayer} from '../../../models/item.layer';
import { IItemLayer, ILayerData, IRenderoutputTiles, IRenderoutputImage, IGradientstop, ILayer, IHistogram } from '../../../models'; import { ILayerData} from '../../../models/layer.data';
import { IRenderoutputTiles,IRenderoutputImage,IGradientstop,ILayer,IHistogram} from '../../../models/color.map';
import {Extent} from 'ol/extent'; import {Extent} from 'ol/extent';
import Projection from 'ol/proj/Projection'; import Projection from 'ol/proj/Projection';
import * as proj from 'ol/proj'; import * as proj from 'ol/proj';
@@ -85,16 +85,17 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
}); });
} }
createLayer(itemLayer: IItemLayer): Layer { createGeotiffLayer(item:IItem,itemLayer:IItemLayer):Layer {
var layerIndex = -1;
var layer: Layer = null; var layer: Layer = null;
if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') { layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
let source = new XYZ({ maxZoom: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/tiles/{z}/{x}/{y}.png?v=${itemLayer.item.updated.getTime()}` }); let source = new XYZ({ maxZoom: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${item.updated.getTime()}` });
layer = new Tile({ source: source }); layer = new Tile({ source: source });
var data = itemLayer.item.data; var data = item.data;
var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null; var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null;
if (l && l.rendering && l.rendering.renderoutputType == "Tiles") { if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
var rt = l.rendering as IRenderoutputTiles; var rt = l.rendering as IRenderoutputTiles;
let source = new XYZ({ maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/tiles/{z}/{x}/{y}.png?v=${itemLayer.item.updated.getTime()}` }); let source = new XYZ({ maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${item.updated.getTime()}` });
layer = new Tile({ source: source }); layer = new Tile({ source: source });
} }
if (l && l.rendering && l.rendering.renderoutputType == "Image") { if (l && l.rendering && l.rendering.renderoutputType == "Image") {
@@ -104,34 +105,39 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
units: 'pixels', units: 'pixels',
extent: ri.extent extent: ri.extent
}); });
let source = new ImageStatic({ imageExtent: ri.extent, projection: projection, url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/mapimage?v=${itemLayer.item.updated.getTime()}` }); let source = new ImageStatic({ imageExtent: ri.extent, projection: projection, url: `${this._apiEndPoint}/api/v1/items/${item.code}/mapimage/${layerIndex}?v=${item.updated.getTime()}` });
layer = new Image({ source: source }); layer = new Image({ source: source });
} }
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.shape.processed') { return layer;
var data = itemLayer.item.data; }
var layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index;
var l = itemLayer.item.data.layers[layerIndex]; createShapeLayer(item:IItem,itemLayer:IItemLayer):Layer {
var layerIndex = -1;
var layer: Layer = null;
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
var data = item.data;
var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null;
if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") { if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") {
var rt = itemLayer.item.data.layers[layerIndex].rendering as IRenderoutputTiles; var rt = item.data.layers[layerIndex].rendering as IRenderoutputTiles;
layer = new VectorTileLayer({ layer = new VectorTileLayer({
declutter: true, declutter: true,
source: new VectorTileSource({ source: new VectorTileSource({
maxZoom: rt.maxzoom, maxZoom: rt.maxzoom,
minZoom: rt.minzoom, minZoom: rt.minzoom,
format: new MVT(), format: new MVT(),
url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/vectortiles/{z}/{x}/{y}.pbf?v=${itemLayer.item.updated.getTime()}` url: `${this._apiEndPoint}/api/v1/items/${item.code}/vectortiles/{z}/{x}/{y}.pbf?v=${item.updated.getTime()}`
}), }),
style: (feature) => { style: (feature) => {
return this.getColorFromGradient(l, feature); return this.getColorFromGradient(l, feature);
} }
}) })
} if (l && l.rendering && l.rendering.renderoutputType == "Tiles") { } else if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
var rt = l.rendering as IRenderoutputTiles; var rt = l.rendering as IRenderoutputTiles;
layer = new Tile({ layer = new Tile({
source: new XYZ({ source: new XYZ({
maxZoom: rt.maxzoom, maxZoom: rt.maxzoom,
minZoom: rt.minzoom, minZoom: rt.minzoom,
url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/vectortiles/image_tiles/${layerIndex}/{z}/{x}/{y}.png?v=${itemLayer.item.updated.getTime()}` url: `${this._apiEndPoint}/api/v1/items/${item.code}/vectortiles/image_tiles/${layerIndex}/{z}/{x}/{y}.png?v=${item.updated.getTime()}`
}) })
}); });
} else { } else {
@@ -141,7 +147,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
strategy: loadingstrategy.bbox, strategy: loadingstrategy.bbox,
loader: function (extent: Extent, resolution: number, projection: Projection) { loader: function (extent: Extent, resolution: number, projection: Projection) {
var source = this as VectorSource; var source = this as VectorSource;
__this.itemService.getItemFeatures(itemLayer.item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) { __this.itemService.getItemFeatures(item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) {
var features = format.readFeatures(data); var features = format.readFeatures(data);
for (let f of features) { for (let f of features) {
if (f.get("code")) { if (f.get("code")) {
@@ -184,8 +190,12 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
} }
}); });
} }
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.layer') { return layer;
let data = itemLayer.item.data as ILayerData; }
createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer {
let data = item.data as ILayerData;
var layer: Layer = null;
switch (data.interfaceType) { switch (data.interfaceType) {
case 'OSM': { case 'OSM': {
let source = new OSM(); let source = new OSM();
@@ -211,6 +221,18 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
break; break;
} }
} }
return layer;
}
createLayer(itemLayer: IItemLayer): Layer {
var layer: Layer = null;
var layerIndex = -1;
if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') {
layer = this.createGeotiffLayer(itemLayer.item,itemLayer);
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {
layer = this.createShapeLayer(itemLayer.item,itemLayer);
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.layer') {
layer = this.createExternalLayer(itemLayer.item,itemLayer);
} }
if (layer) { if (layer) {
let geometry = new GeoJSON().readGeometry(itemLayer.item.geometry); let geometry = new GeoJSON().readGeometry(itemLayer.item.geometry);
@@ -226,33 +248,51 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
this.updateLayers(this.itemLayers); this.updateLayers(this.itemLayers);
} }
updateLayers(itemLayers: IItemLayer[]) { addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer {
if (itemLayers) { if(!itemLayer) return null;
var olLayers = this.instance.getLayers(); var olLayers = this.instance.getLayers();
itemLayers.forEach((itemLayer, index) => {
var layer = itemLayer.layer; var layer = itemLayer.layer;
let olIndex = olLayers.getArray().indexOf(layer); let olIndex = olLayers.getArray().indexOf(layer);
if (olIndex < 0) { if (olIndex < 0) {
// New layer: we add it to the map // New layer: we add it to the map
layer = this.createLayer(itemLayer); layer = this.createLayer(itemLayer);
if (layer) { if (layer) {
itemLayer.layer = layer;
}
olLayers.insertAt(index, layer); olLayers.insertAt(index, layer);
}
} else if (index !== olIndex) { } else if (index !== olIndex) {
// layer has moved inside the layers list // layer has moved inside the layers list
olLayers.removeAt(olIndex); olLayers.removeAt(olIndex);
olLayers.insertAt(index, layer); olLayers.insertAt(index, layer);
} }
if(layer) {
itemLayer.layer = layer;
layer.setOpacity(itemLayer.opacity); layer.setOpacity(itemLayer.opacity);
layer.setVisible(itemLayer.visible); layer.setVisible(itemLayer.visible);
}
return layer;
}
updateLayers(itemLayers: IItemLayer[]) {
let newLayers: IItemLayer[] = [];
if (itemLayers) {
itemLayers.forEach((itemLayer, index) => {
if(itemLayer.item.itemType == 'vnd.farmmaps.itemtype.temporal') {
let il = itemLayer as ITemporalItemLayer;
let previousLayer = this.addOrUpdateOlLayer(il.previousItemLayer,newLayers.length);
if(previousLayer) newLayers.push(previousLayer);
let selectedLayer = this.addOrUpdateOlLayer(il.selectedItemLayer,newLayers.length);
if(selectedLayer) newLayers.push(selectedLayer);
let nextLayer = this.addOrUpdateOlLayer(il.nextItemLayer,newLayers.length);
if(nextLayer) newLayers.push(nextLayer);
} else {
let layer = this.addOrUpdateOlLayer(itemLayer,newLayers.length);
if(layer) newLayers.push(layer);
}
}); });
// Remove the layers that have disapeared from childrenLayers // Remove the layers that have disapeared from childrenLayers
if (olLayers.getLength() > itemLayers.length) { var olLayers = this.instance.getLayers();
for (let i = itemLayers.length; i < olLayers.getLength(); i++) { while(olLayers.getLength() > newLayers.length) {
olLayers.removeAt(i); olLayers.removeAt(newLayers.length);
}
} }
} }
} }

View File

@@ -14,6 +14,8 @@ import {Vector,Cluster} from 'ol/source';
import {Layer} from 'ol/layer'; import {Layer} from 'ol/layer';
import {GeoJSON} from 'ol/format'; import {GeoJSON} from 'ol/format';
import {Select} from 'ol/interaction'; import {Select} from 'ol/interaction';
import {IStyles} from '../../../models/style.cache';
import {FeatureIconService} from '../../../services/feature-icon.service';
@Component({ @Component({
selector: 'fm-map-item-source-vector', selector: 'fm-map-item-source-vector',
@@ -31,41 +33,11 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
@Input() features: Array<Feature>; @Input() features: Array<Feature>;
@Input() selectedFeature: Feature; @Input() selectedFeature: Feature;
@Input() selectedItem: IItem; @Input() selectedItem: IItem;
@Input() styles:IStyles;
@Output() onFeaturesSelected: EventEmitter<Feature> = new EventEmitter<Feature>(); @Output() onFeaturesSelected: EventEmitter<Feature> = new EventEmitter<Feature>();
private styleCache = { private stylesCache:IStyles = {};
'file': new style.Style({
image: new style.Icon({
anchor: [0.5, 1],
scale: 0.05,
src: this.getIconImageDataUrl("fa fa-file-o")
}),
stroke: new style.Stroke({
color: 'red',
width: 1
}),
fill: new style.Fill({
color: 'rgba(0, 0, 255, 0.1)'
}),
geometry: (feature) => this.geometry(feature)
}),
'selected': new style.Style({
image: new style.Icon({
anchor: [0.5, 1],
scale: 0.08,
src: this.getIconImageDataUrl(null)
}),
stroke: new style.Stroke({
color: 'red',
width: 3
}),
fill: new style.Fill({
color: 'rgba(0, 0, 255, 0.1)'
}),
geometry: (feature) => this.geometry(feature)
})
};
constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, @Host() private map: MapComponent, private itemTypeService: ItemTypeService) { constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, @Host() private map: MapComponent, private itemTypeService: ItemTypeService,private featureIconService$:FeatureIconService) {
super(layer); super(layer);
this._format = new GeoJSON(); this._format = new GeoJSON();
} }
@@ -82,36 +54,23 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
return geometry; return geometry;
} }
getIconImageDataUrl(iconClass:string, backgroundColor: string = "#c80a6e",color:string = "#ffffff"): string { getSelectedStyle(feature:Feature):style.Style {
var canvas = document.createElement('canvas'); let key = feature.get('itemType')+"_selected";
canvas.width = 365; let evaluatedStyle =null;
canvas.height = 560; var styleEntry = this.stylesCache[key];
var ctx = canvas.getContext('2d'); if(styleEntry) {
ctx.lineWidth = 6; if(typeof styleEntry === 'function') {
ctx.fillStyle = backgroundColor; evaluatedStyle = styleEntry(feature);
ctx.strokeStyle = "#000000"; } else {
var path = new Path2D("m182.9 551.7c0 0.1 0.2 0.3 0.2 0.3s175.2-269 175.2-357.4c0-130.1-88.8-186.7-175.4-186.9-86.6 0.2-175.4 56.8-175.4 186.9 0 88.4 175.3 357.4 175.3 357.4z"); evaluatedStyle = styleEntry;
ctx.fill(path)
var iconCharacter = "";
if (iconClass != null) {
var element = document.createElement("i");
element.style.display = "none";
element.className = iconClass;
document.body.appendChild(element);
iconCharacter = getComputedStyle(element, "::before").content.replace(/"/g, '');
let iconFont = "200px " +getComputedStyle(element, "::before").fontFamily
document.body.removeChild(element);
ctx.strokeStyle = color;
ctx.fillStyle = color;
ctx.lineWidth = 15;
ctx.font = iconFont;
var ts = ctx.measureText(iconCharacter);
ctx.fillText(iconCharacter, 182.9 - (ts.width / 2), 250);
ctx.strokeText(iconCharacter, 182.9 - (ts.width / 2), 250);
} }
} else {
return canvas.toDataURL(); evaluatedStyle = this.stylesCache["selected"];
}
if(evaluatedStyle && evaluatedStyle.geometry_ == null) {
evaluatedStyle.setGeometry((feature) => this.geometry(feature));
}
return evaluatedStyle
} }
ngOnInit() { ngOnInit() {
@@ -119,14 +78,14 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
this.format = new GeoJSON(); this.format = new GeoJSON();
this._select = new Select({ this._select = new Select({
style: (feature) => { style: (feature) => {
return this.styleCache['selected']; return this.getSelectedStyle(feature);
}, },
hitTolerance: 10, hitTolerance: 10,
layers: [this.layer.instance as Layer] layers: [this.layer.instance as Layer]
}); });
this._hoverSelect = new Select({ this._hoverSelect = new Select({
style: (feature) => { style: (feature) => {
return this.styleCache['selected']; return this.getSelectedStyle(feature);
}, },
hitTolerance: 10, hitTolerance: 10,
condition: (e: MapBrowserEvent) => { condition: (e: MapBrowserEvent) => {
@@ -148,16 +107,16 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
this.host.instance.setStyle((feature) => { this.host.instance.setStyle((feature) => {
var key = feature.get('itemType') + (this.selectedItem?"_I":""); var key = feature.get('itemType') + (this.selectedItem?"_I":"");
if (!this.styleCache[key]) { if (!this.stylesCache[key]) {
if (this.itemTypeService.itemTypes[key]) { if (this.itemTypeService.itemTypes[key]) {
let itemType = this.itemTypeService.itemTypes[key]; let itemType = this.itemTypeService.itemTypes[key];
let fillColor = color.asArray(itemType.iconColor); let fillColor = color.asArray(itemType.iconColor);
fillColor[3] = this.selectedItem?0:0.5; fillColor[3] = this.selectedItem?0:0.5;
this.styleCache[key] = new style.Style({ this.stylesCache[key] = new style.Style({
image: itemType.icon ? new style.Icon({ image: itemType.icon ? new style.Icon({
anchor: [0.5, 1], anchor: [0.5, 1],
scale: 0.05, scale: 0.05,
src: this.getIconImageDataUrl(itemType.icon) src: this.featureIconService$.getIconImageDataUrl(itemType.icon)
}):null, }):null,
stroke: new style.Stroke({ stroke: new style.Stroke({
color: 'red', color: 'red',
@@ -166,14 +125,23 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
fill: new style.Fill({ fill: new style.Fill({
color: fillColor color: fillColor
}), }),
geometry: (feature) => this.geometry(feature) geometry:(feature) => this.geometry(feature)
}); });
} else { } else {
key = 'file'; key = 'file';
} }
} }
var styleEntry = this.styleCache[key]; let evaluatedStyle =null;
return styleEntry; var styleEntry = this.stylesCache[key];
if(typeof styleEntry === 'function') {
evaluatedStyle = styleEntry(feature);
} else {
evaluatedStyle = styleEntry;
}
if(evaluatedStyle && evaluatedStyle.geometry_ == null) {
evaluatedStyle.setGeometry((feature) => this.geometry(feature));
}
return evaluatedStyle;
}); });
} }
@@ -203,5 +171,13 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
this.map.instance.addInteraction(this._hoverSelect); this.map.instance.addInteraction(this._hoverSelect);
} }
} }
if (changes["styles"] && this.instance) {
let styles = changes["styles"].currentValue;
for (const key in styles) {
if (styles.hasOwnProperty(key)) {
this.stylesCache[key]=styles[key];
}
}
}
} }
} }

View File

@@ -1,5 +1,5 @@
import { Component,Input,Output,EventEmitter } from '@angular/core'; import { Component,Input,Output,EventEmitter } from '@angular/core';
import { IItemLayer } from '../../../models'; import { IItemLayer } from '../../../models/item.layer';
@Component({ @Component({
selector: 'fm-map-layer-list', selector: 'fm-map-layer-list',

View File

@@ -0,0 +1,13 @@
<div (click)="handleClick($event)" class="btn btn-outline-secondary gps-location">
<svg height="100%" width="100%" viewBox="0 0 96 96">
<g
id="XMLID_1_"><circle
class="pan-to" [ngClass]="{'pan-to-centered':centered(),'pan-to-disabled':disabled()}"
cx="48"
cy="48"
r="9.8000002"/><path
class="pan-to" [ngClass]="{'pan-to-centered':centered(),'pan-to-disabled':disabled()}"
d="M 80.5,44.8 H 73.8 C 72.3,33 63,23.7 51.3,22.2 v -6.7 h -6.5 v 6.7 C 33,23.7 23.7,33 22.2,44.8 h -6.7 v 6.5 h 6.7 C 23.7,63 33,72.3 44.8,73.8 v 6.7 h 6.5 V 73.8 C 63,72.3 72.3,63 73.8,51.3 h 6.7 z M 48,67.5 C 37.2,67.5 28.5,58.8 28.5,48 28.5,37.2 37.2,28.5 48,28.5 c 10.8,0 19.5,8.7 19.5,19.5 0,10.8 -8.7,19.5 -19.5,19.5 z"
inkscape:connector-curvature="0"/></g>
</svg>
</div>

View File

@@ -0,0 +1,37 @@
@import "~bootstrap/scss/bootstrap.scss";
.gps-location {
display:block;
width:2.5em;
height:2.5em;
background-color: $body-bg;
background-size: contain;
margin-top:0.5em;
border-radius: 1.75em;
padding:0
}
.center, .tolerance, .border {
stroke-width: 0;
}
.pan-to {
fill: $secondary;
}
div.gps-location:hover .pan-to {
fill: $white;
}
.pan-to-centered {
fill: $primary;
}
div.gps-location:hover .pan-to-centered {
fill: theme-color-level($color-name: "primary", $level: -10)
}
.pan-to.pan-to-disabled {
fill: $gray-300;
}

View File

@@ -0,0 +1,84 @@
import { Component, OnInit, Input, Host, OnChanges, SimpleChanges,ChangeDetectorRef } from '@angular/core';
import { MapComponent } from 'ngx-openlayers';
import {IMapState} from '../../../models/map.state'
import {View} from 'ol';
import { fromLonLat } from 'ol/proj';
@Component({
selector: 'fm-map-pan-to-location',
templateUrl: './pan-to-location.component.html',
styleUrls: ['./pan-to-location.component.scss']
})
export class PanToLocation implements OnInit,OnChanges{
view: View;
map: MapComponent;
@Input() position: Position;
@Input() mapState: IMapState;
@Input() animate: boolean;
constructor(@Host() map: MapComponent,private changeDetectorRef$: ChangeDetectorRef ) {
this.map = map;
}
ngOnInit() {
this.view = this.map.instance.getView();
this.view.on('change:center', () => {
this.changeDetectorRef$.detectChanges();
});
}
ngOnChanges(changes: SimpleChanges) {
// if (changes.position && this.instance) {
// var p = changes.position.currentValue as Position;
// this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude]));
// this.locationTolerance = p.coords.accuracy;
// this.recalcLocationTolerance();
// this.heading = p.coords.heading;
// }
}
p
public centered():boolean {
if(this.position && this.mapState) {
let center = this.view.getCenter();
let newCenter = fromLonLat([this.position.coords.longitude,this.position.coords.latitude]);
let x1 = newCenter[0].toFixed(0);
let x2 = center[0].toFixed(0);
let y1 = newCenter[1].toFixed(0);
let y2 = center[1].toFixed(0);
return x1==x2 && y1==y2;
}
return false;
}
public disabled():boolean {
return !this.position;
}
handleClick(event:Event) {
if(this.position) {
let view = this.map.instance.getView();
let newCenter = fromLonLat([this.position.coords.longitude,this.position.coords.latitude]);
let extent = [newCenter[0]-500,newCenter[1]-500,newCenter[0]+500,newCenter[1]+500];
var options = { padding: [0, 0, 0, 0],minResolution:1 };
let size = this.map.instance.getSize();
let rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
let threshold = 44 * rem;
var left = 1 * rem;
var right = 1 * rem;
var bottom = Math.round(size[1] / 2);
var top = 1 * rem;
if (size[0] > threshold) {
bottom = 1 * rem;
left = 23 * rem;
}
//options.padding = [top, right, bottom, left];
if (this.animate) options["duration"] = 2000;
view.fit(extent, options);
}
event.preventDefault();
}
}

View File

@@ -0,0 +1,35 @@
<div (click)="handleClick($event)" class="btn btn-outline-secondary compass" [style.transform]="Rotation()" [ngClass]="{'compass-n':IsNorth()}">
<svg height="100%" width="100%" viewBox="0 0 132.29166 132.29167">
<g
inkscape:label="Laag 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-164.70832)">
<g
id="g4550"
transform="translate(2.3213753,-1.8555167)">
<path
id="top-r"
d="m 63.824458,179.82737 v 52.8823 H 48.380953 Z"
style="stroke:none;stroke-width:0.15389842px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
id="top-l"
d="m 63.824458,179.82737 v 52.8823 h 15.443505 z"
style="stroke:none;stroke-width:0.15389842px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
id="bottom-l"
d="m 63.824458,285.59197 v -52.8823 h -15.4435 z"
style="stroke:none;stroke-width:0.15389842px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
id="bottom-r"
d="m 63.824458,285.59197 v -52.8823 h 15.443505 z"
style="stroke:none;stroke-width:0.15389842px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
<path
id="north"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:sans-serif;-inkscape-font-specification:'sans-serif Bold';stroke-width:2.95481014"
d="m 50.702335,239.32724 h 9.926315 l 12.534859,23.63848 v -23.63848 h 8.425825 v 34.46509 H 71.663019 L 59.12816,250.15385 v 23.63848 h -8.425825 z" />
</g>
</g>
</svg>
</div>

View File

@@ -0,0 +1,67 @@
@import "~bootstrap/scss/bootstrap.scss";
.compass {
width:2.5em;
height:2.5em;
background-color: white;
opacity: 1;
border-radius:1.75em;
padding:0;
margin-top:0.5em;
}
#north {
display: none;
fill:$black;
}
#top-l {
fill:#d40000;
}
#top-r {
fill:#ff0000;
}
#bottom-l {
fill:#000000;
}
#bottom-r {
fill:#666666;
}
div.compass:hover #top-l {
fill:$white;
}
div.compass:hover #top-r {
fill:$gray-300;
}
div.compass:hover #bottom-l {
fill:$gray-300;
}
div.compass:hover #bottom-r {
fill:$white;
}
div.compass:hover #north {
fill:$white;
}
.compass-n {
transition: opacity 1s ease-out 2s,height 1s ease-out 3s,margin-top 1s ease-out 3s;
opacity:0;
height:0;
margin-top:0;
}
.compass-n #bottom-l, .compass-n #bottom-r {
display: none;
}
.compass-n #north {
display: inline;
}

View File

@@ -7,22 +7,8 @@ import {View} from 'ol';
@Component({ @Component({
selector: 'fm-map-rotation-reset', selector: 'fm-map-rotation-reset',
template: `<div (click)="handleClick($event)" class="rounded-circle compass" [style.transform]="Rotation()" [ngClass]="{'compass-n':IsNorth()}"></div>`, templateUrl: './rotation-reset.component.html',
styles: [`.compass { styleUrls: ['./rotation-reset.component.scss']
width:2.5em;
height:2.5em;
background-color: white;
background-size: contain;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAF6AAABegB0iYb4wAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAmlSURBVHic7d39c1xVHcfxz92kCVh0BojVRpABRGBAKj6P4+io1LYp/hv9O/I/dNqmmU2mP9sf7SMFsSBaRMU+ZUAFB8HC1FKqJLR52D3+cJNm0ySb3XvPOd9zN+/XTGfa3eTe76T7yT3n3Hu/VwIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMlz0iMXpEes68CymnUBWGGkJu2xLgLLCEha9i7+AdDKSXc76bNL0s0/SZ+zrgc5jiDpeE7S3ZLuGpR+Zl0McgQkHSNLf6m1/B22CEg6bk/OnfS8ZSFYRkAS4KRvSHqo5aUHp6SnrerBMgKShlUrV01Ws5JAQNKwas7hmIckIbMuYLNz0r2Srkrql6TLi69nUkPStqek61a1gSNICnZpMRytnNTXlHYa1IMWBMTeunONGvMQcwTEkMt//r9o8/4ex/+RKX74tr4naVub94empO/GKgarERBbGw6hHMMsUwTEFgFJHAEx4qTtkr650ddl0rNvScMRSsIaCIidEXV2Hiqbl3aHLgZrIyB2Oh46ZQyzzHAm3YCTBiRdk/T5O9+7vPrLJWl6UBp6TJoNWxnuxBHExo+1RjjauGdO+lGoYrA+AmKj6wsRuXjRBgGx0fWcgnmIDQISmcv7Xn29wPc9fln6WoCS0AYBie+XRb+xyTArOgISX+EPeUZAomOZNyInbVW+vHvXel+zzjLvktlMGnpKmvZbGdbDESSu59QmHB0YFD2zoiIgcZVeieLixbgISFy7PGxjxDE0joaAROKkHZK+6mFTD1zK+2ghAgISj7ehEfeqx0NA4vH2oWYeEg9j2QicdJ/y3ld9G33tBsu8kvKeWTXpS09KH5cuDm1xBIljtzoIR6ec1Ndo0w0F/hCQOLwPiRhmxUFAAnP5kcPH8u4KmbTnVx6PSlgbAQnvB5LuD7Dd+56Uvh9gu2hBQMILdoEhT6IKj4CEF2yuwDwkPAISkMv7WT0TcBc7zksPBNz+pkdAwnpeYc81ZX0tzzaEfwQkrOBzBJo5hMWZ9EBcfu/Gf9Rde5+OzqTfYWZQup+eWWFwBAnnJ+oyHAVtvZX32UIABCScaEMf7lUPh4CEE/NDW7hTCtojIAG4vO/VYxF3+ehU3P1tGgQkjOgn8JqcNAyCgIQRfU7APCQMlnk9c9I9yntfDRb5/gLLvEvm+qWhJ6RPi28Cd+II4t9OFQxHSQNN6ecG++1pBMQ/s7kA8xD/CIhHi/2qLJ8nuJeeWX4REL+elfQVw/1vn+rgybnoHAHxy3wliUck+EVA/DKfA9BUzi/Gq544aUjSRyrZSKHEMu+SZkPaviPvw4WSOIL4s0dpdBmp1eiZ5Q0B8SeZsT9n1f0hIB4s9r7aaV1Hi90vS/3WRfQCAuLHDxWm91VR927L+3GhJALiR3JDGpZ7/SAgfiS3tJolWFMVEZCSnPSgpKet61jDM1PSQ9ZFVB0BKW+vEj2f5GyvC+sJBKS8ZMf69MwqL8nffFWx2PvqmvKbpLzwcCa91cxWaehh6ZbfzW4eHEHK+ak8hiOArTN5fy4UREDKSX6liA7w5RCQcpJvHF3LG2ijIAJSkJOekPSodR0bcdLD56XHreuoKgJSXGWGLv0VqjU1BKS4ynzomIcUxzJvAU76gvJHGwz43rbnZd4l87ekL35H+m+YzfcujiDF7FSAcAS0ZZCeWYUQkGIqN2ThXvViCEiXFvtO7bKuo1tOGqFnVvcISPe+rfzptVXz5YvSt6yLqBpuy+xS6F/B+/btC7btZrMp1evBtt+LOIJ078+SrlgXUcBH9Xr9L9ZFVA0B6Z6TdNq6iAJOKK8dXSAgxRy3LqBbWZZVruYUEJBizkiasy6iC/POuZesi6giAlLM/yS9Zl1Ep7Ise3V8fJyz6AUQkOKqNGSpUq1JISDFVeZDV6vVKlNraghIcW9Jese6iA7889ChQ29bF1FVBKSck9YFbMQ5d8y6hiojIOVUYehShRqTRUDKeVnStHURbczMz8+ftS6iyghIObPKQ5Kql44cOUJPrBIISHknrAtoI+XaKoGAlHdciV7j1Gg0TlnXUHUEpLz3JV2yLmINFyYmJt6zLqLqCIgfya0UcXGiHwTEj+TG+s655GqqIgLix+8lfWxdRItPhoeHz1kX0QsIiB8N5ZfAJ8E5d2p0dHTBuo5eQED8SWZIU6vVkqml6giIPyeVH0msNbMse8G6iF5BQPy5JukN6yIkvT42NnbVuoheQUD8SmFpNYUaegYB8ct87M/8wy8C4tebkv5tuP8Px8bG/mq4/55DQPxykiyvf0r2urCqIiD+Wc4BmH94RkD8O6P8PpHY5hYWFuh95RkB8W9a0quxd+qcOzs5Oflp7P32OgISRvSVpCzLWL0KgICEEX0uwOXtYRCQMP4m6e8R9/fO4cOHY+5v0yAg4cQc8vw64r42FQISTrSAMP8Ih4CEc1ZSjFWlmYGBgVci7GdTIiDhzEr6TYT9nNm/f7/FeZdNgYCEFXzow73nYRGQsI4p7LVRzjmXfAPtKiMgYV2RdCHg9s/X6/UPAm5/0yMg4YU8gcfJwcAISHjB5gjMP8IjIOGdU5ieWddv3LjxeoDtogUBCa8h6bTvjWZZdvLo0aMpdFHpaQQkjhBzBeYfERCQOE7Jb8+sRn9/P72vIiAgcVyX5G2+4Jw7d+DAgZR6AfcsAhKPzyERw6tICEg83j7UzjkCEgkBiee8pH952M4H9Xr9ooftoAMEJC4fy70nRO+raAhIXKWHRgyv4iIgcb0oqcxzy2e3bNkS4x4TLCIgcc1IKnz3X5Zlvz148OC0x3qwAQISX+ELDLk4MT4CEl/hDiSNRoOAREZA4ntXed+sbr09MTHxD9/FoD0CYqPrlShWr2wQEBtdD5V4cpQNAmLjFXXXM2t6YGDgd6GKwfoIiI055edEOvUCva9sEBA7Hc8pmH/YISB2Or2myjUaDcvnHm5qBMTOh5I6eSLtm5OTk1dCF4O1ERBbnQydGF4ZIiC2CEjiCIitP0q62ub9a8PDw2/EKgarERBbTUntupOcHB0dbcYqBqsREHvrDqF4MKc9AmLvtKSFNV5vLCwsnIldDFYiIPY+kfSHNV5/bWJi4nrsYrASAUnDqgsReTBnGghIGlbNNZh/pIGApOGipPda/v3+2NjYJatisIyApKP1WYPHzKrACgQkHbfnHDRnSEe/dQG47UVJNyVlWZbR+yoRBCQdNyWdleTGx8c/sy4GOQKSluOi725SCEhaTvT19VnXAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOvB/FOHOpgoUlk8AAAAASUVORK5CYII=);
opacity: 1;
}
.compass-n {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAF6AAABegB0iYb4wAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAe9SURBVHic7d07jB1XHcfx712vDXYinDhegw2YOOERYhzLxAhhAhhE4sSORUdDKioaKpoIEBHhIR4NSomgBEEdCQqKCImKAhHwxilAbpASiC3iOMkGr3cPxXizu/Zd37kz5zW734+0ze6Zmb/u3d89Z87MnAuSJEmSJEmSJEmSJEmSJEmSJEmSJEmSJEmSpE0qwCjAqHQdWjVTugCtc3QeHihdhFbNli5A65wJEIDnSxeihj1IXc6M4EzpIqTqBNgT4No8XDsPd5WuRw17kHo8BmwLsG0ZTpUuRg0DUo+3h1bBYZa0KjQ9x8UA4Vzzc+k5J1CqYA9Sh0+x/rxjzxx8slQxWmVA6nD6xl+MxvxO+RmQOtx0zuF5SB0MSGEB3gccGfOno/NwMHc9Ws+AlHeGje+/ejRnIbqZASlvw3ON4HlIcd45WlCAdwAXgdtXfje/vskbt8HeQ/BW3sq0wh6krJOsCccYt70On81Ui8YwIGVNHELNOMwqyoCUNfGfP8DZHIVoPANSSICPAB9s0fSe8/Dh1PVoPANSTusLgUteNCzGgJQzzT+9ASnEad4CQjNzdZFmmned+ZubA1ydhb33wZW0lelG9iBlPMKYcNzCjkX4YqpitDEDUsbUQ6YZh1lFGJDMrq97NfU9VgFOu2ZWfgYkv48DBzpst/88HItdjG7NgOTX+cr4slfVszMg+XU+l/Ahqvwc02YUYA54mVt8MG0wzbtieQn2H4X/xK1MG7EHyesx+r3mMzOumZWVAcmr9zmEiznkZUAyCbANeDjCrk65ZlY+BiSfTwN7Iuznzn3NOlrKwIDkE21o5LPq+RiQfKJN0foVCfkYkAwCvB/4WMT9HXkBPhBrf9qYAcnj8dg7XGqmjJWYAckj+jmD0715eCU9sQDvBC4Bu9q0n3Al/W0jWLgMd52Ahc7FaSJ7kPQ+T8twTCPAzt3wudj71XoGJL1kM07evJieAUkv2QLUTvemZ0ASCvBR4N6E+z/0N7gv1f5lQFJL/gm/zV4kKQOSVvJ/Xs9D0nKaN5EA76JZ+2r7NNu1neZdY3ER9h2DV6ffVJPYg6RziinD0dH2Ha6ZlYwBSSfblW4Xc0jHgCQQmtc12/cLjuBM8L1Mwhc1jQeB92Q83r5zzXpbisyApJF9ZsmlSdMwIGlkPyfwKcM0nOaNLMA+4CU6fvh0mOZdsRzgwBH4d/dd6Eb2IPGdpszrOjPKODGwVRiQ+IoNdRxmxecQK6LQrFf1CnBH1330GGIxgssLMHccFnvsRmvYg8T1ED3C0VeA3TvgRKnjb0YGJK7iU63e3RuXAYmr+DmA5yFxGZBIAhwE7i9dB3D4PNxduojNwoDEc7Z0ASuW7EWiMSDxVDP29yGqeJzmjSDATpqHo3ov79NnmnfFCBYWYO9xeDPC7rY0e5A4vkCCta+6CrBzF5wsXcdmYEDiqG5Is1xhTUNkQOKocSHp6Atmb0UGpKfQfK3B3aXrGOPgPBwuXcTQGZD+qp1S9Vn1/gxIf9WO9X3KsD+neXsIsJvm7t1oy/vEmOZd49oizLlmVnf2IP08Sp61r7qanYVHShcxZAakn+rH+H4TVT8GpKPr61CdKl3HJCM47ZpZ3fnCdfcJ4N2li5gkwNwLcLx0HUNlQLobzAyRNy92Z0C6G9LYfki1VsWAdBCaZUWHtNTngy/CgdJFDJEB6eY0w7qGNFoawIRCjQxIN4Mb03se0s2QPgWrEJoLg6/QXEWPLvKV9LVeG8HcYbia7hCbz2zpAgbofuAfqXae8hPr+rfuPp/wEJIkSZIkSZIkSZI0fN5q0s+dwB+m3OYtmpsdX+tx3GeB/S3bPgz8t8expM7mgNDh5+mex70wxbHmeh5L6qxrQK7Q73FdA5KJt7uXcTvwzdJFaDIDUs7XgHtKF6FbMyDl7ACeKl2Ebs2AlPUEcLR0EdqYASlrBvhu6SK0MQNS3peAE6WL0HgGpA4/Kl2AxjMgdfgMzUrxqowBqceP8f2ojm9IPR4Avly6CK1nQOryNHV/Ic+WY0DyuQRcntDmQ8BXM9SilgxIPleAn7Zo9xSwK3EtasmA5PUz4OUJbfYDX89Qi1owIHm9AXy/RbsngT2Ja1ELBiS/nwP/nNDmDuAbGWqRkprmgakLa7Z7okX7N4H3bnBcH5jKxB6kjF8Df53QZic+VKWB69qDAJxtsc1V4N4xx7UHycQepJxngT9OaLMdb4fXgPXpQQAearHdEnDshu3sQTKxBynrT8DvJrSZAb6XoRYpur49CMARml5i0vYn12xjD5KJPUh5fwd+06JdmwuMUlVi9CAAh4D/tdjH49fb24NkYg9ShwvAL1u0+yG+ZxqQWD0INDcpvt5iP1/BHiQbP43q8RLwTIt2PlSlwYjZg0Bzk+KlKfZpD5KYPUhdXgV+UroIrTIg9XkG+FfpItQwIPVZAH5Qugg1DEidfgG8WLoIGZBaXcO7eKtgQOr1W+AvpYvY6gxIvQLw7dJFbHUGpG6/B54rXcRWZkDq9yRNb6ICDEj9/kzzeK4KMCDD8C2ah6qUmQEZhnPAr0oXsRUZkOH4Ds1DVZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkSZIkbSX/B0lc8D0skvAeAAAAAElFTkSuQmCC);
transition: opacity 1s ease-out;
transition-delay: 2s;
opacity:0;
}
`]
}) })
export class RotationResetComponent implements OnInit { export class RotationResetComponent implements OnInit {
view: View; view: View;

View File

@@ -22,7 +22,7 @@ export class ZoomToExtentComponent implements OnChanges {
var options = { padding: [0, 0, 0, 0],minResolution:1 }; var options = { padding: [0, 0, 0, 0],minResolution:1 };
let size = this.map.instance.getSize(); let size = this.map.instance.getSize();
let rem = parseFloat(getComputedStyle(document.documentElement).fontSize); let rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
let threshold = 44 * rem; let threshold = 40 * rem;
var left = 1 * rem; var left = 1 * rem;
var right = 1 * rem; var right = 1 * rem;
var bottom = Math.round(size[1] / 2); var bottom = Math.round(size[1] / 2);

View File

@@ -1,4 +1,3 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";

View File

@@ -2,7 +2,7 @@ import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleCh
import { Feature } from 'ol'; import { Feature } from 'ol';
import { FeatureListComponent,AbstractFeatureListComponent } from '../feature-list/feature-list.component'; import { FeatureListComponent,AbstractFeatureListComponent } from '../feature-list/feature-list.component';
import { WidgetHostDirective } from '../widget-host/widget-host.directive'; import { WidgetHostDirective } from '../widget-host/widget-host.directive';
import {IQueryState } from '../../models/query.state'; import {IQueryState } from '@farmmaps/common';
import * as mapReducers from '../../reducers/map.reducer'; import * as mapReducers from '../../reducers/map.reducer';
import * as mapActions from '../../actions/map.actions'; import * as mapActions from '../../actions/map.actions';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
@@ -21,7 +21,7 @@ export class FeatureListContainerComponent {
@Input() features: Array<Feature> @Input() features: Array<Feature>
@Input() queryState: IQueryState; @Input() queryState: IQueryState;
@ViewChild(WidgetHostDirective) widgetHost: WidgetHostDirective; @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
loadComponent(queryState:IQueryState) { loadComponent(queryState:IQueryState) {
var componentFactory: ComponentFactory<AbstractFeatureListComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListComponent); // default var componentFactory: ComponentFactory<AbstractFeatureListComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListComponent); // default

View File

@@ -5,7 +5,7 @@
<h4 i18n>Farm</h4> <h4 i18n>Farm</h4>
<h3>{{schemeItem.name}}</h3> <h3>{{schemeItem.name}}</h3>
<div class="cropfields"> <div class="cropfields">
<div class="row m-0" *ngFor="let feature of features" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)"> <div class="row m-0 pl-3 pr-3" *ngFor="let feature of features" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
<fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container> <fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
</div> </div>
</div> </div>

View File

@@ -1,7 +1,6 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";
feature-list-feature-container { fm-map-feature-list-feature-container {
width:100%; width:100%;
pointer-events:none; pointer-events:none;
} }
@@ -18,6 +17,6 @@ feature-list-feature-container {
.cropfields { .cropfields {
border-top: 1px solid gray('500'); border-top: 1px solid gray('500');
margin-left: -1.5rem; margin-left: -1.25rem;
margin-right: -1.5rem; margin-right: -1.25rem;
} }

View File

@@ -4,7 +4,7 @@
<div><a href="#" (click)="handleBackClick($event)" i18n>Back</a></div> <div><a href="#" (click)="handleBackClick($event)" i18n>Back</a></div>
<h3 i18n><i class="fm fm-farm"></i> Farms</h3> <h3 i18n><i class="fm fm-farm"></i> Farms</h3>
<div class="farms"> <div class="farms">
<div class="row m-0" *ngFor="let feature of features" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)"> <div class="row m-0 pl-3 pr-3" *ngFor="let feature of features" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
<fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container> <fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
</div> </div>
</div> </div>

View File

@@ -1,7 +1,6 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";
feature-list-feature-container { fm-map-feature-list-feature-container {
width:100%; width:100%;
pointer-events:none; pointer-events:none;
} }
@@ -18,6 +17,6 @@ feature-list-feature-container {
.farms { .farms {
border-top: 1px solid gray('500'); border-top: 1px solid gray('500');
margin-left: -1.5rem; margin-left: -1.25rem;
margin-right: -1.5rem; margin-right: -1.25rem;
} }

View File

@@ -19,7 +19,7 @@ export class FeatureListFeatureContainerComponent {
@Input() feature: Feature; @Input() feature: Feature;
@ViewChild(WidgetHostDirective) widgetHost: WidgetHostDirective; @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
loadComponent() { loadComponent() {
var componentFactory: ComponentFactory<AbstractFeatureListFeatureComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListFeatureComponent); // default var componentFactory: ComponentFactory<AbstractFeatureListFeatureComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListFeatureComponent); // default

View File

@@ -1,6 +1,12 @@
<div *ngIf="feature;let feature" class="row m-0"> <div *ngIf="feature;let feature" class="d-flex m-0">
<div class="col p-2"> <div class="p-2">
<div #container class="thumbnail">
<canvas #canvas ></canvas>
</div>
</div>
<div class="flex-grow p-2 overflow-hidden">
<h1 class="card-title" title="{{feature.get('name')}}">{{feature.get('name')}}</h1> <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>{{feature.get('datadate')|date}}</span> - <span>{{feature.get('dataenddate')|date}}</span> </div>
</div> </div>
</div> </div>

View File

@@ -1,4 +1,3 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";
@@ -10,21 +9,18 @@
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.thumbnail > img { .card-text {
width: 100%; overflow: hidden;
height: auto; white-space: nowrap;
} text-overflow: ellipsis;
.thumbnail > div {
width: 100%;
font-size: 2rem;
text-align: center;
min-height: 3rem;
color: white;
padding-top: 0.5rem;
} }
.col { .col {
overflow: hidden; overflow: hidden;
} }
.thumbnail {
width: 4em;
height: 4em;
}

View File

@@ -1,10 +1,14 @@
import { Component, Input, Injectable} from '@angular/core'; import { Component, Injectable,ViewChild,AfterViewInit} from '@angular/core';
import { Feature } from 'ol'; import { Feature } from 'ol';
import * as extent from 'ol/extent';
import * as render from 'ol/render';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer'; import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common'; import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
import { AbstractFeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component'; import { AbstractFeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
import { ForItemType } from '../for-item/for-itemtype.decorator'; import { ForItemType } from '../for-item/for-itemtype.decorator';
import {getArea} from 'ol/sphere';
import * as style from 'ol/style';
@ForItemType("vnd.farmmaps.itemtype.cropfield") @ForItemType("vnd.farmmaps.itemtype.cropfield")
@@ -14,9 +18,58 @@ import { ForItemType } from '../for-item/for-itemtype.decorator';
templateUrl: './feature-list-feature-cropfield.component.html', templateUrl: './feature-list-feature-cropfield.component.html',
styleUrls: ['./feature-list-feature-cropfield.component.scss'] styleUrls: ['./feature-list-feature-cropfield.component.scss']
}) })
export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFeatureComponent { export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFeatureComponent implements AfterViewInit {
@ViewChild('canvas', { static: false }) canvas;
@ViewChild('container', { static: false }) container;
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService,config:AppConfig) { constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService,config:AppConfig) {
super(store, itemTypeService,config); super(store, itemTypeService,config);
} }
areaInHa(feature:Feature):number {
if(!feature) return 0;
// get area from faeture if 0 calculate from polygon
let a = feature.get('area');
if(a) return a;
return getArea(feature.getGeometry(),{projectio:"EPSG:3857"}) / 10000;
}
render(canvas,width,height,feature:Feature) {
let renderContext = render.toContext(canvas.getContext( '2d'),{ size: [width, height] });
let strokeStyle = new style.Style({
stroke: new style.Stroke({ color: 'black',width:1.5 })
});
let geom = feature.getGeometry().clone(),
line = geom.getCoordinates()[0],
e = extent.boundingExtent( line );
let dxy = extent.getCenter(e),
sxy = [
(width - 2 ) / extent.getWidth(e),
(height - 2 ) / extent.getHeight(e)
];
let dx = dxy[0],
dy = dxy[1],
sx = sxy[0],
sy = sxy[1];
geom.translate( -dx, -dy );
geom.scale( Math.min(sx, sy), -Math.min(sx, sy));
geom.translate( width / 2, height / 2 );
renderContext.setStyle( strokeStyle );
renderContext.drawGeometry( geom );
}
ngAfterViewInit() {
this.render(this.canvas.nativeElement,
this.container.nativeElement.offsetWidth,
this.container.nativeElement.offsetHeight,
this.feature);
}
} }

View File

@@ -1,4 +1,3 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";

View File

@@ -1,4 +1,3 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";

View File

@@ -1,6 +1,6 @@
<div *ngIf="features;let features"> <div *ngIf="features;let features">
<a href="#" (click)="handleBackClick($event)">Go back</a> <a href="#" (click)="handleBackClick($event)">Go back</a>
<div class="row m-0" *ngFor="let feature of features" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)"> <div class="row m-0 pl-3 pr-3" *ngFor="let feature of features" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
<fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container> <fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
</div> </div>
</div> </div>

View File

@@ -1,7 +1,6 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";
feature-list-feature-container { fm-map-feature-list-feature-container {
width: 100%; width: 100%;
pointer-events: none; pointer-events: none;
} }

View File

@@ -8,7 +8,7 @@ import * as mapActions from '../../actions/map.actions';
import { Observable, from } from 'rxjs'; import { Observable, from } from 'rxjs';
import { withLatestFrom } from 'rxjs/operators'; import { withLatestFrom } from 'rxjs/operators';
import { tassign } from 'tassign'; import { tassign } from 'tassign';
import { IQueryState } from '../../models'; import { IQueryState } from '@farmmaps/common';
@Injectable() @Injectable()

View File

@@ -19,7 +19,7 @@ export class ItemListItemContainerComponent {
@Input() item: IListItem; @Input() item: IListItem;
@ViewChild(WidgetHostDirective) widgetHost: WidgetHostDirective; @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
loadComponent() { loadComponent() {
var componentFactory: ComponentFactory<AbstractItemListItemComponent> = this.componentFactoryResolver.resolveComponentFactory(ItemListItemComponent); // default var componentFactory: ComponentFactory<AbstractItemListItemComponent> = this.componentFactoryResolver.resolveComponentFactory(ItemListItemComponent); // default

View File

@@ -1,4 +1,3 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";
.widget { .widget {

View File

@@ -1,4 +1,4 @@
<div *ngIf="items;let items" class="widget-container"> <div *ngIf="items;let items" class="widget-container pt-0">
<div class="widget" *ngFor="let item of items" (click)="handleItemClick(item)"> <div class="widget" *ngFor="let item of items" (click)="handleItemClick(item)">
<div class="content"> <div class="content">
<fm-map-item-list-item-container [item]="item" class="item-container"></fm-map-item-list-item-container> <fm-map-item-list-item-container [item]="item" class="item-container"></fm-map-item-list-item-container>

View File

@@ -1,4 +1,3 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";
.widget-container { .widget-container {
@@ -19,7 +18,7 @@
.widget:after { .widget:after {
content: ""; content: "";
display: block; display: block;
padding-bottom: 100%; padding-bottom: 66%;
} }
.content { .content {

View File

@@ -1,14 +1,10 @@
import { Component, Input, Injectable } from '@angular/core'; import { Component, Input, Injectable } from '@angular/core';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Feature } from 'ol';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer'; import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers,ItemTypeService, IItem, Item,IListItem } from '@farmmaps/common'; import { commonReducers,ItemTypeService,IListItem } from '@farmmaps/common';
import * as mapActions from '../../actions/map.actions'; import * as mapActions from '../../actions/map.actions';
import { Observable, from } from 'rxjs';
import { withLatestFrom } from 'rxjs/operators';
import { tassign } from 'tassign'; import { tassign } from 'tassign';
import { IQueryState } from '../../models';
@Injectable() @Injectable()

View File

@@ -1,4 +1,4 @@
<div *ngIf="widgets;let widgets" class="widget-container"> <div *ngIf="widgets;let widgets" class="widget-container pt-0">
<div class="widget" *ngFor="let widget of widgets"> <div class="widget" *ngFor="let widget of widgets">
<div class="content"> <div class="content">
<ng-template #widgetTemplate></ng-template> <ng-template #widgetTemplate></ng-template>

View File

@@ -1,4 +1,3 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";
.widget-container { .widget-container {

View File

@@ -0,0 +1,25 @@
<div class="btn btn-outline-secondary layer-switcher" (click)="handleClick($event)">
<i class="fa fa-map-o"></i>
<div class="layers hidden" [ngClass]="{'hidden':!(showLayerSwitcher|async)}" (click)="$event.stopPropagation();">
<div class="card layers-card m-1">
<div class="card-header" i18n>
Layers
<i class="float-right fa fa-close" (click)="close($event)"></i>
</div>
<ul class="navbar-nav">
<li class="nav-item py-0">
<span i18n><i class="fa fa-map-o" aria-hidden="true"></i> Base maps</span>
<div class="mb-4">
<fm-map-layer-list [baseLayers]="true" [itemLayers]="baseLayers|async" [selectedLayer]="selectedBaseLayer|async" (onSelectLayer)="handleSelectBaseLayer($event)"></fm-map-layer-list>
</div>
</li>
<li class="nav-item py-0">
<span i18n><i class="fa fa-map-o" aria-hidden="true"></i> Overlays</span>
<div class="mb-4">
<fm-map-layer-list [itemLayers]="overlayLayers|async" [selectedLayer]="selectedOverlayLayer|async" (onDelete)="handleOnDelete($event)" (onToggleVisibility)="handleOnToggleVisibility($event)" (onSetOpacity)="handleOnSetOpacity($event)" (onZoomToExtent)="handleZoomToExtent($event)" (onSelectLayer)="handleSelectOverlayLayer($event)"></fm-map-layer-list>
</div>
</li>
</ul>
</div>
</div>
</div>

View File

@@ -0,0 +1,71 @@
@import "~bootstrap/scss/bootstrap.scss";
.layer-switcher {
display:block;
width:2.5em;
height:2.5em;
background-color: $body-bg;
background-size: contain;
margin-top:0.5em;
text-align: center;
line-height: 2.5em;
border-radius: 1.75em;
padding: 0;
color: $secondary;
}
.layer-switcher i {
font-weight: bold;
}
.layers {
color:$secondary;
position: absolute;
overflow: hidden;
bottom: -1em;
right: -1em;
text-align: left;
min-width: 100vw;
z-index: 4;
// transition: max-height 0.3s ease-out,max-width 0.3s ease-out,min-height 0.3s ease-out,min-width 0.3s ease-out;
}
.hidden {
max-width:0;
max-height: 0;
min-height: 0;
min-width: 0;
}
.navbar-nav {
padding-left: 7px;
padding-right: 7px;
margin-bottom: 7px;
overflow-x: hidden;
overflow-y: auto;
bottom:-3rem;
height: 50vh;
}
@media screen and (min-width:44rem) {
.layer-switcher {
position: relative;
}
.layers {
max-width: 100%;
min-width: 22em;
bottom: 2.5em;
right: 2.5em;
min-height: 0;
max-height: calc(100vh - 9rem);
}
.hidden {
max-width:0;
max-height: 0;
min-height: 0;
min-width: 0;
}
}

View File

@@ -0,0 +1,75 @@
import { Component, OnInit, OnChanges, SimpleChanges } from '@angular/core';
import {IItemLayer} from '../../models/item.layer';
import { Store } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer';
import * as mapActions from '../../actions/map.actions';
import {createEmpty,extend } from 'ol/extent';
import { Observable } from 'rxjs';
@Component({
selector: 'fm-map-layer-switcher',
templateUrl: './layer-switcher.component.html',
styleUrls: ['./layer-switcher.component.scss']
})
export class LayerSwitcher implements OnInit,OnChanges{
public showLayerSwitcher:Observable<boolean>;
public overlayLayers: Observable<Array<IItemLayer>>;
public selectedOverlayLayer: Observable<IItemLayer>;
public baseLayers: Observable<Array<IItemLayer>>;
public selectedBaseLayer: Observable<IItemLayer>;
constructor( private store: Store<mapReducers.State>) {
}
ngOnInit() {
this.overlayLayers = this.store.select(mapReducers.selectGetOverlayLayers);
this.selectedOverlayLayer = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
this.baseLayers = this.store.select(mapReducers.selectGetBaseLayers);
this.selectedBaseLayer = this.store.select(mapReducers.selectGetSelectedBaseLayer);
this.showLayerSwitcher = this.store.select(mapReducers.selectGetShowLayerSwitcher);
}
ngOnChanges(changes: SimpleChanges) {
}
handleClick(event:Event) {
this.store.dispatch(new mapActions.ShowLayerSwitcher(true));
}
close(event:Event) {
this.store.dispatch(new mapActions.ShowLayerSwitcher(false));
}
handleOnToggleVisibility(itemLayer: IItemLayer) {
this.store.dispatch(new mapActions.SetVisibility(itemLayer,!itemLayer.visible));
}
handleOnSetOpacity(event:{ layer: IItemLayer,opacity:number }) {
this.store.dispatch(new mapActions.SetOpacity(event.layer, event.opacity));
}
handleOnDelete(itemLayer: IItemLayer) {
this.store.dispatch(new mapActions.RemoveLayer(itemLayer));
}
handleZoomToExtent(itemLayer: IItemLayer) {
var extent = createEmpty();
extend(extent, itemLayer.layer.getExtent());
if (extent) {
this.store.dispatch(new mapActions.SetExtent(extent));
}
}
handleSelectOverlayLayer(itemLayer: IItemLayer) {
this.store.dispatch(new mapActions.SelectOverlayLayer(itemLayer));
}
handleSelectBaseLayer(itemLayer: IItemLayer) {
this.store.dispatch(new mapActions.SelectBaseLayer(itemLayer));
}
}

View File

@@ -1,4 +1,4 @@
<table class="container" *ngIf="layer"> <table class="container" *ngIf="showLegend()">
<tr> <tr>
<td colspan="2"> <td colspan="2">
<div class="title"> <div class="title">
@@ -14,20 +14,22 @@
</td> </td>
</tr> </tr>
<tr *ngFor="let entry of layer.renderer.colorMap.entries; let i = index "> <tr *ngFor="let entry of layer.renderer.colorMap.entries; let i = index ">
<td class="legend-items"><div [style.background-color]="getHex(entry.color)"></div></td> <td class="legend-items"><span [style.background-color]="getHex(entry.color)" class="color"></span></td>
<td class="legend-items-text">{{entry.value | number:'1.0-2'}} {{legendunit}}</td> <td class="legend-items-text"><span *ngIf="!entry.label">{{entry.value | number:'1.0-2'}} {{legendunit}}</span><span *ngIf="entry.label">{{entry.label}}</span></td>
<!--<td class="histogram-items-text"><span *ngIf="histogramenabled">{{entry.value}} {{histogramunit}}</span></td>
<td class="histogram-items"> <td class="histogram-items">
<div *ngIf="histogramenabled" [style.background-color]="getHex(selectedColorMap.noValue)" [style.width]="getPart(selectedColorMap, entry)"> <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>
</div> </div>
</td>--> </td>
</tr> </tr>
<tr> <tr>
<td colspan="4"></td> <td colspan="4"></td>
</tr> </tr>
<!--<tr> <!--<tr *ngIf="layer.renderer.colorMap.entries.length > 0">
<td> <td>
<i class="fas fa-chart-bar" (click)="onClickHistoGram()"></i> <i title="Show histogram" class="fa fa-bar-chart fa-rotate-90" (click)="onClickHistoGram()"></i>
</td> </td>
<td colspan="3"></td> <td colspan="3"></td>
</tr>--> </tr>-->

View File

@@ -16,9 +16,13 @@
margin-bottom: 0; margin-bottom: 0;
} }
.legend-items { span.color {
display:inline-block;
width: 1.5em; width: 1.5em;
height: 1.5em; height: 1.5em;
}
.legend-items {
padding: 0.1em; padding: 0.1em;
border-style: none; border-style: none;
border-width: 0.05em; border-width: 0.05em;
@@ -36,16 +40,10 @@
} }
.histogram-items { .histogram-items {
width: 5em; width: 100%;
padding-left: 1em; padding-left: 1em;
} }
.histogram-items > div {
height: 1em;
border-style: solid;
border-width: 0.05em;
vertical-align: middle;
}
.histogram-items-text { .histogram-items-text {
max-width: 20em; max-width: 20em;
@@ -54,5 +52,16 @@
text-align: left; text-align: left;
} }
.bar {
display:inline-block;
height: 1em;
vertical-align: middle;
}
.bar-label {
margin-left:0.3em;
font-size:0.7em;
}

View File

@@ -1,5 +1,5 @@
import { Component, OnInit, Input,AfterViewInit } from '@angular/core'; import { Component, OnInit, Input,AfterViewInit } from '@angular/core';
import { IColorMap, IColor, IColorEntry,ILayer } from '../../models'; import { IColorMap, IColor, IColorEntry,ILayer, IRenderer } from '../../models/color.map';
@Component({ @Component({
@@ -45,22 +45,39 @@ export class LegendComponent implements OnInit,AfterViewInit {
this.histogramenabled = !this.histogramenabled; this.histogramenabled = !this.histogramenabled;
} }
public getHex(color: IColor): string { public getHex(color: IColor): string {
return '#' + this.componentToHex(color.red) + this.componentToHex(color.green) + this.componentToHex(color.blue); return '#' + this.componentToHex(color.red) + this.componentToHex(color.green) + this.componentToHex(color.blue);
} }
public componentToHex(c: number): string { private componentToHex(c: number): string {
const hex = c.toString(16); const hex = c.toString(16);
return hex.length === 1 ? `0${hex}` : hex; return hex.length === 1 ? `0${hex}` : hex;
} }
private getPart(colorMap: IColorMap, colorEntry: IColorEntry): string { public getPart(renderer: IRenderer, index: number): string {
let sumOfValue = colorMap.entries.reduce((sum, item) => sum + item.value, 0); let max = renderer.band.histogram.entries.reduce((max, entry) => entry.freqency > max ? entry.freqency : max, 0);
let part = ((colorEntry.value / sumOfValue) * 100) + "%"; let scale = 65 / max;
let part = (renderer.band.histogram.entries[index].freqency * scale) + "%";
return part; return part;
} }
public getLabel(renderer: IRenderer, index: number): string {
let scale = 100 / renderer.band.histogram.entries.reduce((sum, entry) => sum + entry.freqency, 0);
let percent = renderer.band.histogram.entries[index].freqency * scale;
return percent < 0.1 ? "" : percent.toFixed(1) + " %";
}
showLegend(): boolean {
return this.layer && this.layer.renderer && this.layer.renderer.renderType != "MULTIBAND_COLOR";
}
showHistogram(): boolean {
return this.histogramenabled && this.layer.renderer.band.histogram.entries && this.layer.renderer.band.histogram.entries.length > 0 && this.layer.renderer.colorMap.colormapType == "minmax";
}
} }

View File

@@ -1 +0,0 @@
export * from './map-search.component';

View File

@@ -26,6 +26,9 @@
<label class="form-check-label" for="filtercheck2">Restrict to visible area</label> <label class="form-check-label" for="filtercheck2">Restrict to visible area</label>
</div> </div>
</div> </div>
<div class="shortcuts">
<router-outlet name="map-search"></router-outlet>
</div>
</form> </form>
<ng-content></ng-content> <ng-content></ng-content>
</div> </div>

View File

@@ -1,11 +1,12 @@
@import "~bootstrap/scss/bootstrap.scss";
div.map-search { div.map-search {
position: absolute; position: absolute;
top: 0.5rem; top: 0.5rem;
left: 0.5rem; left: 0.5rem;
transition: opacity 0.5s ease-out, left 0.3s,max-height 0.3s ease-out,max-width 0.3s ease-out; transition: opacity 0.5s ease-out, left 0.3s,max-height 0.3s ease-out,max-width 0.3s ease-out;
max-height: 10rem; max-height: 10rem;
width: 21rem; min-width: calc(100vw - 1rem);
max-width: 21rem;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3); box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
z-index:3; z-index:3;
} }
@@ -40,11 +41,13 @@ div.map-search button {
div.map-search.collapsed { div.map-search.collapsed {
max-height:3.5rem; max-height:3.5rem;
max-width:10rem; max-width:10rem;
min-width: 0;
} }
div.map-search.searchcollapsed { div.map-search.searchcollapsed {
max-height: 3.5rem; max-height: 3.5rem;
max-width: 6rem; max-width: 6rem;
min-width: unset;
} }
div.map-search div.options { div.map-search div.options {
@@ -55,11 +58,24 @@ div.map-search div.options {
max-height:4.5rem; max-height:4.5rem;
} }
div.map-search div.shortcuts {
padding-top: 0.5rem;
line-height: 1.5rem;
overflow: hidden;
max-height: 50vh;
transition: max-height 0.3s ease-in-out;
}
div.map-search.collapsed div.options, div.map-search.searchcollapsed div.options { div.map-search.collapsed div.options, div.map-search.searchcollapsed div.options {
max-height: 0; max-height: 0;
padding:0; padding:0;
} }
div.map-search.collapsed div.shortcuts, div.map-search.searchcollapsed div.shortcuts {
max-height: 0;
padding:0;
}
div.map-search button { div.map-search button {
overflow: hidden; overflow: hidden;
} }
@@ -89,6 +105,18 @@ div.map-search.searchcollapsed button[type="submit"] {
white-space:nowrap; white-space:nowrap;
} }
.form-control, .form-control:focus {
border-color: $secondary;
}
@media screen and (min-width:44rem) {
div.map-search {
width: 21rem;
max-width: 21rem;
min-width:0;
}
}

View File

@@ -2,8 +2,8 @@ import { Component, Input, Output, OnInit, EventEmitter, SimpleChanges, OnChange
import { Observable , of } from 'rxjs'; import { Observable , of } from 'rxjs';
import { debounceTime,distinctUntilChanged,tap,switchMap,merge,catchError} from 'rxjs/operators'; import { debounceTime,distinctUntilChanged,tap,switchMap,merge,catchError} from 'rxjs/operators';
import { TypeaheadService, TimespanService } from '@farmmaps/common'; import { TypeaheadService, TimespanService } from '@farmmaps/common';
import { IQueryState,IPeriodState } from '../../models'; import { IQueryState } from '@farmmaps/common';
import { fillProperties } from '@angular/core/src/util/property'; import { IPeriodState } from '../../models/period.state';
import { tassign } from 'tassign'; import { tassign } from 'tassign';
@Component({ @Component({
@@ -13,7 +13,7 @@ import { tassign } from 'tassign';
}) })
export class MapSearchComponent { export class MapSearchComponent {
@ViewChild('searchText') searchText; @ViewChild('searchText', { static: true }) searchText;
@Input() clearEnabled: boolean @Input() clearEnabled: boolean
@Input() set collapsed(collapsed: boolean) { @Input() set collapsed(collapsed: boolean) {
this.collapsedLocal = collapsed; this.collapsedLocal = collapsed;

View File

@@ -1,58 +1,71 @@
<aol-map #map (onMoveEnd)="handleOnMoveEnd($event)" (click)="handleOnMouseDown($event)" [ngClass]="{'panel-visible':(panelVisible|async)}" class="map"> <ng-container *ngIf="{
mapState:mapState$|async,
extent:extent$|async,
baseLayers:baseLayers$|async,
overlayLayers:overlayLayers$|async,
selectedItemLayer:selectedItemLayer$|async,
features:features$|async,
position:position$|async,
parentCode:parentCode$|async,
panelVisible:panelVisible$|async,
openedModalName:openedModalName$|async,
panelCollapsed:panelCollapsed$|async,
searchMinified:searchMinified$|async,
selectedItem:selectedItem$|async,
queryState:queryState$|async,
searchCollapsed:searchCollapsed$|async,
clearEnabled:clearEnabled$|async,
period:period$|async,
compassHeading:compassHeading$|async,
styles:styles$|async,
selectedFeature:selectedFeature$|async
} as state">
<aol-map #map (moveEnd)="handleOnMoveEnd($event)" (click)="handleOnMouseDown($event)" [ngClass]="{'panel-visible':state.panelVisible}" class="map">
<div> <div>
</div> </div>
<aol-view [zoom]="(mapState|async).zoom" [rotation]="(mapState|async).rotation"> <aol-view [zoom]="state.mapState.zoom" [rotation]="state.mapState.rotation">
<aol-coordinate [x]="(mapState|async).xCenter" [y]="(mapState|async).yCenter" [srid]="'EPSG:4326'"></aol-coordinate> <aol-coordinate [x]="state.mapState.xCenter" [y]="state.mapState.yCenter" [srid]="'EPSG:4326'"></aol-coordinate>
<fm-map-zoom-to-extent [extent]="extent|async" [animate]="true"></fm-map-zoom-to-extent> <fm-map-zoom-to-extent [extent]="state.extent" [animate]="true"></fm-map-zoom-to-extent>
</aol-view> </aol-view>
<aol-interaction-default></aol-interaction-default> <aol-interaction-default></aol-interaction-default>
<aol-interaction-dragrotateandzoom></aol-interaction-dragrotateandzoom> <aol-interaction-dragrotateandzoom></aol-interaction-dragrotateandzoom>
<fm-map-item-layers [itemLayers]="baseLayers|async"></fm-map-item-layers> <fm-map-item-layers [itemLayers]="state.baseLayers"></fm-map-item-layers>
<fm-map-item-layers [itemLayers]="overlayLayers|async"></fm-map-item-layers> <fm-map-item-layers [itemLayers]="state.overlayLayers"></fm-map-item-layers>
<fm-map-item-layers [itemLayer]="selectedItemLayer|async"></fm-map-item-layers> <fm-map-item-layers [itemLayer]="state.selectedItemLayer"></fm-map-item-layers>
<aol-layer-vector> <aol-layer-vector>
<fm-map-item-source-vector [features]="features|async" (onFeaturesSelected)="handleFeaturesSelected($event)" [selectedFeature]="selectedFeature|async" [selectedItem]="selectedItem|async"></fm-map-item-source-vector> <fm-map-item-source-vector [styles]="state.styles" [features]="state.features" (onFeaturesSelected)="handleFeaturesSelected($event)" [selectedFeature]="state.selectedFeature" [selectedItem]="state.selectedItem"></fm-map-item-source-vector>
</aol-layer-vector> </aol-layer-vector>
<fm-map-gps-location [position]="position|async" [headingTolerance]="20" [showHeading]="true"></fm-map-gps-location> <fm-map-gps-location [position]="state.position" [headingTolerance]="20" [showHeading]="true" [heading]="state.compassHeading"></fm-map-gps-location>
<div class="control-container"> <div class="control-container">
<!-- <switch2d3d></switch2d3d>--> <!-- <switch2d3d></switch2d3d>-->
<fm-map-layer-switcher></fm-map-layer-switcher>
<fm-map-pan-to-location [position]="state.position" [mapState]="state.mapState" [animate]="true"></fm-map-pan-to-location>
<fm-map-rotation-reset></fm-map-rotation-reset> <fm-map-rotation-reset></fm-map-rotation-reset>
</div> </div>
<fm-map-file-drop-target [parentCode]="(parentCode | async)" (onFileDropped)="handleFileDropped($event)"></fm-map-file-drop-target> <fm-map-file-drop-target [parentCode]="state.parentCode" (onFileDropped)="handleFileDropped($event)"></fm-map-file-drop-target>
</aol-map> </aol-map>
<fm-map-map-search #mapSearch [openedModalName]="openedModalName|async" (onOpenModal)="handleOpenModal($event)" (onCloseModal)="handleCloseModal()" [ngClass]="{'menuVisible':(menuVisible|async)}" (onToggleMenu)="handleToggleMenu($event)" (onSearchCollapse)="handleSearchCollapse($event)" (onSearchExpand)="handleSearchExpand($event)" [collapsed]="searchCollapsed|async" [searchMinified]="(searchMinified | async)" (onSearch)="handleSearch($event)" (onClear)="handleClearSearch($event)" [filterOptions]="queryState|async" [clearEnabled]="clearEnabled|async" [period]="period|async"></fm-map-map-search> <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-side-panel [resizeable]="true" [visible]="(panelVisible|async)" [collapsed]="(panelCollapsed|async)" [collapsable]="false"> <fm-side-panel [resizeable]="true" [visible]="state.panelVisible" [collapsed]="state.panelCollapsed" [collapsable]="false">
<div class="panel-wrapper"> <div class="panel-wrapper">
<div class="panel-top bg-secondary" *ngIf="!(searchMinified | async)"> <div class="panel-top bg-secondary" *ngIf="!(state.searchMinified)">
</div> </div>
<div class="panel-bottom"> <div class="panel-bottom">
<div *ngIf="!(selectedItem|async)"> <div *ngIf="!(state.selectedItem)">
<fm-map-feature-list-container [features]="(features | async)" [queryState]="(queryState|async)"></fm-map-feature-list-container> <fm-map-feature-list-container [features]="state.features" [queryState]="state.queryState"></fm-map-feature-list-container>
</div> </div>
<div *ngIf="(selectedItem | async);let item"> <div *ngIf="state.selectedItem;let item">
<fm-map-selected-item-container [item]="item"></fm-map-selected-item-container> <fm-map-selected-item-container [item]="item" [itemLayer]="state.selectedItemLayer"></fm-map-selected-item-container>
</div> </div>
<div *ngIf="(features|async).length == 0" class="no-results m-2"> <div *ngIf="state.features.length == 0" class="no-results m-2">
<div *ngIf="(queryState|async)?.query">Cannot find <span>{{(queryState|async)?.query}}</span></div> <div *ngIf="state.queryState.query">Cannot find <span>{{state.queryState?.query}}</span></div>
<div *ngIf="(queryState|async)?.tags">Cannot find tag <span>{{(queryState|async)?.tags}}</span></div> <div *ngIf="state.queryState?.tags">Cannot find tag <span>{{state.queryState?.tags}}</span></div>
</div> </div>
</div> </div>
</div> </div>
</fm-side-panel> </fm-side-panel>
<fm-side-panel [visible]="(menuVisible|async)" class="menu"> </ng-container>
<div class="container-fluid">
<div class="body">
<div class="d-flex flex-row">
<div class="mt-2 mb-2 flex-grow-1 logo"><router-outlet name="side-panel-logo"></router-outlet></div>
<div class="mt-2 mb-2 ml-2"><button type="button" class="btn btn-outline-secondary" (click)="handleToggleMenu($event)"><i class="fa fa-times" aria-hidden="true"></i></button></div>
</div>
<div class="d-flex flex-column cards">
<router-outlet name="side-panel-menu"></router-outlet>
</div>
</div>
</div>
</fm-side-panel>

View File

@@ -1,4 +1,3 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";
aol-map { position:absolute;width:100%;height:100%;} aol-map { position:absolute;width:100%;height:100%;}
@@ -117,10 +116,6 @@ timespan.menuVisible {
transition: height 0.5s; transition: height 0.5s;
} }
:host ::ng-deep .menu .side-panel {
z-index: 100;
background-color: rgb(245,245,245);
}
@media screen and (min-width:44rem) { @media screen and (min-width:44rem) {
.panel-top { .panel-top {

View File

@@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy, HostListener, Inject, ViewChild, AfterViewInit } from '@angular/core'; import { Component, OnInit, OnDestroy, HostListener, Inject, ViewChild, AfterViewInit,ChangeDetectorRef,NgZone } from '@angular/core';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Observable, Subject, Subscription,combineLatest, from } from 'rxjs'; import { Observable, Subject, Subscription,combineLatest, from } from 'rxjs';
import { debounce, withLatestFrom, first, combineAll } from 'rxjs/operators'; import { debounce, withLatestFrom, first, combineAll } from 'rxjs/operators';
@@ -9,11 +9,17 @@ import { Store } from '@ngrx/store';
// Map // Map
import * as mapReducers from '../../reducers/map.reducer'; import * as mapReducers from '../../reducers/map.reducer';
import * as mapActions from '../../actions/map.actions'; import * as mapActions from '../../actions/map.actions';
import { IMapState,ISelectedFeatures,IItemLayer, ItemLayer,IQueryState,IPeriodState } from '../../models'; import { IMapState} from '../../models/map.state';
import { ISelectedFeatures } from '../../models/selected.features';
import { IItemLayer } from '../../models/item.layer';
import { IQueryState } from '@farmmaps/common';
import { IPeriodState } from '../../models/period.state';
import {IStyles} from '../../models/style.cache';
import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component'; import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component';
import { IMetaData } from '../meta-data-modal/meta-data-modal.component'; import { IMetaData } from '../meta-data-modal/meta-data-modal.component';
import { StateSerializerService } from '../../services/state-serializer.service'; import { StateSerializerService } from '@farmmaps/common';
import { GeolocationService} from '../../services/geolocation.service'; import { GeolocationService} from '../../services/geolocation.service';
import {DeviceOrientationService} from '../../services/device-orientation.service';
// AppCommon // AppCommon
import { ResumableFileUploadService, ItemTypeService } from '@farmmaps/common'; import { ResumableFileUploadService, ItemTypeService } from '@farmmaps/common';
@@ -26,6 +32,7 @@ import {Extent,createEmpty,extend } from 'ol/extent';
import {transform} from 'ol/proj'; import {transform} from 'ol/proj';
import { query } from '@angular/animations'; import { query } from '@angular/animations';
import { tassign } from 'tassign'; import { tassign } from 'tassign';
import * as style from 'ol/style';
@Component({ @Component({
@@ -36,41 +43,54 @@ import { tassign } from 'tassign';
export class MapComponent implements OnInit, OnDestroy,AfterViewInit { export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
title: string = 'Map'; title: string = 'Map';
public openedModalName: Observable<string>; public openedModalName$: Observable<string> = this.store.select(commonReducers.selectOpenedModalName);
public itemTypes: Observable<{ [id: string]: IItemType }>; public itemTypes$: Observable<{ [id: string]: IItemType }>;
public mapState: Observable<IMapState>; public mapState$: Observable<IMapState> = this.store.select(mapReducers.selectGetMapState);
public features: Observable<Array<Feature>>; public features$: Observable<Array<Feature>> = this.store.select(mapReducers.selectGetFeatures);
public overlayLayers: Observable<Array<IItemLayer>>; public overlayLayers$: Observable<Array<IItemLayer>> = this.store.select(mapReducers.selectGetOverlayLayers);
public selectedOverlayLayer: Observable<IItemLayer>; public selectedOverlayLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
public selectedItemLayer: Observable<IItemLayer>; public selectedItemLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedItemLayer);
public baseLayers: Observable<Array<IItemLayer>>; public baseLayers$: Observable<Array<IItemLayer>> = this.store.select(mapReducers.selectGetBaseLayers);
public selectedBaseLayer: Observable<IItemLayer>; public selectedBaseLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedBaseLayer);
public projection: Observable<string>; public projection$: Observable<string> = this.store.select(mapReducers.selectGetProjection);
public selectedFeatures: Subject<ISelectedFeatures> = new Subject<ISelectedFeatures>(); public selectedFeatures$: Subject<ISelectedFeatures> = new Subject<ISelectedFeatures>();
public droppedFile: Subject<IDroppedFile> = new Subject<IDroppedFile>(); public droppedFile$: Subject<IDroppedFile> = new Subject<IDroppedFile>();
private paramSub: Subscription; private paramSub: Subscription;
private itemTypeSub: Subscription; private itemTypeSub: Subscription;
private mapStateSub: Subscription; private mapStateSub: Subscription;
private queryStateSub: Subscription; private queryStateSub: Subscription;
public parentCode: Observable<string>; public parentCode$: Observable<string> =this.store.select(mapReducers.selectGetParentCode);
public panelVisible: Observable<boolean>; public panelVisible$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelVisible);
public panelCollapsed: Observable<boolean>; public panelCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelCollapsed);
public selectedFeature: Observable<Feature>; public selectedFeature$: Observable<Feature> = this.store.select(mapReducers.selectGetSelectedFeature);
public selectedItem: Observable<IItem>; public selectedItem$: Observable<IItem> = this.store.select(mapReducers.selectGetSelectedItem);
public queryState: Observable<IQueryState>; public queryState$: Observable<IQueryState> = this.store.select(mapReducers.selectGetQueryState);
public period: Observable<IPeriodState>; public period$: Observable<IPeriodState> = this.store.select(mapReducers.selectGetPeriod);
public clearEnabled: Observable<boolean>; public clearEnabled$: Observable<boolean> = this.store.select(mapReducers.selectGetClearEnabled);
public searchCollapsed: Observable<boolean>; public searchCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetSearchCollapsed);
public searchMinified: Observable<boolean>; public searchMinified$: Observable<boolean> = this.store.select(mapReducers.selectGetSearchMinified);
public menuVisible: Observable<boolean>; public menuVisible$: Observable<boolean>;
public query: Observable<IQueryState>; public query$: Observable<IQueryState> = this.store.select(mapReducers.selectGetQuery);
public position: Observable<Position>; public position$: Observable<Position> = this.geolocationService.getCurrentPosition();
public compassHeading$: Observable<number> = this.deviceorientationService.getCurrentCompassHeading();
public baseLayersCollapsed:boolean = true; public baseLayersCollapsed:boolean = true;
public overlayLayersCollapsed: boolean = true; public overlayLayersCollapsed: boolean = true;
public extent: Observable<Extent>; public extent$: Observable<Extent> = this.store.select(mapReducers.selectGetExtent);
@ViewChild('map') map; public styles$:Observable<IStyles> = this.store.select(mapReducers.selectGetStyles);
private setStateCount$:Observable<number> = this.store.select(mapReducers.selectgetSetStateCount);
constructor(private store: Store<mapReducers.State | commonReducers.State>, private route: ActivatedRoute, private router: Router, private uploadService: ResumableFileUploadService, private serializeService: StateSerializerService, public itemTypeService: ItemTypeService, private location: Location, private geolocationService: GeolocationService ) { @ViewChild('map', { static: false }) map;
constructor(private store: Store<mapReducers.State | commonReducers.State>,
private route: ActivatedRoute,
private router: Router,
private uploadService: ResumableFileUploadService,
private serializeService: StateSerializerService,
public itemTypeService: ItemTypeService,
private location: Location,
private geolocationService: GeolocationService,
private zone: NgZone,
private deviceorientationService:DeviceOrientationService) {
} }
@HostListener('document:keyup', ['$event']) @HostListener('document:keyup', ['$event'])
@@ -95,7 +115,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
handleFeaturesSelected(feature: Feature) { handleFeaturesSelected(feature: Feature) {
if (feature) { if (feature) {
let newQuery = tassign(mapReducers.initialQueryState, { itemCode: feature.get('code') }); let newQuery = tassign(mapReducers.initialQueryState, { parentCode: feature.get('parentCode'), itemCode: feature.get('code'),itemType:feature.get('itemType') });
this.store.dispatch(new mapActions.DoQuery(newQuery)); this.store.dispatch(new mapActions.DoQuery(newQuery));
} }
} }
@@ -106,46 +126,51 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
ngOnInit() { ngOnInit() {
this.store.dispatch(new mapActions.Init()); this.store.dispatch(new mapActions.Init());
this.selectedFeatures.next({x:0,y:0,features:[]}); this.selectedFeatures$.next({x:0,y:0,features:[]});
this.mapState = this.store.select(mapReducers.selectGetMapState); this.selectedFeatures$.next(null);
this.parentCode = this.store.select(mapReducers.selectGetParentCode); this.query$.pipe(withLatestFrom(this.mapState$),withLatestFrom(this.setStateCount$)).subscribe(([[queryState,mapState],setStateCount]) =>{
this.features = this.store.select(mapReducers.selectGetFeatures); if(setStateCount>0) {
this.overlayLayers = this.store.select(mapReducers.selectGetOverlayLayers); this.replaceUrl(mapState,queryState,false);
this.selectedOverlayLayer = this.store.select(mapReducers.selectGetSelectedOverlayLayer); }
this.baseLayers = this.store.select(mapReducers.selectGetBaseLayers);
this.projection = this.store.select(mapReducers.selectGetProjection);
this.selectedBaseLayer = this.store.select(mapReducers.selectGetSelectedBaseLayer);
this.panelVisible = this.store.select(mapReducers.selectGetPanelVisible);
this.panelCollapsed = this.store.select(mapReducers.selectGetPanelCollapsed);
this.selectedFeature = this.store.select(mapReducers.selectGetSelectedFeature);
this.selectedItem = this.store.select(mapReducers.selectGetSelectedItem);
this.queryState = this.store.select(mapReducers.selectGetQueryState);
this.clearEnabled = this.store.select(mapReducers.selectGetClearEnabled);
this.searchCollapsed = this.store.select(mapReducers.selectGetSearchCollapsed);
this.searchMinified = this.store.select(mapReducers.selectGetSearchMinified);
this.menuVisible = this.store.select(mapReducers.selectGetMenuVisible);
this.openedModalName = this.store.select(commonReducers.selectOpenedModalName);
this.query = this.store.select(mapReducers.selectGetQuery);
this.extent = this.store.select(mapReducers.selectGetExtent);
this.selectedFeatures.next(null);
this.selectedItemLayer = this.store.select(mapReducers.selectGetSelectedItemLayer);
this.period = this.store.select(mapReducers.selectGetPeriod);
this.position = this.geolocationService.getCurrentPosition();
this.mapState.pipe(withLatestFrom(this.queryState)).subscribe((state) => {
this.replaceUrl(state[0], state[1], true);
}); });
this.query.pipe(withLatestFrom(this.mapState)).subscribe((state) => { this.mapState$.pipe(withLatestFrom(this.queryState$),withLatestFrom(this.setStateCount$)).subscribe(([[mapState,queryState],setStateCount]) =>{
this.replaceUrl(state[1], state[0],false); if(setStateCount>0) {
this.replaceUrl(mapState,queryState,true);
}
}); });
this.queryState$.pipe(withLatestFrom(this.mapState$),withLatestFrom(this.setStateCount$)).subscribe(([[queryState,mapState],setStateCount]) =>{
if(setStateCount>0) {
this.replaceUrl(mapState,queryState,true);
}
})
}
initCustomStyles() {
this.store.dispatch(new mapActions.SetStyle('vnd.farmmaps.itemtype.layer',new style.Style({
stroke: new style.Stroke({
color: 'red',
lineDash: [ 5,5],
width: 1
}),
geometry:(feature) =>feature.getGeometry()
})));
this.store.dispatch(new mapActions.SetStyle('vnd.farmmaps.itemtype.layer_selected',new style.Style({
stroke: new style.Stroke({
color: 'red',
lineDash: [ 5,5],
width: 3
}),
geometry:(feature) =>feature.getGeometry()
})));
} }
private stateSetCount: number = 0;
private lastQueryState: string = this.serializeService.serialize(mapReducers.initialQueryState);
private lastMapState: string = "";
ngAfterViewInit() { ngAfterViewInit() {
this.paramSub = this.route.paramMap.subscribe((params: ParamMap) => { this.initCustomStyles();
//console.log("Param sub"); this.paramSub = this.route.paramMap.pipe(withLatestFrom(this.setStateCount$),withLatestFrom(this.queryState$),withLatestFrom(this.mapState$)).subscribe( (state) => {
let params: ParamMap = state[0][0][0];
let setStateCount:number = state[0][0][1];
let lastQueryState:IQueryState = state[0][1];
let lastMapState:IMapState = state[1];
var newMapState: IMapState = null; var newMapState: IMapState = null;
var newQueryState: IQueryState = null; var newQueryState: IQueryState = null;
var mapStateChanged = false; var mapStateChanged = false;
@@ -157,30 +182,31 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
let rotation = parseFloat(params.get("rotation")); let rotation = parseFloat(params.get("rotation"));
let baseLayer = params.get("baseLayer")?params.get("baseLayer"):""; let baseLayer = params.get("baseLayer")?params.get("baseLayer"):"";
newMapState = { xCenter: xCenter, yCenter: yCenter, zoom: zoom, rotation: rotation, baseLayerCode: baseLayer } newMapState = { xCenter: xCenter, yCenter: yCenter, zoom: zoom, rotation: rotation, baseLayerCode: baseLayer }
mapStateChanged = this.lastMapState != JSON.stringify(newMapState) && this.stateSetCount == 0; mapStateChanged = (JSON.stringify(lastMapState) != JSON.stringify(newMapState)) && setStateCount == 0 ;
this.lastMapState = JSON.stringify(newMapState); window.localStorage.setItem("FarmMapsCommonMap_mapState",JSON.stringify(newMapState));
} }
if (params.has("queryState")) { if (params.has("queryState")) {
let queryState = params.get("queryState"); let queryState = params.get("queryState");
newQueryState = tassign(mapReducers.initialQueryState); newQueryState = tassign(mapReducers.initialQueryState);
if (queryState != "") { if (queryState != "") {
newQueryState = this.serializeService.deserialize(queryState); newQueryState = this.serializeService.deserialize(queryState);
queryState = this.serializeService.serialize(newQueryState);
} }
queryStateChanged = this.lastQueryState != queryState; queryStateChanged = this.serializeService.serialize(lastQueryState) != queryState;
this.lastQueryState = queryState;
} }
let t =0;
if (mapStateChanged && queryStateChanged) { if(setStateCount==0) t=600;
//console.log("Both states"); setTimeout(() => {
this.store.dispatch(new mapActions.SetState(newMapState, newQueryState)); this.zone.run(()=> {
} else if (mapStateChanged) { if ( queryStateChanged && mapStateChanged) {
//console.log("Map state"); this.store.dispatch(new mapActions.SetState(newMapState,newQueryState));
this.store.dispatch(new mapActions.SetMapState(newMapState)); } else if(queryStateChanged) {
} else if (queryStateChanged) {
//console.log("Query state");
this.store.dispatch(new mapActions.SetQueryState(newQueryState)); this.store.dispatch(new mapActions.SetQueryState(newQueryState));
} else if (mapStateChanged) {
this.store.dispatch(new mapActions.SetMapState(newMapState));
} }
this.stateSetCount += 1; })
},t);
}); });
setTimeout(() => { setTimeout(() => {
this.map.instance.updateSize(); this.map.instance.updateSize();
@@ -196,7 +222,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
} }
handleToggleMenu(event) { handleToggleMenu(event) {
this.store.dispatch(new mapActions.ToggleMenu()); this.store.dispatch(new commonActions.ToggleMenu());
} }
handleToggleBaseLayers(event:MouseEvent) { handleToggleBaseLayers(event:MouseEvent) {
@@ -215,15 +241,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
this.store.dispatch(new mapActions.DoQuery(queryState)); this.store.dispatch(new mapActions.DoQuery(queryState));
} }
handleTrijntjeClick(event: MouseEvent, query: any) {
event.preventDefault();
var queryState = tassign(mapReducers.initialQueryState, query);
var mapState = JSON.parse(this.lastMapState);
this.router.navigate(["app","trijntje" , mapState.xCenter.toFixed(5), mapState.yCenter.toFixed(5), mapState.zoom, mapState.rotation.toFixed(2), mapState.baseLayerCode, this.serializeService.serialize(queryState)], { replaceUrl: false });
}
replaceUrl(mapState: IMapState, queryState: IQueryState, replace: boolean = true) { replaceUrl(mapState: IMapState, queryState: IQueryState, replace: boolean = true) {
console.debug(`Replace url : Baselayer(${mapState.baseLayerCode}) Querystate(${this.serializeService.serialize(queryState)})`);
let parts =["."]; let parts =["."];
parts.push(mapState.xCenter.toFixed(5)); parts.push(mapState.xCenter.toFixed(5));
parts.push(mapState.yCenter.toFixed(5)); parts.push(mapState.yCenter.toFixed(5));
@@ -237,6 +255,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
} }
handleOnMoveEnd(event) { handleOnMoveEnd(event) {
this.zone.run(() =>{
var map = event.map; var map = event.map;
var view = map.getView(); var view = map.getView();
var rotation = view.getRotation(); var rotation = view.getRotation();
@@ -246,17 +265,20 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
let mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null }; let mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null };
let state = { mapState: mapState, extent: extent }; let state = { mapState: mapState, extent: extent };
let source = from([state]); let source = from([state]);
source.pipe(withLatestFrom(this.selectedBaseLayer), withLatestFrom(this.queryState)).subscribe(([[state, baselayer], queryState]) => { source.pipe(withLatestFrom(this.selectedBaseLayer$)).subscribe(([state, baselayer]) => {
if (mapState && baselayer && queryState) { if (mapState && baselayer) {
let newMapState = tassign(state.mapState, { baseLayerCode: baselayer.item.code }); let newMapState = tassign(state.mapState, { baseLayerCode: baselayer.item.code });
this.replaceUrl(newMapState, tassign(queryState, { bbox: queryState.bboxFilter ? state.extent : queryState.bbox })); this.store.dispatch(new mapActions.SetMapState(newMapState));
this.store.dispatch(new mapActions.SetViewExtent(state.extent)); this.store.dispatch(new mapActions.SetViewExtent(state.extent));
} }
}); });
});
} }
handleOnMouseDown(event: MouseEvent) { handleOnMouseDown(event: MouseEvent) {
this.zone.run(() =>{
this.store.dispatch(new mapActions.CollapseSearch()); this.store.dispatch(new mapActions.CollapseSearch());
});
} }
handleOnDownload(event) { handleOnDownload(event) {

View File

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

View File

@@ -29,7 +29,7 @@ export class SelectPeriodModalComponent {
fromDate: NgbDateStruct; fromDate: NgbDateStruct;
toDate: NgbDateStruct; toDate: NgbDateStruct;
@ViewChild('content') _templateModal:ElementRef; @ViewChild('content', { static: true }) _templateModal:ElementRef;
@Input() set modalState(_modalState:any) {; @Input() set modalState(_modalState:any) {;
if(_modalState == this.modalName) { if(_modalState == this.modalName) {

View File

@@ -1,4 +1,3 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";

View File

@@ -2,6 +2,7 @@ import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleCh
import { IItem } from '@farmmaps/common'; import { IItem } from '@farmmaps/common';
import { AbstractSelectedItemComponent, SelectedItemComponent } from '../selected-item/selected-item.component'; import { AbstractSelectedItemComponent, SelectedItemComponent } from '../selected-item/selected-item.component';
import { WidgetHostDirective } from '../widget-host/widget-host.directive'; import { WidgetHostDirective } from '../widget-host/widget-host.directive';
import { IItemLayer } from '../../models/item.layer';
@Component({ @Component({
@@ -15,14 +16,26 @@ export class SelectedItemContainerComponent {
} }
@Input() item: IItem; @Input() item: IItem;
@Input() itemLayer:IItemLayer
@ViewChild(WidgetHostDirective) widgetHost: WidgetHostDirective; @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
loadComponent() { loadComponent() {
var componentFactory: ComponentFactory<AbstractSelectedItemComponent> = this.componentFactoryResolver.resolveComponentFactory(SelectedItemComponent); // default let componentFactory: ComponentFactory<AbstractSelectedItemComponent> = this.componentFactoryResolver.resolveComponentFactory(SelectedItemComponent); // default
for (var i = 0; i < this.selectedItemComponents.length; i++) { let firstComponentWithTypeAndTask = this.selectedItemComponents
if (this.selectedItemComponents[i]['forItemType'] == this.item.itemType) { .find(value => value['forSourceTask'] == this.item.sourceTask &&
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.selectedItemComponents[i]['constructor'] as any); value['forItemType'] == this.item.itemType
);
if (firstComponentWithTypeAndTask) {
componentFactory = this.componentFactoryResolver.resolveComponentFactory(firstComponentWithTypeAndTask['constructor'] as any);
} else {
let firstComponentWithType = this.selectedItemComponents
.find(value => value['forSourceTask'] == null &&
value['forItemType'] == this.item.itemType);
if (firstComponentWithType) {
componentFactory = this.componentFactoryResolver.resolveComponentFactory(firstComponentWithType['constructor'] as any);
} }
} }
const viewContainerRef = this.widgetHost.viewContainerRef; const viewContainerRef = this.widgetHost.viewContainerRef;
@@ -30,11 +43,15 @@ export class SelectedItemContainerComponent {
const componentRef = viewContainerRef.createComponent(componentFactory); const componentRef = viewContainerRef.createComponent(componentFactory);
(<AbstractSelectedItemComponent>componentRef.instance).item = this.item; (<AbstractSelectedItemComponent>componentRef.instance).item = this.item;
(<AbstractSelectedItemComponent>componentRef.instance).itemLayer = this.itemLayer;
} }
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
if (changes["item"] && changes["item"].currentValue) { if (changes["item"] && changes["item"].currentValue) {
this.loadComponent(); this.loadComponent();
} }
if (changes["itemLayer"] && changes["itemLayer"].currentValue) {
this.loadComponent();
}
} }
} }

View File

@@ -3,11 +3,15 @@
<div class="card border-0"> <div class="card border-0">
<div class="card-body"> <div class="card-body">
<div><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div> <div><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
<h4>Cropfield</h4> <div class="card menu-card">
<h1>{{item.name}}</h1> <h1>Cropfield</h1>
<div>{{item.data.cropTypeName}}</div> <h4>{{item.name}}</h4>
<div><span>{{item.data.startDate|date}}</span> - <span>{{item.data.endDate|date}}</span> </div> <div class="card-text"><span>{{areaInHa(item)| number:'1.2-2'}} ha</span>&nbsp;<span>{{item.data.cropTypeName}}</span></div>
<div class="mt-1"><a href="#" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></div> <div class="card-text"><span>{{item.data.startDate|date}}</span> - <span>{{item.data.endDate|date}}</span> </div>
<ul class="p-0 mt-2">
<li *ngIf="item.isEditable"><a href="#" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li>
</ul>
</div>
</div> </div>
<fm-map-item-list [items]="(items|async)"></fm-map-item-list> <fm-map-item-list [items]="(items|async)"></fm-map-item-list>
<fm-map-item-widget-list [item]="item"></fm-map-item-widget-list> <fm-map-item-widget-list [item]="item"></fm-map-item-widget-list>

View File

@@ -1,4 +1,3 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";
.big-icon { .big-icon {
@@ -13,6 +12,10 @@
font-size: 1rem; font-size: 1rem;
} }
.card-body {
padding-bottom: unset;
}
.spacer { .spacer {
display: none; display: none;
height: 4rem; height: 4rem;
@@ -23,3 +26,11 @@
display: block; display: block;
} }
} }
.menu-card {
margin-left: -7px;
padding-left: 7px;
margin-right: -7px;
padding-right: 7px;
margin-bottom: 7px;
}

View File

@@ -8,6 +8,8 @@ import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
import { ForItemType } from '../for-item/for-itemtype.decorator'; import { ForItemType } from '../for-item/for-itemtype.decorator';
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component'; import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import {GeoJSON} from 'ol/format';
import {getArea} from 'ol/sphere';
@ForItemType("vnd.farmmaps.itemtype.cropfield") @ForItemType("vnd.farmmaps.itemtype.cropfield")
@@ -24,7 +26,18 @@ export class SelectedItemCropfieldComponent extends AbstractSelectedItemComponen
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) { constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
super(store, itemTypeService,location,router); super(store, itemTypeService,location,router);
} }
areaInHa(item:IItem):number {
if(!item) return 0;
// get area from faeture if 0 calculate from polygon
let a = item.data.area;
if(a) return a;
let format = new GeoJSON();
let polygon = format.readGeometry(item.geometry);
return getArea(polygon,{projection:"EPSG:4326"}) / 10000;
}
ngOnInit() { ngOnInit() {
this.items = this.folderService$.getItems(this.item.code, 0, 1000); this. items = this.folderService$.getItems(this.item.code, 0, 1000);
} }
} }

View File

@@ -3,20 +3,26 @@
<div class="card border-0"> <div class="card border-0">
<div class="card-body"> <div class="card-body">
<div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div> <div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
<div class="card menu-card">
<h1>{{item.name}}</h1> <h1>{{item.name}}</h1>
<div class="legend-container" *ngIf="item?.data.layers;let layers">
<!--<div *ngIf="layers.length>1">
<select (change)="onLayerChanged($event.target.value)">
<option *ngFor="let l of layers;let layerIndex = index" [value]="layerIndex">{{l.name}}</option>
</select>
</div>-->
<fm-map-layer-legend [layer]="layers[selectedLayer]" [histogramenabled]="false" histogramunit="ha"></fm-map-layer-legend>
</div> </div>
<div class="legend-container" *ngIf="item?.data.layers;let layers">
<div class="card menu-card">
<div *ngIf="layers.length>1">
<select (change)="onLayerChanged($event.target.value)" [value]="itemLayer.layerIndex">
<option *ngFor="let l of layers;" [value]="l.index">{{l.name}}</option>
</select>
</div>
<fm-map-layer-legend [layer]="layer(layers,itemLayer.layerIndex)" [histogramenabled]="true"></fm-map-layer-legend>
</div>
</div>
<div class="card menu-card">
<ul class="p-0 mt-2"> <ul class="p-0 mt-2">
<!--<li><a href="/api/v1/items/{{item.code}}/file" class="mt-1 mr-1" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a></li>--> <!--<li><a href="/api/v1/items/{{item.code}}/file" class="mt-1 mr-1" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a></li>-->
<li><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li> <li *ngIf="item.isEditable"><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li>
<li *ngIf="itemTypeService.isLayer(item)"><a href="#" (click)="handleAddAsLayer(item)" class="mt-1 mr-1" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a></li> <li *ngIf="itemTypeService.isLayer(item)"><a href="#" (click)="handleAddAsLayer(item,itemLayer.layerIndex)" class="mt-1 mr-1" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a></li>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
</div>

View File

@@ -1,4 +1,3 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";
.big-icon { .big-icon {
@@ -31,3 +30,12 @@ li {
display:block; display:block;
} }
} }
.menu-card {
margin-left: -7px;
padding-left: 7px;
margin-right: -7px;
padding-right: 7px;
margin-bottom: 7px;
}

View File

@@ -1,13 +1,12 @@
import { Component, Input, Injectable, OnInit } from '@angular/core'; import { Component, Injectable } from '@angular/core';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Feature } from 'ol';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer'; import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common'; import { commonReducers, ItemTypeService, ItemService, FolderService } from '@farmmaps/common';
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router'; import { Router } from '@angular/router';
import { ForItemType } from '../for-item/for-itemtype.decorator'; import { ForItemType } from '../for-item/for-itemtype.decorator';
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component'; import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
import { Observable } from 'rxjs'; import * as mapActions from '../../actions/map.actions';
@ForItemType("vnd.farmmaps.itemtype.geotiff.processed") @ForItemType("vnd.farmmaps.itemtype.geotiff.processed")
@@ -26,5 +25,10 @@ export class SelectedItemGeotiffComponent extends AbstractSelectedItemComponent
onLayerChanged(layerIndex: number) { onLayerChanged(layerIndex: number) {
this.selectedLayer = layerIndex; this.selectedLayer = layerIndex;
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
}
layer(layers:any,layerIndex:number) {
return layers.find(l => l.index == layerIndex);
} }
} }

View File

@@ -3,20 +3,26 @@
<div class="card border-0"> <div class="card border-0">
<div class="card-body"> <div class="card-body">
<div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div> <div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
<div class="card menu-card">
<h1>{{item.name}}</h1> <h1>{{item.name}}</h1>
</div>
<div class="legend-container" *ngIf="item?.data.layers;let layers"> <div class="legend-container" *ngIf="item?.data.layers;let layers">
<div class="card menu-card">
<div *ngIf="layers.length>1"> <div *ngIf="layers.length>1">
<select (change)="onLayerChanged($event.target.value)"> <select (change)="onLayerChanged($event.target.value)" [value]="itemLayer.layerIndex">
<option *ngFor="let l of layers;" [value]="l.index">{{l.name}}</option> <option *ngFor="let l of layers;" [value]="l.index">{{l.name}}</option>
</select> </select>
</div> </div>
<fm-map-layer-legend [showTitle]="layers.length==1" [layer]="layers[selectedLayer]" [histogramenabled]="false" histogramunit="ha"></fm-map-layer-legend> <fm-map-layer-legend [showTitle]="layers.length==1" [layer]="layer(layers,itemLayer.layerIndex)" [histogramenabled]="true"></fm-map-layer-legend>
</div> </div>
</div>
<div class="card menu-card">
<ul class="p-0 mt-2"> <ul class="p-0 mt-2">
<!--<li><a href="/api/v1/items/{{item.code}}/file" class="mt-1 mr-1" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a></li>--> <!--<li><a href="/api/v1/items/{{item.code}}/file" class="mt-1 mr-1" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a></li>-->
<li><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li> <li *ngIf="item.isEditable"><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li>
<li *ngIf="itemTypeService.isLayer(item)"><a href="#" (click)="handleAddAsLayer(item,selectedLayer)" class="mt-1 mr-1" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a></li> <li *ngIf="itemTypeService.isLayer(item)"><a href="#" (click)="handleAddAsLayer(item,itemLayer.layerIndex)" class="mt-1 mr-1" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a></li>
</ul> </ul>
</div> </div>
</div> </div>
</div> </div>
</div>

View File

@@ -1,4 +1,3 @@
@import "../../_theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";
.big-icon { .big-icon {
@@ -39,3 +38,11 @@ li {
display: block; display: block;
} }
} }
.menu-card {
margin-left: -7px;
padding-left: 7px;
margin-right: -7px;
padding-right: 7px;
margin-bottom: 7px;
}

View File

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

View File

@@ -0,0 +1,43 @@
<div class="spacer"></div>
<div *ngIf="selectedItem();let item">
<div class="card border-0">
<div class="card-body">
<div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
<div class="card menu-card">
<h1>{{item.name}}</h1>
</div>
<div class="legend-container" *ngIf="item?.data.layers;let layers">
<div class="card menu-card">
<h5>Date image: {{item.dataDate | date:'shortDate'}}</h5>
<div class="d-flex justify-content-between">
<div *ngIf="hasPrevious()">
<button type="button" class="btn btn-link p-0" (click)="handlePreviousTemporal($event)" i18n>
<i class="fa fa-arrow-circle-left" aria-hidden="true" title="Previous"></i>&nbsp;{{ previousDate() | date:'shortDate'}}
</button>
</div>
<div *ngIf="hasNext()">
<button type="button" class="btn btn-link p-0" (click)="handleNextTemporal($event)" i18n>
{{ nextDate()| date:'shortDate' }}&nbsp;<i class="fa fa-arrow-circle-right" aria-hidden="true" title="Next"></i>
</button>
</div>
</div>
</div>
<div class="card menu-card pt-2">
<div *ngIf="layers.length>1">
<select (change)="onLayerChanged($event.target.value)" [value]="itemLayer.layerIndex">
<option *ngFor="let l of layers;" [value]="l.index">{{l.name}}</option>
</select>
</div>
<fm-map-layer-legend [layer]="layer(layers,itemLayer.layerIndex)" [histogramenabled]="true"></fm-map-layer-legend>
</div>
</div>
<div class="card menu-card">
<ul class="p-0 mt-2">
<li *ngIf="item.isEditable"><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li>
<li *ngIf="itemTypeService.isLayer(item)"><a href="#" (click)="handleAddAsLayer(item,itemLayer.layerIndex)" class="mt-1 mr-1" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a></li>
<li><a href="#" (click)="handleGoToChart(item)" i18n><i class="fa fa-line-chart" aria-hidden="true" title="Edit"></i> Show chart</a></li>
</ul>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,41 @@
@import "~bootstrap/scss/bootstrap.scss";
.big-icon {
width: 100%;
color: white;
font-size: 9rem;
padding: 3rem;
text-align: center;
}
.card-title {
font-size: 1rem;
}
ul {
list-style:none;
}
li {
margin-top:1rem;
}
.spacer {
display:none;
height:4rem;
}
@media screen and (min-width:44rem) {
.spacer {
display:block;
}
}
.menu-card {
margin-left: -7px;
padding-left: 7px;
margin-right: -7px;
padding-right: 7px;
margin-bottom: 7px;
}

View File

@@ -0,0 +1,80 @@
import { Component, Injectable } from '@angular/core';
import { Location } from '@angular/common';
import { Store } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers, ItemTypeService, ItemService, FolderService,IItem } from '@farmmaps/common';
import { Router } from '@angular/router';
import { ForItemType } from '../for-item/for-itemtype.decorator';
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
import { ITemporalItemLayer} from '../../models/item.layer';
import * as mapActions from '../../actions/map.actions';
@ForItemType("vnd.farmmaps.itemtype.temporal")
@Injectable()
@Component({
selector: 'fm-map-selected-item-temporal',
templateUrl: './selected-item-temporal.component.html',
styleUrls: ['./selected-item-temporal.component.scss']
})
export class SelectedItemTemporalComponent extends AbstractSelectedItemComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
super(store, itemTypeService,location,router);
}
onLayerChanged(layerIndex: number) {
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
}
hasNext():boolean {
let temporalItemLayer = this.itemLayer as ITemporalItemLayer;
return temporalItemLayer && temporalItemLayer.nextItemLayer != null;
}
nextDate():Date {
let temporalItemLayer = this.itemLayer as ITemporalItemLayer;
if(temporalItemLayer.nextItemLayer.item)
return temporalItemLayer.nextItemLayer.item.dataDate;
return null;
}
hasPrevious():boolean {
let temporalItemLayer = this.itemLayer as ITemporalItemLayer;
return temporalItemLayer && temporalItemLayer.previousItemLayer != null;
}
previousDate():Date {
let temporalItemLayer = this.itemLayer as ITemporalItemLayer;
if(temporalItemLayer.previousItemLayer.item)
return temporalItemLayer.previousItemLayer.item.dataDate;
return null;
}
handleNextTemporal(event:MouseEvent) {
this.store.dispatch(new mapActions.NextTemporal());
event.preventDefault();
}
handlePreviousTemporal(event:MouseEvent) {
this.store.dispatch(new mapActions.PreviousTemporal());
event.preventDefault();
}
selectedItem():IItem {
let temporalItemLayer = this.itemLayer as ITemporalItemLayer;
if(temporalItemLayer && temporalItemLayer.selectedItemLayer) {
return temporalItemLayer.selectedItemLayer.item;
}
return null;
}
layer(layers:any,layerIndex:number) {
return layers.find(l => l.index == layerIndex);
}
handleGoToChart(item: IItem) {
this.router.navigate(['/viewer', 'temporal', 'item', item.parentCode, item.dataDate.getUTCFullYear()]);
return false;
}
}

View File

@@ -1,16 +1,18 @@
<div *ngIf="item;let item"> <div *ngIf="item;let item">
<div class="card border-0"> <div class="card border-0">
<img *ngIf="item.thumbnail" class="card-img-top" [src]="'/api/v1/items/'+item.code+'/thumbnail?v='+item.updated.getTime()" /> <img *ngIf="item.thumbnail" class="card-img-top" [src]="config.getConfig('apiEndPoint') +'/api/v1/items/'+item.code+'/thumbnail?v='+item.updated.getTime()" />
<div *ngIf="!item.thumbnail" class="big-icon" [style.background-color]="itemTypeService.getColor(item.itemType)"> <div *ngIf="!item.thumbnail" class="big-icon" [style.background-color]="itemTypeService.getColor(item.itemType)">
<i [ngClass]="itemTypeService.getIcon(item.itemType)"></i> <i [ngClass]="itemTypeService.getIcon(item.itemType)"></i>
</div> </div>
</div>
<div class="card">
<div class="card-body"> <div class="card-body">
<div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div> <div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
<h1 class="card-title">{{item.name}}</h1> <h1 class="card-title">{{item.name}}</h1>
<a *ngIf="itemTypeService.hasViewer(item)" href="#" (click)="handleOnView(item)" class="btn btn-outline-secondary" i18n><i class="fa fa-eye" aria-hidden="true" title="View"></i> View</a> <a *ngIf="itemTypeService.hasViewer(item)" href="#" (click)="handleOnView(item)" class="btn btn-outline-secondary" i18n><i class="fa fa-eye" aria-hidden="true" title="View"></i> View</a>
<a href="/api/v1/items/{{item.code}}/data" class="btn btn-outline-secondary" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a> <!-- <a [href]="config.getConfig('apiEndPoint')+ '/api/v1/items/'+ item.code+ '/download'" class="btn btn-outline-secondary" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a> -->
<a href="#" class="btn btn-outline-secondary" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a> <a *ngIf="item.isEditable" href="#" class="btn btn-outline-secondary" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a>
<a *ngIf="itemTypeService.isLayer(item)" href="#" (click)="handleAddAsLayer(item)" class="btn btn-outline-secondary" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a> <a *ngIf="itemTypeService.isLayer(item)" href="#" (click)="handleAddAsLayer(item)" class="btn btn-outline-secondary" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,4 +1,3 @@
@import "../../theme.scss";
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";
.big-icon { .big-icon {

View File

@@ -1,32 +1,35 @@
import { Component, Input, Injectable } from '@angular/core'; import {Component, Injectable, Input} from '@angular/core';
import { Location } from '@angular/common'; import {Location} from '@angular/common';
import { Feature } from 'ol'; import {Store} from '@ngrx/store';
import { Store } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer'; import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common'; import {AppConfig, commonReducers, IItem, ItemTypeService} from '@farmmaps/common';
import * as mapActions from '../../actions/map.actions'; import * as mapActions from '../../actions/map.actions';
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router'; import {Router} from '@angular/router';
import { IItemLayer } from '../../models/item.layer';
@Injectable() @Injectable()
export abstract class AbstractSelectedItemComponent { export abstract class AbstractSelectedItemComponent {
@Input() item: IItem @Input() item: IItem
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location, private router: Router) { @Input() itemLayer: IItemLayer
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location, public router: Router) {
} }
handleOnView(item: IItem) { handleOnView(item: IItem) {
var itemType = this.itemTypeService.itemTypes[item.itemType]; if (this.itemTypeService.hasViewer(item)) {
if (itemType) { let viewer = this.itemTypeService.itemTypes[item.itemType].viewer;
if (itemType.viewer) { let url = `/viewer/${viewer}/item/${item.code}`;
let url = `/viewer/${itemType.viewer}/item/${item.code}`;
this.router.navigate([url]); this.router.navigate([url]);
} }
}
return false; return false;
} }
handleOnEdit(item: IItem) { handleOnEdit(item: IItem) {
let url = `/editor/property/item/${item.code}`; var editor = "property";
if(this.itemTypeService.hasEditor(item)) {
editor = this.itemTypeService.itemTypes[item.itemType].editor;
}
let url = `/editor/${editor}/item/${item.code}`
this.router.navigate([url]); this.router.navigate([url]);
return false; return false;
} }
@@ -50,7 +53,7 @@ export abstract class AbstractSelectedItemComponent {
}) })
export class SelectedItemComponent extends AbstractSelectedItemComponent { export class SelectedItemComponent extends AbstractSelectedItemComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router) { constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, public config:AppConfig) {
super(store, itemTypeService,location,router); super(store, itemTypeService,location,router);
} }
} }

View File

@@ -1,15 +1,14 @@
import { Injectable, Inject } from '@angular/core'; import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Store, Action } from '@ngrx/store'; import { Store, Action } from '@ngrx/store';
import { Effect, Actions,ofType } from '@ngrx/effects'; import { Effect, Actions,ofType } from '@ngrx/effects';
import { Observable , of } from 'rxjs'; import { Observable , of } from 'rxjs';
import { withLatestFrom, switchMap, map, catchError, mergeMap, delay} from 'rxjs/operators'; import { withLatestFrom, switchMap, map, catchError, mergeMap } from 'rxjs/operators';
import {GeoJSON} from 'ol/format'; import {GeoJSON,WKT} from 'ol/format';
import {Feature} from 'ol'; import {Feature} from 'ol';
import { getCenter, Extent, createEmpty, extend} from 'ol/extent'; import { getCenter } from 'ol/extent';
import {Point} from 'ol/geom' import {Point} from 'ol/geom'
@@ -19,16 +18,30 @@ import {commonReducers} from '@farmmaps/common';
import {commonActions} from '@farmmaps/common'; import {commonActions} from '@farmmaps/common';
import { IListItem, IItem } from '@farmmaps/common'; import { IItem } from '@farmmaps/common';
import { FolderService, ItemService } from '@farmmaps/common'; import { FolderService, ItemService } from '@farmmaps/common';
import { tassign } from 'tassign'; import { tassign } from 'tassign';
import {FeatureIconService} from '../services/feature-icon.service';
import * as style from 'ol/style';
import { ItemTypeService } from '@farmmaps/common';
import { Router } from '@angular/router';
@Injectable() @Injectable()
export class MapEffects { export class MapEffects {
private _format: GeoJSON; private _geojsonFormat: GeoJSON;
private _wktFormat: WKT;
private toPointFeature(feature: any): Feature { private toPointFeature(updateEvent:commonActions.DeviceUpdateEvent): Feature {
var f = this._format.readFeature(feature); var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857'
});
f.setId(updateEvent.itemCode);
var centroid = getCenter(f.getGeometry().getExtent()); var centroid = getCenter(f.getGeometry().getExtent());
f.setGeometry(new Point(centroid)); f.setGeometry(new Point(centroid));
return f; return f;
@@ -39,10 +52,41 @@ export class MapEffects {
ofType(mapActions.INIT), ofType(mapActions.INIT),
withLatestFrom(this.store$.select(commonReducers.selectGetRootItems)), withLatestFrom(this.store$.select(commonReducers.selectGetRootItems)),
switchMap(([action, rootItems]) => { switchMap(([action, rootItems]) => {
let actions=[];
for (let rootItem of rootItems) { for (let rootItem of rootItems) {
if (rootItem.itemType == "UPLOADS_FOLDER") return of(new mapActions.SetParent(rootItem.code)); if (rootItem.itemType == "UPLOADS_FOLDER") actions.push(new mapActions.SetParent(rootItem.code));
} }
return []; // initialize default feature styles
actions.push(new mapActions.SetStyle('file',new style.Style({
image: new style.Icon({
anchor: [0.5, 1],
scale: 0.05,
src: this.featureIconService$.getIconImageDataUrl("fa fa-file-o")
}),
stroke: new style.Stroke({
color: 'red',
width: 1
}),
fill: new style.Fill({
color: 'rgba(0, 0, 255, 0.1)'
})
})));
actions.push(new mapActions.SetStyle('selected',new style.Style({
image: new style.Icon({
anchor: [0.5, 1],
scale: 0.08,
src: this.featureIconService$.getIconImageDataUrl(null)
}),
stroke: new style.Stroke({
color: 'red',
width: 3
}),
fill: new style.Fill({
color: 'rgba(0, 0, 255, 0.1)'
})
})));
return actions;
} }
)); ));
@@ -74,7 +118,7 @@ export class MapEffects {
console.debug("Start search"); console.debug("Start search");
var startDate = action.queryState.startDate; var startDate = action.queryState.startDate;
var endDate = action.queryState.endDate; var endDate = action.queryState.endDate;
var newAction; var newAction:Observable<Action>;
if (action.queryState.itemCode || action.queryState.parentCode || action.queryState.itemType || action.queryState.query || action.queryState.tags) { if (action.queryState.itemCode || action.queryState.parentCode || action.queryState.itemType || action.queryState.query || action.queryState.tags) {
newAction= this.itemService$.getFeatures(action.queryState.bbox, "EPSG:3857", action.queryState.query, action.queryState.tags, startDate, endDate, action.queryState.itemType, action.queryState.parentCode).pipe( newAction= this.itemService$.getFeatures(action.queryState.bbox, "EPSG:3857", action.queryState.query, action.queryState.tags, startDate, endDate, action.queryState.itemType, action.queryState.parentCode).pipe(
switchMap((features: any) => { switchMap((features: any) => {
@@ -83,7 +127,7 @@ export class MapEffects {
f.id = f.properties["code"]; f.id = f.properties["code"];
} }
} }
return of(new mapActions.StartSearchSuccess(this._format.readFeatures(features), action.queryState)); return of(new mapActions.StartSearchSuccess(this._geojsonFormat.readFeatures(features), action.queryState));
} }
), ),
catchError(error => of(new commonActions.Fail(error)))); catchError(error => of(new commonActions.Fail(error))));
@@ -98,19 +142,7 @@ export class MapEffects {
startSearchSucces$: Observable<Action> = this.actions$.pipe( startSearchSucces$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.STARTSEARCHSUCCESS), ofType(mapActions.STARTSEARCHSUCCESS),
mergeMap((action: mapActions.StartSearchSuccess) => { mergeMap((action: mapActions.StartSearchSuccess) => {
if (action.query.bboxFilter) { return [new commonActions.SetMenuVisible(false)];
return [];
} else {
var extent = createEmpty();
if (extent) {
for (let f of action.features) {
extend(extent, (f as Feature).getGeometry().getExtent());
}
}
//return [];
return of(new mapActions.SetExtent(extent));
}
})); }));
@Effect() @Effect()
@@ -135,11 +167,33 @@ export class MapEffects {
ofType(mapActions.SELECTITEMSUCCESS), ofType(mapActions.SELECTITEMSUCCESS),
switchMap((action:mapActions.SelectItemSuccess) => { switchMap((action:mapActions.SelectItemSuccess) => {
return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe( return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe(
map((feature: IItem) => new mapActions.AddFeatureSuccess(this._format.readFeature(feature) )), map((feature: any) => {
let f = this._geojsonFormat.readFeature(feature);
f.setId(action.item.code);
return new mapActions.AddFeatureSuccess(f );
}),
catchError(error => of(new commonActions.Fail(error)))); catchError(error => of(new commonActions.Fail(error))));
} }
)); ));
@Effect()
selectItemSuccessTemporal$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS),
switchMap((action:mapActions.SelectItemSuccess) => {
if(action.item.itemType == "vnd.farmmaps.itemtype.temporal") {
return this.itemService$.getChildItemList(action.item.code,null).pipe(
map(items => new mapActions.SelectTemporalItemsSuccess(
items.sort((a, b) =>
-(b.dataDate.getTime() - a.dataDate.getTime())
)
)),
catchError(error => of(new commonActions.Fail(error))));
} else {
return [];
}
}
));
@Effect() @Effect()
uploadedItemClick$: Observable<Action> = this.actions$.pipe( uploadedItemClick$: Observable<Action> = this.actions$.pipe(
ofType(commonActions.UPLOADEDFILECLICK), ofType(commonActions.UPLOADEDFILECLICK),
@@ -163,21 +217,19 @@ export class MapEffects {
@Effect() @Effect()
featureUpdate$: Observable<Action> = this.actions$.pipe( featureUpdate$: Observable<Action> = this.actions$.pipe(
ofType(commonActions.ITEMCHANGEDEVENT), ofType(commonActions.DEVICEUPDATEEVENT),
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)), withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
mergeMap(([action, features]) => { mergeMap(([action, features]) => {
let itemChangedAction = action as commonActions.ItemChangedEvent; let deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent;
var feature: Feature = null; var feature: Feature = null;
for (let f of features) { for (let f of features) {
if (f.get("code") == itemChangedAction.itemCode) { if (f.getId() == deviceUpdateEventAction.itemCode) {
feature = f; feature = f;
break; break;
} }
} }
if (feature) { if (feature) {
return this.itemService$.getFeature(itemChangedAction.itemCode, "EPSG:3857").pipe( return of(new mapActions.UpdateFeatureSuccess(this.toPointFeature(deviceUpdateEventAction)));
map((feature: any) => new mapActions.UpdateFeatureSuccess(this.toPointFeature(feature))),
catchError(error => of(new commonActions.Fail(error))));
} else { } else {
return []; return [];
} }
@@ -204,7 +256,22 @@ export class MapEffects {
switchMap((action: mapActions.SetQueryState) => { switchMap((action: mapActions.SetQueryState) => {
var newAction:Action; var newAction:Action;
if (action.queryState.itemCode && action.queryState.itemCode != "") { if (action.queryState.itemCode && action.queryState.itemCode != "") {
let urlparts=[];
if(action.queryState.itemType && action.queryState.itemType!= "") {
let itemType = this.itemTypeService$.itemTypes[action.queryState.itemType];
if (itemType.viewer == "edit_in_editor" && itemType.editor) {
urlparts.push('/editor');
urlparts.push(itemType.editor);
urlparts.push('item');
urlparts.push(action.queryState.itemCode);
}
}
if(urlparts.length==0 ) {
newAction= new mapActions.SelectItem(action.queryState.itemCode); newAction= new mapActions.SelectItem(action.queryState.itemCode);
} else {
this.router$.navigate(urlparts);
return [];
}
} else { } else {
newAction= new mapActions.StartSearch(action.queryState); newAction= new mapActions.StartSearch(action.queryState);
} }
@@ -224,7 +291,8 @@ export class MapEffects {
return of(newAction); return of(newAction);
})); }));
constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService) { constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService,private router$:Router) {
this._format = new GeoJSON(); this._geojsonFormat = new GeoJSON();
this._wktFormat = new WKT();
} }
} }

View File

@@ -7,7 +7,8 @@ export interface IColor {
export interface IColorEntry { export interface IColorEntry {
value: number, value: number,
color: IColor color: IColor,
label: string
} }
export interface IHistogramEntry { export interface IHistogramEntry {
@@ -32,7 +33,8 @@ export interface IGradientstop {
export interface IColorMap { export interface IColorMap {
gradient: IGradientstop[], gradient: IGradientstop[],
noValue: IColorEntry, noValue: IColorEntry,
entries: IColorEntry[] entries: IColorEntry[],
colormapType: string
} }
export interface IBand { export interface IBand {
@@ -42,7 +44,8 @@ export interface IBand {
export interface IRenderer { export interface IRenderer {
band:IBand, band:IBand,
colorMap: IColorMap colorMap: IColorMap,
renderType:string
} }
export interface IRenderoutput { export interface IRenderoutput {

View File

@@ -1,7 +0,0 @@
export * from './map.state';
export * from './selected.features';
export * from './item.layer'
export * from './layer.data'
export * from './color.map';
export * from './query.state';
export * from './period.state';

View File

@@ -1,4 +1,4 @@
import { IItem } from '@farmmaps/common'; import { IItem,IListItem } from '@farmmaps/common';
import {Layer} from 'ol/layer'; import {Layer} from 'ol/layer';
export interface IItemLayer { export interface IItemLayer {
@@ -20,7 +20,31 @@ export class ItemLayer implements IItemLayer {
public opacity: number = 1; public opacity: number = 1;
public layerIndex: number = -1; public layerIndex: number = -1;
constructor(item:IItem) { constructor(item:IItem,opacity:number = 1, visible:boolean = true,layerIndex:number=-1) {
this.item = item; this.item = item;
this.opacity = opacity;
this.visible = visible;
this.layerIndex = layerIndex;
} }
} }
export interface ITemporalItemLayer extends IItemLayer {
previousItemLayer: IItemLayer,
selectedItemLayer: IItemLayer,
nextItemLayer: IItemLayer,
temporalItems: IItem[],
}
export class TemporalItemLayer extends ItemLayer implements ITemporalItemLayer {
public previousItemLayer:IItemLayer = null;
public selectedItemLayer:IItemLayer =null;
public nextItemLayer:IItemLayer = null;
public temporalItems:IItem[] = [];
constructor(item:IItem,opacity:number = 1, visible:boolean = true) {
super(item,opacity,visible)
}
}

View File

@@ -0,0 +1,5 @@
import {Style,Feature} from 'ol';
export interface IStyles{
[id: string]: Style | (Feature);
};

View File

@@ -1,11 +1,16 @@
import { tassign } from 'tassign'; import { tassign } from 'tassign';
import { IItem,Item } from '@farmmaps/common'; import { IItem,Item } from '@farmmaps/common';
import { IItemLayer,ItemLayer, IMapState,IQueryState,IPeriodState} from '../models' import { IItemLayer,ItemLayer,ITemporalItemLayer,TemporalItemLayer} from '../models/item.layer';
import { IMapState} from '../models/map.state';
import { IQueryState} from '@farmmaps/common';
import { IPeriodState} from '../models/period.state';
import { IStyles} from '../models/style.cache';
import * as mapActions from '../actions/map.actions'; import * as mapActions from '../actions/map.actions';
import {commonActions} from '@farmmaps/common'; import {commonActions} from '@farmmaps/common';
import { createSelector, createFeatureSelector } from '@ngrx/store'; import { createSelector, createFeatureSelector } from '@ngrx/store';
import {Feature} from 'ol'; import {Feature} from 'ol';
import { createEmpty, extend} from 'ol/extent';
import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store'; import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';
@@ -42,14 +47,16 @@ export interface State {
clearEnabled: boolean, clearEnabled: boolean,
searchCollapsed: boolean, searchCollapsed: boolean,
searchMinified: boolean, searchMinified: boolean,
menuVisible: boolean,
extent: number[], extent: number[],
baseLayers: Array<IItemLayer> baseLayers: Array<IItemLayer>
overlayLayers: Array<IItemLayer>, overlayLayers: Array<IItemLayer>,
selectedItemLayer: IItemLayer, selectedItemLayer: IItemLayer,
projection: string, projection: string,
selectedBaseLayer: IItemLayer, selectedBaseLayer: IItemLayer,
selectedOverlayLayer: IItemLayer selectedOverlayLayer: IItemLayer,
styles:IStyles,
showLayerSwitcher:boolean,
setStateCount:number
} }
export const initialState: State = { export const initialState: State = {
@@ -76,14 +83,16 @@ export const initialState: State = {
clearEnabled: false, clearEnabled: false,
searchCollapsed: true, searchCollapsed: true,
searchMinified:false, searchMinified:false,
menuVisible: true,
extent: null, extent: null,
baseLayers: [], baseLayers: [],
overlayLayers: [], overlayLayers: [],
projection: "EPSG:3857", projection: "EPSG:3857",
selectedBaseLayer: null, selectedBaseLayer: null,
selectedOverlayLayer: null, selectedOverlayLayer: null,
selectedItemLayer: null selectedItemLayer: null,
styles: {},
showLayerSwitcher: false,
setStateCount: 0
} }
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State { export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State {
@@ -95,16 +104,16 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
case mapActions.SETMAPSTATE: { case mapActions.SETMAPSTATE: {
let a = action as mapActions.SetMapState; let a = action as mapActions.SetMapState;
return tassign(state, { return tassign(state, {
mapState: a.mapState mapState: a.mapState,setStateCount: state.setStateCount+1
}); });
} }
case mapActions.SETQUERYSTATE: { case mapActions.SETQUERYSTATE: {
let a = action as mapActions.SetQueryState; let a = action as mapActions.SetQueryState;
return tassign(state, { queryState: tassign(a.queryState )}); return tassign(state, { queryState: tassign(a.queryState ),setStateCount: state.setStateCount+1});
} }
case mapActions.SETSTATE: { case mapActions.SETSTATE: {
let a = action as mapActions.SetState; let a = action as mapActions.SetState;
return tassign(state, { mapState: tassign(a.mapState), queryState: tassign(a.queryState)}); return tassign(state, { mapState: tassign(a.mapState), queryState: tassign(a.queryState),setStateCount: state.setStateCount+1});
} }
case mapActions.SETVIEWEXTENT: { case mapActions.SETVIEWEXTENT: {
let a = action as mapActions.SetViewExtent; let a = action as mapActions.SetViewExtent;
@@ -118,11 +127,22 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
} }
case mapActions.STARTSEARCHSUCCESS: { case mapActions.STARTSEARCHSUCCESS: {
let a = action as mapActions.StartSearchSuccess; let a = action as mapActions.StartSearchSuccess;
let extent = state.extent;
if (!action.query.bboxFilter) {
console.debug("Set extent");
extent = createEmpty();
if (extent) {
for (let f of action.features) {
extend(extent, (f as Feature).getGeometry().getExtent());
}
}
}
return tassign(state, { return tassign(state, {
panelVisible: true, panelVisible: true,
clearEnabled: true, clearEnabled: true,
searchMinified: true, searchMinified: true,
features: a.features features: a.features,
extent:extent
}); });
} }
case mapActions.SELECTFEATURE: { case mapActions.SELECTFEATURE: {
@@ -144,6 +164,9 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
var itemLayer = null; var itemLayer = null;
if (a.item && "vnd.farmmaps.itemtype.layer,vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(a.item.itemType) >=0 ) { if (a.item && "vnd.farmmaps.itemtype.layer,vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(a.item.itemType) >=0 ) {
itemLayer = new ItemLayer(a.item); itemLayer = new ItemLayer(a.item);
itemLayer.layerIndex = a.item.data.layers?a.item.data.layers[0].index:-1;
} else if (a.item && a.item.itemType == "vnd.farmmaps.itemtype.temporal") {
itemLayer = new TemporalItemLayer(a.item);
} }
return tassign(state, { return tassign(state, {
selectedItem: a.item, selectedItem: a.item,
@@ -155,6 +178,86 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
queryState: tassign(state.queryState, {itemCode:a.item ? a.item.code:null}) queryState: tassign(state.queryState, {itemCode:a.item ? a.item.code:null})
}); });
} }
case mapActions.SELECTTEMPORALITEMSSUCCESS:{
let a = action as mapActions.SelectTemporalItemsSuccess;
let selectedItemLayer=tassign(state.selectedItemLayer) as TemporalItemLayer;
let layerIndex=-1;
selectedItemLayer.temporalItems = a.temporalItems;
if(a.temporalItems.length>0) {
let item = a.temporalItems[a.temporalItems.length-1];
layerIndex = item.data.layers[0].index;
selectedItemLayer.selectedItemLayer = new ItemLayer(item,1,true,layerIndex);
} else {
selectedItemLayer.selectedItemLayer = null;
}
selectedItemLayer.previousItemLayer = a.temporalItems.length>1?new ItemLayer(a.temporalItems[a.temporalItems.length-2],0,true,layerIndex):null;
selectedItemLayer.nextItemLayer = null;
if(selectedItemLayer.selectedItemLayer) {
let layerIndex = selectedItemLayer.selectedItemLayer.item.data.layers[0].index;
selectedItemLayer.layerIndex = layerIndex;
}
return tassign(state,{selectedItemLayer:tassign(state.selectedItemLayer,selectedItemLayer as ItemLayer)});
}
case mapActions.NEXTTEMPORAL: {
let temporalLayer = state.selectedItemLayer as ITemporalItemLayer;
if(temporalLayer.temporalItems && temporalLayer.temporalItems.length>0) {
let index = temporalLayer.temporalItems.indexOf(temporalLayer.selectedItemLayer.item);
if(index == (temporalLayer.temporalItems.length-1)) {
return state;
} else {
temporalLayer.previousItemLayer = temporalLayer.selectedItemLayer;
if( temporalLayer.previousItemLayer) {
temporalLayer.previousItemLayer.opacity=0;
temporalLayer.previousItemLayer.layerIndex = temporalLayer.layerIndex;
}
temporalLayer.selectedItemLayer = temporalLayer.nextItemLayer;
if( temporalLayer.selectedItemLayer) {
temporalLayer.selectedItemLayer.opacity=1;
temporalLayer.selectedItemLayer.layerIndex=temporalLayer.layerIndex;
}
temporalLayer.nextItemLayer = index+2 < temporalLayer.temporalItems.length ? new ItemLayer(temporalLayer.temporalItems[index+2],0,true,temporalLayer.layerIndex):null;
if( temporalLayer.nextItemLayer) {
temporalLayer.nextItemLayer.opacity=0;
temporalLayer.nextItemLayer.layerIndex = temporalLayer.layerIndex;
}
return tassign(state,{selectedItemLayer:tassign(state.selectedItemLayer,temporalLayer as ItemLayer)});
}
} else {
return state;
}
}
case mapActions.PREVIOUSTEMPORAL: {
let temporalLayer = state.selectedItemLayer as ITemporalItemLayer;
if(temporalLayer.temporalItems && temporalLayer.temporalItems.length>0) {
let index = temporalLayer.temporalItems.indexOf(temporalLayer.selectedItemLayer.item);
if(index == 0) {
return state;
} else {
temporalLayer.nextItemLayer = temporalLayer.selectedItemLayer;
if( temporalLayer.nextItemLayer) {
temporalLayer.nextItemLayer.opacity=0;
temporalLayer.nextItemLayer.layerIndex = temporalLayer.layerIndex;
}
temporalLayer.selectedItemLayer = temporalLayer.previousItemLayer;
if( temporalLayer.selectedItemLayer) {
temporalLayer.selectedItemLayer.opacity=1;
temporalLayer.selectedItemLayer.layerIndex = temporalLayer.layerIndex;
}
temporalLayer.previousItemLayer = index-2 >=0? new ItemLayer(temporalLayer.temporalItems[index-2],0,true,temporalLayer.layerIndex):null;
if( temporalLayer.previousItemLayer) {
temporalLayer.previousItemLayer.opacity=0;
temporalLayer.previousItemLayer.layerIndex = temporalLayer.layerIndex;
}
return tassign(state,{selectedItemLayer:tassign(state.selectedItemLayer,temporalLayer as ItemLayer)});
}
} else {
return state;
}
}
case mapActions.SELECTTEMPORAL:{
//todo implement
}
case mapActions.STARTSEARCH: { case mapActions.STARTSEARCH: {
let a = action as mapActions.StartSearch; let a = action as mapActions.StartSearch;
return tassign(state, { return tassign(state, {
@@ -162,13 +265,13 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
selectedItemLayer:null, selectedItemLayer:null,
queryState: tassign(a.queryState), queryState: tassign(a.queryState),
searchCollapsed: false, searchCollapsed: false,
searchMinified: true, searchMinified: true
menuVisible:false
}); });
} }
case mapActions.DOQUERY: { case mapActions.DOQUERY: {
let a = action as mapActions.DoQuery; let a = action as mapActions.DoQuery;
return tassign(state, { return tassign(state, {
setStateCount:state.setStateCount+1,
query: tassign(a.query, { bbox: a.query.bboxFilter ? state.viewExtent : [] })}); query: tassign(a.query, { bbox: a.query.bboxFilter ? state.viewExtent : [] })});
} }
case mapActions.ADDFEATURESUCCESS: { case mapActions.ADDFEATURESUCCESS: {
@@ -178,7 +281,6 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
return tassign(state, { return tassign(state, {
panelVisible: true, panelVisible: true,
selectedFeature: a.feature, selectedFeature: a.feature,
menuVisible: false,
extent: a.feature.getGeometry().getExtent(), extent: a.feature.getGeometry().getExtent(),
searchCollapsed: false, searchCollapsed: false,
clearEnabled:true, clearEnabled:true,
@@ -190,7 +292,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
let features: any[] = []; let features: any[] = [];
var index = -1; var index = -1;
for (var i = 0; i < state.features.length; i++) { for (var i = 0; i < state.features.length; i++) {
if (state.features[i].get("code") == a.feature.get("code")) { if (state.features[i].getId() == a.feature.getId()) {
features.push(a.feature); features.push(a.feature);
} else { } else {
features.push(state.features[i]); features.push(state.features[i]);
@@ -204,10 +306,8 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
case mapActions.COLLAPSESEARCH: { case mapActions.COLLAPSESEARCH: {
return tassign(state, { searchCollapsed: state.panelVisible ? false: true}); return tassign(state, { searchCollapsed: state.panelVisible ? false: true});
} }
case mapActions.TOGGLEMENU: {
return tassign(state, { menuVisible: !state.menuVisible });
}
case mapActions.SETEXTENT: { case mapActions.SETEXTENT: {
console.debug("Set extent 2");
let a = action as mapActions.SetExtent; let a = action as mapActions.SetExtent;
return tassign(state, { extent: a.extent }); return tassign(state, { extent: a.extent });
} }
@@ -248,8 +348,35 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
case mapActions.SETLAYERINDEX: { case mapActions.SETLAYERINDEX: {
let a = action as mapActions.SetLayerIndex; let a = action as mapActions.SetLayerIndex;
if (a.itemLayer == null) { if (a.itemLayer == null) {
if(state.selectedItemLayer.item.itemType == "vnd.farmmaps.itemtype.temporal") {
var newItemlayer = tassign(state.selectedItemLayer,{layerIndex:a.layerIndex});
let tl = newItemlayer as ITemporalItemLayer;
if(tl.previousItemLayer) {
let nl = new ItemLayer(tl.previousItemLayer.item);
nl.opacity = tl.previousItemLayer.opacity;
nl.visible = tl.previousItemLayer.visible;
nl.layerIndex = a.layerIndex;
tl.previousItemLayer = nl;
}
if(tl.selectedItemLayer) {
let nl = new ItemLayer(tl.selectedItemLayer.item);
nl.opacity = tl.selectedItemLayer.opacity;
nl.visible = tl.selectedItemLayer.visible;
nl.layerIndex = a.layerIndex;
tl.selectedItemLayer = nl;
}
if(tl.nextItemLayer) {
let nl = new ItemLayer(tl.nextItemLayer.item);
nl.opacity = tl.nextItemLayer.opacity;
nl.visible = tl.nextItemLayer.visible;
nl.layerIndex = a.layerIndex;
tl.nextItemLayer = nl;
}
} else {
var newItemlayer = new ItemLayer(state.selectedItemLayer.item); var newItemlayer = new ItemLayer(state.selectedItemLayer.item);
newItemlayer.layerIndex = a.layerIndex; newItemlayer.layerIndex = a.layerIndex;
}
return tassign(state, { selectedItemLayer: newItemlayer}) return tassign(state, { selectedItemLayer: newItemlayer})
} else { } else {
let newLayers = state.overlayLayers.slice(0); let newLayers = state.overlayLayers.slice(0);
@@ -307,14 +434,27 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
clearEnabled: false, clearEnabled: false,
searchCollapsed: true, searchCollapsed: true,
searchMinified: false, searchMinified: false,
menuVisible:false,
features: [], features: [],
query:initialState.query query:initialState.query,
showLayerSwitcher: false
}); });
} else { } else {
return tassign(state, {}); return tassign(state, {});
} }
} }
case mapActions.SETSTYLE:{
let a = action as mapActions.SetStyle;
let styles = tassign(state.styles);
styles[a.itemType] = a.style;
return tassign(state,{styles:styles});
}
case mapActions.SHOWLAYERSWITCHER:{
let a = action as mapActions.ShowLayerSwitcher;
return tassign(state,{showLayerSwitcher:a.show});
}
case mapActions.INIT:{
return tassign(state,{setStateCount:0});
}
default: { default: {
return state; return state;
} }
@@ -332,7 +472,6 @@ export const getQueryState = (state: State) => state.queryState;
export const getClearEnabled = (state: State) => state.clearEnabled; export const getClearEnabled = (state: State) => state.clearEnabled;
export const getSearchCollapsed = (state: State) => state.searchCollapsed; export const getSearchCollapsed = (state: State) => state.searchCollapsed;
export const getSearchMinified = (state: State) => state.searchMinified; export const getSearchMinified = (state: State) => state.searchMinified;
export const getMenuVisible = (state: State) => state.menuVisible;
export const getExtent = (state: State) => state.extent; export const getExtent = (state: State) => state.extent;
export const getOverlayLayers = (state: State) => state.overlayLayers; export const getOverlayLayers = (state: State) => state.overlayLayers;
export const getBaseLayers = (state: State) => state.baseLayers; export const getBaseLayers = (state: State) => state.baseLayers;
@@ -342,6 +481,9 @@ export const getSelectedOverlayLayer = (state: State) => state.selectedOverlayLa
export const getQuery = (state: State) => state.query; export const getQuery = (state: State) => state.query;
export const getSelectedItemLayer = (state: State) => state.selectedItemLayer; export const getSelectedItemLayer = (state: State) => state.selectedItemLayer;
export const getPeriod = (state:State) => state.period; export const getPeriod = (state:State) => state.period;
export const getStyles = (state:State) => state.styles;
export const getShowLayerSwitcher = (state:State) => state.showLayerSwitcher;
export const getSetStateCount = (state:State) => state.setStateCount;
export const selectMapState = createFeatureSelector<State>(MODULE_NAME); export const selectMapState = createFeatureSelector<State>(MODULE_NAME);
export const selectGetMapState= createSelector(selectMapState, getMapState); export const selectGetMapState= createSelector(selectMapState, getMapState);
@@ -355,7 +497,6 @@ export const selectGetQueryState = createSelector(selectMapState, getQueryState)
export const selectGetClearEnabled = createSelector(selectMapState, getClearEnabled); export const selectGetClearEnabled = createSelector(selectMapState, getClearEnabled);
export const selectGetSearchCollapsed = createSelector(selectMapState, getSearchCollapsed); export const selectGetSearchCollapsed = createSelector(selectMapState, getSearchCollapsed);
export const selectGetSearchMinified = createSelector(selectMapState, getSearchMinified); export const selectGetSearchMinified = createSelector(selectMapState, getSearchMinified);
export const selectGetMenuVisible = createSelector(selectMapState, getMenuVisible);
export const selectGetExtent = createSelector(selectMapState, getExtent); export const selectGetExtent = createSelector(selectMapState, getExtent);
export const selectGetOverlayLayers = createSelector(selectMapState, getOverlayLayers); export const selectGetOverlayLayers = createSelector(selectMapState, getOverlayLayers);
export const selectGetBaseLayers = createSelector(selectMapState, getBaseLayers); export const selectGetBaseLayers = createSelector(selectMapState, getBaseLayers);
@@ -365,5 +506,8 @@ export const selectGetSelectedOverlayLayer = createSelector(selectMapState, getS
export const selectGetQuery = createSelector(selectMapState, getQuery); export const selectGetQuery = createSelector(selectMapState, getQuery);
export const selectGetSelectedItemLayer = createSelector(selectMapState, getSelectedItemLayer); export const selectGetSelectedItemLayer = createSelector(selectMapState, getSelectedItemLayer);
export const selectGetPeriod = createSelector(selectMapState, getPeriod); export const selectGetPeriod = createSelector(selectMapState, getPeriod);
export const selectGetStyles = createSelector(selectMapState, getStyles);
export const selectGetShowLayerSwitcher = createSelector(selectMapState,getShowLayerSwitcher);
export const selectgetSetStateCount = createSelector(selectMapState,getSetStateCount);

View File

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

View File

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

View File

@@ -25,7 +25,7 @@ export class GeolocationService {
}, },
(error: PositionError) => { (error: PositionError) => {
console.debug('Geolocation service: ' + error.message); console.debug('Geolocation service: ' + error.message);
observer.error(error); //observer.error(error);
}, },
{ {
enableHighAccuracy: true, enableHighAccuracy: true,

View File

@@ -5,9 +5,9 @@
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"angular-oauth2-oidc": { "angular-oauth2-oidc": {
"version": "5.0.2", "version": "8.0.4",
"resolved": "https://registry.npmjs.org/angular-oauth2-oidc/-/angular-oauth2-oidc-5.0.2.tgz", "resolved": "https://registry.npmjs.org/angular-oauth2-oidc/-/angular-oauth2-oidc-8.0.4.tgz",
"integrity": "sha512-jtOv4IWEjSFfBHVE4seWGWT/ZfWJ95QJ1JaFhVVGJEF64ibGuPwV3ztwTOUl98QHi/Yg4PXXDAisb31JnIbxBw==", "integrity": "sha512-7/3niJBqD7rnElcW+SudE36g7zMWChW4gSq7NpJSzDA4aQadBgvg0hn317MfPm9tpYGrpE3G/z2NMnbzek4TMA==",
"requires": { "requires": {
"jsrsasign": "^8.0.12", "jsrsasign": "^8.0.12",
"tslib": "^1.9.0" "tslib": "^1.9.0"
@@ -19,9 +19,9 @@
"integrity": "sha1-Iqu5ZW00owuVMENnIINeicLlwxY=" "integrity": "sha1-Iqu5ZW00owuVMENnIINeicLlwxY="
}, },
"ngx-uploadx": { "ngx-uploadx": {
"version": "3.1.3", "version": "3.3.2",
"resolved": "https://registry.npmjs.org/ngx-uploadx/-/ngx-uploadx-3.1.3.tgz", "resolved": "https://registry.npmjs.org/ngx-uploadx/-/ngx-uploadx-3.3.2.tgz",
"integrity": "sha512-RX3uEaqMTpjTv5mtdnTQYsDOED3Qg5V3OBU5ohOyL35uL+dllF7I0y+kojJprm9thzHNAWih1DLeTlVWZKo+hQ==", "integrity": "sha512-gRdXXq2cRU9HE6dj65qay9GV8NRC7n8y5LtMzJWqsfu2k3CHMQxo2TqZwA9/l/PqJ76RoO7sTPy1OenFQ+krkQ==",
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
} }

View File

@@ -4,21 +4,19 @@
"publishConfig": { "publishConfig": {
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/" "registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
}, },
"dependencies": {
"angular-oauth2-oidc": "^5.0.2",
"ngx-uploadx": "^3.1.3"
},
"peerDependencies": { "peerDependencies": {
"@ng-bootstrap/ng-bootstrap": "^4.2.1", "@ng-bootstrap/ng-bootstrap": "^4.2.1",
"@angular/common": "^7.2.0", "@angular/common": "^8.2.0",
"@angular/core": "^7.2.0", "@angular/core": "^8.2.0",
"@angular/forms": "^7.2.0", "@angular/forms": "^8.2.0",
"@ngrx/effects": "^7.2", "@ngrx/effects": "^8.2",
"@ngrx/router-store": "^7.2", "@ngrx/router-store": "^8.2",
"@ngrx/store": "^7.2", "@ngrx/store": "^8.2",
"tassign": "^1.0.0", "tassign": "^1.0.0",
"bootstrap": "^4.3.1", "bootstrap": "^4.3.1",
"@aspnet/signalr": "^1.1.4", "@aspnet/signalr": "^1.1.4",
"font-awesome": "^4.7.0" "font-awesome": "^4.7.0",
"ngx-uploadx": "^3.3.2",
"angular-oauth2-oidc": "^8.0.2"
} }
} }

View File

@@ -1,2 +0,0 @@
//$theme-colors: ( "primary": #a7ce39, "secondary": #ffc800 );
//$theme-colors: ( "primary": #a7ce39);

View File

@@ -13,7 +13,6 @@ export const INITROOTSUCCESS = '[Explorer] InitRootSuccess';
export const OPENMODAL = '[AppCommon] OpenModal'; export const OPENMODAL = '[AppCommon] OpenModal';
export const CLOSEMODAL = '[AppCommon] CloseModal'; export const CLOSEMODAL = '[AppCommon] CloseModal';
export const LOGIN = '[AppCommon] Login'; export const LOGIN = '[AppCommon] Login';
export const INITIALIZED = '[AppCommon] Initialized';
export const ESCAPE = '[AppCommon] Escape'; export const ESCAPE = '[AppCommon] Escape';
export const LOADITEMTYPES = '[AppCommon] LoadItemTypes'; export const LOADITEMTYPES = '[AppCommon] LoadItemTypes';
@@ -27,6 +26,8 @@ export const TASKSTARTEVENT = '[AppCommon] TaskStartEvent';
export const TASKENDEVENT = '[AppCommon] TaskEndEvent'; export const TASKENDEVENT = '[AppCommon] TaskEndEvent';
export const TASKERRORTEVENT = '[AppCommon] TaskErrorEvent'; export const TASKERRORTEVENT = '[AppCommon] TaskErrorEvent';
export const DEVICEUPDATEEVENT = '[AppCommon] DeviceUpdateEvent';
export const DELETEITEMS = '[AppCommon] DeleteItems'; export const DELETEITEMS = '[AppCommon] DeleteItems';
export const DELETEITEMSSUCCESS = '[AppCommon] DeleteItemsSuccess'; export const DELETEITEMSSUCCESS = '[AppCommon] DeleteItemsSuccess';
@@ -44,6 +45,10 @@ export const FAIL = '[AppCommon] Fail';
export const UPLOADEDFILECLICK = '[AppCommon] UploadedFileClick'; export const UPLOADEDFILECLICK = '[AppCommon] UploadedFileClick';
export const TOGGLEMENU = '[AppCommon] ToggleMenu';
export const SETMENUVISIBLE = '[AppCommon] SetMenuVisible';
export class InitUser implements Action { export class InitUser implements Action {
readonly type = INITUSER; readonly type = INITUSER;
@@ -98,12 +103,6 @@ export class Login implements Action {
constructor(public url: string) { } constructor(public url: string) { }
} }
export class Initialized implements Action {
readonly type = INITIALIZED;
constructor() { }
}
export class Escape implements Action { export class Escape implements Action {
readonly type = ESCAPE; readonly type = ESCAPE;
@@ -164,6 +163,12 @@ export class TaskErrorEvent implements Action {
constructor(public itemCode: string, public attributes: any) { } constructor(public itemCode: string, public attributes: any) { }
} }
export class DeviceUpdateEvent implements Action {
readonly type = DEVICEUPDATEEVENT;
constructor(public itemCode: string, public attributes: any) { }
}
export class DeleteItems implements Action { export class DeleteItems implements Action {
readonly type = DELETEITEMS; readonly type = DELETEITEMS;
@@ -205,13 +210,24 @@ export class UploadedFileClick implements Action {
constructor(public itemCode:string) { } constructor(public itemCode:string) { }
} }
export class ToggleMenu implements Action {
readonly type = TOGGLEMENU;
constructor() { }
}
export class SetMenuVisible implements Action {
readonly type = SETMENUVISIBLE;
constructor(public visible:boolean) { }
}
export type Actions = OpenModal export type Actions = OpenModal
| InitRoot | InitRoot
| InitRootSuccess | InitRootSuccess
| CloseModal | CloseModal
| Login | Login
| Initialized
| ItemChangedEvent | ItemChangedEvent
| ItemAddedEvent | ItemAddedEvent
| ItemDeletedEvent | ItemDeletedEvent
@@ -231,4 +247,7 @@ export type Actions = OpenModal
| InitUserSuccess | InitUserSuccess
| TaskStartEvent | TaskStartEvent
| TaskEndEvent | TaskEndEvent
| TaskErrorEvent; | TaskErrorEvent
| DeviceUpdateEvent
| ToggleMenu
| SetMenuVisible;

View File

@@ -3,6 +3,7 @@ import {RouterModule} from '@angular/router';
import {AuthCallbackComponent} from './components/auth-callback/auth-callback.component'; import {AuthCallbackComponent} from './components/auth-callback/auth-callback.component';
import {AuthCallbackGuard} from './components/auth-callback/auth-callback.guard'; import {AuthCallbackGuard} from './components/auth-callback/auth-callback.guard';
import {NavBarGuard} from './services/nav-bar-guard.service';
import {FullScreenGuard} from './services/full-screen-guard.service'; import {FullScreenGuard} from './services/full-screen-guard.service';
import {SessionClearedComponent} from './components/session-cleared/session-cleared.component'; import {SessionClearedComponent} from './components/session-cleared/session-cleared.component';
import {NotFoundComponent} from './components/not-found/not-found.component'; import {NotFoundComponent} from './components/not-found/not-found.component';
@@ -21,16 +22,8 @@ const routes = [
}, },
{ {
path: '**', component: NotFoundComponent, path: '**', component: NotFoundComponent,
data: { canActivate: [NavBarGuard]
title: '404 - Not found', }
meta: [{name: 'description', content: '404 - Error'}],
links: [],
// links: [
// { rel: 'canonical', href: 'http://blogs.example.com/bootstrap/something' },
// { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/bootstrap-demo' }
//]
},
},
]; ];
@NgModule({ @NgModule({

View File

@@ -0,0 +1,86 @@
// angular modules
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf } from '@angular/core';
import { DatePipe } from '@angular/common';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
// external modules
import { OAuthModule, OAuthService, OAuthStorage } from 'angular-oauth2-oidc';
//components
import { ItemTypeService } from './services/itemtype.service';
import { FolderService } from './services/folder.service';
import { TimespanService } from './services/timespan.service';
import { ItemService } from './services/item.service';
import { EventService } from './services/event.service';
import { TypeaheadService } from './services/typeahead.service';
import { UserService } from './services/user.service';
import { WeatherService} from './services/weather.service';
import { AppConfig } from './shared/app.config';
import { AccessTokenInterceptor } from "./shared/accesstoken.interceptor";
import { appConfigFactory } from "./shared/app.config.factory";
import { AuthGuard } from './services/auth-guard.service';
import { NavBarGuard } from './services/nav-bar-guard.service';
import { FullScreenGuard } from './services/full-screen-guard.service';
import { CodeListItemService } from './services/codelistitem.service';
import { AuthCallbackGuard } from './components/auth-callback/auth-callback.guard';
import { ResumableFileUploadService } from './components/resumable-file-upload/resumable-file-upload.service';
import { NgbDateNativeAdapter } from './services/date-adapter.service'
import { AuthConfigFactory } from './shared/authconfigFactory';
import { StateSerializerService } from './services/state-serializer.service';
export {
FolderService,
ItemTypeService,
TimespanService,
ItemService,
EventService,
TypeaheadService,
UserService,
WeatherService,
CodeListItemService,
AppConfig,
AccessTokenInterceptor,
AuthGuard,
NavBarGuard,
FullScreenGuard,
AuthCallbackGuard,
ResumableFileUploadService,
NgbDateNativeAdapter,
StateSerializerService
};
@NgModule({
imports: [
OAuthModule.forRoot(),
]
})
export class AppCommonServiceModule {
constructor(@Optional() @SkipSelf() parentModule: AppCommonServiceModule) {
if (parentModule) {
throw new Error(
'AppCommonServiceModule is already loaded. Import it in the AppModule only');
}
}
static forRoot(): ModuleWithProviders {
return {
ngModule: AppCommonServiceModule,
providers: [
AppConfig,
ItemTypeService,
{
provide: APP_INITIALIZER,
useFactory: appConfigFactory,
deps: [Injector, AppConfig, OAuthService, AuthConfigFactory, OAuthStorage,ItemTypeService],
multi: true
},
{
provide: HTTP_INTERCEPTORS,
useClass: AccessTokenInterceptor,
multi: true
},
DatePipe
]
};
}
}

View File

@@ -1,15 +1,15 @@
// angular modules // angular modules
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector,Optional,SkipSelf } from '@angular/core'; import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf } from '@angular/core';
import { CommonModule, DatePipe } from '@angular/common'; import { CommonModule, DatePipe } from '@angular/common';
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http'; import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
// external modules // external modules
import { OAuthModule,AuthConfig, OAuthService, OAuthStorage } from 'angular-oauth2-oidc'; import { OAuthModule, AuthConfig, OAuthService, OAuthStorage } from 'angular-oauth2-oidc';
import { StoreModule,Store } from '@ngrx/store'; import { StoreModule, Store } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects'; import { EffectsModule } from '@ngrx/effects';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import {UploadxModule } from 'ngx-uploadx'; import { UploadxModule } from 'ngx-uploadx';
// routing module // routing module
@@ -18,69 +18,47 @@ import { AppCommonRoutingModule } from './common-routing.module';
import { MODULE_NAME } from './module-name'; import { MODULE_NAME } from './module-name';
//components //components
import { ItemTypeService } from './services/itemtype.service';
import { FolderService } from './services/folder.service';
import { TimespanService} from './services/timespan.service';
import { ItemService} from './services/item.service';
import { EventService } from './services/event.service';
import { TypeaheadService } from './services/typeahead.service';
import { UserService } from './services/user.service';
import { AppConfig } from './shared/app.config';
import { AccessTokenInterceptor } from "./shared/accesstoken.interceptor";
import { appConfigFactory } from "./shared/app.config.factory";
import { AuthGuard } from './services/auth-guard.service';
import { NavBarGuard } from './services/nav-bar-guard.service';
import { FullScreenGuard } from './services/full-screen-guard.service';
import { SafePipe } from './shared/safe.pipe'; import { SafePipe } from './shared/safe.pipe';
import { AppComponent} from './components/app/app.component'; import { AuthConfigFactory, IAuthconfigFactory } from './shared/authconfigFactory';
import { AppComponent } from './components/app/app.component';
import { AuthCallbackComponent } from './components/auth-callback/auth-callback.component'; import { AuthCallbackComponent } from './components/auth-callback/auth-callback.component';
import { AuthCallbackGuard } from './components/auth-callback/auth-callback.guard';
import { SessionClearedComponent } from './components/session-cleared/session-cleared.component'; import { SessionClearedComponent } from './components/session-cleared/session-cleared.component';
import { ResumableFileUploadService } from './components/resumable-file-upload/resumable-file-upload.service';
import { ResumableFileUploadComponent } from './components/resumable-file-upload/resumable-file-upload.component'; import { ResumableFileUploadComponent } from './components/resumable-file-upload/resumable-file-upload.component';
import { NotFoundComponent } from './components/not-found/not-found.component'; import { NotFoundComponent } from './components/not-found/not-found.component';
import { NotImplementedComponent } from './components/not-implemented/not-implemented.component'; import { NotImplementedComponent } from './components/not-implemented/not-implemented.component';
import { SidePanelComponent } from './components/side-panel/side-panel.component'; import { SidePanelComponent } from './components/side-panel/side-panel.component';
import { TimespanComponent } from './components/timespan/timespan.component'; import { TimespanComponent } from './components/timespan/timespan.component';
import { TagInputComponent } from './components/tag-input/tag-input.component'; import { TagInputComponent } from './components/tag-input/tag-input.component';
import {IEventMessage } from './models/event.message'; import { MenuBackgroundComponent } from './components/menu-background/menu-background.component';
import { Alert } from './enumerations/alert.enum';
import { IEventMessage } from './models/event.message';
import { IItem, Item } from './models/item'; import { IItem, Item } from './models/item';
import {IItemType} from './models/item.type'; import { WeatherCurrentObservation } from './models/weatherCurrentObservation';
import {IItemTypes} from './models/item.types'; import { IItemType } from './models/item.type';
import {IItemTask,ItemTask} from './models/itemTask'; import { IItemTypes } from './models/item.types';
import {IListItem} from './models/list.item'; import { IItemTask, ItemTask } from './models/itemTask';
import {ITypeaheadItem} from './models/typeahead.item'; import { IListItem } from './models/list.item';
import {IUser} from './models/user'; import { ITypeaheadItem } from './models/typeahead.item';
import { IUser } from './models/user';
import { IQueryState } from './models/query.state';
import { ICodeListItem } from './models/code.list.item';
import * as commonActions from './actions/app-common.actions'; import * as commonActions from './actions/app-common.actions';
import * as commonReducers from './reducers/app-common.reducer'; import * as commonReducers from './reducers/app-common.reducer';
import * as commonEffects from './effects/app-common.effects'; import * as commonEffects from './effects/app-common.effects';
import {NgbDateNativeAdapter} from './services/date-adapter.service' import { SecureOAuthStorage} from './shared/secureOAuthStorage';
import { from } from 'rxjs';
export {FolderService, export {
ItemTypeService,
TimespanService,
ItemService,
EventService,
TypeaheadService,
UserService,
AppConfig,
AccessTokenInterceptor,
AuthGuard,
NavBarGuard,
FullScreenGuard,
SafePipe, SafePipe,
AuthCallbackComponent, AuthCallbackComponent,
AuthCallbackGuard,
AppComponent, AppComponent,
SessionClearedComponent, SessionClearedComponent,
ResumableFileUploadService,
ResumableFileUploadComponent, ResumableFileUploadComponent,
NotFoundComponent, NotFoundComponent,
NotImplementedComponent, NotImplementedComponent,
SidePanelComponent, SidePanelComponent,
TimespanComponent, TimespanComponent,
TagInputComponent, TagInputComponent,
Alert,
IEventMessage, IEventMessage,
IItem, IItem,
Item, Item,
@@ -91,9 +69,15 @@ export {FolderService,
IListItem, IListItem,
ITypeaheadItem, ITypeaheadItem,
IUser, IUser,
ICodeListItem,
IQueryState,
commonActions, commonActions,
commonReducers, commonReducers,
NgbDateNativeAdapter IAuthconfigFactory,
AuthConfigFactory,
MenuBackgroundComponent,
SecureOAuthStorage,
WeatherCurrentObservation
}; };
@NgModule({ @NgModule({
@@ -101,16 +85,13 @@ export {FolderService,
CommonModule, CommonModule,
HttpClientModule, HttpClientModule,
AppCommonRoutingModule, AppCommonRoutingModule,
StoreModule.forFeature(MODULE_NAME, commonReducers.reducer ), StoreModule.forFeature(MODULE_NAME, commonReducers.reducer),
EffectsModule.forFeature([commonEffects.AppCommonEffects]), EffectsModule.forFeature([commonEffects.AppCommonEffects]),
OAuthModule.forRoot(), OAuthModule.forRoot(),
NgbModule, NgbModule,
FormsModule, FormsModule,
UploadxModule UploadxModule
], ],
providers: [
DatePipe
],
declarations: [ declarations: [
AppComponent, AppComponent,
AuthCallbackComponent, AuthCallbackComponent,
@@ -121,7 +102,8 @@ export {FolderService,
ResumableFileUploadComponent, ResumableFileUploadComponent,
TimespanComponent, TimespanComponent,
TagInputComponent, TagInputComponent,
SessionClearedComponent SessionClearedComponent,
MenuBackgroundComponent
], ],
exports: [ exports: [
NgbModule, NgbModule,
@@ -137,33 +119,9 @@ export {FolderService,
ResumableFileUploadComponent, ResumableFileUploadComponent,
TimespanComponent, TimespanComponent,
TagInputComponent, TagInputComponent,
SessionClearedComponent SessionClearedComponent,
MenuBackgroundComponent
] ]
}) })
export class AppCommonModule { export class AppCommonModule {
constructor (@Optional() @SkipSelf() parentModule: AppCommonModule) {
if (parentModule) {
throw new Error(
'AppCommonModule is already loaded. Import it in the AppModule only');
}
}
static forRoot(): ModuleWithProviders {
return {
ngModule: AppCommonModule,
providers: [
AppConfig,
{
provide: APP_INITIALIZER,
useFactory: appConfigFactory,
deps: [Injector, AppConfig, OAuthService],
multi: true
},
{
provide: HTTP_INTERCEPTORS,
useClass: AccessTokenInterceptor,
multi: true
}
]
};
}
} }

View File

@@ -1,14 +1,26 @@
<div class="app fullscreen" (click)="handleClick($event)" [ngClass]="{'fullscreen' :(fullScreen|async)}"> <div class="app fullscreen" (click)="handleClick($event)" [ngClass]="{'fullscreen' :(fullScreen|async)}">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary"> <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" [routerLink]="['/']">Farm Maps <span *ngIf="routeLoading|async"><i class="fa fa-spinner fa-spin"></i></span></a> <button type="button" class="btn btn-outline-light" (click)="handleToggleMenu($event)"><i class="fa fa-bars" aria-hidden="true"></i></button>
<ul class="navbar-nav"> <router-outlet name="menu" class="ml-4"></router-outlet>
<li class="nav-item py-0"><a [routerLinkActive]="['active']" [routerLink]="['/map']" class="nav-link"><span><i class="fa fa-globe" aria-hidden="true"></i> Map</span></a></li>
<li class="nav-item py-0"><a [routerLinkActive]="['active']" [routerLink]="['/explorer']" class="nav-link"><span><i class="fa fa-folder" aria-hidden="true"></i> Explorer</span></a></li>
</ul>
<router-outlet name="menu"></router-outlet>
</nav> </nav>
<div class="body"> <div class="body">
<router-outlet></router-outlet> <router-outlet></router-outlet>
</div> </div>
<fm-menu-background [visible]="menuVisible|async"></fm-menu-background>
<fm-side-panel [visible]="menuVisible|async" [left]="true" class="menu" (click)="handleStopBubble($event)">
<div class="container-fluid">
<div class="body">
<div class="d-flex flex-row">
<div class="mt-2 mb-2 flex-grow-1 logo"><router-outlet name="side-panel-logo"></router-outlet></div>
<div class="mt-2 mb-2 ml-2"><button type="button" class="btn btn-outline-secondary" (click)="handleToggleMenu($event)"><i class="fa fa-times" aria-hidden="true"></i></button></div>
</div>
<div class="d-flex flex-column cards">
<router-outlet name="side-panel-menu"></router-outlet>
</div>
</div>
</div>
</fm-side-panel>
<ng-container *ngIf="showUploadProgress">
<fm-resumable-file-upload></fm-resumable-file-upload> <fm-resumable-file-upload></fm-resumable-file-upload>
</ng-container>
</div> </div>

View File

@@ -1,5 +1,3 @@
//@import "theme.scss";
/* Import Bootstrap & Fonts */ /* Import Bootstrap & Fonts */
@import "~bootstrap/scss/bootstrap.scss"; @import "~bootstrap/scss/bootstrap.scss";
@@ -70,3 +68,11 @@ body { background: #f1f1f1; line-height: 18px; user-select:none;}
color: #ffffff; color: #ffffff;
} }
.menu .side-panel {
z-index: 100;
background-color: rgb(245,245,245);
}
.logo {
margin-left: 1rem;
}

View File

@@ -1,6 +1,6 @@
import { Component, OnInit, OnDestroy, Inject, ViewEncapsulation, RendererFactory2, PLATFORM_ID, ChangeDetectionStrategy, HostListener } from '@angular/core'; import { Component, OnInit, OnDestroy, Inject, ViewEncapsulation, RendererFactory2, PLATFORM_ID, ChangeDetectionStrategy, HostListener, Input } from '@angular/core';
import { Router, NavigationEnd, RouteConfigLoadStart, RouteConfigLoadEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router'; import { Router, NavigationStart, NavigationEnd, RouteConfigLoadStart, RouteConfigLoadEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router';
import { Meta, Title, DOCUMENT, MetaDefinition } from '@angular/platform-browser'; import { Meta, Title, MetaDefinition } from '@angular/platform-browser';import { DOCUMENT } from "@angular/common";
import { Subscription , Observable } from 'rxjs'; import { Subscription , Observable } from 'rxjs';
import { Store, Action } from '@ngrx/store'; import { Store, Action } from '@ngrx/store';
@@ -31,11 +31,10 @@ export class AppComponent implements OnInit, OnDestroy {
public currentFolder: Observable<IListItem>; public currentFolder: Observable<IListItem>;
public folderParents: Observable<IListItem[]>; public folderParents: Observable<IListItem[]>;
public browseFileElement: any;
public browseDirectoryElement: any;
public fileDroptarget: any;
public fullScreen: Observable<boolean>; public fullScreen: Observable<boolean>;
public routeLoading: Observable<boolean>; public routeLoading: Observable<boolean>;
public menuVisible: Observable<boolean>;
@Input() showUploadProgress: boolean =true;
constructor( constructor(
private router: Router, private router: Router,
@@ -77,6 +76,10 @@ export class AppComponent implements OnInit, OnDestroy {
action = new commonActions.TaskErrorEvent(event.itemCode, event.attributes); action = new commonActions.TaskErrorEvent(event.itemCode, event.attributes);
break; break;
} }
case "deviceUpdate": {
action = new commonActions.DeviceUpdateEvent(event.itemCode, event.attributes);
break;
}
} }
return action; return action;
} }
@@ -84,6 +87,7 @@ export class AppComponent implements OnInit, OnDestroy {
ngOnInit() { ngOnInit() {
this.fullScreen = this.store.select(appReducers.selectGetFullScreen); this.fullScreen = this.store.select(appReducers.selectGetFullScreen);
this.routeLoading = this.store.select(appReducers.selectGetRouteLoading); this.routeLoading = this.store.select(appReducers.selectGetRouteLoading);
this.menuVisible = this.store.select(appReducers.SelectGetMenuVisible);
this.InstallRouteEventHandler(); this.InstallRouteEventHandler();
this.InstallEventServiceEventHandler(); this.InstallEventServiceEventHandler();
} }
@@ -111,6 +115,9 @@ export class AppComponent implements OnInit, OnDestroy {
if (event instanceof RouteConfigLoadEnd) { if (event instanceof RouteConfigLoadEnd) {
other.store.dispatch(new commonActions.EndRouteLoading()); other.store.dispatch(new commonActions.EndRouteLoading());
} }
if(event instanceof NavigationStart) {
other.store.dispatch(new commonActions.SetMenuVisible(false));
}
}); });
} }
@@ -125,5 +132,14 @@ export class AppComponent implements OnInit, OnDestroy {
handleClick(event: MouseEvent) { handleClick(event: MouseEvent) {
this.store.dispatch(new commonActions.Escape(false,true)); this.store.dispatch(new commonActions.Escape(false,true));
} }
handleStopBubble(event: MouseEvent) {
event.stopPropagation();
}
handleToggleMenu(event:MouseEvent) {
event.stopPropagation();
this.store.dispatch(new commonActions.ToggleMenu());
}
} }

View File

@@ -0,0 +1,3 @@
<div class="menu-background" [ngClass]="{'show':visible}">
</div>

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