fixes: #21946#note-5, #21991#note-3
This commit is contained in:
parent
decdb3258e
commit
b236cc3ebb
|
@ -158,13 +158,24 @@ public class LayerManager {
|
||||||
|
|
||||||
ArrayList<LayerObject> layerVisibility = new ArrayList<LayerObject>(collLO.size());
|
ArrayList<LayerObject> layerVisibility = new ArrayList<LayerObject>(collLO.size());
|
||||||
layerVisibility.addAll(collLO);
|
layerVisibility.addAll(collLO);
|
||||||
//Managing layer visibility
|
//Managing layer visibility. If a layer is not visible has to be not queryable
|
||||||
for (LayerObject layerObject : layerVisibility) {
|
for (LayerObject layerObject : layerVisibility) {
|
||||||
boolean isLayerVisible = olMap.isLayerVisible(layerObject.getLayerItem().getName());
|
String layerName = layerObject.getLayerItem().getName();
|
||||||
|
boolean isLayerVisible = olMap.isLayerVisible(layerName);
|
||||||
if(!isLayerVisible) {
|
if(!isLayerVisible) {
|
||||||
GWT.log("From querying removing layername: "+layerObject.getLayerItem().getName() + ", it is not visible");
|
GWT.log("From querying removing layername: "+layerName + ", it is not visible");
|
||||||
listLO.remove(layerObject);
|
listLO.remove(layerObject);
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// ExtentWrapped layerExtent = olMap.getSourceExtentForLayer(layerName);
|
||||||
|
// if(layerExtent!=null) {
|
||||||
|
// ExtentWrapped centerQueryPoint = new ExtentWrapped(minX, minY, maxX,maxY);
|
||||||
|
//
|
||||||
|
// boolean contains = layerExtent.containsExtent(centerQueryPoint);
|
||||||
|
// GWT.log("layer: "+layerName + " contains the queried BBOX: "+contains);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,7 +448,7 @@ public class LayerManager {
|
||||||
if (dlo == null) {
|
if (dlo == null) {
|
||||||
mapDetailLayerObjects.put(key, lo);
|
mapDetailLayerObjects.put(key, lo);
|
||||||
olMap.addWMSDetailLayer(layerItem);
|
olMap.addWMSDetailLayer(layerItem);
|
||||||
overlayLayerManager.addLayerItem(layerItem);
|
overlayLayerManager.addLayerItem(lo);
|
||||||
//overlayLayerManager.show();
|
//overlayLayerManager.show();
|
||||||
} else {
|
} else {
|
||||||
GWT.log("Skipping detail layer " + key + " already added to Map");
|
GWT.log("Skipping detail layer " + key + " already added to Map");
|
||||||
|
@ -558,7 +569,13 @@ public class LayerManager {
|
||||||
|| layerSourceName.compareToIgnoreCase(baseLayerFromISProfile.getName()) == 0) {
|
|| layerSourceName.compareToIgnoreCase(baseLayerFromISProfile.getName()) == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<FeatureRow> features = geoNaSpatialQueryResult.getFeatures();
|
||||||
|
|
||||||
|
if (features == null || features.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
String nomeConcessione = lo.getSourceConcessione().getNome();
|
String nomeConcessione = lo.getSourceConcessione().getNome();
|
||||||
if (prevConcessioneName.compareTo(nomeConcessione) != 0) {
|
if (prevConcessioneName.compareTo(nomeConcessione) != 0) {
|
||||||
String concessioneIntro = StringUtil.ellipsize(lo.getSourceConcessione().getNome(), 40);
|
String concessioneIntro = StringUtil.ellipsize(lo.getSourceConcessione().getNome(), 40);
|
||||||
|
@ -582,8 +599,8 @@ public class LayerManager {
|
||||||
layerLabel.getElement().getStyle().setMarginBottom(5, Unit.PX);
|
layerLabel.getElement().getStyle().setMarginBottom(5, Unit.PX);
|
||||||
flowPanel.add(layerLabel);
|
flowPanel.add(layerLabel);
|
||||||
|
|
||||||
List<FeatureRow> features = geoNaSpatialQueryResult.getFeatures();
|
|
||||||
|
|
||||||
|
/*
|
||||||
if (features == null || features.isEmpty()) {
|
if (features == null || features.isEmpty()) {
|
||||||
FlexTable flex = new FlexTable();
|
FlexTable flex = new FlexTable();
|
||||||
flex.setCellPadding(1);
|
flex.setCellPadding(1);
|
||||||
|
@ -593,7 +610,7 @@ public class LayerManager {
|
||||||
flowPanel.add(flex);
|
flowPanel.add(flex);
|
||||||
continue;
|
continue;
|
||||||
// olMap.showPopup(vpPanel.toString(), onFailureCenterTo);
|
// olMap.showPopup(vpPanel.toString(), onFailureCenterTo);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
GWT.log("Displaying " + features.size() + " features");
|
GWT.log("Displaying " + features.size() + " features");
|
||||||
FlexTable intFlex = new FlexTable();
|
FlexTable intFlex = new FlexTable();
|
||||||
|
|
|
@ -3,14 +3,14 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd.DragDropLayer;
|
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.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
|
|
||||||
public class OverlayLayerManager {
|
public class OverlayLayerManager {
|
||||||
|
|
||||||
private ArrayList<LayerItem> layers = new ArrayList<LayerItem>();
|
private ArrayList<LayerObject> layers = new ArrayList<LayerObject>();
|
||||||
private FlowPanel fp = new FlowPanel();
|
private FlowPanel fp = new FlowPanel();
|
||||||
private HandlerManager applicationBus;
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@ public class OverlayLayerManager {
|
||||||
//fp.addStyleName("layers-panel");
|
//fp.addStyleName("layers-panel");
|
||||||
}
|
}
|
||||||
|
|
||||||
void addLayerItem(LayerItem layer) {
|
void addLayerItem(LayerObject lo) {
|
||||||
DragDropLayer dandd = new DragDropLayer(applicationBus, layer, true, true);
|
DragDropLayer dandd = new DragDropLayer(applicationBus, lo, true, true);
|
||||||
layers.add(layer);
|
layers.add(lo);
|
||||||
fp.add(dandd);
|
fp.add(dandd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.dom.client.Style.Visibility;
|
import com.google.gwt.dom.client.Style.Visibility;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.json.client.JSONArray;
|
||||||
import com.google.gwt.json.client.JSONObject;
|
import com.google.gwt.json.client.JSONObject;
|
||||||
import com.google.gwt.json.client.JSONParser;
|
import com.google.gwt.json.client.JSONParser;
|
||||||
import com.google.gwt.json.client.JSONValue;
|
import com.google.gwt.json.client.JSONValue;
|
||||||
|
@ -419,6 +420,7 @@ public abstract class OpenLayerOSM {
|
||||||
}
|
}
|
||||||
|
|
||||||
Image wmsLayer = new Image(layerOptions);
|
Image wmsLayer = new Image(layerOptions);
|
||||||
|
wmsLayer.setZIndex(wmsDetailsLayerMap.size() + 1);
|
||||||
map.addLayer(wmsLayer);
|
map.addLayer(wmsLayer);
|
||||||
wmsDetailsLayerMap.put(key, wmsLayer);
|
wmsDetailsLayerMap.put(key, wmsLayer);
|
||||||
|
|
||||||
|
@ -686,24 +688,72 @@ public abstract class OpenLayerOSM {
|
||||||
Image layerImage = (Image) layer;
|
Image layerImage = (Image) layer;
|
||||||
|
|
||||||
Source source = layerImage.getSource();
|
Source source = layerImage.getSource();
|
||||||
// GWT.log("source: "+source.toString());
|
|
||||||
// GeoportalDataViewerConstants.printJsObj(source);
|
// GeoportalDataViewerConstants.printJsObj(source);
|
||||||
String sorceRootObj = GeoportalDataViewerConstants.toJsonObj(source);
|
String sorceRootObj = GeoportalDataViewerConstants.toJsonObj(source);
|
||||||
JSONValue jsonObj = JSONParser.parseStrict(sorceRootObj);
|
JSONValue jsonObj = JSONParser.parseStrict(sorceRootObj);
|
||||||
// GWT.log("jsonObj: " + jsonObj.toString());
|
// GWT.log("jsonObj: " + jsonObj.toString());
|
||||||
JSONObject jsonSourceObj = (JSONObject) jsonObj;
|
JSONObject jsonSourceObj = (JSONObject) jsonObj;
|
||||||
|
GeoportalDataViewerConstants.printJsObj(jsonSourceObj);
|
||||||
|
|
||||||
JSONObject jsonParamsObj = (JSONObject) jsonSourceObj.get("params_");
|
JSONObject jsonParamsObj = (JSONObject) jsonSourceObj.get("params_");
|
||||||
// GWT.log("jsonParamsObj is: "+jsonParamsObj);
|
// GWT.log("jsonParamsObj is: "+jsonParamsObj);
|
||||||
JSONValue jsonLayers = jsonParamsObj.get("LAYERS");
|
JSONValue jsonLayers = jsonParamsObj.get("LAYERS");
|
||||||
GWT.log("theLayerName name is: " + jsonLayers);
|
GWT.log("theLayerName name is: " + jsonLayers);
|
||||||
layerNames.add(jsonLayers.toString());
|
layerNames.add(jsonLayers.toString());
|
||||||
|
|
||||||
|
JSONObject imagesParamsObj = (JSONObject) jsonSourceObj.get("image_");
|
||||||
|
JSONArray extent = (JSONArray) imagesParamsObj.get("extent");
|
||||||
|
GWT.log("extentLayer: " + extent.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return layerNames;
|
return layerNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the source extent for layer.
|
||||||
|
*
|
||||||
|
* @param layerName the layer name
|
||||||
|
* @return the source extent for layer
|
||||||
|
*/
|
||||||
|
public ExtentWrapped getSourceExtentForLayer(String layerName) {
|
||||||
|
Collection<Base> layers = map.getLayers();
|
||||||
|
if (layers != null) {
|
||||||
|
Base[] layersArr = layers.getArray();
|
||||||
|
for (int i = 0; i < layersArr.length; i++) {
|
||||||
|
Base layer = layersArr[i];
|
||||||
|
if (layer instanceof Image) {
|
||||||
|
Image layerImage = (Image) layer;
|
||||||
|
|
||||||
|
Source source = layerImage.getSource();
|
||||||
|
// GeoportalDataViewerConstants.printJsObj(source);
|
||||||
|
String sorceRootObj = GeoportalDataViewerConstants.toJsonObj(source);
|
||||||
|
JSONValue jsonObj = JSONParser.parseStrict(sorceRootObj);
|
||||||
|
// GWT.log("jsonObj: " + jsonObj.toString());
|
||||||
|
JSONObject jsonSourceObj = (JSONObject) jsonObj;
|
||||||
|
// GeoportalDataViewerConstants.printJsObj(jsonSourceObj);
|
||||||
|
|
||||||
|
JSONObject jsonParamsObj = (JSONObject) jsonSourceObj.get("params_");
|
||||||
|
// GWT.log("jsonParamsObj is: "+jsonParamsObj);
|
||||||
|
JSONValue jsonLayers = jsonParamsObj.get("LAYERS");
|
||||||
|
|
||||||
|
String layerNameIntoMap = jsonLayers.toString().replaceAll("\"", "");
|
||||||
|
if (layerName.compareTo(layerNameIntoMap) == 0) {
|
||||||
|
JSONObject imagesParamsObj = (JSONObject) jsonSourceObj.get("image_");
|
||||||
|
JSONArray extent = (JSONArray) imagesParamsObj.get("extent");
|
||||||
|
// GWT.log("extentLayer: "+extent.toString());
|
||||||
|
double minX = Double.parseDouble(extent.get(0).toString());
|
||||||
|
double minY = Double.parseDouble(extent.get(1).toString());
|
||||||
|
double maxX = Double.parseDouble(extent.get(2).toString());
|
||||||
|
double maxY = Double.parseDouble(extent.get(3).toString());
|
||||||
|
return new ExtentWrapped(minX, minY, maxX, maxY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the wms details layer map.
|
* Gets the wms details layer map.
|
||||||
*
|
*
|
||||||
|
@ -722,7 +772,6 @@ public abstract class OpenLayerOSM {
|
||||||
return wmsLayerMap;
|
return wmsLayerMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is layer visible.
|
* Checks if is layer visible.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
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.DO_LAYER_ACTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
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.LayerItem;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.CheckBox;
|
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||||
|
@ -34,25 +36,32 @@ public class DragDropLayer extends FlowPanel {
|
||||||
private static DragDropLayer dragging = null;
|
private static DragDropLayer dragging = null;
|
||||||
private static DragDropLayer draggingTarget = null;
|
private static DragDropLayer draggingTarget = null;
|
||||||
final boolean droppable;
|
final boolean droppable;
|
||||||
private Label label;
|
private Label labelLayerName;
|
||||||
private CheckBox checkBoxVisibility = new CheckBox();
|
private CheckBox checkBoxVisibility = new CheckBox();
|
||||||
private Button draggableButton = new Button();
|
private Button draggableButton = new Button();
|
||||||
private HandlerManager applicationBus;
|
private HandlerManager applicationBus;
|
||||||
|
private LayerObject layerObject;
|
||||||
private LayerItem layerItem;
|
private LayerItem layerItem;
|
||||||
|
|
||||||
public DragDropLayer(HandlerManager applicationBus, LayerItem layer, boolean draggable, boolean droppable) {
|
public DragDropLayer(HandlerManager applicationBus, LayerObject layerObject, boolean draggable, boolean droppable) {
|
||||||
this.applicationBus = applicationBus;
|
this.applicationBus = applicationBus;
|
||||||
this.layerItem = layer;
|
this.layerObject = layerObject;
|
||||||
|
this.layerItem = layerObject.getLayerItem();
|
||||||
String layerName = StringUtil.fullNameToLayerName(layer.getName(), ":");
|
|
||||||
|
String layerName = StringUtil.fullNameToLayerName(layerItem.getName(), ":");
|
||||||
this.label = new Label(layerName);
|
|
||||||
this.label.setTitle(layer.getName());
|
this.labelLayerName = new Label(layerName);
|
||||||
this.label.setType(LabelType.INFO);
|
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().setMarginTop(5, Unit.PX);
|
||||||
getElement().getStyle().setMarginBottom(10, Unit.PX);
|
getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||||
setWidth("350px");
|
setWidth("400px");
|
||||||
|
|
||||||
if (draggable) {
|
if (draggable) {
|
||||||
initDrag();
|
initDrag();
|
||||||
|
@ -68,18 +77,19 @@ public class DragDropLayer extends FlowPanel {
|
||||||
draggableButton.addStyleName("draggable");
|
draggableButton.addStyleName("draggable");
|
||||||
}
|
}
|
||||||
|
|
||||||
RangeSlider rs = new RangeSlider(applicationBus, layer);
|
RangeSlider rs = new RangeSlider(applicationBus, layerItem);
|
||||||
rs.setWidth("250px");
|
rs.setWidth("300px");
|
||||||
FlexTable ft = new FlexTable();
|
FlexTable ft = new FlexTable();
|
||||||
ft.setWidget(0, 0, draggableButton);
|
ft.setWidget(0, 0, draggableButton);
|
||||||
draggableButton.setTitle("Drag me up or down to change my position on the Map");
|
draggableButton.setTitle("Drag and Drop me up or down to change my position on the Map");
|
||||||
checkBoxVisibility.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
checkBoxVisibility.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||||
checkBoxVisibility.setValue(true);
|
checkBoxVisibility.setValue(true);
|
||||||
|
|
||||||
label.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
//labelLayerName.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||||
ft.setWidget(0, 1, checkBoxVisibility);
|
ft.setWidget(0, 1, checkBoxVisibility);
|
||||||
ft.setWidget(0, 2, label);
|
ft.setWidget(0, 2, labelConcessione);
|
||||||
ft.setWidget(1, 2, new SimplePanel(rs));
|
ft.setWidget(1, 2, labelLayerName);
|
||||||
|
ft.setWidget(2, 2, new SimplePanel(rs));
|
||||||
add(ft);
|
add(ft);
|
||||||
draggableButton.setIcon(IconType.MOVE);
|
draggableButton.setIcon(IconType.MOVE);
|
||||||
|
|
||||||
|
@ -87,7 +97,7 @@ public class DragDropLayer extends FlowPanel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||||
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.VISIBILITY, layer);
|
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.VISIBILITY, layerItem);
|
||||||
dae.setVisibility(checkBoxVisibility.getValue());
|
dae.setVisibility(checkBoxVisibility.getValue());
|
||||||
applicationBus.fireEvent(dae);
|
applicationBus.fireEvent(dae);
|
||||||
|
|
||||||
|
@ -148,7 +158,7 @@ public class DragDropLayer extends FlowPanel {
|
||||||
|
|
||||||
GWT.log("sourceIndex: " + sourceIndex+", sourceItem: "+dragging.getLayerItem().getName());
|
GWT.log("sourceIndex: " + sourceIndex+", sourceItem: "+dragging.getLayerItem().getName());
|
||||||
GWT.log("targetIndex: " + targetIndex+", targetItem: "+draggingTarget.getLayerItem().getName());
|
GWT.log("targetIndex: " + targetIndex+", targetItem: "+draggingTarget.getLayerItem().getName());
|
||||||
if (sourceIndex != targetIndex && targetIndex > 0) {
|
if (sourceIndex != targetIndex && targetIndex >= 0) {
|
||||||
tree.remove(source);
|
tree.remove(source);
|
||||||
target = tree;
|
target = tree;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue