439 Commits

Author SHA1 Message Date
Willem Dantuma
306065dcbd Fix logout issue
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-10-09 16:35:14 +02:00
824ba97704 try to fix deleteCodeListItem
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-10-09 07:47:47 +02:00
ac8ab147bc added codelist service
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-10-08 14:25:33 +02:00
Willem Dantuma
640c99cde2 Add test component
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-10-06 09:07:40 +02:00
Willem Dantuma
da2492e017 Add fm-gradient-select
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-10-06 08:22:10 +02:00
Willem Dantuma
f93d235877 add fm-gradient component
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-10-05 14:58:47 +02:00
Willem Dantuma
fe798e3f60 Fix AW-1508
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-10-05 11:08:36 +02:00
Willem Dantuma
b8dcc4e9e0 Add 3D example to test app
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-10-02 17:48:34 +02:00
Willem Dantuma
4b6175b6c4 Add npm scope
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-10-02 17:37:36 +02:00
Willem Dantuma
388a2faf84 Fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-10-02 17:33:25 +02:00
Willem Dantuma
0b0bb4d598 Fix build
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-10-02 17:26:18 +02:00
Willem Dantuma
7696ddd8d2 Add common-map3d to jenkins build
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-10-02 17:23:11 +02:00
Willem Dantuma
1301a9d082 Merge branch 'feature/Resurect_3D' into develop 2020-10-02 17:21:01 +02:00
Willem Dantuma
e87affee08 Refactor 3d to own library 2020-10-02 17:20:00 +02:00
Willem Dantuma
b00b21e6b8 Merge branch 'develop' into feature/Resurect_3D 2020-10-02 16:44:11 +02:00
Willem Dantuma
835851350c Fix i18n tags
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-10-02 07:46:59 +02:00
Willem Dantuma
7bdb48b644 Fix signalr authentication
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-30 18:30:36 +02:00
Willem Dantuma
84d6f44e9b Fix transition
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-29 20:57:14 +02:00
Willem Dantuma
2fd109d967 Fix AW-1414
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-29 15:27:21 +02:00
Willem Dantuma
f9934ccf27 Fix AW-1355
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-29 14:56:23 +02:00
Willem Dantuma
b93218e165 Merge branch 'develop' into feature/Resurect_3D
# Conflicts:
#	angular.json
#	package-lock.json
#	package.json
#	projects/common-map/package.json
2020-09-26 12:17:58 +02:00
Willem Dantuma
8e55308df9 First working angular 10 version
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-26 10:10:38 +02:00
Willem Dantuma
5270739641 Fix versions
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-26 10:03:15 +02:00
Willem Dantuma
ce8e8fa706 Update common
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-09-25 21:24:54 +02:00
Willem Dantuma
d326a82c4e Fix build
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-09-25 21:18:04 +02:00
Willem Dantuma
c1683a058c Fix build
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-09-25 21:16:38 +02:00
Willem Dantuma
aa168bb3a1 Fix build
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-09-25 19:55:08 +02:00
Willem Dantuma
fe53955bea Try to fix build
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-09-25 19:47:39 +02:00
Willem Dantuma
ba3dad1365 Fix dep
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-09-25 19:38:47 +02:00
Willem Dantuma
6d2d259c01 Merge branch 'feature/angular_upgrade_10' into develop
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-09-25 19:28:18 +02:00
Willem Dantuma
92774647ff Upgrade to angular 10 2020-09-25 19:27:53 +02:00
Willem Dantuma
9ca047923f npm auit fix 2020-09-25 17:10:17 +02:00
Willem Dantuma
c893a2820b Fix responsetype
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-22 19:29:44 +02:00
Willem Dantuma
baa0166fc8 Stupid bug :-(
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-22 15:13:00 +02:00
Willem Dantuma
58c200aca0 Another attempt to fix parameter
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-22 15:03:23 +02:00
Willem Dantuma
b8a4b3541d Fix params
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-22 14:46:51 +02:00
Willem Dantuma
584a1514ac Add getItemData
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-22 13:58:33 +02:00
Willem Dantuma
21af6ab2c4 Some styling fixes 2020-09-18 17:19:29 +02:00
Willem Dantuma
c606e02673 Fix static image layer 2020-09-18 16:05:44 +02:00
Willem Dantuma
ff4eb296ff Update libs
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-18 14:50:17 +02:00
Willem Dantuma
ea26cdd628 Update libs
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-18 14:30:20 +02:00
Willem Dantuma
26e28bdda8 Revert changes 2020-09-18 14:29:50 +02:00
Willem Dantuma
15d1f14ee1 More or less working now 2020-09-18 14:20:33 +02:00
Willem Dantuma
22e007b70b First attempt to bring back 3D view in map 2020-09-18 08:38:05 +02:00
Willem Dantuma
9e4a538a07 Implement min/maxzoom on vectorlayer
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-16 20:09:52 +02:00
Willem Dantuma
c44c771feb Use indexKey if specified
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-16 15:02:42 +02:00
Willem Dantuma
394bbab320 Add support for alpha in legend
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-16 14:40:03 +02:00
Willem Dantuma
3008081ae8 Implement stylecache for vectorlayer
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-16 13:38:06 +02:00
Willem Dantuma
7474c00498 Fix layerindex
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-16 10:34:04 +02:00
Willem Dantuma
964bf925e7 Fix typo
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-15 15:01:20 +02:00
Willem Dantuma
fb8129148d Add to module
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-15 14:01:24 +02:00
Willem Dantuma
73db03148a First attempt package preload strategy 2020-09-15 14:00:18 +02:00
Willem Dantuma
6367d3399d Implement default baselayer option
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-09 09:54:50 +02:00
Willem Dantuma
ee4e7113d2 Add TileJSON interface 2020-09-09 09:47:32 +02:00
Willem Dantuma
ad86e41345 Add background-color padding and border
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-04 10:40:34 +02:00
Willem Dantuma
e682b375e7 Add user-menu router outlet
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-04 10:10:01 +02:00
Willem Dantuma
78425a621a Fix fm-hasclaim
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-03 12:43:55 +02:00
1030b1c41a removed logging in weather service.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
changed moment to peerdependency.
2020-09-03 10:37:24 +02:00
76bdad6eaf fixed build
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-03 10:25:39 +02:00
ce56dd9e9f updated weather service with correct date manipulation.
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-09-03 10:19:12 +02:00
e7a53ba7b5 HourlyWeatherData time changed to string.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-02 21:32:47 +02:00
9f1f6934ee made hourly weather data static typed.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-02 16:21:49 +02:00
773bf3f5e7 fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-09-02 15:28:12 +02:00
cdc900d5fd fixed weather service
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-09-02 15:23:54 +02:00
80522a3a2f Revert "AW-1435 Add links to package manager and widget manager"
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This reverts commit 0157812357.
2020-08-17 15:53:02 +02:00
0157812357 AW-1435 Add links to package manager and widget manager
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-17 14:19:38 +02:00
329564d8f6 AW-1431 Oops
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-13 15:47:04 +02:00
ba2a067c8b AW-1431 Expose new property
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-08-13 15:28:30 +02:00
4d67a656f5 AW-1431 Add InitUserSettingsRoot
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-13 13:06:28 +02:00
ad1d40cdd1 AW-1426 Add extra check.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-11 19:13:57 +02:00
131e0eb371 Cleanup
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-11 19:03:05 +02:00
e563011099 New try
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-08-11 18:58:50 +02:00
7c072752c8 Build fixed
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-08-11 18:52:39 +02:00
36ced002e0 Fix build
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-08-11 18:50:08 +02:00
3e1b892eef Fix build?
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-08-11 18:38:15 +02:00
f4004cf2be Revert "AW-1426 Add extra check"
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
This reverts commit a6fd052a4f.
2020-08-11 14:42:45 +02:00
d1d8723186 Rollback c028adfb77
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-08-11 14:40:04 +02:00
a6fd052a4f AW-1426 Add extra check
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-08-11 14:35:04 +02:00
cede944538 Revert "AW-1426 Remove default component if none found"
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
This reverts commit 3b3c2768d3.
2020-08-11 14:24:12 +02:00
3b3c2768d3 AW-1426 Remove default component if none found
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-08-11 14:11:51 +02:00
3dd19c702f Remove Trijntje
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-08-11 13:32:05 +02:00
c028adfb77 Updated statistics confidence interval.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-06 12:04:56 +02:00
1d2caa0fe3 Updated statistics labels.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-06 09:15:31 +02:00
Willem Dantuma
d7ca1512bd Add TaskProgressEvent
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-05 20:05:44 +02:00
Willem Dantuma
ebe435027f Add addedfiles stream
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-05 15:49:02 +02:00
Willem Dantuma
dfefa6746f Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-05 10:34:04 +02:00
Willem Dantuma
c90df5c972 Fix userPackagesChanged 2020-08-05 10:33:55 +02:00
514a91c2c7 Improved implementation to retrieve user packages.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-05 09:02:28 +02:00
Willem Dantuma
ee7d1cb9a2 AW-1419
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-04 16:09:22 +02:00
309b320534 AW-1415 Add postItemPackageTask
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-04 14:08:50 +02:00
fdfa7d3387 Typo
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-03 08:48:11 +02:00
Willem Dantuma
6785bfc3e0 Fix when not having READ rights on the parent
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-08-01 09:44:32 +02:00
Willem Dantuma
c682fb9184 Fix z-index
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-31 09:51:28 +02:00
Willem Dantuma
ca6ea96eae Add interfacetype VectorWFSJson
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-30 09:33:32 +02:00
Willem Dantuma
3ebc197fac Make extent nullable
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-29 08:43:17 +02:00
52871efb09 fix for statistics
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-28 20:02:23 +02:00
f014dc9f93 now use statistics if available in band.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-28 19:05:38 +02:00
e6cda406c9 improved alignment of legend. fixed rain in weatherservice.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-25 09:57:24 +02:00
df04397b13 I info icon now placed in the top right.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-23 19:39:06 +02:00
Willem Dantuma
e0b29c905c Fix height
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-23 11:48:31 +02:00
Willem Dantuma
44ae806b30 Add offline alert
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-23 11:28:07 +02:00
Willem Dantuma
78e3cf74b9 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-23 09:43:03 +02:00
Willem Dantuma
428353d379 Fix inituser flow 2020-07-23 09:42:44 +02:00
9697e93915 convert hourly to daily with wilco's new changes for weather2.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-22 23:04:06 +02:00
Willem Dantuma
e057e463bd Only on change
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-22 21:16:38 +02:00
Willem Dantuma
d494a7c7d6 Implement healthcheck service
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-22 20:31:12 +02:00
Willem Dantuma
e525227865 another attempt to implement on /offline
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-22 18:49:15 +02:00
Willem Dantuma
10bdd27608 Check token when going online
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-22 09:05:02 +02:00
Willem Dantuma
2790ae74e7 Mirror navigator online flag in observable state 2020-07-22 08:52:41 +02:00
Willem Dantuma
31d01c75c5 And another potential issue
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-22 08:23:53 +02:00
Willem Dantuma
0da8d3d46d Fix editing unidentified type
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-22 08:22:35 +02:00
Willem Dantuma
60761e9f4a Fix typo
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-21 19:28:14 +02:00
Willem Dantuma
ec9684b826 Set upload flag only when file is found
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-21 19:11:30 +02:00
Willem Dantuma
1073044f31 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-21 18:40:10 +02:00
Willem Dantuma
81126974f5 After cancel a single file close the upload dialog 2020-07-21 18:39:51 +02:00
06f443a503 fix circular dependency error.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-21 17:06:58 +02:00
eb560aaf33 added weather method do receive historical + forecast weatherdata.
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-07-21 16:57:11 +02:00
Willem Dantuma
464b82bfb9 Fix colspan
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-21 11:21:34 +02:00
Willem Dantuma
1c75fb6f71 Fix upload dialog
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-20 15:07:25 +02:00
Willem Dantuma
5f5d8a9712 Do not add when cancelled
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-20 14:59:27 +02:00
Willem Dantuma
dc329a0e29 Try to fix file count
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-20 14:50:00 +02:00
Willem Dantuma
15a09e4b05 Attempt to fix multiple queue events for file upload
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-20 14:13:30 +02:00
94f973406e fixed parent name size.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-15 23:35:22 +02:00
6404e45d66 fix bug.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-15 23:28:17 +02:00
c0f689331e Added parentitem title to geotiff, shape and temporal selected-item components.
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-07-15 23:15:31 +02:00
0f5a5251db only show legend title if one layer
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-15 13:41:25 +02:00
3352bfd805 Added schema layout api to schemaService
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-09 13:45:24 +02:00
Willem Dantuma
60ed2afaa4 Fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-07-07 09:45:13 +02:00
Willem Dantuma
9ac534c171 Fix build
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-07-07 09:42:30 +02:00
Willem Dantuma
cecbdb2ded Fix dates
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-07-07 09:37:17 +02:00
Willem Dantuma
1092d5dcaf Fix build
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-07-07 09:31:47 +02:00
Willem Dantuma
4af6b2937c Refactor Date to string
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-07-07 09:24:45 +02:00
263fb6c3d4 Changed schema service to return any for json object.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-30 16:30:33 +02:00
Willem Dantuma
09fa8b4f1f Fix template selection
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-30 09:11:46 +02:00
Willem Dantuma
214dc3ffa1 Refactor temporallast
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-29 16:09:19 +02:00
Willem Dantuma
fad04744cf Refactor ILayer
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-29 16:00:53 +02:00
Willem Dantuma
033b74517f Export IDataLayer
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-29 15:51:08 +02:00
Willem Dantuma
0b7564e874 Add data layer
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-29 15:44:23 +02:00
Willem Dantuma
0d247e6416 Fix layerswitcher not opening
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-26 09:18:07 +02:00
Willem Dantuma
b92cc7bc09 Fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-26 09:02:33 +02:00
Willem Dantuma
eba18b0235 Close menu's on map click
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-06-26 08:49:35 +02:00
Willem Dantuma
69f8184dfe add closeall action
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-26 08:22:31 +02:00
Willem Dantuma
31c1570ffb Fix relogin issue on mobile
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-25 19:04:40 +02:00
Willem Dantuma
fe2650c4fd Refactored logout
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-25 18:52:13 +02:00
Willem Dantuma
f89209c555 Add logout event handler
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-25 17:21:12 +02:00
Willem Dantuma
b3d0a6f0c7 parse dataenddate
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-25 10:34:25 +02:00
Willem Dantuma
6bd1726fc9 Add dataenddate
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-25 10:01:54 +02:00
Willem Dantuma
b0ff54d157 Add dataenddate
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-25 09:47:53 +02:00
Willem Dantuma
277dc7051e Add shadow and transition
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-24 15:49:57 +02:00
Willem Dantuma
ace4a6b364 Implement toggleaccountmenu action
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-24 15:07:11 +02:00
Willem Dantuma
146514d386 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-24 13:08:27 +02:00
Willem Dantuma
1187ee9fd6 Implement logout 2020-06-24 13:08:13 +02:00
4527276254 Changed schema service.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-24 11:52:05 +02:00
Willem Dantuma
6f52302875 Fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-24 08:40:28 +02:00
Willem Dantuma
cbe27c2add Refactor template selection logic add forpackage decorator
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-06-24 08:35:34 +02:00
Willem Dantuma
cd156ab1bc Export packageservice
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-24 07:56:28 +02:00
Willem Dantuma
f9d0e2aee0 Implemented hasclaim directive
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-23 17:51:47 +02:00
Willem Dantuma
253b3d3c90 Fix build
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-23 15:44:14 +02:00
Willem Dantuma
28d4adc571 AW-1330
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
2020-06-23 15:39:30 +02:00
Willem Dantuma
925af1e645 Update dependency
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-23 14:18:49 +02:00
Willem Dantuma
4130e0a796 Merge branch 'develop' of https://git.akkerweb.nl/FarmMaps/FarmMapsLib into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-23 13:36:29 +02:00
Willem Dantuma
01933b1602 AW-1330 add atitemlocationitem parameter 2020-06-23 13:36:03 +02:00
0482aa7124 Added provided in root for schema service
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-22 13:37:38 +02:00
75015f6d22 Added schema service
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-22 13:12:02 +02:00
aa3707aa56 Added getSchema method to itemtypes service.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-22 12:20:02 +02:00
Willem Dantuma
ff06b419f2 Fix top in fullscreen mode
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-12 12:53:43 +02:00
Willem Dantuma
c1c0bd2596 Add start of user/account menu
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-12 12:24:08 +02:00
Willem Dantuma
978cbdabfc Read both farmmaps currentuser and authenticate userinfo
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-06-10 21:53:54 +02:00
Willem Dantuma
e0d585e125 Fix wrapping
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-29 10:00:53 +02:00
Willem Dantuma
cc6229002c Make histogram info block collapsable
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-27 10:57:25 +02:00
Willem Dantuma
ca776b0cb5 Fix layer index for real this time ( https://angular.io/guide/ivy-compatibility-examples#cannot-bind-to-value-property-of-select-with-ngfor )
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-27 09:14:43 +02:00
Willem Dantuma
7b29ca28d9 Fix layer index
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-26 18:19:46 +02:00
Willem Dantuma
0fb71a9227 Fix i18n tag
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-26 17:20:30 +02:00
Willem Dantuma
f1bfc9fec0 Add confidence interval
Some checks reported errors
FarmMaps.Develop/FarmMapsLib/pipeline/head Something is wrong with the build of this commit
2020-05-26 17:19:07 +02:00
Willem Dantuma
705d811832 Fix layer index
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-26 17:04:44 +02:00
Willem Dantuma
3ed68efab7 Mark some text as translatable
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-25 10:04:35 +02:00
Willem Dantuma
454dc26128 Try to fix exception
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-21 18:28:03 +02:00
Willem Dantuma
d56cfa805b Fix some issues
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-21 18:18:38 +02:00
Willem Dantuma
506b15cd4f Fix null ref
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-19 11:51:06 +02:00
Willem Dantuma
4a0474546c Converted observer to behaviorsubject 2020-05-19 11:46:27 +02:00
Willem Dantuma
51bb5b3833 Fix base map not showing
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-19 11:14:07 +02:00
Willem Dantuma
f4d1a04303 Add profile scope, expose start and stop methods events service
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-16 10:46:55 +02:00
Willem Dantuma
44cac3e1ab Update libs
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-13 12:47:26 +02:00
Willem Dantuma
2ea51d94ef Add basic package managing plumbing
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-13 12:30:09 +02:00
Willem Dantuma
750a743a50 Fix promise resolve
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-11 20:57:45 +02:00
Willem Dantuma
1c8db3ac94 Add some debug logging
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-11 20:50:38 +02:00
Willem Dantuma
b70ec77328 Fix authguard
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-11 20:39:00 +02:00
Willem Dantuma
baf8767a91 Refactor authentication flow
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-09 09:14:16 +02:00
Willem Dantuma
62887e8089 Implement canactivatechild also
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-06 14:13:10 +02:00
Willem Dantuma
24eef611d4 Add get user selector
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-05-04 14:47:04 +02:00
Willem Dantuma
62d5779c75 Fix url at page refresh
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-23 11:11:07 +02:00
Willem Dantuma
3493e96aad Fix panel on mobile
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-23 10:50:29 +02:00
Willem Dantuma
23ff92de6c Update libs
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-23 09:08:44 +02:00
Willem Dantuma
279d7eeca6 Fix imports
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-22 12:34:07 +02:00
Willem Dantuma
bb979e4322 Merge branch 'feature/streamline_flow' into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-22 12:27:11 +02:00
Willem Dantuma
d57ffe59e7 Fix style 2020-04-22 12:16:03 +02:00
Willem Dantuma
4dfa2cd96c Fix query 2020-04-22 09:25:10 +02:00
Willem Dantuma
7eef50eb7a Remove uneeded delay 2020-04-22 08:59:04 +02:00
Willem Dantuma
69751540d3 More refactoring, add thematic maps button 2020-04-22 08:11:50 +02:00
Willem Dantuma
ef81b04f4e More refactoring 2020-04-21 14:54:13 +02:00
Willem Dantuma
e41c728fb2 Fix zoom to extent 2020-04-21 13:22:54 +02:00
Willem Dantuma
4e83bc6158 Some refactoring 2020-04-21 12:31:20 +02:00
Willem Dantuma
c6d7f6b0cb Add action logging and some refactoring 2020-04-17 13:26:50 +02:00
Willem Dantuma
3828db341a Add debug logging
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-17 08:39:48 +02:00
Willem Dantuma
da0534e928 Make templating more responsive
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-17 08:01:39 +02:00
Willem Dantuma
be4cbd36d1 Add null check
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-16 17:43:13 +02:00
Willem Dantuma
8e0c424f81 Try to fix navigation issue
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-16 17:32:02 +02:00
Willem Dantuma
e30d95ff09 Refactor edit_in_editor
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-16 17:05:07 +02:00
Willem Dantuma
0b32153489 Also supply parentcode and itemtype
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-16 16:01:06 +02:00
Willem Dantuma
3e0cf6d691 Fix click on feature
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-16 15:47:15 +02:00
Willem Dantuma
d34a2069d6 Fix feature highlighting
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-16 13:19:06 +02:00
Willem Dantuma
9fbc946c68 Repeat signalR authenticate
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-16 11:04:39 +02:00
Willem Dantuma
e964fa72f3 Automatic reconnect signalR
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-15 21:31:02 +02:00
Willem Dantuma
1532e141b9 Add getScaledValueto both
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-07 10:22:27 +02:00
Willem Dantuma
490cd92707 Fix class
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-07 09:53:32 +02:00
Willem Dantuma
d6c89c7ada Add getScaledValue function
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-07 09:43:54 +02:00
Willem Dantuma
dd138f1168 Use scale in legend
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-07 08:51:31 +02:00
Willem Dantuma
1b165c3575 Remove uneeded search minify
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-07 07:58:04 +02:00
Willem Dantuma
77478078f6 Fix i18n tags
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
2020-04-06 14:51:43 +02:00
Willem Dantuma
61e6092cb3 Update libs
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-04-03 14:03:30 +02:00
Willem Dantuma
0d78fa29f3 Merge branch 'feature/Upgrade_to_angular_9' into develop
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-04-03 13:52:39 +02:00
Willem Dantuma
a892cb890b Move dependencies to peerdependencies 2020-04-02 09:07:19 +02:00
Willem Dantuma
8a6b376373 Revert ol to 6.1.1 2020-04-02 08:43:43 +02:00
Willem Dantuma
80ddf816b0 More migration fixes 2020-04-01 16:11:44 +02:00
Willem Dantuma
511f1f4731 Add @Directive attributes 2020-04-01 10:05:44 +02:00
Willem Dantuma
a5a7e1ece1 Updated ol to6.2.1 2020-04-01 09:19:19 +02:00
Willem Dantuma
c9d1fba36d Updated peer dependencies common 2020-04-01 09:13:41 +02:00
Willem Dantuma
ad7cc655d1 Updated other deps 2020-04-01 09:09:42 +02:00
Willem Dantuma
34990e5de2 Update to angular 9 2020-04-01 09:06:11 +02:00
Willem Dantuma
984408cd52 Update tsickle 2020-04-01 09:02:15 +02:00
Willem Dantuma
3b1b9c0b98 Update @ng-bootstrap 2020-04-01 09:00:30 +02:00
Willem Dantuma
7f776cf56b Update to latest 8.x 2020-04-01 08:55:55 +02:00
8ef248b0a7 AW-1037 Add filter parameter
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-27 15:53:26 +01:00
Willem Dantuma
bf883a779f AW-1079
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-27 13:22:11 +01:00
Willem Dantuma
050fda377b Fix unnecessary "hops" after zooming
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-26 15:55:21 +01:00
Willem Dantuma
dad8e061ea AW-1079
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-26 15:45:57 +01:00
Willem Dantuma
bc17f80050 Fix AW-1056, AW-1080
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
2020-03-26 14:29:18 +01:00
8db1edb262 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-03-26 14:06:32 +01:00
e279c04e62 AW-1037 Add itemtasklist to service. 2020-03-26 14:05:50 +01:00
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
220 changed files with 18664 additions and 12453 deletions

View File

@@ -1,11 +1,11 @@
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
# For additional information regarding the format and rule options, please see: # For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries # https://github.com/browserslist/browserslist#queries
# #
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
> 0.5% > 0.5%
last 2 versions last 2 versions
Firefox ESR Firefox ESR
not dead not dead
not IE 9-11 not IE 9-11

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/*

View File

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

118
README.md
View File

@@ -1,59 +1,59 @@
# Farmmaps viewer # Farmmaps viewer
This is a sample FarmMaps client in Angular 7.x. This is a sample FarmMaps client in Angular 7.x.
## Quick start ## Quick start
Use one of the two options below to get started. Use one of the two options below to get started.
## Option 1, Using docker ## Option 1, Using docker
*Dependencies* *Dependencies*
* docker desktop * docker desktop
*Setup* *Setup*
``` ```
docker pull node:10.16.0 docker pull node:12.13.1
docker run -t -i --entrypoint /bin/bash -p 4200:4200 node:10.16.0 docker run -t -i --entrypoint /bin/bash -p 4200:4200 node:12.13.1
``` ```
Inside the running container Inside the running container
``` ```
git clone https://git.akkerweb.nl/FarmMaps/FarmMapsLib.git git clone https://git.akkerweb.nl/FarmMaps/FarmMapsLib.git
cd FarmMapsLib cd FarmMapsLib
npm config set @farmmaps:registry https://repository.akkerweb.nl/repository/npm-group/ npm config set @farmmaps:registry https://repository.akkerweb.nl/repository/npm-group/
npm install -g @angular/cli npm install -g @angular/cli
npm install npm install
ng serve --host 0.0.0.0 ng serve --host 0.0.0.0
``` ```
*Go* *Go*
Point your browser to http://localhost:4200 Point your browser to http://localhost:4200
## Option 2, Using local machine ## Option 2, Using local machine
*Dependencies* *Dependencies*
* npm 6.9.0 * npm 6.9.0
* nodejs 10.16.0 * nodejs 10.16.0
* git * git
*Setup* *Setup*
``` ```
git clone https://git.akkerweb.nl/FarmMaps/FarmMapsLib.git git clone https://git.akkerweb.nl/FarmMaps/FarmMapsLib.git
cd FarmMapsLib cd FarmMapsLib
npm config set @farmmaps:registry https://repository.akkerweb.nl/repository/npm-group/ npm config set @farmmaps:registry https://repository.akkerweb.nl/repository/npm-group/
npm install -g @angular/cli npm install -g @angular/cli
npm install npm install
ng serve ng serve
``` ```
*Go* *Go*
Point your browser to http://localhost:4200 Point your browser to http://localhost:4200

View File

@@ -11,8 +11,12 @@
"schematics": {}, "schematics": {},
"architect": { "architect": {
"build": { "build": {
"builder": "@angular-devkit/build-angular:browser", "builder": "@angular-builders/custom-webpack:browser",
"options": { "options": {
"customWebpackConfig": {
"path": "./custom-webpack.config.js"
},
"aot": true,
"outputPath": "dist/farmmaps-lib-app", "outputPath": "dist/farmmaps-lib-app",
"index": "src/index.html", "index": "src/index.html",
"main": "src/main.ts", "main": "src/main.ts",
@@ -21,18 +25,23 @@
"assets": [ "assets": [
{ {
"glob": "**/*", "glob": "**/*",
"input":"src/assets/images", "input": "src/assets/images",
"output":"/images" "output": "/images"
}, },
{ {
"glob": "silent-refresh.html", "glob": "silent-refresh.html",
"input":"src/assets", "input": "src/assets",
"output":"/" "output": "/"
}, },
{ {
"glob": "favicon.ico", "glob": "favicon.ico",
"input":"src/assets", "input": "src/assets",
"output":"/" "output": "/"
},
{
"glob": "**/*",
"input": "node_modules/cesium/Build/Cesium",
"output": "/assets/cesium"
}, },
"src/configuration.json" "src/configuration.json"
], ],
@@ -40,10 +49,11 @@
"src/styles.css", "src/styles.css",
"node_modules/bootstrap/dist/css/bootstrap.min.css", "node_modules/bootstrap/dist/css/bootstrap.min.css",
"node_modules/font-awesome/css/font-awesome.min.css", "node_modules/font-awesome/css/font-awesome.min.css",
"fonts/FMIconFont/style.css" "fonts/FMIconFont/style.css",
"node_modules/cesium/Build/Cesium/Widgets/widgets.css",
"node_modules/ol/ol.css"
], ],
"scripts": [], "scripts": []
"es5BrowserSupport": true
}, },
"configurations": { "configurations": {
"production": { "production": {
@@ -66,14 +76,18 @@
{ {
"type": "initial", "type": "initial",
"maximumWarning": "2mb", "maximumWarning": "2mb",
"maximumError": "5mb" "maximumError": "7mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
} }
] ]
} }
} }
}, },
"serve": { "serve": {
"builder": "@angular-devkit/build-angular:dev-server", "builder": "@angular-builders/custom-webpack:dev-server",
"options": { "options": {
"browserTarget": "farmmaps-lib-app:build" "browserTarget": "farmmaps-lib-app:build"
}, },
@@ -160,7 +174,12 @@
"tsConfig": "projects/common/tsconfig.lib.json", "tsConfig": "projects/common/tsconfig.lib.json",
"project": "projects/common/ng-package.json" "project": "projects/common/ng-package.json"
} }
}, , "configurations": {
"production": {
"tsConfig": "projects/common/tsconfig.lib.prod.json"
}
}
},
"test": { "test": {
"builder": "@angular-devkit/build-angular:karma", "builder": "@angular-devkit/build-angular:karma",
"options": { "options": {
@@ -195,7 +214,12 @@
"tsConfig": "projects/common-map/tsconfig.lib.json", "tsConfig": "projects/common-map/tsconfig.lib.json",
"project": "projects/common-map/ng-package.json" "project": "projects/common-map/ng-package.json"
} }
}, , "configurations": {
"production": {
"tsConfig": "projects/common-map/tsconfig.lib.prod.json"
}
}
},
"test": { "test": {
"builder": "@angular-devkit/build-angular:karma", "builder": "@angular-devkit/build-angular:karma",
"options": { "options": {
@@ -217,6 +241,46 @@
} }
} }
} }
},
"common-map3d": {
"projectType": "library",
"root": "projects/common-map3d",
"sourceRoot": "projects/common-map3d/src",
"prefix": "fm-map3d",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr:build",
"options": {
"tsConfig": "projects/common-map3d/tsconfig.lib.json",
"project": "projects/common-map3d/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/common-map3d/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/common-map3d/src/test.ts",
"tsConfig": "projects/common-map3d/tsconfig.spec.json",
"karmaConfig": "projects/common-map3d/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/common-map3d/tsconfig.lib.json",
"projects/common-map3d/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
} }
}, },
"defaultProject": "farmmaps-lib-app" "defaultProject": "farmmaps-lib-app"

10
custom-webpack.config.js Normal file
View File

@@ -0,0 +1,10 @@
module.exports = {
node: {
// Resolve node module use of fs
fs: "empty",
Buffer: false,
http: "empty",
https: "empty",
zlib: "empty"
}
};

12926
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -11,53 +11,62 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "~7.2.0", "@angular/animations": "~10.1.3",
"@angular/common": "~7.2.0", "@angular/common": "~10.1.3",
"@angular/compiler": "~7.2.0", "@angular/compiler": "~10.1.3",
"@angular/core": "~7.2.0", "@angular/core": "~10.1.3",
"@angular/forms": "~7.2.0", "@angular/forms": "~10.1.3",
"@angular/platform-browser": "~7.2.0", "@angular/platform-browser": "~10.1.3",
"@angular/platform-browser-dynamic": "~7.2.0", "@angular/platform-browser-dynamic": "~10.1.3",
"@angular/router": "~7.2.0", "@angular/router": "~10.1.3",
"@aspnet/signalr": "^1.1.4", "@farmmaps/common": ">=0.0.1-prerelease.434 <0.0.1",
"@farmmaps/common": ">=0.0.1-prerelease.69 <0.0.1", "@farmmaps/common-map": ">=0.0.1-prerelease.434 <0.0.1",
"@farmmaps/common-map": ">=0.0.1-prerelease.69 <0.0.1", "@farmmaps/common-map3d": ">=0.0.1-prerelease.434 <0.0.1",
"@ng-bootstrap/ng-bootstrap": "^4.2.1", "@microsoft/signalr": "^3.1.3",
"@ngrx/effects": "^7.2.0", "@ng-bootstrap/ng-bootstrap": "^7.0",
"@ngrx/router-store": "^7.2.0", "@ngrx/effects": "^10.0",
"@ngrx/store": "^7.2.0", "@ngrx/router-store": "^10.0",
"bootstrap": "^4.3.1", "@ngrx/store": "^10.0",
"angular-oauth2-oidc": "^10.0.3",
"bootstrap": "^4.4.1",
"cesium": "^1.73.0",
"core-js": "^2.6.11",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"core-js": "^2.5.4", "ngrx-store-localstorage": "^10.0",
"ngrx-store-localstorage": "^8.0.0", "ngx-bootstrap": "^5.6.1",
"ngx-openlayers": "1.0.0-next.16",
"ngx-uploadx": "^3.5.1",
"ol": "6.1.1",
"ol-cesium": "^2.11.3",
"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" "tslib": "^2.0.0",
"zone.js": "~0.10.2",
"moment": "^2.27.0"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "~0.13.0", "@angular-devkit/build-angular": "^0.1001.3",
"@angular-devkit/build-ng-packagr": "~0.13.0", "@angular-devkit/build-ng-packagr": "~0.1001.3",
"@angular/cli": "~7.3.8", "@angular/cli": "^10.1.3",
"@angular/compiler-cli": "~7.2.0", "@angular/compiler-cli": "~10.1.3",
"@angular/language-service": "~7.2.0", "@angular/language-service": "~10.1.3",
"@types/node": "~8.9.4", "@angular-builders/custom-webpack": "~10.0.1",
"@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": "^12.11.1",
"jasmine-core": "~2.99.1", "codelyzer": "^5.1.2",
"jasmine-spec-reporter": "~4.2.1", "jasmine-core": "~3.5.0",
"karma": "~4.0.0", "jasmine-spec-reporter": "~5.0.0",
"karma-chrome-launcher": "~2.2.0", "karma": "~5.0.0",
"karma-coverage-istanbul-reporter": "~2.0.1", "karma-chrome-launcher": "~3.1.0",
"karma-jasmine": "~1.1.2", "karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine-html-reporter": "^0.2.2", "karma-jasmine": "~4.0.0",
"ng-packagr": "^4.2.0", "karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~5.4.0", "ng-packagr": "^10.1.0",
"ts-node": "~7.0.0", "protractor": "~7.0.0",
"tsickle": ">=0.34.0", "ts-node": "^8.8.1",
"tslib": "^1.9.0", "tslint": "~6.1.0",
"tslint": "~5.11.0", "typescript": "~4.0.3"
"typescript": "~3.2.2"
} }
} }

View File

@@ -4,105 +4,10 @@
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@farmmaps/common": {
"version": "0.0.1-prerelease.56",
"resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-0.0.1-prerelease.56.tgz",
"integrity": "sha512-m9KxWsLkTSz2JI074gIJH1kDR0PCLsFAug8oBjtlU/QxgBySrvqHCRiODpNmNWnFyNTZHqKHJQefn3Q9iAil4g==",
"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": {
"version": "1.1.13",
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz",
"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": {
"version": "1.0.0-next.9",
"resolved": "https://registry.npmjs.org/ngx-openlayers/-/ngx-openlayers-1.0.0-next.9.tgz",
"integrity": "sha512-14UFxJX9oeOXtq+HJCJyXn0sBmYmCqj2AnFtetKk1FsDe8EUMFGIRju8UOFegCr2oEu5JsuRjALcfW7lCe+teg==",
"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": {
"tslib": "^1.9.0"
}
},
"ol": {
"version": "5.3.3",
"resolved": "https://registry.npmjs.org/ol/-/ol-5.3.3.tgz",
"integrity": "sha512-7eU4x8YMduNcED1D5wI+AMWDRe7/1HmGfsbV+kFFROI9RNABU/6n4osj6Q3trZbxxKnK2DSRIjIRGwRHT/Z+Ww==",
"requires": {
"pbf": "3.1.0",
"pixelworks": "1.1.0",
"rbush": "2.0.2"
}
},
"pbf": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/pbf/-/pbf-3.1.0.tgz",
"integrity": "sha512-/hYJmIsTmh7fMkHAWWXJ5b8IKLWdjdlAFb3IHkRBn1XUhIYBChVGfVwmHEAV3UfXTxsP/AKfYTXTS/dCPxJd5w==",
"requires": {
"ieee754": "^1.1.6",
"resolve-protobuf-schema": "^2.0.0"
}
},
"pixelworks": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/pixelworks/-/pixelworks-1.1.0.tgz",
"integrity": "sha1-Hwla1I3Ki/ihyCWOAJIDGkTyLKU="
},
"protocol-buffers-schema": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.3.2.tgz",
"integrity": "sha512-Xdayp8sB/mU+sUV4G7ws8xtYMGdQnxbeIfLjyO9TZZRJdztBGhlmbI5x1qcY4TG5hBkIKGnc28i7nXxaugu88w=="
},
"quickselect": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/quickselect/-/quickselect-1.1.1.tgz",
"integrity": "sha512-qN0Gqdw4c4KGPsBOQafj6yj/PA6c/L63f6CaZ/DCF/xF4Esu3jVmKLUDYxghFx8Kb/O7y9tI7x2RjTSXwdK1iQ=="
},
"rbush": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/rbush/-/rbush-2.0.2.tgz",
"integrity": "sha512-XBOuALcTm+O/H8G90b6pzu6nX6v2zCKiFG4BJho8a+bY6AER6t8uQUZdi5bomQc0AprCWhEGa7ncAbbRap0bRA==",
"requires": {
"quickselect": "^1.0.1"
}
},
"resolve-protobuf-schema": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz",
"integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==",
"requires": {
"protocol-buffers-schema": "^3.3.1"
}
},
"tslib": { "tslib": {
"version": "1.10.0", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz",
"integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ=="
} }
} }
} }

View File

@@ -5,16 +5,17 @@
"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", "tslib": "^2.0.0"
"ol": "^5.3.3"
}, },
"peerDependencies": { "peerDependencies": {
"@angular/core": "^7.2.0", "@angular/core": "^10.1.3",
"ngrx-store-localstorage": "^8.0.0", "ngrx-store-localstorage": "^10.0",
"@ngrx/effects": "^7.2", "@ngrx/effects": "^10.0",
"@ngrx/router-store": "^7.2", "@ngrx/router-store": "^10.0",
"@ngrx/store": "^7.2", "@ngrx/store": "^10.0",
"tassign": "^1.0.0", "tassign": "^1.0.0",
"@farmmaps/common": ">=0.0.1-prerelease.56 <0.0.1" "@farmmaps/common": ">=0.0.1-prerelease.420 <0.0.1",
"ngx-openlayers": "1.0.0-next.16",
"ol": "6.1.1"
} }
} }

View File

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

View File

@@ -1,241 +1,295 @@
import { Action } from '@ngrx/store'; import { Action } from '@ngrx/store';
import { IMapState,IItemLayer,IQueryState } from '../models'; import { IMapState } from '../models/map.state';
import { IItem } from '@farmmaps/common'; import { IItemLayer } from '../models/item.layer';
import { Feature } from 'ol'; import { IQueryState } from '@farmmaps/common';
import { Extent } from 'ol/extent'; import { IItem } from '@farmmaps/common';
import { Feature,Style } from 'ol';
export const SETSTATE = '[Map] SetState';
export const SETMAPSTATE = '[Map] MapState'; export const SETSTATE = '[Map] SetState';
export const SETVIEWEXTENT = '[Map] SetViewExtent'; export const SETMAPSTATE = '[Map] MapState';
export const INIT = '[Map] Init'; export const SETVIEWEXTENT = '[Map] SetViewExtent';
export const SETPARENT = '[Map] SetParent'; export const INIT = '[Map] Init';
export const STARTSEARCH = '[Map] StartSearch'; export const SETPARENT = '[Map] SetParent';
export const STARTSEARCHSUCCESS = '[Map] StartSearchSuccess'; export const STARTSEARCH = '[Map] StartSearch';
export const SELECTFEATURE = '[Map] SelectFeature'; export const STARTSEARCHSUCCESS = '[Map] StartSearchSuccess';
export const SELECTITEM = '[Map] SelectItem'; export const SELECTFEATURE = '[Map] SelectFeature';
export const SELECTITEMSUCCESS = '[Map] SelectItemSuccess'; export const SELECTITEM = '[Map] SelectItem';
export const ADDFEATURESUCCESS = '[Map] AddFeatureSuccess'; export const SELECTITEMSUCCESS = '[Map] SelectItemSuccess';
export const UPDATEFEATURESUCCESS = '[Map] UpdateFeatureSuccess'; export const SELECTTEMPORALITEMSSUCCESS = '[Map] SelectTemporalItemsSuccess';
export const EXPANDSEARCH = '[Map] ExpandSearch'; export const NEXTTEMPORAL = '[Map] NextTemporal';
export const COLLAPSESEARCH = '[Map] CollapseSearch'; export const PREVIOUSTEMPORAL = '[Map] PreviousTemporal';
export const TOGGLEMENU = '[Map] ToggleMenu'; export const SELECTTEMPORAL = '[Map] SelectTemporal';
export const SETEXTENT = '[Map] SetExtent'; export const ADDFEATURESUCCESS = '[Map] AddFeatureSuccess';
export const SETQUERYSTATE = '[Map] SetQueryState'; export const UPDATEFEATURESUCCESS = '[Map] UpdateFeatureSuccess';
export const SETTIMESPAN = '[Map] SetTimeSpan'; export const EXPANDSEARCH = '[Map] ExpandSearch';
export const ADDLAYER = '[Map] AddLayer'; export const COLLAPSESEARCH = '[Map] CollapseSearch';
export const SETVISIBILITY = '[Map] SetVisibility'; export const SETEXTENT = '[Map] SetExtent';
export const SETOPACITY = '[Map] SetOpacity'; export const SETQUERYSTATE = '[Map] SetQueryState';
export const SETLAYERINDEX = '[Map] SetLayerIndex'; export const SETTIMESPAN = '[Map] SetTimeSpan';
export const REMOVELAYER = '[Map] RemoveLayer'; export const ADDLAYER = '[Map] AddLayer';
export const LOADBASELAYERS = '[Map] LoadLayers'; export const SETVISIBILITY = '[Map] SetVisibility';
export const LOADBASELAYERSSUCCESS = '[Map] LoadLayersSuccess'; export const SETOPACITY = '[Map] SetOpacity';
export const SELECTBASELAYER = '[Map] SelectBaseLayers'; export const SETLAYERINDEX = '[Map] SetLayerIndex';
export const SELECTOVERLAYLAYER = '[Map] SelectOverlayLayers'; export const REMOVELAYER = '[Map] RemoveLayer';
export const ZOOMTOEXTENT = '[Map] ZoomToExtent'; export const LOADBASELAYERS = '[Map] LoadLayers';
export const DOQUERY = '[Map] DoQuery'; export const LOADBASELAYERSSUCCESS = '[Map] LoadLayersSuccess';
export const SELECTBASELAYER = '[Map] SelectBaseLayers';
export class SetState implements Action { export const SELECTOVERLAYLAYER = '[Map] SelectOverlayLayers';
readonly type = SETSTATE; export const ZOOMTOEXTENT = '[Map] ZoomToExtent';
export const DOQUERY = '[Map] DoQuery';
constructor(public mapState: IMapState,public queryState:IQueryState) { } export const SETSTYLE = '[Map] SetStyle';
} export const SHOWLAYERSWITCHER = '[Map] ShowLayerSwitcher';
export const CLEAR = '[Map] Clear';
export class SetMapState implements Action { export const SETREPLACEURL = '[Map] SetReplaceUrl';
readonly type = SETMAPSTATE;
export class Clear implements Action {
constructor(public mapState: IMapState) { } readonly type = CLEAR;
} constructor() {}
}
export class SetViewExtent implements Action {
readonly type = SETVIEWEXTENT; export class SetState implements Action {
readonly type = SETSTATE;
constructor(public extent:number[]) { }
} constructor(public mapState: IMapState,public queryState:IQueryState) { }
}
export class Init implements Action {
readonly type = INIT; export class SetMapState implements Action {
readonly type = SETMAPSTATE;
constructor() { }
} constructor(public mapState: IMapState) { }
}
export class SetParent implements Action {
readonly type = SETPARENT; export class SetViewExtent implements Action {
readonly type = SETVIEWEXTENT;
constructor(public parentCode:string) { }
} constructor(public extent:number[]) { }
}
export class StartSearch implements Action {
readonly type = STARTSEARCH; export class Init implements Action {
readonly type = INIT;
constructor(public queryState: IQueryState) { }
} constructor() { }
}
export class StartSearchSuccess implements Action {
readonly type = STARTSEARCHSUCCESS; export class SetParent implements Action {
readonly type = SETPARENT;
constructor(public features: Array<Feature>, public query:IQueryState) { }
} constructor(public parentCode:string) { }
}
export class SelectFeature implements Action {
readonly type = SELECTFEATURE; export class StartSearch implements Action {
readonly type = STARTSEARCH;
constructor(public feature:Feature) { }
} constructor(public queryState: IQueryState) { }
}
export class SelectItem implements Action {
readonly type = SELECTITEM; export class StartSearchSuccess implements Action {
readonly type = STARTSEARCHSUCCESS;
constructor(public itemCode:string) { }
} constructor(public features: Array<Feature>, public query:IQueryState,public setStateCount:number) { }
}
export class SelectItemSuccess implements Action {
readonly type = SELECTITEMSUCCESS; export class SelectFeature implements Action {
readonly type = SELECTFEATURE;
constructor(public item: IItem) { }
} constructor(public feature:Feature) { }
}
export class AddFeatureSuccess implements Action {
readonly type = ADDFEATURESUCCESS; export class SelectItem implements Action {
readonly type = SELECTITEM;
constructor(public feature: Feature) { }
} constructor(public itemCode:string) { }
}
export class UpdateFeatureSuccess implements Action {
readonly type = UPDATEFEATURESUCCESS; export class SelectItemSuccess implements Action {
readonly type = SELECTITEMSUCCESS;
constructor(public feature: Feature) { }
} constructor(public item: IItem, public parentItem: IItem) { }
}
export class ExpandSearch implements Action {
readonly type = EXPANDSEARCH; export class SelectTemporalItemsSuccess implements Action {
readonly type = SELECTTEMPORALITEMSSUCCESS;
constructor() { }
} constructor(public temporalItems: IItem[]) { }
}
export class CollapseSearch implements Action {
readonly type = COLLAPSESEARCH; export class NextTemporal implements Action {
readonly type = NEXTTEMPORAL;
constructor() { }
} constructor() { }
}
export class ToggleMenu implements Action {
readonly type = TOGGLEMENU; export class PreviousTemporal implements Action {
readonly type = PREVIOUSTEMPORAL;
constructor() { }
} constructor() { }
}
export class SetExtent implements Action {
readonly type = SETEXTENT; export class SelectTemporal implements Action {
readonly type = SELECTTEMPORAL;
constructor(public extent:number[]) { }
} constructor(item:IItem) { }
}
export class SetQueryState implements Action {
readonly type = SETQUERYSTATE; export class AddFeatureSuccess implements Action {
readonly type = ADDFEATURESUCCESS;
constructor(public queryState: IQueryState) { }
} constructor(public feature: Feature) { }
}
export class SetTimeSpan implements Action {
readonly type = SETTIMESPAN; export class UpdateFeatureSuccess implements Action {
readonly type = UPDATEFEATURESUCCESS;
constructor(public startDate: Date, public endDate: Date) { }
} constructor(public feature: Feature) { }
}
export class AddLayer implements Action {
readonly type = ADDLAYER; export class ExpandSearch implements Action {
readonly type = EXPANDSEARCH;
constructor(public item:IItem,public layerIndex=-1) { }
} constructor() { }
}
export class SetVisibility implements Action {
readonly type = SETVISIBILITY; export class CollapseSearch implements Action {
readonly type = COLLAPSESEARCH;
constructor(public itemLayer:IItemLayer,public visibility:boolean) { }
} constructor() { }
}
export class SetOpacity implements Action {
readonly type = SETOPACITY; export class SetExtent implements Action {
readonly type = SETEXTENT;
constructor(public itemLayer: IItemLayer, public opacity: number) { }
} constructor(public extent:number[]) { }
}
export class SetLayerIndex implements Action {
readonly type = SETLAYERINDEX; export class SetQueryState implements Action {
readonly type = SETQUERYSTATE;
constructor(public layerIndex: number, public itemLayer: IItemLayer = null) { }
} constructor(public queryState: IQueryState,public replaceUrl:boolean = true) { }
}
export class RemoveLayer implements Action {
readonly type = REMOVELAYER; export class SetTimeSpan implements Action {
readonly type = SETTIMESPAN;
constructor(public itemLayer: IItemLayer) { }
} constructor(public startDate: Date, public endDate: Date) { }
}
export class LoadBaseLayers implements Action {
readonly type = LOADBASELAYERS; export class AddLayer implements Action {
readonly type = ADDLAYER;
constructor(public projection: string) { }
} constructor(public item:IItem,public layerIndex=-1) { }
}
export class LoadBaseLayersSuccess implements Action {
readonly type = LOADBASELAYERSSUCCESS; export class SetVisibility implements Action {
readonly type = SETVISIBILITY;
constructor(public items: IItem[] ) { }
} constructor(public itemLayer:IItemLayer,public visibility:boolean) { }
}
export class SelectBaseLayer implements Action {
readonly type = SELECTBASELAYER; export class SetOpacity implements Action {
readonly type = SETOPACITY;
constructor(public itemLayer: IItemLayer) { }
} constructor(public itemLayer: IItemLayer, public opacity: number) { }
}
export class SelectOverlayLayer implements Action {
readonly type = SELECTOVERLAYLAYER; export class SetLayerIndex implements Action {
readonly type = SETLAYERINDEX;
constructor(public itemLayer: IItemLayer) { }
} constructor(public layerIndex: number, public itemLayer: IItemLayer = null) { }
}
export class ZoomToExtent implements Action {
readonly type = ZOOMTOEXTENT; export class RemoveLayer implements Action {
readonly type = REMOVELAYER;
constructor(public itemLayer: IItemLayer) { }
} constructor(public itemLayer: IItemLayer) { }
}
export class DoQuery implements Action {
readonly type = DOQUERY; export class LoadBaseLayers implements Action {
readonly type = LOADBASELAYERS;
constructor(public query:IQueryState) { }
} constructor(public projection: string) { }
}
export type Actions = SetMapState
| Init export class LoadBaseLayersSuccess implements Action {
| SetParent readonly type = LOADBASELAYERSSUCCESS;
| StartSearch
| StartSearchSuccess constructor(public items: IItem[] ) { }
| SelectFeature }
| SelectItem
| SelectItemSuccess export class SelectBaseLayer implements Action {
| AddFeatureSuccess readonly type = SELECTBASELAYER;
| UpdateFeatureSuccess
| ExpandSearch constructor(public itemLayer: IItemLayer) { }
| CollapseSearch }
| ToggleMenu
| SetExtent export class SelectOverlayLayer implements Action {
| SetQueryState readonly type = SELECTOVERLAYLAYER;
| SetTimeSpan
| AddLayer constructor(public itemLayer: IItemLayer) { }
| RemoveLayer }
| SetVisibility
| SetOpacity export class ZoomToExtent implements Action {
| SetLayerIndex readonly type = ZOOMTOEXTENT;
| LoadBaseLayers
| LoadBaseLayersSuccess constructor(public itemLayer: IItemLayer) { }
| SelectBaseLayer }
| SelectOverlayLayer
| ZoomToExtent export class DoQuery implements Action {
| SetState readonly type = DOQUERY;
| SetViewExtent
| DoQuery; 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 class SetReplaceUrl implements Action {
readonly type = SETREPLACEURL;
constructor(public replaceUrl:boolean) {}
}
export type Actions = SetMapState
| Init
| Clear
| SetParent
| StartSearch
| StartSearchSuccess
| SelectFeature
| SelectItem
| SelectItemSuccess
| SelectTemporalItemsSuccess
| NextTemporal
| PreviousTemporal
| SelectTemporal
| AddFeatureSuccess
| UpdateFeatureSuccess
| ExpandSearch
| CollapseSearch
| SetExtent
| SetQueryState
| SetTimeSpan
| AddLayer
| RemoveLayer
| SetVisibility
| SetOpacity
| SetLayerIndex
| LoadBaseLayers
| LoadBaseLayersSuccess
| SelectBaseLayer
| SelectOverlayLayer
| ZoomToExtent
| SetState
| SetViewExtent
| DoQuery
| SetStyle
| ShowLayerSwitcher
| SetReplaceUrl;

View File

@@ -1,29 +1,29 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router'; import { RouterModule } from '@angular/router';
import { MapComponent } from './components/map/map.component'; import { MapComponent } from './components/map/map.component';
import { AuthGuard } from '@farmmaps/common'; import { AuthGuard } from '@farmmaps/common';
const routes = [ const routes = [
{ {
path: '', canActivateChild: [AuthGuard], children: [ path: '', children: [
{ {
path: '', path: '',
component: MapComponent component: MapComponent
} }
] ]
}, },
{ {
path: ':xCenter/:yCenter/:zoom/:rotation/:baseLayer/:queryState', canActivateChild: [AuthGuard], children: [ path: ':xCenter/:yCenter/:zoom/:rotation/:baseLayer/:queryState', children: [
{ {
path: '', path: '',
component: MapComponent component: MapComponent
} }
] ]
} }
]; ];
@NgModule({ @NgModule({
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(routes)],
exports: [RouterModule] exports: [RouterModule]
}) })
export class MapRoutingModule { } export class MapRoutingModule { }

View File

@@ -16,16 +16,14 @@ 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';
//import {Switch2D3DComponent } from './components/aol/switch2d3d/switch2d3d.component';
import {FeatureListFeatureCropfieldComponent } from './components/feature-list-feature-cropfield/feature-list-feature-cropfield.component'; import {FeatureListFeatureCropfieldComponent } from './components/feature-list-feature-cropfield/feature-list-feature-cropfield.component';
import { FeatureListFeatureCroppingschemeComponent} from './components/feature-list-feature-croppingscheme/feature-list-feature-croppingscheme.component'; import { FeatureListFeatureCroppingschemeComponent} from './components/feature-list-feature-croppingscheme/feature-list-feature-croppingscheme.component';
import { ItemWidgetListComponent} from './components/item-widget-list/item-widget-list.component'; import { ItemWidgetListComponent} from './components/item-widget-list/item-widget-list.component';
@@ -35,6 +33,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 +45,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 +52,43 @@ 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 { ForPackage } from './components/for-item/for-package.decorator';
import { PanToLocation} from './components/aol/pan-to-location/pan-to-location.component';
import {LayerSwitcher} from './components/layer-switcher/layer-switcher.component';
import {HistogramDetailsComponent} from './components/legend/histogram-details/histogram-details.component';
import {StatisticsDetailsComponent} from './components/legend/statistics-details/statistics-details.component';
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 +96,6 @@ export {
mapActions, mapActions,
ZoomToExtentComponent, ZoomToExtentComponent,
ItemVectorSourceComponent, ItemVectorSourceComponent,
ItemFeaturesSourceComponent,
ItemLayersComponent, ItemLayersComponent,
FileDropTargetComponent, FileDropTargetComponent,
MapComponent, MapComponent,
@@ -97,6 +119,7 @@ export {
SelectedItemComponent, SelectedItemComponent,
SelectedItemCropfieldComponent, SelectedItemCropfieldComponent,
SelectedItemGeotiffComponent, SelectedItemGeotiffComponent,
SelectedItemTemporalComponent,
SelectedItemShapeComponent, SelectedItemShapeComponent,
ItemListItemComponent, ItemListItemComponent,
ItemListItemContainerComponent, ItemListItemContainerComponent,
@@ -104,31 +127,34 @@ 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,
ForSourceTask ForSourceTask,
ForPackage
} }
@NgModule({ @NgModule({
imports: [ imports: [
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 +164,6 @@ export {
declarations: [ declarations: [
ZoomToExtentComponent, ZoomToExtentComponent,
ItemVectorSourceComponent, ItemVectorSourceComponent,
ItemFeaturesSourceComponent,
ItemLayersComponent, ItemLayersComponent,
FileDropTargetComponent, FileDropTargetComponent,
MapComponent, MapComponent,
@@ -162,6 +187,7 @@ export {
SelectedItemComponent, SelectedItemComponent,
SelectedItemCropfieldComponent, SelectedItemCropfieldComponent,
SelectedItemGeotiffComponent, SelectedItemGeotiffComponent,
SelectedItemTemporalComponent,
SelectedItemShapeComponent, SelectedItemShapeComponent,
ItemListItemComponent, ItemListItemComponent,
ItemListItemContainerComponent, ItemListItemContainerComponent,
@@ -169,6 +195,10 @@ export {
ItemWidgetListComponent, ItemWidgetListComponent,
WidgetStatusComponent, WidgetStatusComponent,
GpsLocation, GpsLocation,
PanToLocation,
LayerSwitcher,
HistogramDetailsComponent,
StatisticsDetailsComponent
], ],
entryComponents: [ entryComponents: [
FeatureListComponent, FeatureListComponent,
@@ -180,18 +210,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 +231,7 @@ export {
SelectedItemComponent, SelectedItemComponent,
SelectedItemCropfieldComponent, SelectedItemCropfieldComponent,
SelectedItemGeotiffComponent, SelectedItemGeotiffComponent,
SelectedItemTemporalComponent,
SelectedItemShapeComponent, SelectedItemShapeComponent,
ItemListItemComponent, ItemListItemComponent,
ItemListItemContainerComponent, ItemListItemContainerComponent,
@@ -221,13 +254,15 @@ export {
] ]
}) })
export class AppCommonMapModule { export class AppCommonMapModule {
static forRoot(): ModuleWithProviders { static forRoot(): ModuleWithProviders<AppCommonMapModule> {
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 +271,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

@@ -1,68 +1,74 @@
import { Component, OnInit, Input, ViewChild, ElementRef, OnChanges, SimpleChanges } from '@angular/core'; import { Component, OnInit, Input, ViewChild, ElementRef, OnChanges, SimpleChanges ,Host} from '@angular/core';
import { MapComponent } from 'ngx-openlayers'; import { MapComponent } from 'ngx-openlayers';
import Overlay from 'ol/Overlay'; import Overlay from 'ol/Overlay';
import { fromLonLat, toLonLat } from 'ol/proj'; import { fromLonLat, toLonLat } from 'ol/proj';
@Component({ @Component({
selector: 'fm-map-gps-location', selector: 'fm-map-gps-location',
templateUrl: './gps-location.component.html', templateUrl: './gps-location.component.html',
styleUrls: ['./gps-location.component.scss'] styleUrls: ['./gps-location.component.scss']
}) })
export class GpsLocation implements OnInit,OnChanges{ export class GpsLocation implements OnInit,OnChanges{
@Input() enable:boolean; @Input() enable:boolean;
public instance: Overlay; public instance: Overlay;
@Input() position: Position; @Input() position: Position;
@Input() location: number[]=[0,0]; @Input() location: number[]=[0,0];
@Input() locationTolerance: number = 0; @Input() locationTolerance: number = 0;
@Input() showHeading: boolean = false; @Input() showHeading: boolean = false;
@Input() heading: number = 0; @Input() heading: number = 0;
@Input() headingTolerance: number = 0; @Input() headingTolerance: number = 0;
public locTolerancePixels: number = 0; public locTolerancePixels: number = 0;
public path: string = ""; public path: string = "";
public rotate: string = ""; public rotate: string = "";
private resolution: number = 0; private resolution: number = 0;
@ViewChild('location') locationElement: ElementRef; initialized:boolean = false;
@ViewChild('location', { static: true }) locationElement: ElementRef;
constructor(private map: MapComponent) {
constructor(@Host() private map: MapComponent) {
}
}
recalcLocationTolerance() {
this.locTolerancePixels = this.resolution >0? this.locationTolerance / this.resolution:0; recalcLocationTolerance() {
} this.locTolerancePixels = this.resolution >0? this.locationTolerance / this.resolution:0;
}
ngOnInit() {
this.instance = new Overlay({ ngOnInit() {
stopEvent:false, this.instance = new Overlay({
positioning: 'center-center', stopEvent:false,
position: fromLonLat( this.location), positioning: 'center-center',
element: this.locationElement.nativeElement position: fromLonLat( this.location),
}); element: this.locationElement.nativeElement
var x = Math.tan(this.headingTolerance * Math.PI / 180)*40; });
var y = Math.cos(this.headingTolerance * Math.PI / 180) * 40; var x = Math.tan(this.headingTolerance * Math.PI / 180)*40;
var y1 = Math.round(500 - y); var y = Math.cos(this.headingTolerance * Math.PI / 180) * 40;
var x1 = Math.round(500 - x); var y1 = Math.round(500 - y);
var y2 = Math.round(y1); var x1 = Math.round(500 - x);
var x2 = Math.round(500 + x); var y2 = Math.round(y1);
this.path = "M " + x2 + " " + y2 + " A 45 45,0,0,0, " + x1 + " " + y1 + " L 493 500 L 507 500 Z"; var x2 = Math.round(500 + x);
this.rotate = "rotate(" + Math.round(this.heading) + " 500 500)"; this.path = "M " + x2 + " " + y2 + " A 45 45,0,0,0, " + x1 + " " + y1 + " L 493 500 L 507 500 Z";
this.locTolerancePixels = this.locationTolerance; this.rotate = "rotate(" + Math.round(this.heading) + " 500 500)";
this.map.instance.addOverlay(this.instance); this.locTolerancePixels = this.locationTolerance;
this.map.instance.getView().on('change:resolution', (evt) => { this.map.instance.addOverlay(this.instance);
this.resolution = evt.target.get('resolution'); this.map.instance.getView().on('change:resolution', (evt) => {
this.recalcLocationTolerance(); this.resolution = evt.target.get('resolution');
}); this.recalcLocationTolerance();
} });
this.initialized = true;
ngOnChanges(changes: SimpleChanges) { }
if (changes.position && this.instance) {
var p = changes.position.currentValue as Position; ngOnChanges(changes: SimpleChanges) {
this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude])); if (changes.position && this.instance) {
this.locationTolerance = p.coords.accuracy; var p = changes.position.currentValue as Position;
this.recalcLocationTolerance(); if(p && this.initialized) {
this.heading = p.coords.heading; this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude]));
} this.locationTolerance = p.coords.accuracy;
} this.recalcLocationTolerance();
} }
}
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,276 +1,352 @@
import { Component, Host, Input, Output, EventEmitter, Optional, QueryList, OnInit, AfterViewInit, OnChanges, SimpleChanges, SkipSelf, forwardRef, Inject, InjectionToken } from '@angular/core'; import { Component, Host, Input, Output, EventEmitter, Optional, QueryList, OnInit, AfterViewInit, OnChanges, SimpleChanges, SkipSelf, forwardRef, Inject, InjectionToken } from '@angular/core';
import { HttpClient } from "@angular/common/http"; import { HttpClient } from "@angular/common/http";
import { LayerVectorComponent, LayerTileComponent, LayerGroupComponent, MapComponent } from 'ngx-openlayers'; import { LayerVectorComponent, LayerTileComponent, LayerGroupComponent, MapComponent } from 'ngx-openlayers';
import { ItemService } from '@farmmaps/common'; import { ItemService,IItem,AppConfig } from '@farmmaps/common';
import { AppConfig } from '@farmmaps/common'; import { IItemLayer,ItemLayer, ITemporalItemLayer} from '../../../models/item.layer';
import { IItemLayer, ILayerData, IRenderoutputTiles, IRenderoutputImage, IGradientstop, ILayer, IHistogram } from '../../../models'; import { ILayerData} from '../../../models/layer.data';
import { IRenderoutputTiles,IRenderoutputImage,IGradientstop,ILayer,IHistogram} from '../../../models/color.map';
import {Extent} from 'ol/extent'; import {Extent} from 'ol/extent';
import Projection from 'ol/proj/Projection'; import Projection from 'ol/proj/Projection';
import * as proj from 'ol/proj'; import * as proj from 'ol/proj';
import * as loadingstrategy from 'ol/loadingstrategy'; import * as loadingstrategy from 'ol/loadingstrategy';
import * as style from 'ol/style'; import * as style from 'ol/style';
import {Tile,Layer,Image} from 'ol/layer'; import {Tile,Layer,Image} from 'ol/layer';
import {XYZ,ImageStatic,OSM,BingMaps,TileWMS,TileArcGISRest} from 'ol/source'; import {XYZ,ImageStatic,OSM,BingMaps,TileWMS,TileArcGISRest,TileJSON} from 'ol/source';
import {Vector as VectorSource} from 'ol/source'; import {Vector as VectorSource} from 'ol/source';
import { Vector as VectorLayer } from 'ol/layer'; import { Vector as VectorLayer } from 'ol/layer';
import VectorTileSource from 'ol/source/VectorTile'; import VectorTileSource from 'ol/source/VectorTile';
import VectorTileLayer from 'ol/layer/VectorTile'; import VectorTileLayer from 'ol/layer/VectorTile';
import {GeoJSON,MVT} from 'ol/format'; import {GeoJSON,MVT} from 'ol/format';
import { from } from 'rxjs'; import { from } from 'rxjs';
@Component({ @Component({
selector: 'fm-map-item-layers', selector: 'fm-map-item-layers',
template: `<ng-content></ng-content>`, template: `<ng-content></ng-content>`,
providers: [ providers: [
{ provide: LayerGroupComponent, useExisting: forwardRef(() => ItemLayersComponent) } { provide: LayerGroupComponent, useExisting: forwardRef(() => ItemLayersComponent) }
] ]
}) })
export class ItemLayersComponent extends LayerGroupComponent implements OnChanges, OnInit { export class ItemLayersComponent extends LayerGroupComponent implements OnChanges, OnInit {
@Input() itemLayers: IItemLayer[]; @Input() itemLayers: IItemLayer[];
@Input() itemLayer: IItemLayer; @Input() itemLayer: IItemLayer;
private _apiEndPoint: string; private _apiEndPoint: string;
private initialized:boolean = false;
constructor(private itemService: ItemService, @Host() private map: MapComponent, public appConfig: AppConfig) {
super(map); constructor(private itemService: ItemService, @Host() private map: MapComponent, public appConfig: AppConfig) {
this._apiEndPoint = appConfig.getConfig("apiEndPoint"); super(map);
} this._apiEndPoint = appConfig.getConfig("apiEndPoint");
}
private styleCache = {}
private styleCache = {}
componentToHex(c) {
var hex = c.toString(16); componentToHex(c) {
return hex.length == 1 ? "0" + hex : hex; var hex = c.toString(16);
} return hex.length == 1 ? "0" + hex : hex;
}
rgbaToHex(r, g, b,a) {
return "#" + this.componentToHex(r) + this.componentToHex(g) + this.componentToHex(b) + this.componentToHex(a); rgbaToHex(r, g, b,a) {
} return "#" + this.componentToHex(r) + this.componentToHex(g) + this.componentToHex(b) + this.componentToHex(a);
}
getColorFromGradient(layer: ILayer, feature): style.Style {
var value = feature.get(layer.name); getColorFromGradient(item:IItem,layer: ILayer, feature): style.Style {
var gradient: IGradientstop[] = layer.renderer.colorMap.gradient; var value = layer.indexKey ? feature.get(layer.indexKey): feature.get(layer.name);
var histogram: IHistogram = layer.renderer.band.histogram; var key = item.code + "_" + value;
var index = (value - histogram.min) / histogram.max; if(!this.styleCache[key]) {
var min = gradient[0]; var gradient: IGradientstop[] = layer.renderer.colorMap.gradient;
var max = gradient[gradient.length - 1]; var histogram: IHistogram = layer.renderer.band.histogram;
for (var n = 0; n < gradient.length; n++) { var index = (value - histogram.min) / histogram.max;
var s = gradient[n]; var min = gradient[0];
if (s.relativestop <= index && min.relativestop < s.relativestop && n < gradient.length - 1) min = s; var max = gradient[gradient.length - 1];
if (s.relativestop >= index && max.relativestop > s.relativestop && n > 0) max = s; for (var n = 0; n < gradient.length; n++) {
} var s = gradient[n];
var i = index - min.relativestop; if (s.relativestop <= index && min.relativestop < s.relativestop && n < gradient.length - 1) min = s;
var size = max.relativestop - min.relativestop; if (s.relativestop >= index && max.relativestop > s.relativestop && n > 0) max = s;
var alpha = Math.round( min.color.alpha + ((max.color.alpha - min.color.alpha) * i / size)); }
var red = Math.round(min.color.red + ((max.color.red - min.color.red) * i / size)); var i = index - min.relativestop;
var green = Math.round(min.color.green + ((max.color.green - min.color.green) * i / size)); var size = max.relativestop - min.relativestop;
var blue = Math.round(min.color.blue + ((max.color.blue - min.color.blue) * i / size)); var alpha = Math.round( min.color.alpha + ((max.color.alpha - min.color.alpha) * i / size));
var red = Math.round(min.color.red + ((max.color.red - min.color.red) * i / size));
return new style.Style( var green = Math.round(min.color.green + ((max.color.green - min.color.green) * i / size));
{ var blue = Math.round(min.color.blue + ((max.color.blue - min.color.blue) * i / size));
image: new style.Circle({
fill: new style.Fill({ this.styleCache[key] = new style.Style(
color: this.rgbaToHex(red,green,blue,alpha) {
}), image: new style.Circle({
radius: 3 fill: new style.Fill({
}), color: this.rgbaToHex(red,green,blue,alpha)
fill: new style.Fill({ }),
color: this.rgbaToHex(red, green, blue, alpha) radius: 3
}), }),
stroke: new style.Stroke({ fill: new style.Fill({
color: this.rgbaToHex(red, green, blue, alpha), color: this.rgbaToHex(red, green, blue, alpha)
width: 1.25 }),
}), stroke: new style.Stroke({
}); color: this.rgbaToHex(red, green, blue, 255),
} width: 1.25
}),
createLayer(itemLayer: IItemLayer): Layer { });
var layer: Layer = null; }
if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') { return this.styleCache[key];
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()}` }); }
layer = new Tile({ source: source });
var data = itemLayer.item.data; createGeotiffLayer(item:IItem,itemLayer:IItemLayer):Layer {
var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null; var layerIndex = -1;
if (l && l.rendering && l.rendering.renderoutputType == "Tiles") { var layer: Layer = null;
var rt = l.rendering as IRenderoutputTiles; layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
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: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` });
layer = new Tile({ source: source }); layer = new Tile({ source: source });
} var data = item.data;
if (l && l.rendering && l.rendering.renderoutputType == "Image") { var l = (data && data.layers && data.layers.length > 0) ? data.layers[0] : null;
var ri = l.rendering as IRenderoutputImage; if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
let projection = new Projection({ var rt = l.rendering as IRenderoutputTiles;
code: 'image', let source = new XYZ({crossOrigin: 'use-credentials', maxZoom: rt.maxzoom, minZoom: rt.minzoom, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` });
units: 'pixels', layer = new Tile({ source: source });
extent: ri.extent }
}); if (l && l.rendering && l.rendering.renderoutputType == "Image") {
let source = new ImageStatic({ imageExtent: ri.extent, projection: projection, url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/mapimage?v=${itemLayer.item.updated.getTime()}` }); var ri = l.rendering as IRenderoutputImage;
layer = new Image({ source: source }); // convert to EPSG:4326 asworkaround for cesium
} var projectedExtent = proj.transformExtent( ri.extent, 'EPSG:3857','EPSG:4326');
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.shape.processed') { let source = new ImageStatic({ imageExtent:projectedExtent,projection:'EPSG:4326', crossOrigin: 'use-credentials', url: `${this._apiEndPoint}/api/v1/items/${item.code}/mapimage/${layerIndex}?v=${Date.parse(item.updated)}` });
var data = itemLayer.item.data; layer = new Image({ source: source });
var layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index; }
var l = itemLayer.item.data.layers[layerIndex]; return layer;
if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") { }
var rt = itemLayer.item.data.layers[layerIndex].rendering as IRenderoutputTiles;
layer = new VectorTileLayer({ createShapeLayer(item:IItem,itemLayer:IItemLayer):Layer {
declutter: true, var layerIndex = -1;
source: new VectorTileSource({ var layer: Layer = null;
maxZoom: rt.maxzoom, layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
minZoom: rt.minzoom, var data = item.data;
format: new MVT(), var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null;
url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/vectortiles/{z}/{x}/{y}.pbf?v=${itemLayer.item.updated.getTime()}` if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") {
}), var rt = l.rendering as IRenderoutputTiles;
style: (feature) => { layer = new VectorTileLayer({
return this.getColorFromGradient(l, feature); declutter: true,
} source: new VectorTileSource({
}) maxZoom: rt.maxzoom,
} if (l && l.rendering && l.rendering.renderoutputType == "Tiles") { minZoom: rt.minzoom,
var rt = l.rendering as IRenderoutputTiles; format: new MVT(),
layer = new Tile({ url: `${this._apiEndPoint}/api/v1/items/${item.code}/vectortiles/{z}/{x}/{y}.pbf?v=${Date.parse(item.updated)}`
source: new XYZ({ }),
maxZoom: rt.maxzoom, style: (feature) => {
minZoom: rt.minzoom, return this.getColorFromGradient(item,l, feature);
url: `${this._apiEndPoint}/api/v1/items/${itemLayer.item.code}/vectortiles/image_tiles/${layerIndex}/{z}/{x}/{y}.png?v=${itemLayer.item.updated.getTime()}` }
}) })
}); } else if (l && l.rendering && l.rendering.renderoutputType == "Tiles") {
} else { var rt = l.rendering as IRenderoutputTiles;
let __this = this; layer = new Tile({
let format = new GeoJSON(); source: new XYZ({
let source = new VectorSource({ maxZoom: rt.maxzoom,
strategy: loadingstrategy.bbox, minZoom: rt.minzoom,
loader: function (extent: Extent, resolution: number, projection: Projection) { url: `${this._apiEndPoint}/api/v1/items/${item.code}/vectortiles/image_tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}`
var source = this as VectorSource; })
__this.itemService.getItemFeatures(itemLayer.item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) { });
var features = format.readFeatures(data); } else {
for (let f of features) { let __this = this;
if (f.get("code")) { let format = new GeoJSON();
f.setId(f.get("code")); let source = new VectorSource({
} strategy: loadingstrategy.bbox,
} loader: function (extent: Extent, resolution: number, projection: Projection) {
source.addFeatures(features); var source = this as VectorSource;
}); __this.itemService.getItemFeatures(item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) {
} var features = format.readFeatures(data);
}); for (let f of features) {
layer = new VectorLayer({ if (f.get("code")) {
source: source, f.setId(f.get("code"));
style: (feature) => { }
var key = feature.get("color"); }
if (!this.styleCache[key]) { source.addFeatures(features);
var color = feature.get("color"); });
this.styleCache[key] = new style.Style( }
{ });
fill: new style.Fill({ layer = new VectorLayer({
color: color source: source,
}), style: (feature) => {
stroke: new style.Stroke({ var key =feature.get("code") + "_" + feature.get("color");
color: color, if (!this.styleCache[key]) {
width: 1.25 var color = feature.get("color");
}), this.styleCache[key] = new style.Style(
image: new style.Circle({ {
fill: new style.Fill({ fill: new style.Fill({
color: color color: color
}), }),
stroke: new style.Stroke({ stroke: new style.Stroke({
color: color, color: color,
width: 1.25 width: 1.25
}), }),
radius: 5 image: new style.Circle({
}), fill: new style.Fill({
} color: color
) }),
} stroke: new style.Stroke({
return this.styleCache[key]; color: color,
} width: 1.25
}); }),
} radius: 5
} else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.layer') { }),
let data = itemLayer.item.data as ILayerData; }
switch (data.interfaceType) { )
case 'OSM': { }
let source = new OSM(); return this.styleCache[key];
layer = new Tile({ source: source }); }
break; });
} }
case 'BingMaps': { if(l.minzoom) {
let source = new BingMaps(data.options); layer.setMinZoom(l.minzoom);
layer = new Tile({ source: source }); }
break; if(l.maxzoom) {
} layer.setMaxZoom(l.maxzoom);
case 'TileWMS': { }
let source = new TileWMS(data.options); return layer;
layer = new Tile({ source: source }); }
break;
} createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer {
case 'TileArcGISRest': { let data = item.data as ILayerData;
let source = new TileArcGISRest(data.options); var layer: Layer = null;
layer = new Tile({ source: source }); switch (data.interfaceType) {
break; case 'OSM': {
} let source = new OSM();
default: { layer = new Tile({ source: source });
break; break;
} }
} case 'BingMaps': {
} let source = new BingMaps(data.options);
if (layer) { layer = new Tile({ source: source });
let geometry = new GeoJSON().readGeometry(itemLayer.item.geometry); break;
let extent = geometry ? proj.transformExtent(geometry.getExtent(), 'EPSG:4326', 'EPSG:3857') : null; }
if (extent) layer.setExtent(extent); case 'TileWMS': {
} let source = new TileWMS(data.options);
layer = new Tile({ source: source });
return layer; break;
} }
case 'TileJSON': {
ngOnInit() { let source = new TileJSON(data.options);
super.ngOnInit(); layer = new Tile({ source: source });
this.updateLayers(this.itemLayers); break;
} }
case 'TileArcGISRest': {
updateLayers(itemLayers: IItemLayer[]) { let source = new TileArcGISRest(data.options);
if (itemLayers) { layer = new Tile({ source: source });
var olLayers = this.instance.getLayers(); break;
itemLayers.forEach((itemLayer, index) => { }
case 'VectorWFSJson': {
var layer = itemLayer.layer; let source = new VectorSource({
let olIndex = olLayers.getArray().indexOf(layer); format: new GeoJSON(),
if (olIndex < 0) { url: function (extent) {
// New layer: we add it to the map return (
layer = this.createLayer(itemLayer); data.options.url + '&srsname=' + data.projection +
if (layer) { '&bbox=' +
itemLayer.layer = layer; extent.join(',') +
} ',EPSG:3857'
olLayers.insertAt(index, layer); );
} else if (index !== olIndex) { },
// layer has moved inside the layers list strategy: loadingstrategy.bbox,
olLayers.removeAt(olIndex); });
olLayers.insertAt(index, layer); layer = new VectorLayer({ source: source });
} break;
layer.setOpacity(itemLayer.opacity); }
layer.setVisible(itemLayer.visible); default: {
}); break;
// Remove the layers that have disapeared from childrenLayers }
if (olLayers.getLength() > itemLayers.length) { }
for (let i = itemLayers.length; i < olLayers.getLength(); i++) { return layer;
olLayers.removeAt(i); }
}
} createLayer(itemLayer: IItemLayer): Layer {
} var layer: Layer = null;
} var layerIndex = -1;
if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') {
ngOnChanges(changes: SimpleChanges) { layer = this.createGeotiffLayer(itemLayer.item,itemLayer);
if (this.instance) { } else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.shape.processed') {
if (changes['itemLayers']) { layer = this.createShapeLayer(itemLayer.item,itemLayer);
var itemLayers = changes['itemLayers'].currentValue as IItemLayer[]; } else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.layer') {
this.updateLayers(itemLayers); layer = this.createExternalLayer(itemLayer.item,itemLayer);
} }
if (changes['itemLayer']) { if (layer) {
var itemLayer = changes['itemLayer'].currentValue as IItemLayer; let geometry = new GeoJSON().readGeometry(itemLayer.item.geometry);
if(itemLayer) { let extent = geometry ? proj.transformExtent(geometry.getExtent(), 'EPSG:4326', 'EPSG:3857') : null;
this.updateLayers([itemLayer]); if (extent) layer.setExtent(extent);
} else { }
this.updateLayers([]);
} return layer;
} }
}
} ngOnInit() {
} super.ngOnInit();
if(this.itemLayers) {
this.updateLayers(this.itemLayers);
} else if(this.itemLayer) {
this.updateLayers([this.itemLayer])
} else {
this.updateLayers([]);
}
this.initialized=true;
}
addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer {
if(!itemLayer) return null;
var olLayers = this.instance.getLayers();
var layer = itemLayer.layer;
let olIndex = olLayers.getArray().indexOf(layer);
if (olIndex < 0) {
// New layer: we add it to the map
layer = this.createLayer(itemLayer);
if (layer) {
olLayers.insertAt(index, layer);
}
} else if (index !== olIndex) {
// layer has moved inside the layers list
olLayers.removeAt(olIndex);
olLayers.insertAt(index, layer);
}
if(layer) {
itemLayer.layer = layer;
layer.setOpacity(itemLayer.opacity);
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
var olLayers = this.instance.getLayers();
while(olLayers.getLength() > newLayers.length) {
olLayers.removeAt(newLayers.length);
}
}
}
ngOnChanges(changes: SimpleChanges) {
if (this.instance && this.initialized) {
if (changes['itemLayers']) {
var itemLayers = changes['itemLayers'].currentValue as IItemLayer[];
this.updateLayers(itemLayers);
}
if (changes['itemLayer']) {
var itemLayer = changes['itemLayer'].currentValue as IItemLayer;
if(itemLayer) {
this.updateLayers([itemLayer]);
} else {
this.updateLayers([]);
}
}
}
}
}

View File

@@ -1,207 +1,189 @@
import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken } from '@angular/core'; import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken } from '@angular/core';
import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-openlayers'; import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-openlayers';
import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common'; import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common';
import { Feature } from 'ol'; import { Feature } from 'ol';
import { Point } from 'ol/geom'; import { Point } from 'ol/geom';
import { MapBrowserEvent } from 'ol'; import { MapBrowserEvent } from 'ol';
import * as style from 'ol/style'; import * as style from 'ol/style';
import * as color from 'ol/color'; import * as color from 'ol/color';
import * as loadingstrategy from 'ol/loadingstrategy'; import * as loadingstrategy from 'ol/loadingstrategy';
import * as condition from 'ol/events/condition'; import * as condition from 'ol/events/condition';
import * as extent from 'ol/extent'; import * as extent from 'ol/extent';
import {Vector,Cluster} from 'ol/source'; import {Vector,Cluster} from 'ol/source';
import {Layer} from 'ol/layer'; import {Layer} from 'ol/layer';
import {GeoJSON} from 'ol/format'; import {GeoJSON} from 'ol/format';
import {Select} from 'ol/interaction'; import {Select} from 'ol/interaction';
import {IStyles} from '../../../models/style.cache';
@Component({ import {FeatureIconService} from '../../../services/feature-icon.service';
selector: 'fm-map-item-source-vector',
template: `<ng-content></ng-content>`, @Component({
providers: [ selector: 'fm-map-item-source-vector',
{ provide: SourceVectorComponent , useExisting: forwardRef(() => ItemVectorSourceComponent) } template: `<ng-content></ng-content>`,
] providers: [
}) { provide: SourceVectorComponent , useExisting: forwardRef(() => ItemVectorSourceComponent) }
export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnChanges { ]
instance: Vector; })
private _format: GeoJSON; export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnChanges {
private _select: Select; instance: Vector;
private _hoverSelect: Select; private _format: GeoJSON;
private _iconScale: number = 0.05; private _select: Select;
@Input() features: Array<Feature>; private _hoverSelect: Select;
@Input() selectedFeature: Feature; private _iconScale: number = 0.05;
@Input() selectedItem: IItem; @Input() features: Array<Feature>;
@Output() onFeaturesSelected: EventEmitter<Feature> = new EventEmitter<Feature>(); @Input() selectedFeature: Feature;
private styleCache = { @Input() selectedItem: IItem;
'file': new style.Style({ @Input() styles:IStyles;
image: new style.Icon({ @Output() onFeaturesSelected: EventEmitter<Feature> = new EventEmitter<Feature>();
anchor: [0.5, 1], @Output() onFeatureHover: EventEmitter<Feature> = new EventEmitter<Feature>();
scale: 0.05, private stylesCache:IStyles = {};
src: this.getIconImageDataUrl("fa fa-file-o")
}), constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, @Host() private map: MapComponent, private itemTypeService: ItemTypeService,private featureIconService$:FeatureIconService) {
stroke: new style.Stroke({ super(layer);
color: 'red', this._format = new GeoJSON();
width: 1 }
}),
fill: new style.Fill({ geometry(feature: Feature) {
color: 'rgba(0, 0, 255, 0.1)' let view = this.map.instance.getView();
}), let resolution = view.getResolution();
geometry: (feature) => this.geometry(feature) var geometry = feature.getGeometry();
}), let e = geometry.getExtent();
'selected': new style.Style({ //var size = Math.max((e[2] - e[0]) / resolution, (e[3] - e[1]) / resolution);
image: new style.Icon({ if (resolution > 12) {
anchor: [0.5, 1], geometry = new Point(extent.getCenter(e));
scale: 0.08, }
src: this.getIconImageDataUrl(null) return geometry;
}), }
stroke: new style.Stroke({
color: 'red', getSelectedStyle(feature:Feature):style.Style {
width: 3 let key = feature.get('itemType')+"_selected";
}), let evaluatedStyle =null;
fill: new style.Fill({ var styleEntry = this.stylesCache[key];
color: 'rgba(0, 0, 255, 0.1)' if(styleEntry) {
}), if(typeof styleEntry === 'function') {
geometry: (feature) => this.geometry(feature) evaluatedStyle = styleEntry(feature);
}) } else {
}; evaluatedStyle = styleEntry;
}
constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, @Host() private map: MapComponent, private itemTypeService: ItemTypeService) { } else {
super(layer); evaluatedStyle = this.stylesCache["selected"];
this._format = new GeoJSON(); }
} if(evaluatedStyle ) {
evaluatedStyle.setGeometry((feature) => this.geometry(feature));
geometry(feature: Feature) { }
let view = this.map.instance.getView(); return evaluatedStyle
let resolution = view.getResolution(); }
var geometry = feature.getGeometry();
let e = geometry.getExtent(); ngOnInit() {
//var size = Math.max((e[2] - e[0]) / resolution, (e[3] - e[1]) / resolution); this.strategy = loadingstrategy.bbox;
if (resolution > 12) { this.format = new GeoJSON();
geometry = new Point(extent.getCenter(e)); this._select = new Select({
} style:null,
return geometry; hitTolerance: 10,
} layers: [this.layer.instance as Layer]
});
getIconImageDataUrl(iconClass:string, backgroundColor: string = "#c80a6e",color:string = "#ffffff"): string { this._hoverSelect = new Select({
var canvas = document.createElement('canvas'); style: (feature) => {
canvas.width = 365; return this.getSelectedStyle(feature);
canvas.height = 560; },
var ctx = canvas.getContext('2d'); hitTolerance: 10,
ctx.lineWidth = 6; condition: (e: MapBrowserEvent) => {
ctx.fillStyle = backgroundColor; return e.type == 'pointermove';
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"); layers: [this.layer.instance as Layer]
ctx.fill(path) });
this.map.instance.addInteraction(this._select);
var iconCharacter = ""; this.map.instance.addInteraction(this._hoverSelect);
if (iconClass != null) { this._select.on('select', (e) => {
var element = document.createElement("i"); if (e.selected.length > 0 && e.selected[0]) {
element.style.display = "none"; this.onFeaturesSelected.emit(e.selected[0]);
element.className = iconClass; } else {
document.body.appendChild(element); this.onFeaturesSelected.emit(null);
iconCharacter = getComputedStyle(element, "::before").content.replace(/"/g, ''); }
let iconFont = "200px " +getComputedStyle(element, "::before").fontFamily });
document.body.removeChild(element); this._hoverSelect.on('select', (e) => {
ctx.strokeStyle = color; if (e.selected.length > 0 && e.selected[0]) {
ctx.fillStyle = color; this.onFeatureHover.emit(e.selected[0]);
ctx.lineWidth = 15; } else {
ctx.font = iconFont; this.onFeatureHover.emit(null);
var ts = ctx.measureText(iconCharacter); }
ctx.fillText(iconCharacter, 182.9 - (ts.width / 2), 250); });
ctx.strokeText(iconCharacter, 182.9 - (ts.width / 2), 250); this.instance = new Vector(this);
} this.host.instance.setSource(this.instance);
return canvas.toDataURL(); this.host.instance.setStyle((feature) => {
} var key = feature.get('itemType') + (this.selectedItem?"_I":"");
if (!this.stylesCache[key]) {
ngOnInit() { if (this.itemTypeService.itemTypes[key]) {
this.strategy = loadingstrategy.bbox; let itemType = this.itemTypeService.itemTypes[key];
this.format = new GeoJSON(); let fillColor = color.asArray(itemType.iconColor);
this._select = new Select({ fillColor[3] = this.selectedItem?0:0.5;
style: (feature) => { this.stylesCache[key] = new style.Style({
return this.styleCache['selected']; image: itemType.icon ? new style.Icon({
}, anchor: [0.5, 1],
hitTolerance: 10, scale: 0.05,
layers: [this.layer.instance as Layer] src: this.featureIconService$.getIconImageDataUrl(itemType.icon)
}); }):null,
this._hoverSelect = new Select({ stroke: new style.Stroke({
style: (feature) => { color: 'red',
return this.styleCache['selected']; width: 1
}, }),
hitTolerance: 10, fill: new style.Fill({
condition: (e: MapBrowserEvent) => { color: fillColor
return e.type == 'pointermove'; }),
}, geometry:(feature) => this.geometry(feature)
layers: [this.layer.instance as Layer] });
}); } else {
this.map.instance.addInteraction(this._select); key = 'file';
this.map.instance.addInteraction(this._hoverSelect); }
this._select.on('select', (e) => { }
if (e.selected.length > 0 && e.selected[0]) { let evaluatedStyle =null;
this.onFeaturesSelected.emit(e.selected[0]); var styleEntry = this.stylesCache[key];
} else { if(typeof styleEntry === 'function') {
this.onFeaturesSelected.emit(null); evaluatedStyle = styleEntry(feature);
} } else {
}); evaluatedStyle = styleEntry;
this.instance = new Vector(this); }
this.host.instance.setSource(this.instance); if(evaluatedStyle && evaluatedStyle.geometry_ == null) {
evaluatedStyle.setGeometry((feature) => this.geometry(feature));
this.host.instance.setStyle((feature) => { }
var key = feature.get('itemType') + (this.selectedItem?"_I":""); return evaluatedStyle;
if (!this.styleCache[key]) { });
if (this.itemTypeService.itemTypes[key]) { }
let itemType = this.itemTypeService.itemTypes[key];
let fillColor = color.asArray(itemType.iconColor); ngOnChanges(changes: SimpleChanges) {
fillColor[3] = this.selectedItem?0:0.5; if (changes["features"] && this.instance) {
this.styleCache[key] = new style.Style({ this.instance.clear(true);
image: itemType.icon ? new style.Icon({ this._select.getFeatures().clear();
anchor: [0.5, 1], this.instance.addFeatures(changes["features"].currentValue);
scale: 0.05, }
src: this.getIconImageDataUrl(itemType.icon)
}):null, if (changes["selectedFeature"] && this.instance) {
stroke: new style.Stroke({ var features = this._hoverSelect.getFeatures();
color: 'red', var feature = changes["selectedFeature"].currentValue
width: 1 //this.instance.clear(false);
}), //this.instance.addFeatures(features.getArray());
fill: new style.Fill({ features.clear();
color: fillColor if (feature) {
}), //this.instance.removeFeature(feature);
geometry: (feature) => this.geometry(feature) features.push(feature)
}); }
} else { }
key = 'file'; if (changes["selectedItem"] && this.instance) {
} var item = changes["selectedItem"].currentValue
} if (item) {
var styleEntry = this.styleCache[key]; this.map.instance.removeInteraction(this._hoverSelect);
return styleEntry; } else {
}); this.map.instance.addInteraction(this._hoverSelect);
} }
}
ngOnChanges(changes: SimpleChanges) { if (changes["styles"] && this.instance) {
if (changes["features"] && this.instance) { let styles = changes["styles"].currentValue;
this.instance.clear(true); for (const key in styles) {
this._select.getFeatures().clear(); if (styles.hasOwnProperty(key)) {
this.instance.addFeatures(changes["features"].currentValue); this.stylesCache[key]=styles[key];
} }
}
if (changes["selectedFeature"] && this.instance) { }
var features = this._select.getFeatures(); }
var feature = changes["selectedFeature"].currentValue }
//this.instance.clear(false);
//this.instance.addFeatures(features.getArray());
features.clear();
if (feature) {
//this.instance.removeFeature(feature);
features.push(feature)
}
}
if (changes["selectedItem"] && this.instance) {
var item = changes["selectedItem"].currentValue
if (item) {
this.map.instance.removeInteraction(this._hoverSelect);
} else {
this.map.instance.addInteraction(this._hoverSelect);
}
}
}
}

View File

@@ -1,29 +1,31 @@
<div class="layerlist" *ngIf="itemLayers.length > 0;else noLayers"> <div>
<div class="list-group"> <div class="layerlist" *ngIf="itemLayers.length > 0;else noLayers">
<div *ngFor="let itemLayer of itemLayers" class="list-group-item list-group-item-action p-2 text-truncate" [ngClass]="{'active' : selectedLayer==itemLayer}"> <div class="list-group">
<div (click)="handleSelectLayer($event,itemLayer)" [title]="itemLayer.item.name">{{itemLayer.item.name}}</div> <div *ngFor="let itemLayer of itemLayers" class="list-group-item list-group-item-action p-2 text-truncate" [ngClass]="{'active' : selectedLayer==itemLayer}">
<div class="mt-1" *ngIf="selectedLayer==itemLayer && !baseLayers"> <div (click)="handleSelectLayer($event,itemLayer)" [title]="itemLayer.item.name">{{itemLayer.item.name}}</div>
<span class="btn-group"> <div class="mt-1" *ngIf="selectedLayer==itemLayer && !baseLayers">
<a title="Toggle visibility"href="#" class="btn btn-light btn-sm" (click)="handleToggleVisibility($event,itemLayer)"><i class="fa" aria-hidden="true" [ngClass]="{'fa-eye':!itemLayer.visible,'fa-eye-slash':itemLayer.visible}"></i></a> <span class="btn-group">
<a title="Transparency 25%" *ngIf="itemLayer.visible" href="#" class="btn btn-light btn-sm" (click)="handleSetOpacity($event,itemLayer,0.25)">25%</a> <a title="Toggle visibility"href="#" class="btn btn-light btn-sm" (click)="handleToggleVisibility($event,itemLayer)"><i class="fa" aria-hidden="true" [ngClass]="{'fa-eye':!itemLayer.visible,'fa-eye-slash':itemLayer.visible}"></i></a>
<a title="Transparency 50%" *ngIf="itemLayer.visible" href="#" class="btn btn-light btn-sm" (click)="handleSetOpacity($event,itemLayer,0.5)">50%</a> <a title="Transparency 25%" *ngIf="itemLayer.visible" href="#" class="btn btn-light btn-sm" (click)="handleSetOpacity($event,itemLayer,0.25)">25%</a>
<a title="Transparency 75%" *ngIf="itemLayer.visible" href="#" class="btn btn-light btn-sm" (click)="handleSetOpacity($event,itemLayer,0.75)">75%</a> <a title="Transparency 50%" *ngIf="itemLayer.visible" href="#" class="btn btn-light btn-sm" (click)="handleSetOpacity($event,itemLayer,0.5)">50%</a>
<a title="No transparency" *ngIf="itemLayer.visible" href="#" class="btn btn-light btn-sm" (click)="handleSetOpacity($event,itemLayer,1)">100%</a> <a title="Transparency 75%" *ngIf="itemLayer.visible" href="#" class="btn btn-light btn-sm" (click)="handleSetOpacity($event,itemLayer,0.75)">75%</a>
</span> <a title="No transparency" *ngIf="itemLayer.visible" href="#" class="btn btn-light btn-sm" (click)="handleSetOpacity($event,itemLayer,1)">100%</a>
<a href="#" title="Zoom to extent" class="btn btn-light btn-sm" (click)="handleZoomToExtent($event,itemLayer)"><i class="fa fa-search-plus" aria-hidden="true"></i></a> </span>
<span *ngIf="firstLayer(itemLayer)"><a href="#" title="Toggle legend" class="btn btn-light btn-sm" (click)="itemLayer.legendVisible=toggleLegend($event,itemLayer.legendVisible)"><i class="fa fa-bar-chart" aria-hidden="true"></i></a></span> <a href="#" title="Zoom to extent" class="btn btn-light btn-sm" (click)="handleZoomToExtent($event,itemLayer)"><i class="fa fa-search-plus" aria-hidden="true"></i></a>
<span class="float-right"><a href="#" title="Remove overlay" class="btn btn-light btn-sm" (click)="handleDelete($event,itemLayer)"><i class="fa fa-minus" aria-hidden="true"></i></a></span> <span *ngIf="firstLayer(itemLayer)"><a href="#" title="Toggle legend" class="btn btn-light btn-sm" (click)="itemLayer.legendVisible=toggleLegend($event,itemLayer.legendVisible)"><i class="fa fa-bar-chart" aria-hidden="true"></i></a></span>
</div> <span class="float-right"><a href="#" title="Remove overlay" class="btn btn-light btn-sm" (click)="handleDelete($event,itemLayer)"><i class="fa fa-minus" aria-hidden="true"></i></a></span>
<div *ngIf="itemLayer.legendVisible"> </div>
<div class="card legend"> <div *ngIf="itemLayer.legendVisible">
<fm-map-layer-legend [layer]="firstLayer(itemLayer)" (click)="handleLegendClick($event,itemLayer);"></fm-map-layer-legend> <div class="card legend">
</div> <fm-map-layer-legend [layer]="firstLayer(itemLayer)" (click)="handleLegendClick($event,itemLayer);"></fm-map-layer-legend>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<ng-template #noLayers> </div>
<div class="list-group"> </div>
<div class="list-group-item" i18n>No layers</div> <ng-template #noLayers>
</div> <div class="list-group">
</ng-template> <div class="list-group-item" i18n>No layers</div>
</div>
</ng-template>

View File

@@ -1,64 +1,64 @@
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',
templateUrl: './layer-list.component.html', templateUrl: './layer-list.component.html',
styleUrls: ['./layer-list.component.scss'] styleUrls: ['./layer-list.component.scss']
}) })
export class LayerListComponent { export class LayerListComponent {
@Input() itemLayers: IItemLayer[]; @Input() itemLayers: IItemLayer[] = [];
@Input() baseLayers: boolean = false; @Input() baseLayers: boolean = false;
@Output() onToggleVisibility = new EventEmitter<IItemLayer>(); @Output() onToggleVisibility = new EventEmitter<IItemLayer>();
@Output() onSetOpacity = new EventEmitter<{layer: IItemLayer,opacity:number }>(); @Output() onSetOpacity = new EventEmitter<{layer: IItemLayer,opacity:number }>();
@Output() onDelete = new EventEmitter<IItemLayer>(); @Output() onDelete = new EventEmitter<IItemLayer>();
@Output() onZoomToExtent = new EventEmitter<IItemLayer>(); @Output() onZoomToExtent = new EventEmitter<IItemLayer>();
@Output() onSelectLayer = new EventEmitter<IItemLayer>(); @Output() onSelectLayer = new EventEmitter<IItemLayer>();
@Input() selectedLayer: IItemLayer; @Input() selectedLayer: IItemLayer;
constructor( ) { constructor( ) {
} }
handleDelete(event:MouseEvent, item:IItemLayer) { handleDelete(event:MouseEvent, item:IItemLayer) {
this.onDelete.emit(item); this.onDelete.emit(item);
event.preventDefault(); event.preventDefault();
} }
handleToggleVisibility(event:MouseEvent, item: IItemLayer) { handleToggleVisibility(event:MouseEvent, item: IItemLayer) {
this.onToggleVisibility.emit(item); this.onToggleVisibility.emit(item);
item.legendVisible = item.visible && item.legendVisible; item.legendVisible = item.visible && item.legendVisible;
event.preventDefault(); event.preventDefault();
} }
handleSetOpacity(event: MouseEvent, layer: IItemLayer,opacity:number) { handleSetOpacity(event: MouseEvent, layer: IItemLayer,opacity:number) {
this.onSetOpacity.emit({ layer,opacity }); this.onSetOpacity.emit({ layer,opacity });
event.preventDefault(); event.preventDefault();
} }
handleZoomToExtent(event: MouseEvent, item: IItemLayer) { handleZoomToExtent(event: MouseEvent, item: IItemLayer) {
this.onZoomToExtent.emit(item); this.onZoomToExtent.emit(item);
event.preventDefault(); event.preventDefault();
} }
handleSelectLayer(event: MouseEvent, item: IItemLayer) { handleSelectLayer(event: MouseEvent, item: IItemLayer) {
this.onSelectLayer.emit(item); this.onSelectLayer.emit(item);
event.preventDefault(); event.preventDefault();
} }
firstLayer(item: IItemLayer): any { firstLayer(item: IItemLayer): any {
if (item && item.item && item.item.data && item.item.data.layers && item.item.data.layers.length > 0) return item.item.data.layers[0]; if (item && item.item && item.item.data && item.item.data.layers && item.item.data.layers.length > 0) return item.item.data.layers[0];
return null; return null;
} }
toggleLegend(event: MouseEvent, lg: boolean) { toggleLegend(event: MouseEvent, lg: boolean) {
event.preventDefault(); event.preventDefault();
return !lg; return !lg;
} }
handleLegendClick(event: MouseEvent, item: IItemLayer) { handleLegendClick(event: MouseEvent, item: IItemLayer) {
this.onSelectLayer.emit(item); this.onSelectLayer.emit(item);
this.onZoomToExtent.emit(item); this.onZoomToExtent.emit(item);
event.preventDefault(); event.preventDefault();
} }
} }

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

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

View File

@@ -1,40 +0,0 @@
// import { Component, OnInit,Input } from '@angular/core';
//import { MapComponent } from 'ngx-openlayers';
//import OLCesium from 'olcs/OLCesium.js';
// @Component({
// selector: 'fm-map-switch2d3d',
// template: '<div (click)="handleClick($event)" class="rounded-circle twotreed">{{label}}</div>',
// styles: [`.twotreed {
// width:2.5em;
// height:2.5em;
// background-color: white;
// text-align:center;
// line-height:2.5em;
// font-weight:bold;
// cursor:default;}`]
// })
// export class Switch2D3DComponent {
// @Input() enable:boolean;
// public label: string = "3D";
// private ol3d: OLCesium;
// constructor(private map: MapComponent) {
// }
// ngOnInit() {
// this.ol3d = new OLCesium({ map: this.map.instance }); // ol2dMap is the ol.Map instance
// }
// handleClick(event) {
// this.enable = !this.enable;
// if (this.enable)
// this.ol3d.setEnabled(this.enable);
// this.label = this.enable?"2D":"3D";
// }
// }

View File

@@ -1,39 +1,39 @@
import { Component, Host, Input, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core'; import { Component, Host, Input, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core';
import { ViewComponent, MapComponent } from 'ngx-openlayers'; import { ViewComponent, MapComponent } from 'ngx-openlayers';
@Component({ @Component({
selector: 'fm-map-zoom-to-extent', selector: 'fm-map-zoom-to-extent',
template: `<ng-content></ng-content>` template: `<ng-content></ng-content>`
}) })
export class ZoomToExtentComponent implements OnChanges { export class ZoomToExtentComponent implements OnChanges {
view: ViewComponent; view: ViewComponent;
map: MapComponent; map: MapComponent;
@Input() extent: number[]; @Input() extent: number[];
@Input() animate: boolean = false; @Input() animate: boolean = false;
constructor(@Host() view: ViewComponent, @Host() map: MapComponent) { constructor(@Host() view: ViewComponent, @Host() map: MapComponent) {
this.view = view; this.view = view;
this.map = map; this.map = map;
} }
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
if (this.extent) { if (this.extent) {
var options = { padding: [0, 0, 0, 0],minResolution:1 }; var options = { padding: [0, 0, 0, 0],minResolution:1 };
let size = this.map.instance.getSize(); let size = this.map.instance.getSize();
let rem = parseFloat(getComputedStyle(document.documentElement).fontSize); let rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
let threshold = 44 * rem; let threshold = 40 * rem;
var left = 1 * rem; var left = 1 * rem;
var right = 1 * rem; var right = 1 * rem;
var bottom = Math.round(size[1] / 2); var bottom = Math.round(size[1] / 2);
var top = 1 * rem; var top = 1 * rem;
if (size[0] > threshold) { if (size[0] > threshold) {
bottom = 1 * rem; bottom = 1 * rem;
left = 23 * rem; left = 23 * rem;
} }
options.padding = [top, right, bottom, left]; options.padding = [top, right, bottom, left];
if (this.animate) options["duration"] = 2000; if (this.animate) options["duration"] = 1000;
this.view.instance.fit(this.extent, options); this.view.instance.fit(this.extent, options);
} }
} }
} }

View File

@@ -1,19 +1,18 @@
@import "../../_theme.scss"; @import "~bootstrap/scss/bootstrap.scss";
@import "~bootstrap/scss/bootstrap.scss";
.row {
.row { border-bottom: 1px solid gray('500');
border-bottom: 1px solid gray('500'); user-select: none;
user-select: none; }
}
.row.selected {
.row:hover { background-color: gray('100');
background-color: gray('100'); }
}
@media screen and (min-width: 44rem) {
@media screen and (min-width: 44rem) { .feature-list-container {
.feature-list-container { margin-top: 4rem;
margin-top: 4rem; }
} }
}

View File

@@ -1,59 +1,88 @@
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core'; import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject} from '@angular/core';
import { Feature } from 'ol'; import { Feature } from 'ol';
import { FeatureListComponent,AbstractFeatureListComponent } from '../feature-list/feature-list.component'; import { FeatureListComponent,AbstractFeatureListComponent } from '../feature-list/feature-list.component';
import { WidgetHostDirective } from '../widget-host/widget-host.directive'; import { WidgetHostDirective } from '../widget-host/widget-host.directive';
import {IQueryState } from '../../models/query.state'; import {IQueryState,PackageService } 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';
import { Observable } from 'rxjs';
@Component({
selector: 'fm-map-feature-list-container', @Component({
templateUrl: './feature-list-container.component.html', selector: 'fm-map-feature-list-container',
styleUrls: ['./feature-list-container.component.scss'] templateUrl: './feature-list-container.component.html',
}) styleUrls: ['./feature-list-container.component.scss']
export class FeatureListContainerComponent { })
export class FeatureListContainerComponent {
constructor(private store: Store<mapReducers.State>,private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractFeatureListComponent) public featureLists: AbstractFeatureListComponent[] ) {
} constructor(private store: Store<mapReducers.State>,private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractFeatureListComponent) public featureLists: AbstractFeatureListComponent[],private packageService:PackageService ) {
}
@Input() features: Array<Feature>
@Input() queryState: IQueryState; @Input() features: Array<Feature>
@Input() queryState: IQueryState;
@ViewChild(WidgetHostDirective) widgetHost: WidgetHostDirective; @Input() selectedFeature: Feature;
@Input() clickedFeature:Observable<Feature>;
loadComponent(queryState:IQueryState) {
var componentFactory: ComponentFactory<AbstractFeatureListComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListComponent); // default @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
var selected = -1; componentRef:any;
for (var i = 0; i < this.featureLists.length; i++) {
if (this.featureLists[i]['forItemType'] == queryState.itemType && this.featureLists[i]['forChild'] && queryState.parentCode && queryState.parentCode != "") { loadComponent(queryState:IQueryState) {
selected = i; let componentFactory: ComponentFactory<AbstractFeatureListComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListComponent); // default
break; let selected = -1;
} else if (this.featureLists[i]['forItemType'] == queryState.itemType) { let maxMatches =0;
selected = i; let showItem = true;
break; for (let i = 0; i < this.featureLists.length; i++) {
} let matches=0;
} let criteria=0;
if (selected >= 0) { if (this.featureLists[i]['forItemType']) {
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.featureLists[i]['constructor'] as any); criteria++;
if (this.featureLists[selected]['collapseSearch'] === true) { if( this.featureLists[i]['forItemType'].indexOf(queryState.itemType) >= 0) {
this.store.dispatch(new mapActions.CollapseSearch()); matches++;
} }
} }
const viewContainerRef = this.widgetHost.viewContainerRef; if(this.featureLists[i]['forChild'] ) {
viewContainerRef.clear(); criteria++;
if(queryState.parentCode && queryState.parentCode != "") {
const componentRef = viewContainerRef.createComponent(componentFactory); matches++;
(<AbstractFeatureListComponent>componentRef.instance).features = this.features; }
(<AbstractFeatureListComponent>componentRef.instance).queryState = this.queryState; }
} if(criteria == matches && matches > maxMatches) {
selected=i;
ngOnChanges(changes: SimpleChanges) { maxMatches = matches;
if (changes["features"] && changes["features"].currentValue) { }
if (this.queryState) { }
this.loadComponent(this.queryState); if (selected >= 0) {
} componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.featureLists[selected]['constructor'] as any);
} if (this.featureLists[selected]['collapseSearch'] === true) {
} this.store.dispatch(new mapActions.CollapseSearch());
} }
}
const viewContainerRef = this.widgetHost.viewContainerRef;
viewContainerRef.clear();
if(showItem) {
this.componentRef = viewContainerRef.createComponent(componentFactory);
(<AbstractFeatureListComponent>this.componentRef.instance).features = null;
(<AbstractFeatureListComponent>this.componentRef.instance).queryState = queryState;
(<AbstractFeatureListComponent>this.componentRef.instance).selectedFeature = null;
}
}
ngOnInit() {
this.clickedFeature.subscribe((feature => {
(<AbstractFeatureListComponent>this.componentRef.instance).handleFeatureClick(feature);
}));
}
ngOnChanges(changes: SimpleChanges) {
if ((changes["queryState"] && changes["queryState"].currentValue)) {
this.loadComponent(changes["queryState"].currentValue);
}
if ((changes["features"] && changes["features"].currentValue)) {
(<AbstractFeatureListComponent>this.componentRef.instance).features = changes["features"].currentValue;
}
if(changes["selectedFeature"]) {
(<AbstractFeatureListComponent>this.componentRef.instance).selectedFeature = changes["selectedFeature"].currentValue;
}
}
}

View File

@@ -1,14 +1,14 @@
<div *ngIf="features;let features"> <div class="card border-0">
<div class="card border-0"> <div class="card-body" *ngIf="(schemeItem|async);let schemeItem">
<div class="card-body" *ngIf="(schemeItem|async);let schemeItem"> <div><a href="#" (click)="handleBackClick($event)" i18n>back</a></div>
<div><a href="#" (click)="handleBackClick($event)" i18n>back</a></div> <h4 i18n>Farm</h4>
<h4 i18n>Farm</h4> <h3>{{schemeItem.name}}</h3>
<h3>{{schemeItem.name}}</h3> <div *ngIf="features;let features">
<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" [ngClass]="{'selected':isFeatureSelected(feature)}" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
<fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container> <fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

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

View File

@@ -1,30 +1,30 @@
import { Component, Injectable,AfterViewInit, OnInit} from '@angular/core'; import { Component, Injectable,AfterViewInit, OnInit,SimpleChanges, ChangeDetectorRef} from '@angular/core';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { AbstractFeatureListComponent } from '../feature-list/feature-list.component'; import { AbstractFeatureListComponent } from '../feature-list/feature-list.component';
import {ForItemType } from '../for-item/for-itemtype.decorator'; import {ForItemType } from '../for-item/for-itemtype.decorator';
import {ForChild } from '../for-item/for-child.decorator'; import {ForChild } from '../for-item/for-child.decorator';
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,ItemService } from '@farmmaps/common'; import { commonReducers, ItemTypeService, IItem,ItemService } from '@farmmaps/common';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
@ForChild() @ForChild()
@ForItemType("vnd.farmmaps.itemtype.cropfield") @ForItemType("vnd.farmmaps.itemtype.cropfield")
@Injectable() @Injectable()
@Component({ @Component({
selector: 'fm-map-feature-list-cropfield', selector: 'fm-map-feature-list-cropfield',
templateUrl: './feature-list-cropfield.component.html', templateUrl: './feature-list-cropfield.component.html',
styleUrls: ['./feature-list-cropfield.component.scss'] styleUrls: ['./feature-list-cropfield.component.scss']
}) })
export class FeatureListCropfieldComponent extends AbstractFeatureListComponent implements OnInit { export class FeatureListCropfieldComponent extends AbstractFeatureListComponent implements OnInit {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, private itemService: ItemService) { constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, private itemService: ItemService) {
super(store, itemTypeService,location); super(store, itemTypeService,location);
} }
public schemeItem: Observable<IItem> public schemeItem: Observable<IItem>
ngOnInit() { ngOnInit() {
this.schemeItem = this.itemService.getItem(this.queryState.parentCode); this.schemeItem = this.itemService.getItem(this.queryState.parentCode);
} }
} }

View File

@@ -1,13 +1,13 @@
<div *ngIf="features;let features"> <div class="card border-0">
<div class="card border-0"> <div class="card-body">
<div class="card-body"> <div><a href="#" (click)="handleBackClick($event)" i18n>Back</a></div>
<div><a href="#" (click)="handleBackClick($event)" i18n>Back</a></div> <h3><i class="fm fm-farm"></i>&nbsp;<span i18n>Farms</span></h3>
<h3 i18n><i class="fm fm-farm"></i> Farms</h3> <div *ngIf="features;let features">
<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"[ngClass]="{'selected':isFeatureSelected(feature)}" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
<fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container> <fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

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

View File

@@ -1,29 +1,30 @@
import { Component, Injectable } from '@angular/core'; import { Component, Injectable } from '@angular/core';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { AbstractFeatureListComponent } from '../feature-list/feature-list.component'; import { AbstractFeatureListComponent } from '../feature-list/feature-list.component';
import { ForItemType } from '../for-item/for-itemtype.decorator'; import { ForItemType } from '../for-item/for-itemtype.decorator';
import { Store } from '@ngrx/store'; import { Store,Action } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer'; import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers, ItemTypeService } from '@farmmaps/common'; import { commonReducers, ItemTypeService } from '@farmmaps/common';
import * as mapActions from '../../actions/map.actions'; import * as mapActions from '../../actions/map.actions';
import { tassign } from 'tassign'; import { tassign } from 'tassign';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Feature } from 'ol';
@ForItemType("vnd.farmmaps.itemtype.croppingscheme")
@Injectable() @ForItemType("vnd.farmmaps.itemtype.croppingscheme")
@Component({ @Injectable()
selector: 'fm-map-feature-list-croppingscheme', @Component({
templateUrl: './feature-list-croppingscheme.component.html', selector: 'fm-map-feature-list-croppingscheme',
styleUrls: ['./feature-list-croppingscheme.component.scss'] templateUrl: './feature-list-croppingscheme.component.html',
}) styleUrls: ['./feature-list-croppingscheme.component.scss']
export class FeatureListCroppingschemeComponent extends AbstractFeatureListComponent { })
export class FeatureListCroppingschemeComponent extends AbstractFeatureListComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, private router: Router) {
super(store, itemTypeService, location); constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, private router: Router) {
} super(store, itemTypeService, location);
}
handleFeatureClick(feature) {
var queryState = tassign(mapReducers.initialState.queryState, { parentCode: feature.get('code'), itemType: "vnd.farmmaps.itemtype.cropfield" }); getAction(feature:Feature):Action {
this.store.dispatch(new mapActions.DoQuery(queryState)); var queryState = tassign(mapReducers.initialState.queryState, { parentCode: feature.get('code'), itemType: "vnd.farmmaps.itemtype.cropfield" });
} return new mapActions.DoQuery(queryState);
} }
}

View File

@@ -1,43 +1,59 @@
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core'; import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
import { Feature } from 'ol'; import { Feature } from 'ol';
import { AbstractFeatureListFeatureComponent,FeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component'; import { AbstractFeatureListFeatureComponent,FeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
import { WidgetHostDirective } from '../widget-host/widget-host.directive'; import { WidgetHostDirective } from '../widget-host/widget-host.directive';
@Component({ @Component({
selector: 'fm-map-feature-list-feature-container', selector: 'fm-map-feature-list-feature-container',
template: ` template: `
<div> <div>
<ng-template fm-map-widget-host></ng-template> <ng-template fm-map-widget-host></ng-template>
</div> </div>
` `
}) })
export class FeatureListFeatureContainerComponent { export class FeatureListFeatureContainerComponent {
constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractFeatureListFeatureComponent) public featureLists: AbstractFeatureListFeatureComponent[] ) { constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractFeatureListFeatureComponent) public featureLists: AbstractFeatureListFeatureComponent[] ) {
} }
@Input() feature: Feature; @Input() feature: Feature;
@ViewChild(WidgetHostDirective) widgetHost: WidgetHostDirective; @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
loadComponent() { loadComponent() {
var componentFactory: ComponentFactory<AbstractFeatureListFeatureComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListFeatureComponent); // default var componentFactory: ComponentFactory<AbstractFeatureListFeatureComponent> = this.componentFactoryResolver.resolveComponentFactory(FeatureListFeatureComponent); // default
for (var i = 0; i < this.featureLists.length; i++) {
if (this.featureLists[i]['forItemType'] == this.feature.get("itemType")) { let selected = -1;
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.featureLists[i]['constructor'] as any); let maxMatches =0;
} for (let i = 0; i < this.featureLists.length; i++) {
} let matches=0;
const viewContainerRef = this.widgetHost.viewContainerRef; let criteria=0;
viewContainerRef.clear(); if (this.featureLists[i]['forItemType']) {
criteria++;
const componentRef = viewContainerRef.createComponent(componentFactory); if(this.featureLists[i]['forItemType'].indexOf(this.feature.get("itemType")) >= 0) {
(<AbstractFeatureListFeatureComponent>componentRef.instance).feature = this.feature; matches++;
} }
}
ngOnChanges(changes: SimpleChanges) { if(criteria == matches && matches > maxMatches) {
if (changes["feature"] && changes["feature"].currentValue) { selected=i;
this.loadComponent(); maxMatches = matches;
} }
} }
} if (selected >= 0) {
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.featureLists[selected]['constructor'] as any);
}
const viewContainerRef = this.widgetHost.viewContainerRef;
viewContainerRef.clear();
const componentRef = viewContainerRef.createComponent(componentFactory);
(<AbstractFeatureListFeatureComponent>componentRef.instance).feature = this.feature;
}
ngOnChanges(changes: SimpleChanges) {
if (changes["feature"] && changes["feature"].currentValue) {
this.loadComponent();
}
}
}

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">
<h1 class="card-title" title="{{feature.get('name')}}">{{feature.get('name')}}</h1> <div #container class="thumbnail">
<div class="card-text"><span>{{feature.get('datadate')|date}}</span> - <span>{{feature.get('dataenddate')|date}}</span> </div> <canvas #canvas ></canvas>
</div> </div>
</div> </div>
<div class="flex-grow p-2 overflow-hidden">
<h1 class="card-title" title="{{feature.get('name')}}">{{feature.get('name')}}</h1>
<div class="card-text"><span>{{areaInHa(feature)| number:'1.2-2'}} ha</span>&nbsp;<span>{{feature.get('cropTypeName')}}</span> </div>
<div class="card-text"><span>{{feature.get('datadate')|date}}</span> - <span>{{feature.get('dataenddate')|date}}</span> </div>
</div>
</div>

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,28 +1,29 @@
import { Component, Input, Injectable} from '@angular/core'; import { Component, Input, Injectable,Directive} from '@angular/core';
import { Feature } from 'ol'; import { Feature } from 'ol';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer'; import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common'; import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
@Injectable() @Injectable()
export abstract class AbstractFeatureListFeatureComponent { @Directive()
@Input() feature: Feature export abstract class AbstractFeatureListFeatureComponent {
@Input() feature: Feature
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService,public config:AppConfig) {
} constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService,public config:AppConfig) {
} }
}
@Injectable()
@Component({ @Injectable()
selector: 'fm-map-feature-list-feature', @Component({
templateUrl: './feature-list-feature.component.html', selector: 'fm-map-feature-list-feature',
styleUrls: ['./feature-list-feature.component.scss'] templateUrl: './feature-list-feature.component.html',
}) styleUrls: ['./feature-list-feature.component.scss']
export class FeatureListFeatureComponent extends AbstractFeatureListFeatureComponent { })
export class FeatureListFeatureComponent extends AbstractFeatureListFeatureComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, config:AppConfig) {
super(store, itemTypeService,config); constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, config:AppConfig) {
} super(store, itemTypeService,config);
} }
}

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" [ngClass]="{'selected':isFeatureSelected(feature)}" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
<fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container> <fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
</div> </div>
</div> </div>

View File

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

View File

@@ -1,52 +1,68 @@
import { Component, Input, Injectable } from '@angular/core'; import { Component, Input, Injectable,Directive,SimpleChanges } from '@angular/core';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Feature } from 'ol'; import { Feature } from 'ol';
import { Store } from '@ngrx/store'; import { Store,Action} from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer'; import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common'; import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common';
import * as mapActions from '../../actions/map.actions'; import * as mapActions from '../../actions/map.actions';
import { Observable, from } from 'rxjs'; import { Observable, from } from 'rxjs';
import { withLatestFrom } from 'rxjs/operators'; import { withLatestFrom } from 'rxjs/operators';
import { tassign } from 'tassign'; import { tassign } from 'tassign';
import { IQueryState } from '../../models'; import { IQueryState } from '@farmmaps/common';
@Injectable() @Injectable()
export abstract class AbstractFeatureListComponent { @Directive()
@Input() features: Array<Feature>; export abstract class AbstractFeatureListComponent {
@Input() queryState: IQueryState; @Input() features: Array<Feature>;
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location) { @Input() queryState: IQueryState;
} @Input() selectedFeature: Feature;
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location) {
handleFeatureClick(feature:Feature) { }
var newQuery: any = tassign(mapReducers.initialState.query);
newQuery.itemCode = feature.get('code'); handleFeatureClick(feature:Feature) {
this.store.dispatch(new mapActions.DoQuery(newQuery)); if(feature) {
} let action = this.getAction(feature);
this.store.dispatch(action);
handleFeatureMouseEnter(feature) { }
this.store.dispatch(new mapActions.SelectFeature(feature)); }
}
getAction(feature:Feature):Action {
handleFeatureMouseLeave(feature) { var newQuery: any = tassign(mapReducers.initialState.queryState);
this.store.dispatch(new mapActions.SelectFeature(null)); newQuery.parentCode = feature.get('parentCode');
} newQuery.itemCode = feature.get('code');
newQuery.itemType = feature.get('itemType');
handleBackClick(event: MouseEvent) { return new mapActions.DoQuery(newQuery)
event.preventDefault(); }
this.location.back();
} handleFeatureMouseEnter(feature) {
} this.store.dispatch(new mapActions.SelectFeature(feature));
}
@Injectable()
@Component({ handleFeatureMouseLeave(feature) {
selector: 'fm-map-feature-list', this.store.dispatch(new mapActions.SelectFeature(null));
templateUrl: './feature-list.component.html', }
styleUrls: ['./feature-list.component.scss']
}) handleBackClick(event: MouseEvent) {
export class FeatureListComponent extends AbstractFeatureListComponent { event.preventDefault();
this.location.back();
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService,location:Location) { }
super(store, itemTypeService,location);
} isFeatureSelected(feature:Feature):boolean {
} if(!this.selectedFeature) return false;
return feature.getId() == this.selectedFeature.getId();
}
}
@Injectable()
@Component({
selector: 'fm-map-feature-list',
templateUrl: './feature-list.component.html',
styleUrls: ['./feature-list.component.scss']
})
export class FeatureListComponent extends AbstractFeatureListComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService,location:Location) {
super(store, itemTypeService,location);
}
}

View File

@@ -0,0 +1,5 @@
export function ForPackage(packageCode: string) {
return function (constructor:Function) {
constructor.prototype.forPackage = packageCode;
};
}

View File

@@ -1,47 +1,67 @@
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core'; import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
import { AbstractItemListItemComponent,ItemListItemComponent } from '../item-list-item/item-list-item.component'; import { AbstractItemListItemComponent,ItemListItemComponent } from '../item-list-item/item-list-item.component';
import { WidgetHostDirective } from '../widget-host/widget-host.directive'; import { WidgetHostDirective } from '../widget-host/widget-host.directive';
import { IItem, IListItem } from '@farmmaps/common'; import { IItem, IListItem } from '@farmmaps/common';
@Component({ @Component({
selector: 'fm-map-item-list-item-container', selector: 'fm-map-item-list-item-container',
template: ` template: `
<div style="height:100%"> <div style="height:100%">
<ng-template fm-map-widget-host></ng-template> <ng-template fm-map-widget-host></ng-template>
</div> </div>
` `
}) })
export class ItemListItemContainerComponent { export class ItemListItemContainerComponent {
constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractItemListItemComponent) public itemComponentList: AbstractItemListItemComponent[] ) { constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractItemListItemComponent) public itemComponentList: AbstractItemListItemComponent[] ) {
} }
@Input() item: IListItem; @Input() item: IListItem;
@ViewChild(WidgetHostDirective) widgetHost: WidgetHostDirective; @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
loadComponent() { loadComponent() {
var componentFactory: ComponentFactory<AbstractItemListItemComponent> = this.componentFactoryResolver.resolveComponentFactory(ItemListItemComponent); // default var componentFactory: ComponentFactory<AbstractItemListItemComponent> = this.componentFactoryResolver.resolveComponentFactory(ItemListItemComponent); // default
for (var i = 0; i < this.itemComponentList.length; i++) {
if (this.itemComponentList[i]['forItemType'] && let selected = -1;
this.itemComponentList[i]['forItemType'].indexOf(this.item.itemType) >= 0 && let maxMatches =0;
this.itemComponentList[i]['forSourceTask'] && let showItem = true;
this.itemComponentList[i]['forSourceTask'].indexOf(this.item.sourceTask) >= 0 ) for (let i = 0; i < this.itemComponentList.length; i++) {
{ let matches=0;
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.itemComponentList[i]['constructor'] as any); let criteria=0;
} if (this.itemComponentList[i]['forItemType']) {
} criteria++;
const viewContainerRef = this.widgetHost.viewContainerRef; if(this.itemComponentList[i]['forItemType'].indexOf(this.item.itemType) >= 0) {
viewContainerRef.clear(); matches++;
}
const componentRef = viewContainerRef.createComponent(componentFactory); }
(<AbstractItemListItemComponent>componentRef.instance).item = this.item; if (this.itemComponentList[i]['forSourceTask']) {
} criteria++;
if(this.itemComponentList[i]['forSourceTask'].indexOf(this.item.sourceTask) >= 0) {
ngOnChanges(changes: SimpleChanges) { matches++;
if (changes["item"] && changes["item"].currentValue) { }
this.loadComponent(); }
}
} if(criteria == matches && matches > maxMatches) {
} selected=i;
maxMatches = matches;
}
}
if (selected >= 0) {
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.itemComponentList[selected]['constructor'] as any);
}
const viewContainerRef = this.widgetHost.viewContainerRef;
viewContainerRef.clear();
const componentRef = viewContainerRef.createComponent(componentFactory);
(<AbstractItemListItemComponent>componentRef.instance).item = this.item;
}
ngOnChanges(changes: SimpleChanges) {
if (changes["item"] && changes["item"].currentValue) {
this.loadComponent();
}
}
}

View File

@@ -1,27 +1,26 @@
@import "../../_theme.scss"; @import "~bootstrap/scss/bootstrap.scss";
@import "~bootstrap/scss/bootstrap.scss";
.widget {
.widget { padding:0.8rem;
padding:0.8rem; height:100%;
height:100%; width:100%;
width:100%; color:#ffffff;
color:#ffffff; position:relative;
position:relative; }
}
.icon {
.icon { display:block;
display:block; font-size:6rem;
font-size:6rem; text-align:center;
text-align:center; }
} .title {
.title { display:block;
display:block; position:absolute;
position:absolute; width:calc(100% - 1.6rem );
width:calc(100% - 1.6rem ); padding-top:0.5rem;
padding-top:0.5rem; bottom:0.8rem;
bottom:0.8rem; height:2rem;
height:2rem; overflow:hidden;
overflow:hidden; white-space:nowrap;
white-space:nowrap; text-overflow:ellipsis;
text-overflow:ellipsis; }
}

View File

@@ -1,35 +1,53 @@
import { Component, Input, Injectable} from '@angular/core'; import { Component, Input, Injectable,Directive} from '@angular/core';
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,IListItem } from '@farmmaps/common'; import { commonReducers,ItemTypeService,IListItem } from '@farmmaps/common';
@Injectable() @Injectable()
export abstract class AbstractItemListItemComponent { @Directive()
@Input() item: IListItem export abstract class AbstractItemListItemComponent {
@Input() item: IListItem
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService) {
} constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService) {
} }
@Injectable() getScaledValue(value:number,scale:number = 0):number {
export abstract class AbstractItemWidgetComponent { let v = value;
@Input() item: IListItem if(scale && scale != 0) {
v=scale*value;
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService) { }
} return v;
} }
}
@Injectable()
@Component({ @Injectable()
selector: 'fm-map-item-list-item', @Directive()
templateUrl: './item-list-item.component.html', export abstract class AbstractItemWidgetComponent {
styleUrls: ['./item-list-item.component.scss'] @Input() item: IListItem
})
export class ItemListItemComponent extends AbstractItemListItemComponent { constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService) {
}
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService) {
super(store, itemTypeService); getScaledValue(value:number,scale:number = 0):number {
} let v = value;
} if(scale && scale != 0) {
v=scale*value;
}
return v;
}
}
@Injectable()
@Component({
selector: 'fm-map-item-list-item',
templateUrl: './item-list-item.component.html',
styleUrls: ['./item-list-item.component.scss']
})
export class ItemListItemComponent extends AbstractItemListItemComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService) {
super(store, itemTypeService);
}
}

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,17 +1,14 @@
import { Component, Input, Injectable } from '@angular/core'; import { Component, Input, Injectable, Directive } 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()
@Directive()
export abstract class AbstractItemListComponent { export abstract class AbstractItemListComponent {
@Input() items: Array<IListItem> @Input() items: Array<IListItem>
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location) { constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location) {

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,42 +1,41 @@
@import "../../_theme.scss"; @import "~bootstrap/scss/bootstrap.scss";
@import "~bootstrap/scss/bootstrap.scss";
.widget-container {
.widget-container { overflow:auto;
overflow:auto; margin-bottom:1rem;
margin-bottom:1rem; }
}
.widget {
.widget { position:relative;
position:relative; border: 1px solid gray('500');
border: 1px solid gray('500'); user-select: none;
user-select: none; display:inline-block;
display:inline-block; width:50%;
width:50%; overflow:hidden;
overflow:hidden; float:left;
float:left; }
}
.widget:after {
.widget:after { content: "";
content: ""; display: block;
display: block; padding-bottom: 100%;
padding-bottom: 100%; }
}
.content {
.content { position:absolute;
position:absolute; width:100%;
width:100%; height:100%;
height:100%; }
}
.widget:hover {
.widget:hover { background-color: gray('100');
background-color: gray('100'); }
}
.widget-container {
.widget-container { padding:1rem;
padding:1rem; }
}
.item-container {
.item-container { display:block;
display:block; height:100%;
height:100%; }
}

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">
<span i18n>Layers</span>
<i class="float-right fa fa-close" (click)="close($event)"></i>
</div>
<ul class="navbar-nav">
<li class="nav-item py-0">
<span><i class="fa fa-map-o" aria-hidden="true"></i>&nbsp;<span i18n>Base maps</span></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><i class="fa fa-map-o" aria-hidden="true"></i>&nbsp;<span i18n>Overlays</span></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,77 @@
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) {
event.stopPropagation();
this.store.dispatch(new mapActions.ShowLayerSwitcher(true));
}
close(event:Event) {
event.stopPropagation();
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

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

View File

@@ -0,0 +1,20 @@
import {Component, Input} from '@angular/core';
import {IHistogram, ILayer} from '../../../models/color.map';
@Component({
selector: 'fm-map-histogram-details',
templateUrl: './histogram-details.component.html',
styles: ['.nopadding{\n' +
' padding: 0 !important;\n' +
' margin: 0 !important;\n' +
'}']
})
export class HistogramDetailsComponent {
@Input()
histogram: IHistogram;
showConfidenceInterval(): boolean {
return this.histogram.confidence != null && this.histogram.confidence !== 1;
}
}

View File

@@ -1,39 +1,48 @@
<table class="container" *ngIf="layer"> <table class="container" *ngIf="showLegend()">
<tr> <tr>
<td colspan="2"> <td colspan="3">
<div class="title"> <div class="title">
<h4 *ngIf="showTitle">{{layer.name}}</h4> <h4 *ngIf="showTitle">{{layer.name}}</h4>
<b *ngIf="layer.unit">({{layer.unit}})</b> <b *ngIf="layer.unit">({{layer.unit}})</b>
</div> </div>
</td> </td>
<td colspan="2"> <td>
<div class="title" *ngIf="histogramenabled"> <a i18n-title title="more info"><i class="fa fa-info-circle text-primary" (click)="hideHistogramDetails = !hideHistogramDetails"></i></a>
<h4>{{histogram}}</h4> </td>
<b *ngIf="histogramunit">({{histogramunit}})</b> <td colspan="2">
</div> <div class="title" *ngIf="histogramenabled">
</td> <h4>{{histogram}}</h4>
</tr> <b *ngIf="histogramunit">({{histogramunit}})</b>
<tr *ngFor="let entry of layer.renderer.colorMap.entries; let i = index "> </div>
<td class="legend-items"><div [style.background-color]="getHex(entry.color)"></div></td> </td>
<td class="legend-items-text">{{entry.value | number:'1.0-2'}} {{legendunit}}</td> </tr>
<!--<td class="histogram-items-text"><span *ngIf="histogramenabled">{{entry.value}} {{histogramunit}}</span></td> <tr *ngFor="let entry of layer.renderer.colorMap.entries; let i = index ">
<td class="histogram-items"> <td class="legend-items"><span [style.background-color]="getAlphaHex(entry.color)" [style.border-color]="getHex(entry.color)"class="color"></span></td>
<div *ngIf="histogramenabled" [style.background-color]="getHex(selectedColorMap.noValue)" [style.width]="getPart(selectedColorMap, entry)"> <td class="legend-items-text"><span *ngIf="!entry.label">{{getScaledValue(entry.value,layer.scale) | number:'1.0-2'}} {{legendunit}}</span><span *ngIf="entry.label">{{entry.label}}</span></td>
</div> <td class="histogram-items">
</td>--> <div *ngIf="showHistogram()">
</tr> <span class="bar" [style.background-color]="getHex(entry.color)" [style.width]="getPart(layer.renderer, i)">
<tr> </span>
<td colspan="4"></td> <span class="bar-label">{{getLabel(layer.renderer,i)}}</span>
</tr> </div>
<!--<tr> </td>
<td> </tr>
<i class="fas fa-chart-bar" (click)="onClickHistoGram()"></i> <tr *ngIf="showHistogram()">
</td> <td colspan="4" class="pb-1 pt-1">
<td colspan="3"></td> <div class="info" [ngbCollapse]="hideHistogramDetails">
</tr>--> <ng-container *ngIf="bandContainsStatistics(); else histogram">
</table> <fm-map-statistics-details [statistics]="layer.renderer.band.statistics"></fm-map-statistics-details>
</ng-container>
<ng-template #histogram>
<fm-map-histogram-details [histogram]="layer.renderer.band.histogram"></fm-map-histogram-details>
</ng-template>
</div>
</td>
</tr>
</table>

View File

@@ -1,58 +1,72 @@
.container { .container {
max-width: 40em; max-width: 40em;
border-spacing: 0.5em; border-spacing: 0.5em;
font-family: inherit; font-family: inherit;
} }
.title { .title {
padding: 7px; padding: 7px;
text-align: center; text-align: center;
font-size: 14px; font-size: 14px;
line-height: 28px; line-height: 28px;
} }
.title > h4 { .title > h4 {
margin-bottom: 0; margin-bottom: 0;
} }
.legend-items { span.color {
width: 1.5em; display:inline-block;
height: 1.5em; width: 1.5em;
padding: 0.1em; height: 1.5em;
border-style: none; border: 2px solid;
border-width: 0.05em; }
}
.legend-items {
.legend-items div { padding: 0.1em;
width:100%; border-style: none;
height:100%; border-width: 0.05em;
} }
.legend-items-text { .legend-items div {
max-width: 20em; width:100%;
padding-left: 0.5em; height:100%;
text-align: left; }
}
.legend-items-text {
.histogram-items { max-width: 20em;
width: 5em; padding-left: 0.5em;
padding-left: 1em; text-align: left;
} white-space: nowrap;
}
.histogram-items > div {
height: 1em; .histogram-items {
border-style: solid; width: 100%;
border-width: 0.05em; padding-left: 1em;
vertical-align: middle; }
}
.histogram-items-text { .histogram-items-text {
max-width: 20em; max-width: 20em;
font-size: 14pt; font-size: 14pt;
padding-left: 1em; padding-left: 1em;
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;
}
.info {
line-height: 1.3em;
}

View File

@@ -1,66 +1,100 @@
import { Component, OnInit, Input,AfterViewInit } from '@angular/core'; import { Component, OnInit, Input,AfterViewInit } from '@angular/core';
import { IColorMap, IColor, IColorEntry,ILayer } from '../../models'; import { IColorMap, IColor, IColorEntry,ILayer, IRenderer } from '../../models/color.map';
@Component({ @Component({
selector: 'fm-map-layer-legend', selector: 'fm-map-layer-legend',
templateUrl: './legend.component.html', templateUrl: './legend.component.html',
styleUrls: ['./legend.component.scss'] styleUrls: ['./legend.component.scss']
}) })
export class LegendComponent implements OnInit,AfterViewInit { export class LegendComponent implements OnInit,AfterViewInit {
constructor() { constructor() {
} }
ngOnInit() { ngOnInit() {
} }
ngAfterViewInit() { ngAfterViewInit() {
} }
@Input() @Input()
layer: ILayer; layer: ILayer;
@Input() @Input()
legend: string; legend: string;
@Input() @Input()
histogram: string; histogram: string;
@Input() @Input()
showTitle: boolean = true; showTitle: boolean = true;
@Input() @Input()
histogramenabled: boolean; histogramenabled: boolean;
@Input() @Input()
legendunit: string; legendunit: string;
@Input() @Input()
histogramunit: string; histogramunit: string;
public hideHistogramDetails:boolean = true;
onClickHistoGram(): void {
this.histogramenabled = !this.histogramenabled; onClickHistoGram(): void {
} this.histogramenabled = !this.histogramenabled;
}
public getHex(color: IColor): string {
return '#' + this.componentToHex(color.red) + this.componentToHex(color.green) + this.componentToHex(color.blue);
}
public componentToHex(c: number): string { public getHex(color: IColor): string {
const hex = c.toString(16); return '#' + this.componentToHex(color.red) + this.componentToHex(color.green) + this.componentToHex(color.blue);
return hex.length === 1 ? `0${hex}` : hex; }
}
public getAlphaHex(color: IColor): string {
private getPart(colorMap: IColorMap, colorEntry: IColorEntry): string { return '#' + this.componentToHex(color.red) + this.componentToHex(color.green) + this.componentToHex(color.blue)+ this.componentToHex(color.alpha);
let sumOfValue = colorMap.entries.reduce((sum, item) => sum + item.value, 0); }
let part = ((colorEntry.value / sumOfValue) * 100) + "%";
private componentToHex(c: number): string {
return part; const hex = c.toString(16);
} return hex.length === 1 ? `0${hex}` : hex;
}
}
public getPart(renderer: IRenderer, index: number): string {
let max = renderer.band.histogram.entries.reduce((max, entry) => entry.freqency > max ? entry.freqency : max, 0);
let scale = 65 / max;
let part = (renderer.band.histogram.entries[index].freqency * scale) + "%";
return part;
}
public getScaledValue(value:number,scale:number):number {
let v = value;
if(scale && scale != 0) {
v=scale*value;
}
return v;
}
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";
}
bandContainsStatistics(): boolean {
return this.layer.renderer.band.statistics != null;
}
}

View File

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

View File

@@ -0,0 +1,16 @@
import {Component, Input} from '@angular/core';
import {IStatistics} from '../../../models/color.map';
@Component({
selector: 'fm-map-statistics-details',
templateUrl: './statistics-details.component.html',
styles: ['.nopadding{\n' +
' padding: 0 !important;\n' +
' margin: 0 !important;\n' +
'}']
})
export class StatisticsDetailsComponent {
@Input()
statistics: IStatistics;
}

View File

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

View File

@@ -1,33 +1,36 @@
<ng-template #rt let-r="result" let-t="term"> <ng-template #rt let-r="result" let-t="term">
<i class="fa fa-search" aria-hidden="true" style="width:2rem"></i> <i class="fa fa-search" aria-hidden="true" style="width:2rem"></i>
<ngb-highlight [result]="formatter(r)" [term]="t"></ngb-highlight> <ngb-highlight [result]="formatter(r)" [term]="t"></ngb-highlight>
</ng-template> </ng-template>
<div class="map-search collapsed" [ngClass]="{'collapsed':collapsedLocal,searchcollapsed:searchMinifiedLocal}" (click)="$event.stopPropagation()"> <div class="map-search collapsed" [ngClass]="{'collapsed':collapsedLocal,searchcollapsed:searchMinifiedLocal}" (click)="$event.stopPropagation()">
<div class="card p-2"> <div class="card p-2">
<form class="form" (ngSubmit)="handleSearch($event)"> <form class="form" (ngSubmit)="handleSearch($event)">
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend"> <div class="input-group-prepend">
<button type="button" class="btn btn-outline-secondary" (click)="handleToggleMenu($event)"><i class="fa fa-bars" aria-hidden="true"></i></button> <button type="button" class="btn btn-outline-secondary" (click)="handleToggleMenu($event)"><i class="fa fa-bars" aria-hidden="true"></i></button>
</div> </div>
<input #searchText class="form-control" type="text" (focus)="handleFocus($event)" [ngModel]="searchTextLocal" name="searchTextLocal" (ngModelChange)="handleChange($event)" [ngbTypeahead]="search" [resultTemplate]="rt" [inputFormatter]="formatter" (selectItem)="handleSelect($event)" placeholder="Search" i18n-placeholder /> <input #searchText class="form-control" type="text" (focus)="handleFocus($event)" [ngModel]="searchTextLocal" name="searchTextLocal" (ngModelChange)="handleChange($event)" [ngbTypeahead]="search" [resultTemplate]="rt" [inputFormatter]="formatter" (selectItem)="handleSelect($event)" placeholder="Search" i18n-placeholder />
<div class="input-group-append"> <div class="input-group-append">
<button type="submit" class="btn btn-outline-secondary" [disabled]="disabled"><i class="fa fa-search"></i></button> <button type="submit" class="btn btn-outline-secondary" [disabled]="disabled"><i class="fa fa-search"></i></button>
<button type="button" class="clear btn btn-outline-secondary" [disabled]="!clearEnabled" (click)="handleClearClick($event)"><i class="fa fa-remove"></i></button> <button type="button" class="clear btn btn-outline-secondary" [disabled]="!clearEnabled" (click)="handleClearClick($event)"><i class="fa fa-remove"></i></button>
</div> </div>
</div> </div>
<div class="options"> <div class="options">
<div class="form-check"> <div class="form-check">
<input class="form-check-input" (ngModelChange)="handleChangeEnableDateFilter($event)" [ngModel]="dateFilter" name="datefilterEnabled" type="checkbox" value="" id="filtercheck1"> <input class="form-check-input" (ngModelChange)="handleChangeEnableDateFilter($event)" [ngModel]="dateFilter" name="datefilterEnabled" type="checkbox" value="" id="filtercheck1">
<label class="form-check-label" for="filtercheck1">from <a (click)="handleOpenSelectPeriodModal($event)" href="#">{{startEndCaption}}</a></label> <label class="form-check-label" for="filtercheck1"><span i18n>from</span> <a (click)="handleOpenSelectPeriodModal($event)" href="#">{{startEndCaption}}</a></label>
</div> </div>
<div class="form-check"> <div class="form-check">
<input class="form-check-input" (ngModelChange)="handleChangeEnableBBOXFilter($event)" [ngModel]="filterOptionsLocal.bboxFilter" name="bboxfilterEnabled" type="checkbox" value="" id="filtercheck2"> <input class="form-check-input" (ngModelChange)="handleChangeEnableBBOXFilter($event)" [ngModel]="filterOptionsLocal.bboxFilter" name="bboxfilterEnabled" type="checkbox" value="" id="filtercheck2">
<label class="form-check-label" for="filtercheck2">Restrict to visible area</label> <label class="form-check-label" for="filtercheck2" i18n>Restrict to visible area</label>
</div> </div>
</div> </div>
</form> <div class="shortcuts">
<ng-content></ng-content> <router-outlet name="map-search"></router-outlet>
</div> </div>
</div> </form>
<fm-map-select-period-modal [modalState]="openedModalName" (onCloseModal)="handleCloseModal()" (onSelect)="handleSelectPeriod($event)" [startDate]="startDate" [endDate]="endDate"></fm-map-select-period-modal> <ng-content></ng-content>
</div>
</div>
<fm-map-select-period-modal [modalState]="openedModalName" (onCloseModal)="handleCloseModal()" (onSelect)="handleSelectPeriod($event)" [startDate]="startDate" [endDate]="endDate"></fm-map-select-period-modal>

View File

@@ -1,94 +1,122 @@
div.map-search { @import "~bootstrap/scss/bootstrap.scss";
position: absolute;
top: 0.5rem; div.map-search {
left: 0.5rem; position: absolute;
transition: opacity 0.5s ease-out, left 0.3s,max-height 0.3s ease-out,max-width 0.3s ease-out; top: 0.5rem;
max-height: 10rem; left: 0.5rem;
width: 21rem; transition: opacity 0.5s ease-out, left 0.3s,max-height 0.3s ease-out,max-width 0.3s ease-out;
max-width: 21rem; max-height: 10rem;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.3); min-width: calc(100vw - 1rem);
z-index:3; box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
} z-index:3;
}
.input-group {
flex-wrap:nowrap; .input-group {
} flex-wrap:nowrap;
}
.disabled {
color:lighten(#000000,80%); .disabled {
} color:lighten(#000000,80%);
}
:host ::ng-deep ngb-typeahead-window.dropdown-menu {
width: 20rem; :host ::ng-deep ngb-typeahead-window.dropdown-menu {
left:-2.5rem !important; width: 20rem;
} left:-2.5rem !important;
}
:host ::ng-deep button.dropdown-item {
overflow:hidden; :host ::ng-deep button.dropdown-item {
text-overflow:ellipsis; overflow:hidden;
padding: 0.375rem 0.75rem; text-overflow:ellipsis;
} padding: 0.375rem 0.75rem;
}
div.map-search input[type=text] {
transition: width 0.3s ease-out; div.map-search input[type=text] {
} transition: width 0.3s ease-out;
}
div.map-search button {
transition: width 0.3s ease-out; div.map-search button {
} transition: width 0.3s ease-out;
}
div.map-search.collapsed {
max-height:3.5rem; div.map-search.collapsed {
max-width:10rem; max-height:3.5rem;
} max-width:10rem;
min-width: 0;
div.map-search.searchcollapsed { }
max-height: 3.5rem;
max-width: 6rem; div.map-search.searchcollapsed {
} max-height: 3.5rem;
max-width: 6rem;
div.map-search div.options { min-width: unset;
padding-top: 0.5rem; }
line-height: 1.5rem;
overflow: hidden; div.map-search div.options {
transition: max-height 0.3s ease-in-out; padding-top: 0.5rem;
max-height:4.5rem; line-height: 1.5rem;
} overflow: hidden;
transition: max-height 0.3s ease-in-out;
div.map-search.collapsed div.options, div.map-search.searchcollapsed div.options { max-height:4.5rem;
max-height: 0; }
padding:0;
} div.map-search div.shortcuts {
padding-top: 0.5rem;
div.map-search button { line-height: 1.5rem;
overflow: hidden; overflow: hidden;
} max-height: 50vh;
transition: max-height 0.3s ease-in-out;
div.map-search.collapsed input[type=text] { }
border-top-right-radius: 0.25rem;
border-bottom-right-radius: 0.25rem; div.map-search.collapsed div.options, div.map-search.searchcollapsed div.options {
} max-height: 0;
padding:0;
div.map-search.searchcollapsed input[type=text] { }
display: none;
} div.map-search.collapsed div.shortcuts, div.map-search.searchcollapsed div.shortcuts {
max-height: 0;
div.map-search.collapsed button.clear, div.map-search.collapsed button[type="submit"] { padding:0;
width: 0; }
padding: 0;
border-color:transparent; div.map-search button {
} overflow: hidden;
}
div.map-search.searchcollapsed button[type="submit"] {
width: 0; div.map-search.collapsed input[type=text] {
padding: 0; border-top-right-radius: 0.25rem;
border-color: transparent; border-bottom-right-radius: 0.25rem;
} }
.options label { div.map-search.searchcollapsed input[type=text] {
white-space:nowrap; display: none;
} }
div.map-search.collapsed button.clear, div.map-search.collapsed button[type="submit"] {
width: 0;
padding: 0;
border-color:transparent;
}
div.map-search.searchcollapsed button[type="submit"] {
width: 0;
padding: 0;
border-color: transparent;
}
.options label {
white-space:nowrap;
}
.form-control, .form-control:focus {
border-color: $secondary;
}
@media screen and (min-width:44rem) {
div.map-search {
width: 21rem;
max-width: 21rem;
min-width:0;
}
}

View File

@@ -1,178 +1,178 @@
import { Component, Input, Output, OnInit, EventEmitter, SimpleChanges, OnChanges, ViewChild } from '@angular/core'; import { Component, Input, Output, OnInit, EventEmitter, SimpleChanges, OnChanges, ViewChild } from '@angular/core';
import { Observable , of } from 'rxjs'; import { Observable , of } from 'rxjs';
import { debounceTime,distinctUntilChanged,tap,switchMap,merge,catchError} from 'rxjs/operators'; import { debounceTime,distinctUntilChanged,tap,switchMap,merge,catchError} from 'rxjs/operators';
import { TypeaheadService, TimespanService } from '@farmmaps/common'; import { TypeaheadService, TimespanService } from '@farmmaps/common';
import { IQueryState,IPeriodState } from '../../models'; import { IQueryState } from '@farmmaps/common';
import { fillProperties } from '@angular/core/src/util/property'; import { IPeriodState } from '../../models/period.state';
import { tassign } from 'tassign'; import { tassign } from 'tassign';
@Component({ @Component({
selector: 'fm-map-map-search', selector: 'fm-map-map-search',
templateUrl: './map-search.component.html', templateUrl: './map-search.component.html',
styleUrls: ['./map-search.component.scss'] styleUrls: ['./map-search.component.scss']
}) })
export class MapSearchComponent { export class MapSearchComponent {
@ViewChild('searchText') searchText; @ViewChild('searchText', { static: true }) searchText;
@Input() clearEnabled: boolean @Input() clearEnabled: boolean
@Input() set collapsed(collapsed: boolean) { @Input() set collapsed(collapsed: boolean) {
this.collapsedLocal = collapsed; this.collapsedLocal = collapsed;
if (collapsed) this.searchText.nativeElement.blur(); if (collapsed) this.searchText.nativeElement.blur();
} }
@Input() set searchMinified(minified: boolean) { @Input() set searchMinified(minified: boolean) {
this.searchMinifiedLocal = minified; this.searchMinifiedLocal = minified;
} }
@Input() period: IPeriodState @Input() period: IPeriodState
@Output() onSearch = new EventEmitter<IQueryState>(); @Output() onSearch = new EventEmitter<IQueryState>();
@Output() onClear = new EventEmitter<any>(); @Output() onClear = new EventEmitter<any>();
@Output() onSearchCollapse = new EventEmitter<any>(); @Output() onSearchCollapse = new EventEmitter<any>();
@Output() onSearchExpand = new EventEmitter<any>(); @Output() onSearchExpand = new EventEmitter<any>();
@Output() onToggleMenu = new EventEmitter<any>(); @Output() onToggleMenu = new EventEmitter<any>();
@Output() onOpenModal = new EventEmitter<string>(); @Output() onOpenModal = new EventEmitter<string>();
@Output() onCloseModal = new EventEmitter<any>(); @Output() onCloseModal = new EventEmitter<any>();
@Input() openedModalName: string; @Input() openedModalName: string;
@Input() set filterOptions(filterOptions: IQueryState) { @Input() set filterOptions(filterOptions: IQueryState) {
if (filterOptions && filterOptions.query && filterOptions.query.length > 0) { if (filterOptions && filterOptions.query && filterOptions.query.length > 0) {
this.disabled = false; this.disabled = false;
} else { } else {
this.disabled = true; this.disabled = true;
} }
this.filterOptionsLocal = tassign(this.filterOptionsLocal, { tags: filterOptions.tags, query: filterOptions.query,bbox:filterOptions.bbox }); this.filterOptionsLocal = tassign(this.filterOptionsLocal, { tags: filterOptions.tags, query: filterOptions.query,bbox:filterOptions.bbox });
if (filterOptions.tags) { if (filterOptions.tags) {
this.searchTextLocal = { name: filterOptions.tags }; this.searchTextLocal = { name: filterOptions.tags };
} else { } else {
this.searchTextLocal = { name: filterOptions.query }; this.searchTextLocal = { name: filterOptions.query };
} }
if (this.dateFilter) { if (this.dateFilter) {
this.filterOptionsLocal.startDate = this.startDate; this.filterOptionsLocal.startDate = this.startDate;
this.filterOptionsLocal.endDate = this.endDate; this.filterOptionsLocal.endDate = this.endDate;
} }
} }
public collapsedLocal: boolean = true; public collapsedLocal: boolean = true;
public searchMinifiedLocal: boolean = false; public searchMinifiedLocal: boolean = false;
public filterOptionsLocal: IQueryState; public filterOptionsLocal: IQueryState;
private extent: number[]; private extent: number[];
public searchTextLocal: any; public searchTextLocal: any;
public searchTextLocalOutput: string; public searchTextLocalOutput: string;
public dateFilter: boolean = true; public dateFilter: boolean = true;
public startDate: Date = new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1); public startDate: Date = new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1);
public endDate: Date = new Date(Date.now()); public endDate: Date = new Date(Date.now());
public startEndCaption: string = this.timespanService.getCaption(this.startDate, this.endDate, 4); public startEndCaption: string = this.timespanService.getCaption(this.startDate, this.endDate, 4);
searching = false; searching = false;
searchFailed = false; searchFailed = false;
hideSearchingWhenUnsubscribed = new Observable(() => () => this.searching = false); hideSearchingWhenUnsubscribed = new Observable(() => () => this.searching = false);
public disabled: boolean = true; public disabled: boolean = true;
constructor(private typeaheadService: TypeaheadService, private timespanService: TimespanService) { constructor(private typeaheadService: TypeaheadService, private timespanService: TimespanService) {
this.filterOptionsLocal = { query: "", tags: "", startDate: null, endDate: null, bboxFilter: true, itemType: null, itemCode:null,level:0,parentCode:null,bbox:[] }; this.filterOptionsLocal = { query: "", tags: "", startDate: null, endDate: null, bboxFilter: false, itemType: null, itemCode:null,level:0,parentCode:null,bbox:[] };
} }
search = (text$: Observable<string>) => search = (text$: Observable<string>) =>
text$.pipe( text$.pipe(
debounceTime(300), debounceTime(300),
distinctUntilChanged(), distinctUntilChanged(),
tap(() => this.searching = true), tap(() => this.searching = true),
switchMap(term => term.length < 1 ? of([]) : switchMap(term => term.length < 1 ? of([]) :
this.typeaheadService.getSearchTypeaheadItems(term).pipe( this.typeaheadService.getSearchTypeaheadItems(term).pipe(
tap(() => this.searchFailed = false), tap(() => this.searchFailed = false),
catchError(() => { catchError(() => {
this.searchFailed = true; this.searchFailed = true;
return of([]); return of([]);
})) ), })) ),
tap(() => this.searching = false), tap(() => this.searching = false),
merge(this.hideSearchingWhenUnsubscribed)); merge(this.hideSearchingWhenUnsubscribed));
formatter = (x: { name: string }) => x.name; formatter = (x: { name: string }) => x.name;
handleSearch(event) { handleSearch(event) {
this.filterOptionsLocal.tags = null; this.filterOptionsLocal.tags = null;
this.filterOptionsLocal.itemType = null; this.filterOptionsLocal.itemType = null;
this.filterOptionsLocal.itemCode = null; this.filterOptionsLocal.itemCode = null;
this.filterOptionsLocal.parentCode = null; this.filterOptionsLocal.parentCode = null;
this.filterOptionsLocal.query = this.searchTextLocalOutput; this.filterOptionsLocal.query = this.searchTextLocalOutput;
if (this.dateFilter) { if (this.dateFilter) {
this.filterOptionsLocal.startDate = this.startDate; this.filterOptionsLocal.startDate = this.startDate;
this.filterOptionsLocal.endDate = this.endDate; this.filterOptionsLocal.endDate = this.endDate;
} }
this.onSearch.emit(this.filterOptionsLocal); this.onSearch.emit(this.filterOptionsLocal);
} }
handleOpenSelectPeriodModal(event: MouseEvent) { handleOpenSelectPeriodModal(event: MouseEvent) {
event.preventDefault(); event.preventDefault();
this.onOpenModal.emit('selectPeriodModal'); this.onOpenModal.emit('selectPeriodModal');
} }
handleCloseModal() { handleCloseModal() {
this.onCloseModal.emit({}); this.onCloseModal.emit({});
} }
handleSelect(event) { handleSelect(event) {
event.preventDefault(); event.preventDefault();
this.filterOptionsLocal.query = null; this.filterOptionsLocal.query = null;
this.filterOptionsLocal.itemType = null; this.filterOptionsLocal.itemType = null;
this.filterOptionsLocal.itemCode = null; this.filterOptionsLocal.itemCode = null;
this.filterOptionsLocal.parentCode = null; this.filterOptionsLocal.parentCode = null;
this.filterOptionsLocal.tags = event.item.name; this.filterOptionsLocal.tags = event.item.name;
if (this.dateFilter) { if (this.dateFilter) {
this.filterOptionsLocal.startDate = this.startDate; this.filterOptionsLocal.startDate = this.startDate;
this.filterOptionsLocal.endDate = this.endDate; this.filterOptionsLocal.endDate = this.endDate;
} }
this.onSearch.emit(this.filterOptionsLocal); this.onSearch.emit(this.filterOptionsLocal);
this.searchTextLocal = { name: this.filterOptionsLocal.tags }; this.searchTextLocal = { name: this.filterOptionsLocal.tags };
} }
handleSelectPeriod(event: { startDate: Date, endDate: Date }) { handleSelectPeriod(event: { startDate: Date, endDate: Date }) {
this.startDate = event.startDate; this.startDate = event.startDate;
this.endDate = event.endDate; this.endDate = event.endDate;
this.handleCloseModal(); this.handleCloseModal();
this.startEndCaption = this.timespanService.getCaption(event.startDate, event.endDate, 4); this.startEndCaption = this.timespanService.getCaption(event.startDate, event.endDate, 4);
this.onSearch.emit(this.filterOptionsLocal); this.onSearch.emit(this.filterOptionsLocal);
} }
handleChangeEnableDateFilter(enabled) { handleChangeEnableDateFilter(enabled) {
this.dateFilter = enabled; this.dateFilter = enabled;
if (enabled) { if (enabled) {
this.filterOptionsLocal.startDate = this.startDate; this.filterOptionsLocal.startDate = this.startDate;
this.filterOptionsLocal.endDate = this.endDate; this.filterOptionsLocal.endDate = this.endDate;
} else { } else {
this.filterOptionsLocal.startDate = null; this.filterOptionsLocal.startDate = null;
this.filterOptionsLocal.endDate = null; this.filterOptionsLocal.endDate = null;
} }
if(this.filterOptionsLocal.query || this.filterOptionsLocal.tags) if(this.filterOptionsLocal.query || this.filterOptionsLocal.tags)
this.onSearch.emit(this.filterOptionsLocal); this.onSearch.emit(this.filterOptionsLocal);
} }
handleChangeEnableBBOXFilter(enabled) { handleChangeEnableBBOXFilter(enabled) {
this.filterOptionsLocal.bboxFilter = enabled; this.filterOptionsLocal.bboxFilter = enabled;
if (this.filterOptionsLocal.query || this.filterOptionsLocal.tags) if (this.filterOptionsLocal.query || this.filterOptionsLocal.tags)
this.onSearch.emit(this.filterOptionsLocal); this.onSearch.emit(this.filterOptionsLocal);
} }
handleToggleMenu(event) { handleToggleMenu(event) {
this.onToggleMenu.emit({}); this.onToggleMenu.emit({});
} }
handleFocus(event) { handleFocus(event) {
this.onSearchExpand.emit({}); this.onSearchExpand.emit({});
} }
handleChange(event: string) { handleChange(event: string) {
this.searchTextLocalOutput = event; this.searchTextLocalOutput = event;
if (event && event.length == 1) { if (event && event.length == 1) {
this.onSearchExpand.emit({}); this.onSearchExpand.emit({});
} }
if (event && event.length > 0) if (event && event.length > 0)
this.disabled = false; this.disabled = false;
else else
this.disabled = true; this.disabled = true;
} }
handleClearClick(event) { handleClearClick(event) {
this.onClear.emit({}); this.onClear.emit({});
} }
} }

View File

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

View File

@@ -1,171 +1,166 @@
@import "../../_theme.scss"; @import "~bootstrap/scss/bootstrap.scss";
@import "~bootstrap/scss/bootstrap.scss";
aol-map { position:absolute;width:100%;height:100%;}
aol-map { position:absolute;width:100%;height:100%;}
.arrow {
.arrow { top: 3rem;
top: 3rem; }
}
.popover {
.popover { max-height:22rem;
max-height:22rem; min-width:15rem;
min-width:15rem; }
}
.popover-body {
.popover-body { max-height:19rem;
max-height:19rem; overflow:hidden;
overflow:hidden; overflow-y:auto;
overflow-y:auto; }
}
.card-title {
.card-title { font-size:1rem;
font-size:1rem; }
}
.menu-card {
.menu-card { margin-left:-7px;
margin-left:-7px; padding-left:7px;
padding-left:7px; margin-right:-7px;
margin-right:-7px; padding-right:7px;
padding-right:7px; margin-bottom:7px;
margin-bottom:7px; }
}
.icon-top {
.icon-top { font-size: 6rem;
font-size: 6rem; text-align: center;
text-align: center; height: 9.75rem;
height: 9.75rem; }
}
.icon-top i {
.icon-top i { padding-top: 1.875rem;
padding-top: 1.875rem; }
}
.card-title {
.card-title { white-space:nowrap;
white-space:nowrap; overflow:hidden;
overflow:hidden; text-overflow:ellipsis;
text-overflow:ellipsis; }
}
.control-container {
.control-container { position: absolute;
position: absolute; right: 1em;
right: 1em; bottom: 1em;
bottom: 1em; }
}
switch2d3d {
switch2d3d { position: absolute;
position: absolute; right: 1em;
right: 1em; bottom: 1em;
bottom: 1em; }
}
.panel-wrapper {
.panel-wrapper { display: flex;
display: flex; flex-direction: column;
flex-direction: column; align-items: stretch;
align-items: stretch; width: 100%;
width: 100%; height: 100%;
height: 100%; }
}
.panel-top {
.panel-top { display: block;
display: block; height:0;
height:0; }
}
.panel-bottom {
.panel-bottom { overflow:auto;
overflow:auto; flex:1;
flex:1; }
}
.no-results {
.no-results { font-weight:bold;
font-weight:bold; }
}
.no-results > span {
.no-results > span { font-style:italic;
font-style:italic; }
}
div.header {
div.header { display:flex;
display:flex; padding-top:1em;
padding-top:1em; margin-bottom:1em;
margin-bottom:1em; }
}
div.header button {
div.header button { margin-left:1em;
margin-left:1em; }
}
.logo {
.logo { overflow: hidden;
overflow: hidden; max-height: 2.5em;
max-height: 2.5em; }
}
timespan {
timespan { position: absolute;
position: absolute; transition: left 0.5s;
transition: left 0.5s; bottom: 0;
bottom: 0; left: 0;
left: 0; right: 0;
right: 0; background-color: rgba(255, 255, 255, 0.5);
background-color: rgba(255, 255, 255, 0.5); }
}
timespan.menuVisible {
timespan.menuVisible { left: 22rem;
left: 22rem; }
}
:host ::ng-deep .timespan div.clearfix {
:host ::ng-deep .timespan div.clearfix { transition: height 0.5s;
transition: height 0.5s; }
}
:host ::ng-deep .menu .side-panel { @media screen and (min-width:44rem) {
z-index: 100; .panel-top {
background-color: rgb(245,245,245); height: 8.1rem;
} }
}
@media screen and (min-width:44rem) {
.panel-top { .map {
height: 8.1rem; transition: margin-left 0.3s;
} }
}
.shortcut-icon {
.map { display: inline-block;
transition: margin-left 0.3s; text-align: center;
} margin: 0.5rem;
cursor:pointer;
.shortcut-icon { }
display: inline-block;
text-align: center; .shortcut-icon > .icon {
margin: 0.5rem; width: 3rem;
cursor:pointer; height: 3rem;
} background-color: #731e64;
display: inline-block;
.shortcut-icon > .icon { text-align: center;
width: 3rem; line-height: 3rem;
height: 3rem; color: #ffffff;
background-color: #731e64; font-size: 2rem;
display: inline-block; }
text-align: center;
line-height: 3rem; .shortcut-icon > .caption {
color: #ffffff; text-align: center;
font-size: 2rem; width: 4rem;
} overflow: hidden;
text-overflow: ellipsis;
.shortcut-icon > .caption { color: theme-color();
text-align: center; }
width: 4rem;
overflow: hidden; .shortcut-icon > .farm-icon {
text-overflow: ellipsis; background-color: #731E64;
color: theme-color(); }
}
.shortcut-icon > .trijntje-icon {
.shortcut-icon > .farm-icon { background-color: #FAA33F;
background-color: #731E64; }
}
/*.panel-visible {
.shortcut-icon > .trijntje-icon { margin-left:22rem;
background-color: #FAA33F; }*/
}
/*.panel-visible {
margin-left:22rem;
}*/

View File

@@ -1,303 +1,407 @@
import { Component, OnInit, OnDestroy, HostListener, Inject, ViewChild, AfterViewInit } from '@angular/core'; import { Component, OnInit, OnDestroy, HostListener, ViewChild, AfterViewInit,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, from,of } from 'rxjs';
import { debounce, withLatestFrom, first, combineAll } from 'rxjs/operators'; import { withLatestFrom, switchMap,skip } from 'rxjs/operators';
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router'; import { Router, ActivatedRoute, ParamMap } from '@angular/router';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
//import { proj,Map } from 'openlayers'; //import { proj,Map } from 'openlayers';
// Map // Map
import * as mapReducers from '../../reducers/map.reducer'; import * as mapReducers from '../../reducers/map.reducer';
import * as mapActions from '../../actions/map.actions'; import * as mapActions from '../../actions/map.actions';
import { IMapState,ISelectedFeatures,IItemLayer, ItemLayer,IQueryState,IPeriodState } from '../../models'; import { IMapState} from '../../models/map.state';
import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component'; import { ISelectedFeatures } from '../../models/selected.features';
import { IMetaData } from '../meta-data-modal/meta-data-modal.component'; import { IItemLayer } from '../../models/item.layer';
import { StateSerializerService } from '../../services/state-serializer.service'; import { IQueryState } from '@farmmaps/common';
import { GeolocationService} from '../../services/geolocation.service'; import { IPeriodState } from '../../models/period.state';
import {IStyles} from '../../models/style.cache';
// AppCommon import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component';
import { ResumableFileUploadService, ItemTypeService } from '@farmmaps/common'; import { StateSerializerService } from '@farmmaps/common';
import { IItemType, IItem } from '@farmmaps/common'; import { GeolocationService} from '../../services/geolocation.service';
import {commonReducers} from '@farmmaps/common'; import {DeviceOrientationService} from '../../services/device-orientation.service';
import {commonActions} from '@farmmaps/common';
// AppCommon
import {Feature} from 'ol'; import { ResumableFileUploadService, ItemTypeService } from '@farmmaps/common';
import {Extent,createEmpty,extend } from 'ol/extent'; import { IItemType, IItem } from '@farmmaps/common';
import {transform} from 'ol/proj'; import {commonReducers} from '@farmmaps/common';
import { query } from '@angular/animations'; import {commonActions} from '@farmmaps/common';
import { tassign } from 'tassign';
import {Feature} from 'ol';
import {Extent,createEmpty,extend } from 'ol/extent';
@Component({ import {transform} from 'ol/proj';
selector: 'fm-map-map', import { tassign } from 'tassign';
templateUrl: './map.component.html', import * as style from 'ol/style';
styleUrls: ['./map.component.scss']
})
@Component({
export class MapComponent implements OnInit, OnDestroy,AfterViewInit { selector: 'fm-map-map',
title: string = 'Map'; templateUrl: './map.component.html',
public openedModalName: Observable<string>; styleUrls: ['./map.component.scss']
public itemTypes: Observable<{ [id: string]: IItemType }>; })
public mapState: Observable<IMapState>;
public features: Observable<Array<Feature>>; export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
public overlayLayers: Observable<Array<IItemLayer>>; title: string = 'Map';
public selectedOverlayLayer: Observable<IItemLayer>; public openedModalName$: Observable<string> = this.store.select(commonReducers.selectOpenedModalName);
public selectedItemLayer: Observable<IItemLayer>; public itemTypes$: Observable<{ [id: string]: IItemType }>;
public baseLayers: Observable<Array<IItemLayer>>; public mapState$: Observable<IMapState> = this.store.select(mapReducers.selectGetMapState);
public selectedBaseLayer: Observable<IItemLayer>; public features$: Observable<Array<Feature>> = this.store.select(mapReducers.selectGetFeatures);
public projection: Observable<string>; public overlayLayers$: Observable<Array<IItemLayer>> = this.store.select(mapReducers.selectGetOverlayLayers);
public selectedFeatures: Subject<ISelectedFeatures> = new Subject<ISelectedFeatures>(); public selectedOverlayLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
public droppedFile: Subject<IDroppedFile> = new Subject<IDroppedFile>(); public selectedItemLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedItemLayer);
private paramSub: Subscription; public baseLayers$: Observable<Array<IItemLayer>> = this.store.select(mapReducers.selectGetBaseLayers);
private itemTypeSub: Subscription; public selectedBaseLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedBaseLayer);
private mapStateSub: Subscription; public projection$: Observable<string> = this.store.select(mapReducers.selectGetProjection);
private queryStateSub: Subscription; public selectedFeatures$: Subject<ISelectedFeatures> = new Subject<ISelectedFeatures>();
public parentCode: Observable<string>; public droppedFile$: Subject<IDroppedFile> = new Subject<IDroppedFile>();
public panelVisible: Observable<boolean>; private paramSub: Subscription;
public panelCollapsed: Observable<boolean>; private itemTypeSub: Subscription;
public selectedFeature: Observable<Feature>; private stateSub: Subscription;
public selectedItem: Observable<IItem>; private queryStateSub: Subscription;
public queryState: Observable<IQueryState>; private querySub: Subscription;
public period: Observable<IPeriodState>; public parentCode$: Observable<string> =this.store.select(mapReducers.selectGetParentCode);
public clearEnabled: Observable<boolean>; public panelVisible$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelVisible);
public searchCollapsed: Observable<boolean>; public panelCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelCollapsed);
public searchMinified: Observable<boolean>; public selectedFeature$: Observable<Feature> = this.store.select(mapReducers.selectGetSelectedFeature);
public menuVisible: Observable<boolean>; public clickedFeature: Subject<Feature> = new Subject<Feature>();
public query: Observable<IQueryState>; public selectedItem$: Observable<IItem> = this.store.select(mapReducers.selectGetSelectedItem);
public position: Observable<Position>; public parentItem$: Observable<IItem> =this.store.select(mapReducers.selectGetParentItem);
public baseLayersCollapsed:boolean = true; public queryState$: Observable<IQueryState> = this.store.select(mapReducers.selectGetQueryState);
public overlayLayersCollapsed: boolean = true; public state$:Observable<{mapState:IMapState,queryState:IQueryState,setStateCount:number}> = this.store.select(mapReducers.selectGetState);
public extent: Observable<Extent>; public period$: Observable<IPeriodState> = this.store.select(mapReducers.selectGetPeriod);
@ViewChild('map') map; public clearEnabled$: Observable<boolean> = this.store.select(mapReducers.selectGetClearEnabled);
public searchCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetSearchCollapsed);
constructor(private store: Store<mapReducers.State | commonReducers.State>, private route: ActivatedRoute, private router: Router, private uploadService: ResumableFileUploadService, private serializeService: StateSerializerService, public itemTypeService: ItemTypeService, private location: Location, private geolocationService: GeolocationService ) { public searchMinified$: Observable<boolean> = this.store.select(mapReducers.selectGetSearchMinified);
} public menuVisible$: Observable<boolean>;
public query$: Observable<IQueryState> = this.store.select(mapReducers.selectGetQuery);
@HostListener('document:keyup', ['$event']) public position$: Observable<Position> = this.geolocationService.getCurrentPosition();
escapeClose(event: KeyboardEvent) { public compassHeading$: Observable<number> = this.deviceorientationService.getCurrentCompassHeading();
let x = event.keyCode; public baseLayersCollapsed:boolean = true;
if (x === 27) { public overlayLayersCollapsed: boolean = true;
this.handleCloseModal() public extent$: Observable<Extent> = this.store.select(mapReducers.selectGetExtent);
} public styles$:Observable<IStyles> = this.store.select(mapReducers.selectGetStyles);
} private setStateCount$:Observable<number> = this.store.select(mapReducers.selectgetSetStateCount);
private lastUrl = "";
handleOpenModal(modalName: string) {
this.store.dispatch(new commonActions.OpenModal(modalName)); @ViewChild('map') map;
}
constructor(private store: Store<mapReducers.State | commonReducers.State>,
handleCloseModal() { private route: ActivatedRoute,
this.store.dispatch(new commonActions.CloseModal()); private router: Router,
} private uploadService: ResumableFileUploadService,
private serializeService: StateSerializerService,
handleFileDropped(droppedFile: IDroppedFile) { public itemTypeService: ItemTypeService,
this.uploadService.addFiles(droppedFile.files, droppedFile.event, { parentCode:droppedFile.parentCode, geometry:droppedFile.geometry }); private location: Location,
} private geolocationService: GeolocationService,
private zone: NgZone,
handleFeaturesSelected(feature: Feature) { private deviceorientationService:DeviceOrientationService) {
if (feature) { this.querySub = this.query$.pipe(skip(1), withLatestFrom(this.mapState$),withLatestFrom(this.setStateCount$)).subscribe(([[queryState,mapState],setStateCount]) =>{
let newQuery = tassign(mapReducers.initialQueryState, { itemCode: feature.get('code') }); if(queryState) {
this.store.dispatch(new mapActions.DoQuery(newQuery)); let newQueryState = tassign(mapReducers.initialQueryState);
} console.debug(`Do Query ${setStateCount}`);
} let urlparts=[];
if (queryState.itemCode && queryState.itemCode != "") {
handleSearch(queryState: IQueryState) { if(queryState.itemType && queryState.itemType!= "") {
this.store.dispatch(new mapActions.DoQuery(queryState)); let itemType = this.itemTypeService.itemTypes[queryState.itemType];
} if (itemType && itemType.viewer && itemType.viewer == "edit_in_editor" && itemType.editor) {
urlparts.push('/editor');
ngOnInit() { urlparts.push(itemType.editor);
this.store.dispatch(new mapActions.Init()); urlparts.push('item');
this.selectedFeatures.next({x:0,y:0,features:[]}); urlparts.push(queryState.itemCode);
this.mapState = this.store.select(mapReducers.selectGetMapState); }
this.parentCode = this.store.select(mapReducers.selectGetParentCode); }
this.features = this.store.select(mapReducers.selectGetFeatures); } else {
this.overlayLayers = this.store.select(mapReducers.selectGetOverlayLayers); newQueryState= queryState;
this.selectedOverlayLayer = this.store.select(mapReducers.selectGetSelectedOverlayLayer); }
this.baseLayers = this.store.select(mapReducers.selectGetBaseLayers); if(urlparts.length==0 ) {
this.projection = this.store.select(mapReducers.selectGetProjection); newQueryState.itemCode = queryState.itemCode;
this.selectedBaseLayer = this.store.select(mapReducers.selectGetSelectedBaseLayer); this.zone.run(() => {
this.panelVisible = this.store.select(mapReducers.selectGetPanelVisible); this.store.dispatch(new mapActions.SetQueryState(newQueryState,false));
this.panelCollapsed = this.store.select(mapReducers.selectGetPanelCollapsed); })
this.selectedFeature = this.store.select(mapReducers.selectGetSelectedFeature); } else {
this.selectedItem = this.store.select(mapReducers.selectGetSelectedItem); this.router.navigate(urlparts);
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); @HostListener('document:keyup', ['$event'])
this.query = this.store.select(mapReducers.selectGetQuery); escapeClose(event: KeyboardEvent) {
this.extent = this.store.select(mapReducers.selectGetExtent); let x = event.keyCode;
this.selectedFeatures.next(null); if (x === 27) {
this.selectedItemLayer = this.store.select(mapReducers.selectGetSelectedItemLayer); this.handleCloseModal()
this.period = this.store.select(mapReducers.selectGetPeriod); }
this.position = this.geolocationService.getCurrentPosition(); }
this.mapState.pipe(withLatestFrom(this.queryState)).subscribe((state) => { handleOpenModal(modalName: string) {
this.replaceUrl(state[0], state[1], true); this.store.dispatch(new commonActions.OpenModal(modalName));
}); }
this.query.pipe(withLatestFrom(this.mapState)).subscribe((state) => {
this.replaceUrl(state[1], state[0],false); handleCloseModal() {
}); this.store.dispatch(new commonActions.CloseModal());
} }
private stateSetCount: number = 0; handleFileDropped(droppedFile: IDroppedFile) {
private lastQueryState: string = this.serializeService.serialize(mapReducers.initialQueryState); this.uploadService.addFiles(droppedFile.files, droppedFile.event, { parentCode:droppedFile.parentCode, geometry:droppedFile.geometry });
private lastMapState: string = ""; }
ngAfterViewInit() {
this.paramSub = this.route.paramMap.subscribe((params: ParamMap) => { handleFeatureClick(feature: Feature) {
//console.log("Param sub"); this.clickedFeature.next(feature);
var newMapState: IMapState = null; }
var newQueryState: IQueryState = null;
var mapStateChanged = false; handleFeatureHover(feature: Feature) {
var queryStateChanged = false; this.store.dispatch(new mapActions.SelectFeature(feature));
if (params.has("xCenter") && params.has("yCenter")) { }
let xCenter = parseFloat(params.get("xCenter"));
let yCenter = parseFloat(params.get("yCenter")); handleSearch(queryState: IQueryState) {
let zoom = parseFloat(params.get("zoom")); this.store.dispatch(new mapActions.DoQuery(queryState));
let rotation = parseFloat(params.get("rotation")); }
let baseLayer = params.get("baseLayer")?params.get("baseLayer"):"";
newMapState = { xCenter: xCenter, yCenter: yCenter, zoom: zoom, rotation: rotation, baseLayerCode: baseLayer } ngOnInit() {
mapStateChanged = this.lastMapState != JSON.stringify(newMapState) && this.stateSetCount == 0; console.debug("Init");
this.lastMapState = JSON.stringify(newMapState); this.store.dispatch(new mapActions.Clear());
} this.selectedFeatures$.next({x:0,y:0,features:[]});
if (params.has("queryState")) { this.selectedFeatures$.next(null);
let queryState = params.get("queryState"); }
newQueryState = tassign(mapReducers.initialQueryState);
if (queryState != "") { initCustomStyles() {
newQueryState = this.serializeService.deserialize(queryState); this.store.dispatch(new mapActions.SetStyle('vnd.farmmaps.itemtype.layer',new style.Style({
} stroke: new style.Stroke({
queryStateChanged = this.lastQueryState != queryState; color: 'red',
this.lastQueryState = queryState; lineDash: [ 5,5],
} width: 1
}),
if (mapStateChanged && queryStateChanged) { geometry:(feature) =>feature.getGeometry()
//console.log("Both states"); })));
this.store.dispatch(new mapActions.SetState(newMapState, newQueryState)); this.store.dispatch(new mapActions.SetStyle('vnd.farmmaps.itemtype.layer_selected',new style.Style({
} else if (mapStateChanged) { stroke: new style.Stroke({
//console.log("Map state"); color: 'red',
this.store.dispatch(new mapActions.SetMapState(newMapState)); lineDash: [ 5,5],
} else if (queryStateChanged) { width: 3
//console.log("Query state"); }),
this.store.dispatch(new mapActions.SetQueryState(newQueryState)); geometry:(feature) =>feature.getGeometry()
} })));
this.stateSetCount += 1; }
});
setTimeout(() => { round(value:number,decimals:number):number {
this.map.instance.updateSize(); let d = Math.pow(10, decimals);
}, 500); return Math.round((value + Number.EPSILON)*d)/d;
} }
handleSearchCollapse(event) { getMapStateFromUrl(params:ParamMap):IMapState {
this.store.dispatch(new mapActions.CollapseSearch()); var hasUrlmapState = params.has("xCenter") && params.has("yCenter");
} if (hasUrlmapState) {
let xCenter = parseFloat(params.get("xCenter"));
handleSearchExpand(event) { let yCenter = parseFloat(params.get("yCenter"));
this.store.dispatch(new mapActions.ExpandSearch()); let zoom = parseFloat(params.get("zoom"));
} let rotation = parseFloat(params.get("rotation"));
let baseLayer = params.get("baseLayer")?params.get("baseLayer"):"";
handleToggleMenu(event) { var newMapState = {zoom: zoom, rotation: rotation, xCenter: xCenter, yCenter: yCenter, baseLayerCode: baseLayer };
this.store.dispatch(new mapActions.ToggleMenu()); return newMapState;
} } else {
return null;
handleToggleBaseLayers(event:MouseEvent) { }
this.baseLayersCollapsed = !this.baseLayersCollapsed; }
event.preventDefault();
} normalizeMapState(mapState:IMapState):IMapState {
if(!mapState) return null;
handleToggleOverlayLayers(event: MouseEvent) { return {zoom: this.round(mapState.zoom,0),
this.overlayLayersCollapsed = !this.overlayLayersCollapsed; rotation: this.round(mapState.rotation,2),
event.preventDefault(); xCenter: this.round(mapState.xCenter,5),
} yCenter: this.round(mapState.yCenter,5),
baseLayerCode: mapState.baseLayerCode };
handlePredefinedQuery(event: MouseEvent, query: any) { }
event.preventDefault();
var queryState = tassign(mapReducers.initialQueryState, query); serializeMapState(mapState:IMapState):string {
this.store.dispatch(new mapActions.DoQuery(queryState)); return JSON.stringify(this.normalizeMapState(mapState));
} }
handleTrijntjeClick(event: MouseEvent, query: any) { getQueryStateFromUrl(params:ParamMap):IQueryState {
event.preventDefault(); if (params.has("queryState")) {
var queryState = tassign(mapReducers.initialQueryState, query); let queryState = params.get("queryState");
var mapState = JSON.parse(this.lastMapState); var newQueryState = tassign(mapReducers.initialQueryState);
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 }); if (queryState != "") {
} newQueryState = this.serializeService.deserialize(queryState);
}
replaceUrl(mapState: IMapState, queryState: IQueryState, replace: boolean = true) { return newQueryState;
console.debug(`Replace url : Baselayer(${mapState.baseLayerCode}) Querystate(${this.serializeService.serialize(queryState)})`); } else {
let parts =["."]; return null;
parts.push(mapState.xCenter.toFixed(5)); }
parts.push(mapState.yCenter.toFixed(5)); }
parts.push( mapState.zoom.toFixed(0));
parts.push( mapState.rotation.toFixed(2)); ngAfterViewInit() {
if(mapState.baseLayerCode!="") { console.debug("View init");
parts.push(mapState.baseLayerCode); this.initCustomStyles();
parts.push( this.serializeService.serialize(queryState));
this.router.navigate(parts, { replaceUrl: replace,relativeTo:this.route.parent }); // url to state
}
} this.paramSub = this.route.paramMap.pipe(withLatestFrom(this.state$),switchMap(([params,state]) => {
var newMapState: IMapState = state.mapState;
handleOnMoveEnd(event) { var newQueryState: IQueryState = state.queryState;
var map = event.map;
var view = map.getView(); var queryStateChanged = false;
var rotation = view.getRotation(); var mapStateChanged = false;
var zoom = view.getZoom(); let urlMapState = this.getMapStateFromUrl(params);
var center = transform(view.getCenter(), view.getProjection(), "EPSG:4326"); if(urlMapState) {
var extent = view.calculateExtent(this.map.instance.getSize()); newMapState = urlMapState;
let mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null }; mapStateChanged = this.serializeMapState(state.mapState) != this.serializeMapState(newMapState);
let state = { mapState: mapState, extent: extent }; }
let source = from([state]);
source.pipe(withLatestFrom(this.selectedBaseLayer), withLatestFrom(this.queryState)).subscribe(([[state, baselayer], queryState]) => { let urlQueryState = this.getQueryStateFromUrl(params);
if (mapState && baselayer && queryState) { if(urlQueryState) {
let newMapState = tassign(state.mapState, { baseLayerCode: baselayer.item.code }); newQueryState = urlQueryState;
this.replaceUrl(newMapState, tassign(queryState, { bbox: queryState.bboxFilter ? state.extent : queryState.bbox })); queryStateChanged = this.serializeService.serialize(state.queryState) != this.serializeService.serialize(urlQueryState);
this.store.dispatch(new mapActions.SetViewExtent(state.extent)); }
}
}); if(queryStateChanged && mapStateChanged && state.setStateCount ==0) {
} return of(new mapActions.SetState(newMapState,newQueryState));
window.localStorage.setItem("FarmMapsCommonMap_mapState",this.serializeMapState(newMapState));
handleOnMouseDown(event: MouseEvent) { } else if(queryStateChanged) {
this.store.dispatch(new mapActions.CollapseSearch()); return of(new mapActions.SetQueryState(newQueryState));
} } return of(new mapActions.SetReplaceUrl(true));
})).subscribe((action) => {
handleOnDownload(event) { if(action) {
this.zone.run(() => {
} console.debug("Url to state");
this.store.dispatch(action);
handleClearSearch(event) { });
this.store.dispatch(new commonActions.Escape(true, false)); }
} });
handleOnDelete(itemLayer: IItemLayer) { // state to url
this.store.dispatch(new mapActions.RemoveLayer(itemLayer));
} this.stateSub = this.state$.pipe(switchMap((state) => {
let newUrl = this.serializeMapState(state.mapState) + "_" + this.serializeService.serialize(state.queryState);
handleOnToggleVisibility(itemLayer: IItemLayer) { if(this.lastUrl!=newUrl && state.setStateCount>0) {
this.store.dispatch(new mapActions.SetVisibility(itemLayer,!itemLayer.visible)); this.lastUrl=newUrl;
} return of(state);
}
handleOnSetOpacity(event:{ layer: IItemLayer,opacity:number }) { else {
this.store.dispatch(new mapActions.SetOpacity(event.layer, event.opacity)); return of(null);
} }
})).subscribe((newUrlState) =>{
handleZoomToExtent(itemLayer: IItemLayer) { if(newUrlState) {
var extent = createEmpty(); console.debug(`State to url ${newUrlState.setStateCount}`);
extend(extent, itemLayer.layer.getExtent()); this.replaceUrl(newUrlState.mapState,newUrlState.queryState,newUrlState.replaceUrl);
if (extent) { }
this.store.dispatch(new mapActions.SetExtent(extent)); });
}
} setTimeout(() => {
this.map.instance.updateSize();
handleSelectBaseLayer(itemLayer: IItemLayer) { }, 500);
this.store.dispatch(new mapActions.SelectBaseLayer(itemLayer)); }
}
handleSearchCollapse(event) {
handleSelectOverlayLayer(itemLayer: IItemLayer) { this.store.dispatch(new mapActions.CollapseSearch());
this.store.dispatch(new mapActions.SelectOverlayLayer(itemLayer)); }
}
handleSearchExpand(event) {
ngOnDestroy() { this.store.dispatch(new mapActions.ExpandSearch());
this.paramSub.unsubscribe(); }
if (this.itemTypeSub) this.itemTypeSub.unsubscribe();
if (this.mapStateSub) this.mapStateSub.unsubscribe(); handleToggleMenu(event) {
if (this.queryStateSub) this.queryStateSub.unsubscribe(); } this.store.dispatch(new commonActions.ToggleMenu());
} }
handleToggleBaseLayers(event:MouseEvent) {
this.baseLayersCollapsed = !this.baseLayersCollapsed;
event.preventDefault();
}
handleToggleOverlayLayers(event: MouseEvent) {
this.overlayLayersCollapsed = !this.overlayLayersCollapsed;
event.preventDefault();
}
handlePredefinedQuery(event: MouseEvent, query: any) {
event.preventDefault();
var queryState = tassign(mapReducers.initialQueryState, query);
this.store.dispatch(new mapActions.DoQuery(queryState));
}
replaceUrl(mapState: IMapState, queryState: IQueryState, replace: boolean = true) {
let parts =["."];
parts.push(mapState.xCenter.toFixed(5));
parts.push(mapState.yCenter.toFixed(5));
parts.push( mapState.zoom.toFixed(0));
parts.push( mapState.rotation.toFixed(2));
if(mapState.baseLayerCode!="") {
parts.push(mapState.baseLayerCode);
parts.push( this.serializeService.serialize(queryState));
console.debug("Replace url",parts);
this.router.navigate(parts, { replaceUrl: replace,relativeTo:this.route.parent });
}
}
handleOnMoveEnd(event) {
console.debug("Move end");
this.zone.run(() =>{
var map = event.map;
var view = map.getView();
var rotation = view.getRotation();
var zoom = view.getZoom();
var center = transform(view.getCenter(), view.getProjection(), "EPSG:4326");
var extent = view.calculateExtent(this.map.instance.getSize());
let mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null };
let state = { mapState: mapState, extent: extent };
let source = from([state]);
source.pipe(withLatestFrom(this.selectedBaseLayer$),withLatestFrom(this.setStateCount$)).subscribe(([[state, baselayer],setStateCount]) => {
if (mapState && baselayer) { // do not react on first move
let newMapState = tassign(state.mapState, { baseLayerCode: baselayer.item.code });
this.store.dispatch(new mapActions.SetMapState(newMapState));
this.store.dispatch(new mapActions.SetViewExtent(state.extent));
}
});
});
}
handleOnMouseDown(event: MouseEvent) {
event.stopPropagation();
this.zone.run(() =>{
this.store.dispatch(new commonActions.CloseAll());
});
}
handleOnDownload(event) {
}
handleClearSearch(event) {
this.store.dispatch(new commonActions.Escape(true, false));
}
handleOnDelete(itemLayer: IItemLayer) {
this.store.dispatch(new mapActions.RemoveLayer(itemLayer));
}
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));
}
handleZoomToExtent(itemLayer: IItemLayer) {
var extent = createEmpty();
extend(extent, itemLayer.layer.getExtent());
if (extent) {
this.store.dispatch(new mapActions.SetExtent(extent));
}
}
handleSelectBaseLayer(itemLayer: IItemLayer) {
this.store.dispatch(new mapActions.SelectBaseLayer(itemLayer));
}
handleSelectOverlayLayer(itemLayer: IItemLayer) {
this.store.dispatch(new mapActions.SelectOverlayLayer(itemLayer));
}
ngOnDestroy() {
if (this.paramSub) this.paramSub.unsubscribe();
if (this.itemTypeSub) this.itemTypeSub.unsubscribe();
if (this.stateSub) this.stateSub.unsubscribe();
if (this.queryStateSub) this.queryStateSub.unsubscribe();
if (this.querySub) this.querySub.unsubscribe();
}
}

View File

@@ -1,61 +1,61 @@
import { Component, Output, ViewChild, EventEmitter, Input, ElementRef, HostListener } from '@angular/core'; import { Component, Output, ViewChild, EventEmitter, Input, ElementRef, HostListener } from '@angular/core';
import { FormGroup,FormBuilder, Validators } from '@angular/forms'; import { FormGroup,FormBuilder, Validators } from '@angular/forms';
import { IListItem } from '@farmmaps/common'; import { IListItem } from '@farmmaps/common';
import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component'; import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component';
import {NgbModal, NgbModalRef} from "@ng-bootstrap/ng-bootstrap"; import {NgbModal, NgbModalRef} from "@ng-bootstrap/ng-bootstrap";
export interface IMetaData { export interface IMetaData {
droppedFile: IDroppedFile, droppedFile: IDroppedFile,
attributes: any attributes: any
} }
@Component({ @Component({
selector: 'fm-map-meta-data-modal', selector: 'fm-map-meta-data-modal',
templateUrl: 'meta-data-modal.component.html' templateUrl: 'meta-data-modal.component.html'
}) })
export class MetaDataModalComponent { export class MetaDataModalComponent {
private modalName: string = 'metaDataModal'; private modalName: string = 'metaDataModal';
private modalRef: NgbModalRef; private modalRef: NgbModalRef;
@ViewChild('content') _templateModal:ElementRef; @ViewChild('content', { static: true }) _templateModal:ElementRef;
@Input() droppedFile: IDroppedFile; @Input() droppedFile: IDroppedFile;
@Input() set modalState(_modalState:any) {; @Input() set modalState(_modalState:any) {;
if(_modalState == this.modalName) { if(_modalState == this.modalName) {
this.openModal() this.openModal()
} else if(this.modalRef) { } else if(this.modalRef) {
this.closeModal(); this.closeModal();
} }
} }
@Input() event: IListItem; @Input() event: IListItem;
@Output() onCloseModal = new EventEmitter<any>(); @Output() onCloseModal = new EventEmitter<any>();
@Output() onAddFilesWithMetaData = new EventEmitter<IMetaData>(); @Output() onAddFilesWithMetaData = new EventEmitter<IMetaData>();
constructor(private modalService: NgbModal, public fb: FormBuilder) { } constructor(private modalService: NgbModal, public fb: FormBuilder) { }
public metaDataForm: FormGroup; public metaDataForm: FormGroup;
handleMetaDataEntered(event) { handleMetaDataEntered(event) {
if (this.metaDataForm.valid) { if (this.metaDataForm.valid) {
this.onAddFilesWithMetaData.emit({ droppedFile: this.droppedFile, attributes: { name: this.metaDataForm.value.name } }); this.onAddFilesWithMetaData.emit({ droppedFile: this.droppedFile, attributes: { name: this.metaDataForm.value.name } });
} }
} }
openModal() { openModal() {
//Timeout trick to avoid ExpressionChangedAfterItHasBeenCheckedError //Timeout trick to avoid ExpressionChangedAfterItHasBeenCheckedError
setTimeout(() => this.modalRef = this.modalService.open(this._templateModal, { backdrop: 'static', keyboard: false })); setTimeout(() => this.modalRef = this.modalService.open(this._templateModal, { backdrop: 'static', keyboard: false }));
} }
closeModal() { closeModal() {
this.modalRef.close(); this.modalRef.close();
this.metaDataForm.patchValue({ name: "" }); this.metaDataForm.patchValue({ name: "" });
} }
ngOnInit(): void { ngOnInit(): void {
this.metaDataForm = this.fb.group({ this.metaDataForm = this.fb.group({
name: ["", Validators.compose([Validators.required, Validators.pattern("[a-zA-Z0-9_].*")])] name: ["", Validators.compose([Validators.required, Validators.pattern("[a-zA-Z0-9_].*")])]
}); });
} }
} }

View File

@@ -1,31 +1,31 @@
<ng-template #content let-c="close" let-d="dismiss"> <ng-template #content let-c="close" let-d="dismiss">
<div class="modal-header"> <div class="modal-header">
<h4 class="modal-title" i18n>Select period</h4> <h4 class="modal-title" i18n>Select period</h4>
<button type="button" class="close" aria-label="Close" (click)="d('Cross click'); onCloseModal.emit()"> <button type="button" class="close" aria-label="Close" (click)="d('Cross click'); onCloseModal.emit()">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<ngb-datepicker #dp ngModel (ngModelChange)="onDateChange($event)" [displayMonths]="2" [dayTemplate]="t"> <ngb-datepicker #dp ngModel (ngModelChange)="onDateChange($event)" [displayMonths]="2" [dayTemplate]="t">
</ngb-datepicker> </ngb-datepicker>
<ng-template #t let-date="date" let-focused="focused"> <ng-template #t let-date="date" let-focused="focused">
<span class="custom-day" <span class="custom-day"
[class.focused]="focused" [class.focused]="focused"
[class.range]="isFrom(date) || isTo(date) || isInside(date) || isHovered(date)" [class.range]="isFrom(date) || isTo(date) || isInside(date) || isHovered(date)"
[class.faded]="isHovered(date) || isInside(date)" [class.faded]="isHovered(date) || isInside(date)"
(mouseenter)="hoveredDate = date" (mouseenter)="hoveredDate = date"
(mouseleave)="hoveredDate = null"> (mouseleave)="hoveredDate = null">
{{ date.day }} {{ date.day }}
</span> </span>
</ng-template> </ng-template>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="submit" class="btn btn-primary" (click)="handleSelect($event)" i18n>Select</button> <button type="submit" class="btn btn-primary" (click)="handleSelect($event)" i18n>Select</button>
<button type="button" class="btn btn-secondary" (click)="c('Close click'); onCloseModal.emit()" i18n>Close</button> <button type="button" class="btn btn-secondary" (click)="c('Close click'); onCloseModal.emit()" i18n="@@buttonClose">Close</button>
</div> </div>
</ng-template> </ng-template>

View File

@@ -1,20 +1,25 @@
.custom-day { .custom-day {
text-align: center; text-align: center;
padding: 0.185rem 0.25rem; padding: 0.185rem 0.25rem;
display: inline-block; display: inline-block;
height: 2rem; height: 2rem;
width: 2rem; width: 2rem;
} }
.custom-day.focused { .custom-day.focused {
background-color: #e6e6e6; background-color: #e6e6e6;
} }
.custom-day.range, .custom-day:hover { .custom-day.range, .custom-day:hover {
background-color: rgb(2, 117, 216); background-color: rgb(2, 117, 216);
color: white; color: white;
} }
.custom-day.faded { .custom-day.faded {
background-color: rgba(2, 117, 216, 0.5); background-color: rgba(2, 117, 216, 0.5);
} }
ngb-datepicker {
overflow: hidden;
max-width: calc(100vw - 3em);
}

View File

@@ -1,93 +1,93 @@
import { Component, Output, ViewChild, EventEmitter, Input, ElementRef, HostListener } from '@angular/core'; import { Component, Output, ViewChild, EventEmitter, Input, ElementRef, HostListener } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { NgbModal, NgbModalRef, NgbDateStruct, NgbCalendar, NgbDateAdapter } from "@ng-bootstrap/ng-bootstrap"; import { NgbModal, NgbModalRef, NgbDateStruct, NgbCalendar, NgbDateAdapter } from "@ng-bootstrap/ng-bootstrap";
import { NgbDateNativeAdapter } from '@farmmaps/common'; import { NgbDateNativeAdapter } from '@farmmaps/common';
const equals = (one: NgbDateStruct, two: NgbDateStruct) => const equals = (one: NgbDateStruct, two: NgbDateStruct) =>
one && two && two.year === one.year && two.month === one.month && two.day === one.day; one && two && two.year === one.year && two.month === one.month && two.day === one.day;
const before = (one: NgbDateStruct, two: NgbDateStruct) => const before = (one: NgbDateStruct, two: NgbDateStruct) =>
!one || !two ? false : one.year === two.year ? one.month === two.month ? one.day === two.day !one || !two ? false : one.year === two.year ? one.month === two.month ? one.day === two.day
? false : one.day < two.day : one.month < two.month : one.year < two.year; ? false : one.day < two.day : one.month < two.month : one.year < two.year;
const after = (one: NgbDateStruct, two: NgbDateStruct) => const after = (one: NgbDateStruct, two: NgbDateStruct) =>
!one || !two ? false : one.year === two.year ? one.month === two.month ? one.day === two.day !one || !two ? false : one.year === two.year ? one.month === two.month ? one.day === two.day
? false : one.day > two.day : one.month > two.month : one.year > two.year; ? false : one.day > two.day : one.month > two.month : one.year > two.year;
@Component({ @Component({
selector: 'fm-map-select-period-modal', selector: 'fm-map-select-period-modal',
templateUrl: 'select-period-modal.component.html', templateUrl: 'select-period-modal.component.html',
styleUrls: ['select-period-modal.component.scss'] styleUrls: ['select-period-modal.component.scss']
}) })
export class SelectPeriodModalComponent { export class SelectPeriodModalComponent {
private modalName: string = 'selectPeriodModal'; private modalName: string = 'selectPeriodModal';
private modalRef: NgbModalRef; private modalRef: NgbModalRef;
private dateAdapter = new NgbDateNativeAdapter(); private dateAdapter = new NgbDateNativeAdapter();
hoveredDate: NgbDateStruct; hoveredDate: NgbDateStruct;
fromDate: NgbDateStruct; fromDate: NgbDateStruct;
toDate: NgbDateStruct; toDate: NgbDateStruct;
@ViewChild('content') _templateModal:ElementRef; @ViewChild('content', { static: true }) _templateModal:ElementRef;
@Input() set modalState(_modalState:any) {; @Input() set modalState(_modalState:any) {;
if(_modalState == this.modalName) { if(_modalState == this.modalName) {
this.openModal() this.openModal()
} else if(this.modalRef) { } else if(this.modalRef) {
this.closeModal(); this.closeModal();
} }
} }
@Input() set startDate(_modalState: Date) { @Input() set startDate(_modalState: Date) {
this.fromDate = this.dateAdapter.fromModel(_modalState); this.fromDate = this.dateAdapter.fromModel(_modalState);
} }
@Input() set endDate(_modalState: Date) { @Input() set endDate(_modalState: Date) {
var d = new Date(_modalState); var d = new Date(_modalState);
d.setDate(d.getDate() - 1); d.setDate(d.getDate() - 1);
this.toDate = this.dateAdapter.fromModel(d); this.toDate = this.dateAdapter.fromModel(d);
} }
@Output() onCloseModal = new EventEmitter<any>(); @Output() onCloseModal = new EventEmitter<any>();
@Output() onSelect = new EventEmitter<{ startDate: Date, endDate: Date }>(); @Output() onSelect = new EventEmitter<{ startDate: Date, endDate: Date }>();
constructor(private modalService: NgbModal, private calendar: NgbCalendar) { } constructor(private modalService: NgbModal, private calendar: NgbCalendar) { }
openModal() { openModal() {
//Timeout trick to avoid ExpressionChangedAfterItHasBeenCheckedError //Timeout trick to avoid ExpressionChangedAfterItHasBeenCheckedError
setTimeout(() => this.modalRef = this.modalService.open(this._templateModal, { backdrop: 'static', keyboard: false})); setTimeout(() => this.modalRef = this.modalService.open(this._templateModal, { backdrop: 'static', keyboard: false}));
} }
closeModal() { closeModal() {
this.modalRef.close(); this.modalRef.close();
} }
ngOnInit(): void { ngOnInit(): void {
} }
onDateChange(date: NgbDateStruct) { onDateChange(date: NgbDateStruct) {
if (!this.fromDate && !this.toDate) { if (!this.fromDate && !this.toDate) {
this.fromDate = date; this.fromDate = date;
} else if (this.fromDate && !this.toDate && after(date, this.fromDate)) { } else if (this.fromDate && !this.toDate && after(date, this.fromDate)) {
this.toDate = date; this.toDate = date;
} else { } else {
this.toDate = null; this.toDate = null;
this.fromDate = date; this.fromDate = date;
} }
} }
handleSelect(event:MouseEvent) { handleSelect(event:MouseEvent) {
event.preventDefault(); event.preventDefault();
if (this.fromDate && this.toDate && before(this.fromDate, this.toDate)) { if (this.fromDate && this.toDate && before(this.fromDate, this.toDate)) {
var endDate = new Date(this.dateAdapter.toModel(this.toDate)); var endDate = new Date(this.dateAdapter.toModel(this.toDate));
endDate.setDate(endDate.getDate() + 1); endDate.setDate(endDate.getDate() + 1);
this.onSelect.emit({startDate:this.dateAdapter.toModel(this.fromDate),endDate:endDate}) this.onSelect.emit({startDate:this.dateAdapter.toModel(this.fromDate),endDate:endDate})
} }
} }
isHovered = date => this.fromDate && !this.toDate && this.hoveredDate && after(date, this.fromDate) && before(date, this.hoveredDate); isHovered = date => this.fromDate && !this.toDate && this.hoveredDate && after(date, this.fromDate) && before(date, this.hoveredDate);
isInside = date => after(date, this.fromDate) && before(date, this.toDate); isInside = date => after(date, this.fromDate) && before(date, this.toDate);
isFrom = date => equals(date, this.fromDate); isFrom = date => equals(date, this.fromDate);
isTo = date => equals(date, this.toDate); isTo = date => equals(date, this.toDate);
} }

View File

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

View File

@@ -1,40 +1,77 @@
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core'; import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
import { IItem } from '@farmmaps/common'; import { IItem } from '@farmmaps/common';
import { AbstractSelectedItemComponent, SelectedItemComponent } from '../selected-item/selected-item.component'; import { AbstractSelectedItemComponent, SelectedItemComponent } from '../selected-item/selected-item.component';
import { WidgetHostDirective } from '../widget-host/widget-host.directive'; import { WidgetHostDirective } from '../widget-host/widget-host.directive';
import { IItemLayer } from '../../models/item.layer';
@Component({
selector: 'fm-map-selected-item-container', @Component({
templateUrl: './selected-item-container.component.html', selector: 'fm-map-selected-item-container',
styleUrls: ['./selected-item-container.component.scss'] templateUrl: './selected-item-container.component.html',
}) styleUrls: ['./selected-item-container.component.scss']
export class SelectedItemContainerComponent { })
export class SelectedItemContainerComponent {
constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractSelectedItemComponent) public selectedItemComponents: AbstractSelectedItemComponent[] ) {
} constructor(private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractSelectedItemComponent) public selectedItemComponents: AbstractSelectedItemComponent[] ) {
}
@Input() item: IItem;
@Input() item: IItem;
@ViewChild(WidgetHostDirective) widgetHost: WidgetHostDirective; @Input() parentItem: IItem;
@Input() itemLayer:IItemLayer;
loadComponent() { @Input() overlayLayers:Array<IItemLayer>;
var componentFactory: ComponentFactory<AbstractSelectedItemComponent> = this.componentFactoryResolver.resolveComponentFactory(SelectedItemComponent); // default
for (var i = 0; i < this.selectedItemComponents.length; i++) { @ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
if (this.selectedItemComponents[i]['forItemType'] == this.item.itemType) {
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.selectedItemComponents[i]['constructor'] as any); loadComponent() {
} let componentFactory: ComponentFactory<AbstractSelectedItemComponent> = this.componentFactoryResolver.resolveComponentFactory(SelectedItemComponent); // default
}
const viewContainerRef = this.widgetHost.viewContainerRef; let selected = -1;
viewContainerRef.clear(); let maxMatches =0;
let showItem = true;
const componentRef = viewContainerRef.createComponent(componentFactory); for (let i = 0; i < this.selectedItemComponents.length; i++) {
(<AbstractSelectedItemComponent>componentRef.instance).item = this.item; let matches=0;
} let criteria=0;
if (this.selectedItemComponents[i]['forItemType'] ) {
ngOnChanges(changes: SimpleChanges) { criteria++;
if (changes["item"] && changes["item"].currentValue) { if(this.selectedItemComponents[i]['forItemType'].indexOf(this.item.itemType) >= 0) {
this.loadComponent(); matches++;
} }
} }
} if (this.selectedItemComponents[i]['forSourceTask']) {
criteria++;
if( this.selectedItemComponents[i]['forSourceTask'].indexOf(this.item.sourceTask) >= 0) {
matches++;
}
}
if(criteria==matches && matches > maxMatches) {
selected=i;
maxMatches = matches;
}
}
if (selected >= 0) {
componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.selectedItemComponents[selected]['constructor'] as any);
}
const viewContainerRef = this.widgetHost.viewContainerRef;
viewContainerRef.clear();
const componentRef = viewContainerRef.createComponent(componentFactory);
(<AbstractSelectedItemComponent>componentRef.instance).item = this.item;
(<AbstractSelectedItemComponent>componentRef.instance).parentItem = this.parentItem;
(<AbstractSelectedItemComponent>componentRef.instance).itemLayer = this.itemLayer;
(<AbstractSelectedItemComponent>componentRef.instance).overlayLayers = this.overlayLayers;
}
ngOnChanges(changes: SimpleChanges) {
if (changes["item"] && changes["item"].currentValue) {
this.loadComponent();
}
if (changes["itemLayer"] && changes["itemLayer"].currentValue) {
this.loadComponent();
}
if (changes["overlayLayers"] && changes["overlayLayers"].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)"><i class="fa fa-pencil" aria-hidden="true" i18n-title title="Edit"></i>&nbsp;<span i18n>Edit</span></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

@@ -1,30 +1,63 @@
import { Component, Input, Injectable, OnInit } from '@angular/core'; import { Component, Input, Injectable, OnInit } from '@angular/core';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Feature } from 'ol'; import { Feature } from 'ol';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer'; import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common'; import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common';
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router'; import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
import { ForItemType } from '../for-item/for-itemtype.decorator'; import { ForItemType } from '../for-item/for-itemtype.decorator';
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component'; import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
import { Observable } from 'rxjs'; import { Observable,of } from 'rxjs';
import {GeoJSON} from 'ol/format';
import {getArea} from 'ol/sphere';
@ForItemType("vnd.farmmaps.itemtype.cropfield") import { withLatestFrom,switchMap,combineLatest } from 'rxjs/operators';
@Injectable()
@Component({
selector: 'fm-map-selected-item-cropfield', @ForItemType("vnd.farmmaps.itemtype.cropfield")
templateUrl: './selected-item-cropfield.component.html', @Injectable()
styleUrls: ['./selected-item-cropfield.component.scss'] @Component({
}) selector: 'fm-map-selected-item-cropfield',
export class SelectedItemCropfieldComponent extends AbstractSelectedItemComponent implements OnInit{ templateUrl: './selected-item-cropfield.component.html',
styleUrls: ['./selected-item-cropfield.component.scss']
public items: Observable<IListItem[]>; })
export class SelectedItemCropfieldComponent extends AbstractSelectedItemComponent implements OnInit{
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
super(store, itemTypeService,location,router); public items: Observable<IListItem[]>;
}
ngOnInit() { constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
this.items = this.folderService$.getItems(this.item.code, 0, 1000); 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() {
var childItems = this.folderService$.getItems(this.item.code, 0, 1000);
var atLocationItems = this.itemService$.getItemList(null,null,null,this.item.code,true);
this.items = childItems.pipe(
combineLatest(atLocationItems),
switchMap(([ci,ali]) => {
let retVal:IListItem[] = [];
let codes = {};
ci.forEach((listItem) => {
retVal.push(listItem);
codes[listItem.code]=listItem;
});
ali.forEach((atlocationitem) => {
let listItem = atlocationitem as IListItem;
let allowedItemTypes = "vnd.farmmaps.itemtype.device.senml"; // this is a hack
if(!codes[listItem.code] && allowedItemTypes.indexOf(listItem.itemType) >= 0) {
retVal.push(listItem);
}
});
return of(retVal);
}));
}
}

View File

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

View File

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

View File

@@ -1,30 +1,32 @@
import { Component, Input, Injectable, OnInit } from '@angular/core'; import { Component, Injectable } from '@angular/core';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Feature } from 'ol'; import { Store } from '@ngrx/store';
import { Store } from '@ngrx/store'; import * as mapReducers from '../../reducers/map.reducer';
import * as mapReducers from '../../reducers/map.reducer'; import { commonReducers, ItemTypeService, ItemService, FolderService } from '@farmmaps/common';
import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common'; import { Router } from '@angular/router';
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router'; import { ForItemType } from '../for-item/for-itemtype.decorator';
import { ForItemType } from '../for-item/for-itemtype.decorator'; import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component'; import * as mapActions from '../../actions/map.actions';
import { Observable } from 'rxjs';
@ForItemType("vnd.farmmaps.itemtype.geotiff.processed")
@ForItemType("vnd.farmmaps.itemtype.geotiff.processed") @Injectable()
@Injectable() @Component({
@Component({ selector: 'fm-map-selected-item-geotiff',
selector: 'fm-map-selected-item-geotiff', templateUrl: './selected-item-geotiff.component.html',
templateUrl: './selected-item-geotiff.component.html', styleUrls: ['./selected-item-geotiff.component.scss']
styleUrls: ['./selected-item-geotiff.component.scss'] })
}) export class SelectedItemGeotiffComponent extends AbstractSelectedItemComponent {
export class SelectedItemGeotiffComponent extends AbstractSelectedItemComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) { super(store, itemTypeService,location,router);
super(store, itemTypeService,location,router); }
}
public selectedLayer: number = 0; onLayerChanged(layerIndex: number) {
this.store.dispatch(new mapActions.SetLayerIndex(layerIndex));
onLayerChanged(layerIndex: number) { }
this.selectedLayer = layerIndex;
} layer(layers:any,layerIndex:number) {
} return layers.find(l => l.index == layerIndex);
}
}

View File

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

@@ -1,32 +1,35 @@
import { Component, Input, Injectable, OnInit } from '@angular/core'; import { Component, Input, Injectable, OnInit } from '@angular/core';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Feature } from 'ol'; import { Feature } from 'ol';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import * as mapReducers from '../../reducers/map.reducer'; import * as mapReducers from '../../reducers/map.reducer';
import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common'; import { commonReducers, ItemTypeService, IItem, Item, ItemService, FolderService, IListItem} from '@farmmaps/common';
import * as mapActions from '../../actions/map.actions'; import * as mapActions from '../../actions/map.actions';
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router'; import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router';
import { ForItemType } from '../for-item/for-itemtype.decorator'; import { ForItemType } from '../for-item/for-itemtype.decorator';
import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component'; import { AbstractSelectedItemComponent } from '../selected-item/selected-item.component';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
@ForItemType("vnd.farmmaps.itemtype.shape.processed") @ForItemType("vnd.farmmaps.itemtype.shape.processed")
@Injectable() @Injectable()
@Component({ @Component({
selector: 'fm-map-selected-item-shape', selector: 'fm-map-selected-item-shape',
templateUrl: './selected-item-shape.component.html', templateUrl: './selected-item-shape.component.html',
styleUrls: ['./selected-item-shape.component.scss'] styleUrls: ['./selected-item-shape.component.scss']
}) })
export class SelectedItemShapeComponent extends AbstractSelectedItemComponent { export class SelectedItemShapeComponent extends AbstractSelectedItemComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) { constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, private itemService$: ItemService,private folderService$: FolderService) {
super(store, itemTypeService,location,router); super(store, itemTypeService,location,router);
} }
public selectedLayer: number = 0; 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,48 @@
<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">
<h2 *ngIf="parentItem">{{parentItem.name}}</h2>
<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)">
<i class="fa fa-arrow-circle-left" aria-hidden="true" i18n-title title="Previous"></i>&nbsp;{{ previousDate() | date:'shortDate'}}
</button>
</div>
<div *ngIf="hasNext()">
<button type="button" class="btn btn-link p-0" (click)="handleNextTemporal($event)">
{{ nextDate()| date:'shortDate' }}&nbsp;<i class="fa fa-arrow-circle-right" aria-hidden="true" i18n-title 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)">
<option *ngFor="let l of layers;" [value]="l.index" [selected]="itemLayer.layerIndex == l.index">{{l.name}}</option>
</select>
</div>
<fm-map-layer-legend [showTitle]="layers.length == 1"
[layer]="layer(layers,itemLayer.layerIndex)" [histogramenabled]="true"></fm-map-layer-legend>
</div>
</div>
<div class="card menu-card">
<ul class="p-0 mt-2">
<li *ngIf="item.isEditable"><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)"><i class="fa fa-pencil" aria-hidden="true" i18n-title title="Edit"></i>&nbsp;<span i18n>Edit</span></a></li>
<ng-container *ngIf="itemTypeService.isLayer(item)">
<li *ngIf="!getItemLayer(item,itemLayer.layerIndex)"><a href="#" (click)="handleAddAsLayer(item,itemLayer.layerIndex)"><i class="fa fa-eye" aria-hidden="true" i18n-title title="Add as layer"></i>&nbsp;<span i18n>Add as overlay</span></a></li>
<li *ngIf="getItemLayer(item,itemLayer.layerIndex)"><a href="#" (click)="handleRemoveLayer(item,itemLayer.layerIndex)"><i class="fa fa-eye" aria-hidden="true" i18n-title title="Remove overlay"></i>&nbsp;<span i18n>Remove overlay</span></a></li>
</ng-container>
<li><a href="#" (click)="handleGoToChart(item)"><i class="fa fa-line-chart" aria-hidden="true" i18m-title title="Show chart"></i>&nbsp;<span i18n>Show chart</span></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 new Date(Date.parse(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 new Date(Date.parse(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, new Date(Date.parse(item.dataDate)).getUTCFullYear()]);
return false;
}
}

View File

@@ -1,16 +1,24 @@
<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]="getThumbnailUrl(item)" />
<div *ngIf="!item.thumbnail" class="big-icon" [style.background-color]="itemTypeService.getColor(item.itemType)"> <div *ngIf="!item.thumbnail" class="big-icon" [style.background-color]="itemTypeService.getColor(item.itemType)">
<i [ngClass]="itemTypeService.getIcon(item.itemType)"></i> <i [ngClass]="itemTypeService.getIcon(item.itemType)"></i>
</div> </div>
<div class="card-body"> </div>
<div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div> <div class="card">
<h1 class="card-title">{{item.name}}</h1> <div class="card-body">
<a *ngIf="itemTypeService.hasViewer(item)" href="#" (click)="handleOnView(item)" class="btn btn-outline-secondary" i18n><i class="fa fa-eye" aria-hidden="true" title="View"></i> View</a> <div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
<a href="/api/v1/items/{{item.code}}/data" class="btn btn-outline-secondary" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a> <h1 class="card-title">{{item.name}}</h1>
<a href="#" class="btn btn-outline-secondary" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a> <div class="card menu-card">
<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> <ul class="p-0 mt-2">
</div> <li *ngIf="itemTypeService.hasViewer(item)"><a href="#" (click)="handleOnView(item)" class="btn btn-outline-secondary"><i class="fa fa-eye" aria-hidden="true" title="View"></i>&nbsp;<span i18n>View</span></a></li>
</div> <li *ngIf="item.isEditable"><a href="#" (click)="handleOnEdit(item)"><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> <span i18n>Edit</span></a></li>
</div> <ng-container *ngIf="itemTypeService.isLayer(item)">
<li *ngIf="!getItemLayer(item)"><a href="#" (click)="handleAddAsLayer(item)"><i class="fa fa-eye" aria-hidden="true" i18n-title title="Add as layer"></i>&nbsp;<span i18n>Add as overlay</span></a></li>
<li *ngIf="getItemLayer(item)"><a href="#" (click)="handleRemoveLayer(item)"><i class="fa fa-eye" aria-hidden="true" i18n-title title="Remove overlay"></i>&nbsp;<span i18n>Remove overlay</span></a></li>
</ng-container>
</ul>
</div>
</div>
</div>
</div>

View File

@@ -1,14 +1,29 @@
@import "../../theme.scss"; @import "~bootstrap/scss/bootstrap.scss";
@import "~bootstrap/scss/bootstrap.scss";
.big-icon {
.big-icon { width: 100%;
width: 100%; color: white;
color: white; font-size: 9rem;
font-size: 9rem; padding: 3rem;
padding: 3rem; text-align: center;
text-align: center; }
}
.card-title {
.card-title { font-size: 1rem;
font-size: 1rem; }
}
ul {
list-style:none;
}
li {
margin-top:1rem;
}
.menu-card {
margin-left: -7px;
padding-left: 7px;
margin-right: -7px;
padding-right: 7px;
margin-bottom: 7px;
}

View File

@@ -1,56 +1,82 @@
import { Component, Input, Injectable } from '@angular/core'; import {Component, Injectable, Input, Directive} from '@angular/core';
import { Location } from '@angular/common'; import {Location} from '@angular/common';
import { Feature } from 'ol'; import {Store} from '@ngrx/store';
import { Store } from '@ngrx/store'; import * as mapReducers from '../../reducers/map.reducer';
import * as mapReducers from '../../reducers/map.reducer'; import {AppConfig, commonReducers, IItem, ItemTypeService} from '@farmmaps/common';
import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common'; import * as mapActions from '../../actions/map.actions';
import * as mapActions from '../../actions/map.actions'; import {Router} from '@angular/router';
import { Router, ActivatedRoute, ParamMap, Event } from '@angular/router'; import { IItemLayer } from '../../models/item.layer';
@Injectable() @Injectable()
export abstract class AbstractSelectedItemComponent { @Directive()
@Input() item: IItem export abstract class AbstractSelectedItemComponent {
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location, private router: Router) { @Input() item: IItem;
} @Input() parentItem: IItem;
@Input() itemLayer: IItemLayer;
handleOnView(item: IItem) { @Input() overlayLayers: Array<IItemLayer>;
var itemType = this.itemTypeService.itemTypes[item.itemType]; constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location, public router: Router) {
if (itemType) { }
if (itemType.viewer) {
let url = `/viewer/${itemType.viewer}/item/${item.code}`; handleOnView(item: IItem) {
this.router.navigate([url]); if (this.itemTypeService.hasViewer(item)) {
} let viewer = this.itemTypeService.itemTypes[item.itemType].viewer;
} let url = `/viewer/${viewer}/item/${item.code}`;
return false; this.router.navigate([url]);
} }
return false;
handleOnEdit(item: IItem) { }
let url = `/editor/property/item/${item.code}`;
this.router.navigate([url]); handleOnEdit(item: IItem) {
return false; var editor = "property";
} if(this.itemTypeService.hasEditor(item)) {
editor = this.itemTypeService.itemTypes[item.itemType].editor;
handleAddAsLayer(item: IItem,layerIndex:number = -1) { }
this.store.dispatch(new mapActions.AddLayer(item,layerIndex)); let url = `/editor/${editor}/item/${item.code}`
return false; this.router.navigate([url]);
} return false;
}
handleBackToList(event: MouseEvent) {
event.preventDefault(); handleAddAsLayer(item: IItem,layerIndex:number = -1) {
this.location.back(); this.store.dispatch(new mapActions.AddLayer(item,layerIndex));
} return false;
} }
@Injectable() handleRemoveLayer(item: IItem,layerIndex:number = -1) {
@Component({ let itemLayer = this.getItemLayer(item,layerIndex);
selector: 'fm-map-selected-item', if(itemLayer) {
templateUrl: './selected-item.component.html', this.store.dispatch(new mapActions.RemoveLayer(itemLayer));
styleUrls: ['./selected-item.component.scss'] }
}) return false;
export class SelectedItemComponent extends AbstractSelectedItemComponent { }
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router) { getItemLayer(item:IItem,layerIndex:number = -1):IItemLayer {
super(store, itemTypeService,location,router); let li = layerIndex==-1?0:layerIndex;
} let selected = this.overlayLayers.filter(ol => ol.item.code == item.code && ol.layerIndex == li);
} if(selected.length==0) return null;
return selected[0];
}
handleBackToList(event: MouseEvent) {
event.preventDefault();
this.location.back();
}
}
@Injectable()
@Component({
selector: 'fm-map-selected-item',
templateUrl: './selected-item.component.html',
styleUrls: ['./selected-item.component.scss']
})
export class SelectedItemComponent extends AbstractSelectedItemComponent {
constructor(store: Store<mapReducers.State | commonReducers.State>, itemTypeService: ItemTypeService, location: Location, router: Router, public config:AppConfig) {
super(store, itemTypeService,location,router);
}
getThumbnailUrl(item:IItem):string {
return this.config.getConfig('apiEndPoint') +'/api/v1/items/'+item.code+'/thumbnail?v=' + Date.parse(item.updated);
}
}

View File

@@ -1,6 +1,6 @@
<div [ngSwitch]="stage"> <div [ngSwitch]="stage">
<h6 *ngSwitchCase="StageEnum.DevelopmentPreAlpha" style="color:darkred" [ngbTooltip]="info" i18n><b>Stage:Pre-alpha</b></h6> <h6 *ngSwitchCase="StageEnum.DevelopmentPreAlpha" style="color:darkred" [ngbTooltip]="info"><b><span i18n>Stage:Pre-alpha</span></b></h6>
<h6 *ngSwitchCase="StageEnum.DevelopmentAlpha" style="color:red" [ngbTooltip]="info" i18n><b>Stage:Alpha</b></h6> <h6 *ngSwitchCase="StageEnum.DevelopmentAlpha" style="color:red" [ngbTooltip]="info"><b><span i18n>Stage:Alpha</span></b></h6>
<h6 *ngSwitchCase="StageEnum.DevelopmentBeta" style="color:orange" [ngbTooltip]="info" i18n><b>Stage:Beta</b></h6> <h6 *ngSwitchCase="StageEnum.DevelopmentBeta" style="color:orange" [ngbTooltip]="info" ><b><span i18n>Stage:Beta</span></b></h6>
<h6 *ngSwitchCase="StageEnum.ReleaseCandidate" style="color:green" [ngbTooltip]="info" i18n><b>Stage:RC</b></h6> <h6 *ngSwitchCase="StageEnum.ReleaseCandidate" style="color:green" [ngbTooltip]="info" ><b><span i18n>Stage:RC</span></b></h6>
</div> </div>

View File

@@ -1,230 +1,309 @@
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, interval } from 'rxjs';
import { Observable , of } from 'rxjs'; import { withLatestFrom, switchMap, map, catchError, mergeMap,delayWhen } from 'rxjs/operators';
import { withLatestFrom, switchMap, map, catchError, mergeMap, delay} from 'rxjs/operators';
import {GeoJSON,WKT} from 'ol/format';
import {GeoJSON} from 'ol/format'; import {Feature} from 'ol';
import {Feature} from 'ol'; import { getCenter,createEmpty,extend } from 'ol/extent';
import { getCenter, Extent, createEmpty, extend} from 'ol/extent'; import {Point} from 'ol/geom'
import {Point} from 'ol/geom'
import * as mapActions from '../actions/map.actions';
import * as mapActions from '../actions/map.actions'; import * as mapReducers from '../reducers/map.reducer';
import * as mapReducers from '../reducers/map.reducer'; import {commonReducers} from '@farmmaps/common';
import {commonReducers} from '@farmmaps/common';
import {commonActions} from '@farmmaps/common';
import {commonActions} from '@farmmaps/common';
import { IItem } from '@farmmaps/common';
import { IListItem, IItem } from '@farmmaps/common'; import { FolderService, ItemService } from '@farmmaps/common';
import { FolderService, ItemService } from '@farmmaps/common'; import { tassign } from 'tassign';
import { tassign } from 'tassign';
import {FeatureIconService} from '../services/feature-icon.service';
@Injectable()
export class MapEffects { import * as style from 'ol/style';
private _format: GeoJSON;
import { ItemTypeService,IQueryState } from '@farmmaps/common';
private toPointFeature(feature: any): Feature {
var f = this._format.readFeature(feature);
var centroid = getCenter(f.getGeometry().getExtent()); @Injectable()
f.setGeometry(new Point(centroid)); export class MapEffects {
return f; private _geojsonFormat: GeoJSON;
} private _wktFormat: WKT;
@Effect() private toPointFeature(updateEvent:commonActions.DeviceUpdateEvent): Feature {
init$: Observable<Action> = this.actions$.pipe( var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
ofType(mapActions.INIT), dataProjection: 'EPSG:4326',
withLatestFrom(this.store$.select(commonReducers.selectGetRootItems)), featureProjection: 'EPSG:3857'
switchMap(([action, rootItems]) => { });
for (let rootItem of rootItems) { f.setId(updateEvent.itemCode);
if (rootItem.itemType == "UPLOADS_FOLDER") return of(new mapActions.SetParent(rootItem.code)); var centroid = getCenter(f.getGeometry().getExtent());
} f.setGeometry(new Point(centroid));
return []; return f;
} }
));
@Effect()
@Effect() init$: Observable<Action> = this.actions$.pipe(
initBaseLayers$: Observable<Action> = this.actions$.pipe( ofType(mapActions.INIT),
ofType(mapActions.INIT), withLatestFrom(this.store$.select(commonReducers.selectGetRootItems)),
withLatestFrom(this.store$.select(mapReducers.selectGetProjection)), switchMap(([action, rootItems]) => {
map(([action, projection]) => new mapActions.LoadBaseLayers(projection))); let actions=[];
for (let rootItem of rootItems) {
@Effect() if (rootItem.itemType == "UPLOADS_FOLDER") actions.push(new mapActions.SetParent(rootItem.code));
loadBaseLayers$: Observable<Action> = this.actions$.pipe( }
ofType(mapActions.LOADBASELAYERS), // initialize default feature styles
switchMap((action: mapActions.LoadBaseLayers) => { actions.push(new mapActions.SetStyle('file',new style.Style({
return this.itemService$.getItemList("vnd.farmmaps.itemtype.layer", { "isBaseLayer": true }).pipe( image: new style.Icon({
map((items: IItem[]) => new mapActions.LoadBaseLayersSuccess(items)), anchor: [0.5, 1],
catchError(error => of(new commonActions.Fail(error)))); scale: 0.05,
})); src: this.featureIconService$.getIconImageDataUrl("fa fa-file-o")
}),
@Effect() stroke: new style.Stroke({
initRootItems$: Observable<Action> = this.actions$.pipe( color: 'red',
ofType(commonActions.INITROOTSUCCESS), width: 1
map((action) => new mapActions.Init() }),
)); fill: new style.Fill({
color: 'rgba(0, 0, 255, 0.1)'
@Effect() })
startSearch$: Observable<Action> = this.actions$.pipe( })));
ofType(mapActions.STARTSEARCH), actions.push(new mapActions.SetStyle('selected',new style.Style({
switchMap((action: mapActions.StartSearch) => { image: new style.Icon({
console.debug("Start search"); anchor: [0.5, 1],
var startDate = action.queryState.startDate; scale: 0.08,
var endDate = action.queryState.endDate; src: this.featureIconService$.getIconImageDataUrl(null)
var newAction; }),
if (action.queryState.itemCode || action.queryState.parentCode || action.queryState.itemType || action.queryState.query || action.queryState.tags) { stroke: new style.Stroke({
newAction= this.itemService$.getFeatures(action.queryState.bbox, "EPSG:3857", action.queryState.query, action.queryState.tags, startDate, endDate, action.queryState.itemType, action.queryState.parentCode).pipe( color: 'red',
switchMap((features: any) => { width: 3
for (let f of features.features) { }),
if (f.properties && f.properties["code"]) { fill: new style.Fill({
f.id = f.properties["code"]; color: 'rgba(0, 0, 255, 0.1)'
} })
} })));
return of(new mapActions.StartSearchSuccess(this._format.readFeatures(features), action.queryState));
} return actions;
), }
catchError(error => of(new commonActions.Fail(error)))); ));
} else {
newAction= of(new commonActions.Escape(true,false)); @Effect()
} initBaseLayers$: Observable<Action> = this.actions$.pipe(
return newAction; ofType(mapActions.INIT),
})); withLatestFrom(this.store$.select(mapReducers.selectGetProjection)),
map(([action, projection]) => new mapActions.LoadBaseLayers(projection)));
@Effect() @Effect()
startSearchSucces$: Observable<Action> = this.actions$.pipe( loadBaseLayers$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.STARTSEARCHSUCCESS), ofType(mapActions.LOADBASELAYERS),
mergeMap((action: mapActions.StartSearchSuccess) => { switchMap((action: mapActions.LoadBaseLayers) => {
if (action.query.bboxFilter) { return this.itemService$.getItemList("vnd.farmmaps.itemtype.layer", { "isBaseLayer": true }).pipe(
return []; map((items: IItem[]) => new mapActions.LoadBaseLayersSuccess(items)),
} else { catchError(error => of(new commonActions.Fail(error))));
var extent = createEmpty(); }));
if (extent) { @Effect()
for (let f of action.features) { initRootItems$: Observable<Action> = this.actions$.pipe(
extend(extent, (f as Feature).getGeometry().getExtent()); ofType(commonActions.INITROOTSUCCESS),
} map((action) => new mapActions.Init()
} ));
//return [];
return of(new mapActions.SetExtent(extent)); @Effect()
} startSearch$: Observable<Action> = this.actions$.pipe(
})); ofType(mapActions.STARTSEARCH),
withLatestFrom(this.store$.select(mapReducers.selectgetSetStateCount)),
@Effect() switchMap(([action,setStateCount]) => {
selectItem$: Observable<Action> = this.actions$.pipe( let a = action as mapActions.StartSearch;
ofType(mapActions.SELECTITEM), var startDate = a.queryState.startDate;
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)), var endDate = a.queryState.endDate;
switchMap(([action, selectedItem]) => { var newAction:Observable<Action>;
let a = action as mapActions.SelectItem; if (a.queryState.itemCode || a.queryState.parentCode || a.queryState.itemType || a.queryState.query || a.queryState.tags) {
let itemCode = selectedItem ? selectedItem.code : ""; newAction= this.itemService$.getFeatures(a.queryState.bbox, "EPSG:3857", a.queryState.query, a.queryState.tags, startDate, endDate, a.queryState.itemType, a.queryState.parentCode).pipe(
if (a.itemCode != itemCode) { switchMap((features: any) => {
return this.itemService$.getItem(a.itemCode).pipe( for (let f of features.features) {
map((item: IItem) => new mapActions.SelectItemSuccess(item)), if (f.properties && f.properties["code"]) {
catchError(error => of(new commonActions.Fail(error)))) f.id = f.properties["code"];
} else { }
return []; }
} return of(new mapActions.StartSearchSuccess(this._geojsonFormat.readFeatures(features), a.queryState,setStateCount));
} }
)); ),
catchError(error => of(new commonActions.Fail(error))));
@Effect() } else {
selectItemSuccess$: Observable<Action> = this.actions$.pipe( return [];
ofType(mapActions.SELECTITEMSUCCESS), }
switchMap((action:mapActions.SelectItemSuccess) => { return newAction;
return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe( }));
map((feature: IItem) => new mapActions.AddFeatureSuccess(this._format.readFeature(feature) )),
catchError(error => of(new commonActions.Fail(error))));
} @Effect()
)); zoomToExtent$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.STARTSEARCHSUCCESS),
@Effect() delayWhen(action => (action as mapActions.StartSearchSuccess).setStateCount == 1 ? interval(500):interval(0)),
uploadedItemClick$: Observable<Action> = this.actions$.pipe( mergeMap((action: mapActions.StartSearchSuccess) => {
ofType(commonActions.UPLOADEDFILECLICK), let actions =[];
switchMap((action: commonActions.UploadedFileClick) => of(new mapActions.DoQuery(tassign(mapReducers.initialState.query, {itemCode:action.itemCode}))) actions.push(new commonActions.SetMenuVisible(false));
)); let extent = createEmpty();
if (!action.query.bboxFilter) {
//@Effect() if (extent) {
//itemAdded$: Observable<Action> = this.actions$.pipe( for (let f of action.features) {
// ofType(commonActions.ITEMADDEDEVENT), extend(extent, (f as Feature).getGeometry().getExtent());
// withLatestFrom(this.store$.select(mapReducers.selectGetParentCode)), }
// mergeMap(([action, parentCode]) => { if(action.features && action.features.length >0) {
// let itemAddedAction = action as commonActions.ItemAddedEvent; actions.push(new mapActions.SetExtent(extent));
// if (parentCode && itemAddedAction.attributes["parentCode"] == parentCode) { }
// return this.itemService$.getFeature(itemAddedAction.itemCode,"EPSG:3857").pipe( }
// map((feature: Feature) => new mapActions.AddFeatureSuccess(this.toPointFeature(feature))), }
// catchError(error => of(new commonActions.Fail(error)))) return actions;
// } else }));
// return [
// ]; @Effect()
// })); hideMenu$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.STARTSEARCHSUCCESS),
@Effect() mergeMap((action: mapActions.StartSearchSuccess) => {
featureUpdate$: Observable<Action> = this.actions$.pipe( return of(new commonActions.SetMenuVisible(false));
ofType(commonActions.ITEMCHANGEDEVENT), }));
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
mergeMap(([action, features]) => { @Effect()
let itemChangedAction = action as commonActions.ItemChangedEvent; selectItem$: Observable<Action> = this.actions$.pipe(
var feature: Feature = null; ofType(mapActions.SELECTITEM),
for (let f of features) { withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
if (f.get("code") == itemChangedAction.itemCode) { withLatestFrom(this.store$.select(mapReducers.getSetStateCount)),
feature = f; switchMap(([[action, selectedItem],setStateCount]) => {
break; let a = action as mapActions.SelectItem;
} let itemCode = selectedItem ? selectedItem.code : "";
} if (a.itemCode != itemCode || setStateCount == 1) {
if (feature) { return this.itemService$.getItem(a.itemCode).pipe(
return this.itemService$.getFeature(itemChangedAction.itemCode, "EPSG:3857").pipe( switchMap(child => {
map((feature: any) => new mapActions.UpdateFeatureSuccess(this.toPointFeature(feature))), return this.itemService$.getItem(child.parentCode)
catchError(error => of(new commonActions.Fail(error)))); .pipe(map(parent => {
} else { return {child, parent};
return []; }),catchError(() => { let parent:IItem = null;return of({child,parent})})
} );
})); }),
map(data => new mapActions.SelectItemSuccess(data.child, data.parent)),
@Effect() catchError(error => of(new commonActions.Fail(error))))
itemUpdate$: Observable<Action> = this.actions$.pipe( } else {
ofType(commonActions.ITEMCHANGEDEVENT), return [];
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)), }
mergeMap(([action, selectedItem]) => { }
let itemChangedAction = action as commonActions.ItemChangedEvent; ));
if (selectedItem && selectedItem.code == itemChangedAction.itemCode) {
return this.itemService$.getItem(itemChangedAction.itemCode).pipe( @Effect()
map((item: IItem) => new mapActions.SelectItemSuccess(item)), selectItemSuccess$: Observable<Action> = this.actions$.pipe(
catchError(error => of(new commonActions.Fail(error)))); ofType(mapActions.SELECTITEMSUCCESS),
} else { switchMap((action:mapActions.SelectItemSuccess) => {
return []; return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe(
} map((feature: any) => {
})); let f = this._geojsonFormat.readFeature(feature);
f.setId(action.item.code);
@Effect() return new mapActions.AddFeatureSuccess(f );
setQueryState$: Observable<Action> = this.actions$.pipe( }),
ofType(mapActions.SETQUERYSTATE), catchError(error => of(new commonActions.Fail(error))));
switchMap((action: mapActions.SetQueryState) => { }
var newAction:Action; ));
if (action.queryState.itemCode && action.queryState.itemCode != "") {
newAction= new mapActions.SelectItem(action.queryState.itemCode); @Effect()
} else { selectItemSuccessTemporal$: Observable<Action> = this.actions$.pipe(
newAction= new mapActions.StartSearch(action.queryState); ofType(mapActions.SELECTITEMSUCCESS),
} switchMap((action:mapActions.SelectItemSuccess) => {
return of(newAction); if(action.item.itemType == "vnd.farmmaps.itemtype.temporal") {
})); return this.itemService$.getChildItemList(action.item.code,null).pipe(
map(items => new mapActions.SelectTemporalItemsSuccess(
@Effect() items.sort((a, b) =>
setState$: Observable<Action> = this.actions$.pipe( -(Date.parse(b.dataDate) - Date.parse(a.dataDate))
ofType(mapActions.SETSTATE), )
switchMap((action: mapActions.SetState) => { )),
var newAction:Action; catchError(error => of(new commonActions.Fail(error))));
if (action.queryState.itemCode && action.queryState.itemCode != "") { } else {
newAction= new mapActions.SelectItem(action.queryState.itemCode); return [];
} else { }
newAction= new mapActions.StartSearch(action.queryState); }
} ));
return of(newAction);
})); @Effect()
uploadedItemClick$: Observable<Action> = this.actions$.pipe(
constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService) { ofType(commonActions.UPLOADEDFILECLICK),
this._format = new GeoJSON(); switchMap((action: commonActions.UploadedFileClick) => of(new mapActions.DoQuery(tassign(mapReducers.initialState.query, {itemCode:action.itemCode})))
} ));
}
@Effect()
featureUpdate$: Observable<Action> = this.actions$.pipe(
ofType(commonActions.DEVICEUPDATEEVENT),
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
mergeMap(([action, features]) => {
let deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent;
var feature: Feature = null;
for (let f of features) {
if (f.getId() == deviceUpdateEventAction.itemCode) {
feature = f;
break;
}
}
if (feature) {
return of(new mapActions.UpdateFeatureSuccess(this.toPointFeature(deviceUpdateEventAction)));
} else {
return [];
}
}));
@Effect()
itemUpdate$: Observable<Action> = this.actions$.pipe(
ofType(commonActions.ITEMCHANGEDEVENT),
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
mergeMap(([action, selectedItem]) => {
let itemChangedAction = action as commonActions.ItemChangedEvent;
if (selectedItem && selectedItem.code == itemChangedAction.itemCode) {
return this.itemService$.getItem(itemChangedAction.itemCode).pipe(
switchMap(child => {
return this.itemService$.getItem(child.parentCode)
.pipe(map(parent => {
return {child, parent};
})
);
}),
map(data => new mapActions.SelectItemSuccess(data.child, data.parent)),
catchError(error => of(new commonActions.Fail(error))));
} else {
return [];
}
}));
getActionFromQueryState(queryState:IQueryState, inSearch:boolean):Observable<Action>|[] {
if(!inSearch && (queryState.itemType || queryState.parentCode || queryState.itemCode || queryState.query || queryState.tags)) {
var newAction:Action;
if (queryState.itemCode && queryState.itemCode != "") {
newAction= new mapActions.SelectItem(queryState.itemCode);
} else {
newAction= new mapActions.StartSearch(queryState);
}
return of(newAction);
} else {
return of(new commonActions.Escape(true,false));
}
}
@Effect()
setQueryState$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.SETQUERYSTATE),
withLatestFrom(this.store$.select(mapReducers.selectGetInSearch)),
switchMap(([action,inSearch]) => {
let a = action as mapActions.SetQueryState;
return this.getActionFromQueryState(a.queryState,inSearch);
}));
@Effect()
setState$: Observable<Action> = this.actions$.pipe(
ofType(mapActions.SETSTATE),
withLatestFrom(this.store$.select(mapReducers.selectGetInSearch)),
switchMap(([action,inSearch]) => {
let a = action as mapActions.SetState;
return this.getActionFromQueryState(a.queryState,inSearch);
}));
constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService) {
this._geojsonFormat = new GeoJSON();
this._wktFormat = new WKT();
}
}

View File

@@ -1,69 +1,94 @@
export interface IColor { import { IDataLayer } from '@farmmaps/common';
red: number,
green: number, export interface IColor {
blue: number, red: number,
alpha: number, green: number,
} blue: number,
alpha: number,
export interface IColorEntry { }
value: number,
color: IColor export interface IColorEntry {
} value: number,
color: IColor,
export interface IHistogramEntry { label: string
value: number, }
freqency: number
} export interface IHistogramEntry {
value: number,
export interface IHistogram { freqency: number
min: number, }
max: number,
mean: number, export interface IHistogram {
stddev: number, min: number,
classes: number, max: number,
entries: IHistogramEntry[] mean: number,
} stddev: number,
classes: number,
export interface IGradientstop { entries: IHistogramEntry[],
relativestop: number, confidence?: number;
color: IColor }
}
export interface IStatistics {
export interface IColorMap { min: number;
gradient: IGradientstop[], max: number;
noValue: IColorEntry, mean: number;
entries: IColorEntry[] stddev: number;
} populationCount: number;
minPlus: number;
export interface IBand { maxMinus: number;
histogram: IHistogram mode: number;
} median: number;
curtosis: number;
skewness: number;
export interface IRenderer { variance: number;
band:IBand, variationCoefficient: number;
colorMap: IColorMap confidenceIntervalErrorMargin: number;
} confidenceIntervalLow: number;
confidenceIntervalHigh: number;
export interface IRenderoutput { }
renderoutputType: string
} export interface IGradientstop {
relativestop: number,
export interface IRenderoutputTiles { color: IColor
renderoutputType: string, }
minzoom: number,
maxzoom: number export interface IColorMap {
} gradient: IGradientstop[],
noValue: IColorEntry,
export interface IRenderoutputImage { entries: IColorEntry[],
renderoutputType: string, colormapType: string
extent: [number,number,number,number] }
}
export interface IBand {
export interface ILayer { histogram: IHistogram;
name: string, statistics: IStatistics;
unit: string, }
index: number,
renderer: IRenderer,
rendering: IRenderoutput export interface IRenderer {
} band:IBand,
colorMap: IColorMap,
renderType:string
}
export interface IRenderoutput {
renderoutputType: string
}
export interface IRenderoutputTiles {
renderoutputType: string,
minzoom: number,
maxzoom: number
}
export interface IRenderoutputImage {
renderoutputType: string,
extent: [number,number,number,number]
}
export interface ILayer extends IDataLayer {
renderer: IRenderer,
rendering: IRenderoutput,
minzoom: number,
maxzoom: number
}

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,26 +1,50 @@
import { IItem } from '@farmmaps/common'; import { IItem,IListItem } from '@farmmaps/common';
import {Layer} from 'ol/layer'; import {Layer} from 'ol/layer';
export interface IItemLayer { export interface IItemLayer {
item: IItem, item: IItem,
layer: Layer, layer: Layer,
visible: boolean, visible: boolean,
legendVisible:boolean, legendVisible:boolean,
projection: string, projection: string,
opacity: number, opacity: number,
layerIndex:number layerIndex:number
} }
export class ItemLayer implements IItemLayer { export class ItemLayer implements IItemLayer {
public item: IItem; public item: IItem;
public layer: Layer = null; public layer: Layer = null;
public visible: boolean = true; public visible: boolean = true;
public legendVisible: boolean = false; public legendVisible: boolean = false;
public projection: string; public projection: string;
public opacity: number = 1; public opacity: number = 1;
public layerIndex: number = -1; public layerIndex: number = -1;
constructor(item:IItem) { constructor(item:IItem,opacity:number = 1, visible:boolean = true,layerIndex:number=-1) {
this.item = item; this.item = item;
} this.opacity = opacity;
} this.visible = visible;
this.layerIndex = layerIndex;
}
}
export interface ITemporalItemLayer extends IItemLayer {
previousItemLayer: IItemLayer,
selectedItemLayer: IItemLayer,
nextItemLayer: IItemLayer,
temporalItems: IItem[],
}
export class TemporalItemLayer extends ItemLayer implements ITemporalItemLayer {
public previousItemLayer:IItemLayer = null;
public selectedItemLayer:IItemLayer =null;
public nextItemLayer:IItemLayer = null;
public temporalItems:IItem[] = [];
constructor(item:IItem,opacity:number = 1, visible:boolean = true) {
super(item,opacity,visible)
}
}

View File

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

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