Fixing the CORSE issue #24506#note-2
This commit is contained in:
parent
aaed3cf9f4
commit
619c67c5ec
2
pom.xml
2
pom.xml
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Convenience property to set the GWT version -->
|
<!-- Convenience property to set the GWT version -->
|
||||||
<gwt.version>2.9.0</gwt.version>
|
<gwt.version>2.10.0</gwt.version>
|
||||||
<gwt.compiler.style>PRETTY</gwt.compiler.style>
|
<gwt.compiler.style>PRETTY</gwt.compiler.style>
|
||||||
<gson.version>2.6.2</gson.version>
|
<gson.version>2.6.2</gson.version>
|
||||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -73,11 +74,6 @@ import com.google.gwt.core.client.ScriptInjector;
|
||||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||||
import com.google.gwt.event.logical.shared.ResizeHandler;
|
import com.google.gwt.event.logical.shared.ResizeHandler;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.http.client.Request;
|
|
||||||
import com.google.gwt.http.client.RequestBuilder;
|
|
||||||
import com.google.gwt.http.client.RequestCallback;
|
|
||||||
import com.google.gwt.http.client.RequestException;
|
|
||||||
import com.google.gwt.http.client.Response;
|
|
||||||
import com.google.gwt.user.client.Timer;
|
import com.google.gwt.user.client.Timer;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
@ -155,6 +151,9 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
private boolean initApplication;
|
private boolean initApplication;
|
||||||
|
|
||||||
|
// A cache (Layer_ID, GeoJSON) of layer features loaded via GetFeature Request
|
||||||
|
private HashMap<String, String> layerFeaturesCache = new HashMap<String, String>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the entry point method.
|
* This is the entry point method.
|
||||||
*/
|
*/
|
||||||
|
@ -200,6 +199,9 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inits the application.
|
||||||
|
*/
|
||||||
private void initApplication() {
|
private void initApplication() {
|
||||||
|
|
||||||
initApplication = true;
|
initApplication = true;
|
||||||
|
@ -300,10 +302,20 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
RootPanel.get(APP_DIV).add(attributionDiv);
|
RootPanel.get(APP_DIV).add(attributionDiv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the status.
|
||||||
|
*
|
||||||
|
* @return the status
|
||||||
|
*/
|
||||||
public static ViewerStatus getStatus() {
|
public static ViewerStatus getStatus() {
|
||||||
return viewerStatus;
|
return viewerStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the list base map layers.
|
||||||
|
*
|
||||||
|
* @return the list base map layers
|
||||||
|
*/
|
||||||
public static List<BaseMapLayer> getListBaseMapLayers() {
|
public static List<BaseMapLayer> getListBaseMapLayers() {
|
||||||
return listBaseMapLayers;
|
return listBaseMapLayers;
|
||||||
}
|
}
|
||||||
|
@ -320,6 +332,11 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the client height.
|
||||||
|
*
|
||||||
|
* @return the client height
|
||||||
|
*/
|
||||||
public int getClientHeight() {
|
public int getClientHeight() {
|
||||||
RootPanel principalDiv = RootPanel.get(APP_DIV);
|
RootPanel principalDiv = RootPanel.get(APP_DIV);
|
||||||
int topBorder = principalDiv.getAbsoluteTop();
|
int topBorder = principalDiv.getAbsoluteTop();
|
||||||
|
@ -585,76 +602,53 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case LOCATE_LAYER:
|
case LOCATE_LAYER:
|
||||||
|
|
||||||
final LayerItem layerItem = doLayerActionEvent.getLayerItem();
|
final LayerItem layerItem = doLayerActionEvent.getLayerItem();
|
||||||
|
|
||||||
boolean layerHighlighted = olMap.areLayerFeaturesAsHighlight(layerItem);
|
boolean layerHighlighted = olMap.areLayerFeaturesAsHighlight(layerItem);
|
||||||
|
|
||||||
if(layerHighlighted) {
|
if (layerHighlighted) {
|
||||||
|
doLayerActionEvent.getSourceEventUI().setVisibleLoaderFeatures(false, null);
|
||||||
olMap.removeLayerFeaturesAsHighlight(layerItem.getName());
|
olMap.removeLayerFeaturesAsHighlight(layerItem.getName());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getWFSRequest(layerItem,
|
|
||||||
olMap.getProjectionCode(), null, 0, "json",
|
|
||||||
new AsyncCallback<String>() {
|
|
||||||
|
|
||||||
@Override
|
final String geoJSONFeatures = layerFeaturesCache.get(layerItem.getName());
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
if (geoJSONFeatures == null) {
|
||||||
|
|
||||||
@Override
|
GeoportalDataViewerServiceAsync.Util.getInstance().getWFSResponse(layerItem,
|
||||||
public void onSuccess(String wmsRequestURL) {
|
olMap.getProjectionCode(), null, 0, "json", new AsyncCallback<String>() {
|
||||||
GWT.log("wmsRequestURL: "+wmsRequestURL);
|
|
||||||
|
|
||||||
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, wmsRequestURL);
|
|
||||||
|
|
||||||
try {
|
@Override
|
||||||
Request response = builder.sendRequest(null, new RequestCallback() {
|
public void onFailure(Throwable caught) {
|
||||||
public void onError(Request request, Throwable exception) {
|
doLayerActionEvent.getSourceEventUI().setVisibleLoaderFeatures(false, null);
|
||||||
// Code omitted for clarity
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onResponseReceived(Request request, Response response) {
|
}
|
||||||
GWT.log("GeoJSON: "+response.getText());
|
|
||||||
|
|
||||||
GeoJsonFeatureOptions fo = new GeoJsonFeatureOptions();
|
@Override
|
||||||
ProjectionOptions projectionOptions = new ProjectionOptions();
|
public void onSuccess(String geoJSONFeaturesResp) {
|
||||||
projectionOptions.setCode(MAP_PROJECTION.EPSG_4326.getName());
|
doLayerActionEvent.getSourceEventUI().setVisibleLoaderFeatures(false, null);
|
||||||
Projection fp = new Projection(projectionOptions);
|
|
||||||
fo.setFeatureProjection(fp);
|
|
||||||
fo.setDataProjection(fp);
|
|
||||||
GeoJsonOptions geoJsonOpt = new GeoJsonOptions();
|
|
||||||
geoJsonOpt.setDefaultDataProjection(fp);
|
|
||||||
geoJsonOpt.setFeatureProjection(fp);
|
|
||||||
GeoJson geoJson = OLFactory.createGeoJSON(geoJsonOpt);
|
|
||||||
|
|
||||||
Feature[] features = geoJson.readFeatures(response.getText());
|
|
||||||
GWT.log("features: "+features);
|
|
||||||
//Feature[] features = new GeoJson().readFeatures(jsonObject, projectionOptions);
|
|
||||||
olMap.addLayerFeaturesAsHighlight(layerItem, features);
|
|
||||||
|
|
||||||
ProjectDV projectDV = doLayerActionEvent.getLayerObject().getProjectDV();
|
|
||||||
if(projectDV!=null) {
|
|
||||||
GeoJSON spatialReference = projectDV.getSpatialReference();
|
|
||||||
|
|
||||||
GWT.log("spatialReference is: "+spatialReference);
|
|
||||||
Coordinate transfCoord = MapUtils.geoJSONTToBBoxCenter(spatialReference, MAP_PROJECTION.EPSG_4326.getName(),
|
|
||||||
MAP_PROJECTION.EPSG_3857.getName());
|
|
||||||
GWT.log("transfCoord is: "+transfCoord);
|
|
||||||
if(transfCoord!=null)
|
|
||||||
olMap.setCenter(transfCoord);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch (RequestException e) {
|
if (geoJSONFeaturesResp != null && !geoJSONFeaturesResp.isEmpty()) {
|
||||||
|
layerFeaturesCache.put(layerItem.getName(), geoJSONFeaturesResp);
|
||||||
}
|
|
||||||
}
|
GWT.log("GeoJSON: " + geoJSONFeaturesResp);
|
||||||
});
|
|
||||||
|
showLayerFeatures(layerItem, geoJSONFeaturesResp,
|
||||||
|
doLayerActionEvent.getLayerObject().getProjectDV());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
|
||||||
|
doLayerActionEvent.getSourceEventUI().setVisibleLoaderFeatures(false, null);
|
||||||
|
showLayerFeatures(layerItem, geoJSONFeatures,
|
||||||
|
doLayerActionEvent.getLayerObject().getProjectDV());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -664,7 +658,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
applicationBus.addHandler(ChangeMapLayerEvent.TYPE, new ChangeMapLayerEventHandler() {
|
applicationBus.addHandler(ChangeMapLayerEvent.TYPE, new ChangeMapLayerEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -774,11 +768,11 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the.
|
* Sets the.
|
||||||
*
|
*
|
||||||
* @param json the json
|
* @param json the json
|
||||||
|
* @return the object
|
||||||
*/
|
*/
|
||||||
public static native Object toJSON(String json) /*-{
|
public static native Object toJSON(String json) /*-{
|
||||||
var jsonObj = JSON.parse(json);
|
var jsonObj = JSON.parse(json);
|
||||||
|
@ -802,6 +796,13 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
//
|
//
|
||||||
// }-*/;
|
// }-*/;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform WFS query on centroid.
|
||||||
|
*
|
||||||
|
* @param projectID the project ID
|
||||||
|
* @param centroidLong the centroid long
|
||||||
|
* @param centroidLat the centroid lat
|
||||||
|
*/
|
||||||
private void performWFSQueryOnCentroid(String projectID, Double centroidLong, Double centroidLat) {
|
private void performWFSQueryOnCentroid(String projectID, Double centroidLong, Double centroidLat) {
|
||||||
GWT.log("Perform performWFSQueryOnCentroid: " + projectID + " long: " + centroidLong + ", lat: " + centroidLat);
|
GWT.log("Perform performWFSQueryOnCentroid: " + projectID + " long: " + centroidLong + ", lat: " + centroidLat);
|
||||||
if (projectID != null) {
|
if (projectID != null) {
|
||||||
|
@ -826,6 +827,13 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show popover.
|
||||||
|
*
|
||||||
|
* @param w the w
|
||||||
|
* @param message the message
|
||||||
|
* @param heading the heading
|
||||||
|
*/
|
||||||
public static void showPopover(final Widget w, String message, String heading) {
|
public static void showPopover(final Widget w, String message, String heading) {
|
||||||
|
|
||||||
final Popover popover = new Popover();
|
final Popover popover = new Popover();
|
||||||
|
@ -847,6 +855,11 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
timer.schedule(3000);
|
timer.schedule(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the general error panel.
|
||||||
|
*
|
||||||
|
* @return the general error panel
|
||||||
|
*/
|
||||||
private FlowPanel getGeneralErrorPanel() {
|
private FlowPanel getGeneralErrorPanel() {
|
||||||
Image geoportalError = new Image(GNAImages.ICONS.geoportaServiceError());
|
Image geoportalError = new Image(GNAImages.ICONS.geoportaServiceError());
|
||||||
FlowPanel errorPanelMsg = new FlowPanel();
|
FlowPanel errorPanelMsg = new FlowPanel();
|
||||||
|
@ -859,4 +872,41 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
return errorPanelMsg;
|
return errorPanelMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show layer features.
|
||||||
|
*
|
||||||
|
* @param layerItem the layer item
|
||||||
|
* @param geoJSONFeatures the geo JSON features
|
||||||
|
* @param projectDV the project DV
|
||||||
|
*/
|
||||||
|
private void showLayerFeatures(LayerItem layerItem, String geoJSONFeatures, ProjectDV projectDV) {
|
||||||
|
|
||||||
|
GeoJsonFeatureOptions fo = new GeoJsonFeatureOptions();
|
||||||
|
ProjectionOptions projectionOptions = new ProjectionOptions();
|
||||||
|
projectionOptions.setCode(MAP_PROJECTION.EPSG_4326.getName());
|
||||||
|
Projection fp = new Projection(projectionOptions);
|
||||||
|
fo.setFeatureProjection(fp);
|
||||||
|
fo.setDataProjection(fp);
|
||||||
|
GeoJsonOptions geoJsonOpt = new GeoJsonOptions();
|
||||||
|
geoJsonOpt.setDefaultDataProjection(fp);
|
||||||
|
geoJsonOpt.setFeatureProjection(fp);
|
||||||
|
GeoJson geoJson = OLFactory.createGeoJSON(geoJsonOpt);
|
||||||
|
|
||||||
|
Feature[] features = geoJson.readFeatures(geoJSONFeatures);
|
||||||
|
|
||||||
|
GWT.log("features: " + features);
|
||||||
|
olMapMng.getOLMap().addLayerFeaturesAsHighlight(layerItem, features);
|
||||||
|
|
||||||
|
if (projectDV != null) {
|
||||||
|
GeoJSON spatialReference = projectDV.getSpatialReference();
|
||||||
|
|
||||||
|
GWT.log("spatialReference is: " + spatialReference);
|
||||||
|
Coordinate transfCoord = MapUtils.geoJSONTToBBoxCenter(spatialReference, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
|
MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
GWT.log("transfCoord is: " + transfCoord);
|
||||||
|
if (transfCoord != null)
|
||||||
|
olMapMng.getOLMap().setCenter(transfCoord);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,4 +193,17 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
String getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
String getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||||
String outputFormat);
|
String outputFormat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the WFS response.
|
||||||
|
*
|
||||||
|
* @param layerItem the layer item
|
||||||
|
* @param mapSrsName the map srs name
|
||||||
|
* @param mapBBOX the map BBOX
|
||||||
|
* @param maxFeatures the max features
|
||||||
|
* @param outputFormat the output format
|
||||||
|
* @return the WFS response
|
||||||
|
*/
|
||||||
|
String getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||||
|
String outputFormat);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,4 +79,7 @@ public interface GeoportalDataViewerServiceAsync {
|
||||||
void getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat,
|
void getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat,
|
||||||
AsyncCallback<String> callback);
|
AsyncCallback<String> callback);
|
||||||
|
|
||||||
|
void getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat,
|
||||||
|
AsyncCallback<String> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||||
|
|
||||||
|
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.LayerItem;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
||||||
private SwapLayer sourceLayerSwap;
|
private SwapLayer sourceLayerSwap;
|
||||||
private SwapLayer targetLayerSwap;
|
private SwapLayer targetLayerSwap;
|
||||||
private LayerObject layerObject;
|
private LayerObject layerObject;
|
||||||
|
private DragDropLayer sourceEventUI;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class SwapLayer.
|
* The Class SwapLayer.
|
||||||
|
@ -211,6 +213,25 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
||||||
return visibility;
|
return visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the UI event source.
|
||||||
|
*
|
||||||
|
* @param sourceEventUI the new UI event source
|
||||||
|
*/
|
||||||
|
public void setUIEventSource(DragDropLayer sourceEventUI) {
|
||||||
|
this.sourceEventUI = sourceEventUI;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the source event UI.
|
||||||
|
*
|
||||||
|
* @return the source event UI
|
||||||
|
*/
|
||||||
|
public DragDropLayer getSourceEventUI() {
|
||||||
|
return sourceEventUI;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To string.
|
* To string.
|
||||||
*
|
*
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -10,6 +10,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetai
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||||
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 org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
|
@ -56,6 +57,10 @@ public class DragDropLayer extends FlowPanel {
|
||||||
private Image imgLocateNone = new Image(GNAImages.ICONS.locateNone());
|
private Image imgLocateNone = new Image(GNAImages.ICONS.locateNone());
|
||||||
private boolean locateEnabled = false;
|
private boolean locateEnabled = false;
|
||||||
private HTML buttonLocate = new HTML();
|
private HTML buttonLocate = new HTML();
|
||||||
|
|
||||||
|
private DragDropLayer INSTANCE = this;
|
||||||
|
|
||||||
|
private LoaderIcon loaderIcon = new LoaderIcon("Loading features", null);
|
||||||
|
|
||||||
private Button draggableButton = new Button();
|
private Button draggableButton = new Button();
|
||||||
private HandlerManager applicationBus;
|
private HandlerManager applicationBus;
|
||||||
|
@ -70,7 +75,7 @@ public class DragDropLayer extends FlowPanel {
|
||||||
this.layerObject = layerObject;
|
this.layerObject = layerObject;
|
||||||
this.layerItem = layerObject.getLayerItem();
|
this.layerItem = layerObject.getLayerItem();
|
||||||
GWT.log("DragDropLayer for projectDV: " + layerObject.getProjectDV());
|
GWT.log("DragDropLayer for projectDV: " + layerObject.getProjectDV());
|
||||||
|
|
||||||
// Checking the spatial reference
|
// Checking the spatial reference
|
||||||
if (layerObject.getProjectDV() != null && layerObject.getProjectDV().getSpatialReference() == null) {
|
if (layerObject.getProjectDV() != null && layerObject.getProjectDV().getSpatialReference() == null) {
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getSpatialReference(layerObject.getProfileID(),
|
GeoportalDataViewerServiceAsync.Util.getInstance().getSpatialReference(layerObject.getProfileID(),
|
||||||
|
@ -172,14 +177,16 @@ public class DragDropLayer extends FlowPanel {
|
||||||
HorizontalPanel hp0 = new HorizontalPanel();
|
HorizontalPanel hp0 = new HorizontalPanel();
|
||||||
HorizontalPanel hpFunct = new HorizontalPanel();
|
HorizontalPanel hpFunct = new HorizontalPanel();
|
||||||
vpInner.getElement().getStyle().setMarginLeft(47, Unit.PX);
|
vpInner.getElement().getStyle().setMarginLeft(47, Unit.PX);
|
||||||
|
|
||||||
hp0.add(draggableButton);
|
hp0.add(draggableButton);
|
||||||
labelProject.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
labelProject.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||||
labelProject.getElement().getStyle().setFontWeight(FontWeight.BOLD);
|
labelProject.getElement().getStyle().setFontWeight(FontWeight.BOLD);
|
||||||
hp0.add(labelProject);
|
hp0.add(labelProject);
|
||||||
hpFunct.add(buttonLayerVisibility);
|
hpFunct.add(buttonLayerVisibility);
|
||||||
hpFunct.add(buttonLocate);
|
hpFunct.add(buttonLocate);
|
||||||
|
hpFunct.add(loaderIcon);
|
||||||
|
setVisibleLoaderFeatures(false, null);
|
||||||
|
|
||||||
if (layerObject.getProjectDV().getTemporalReference() != null) {
|
if (layerObject.getProjectDV().getTemporalReference() != null) {
|
||||||
TemporalReferenceDV tempRef = layerObject.getProjectDV().getTemporalReference();
|
TemporalReferenceDV tempRef = layerObject.getProjectDV().getTemporalReference();
|
||||||
// ft.setWidget(ft.getRowCount() + 1, 2, new HTML(ProjectUtil.toHTMLCode(tempRef)));
|
// ft.setWidget(ft.getRowCount() + 1, 2, new HTML(ProjectUtil.toHTMLCode(tempRef)));
|
||||||
|
@ -187,14 +194,14 @@ public class DragDropLayer extends FlowPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
vpInner.add(labelLayerName);
|
vpInner.add(labelLayerName);
|
||||||
//vpInner.add(new SimplePanel(rs));
|
// vpInner.add(new SimplePanel(rs));
|
||||||
|
|
||||||
vp.add(hp0);
|
vp.add(hp0);
|
||||||
hpFunct.getElement().getStyle().setMarginTop(5, Unit.PX);
|
hpFunct.getElement().getStyle().setMarginTop(5, Unit.PX);
|
||||||
vpInner.add(hpFunct);
|
vpInner.add(hpFunct);
|
||||||
vpInner.add(new SimplePanel(rs));
|
vpInner.add(new SimplePanel(rs));
|
||||||
vp.add(vpInner);
|
vp.add(vpInner);
|
||||||
|
|
||||||
add(vp);
|
add(vp);
|
||||||
|
|
||||||
// add(ft);
|
// add(ft);
|
||||||
|
@ -221,6 +228,8 @@ public class DragDropLayer extends FlowPanel {
|
||||||
setLocateEnabledButtonImage();
|
setLocateEnabledButtonImage();
|
||||||
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.LOCATE_LAYER,
|
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.LOCATE_LAYER,
|
||||||
layerItem, layerObject);
|
layerItem, layerObject);
|
||||||
|
dae.setUIEventSource(INSTANCE);
|
||||||
|
setVisibleLoaderFeatures(true, null);
|
||||||
applicationBus.fireEvent(dae);
|
applicationBus.fireEvent(dae);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -242,10 +251,10 @@ public class DragDropLayer extends FlowPanel {
|
||||||
buttonLocate.getElement().removeAllChildren();
|
buttonLocate.getElement().removeAllChildren();
|
||||||
if (locateEnabled) {
|
if (locateEnabled) {
|
||||||
buttonLocate.getElement().appendChild(imgLocate.getElement());
|
buttonLocate.getElement().appendChild(imgLocate.getElement());
|
||||||
buttonLocate.setTitle("Unselect the layer");
|
buttonLocate.setTitle("Unselect the layer features");
|
||||||
} else {
|
} else {
|
||||||
buttonLocate.getElement().appendChild(imgLocateNone.getElement());
|
buttonLocate.getElement().appendChild(imgLocateNone.getElement());
|
||||||
buttonLocate.setTitle("Highlight the layer");
|
buttonLocate.setTitle("Highlight the layer features");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -330,4 +339,17 @@ public class DragDropLayer extends FlowPanel {
|
||||||
return layerItem;
|
return layerItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the visible loader features.
|
||||||
|
*
|
||||||
|
* @param bool the bool
|
||||||
|
* @param msg the msg
|
||||||
|
*/
|
||||||
|
public void setVisibleLoaderFeatures(boolean bool, String msg) {
|
||||||
|
loaderIcon.setVisible(bool);
|
||||||
|
if(msg!=null)
|
||||||
|
loaderIcon.setText(msg);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@ package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||||
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
|
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
|
||||||
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
|
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -1542,14 +1546,13 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the WFS request.
|
* Gets the WFS request.
|
||||||
*
|
*
|
||||||
* @param layerItem the layer item
|
* @param layerItem the layer item
|
||||||
* @param mapSrsName the map srs name
|
* @param mapSrsName the map srs name
|
||||||
* @param mapBBOX the map BBOX
|
* @param mapBBOX the map BBOX
|
||||||
* @param maxFeatures the max features. If 0 means all feature
|
* @param maxFeatures the max features. If 0 means all feature
|
||||||
* @param outputFormat the output format
|
* @param outputFormat the output format
|
||||||
* @return the WFS request
|
* @return the WFS request
|
||||||
*/
|
*/
|
||||||
|
@ -1557,15 +1560,70 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
public String getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
public String getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||||
String outputFormat) {
|
String outputFormat) {
|
||||||
LOG.info("getWFSRequest called");
|
LOG.info("getWFSRequest called");
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("getWFSRequest parameters layerItem name: " + layerItem.getName(),
|
LOG.debug("getWFSRequest parameters layerItem name: " + layerItem.getName(), ", mapSrsName: " + mapSrsName
|
||||||
", mapSrsName: " + mapSrsName + ", mapBBOX: " + mapBBOX + ", maxFeatures: " + maxFeatures
|
+ ", mapBBOX: " + mapBBOX + ", maxFeatures: " + maxFeatures + ", outputFormat: " + outputFormat);
|
||||||
+ ", outputFormat: " + outputFormat);
|
|
||||||
}
|
}
|
||||||
String url = GisMakers.buildWFSFeatureQuery(layerItem, mapSrsName, mapBBOX, maxFeatures, outputFormat);
|
String url = GisMakers.buildWFSFeatureQuery(layerItem, mapSrsName, mapBBOX, maxFeatures, outputFormat);
|
||||||
LOG.info("returning WFSRequest: "+url);
|
LOG.info("returning WFSRequest: " + url);
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the WFS response.
|
||||||
|
*
|
||||||
|
* @param layerItem the layer item
|
||||||
|
* @param mapSrsName the map srs name
|
||||||
|
* @param mapBBOX the map BBOX
|
||||||
|
* @param maxFeatures the max features
|
||||||
|
* @param outputFormat the output format
|
||||||
|
* @return the WFS response
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||||
|
String outputFormat) {
|
||||||
|
LOG.info("getWFSResponse called");
|
||||||
|
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("getWFSResponse parameters layerItem name: " + layerItem.getName(), ", mapSrsName: " + mapSrsName
|
||||||
|
+ ", mapBBOX: " + mapBBOX + ", maxFeatures: " + maxFeatures + ", outputFormat: " + outputFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
String url = getWFSRequest(layerItem, mapSrsName, mapBBOX, maxFeatures, outputFormat);
|
||||||
|
StringBuffer response = new StringBuffer();
|
||||||
|
String theResponseString = "";
|
||||||
|
HttpURLConnection con = null;
|
||||||
|
LOG.debug("Built URL: " + url);
|
||||||
|
try {
|
||||||
|
URL obj = new URL(url);
|
||||||
|
con = (HttpURLConnection) obj.openConnection();
|
||||||
|
con.setRequestMethod("GET");
|
||||||
|
int responseCode = con.getResponseCode();
|
||||||
|
LOG.debug("GET Response Code: " + responseCode);
|
||||||
|
if (responseCode == HttpURLConnection.HTTP_OK) { // success
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
|
||||||
|
String inputLine;
|
||||||
|
while ((inputLine = in.readLine()) != null) {
|
||||||
|
response.append(inputLine);
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
} else {
|
||||||
|
LOG.info("GET request did not work.");
|
||||||
|
}
|
||||||
|
|
||||||
|
theResponseString = response.toString();
|
||||||
|
//LOG.trace(theResponseString);
|
||||||
|
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("getWFSResponse is empty? " + theResponseString.isEmpty());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Error on performing the request to URL: " + url, e);
|
||||||
|
} finally {
|
||||||
|
|
||||||
|
}
|
||||||
|
return theResponseString;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue