enhancements on transect
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/gis-viewer@81228 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
e9902a3688
commit
820ce70a3c
|
@ -309,74 +309,6 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
|
|||
layersPanel.addLayerItems(layerItems, false);
|
||||
layersPanel.updateLayersOrder();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Addeb by Francesco
|
||||
* Extension of addLayerByWms, with input parameter is external layer
|
||||
* @param title
|
||||
* @param layerName
|
||||
* @param url
|
||||
* @param isExternal
|
||||
* @param isBase
|
||||
* @param displayInLayerSwitcher
|
||||
* @param styles - the first style of list must be the default style
|
||||
*/
|
||||
public void addLayerByWms(LayerType layerType, String title, String layerName, String url, boolean isExternal, boolean isBase, boolean displayInLayerSwitcher, ArrayList<String> styles) {
|
||||
LayerItem l = new LayerItem();
|
||||
l.setBaseLayer(isBase);
|
||||
l.setTitle(title);
|
||||
l.setName(layerName);
|
||||
l.setLayer(layerName);
|
||||
l.setUrl(url);
|
||||
l.setGeoserverUrl(url);
|
||||
l.setGeoserverWmsUrl(url);
|
||||
l.setExternal(isExternal);
|
||||
l.setOpacity(1d);
|
||||
l.setBuffer(2);
|
||||
|
||||
switch (layerType) {
|
||||
|
||||
//TODO IMPLEMENT THIS CASE
|
||||
case RASTER:
|
||||
|
||||
l.setHasLegend(false);
|
||||
l.setBaseLayer(true);
|
||||
l.setTrasparent(false);
|
||||
l.setClickData(false);
|
||||
|
||||
break;
|
||||
|
||||
case FEATURETYPE:
|
||||
|
||||
//CASE FEATURE TYPE
|
||||
l.setBaseLayer(false);
|
||||
l.setClickData(true);
|
||||
l.setTrasparent(true);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if(styles!=null & styles.size()>0){
|
||||
l.setHasLegend(true);
|
||||
l.setDefaultStyle(styles.get(0));
|
||||
l.setStyle(styles.get(0));
|
||||
l.setStyles(styles);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
List<LayerItem> layerItems = new ArrayList<LayerItem>();
|
||||
layerItems.add(l);
|
||||
|
||||
openLayersMap.addLayerItemByWms(l, displayInLayerSwitcher);
|
||||
layersPanel.addLayerItems(layerItems, false);
|
||||
layersPanel.updateLayersOrder();
|
||||
}
|
||||
|
||||
private void addLayersOnMap(List<LayerItem> layerItems, boolean toTop) {
|
||||
for (LayerItem layerItem : layerItems)
|
||||
|
@ -861,5 +793,111 @@ implements ToolbarHandler, DataPanelHandler, LayersPanelHandler, CqlFilterHandle
|
|||
showDataPanel();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Addeb by Francesco
|
||||
* Extension of addLayerByWms, with input parameter is external layer
|
||||
* @param title
|
||||
* @param layerName
|
||||
* @param url
|
||||
* @param isExternal
|
||||
* @param isBase
|
||||
* @param displayInLayerSwitcher
|
||||
* @param styles - the first style of list must be the default style
|
||||
* @param onTop
|
||||
*/
|
||||
public void addLayerByWms(LayerType layerType, String title, String layerName, String url, boolean isExternal, boolean isBase, boolean displayInLayerSwitcher, ArrayList<String> styles, boolean onTop) {
|
||||
LayerItem l = new LayerItem();
|
||||
l.setBaseLayer(isBase);
|
||||
l.setTitle(title);
|
||||
l.setName(layerName);
|
||||
l.setLayer(layerName);
|
||||
l.setUrl(url);
|
||||
l.setGeoserverUrl(url);
|
||||
l.setGeoserverWmsUrl(url);
|
||||
l.setExternal(isExternal);
|
||||
l.setOpacity(1d);
|
||||
l.setBuffer(2);
|
||||
|
||||
switch (layerType) {
|
||||
|
||||
//TODO IMPLEMENT THIS CASE
|
||||
case RASTER:
|
||||
|
||||
l.setHasLegend(false);
|
||||
l.setBaseLayer(true);
|
||||
l.setTrasparent(false);
|
||||
l.setClickData(false);
|
||||
|
||||
break;
|
||||
|
||||
case FEATURETYPE:
|
||||
|
||||
//CASE FEATURE TYPE
|
||||
l.setBaseLayer(false);
|
||||
l.setClickData(true);
|
||||
l.setTrasparent(true);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if(styles!=null & styles.size()>0){
|
||||
l.setHasLegend(true);
|
||||
l.setDefaultStyle(styles.get(0));
|
||||
l.setStyle(styles.get(0));
|
||||
l.setStyles(styles);
|
||||
}
|
||||
|
||||
List<LayerItem> layerItems = new ArrayList<LayerItem>();
|
||||
layerItems.add(l);
|
||||
|
||||
openLayersMap.addLayerItemByWms(l, displayInLayerSwitcher);
|
||||
layersPanel.addLayerItems(layerItems, onTop);
|
||||
layersPanel.updateLayersOrder();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Addeb by Francesco
|
||||
*
|
||||
* @param layerType
|
||||
* @param listLayerItem
|
||||
* @param onTop
|
||||
*/
|
||||
public void addLayerItemsByWms(LayerType layerType, List<LayerItem> listLayerItem, boolean onTop) {
|
||||
|
||||
for (LayerItem l : listLayerItem) {
|
||||
|
||||
switch (layerType) {
|
||||
|
||||
//TODO IMPLEMENT THIS CASE
|
||||
case RASTER:
|
||||
|
||||
l.setHasLegend(false);
|
||||
l.setBaseLayer(true);
|
||||
l.setTrasparent(false);
|
||||
l.setClickData(false);
|
||||
|
||||
break;
|
||||
|
||||
case FEATURETYPE:
|
||||
|
||||
//CASE FEATURE TYPE
|
||||
l.setBaseLayer(false);
|
||||
l.setClickData(true);
|
||||
l.setTrasparent(true);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
openLayersMap.addLayerItemByWms(l, false);
|
||||
}
|
||||
|
||||
layersPanel.addLayerItems(listLayerItem, onTop);
|
||||
layersPanel.updateLayersOrder();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
import org.gcube.portlets.user.gisviewer.client.commons.beans.DataResult;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItemsResult;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.Property;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.WfsTable;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
|
@ -29,6 +30,17 @@ public interface GisViewerService extends RemoteService {
|
|||
|
||||
List<WfsTable> getDataResult(List<LayerItem> layerItems, String bbox);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Added by Francesco M. 10/09/2013
|
||||
* @param geoserverUrl
|
||||
* @param layer
|
||||
* @return
|
||||
*/
|
||||
List<Property> getListProperty(String geoserverUrl, LayerItem layer);
|
||||
|
||||
|
||||
// LayerItemsResult getLayersInfoByLayerConfigurations(List<LayerConfiguration> layerConfigurations);
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
import org.gcube.portlets.user.gisviewer.client.commons.beans.DataResult;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItemsResult;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.Property;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.WfsTable;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
@ -27,6 +28,9 @@ public interface GisViewerServiceAsync {
|
|||
|
||||
public void getDataResult(List<LayerItem> layerItems, String bbox, AsyncCallback<List<WfsTable>> asyncCallback);
|
||||
|
||||
void getListProperty(String geoserverUrl, LayerItem layer,
|
||||
AsyncCallback<List<Property>> callback);
|
||||
|
||||
// public void getLayersInfoByLayerConfigurations(List<LayerConfiguration> layerConfigurations, AsyncCallback<LayerItemsResult> asyncCallback);
|
||||
|
||||
}
|
||||
|
|
|
@ -70,4 +70,23 @@ public class Property implements IsSerializable, Cloneable {
|
|||
public void setMinOccours(int minOccours) {
|
||||
this.minOccours = minOccours;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Property [name=");
|
||||
builder.append(name);
|
||||
builder.append(", type=");
|
||||
builder.append(type);
|
||||
builder.append(", nillable=");
|
||||
builder.append(nillable);
|
||||
builder.append(", maxOccours=");
|
||||
builder.append(maxOccours);
|
||||
builder.append(", minOccours=");
|
||||
builder.append(minOccours);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package org.gcube.portlets.user.gisviewer.client.layerspanel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.gisviewer.client.Constants;
|
||||
import org.gcube.portlets.user.gisviewer.client.GisViewer;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.LayerItem;
|
||||
import org.gcube.portlets.user.gisviewer.client.commons.beans.Property;
|
||||
import org.gcube.portlets.user.gisviewer.client.resources.Images;
|
||||
|
||||
import com.extjs.gxt.ui.client.event.BaseEvent;
|
||||
|
@ -23,6 +26,7 @@ import com.extjs.gxt.ui.client.widget.menu.Menu;
|
|||
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||
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.dom.client.MouseOutEvent;
|
||||
|
@ -30,6 +34,7 @@ import com.google.gwt.event.dom.client.MouseOutHandler;
|
|||
import com.google.gwt.event.dom.client.MouseOverEvent;
|
||||
import com.google.gwt.event.dom.client.MouseOverHandler;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
|
@ -93,6 +98,10 @@ public class LayerToolsPanel extends VerticalPanel {
|
|||
|
||||
private boolean cqlTipInserted=false;
|
||||
private boolean transectTipInserted=false;
|
||||
|
||||
// TOOLBAR TRANSECT, FILTER AND EXPORT
|
||||
private ToolBar toolBar1 = new ToolBar();
|
||||
// private Button btnTransect = new Button("");
|
||||
|
||||
|
||||
|
||||
|
@ -101,6 +110,8 @@ public class LayerToolsPanel extends VerticalPanel {
|
|||
super();
|
||||
this.layerItem = layerItem;
|
||||
this.layersPanelHandler = layersPanelHandler;
|
||||
|
||||
// this.btnTransect.setVisible(false);
|
||||
setTransectInfo();
|
||||
|
||||
this.setTableWidth("100%");
|
||||
|
@ -130,20 +141,9 @@ public class LayerToolsPanel extends VerticalPanel {
|
|||
|
||||
this.add(cp);
|
||||
}
|
||||
|
||||
private void createTools() {
|
||||
tools = new VerticalPanel();
|
||||
tools.setStyleAttribute("padding-left", TOOLS_PADDING);
|
||||
//tools.setStyleAttribute("background-color", "#E5E5E5");
|
||||
tools.setStyleName("layersPanel2");
|
||||
tools.setHeight(LAYER_TOOLS_PANEL_HEIGHT);
|
||||
|
||||
// TOOLBAR TRANSECT, FILTER AND EXPORT
|
||||
ToolBar toolBar1 = new ToolBar();
|
||||
toolBar1.setStyleName("myToolbar"); // TODO define style
|
||||
toolBar1.add(new SizedLabel("General", 10));
|
||||
toolBar1.add(new SeparatorToolItem());
|
||||
|
||||
|
||||
private void activeTransect(){
|
||||
|
||||
if ((tableTransect!=null && fieldTransect!=null)) {
|
||||
// transect button
|
||||
Button btnTransect = new Button("", Images.iconTransect(), new SelectionListener<ButtonEvent>(){
|
||||
|
@ -155,9 +155,44 @@ public class LayerToolsPanel extends VerticalPanel {
|
|||
});
|
||||
btnTransect.setToolTip("Generate a Transect function");
|
||||
//btnTransect.setEnabled((tableTransect!=null && fieldTransect!=null));
|
||||
// toolBar1.layout();
|
||||
toolBar1.add(btnTransect);
|
||||
tools.layout(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void createTools() {
|
||||
tools = new VerticalPanel();
|
||||
tools.setStyleAttribute("padding-left", TOOLS_PADDING);
|
||||
//tools.setStyleAttribute("background-color", "#E5E5E5");
|
||||
tools.setStyleName("layersPanel2");
|
||||
tools.setHeight(LAYER_TOOLS_PANEL_HEIGHT);
|
||||
|
||||
// TOOLBAR TRANSECT, FILTER AND EXPORT
|
||||
toolBar1.setStyleName("myToolbar"); // TODO define style
|
||||
toolBar1.add(new SizedLabel("General", 10));
|
||||
toolBar1.add(new SeparatorToolItem());
|
||||
// this.toolBar1.add(btnTransect);
|
||||
|
||||
activeTransect();
|
||||
|
||||
|
||||
// if ((tableTransect!=null && fieldTransect!=null)) {
|
||||
// // transect button
|
||||
// Button btnTransect = new Button("", Images.iconTransect(), new SelectionListener<ButtonEvent>(){
|
||||
// @Override
|
||||
// public void componentSelected(ButtonEvent ce) {
|
||||
// setTransectTip(true);
|
||||
// layersPanelHandler.activateTransect(layerItem, tableTransect, fieldTransect);
|
||||
// }
|
||||
// });
|
||||
// btnTransect.setToolTip("Generate a Transect function");
|
||||
// //btnTransect.setEnabled((tableTransect!=null && fieldTransect!=null));
|
||||
// toolBar1.add(btnTransect);
|
||||
// }
|
||||
|
||||
// filter button
|
||||
Button btnFilter = new Button("", Images.iconFilter(), new SelectionListener<ButtonEvent>(){
|
||||
@Override
|
||||
|
@ -466,6 +501,49 @@ public class LayerToolsPanel extends VerticalPanel {
|
|||
foundDefaultStyle = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GisViewer.service.getListProperty(layerItem.getGeoserverUrl(), layerItem, new AsyncCallback<List<Property>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
GWT.log("error on get list property", caught);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<Property> result) {
|
||||
layerItem.setProperties(result);
|
||||
|
||||
|
||||
System.out.println("property "+layerItem.getProperties());
|
||||
if(result!=null && result.size()>0){
|
||||
|
||||
boolean cointainsPropertyTransect = false;
|
||||
|
||||
if (layerItem.containsProperty("maxspeciescountinacell")) {
|
||||
fieldTransect = "maxspeciescountinacell";
|
||||
tableTransect = layerItem.getName();
|
||||
cointainsPropertyTransect = true;
|
||||
} else if (layerItem.containsProperty("probability")) {
|
||||
|
||||
System.out.println("layerItem.containsProperty ");
|
||||
|
||||
fieldTransect = "probability";
|
||||
tableTransect = layerItem.getName();
|
||||
cointainsPropertyTransect = true;
|
||||
}
|
||||
|
||||
System.out.println("cointainsPropertyTransect "+cointainsPropertyTransect);
|
||||
|
||||
if(cointainsPropertyTransect)
|
||||
activeTransect();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//COMMENTED BY FRANCESCO M.
|
||||
|
|
|
@ -573,4 +573,14 @@ public abstract class GisViewerServiceImpl extends RemoteServiceServlet implemen
|
|||
List<WfsTable> result = FeatureParser.getDataResults(layerItems, bbox);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Property> getListProperty(String geoserverUrl, LayerItem layer){
|
||||
System.out.println("getListProperty");
|
||||
// set layer properties info
|
||||
return FeatureTypeParser.getProperties(geoserverUrl, layer.getLayer());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -16,11 +16,16 @@ import org.w3c.dom.NodeList;
|
|||
import org.xml.sax.SAXException;
|
||||
|
||||
public class FeatureTypeParser {
|
||||
|
||||
|
||||
public static List<Property> getProperties(String geoserverURL,
|
||||
String layerName) {
|
||||
String wfsRequestURL = geoserverURL
|
||||
+ "/wfs?service=wfs&version=1.1.0&request=DescribeFeatureType&typeName="
|
||||
+ layerName;
|
||||
|
||||
// System.out.println("wfsRequestURL "+wfsRequestURL);
|
||||
|
||||
List<Property> properties = new ArrayList<Property>();
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue