Compare commits

...

203 Commits

Author SHA1 Message Date
Francesco Mangiacrapa 52ea4f5130 reverted to v3.6.0 2024-04-30 11:20:02 +02:00
Francesco Mangiacrapa 66d1baa4ee just to rebuild v3.6.0-SNAPSHOT 2024-04-30 11:13:10 +02:00
Francesco Mangiacrapa 8a3c4437a0 just to rebuild the SNAPSHOT 2024-04-30 11:10:54 +02:00
Francesco Mangiacrapa 8cf6d178b1 geoportal-data-mapper range updated at [1.0.1-SNAPSHOT, 2.0.0-SNAPSHOT) 2023-09-14 16:41:58 +02:00
Francesco Mangiacrapa 0733a62801 removed -SNAPSHOT 2023-09-11 15:08:50 +02:00
Francesco Mangiacrapa dea11a7b95 Merge pull request 'feature_25598' (!17) from feature_25598 into master
Reviewed-on: #17
2023-09-11 15:06:52 +02:00
Francesco Mangiacrapa b3555f4d98 improved CSS 2023-09-11 11:21:02 +02:00
Francesco Mangiacrapa eb92bc685c added -SNAPSHOT 2023-09-11 10:55:34 +02:00
Francesco Mangiacrapa 3099a31e32 Showing basic statistics (i.e. "X project published") via
'countByPhase'method [#25598]
2023-09-11 10:48:34 +02:00
Francesco Mangiacrapa 5cef21b4f0 Update README 2023-09-06 17:15:42 +02:00
Francesco Mangiacrapa e94532f04f removed -SNAPSHOT to be released 2023-09-05 15:20:17 +02:00
Francesco Mangiacrapa b57091278e Merge pull request 'gui_optimization_25461' (!16) from gui_optimization_25461 into master
Reviewed-on: #16
2023-09-05 15:16:50 +02:00
Francesco Mangiacrapa 5cde386089 moved details-panel at z-index: 950. Required for screen < 900px in
width (e.g. tablet)
2023-09-04 11:16:40 +02:00
Francesco Mangiacrapa ba9c8aee78 Using the latest libraries version: gwt-ol.v8.4.1 (with
openlayers.v6.6.1) and gwt.v2.10
2023-08-31 17:21:15 +02:00
Francesco Mangiacrapa 8967184d3c Optimized the UI for screen size 1200x1200 2023-08-31 15:17:21 +02:00
Francesco Mangiacrapa 6338792427 UI optimized for less than 1600w screen resolution 2023-08-29 14:41:32 +02:00
Francesco Mangiacrapa 34f2ba4c7e Media with max-width 2048px the details-panel has width 530px 2023-07-31 12:37:31 +02:00
Francesco Mangiacrapa 6c5c584c0f bug fixing #25293 2023-07-31 12:15:06 +02:00
Francesco Mangiacrapa 4d87eaf5a2 Updated README 2023-07-25 11:36:59 +02:00
Francesco Mangiacrapa 1781488971 Update 'README.md' 2023-07-12 23:43:33 +02:00
Francesco Mangiacrapa a399dbb912 Updated README 2023-07-08 18:38:23 +02:00
Francesco Mangiacrapa dd056fdc9e Updated README 2023-07-08 18:37:50 +02:00
Francesco Mangiacrapa d0271d662c Updated README 2023-07-08 18:36:28 +02:00
Francesco Mangiacrapa d5f2bf9a67 Updated README 2023-07-08 18:35:59 +02:00
Francesco Mangiacrapa a6ac952994 removed -SNAPSHOT to be released 2023-06-15 11:57:14 +02:00
Francesco Mangiacrapa 7383b01aa9 Fixed an issue regarding the set Layer Style facility, #25066?#note-7.
Moved to -SNAPSHOT
2023-06-15 11:56:46 +02:00
Francesco Mangiacrapa 9d92b14378 removed -SNAPSHOT to be released 2023-06-09 13:55:13 +02:00
Francesco Mangiacrapa 23feb1a3c8 Setting initial layer opacity at 0.8 2023-06-09 13:54:45 +02:00
Francesco Mangiacrapa b7885b3b72 removed -SNAPSHOT to be released 2023-06-09 11:08:42 +02:00
Francesco Mangiacrapa 0093af4cdf Added -SNAPSHOT and maven-parent 1.2.0 2023-06-09 11:07:43 +02:00
Francesco Mangiacrapa 412878f323 Removed -SNAPSHOT to be released 2023-06-09 10:45:05 +02:00
Francesco Mangiacrapa bb33754558 Merge pull request 'task_25066' (!15) from task_25066 into master
Reviewed-on: #15
2023-06-09 10:37:45 +02:00
Francesco Mangiacrapa 3644685fe5 Improved search facility 2023-06-09 10:28:46 +02:00
Francesco Mangiacrapa 6361c1c0b9 #25074 cross-filtering completed 2023-06-08 17:03:42 +02:00
Francesco Mangiacrapa a7680ffb46 Added "Fit map to Extent" facility 2023-06-07 14:26:57 +02:00
Francesco Mangiacrapa 1002111ca8 Fixing label 2023-06-06 14:50:06 +02:00
Francesco Mangiacrapa f3e3ca5eb9 Updated label and css 2023-06-06 14:38:30 +02:00
Francesco Mangiacrapa e76448d10a Updated border radius 2023-06-06 12:04:25 +02:00
Francesco Mangiacrapa e73c3a0202 Improved CQL filtering. Now is working in combination with SEARCH and
CROSS_Filtering
2023-06-06 11:49:31 +02:00
Francesco Mangiacrapa a28d2433a0 Passing WFS requests from the servlet due to CORS issue, see
#25074?#note-7
2023-06-05 16:54:40 +02:00
Francesco Mangiacrapa 36bfcd2b9e Added WFS cross filtering results 2023-06-01 16:26:34 +02:00
Francesco Mangiacrapa dcca1afba1 fixed cross filtering select 2023-05-31 17:15:04 +02:00
Francesco Mangiacrapa 33d6dbc89f Applied CQL_Filter for cross filtering 2023-05-31 17:02:03 +02:00
Francesco Mangiacrapa 9d48e78fac in progress cross filtering 2023-05-26 17:49:59 +02:00
Francesco Mangiacrapa a208b37791 in progress cross-filtering 2023-05-26 14:45:47 +02:00
Francesco Mangiacrapa 16d9feffe0 Implement generic method to load grouped configured layers for Overlay
and Cross-Filtering facilities
2023-05-25 11:28:25 +02:00
Francesco Mangiacrapa d1ec08c70f added comments 2023-05-19 15:12:46 +02:00
Francesco Mangiacrapa b3dd9126b9 Fixing layer order 2023-05-19 14:59:55 +02:00
Francesco Mangiacrapa f86988f8c7 Improved Overlay Custom Layer Panel and CSS 2023-05-15 17:11:37 +02:00
Francesco Mangiacrapa 7dc1343f1b Supported the grouped custom layers [#25110] 2023-05-15 16:19:40 +02:00
Francesco Mangiacrapa 647ddfb2d8 Added constant 2023-05-12 11:12:39 +02:00
Francesco Mangiacrapa 16eb79cf32 Updated README 2023-05-12 10:45:44 +02:00
Francesco Mangiacrapa f104c100d8 removed -SNAPSHOT to be released 2023-05-11 15:55:46 +02:00
Francesco Mangiacrapa 2cdc97e70d Merge pull request 'task_24166' (!14) from task_24166 into master
Reviewed-on: #14
2023-05-11 15:53:48 +02:00
Francesco Mangiacrapa 18fe9c40ea Added -SNAPSHOT 2023-05-11 15:53:08 +02:00
Francesco Mangiacrapa c4e9ca93b6 removed -SNAPSHOT to be released 2023-05-11 15:16:28 +02:00
Francesco Mangiacrapa 293bfabfa8 Removed unused cache. Updated pom 2023-05-08 11:37:27 +02:00
Francesco Mangiacrapa d0be59234a Updated README. Fixed pom 2023-05-05 17:40:55 +02:00
Francesco Mangiacrapa 9d059ca4e9 Passed to the geoportal-data-mapper component [#24978] 2023-05-05 17:23:11 +02:00
Francesco Mangiacrapa 2d4bfbee38 Starting integration of the geoportal-data-mapper library 2023-04-13 11:46:17 +02:00
Francesco Mangiacrapa 031ba50a03 Upgraded maven-portal-bom version at 3.7.0 2023-04-04 14:56:37 +02:00
Francesco Mangiacrapa ad7de9f7dc removed -SNAPSHOT to be released 2023-03-30 16:36:19 +02:00
Francesco Mangiacrapa e09bb18614 Improved css 2023-03-30 16:21:49 +02:00
Francesco Mangiacrapa 60f4569518 updated css 2023-03-30 15:13:22 +02:00
Francesco Mangiacrapa 675f23d1ac updated css 2023-03-30 12:43:45 +02:00
Francesco Mangiacrapa 4a44835356 Just including new dependencies 2023-03-30 12:10:29 +02:00
Francesco Mangiacrapa 5ec86d1a8d removed -SNAPSHOT to be released 2023-02-20 15:39:04 +01:00
Francesco Mangiacrapa 9581d3ce73 fixing issues #24632 2023-02-20 15:22:51 +01:00
Francesco Mangiacrapa 2b6272dd60 Fixed fit to Extent on features loaded end 2023-02-07 15:25:53 +01:00
Francesco Mangiacrapa 003590f46e removed -SNAPSHOT to be released 2023-02-03 15:25:28 +01:00
Francesco Mangiacrapa f1fde26359 Merge pull request 'task_24532' (!13) from task_24532 into master
Reviewed-on: #13
2023-02-03 15:24:09 +01:00
Francesco Mangiacrapa 872caa7137 updated CHANGELOG 2023-02-03 15:23:33 +01:00
Francesco Mangiacrapa ff3a7461df Added warning message on broken link 2023-02-03 14:19:33 +01:00
Francesco Mangiacrapa 1a6c9b074d Set Highlight to Light yellow4 2023-02-03 12:28:26 +01:00
Francesco Mangiacrapa 88c986a478 Updated 2023-02-03 11:54:40 +01:00
Francesco Mangiacrapa 06d88b4033 #24432 Done 2023-02-03 11:53:37 +01:00
Francesco Mangiacrapa b5e6afb6ce Moved to red highlight 2023-01-31 15:59:32 +01:00
Francesco Mangiacrapa 657da72da6 Done #24506. Removed -SNAPSHOT to be released 2023-01-31 15:35:37 +01:00
Francesco Mangiacrapa 14bb068b2e Added images 2023-01-31 15:34:04 +01:00
Francesco Mangiacrapa d81ca374dc Merged with branch `locate_layer_geometry` 2023-01-31 15:24:45 +01:00
Francesco Mangiacrapa 5221d2a6b5 Displaying an Alert if an error occurs on adding a layer to Map (#24471) 2023-01-25 10:46:17 +01:00
Francesco Mangiacrapa 69e5216645 commented console.log. Added MaxLenght to CQL Filter 2023-01-24 10:23:37 +01:00
Francesco Mangiacrapa 0d4428e341 Made the code "more robust" (adding some try/catch and checking null
value)
2023-01-19 11:35:50 +01:00
Francesco Mangiacrapa 3c12d6a841 Fixing #24432 GWT serialization 2023-01-17 17:02:23 +01:00
Francesco Mangiacrapa 9a7edeada1 Added Comparable for sorting the UCD names 2023-01-16 14:08:23 +01:00
Francesco Mangiacrapa f9ea07ee00 Merge pull request 'Added Layer Style and Show Legend facilities' (!11) from layer_style_and_legend into master
Reviewed-on: #11
2023-01-16 11:37:58 +01:00
Francesco Mangiacrapa 5a5178c459 Added Layer Style and Show Legend facilities 2023-01-16 11:37:06 +01:00
Francesco Mangiacrapa 8d47db8e83 Fixing issue - files/images duplicated reading the section 2023-01-12 16:56:26 +01:00
Francesco Mangiacrapa dc439a2637 removed -SNAPSHOT to be released 2023-01-12 11:54:42 +01:00
Francesco Mangiacrapa f46fff44ba Merge pull request 'animated_map' (!10) from animated_map into master
Reviewed-on: #10
2023-01-12 11:40:23 +01:00
Francesco Mangiacrapa 268a5eb614 #24404, done 2023-01-12 11:00:09 +01:00
Francesco Mangiacrapa 047db1e848 Added access policy filtering on reading layers for project ID 2023-01-11 17:12:19 +01:00
Francesco Mangiacrapa acc6be29d8 #24390 workaround applied on checking the access policy 2023-01-11 12:21:32 +01:00
Francesco Mangiacrapa 5e45322051 On init - centering the map on the project without centroid feature 2023-01-10 14:36:37 +01:00
Francesco Mangiacrapa cef3b61800 Renamed "Go to Layers" to "Zoom to Layers" 2023-01-09 15:29:01 +01:00
Francesco Mangiacrapa cb99242958 Managing visibility of "Go to Layers" 2022-12-22 16:38:43 +01:00
Francesco Mangiacrapa 67b93db8af Improved UI experience adding several animations on interaction with the
map
2022-12-22 11:59:07 +01:00
Francesco Mangiacrapa 78e939c787 Updated the release date 2022-12-21 11:14:51 +01:00
Francesco Mangiacrapa 307c1245b8 Removed -SNAPSHOT to be RELEASED 2022-12-21 11:12:48 +01:00
Francesco Mangiacrapa c8ad962dfe improved behaviour on searching stage 2022-12-21 11:00:12 +01:00
Francesco Mangiacrapa 474832a663 Updated README 2022-12-15 17:51:02 +01:00
Francesco Mangiacrapa 7211ddaeaf bug fixing issue on displaying automatically the layers 2022-12-15 17:47:44 +01:00
Francesco Mangiacrapa 143e79388d Reduced the bounding box when resolving share link 2022-12-15 15:54:54 +01:00
Francesco Mangiacrapa b53fe20a6f Fix - reduced the bounding boxing when resolving a project by share link 2022-12-15 15:39:08 +01:00
Francesco Mangiacrapa b797a9fd8d #24300 Done. Improved the GUI of the search functionality when multiple
collections are available.
2022-12-14 15:46:20 +01:00
Francesco Mangiacrapa 78cc536f54 Bug fixing pagination on start index (but it is not used at the moment) 2022-11-29 15:46:43 +01:00
Francesco Mangiacrapa 491e9a258b moved two logs at DEBUG 2022-11-29 12:35:30 +01:00
Francesco Mangiacrapa b1a09b39e3 revisited the searching result phrase 2022-11-29 10:46:07 +01:00
Francesco Mangiacrapa 4b13d849a5 Added earth spinner with transparent background 2022-11-29 09:45:35 +01:00
Francesco Mangiacrapa 4b838b2263 commented Tests 2022-11-28 17:52:09 +01:00
Francesco Mangiacrapa 0233bf73ab Updated settings 2022-11-28 17:47:51 +01:00
Francesco Mangiacrapa c9ac22c74e Merge pull request 'update_facility' (!9) from update_facility into master
Reviewed-on: #9
2022-11-28 17:45:17 +01:00
Francesco Mangiacrapa 62c02216af copied from master 2022-11-28 17:44:54 +01:00
Francesco Mangiacrapa 9f8421b6df Updated 2022-11-28 17:40:23 +01:00
Francesco Mangiacrapa 5ebab16836 Moved one log to DEBUG 2022-11-28 15:44:58 +01:00
Francesco Mangiacrapa a55d771e6d Refactored title and short-title 2022-11-28 15:35:03 +01:00
Francesco Mangiacrapa 0b16d37c1b Refactored the GeoPortalDataViewerAppPortlet to GeoPortalDataViewerApp 2022-11-28 15:32:14 +01:00
Francesco Mangiacrapa 189dc36f75 #24195 Integrated the temporal query. Fixing CQL on WFS during searching
enabled
2022-11-28 15:20:21 +01:00
Francesco Mangiacrapa 0764d0770c Integrated temporal query for YEAR 2022-11-28 09:49:46 +01:00
Francesco Mangiacrapa 6b3ceadec5 Merge pull request 'update_facility' (!8) from update_facility into master
Reviewed-on: #8
2022-11-21 16:45:28 +01:00
Francesco Mangiacrapa c4ebdcf003 Synchronized the Timeline selected project with the showing popoup on
centroid
2022-11-21 15:16:36 +01:00
Francesco Mangiacrapa 2e2ecfa41d setTocContent visibility 2022-11-18 17:07:13 +01:00
Francesco Mangiacrapa 1f3b3c2be1 Improved GUI. Added Temporal Comparator 2022-11-18 16:50:01 +01:00
Francesco Mangiacrapa 20c4da197e Added Table Of Contents (TOC) and "Go to Top" 2022-11-18 11:06:47 +01:00
Francesco Mangiacrapa 1555018334 removed -SNAPSHOT to be released 2022-11-17 12:29:41 +01:00
Francesco Mangiacrapa 643562bc26 Merge pull request '#24136 Integrated the temporal dimension on the front-end side' (!7) from update_facility into master
Reviewed-on: #7
2022-11-17 12:02:31 +01:00
Francesco Mangiacrapa 67e975df6a update settings 2022-11-17 12:01:29 +01:00
Francesco Mangiacrapa 08529f2206 #24136 Integrated the temporal dimension on the front-end side 2022-11-16 16:42:12 +01:00
Francesco Mangiacrapa 88c6a831d4 removed unused code 2022-11-15 14:25:30 +01:00
Francesco Mangiacrapa 98e8c19be8 Updated description 2022-11-15 11:39:03 +01:00
Francesco Mangiacrapa f314fd74e6 updated settings 2022-11-15 11:33:23 +01:00
Francesco Mangiacrapa f63960aaf6 Improved layers already displayed 2022-11-15 10:08:02 +01:00
Francesco Mangiacrapa 0216e43423 revisited the "Geoportal-DataViewer-Configs" discovery. Removed unused
RPC
2022-11-14 17:01:28 +01:00
Francesco Mangiacrapa 942744cf05 Performed several improvements 2022-11-14 16:24:49 +01:00
Francesco Mangiacrapa 84fcc7dbb3 Added Application Notifier. Improved Modal Expand 2022-11-14 14:12:50 +01:00
Francesco Mangiacrapa 430d28ce03 Improved ImageGallery. LayerSectionViewer, ProjectViewer etc. 2022-11-11 16:30:20 +01:00
Francesco Mangiacrapa 6ab7c60643 Removed old model "Concessioni". Updated CHANGELOG 2022-11-09 15:25:00 +01:00
Francesco Mangiacrapa 6950ce8c2f Added code to opening the collection in input or all the collections 2022-11-09 14:35:37 +01:00
Francesco Mangiacrapa 59fcd5db9d improved css 2022-11-09 12:12:24 +01:00
Francesco Mangiacrapa 36db7c417f fixing ContextRequest 2022-11-09 12:09:39 +01:00
Francesco Mangiacrapa 0c481c63c2 fixed css 2022-11-09 12:00:49 +01:00
Francesco Mangiacrapa 8298b2f93e Removed old concessione. Added "Add layers to Map" facility 2022-11-09 11:42:44 +01:00
Francesco Mangiacrapa 62dc1bad6c Integrated with timeline config 2022-11-08 17:56:36 +01:00
Francesco Mangiacrapa fec3f26c0a Fixing timeline status 2022-11-08 14:50:48 +01:00
Francesco Mangiacrapa 7c646b3ead minor fixes 2022-11-08 13:55:52 +01:00
Francesco Mangiacrapa 42f52dfa50 fixed Tests 2022-11-08 12:15:11 +01:00
Francesco Mangiacrapa 79a040d0a3 added responsive CSS 2022-11-08 12:13:14 +01:00
Francesco Mangiacrapa 744aebcf2c #23955 timeline facility first release 2022-11-08 10:45:39 +01:00
Francesco Mangiacrapa b9f73817f8 in progress timeline 2022-11-07 17:58:06 +01:00
Francesco Mangiacrapa ed93c13434 in progress on timeline 2022-11-04 17:16:37 +01:00
Francesco Mangiacrapa a3b5045ef7 in progress on #24028 2022-11-03 17:03:15 +01:00
Francesco Mangiacrapa ed4f9bd204 Trying to integrate vis-timeline 2022-11-02 18:05:38 +01:00
Francesco Mangiacrapa 819032fb13 Remove collection from Map, implemented. 2022-10-27 17:40:04 +02:00
Francesco Mangiacrapa 941805a596 Fixing search facility 2022-10-27 16:18:54 +02:00
Francesco Mangiacrapa b3345a4b5f Integrated with spatialReference. Setting the IndexFlag according to
user logged-in or not
2022-10-27 15:09:07 +02:00
Francesco Mangiacrapa 56f3c29d6d added com.google.code.gson dependency 2022-10-26 09:20:25 +02:00
Francesco Mangiacrapa bd5a9d14e5 fixed tests 2022-10-25 17:04:05 +02:00
Francesco Mangiacrapa 4dff83b63f Fixing DD layers and Open Details popup 2022-10-25 17:01:24 +02:00
Francesco Mangiacrapa 05196b2294 Fixed WFS on layers 2022-10-25 14:53:56 +02:00
Francesco Mangiacrapa 0900cd46c5 in progress 2022-10-25 11:35:03 +02:00
Francesco Mangiacrapa 0a5cd91c55 Migrated the Search facility 2022-10-24 12:23:52 +02:00
Francesco Mangiacrapa 0fb238f0b4 In progress 2022-10-20 18:01:54 +02:00
Francesco Mangiacrapa 18d3548c09 in progress 2022-10-19 17:51:13 +02:00
Francesco Mangiacrapa 9b0d36f232 refactored 2022-10-18 17:32:12 +02:00
Francesco Mangiacrapa a3c10d1b18 Ported getLayersForId 2022-10-18 14:17:41 +02:00
Francesco Mangiacrapa 51a44a3e54 Created the ItemFieldsResponse 2022-10-17 16:52:22 +02:00
Francesco Mangiacrapa 6986aa493d Starting LayerSectionViewer 2022-10-14 17:19:40 +02:00
Francesco Mangiacrapa 4a17360a18 Deserialized List of sdi-layers 2022-10-14 15:31:32 +02:00
Francesco Mangiacrapa 079bf39843 removed package 2022-10-13 17:20:36 +02:00
Francesco Mangiacrapa 5b7ae7de86 refactoring 2022-10-13 17:19:53 +02:00
Francesco Mangiacrapa 5298fb95f7 fixing test 2022-10-13 16:54:38 +02:00
Francesco Mangiacrapa 1a7ecf78fc merged in part with the branch cms-projects-support 2022-10-13 16:53:33 +02:00
Francesco Mangiacrapa 8e51d51460 Added GcubeProfilesPerUCDIdCache and Updated SearchFacilityUI 2022-10-12 17:12:09 +02:00
Francesco Mangiacrapa 7647628716 Added Guava Cache for gcubeProfiles Per UCD_ID 2022-10-12 11:13:40 +02:00
Francesco Mangiacrapa aba4e0dca0 Rendering list of files 2022-10-11 16:10:46 +02:00
Francesco Mangiacrapa 6363c2ea5e Starting migration to UCD 2022-10-11 15:00:39 +02:00
Francesco Mangiacrapa 0065ff35f1 Added lombok v.1.18.4 REQUIRED FOR JDK_11 2022-09-28 13:54:53 +02:00
Francesco Mangiacrapa 81c65937ee Testing building on jenkins with JDK_11 2022-09-28 13:50:12 +02:00
Francesco Mangiacrapa 549086b448 removed -SNAPSHOT to be released 2022-09-06 15:18:27 +02:00
Francesco Mangiacrapa 70056e06b8 Merge pull request '#23819 Enhancement implemented' (!6) from feature_23819 into master
Reviewed-on: #6
2022-09-06 15:16:37 +02:00
Francesco Mangiacrapa bf5265bd63 #23819 Enhancement implemented 2022-09-06 14:53:19 +02:00
Francesco Mangiacrapa 3c64fd79f3 Removed -SNAPSHOT to be released 2022-08-29 15:32:40 +02:00
Francesco Mangiacrapa 815d73cd92 #23770 OpenLayers CDN URLs updated also in the .jsp 2022-08-29 15:14:01 +02:00
Francesco Mangiacrapa 0870eceb5e Updated OL CDN URLs, see #23770 2022-08-29 15:04:12 +02:00
Francesco Mangiacrapa 052aa44675 Removed -SNAPSHOT to be released. Moved to maven-portal-bom.3.6.4 2022-07-27 12:16:57 +02:00
Francesco Mangiacrapa cded2a5254 Used new maven range for geoportal-client 2022-07-27 11:08:23 +02:00
Francesco Mangiacrapa 15437a94a5 added a check on empty/null images 2022-07-26 16:52:29 +02:00
Francesco Mangiacrapa 42bf373251 #23689 Fixed the search facility is buggy when used from public access 2022-07-26 16:28:25 +02:00
Francesco Mangiacrapa 03702b7148 removed -SNAPSHOT to be released 2022-01-13 17:15:22 +01:00
Francesco Mangiacrapa dfbadcb502 Merge pull request 'feature_22518' (!5) from feature_22518 into master
Reviewed-on: #5
2022-01-13 17:09:10 +01:00
Francesco Mangiacrapa e819f34267 New icons added for layer (in)visible 2021-12-22 15:40:45 +01:00
Francesco Mangiacrapa 736264ddf1 removed comments 2021-12-22 12:24:03 +01:00
Francesco Mangiacrapa 5d59c9dcbc ported to GNADataViewerConfigProfile 2021-12-21 16:52:35 +01:00
Francesco Mangiacrapa 98349ac121 improved error message 2021-12-17 10:51:22 +01:00
Francesco Mangiacrapa d739fbee4d improved css 2021-12-17 10:50:13 +01:00
Francesco Mangiacrapa 99984fcd2c integrated with WhereClause. Updated icons 2021-12-15 15:44:31 +01:00
Francesco Mangiacrapa 342d40fdf9 Searching facility integrated with CQL filter 2021-12-14 15:26:09 +01:00
Francesco Mangiacrapa fb827a6913 fixed labels 2021-12-13 11:58:35 +01:00
Francesco Mangiacrapa 479ee9f7a7 Changed display name for item fields 2021-12-13 11:28:47 +01:00
Francesco Mangiacrapa 54e0d0de01 removing toLowerCase 2021-12-10 16:59:31 +01:00
Francesco Mangiacrapa 0e97a234ce #22518 Added the search facility 2021-12-10 16:19:33 +01:00
Francesco Mangiacrapa 5daa568c44 In progress #22518 2021-12-07 17:13:20 +01:00
Francesco Mangiacrapa 50ac34dddb Merge pull request 'task_22027' (!4) from task_22027 into master
Reviewed-on: #4
2021-12-07 09:50:57 +01:00
150 changed files with 13187 additions and 3245 deletions

View File

@ -1,16 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/geoportal-data-viewer-app-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.6.0/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
@ -24,16 +19,16 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/geoportal-data-viewer-app-2.1.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/geoportal-data-viewer-app-3.6.0/WEB-INF/classes"/>
</classpath>

View File

@ -1,4 +1,4 @@
eclipse.preferences.version=1
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-2.1.0-SNAPSHOT
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.6.0
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -6,6 +6,6 @@ org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,41 +1,925 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="geoportal-data-viewer-app-2.1.0-SNAPSHOT">
<wb-module deploy-name="geoportal-data-viewer-app-3.6.0">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<dependent-module archiveName="geoportal-data-mapper-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-mapper/geoportal-data-mapper">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="uri-resolver-manager-1.8.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/uri-resolver-manager/uri-resolver-manager">
<dependency-type>uses</dependency-type>
</dependent-module>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
<property name="context-root" value="geoportal-data-viewer-app"/>
</wb-module>
</project-modules>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
<installed facet="jst.jaxrs" version="2.0"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="3.0"/>
</faceted-project>

View File

@ -4,11 +4,107 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v3.6.0]
- GUI optimization [#25461]
- Using the latest libraries version: gwt-ol.v8.4.1 (with openlayers.v6.6.1) and gwt.v2.10
- Showing basic statistics (i.e. "X project published") via 'countByPhase' method [#25598]
## [v3.5.0]
- Supported the cross-filtering [#25074]
- Supported the grouped custom layers [#25110]
- Managed the (WMS) Layer Style facility [#25066]
## [v3.4.0] - 2023-05-11
- Integrated the geoportal-data-mapper component [#24978]
## [v3.3.1] - 2023-03-30
- Just including new dependencies
- Improved css
## [v3.3.0] - 2023-02-20
#### Fixes
- [#24632] Returning the public layer index if the private is missing
- [#24632] No temporal info shown if the temporal extent is missing
## [v3.2.1] - 2023-02-03
#### Fixes
- [#24432] Reverting serialization LinkedHashMap<String, String> to LinkedHashMap<String, Object>.
- Improved Alert UX in case of broken shared link
- Moved to gwt 2.9.0
## [v3.2.0] - 2023-01-31
#### Enhancements
- [#24506] Added facility: Locate/Highlight the Layer on the Map
## [v3.1.0] - 2023-01-12
#### Enhancements
- [#24300] Improved the GUI of the search functionality when multiple collections are available
- [#24404] Improved the handlers of events: Search, Locate
- Improved the user experience providing an animated map and zoom to layers facility
#### Fixes
- Reduced the BBOX when resolving a project by share link
- GNA Project binding with automatically adding of the layers to Map
- [#24390] Read the access policy from the fileset json section
- [#24432] Fixing serialization issue using LinkedHashMap<String, String> instead of LinkedHashMap<String, Object>
## [v3.0.0] - 2022-11-28
- [#23940] Passed to CMS-UCD
- [#23941] Implemented and integrated the DTO Project/Document per UCD config and gCube Metadata Profiles
- [#23953] Passed the 'Search facility' to CMS-UCD model
- [#23954] Passed the 'Details Panel facility' to CMS-UCD model
- [#23955] Implemented the Temporal facility to navigate temporal relations among (JSON) Projects
- [#24028] Passed the spatial dimension to CMS-Project model
- [#24136] Integrated the temporal dimension on the front-end side
- [#24195] Integrated the temporal query
## [v2.4.1-SNAPSHOT] - 2022-09-28
- [#23906] Tested building on jenkins with JDK_11
## [v2.4.0] - 2022-09-07
#### Enhancement
- [#23819] Adding layers to principal map belonging to more centroids with the same spatial position
## [v2.3.1] - 2022-08-29
#### Bug fixed
- [#23770] OpenLayers CDN URLs updated (github relative URL changed from "master/en/vX.Y.Z/" to "main/dist/en/vX.Y.Z/")
## [v2.3.0] - 2022-07-26
#### Bug fixed
- [#23689] Fixed the search facility is buggy when used from public access
- [#23704] Used new maven range for geoportal-client
- Moved to 3.6.4
## [v2.2.0] - 2021-12-07
#### Enhancements
- [#22518] Added the search for fields facility
## [v2.1.0-SNAPSHOT] - 2021-11-10
#### Enhancements
- [#22518] Added the search for name facility
- [#22027] Integrated with MapBox Satellite
- Added link "Open Project" in the pop-up of WFS details
- Moved to gwt-ol3 v8.1.0-gwt2_9

View File

@ -1,6 +1,6 @@
# GeoPortal Data Viewer App
The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Web-Map Interface
The "Geoportal data-viewer" technology allows users to access and search for spatio-temporal documents through a web GIS which allows them to: (i) navigate and select the projects published in the system by "geographical map" (spatial dimension) , (ii) navigate and select the relationships between projects (evolution of over time) via "timeline" (temporal dimension), (iii) view metadata and resources (images, layers, etc. .) of documents via the "project view detail", (iv) export a view of the map with the layer of interest or add the layers of a project to the main map, (v) manage the order and overlapping of the layers, (vi) execute spatial queries on the layers and view the results, (vii) search through metadata or temporal dimension queries for the projects of interest, (vii) apply spatial filters for cross-layer.
## Built With
@ -10,13 +10,43 @@ The GeoPortal Data Viewer App is an application to access, discovery and navigat
**Uses**
* GWT v.2.9.0. [GWT](http://www.gwtproject.org) is licensed under [Apache License 2.0](http://www.gwtproject.org/terms.html)
* GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
* GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
* GWT-OpenLayers 3+ v.8.1.0-gwt2_9. [GWT-OL3](https://github.com/TDesjardins/gwt-ol)
* OpenLayers v.6.X. [OpenLayers](https://openlayers.org/) is licensed under [BSD 2-Clause "Simplified"](https://github.com/openlayers/openlayers/blob/main/LICENSE.md)
* OpenLayers v.6.x [OpenLayers](https://openlayers.org/) is licensed under [BSD 2-Clause "Simplified"](https://github.com/openlayers/openlayers/blob/main/LICENSE.md)
* NanoGallery v2.X [NanoGallery2](https://github.com/nanostudio-org/nanogallery2) is licensed under [GNU General Public License "gplv3"](https://www.gnu.org/licenses/gpl-3.0.html)
* Vis-Timeline v7.x [VisTimeline](https://github.com/visjs/vis-timeline) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0) and MIT
* Handlebarsjs v4.x [Handlebarsjs](https://handlebarsjs.com/) is licensed under MIT
## Architecture
<img src="https://gcube.wiki.gcube-system.org/images_gcube/8/82/GeoPortalDataViewer_Architecture.png" style="max-width:800px;" alt="GeoPortal Data-Viewer - Architecture" />
## Showcase
##### D4GNA instance of Geoportal D4Science
see at [Dataset per il Geoportale Nazionale per lArcheologia (D4GNA)](https://gna.d4science.org/)
**D4GNA Viewer - OSM**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/0/06/D4GNA_Viewer_OSM.png" style="max-width:800px;" alt="Data_Viewer_OSM" />
**D4GNA Viewer - MapBox**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/9/9c/D4GNA_Viewer_MapBox.png" style="max-width:800px;" alt="Data_Viewer_MapBox" />
**D4GNA Viewer - Discovering...**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/8/85/D4GNA_ERCIM_3.png" style="max-width:800px;" alt="D4GNA_ERCIM_3" />
<br />
<br />
<img src="https://gcube.wiki.gcube-system.org/images_gcube/9/9c/D4GNA_ERCIM_2.png" style="max-width:800px;" alt="D4GNA_ERCIM_2" />
## Documentation
N/A
Geoportal Service Documentation is available at [gCube CMS Suite](https://geoportal.d4science.org/geoportal-service/docs/index.html)
User Guide (DRAFT ITA) is available at [Guida al DataViewer D4GNA (DRAFT-ITA)](https://gcube.wiki.gcube-system.org/images_gcube/b/b3/D4science_Guida_al_DataViewer_D4GNA_bozza.pdf)
## Change log

75
pom.xml
View File

@ -7,21 +7,23 @@
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.1.0</version>
<version>1.2.0</version>
<relativePath />
</parent>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-viewer-app</artifactId>
<packaging>war</packaging>
<version>2.1.0-SNAPSHOT</version>
<version>3.6.0</version>
<name>GeoPortal Data Viewer App</name>
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Web-Map Interface</description>
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the Geoportal projects/documents by a Web-Map Interface</description>
<properties>
<!-- Convenience property to set the GWT version -->
<gwt.version>2.9.0</gwt.version>
<gwt.version>2.10.0</gwt.version>
<gwt.compiler.style>PRETTY</gwt.compiler.style>
<gson.version>2.6.2</gson.version>
<gwt.ol.version>8.4.1</gwt.ol.version>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<!-- GWT 2.9 support 8, 9 and 11 -->
<maven.compiler.source>1.8</maven.compiler.source>
@ -54,36 +56,15 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.3</version>
<version>3.7.0</version>
<type>pom</type>
<scope>import</scope>
<exclusions>
<exclusion>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
@ -122,7 +103,7 @@
<dependency>
<groupId>com.github.tdesjardins</groupId>
<artifactId>gwt-ol3</artifactId>
<version>8.1.0-gwt2_9</version>
<version>${gwt.ol.version}</version>
</dependency>
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
@ -155,29 +136,41 @@
<artifactId>usermanagement-core</artifactId>
<scope>provided</scope>
</dependency>
<!-- REQUIRED FOR JDK_11 -->
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-url-shortener</artifactId>
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
<!-- END -->
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-mapper</artifactId>
<version>[1.0.1-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-common</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-client</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.7.0</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
@ -208,12 +201,14 @@
<!-- <version>1.6.4</version> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayersMapParameters;
import com.google.gwt.dom.client.Element;
import com.google.gwt.i18n.client.DateTimeFormat;
/**
@ -13,6 +14,8 @@ import com.google.gwt.i18n.client.DateTimeFormat;
* Nov 24, 2020
*/
public class GeoportalDataViewerConstants {
public static final int TABLET_WIDTH = 1601;
public static final String MAP_DIV = "map";
@ -25,10 +28,43 @@ public class GeoportalDataViewerConstants {
public static final String GET_ZOOM = OpenLayersMapParameters.OL_MAP_PARAM.zoom.name();
public static final String GET_CENTER_MAP_TO_LONG_LAT = OpenLayersMapParameters.OL_MAP_PARAM.centermap.name();
public static final Double INITIAL_LAYER_OPACITY = 0.8;
public static final int SEARCH_LIMIT_RESULTS_TO_MAXIMUM = 50;
public static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getFormat("dd MMMM yyyy");
public static enum MapEventType {
MOUSE_CLICK, MAP_ZOOM_END, MOVE_END, ADDED_CENTROID_LAYER_TO_MAP
}
public static final String PROJECT_ID_KEY_FEATURE = "projectid";
public static enum GisToolbarFacilities {
COLLECTION("Collection", "Open the collections"),
MAP("Map", "Select the base Map"),
OVERLAY("Overlay", "Add overlay layers"),
SEARCH("Search", "Search in the collections"),
FILTER("Filter", "Apply spatial filtering"),
LAYERS("Layers", "Layers added to Map"),
PRESET_LOCATION("Preset Location", "Center the Map to Location");
String name;
String tooltip;
GisToolbarFacilities(String name, String tooltip) {
this.name = name;
this.tooltip = tooltip;
}
public String getName() {
return name;
}
public String getTooltip() {
return tooltip;
}
}
/**
* The Enum LayerType.
*
@ -82,7 +118,7 @@ public class GeoportalDataViewerConstants {
* @param msg the msg
*/
public static native void printJs(String msg)/*-{
console.log("js console: " + msg);
//console.log("js console: " + msg);
}-*/;
/**
@ -91,7 +127,7 @@ public class GeoportalDataViewerConstants {
* @param msg the msg
*/
public static native void printJsObj(Object object)/*-{
console.log("js obj: " + JSON.stringify(object, null, 4));
//console.log("js obj: " + JSON.stringify(object, null, 4));
}-*/;
/**
@ -103,4 +139,75 @@ public class GeoportalDataViewerConstants {
return JSON.stringify(object);
}-*/;
/**
* Json to HTML.
*
* @param jsonTxt the json txt
* @return the string
*/
public static native String jsonToTableHTML(String jsonTxt)/*-{
try {
var jsonObj = JSON.parse(jsonTxt);
if (jsonObj.length == undefined)
jsonObj = [ jsonObj ]
//console.log(jsonObj.length)
// EXTRACT VALUE FOR HTML HEADER.
var col = [];
for (var i = 0; i < jsonObj.length; i++) {
for ( var key in jsonObj[i]) {
//console.log('key json' +key)
if (col.indexOf(key) === -1) {
col.push(key);
}
}
}
// CREATE DYNAMIC TABLE.
var table = document.createElement("table");
try {
table.classList.add("my-html-table");
} catch (e) {
console.log('invalid css add', e);
}
// ADD JSON DATA TO THE TABLE AS ROWS.
for (var i = 0; i < col.length; i++) {
tr = table.insertRow(-1);
var firstCell = tr.insertCell(-1);
//firstCell.style.cssText="font-weight: bold; text-align: center; vertical-align: middle;";
firstCell.innerHTML = col[i];
for (var j = 0; j < jsonObj.length; j++) {
var tabCell = tr.insertCell(-1);
var theValue = jsonObj[j][col[i]];
//console.log("the value: "+theValue);
if (theValue !== null
&& Object.prototype.toString.call(theValue) === '[object Array]') {
var formattedValueArray = "";
for (var k = 0; k < theValue.length; k++) {
var theValueArray = theValue[k];
//console.log(theValueArray);
formattedValueArray += theValueArray + "<br>";
}
tabCell.innerHTML = formattedValueArray;
} else {
tabCell.innerHTML = theValue;
}
}
}
return table.outerHTML;
} catch (e) {
console.log('invalid json', e);
return jsonTxt;
}
}-*/;
public static native void clickElement(Element elem) /*-{
elem.click();
}-*/;
}

View File

@ -1,15 +1,25 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
@ -45,18 +55,10 @@ public interface GeoportalDataViewerService extends RemoteService {
* @param maxWFSFeature the max WFS feature
* @param zoomLevel the zoom level
* @return the data result
*/
List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX,
int maxWFSFeature, double zoomLevel);
/**
* Gets the concessione for id.
*
* @param mongoId the mongo id
* @return the concessione for id
* @throws Exception the exception
*/
ConcessioneDV getConcessioneForId(String mongoId) throws Exception;
List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX,
int maxWFSFeature, double zoomLevel) throws Exception;
/**
* Gets the my login.
@ -65,33 +67,13 @@ public interface GeoportalDataViewerService extends RemoteService {
*/
String getMyLogin();
/**
* Gets the layer for type.
*
* @param layerType the layer type
* @return the layer for type
* @throws Exception the exception
*/
GeoInformationForWMSRequest getLayerForType(String layerType) throws Exception;
/**
* Gets the geo na data view profile.
*
* @return the geo na data view profile
* @throws Exception the exception
*/
GeoNaDataViewerProfile getGeoNaDataViewProfile() throws Exception;
/**
* Gets the uploaded images for id.
*
* @param itemType the item type
* @param itemId the item id
* @param maxImages the max images
* @return the uploaded images for id
* @throws Exception
*/
List<UploadedImageDV> getUploadedImagesForId(String itemType, String itemId, Integer maxImages) throws Exception;
GNADataViewerConfigProfile getGeoNaDataViewProfile() throws Exception;
/**
* Gets the public links for.
@ -100,17 +82,17 @@ public interface GeoportalDataViewerService extends RemoteService {
* @return the public links for
* @throws Exception the exception
*/
GeoNaItemRef getPublicLinksFor(GeoNaItemRef item) throws Exception;
GeoportalItemReferences getPublicLinksFor(GeoportalItemReferences item) throws Exception;
/**
* Gets the layers for id.
*
* @param itemType the item type
* @param itemId the item id
* @param theProfileID the the profile ID
* @param theProductID the the product ID
* @return the layers for id
* @throws Exception the exception
*/
List<LayerConcessioneDV> getLayersForId(String itemType, String itemId) throws Exception;
List<GCubeSDIViewerLayerDV> getLayersForId(String theProfileID, String theProductID) throws Exception;
/**
* Gets the WFS features.
@ -125,7 +107,126 @@ public interface GeoportalDataViewerService extends RemoteService {
List<GeoNaSpatialQueryResult> getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName,
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel);
/**
* Gets the list base layers.
*
* @return the list base layers
*/
List<BaseMapLayer> getListBaseLayers();
/**
* List of fields for searching.
*
* @return the list
* @throws Exception the exception
*/
List<ItemFieldsResponse> getConfigListOfFieldsForSearching() throws Exception;
/**
* Gets the project view for id.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the project view for id
* @throws Exception the exception
*/
ProjectView getProjectViewForId(String profileID, String projectID) throws Exception;
/**
* Gets the list projects.
*
* @param theProfileID the the profile ID
* @param start the start
* @param limit the limit
* @param filter the filter
* @param reloadFromService the reload from service
* @return the list projects
* @throws Exception the exception
*/
ResultSetPaginatedDataIDs getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
boolean reloadFromService) throws Exception;
/**
* NEW CODE HERE.
*
* @return the initial configuration
* @throws Exception the exception
*/
ViewerConfiguration getInitialConfiguration() throws Exception;
/**
* Gets the entry sets document for project ID.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param limit the limit
* @return the entry sets document for project ID
*/
LinkedHashMap<String, Object> getEntrySetsDocumentForProjectID(String profileID, String projectID, int limit);
/**
* Gets the relationships for timeline.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the relationships for timeline
* @throws Exception the exception
*/
List<String> getRelationshipsForTimeline(String profileID, String projectID) throws Exception;
/**
* Gets the spatial reference.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the spatial reference
*/
GeoJSON getSpatialReference(String profileID, String projectID);
/**
* Gets the WFS request.
*
* @param layerItem the layer item
* @param mapSrsName the map srs name
* @param mapBBOX the map BBOX
* @param maxFeatures the max features. If 0 means all feature
* @param outputFormat the output format
* @return the WFS request
*/
String getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
String outputFormat);
/**
* Gets the WFS response.
*
* @param layerItem the layer item
* @param mapSrsName the map srs name
* @param mapBBOX the map BBOX
* @param maxFeatures the max features
* @param outputFormat the output format
* @return the WFS response
*/
String getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
String outputFormat);
/**
* Gets the avaiable custom grouped layers for UCD.
*
* @param theHandler the the handler
* @return the avaiable custom grouped layers for UCD
*/
Map<String, List<GroupedLayersDV<? extends LayerIDV>>> getAvaiableCustomGroupedLayersForUCD(
GEOPORTAL_DATA_HANDLER theHandler);
/**
* Gets the HTTP response for URL.
*
* @param url the url
* @return the HTTP response for URL
*/
String getHTTPResponseForURL(String url);
Integer getCountFor(String profileID, String phase, String status);
}

View File

@ -1,15 +1,25 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
@ -37,28 +47,50 @@ public interface GeoportalDataViewerServiceAsync {
void parseWmsRequest(String wmsRequest, String layerName, AsyncCallback<GeoInformationForWMSRequest> callback);
void getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature, double zoomLevel,
AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
void getConcessioneForId(String mongoId, AsyncCallback<ConcessioneDV> callback);
void getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature,
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
void getMyLogin(AsyncCallback<String> callback);
void getLayerForType(String layerType, AsyncCallback<GeoInformationForWMSRequest> callback);
void getGeoNaDataViewProfile(AsyncCallback<GNADataViewerConfigProfile> callback);
void getGeoNaDataViewProfile(AsyncCallback<GeoNaDataViewerProfile> callback);
void getPublicLinksFor(GeoportalItemReferences item, AsyncCallback<GeoportalItemReferences> asyncCallback);
void getUploadedImagesForId(String itemType, String itemId, Integer maxImages,
AsyncCallback<List<UploadedImageDV>> callback);
void getPublicLinksFor(GeoNaItemRef item, AsyncCallback<GeoNaItemRef> asyncCallback);
void getLayersForId(String itemType, String itemId,
AsyncCallback<List<LayerConcessioneDV>> asyncCallback);
void getLayersForId(String theProfileID, String theProductID,
AsyncCallback<List<GCubeSDIViewerLayerDV>> asyncCallback);
void getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature,
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
void getListBaseLayers(AsyncCallback<List<BaseMapLayer>> callback);
void getConfigListOfFieldsForSearching(AsyncCallback<List<ItemFieldsResponse>> callback);
void getProjectViewForId(String profileID, String projectID, AsyncCallback<ProjectView> callback);
void getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
boolean reloadFromService, AsyncCallback<ResultSetPaginatedDataIDs> callback);
void getInitialConfiguration(AsyncCallback<ViewerConfiguration> callback);
void getEntrySetsDocumentForProjectID(String profileID, String projectID, int limit,
AsyncCallback<LinkedHashMap<String, Object>> callback);
void getRelationshipsForTimeline(String profileID, String projectID, AsyncCallback<List<String>> callback);
void getSpatialReference(String profileID, String projectID, AsyncCallback<GeoJSON> callback);
void getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat,
AsyncCallback<String> callback);
void getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat,
AsyncCallback<String> callback);
void getAvaiableCustomGroupedLayersForUCD(GEOPORTAL_DATA_HANDLER theHandler,
AsyncCallback<Map<String, List<GroupedLayersDV<? extends LayerIDV>>>> callback);
void getHTTPResponseForURL(String url, AsyncCallback<String> callback);
void getCountFor(String profileID, String phase, String status, AsyncCallback<Integer> callback);
}

View File

@ -46,7 +46,7 @@ public class OLMapManager {
*
* @param targetId the target id
* @param layerManagerBus the layer manager bus
* @param baseMapLayer the base map layer
* @param baseMapLayer the base map layer
*/
public OLMapManager(String targetId, HandlerManager layerManagerBus, BaseMapLayer baseMapLayer) {
this.targetId = targetId;
@ -75,7 +75,8 @@ public class OLMapManager {
//
// }
ExtentWrapped toExt = new ExtentWrapped(coordinate.getX(), coordinate.getY(), coordinate.getX(), coordinate.getY());
ExtentWrapped toExt = new ExtentWrapped(coordinate.getX(), coordinate.getY(), coordinate.getX(),
coordinate.getY());
GeoQuery select = toDataPointQuery(coordinate, true);
layerManagerBus.fireEvent(new QueryDataEvent(select, toExt, null, true, MapEventType.MOUSE_CLICK));
@ -140,7 +141,7 @@ public class OLMapManager {
/**
* To data point query.
*
* @param coordinate the coordinate
* @param coordinate the coordinate
* @param manualClick the manual click
* @return the geo query
*/
@ -157,23 +158,24 @@ public class OLMapManager {
// ratio - mapPixelWeight : bboxWeight = 20px : geoRectangleWidth
// where 10px is the pixel diameter dimension of the clicked point
double bboxWidth = Math.abs(olMap.getExtent().getLowerLeftX() - olMap.getExtent().getUpperRightX());
double geoWidth = 0;
// adding a tolerance in case of manual click
if (manualClick) {
// adding a tolerance for clicking
//geoWidth = (bboxWidth / w) * (14 / 2);
// geoWidth = (bboxWidth / w) * (14 / 2);
geoWidth = (bboxWidth / w) * (16 / 2);
} else {
// data point selection for coordinate loaded from concessione
geoWidth = (bboxWidth / w) * (2);
// data point selection for coordinate loaded from the centroid
geoWidth = (bboxWidth / w) / 60;
GWT.log("geo width: "+geoWidth);
}
double x1 = Math.min(lon + geoWidth, lon - geoWidth);
double x2 = Math.max(lon + geoWidth, lon - geoWidth);
double y1 = Math.min(lat + geoWidth, lat - geoWidth);
double y2 = Math.max(lat + geoWidth, lat - geoWidth);
// GWT.log("("+x1+","+y1+")("+x2+","+y2+")");
//GWT.log("("+x1+","+y1+")("+x2+","+y2+")");
GeoQuery select = new GeoQuery(x1, y1, x2, y2, TYPE.POINT);
return select;
@ -211,7 +213,7 @@ public class OLMapManager {
GWT.log("the distance is: " + dist);
if (dist > 5000 || startExt.containsExtent(endExt)) {
GeoQuery select = toDataBoxQuery(dragEndExtent);
//TODO THE AUTOMATICALLY SHOWING POP-UP ACCORDING TO ZOOM IS BUGGY
// TODO THE AUTOMATICALLY SHOWING POP-UP ACCORDING TO ZOOM IS BUGGY
layerManagerBus.fireEvent(new QueryDataEvent(select, endExt, null, false, mapEventType));
}
} else if (zoomStart != null && zoomEnd != null) {

View File

@ -1,37 +1,70 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.ArrayList;
import java.util.HashMap;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd.DragDropLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.constants.LabelType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.FlowPanel;
public class OverlayLayerManager {
private ArrayList<LayerObject> layers = new ArrayList<LayerObject>();
private FlowPanel fp = new FlowPanel();
// private ArrayList<LayerObject> layers = new ArrayList<LayerObject>();
// private FlowPanel fp = new FlowPanel();
private FlowPanel clusterCollectionsMainPanel = new FlowPanel();
private HashMap<String, ArrayList<DragDropLayer>> mapCollectionsPerProfileID = new HashMap<String, ArrayList<DragDropLayer>>();
private HashMap<String, FlowPanel> mapCollectionsContainersPerProfileID = new HashMap<String, FlowPanel>();
private HandlerManager applicationBus;
public OverlayLayerManager(HandlerManager applicationBus) {
this.applicationBus = applicationBus;
//fp.addStyleName("layers-panel");
}
void addLayerItem(LayerObject lo) {
public void addLayerItem(LayerObject lo) {
GWT.log("Adding LayerObject having project: "+lo.getProjectDV());
GWT.log("Adding LayerObject having project id: "+lo.getProjectDV().getId());
ArrayList<DragDropLayer> listDDLayers = mapCollectionsPerProfileID.get(lo.getProfileID());
if (listDDLayers == null) {
String collectionName = lo.getProjectDV() != null && lo.getProjectDV().getProfileName() != null
? lo.getProjectDV().getProfileName()
: lo.getProfileID();
Label labelCollectionName = new Label(collectionName);
labelCollectionName.setType(LabelType.WARNING);
clusterCollectionsMainPanel.add(labelCollectionName);
listDDLayers = new ArrayList<DragDropLayer>();
}
FlowPanel fp = new FlowPanel();
fp.getElement().getStyle().setMarginLeft(10, Unit.PX);
DragDropLayer dandd = new DragDropLayer(applicationBus, lo, true, true);
layers.add(lo);
listDDLayers.add(dandd);
fp.add(dandd);
mapCollectionsContainersPerProfileID.put(lo.getProfileID(), fp);
mapCollectionsPerProfileID.put(lo.getProfileID(), listDDLayers);
clusterCollectionsMainPanel.add(fp);
}
public void resetLayers() {
layers.clear();
fp.clear();
clusterCollectionsMainPanel.clear();
mapCollectionsContainersPerProfileID.clear();
mapCollectionsPerProfileID.clear();
}
public FlowPanel getPanel() {
return fp;
return clusterCollectionsMainPanel;
}
}

View File

@ -0,0 +1,18 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
public class ViewerStatus {
private ViewerConfiguration viewerConfig;
public void setConfig(ViewerConfiguration result) {
this.viewerConfig = result;
}
public ViewerConfiguration getViewerConfig() {
return viewerConfig;
}
}

View File

@ -0,0 +1,69 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class AddedLayerToMapEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 18, 2020
*/
public class AddLayerToMapEvent extends GwtEvent<AddLayerToMapEventHandler> {
public static Type<AddLayerToMapEventHandler> TYPE = new Type<AddLayerToMapEventHandler>();
private ProjectDV theProjectDV;
private boolean notifyClashing;
/**
* Instantiates a new adds the layer to map event.
*
* @param theProjectDV the the project DV
* @param notifyClashing the notify clashing
*/
public AddLayerToMapEvent(ProjectDV theProjectDV, boolean notifyClashing) {
this.theProjectDV = theProjectDV;
this.notifyClashing = notifyClashing;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<AddLayerToMapEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(AddLayerToMapEventHandler handler) {
handler.onAddingLayerForProject(this);
}
/**
* Gets the the project DV.
*
* @return the the project DV
*/
public ProjectDV getTheProjectDV() {
return theProjectDV;
}
/**
* Checks if is notify clashing.
*
* @return true, if is notify clashing
*/
public boolean isNotifyClashing() {
return notifyClashing;
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface AddLayerToMapEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 9, 2022
*/
public interface AddLayerToMapEventHandler extends EventHandler {
/**
* On adding layer for project.
*
* @param addLayerToMapEvent the add layer to map event
*/
void onAddingLayerForProject(AddLayerToMapEvent addLayerToMapEvent);
}

View File

@ -0,0 +1,72 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class AddedLayerToMapEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 18, 2020
*/
public class ApplyCQLToLayerOnMapEvent extends GwtEvent<ApplyCQLToLayerOnMapEventHandler> {
public static Type<ApplyCQLToLayerOnMapEventHandler> TYPE = new Type<ApplyCQLToLayerOnMapEventHandler>();
private IndexLayerDV theIndeLayer;
private String cqlFilterValue;
/**
* Instantiates a new apply CQL to layer map event.
*
* @param theIndeLayer the the inde layer
* @param cqlFilter the cql filter
*/
public ApplyCQLToLayerOnMapEvent(IndexLayerDV theIndeLayer, String cqlFilterValue) {
this.theIndeLayer = theIndeLayer;
this.cqlFilterValue = cqlFilterValue;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<ApplyCQLToLayerOnMapEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(ApplyCQLToLayerOnMapEventHandler handler) {
handler.onApplyCQL(this);
}
public IndexLayerDV getTheIndeLayer() {
return theIndeLayer;
}
public String getCqlFilterValue() {
return cqlFilterValue;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ApplyCQLToLayerOnMapEvent [theIndeLayer=");
builder.append(theIndeLayer);
builder.append(", cqlFilterValue=");
builder.append(cqlFilterValue);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface ApplyCQLToLayerOnMapEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 31, 2023
*/
public interface ApplyCQLToLayerOnMapEventHandler extends EventHandler {
/**
* On apply CQL.
*
* @param applyCQLToLayerMapEvent the apply CQL to layer map event
*/
void onApplyCQL(ApplyCQLToLayerOnMapEvent applyCQLToLayerMapEvent);
}

View File

@ -1,6 +1,8 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd.DragDropLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import com.google.gwt.event.shared.GwtEvent;
@ -22,7 +24,7 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
* Oct 12, 2021
*/
public static enum DO_LAYER_ACTION {
VISIBILITY, SWAP, OPACITY
VISIBILITY, SWAP, OPACITY, LOCATE_LAYER
}
private DO_LAYER_ACTION doAction;
@ -31,29 +33,31 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
private boolean visibility;
private SwapLayer sourceLayerSwap;
private SwapLayer targetLayerSwap;
private LayerObject layerObject;
private DragDropLayer sourceEventUI;
/**
* The Class SwapLayer.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 15, 2021
* Oct 15, 2021
*/
public static class SwapLayer{
public static class SwapLayer {
private LayerItem layerItem;
private int position;
/**
* Instantiates a new swap layer.
*
* @param layerItem the layer item
* @param position the position
* @param position the position
*/
public SwapLayer(LayerItem layerItem, int position){
public SwapLayer(LayerItem layerItem, int position) {
this.layerItem = layerItem;
this.position = position;
}
/**
* Gets the layer item.
*
@ -62,7 +66,7 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
public LayerItem getLayerItem() {
return layerItem;
}
/**
* Gets the position.
*
@ -76,11 +80,14 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
/**
* Instantiates a new do action on detail layers event.
*
* @param action the action
* @param layerItem the layer item
* @param action the action
* @param layerItem the layer item
* @param layerObject the layer object
* @param layerObject the layer object
*/
public DoActionOnDetailLayersEvent(DO_LAYER_ACTION action, LayerItem layerItem) {
public DoActionOnDetailLayersEvent(DO_LAYER_ACTION action, LayerItem layerItem, LayerObject layerObject) {
this.layerItem = layerItem;
this.layerObject = layerObject;
this.doAction = action;
}
@ -135,6 +142,24 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
}
/**
* Gets the layer object.
*
* @return the layer object
*/
public LayerObject getLayerObject() {
return layerObject;
}
/**
* Sets the layer object.
*
* @param layerObject the new layer object
*/
public void setLayerObject(LayerObject layerObject) {
this.layerObject = layerObject;
}
/**
* Gets the do action.
*
@ -189,6 +214,25 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
return visibility;
}
/**
* Sets the UI event source.
*
* @param sourceEventUI the new UI event source
*/
public void setUIEventSource(DragDropLayer sourceEventUI) {
this.sourceEventUI = sourceEventUI;
}
/**
* Gets the source event UI.
*
* @return the source event UI
*/
public DragDropLayer getSourceEventUI() {
return sourceEventUI;
}
/**
* To string.
*

View File

@ -0,0 +1,52 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.GwtEvent;
import ol.Extent;
/**
* The Class FitMapToExtentEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 6, 2023
*/
public class FitMapToExtentEvent extends GwtEvent<FitMapToExtentEventHandler> {
public static Type<FitMapToExtentEventHandler> TYPE = new Type<FitMapToExtentEventHandler>();
private Extent extent;
/**
* Instantiates a new fit map to extent event.
*
* @param extent the extent
*/
public FitMapToExtentEvent(Extent extent) {
this.extent = extent;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<FitMapToExtentEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(FitMapToExtentEventHandler handler) {
handler.onFitToMap(this);
}
public Extent getExtent() {
return extent;
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface FitMapToExtentEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 6, 2023
*/
public interface FitMapToExtentEventHandler extends EventHandler {
/**
* On fit to map.
*
* @param fitMapToExtentEvent the fit map to extent event
*/
void onFitToMap(FitMapToExtentEvent fitMapToExtentEvent);
}

View File

@ -0,0 +1,83 @@
//package org.gcube.portlets.user.geoportaldataviewer.client.events;
//
//import org.gcube.application.geoportalcommon.shared.SearchingFilter;
//import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.RECORD_TYPE;
//
//import com.google.gwt.event.shared.GwtEvent;
//
///**
// * The Class GetListOfRecordsEvent.
// *
// * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
// *
// * Dec 7, 2021
// */
//public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler> {
//
// /** The type. */
// public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>();
// private RECORD_TYPE recordType;
// private SearchingFilter sortFilter;
//
// /**
// * Instantiates a new cancel upload event.
// *
// * @param recordType the record type
// * @param sortFilter the sort filter
// */
// public GetListOfRecordsEvent(RECORD_TYPE recordType, SearchingFilter sortFilter) {
// this.recordType = recordType;
// this.sortFilter = sortFilter;
// }
//
// /**
// * Gets the associated type.
// *
// * @return the associated type
// */
// /*
// * (non-Javadoc)
// *
// * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
// */
// @Override
// public Type<GetListOfRecordsEventHandler> getAssociatedType() {
// return TYPE;
// }
//
// /**
// * Dispatch.
// *
// * @param handler the handler
// */
// /*
// * (non-Javadoc)
// *
// * @see
// * com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
// * EventHandler)
// */
// @Override
// protected void dispatch(GetListOfRecordsEventHandler handler) {
// handler.onGetList(this);
// }
//
// /**
// * Gets the record type.
// *
// * @return the record type
// */
// public RECORD_TYPE getRecordType() {
// return recordType;
// }
//
// /**
// * Gets the sort filter.
// *
// * @return the sort filter
// */
// public SearchingFilter getSortFilter() {
// return sortFilter;
// }
//
//}

View File

@ -0,0 +1,22 @@
//package org.gcube.portlets.user.geoportaldataviewer.client.events;
//
//import com.google.gwt.event.shared.EventHandler;
//
//
///**
// * The Interface GetListOfRecordsEventHandler.
// *
// * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
// *
// * Aug 4, 2021
// */
//public interface GetListOfRecordsEventHandler extends EventHandler {
//
//
// /**
// * On get list.
// *
// * @param getListOfRecordsEvent the get list of records event
// */
// void onGetList(GetListOfRecordsEvent getListOfRecordsEvent);
//}

View File

@ -0,0 +1,92 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class OverlayCustomLayerToMapEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 15, 2023
*/
public class OverlayCustomLayerToMapEvent extends GwtEvent<OverlayCustomLayerToMapEventHandler> {
public static Type<OverlayCustomLayerToMapEventHandler> TYPE = new Type<OverlayCustomLayerToMapEventHandler>();
private LayerItem layerItem;
private ACTION_TYPE actionType;
private boolean enabled;
/**
* The Enum ACTION_TYPE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 15, 2023
*/
public enum ACTION_TYPE {
VISIBILITY
}
/**
* Instantiates a new overlay custom layer to map event.
*
* @param layerItem the layer item
* @param actionType the action type
* @param enabled the enabled
*/
public OverlayCustomLayerToMapEvent(LayerItem layerItem, ACTION_TYPE actionType, boolean enabled) {
this.layerItem = layerItem;
this.actionType = actionType;
this.enabled = enabled;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<OverlayCustomLayerToMapEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(OverlayCustomLayerToMapEventHandler handler) {
handler.onCustomOverlayLayerAction(this);
}
/**
* Gets the layer item.
*
* @return the layer item
*/
public LayerItem getLayerItem() {
return layerItem;
}
/**
* Gets the action type.
*
* @return the action type
*/
public ACTION_TYPE getActionType() {
return actionType;
}
/**
* Checks if is enabled.
*
* @return true, if is enabled
*/
public boolean isEnabled() {
return enabled;
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface OverlayCustomLayerToMapEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 15, 2023
*/
public interface OverlayCustomLayerToMapEventHandler extends EventHandler {
/**
* On custom overlay layer action.
*
* @param customOverLayerToMapEvent the custom over layer to map event
*/
void onCustomOverlayLayerAction(OverlayCustomLayerToMapEvent customOverLayerToMapEvent);
}

View File

@ -17,7 +17,7 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
public static Type<QueryDataEventHandler> TYPE = new Type<QueryDataEventHandler>();
private GeoQuery select;
private ExtentWrapped queryClickExtent;
private String mongoItemId;
private String productID;
private boolean onInit;
private MapEventType sourceMapEventType;
@ -26,15 +26,15 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
*
* @param select the select
* @param onFailureCenterTo the on failure center to
* @param mongoItemId the mongo item id
* @param productID the mongo item id
* @param onInit the on init
* @param mapEventType the map event type
*/
public QueryDataEvent(GeoQuery select, ExtentWrapped queryClickExtent, String mongoItemId, boolean onInit,
public QueryDataEvent(GeoQuery select, ExtentWrapped queryClickExtent, String productID, boolean onInit,
MapEventType mapEventType) {
this.select = select;
this.queryClickExtent = queryClickExtent;
this.mongoItemId = mongoItemId;
this.productID = productID;
this.onInit = onInit;
this.sourceMapEventType = mapEventType;
}
@ -49,13 +49,8 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
return TYPE;
}
/**
* Gets the mongo item id.
*
* @return the mongo item id
*/
public String getMongoItemId() {
return mongoItemId;
public String getProductID() {
return productID;
}
/**
@ -107,8 +102,8 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
builder.append(select);
builder.append(", queryClickExtent=");
builder.append(queryClickExtent);
builder.append(", mongoItemId=");
builder.append(mongoItemId);
builder.append(", productID=");
builder.append(productID);
builder.append(", onInit=");
builder.append(onInit);
builder.append(", sourceMapEventType=");

View File

@ -0,0 +1,81 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import java.util.List;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class SearchPerformedEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 14, 2021
*/
public class SearchPerformedEvent extends GwtEvent<SearchPerformedEventHandler> {
public static Type<SearchPerformedEventHandler> TYPE = new Type<SearchPerformedEventHandler>();
private List<String> listProjectIDs;
private boolean searchReset;
private String profileID;
/**
* Instantiates a new search performed event.
*
* @param profileID the profile ID
* @param listProjectIds the list project ids
* @param searchReset the search reset
*/
public SearchPerformedEvent(String profileID, List<String> listProjectIds, boolean searchReset) {
this.profileID = profileID;
this.listProjectIDs = listProjectIds;
this.searchReset = searchReset;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<SearchPerformedEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(SearchPerformedEventHandler handler) {
handler.onSearchDone(this);
}
/**
* Gets the profile ID. It is equal to collectionID
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
}
/**
* Gets the list project Ids.
*
* @return the list project Ids
*/
public List<String> getListProjectIDs() {
return listProjectIDs;
}
/**
* Checks if is search reset.
*
* @return true, if is search reset
*/
public boolean isSearchReset() {
return searchReset;
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface SearchPerformedEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 14, 2021
*/
public interface SearchPerformedEventHandler extends EventHandler {
/**
* On search done.
*
* @param searchPerformedEvent the search performed event
*/
void onSearchDone(SearchPerformedEvent searchPerformedEvent);
}

View File

@ -1,55 +1,138 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ShowDetailsEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jul 30, 2021
* Nov 14, 2022
*/
public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
public static Type<ShowDetailsEventHandler> TYPE = new Type<ShowDetailsEventHandler>();
private String geonaItemType;
private String layerObjectType;
private FeatureRow featureRow;
private String geonaMongoID;
private String itemName;
private String profileID;
private String projectID;
private boolean loadTimelineRelationships;
private boolean isEventFromTimeline;
private EVENT_SOURCE sourceEvent;
/**
* Instantiates a new show details event.
* The Enum EVENT_SOURCE.
*
* @param geonaItemType the geona item type
* @param geonaMongoID the geona mongo ID
* @param itemName the item name
* @param featureRow the feature row
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 22, 2022
*/
public ShowDetailsEvent(String geonaItemType, String geonaMongoID, String itemName, FeatureRow featureRow) {
this.geonaItemType = geonaItemType;
this.geonaMongoID = geonaMongoID;
this.itemName = itemName;
this.featureRow = featureRow;
public static enum EVENT_SOURCE {
LOCATE_ON_INIT, OPEN_DETAILS, OPEN_PROJECTS, LOCATE_SEARCHED, LOCATE_FROM_TIMELINE, GO_TO_LAYERS
}
/**
* Instantiates a new show details event.
*
* @param gir the gir
* @param itemName the item name
* @param featureRow the feature row
* @param layerObjectType the layer object type
* @param profileID the profile ID
* @param projectID the project ID
* @param featureRow the feature row
* @param loadTimelineRelationships the load timeline relationships
* @param sourceEvent the source event
*/
public ShowDetailsEvent(GeoNaItemRef gir, String itemName, FeatureRow featureRow) {
this.geonaItemType = gir.getItemType();
this.geonaMongoID = gir.getItemId();
this.itemName = itemName;
public ShowDetailsEvent(String layerObjectType, String profileID, String projectID, FeatureRow featureRow,
boolean loadTimelineRelationships, EVENT_SOURCE sourceEvent) {
this.layerObjectType = layerObjectType;
this.profileID = profileID;
this.projectID = projectID;
this.featureRow = featureRow;
this.loadTimelineRelationships = loadTimelineRelationships;
this.sourceEvent = sourceEvent;
}
/**
* Instantiates a new show details event.
*
* @param gir the gir
* @param featureRow the feature row
* @param loadTimelineRelationships the load timeline relationships
* @param sourceEvent the source event
*/
public ShowDetailsEvent(GeoportalItemReferences gir, FeatureRow featureRow, boolean loadTimelineRelationships,
boolean goToLayers, EVENT_SOURCE sourceEvent) {
this.layerObjectType = gir.getLayerObjectType();
this.profileID = gir.getProfileID();
this.projectID = gir.getProjectID();
this.featureRow = featureRow;
this.loadTimelineRelationships = loadTimelineRelationships;
this.sourceEvent = sourceEvent;
}
/**
* Event from timeline.
*
* @param bool the bool
*/
public void setEventFromTimeline(boolean bool) {
this.isEventFromTimeline = bool;
}
/**
* Checks if is event from timeline.
*
* @return true, if is event from timeline
*/
public boolean isEventFromTimeline() {
return isEventFromTimeline;
}
/**
* Gets the source event.
*
* @return the source event
*/
public EVENT_SOURCE getSourceEvent() {
return sourceEvent;
}
/**
* Gets the type.
*
* @return the type
*/
public static Type<ShowDetailsEventHandler> getTYPE() {
return TYPE;
}
/**
* Gets the layer object type.
*
* @return the layer object type
*/
public String getLayerObjectType() {
return layerObjectType;
}
/**
* Gets the profile ID.
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
}
/**
* Gets the project ID.
*
* @return the project ID
*/
public String getProjectID() {
return projectID;
}
/**
@ -73,15 +156,6 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
}
/**
* Gets the geona item type.
*
* @return the geona item type
*/
public String getGeonaItemType() {
return geonaItemType;
}
/**
* Gets the feature row.
*
@ -92,43 +166,44 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
}
/**
* Gets the geona mongo ID.
* Checks if is load timeline relationships.
*
* @return the geona mongo ID
* @return true, if is load timeline relationships
*/
public String getGeonaMongoID() {
return geonaMongoID;
public boolean isLoadTimelineRelationships() {
return loadTimelineRelationships;
}
/**
* Gets the item name.
*
* @return the item name
*/
public String getItemName() {
return itemName;
}
/**
* Sets the item name.
*
* @param itemName the new item name
*/
public void setItemName(String itemName) {
this.itemName = itemName;
}
/**
* Gets the geona item ref.
*
* @return the geona item ref
*/
public GeoNaItemRef getGeonaItemRef() {
return new GeoNaItemRef(geonaMongoID, geonaItemType);
public GeoportalItemReferences getGeonaItemRef() {
return new GeoportalItemReferences(projectID, profileID, layerObjectType);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ShowDetailsEvent [layerObjectType=");
builder.append(layerObjectType);
builder.append(", featureRow=");
builder.append(featureRow);
builder.append(", itemName=");
builder.append(itemName);
builder.append(", profileID=");
builder.append(profileID);
builder.append(", projectID=");
builder.append(projectID);
builder.append(", loadTimelineRelationships=");
builder.append(loadTimelineRelationships);
builder.append(", isEventFromTimeline=");
builder.append(isEventFromTimeline);
builder.append(", sourceEvent=");
builder.append(sourceEvent);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,122 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ShowPopupOnCentroidEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 12, 2023
*/
public class ShowPopupOnCentroidEvent extends GwtEvent<ShowPopupOnCentroidEventHandler> {
public static Type<ShowPopupOnCentroidEventHandler> TYPE = new Type<ShowPopupOnCentroidEventHandler>();
private String profileID;
private String projectID;
private GeoJSON spatialReference;
private ProjectView projectView;
/**
* Instantiates a new show popup on centroid event.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param spatialReference the spatial reference
*/
public ShowPopupOnCentroidEvent(String profileID, String projectID, GeoJSON spatialReference) {
this.profileID = profileID;
this.projectID = projectID;
this.spatialReference = spatialReference;
}
/**
* Instantiates a new show popup on centroid event.
*
* @param projectView the project view
*/
public ShowPopupOnCentroidEvent(ProjectView projectView) {
this.projectView = projectView;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<ShowPopupOnCentroidEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(ShowPopupOnCentroidEventHandler handler) {
handler.onShowPopup(this);
}
/**
* Gets the profile ID.
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
}
/**
* Gets the project ID.
*
* @return the project ID
*/
public String getProjectID() {
return projectID;
}
/**
* Gets the spatial reference.
*
* @return the spatial reference
*/
public GeoJSON getSpatialReference() {
return spatialReference;
}
/**
* Gets the project view.
*
* @return the project view
*/
public ProjectView getProjectView() {
return projectView;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ShowPopupOnCentroidEvent [profileID=");
builder.append(profileID);
builder.append(", projectID=");
builder.append(projectID);
builder.append(", spatialReference=");
builder.append(spatialReference);
builder.append(", projectView=");
builder.append(projectView);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface ShowPopupOnCentroidEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 12, 2023
*/
public interface ShowPopupOnCentroidEventHandler extends EventHandler {
/**
* On show popup.
*
* @param showPopupOnCentroiEvent the show popup on centroi event
*/
void onShowPopup(ShowPopupOnCentroidEvent showPopupOnCentroiEvent);
}

View File

@ -0,0 +1,80 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class TimelineProjectRelationsEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 3, 2022
*/
public class TimelineProjectRelationsEvent extends GwtEvent<TimelineProjectRelationsEventHandler> {
public static Type<TimelineProjectRelationsEventHandler> TYPE = new Type<TimelineProjectRelationsEventHandler>();
private EVENT_TYPE eventType = EVENT_TYPE.HIDE; //default
private ProjectDV theProjectDV;
/**
* The Enum EVENT_TYPE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 3, 2022
*/
public enum EVENT_TYPE {
SHOW, HIDE
}
/**
* Instantiates a new timeline project relations event.
*
* @param theProjectDV the the project DV
* @param eventType the event type
*/
public TimelineProjectRelationsEvent(ProjectDV theProjectDV, EVENT_TYPE eventType) {
this.theProjectDV = theProjectDV;
this.eventType = eventType;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<TimelineProjectRelationsEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(TimelineProjectRelationsEventHandler handler) {
handler.onTimelineRelationEvent(this);
}
/**
* Gets the event type.
*
* @return the event type
*/
public EVENT_TYPE getEventType() {
return eventType;
}
/**
* Gets the the project DV.
*
* @return the the project DV
*/
public ProjectDV getTheProjectDV() {
return theProjectDV;
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface TimelineProjectRelationsEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 3, 2022
*/
public interface TimelineProjectRelationsEventHandler extends EventHandler {
/**
* On timeline relation event.
*
* @param timelineProjectRelationsEvent the timeline project relations event
*/
void onTimelineRelationEvent(TimelineProjectRelationsEvent timelineProjectRelationsEvent);
}

View File

@ -0,0 +1,134 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class UpdateLayerToMapEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2023
*/
public class UpdateLayerToMapEvent extends GwtEvent<UpdateLayerToMapEventHandler> {
public static Type<UpdateLayerToMapEventHandler> TYPE = new Type<UpdateLayerToMapEventHandler>();
private GCubeCollection collection;
private String layerName;
private REQUEST_PARAMETER operation;
private String value;
private LAYER_TYPE layerType;
/**
* The Enum REQUEST_PARAMETER.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2023
*/
public static enum REQUEST_PARAMETER {
STYLE
}
/**
* The Enum LAYER_TYPE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2023
*/
public static enum LAYER_TYPE {
INDEX, DETAILS
}
/**
* Instantiates a new adds the layer to map event.
*
* @param collection the collection
* @param layerName the layer name
* @param type the type
*/
public UpdateLayerToMapEvent(GCubeCollection collection, String layerName, LAYER_TYPE type) {
this.collection = collection;
this.layerName = layerName;
this.layerType = type;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<UpdateLayerToMapEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Sets the operation.
*
* @param operation the operation
* @param value the value
*/
public void setOperation(REQUEST_PARAMETER operation, String value) {
this.operation = operation;
this.value = value;
}
/**
* Gets the value.
*
* @return the value
*/
public String getValue() {
return value;
}
/**
* Gets the layer type.
*
* @return the layer type
*/
public LAYER_TYPE getLayerType() {
return layerType;
}
/**
* Gets the operation.
*
* @return the operation
*/
public REQUEST_PARAMETER getOperation() {
return operation;
}
/**
* Gets the layer name.
*
* @return the layer name
*/
public String getLayerName() {
return layerName;
}
/**
* Gets the collection.
*
* @return the collection
*/
public GCubeCollection getCollection() {
return collection;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(UpdateLayerToMapEventHandler handler) {
handler.onUpdateLayer(this);
}
}

View File

@ -0,0 +1,20 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface UpdateLayerToMapEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2023
*/
public interface UpdateLayerToMapEventHandler extends EventHandler {
/**
* On update layer.
*
* @param updateLayerToMapEvent the update layer to map event
*/
void onUpdateLayer(UpdateLayerToMapEvent updateLayerToMapEvent);
}

View File

@ -0,0 +1,30 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
import com.google.gwt.event.shared.GwtEvent;
public class CloseCollectionEvent extends GwtEvent<CloseCollectionEventHandler> {
private String collectionId = null;
public static Type<CloseCollectionEventHandler> TYPE = new Type<CloseCollectionEventHandler>();
@Override
public Type<CloseCollectionEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(CloseCollectionEventHandler handler) {
handler.onCloseCollection(this);
}
public CloseCollectionEvent(String collectionId) {
this.collectionId=collectionId;
}
public String getCollectionId() {
return collectionId;
}
}

View File

@ -0,0 +1,9 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
import com.google.gwt.event.shared.EventHandler;
public interface CloseCollectionEventHandler extends EventHandler{
void onCloseCollection(CloseCollectionEvent closeCollectionEvent);
}

View File

@ -0,0 +1,40 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
import com.google.gwt.event.shared.GwtEvent;
public class OpenCollectionEvent extends GwtEvent<OpenCollectionEventHandler> {
private String collectionId = null;
public static Type<OpenCollectionEventHandler> TYPE = new Type<OpenCollectionEventHandler>();
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<OpenCollectionEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(OpenCollectionEventHandler handler) {
handler.onOpenCollection(this);
}
public OpenCollectionEvent(String collectionId) {
this.collectionId = collectionId;
}
public String getCollectionId() {
return collectionId;
}
}

View File

@ -0,0 +1,10 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
import com.google.gwt.event.shared.EventHandler;
public interface OpenCollectionEventHandler extends EventHandler {
void onOpenCollection(OpenCollectionEvent event);
}

View File

@ -32,15 +32,15 @@ public class ExtentWrapped extends ol.Extent {
super(minX, minY, maxX, maxY);
}
/**
* @param coordinate coordinate to check.
* @return true if the passed coordinate is contained or on the edge of the
* extent.
*/
@JsOverlay
public final Coordinate getCenter() {
return getCenter((ol.Extent) this);
}
// /**
// * @param coordinate coordinate to check.
// * @return true if the passed coordinate is contained or on the edge of the
// * extent.
// */
// @JsOverlay
// public final Coordinate getCenter() {
// return getCenter((ol.Extent) this);
// }
@JsMethod(name = "getCenter", namespace = PACKAGE_EXTENT)
private static native Coordinate getCenter(Extent extent);

View File

@ -19,17 +19,18 @@ public class LayerOrder {
* Nov 12, 2021
*/
public static enum LAYER_TYPE {
BASE_MAP, BASE_WMS, WMS_DETAIL, VECTOR
BASE_MAP, CUSTOM_WMS_DETAIL, BASE_WMS, WMS_DETAIL, VECTOR
}
public static final HashMap<LAYER_TYPE, Integer> LAYER_OFFSET = new HashMap<LAYER_TYPE, Integer>(5);
static {
LAYER_OFFSET.put(LAYER_TYPE.BASE_MAP, 0);
LAYER_OFFSET.put(LAYER_TYPE.BASE_WMS, 70);
LAYER_OFFSET.put(LAYER_TYPE.WMS_DETAIL, 140);
LAYER_OFFSET.put(LAYER_TYPE.VECTOR, 210);
LAYER_OFFSET.put(LAYER_TYPE.BASE_MAP, 0); //Base OL or MapBox
LAYER_OFFSET.put(LAYER_TYPE.CUSTOM_WMS_DETAIL, 70); //WMS custom Overlay. Es. Layer "Limiti Amministrativi"
LAYER_OFFSET.put(LAYER_TYPE.BASE_WMS, 210); // Index layers (i.e. centroids for UCD)
LAYER_OFFSET.put(LAYER_TYPE.WMS_DETAIL, 140); //Layer/s belonging to a Project (materialized layers. Ex. "Posizionamento Scavo")
LAYER_OFFSET.put(LAYER_TYPE.VECTOR, 320); //Vector layer to show other info. Ex. Pointer with coordinates (x,y) in the Light OL Map.
}
/**

View File

@ -1,7 +1,12 @@
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import com.google.gwt.core.client.GWT;
import ol.Collection;
import ol.Coordinate;
import ol.Extent;
import ol.control.Attribution;
import ol.control.Control;
import ol.control.FullScreen;
@ -10,50 +15,58 @@ import ol.control.ZoomSlider;
import ol.geom.LineString;
import ol.proj.Projection;
/**
* The Class MapUtils.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 12, 2020
* Nov 12, 2020
*/
public final class MapUtils {
/**
* Creates some default controls and adds it to the collection.
*
* @param controls collection with controls
*/
public static void addDefaultControls(final Collection<Control> controls) {
/**
* Creates some default controls and adds it to the collection.
*
* @param controls collection with controls
*/
public static void addDefaultControls(final Collection<Control> controls) {
controls.push(new FullScreen());
controls.push(new ZoomSlider());
MousePosition mousePosition = new MousePosition();
mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
controls.push(mousePosition);
controls.push(new FullScreen());
controls.push(new ZoomSlider());
MousePosition mousePosition = new MousePosition();
mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
controls.push(mousePosition);
Attribution attribution = new Attribution();
attribution.setCollapsed(true);
controls.push(attribution);
//controls.push(new ZoomToExtent());
// controls.push(new ZoomToExtent());
}
}
/**
* Transform coordiante.
*
* @param centerCoordinate the center coordinate
* @param source the source
* @param target the target
* @param source the source
* @param target the target
* @return the coordinate
*/
public static Coordinate transformCoordiante(Coordinate centerCoordinate, String source, String target) {
return Projection.transform(centerCoordinate, source, target);
}
/**
* Transform extent.
*
* @param extent the extent
* @param source the source
* @param target the target
* @return the extent
*/
public static Extent transformExtent(Extent extent, String source, String target) {
return Projection.transformExtent(extent, source, target);
}
/**
* Distance between centroid.
@ -63,10 +76,9 @@ public final class MapUtils {
* @return the long
*/
public static long distanceBetweenCentroid(ExtentWrapped ex1, ExtentWrapped ex2) {
return distanceBetween(ex1.getCenter(),ex2.getCenter());
return distanceBetween(ex1.getCenter(), ex2.getCenter());
}
/**
* Distance between.
*
@ -84,15 +96,43 @@ public final class MapUtils {
// GWT.log("Line length is: "+ls);
return Math.round(ls.getLength() * 100) / 100;
}
/**
* Reverse coordinate.
*
* @param coord the coord
* @return the coordinate
*/
public static Coordinate reverseCoordinate(Coordinate coord){
public static Coordinate reverseCoordinate(Coordinate coord) {
return new Coordinate(coord.getY(), coord.getX());
}
/**
* Geo JSON to B box center.
*
* @param spatialReference the spatial reference
* @param transforFrom the transfor from
* @param transformTo the transform to
* @return the coordinate
*/
public static Coordinate geoJSONToBBOXCenter(GeoJSON spatialReference, String transforFrom, String transformTo) {
try {
if (spatialReference != null) {
ExtentWrapped ew = new ExtentWrapped(spatialReference.getBbox().getMinX(),
spatialReference.getBbox().getMinY(), spatialReference.getBbox().getMaxX(),
spatialReference.getBbox().getMaxY());
Coordinate center = ew.getCenter();
if (transforFrom != null && transformTo != null)
center = transformCoordiante(center, transforFrom, transformTo);
return center;
}
} catch (Exception e) {
GWT.log("geoJSONTToBBoxCenter error: " + e.getMessage());
}
return null;
}
}

View File

@ -1,6 +1,7 @@
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
@ -8,6 +9,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerCon
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
import org.gcube.portlets.user.geoportaldataviewer.client.util.WFSMakerUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
@ -35,7 +37,10 @@ import ol.Overlay;
import ol.OverlayOptions;
import ol.Size;
import ol.View;
import ol.ViewFitOptions;
import ol.ViewOptions;
import ol.animation.AnimationOptions;
import ol.color.Color;
import ol.event.EventListener;
import ol.geom.Geometry;
import ol.interaction.Draw;
@ -61,6 +66,11 @@ import ol.source.Source;
import ol.source.Vector;
import ol.source.Xyz;
import ol.source.XyzOptions;
import ol.style.Fill;
import ol.style.FillOptions;
import ol.style.Stroke;
import ol.style.StrokeOptions;
import ol.style.Style;
/**
* The Class OpenLayerMap.
@ -71,8 +81,29 @@ import ol.source.XyzOptions;
*/
public abstract class OpenLayerMap {
public static final String CQL_FILTER_PARAMETER = WFSMakerUtil.CQL_FILTER_PARAMETER;
private static final int MAX_LENGHT_CQL_FOR_GET_REQUEST = 1600; // 1600 characters
public static final int SET_CENTER_ANIMATED_DURATION = 500;
public static final int ZOOM_ANIMATED_DURATION = 3000;
public static final int MAX_ZOOM = 21;
/**
* The Enum CQL_FACILITY_ORIGIN.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 6, 2023
*/
public static enum CQL_FACILITY_ORIGIN {
SEARCH, CROSS_FILTERING
}
public HashMap<CQL_FACILITY_ORIGIN, String> cqlFilterMap = new HashMap<CQL_FACILITY_ORIGIN, String>();
/**
* Click listener.
*
@ -136,24 +167,26 @@ public abstract class OpenLayerMap {
private LinkedHashMap<String, Image> wmsDetailsLayerMap;
private LinkedHashMap<String, Image> wmsGroupedCustomLayerMap;
private LinkedHashMap<String, Image> wmsLayerMap;
private LinkedHashMap<String, ol.layer.Vector> vectorLayersHighlighted = new LinkedHashMap<String, ol.layer.Vector>();
private Layer baseLayerTile;
private LayerOrder layerOrder = new LayerOrder();
/**
* Instantiates a new open layer OSM.
*
* @param divTargetId the div target id
* @param eventBus the event bus
* @param baseLayer the base layer
* @param eventBus the event bus
* @param baseLayer the base layer
*/
public OpenLayerMap(String divTargetId, HandlerManager eventBus, BaseMapLayer baseLayer) {
this.eventBus = eventBus;
// create a projection
projectionOptions.setCode(MAP_PROJECTION.EPSG_3857.getName());
projectionOptions.setUnits("m");
@ -172,7 +205,7 @@ public abstract class OpenLayerMap {
map = new Map(mapOptions);
//map.addLayer(baseLayerTile);
// map.addLayer(baseLayerTile);
// map.addLayer(tileDebugLayer);
// add some controls
@ -182,8 +215,8 @@ public abstract class OpenLayerMap {
// add some interactions
map.addInteraction(new KeyboardPan());
map.addInteraction(new KeyboardZoom());
//applying base map
// applying base map
changeBaseMap(baseLayer);
bindEvents();
@ -212,11 +245,11 @@ public abstract class OpenLayerMap {
XyzOptions xyzOptions = OLFactory.createOptions();
Osm osmSource = new Osm(xyzOptions);
osmSource.setUrl(baseLayer.getUrl());
//setAttributions is buggy
//osmSource.setAttributions(baseLayer.getAttribution());
// setAttributions is buggy
// osmSource.setAttributions(baseLayer.getAttribution());
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(osmSource);
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_MAP)+1;
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_MAP) + 1;
layerOptions.setZIndex(zIndex);
baseLayerTile = new Tile(layerOptions);
@ -226,16 +259,15 @@ public abstract class OpenLayerMap {
XyzOptions xyzOptions2 = OLFactory.createOptions();
Xyz xyz = new Xyz(xyzOptions2);
//setAttributions is buggy
//xyz.setAttributions(baseLayer.getAttribution());
// setAttributions is buggy
// xyz.setAttributions(baseLayer.getAttribution());
xyz.setUrl(baseLayer.getUrl());
LayerOptions layerOptions2 = OLFactory.createOptions();
layerOptions2.setSource(xyz);
zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_MAP)+1;
zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_MAP) + 1;
layerOptions2.setZIndex(zIndex);
baseLayerTile = new Tile(layerOptions2);
break;
@ -300,7 +332,13 @@ public abstract class OpenLayerMap {
* @param centerCoordinate the new center
*/
public void setCenter(Coordinate centerCoordinate) {
view.setCenter(centerCoordinate);
AnimationOptions animations = new AnimationOptions();
animations.setCenter(centerCoordinate);
animations.setDuration(SET_CENTER_ANIMATED_DURATION);
view.animate(animations);
// view.setCenter(centerCoordinate);
}
/**
@ -309,7 +347,11 @@ public abstract class OpenLayerMap {
* @param zoom the new zoom
*/
public void setZoom(int zoom) {
view.setZoom(zoom);
AnimationOptions animations = new AnimationOptions();
animations.setDuration(ZOOM_ANIMATED_DURATION);
animations.setZoom(zoom);
view.animate(animations);
// view.setZoom(zoom);
}
/**
@ -325,7 +367,7 @@ public abstract class OpenLayerMap {
elPopup.getStyle().setVisibility(Visibility.VISIBLE);
if (popupOverlay == null) {
popupOverlay = addOverlay(elPopup);
addPopupCloserHandelr(popupOverlay);
addPopupCloserHandler(popupOverlay);
}
Element popContent = DOM.getElementById("popup-content");
popContent.setInnerHTML(html);
@ -343,11 +385,11 @@ public abstract class OpenLayerMap {
}
/**
* Adds the popup closer handelr.
* Adds the popup closer handler.
*
* @param popupOverlay the popup overlay
*/
private void addPopupCloserHandelr(Overlay popupOverlay) {
private void addPopupCloserHandler(Overlay popupOverlay) {
Element elPopupCloser = DOM.getElementById("popup-closer");
Event.sinkEvents(elPopupCloser, Event.ONCLICK);
Event.setEventListener(elPopupCloser, new com.google.gwt.user.client.EventListener() {
@ -397,14 +439,15 @@ public abstract class OpenLayerMap {
imageWMSParams.setLayers(layerItem.getName());
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
imageWMSOptions.setUrl(layerItem.getMapServerHost());
imageWMSOptions.setUrl(layerItem.getMapServerEndpoint());
imageWMSOptions.setParams(imageWMSParams);
// imageWMSOptions.setRatio(1.5f);
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(imageWMSSource);
// Settings MIN and MAX Resolution
if (layerItem.getMinResolution() != null) {
layerOptions.setMinResolution(layerItem.getMinResolution());
@ -414,7 +457,8 @@ public abstract class OpenLayerMap {
}
Image wmsLayer = new Image(layerOptions);
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_WMS)+wmsLayerMap.size()+1;
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_WMS) + wmsLayerMap.size() + 1;
wmsLayer.setZIndex(zIndex);
// visibleLayerItems
@ -429,12 +473,63 @@ public abstract class OpenLayerMap {
}
/**
* Sets the CQL filter to WMS layer.
*
* @param origin the origin
* @param layerName the key
* @param newCQLFilterExpression the cql filter expression
* @return the new CQL Filter
*/
public String setCQLFilterToWMSLayer(CQL_FACILITY_ORIGIN origin, String layerName, String newCQLFilterExpression) {
GWT.log("Getting key (layerName): " + layerName);
GWT.log("Adding CQL FILTER: " + newCQLFilterExpression);
Image wmsLayer = wmsLayerMap.get(layerName);
GWT.log("WMS layer is: " + wmsLayer);
ImageWms imageWMSSource = wmsLayer.getSource();
ImageWmsParams imageWMSParams = imageWMSSource.getParams();
// Setting new CQL filter for Origin
cqlFilterMap.put(origin, newCQLFilterExpression);
String setCQLFilter = "";
// Building new CQL filter
for (CQL_FACILITY_ORIGIN originKey : cqlFilterMap.keySet()) {
String originCQLFilter = cqlFilterMap.get(originKey);
if (originCQLFilter != null) {
if (setCQLFilter.isEmpty()) {
setCQLFilter = originCQLFilter;
} else {
setCQLFilter += " AND " + originCQLFilter;
}
}
}
if (setCQLFilter.isEmpty())
imageWMSParams.delete(CQL_FILTER_PARAMETER);
else
imageWMSParams.set(CQL_FILTER_PARAMETER, setCQLFilter);
imageWMSSource.updateParams(imageWMSParams);
wmsLayer.setSource(imageWMSSource);
wmsLayer.changed();
GWT.log("returning " + CQL_FILTER_PARAMETER + ": " + setCQLFilter);
return setCQLFilter;
}
/**
* Adds the WMS detail layer.
*
* @param layerItem the layer item
* @param layerItem the layer item
* @param initialOpacity the initial opacity
*/
public synchronized void addWMSDetailLayer(LayerItem layerItem) {
public void addWMSDetailLayer(LayerItem layerItem, double initialOpacity) {
if (wmsDetailsLayerMap == null)
wmsDetailsLayerMap = new LinkedHashMap<String, Image>();
@ -449,14 +544,14 @@ public abstract class OpenLayerMap {
imageWMSParams.setLayers(layerItem.getName());
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
imageWMSOptions.setUrl(layerItem.getMapServerHost());
imageWMSOptions.setUrl(layerItem.getMapServerEndpoint());
imageWMSOptions.setParams(imageWMSParams);
// imageWMSOptions.setRatio(1.5f);
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(imageWMSSource);
// Settings MIN and MAX Resolution
if (layerItem.getMinResolution() != null) {
layerOptions.setMinResolution(layerItem.getMinResolution());
@ -466,8 +561,9 @@ public abstract class OpenLayerMap {
}
Image wmsLayer = new Image(layerOptions);
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.WMS_DETAIL)+wmsDetailsLayerMap.size() + 1;
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.WMS_DETAIL) + wmsDetailsLayerMap.size() + 1;
wmsLayer.setZIndex(zIndex);
wmsLayer.setOpacity(initialOpacity);
map.addLayer(wmsLayer);
wmsDetailsLayerMap.put(key, wmsLayer);
@ -479,17 +575,89 @@ public abstract class OpenLayerMap {
}
/**
* Adds the custom WMS detail layer.
*
* @param layerItem the layer item
*/
public void addGroupedCustomWMSLayer(LayerItem layerItem) {
if (wmsGroupedCustomLayerMap == null)
wmsGroupedCustomLayerMap = new LinkedHashMap<String, Image>();
String key = layerItem.getName();
Image layer = wmsGroupedCustomLayerMap.get(key);
if (layer == null) {
GWT.log("The grouped custom layer with key: " + key + " does not exist, creating and adding it to map");
ImageWmsParams imageWMSParams = OLFactory.createOptions();
imageWMSParams.setLayers(layerItem.getName());
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
imageWMSOptions.setUrl(layerItem.getMapServerEndpoint());
imageWMSOptions.setParams(imageWMSParams);
// imageWMSOptions.setRatio(1.5f);
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(imageWMSSource);
// Settings MIN and MAX Resolution
if (layerItem.getMinResolution() != null) {
layerOptions.setMinResolution(layerItem.getMinResolution());
}
if (layerItem.getMaxResolution() != null) {
layerOptions.setMaxResolution(layerItem.getMaxResolution());
}
Image wmsLayer = new Image(layerOptions);
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.CUSTOM_WMS_DETAIL) + wmsGroupedCustomLayerMap.size()
+ 1;
wmsLayer.setZIndex(zIndex);
map.addLayer(wmsLayer);
wmsGroupedCustomLayerMap.put(key, wmsLayer);
GWT.log("Added GroupedCustomWMSLayer for layer name: " + layerItem.getName());
eventBus.fireEvent(new AddedLayerToMapEvent(layerItem, LAYER_TYPE.OVERLAY));
} else {
GWT.log("The WMS detail layer with key: " + key + " already exists, skipping");
}
}
/**
* Removes the all detail layers.
*
* @param layerName the layer name
*/
public void removeWMSLayer(String layerName) {
GWT.log("Removing layerName: " + layerName + " from map: " + wmsLayerMap);
// NOT NEEDED ANYMORE.. I'M USING MIN/MAX LAYER RESOLUTION
if (wmsLayerMap == null)
return;
Image layer = wmsLayerMap.get(layerName);
if (layer != null) {
map.removeLayer(layer);
wmsLayerMap.remove(layerName);
GWT.log("Removed layerName: " + layerName + " from map: " + wmsLayerMap.keySet());
}
}
/**
* Removes the all detail layers.
*/
public void removeAllDetailLayers() {
// NOT NEEDED ANYMORE.. I'M USING MIN/MAX LAYER RESOLUTION
if (wmsDetailsLayerMap == null)
return;
GWT.log("Removing layers: " + wmsDetailsLayerMap.keySet() + " from map");
GWT.log("Removing wmsDetailsLayerMap: " + wmsDetailsLayerMap.keySet() + " from map");
for (String key : wmsDetailsLayerMap.keySet()) {
Image layer = wmsDetailsLayerMap.get(key);
@ -500,6 +668,24 @@ public abstract class OpenLayerMap {
}
/**
* Removes the all layer features as highlight.
*/
public void removeAllLayerFeaturesAsHighlight() {
if (vectorLayersHighlighted == null)
return;
GWT.log("Removing vectorLayersHighlighted: " + vectorLayersHighlighted.keySet() + " from map");
for (String layerName : vectorLayersHighlighted.keySet()) {
removeLayerFeaturesAsHighlight(layerName);
}
vectorLayersHighlighted.clear();
}
/**
* Adds the vector.
*
@ -510,12 +696,12 @@ public abstract class OpenLayerMap {
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
vectorLayerOptions.setMap(map);
// Style style = new Style();
// FillOptions fillOptions = new FillOptions();
// Color color = new Color(0, 0, 255, 1.0);
// fillOptions.setColor(color);
// Fill fill = new Fill(fillOptions);
// style.setFill(fill);
Style style = new Style();
FillOptions fillOptions = new FillOptions();
Color color = new Color(0, 0, 255, 1.0);
fillOptions.setColor(color);
Fill fill = new Fill(fillOptions);
style.setFill(fill);
FeatureOptions featureOptions = new FeatureOptions();
featureOptions.setGeometry(geometry);
@ -524,15 +710,105 @@ public abstract class OpenLayerMap {
Vector vectorSource = OLFactory.createVectorSource();
vectorSource.addFeature(feature);
vectorLayerOptions.setSource(vectorSource);
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR)+1;
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR) + 1000;
vector.setZIndex(zIndex);
map.addLayer(vector);
}
/**
* Adds the vector.
*
* @param layerItem the layer item
* @param features the features
* @param fitMapToFeaturesExtent the fit map to features extent
*/
public void addLayerFeaturesAsHighlight(LayerItem layerItem, Feature[] features, boolean fitMapToFeaturesExtent) {
removeLayerFeaturesAsHighlight(layerItem.getName());
Style style = new Style();
StrokeOptions strokeOptions = new StrokeOptions();
strokeOptions.setColor(new Color(255, 69, 0, 0.8));
strokeOptions.setWidth(5);
Stroke stroke = new Stroke(strokeOptions);
stroke.setWidth(2);
style.setStroke(stroke);
Vector vectorSource = OLFactory.createVectorSource();
EventListener<ol.events.Event> listenerE = new EventListener<ol.events.Event>() {
@Override
public void onEvent(ol.events.Event event) {
ol.Extent theExtent = vectorSource.getExtent();
// GWT.log(theExtent.toString());
map.getView().fit(theExtent);
}
};
if (fitMapToFeaturesExtent)
vectorSource.addChangeListener(listenerE);
vectorSource.addFeatures(features);
// GWT.log("features: " + features);
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
vectorLayerOptions.setSource(vectorSource);
vectorLayerOptions.setStyle(style);
// GWT.log("vectorLayerOptions: " + vectorLayerOptions);
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
// vector.setStyle(style);
vector.setVisible(true);
vector.setZIndex(5000);
vectorLayersHighlighted.put(layerItem.getName(), vector);
map.addLayer(vector);
}
/**
* Are layer features A as highlight.
*
* @param layerItem the layer item
* @return true, if successful
*/
public boolean areLayerFeaturesAsHighlight(LayerItem layerItem) {
return vectorLayersHighlighted.get(layerItem.getName()) != null;
}
/**
* Removes the layer features A as highlight.
*
* @param layerName the layer name
* @return true, if successful
*/
public boolean removeLayerFeaturesAsHighlight(String layerName) {
try {
ol.layer.Vector vl = vectorLayersHighlighted.get(layerName);
if (vl != null) {
map.removeLayer(vl);
vectorLayersHighlighted.remove(layerName);
return true;
}
} catch (Exception e) {
}
return false;
}
/**
* Adds the point vector source.
*
@ -854,6 +1130,23 @@ public abstract class OpenLayerMap {
layer.setVisible(visible);
}
public void setLayerStyleForIndex(String layerName, String value) {
GWT.log("Setting style " + value + " for " + layerName);
Image indexWmsLayer = wmsLayerMap.get(layerName);
GWT.log("WMS layer is: " + indexWmsLayer);
if (indexWmsLayer != null) {
ImageWms imageWMSSource = indexWmsLayer.getSource();
ImageWmsParams imageWMSParams = imageWMSSource.getParams();
imageWMSParams.set("STYLES", value);
imageWMSSource.updateParams(imageWMSParams);
indexWmsLayer.setSource(imageWMSSource);
indexWmsLayer.changed();
}
}
/**
* Sets the WMS detail layer opacity.
*
@ -863,7 +1156,21 @@ public abstract class OpenLayerMap {
public void setWMSDetailLayerOpacity(LayerItem layerItem, double opacity) {
String key = layerItem.getName();
Image layer = wmsDetailsLayerMap.get(key);
layer.setOpacity(opacity);
if (layer != null)
layer.setOpacity(opacity);
}
/**
* Sets the WMS detail layer visible.
*
* @param layerItem the layer item
* @param visible the visible
*/
public void setWMSGroupedCustomLayerVisible(LayerItem layerItem, boolean visible) {
String key = layerItem.getName();
Image layer = wmsGroupedCustomLayerMap.get(key);
if (layer != null)
layer.setVisible(visible);
}
/**
@ -903,4 +1210,17 @@ public abstract class OpenLayerMap {
return map.get((map.keySet().toArray())[index]);
}
/**
* Fit to extent.
*
* @param extent the extent
*/
public void fitToExtent(ol.Extent extent) {
ViewFitOptions opt = new ViewFitOptions();
opt.setMaxZoom(16);
opt.setDuration(SET_CENTER_ANIMATED_DURATION * 5);
map.getView().fit(extent, opt);
}
}

View File

@ -6,23 +6,26 @@ import com.google.gwt.resources.client.CssResource;
import com.google.gwt.resources.client.ImageResource;
public interface GNAImages extends ClientBundle {
/** Get access to the css resource during gwt compilation */
@Source("baseIcons.css")
CssResource css();
public static final GNAImages ICONS = GWT.create(GNAImages.class);
/** Our sample image icon. Makes the image resource for the gwt-compiler's css composer accessible */
@Source("map.png")
ImageResource map();
@Source("preset_location.png")
ImageResource preset_location();
@Source("layers.png")
ImageResource layers();
/**
* Our sample image icon. Makes the image resource for the gwt-compiler's css
* composer accessible
*/
@Source("map1.png")
ImageResource map();
@Source("preset_location.png")
ImageResource preset_location();
@Source("layers.png")
ImageResource layers();
@Source("loading.gif")
ImageResource loading();
@ -38,4 +41,28 @@ public interface GNAImages extends ClientBundle {
@Source("world.png")
ImageResource worldIcon();
@Source("layer_visible.png")
ImageResource layerVisible();
@Source("layer_invisible.png")
ImageResource layerInvisible();
@Source("locate.png")
ImageResource locate();
@Source("locate_none.png")
ImageResource locateNone();
@Source("spinner_earth.gif")
ImageResource spinnerEarth();
@Source("spinner_clock.gif")
ImageResource spinnerClock();
@Source("geoportal_error.png")
ImageResource geoportaServiceError();
@Source("warning_error.png")
ImageResource warningError();
}

View File

@ -22,4 +22,4 @@
vertical-align: middle;
width: 17px !important;
height: 17px !important;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 465 B

After

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 705 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 683 B

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1,10 +1,9 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni.ConcessioneView;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectViewer;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
@ -33,7 +32,7 @@ public class DetailsPanel extends Composite {
@UiField
HTMLPanel detailsHTMLPanel;
private RecordDV displayedRecord = null;
private ProjectView displayedProject = null;
private HandlerManager applicationBus;
@ -63,15 +62,15 @@ public class DetailsPanel extends Composite {
}
public void showDetailsFor(ConcessioneDV cdv, GeoNaItemRef geonaItemRef) {
this.displayedRecord = cdv;
public void showDetailsFor(ProjectView result, GeoportalItemReferences geonaItemRef) {
this.displayedProject = result;
datailsContainerPanel.clear();
if(detailsHTMLPanel.getParent()!=null) {
detailsHTMLPanel.getParent().getElement().setScrollTop(0);
}
datailsContainerPanel.add(new ConcessioneView(geonaItemRef, cdv));
datailsContainerPanel.add(new ProjectViewer(applicationBus, geonaItemRef, result));
showPanelDetails();
}
@ -80,13 +79,13 @@ public class DetailsPanel extends Composite {
}
public void hidePanelDetails() {
this.displayedRecord = null;
this.displayedProject = null;
datailsContainerPanel.clear();
detailsHTMLPanel.setVisible(false);
}
public RecordDV getDisplayedRecord() {
return displayedRecord;
public ProjectView getDisplayedProject() {
return displayedProject;
}
}

View File

@ -8,12 +8,23 @@
}
.to-align-right{
position: absolute;
top: 10px;
top: 50px;
right: 10px;
}
.to-align-left {
position: absolute;
top: 5px;
color: white !important;
text-decoration: none !important;
}
.to-align-left :hover {
color: #F5F5F5;
}
</ui:style>
<g:HTMLPanel ui:field="detailsHTMLPanel" visible="false">
<b:Button ui:field="closeButton" addStyleNames="{style.to-align-right}"></b:Button>
<b:Button ui:field="closeButton" addStyleNames="{style.to-align-left}"></b:Button>
<g:HTMLPanel ui:field="datailsContainerPanel"></g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,27 +1,55 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.ConfiguredLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.GisToolbarFacilities;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.search.SearchFacilityUI;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.crossfiltering.CrossFilteringLayerPanel;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.customoverlays.OverlayCustomLayerPanel;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.layercollection.LayerCollectionPanel;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.DropdownButton;
import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.Paragraph;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.client.ui.constants.LabelType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
@ -32,10 +60,13 @@ import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
@ -49,6 +80,10 @@ import com.google.gwt.user.client.ui.Widget;
*/
public class GeonaDataViewMainPanel extends Composite {
private static final String PLACEHOLDER_SELECT_SEARCH_IN = "Select Collection...";
private static GeonaDataViewMainPanelUiBinder uiBinder = GWT.create(GeonaDataViewMainPanelUiBinder.class);
/**
@ -89,17 +124,46 @@ public class GeonaDataViewMainPanel extends Composite {
Button linkLayers;
@UiField
ScrollPanel overlayLayersPanel;
DropdownButton openCollectionDropDown;
@UiField
DropdownButton linkCustomOverlayLayers;
@UiField
DropdownButton linkCrossFilteringLayers;
@UiField
HTMLPanel panelCustomOverlayLayers;
@UiField
HTMLPanel panelCrossFilteringLayers;
@UiField
HTMLPanel openCollectionPanel;
@UiField
DropdownButton searchFacilityButton;
@UiField
ListBox navListSearch;
//@UiField
//ScrollPanel overlayLayersPanel;
RootPanel overlayLayersPanel = RootPanel.get(GeoportalDataViewer.DIV_LAYER_VIEW);
@UiField
ScrollPanel searchFacilityPanel;
@UiField
HTMLPanel panelAttribution;
@UiField
HTMLPanel panelBaseLayers;
@UiField
DropdownButton linkMap;
@UiField
DropdownButton linkPresetLocation;
@ -108,20 +172,21 @@ public class GeonaDataViewMainPanel extends Composite {
private OpenLayerMap map;
private HandlerManager applicationBus;
/**
* Instantiates a new geona data view main panel.
*
* @param applicationBus the application bus
* @param mapHeight the map height
*/
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight) {
private HashMap<String, List<CheckBox>> mapCollectionCheckBoxes;
private SearchFacilityUI currentSearchFacility;
private HashMap<String, ItemFieldsResponse> mapItemFieldsForUCD = new HashMap<String, ItemFieldsResponse>();
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight,
List<ItemFieldsResponse> itemFieldsReponse) {
initWidget(uiBinder.createAndBindUi(this));
this.applicationBus = applicationBus;
mapPanel = new MapPanel(mapHeight + "px");
detailsPanel.setHeight(mapHeight + "px");
detailsPanel.setApplicationBus(applicationBus);
overlayLayersPanel.setVisible(false);
mainContainerPanel.add(mapPanel);
bindHandlers();
dataPointSelection.setIcon(IconType.SCREENSHOT);
@ -137,16 +202,109 @@ public class GeonaDataViewMainPanel extends Composite {
worldImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
extentToEarth.getElement().appendChild(worldImg.getElement());
extentToEarth.setWidth("140px");
linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
// linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
openCollectionDropDown.setIcon(IconType.COMPASS);
mapItemFieldsForUCD.clear();
SearchingFilter initialSortFilter = new SearchingFilter();
initialSortFilter.setOrder(ORDER.ASC);
navListSearch.addItem(PLACEHOLDER_SELECT_SEARCH_IN, PLACEHOLDER_SELECT_SEARCH_IN);
navListSearch.getElement().getFirstChildElement().setAttribute("disabled", "disabled");
for (final ItemFieldsResponse itemFieldResp : itemFieldsReponse) {
UseCaseDescriptorDV ucd = itemFieldResp.getUseCaseDescriptorDV();
mapItemFieldsForUCD.put(ucd.getId(), itemFieldResp);
GWT.log("Added navLink for: " + ucd.getName());
navListSearch.addItem(ucd.getName(), ucd.getProfileID());
}
navListSearch.addChangeHandler(new ChangeHandler() {
private SearchFacilityUI currentSearchFacility;
@Override
public void onChange(ChangeEvent event) {
if (this.currentSearchFacility != null)
this.currentSearchFacility.resetCurrentSearch();
String ucdProfileID = navListSearch.getValue(navListSearch.getSelectedIndex());
GWT.log("UCD ProfileID selected: " + ucdProfileID);
if (ucdProfileID.compareTo(PLACEHOLDER_SELECT_SEARCH_IN) != 0) {
searchFacilityPanel.clear();
ItemFieldsResponse itemFieldResp = mapItemFieldsForUCD.get(ucdProfileID);
List<ItemFieldDV> result = itemFieldResp.getListItemFields();
List<ItemFieldDV> displayFields = new ArrayList<ItemFieldDV>();
List<ItemFieldDV> searchByFields = new ArrayList<ItemFieldDV>();
List<ItemFieldDV> sortByFields = new ArrayList<ItemFieldDV>();
for (ItemFieldDV itemField : result) {
if (itemField.isDisplayAsResult()) {
displayFields.add(itemField);
}
if (itemField.isSearchable()) {
searchByFields.add(itemField);
}
if (itemField.isSortable()) {
sortByFields.add(itemField);
}
}
this.currentSearchFacility = new SearchFacilityUI(ucdProfileID, applicationBus, displayFields,
sortByFields, searchByFields, initialSortFilter);
searchFacilityPanel.add(currentSearchFacility);
currentSearchFacility.setSearchButton(searchFacilityButton);
}
}
});
searchFacilityButton.setIcon(IconType.SEARCH);
if (itemFieldsReponse.size() == 0) {
searchFacilityPanel.setVisible(false);
searchFacilityButton.setVisible(false);
}
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
searchFacilityPanel.getElement().getParentElement().addClassName("opacity-09");
panelCustomOverlayLayers.getElement().getParentElement().addClassName("opacity-09");
panelCrossFilteringLayers.getElement().getParentElement().addClassName("opacity-09");
}
});
openCollectionDropDown.setTitle(GisToolbarFacilities.COLLECTION.getTooltip());
linkCustomOverlayLayers.setTitle(GisToolbarFacilities.OVERLAY.getTooltip());
linkCrossFilteringLayers.setTitle(GisToolbarFacilities.FILTER.getTooltip());
searchFacilityButton.setTitle(GisToolbarFacilities.SEARCH.getTooltip());
linkLayers.setTitle(GisToolbarFacilities.LAYERS.getTooltip());
linkMap.setTitle(GisToolbarFacilities.MAP.getTooltip());
linkPresetLocation.setTitle(GisToolbarFacilities.PRESET_LOCATION.getTooltip());
// layersDDB.setToggle(true);
bindEvents();
}
/**
* Bind events.
*/
private void bindEvents() {
linkLayers.addClickHandler(new ClickHandler() {
@ -164,6 +322,45 @@ public class GeonaDataViewMainPanel extends Composite {
}
});
searchFacilityButton.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// event.preventDefault();
event.stopPropagation();
}
}, ClickEvent.getType());
openCollectionDropDown.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// event.preventDefault();
event.stopPropagation();
}
}, ClickEvent.getType());
linkCustomOverlayLayers.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// event.preventDefault();
event.stopPropagation();
}
}, ClickEvent.getType());
linkCrossFilteringLayers.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// event.preventDefault();
event.stopPropagation();
}
}, ClickEvent.getType());
}
/**
@ -179,7 +376,31 @@ public class GeonaDataViewMainPanel extends Composite {
setOverlayPanelMaxHeight();
}
public void setPanelsWidth(int clientWidth) {
if(clientWidth<GeoportalDataViewerConstants.TABLET_WIDTH) {
openCollectionDropDown.setText("");
linkCustomOverlayLayers.setText("");
linkCrossFilteringLayers.setText("");
searchFacilityButton.setText("");
linkLayers.setText("");
linkPresetLocation.setText("");
linkMap.setText("");
}else {
openCollectionDropDown.setText(GisToolbarFacilities.COLLECTION.getName());
linkCustomOverlayLayers.setText(GisToolbarFacilities.OVERLAY.getName());
linkCrossFilteringLayers.setText(GisToolbarFacilities.FILTER.getName());
searchFacilityButton.setText(GisToolbarFacilities.SEARCH.getName());
linkLayers.setText(GisToolbarFacilities.LAYERS.getName());
linkMap.setText(GisToolbarFacilities.MAP.getName());
linkPresetLocation.setText(GisToolbarFacilities.PRESET_LOCATION.getName());
}
}
/**
* Sets the overlay panel max height.
*/
private void setOverlayPanelMaxHeight() {
String overlMH = mapPanel.getOffsetHeight() - 130 + "px";
@ -274,11 +495,11 @@ public class GeonaDataViewMainPanel extends Composite {
/**
* Show as details.
*
* @param concessioneDV the concessione DV
* @param geonaItemRef the geona item ref
* @param result the result
* @param geonaItemRef the geona item ref
*/
public void showAsDetails(ConcessioneDV concessioneDV, GeoNaItemRef geonaItemRef) {
detailsPanel.showDetailsFor(concessioneDV, geonaItemRef);
public void showAsDetails(ProjectView result, GeoportalItemReferences geonaItemRef) {
detailsPanel.showDetailsFor(result, geonaItemRef);
}
@ -291,12 +512,12 @@ public class GeonaDataViewMainPanel extends Composite {
}
/**
* Gets the displyed record.
* Gets the displayed record.
*
* @return the displyed record
* @return the displayed record
*/
public RecordDV getDisplyedRecord() {
return detailsPanel.getDisplayedRecord();
public ProjectView getDisplayedProject() {
return detailsPanel.getDisplayedProject();
}
/**
@ -324,6 +545,9 @@ public class GeonaDataViewMainPanel extends Composite {
// layersDDBClickEvent();
}
/**
* Layers DDB click event.
*/
private void layersDDBClickEvent() {
linkLayers.fireEvent(new GwtEvent<ClickHandler>() {
@Override
@ -349,6 +573,11 @@ public class GeonaDataViewMainPanel extends Composite {
// layersDDBClickEvent();
}
/**
* Sets the map attribution.
*
* @param attribution the new map attribution
*/
public void setMapAttribution(String attribution) {
panelAttribution.clear();
Label label = new Label("Base Map Credits");
@ -356,39 +585,202 @@ public class GeonaDataViewMainPanel extends Composite {
panelAttribution.add(label);
panelAttribution.add(p);
}
/**
* Sets the base layers.
*
* @param listBaseLayers the new base layers
*/
public void setAvailableCollections(Collection<GCubeCollection> collection, String openCollectionID) {
GWT.log("Init Available collections menu");
if (collection == null || collection.isEmpty())
GWT.log("!!! No Available collections");
mapCollectionCheckBoxes = new HashMap<String, List<CheckBox>>();
for (GCubeCollection coll : collection) {
GWT.log("Found available collection " + coll);
final String collectionID = coll.getUcd().getId(); // collectionID == UCD_Id
LayerCollectionPanel lcp = new LayerCollectionPanel(coll, applicationBus);
openCollectionPanel.add(lcp);
List<CheckBox> listCollections = mapCollectionCheckBoxes.get(collectionID);
if (listCollections == null)
listCollections = new ArrayList<CheckBox>();
listCollections.add(lcp.getCheckbox());
mapCollectionCheckBoxes.put(collectionID, listCollections);
// Opening All Collections if openCollectionID is null
if (openCollectionID == null) {
lcp.getCheckbox().setValue(true, true);
// String collectionID = checkbox.getId().replace("gcubeCollectionSelector_",
// "");
GWT.log("Opening the collection: " + collectionID);
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
}
}
// Opening All Collections if openCollectionID is null
if (openCollectionID != null) {
List<CheckBox> listCheckBoxes = mapCollectionCheckBoxes.get(openCollectionID);
if (listCheckBoxes != null) {
for (CheckBox checkBox : listCheckBoxes) {
checkBox.setValue(true, true);
String collectionID = checkBox.getId().replace("gcubeCollectionSelector_", "");
GWT.log("Opening the input collection: " + collectionID);
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
}
}
}
}
public void openCollectionMenu() {
GWT.log("openCollectionMenu");
GeoportalDataViewerConstants.clickElement(openCollectionDropDown.getElement().getFirstChildElement());
}
public void setBaseLayers(List<BaseMapLayer> listBaseLayers) {
if(listBaseLayers==null)
if (listBaseLayers == null)
return;
int i = 0;
for (BaseMapLayer baseMapLayer : listBaseLayers) {
RadioButton radio = new RadioButton("base-layer");
radio.setText(baseMapLayer.getName());
if(i==0) {
if (i == 0) {
radio.setValue(true, false);
}
radio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
applicationBus.fireEvent(new ChangeMapLayerEvent(baseMapLayer));
}
});
SimplePanel sp = new SimplePanel(radio);
sp.getElement().addClassName("form-inline");
sp.getElement().addClassName("map-layers-radio");
panelBaseLayers.add(sp);
i++;
}
}
public void addOverlayLayers(GCubeCollection collection,
List<GroupedLayersDV<? extends LayerIDV>> listGroupedLayers) {
if (listGroupedLayers == null)
return;
com.github.gwtbootstrap.client.ui.Label collectionGroup = new com.github.gwtbootstrap.client.ui.Label(
collection.getUcd().getName());
collectionGroup.setType(LabelType.WARNING);
LayoutPanel lc = new LayoutPanel();
lc.add(collectionGroup);
panelCustomOverlayLayers.add(lc);
for (GroupedLayersDV gCustomLayerDV : listGroupedLayers) {
if (gCustomLayerDV.getListCustomLayers() != null) {
FlowPanel lcInner = new FlowPanel();
lcInner.getElement().getStyle().setMarginLeft(5.0, Unit.PX);
com.github.gwtbootstrap.client.ui.Label labelGroup = new com.github.gwtbootstrap.client.ui.Label(
gCustomLayerDV.getName());
labelGroup.setType(LabelType.INFO);
String descr = gCustomLayerDV.getDescription() != null && !gCustomLayerDV.getDescription().isEmpty()
? gCustomLayerDV.getDescription()
: gCustomLayerDV.getName();
labelGroup.setTitle(descr);
lcInner.add(labelGroup);
if (descr.compareTo(gCustomLayerDV.getName()) != 0) {
HTML overlayGroupDescr = new HTML();
overlayGroupDescr.getElement().setClassName("overlay-panel-style-description");
overlayGroupDescr.setHTML(descr);
lcInner.add(overlayGroupDescr);
}
List<ConfiguredLayerDV> list = gCustomLayerDV.getListCustomLayers();
for (ConfiguredLayerDV customLayer : list) {
if (customLayer.isDisplay()) {
LayerItem layerItem = new LayerItem();
if (customLayer.getWMS_URL() != null) {
final String mapServerHost = URLUtil.getPathURL(customLayer.getWMS_URL());
GWT.log("mapServerHost: " + mapServerHost);
layerItem.setMapServerHost(mapServerHost);
layerItem.setBaseLayer(false);
layerItem.setName(customLayer.getName());
layerItem.setTitle(customLayer.getTitle());
layerItem.setWmsLink(customLayer.getWMS_URL());
// panelCustomOverlayLayers.add(new CrossFilteringLayerPanel(layerItem,
// applicationBus));
lcInner.add(new OverlayCustomLayerPanel(layerItem, applicationBus));
map.addGroupedCustomWMSLayer(layerItem);
}
}
}
panelCustomOverlayLayers.add(lcInner);
}
}
linkCustomOverlayLayers.setVisible(listGroupedLayers.size() > 0);
}
public void addCrossFilteringLayers(GCubeCollection collection,
List<GroupedLayersDV<? extends LayerIDV>> listGroupedLayers) {
if (listGroupedLayers == null)
return;
com.github.gwtbootstrap.client.ui.Label collectionGroup = new com.github.gwtbootstrap.client.ui.Label(
collection.getUcd().getName());
collectionGroup.setType(LabelType.WARNING);
LayoutPanel lc = new LayoutPanel();
lc.add(collectionGroup);
panelCrossFilteringLayers.add(lc);
for (GroupedLayersDV<? extends LayerIDV> groupedLayerDV : listGroupedLayers) {
FlowPanel lcInner = new FlowPanel();
lcInner.getElement().getStyle().setMarginLeft(5.0, Unit.PX);
com.github.gwtbootstrap.client.ui.Label labelGroup = new com.github.gwtbootstrap.client.ui.Label(
groupedLayerDV.getName());
labelGroup.setType(LabelType.INFO);
String descr = groupedLayerDV.getDescription() != null && !groupedLayerDV.getDescription().isEmpty()
? groupedLayerDV.getDescription()
: groupedLayerDV.getName();
labelGroup.setTitle(descr);
lcInner.add(labelGroup);
// panelCustomOverlayLayers.add(labelGroup);
if (descr.compareTo(groupedLayerDV.getName()) != 0) {
HTML overlayGroupDescr = new HTML();
overlayGroupDescr.getElement().setClassName("filter-panel-style-description");
overlayGroupDescr.setHTML(descr);
lcInner.add(overlayGroupDescr);
// panelCustomOverlayLayers.add(overlayGroupDescr);
}
CrossFilteringLayerPanel cfp = new CrossFilteringLayerPanel(collection, groupedLayerDV, applicationBus);
cfp.setFilterButton(linkCrossFilteringLayers);
lcInner.add(cfp);
panelCrossFilteringLayers.add(lcInner);
}
linkCrossFilteringLayers.setVisible(listGroupedLayers.size() > 0);
}
}

View File

@ -11,6 +11,20 @@
.font-weight-bold {
font-weight: bold;
}
.open-collection-style {
padding-left: 15px;
padding-right: 15px;
}
.margin-left-top-5 {
margin-left: 5px;
margin-top: 5px;
}
.margin-left-5 {
margin-left: 5px;
}
</ui:style>
<g:HTMLPanel ui:field="mainHTMLPanel">
<g:HTMLPanel ui:field="mainContainerPanel">
@ -35,12 +49,39 @@
</g:HTMLPanel>
</g:HTMLPanel>
</b:DropdownButton>
<b:DropdownButton type="LINK" title="Select the Map" text="Map" ui:field="linkMap">
<b:DropdownButton type="LINK" text="Collection"
ui:field="openCollectionDropDown">
<g:HTMLPanel ui:field="openCollectionPanel"
addStyleNames="open-collection-style">
</g:HTMLPanel>
</b:DropdownButton>
<b:DropdownButton type="LINK" text="Map" ui:field="linkMap" icon="GLOBE">
<g:HTMLPanel ui:field="panelBaseLayers">
</g:HTMLPanel>
</b:DropdownButton>
<b:DropdownButton type="LINK"
title="Center Map to Location" text="Preset Location" ui:field="linkPresetLocation">
<b:DropdownButton type="LINK" visible="false" text="Overlay" ui:field="linkCustomOverlayLayers" icon="REORDER">
<g:HTMLPanel ui:field="panelCustomOverlayLayers" addStyleNames="overlay-panel-style">
</g:HTMLPanel>
</b:DropdownButton>
<b:DropdownButton type="LINK" visible="false" text="Filter" ui:field="linkCrossFilteringLayers" icon="FILTER">
<g:HTMLPanel ui:field="panelCrossFilteringLayers" addStyleNames="filter-panel-style">
</g:HTMLPanel>
</b:DropdownButton>
<b:DropdownButton type="LINK" text="Search"
ui:field="searchFacilityButton">
<g:FlowPanel addStyleNames="search-field">
<g:HorizontalPanel>
<b:Label type="INFO">Search in </b:Label>
<b:ListBox title="Search in the Collection..."
ui:field="navListSearch">
</b:ListBox>
</g:HorizontalPanel>
</g:FlowPanel>
<g:ScrollPanel ui:field="searchFacilityPanel"
addStyleNames="search-facility"></g:ScrollPanel>
</b:DropdownButton>
<b:DropdownButton type="LINK" text="Preset Location"
ui:field="linkPresetLocation" addStyleNames="preset-location">
<b:Nav>
<b:Button type="LINK" ui:field="extentToItaly"
text="Italy" title="Center to Italy"></b:Button>
@ -64,8 +105,8 @@
text="Remove Query" visible="false"></b:Button>
<b:Button type="LINK" text="Layers" ui:field="linkLayers">
</b:Button>
<g:ScrollPanel ui:field="overlayLayersPanel"
addStyleNames="layers-panel" visible="false"></g:ScrollPanel>
<!-- <g:ScrollPanel ui:field="overlayLayersPanel"
addStyleNames="layers-panel" visible="false"></g:ScrollPanel> -->
</g:HTMLPanel>
</g:HTMLPanel>
<c:DetailsPanel ui:field="detailsPanel"

View File

@ -1,45 +1,61 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.gallery;
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.gallery;
import java.util.List;
import java.util.Set;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.Random;
import com.google.gwt.user.client.ui.HTMLPanel;
/**
* The Class ImagesGallery.
* The Class ImagesSectionGallery.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Jul 21, 2021
* Jul 21, 2021
*/
public class ImagesGallery {
public class ImagesSectionGallery {
private HTMLPanel galleryPanel;
private List<UploadedImageDV> listImages;
private String galleryDivId;
private SectionView sectionView;
/**
* Instantiates a new images section gallery.
*
* @param sectionView the section view
*/
public ImagesSectionGallery(SectionView sectionView) {
this.galleryDivId = "nanogallery" + Random.nextInt() + Random.nextInt();
this.galleryPanel = new HTMLPanel("<div id='" + galleryDivId + "'></div>");
this.sectionView = sectionView;
}
/**
* Show gallery.
*
* @param json_array_images the json array images
* @param galleryDivId the gallery div id
*/
private native void showGallery(JavaScriptObject json_array_images, String galleryDivId) /*-{
console.log("showing: " + json_array_images)
//console.log("showing: " + json_array_images)
var waitForJQuery = setInterval(
function() {
if (typeof $wnd.$ != 'undefined') {
$wnd
.$("#"+galleryDivId)
.$("#" + galleryDivId)
.nanogallery2(
{
thumbnailHeight : '200 XS150 SM150', // RESPONSIVE THUMBNAIL HEIGHT: default=200px, XS resolution=150px, SM resolution=150px
@ -112,17 +128,6 @@ public class ImagesGallery {
}-*/;
/**
* Instantiates a new images gallery.
*
* @param immagini the immagini
*/
public ImagesGallery(List<UploadedImageDV> immagini) {
this.galleryDivId = "nanogallery"+Random.nextInt()+Random.nextInt();
this.galleryPanel = new HTMLPanel("<div id='"+galleryDivId+"'></div>");
this.listImages = immagini;
}
/**
* Gets the gallery panel.
*
@ -139,28 +144,70 @@ public class ImagesGallery {
JSONArray jsonArray = new JSONArray();
int index = 0;
for (UploadedImageDV image : listImages) {
if(image.getListWsContent()!=null) {
for (WorkspaceContentDV imageContent : image.getListWsContent()) {
JSONObject json = new JSONObject();
json.put("src", new JSONString(imageContent.getLink()));
json.put("srct", new JSONString(imageContent.getLink()));
List<String> listAuthors = image.getResponsabili();
String txtAuthors = listAuthors.size()>1 ? "Authors: ": "Author: ";
for (String author : listAuthors) {
txtAuthors+= " "+author +",";
for (SubDocumentView subdoc : sectionView.getListSubDocuments()) {
JSONValue meta = JSONParser.parseStrict(subdoc.getMetadataAsJSON());
for (FilesetDV image : subdoc.getListImages()) {
try {
if (image.getListPayload() != null) {
for (PayloadDV payloadDV : image.getListPayload()) {
JSONObject json = new JSONObject();
json.put("src", new JSONString(payloadDV.getLink()));
json.put("srct", new JSONString(payloadDV.getLink()));
json.put("downloadURL", new JSONString(payloadDV.getLink()));
try {
json.put("title", new JSONString(getFirstValueOfJSON(meta)));
} catch (Exception e) {
GWT.log("Error on reading the title from: " + meta);
json.put("title", new JSONString(meta.toString()));
}
json.put("description", new JSONString(meta.toString()));
jsonArray.set(jsonArray.size(), json);
index++;
}
}
txtAuthors = txtAuthors.substring(0,txtAuthors.length()-2);
String description = txtAuthors + ". ID Licenza: "+image.getLicenseID();
json.put("title", new JSONString(image.getDidascalia()));
json.put("description", new JSONString(description));
json.put("downloadURL", new JSONString(imageContent.getLink()));
jsonArray.set(index, json);
index++;
} catch (Exception e) {
GWT.log("Error on adding the image to gallery from: " + image);
}
}
}
showGallery(jsonArray.getJavaScriptObject(), galleryDivId);
if(jsonArray.size()>0) {
showGallery(jsonArray.getJavaScriptObject(), galleryDivId);
}
}
/**
* Gets the first value of JSON.
*
* @param metadata the metadata
* @return the first value of JSON
*/
public String getFirstValueOfJSON(JSONValue metadata) {
String value = "";
if (metadata == null)
return value;
if (metadata.isArray() != null) {
JSONArray array = (JSONArray) metadata;
for (int i = 0; i < array.size(); i++) {
JSONObject object = (JSONObject) array.get(i);
Set<String> set = object.keySet();
value = object.get(set.iterator().next()).toString();
}
} else if (metadata.isObject() != null) {
JSONObject object = (JSONObject) metadata;
Set<String> set = object.keySet();
value = object.get(set.iterator().next()).toString();
} else if (metadata.isString() != null) {
value = metadata.toString();
}
return value;
}
}

View File

@ -0,0 +1,227 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.layers;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.DropdownButton;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import ol.Coordinate;
public class LayersSectionViewer extends Composite {
private static LayersSectionViewerUiBinder uiBinder = GWT.create(LayersSectionViewerUiBinder.class);
interface LayersSectionViewerUiBinder extends UiBinder<Widget, LayersSectionViewer> {
}
@UiField
HTMLPanel layerPanel;
@UiField
HTMLPanel mapViewPanel;
private static enum IMAGE_EXPORT_AS {
PNG, JPEG
};
int downloadAttempt = 0;
private GCubeSDIViewerLayerDV layer;
private SubDocumentView subDocumentView;
public LayersSectionViewer(GCubeSDIViewerLayerDV layer, SubDocumentView subDocumentView) {
initWidget(uiBinder.createAndBindUi(this));
GWT.log("Showing: " + layer);
this.layer = layer;
this.subDocumentView = subDocumentView;
String wmsLink = null;
try {
wmsLink = layer.getWMSLink();
} catch (Exception e) {
return;
}
if (wmsLink == null) {
GeoportalDataViewerConstants.printJs("Wms link is null");
return;
}
String layerName = URLUtil.extractValueOfParameterFromURL("layers", wmsLink);
GWT.log("WMS LINK: " + wmsLink);
GWT.log("layerName: " + layerName);
DropdownButton exportMapButton = new DropdownButton("Export Map as...");
exportMapButton.setType(ButtonType.LINK);
exportMapButton.setIcon(IconType.DOWNLOAD_ALT);
exportMapButton.setTitle("Export the map view (OSM + layer) as an image...");
Style exportStyle = exportMapButton.getElement().getStyle();
// exportStyle.setWidth(100, Unit.PCT);
exportStyle.setMarginLeft(70, Unit.PCT);
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
MapView mapView = new MapView(transformedCenterCoordinate,
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
mapViewPanel.add(mapView);
mapViewPanel.add(exportMapButton);
String mapServerHost = wmsLink.contains("?") ? wmsLink.substring(0, wmsLink.indexOf("?")) : wmsLink;
GWT.log("mapServerHost: " + mapServerHost);
BBOXDV bbox = layer.getBbox();
try {
if (bbox != null) {
if (!GWT.isProdMode()) {
GWT.log("bbox: " + bbox);
// GWT.log("bbox keys: " + bbox.keySet());
// GWT.log("bbox values: " + bbox.values());
GWT.log("minX: " + bbox.getMinX());
GWT.log("minY: " + bbox.getMinY());
GWT.log("maxX: " + bbox.getMaxX());
GWT.log("maxY: " + bbox.getMaxY());
}
BoundsMap bounds = new BoundsMap(bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), bbox.getMaxY(), "");
GWT.log("bounds: " + bounds);
mapView.addWMSLayer(mapServerHost, layerName, bounds);
} else {
Alert alert = new Alert();
alert.setType(AlertType.ERROR);
alert.setText("No BBOX found for this layer");
alert.setClose(false);
layerPanel.add(alert);
}
} catch (Exception e) {
Alert alert = new Alert();
alert.setType(AlertType.ERROR);
alert.setHTML("Error on adding the layer to Map. Please check its WMS link: <br/>"+layer.getWMSLink());
alert.getElement().getStyle().setProperty("wordBreak", "break-all");
alert.setClose(false);
layerPanel.add(alert);
}
String htmlLinkId = mapView.getPanelMapElementId() + "-image-download";
for (IMAGE_EXPORT_AS exportType : IMAGE_EXPORT_AS.values()) {
NavLink navLink = new NavLink(exportType.name());
String exportExt = exportType.name().toLowerCase();
String filename = layerName + "." + exportExt;
String mimeType = "image/" + exportExt;
final HTML htmlLink = new HTML("<a id=\"" + htmlLinkId + "\" download=\"" + filename + "\"></a>");
navLink.getElement().appendChild(htmlLink.getElement());
navLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
downloadAttempt++;
if (downloadAttempt > 3) {
Window.alert("LOOP");
return;
}
// DOWNLOAD the OSM + layer by canvas
downloadMap(mapView.getLightOLM().getMap(), mapView.getPanelMapElementId(), htmlLinkId, filename,
mimeType);
}
});
exportMapButton.add(navLink);
}
if (subDocumentView.getMetadataAsJSON() != null) {
String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
layerPanel.add(new HTML(table));
}
}
public static native void exportPDF(String layerURL) /*-{
var image = new Image(layerURL);
var doc = new $wnd.jspdf.jsPDF();
doc.addImage(layerURL, 'PNG', 0, 0, image.width, image.height);
doc.save("map.pdf")
}-*/;
/**
* Prints the.
*
* @param msg the msg
*/
public static native void downloadMap(ol.Map map, String mapPanelId, String linkId, String filename,
String mimeType)/*-{
//console.log("map: " + map);
map.once('rendercomplete', function() {
var mapCanvas = $doc.createElement('canvas');
var size = map.getSize();
mapCanvas.width = size[0];
mapCanvas.height = size[1];
var mapContext = mapCanvas.getContext('2d');
var mapContainer = $doc.querySelector('#' + mapPanelId);
//console.log("mapContainer:" +JSON.stringify(mapContainer, null, 4));
Array.prototype.forEach.call(mapContainer
.querySelectorAll('.ol-layer canvas'), function(canvas) {
if (canvas.width > 0) {
var opacity = canvas.parentNode.style.opacity;
mapContext.globalAlpha = opacity === '' ? 1
: Number(opacity);
var transform = canvas.style.transform;
// Get the transform parameters from the style's transform matrix
var matrix = transform.match(/^matrix\(([^\(]*)\)$/)[1]
.split(',').map(Number);
// Apply the transform to the export map context
CanvasRenderingContext2D.prototype.setTransform.apply(
mapContext, matrix);
mapContext.drawImage(canvas, 0, 0);
}
});
if (navigator.msSaveBlob) {
// link download attribute does not work on MS browsers
navigator.msSaveBlob(mapCanvas.msToBlob(), filename);
} else {
var link = $doc.getElementById(linkId);
link.href = mapCanvas.toDataURL(mimeType);
link.click();
}
});
map.renderSync();
}-*/;
}

View File

@ -11,7 +11,7 @@
<g:HTMLPanel addStyleNames="style-layer">
<g:VerticalPanel>
<g:HTMLPanel ui:field="mapViewPanel"></g:HTMLPanel>
<g:HTMLPanel ui:field="layerConcessionePanel"></g:HTMLPanel>
<g:HTMLPanel ui:field="layerPanel"></g:HTMLPanel>
</g:VerticalPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,85 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
import java.util.Map.Entry;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
public class ProjectUtil {
public static <T extends DocumentDV> String toHMLCode(T document, String projectID) {
String htmlCode = "";
if (document == null)
return htmlCode;
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
}
if (projectID != null) {
htmlCode += " (id: " + projectID + ")";
}
return htmlCode;
}
public static <T extends DocumentDV> String toHMLCode(boolean showkey, T document, String projectID) {
String htmlCode = "";
if (document == null)
return htmlCode;
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += showkey ? firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>"
: firstEntrySet.getValue();
}
if (projectID != null) {
htmlCode += " (id: " + projectID + ")";
}
return htmlCode;
}
public static <T extends DocumentDV> String toHMLCode(T document) {
String htmlCode = "";
if (document == null)
return htmlCode;
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
}
return htmlCode;
}
public static String toHTMLCode(TemporalReferenceDV tempRef) {
String htmlCode = "<span class='display-date'>";
if (tempRef != null) {
String dateToString = "";
if (tempRef.getStart() != null) {
dateToString += GeoportalDataViewerConstants.DATE_TIME_FORMAT.format(tempRef.getStart());
}
dateToString += " / ";
if (tempRef.getStart() != null) {
dateToString += GeoportalDataViewerConstants.DATE_TIME_FORMAT.format(tempRef.getEnd());
}
htmlCode += dateToString;
}
htmlCode += "</span>";
return htmlCode;
}
}

View File

@ -0,0 +1,359 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent.EVENT_TYPE;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShareableLink;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.UListElement;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Random;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import ol.Coordinate;
/**
* The Class ProjectViewer.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 9, 2022
*/
public class ProjectViewer extends Composite {
private static ProjectViewerUiBinder uiBinder = GWT.create(ProjectViewerUiBinder.class);
/**
* The Interface ProjectViewerUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 9, 2022
*/
interface ProjectViewerUiBinder extends UiBinder<Widget, ProjectViewer> {
}
@UiField
HTMLPanel headerPanel;
@UiField
HTMLPanel pageViewDetails;
@UiField
HTMLPanel projectViewerMainPanel;
@UiField
HTMLPanel centroidPanel;
@UiField
HTMLPanel tableOfContentPanel;
@UiField
Button shareButton;
@UiField
Button expandButton;
@UiField
Button relationshipsButton;
@UiField
Button addLayersToMap;
@UiField
HTMLPanel toc_container;
@UiField
HTMLPanel toc_list_container;
@UiField
Button reduceToc;
@UiField
UListElement toc_list_anchors;
private ProjectView theProjectView;
private GeoportalItemReferences geoportalItemReferences;
private String myLogin;
private HandlerManager applicationBus;
private String projectViewerMainPanelID;
/**
* Instantiates a new project viewer.
*/
private ProjectViewer() {
initWidget(uiBinder.createAndBindUi(this));
pageViewDetails.getElement().addClassName("page-view-details");
projectViewerMainPanelID = "projectViewer-" + Random.nextInt();
projectViewerMainPanel.getElement().setId(projectViewerMainPanelID);
}
/**
* Instantiates a new project viewer.
*
* @param applicationBus the application bus
* @param geoportalItemRefs the geoportal item refs
* @param projectView the project view
*/
public ProjectViewer(HandlerManager applicationBus, GeoportalItemReferences geoportalItemRefs,
final ProjectView projectView) {
this();
GWT.log("Rendering " + projectView.getTheProjectDV().getId());
this.theProjectView = projectView;
this.geoportalItemReferences = geoportalItemRefs;
this.applicationBus = applicationBus;
final String theTitle = projectView.getTheProjectDV().getProfileName() != null
? projectView.getTheProjectDV().getProfileName()
: "Project ID: " + projectView.getTheProjectDV().getId();
headerPanel.add(new HTML(theTitle));
shareButton.setType(ButtonType.LINK);
shareButton.setIcon(IconType.SHARE);
shareButton.setTitle("Get a link to share with...");
shareButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
DialogShareableLink dg = new DialogShareableLink(geoportalItemReferences, null);
}
});
expandButton.setType(ButtonType.LINK);
expandButton.setIcon(IconType.EXPAND);
expandButton.setTitle("Show this view in new Window");
expandButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
ProjectViewer cv = new ProjectViewer(applicationBus, geoportalItemReferences, theProjectView);
cv.setExpandViewButtonVisible(false);
cv.setRelationshipsButtonVisible(false);
cv.setAddLayersToMapVisible(false);
cv.setTocContentVisible(true);
int width = Window.getClientWidth() * 75 / 100;
int height = Window.getClientHeight() * 70 / 100;
String modalTitle = ProjectUtil.toHMLCode(false, theProjectView.getTheProjectDV().getTheDocument(),
theProjectView.getTheProjectDV().getId());
ModalWindow mw = new ModalWindow(modalTitle, width, height);
mw.add(cv);
mw.setCaller(ProjectViewer.this);
// mw.setWidth(900);
mw.show();
}
});
relationshipsButton.setType(ButtonType.LINK);
relationshipsButton.setIcon(IconType.LINK);
relationshipsButton.setTitle("Show Relationships of this Project");
List<RelationshipDV> relationships = projectView.getTheProjectDV().getRelationships();
if (relationships != null && relationships.size() > 0) {
relationshipsButton.setVisible(true);
} else {
relationshipsButton.setVisible(false);
}
relationshipsButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
applicationBus.fireEvent(
new TimelineProjectRelationsEvent(theProjectView.getTheProjectDV(), EVENT_TYPE.SHOW));
}
});
addLayersToMap.setType(ButtonType.LINK);
addLayersToMap.setIcon(IconType.MAP_MARKER);
addLayersToMap.setTitle("Add the layer/s of the Project to principal Map");
addLayersToMap.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
applicationBus.fireEvent(new AddLayerToMapEvent(theProjectView.getTheProjectDV(), true));
}
});
setAddLayersToMapVisible(false);
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
@Override
public void onSuccess(String result) {
myLogin = result;
addCentroidMap();
}
@Override
public void onFailure(Throwable caught) {
}
});
reduceToc.setType(ButtonType.LINK);
reduceToc.setIcon(IconType.PLUS_SIGN_ALT);
toc_list_container.setVisible(false);
reduceToc.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
boolean visible = toc_list_container.isVisible();
setTocContentVisible(!visible);
// if (visible) {
// toc_list_container.setVisible(false);
// reduceToc.setIcon(IconType.PLUS_SIGN_ALT);
// } else {
// toc_list_container.setVisible(true);
// reduceToc.setIcon(IconType.MINUS_SIGN_ALT);
// }
}
});
for (SectionView sectionView : projectView.getListSections()) {
if (!sectionView.isEmpty()) {
SectionViewer sectionViewer = new SectionViewer(sectionView, projectViewerMainPanelID);
String sectionId = sectionView.getSectionTitle().replaceAll("[^A-Za-z0-9]", "-") + "_"
+ Random.nextInt();
String divTarget = "<div class='anchor-target' id='" + sectionId + "'></div>";
sectionViewer.getElement().insertFirst(new HTML(divTarget).getElement());
addAnchorToSection(sectionId, sectionView.getSectionTitle());
pageViewDetails.add(sectionViewer);
}
if (sectionView.hasSpatialLayers()) {
setAddLayersToMapVisible(true);
}
}
if (toc_list_anchors.getChildCount() > 0) {
tableOfContentPanel.setVisible(true);
}
}
private void addAnchorToSection(String id, String text) {
String htmlAnchor = "<a href='#" + id + "'>" + text + "</a>";
toc_list_anchors.appendChild(new HTML("<li>" + htmlAnchor + "</li>").getElement());
}
protected void setTocContentVisible(boolean bool) {
toc_list_container.setVisible(bool);
if (bool) {
reduceToc.setIcon(IconType.MINUS_SIGN_ALT);
} else {
reduceToc.setIcon(IconType.PLUS_SIGN_ALT);
}
}
/**
* Adds the centroid map.
*/
private void addCentroidMap() {
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
MapView mapView = new MapView(transformedCenterCoordinate,
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
if (theProjectView != null && theProjectView.getTheProjectDV() != null) {
GeoJSON spatialReference = theProjectView.getTheProjectDV().getSpatialReference();
Coordinate transfCoord = MapUtils.geoJSONToBBOXCenter(spatialReference, MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName());
if (transfCoord != null) {
boolean authenticatedUser = myLogin != null ? true : false;
mapView.addMarker(transfCoord, authenticatedUser);
centroidPanel.add(mapView);
}
} else if (theProjectView != null) {
GeoportalDataViewerConstants
.printJs("I cannot add centroid as maker one or both coordinates are null. Lat: " + theProjectView
+ ", Long:" + theProjectView);
}
}
/**
* Gets the project view.
*
* @return the project view
*/
public ProjectView getProjectView() {
return theProjectView;
}
/**
* Sets the expand view button visible.
*
* @param bool the new expand view button visible
*/
protected void setExpandViewButtonVisible(boolean bool) {
expandButton.setVisible(bool);
}
/**
* Sets the adds the layers to map visible.
*
* @param bool the new adds the layers to map visible
*/
protected void setAddLayersToMapVisible(boolean bool) {
addLayersToMap.setVisible(bool);
}
/**
* Sets the relationships button visible.
*
* @param bool the new relationships button visible
*/
protected void setRelationshipsButtonVisible(boolean bool) {
relationshipsButton.setVisible(bool);
}
}

View File

@ -0,0 +1,66 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.margin-left-10 {
margin-left: 10px;
}
.font-size-h1-22 h1 {
font-size: 22px;
}
.align-to-right {
right: 20px;
position: absolute;
top: 20px !important;
}
.the-title {
background-color: rgba(0, 60, 136, .7);
color: white;
padding: 10px 10px;
font-size: 14px;
padding-left: 40px;
}
.width-100 {
width: 100%;
}
.display-item-list {
display: inline-table;
}
</ui:style>
<g:HTMLPanel ui:field="projectViewerMainPanel">
<!-- <g:HTMLPanel ui:field="sharePanel" -->
<!-- addStyleNames="{style.align-to-right}"> -->
<!-- </g:HTMLPanel> -->
<g:HTMLPanel ui:field="headerPanel"
addStyleNames="{style.the-title}"></g:HTMLPanel>
<g:HTMLPanel ui:field="pageViewDetails">
<g:HorizontalPanel
addStyleNames="functionalities-style">
<b:Button ui:field="shareButton">Share</b:Button>
<b:Button ui:field="expandButton">Expand</b:Button>
<b:Button ui:field="relationshipsButton">Relationships</b:Button>
<b:Button ui:field="addLayersToMap">Add Layers to Map</b:Button>
</g:HorizontalPanel>
<g:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel>
<g:HTMLPanel ui:field="tableOfContentPanel"
visible="false" addStyleNames="{style.display-item-list}">
<g:HTMLPanel ui:field="toc_container"
addStyleNames="toc_container">
<b:Button ui:field="reduceToc"
addStyleNames="toc_container_reduce_button"></b:Button>
<div class="toc_title">Contents</div>
<g:HTMLPanel ui:field="toc_list_container" addStyleNames="toc_list_container">
<ul ui:field="toc_list_anchors"></ul>
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,163 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.gallery.ImagesSectionGallery;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.layers.LayersSectionViewer;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.PageHeader;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
public class SectionViewer extends Composite {
private static SectionViewerUiBinder uiBinder = GWT.create(SectionViewerUiBinder.class);
interface SectionViewerUiBinder extends UiBinder<Widget, SectionViewer> {
}
private SectionView sectionView;
@UiField
HTMLPanel sectionPanelContainer;
@UiField
PageHeader sectionTitle;
public SectionViewer(SectionView sectionView, String topTargetId) {
initWidget(uiBinder.createAndBindUi(this));
this.sectionView = sectionView;
List<SubDocumentView> subDocuments = sectionView.getListSubDocuments();
sectionTitle.setTitle(sectionView.getSectionTitle());
sectionTitle.setText(sectionView.getSectionTitle());
if (subDocuments == null)
return;
Button goToTop = new Button("");
goToTop.setType(ButtonType.LINK);
goToTop.setIcon(IconType.DOUBLE_ANGLE_UP);
goToTop.setHref("#" + topTargetId);
goToTop.setTitle("Go to top");
goToTop.getElement().setClassName("go-top-right");
sectionTitle.add(goToTop);
boolean displayAsGallery = false;
try {
for (SubDocumentView subDocumentView : subDocuments) {
if (subDocumentView.getListImages() != null && subDocumentView.getListImages().size() > 0) {
GWT.log("Section with images: " + subDocumentView.getListImages());
displayAsGallery = true;
break;
}
}
boolean displayAsMapOfLayers = false;
for (SubDocumentView subDocumentView : subDocuments) {
if (subDocumentView.getListLayers() != null && subDocumentView.getListLayers().size() > 0) {
GWT.log("Section with layers: " + subDocumentView.getListImages());
displayAsMapOfLayers = true;
break;
}
}
// Displaying the whole section as a Gallery
if (displayAsGallery) {
GWT.log("displayAsGallery the: " + sectionView);
ImagesSectionGallery sectionGallery = new ImagesSectionGallery(sectionView);
sectionPanelContainer.add(sectionGallery.getGalleryPanel());
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
sectionGallery.fillGallery();
}
});
// Displaying the whole section as a Map of Layers
} else if (displayAsMapOfLayers) {
GWT.log("displayAsMapOfLayers the: " + sectionView);
for (SubDocumentView subDocumentView : subDocuments) {
// String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
// sectionPanelContainer.add(new HTML(table));
List<GCubeSDIViewerLayerDV> layers = subDocumentView.getListLayers();
if (layers != null) {
for (GCubeSDIViewerLayerDV gCubeLayer : layers) {
LayersSectionViewer layerSectionViewer = new LayersSectionViewer(gCubeLayer,
subDocumentView);
sectionPanelContainer.add(layerSectionViewer);
// showLinkToDownloadWsContent(fileset.getName(), fileset.getListPayload());
}
}
}
} else {
GWT.log("displaying default the: " + sectionView);
for (SubDocumentView subDocumentView : subDocuments) {
String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
sectionPanelContainer.add(new HTML(table));
List<FilesetDV> files = subDocumentView.getListFiles();
if (files != null) {
for (FilesetDV fileset : files) {
showLinkToDownloadWsContent(fileset.getGcubeProfileFieldName(), fileset.getListPayload());
}
}
}
}
} catch (Exception e) {
GWT.log("Error on rendering the section: "+e.getMessage());
}
}
private void showLinkToDownloadWsContent(String title, List<PayloadDV> listPayloads) {
if (listPayloads != null) {
CustomFlexTable customTable = new CustomFlexTable();
int i = 0;
String fieldLabel = title;
for (PayloadDV payload : listPayloads) {
if (i > 0) {
fieldLabel = "";
}
String downloadLabel = "download";
if (payload.getName() != null) {
downloadLabel = payload.getName();
}
customTable.addNextKeyWidget(fieldLabel,
new HTML("<a href=\"" + payload.getLink() + "\">" + downloadLabel + "</a>"));
}
sectionPanelContainer.add(customTable);
}
}
}

View File

@ -0,0 +1,39 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.margin-left-10 {
margin-left: 10px;
}
.font-size-h1-22 h1 {
font-size: 22px;
margin-top: 5px;
}
.align-to-right {
right: 20px;
position: absolute;
}
.the-title h1 {
font-size: 28px;
}
.margin-bottom-10 {
margin-bottom: 10px;
}
.width-100 {
width: 100%;
}
</ui:style>
<g:HTMLPanel ui:field="sectionPanelContainer">
<g:HTMLPanel
addStyleNames="{style.margin-left-10}">
<b:PageHeader addStyleNames="{style.font-size-h1-22}" ui:field="sectionTitle"></b:PageHeader>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,50 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
import com.github.gwtbootstrap.client.ui.Column;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
public class RelationshipPanel extends Composite {
private static ViewRelationshipPanelUiBinder uiBinder = GWT.create(ViewRelationshipPanelUiBinder.class);
interface ViewRelationshipPanelUiBinder extends UiBinder<Widget, RelationshipPanel> {
}
@UiField
HTMLPanel rootRow;
@UiField
Column leftChildColumn;
@UiField
Column rightChildColumn;
private HandlerManager appManagerBus;
public RelationshipPanel(HandlerManager appManagerBus, ProjectDV fromProject, List<ProjectDV> relationships) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
String html = ProjectUtil.toHMLCode(false, fromProject.getTheDocument(), fromProject.getId());
rootRow.add(new HTML(html));
showRelationsOf(fromProject);
}
public void showRelationsOf(ProjectDV project) {
}
}

View File

@ -0,0 +1,23 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
</ui:style>
<g:HTMLPanel>
<b:Row ui:field="rootRow">
<b:FlowPanel ui:field="rootPanel"></b:FlowPanel>
</b:Row>
<b:Row>
<b:Column size="4">
<b:FlowPanel ui:field="leftChildPanel"></b:FlowPanel>
</b:Column>
<b:Column size="4">
<b:FlowPanel ui:field="rightChildPanel"></b:FlowPanel>
</b:Column>
</b:Row>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,100 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.RootPanel;
public class TimelineManagerStatus {
private HandlerManager applicationBus;
private TimelineStatus status;
public TimelineManagerStatus(HandlerManager applicationBus) {
this.applicationBus = applicationBus;
}
protected TimelineStatus getTimelineOf(ProjectDV theProject) {
if (status == null) {
status = new TimelineStatus(true, new TimelineRelationPanel(applicationBus, theProject), theProject);
GWT.log("Displaying new Timeline of " + status);
return status;
} else {
boolean c1 = status.getTheProjectDV().getId().compareTo(theProject.getId()) == 0;
boolean c2 = status.getTheProjectDV().getProfileID().compareTo(theProject.getProfileID()) == 0;
if (!c1 || !c2) {
GWT.log("Displaying Timeline of " + status);
status = new TimelineStatus(true, new TimelineRelationPanel(applicationBus, theProject), theProject);
return status;
}
status.statusChanged(false);
GWT.log("Skipping already displayed Timeline of " + status);
return status;
}
}
public void showTimelineProjectRelations(ProjectDV theProject, boolean showNotify) {
GWT.log("Showing project relations for: " + theProject);
TimelineStatus timelineStatus = getTimelineOf(theProject);
if (timelineStatus.isStatusChanged()) {
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear();
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).add(timelineStatus.getTimelineRP());
} else if (showNotify) {
GeoportalDataViewer.showPopover(RootPanel.get(GeoportalDataViewer.APP_NOTIFIER),
"Timeline from the selected project is already displayed", "Timeline displayed");
}
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(true);
timelineStatus.getTimelineRP().setTimelineContainerVisible(true);
}
public void hideTimelineProjectRelations() {
GWT.log("hideTimelineProjectRelations");
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(false);
// RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear();
}
public class TimelineStatus {
public boolean statusChanged = false;
private TimelineRelationPanel timelineRP;
private ProjectDV theProjectDV;
public TimelineStatus(boolean statusChanged, TimelineRelationPanel timelineRP, ProjectDV theProjectDV) {
this.statusChanged = statusChanged;
this.timelineRP = timelineRP;
this.theProjectDV = theProjectDV;
}
public void statusChanged(boolean bool) {
this.statusChanged = bool;
}
public boolean isStatusChanged() {
return statusChanged;
}
public TimelineRelationPanel getTimelineRP() {
return timelineRP;
}
public ProjectDV getTheProjectDV() {
return theProjectDV;
}
}
}

View File

@ -0,0 +1,196 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent.EVENT_SOURCE;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Style.TextAlign;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
public class TimelineRelationPanel extends Composite {
@UiField
ScrollPanel timelineContainer;
@UiField
HTMLPanel timelineHeader;
@UiField
Anchor timelinePopupCloser;
private LoaderIcon loaderData = new LoaderIcon("Loading data... please wait",
new Image(GNAImages.ICONS.spinnerClock()));
private TimelineRelationPanel instance = this;
private String selectedTimelineProjectID;
private ProjectDV theProjectDV;
private HandlerManager applicationBus;
private static TimelineRelationPanelUiBinder uiBinder = GWT.create(TimelineRelationPanelUiBinder.class);
interface TimelineRelationPanelUiBinder extends UiBinder<Widget, TimelineRelationPanel> {
}
public TimelineRelationPanel(HandlerManager applicationBus, ProjectDV theProjectDV) {
initWidget(uiBinder.createAndBindUi(this));
this.theProjectDV = theProjectDV;
this.applicationBus = applicationBus;
String html = ProjectUtil.toHMLCode(theProjectDV.getTheDocument());
HTML title = new HTML("Relationships of the Project" + " <br>" + html);
timelineHeader.add(title);
timelineContainer.getElement().setId("timeline-content");
timelineHeader.getElement().setId("timeline-header");
loaderData.getElement().getStyle().setTextAlign(TextAlign.CENTER);
timelineContainer.getElement().setId("visualization");
timelineContainer.add(loaderData);
timelinePopupCloser.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (timelineContainer.isVisible())
setTimelineContainerVisible(false);
else
setTimelineContainerVisible(true);
}
});
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
GeoportalDataViewerServiceAsync.Util.getInstance().getRelationshipsForTimeline(
theProjectDV.getProfileID(), theProjectDV.getId(), new AsyncCallback<List<String>>() {
@Override
public void onSuccess(List<String> result) {
timelineContainer.remove(loaderData);
JSONArray toJsonArr = new JSONArray();
for (int i = 0; i < result.size(); i++) {
toJsonArr.set(i, JSONParser.parseStrict(result.get(i)));
}
instanceTimeline(timelineContainer.getElement().getId(), toJsonArr, instance);
}
@Override
public void onFailure(Throwable caught) {
timelineContainer.remove(loaderData);
Alert alert = new Alert(caught.getMessage());
alert.setType(AlertType.ERROR);
alert.setClose(false);
timelineHeader.add(alert);
}
});
};
});
}
public void setTimelineContainerVisible(boolean bool) {
timelineContainer.setVisible(bool);
}
/*
* Called when a project (box) is clicked into Timeline
*/
private void setSelectedProject(String theComposedProjectID) {
this.selectedTimelineProjectID = theComposedProjectID;
//selectedTimelineProjectID is the couple ProfileID,ProjectID
GWT.log("selectedTimelineProjectID: " + selectedTimelineProjectID);
if (selectedTimelineProjectID == null || selectedTimelineProjectID.isEmpty())
return;
String[] references = this.selectedTimelineProjectID.split(",");
final String thePofileID = references[0];
final String theProjectID = references[1];
GeoportalItemReferences gir = new GeoportalItemReferences(theProjectID, thePofileID);
ShowDetailsEvent showDetailsEvent = new ShowDetailsEvent(gir, null, false, false,
EVENT_SOURCE.LOCATE_FROM_TIMELINE);
showDetailsEvent.setEventFromTimeline(true);
GWT.log("fireEvent: " + showDetailsEvent);
applicationBus.fireEvent(showDetailsEvent);
}
public String getSelectedProjectID() {
return selectedTimelineProjectID;
}
public static native String instanceTimeline(String idDivContainer, JSONArray jsonItems,
TimelineRelationPanel instance) /*-{
console.log('showing timeline');
//console.log('showTimeline_instanceTimeline for json items: '+jsonItems);
//console.log("showTimeline_template: " + $wnd.templateHandlebars);
// DOM element where the Timeline will be attached
var container = $doc.getElementById(idDivContainer);
//console.log("showTimeline_container: " + container);
var myArray = $wnd.JSON.parse(jsonItems);
//console.log("showTimeline_jsonItems: " + myArray);
var container = $doc.getElementById(idDivContainer);
// Create a DataSet (allows two way data-binding)
var items = new $wnd.vis.DataSet(myArray);
// Create a Timeline
var timeline = new $wnd.vis.Timeline(container, items,
$wnd.optionsTimeline);
timeline
.on(
'select',
function(properties, items) {
//console.log('selected: ' + $wnd.JSON.stringify(properties));
console.log('selected items: ' + properties.items);
instance.@org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation.TimelineRelationPanel::setSelectedProject(Ljava/lang/String;)(properties.items+'')
});
//timeline.redraw();
}-*/;
}

View File

@ -0,0 +1,17 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel addStyleNames="timeline-popup">
<g:HTMLPanel ui:field="timelineHeader"
addStyleNames="timeline-popup-header">
<g:Anchor href="#" ui:field="timelinePopupCloser" addStyleNames="timeline-popup-closer"></g:Anchor>
</g:HTMLPanel>
<g:ScrollPanel ui:field="timelineContainer"
addStyleNames="timeline-popup-content"></g:ScrollPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,198 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconSize;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.client.ui.constants.LabelType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
public class ViewRelationshipPanel extends Composite {
private static ViewRelationshipPanelUiBinder uiBinder = GWT.create(ViewRelationshipPanelUiBinder.class);
interface ViewRelationshipPanelUiBinder extends UiBinder<Widget, ViewRelationshipPanel> {
}
private String profileID;
@UiField
HTMLPanel firstPanelContainer;
@UiField
HTMLPanel panelTitle;
@UiField
HTMLPanel secondPanelContainer;
@UiField
FlowPanel firstProjectPanelContainer;
@UiField
FlowPanel secondProjectPanelContainer;
@UiField
Button closeButton;
@UiField
Button buttonExpand;
private HashMap<Integer, ResultDocumentDV> selectedProjects = new HashMap<Integer, ResultDocumentDV>(2);
private HandlerManager appManagerBus;
private Map<String, ResultDocumentDV> mapOfTargetProjectForId = new HashMap<String, ResultDocumentDV>();
public ViewRelationshipPanel(HandlerManager appManagerBus, ProjectDV fromProject, boolean showExpand) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
closeButton.setType(ButtonType.LINK);
closeButton.setIcon(IconType.REMOVE);
closeButton.setIconSize(IconSize.LARGE);
closeButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
}
});
buttonExpand.setType(ButtonType.LINK);
buttonExpand.setIcon(IconType.EXPAND);
buttonExpand.setTitle("Show this view in new Window");
buttonExpand.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Modal mw = new Modal(true, true);
mw.setTitle("Relationships");
int width = 0;
try {
width = Window.getClientWidth() * 75 / 100;
} catch (Exception e) {
// TODO: handle exception
}
if (width > 500)
mw.setWidth(width);
mw.add(new ViewRelationshipPanel(appManagerBus, fromProject, false));
mw.show();
}
});
if (!showExpand) {
buttonExpand.setVisible(false);
panelTitle.setVisible(false);
closeButton.setVisible(false);
}
showRelationsOf(fromProject);
}
public void showRelationsOf(ProjectDV project) {
firstProjectPanelContainer.clear();
secondProjectPanelContainer.clear();
Entry<String, Object> firstEntrySet = project.getTheDocument().getFirstEntryOfMap();
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b> (id: " + project.getId()
+ ")";
firstProjectPanelContainer.add(new HTML(htmlMsg));
HTML labelNoRelations = new HTML("No relationship/s found");
secondProjectPanelContainer.add(labelNoRelations);
if (project.getRelationships() != null && project.getRelationships().size() > 0) {
secondProjectPanelContainer.clear();
for (RelationshipDV relationDV : project.getRelationships()) {
final FlexTable flexTable = new FlexTable();
flexTable.getElement().addClassName("box-table-diplay-project");
Label label = new Label();
label.setType(LabelType.INFO);
label.setText(relationDV.getRelationshipName());
FlowPanel panelContainer = new FlowPanel();
Button deleteRelation = new Button("", IconType.SAVE);
deleteRelation.setTitle("Open this project");
deleteRelation.setType(ButtonType.LINK);
deleteRelation.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
ResultDocumentDV toProject = mapOfTargetProjectForId.get(relationDV.getTargetUCD());
// appManagerBus.fireEvent(
// new RelationActionHandlerEvent(project, relationDV.getRelationshipName(), toProject));
}
});
panelContainer.add(label);
panelContainer.add(deleteRelation);
flexTable.setWidget(0, 0, panelContainer);
// flexTable.setWidget(1, 0, new LoaderIcon("loading project.."));
// GeoportalDataEntryServiceAsync.Util.getInstance().getResultDocumentFoProjectByID(
// relationDV.getTargetUCD(), relationDV.getTargetID(), new AsyncCallback<ResultDocumentDV>() {
//
// @Override
// public void onFailure(Throwable caught) {
// flexTable.setWidget(1, 0, new HTML(caught.getMessage()));
//
// }
//
// @Override
// public void onSuccess(ResultDocumentDV result) {
// mapOfTargetProjectForId.put(relationDV.getTargetUCD(), result);
// Entry<String, Object> firstEntrySet = result.getFirstEntryOfMap();
// String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue()
// + "</b> (id: " + result.getId() + ")";
//
// flexTable.setWidget(1, 0, new HTML(htmlMsg));
//
// ReportTemplateToHTML rtth2 = new ReportTemplateToHTML("", result.getDocumentAsJSON(),
// false, false);
// rtth2.showAsJSON(false);
//
// flexTable.setWidget(2, 0, rtth2);
// }
// });
secondProjectPanelContainer.add(flexTable);
}
}
}
}

View File

@ -0,0 +1,68 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.view-rel-title {
font-size: 18px;
font-weight: bold;
text-align: center;
padding: 18px;
background: #eee;
}
.butt-create {
float: right;
margin-top: 10px;
}
.to-align-right {
position: absolute;
right: 5px;
}
.panel-style {
margin-top: 10px;
padding: 5px;
}
.panel-style table {
margin-top: 0px !important;
}
.panel-container-style {
padding-left: 10px;
padding-top: 5px;
}
.float-right {
float: right;
}
</ui:style>
<g:HTMLPanel>
<b:Button ui:field="closeButton"
addStyleNames="{style.to-align-right}"></b:Button>
<g:HTMLPanel ui:field="panelTitle"
addStyleNames="{style.view-rel-title}">View Relations</g:HTMLPanel>
<b:Button ui:field="buttonExpand"
addStyleNames="{style.float-right}">Expand</b:Button>
<g:HTMLPanel ui:field="firstPanelContainer"
addStyleNames="{style.panel-style}">
<g:FlowPanel>
<b:Label>From Project</b:Label>
</g:FlowPanel>
<g:FlowPanel ui:field="firstProjectPanelContainer"
addStyleNames="{style.panel-container-style}"></g:FlowPanel>
</g:HTMLPanel>
<g:HTMLPanel ui:field="secondPanelContainer"
addStyleNames="{style.panel-style}">
<g:FlowPanel>
<b:Label>To Project/s</b:Label>
</g:FlowPanel>
<g:FlowPanel ui:field="secondProjectPanelContainer"
addStyleNames="{style.panel-container-style}"></g:FlowPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,551 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.search;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
import org.gcube.application.geoportalcommon.shared.WhereClause;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent.EVENT_SOURCE;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.DropdownButton;
import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.TextBox;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class SearchFacilityUI.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 14, 2021
*/
public class SearchFacilityUI extends Composite {
private static SearchFacilityPanelUiBinder uiBinder = GWT.create(SearchFacilityPanelUiBinder.class);
protected static final int MIN_LENGHT_SERCHING_STRING = 3;
public static final String DEFAULT_DOCUMENT_PROJECTION_NAME = "_theDocument";
@UiField
ListBox listBoxSortBy;
@UiField
ListBox listBoxSearchFor;
@UiField
TextBox searchField;
@UiField
NavLink sortByToogle;
@UiField
Button resetSearch;
@UiField
HTMLPanel panelResults;
@UiField
HorizontalPanel toogleSortBy;
private List<ItemFieldDV> searchForFields;
private List<ItemFieldDV> sortByFields;
private SearchingFilter currentSortFilter;
private HandlerManager appManagerBus;
private static final String LABEL_FILTER_SEPARATOR = " - ";
protected static final int MAX_TEXT_DIMENSION = 100;
protected static final int MAX_COLUMNS_RESULTS = 3;
private ResultSetPaginatedData latestResult;
private DropdownButton searchFacilityButton;
private String profileID;
private List<ItemFieldDV> displayByFields;
/**
* The Interface SearchFacilityPanelUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 14, 2021
*/
interface SearchFacilityPanelUiBinder extends UiBinder<Widget, SearchFacilityUI> {
}
/**
* Instantiates a new search facility UI.
*
* @param profileID the profile ID
* @param appManagerBus the app manager bus
* @param displayByFields the display by fields
* @param sortByFields the sort by fields
* @param searchForFields the search for fields
* @param initialSortFilter the initial sort filter
*/
public SearchFacilityUI(String profileID, HandlerManager appManagerBus, List<ItemFieldDV> displayByFields,
List<ItemFieldDV> sortByFields, List<ItemFieldDV> searchForFields, SearchingFilter initialSortFilter) {
initWidget(uiBinder.createAndBindUi(this));
this.profileID = profileID;
this.displayByFields = displayByFields;
this.searchForFields = searchForFields;
this.currentSortFilter = initialSortFilter;
this.sortByFields = sortByFields;
this.appManagerBus = appManagerBus;
resetSearch.setType(ButtonType.LINK);
listBoxSortBy.setWidth("180px");
// listBoxSearchFor.setWidth("140px");
bindEvents();
}
/**
* To label filter.
*
* @param itemField the item field
* @param direction the direction
* @return the string
*/
private String toLabelFilter(ItemFieldDV itemField, ORDER direction) {
String labelFilter = itemField.getDisplayName() + LABEL_FILTER_SEPARATOR + direction.name();
return labelFilter;
}
/**
* Bind events.
*/
private void bindEvents() {
for (ItemFieldDV record_FIELD : sortByFields) {
if (record_FIELD.isSortable()) {
String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
listBoxSortBy.addItem(labelASC);
listBoxSortBy.addItem(labelDESC);
}
}
listBoxSortBy.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (latestResult != null && latestResult.getData().size() > 0) {
doSearchEvent();
}
}
});
for (ItemFieldDV record_FIELD : searchForFields) {
GWT.log("search for: " + record_FIELD);
if (record_FIELD.isSearchable()) {
listBoxSearchFor.addItem(record_FIELD.getDisplayName());
}
}
listBoxSearchFor.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
if (searchField.getText().length() >= MIN_LENGHT_SERCHING_STRING) {
doSearchEvent();
}
}
});
sortByToogle.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (toogleSortBy.isVisible())
toogleSortBy.setVisible(false);
else
toogleSortBy.setVisible(true);
}
});
searchField.addKeyPressHandler(new KeyPressHandler() {
@Override
public void onKeyPress(KeyPressEvent event) {
if (com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER == event.getCharCode()) {
GWT.log(searchField.getText());
doSearchEvent();
}
}
});
resetSearch.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
resetCurrentSearch();
}
});
}
/**
* Reset current search.
*/
public void resetCurrentSearch() {
searchField.setText("");
resetSearch.setVisible(false);
panelResults.clear();
latestResult = null;
appManagerBus.fireEvent(new SearchPerformedEvent(profileID, null, true));
setSearchEnabled(false);
}
/**
* Sets the search enabled.
*
* @param bool the new search enabled
*/
private void setSearchEnabled(boolean bool) {
if (bool) {
searchFacilityButton.getElement().addClassName("highlight-button");
} else {
searchFacilityButton.getElement().removeClassName("highlight-button");
}
}
/**
* Search concessioni.
*/
private void searchProjects() {
SearchingFilter filter = getCurrentSortFilter();
panelResults.clear();
panelResults.add(new HTML("<hr>"));
panelResults.add(new LoaderIcon("Searching..."));
GeoportalDataViewerServiceAsync.Util.getInstance().getListProjects(profileID, 0,
GeoportalDataViewerConstants.SEARCH_LIMIT_RESULTS_TO_MAXIMUM, filter, false,
new AsyncCallback<ResultSetPaginatedDataIDs>() {
@Override
public void onFailure(Throwable caught) {
// showLoading(false);
// Window.alert(caught.getMessage());
panelResults.clear();
panelResults.add(new HTML("<hr>"));
Alert alert = new Alert("Error on searching. Please, refresh or change the search");
alert.setType(AlertType.ERROR);
alert.setClose(false);
panelResults.add(alert);
}
@Override
public void onSuccess(ResultSetPaginatedDataIDs result) {
appManagerBus
.fireEvent(new SearchPerformedEvent(profileID, result.getResultSetProjectIDs(), false));
setSearchEnabled(true);
latestResult = result;
panelResults.clear();
panelResults.add(new HTML("<hr>"));
if (result.getData().size() == 0) {
panelResults.add(new HTML("No result found"));
return;
}
int allItems = result.getResultSetProjectIDs().size();
int returnedItems = result.getData().size();
String message = "";
if (allItems > returnedItems) {
message = "Your query returns too many results (" + allItems
+ "). Please find below the top " + returnedItems + ".<br>";
} else if (returnedItems > 0) {
message = "Found " + returnedItems;
message += returnedItems > 0 ? " projects" : " project";
message += ".";
}
if (returnedItems > 0
&& returnedItems <= GeoportalDataViewerConstants.SEARCH_LIMIT_RESULTS_TO_MAXIMUM) {
message += "On the map you can see all the projects with a centroid matching the query";
}
HTML resultMessage = new HTML(message);
resultMessage.getElement().addClassName("search_result_msg");
panelResults.add(resultMessage);
FlexTable ft = new FlexTable();
ft.getElement().setClassName("table-results");
int i = 0;
// Table headers
for (ItemFieldDV itemField : displayByFields) {
if (i > MAX_COLUMNS_RESULTS) {
break;
}
i++;
String displayName = itemField.getDisplayName();
ft.setWidget(0, i, new HTML(displayName));
}
// From the Second row
i = 1;
for (DocumentDV documentDV : result.getData()) {
ResultDocumentDV resultDoc = (ResultDocumentDV) documentDV;
NavLink locateOnMap = new NavLink("Show");
locateOnMap.setTitle("Locate this project on Map and show details");
locateOnMap.setIcon(IconType.MAP_MARKER);
locateOnMap.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GeoportalItemReferences gir = new GeoportalItemReferences(resultDoc.getProjectID(),
profileID);
// here
appManagerBus.fireEvent(new ClosedViewDetailsEvent());
appManagerBus.fireEvent(
new ShowDetailsEvent(gir, null, true, true, EVENT_SOURCE.LOCATE_SEARCHED));
// appManagerBus.fireEvent(new ShowPopupOnCentroidEvent(profileID,
// resultDoc.getProjectID(), resultDoc.getSpatialReference()));
}
});
// First column
ft.setWidget(i, 0, locateOnMap);
int j = 0;
// Other columns
for (ItemFieldDV itemField : displayByFields) {
if (j > MAX_COLUMNS_RESULTS) {
break;
}
String firstJsonField = itemField.getJsonFields().get(0);
GWT.log("The json fields is: " + firstJsonField);
String key = firstJsonField.replace(DEFAULT_DOCUMENT_PROJECTION_NAME + ".", "");
Object value = documentDV.getDocumentAsMap().get(key);
String objectToRender = "";
String toTitle = "";
if (value == null) {
objectToRender = "N.A.";
toTitle = objectToRender;
} else if (value instanceof ArrayList) {
ArrayList<Object> arrayValues = (ArrayList<Object>) value;
String toReturn = "<ul>";
String toDisplayTitle = "";
for (Object arrayValue : arrayValues) {
toReturn += "<li>" + arrayValue + "</li>";
toDisplayTitle += arrayValue + "; ";
}
toReturn += "</ul>";
GWT.log("Array returning: " + key + " is instance of: " + value.getClass()
+ " to return: " + toReturn);
toTitle = toDisplayTitle;
objectToRender = StringUtil.ellipsize(toReturn, MAX_TEXT_DIMENSION);
} else {
String valueStr = value.toString();
toTitle = valueStr;
objectToRender = StringUtil.ellipsize(valueStr, MAX_TEXT_DIMENSION);
}
GWT.log("The key is: " + key + " objectToRender is: " + objectToRender);
HTML htmlValue = new HTML(objectToRender);
htmlValue.setTitle(toTitle);
ft.setWidget(i, ++j, htmlValue);
}
i++;
}
panelResults.add(ft);
}
});
}
/**
* To display authors.
*
* @param listValues the list values
* @return the string
*/
private String toDisplayList(List<Object> listValues) {
String toDisplay = "";
if (listValues == null)
return toDisplay;
for (Object author : listValues) {
toDisplay += author + "; ";
}
return toDisplay;
}
/**
* Do search event.
*/
private void doSearchEvent() {
String searchText = searchField.getText();
if (searchText.length() < MIN_LENGHT_SERCHING_STRING) {
Window.alert("Please enter at least " + MIN_LENGHT_SERCHING_STRING + " characters");
return;
}
resetSearch.setVisible(true);
// appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
// getCurrentSortFilter()));
searchProjects();
}
/**
* To sort filter.
*
* @param labelFilter the label filter
* @return the searching filter
*/
public SearchingFilter toSortFilter(String labelFilter) {
GWT.log("toSortFilter for label " + labelFilter);
String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
SearchingFilter sortFilter = null;
try {
ItemFieldDV recordField = null;
for (ItemFieldDV value : sortByFields) {
if (array[0].equalsIgnoreCase(value.getDisplayName())) {
recordField = value;
break;
}
}
ORDER orderField = ORDER.valueOf(array[1]);
sortFilter = new SearchingFilter(Arrays.asList(recordField), orderField);
} catch (Exception e) {
}
GWT.log("toSortFilter Got " + sortFilter);
return sortFilter;
}
/**
* Built searching filter.
*
* @return the searching filter
*/
private SearchingFilter builtSearchingFilter() {
SearchingFilter searchingFilter = toSortFilter(listBoxSortBy.getSelectedValue());
String searchText = searchField.getText();
if (searchText != null && !searchText.isEmpty()) {
Map<String, Object> searchInto = new HashMap<String, Object>();
List<String> listOfSeachingFields = new ArrayList<String>();
for (ItemFieldDV recordField : searchForFields) {
if (recordField.getDisplayName().equals(listBoxSearchFor.getSelectedValue())) {
listOfSeachingFields = recordField.getJsonFields();
continue;
}
}
for (String fieldname : listOfSeachingFields) {
searchInto.put(fieldname, searchText);
}
WhereClause where = new WhereClause();
where.setSearchInto(searchInto);
where.setOperator(LOGICAL_OP.OR);
// THIS CLAUSE IS ADDED IN ORDER TO SEARCH ONLY PUBLISHED PRODUCT (WITH SUCCESS)
Map<String, Object> searchInto2 = new HashMap<String, Object>();
// searchInto2.put("report.status", "PASSED");
WhereClause where2 = new WhereClause(LOGICAL_OP.AND, searchInto2);
// searchingFilter.setConditions(Arrays.asList(where, where2));
searchingFilter.setConditions(Arrays.asList(where));
}
return searchingFilter;
}
/**
* Gets the current sort filter.
*
* @return the current sort filter
*/
public SearchingFilter getCurrentSortFilter() {
currentSortFilter = builtSearchingFilter();
GWT.log("currentSortFilter: " + currentSortFilter);
return currentSortFilter;
}
/**
* Sets the search button.
*
* @param searchFacilityButton the new search button
*/
public void setSearchButton(DropdownButton searchFacilityButton) {
this.searchFacilityButton = searchFacilityButton;
}
}

View File

@ -0,0 +1,64 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
xmlns:c="urn:import:org.gcube.portlets.user.geoportaldataviewer.client.ui">
<ui:style>
.important {
font-weight: bold;
}
.container-panel {
padding: 10px;
}
.add-margin-right {
margin-right: 5px;
}
.add-margin-right-23 {
margin-right: 23px;
}
.listBoxSearchForStyle {
margin-right: 5px;
}
.margin-top-5 {
margin-top: 5px;
}
.font-size-12 {
font-size: 12px;
}
</ui:style>
<g:HTMLPanel addStyleNames="{style.container-panel}">
<g:FlowPanel>
<g:FlowPanel>
<g:FlowPanel>
<g:HorizontalPanel>
<g:Label addStyleNames="{style.add-margin-right}">Search for: </g:Label>
<b:ListBox title="Search for"
ui:field="listBoxSearchFor"
addStyleNames="{style.listBoxSearchForStyle}">
</b:ListBox>
<b:TextBox ui:field="searchField"
addStyleNames="search-textbox" placeholder="type a text..."></b:TextBox>
<b:Button icon="REMOVE_CIRCLE" ui:field="resetSearch"
title="Reset the search" visible="false">Reset</b:Button>
</g:HorizontalPanel>
</g:FlowPanel>
<g:FlowPanel>
<b:NavLink ui:field="sortByToogle" addStyleNames="{style.font-size-12}">Sort Results</b:NavLink>
<g:HorizontalPanel ui:field="toogleSortBy"
addStyleNames="{style.margin-top-5}" visible="false">
<g:Label addStyleNames="{style.add-margin-right-23}">Sort by: </g:Label>
<b:ListBox ui:field="listBoxSortBy">
</b:ListBox>
</g:HorizontalPanel>
</g:FlowPanel>
</g:FlowPanel>
<g:HTMLPanel ui:field="panelResults">
</g:HTMLPanel>
</g:FlowPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,672 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.crossfiltering;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.CrossFilteringLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDILayer;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ApplyCQLToLayerOnMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.FitMapToExtentEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.OLGeoJSONUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.WFSMakerUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.ControlGroup;
import com.github.gwtbootstrap.client.ui.ControlLabel;
import com.github.gwtbootstrap.client.ui.Controls;
import com.github.gwtbootstrap.client.ui.DropdownButton;
import com.github.gwtbootstrap.client.ui.Fieldset;
import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.http.client.URL;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import jsinterop.base.JsPropertyMap;
import ol.Extent;
import ol.Feature;
import ol.source.Vector;
/**
* The Class CrossFilteringLayerPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 15, 2023
*/
public class CrossFilteringLayerPanel extends Composite {
private static final double BBOX_OFFESET_ON_FEATURES = 18000.0;
private static final String ITEM_LABEL = "centroid";
public static String COLORSCALERANGE = "COLORSCALERANGE";
@UiField
Fieldset fieldSet;
@UiField
HTMLPanel panelResults;
@UiField
Button buttonReset;
private CheckBox checkbox;
private GeoInformationForWMSRequest geoInformation;
private static CrossFilteringLayerPanelUiBinder uiBinder = GWT.create(CrossFilteringLayerPanelUiBinder.class);
private HandlerManager applicationBus;
private LayerItem layerItem;
private LinkedHashMap<Integer, List<? extends LayerIDV>> mapInnestedFiltering = new LinkedHashMap<Integer, List<? extends LayerIDV>>();
private LinkedHashMap<Integer, HashMap<String, SelectableItem>> mapInnestedFeatures = new LinkedHashMap<Integer, HashMap<String, SelectableItem>>();
private LinkedHashMap<Integer, List<ListBox>> mapInnestedListBoxes = new LinkedHashMap<Integer, List<ListBox>>();
private GroupedLayersDV<? extends LayerIDV> groupedLayersDV;
private GCubeCollection gCubeCollection;
private DropdownButton filterButton;
/**
* The Interface LayerCollectionPanelUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 16, 2023
*/
interface CrossFilteringLayerPanelUiBinder extends UiBinder<Widget, CrossFilteringLayerPanel> {
}
/**
* Instantiates a new overlay custom layer panel.
*
* @param gCubeCollection the g cube collection
* @param groupedLayersDV the grouped layers DV
* @param applicationBus the application bus
*/
public CrossFilteringLayerPanel(GCubeCollection gCubeCollection,
GroupedLayersDV<? extends LayerIDV> groupedLayersDV, HandlerManager applicationBus) {
initWidget(uiBinder.createAndBindUi(this));
this.applicationBus = applicationBus;
this.groupedLayersDV = groupedLayersDV;
this.gCubeCollection = gCubeCollection;
GWT.log("Building cross-filtering for: " + groupedLayersDV);
buttonReset.setType(ButtonType.LINK);
int level = 0;
// Building mapInnestedFiltering
recursivelyBuildSelectableLevels(level, groupedLayersDV.getListCustomLayers());
GWT.log("cross-filtering mapInnestedFiltering: " + mapInnestedFiltering);
for (Integer theLevel : mapInnestedFiltering.keySet()) {
addListBoxesLevelToPanel(theLevel, mapInnestedFiltering.get(theLevel));
}
fillSelectableLevel(level, null);
bindEvents();
}
/**
* Bind events.
*/
private void bindEvents() {
buttonReset.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
panelResults.clear();
for (int i = 1; i < mapInnestedListBoxes.size(); i++) {
resetListBoxLevel(i);
}
// Selecting the placeholder of the fist list box
List<ListBox> listBox = mapInnestedListBoxes.get(0);
listBox.get(0).setSelectedIndex(0);
// Resetting CQL filtering
applicationBus.fireEvent(new ApplyCQLToLayerOnMapEvent(gCubeCollection.getIndexes().get(0), null));
setFilterHighLighted(false);
}
});
}
/**
* Recursively build selectable levels.
*
* @param level the level
* @param layersIDV the layers IDV
*/
private void recursivelyBuildSelectableLevels(int level, List<? extends LayerIDV> layersIDV) {
if (layersIDV == null)
return;
mapInnestedFiltering.put(level, layersIDV);
for (LayerIDV layerIDV : layersIDV) {
if (layerIDV instanceof CrossFilteringLayerDV) {
CrossFilteringLayerDV crossFilteringLayer = (CrossFilteringLayerDV) layerIDV;
if (crossFilteringLayer.getRelated_to() != null) {
recursivelyBuildSelectableLevels(++level, crossFilteringLayer.getRelated_to());
}
}
}
}
/**
* Fill selectable level.
*
* @param level the level
* @param selectedItem the selected item
*/
private void fillSelectableLevel(int level, SelectableItem selectedItem) {
List<? extends LayerIDV> layersIDV = mapInnestedFiltering.get(level);
List<ListBox> listBoxes = mapInnestedListBoxes.get(level);
if (layersIDV == null)
return;
final HashMap<String, SelectableItem> mapSelectableFeatures = new HashMap<String, CrossFilteringLayerPanel.SelectableItem>();
LayerIDV layerIDV = layersIDV.get(0); // Expected one
if (layerIDV instanceof CrossFilteringLayerDV) {
CrossFilteringLayerDV crossFilteringLayer = (CrossFilteringLayerDV) layerIDV;
String wfsURL = crossFilteringLayer.getWFS_URL();
if (selectedItem != null) {
String cqlFilterValue = crossFilteringLayer.getTable_parent_key_field() + "=" + selectedItem.keyValue;
wfsURL += "&" + WFSMakerUtil.CQL_FILTER_PARAMETER + "=" + URL.encode(cqlFilterValue);
}
GWT.log("wfsURL request: " + wfsURL);
GeoportalDataViewerServiceAsync.Util.getInstance().getHTTPResponseForURL(wfsURL,
new AsyncCallback<String>() {
@Override
public void onSuccess(String response) {
GWT.log("wfsURL response: " + response);
Feature[] features = OLGeoJSONUtil.readGeoJsonFeatures(MAP_PROJECTION.EPSG_4326, response);
for (Feature feature : features) {
JsPropertyMap<Object> properties = feature.getProperties();
Object keyValue = properties.get(crossFilteringLayer.getTable_key_field());
Object itemField = properties.get(crossFilteringLayer.getTable_show_field());
Object parentKey = null;
if (crossFilteringLayer.getTable_parent_key_field() != null
&& !crossFilteringLayer.getTable_parent_key_field().isEmpty())
parentKey = properties.get(crossFilteringLayer.getTable_parent_key_field());
parentKey = parentKey == null ? "" : parentKey;
SelectableItem selectableItem = new SelectableItem(
crossFilteringLayer.getTable_key_field() + "", keyValue + "",
crossFilteringLayer.getTable_parent_key_field(), itemField + "",
crossFilteringLayer.getName(), crossFilteringLayer.getTable_geometry_name());
GWT.log("selectableItem: " + selectableItem);
String pathFeatureKey = pathFeatureKey(selectableItem);
mapSelectableFeatures.put(pathFeatureKey, selectableItem);
}
GWT.log("mapSelectableFeatures: " + mapSelectableFeatures);
mapInnestedFeatures.put(level, mapSelectableFeatures);
String placholder = placeholderLayer(layersIDV.get(0)); // Expected one
fillListBoxLevel(level, mapSelectableFeatures, listBoxes, placholder);
}
@Override
public void onFailure(Throwable caught) {
panelResults.clear();
HTML error = new HTML(
"Sorry, an issue is occurred on loading data for cross-filtering facility. Error is: "
+ caught.getMessage());
panelResults.add(error);
}
});
}
}
/**
* Path feature key.
*
* @param selectableItem the selectable item
* @return the string
*/
private String pathFeatureKey(SelectableItem selectableItem) {
return "root_" + selectableItem.parentKeyField + "_" + selectableItem.keyField + "_" + selectableItem.keyValue;
}
/**
* Placeholder layer.
*
* @param layersIDV the layers IDV
* @return the string
*/
private String placeholderLayer(LayerIDV layersIDV) {
String placeholder = "Select";
// if (layersIDV != null)
// placeholder += " " + layersIDV.getTitle();
placeholder += " ...";
return placeholder;
}
/**
* Adds the list boxes level to panel.
*
* @param level the level
* @param layersIDV the layers IDV
*/
private void addListBoxesLevelToPanel(int level, List<? extends LayerIDV> layersIDV) {
if (layersIDV == null)
return;
List<ListBox> listBoxes = new ArrayList<ListBox>(layersIDV.size());
for (LayerIDV layerIDV : layersIDV) {
ControlGroup cg = new ControlGroup();
ControlLabel cl = new ControlLabel(layerIDV.getTitle());
Controls controls = new Controls();
ListBox listBox = new ListBox();
String placeholder = placeholderLayer(layerIDV);
listBox.addItem(placeholder);
setEnabledBox(listBox, false);
listBoxes.add(listBox);
controls.add(listBox);
cg.add(cl);
cg.add(controls);
fieldSet.add(cg);
}
mapInnestedListBoxes.put(level, listBoxes);
}
/**
* Sets the enabled box.
*
* @param listBox the list box
* @param bool the bool
*/
public void setEnabledBox(ListBox listBox, boolean bool) {
listBox.setEnabled(bool);
}
/**
* Clear list box.
*
* @param listBox the list box
* @param bool the bool
*/
public void clearListBox(ListBox listBox, boolean bool) {
listBox.setEnabled(bool);
}
/**
* Reset list box level.
*
* @param level the level
*/
private void resetListBoxLevel(int level) {
List<ListBox> listBoxes = mapInnestedListBoxes.get(level);
if (listBoxes != null) {
for (ListBox listBox : listBoxes) {
listBox.clear();
setEnabledBox(listBox, false);
}
}
}
/**
* Fill list box level.
*
* @param level the level
* @param mapSelectableFeatures the map selectable features
* @param listBoxes the list boxes
* @param placeholder the placeholder
*/
private void fillListBoxLevel(int level, HashMap<String, SelectableItem> mapSelectableFeatures,
List<ListBox> listBoxes, String placeholder) {
// GWT.log("fillBox level: " + level + " map: " + mapSelectableFeatures);
if (mapSelectableFeatures == null)
return;
ListBox listBox = listBoxes.get(0); // Expected one
listBox.clear();
listBox.addItem(placeholder);
listBox.getElement().getFirstChildElement().setAttribute("disabled", "disabled");
for (String key : mapSelectableFeatures.keySet()) {
SelectableItem selItem = mapSelectableFeatures.get(key);
listBox.addItem(selItem.itemValue, key);
}
listBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
loadInnerLevel(level, listBox.getSelectedValue());
for (int i = level + 1; i < mapInnestedListBoxes.size(); i++) {
resetListBoxLevel(i);
}
String key = listBox.getSelectedValue();
SelectableItem selectableItem = mapSelectableFeatures.get(key);
buildCrossFilteringCQLAndFireEvent(selectableItem);
setFilterHighLighted(true);
}
});
setEnabledBox(listBox, true);
}
/**
* Builds the cross filtering CQL and fire event.
*
* @param selectableItem the selectable item
*/
private void buildCrossFilteringCQLAndFireEvent(SelectableItem selectableItem) {
String setCqlFilter = "INTERSECTS(geom,querySingle('" + selectableItem.layername + "','"
+ selectableItem.theGeometryName + "','" + selectableItem.keyField + "=''" + selectableItem.keyValue
+ "'''))";
// setCqlFilter = URL.encode(setCqlFilter);
GWT.log("CQL FILTER built: " + setCqlFilter);
IndexLayerDV indexLayer = gCubeCollection.getIndexes().get(0);
try {
GCubeSDILayer layer = indexLayer.getLayer();
String wmsLink = layer.getOgcLinks().get("wms");
String layerName = URLUtil.extractValueOfParameterFromURL("layers", wmsLink);
String serviceURL = URLUtil.getPathURL(wmsLink);
String toLServiceURL = serviceURL.toLowerCase();
if (toLServiceURL.endsWith("wms")) {
toLServiceURL = toLServiceURL.substring(0, toLServiceURL.length() - 3) + "ows";
}
String wfsCrossFilteringQuery = WFSMakerUtil.buildWFSRequest(toLServiceURL, layerName, 1000, "geom",
setCqlFilter);
GWT.log("wfsCrossFilteringQuery: " + wfsCrossFilteringQuery);
showCountResultsOfWFSCrossFiltering(wfsCrossFilteringQuery);
} catch (Exception e) {
// TODO: handle exception
}
applicationBus.fireEvent(new ApplyCQLToLayerOnMapEvent(indexLayer, setCqlFilter));
}
public void showCountResultsOfWFSCrossFiltering(String wfsQuery) {
panelResults.clear();
panelResults.add(new HTML("<hr>"));
panelResults.add(new LoaderIcon("Applying spatial filter..."));
GeoportalDataViewerServiceAsync.Util.getInstance().getHTTPResponseForURL(wfsQuery, new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
panelResults.clear();
panelResults.add(new HTML("<hr>"));
Alert alert = new Alert("Error on returning number of items");
alert.setType(AlertType.ERROR);
alert.setClose(false);
panelResults.add(alert);
}
@Override
public void onSuccess(String response) {
Feature[] features = OLGeoJSONUtil.readGeoJsonFeatures(MAP_PROJECTION.EPSG_4326, response);
if (features != null) {
int dataCount = features.length;
panelResults.clear();
panelResults.add(new HTML("<hr>"));
FlexTable flexTable = new FlexTable();
String message = "";
if (dataCount <= 0) {
message = "No " + ITEM_LABEL + " found";
} else {
message = "Found " + dataCount;
message += dataCount > 1 ? " " + ITEM_LABEL + "s" : " " + ITEM_LABEL;
}
HTML resultMessage = new HTML();
resultMessage.getElement().addClassName("search_result_msg");
resultMessage.setHTML(message);
flexTable.setWidget(0, 0, resultMessage.asWidget());
panelResults.add(flexTable);
try {
if (features.length > 0) {
// Calculating Extend of the selected Features
Vector vector = new Vector();
vector.addFeatures(features);
Extent theExtent = vector.getExtent();
GWT.log("Extent from features is: " + theExtent);
theExtent = MapUtils.transformExtent(theExtent, MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName());
double bboxOffset = features.length>1?BBOX_OFFESET_ON_FEATURES:0;
final Extent transfExtent = new ExtentWrapped(theExtent.getLowerLeftX() - bboxOffset,
theExtent.getLowerLeftY() - bboxOffset, theExtent.getUpperRightX() + bboxOffset,
theExtent.getUpperRightY() + bboxOffset);
GWT.log("Zoom to selected - transf extent: " + transfExtent);
Button selectTo = new Button("Zoom to selected");
selectTo.setTitle("Zoom to select centroids...");
selectTo.setType(ButtonType.DEFAULT);
selectTo.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
applicationBus.fireEvent(new FitMapToExtentEvent(transfExtent));
}
});
flexTable.setWidget(1, 0, selectTo);
}
} catch (Exception e) {
// TODO: handle exception
}
}
}
});
}
public static final BBOXDV fromGeoJSON(double[] coords) {
BBOXDV toReturn = new BBOXDV();
toReturn.setMaxX(coords[0]);
toReturn.setMinY(coords[1]);
if (coords.length == 6) {
// 3D
toReturn.setMinZ(coords[2]);
toReturn.setMinX(coords[3]);
toReturn.setMaxY(coords[4]);
toReturn.setMaxZ(coords[5]);
} else {
toReturn.setMinX(coords[2]);
toReturn.setMaxY(coords[3]);
}
return toReturn;
}
/**
* Load inner level.
*
* @param level the level
* @param selectableItemValue the selectable item value
*/
private void loadInnerLevel(int level, String selectableItemValue) {
// GWT.log("selected level " + level + " selectableItemValue " +
// selectableItemValue);
HashMap<String, SelectableItem> mapSelectableItem = mapInnestedFeatures.get(level);
SelectableItem selectedItem = mapSelectableItem.get(selectableItemValue);
// GWT.log("selected selectableItem " + selectedItem);
int innerLevel = level + 1;
List<? extends LayerIDV> selectedLayers = mapInnestedFiltering.get(innerLevel);
// if layer filtering exists at this level
if (selectedLayers != null) {
List<ListBox> selectedListBoxes = mapInnestedListBoxes.get(innerLevel);
GWT.log("loading inner layers " + selectedLayers);
GWT.log("loading selectedListBoxes " + selectedListBoxes);
fillSelectableLevel(innerLevel, selectedItem);
}
}
/**
* Sets the filter high lighted.
*
* @param bool the new filter high lighted
*/
private void setFilterHighLighted(boolean bool) {
if (bool) {
filterButton.getElement().addClassName("highlight-button");
} else {
filterButton.getElement().removeClassName("highlight-button");
}
}
/**
* Sets the search button.
*
* @param searchFacilityButton the new search button
*/
public void setFilterButton(DropdownButton searchFacilityButton) {
this.filterButton = searchFacilityButton;
}
/**
* The Class SelectableItem.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 31, 2023
*/
public class SelectableItem {
protected String keyField;
protected String keyValue;
protected String parentKeyField;
protected String itemValue;
protected String layername;
protected String theGeometryName;
/**
* Instantiates a new selectable item.
*/
SelectableItem() {
}
/**
* Instantiates a new selectable item.
*
* @param keyField the key field
* @param keyValue the key value
* @param parentKeyField the parent key field
* @param itemValue the item value
* @param layername the layername
* @param theGeometryName the the geometry name
*/
public SelectableItem(String keyField, String keyValue, String parentKeyField, String itemValue,
String layername, String theGeometryName) {
super();
this.keyField = keyField;
this.keyValue = keyValue;
this.parentKeyField = parentKeyField;
this.itemValue = itemValue;
this.layername = layername;
this.theGeometryName = theGeometryName;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SelectableItem [keyField=");
builder.append(keyField);
builder.append(", keyValue=");
builder.append(keyValue);
builder.append(", parentKeyField=");
builder.append(parentKeyField);
builder.append(", itemValue=");
builder.append(itemValue);
builder.append(", layername=");
builder.append(layername);
builder.append(", theGeometryName=");
builder.append(theGeometryName);
builder.append("]");
return builder.toString();
}
}
}

View File

@ -0,0 +1,28 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
.margin-left-10 {
margin-left: 10px;
}
</ui:style>
<g:HTMLPanel>
<g:ScrollPanel>
<g:HTMLPanel>
<b:Form ui:field="panelForm">
<b:Fieldset ui:field="fieldSet">
</b:Fieldset>
</b:Form>
<g:HTMLPanel ui:field="panelResults">
</g:HTMLPanel>
<b:Button icon="REMOVE_CIRCLE" ui:field="buttonReset"
title="Reset the filter">Reset</b:Button>
</g:HTMLPanel>
</g:ScrollPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,278 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.customoverlays;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.OverlayCustomLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.FontWeight;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.ErrorEvent;
import com.google.gwt.event.dom.client.ErrorHandler;
import com.google.gwt.event.dom.client.LoadEvent;
import com.google.gwt.event.dom.client.LoadHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class OverlayCustomLayerPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 15, 2023
*/
public class OverlayCustomLayerPanel extends Composite {
public static String COLORSCALERANGE = "COLORSCALERANGE";
@UiField
HTMLPanel basePanel;
@UiField
HTMLPanel stylePanel;
@UiField
HTMLPanel styleListPanel;
@UiField
Button buttonLegend;
@UiField
ScrollPanel legendPanel;
private CheckBox checkbox;
private GeoInformationForWMSRequest geoInformation;
private static OverlayCustomLayerPanelUiBinder uiBinder = GWT.create(OverlayCustomLayerPanelUiBinder.class);
private ListBox listBoxStyles = new ListBox();
private HandlerManager applicationBus;
private LayerItem layerItem;
/**
* The Interface LayerCollectionPanelUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 16, 2023
*/
interface OverlayCustomLayerPanelUiBinder extends UiBinder<Widget, OverlayCustomLayerPanel> {
}
/**
* Instantiates a new overlay custom layer panel.
*
* @param layerItem the layer item
* @param applicationBus the application bus
*/
public OverlayCustomLayerPanel(LayerItem layerItem, HandlerManager applicationBus) {
initWidget(uiBinder.createAndBindUi(this));
this.applicationBus = applicationBus;
this.layerItem = layerItem;
buttonLegend.setType(ButtonType.LINK);
legendPanel.setVisible(false);
GWT.log("Found available layerItem " + layerItem);
String label = layerItem.getTitle();
final String layerName = layerItem.getName();
checkbox = new CheckBox(label);
checkbox.setId("gcubeCustomLayerSelector_" + layerName);
checkbox.getElement().getStyle().setFontWeight(FontWeight.BOLD);
checkbox.setChecked(true);
checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
GWT.log("CustomLayer selector flag changed to value : " + event.toDebugString());
if (event.getValue()) {
// OPEN COLLECTION
applicationBus.fireEvent(new OverlayCustomLayerToMapEvent(layerItem, OverlayCustomLayerToMapEvent.ACTION_TYPE.VISIBILITY, true));
} else {
// CLOSE COLLECTION
legendPanel.clear();
legendPanel.setVisible(false);
applicationBus.fireEvent(new OverlayCustomLayerToMapEvent(layerItem, OverlayCustomLayerToMapEvent.ACTION_TYPE.VISIBILITY, false));
}
}
});
basePanel.add(checkbox);
final String wmsLink = layerItem.getWmsLink();
GeoportalDataViewerServiceAsync.Util.getInstance().parseWmsRequest(wmsLink, layerName,
new AsyncCallback<GeoInformationForWMSRequest>() {
@Override
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
}
@Override
public void onSuccess(GeoInformationForWMSRequest geoInfoWMS) {
geoInformation = geoInfoWMS;
GWT.log("Parsed WMS Request returned: " + geoInfoWMS);
if (geoInfoWMS.getStyles() != null && geoInfoWMS.getStyles().getGeoStyles() != null) {
if (geoInfoWMS.getStyles().getGeoStyles().size() > 0) {
stylePanel.setVisible(true);
listBoxStyles.clear();
for (String styleName : geoInfoWMS.getStyles().getGeoStyles()) {
listBoxStyles.addItem(styleName, styleName);
}
styleListPanel.add(listBoxStyles);
}
}
listBoxStyles.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
legendPanel.clear();
legendPanel.setVisible(false);
}
});
buttonLegend.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GWT.log("is isToggle: " + buttonLegend.isToggle());
GWT.log("is isToggled: " + buttonLegend.isToggled());
if (legendPanel.isVisible()) {
legendPanel.clear();
legendPanel.setVisible(false);
} else {
legendPanel.setVisible(true);
loadLegend(wmsLink);
}
}
});
}
});
}
/**
* Gets the checkbox.
*
* @return the checkbox
*/
public CheckBox getCheckbox() {
return checkbox;
}
/**
* Load legend.
*
* @param wmsLink the wms link
*/
private void loadLegend(String wmsLink) {
legendPanel.clear();
String theLayerName = geoInformation.getLayerName();
final FlexTable flexTable = new FlexTable();
legendPanel.add(flexTable);
// Case no style found
if (listBoxStyles.getSelectedValue() == null) {
flexTable.setWidget(0, 0, new HTML("No style found"));
return;
}
FlowPanel flow = new FlowPanel();
flow.add(new HTMLPanel("Legend for: " + theLayerName));
final HorizontalPanel hpLegend = new HorizontalPanel();
String url = geoInformation.getServiceEndPoint() + "?service=WMS&" + "version="
+ URLUtil.getValueOfParameter("version", wmsLink) + "&" + "request=GetLegendGraphic&" + "layer="
+ theLayerName;
String styleName = null;
try {
styleName = listBoxStyles.getSelectedValue();
} catch (Exception e) {
}
styleName = styleName != null && !styleName.isEmpty() ? styleName : "";
if (!geoInformation.isNcWMS()) {
url += "&format=image/png" + "&STYLE=" + styleName
+ "&LEGEND_OPTIONS=forceRule:True;dx:0.2;dy:0.2;mx:0.2;my:0.2;fontStyle:bold;"
+ "borderColor:000000;border:true;fontColor:000000;fontSize:14";
} else {
int isNcWmsStyle = styleName.indexOf("/");
if (isNcWmsStyle != -1) {
styleName = styleName.substring(isNcWmsStyle + 1, styleName.length());
}
url += "&palette=" + styleName;
if (geoInformation.getMapWMSNoStandard() != null) {
for (String key : geoInformation.getMapWMSNoStandard().keySet()) { // ADDING COLORSCALERANGE?
if (key.compareToIgnoreCase(COLORSCALERANGE) == 0) {
url += "&" + key + "=" + geoInformation.getMapWMSNoStandard().get(key);
break;
}
}
}
}
GWT.log(url);
flexTable.setStyleName("layer-style-panel-table-legend");
flexTable.setWidget(0, 0, new Label("Legend"));
final Image legendImage = new Image(url);
legendImage.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
}
});
legendImage.addErrorHandler(new ErrorHandler() {
@Override
public void onError(ErrorEvent event) {
GWT.log("ErrorEvent ");
flexTable.setWidget(0, 1, new HTML("Error on loading the style"));
}
});
hpLegend.add(legendImage);
flexTable.setWidget(0, 1, hpLegend);
}
}

View File

@ -0,0 +1,29 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
.margin-left-10 {
margin-left: 10px;
}
</ui:style>
<g:HTMLPanel addStyleNames="{style.margin-left-10}">
<g:HTMLPanel ui:field="basePanel">
</g:HTMLPanel>
<g:HTMLPanel ui:field="stylePanel" visible="false"
addStyleNames="layer-style-panel">
Layer Style
<g:HorizontalPanel>
<g:HTMLPanel ui:field="styleListPanel"></g:HTMLPanel>
<b:Button icon="BAR_CHART" ui:field="buttonLegend"
title="Show the Legend"></b:Button>
</g:HorizontalPanel>
<g:ScrollPanel ui:field="legendPanel"></g:ScrollPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,21 +1,30 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
import java.util.LinkedHashMap;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.client.ui.constants.LabelType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.Style.FontWeight;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.DragLeaveEvent;
import com.google.gwt.event.dom.client.DragLeaveHandler;
import com.google.gwt.event.dom.client.DragOverEvent;
@ -24,41 +33,106 @@ import com.google.gwt.event.dom.client.DragStartEvent;
import com.google.gwt.event.dom.client.DragStartHandler;
import com.google.gwt.event.dom.client.DropEvent;
import com.google.gwt.event.dom.client.DropHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
public class DragDropLayer extends FlowPanel {
private static final String _22PX = "22px";
private static DragDropLayer dragging = null;
private static DragDropLayer draggingTarget = null;
final boolean droppable;
private Label labelLayerName;
private CheckBox checkBoxVisibility = new CheckBox();
private Image imgLayerVisible = new Image(GNAImages.ICONS.layerVisible());
private Image imgLayerInvisible = new Image(GNAImages.ICONS.layerInvisible());
private Image imgLocate = new Image(GNAImages.ICONS.locate());
private Image imgLocateNone = new Image(GNAImages.ICONS.locateNone());
private boolean locateEnabled = false;
private HTML buttonLocate = new HTML();
private DragDropLayer INSTANCE = this;
private LoaderIcon loaderIcon = new LoaderIcon("Loading features", null);
private Button draggableButton = new Button();
private HandlerManager applicationBus;
private LayerObject layerObject;
private LayerItem layerItem;
private com.google.gwt.user.client.ui.Label labelProject;
private boolean layerVisibility = true;
private HTML buttonLayerVisibility = new HTML();
public DragDropLayer(HandlerManager applicationBus, LayerObject layerObject, boolean draggable, boolean droppable) {
this.applicationBus = applicationBus;
this.layerObject = layerObject;
this.layerItem = layerObject.getLayerItem();
GWT.log("DragDropLayer for projectDV: " + layerObject.getProjectDV());
// Checking the spatial reference
if (layerObject.getProjectDV() != null && layerObject.getProjectDV().getSpatialReference() == null) {
GeoportalDataViewerServiceAsync.Util.getInstance().getSpatialReference(layerObject.getProfileID(),
layerObject.getProjectID(), new AsyncCallback<GeoJSON>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(GeoJSON result) {
if (result != null)
layerObject.getProjectDV().setSpatialReference(result);
}
});
}
String referProjectID = "Project ID: " + layerObject.getProjectDV().getId();
labelProject = new com.google.gwt.user.client.ui.Label("");
labelProject.setTitle(referProjectID);
GeoportalDataViewerServiceAsync.Util.getInstance().getEntrySetsDocumentForProjectID(
layerObject.getProjectDV().getProfileID(), layerObject.getProjectDV().getId(), 1,
new AsyncCallback<LinkedHashMap<String, Object>>() {
@Override
public void onSuccess(LinkedHashMap<String, Object> result) {
String realProjectName = "";
if (result != null) {
for (String key : result.keySet()) {
result.get(key);
//referProject = key + ": " + result.get(key);
realProjectName = result.get(key)+"";
break;
}
}
if (realProjectName != null && !realProjectName.isEmpty()) {
labelProject.setText(StringUtil.ellipsize(realProjectName, 40));
labelProject.setTitle(realProjectName);
}
}
@Override
public void onFailure(Throwable caught) {
labelProject.setTitle("Error on reading the project name");
}
});
String layerName = StringUtil.fullNameToLayerName(layerItem.getName(), ":");
this.labelLayerName = new Label(layerName);
this.labelLayerName.setTitle(layerItem.getName());
this.labelLayerName.setType(LabelType.INFO);
BaseConcessioneDV refConcessione = layerObject.getSourceConcessione();
String nameConcessione = StringUtil.ellipsize(refConcessione.getNome(),40);
com.google.gwt.user.client.ui.Label labelConcessione = new com.google.gwt.user.client.ui.Label(nameConcessione);
labelConcessione.setTitle(refConcessione.getNome());
getElement().getStyle().setMarginTop(5, Unit.PX);
getElement().getStyle().setMarginBottom(10, Unit.PX);
@ -79,31 +153,110 @@ public class DragDropLayer extends FlowPanel {
}
RangeSlider rs = new RangeSlider(applicationBus, layerItem);
rs.getElement().addClassName("range-slider ");
FlexTable ft = new FlexTable();
ft.setWidget(0, 0, draggableButton);
draggableButton.setTitle("Drag and Drop me up or down to change my position on the Map");
checkBoxVisibility.getElement().getStyle().setMarginLeft(10, Unit.PX);
checkBoxVisibility.setValue(true);
rs.getElement().addClassName("range-slider");
//labelLayerName.getElement().getStyle().setMarginLeft(10, Unit.PX);
ft.setWidget(0, 1, checkBoxVisibility);
ft.setWidget(0, 2, labelConcessione);
ft.setWidget(1, 2, labelLayerName);
ft.setWidget(2, 2, new SimplePanel(rs));
add(ft);
// FlexTable ft = new FlexTable();
// ft.setWidget(0, 0, draggableButton);
draggableButton.setTitle("Drag and Drop me up or down to change my position on the Map");
imgLayerVisible.getElement().addClassName("layer-visibility-st");
imgLayerInvisible.getElement().addClassName("layer-visibility-st");
imgLocate.setWidth(_22PX);
imgLocate.setHeight(_22PX);
imgLocateNone.setWidth(_22PX);
imgLocateNone.setHeight(_22PX);
imgLocate.getElement().addClassName("layer-visibility-st");
imgLocateNone.getElement().addClassName("layer-visibility-st");
setLocateEnabledButtonImage();
setLayerVisibilityButtonImage();
VerticalPanel vp = new VerticalPanel();
VerticalPanel vpInner = new VerticalPanel();
HorizontalPanel hp0 = new HorizontalPanel();
HorizontalPanel hpFunct = new HorizontalPanel();
vpInner.getElement().getStyle().setMarginLeft(47, Unit.PX);
hp0.add(draggableButton);
labelProject.getElement().getStyle().setMarginLeft(10, Unit.PX);
labelProject.getElement().getStyle().setFontWeight(FontWeight.BOLD);
hp0.add(labelProject);
hpFunct.add(buttonLayerVisibility);
hpFunct.add(buttonLocate);
hpFunct.add(loaderIcon);
setVisibleLoaderFeatures(false, null);
if(layerObject.getProjectDV().getTemporalReference()!=null) {
TemporalReferenceDV tempRef = layerObject.getProjectDV().getTemporalReference();
if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
vpInner.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
}
vpInner.add(labelLayerName);
// vpInner.add(new SimplePanel(rs));
vp.add(hp0);
hpFunct.getElement().getStyle().setMarginTop(5, Unit.PX);
vpInner.add(hpFunct);
vpInner.add(new SimplePanel(rs));
vp.add(vpInner);
add(vp);
// add(ft);
draggableButton.setIcon(IconType.MOVE);
checkBoxVisibility.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
buttonLayerVisibility.addClickHandler(new ClickHandler() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.VISIBILITY, layerItem);
dae.setVisibility(checkBoxVisibility.getValue());
public void onClick(ClickEvent event) {
layerVisibility = !layerVisibility;
setLayerVisibilityButtonImage();
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.VISIBILITY, layerItem,
layerObject);
dae.setVisibility(layerVisibility);
applicationBus.fireEvent(dae);
}
});
buttonLocate.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
locateEnabled = !locateEnabled;
setLocateEnabledButtonImage();
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.LOCATE_LAYER,
layerItem, layerObject);
dae.setUIEventSource(INSTANCE);
setVisibleLoaderFeatures(true, null);
applicationBus.fireEvent(dae);
}
});
}
private void setLayerVisibilityButtonImage() {
buttonLayerVisibility.getElement().removeAllChildren();
if (layerVisibility) {
buttonLayerVisibility.getElement().appendChild(imgLayerVisible.getElement());
buttonLayerVisibility.setTitle("Hide the layer");
} else {
buttonLayerVisibility.getElement().appendChild(imgLayerInvisible.getElement());
buttonLayerVisibility.setTitle("Show the layer");
}
}
private void setLocateEnabledButtonImage() {
buttonLocate.getElement().removeAllChildren();
if (locateEnabled) {
buttonLocate.getElement().appendChild(imgLocate.getElement());
buttonLocate.setTitle("Unselect the layer features");
} else {
buttonLocate.getElement().appendChild(imgLocateNone.getElement());
buttonLocate.setTitle("Highlight the layer features");
}
}
private void initDrag() {
@ -156,9 +309,9 @@ public class DragDropLayer extends FlowPanel {
source = dragging;
int sourceIndex = tree.getWidgetIndex(source);
int targetIndex = tree.getWidgetIndex(draggingTarget);
GWT.log("sourceIndex: " + sourceIndex+", sourceItem: "+dragging.getLayerItem().getName());
GWT.log("targetIndex: " + targetIndex+", targetItem: "+draggingTarget.getLayerItem().getName());
GWT.log("sourceIndex: " + sourceIndex + ", sourceItem: " + dragging.getLayerItem().getName());
GWT.log("targetIndex: " + targetIndex + ", targetItem: " + draggingTarget.getLayerItem().getName());
if (sourceIndex != targetIndex && targetIndex >= 0) {
tree.remove(source);
target = tree;
@ -167,9 +320,11 @@ public class DragDropLayer extends FlowPanel {
tree.insert(source, targetIndex);
// target.setState(true);
DoActionOnDetailLayersEvent actionSwapLayers = new DoActionOnDetailLayersEvent(
DO_LAYER_ACTION.SWAP, layerItem);
SwapLayer swapLS = new DoActionOnDetailLayersEvent.SwapLayer(dragging.getLayerItem(), sourceIndex);
SwapLayer swapLT = new DoActionOnDetailLayersEvent.SwapLayer(draggingTarget.getLayerItem(), targetIndex);
DO_LAYER_ACTION.SWAP, layerItem, layerObject);
SwapLayer swapLS = new DoActionOnDetailLayersEvent.SwapLayer(dragging.getLayerItem(),
sourceIndex);
SwapLayer swapLT = new DoActionOnDetailLayersEvent.SwapLayer(draggingTarget.getLayerItem(),
targetIndex);
actionSwapLayers.setSwapLayers(swapLS, swapLT);
applicationBus.fireEvent(actionSwapLayers);
}
@ -179,9 +334,22 @@ public class DragDropLayer extends FlowPanel {
}
}, DropEvent.getType());
}
public LayerItem getLayerItem() {
return layerItem;
}
/**
* Sets the visible loader features.
*
* @param bool the bool
* @param msg the msg
*/
public void setVisibleLoaderFeatures(boolean bool, String msg) {
loaderIcon.setVisible(bool);
if(msg!=null)
loaderIcon.setText(msg);
}
}

View File

@ -1,5 +1,6 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
@ -38,8 +39,8 @@ public class RangeSlider extends Composite {
sliderId = "slider-" + Random.nextInt();
theSlider.addClassName("slider");
theSlider.setId(sliderId);
theSlider.setTitle("Set opacity of "+layer.getName());
theSlider.setTitle("Set opacity of the layer");
theSlider.setPropertyObject("value", GeoportalDataViewerConstants.INITIAL_LAYER_OPACITY*100);
bindEvents();
}
@ -54,11 +55,11 @@ public class RangeSlider extends Composite {
if (Event.ONMOUSEUP == event.getTypeInt()) {
GWT.log("Event.ONMOUSEUP");
DoActionOnDetailLayersEvent actionChangeOpacity = new DoActionOnDetailLayersEvent(
DO_LAYER_ACTION.OPACITY, layer);
DO_LAYER_ACTION.OPACITY, layer, null);
int value = Integer.parseInt((String) theSlider.getPropertyObject("value"));
//GWT.log("opacity int value: "+value);
double opacity = (double) ((double) value/100);
GWT.log("opacity double value: "+opacity);
// GWT.log("opacity int value: "+value);
double opacity = (double) ((double) value / 100);
GWT.log("opacity double value: " + opacity);
actionChangeOpacity.setOpacity(opacity);
applicationBus.fireEvent(actionChangeOpacity);
}

View File

@ -1,6 +1,6 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.PublicLink;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
@ -117,7 +117,7 @@ public class DialogShareableLink extends Composite {
// @UiField
// HTMLPanel panelFieldsContainer;
private GeoNaItemRef geonItemRef;
private GeoportalItemReferences geonItemRef;
private String fileVersion;
@ -149,7 +149,7 @@ public class DialogShareableLink extends Composite {
* @param item the item
* @param version the version
*/
public DialogShareableLink(GeoNaItemRef item, String version) {
public DialogShareableLink(GeoportalItemReferences item, String version) {
initWidget(uiBinder.createAndBindUi(this));
this.geonItemRef = item;
@ -396,7 +396,7 @@ public class DialogShareableLink extends Composite {
private native void copyToClipboard(String myDivId) /*-{
var copyText = $doc.getElementById(myDivId);
console.log("text copied is :" + copyText.value);
//console.log("text copied is :" + copyText.value);
copyText.select();
//For mobile devices
copyText.setSelectionRange(0, 99999);
@ -409,12 +409,12 @@ public class DialogShareableLink extends Composite {
*
* @param item the item
*/
private void loadAndShowPublicLinksForItem(GeoNaItemRef item) {
private void loadAndShowPublicLinksForItem(GeoportalItemReferences item) {
GeoportalDataViewerServiceAsync.Util.getInstance().getPublicLinksFor(item, new AsyncCallback<GeoNaItemRef>() {
GeoportalDataViewerServiceAsync.Util.getInstance().getPublicLinksFor(item, new AsyncCallback<GeoportalItemReferences>() {
@Override
public void onSuccess(GeoNaItemRef itemReferences) {
public void onSuccess(GeoportalItemReferences itemReferences) {
showLoadingIcon(false);
openPublicLink = itemReferences.getOpenLink();
restrictedPublicLink = itemReferences.getRestrictedLink();

View File

@ -1,133 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.images;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
import org.gcube.portlets.user.geoportaldataviewer.client.util.NewBrowserWindow;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Heading;
import com.github.gwtbootstrap.client.ui.Image;
import com.github.gwtbootstrap.client.ui.Paragraph;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.TextAlign;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
public class ImageView extends Composite {
private static ImageViewUiBinder uiBinder = GWT.create(ImageViewUiBinder.class);
interface ImageViewUiBinder extends UiBinder<Widget, ImageView> {
}
public ImageView() {
initWidget(uiBinder.createAndBindUi(this));
}
@UiField
Image imageURL;
@UiField
Heading heading;
@UiField
Paragraph paragraph1;
@UiField
Paragraph paragraph2;
@UiField
Button openImage;
@UiField
Button viewImage;
private WorkspaceContentDV latest;
public ImageView(UploadedImageDV imageDV, final boolean showView, final boolean showOpen) {
initWidget(uiBinder.createAndBindUi(this));
if(imageDV.getTitolo()!=null && !imageDV.getTitolo().isEmpty()) {
heading.setText(imageDV.getTitolo());
}
paragraph1.setText(imageDV.getDidascalia());
paragraph1.getElement().getStyle().setTextAlign(TextAlign.LEFT);
if(!showView && imageDV.getLicenseID()!=null) {
paragraph2.setVisible(true);
paragraph2.setText("ID Licenza: "+imageDV.getLicenseID());
}
if(imageDV.getListWsContent()!=null && imageDV.getListWsContent().size()>0) {
latest = imageDV.getListWsContent().get(imageDV.getListWsContent().size()-1);
openImage.setVisible(true);
viewImage.setVisible(true);
imageURL.setVisible(true);
imageURL.setUrl(latest.getLink());
}
openImage.setType(ButtonType.LINK);
openImage.setIcon(IconType.EXTERNAL_LINK);
openImage.setTitle("Open Image in New Browser Window");
openImage.setVisible(showOpen);
openImage.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if(latest!=null) {
NewBrowserWindow.open(latest.getLink()+"?content-disposition=inline", "_blank", null);
}
}
});
viewImage.setVisible(false);
viewImage.setType(ButtonType.LINK);
viewImage.setIcon(IconType.EXPAND);
viewImage.setTitle("View Image in New Dialog");
viewImage.setVisible(showView);
viewImage.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if(latest!=null) {
ModalWindow mw = new ModalWindow(StringUtil.ellipsize(imageDV.getDidascalia(), 50), 900, 600);
mw.add(new ImageView(imageDV, false, true));
mw.setCaller(ImageView.this);
//mw.setWidth(900);
mw.show();
}
}
});
}
/**
* Sets the heading.
*
* @param title the new heading
*/
protected void setHeading(String title) {
heading.setText(title);
}
protected void setParagraph(String text) {
paragraph1.setText(text);
}
}

View File

@ -1,33 +0,0 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.max-width-400 {
max-width: 400px;
}
.float-right {
float: right;
}
.margin-top-10 {
margin-top: 10px;
}
</ui:style>
<g:HTMLPanel>
<!-- <b:Thumbnail size="4" addStyleNames="{style.max-width-400}" ui:field="thumbnailCont"> -->
<b:Button ui:field="viewImage" visible="false">View</b:Button>
<b:Button ui:field="openImage"
addStyleNames="{style.float-right}" visible="false">Open</b:Button>
<b:Image ui:field="imageURL" visible="false" />
<b:Caption addStyleNames="{style.margin-top-10}">
<b:Heading size="4" ui:field="heading" visible="false"></b:Heading>
<b:Paragraph ui:field="paragraph1">
</b:Paragraph>
<b:Paragraph ui:field="paragraph2" visible="false">
</b:Paragraph>
</b:Caption>
</g:HTMLPanel>
<!-- </b:Thumbnail> -->
</ui:UiBinder>

View File

@ -1,61 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.images;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class ThumbnailImageView.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 20, 2020
*/
public class ThumbnailImageView extends Composite {
private static ThumbnailImageViewUiBinder uiBinder = GWT.create(ThumbnailImageViewUiBinder.class);
@UiField
HTMLPanel thumbnailContainer;
/**
* The Interface ThumbnailImageViewUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 20, 2020
*/
interface ThumbnailImageViewUiBinder extends UiBinder<Widget, ThumbnailImageView> {
}
/**
* Instantiates a new thumbnail image view.
*
* @param imageDV the image DV
* @param showView the show view
* @param showOpen the show open
*/
public ThumbnailImageView(UploadedImageDV imageDV, final boolean showView, final boolean showOpen) {
initWidget(uiBinder.createAndBindUi(this));
ImageView imageView = new ImageView(imageDV, showView, showOpen);
String title = StringUtil.ellipsize(imageDV.getTitolo(), 25);
imageView.setHeading(title);
String didascalia = StringUtil.ellipsize(imageDV.getDidascalia(), 50);
imageView.setParagraph(didascalia);
// imageView.setViewImageVisible(true);
thumbnailContainer.add(imageView);
}
}

View File

@ -1,15 +0,0 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
xmlns:citem="urn:import:org.gcube.portlets.user.geoportaldataviewer.client.ui.images">
<ui:style>
.max-width-400 {
max-width: 400px;
}
</ui:style>
<b:Thumbnail size="4" addStyleNames="{style.max-width-400}"
ui:field="thumbnailView">
<g:HTMLPanel ui:field="thumbnailContainer"></g:HTMLPanel>
</b:Thumbnail>
</ui:UiBinder>

View File

@ -0,0 +1,359 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.layercollection;
import java.util.HashMap;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.UpdateLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.UpdateLayerToMapEvent.LAYER_TYPE;
import org.gcube.portlets.user.geoportaldataviewer.client.events.UpdateLayerToMapEvent.REQUEST_PARAMETER;
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.CloseCollectionEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.FontWeight;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.ErrorEvent;
import com.google.gwt.event.dom.client.ErrorHandler;
import com.google.gwt.event.dom.client.LoadEvent;
import com.google.gwt.event.dom.client.LoadHandler;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class LayerCollectionPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 15, 2023
*/
public class LayerCollectionPanel extends Composite {
public static String COLORSCALERANGE = "COLORSCALERANGE";
@UiField
HTMLPanel basePanel;
@UiField
HTMLPanel stylePanel;
@UiField
HTMLPanel styleListPanel;
@UiField
HTMLPanel statisticPanel;
@UiField
Button buttonLegend;
@UiField
ScrollPanel legendPanel;
private CheckBox checkbox;
private GeoInformationForWMSRequest geoInformation;
private static LayerCollectionPanelUiBinder uiBinder = GWT.create(LayerCollectionPanelUiBinder.class);
private ListBox listBoxStyles = new ListBox();
private String layerName;
private GCubeCollection gcubeCollection;
private HandlerManager applicationBus;
/**
* The Interface LayerCollectionPanelUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 16, 2023
*/
interface LayerCollectionPanelUiBinder extends UiBinder<Widget, LayerCollectionPanel> {
}
/**
* Instantiates a new layer collection panel.
*
* @param coll the coll
* @param applicationBus the application bus
*/
public LayerCollectionPanel(final GCubeCollection coll, HandlerManager applicationBus) {
initWidget(uiBinder.createAndBindUi(this));
this.applicationBus = applicationBus;
buttonLegend.setType(ButtonType.LINK);
legendPanel.setVisible(false);
statisticPanel.setVisible(false);
GWT.log("Found available collection " + coll);
String label = coll.getUcd().getName();
final String collectionID = coll.getUcd().getId(); // collectionID == UCD_Id
checkbox = new CheckBox(label);
checkbox.setId("gcubeCollectionSelector_" + collectionID);
checkbox.getElement().getStyle().setFontWeight(FontWeight.BOLD);
checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
GWT.log("Collection selector flag changed to value : " + event.toDebugString());
GWT.log("Collection ID is : " + collectionID + ", event value: " + event.getValue());
if (event.getValue()) {
// OPEN COLLECTION
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
enableLayerStyle(true);
} else {
// CLOSE COLLECTION
hideStyleLegend();
resetLayerStyle();
enableLayerStyle(false);
applicationBus.fireEvent(new CloseCollectionEvent(collectionID));
}
}
});
basePanel.add(checkbox);
GeoportalDataViewerServiceAsync.Util.getInstance().getCountFor(collectionID, "Published", "OK", new AsyncCallback<Integer>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(Integer result) {
if(result!=null) {
String resultLabel = result+" project";
if(result>1) {
resultLabel+="s";
}
resultLabel+= " published";
statisticPanel.setVisible(true);
statisticPanel.add(new HTML(resultLabel));
}
}
});
ViewerConfiguration theConfig = GeoportalDataViewer.getStatus().getViewerConfig();
final GCubeCollection toOpen = theConfig.getAvailableCollections().get(collectionID);
// Check if indexes is empty
if (toOpen.getIndexes() == null || toOpen.getIndexes().isEmpty()) {
GWT.log("Unexpected empty indexes in collection " + toOpen);
Window.alert("Cannot open collection index layer for " + toOpen.getUcd().getName() + ".");
return;
}
this.gcubeCollection = toOpen;
// TODO Get Default Index Layer
// For now we just take the first - only 1 is expected
IndexLayerDV layer = toOpen.getIndexes().get(0);
// Open Index Layer
HashMap<String, String> ogcLinks = layer.getLayer().getOgcLinks();
final String wmsLink = ogcLinks.get("wms");
this.layerName = URLUtil.getValueOfParameter("layers", wmsLink);
GeoportalDataViewerServiceAsync.Util.getInstance().parseWmsRequest(wmsLink, layerName,
new AsyncCallback<GeoInformationForWMSRequest>() {
@Override
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
}
@Override
public void onSuccess(GeoInformationForWMSRequest geoInfoWMS) {
geoInformation = geoInfoWMS;
GWT.log("Parsed WMS Request returned: " + geoInfoWMS);
if (geoInfoWMS.getStyles() != null && geoInfoWMS.getStyles().getGeoStyles() != null) {
if (geoInfoWMS.getStyles().getGeoStyles().size() > 0) {
stylePanel.setVisible(true);
listBoxStyles.clear();
for (String styleName : geoInfoWMS.getStyles().getGeoStyles()) {
listBoxStyles.addItem(styleName, styleName);
}
styleListPanel.add(listBoxStyles);
}
}
buttonLegend.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GWT.log("is isToggle: " + buttonLegend.isToggle());
GWT.log("is isToggled: " + buttonLegend.isToggled());
if (legendPanel.isVisible()) {
hideStyleLegend();
} else {
legendPanel.setVisible(true);
loadLegend(wmsLink);
}
}
});
listBoxStyles.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
setLayerStyle();
}
});
}
});
}
private void setLayerStyle() {
UpdateLayerToMapEvent updateLayer = new UpdateLayerToMapEvent(this.gcubeCollection, this.layerName,
LAYER_TYPE.INDEX);
updateLayer.setOperation(REQUEST_PARAMETER.STYLE, listBoxStyles.getSelectedValue());
applicationBus.fireEvent(updateLayer);
if (legendPanel.isVisible()) {
legendPanel.clear();
legendPanel.setVisible(false);
}
}
private void resetLayerStyle() {
listBoxStyles.setSelectedIndex(0);
listBoxStyles.setSelectedValue(listBoxStyles.getSelectedValue());
}
private void enableLayerStyle(boolean enabled) {
listBoxStyles.setEnabled(enabled);
}
private void hideStyleLegend() {
legendPanel.clear();
legendPanel.setVisible(false);
}
/**
* Gets the checkbox.
*
* @return the checkbox
*/
public CheckBox getCheckbox() {
return checkbox;
}
/**
* Load legend.
*
* @param wmsLink the wms link
*/
private void loadLegend(String wmsLink) {
legendPanel.clear();
String theLayerName = geoInformation.getLayerName();
final FlexTable flexTable = new FlexTable();
legendPanel.add(flexTable);
// Case no style found
if (listBoxStyles.getSelectedValue() == null) {
flexTable.setWidget(0, 0, new HTML("No style found"));
return;
}
FlowPanel flow = new FlowPanel();
flow.add(new HTMLPanel("Legend for: " + theLayerName));
final HorizontalPanel hpLegend = new HorizontalPanel();
String url = geoInformation.getServiceEndPoint() + "?service=WMS&" + "version="
+ URLUtil.getValueOfParameter("version", wmsLink) + "&" + "request=GetLegendGraphic&" + "layer="
+ theLayerName;
String styleName = null;
try {
styleName = listBoxStyles.getSelectedValue();
} catch (Exception e) {
}
styleName = styleName != null && !styleName.isEmpty() ? styleName : "";
if (!geoInformation.isNcWMS()) {
url += "&format=image/png" + "&STYLE=" + styleName
+ "&LEGEND_OPTIONS=forceRule:True;dx:0.2;dy:0.2;mx:0.2;my:0.2;fontStyle:bold;"
+ "borderColor:000000;border:true;fontColor:000000;fontSize:14";
} else {
int isNcWmsStyle = styleName.indexOf("/");
if (isNcWmsStyle != -1) {
styleName = styleName.substring(isNcWmsStyle + 1, styleName.length());
}
url += "&palette=" + styleName;
if (geoInformation.getMapWMSNoStandard() != null) {
for (String key : geoInformation.getMapWMSNoStandard().keySet()) { // ADDING COLORSCALERANGE?
if (key.compareToIgnoreCase(COLORSCALERANGE) == 0) {
url += "&" + key + "=" + geoInformation.getMapWMSNoStandard().get(key);
break;
}
}
}
}
GWT.log(url);
flexTable.setStyleName("layer-style-panel-table-legend");
flexTable.setWidget(0, 0, new Label("Legend"));
final Image legendImage = new Image(url);
legendImage.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
}
});
legendImage.addErrorHandler(new ErrorHandler() {
@Override
public void onError(ErrorEvent event) {
GWT.log("ErrorEvent ");
flexTable.setWidget(0, 1, new HTML("Error on loading the style"));
}
});
hpLegend.add(legendImage);
flexTable.setWidget(0, 1, hpLegend);
}
}

View File

@ -0,0 +1,25 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel>
<g:HTMLPanel ui:field="basePanel">
</g:HTMLPanel>
<g:HTMLPanel ui:field="statisticPanel" addStyleNames="statistic-style-panel">
</g:HTMLPanel>
<g:HTMLPanel ui:field="stylePanel" visible="false" addStyleNames="layer-style-panel">
Layer Style
<g:HorizontalPanel>
<g:HTMLPanel ui:field="styleListPanel"></g:HTMLPanel>
<b:Button icon="BAR_CHART" ui:field="buttonLegend" title="Show the Legend"></b:Button>
</g:HorizontalPanel>
<g:ScrollPanel ui:field="legendPanel"></g:ScrollPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -67,7 +67,7 @@ public class MapView extends Composite {
@UiField
HorizontalPanel coordinatePanel;
private LightOpenLayerMap lightOLSM;
private LightOpenLayerMap lightOLM;
private HTML attributionDiv = null;
@ -92,14 +92,14 @@ public class MapView extends Composite {
@Override
public void execute() {
lightOLSM = new LightOpenLayerMap(theMapId);
lightOLM = new LightOpenLayerMap(theMapId);
setBaseLayers();
// EPSG_3857 LOCATION TO ITALY
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
lightOLSM.setCenter(transformedCenterCoordinate);
lightOLSM.setZoom(GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON);
lightOLM.setCenter(transformedCenterCoordinate);
lightOLM.setZoom(GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON);
}
});
}
@ -127,7 +127,7 @@ public class MapView extends Composite {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
lightOLSM.changeBaseMap(baseMapLayer);
lightOLM.changeBaseMap(baseMapLayer);
setMapAttribution(baseMapLayer);
}
});
@ -193,9 +193,9 @@ public class MapView extends Composite {
@Override
public void execute() {
if (lightOLSM != null) {
lightOLSM.addPoint(coordinate, showCoordinateText, true);
lightOLSM.getMap().getView().setCenter(coordinate);
if (lightOLM != null) {
lightOLM.addPoint(coordinate, showCoordinateText, true);
lightOLM.getMap().getView().setCenter(coordinate);
}
}
});
@ -232,11 +232,11 @@ public class MapView extends Composite {
null);
}
lightOLSM.addWMSLayer(mapServerHost, layerName, theBBOX);
lightOLM.addWMSLayer(mapServerHost, layerName, theBBOX);
if (ew != null) {
lightOLSM.getMap().getView().fit(ew);
lightOLM.getMap().getView().fit(ew);
}
@ -245,8 +245,8 @@ public class MapView extends Composite {
}
public LightOpenLayerMap getLightOLSM() {
return lightOLSM;
public LightOpenLayerMap getLightOLM() {
return lightOLM;
}
}

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