Built layer switcher panel
This commit is contained in:
parent
c899839220
commit
3e3bc7a4e7
|
@ -10,6 +10,7 @@ import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEventHandler;
|
||||
|
@ -174,7 +175,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
layerItem.setName(layerName);
|
||||
layerManager.setBaseLayerFromIsProfile(layerItem);
|
||||
layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false,
|
||||
null, false, null, null,null);
|
||||
null, false, null, null, null);
|
||||
|
||||
if (paramGeonaItemID != null) {
|
||||
if (paramGeonaItemType == null) {
|
||||
|
@ -267,7 +268,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
@Override
|
||||
public void onLayerRendered(AddedLayerToMapEvent addedLayerToMapEvent) {
|
||||
GWT.log("Fired AddedLayerToMapEvent " + addedLayerToMapEvent.getLayerItem());
|
||||
GWT.log("Fired AddedLayerToMapEvent " + addedLayerToMapEvent.getLayerItem() + "layer type: "+addedLayerToMapEvent.getLayerType());
|
||||
// GeoportalDataViewerConstants.print("Fired AddedLayerToMapEvent
|
||||
// "+addedLayerToMapEvent.getLayerItem());
|
||||
|
||||
|
@ -304,6 +305,23 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
// TODO: handle exception
|
||||
}
|
||||
|
||||
LAYER_TYPE layerType = addedLayerToMapEvent.getLayerType();
|
||||
|
||||
if (layerType != null) {
|
||||
|
||||
switch (layerType) {
|
||||
case BASE:
|
||||
|
||||
break;
|
||||
case OVERLAY:
|
||||
mainPanel.showOverlayLayers(layerManager.getOverlayLayerManager().getPanel());
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -315,8 +333,13 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
if (mainPanel.getDisplyedRecord() == null && !olMapMng.isQueryPointActive()) {
|
||||
olMapMng.hidePopInfo();
|
||||
layerManager.removeAllDetailLayers();
|
||||
|
||||
}
|
||||
|
||||
mainPanel.hideOverlayLayers();
|
||||
// layerManager.getOverlayLayerManager().hide();
|
||||
// hidePopupLayers();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -336,7 +359,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
applicationBus.addHandler(DoActionOnDetailLayersEvent.TYPE, new DoActionOnDetailLayersEventHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -367,6 +390,23 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Handler popu closer.
|
||||
// *
|
||||
// * @param divId the div id
|
||||
// * @param overlayId the overlay id
|
||||
// */
|
||||
// public static native void handlerPopuCloser(String divId, String overlayId) /*-{
|
||||
// var closer = $doc.getElementById(divId);
|
||||
// var overlay = $doc.getElementById(overlayId);
|
||||
// closer.onclick = function() {
|
||||
// overlay.setPosition(undefined);
|
||||
// closer.blur();
|
||||
// return false;
|
||||
// };
|
||||
//
|
||||
// }-*/;
|
||||
|
||||
private void performWFSQueryOnCentroid(RecordDV record) {
|
||||
if (record != null) {
|
||||
GWT.log("record instanceof ConcessioneDV: " + (record instanceof ConcessioneDV) + " with mongo item id: "
|
||||
|
@ -384,9 +424,10 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
GeoQuery select = olMapMng.toDataPointQuery(transfCoord, false);
|
||||
GWT.log("GeoQuery: " + select);
|
||||
// GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
|
||||
ExtentWrapped toExt = new ExtentWrapped(transfCoord.getX(), transfCoord.getY(), transfCoord.getX(), transfCoord.getY());
|
||||
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, toExt,
|
||||
record.getItemId(), true, MapEventType.ADDED_CENTROID_LAYER_TO_MAP));
|
||||
ExtentWrapped toExt = new ExtentWrapped(transfCoord.getX(), transfCoord.getY(), transfCoord.getX(),
|
||||
transfCoord.getY());
|
||||
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, toExt, record.getItemId(),
|
||||
true, MapEventType.ADDED_CENTROID_LAYER_TO_MAP));
|
||||
} else {
|
||||
GeoportalDataViewerConstants.printJs(
|
||||
"I cannot select the point one or both coordiantes are null. X: " + x + ", Y:" + y);
|
||||
|
|
|
@ -88,7 +88,7 @@ public class LayerManager {
|
|||
private HandlerManager applicationBus;
|
||||
|
||||
private org.gcube.application.geoportalcommon.shared.LayerItem baseLayerFromISProfile;
|
||||
|
||||
|
||||
private OverlayLayerManager overlayLayerManager;
|
||||
|
||||
/**
|
||||
|
@ -312,11 +312,13 @@ public class LayerManager {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the all detail layers.
|
||||
*/
|
||||
public void removeAllDetailLayers() {
|
||||
mapDetailLayerObjects.clear();
|
||||
olMap.removeAllDetailLayers();
|
||||
overlayLayerManager.resetLayers();
|
||||
overlayLayerManager.hide();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -428,7 +430,7 @@ public class LayerManager {
|
|||
mapDetailLayerObjects.put(key, lo);
|
||||
olMap.addWMSDetailLayer(layerItem);
|
||||
overlayLayerManager.addLayerItem(layerItem);
|
||||
overlayLayerManager.show();
|
||||
//overlayLayerManager.show();
|
||||
} else {
|
||||
GWT.log("Skipping detail layer " + key + " already added to Map");
|
||||
}
|
||||
|
@ -524,15 +526,14 @@ public class LayerManager {
|
|||
/**
|
||||
* Show popup info for layer.
|
||||
*
|
||||
* @param geoNaDataObject the geo na data object
|
||||
* @param feature the feature
|
||||
* @param onFailureCenterTo the on failure center to
|
||||
* @param listGeoNaDataObject the list geo na data object
|
||||
* @param queryClick the query click
|
||||
*/
|
||||
public void showPopupInfoForLayer(List<GeoNaSpatialQueryResult> listGeoNaDataObject, ExtentWrapped queryClick) {
|
||||
|
||||
ScrollPanel scrollPanel = new ScrollPanel();
|
||||
FlowPanel flowPanel = new FlowPanel();
|
||||
//flowPanel.getElement().getStyle().setProperty("maxHeight", "600px");
|
||||
// flowPanel.getElement().getStyle().setProperty("maxHeight", "600px");
|
||||
scrollPanel.add(flowPanel);
|
||||
|
||||
String prevConcessioneName = "";
|
||||
|
@ -572,7 +573,7 @@ public class LayerManager {
|
|||
flowPanel.add(layerLabel);
|
||||
|
||||
List<FeatureRow> features = geoNaSpatialQueryResult.getFeatures();
|
||||
|
||||
|
||||
if (features == null || features.isEmpty()) {
|
||||
FlexTable flex = new FlexTable();
|
||||
flex.setCellPadding(1);
|
||||
|
@ -583,8 +584,8 @@ public class LayerManager {
|
|||
continue;
|
||||
// olMap.showPopup(vpPanel.toString(), onFailureCenterTo);
|
||||
}
|
||||
|
||||
GWT.log("Displaying "+features.size() + " features");
|
||||
|
||||
GWT.log("Displaying " + features.size() + " features");
|
||||
FlexTable intFlex = new FlexTable();
|
||||
intFlex.setCellPadding(1);
|
||||
intFlex.setCellSpacing(1);
|
||||
|
@ -600,8 +601,8 @@ public class LayerManager {
|
|||
Map<String, List<String>> entries = feature.getMapProperties();
|
||||
|
||||
if (entries.size() == 0) {
|
||||
//Adding this row to show "no property" for feature
|
||||
//intFlex.setHTML(i + 1, 1, new HTML("<i>No property</i>").toString());
|
||||
// Adding this row to show "no property" for feature
|
||||
// intFlex.setHTML(i + 1, 1, new HTML("<i>No property</i>").toString());
|
||||
}
|
||||
int j = 0;
|
||||
for (String key : entries.keySet()) {
|
||||
|
@ -626,113 +627,13 @@ public class LayerManager {
|
|||
}
|
||||
flowPanel.add(intFlex);
|
||||
} catch (Exception e) {
|
||||
GeoportalDataViewerConstants.printJs("Error: "+e.getMessage());
|
||||
GeoportalDataViewerConstants.printJs("Error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
olMap.showPopup(scrollPanel.toString(), queryClick.getCenter());
|
||||
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Show popup info for layer.
|
||||
// *
|
||||
// * @param geoNaDataObject the geo na data object
|
||||
// * @param feature the feature
|
||||
// * @param onFailureCenterTo the on failure center to
|
||||
// */
|
||||
// public void showPopupInfoForLayer(List<GeoNaSpatialQueryResult> listGeoNaDataObject,
|
||||
// ExtentWrapped queryClick) {
|
||||
//
|
||||
// ScrollPanel scrollPanel = new ScrollPanel();
|
||||
// VerticalPanel vpPanel = new VerticalPanel();
|
||||
// scrollPanel.add(vpPanel);
|
||||
//
|
||||
// String prevConcessioneName = "";
|
||||
// for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
|
||||
//
|
||||
// GWT.log("baseLayerFromISProfile.getName() :"+baseLayerFromISProfile.getName());
|
||||
// LayerObject lo = geoNaSpatialQueryResult.getSourceLayerObject();
|
||||
// LayerItem sourceLI = lo.getLayerItem();
|
||||
//
|
||||
// String layerSourceName = sourceLI.getName();
|
||||
//
|
||||
// //skipping centroid layer
|
||||
// if(layerSourceName==null || layerSourceName.compareToIgnoreCase(baseLayerFromISProfile.getName())==0) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// String nomeConcessione = lo.getSourceConcessione().getNome();
|
||||
// if(prevConcessioneName.compareTo(nomeConcessione)!=0) {
|
||||
// String concessioneIntro = StringUtil.ellipsize(lo.getSourceConcessione().getNome(), 40);
|
||||
// Heading heading = new Heading(4, concessioneIntro);
|
||||
// heading.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||
// vpPanel.add(heading);
|
||||
// HTML subText = new HTML("<p style=\"color:#999; font-size:14px; margin:5px 0 5px 0;\">Layers and Properties</p>");
|
||||
// vpPanel.add(subText);
|
||||
// }
|
||||
//
|
||||
// prevConcessioneName = nomeConcessione;
|
||||
//
|
||||
// Label layerLabel = new Label();
|
||||
// layerLabel.setType(LabelType.INFO);
|
||||
//
|
||||
// layerLabel.setText(layerSourceName);
|
||||
// layerLabel.getElement().getStyle().setMarginTop(10, Unit.PX);
|
||||
// layerLabel.getElement().getStyle().setMarginBottom(5, Unit.PX);
|
||||
// vpPanel.add(layerLabel);
|
||||
//
|
||||
// List<FeatureRow> features = geoNaSpatialQueryResult.getFeatures();
|
||||
//
|
||||
// if (features == null || features.isEmpty()) {
|
||||
// FlexTable flex = new FlexTable();
|
||||
// flex.setCellPadding(1);
|
||||
// flex.setCellSpacing(1);
|
||||
// flex.getElement().addClassName("table-feature");
|
||||
// flex.setHTML(0, 0, new HTML("No data available").toString());
|
||||
// vpPanel.add(flex);
|
||||
// continue;
|
||||
// //olMap.showPopup(vpPanel.toString(), onFailureCenterTo);
|
||||
// }
|
||||
//
|
||||
// for (FeatureRow feature : features) {
|
||||
//
|
||||
// FlexTable intFlex = new FlexTable();
|
||||
// intFlex.setCellPadding(1);
|
||||
// intFlex.setCellSpacing(1);
|
||||
// intFlex.getElement().addClassName("table-feature");
|
||||
//
|
||||
// intFlex.setHTML(0, 0, new HTML("Feature Id").toString());
|
||||
// intFlex.setHTML(1, 0, new HTML(feature.getId()).toString());
|
||||
//
|
||||
// // Showing properties belonging to concessioni centroid layer
|
||||
// Map<String, List<String>> entries = feature.getMapProperties();
|
||||
//
|
||||
// if (entries.size() == 0) {
|
||||
// intFlex.setHTML(1, 1, new HTML("No property available").toString());
|
||||
// }
|
||||
// int j = 1;
|
||||
// for (String key : entries.keySet()) {
|
||||
// List<String> theValues = entries.get(key);
|
||||
// String valueToDisplay = "";
|
||||
// for (String value : theValues) {
|
||||
// valueToDisplay+=value+", ";
|
||||
//
|
||||
// }
|
||||
// valueToDisplay = valueToDisplay.substring(0,valueToDisplay.length()-2);
|
||||
// intFlex.setHTML(0, j, new HTML(key).toString());
|
||||
// intFlex.setHTML(1, j, new HTML(valueToDisplay).toString());
|
||||
// j++;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// vpPanel.add(intFlex);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// olMap.showPopup(scrollPanel.toString(), queryClick.getCenter());
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* Show popup info for centroid layer.
|
||||
|
@ -935,12 +836,31 @@ public class LayerManager {
|
|||
return layerManagerBus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the base layer from is profile.
|
||||
*
|
||||
* @param layerItem the new base layer from is profile
|
||||
*/
|
||||
public void setBaseLayerFromIsProfile(org.gcube.application.geoportalcommon.shared.LayerItem layerItem) {
|
||||
this.baseLayerFromISProfile = layerItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the base layer from IS proile.
|
||||
*
|
||||
* @return the base layer from IS proile
|
||||
*/
|
||||
public org.gcube.application.geoportalcommon.shared.LayerItem getBaseLayerFromISProile() {
|
||||
return baseLayerFromISProfile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the overlay layer manager.
|
||||
*
|
||||
* @return the overlay layer manager
|
||||
*/
|
||||
public OverlayLayerManager getOverlayLayerManager() {
|
||||
return overlayLayerManager;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,25 +5,18 @@ import java.util.ArrayList;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd.DragDropLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.ui.DialogBox;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
|
||||
public class OverlayLayerManager {
|
||||
|
||||
ArrayList<LayerItem> layers = new ArrayList<LayerItem>();
|
||||
FlowPanel fp = new FlowPanel();
|
||||
private ArrayList<LayerItem> layers = new ArrayList<LayerItem>();
|
||||
private FlowPanel fp = new FlowPanel();
|
||||
private HandlerManager applicationBus;
|
||||
|
||||
public OverlayLayerManager(HandlerManager applicationBus) {
|
||||
this.applicationBus = applicationBus;
|
||||
//setText("Layers");
|
||||
//getElement().addClassName("myOverlayLayerManager");
|
||||
fp.getElement().getStyle().setMarginTop(10, Unit.PX);
|
||||
fp.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||
//add(fp);
|
||||
// getElement().getStyle().setZIndex(100);
|
||||
//fp.addStyleName("layers-panel");
|
||||
}
|
||||
|
||||
void addLayerItem(LayerItem layer) {
|
||||
|
@ -38,7 +31,7 @@ public class OverlayLayerManager {
|
|||
|
||||
}
|
||||
|
||||
FlowPanel getPanel() {
|
||||
public FlowPanel getPanel() {
|
||||
return fp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,26 +4,38 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
|||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* The Class AddedLayerToMapEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 18, 2020
|
||||
* Nov 18, 2020
|
||||
*/
|
||||
public class AddedLayerToMapEvent extends GwtEvent<AddedLayerToMapEventHandler> {
|
||||
public static Type<AddedLayerToMapEventHandler> TYPE = new Type<AddedLayerToMapEventHandler>();
|
||||
private LayerItem layerItem;
|
||||
private LAYER_TYPE layerType;
|
||||
|
||||
/**
|
||||
* The Enum LAYER_TYPE.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Oct 11, 2021
|
||||
*/
|
||||
public enum LAYER_TYPE {
|
||||
BASE, OVERLAY
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new added layer to map event.
|
||||
*
|
||||
* @param layerItem the layer item
|
||||
* @param layerType the layer type
|
||||
*/
|
||||
public AddedLayerToMapEvent(LayerItem layerItem) {
|
||||
public AddedLayerToMapEvent(LayerItem layerItem, LAYER_TYPE layerType) {
|
||||
this.layerItem = layerItem;
|
||||
this.layerType = layerType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,7 +58,7 @@ public class AddedLayerToMapEvent extends GwtEvent<AddedLayerToMapEventHandler>
|
|||
handler.onLayerRendered(this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the layer item.
|
||||
*
|
||||
|
@ -55,6 +67,14 @@ public class AddedLayerToMapEvent extends GwtEvent<AddedLayerToMapEventHandler>
|
|||
public LayerItem getLayerItem() {
|
||||
return layerItem;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the layer type.
|
||||
*
|
||||
* @return the layer type
|
||||
*/
|
||||
public LAYER_TYPE getLayerType() {
|
||||
return layerType;
|
||||
}
|
||||
|
||||
}
|
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
@ -375,7 +376,7 @@ public abstract class OpenLayerOSM {
|
|||
wmsLayerMap.put(key, wmsLayer);
|
||||
|
||||
GWT.log("Added WMSLayer for layer: " + layerItem.getName());
|
||||
eventBus.fireEvent(new AddedLayerToMapEvent(layerItem));
|
||||
eventBus.fireEvent(new AddedLayerToMapEvent(layerItem, LAYER_TYPE.BASE));
|
||||
} else {
|
||||
GWT.log("The WMS layer with key: " + key + " already exists, skipping");
|
||||
}
|
||||
|
@ -423,7 +424,7 @@ public abstract class OpenLayerOSM {
|
|||
wmsDetailsLayerMap.put(key, wmsLayer);
|
||||
|
||||
GWT.log("Added WMSDetailLayer for layer name: " + layerItem.getName());
|
||||
eventBus.fireEvent(new AddedLayerToMapEvent(layerItem));
|
||||
eventBus.fireEvent(new AddedLayerToMapEvent(layerItem, LAYER_TYPE.OVERLAY));
|
||||
} else {
|
||||
GWT.log("The WMS detail layer with key: " + key + " already exists, skipping");
|
||||
}
|
||||
|
@ -564,7 +565,7 @@ public abstract class OpenLayerOSM {
|
|||
* @param element the element
|
||||
* @return the overlay
|
||||
*/
|
||||
private Overlay addOverlay(Element element) {
|
||||
public Overlay addOverlay(Element element) {
|
||||
/**
|
||||
* Create an overlay to anchor the popup to the map.
|
||||
*/
|
||||
|
@ -770,7 +771,7 @@ public abstract class OpenLayerOSM {
|
|||
public HashMap<String, Image> getWmsLayerMap() {
|
||||
return wmsLayerMap;
|
||||
}
|
||||
|
||||
|
||||
public void setWMSDetailLayerVisible(LayerItem layerItem, boolean visible) {
|
||||
String key = layerItem.getName();
|
||||
Image layer = wmsDetailsLayerMap.get(key);
|
||||
|
@ -786,10 +787,10 @@ public abstract class OpenLayerOSM {
|
|||
public void swapLayers(LayerItem layerItem, LayerItem layerItem2) {
|
||||
String key1 = layerItem.getName();
|
||||
Image layer1 = wmsDetailsLayerMap.get(key1);
|
||||
|
||||
|
||||
String key2 = layerItem.getName();
|
||||
Image layer2 = wmsDetailsLayerMap.get(key2);
|
||||
|
||||
|
||||
int zIndex1 = layer1.getZIndex();
|
||||
int zIndex2 = layer2.getZIndex();
|
||||
layer1.setZIndex(zIndex2);
|
||||
|
|
|
@ -11,17 +11,18 @@ import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
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.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
@ -67,12 +68,15 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
|
||||
@UiField
|
||||
Button extentToItaly;
|
||||
|
||||
|
||||
@UiField
|
||||
Button extentToEarth;
|
||||
|
||||
|
||||
@UiField
|
||||
DropdownButton detailLayers;
|
||||
Button layersDDB;
|
||||
|
||||
@UiField
|
||||
FlowPanel overlayLayersPanel;
|
||||
|
||||
private MapPanel mapPanel;
|
||||
|
||||
|
@ -97,17 +101,39 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
dataPointSelection.setIcon(IconType.SCREENSHOT);
|
||||
dataBoxSelection.setIcon(IconType.BOOKMARK);
|
||||
removeQuery.setIcon(IconType.REMOVE);
|
||||
|
||||
|
||||
Image italyImg = new Image(Images.ICONS.italyIcon());
|
||||
italyImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
||||
extentToItaly.getElement().appendChild(italyImg.getElement());
|
||||
extentToItaly.setWidth("140px");
|
||||
|
||||
|
||||
Image worldImg = new Image(Images.ICONS.worldIcon());
|
||||
worldImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
||||
extentToEarth.getElement().appendChild(worldImg.getElement());
|
||||
extentToEarth.setWidth("140px");
|
||||
|
||||
//layersDDB.setToggle(true);
|
||||
bindEvents();
|
||||
|
||||
}
|
||||
|
||||
private void bindEvents() {
|
||||
|
||||
layersDDB.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
GWT.log("layersDDB clicked");
|
||||
|
||||
if(overlayLayersPanel.isVisible()) {
|
||||
overlayLayersPanel.setVisible(false);
|
||||
}else {
|
||||
overlayLayersPanel.setVisible(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -190,7 +216,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
extentToEarth.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -232,9 +258,52 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
public RecordDV getDisplyedRecord() {
|
||||
return detailsPanel.getDisplayedRecord();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the layers DDB.
|
||||
*
|
||||
* @return the layers DDB
|
||||
*/
|
||||
public Button getLayersDDB() {
|
||||
return layersDDB;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show overlay layers.
|
||||
*
|
||||
* @param panel the panel
|
||||
*/
|
||||
public void showOverlayLayers(FlowPanel panel) {
|
||||
GWT.log("showOverlayLayers");
|
||||
//layersDDB.setVisible(true);
|
||||
overlayLayersPanel.setVisible(true);
|
||||
overlayLayersPanel.clear();
|
||||
overlayLayersPanel.add(panel);
|
||||
//layersDDBClickEvent();
|
||||
}
|
||||
|
||||
public DropdownButton getDetailLayers() {
|
||||
return detailLayers;
|
||||
private void layersDDBClickEvent() {
|
||||
layersDDB.fireEvent( new GwtEvent<ClickHandler>() {
|
||||
@Override
|
||||
public com.google.gwt.event.shared.GwtEvent.Type<ClickHandler> getAssociatedType() {
|
||||
return ClickEvent.getType();
|
||||
}
|
||||
@Override
|
||||
protected void dispatch(ClickHandler handler) {
|
||||
handler.onClick(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide overlay layers.
|
||||
*/
|
||||
public void hideOverlayLayers() {
|
||||
GWT.log("hideOverlayLayers");
|
||||
overlayLayersPanel.clear();
|
||||
//layersDDB.setVisible(false);
|
||||
overlayLayersPanel.setVisible(false);
|
||||
//layersDDBClickEvent();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,8 +55,10 @@
|
|||
</b:DropdownButton>
|
||||
<b:Button type="LINK" ui:field="removeQuery"
|
||||
text="Remove Query" visible="false"></b:Button>
|
||||
<b:DropdownButton type="LINK" text="Layers" ui:field="detailLayers" visible="false">
|
||||
</b:DropdownButton>
|
||||
<b:Button type="LINK" text="Layers" ui:field="layersDDB">
|
||||
</b:Button>
|
||||
<g:FlowPanel ui:field="overlayLayersPanel"
|
||||
addStyleNames="layers-panel" visible="false"></g:FlowPanel>
|
||||
</g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
<c:DetailsPanel ui:field="detailsPanel"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||
<ui:style>
|
||||
|
||||
.map-style {
|
||||
width: 100%;
|
||||
}
|
||||
|
|
|
@ -39,10 +39,18 @@ public class DragDropLayer extends FlowPanel {
|
|||
|
||||
public DragDropLayer(HandlerManager applicationBus, LayerItem layer, boolean draggable, boolean droppable) {
|
||||
this.applicationBus = applicationBus;
|
||||
this.label = new Label(layer.getName());
|
||||
|
||||
int layerSep = layer.getName().lastIndexOf(":");
|
||||
String layerName = layerSep > 0 && (layerSep + 1) < layer.getName().length()
|
||||
? layer.getName().substring(layerSep + 1, layer.getName().length())
|
||||
: layer.getName();
|
||||
|
||||
this.label = new Label(layerName);
|
||||
this.label.setTitle(layer.getName());
|
||||
|
||||
getElement().getStyle().setMarginTop(5, Unit.PX);
|
||||
getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||
setWidth("350px");
|
||||
|
||||
if (draggable) {
|
||||
initDrag();
|
||||
|
@ -59,10 +67,13 @@ public class DragDropLayer extends FlowPanel {
|
|||
}
|
||||
|
||||
RangeSlider rs = new RangeSlider();
|
||||
rs.setWidth("250px");
|
||||
FlexTable ft = new FlexTable();
|
||||
ft.setWidget(0, 0, button);
|
||||
checkBoxVisibility.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
checkBoxVisibility.setValue(true);
|
||||
|
||||
label.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
ft.setWidget(0, 1, checkBoxVisibility);
|
||||
ft.setWidget(0, 2, label);
|
||||
ft.setWidget(1, 2, new SimplePanel(rs));
|
||||
|
@ -73,7 +84,8 @@ public class DragDropLayer extends FlowPanel {
|
|||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.VISIBILITY, layer, null);
|
||||
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.VISIBILITY, layer,
|
||||
null);
|
||||
dae.setVisibility(checkBoxVisibility.getValue());
|
||||
applicationBus.fireEvent(dae);
|
||||
|
||||
|
|
|
@ -337,4 +337,11 @@ body {
|
|||
|
||||
.myOverlayLayerManager{
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.layers-panel {
|
||||
margin-top: 10px;
|
||||
background-color: white;
|
||||
opacity: 80%;
|
||||
padding: 10px;
|
||||
}
|
Loading…
Reference in New Issue