2232: Gis Viewer enhacements: z-axis integration

Task-Url: https://support.d4science.org/issues/2232

Added units to z-axis

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/gis-viewer@124101 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-02-11 14:53:02 +00:00
parent 3d3c57bc94
commit 44f9097d88
6 changed files with 166 additions and 33 deletions

View File

@ -19,6 +19,7 @@ import org.gcube.portlets.user.gisviewer.client.commons.beans.MapViewInfo;
import org.gcube.portlets.user.gisviewer.client.commons.beans.TransectParameters;
import org.gcube.portlets.user.gisviewer.client.commons.beans.WebFeatureTable;
import org.gcube.portlets.user.gisviewer.client.commons.beans.WmsRequest;
import org.gcube.portlets.user.gisviewer.client.commons.beans.ZAxis;
import org.gcube.portlets.user.gisviewer.client.commons.utils.ClickDataInfo;
import org.gcube.portlets.user.gisviewer.client.commons.utils.NewBrowserWindow;
import org.gcube.portlets.user.gisviewer.client.commons.utils.URLMakers;
@ -640,7 +641,7 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
}
};
dialog.setHeading(new SizedLabel("Legend for: "+layerItem.getName(), 20,30).getText());
dialog.setHeading(new SizedLabel("Legend for: "+layerItem.getName(), 12,30).getText());
dialog.setTitle("Legend for: "+layerItem.getName());
dialog.setBodyStyleName("pad-text");
dialog.setScrollMode(Scroll.AUTO);
@ -1228,7 +1229,7 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
* @param isNcWms the is nc wms
* @param UUID the uuid
*/
private void addLayerByWms(LayerType layerType, String layerTitle, String layerName, String wmsServiceBaseUrl, boolean isExternal, boolean isBase, boolean displayInLayerSwitcher, ArrayList<String> styles, String serverWmsRequest, boolean onTop, HashMap<String, String> wmsNotStandardParams, boolean isNcWms, String UUID, List<Double> zAxis) {
private void addLayerByWms(LayerType layerType, String layerTitle, String layerName, String wmsServiceBaseUrl, boolean isExternal, boolean isBase, boolean displayInLayerSwitcher, ArrayList<String> styles, String serverWmsRequest, boolean onTop, HashMap<String, String> wmsNotStandardParams, boolean isNcWms, String UUID, ZAxis zAxis) {
// GWT.log("Add addLayerByWms 1");
LayerItem l = new LayerItem();
@ -1246,7 +1247,7 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
l.setWmsNotStandardParams(wmsNotStandardParams);
l.setNcWms(isNcWms);
l.setUUID(UUID);
l.setListZAxis(zAxis);
l.setZAxis(zAxis);
switch (layerType) {

View File

@ -29,7 +29,7 @@ public class GisViewerWmsValidParameters implements Serializable{
private HashMap<String, String> mapWMSNoStandard;
private List<String> styles;
private boolean isNcWMS;
private List<Double> zAxis;
private ZAxis zAxis;
/**
* Instantiates a new gis viewer wms valid parameters.
@ -52,7 +52,7 @@ public class GisViewerWmsValidParameters implements Serializable{
* @param isNcWms the is nc wms
* @param zAxis the z axis
*/
public GisViewerWmsValidParameters(String baseWmsServiceHost, String wmsRequest, String layerName, String versionWms, String crs, HashMap<String, String> mapWmsNotStandard, List<String> styles, boolean isNcWms, List<Double> zAxis) {
public GisViewerWmsValidParameters(String baseWmsServiceHost, String wmsRequest, String layerName, String versionWms, String crs, HashMap<String, String> mapWmsNotStandard, List<String> styles, boolean isNcWms, ZAxis zAxis) {
this.baseWmsServiceHost = baseWmsServiceHost;
this.wmsRequest = wmsRequest;
this.layerName = layerName;
@ -64,24 +64,18 @@ public class GisViewerWmsValidParameters implements Serializable{
this.zAxis = zAxis;
}
/**
* Gets the z axis.
*
* @return the zAxis
*/
public List<Double> getZAxis() {
public ZAxis getZAxis() {
return zAxis;
}
/**
* Sets the z axis.
*
* @param zAxis the zAxis to set
*/
public void setZAxis(List<Double> zAxis) {
public void setZAxis(ZAxis zAxis) {
this.zAxis = zAxis;
}

View File

@ -56,7 +56,7 @@ public class LayerItem implements IsSerializable, Cloneable {
private boolean cqlFilterAvailable = false;
private String UUID;
private List<Double> zAxisList;
private ZAxis zAxis;
private Double zAxisSelected;
/**
@ -601,8 +601,8 @@ public LayerItem clone() {
*
* @param zAxis the new list z axis
*/
public void setListZAxis(List<Double> zAxis) {
this.zAxisList = zAxis;
public void setZAxis(ZAxis zAxis) {
this.zAxis = zAxis;
}
/**
@ -610,9 +610,9 @@ public LayerItem clone() {
*
* @return the zAxis
*/
public List<Double> getListZAxis() {
public ZAxis getZAxis() {
return zAxisList;
return zAxis;
}
// added by ceras
@ -929,7 +929,7 @@ public LayerItem clone() {
builder.append(", UUID=");
builder.append(UUID);
builder.append(", zAxis=");
builder.append(zAxisList);
builder.append(zAxis);
builder.append("]");
return builder.toString();
}

View File

@ -0,0 +1,124 @@
/**
*
*/
package org.gcube.portlets.user.gisviewer.client.commons.beans;
import java.util.List;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* The Class LayerZAxis.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 10, 2016
*/
public class ZAxis implements IsSerializable{
private String units;
private boolean positive;
private List<Double> values;
/**
* Instantiates a new layer z axis.
*/
public ZAxis() {
}
/**
* Instantiates a new layer z axis.
*
* @param units the units
* @param positive the positive
* @param values the values
*/
public ZAxis(String units, boolean positive, List<Double> values) {
this.units = units;
this.positive = positive;
this.values = values;
}
/**
* Gets the units.
*
* @return the units
*/
public String getUnits() {
return units;
}
/**
* Checks if is positive.
*
* @return the positive
*/
public boolean isPositive() {
return positive;
}
/**
* Gets the values.
*
* @return the values
*/
public List<Double> getValues() {
return values;
}
/**
* Sets the units.
*
* @param units the units to set
*/
public void setUnits(String units) {
this.units = units;
}
/**
* Sets the positive.
*
* @param positive the positive to set
*/
public void setPositive(boolean positive) {
this.positive = positive;
}
/**
* Sets the values.
*
* @param values the values to set
*/
public void setValues(List<Double> values) {
this.values = values;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ZAxis [units=");
builder.append(units);
builder.append(", positive=");
builder.append(positive);
builder.append(", values=");
builder.append(values);
builder.append("]");
return builder.toString();
}
}

View File

@ -93,7 +93,7 @@ public class LayerToolsPanel extends VerticalPanel {
// TOOLBAR TRANSECT, FILTER AND EXPORT
private ToolBar toolBar1 = new ToolBar();
private SimpleComboBox<Double> scbZAxis;
private SimpleComboBox<String> scbZAxis;
/**
* Instantiates a new layer tools panel.
@ -304,7 +304,7 @@ public class LayerToolsPanel extends VerticalPanel {
// legend list
if (layerItem.getStyles().size()==0 || layerItem.getStyles().size()==1) {
SizedLabel sizedLabel = new SizedLabel(defaultStyle, 18, 18);
SizedLabel sizedLabel = new SizedLabel(defaultStyle, 12, 18);
sizedLabel.setTitle(defaultStyle);
toolbar3.add(sizedLabel);
}else {
@ -362,20 +362,32 @@ public class LayerToolsPanel extends VerticalPanel {
* Creates the z axis combo.
*/
private void createZAxisCombo() {
if(layerItem.getListZAxis()!=null && layerItem.getListZAxis().size()>0){
scbZAxis = new SimpleComboBox<Double>();
if(layerItem.getZAxis()!=null && layerItem.getZAxis().getValues()!=null && layerItem.getZAxis().getValues().size()>0){
scbZAxis = new SimpleComboBox<String>();
scbZAxis.setEmptyText("Choose Z-Value");
scbZAxis.setTypeAhead(true);
scbZAxis.setEditable(false);
scbZAxis.setTriggerAction(TriggerAction.ALL);
scbZAxis.add(layerItem.getListZAxis());
scbZAxis.setSimpleValue(layerItem.getListZAxis().get(0));
scbZAxis.addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<Double>>() {
String unit = layerItem.getZAxis().getUnits();
for (Double value : layerItem.getZAxis().getValues()) {
String key = value+unit;
scbZAxis.setData(key, value);
scbZAxis.add(key);
}
scbZAxis.setSimpleValue(layerItem.getZAxis().getValues().get(0)+unit);
scbZAxis.addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<String>>() {
@Override
public void selectionChanged(SelectionChangedEvent<SimpleComboValue<Double>> se) {
layerItem.setZAxisSelected(se.getSelectedItem().getValue());
layersPanelHandler.zAxisValueChanged(layerItem, se.getSelectedItem().getValue());
public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se) {
String key = se.getSelectedItem().getValue();
Double value = (Double) scbZAxis.getData(key);
GWT.log("Selected z-axis key: "+key + ", value: "+value);
layerItem.setZAxisSelected(value);
layersPanelHandler.zAxisValueChanged(layerItem, value);
}
});
}

View File

@ -27,6 +27,7 @@ import org.gcube.portlets.user.gisviewer.client.commons.beans.Property;
import org.gcube.portlets.user.gisviewer.client.commons.beans.TransectParameters;
import org.gcube.portlets.user.gisviewer.client.commons.beans.WebFeatureTable;
import org.gcube.portlets.user.gisviewer.client.commons.beans.WmsRequest;
import org.gcube.portlets.user.gisviewer.client.commons.beans.ZAxis;
import org.gcube.portlets.user.gisviewer.client.commons.utils.URLMakers;
import org.gcube.portlets.user.gisviewer.server.datafeature.ClickDataParser;
import org.gcube.portlets.user.gisviewer.server.datafeature.FeatureParser;
@ -140,13 +141,14 @@ public abstract class GisViewerServiceImpl extends RemoteServiceServlet implemen
}
//
GeoNcWMSMetadataUtility geoGS = new GeoNcWMSMetadataUtility(validWMSRequest, 4000);
//STYLES
LayerStyles layerStyle = geoGS.loadStyles();
LayerZAxis layerZAxis = geoGS.loadZAxis();
List<Double> zAxis = layerZAxis==null?null:layerZAxis.getValues();
// mapNcWmsStyles == null?new HashMap<String, String>(1):mapNcWmsStyles;
Map<String,String> mapNcWmsStyles = layerStyle.getMapNcWmsStyles()==null?new HashMap<String, String>(1):layerStyle.getMapNcWmsStyles();
mapWmsNotStandard.putAll(mapNcWmsStyles);
//ZAxis
LayerZAxis layerZAxis = geoGS.loadZAxis();
ZAxis zAxis = layerZAxis!=null?new ZAxis(layerZAxis.getUnits(), layerZAxis.isPositive(), layerZAxis.getValues()):null;
return new GisViewerWmsValidParameters(wmsServiceHost, validWMSRequest, layerName, versionWms, crs, mapWmsNotStandard, layerStyle.getGeoStyles(), layerStyle.isNcWms(), zAxis);
}
catch (Exception e) {