in progress cross-filtering
This commit is contained in:
parent
16d9feffe0
commit
a208b37791
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.4.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.5.0-SNAPSHOT/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-3.4.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-3.5.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
@ -35,5 +35,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/geoportal-data-viewer-app-3.4.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/geoportal-data-viewer-app-3.5.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
eclipse.preferences.version=1
|
||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.4.0-SNAPSHOT
|
||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.5.0-SNAPSHOT
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -79,8 +79,12 @@
|
|||
|
||||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-viewer-app-3.4.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-viewer-app-3.5.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -161,7 +165,9 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -242,7 +248,9 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -323,7 +331,9 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -404,7 +414,9 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -488,7 +500,9 @@
|
|||
<dependent-module archiveName="geoportal-data-common-2.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -569,7 +583,9 @@
|
|||
|
||||
|
||||
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -650,7 +666,9 @@
|
|||
|
||||
|
||||
<property name="context-root" value="geoportal-data-viewer-app"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -731,7 +749,9 @@
|
|||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation.TimelineManagerStatus;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.OLGeoJSONUtil;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.ControlledCallBack;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||
|
@ -91,12 +92,6 @@ import com.google.gwt.user.client.ui.Widget;
|
|||
|
||||
import ol.Coordinate;
|
||||
import ol.Feature;
|
||||
import ol.OLFactory;
|
||||
import ol.format.GeoJson;
|
||||
import ol.format.GeoJsonFeatureOptions;
|
||||
import ol.format.GeoJsonOptions;
|
||||
import ol.proj.Projection;
|
||||
import ol.proj.ProjectionOptions;
|
||||
|
||||
/**
|
||||
* Entry point classes define <code>onModuleLoad()</code>.
|
||||
|
@ -295,7 +290,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
// if (result.getListCustomLayers() != null && result.getListCustomLayers().size() > 0) {
|
||||
// mainPanel.setCustomLayers(result.getListCustomLayers());
|
||||
// }
|
||||
|
||||
|
||||
loadConfigureduGroupedLayersForUCD();
|
||||
|
||||
GWT.log("DONE INIT LOAD");
|
||||
|
@ -318,7 +313,6 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
RootPanel.get(APP_DIV).add(attributionDiv);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load Overlay Layers and Cross-Filtering layers for UCD
|
||||
*
|
||||
|
@ -332,13 +326,14 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert("error: "+caught.getMessage());
|
||||
GWT.log("loadConfigureduGroupedLayersForUCD error for "
|
||||
+ GEOPORTAL_DATA_HANDLER.geoportal_grouped_overlay_layers + ": " + caught.getMessage());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Map<String, List<GroupedLayersDV<? extends LayerIDV>>> result) {
|
||||
GWT.log("GEOPORTAL_DATA_HANDLER.geoportal_grouped_overlay_layers returned: ");
|
||||
GWT.log(GEOPORTAL_DATA_HANDLER.geoportal_grouped_overlay_layers +" returned: "+result);
|
||||
if (result != null && result.size() > 0) {
|
||||
|
||||
Map<String, GCubeCollection> collections = viewerConfiguration.getAvailableCollections();
|
||||
|
@ -355,6 +350,38 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getAvaiableCustomGroupedLayersForUCD(
|
||||
GEOPORTAL_DATA_HANDLER.geoportal_grouped_cross_filtering,
|
||||
new AsyncCallback<Map<String, List<GroupedLayersDV<? extends LayerIDV>>>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
GWT.log("loadConfigureduGroupedLayersForUCD error for "
|
||||
+ GEOPORTAL_DATA_HANDLER.geoportal_grouped_cross_filtering + ": "
|
||||
+ caught.getMessage());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Map<String, List<GroupedLayersDV<? extends LayerIDV>>> result) {
|
||||
GWT.log(GEOPORTAL_DATA_HANDLER.geoportal_grouped_cross_filtering+" returned: "+result);
|
||||
if (result != null && result.size() > 0) {
|
||||
|
||||
Map<String, GCubeCollection> collections = viewerConfiguration.getAvailableCollections();
|
||||
|
||||
for (String profileId : result.keySet()) {
|
||||
List<GroupedLayersDV<? extends LayerIDV>> list = result.get(profileId);
|
||||
if (list != null && list.size() > 0) {
|
||||
GCubeCollection collection = collections.get(profileId);
|
||||
mainPanel.addCrossFilteringLayers(collection, list);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -980,18 +1007,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
*/
|
||||
private void showLayerFeatures(LayerItem layerItem, String geoJSONFeatures, ProjectDV projectDV) {
|
||||
|
||||
GeoJsonFeatureOptions fo = new GeoJsonFeatureOptions();
|
||||
ProjectionOptions projectionOptions = new ProjectionOptions();
|
||||
projectionOptions.setCode(MAP_PROJECTION.EPSG_4326.getName());
|
||||
Projection fp = new Projection(projectionOptions);
|
||||
fo.setFeatureProjection(fp);
|
||||
fo.setDataProjection(fp);
|
||||
GeoJsonOptions geoJsonOpt = new GeoJsonOptions();
|
||||
geoJsonOpt.setDefaultDataProjection(fp);
|
||||
geoJsonOpt.setFeatureProjection(fp);
|
||||
GeoJson geoJson = OLFactory.createGeoJSON(geoJsonOpt);
|
||||
|
||||
Feature[] features = geoJson.readFeatures(geoJSONFeatures);
|
||||
Feature[] features = OLGeoJSONUtil.readGeoJsonFeatures(MAP_PROJECTION.EPSG_4326, geoJSONFeatures);
|
||||
|
||||
GWT.log("features: " + features);
|
||||
olMapMng.getOLMap().addLayerFeaturesAsHighlight(layerItem, features, true);
|
||||
|
|
|
@ -23,6 +23,7 @@ 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;
|
||||
|
@ -61,6 +62,7 @@ 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.ScrollPanel;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
|
@ -122,9 +124,15 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
@UiField
|
||||
DropdownButton linkCustomOverlayLayers;
|
||||
|
||||
@UiField
|
||||
DropdownButton linkCrossFilteringLayers;
|
||||
|
||||
@UiField
|
||||
HTMLPanel panelCustomOverlayLayers;
|
||||
|
||||
@UiField
|
||||
HTMLPanel panelCrossFilteringLayers;
|
||||
|
||||
@UiField
|
||||
HTMLPanel openCollectionPanel;
|
||||
|
||||
|
@ -638,21 +646,30 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
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.WARNING);
|
||||
labelGroup.setType(LabelType.INFO);
|
||||
String descr = gCustomLayerDV.getDescription() != null && !gCustomLayerDV.getDescription().isEmpty()
|
||||
? gCustomLayerDV.getDescription()
|
||||
: gCustomLayerDV.getName();
|
||||
labelGroup.setTitle(descr);
|
||||
panelCustomOverlayLayers.add(labelGroup);
|
||||
lcInner.add(labelGroup);
|
||||
if (descr.compareTo(gCustomLayerDV.getName()) != 0) {
|
||||
HTML overlayGroupDescr = new HTML();
|
||||
overlayGroupDescr.getElement().setClassName("overlay-panel-style-description");
|
||||
overlayGroupDescr.setHTML(descr);
|
||||
panelCustomOverlayLayers.add(overlayGroupDescr);
|
||||
lcInner.add(overlayGroupDescr);
|
||||
}
|
||||
List<ConfiguredLayerDV> list = gCustomLayerDV.getListCustomLayers();
|
||||
for (ConfiguredLayerDV customLayer : list) {
|
||||
|
@ -667,16 +684,61 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
layerItem.setName(customLayer.getName());
|
||||
layerItem.setTitle(customLayer.getTitle());
|
||||
layerItem.setWmsLink(customLayer.getWMS_URL());
|
||||
panelCustomOverlayLayers.add(new OverlayCustomLayerPanel(layerItem, applicationBus));
|
||||
// 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);
|
||||
}
|
||||
lcInner.add(new CrossFilteringLayerPanel(groupedLayerDV, applicationBus));
|
||||
panelCrossFilteringLayers.add(lcInner);
|
||||
}
|
||||
|
||||
//panelCrossFilteringLayers.add(new CrossFilteringLayerPanel(groupedLayerDV, applicationBus));
|
||||
|
||||
linkCrossFilteringLayers.setVisible(listGroupedLayers.size() > 0);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -65,6 +65,11 @@
|
|||
<g:HTMLPanel ui:field="panelCustomOverlayLayers" addStyleNames="overlay-panel-style">
|
||||
</g:HTMLPanel>
|
||||
</b:DropdownButton>
|
||||
<b:DropdownButton type="LINK" visible="false"
|
||||
title="Spatial filtering layers.." 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">
|
||||
|
|
|
@ -0,0 +1,320 @@
|
|||
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.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.OLGeoJSONUtil;
|
||||
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.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.Fieldset;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
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.shared.HandlerManager;
|
||||
import com.google.gwt.http.client.Request;
|
||||
import com.google.gwt.http.client.RequestBuilder;
|
||||
import com.google.gwt.http.client.RequestCallback;
|
||||
import com.google.gwt.http.client.RequestException;
|
||||
import com.google.gwt.http.client.Response;
|
||||
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.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;
|
||||
|
||||
import ol.Feature;
|
||||
|
||||
/**
|
||||
* The Class CrossFilteringLayerPanel.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* May 15, 2023
|
||||
*/
|
||||
public class CrossFilteringLayerPanel extends Composite {
|
||||
|
||||
public static String COLORSCALERANGE = "COLORSCALERANGE";
|
||||
|
||||
//@UiField
|
||||
//WellForm panelContainer;
|
||||
|
||||
@UiField
|
||||
Fieldset fieldSet;
|
||||
|
||||
private CheckBox checkbox;
|
||||
|
||||
private GeoInformationForWMSRequest geoInformation;
|
||||
|
||||
private static CrossFilteringLayerPanelUiBinder uiBinder = GWT.create(CrossFilteringLayerPanelUiBinder.class);
|
||||
|
||||
private HandlerManager applicationBus;
|
||||
|
||||
private LayerItem layerItem;
|
||||
|
||||
private LinkedHashMap<Integer, HashMap<String, SelectableItem>> mapInnestedFeatures = new LinkedHashMap<Integer, HashMap<String, SelectableItem>>();
|
||||
|
||||
private LinkedHashMap<Integer, List<? extends LayerIDV>> mapInnestedFiltering = new LinkedHashMap<Integer, List<? extends LayerIDV>>();
|
||||
|
||||
private LinkedHashMap<Integer, List<ListBox>> mapInnestedListBoxes = new LinkedHashMap<Integer, List<ListBox>>();
|
||||
|
||||
private GroupedLayersDV<? extends LayerIDV> groupedLayersDV;
|
||||
|
||||
/**
|
||||
* The Interface LayerCollectionPanelUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jan 16, 2023
|
||||
*/
|
||||
interface CrossFilteringLayerPanelUiBinder extends UiBinder<Widget, CrossFilteringLayerPanel> {
|
||||
}
|
||||
|
||||
public class SelectableItem {
|
||||
String key;
|
||||
String parentKey;
|
||||
String itemField;
|
||||
|
||||
String provenance; // layerName
|
||||
|
||||
SelectableItem() {
|
||||
|
||||
}
|
||||
|
||||
public SelectableItem(String key, String parentKey, String itemField, String provenance) {
|
||||
super();
|
||||
this.key = key;
|
||||
this.parentKey = parentKey;
|
||||
this.itemField = itemField;
|
||||
this.provenance = provenance;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String getParentKey() {
|
||||
return parentKey;
|
||||
}
|
||||
|
||||
public String getItemField() {
|
||||
return itemField;
|
||||
}
|
||||
|
||||
public String getProvenance() {
|
||||
return provenance;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public void setParentKey(String parentKey) {
|
||||
this.parentKey = parentKey;
|
||||
}
|
||||
|
||||
public void setItemField(String itemField) {
|
||||
this.itemField = itemField;
|
||||
}
|
||||
|
||||
public void setProvenance(String provenance) {
|
||||
this.provenance = provenance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("SelectableItem [key=");
|
||||
builder.append(key);
|
||||
builder.append(", parentKey=");
|
||||
builder.append(parentKey);
|
||||
builder.append(", itemField=");
|
||||
builder.append(itemField);
|
||||
builder.append(", provenance=");
|
||||
builder.append(provenance);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new overlay custom layer panel.
|
||||
*
|
||||
* @param listGroupedLayers the layer item
|
||||
* @param applicationBus the application bus
|
||||
*/
|
||||
public CrossFilteringLayerPanel(GroupedLayersDV<? extends LayerIDV> groupedLayersDV,
|
||||
HandlerManager applicationBus) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.applicationBus = applicationBus;
|
||||
this.groupedLayersDV = groupedLayersDV;
|
||||
GWT.log("Building cross-filtering for: " + groupedLayersDV);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
// filleSelectableLevel(level, mapInnestedFiltering.get(level),
|
||||
// mapInnestedListBoxes.get(level));
|
||||
|
||||
}
|
||||
|
||||
private void filleSelectableLevel(int level, List<? extends LayerIDV> layersIDV, List<ListBox> listBoxes) {
|
||||
|
||||
if (layersIDV == null)
|
||||
return;
|
||||
|
||||
HashMap<String, SelectableItem> mapSelectableFeatures = mapInnestedFeatures.get(level);
|
||||
|
||||
if (mapSelectableFeatures == null) {
|
||||
mapSelectableFeatures = new HashMap<String, SelectableItem>();
|
||||
HashMap<String, SelectableItem> mapFeatures = new HashMap<String, SelectableItem>();
|
||||
|
||||
for (LayerIDV layerIDV : layersIDV) {
|
||||
if (layerIDV instanceof CrossFilteringLayerDV) {
|
||||
CrossFilteringLayerDV crossFilteringLayer = (CrossFilteringLayerDV) layerIDV;
|
||||
String wfsURL = crossFilteringLayer.getWFS_URL();
|
||||
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, wfsURL);
|
||||
|
||||
try {
|
||||
|
||||
Request response = builder.sendRequest(null, new RequestCallback() {
|
||||
public void onError(Request request, Throwable exception) {
|
||||
// Code omitted for clarity
|
||||
}
|
||||
|
||||
public void onResponseReceived(Request request, Response response) {
|
||||
JSONString json = new JSONString(response.getText());
|
||||
JSONValue parser = JSONParser.parse(response.getText());
|
||||
Feature[] features = OLGeoJSONUtil.readGeoJsonFeatures(MAP_PROJECTION.EPSG_4326,
|
||||
response.getText());
|
||||
for (Feature feature : features) {
|
||||
String key = feature.get(crossFilteringLayer.getTable_key_field());
|
||||
String parentKey = feature.get(crossFilteringLayer.getTable_parent_key_field());
|
||||
String itemField = feature.get(crossFilteringLayer.getTable_show_field());
|
||||
|
||||
parentKey = parentKey == null ? "" : parentKey;
|
||||
|
||||
SelectableItem selectableItem = new SelectableItem(key, parentKey, itemField,
|
||||
crossFilteringLayer.getName());
|
||||
|
||||
String mapKey = "root_" + parentKey + key;
|
||||
mapFeatures.put(mapKey, selectableItem);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
} catch (RequestException e) {
|
||||
// Code omitted for clarity
|
||||
}
|
||||
}
|
||||
}
|
||||
mapSelectableFeatures.putAll(mapFeatures);
|
||||
}
|
||||
|
||||
fillListBoxLevel(level, mapSelectableFeatures, listBoxes);
|
||||
// mapInnestedFeatures.put(level, mapSelectableFeatures);
|
||||
|
||||
}
|
||||
|
||||
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();
|
||||
listBox.addItem("Select " + layerIDV.getTitle() + " ...");
|
||||
listBoxes.add(listBox);
|
||||
|
||||
controls.add(listBox);
|
||||
cg.add(cl);
|
||||
cg.add(controls);
|
||||
|
||||
fieldSet.add(cg);
|
||||
}
|
||||
|
||||
mapInnestedListBoxes.put(level, listBoxes);
|
||||
}
|
||||
|
||||
private void fillListBoxLevel(int level, HashMap<String, SelectableItem> mapSelectableFeatures,
|
||||
List<ListBox> listBoxes) {
|
||||
|
||||
if (mapSelectableFeatures == null)
|
||||
return;
|
||||
|
||||
ListBox listBox = listBoxes.get(0); // Expected one
|
||||
|
||||
for (String key : mapSelectableFeatures.keySet()) {
|
||||
SelectableItem selItem = mapSelectableFeatures.get(key);
|
||||
listBox.addItem(selItem.getItemField(), key);
|
||||
}
|
||||
|
||||
listBox.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
loadInnerLevel(level);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void loadInnerLevel(int level) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
// public void resetCurrentSearch() {
|
||||
// searchField.setText("");
|
||||
// resetSearch.setVisible(false);
|
||||
// panelResults.clear();
|
||||
// latestResult = null;
|
||||
// appManagerBus.fireEvent(new SearchPerformedEvent(profileID, null, true));
|
||||
// setSearchEnabled(false);
|
||||
// }
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
<!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>
|
||||
<b:Form ui:field="panelForm">
|
||||
<b:Fieldset ui:field="fieldSet">
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
</g:ScrollPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,55 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.util;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||
|
||||
import ol.Feature;
|
||||
import ol.OLFactory;
|
||||
import ol.format.GeoJson;
|
||||
import ol.format.GeoJsonFeatureOptions;
|
||||
import ol.format.GeoJsonOptions;
|
||||
import ol.proj.Projection;
|
||||
import ol.proj.ProjectionOptions;
|
||||
|
||||
/**
|
||||
* The Class OLGeoJSONUtil.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* May 25, 2023
|
||||
*/
|
||||
public class OLGeoJSONUtil {
|
||||
|
||||
/**
|
||||
* Builds the geo JSON.
|
||||
*
|
||||
* @param projection the projection
|
||||
* @param geoJSONString the geo JSON string
|
||||
* @return the geo json
|
||||
*/
|
||||
public static GeoJson buildGeoJSON(MAP_PROJECTION projection, String geoJSONString) {
|
||||
GeoJsonFeatureOptions fo = new GeoJsonFeatureOptions();
|
||||
ProjectionOptions projectionOptions = new ProjectionOptions();
|
||||
projectionOptions.setCode(projection.getName());
|
||||
Projection fp = new Projection(projectionOptions);
|
||||
fo.setFeatureProjection(fp);
|
||||
fo.setDataProjection(fp);
|
||||
GeoJsonOptions geoJsonOpt = new GeoJsonOptions();
|
||||
geoJsonOpt.setDefaultDataProjection(fp);
|
||||
geoJsonOpt.setFeatureProjection(fp);
|
||||
return OLFactory.createGeoJSON(geoJsonOpt);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Read geo json features.
|
||||
*
|
||||
* @param projection the projection
|
||||
* @param geoJSONString the geo JSON string
|
||||
* @return the feature[]
|
||||
*/
|
||||
public static Feature[] readGeoJsonFeatures(MAP_PROJECTION projection, String geoJSONString) {
|
||||
GeoJson geoJson = buildGeoJSON(projection, geoJSONString);
|
||||
return geoJson.readFeatures(geoJSONString);
|
||||
}
|
||||
|
||||
}
|
|
@ -22,7 +22,6 @@ import java.util.stream.StreamSupport;
|
|||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.bson.Document;
|
||||
import org.gcube.application.geoportal.common.model.configuration.Configuration;
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
import com.liferay.portal.service.UserLocalServiceUtil;
|
||||
|
||||
/**
|
||||
|
|
|
@ -836,6 +836,7 @@ RESPONSIVE
|
|||
.overlay-panel-style-description {
|
||||
border: none !important;
|
||||
white-space: pre-line;
|
||||
padding: 5px 0px;
|
||||
}
|
||||
|
||||
.overlay-panel-style > div {
|
||||
|
@ -847,3 +848,25 @@ RESPONSIVE
|
|||
}
|
||||
|
||||
|
||||
/* FILTER PANEL UI */
|
||||
.filter-panel-style {
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
max-width: 350px;
|
||||
}
|
||||
|
||||
.filter-panel-style-description {
|
||||
border: none !important;
|
||||
white-space: pre-line;
|
||||
padding: 5px 0px;
|
||||
}
|
||||
|
||||
.filter-panel-style > div {
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
padding: 10px;
|
||||
margin-bottom: 10px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue