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());
|
||||
layerVisibility.addAll(collLO);
|
||||
//Managing layer visibility
|
||||
//Managing layer visibility. If a layer is not visible has to be not queryable
|
||||
for (LayerObject layerObject : layerVisibility) {
|
||||
boolean isLayerVisible = olMap.isLayerVisible(layerObject.getLayerItem().getName());
|
||||
String layerName = layerObject.getLayerItem().getName();
|
||||
boolean isLayerVisible = olMap.isLayerVisible(layerName);
|
||||
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);
|
||||
}
|
||||
// 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) {
|
||||
mapDetailLayerObjects.put(key, lo);
|
||||
olMap.addWMSDetailLayer(layerItem);
|
||||
overlayLayerManager.addLayerItem(layerItem);
|
||||
overlayLayerManager.addLayerItem(lo);
|
||||
//overlayLayerManager.show();
|
||||
} else {
|
||||
GWT.log("Skipping detail layer " + key + " already added to Map");
|
||||
|
@ -558,7 +569,13 @@ public class LayerManager {
|
|||
|| layerSourceName.compareToIgnoreCase(baseLayerFromISProfile.getName()) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
List<FeatureRow> features = geoNaSpatialQueryResult.getFeatures();
|
||||
|
||||
if (features == null || features.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String nomeConcessione = lo.getSourceConcessione().getNome();
|
||||
if (prevConcessioneName.compareTo(nomeConcessione) != 0) {
|
||||
String concessioneIntro = StringUtil.ellipsize(lo.getSourceConcessione().getNome(), 40);
|
||||
|
@ -582,8 +599,8 @@ public class LayerManager {
|
|||
layerLabel.getElement().getStyle().setMarginBottom(5, Unit.PX);
|
||||
flowPanel.add(layerLabel);
|
||||
|
||||
List<FeatureRow> features = geoNaSpatialQueryResult.getFeatures();
|
||||
|
||||
/*
|
||||
if (features == null || features.isEmpty()) {
|
||||
FlexTable flex = new FlexTable();
|
||||
flex.setCellPadding(1);
|
||||
|
@ -593,7 +610,7 @@ public class LayerManager {
|
|||
flowPanel.add(flex);
|
||||
continue;
|
||||
// olMap.showPopup(vpPanel.toString(), onFailureCenterTo);
|
||||
}
|
||||
}*/
|
||||
|
||||
GWT.log("Displaying " + features.size() + " features");
|
||||
FlexTable intFlex = new FlexTable();
|
||||
|
|
|
@ -3,14 +3,14 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
|||
import java.util.ArrayList;
|
||||
|
||||
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.user.client.ui.FlowPanel;
|
||||
|
||||
public class OverlayLayerManager {
|
||||
|
||||
private ArrayList<LayerItem> layers = new ArrayList<LayerItem>();
|
||||
private ArrayList<LayerObject> layers = new ArrayList<LayerObject>();
|
||||
private FlowPanel fp = new FlowPanel();
|
||||
private HandlerManager applicationBus;
|
||||
|
||||
|
@ -19,9 +19,9 @@ public class OverlayLayerManager {
|
|||
//fp.addStyleName("layers-panel");
|
||||
}
|
||||
|
||||
void addLayerItem(LayerItem layer) {
|
||||
DragDropLayer dandd = new DragDropLayer(applicationBus, layer, true, true);
|
||||
layers.add(layer);
|
||||
void addLayerItem(LayerObject lo) {
|
||||
DragDropLayer dandd = new DragDropLayer(applicationBus, lo, true, true);
|
||||
layers.add(lo);
|
||||
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.dom.client.Style.Visibility;
|
||||
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.JSONParser;
|
||||
import com.google.gwt.json.client.JSONValue;
|
||||
|
@ -419,6 +420,7 @@ public abstract class OpenLayerOSM {
|
|||
}
|
||||
|
||||
Image wmsLayer = new Image(layerOptions);
|
||||
wmsLayer.setZIndex(wmsDetailsLayerMap.size() + 1);
|
||||
map.addLayer(wmsLayer);
|
||||
wmsDetailsLayerMap.put(key, wmsLayer);
|
||||
|
||||
|
@ -686,24 +688,72 @@ public abstract class OpenLayerOSM {
|
|||
Image layerImage = (Image) layer;
|
||||
|
||||
Source source = layerImage.getSource();
|
||||
// GWT.log("source: "+source.toString());
|
||||
// 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");
|
||||
GWT.log("theLayerName name is: " + jsonLayers);
|
||||
layerNames.add(jsonLayers.toString());
|
||||
|
||||
JSONObject imagesParamsObj = (JSONObject) jsonSourceObj.get("image_");
|
||||
JSONArray extent = (JSONArray) imagesParamsObj.get("extent");
|
||||
GWT.log("extentLayer: " + extent.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
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.
|
||||
*
|
||||
|
@ -722,7 +772,6 @@ public abstract class OpenLayerOSM {
|
|||
return wmsLayerMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if is layer visible.
|
||||
*
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
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.DO_LAYER_ACTION;
|
||||
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;
|
||||
|
@ -34,25 +36,32 @@ public class DragDropLayer extends FlowPanel {
|
|||
private static DragDropLayer dragging = null;
|
||||
private static DragDropLayer draggingTarget = null;
|
||||
final boolean droppable;
|
||||
private Label label;
|
||||
private Label labelLayerName;
|
||||
private CheckBox checkBoxVisibility = new CheckBox();
|
||||
private Button draggableButton = new Button();
|
||||
private HandlerManager applicationBus;
|
||||
private LayerObject layerObject;
|
||||
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.layerItem = layer;
|
||||
|
||||
String layerName = StringUtil.fullNameToLayerName(layer.getName(), ":");
|
||||
|
||||
this.label = new Label(layerName);
|
||||
this.label.setTitle(layer.getName());
|
||||
this.label.setType(LabelType.INFO);
|
||||
this.layerObject = layerObject;
|
||||
this.layerItem = layerObject.getLayerItem();
|
||||
|
||||
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);
|
||||
setWidth("350px");
|
||||
setWidth("400px");
|
||||
|
||||
if (draggable) {
|
||||
initDrag();
|
||||
|
@ -68,18 +77,19 @@ public class DragDropLayer extends FlowPanel {
|
|||
draggableButton.addStyleName("draggable");
|
||||
}
|
||||
|
||||
RangeSlider rs = new RangeSlider(applicationBus, layer);
|
||||
rs.setWidth("250px");
|
||||
RangeSlider rs = new RangeSlider(applicationBus, layerItem);
|
||||
rs.setWidth("300px");
|
||||
FlexTable ft = new FlexTable();
|
||||
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.setValue(true);
|
||||
|
||||
label.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
//labelLayerName.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
ft.setWidget(0, 1, checkBoxVisibility);
|
||||
ft.setWidget(0, 2, label);
|
||||
ft.setWidget(1, 2, new SimplePanel(rs));
|
||||
ft.setWidget(0, 2, labelConcessione);
|
||||
ft.setWidget(1, 2, labelLayerName);
|
||||
ft.setWidget(2, 2, new SimplePanel(rs));
|
||||
add(ft);
|
||||
draggableButton.setIcon(IconType.MOVE);
|
||||
|
||||
|
@ -87,7 +97,7 @@ public class DragDropLayer extends FlowPanel {
|
|||
|
||||
@Override
|
||||
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());
|
||||
applicationBus.fireEvent(dae);
|
||||
|
||||
|
@ -148,7 +158,7 @@ public class DragDropLayer extends FlowPanel {
|
|||
|
||||
GWT.log("sourceIndex: " + sourceIndex+", sourceItem: "+dragging.getLayerItem().getName());
|
||||
GWT.log("targetIndex: " + targetIndex+", targetItem: "+draggingTarget.getLayerItem().getName());
|
||||
if (sourceIndex != targetIndex && targetIndex > 0) {
|
||||
if (sourceIndex != targetIndex && targetIndex >= 0) {
|
||||
tree.remove(source);
|
||||
target = tree;
|
||||
|
||||
|
|
Loading…
Reference in New Issue