in progress
This commit is contained in:
parent
0d4428e341
commit
2b28f53652
|
@ -275,9 +275,6 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
<dependent-module archiveName="geoportal-data-common-2.0.1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
|
||||||
<dependency-type>uses</dependency-type>
|
|
||||||
</dependent-module>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
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.GeoportalDataViewerConstants.MapEventType;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddLayerToMapEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddLayerToMapEvent;
|
||||||
|
@ -59,6 +60,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Popover;
|
import com.github.gwtbootstrap.client.ui.Popover;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.Placement;
|
import com.github.gwtbootstrap.client.ui.constants.Placement;
|
||||||
|
@ -70,6 +72,13 @@ 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.json.client.JSONParser;
|
||||||
|
import com.google.gwt.json.client.JSONValue;
|
||||||
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;
|
||||||
|
@ -80,6 +89,18 @@ import com.google.gwt.user.client.ui.RootPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
|
import ol.OLFactory;
|
||||||
|
import ol.Options;
|
||||||
|
import ol.format.GeoJson;
|
||||||
|
import ol.format.GeoJsonFeatureOptions;
|
||||||
|
import ol.format.GeoJsonOptions;
|
||||||
|
import ol.geom.Geometry;
|
||||||
|
import ol.layer.LayerOptions;
|
||||||
|
import ol.proj.Projection;
|
||||||
|
import ol.proj.ProjectionOptions;
|
||||||
|
import ol.source.Vector;
|
||||||
|
import ol.Feature;
|
||||||
|
import ol.FeatureOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point classes define <code>onModuleLoad()</code>.
|
* Entry point classes define <code>onModuleLoad()</code>.
|
||||||
|
@ -569,6 +590,100 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
doLayerActionEvent.getVisibility());
|
doLayerActionEvent.getVisibility());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case LOCATE_LAYER:
|
||||||
|
|
||||||
|
LayerItem layerItem = doLayerActionEvent.getLayerItem();
|
||||||
|
|
||||||
|
ol.layer.Image layer = olMap.getWmsDetailsLayerMap().get(layerItem.getName());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ExtentWrapped sourceExt = olMap.getSourceExtentForLayer(layerItem.getName());
|
||||||
|
|
||||||
|
GWT.log("extent: "+sourceExt);
|
||||||
|
|
||||||
|
// BoundsMap theBBOX = new BoundsMap(layer.getExtent().getLowerLeftX(), layer.getExtent().getLowerLeftY(), layer.getExtent().getUpperRightX(), layer.getExtent().getUpperRightY(),
|
||||||
|
// null);
|
||||||
|
|
||||||
|
// Coordinate lower = OLFactory.createCoordinate(olMap.getBBOX().getLowerLeftX(), olMap.getBBOX().getLowerLeftY());
|
||||||
|
// Coordinate lowerCoord = MapUtils.transformCoordiante(lower, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
|
// MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
//
|
||||||
|
// Coordinate upper = OLFactory.createCoordinate(olMap.getBBOX().getUpperRightX(), olMap.getBBOX().getUpperRightY());
|
||||||
|
// Coordinate upperCoord = MapUtils.transformCoordiante(upper, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
|
// MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
|
||||||
|
|
||||||
|
BoundsMap theBBOX = new BoundsMap(sourceExt.getLowerLeftX(), sourceExt.getLowerLeftY(), sourceExt.getUpperRightX(), sourceExt.getUpperRightY(), null);
|
||||||
|
GWT.log("theBBOX: "+theBBOX);
|
||||||
|
// if (bbox != null) {
|
||||||
|
|
||||||
|
// Coordinate lower = OLFactory.createCoordinate(olMap.getBBOX().getLowerLeftX(), olMap.getBBOX().getLowerLeftY());
|
||||||
|
// Coordinate lowerCoord = MapUtils.transformCoordiante(lower, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
|
// MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
//
|
||||||
|
// Coordinate upper = OLFactory.createCoordinate(olMap.getBBOX().getUpperRightX(), olMap.getBBOX().getUpperRightY());
|
||||||
|
// Coordinate upperCoord = MapUtils.transformCoordiante(upper, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
|
// MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
//
|
||||||
|
// ew = new ExtentWrapped(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(), upperCoord.getY());
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getWFSRequest(layerItem,
|
||||||
|
olMap.getProjectionCode(), null, 0, "json",
|
||||||
|
new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String wmsRequestURL) {
|
||||||
|
GWT.log("wmsRequestURL: "+wmsRequestURL);
|
||||||
|
|
||||||
|
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, wmsRequestURL);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Request response = builder.sendRequest(null, new RequestCallback() {
|
||||||
|
public void onError(Request request, Throwable exception) {
|
||||||
|
// Code omitted for clarity
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onResponseReceived(Request request, Response response) {
|
||||||
|
GWT.log("GeoJSON: "+response.getText());
|
||||||
|
|
||||||
|
GeoJsonFeatureOptions fo = new GeoJsonFeatureOptions();
|
||||||
|
ProjectionOptions projectionOptions = new ProjectionOptions();
|
||||||
|
projectionOptions.setCode(MAP_PROJECTION.EPSG_3857.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(response.getText());
|
||||||
|
GWT.log("features: "+features);
|
||||||
|
//Feature[] features = new GeoJson().readFeatures(jsonObject, projectionOptions);
|
||||||
|
olMap.addFeaturesAsHighlight(features);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (RequestException e) {
|
||||||
|
// Code omitted for clarity
|
||||||
|
}
|
||||||
|
|
||||||
|
//olMap.locateLayer(doLayerActionEvent.getLayerItem());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -576,7 +691,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
applicationBus.addHandler(ChangeMapLayerEvent.TYPE, new ChangeMapLayerEventHandler() {
|
applicationBus.addHandler(ChangeMapLayerEvent.TYPE, new ChangeMapLayerEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -686,6 +801,17 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the.
|
||||||
|
*
|
||||||
|
* @param json the json
|
||||||
|
*/
|
||||||
|
public static native Object toJSON(String json) /*-{
|
||||||
|
var jsonObj = JSON.parse(json);
|
||||||
|
//console.log("jsonObj: "+jsonObj);
|
||||||
|
return jsonObj;
|
||||||
|
}-*/;
|
||||||
// /**
|
// /**
|
||||||
// * Handler popu closer.
|
// * Handler popu closer.
|
||||||
// *
|
// *
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class GeoportalDataViewerConstants {
|
||||||
* @param msg the msg
|
* @param msg the msg
|
||||||
*/
|
*/
|
||||||
public static native void printJs(String msg)/*-{
|
public static native void printJs(String msg)/*-{
|
||||||
console.log("js console: " + msg);
|
//console.log("js console: " + msg);
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,7 +96,7 @@ public class GeoportalDataViewerConstants {
|
||||||
* @param msg the msg
|
* @param msg the msg
|
||||||
*/
|
*/
|
||||||
public static native void printJsObj(Object object)/*-{
|
public static native void printJsObj(Object object)/*-{
|
||||||
console.log("js obj: " + JSON.stringify(object, null, 4));
|
//console.log("js obj: " + JSON.stringify(object, null, 4));
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
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;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
|
||||||
|
@ -179,4 +180,17 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
GeoJSON getSpatialReference(String profileID, String projectID);
|
GeoJSON getSpatialReference(String profileID, String projectID);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the WFS request.
|
||||||
|
*
|
||||||
|
* @param layerItem the layer item
|
||||||
|
* @param mapSrsName the map srs name
|
||||||
|
* @param mapBBOX the map BBOX
|
||||||
|
* @param maxFeatures the max features. If 0 means all feature
|
||||||
|
* @param outputFormat the output format
|
||||||
|
* @return the WFS request
|
||||||
|
*/
|
||||||
|
String getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||||
|
String outputFormat);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
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;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
|
||||||
|
@ -75,4 +76,7 @@ public interface GeoportalDataViewerServiceAsync {
|
||||||
|
|
||||||
void getSpatialReference(String profileID, String projectID, AsyncCallback<GeoJSON> callback);
|
void getSpatialReference(String profileID, String projectID, AsyncCallback<GeoJSON> callback);
|
||||||
|
|
||||||
|
void getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat,
|
||||||
|
AsyncCallback<String> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
|
||||||
* Oct 12, 2021
|
* Oct 12, 2021
|
||||||
*/
|
*/
|
||||||
public static enum DO_LAYER_ACTION {
|
public static enum DO_LAYER_ACTION {
|
||||||
VISIBILITY, SWAP, OPACITY
|
VISIBILITY, SWAP, OPACITY, LOCATE_LAYER
|
||||||
}
|
}
|
||||||
|
|
||||||
private DO_LAYER_ACTION doAction;
|
private DO_LAYER_ACTION doAction;
|
||||||
|
|
|
@ -37,8 +37,10 @@ import ol.Size;
|
||||||
import ol.View;
|
import ol.View;
|
||||||
import ol.ViewOptions;
|
import ol.ViewOptions;
|
||||||
import ol.animation.AnimationOptions;
|
import ol.animation.AnimationOptions;
|
||||||
|
import ol.color.Color;
|
||||||
import ol.event.EventListener;
|
import ol.event.EventListener;
|
||||||
import ol.geom.Geometry;
|
import ol.geom.Geometry;
|
||||||
|
import ol.geom.Point;
|
||||||
import ol.interaction.Draw;
|
import ol.interaction.Draw;
|
||||||
import ol.interaction.DrawOptions;
|
import ol.interaction.DrawOptions;
|
||||||
import ol.interaction.Extent;
|
import ol.interaction.Extent;
|
||||||
|
@ -62,6 +64,12 @@ import ol.source.Source;
|
||||||
import ol.source.Vector;
|
import ol.source.Vector;
|
||||||
import ol.source.Xyz;
|
import ol.source.Xyz;
|
||||||
import ol.source.XyzOptions;
|
import ol.source.XyzOptions;
|
||||||
|
import ol.style.Fill;
|
||||||
|
import ol.style.FillOptions;
|
||||||
|
import ol.style.Stroke;
|
||||||
|
import ol.style.StrokeOptions;
|
||||||
|
import ol.style.Style;
|
||||||
|
import ol.style.TextOptions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class OpenLayerMap.
|
* The Class OpenLayerMap.
|
||||||
|
@ -520,6 +528,37 @@ public abstract class OpenLayerMap {
|
||||||
GWT.log("The WMS detail layer with key: " + key + " already exists, skipping");
|
GWT.log("The WMS detail layer with key: " + key + " already exists, skipping");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void locateLayer(LayerItem layerItem) {
|
||||||
|
|
||||||
|
String key = layerItem.getName();
|
||||||
|
Image layer = wmsDetailsLayerMap.get(key);
|
||||||
|
|
||||||
|
Source source = layer.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);
|
||||||
|
|
||||||
|
// layer.get("geometry");
|
||||||
|
// GWT.log("The geometry is: "+layer.getSource().get("geometry"));
|
||||||
|
|
||||||
|
// Point thePoint = new Point(coordinate);
|
||||||
|
// Feature vf = new Feature(layer.getExtent());
|
||||||
|
// vf.setStyle(style);
|
||||||
|
// ol.source.Vector vector = new ol.source.Vector();
|
||||||
|
// vector.addFeature(vf);
|
||||||
|
// VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
||||||
|
// vectorLayerOptions.setSource(vector);
|
||||||
|
// ol.layer.Vector geometryLayer = new ol.layer.Vector(vectorLayerOptions);
|
||||||
|
// int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR)+1;
|
||||||
|
// geometryLayer.setZIndex(zIndex);
|
||||||
|
// map.addLayer(geometryLayer);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -574,12 +613,12 @@ public abstract class OpenLayerMap {
|
||||||
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
||||||
vectorLayerOptions.setMap(map);
|
vectorLayerOptions.setMap(map);
|
||||||
|
|
||||||
// Style style = new Style();
|
Style style = new Style();
|
||||||
// FillOptions fillOptions = new FillOptions();
|
FillOptions fillOptions = new FillOptions();
|
||||||
// Color color = new Color(0, 0, 255, 1.0);
|
Color color = new Color(0, 0, 255, 1.0);
|
||||||
// fillOptions.setColor(color);
|
fillOptions.setColor(color);
|
||||||
// Fill fill = new Fill(fillOptions);
|
Fill fill = new Fill(fillOptions);
|
||||||
// style.setFill(fill);
|
style.setFill(fill);
|
||||||
|
|
||||||
FeatureOptions featureOptions = new FeatureOptions();
|
FeatureOptions featureOptions = new FeatureOptions();
|
||||||
featureOptions.setGeometry(geometry);
|
featureOptions.setGeometry(geometry);
|
||||||
|
@ -591,11 +630,57 @@ public abstract class OpenLayerMap {
|
||||||
|
|
||||||
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
|
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
|
||||||
|
|
||||||
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR) + 1;
|
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR) + 1000;
|
||||||
vector.setZIndex(zIndex);
|
vector.setZIndex(zIndex);
|
||||||
|
|
||||||
map.addLayer(vector);
|
map.addLayer(vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the vector.
|
||||||
|
*
|
||||||
|
* @param geometry the geometry
|
||||||
|
*/
|
||||||
|
public void addFeaturesAsHighlight(Feature[] features) {
|
||||||
|
|
||||||
|
Style style = new Style();
|
||||||
|
|
||||||
|
|
||||||
|
StrokeOptions strokeOptions = new StrokeOptions();
|
||||||
|
strokeOptions.setColor(new Color(255, 255, 255, 1.0));
|
||||||
|
strokeOptions.setWidth(5);
|
||||||
|
Stroke stroke = new Stroke(strokeOptions);
|
||||||
|
stroke.setWidth(5);
|
||||||
|
FillOptions fillOptions = new FillOptions();
|
||||||
|
fillOptions.setColor(new Color(0, 0, 255, 1.0));
|
||||||
|
|
||||||
|
|
||||||
|
// FillOptions fillOptions = new FillOptions();
|
||||||
|
// fillOptions.setColor(color);
|
||||||
|
// Fill fill = new Fill(fillOptions);
|
||||||
|
|
||||||
|
// style.setFill(fill);
|
||||||
|
Vector vectorSource = OLFactory.createVectorSource();
|
||||||
|
vectorSource.addFeatures(features);
|
||||||
|
|
||||||
|
GWT.log("features: "+features);
|
||||||
|
|
||||||
|
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
||||||
|
vectorLayerOptions.setSource(vectorSource);
|
||||||
|
vectorLayerOptions.setStyle(style);
|
||||||
|
|
||||||
|
//vectorLayerOptions.setMap(map);
|
||||||
|
|
||||||
|
GWT.log("vectorLayerOptions: "+vectorLayerOptions);
|
||||||
|
|
||||||
|
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
|
||||||
|
vector.setStyle(style);
|
||||||
|
vector.setVisible(true);
|
||||||
|
vector.setZIndex(11000);
|
||||||
|
|
||||||
|
|
||||||
|
map.addLayer(vector);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the point vector source.
|
* Adds the point vector source.
|
||||||
|
@ -868,6 +953,7 @@ public abstract class OpenLayerMap {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the wms details layer map.
|
* Gets the wms details layer map.
|
||||||
*
|
*
|
||||||
|
@ -929,6 +1015,8 @@ public abstract class OpenLayerMap {
|
||||||
Image layer = wmsDetailsLayerMap.get(key);
|
Image layer = wmsDetailsLayerMap.get(key);
|
||||||
layer.setOpacity(opacity);
|
layer.setOpacity(opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swap details layers.
|
* Swap details layers.
|
||||||
|
@ -967,6 +1055,7 @@ public abstract class OpenLayerMap {
|
||||||
return map.get((map.keySet().toArray())[index]);
|
return map.get((map.keySet().toArray())[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class ImagesSectionGallery {
|
||||||
*/
|
*/
|
||||||
private native void showGallery(JavaScriptObject json_array_images, String galleryDivId) /*-{
|
private native void showGallery(JavaScriptObject json_array_images, String galleryDivId) /*-{
|
||||||
|
|
||||||
console.log("showing: " + json_array_images)
|
//console.log("showing: " + json_array_images)
|
||||||
var waitForJQuery = setInterval(
|
var waitForJQuery = setInterval(
|
||||||
function() {
|
function() {
|
||||||
if (typeof $wnd.$ != 'undefined') {
|
if (typeof $wnd.$ != 'undefined') {
|
||||||
|
|
|
@ -189,7 +189,7 @@ public class LayersSectionViewer extends Composite {
|
||||||
*/
|
*/
|
||||||
public static native void downloadMap(ol.Map map, String mapPanelId, String linkId, String filename,
|
public static native void downloadMap(ol.Map map, String mapPanelId, String linkId, String filename,
|
||||||
String mimeType)/*-{
|
String mimeType)/*-{
|
||||||
console.log("map: " + map);
|
//console.log("map: " + map);
|
||||||
|
|
||||||
map.once('rendercomplete', function() {
|
map.once('rendercomplete', function() {
|
||||||
var mapCanvas = $doc.createElement('canvas');
|
var mapCanvas = $doc.createElement('canvas');
|
||||||
|
|
|
@ -128,12 +128,13 @@ public class TimelineRelationPanel extends Composite {
|
||||||
public void setTimelineContainerVisible(boolean bool) {
|
public void setTimelineContainerVisible(boolean bool) {
|
||||||
timelineContainer.setVisible(bool);
|
timelineContainer.setVisible(bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called when a project (box) is clicked into Timeline
|
* Called when a project (box) is clicked into Timeline
|
||||||
*/
|
*/
|
||||||
private void setSelectedProject(String theComposedProjectID) {
|
private void setSelectedProject(String theComposedProjectID) {
|
||||||
this.selectedTimelineProjectID = theComposedProjectID;
|
this.selectedTimelineProjectID = theComposedProjectID;
|
||||||
//selectedTimelineProjectID is the couple ProfileID,ProjectID
|
// selectedTimelineProjectID is the couple ProfileID,ProjectID
|
||||||
GWT.log("selectedTimelineProjectID: " + selectedTimelineProjectID);
|
GWT.log("selectedTimelineProjectID: " + selectedTimelineProjectID);
|
||||||
|
|
||||||
if (selectedTimelineProjectID == null || selectedTimelineProjectID.isEmpty())
|
if (selectedTimelineProjectID == null || selectedTimelineProjectID.isEmpty())
|
||||||
|
@ -144,7 +145,8 @@ public class TimelineRelationPanel extends Composite {
|
||||||
final String thePofileID = references[0];
|
final String thePofileID = references[0];
|
||||||
final String theProjectID = references[1];
|
final String theProjectID = references[1];
|
||||||
GeoportalItemReferences gir = new GeoportalItemReferences(theProjectID, thePofileID);
|
GeoportalItemReferences gir = new GeoportalItemReferences(theProjectID, thePofileID);
|
||||||
ShowDetailsEvent showDetailsEvent = new ShowDetailsEvent(gir, null, false, false, EVENT_SOURCE.LOCATE_FROM_TIMELINE);
|
ShowDetailsEvent showDetailsEvent = new ShowDetailsEvent(gir, null, false, false,
|
||||||
|
EVENT_SOURCE.LOCATE_FROM_TIMELINE);
|
||||||
showDetailsEvent.setEventFromTimeline(true);
|
showDetailsEvent.setEventFromTimeline(true);
|
||||||
GWT.log("fireEvent: " + showDetailsEvent);
|
GWT.log("fireEvent: " + showDetailsEvent);
|
||||||
|
|
||||||
|
@ -157,19 +159,19 @@ public class TimelineRelationPanel extends Composite {
|
||||||
|
|
||||||
public static native String instanceTimeline(String idDivContainer, JSONArray jsonItems,
|
public static native String instanceTimeline(String idDivContainer, JSONArray jsonItems,
|
||||||
TimelineRelationPanel instance) /*-{
|
TimelineRelationPanel instance) /*-{
|
||||||
console.log('showTimeline_instanceTimeline for json items: '
|
console.log('showing timeline');
|
||||||
+ jsonItems);
|
//console.log('showTimeline_instanceTimeline for json items: '+jsonItems);
|
||||||
|
|
||||||
console.log("showTimeline_template: " + $wnd.templateHandlebars);
|
//console.log("showTimeline_template: " + $wnd.templateHandlebars);
|
||||||
|
|
||||||
// DOM element where the Timeline will be attached
|
// DOM element where the Timeline will be attached
|
||||||
var container = $doc.getElementById(idDivContainer);
|
var container = $doc.getElementById(idDivContainer);
|
||||||
|
|
||||||
console.log("showTimeline_container: " + container);
|
//console.log("showTimeline_container: " + container);
|
||||||
|
|
||||||
var myArray = $wnd.JSON.parse(jsonItems);
|
var myArray = $wnd.JSON.parse(jsonItems);
|
||||||
|
|
||||||
console.log("showTimeline_jsonItems: " + myArray);
|
//console.log("showTimeline_jsonItems: " + myArray);
|
||||||
|
|
||||||
var container = $doc.getElementById(idDivContainer);
|
var container = $doc.getElementById(idDivContainer);
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ public class DragDropLayer extends FlowPanel {
|
||||||
private com.google.gwt.user.client.ui.Label labelProject;
|
private com.google.gwt.user.client.ui.Label labelProject;
|
||||||
private boolean layerVisibility = true;
|
private boolean layerVisibility = true;
|
||||||
private HTML buttonLayerVisibility = new HTML();
|
private HTML buttonLayerVisibility = new HTML();
|
||||||
|
private Button buttonLocate = new Button();
|
||||||
|
|
||||||
public DragDropLayer(HandlerManager applicationBus, LayerObject layerObject, boolean draggable, boolean droppable) {
|
public DragDropLayer(HandlerManager applicationBus, LayerObject layerObject, boolean draggable, boolean droppable) {
|
||||||
this.applicationBus = applicationBus;
|
this.applicationBus = applicationBus;
|
||||||
|
@ -126,10 +127,26 @@ public class DragDropLayer extends FlowPanel {
|
||||||
imgLayerVisible.getElement().addClassName("layer-visibility-st");
|
imgLayerVisible.getElement().addClassName("layer-visibility-st");
|
||||||
imgLayerInvisible.getElement().addClassName("layer-visibility-st");
|
imgLayerInvisible.getElement().addClassName("layer-visibility-st");
|
||||||
setLayerVisibilityButtonImage();
|
setLayerVisibilityButtonImage();
|
||||||
|
|
||||||
|
buttonLocate.setIcon(IconType.MAP_MARKER);
|
||||||
|
buttonLocate.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
|
setLayerVisibilityButtonImage();
|
||||||
|
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.LOCATE_LAYER,
|
||||||
|
layerItem);
|
||||||
|
applicationBus.fireEvent(dae);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
// labelLayerName.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
// labelLayerName.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||||
ft.setWidget(0, 1, buttonLayerVisibility);
|
ft.setWidget(0, 1, buttonLayerVisibility);
|
||||||
ft.setWidget(0, 2, labelProject);
|
ft.setWidget(0, 2, buttonLocate);
|
||||||
|
ft.setWidget(0, 3, labelProject);
|
||||||
|
|
||||||
if(layerObject.getProjectDV().getTemporalReference()!=null) {
|
if(layerObject.getProjectDV().getTemporalReference()!=null) {
|
||||||
TemporalReferenceDV tempRef = layerObject.getProjectDV().getTemporalReference();
|
TemporalReferenceDV tempRef = layerObject.getProjectDV().getTemporalReference();
|
||||||
|
|
|
@ -396,7 +396,7 @@ public class DialogShareableLink extends Composite {
|
||||||
private native void copyToClipboard(String myDivId) /*-{
|
private native void copyToClipboard(String myDivId) /*-{
|
||||||
|
|
||||||
var copyText = $doc.getElementById(myDivId);
|
var copyText = $doc.getElementById(myDivId);
|
||||||
console.log("text copied is :" + copyText.value);
|
//console.log("text copied is :" + copyText.value);
|
||||||
copyText.select();
|
copyText.select();
|
||||||
//For mobile devices
|
//For mobile devices
|
||||||
copyText.setSelectionRange(0, 99999);
|
copyText.setSelectionRange(0, 99999);
|
||||||
|
|
|
@ -60,6 +60,7 @@ import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.GisMakers;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.GeoportalServiceIdentityProxy;
|
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.GeoportalServiceIdentityProxy;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.ContextRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.ContextRequest;
|
||||||
|
@ -72,6 +73,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedData
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
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;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObjectType;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObjectType;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
||||||
|
@ -347,7 +349,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
* @param layerObjects the layer objects
|
* @param layerObjects the layer objects
|
||||||
* @param mapSrsName the map srs name
|
* @param mapSrsName the map srs name
|
||||||
* @param selectBBOX the select BBOX
|
* @param selectBBOX the select BBOX
|
||||||
* @param maxWFSFeature the max WFS feature
|
* @param maxWFSFeature the max WFS feature. If 0 means all feature
|
||||||
* @param zoomLevel the zoom level
|
* @param zoomLevel the zoom level
|
||||||
* @return the WFS features
|
* @return the WFS features
|
||||||
*/
|
*/
|
||||||
|
@ -769,10 +771,11 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
LOG.info("Access policy for discovering the layers is: " + accessPolicy);
|
LOG.info("Access policy for discovering the layers is: " + accessPolicy);
|
||||||
|
|
||||||
String filesetParentJSONPath = null;
|
String filesetParentJSONPath = null;
|
||||||
|
|
||||||
//(see ticket #24390)
|
// (see ticket #24390)
|
||||||
if (accessPolicy.equals(ACCESS_POLICY.OPEN)) {
|
if (accessPolicy.equals(ACCESS_POLICY.OPEN)) {
|
||||||
// Filtering for ACCESS_POLICY.OPEN from the fileset when the username is not in session. IAM
|
// Filtering for ACCESS_POLICY.OPEN from the fileset when the username is not in
|
||||||
|
// session. IAM
|
||||||
// identity is running, no logged in user.
|
// identity is running, no logged in user.
|
||||||
filesetParentJSONPath = String.format("%s..%s[?(@._access._policy=='%s')]",
|
filesetParentJSONPath = String.format("%s..%s[?(@._access._policy=='%s')]",
|
||||||
Geoportal_JSON_Mapper.JSON_$_POINTER, Geoportal_JSON_Mapper.FILESET, accessPolicy);
|
Geoportal_JSON_Mapper.JSON_$_POINTER, Geoportal_JSON_Mapper.FILESET, accessPolicy);
|
||||||
|
@ -894,10 +897,10 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
theProjectDV.setProfileName(ucd.getName());
|
theProjectDV.setProfileName(ucd.getName());
|
||||||
|
|
||||||
TemporalReferenceDV temporalReference = temporalReferenceForProject(theProject);
|
TemporalReferenceDV temporalReference = temporalReferenceForProject(theProject);
|
||||||
|
|
||||||
if (temporalReference == null)
|
if (temporalReference == null)
|
||||||
temporalReference = new TemporalReferenceDV();
|
temporalReference = new TemporalReferenceDV();
|
||||||
|
|
||||||
theProjectDV.setTemporalReference(temporalReference);
|
theProjectDV.setTemporalReference(temporalReference);
|
||||||
|
|
||||||
ProjectView projectView = Geoportal_JSON_Mapper.loadProjectView(theProjectDV, scope, userName);
|
ProjectView projectView = Geoportal_JSON_Mapper.loadProjectView(theProjectDV, scope, userName);
|
||||||
|
@ -1269,7 +1272,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Entry<String, Object> entry = entrySetsIt.next();
|
Entry<String, Object> entry = entrySetsIt.next();
|
||||||
documentAsMap.put(entry.getKey(), entry.getValue()!=null?entry.getValue().toString():null);
|
documentAsMap.put(entry.getKey(), entry.getValue() != null ? entry.getValue().toString() : null);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1539,4 +1542,30 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the WFS request.
|
||||||
|
*
|
||||||
|
* @param layerItem the layer item
|
||||||
|
* @param mapSrsName the map srs name
|
||||||
|
* @param mapBBOX the map BBOX
|
||||||
|
* @param maxFeatures the max features. If 0 means all feature
|
||||||
|
* @param outputFormat the output format
|
||||||
|
* @return the WFS request
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
|
||||||
|
String outputFormat) {
|
||||||
|
LOG.info("getWFSRequest called");
|
||||||
|
|
||||||
|
if (LOG.isDebugEnabled()) {
|
||||||
|
LOG.debug("getWFSRequest parameters layerItem name: " + layerItem.getName(),
|
||||||
|
", mapSrsName: " + mapSrsName + ", mapBBOX: " + mapBBOX + ", maxFeatures: " + maxFeatures
|
||||||
|
+ ", outputFormat: " + outputFormat);
|
||||||
|
}
|
||||||
|
String url = GisMakers.buildWFSFeatureQuery(layerItem, mapSrsName, mapBBOX, maxFeatures, outputFormat);
|
||||||
|
LOG.info("returning WFSRequest: "+url);
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,18 +7,17 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class URLMakers.
|
* The Class URLMakers.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
* Oct 29, 2020
|
* Oct 29, 2020
|
||||||
*/
|
*/
|
||||||
public class GisMakers {
|
public class GisMakers {
|
||||||
|
|
||||||
public static final String CQL_FILTER_PARAMETER = "CQL_FILTER";
|
public static final String CQL_FILTER_PARAMETER = "CQL_FILTER";
|
||||||
|
|
||||||
public static final String GEOM_NAME_BOUNDED = "geom";
|
public static final String GEOM_NAME_BOUNDED = "geom";
|
||||||
|
|
||||||
// MAP SERVER PIVOT
|
// MAP SERVER PIVOT
|
||||||
|
@ -30,53 +29,56 @@ public class GisMakers {
|
||||||
public static final String CSV = "csv";
|
public static final String CSV = "csv";
|
||||||
|
|
||||||
public static final String JSON = "json";
|
public static final String JSON = "json";
|
||||||
|
|
||||||
private static String[][] a = { { "\\?", "%3F" }, { "&", "%26" }, };
|
private static String[][] a = { { "\\?", "%3F" }, { "&", "%26" }, };
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(GisMakers.class);
|
private static final Logger LOG = LoggerFactory.getLogger(GisMakers.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum COORDINATE_FORMAT.
|
* The Enum COORDINATE_FORMAT.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
* Oct 29, 2020
|
* Oct 29, 2020
|
||||||
*/
|
*/
|
||||||
public static enum COORDINATE_FORMAT {
|
public static enum COORDINATE_FORMAT {
|
||||||
XY, YX
|
XY, YX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the WFS feature query.
|
* Builds the WFS feature query.
|
||||||
*
|
*
|
||||||
* @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
|
* @param maxFeatures the max features
|
||||||
* @param outputFormat the output format
|
* @param outputFormat the output format
|
||||||
* @return the string
|
* @return the string
|
||||||
*/
|
*/
|
||||||
public static String buildWFSFeatureQuery(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat) {
|
public static String buildWFSFeatureQuery(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX,
|
||||||
|
int maxFeatures, String outputFormat) {
|
||||||
|
|
||||||
String link = layerItem.getMapServerHost();
|
String link = layerItem.getMapServerHost();
|
||||||
LOG.debug("Map server host URL: " + link);
|
LOG.debug("Map server host URL: " + link);
|
||||||
LOG.debug("CQL filter is: " + layerItem.getCqlFilter());
|
LOG.debug("CQL filter is: " + layerItem.getCqlFilter());
|
||||||
LOG.debug("MAX FEATURES: " + maxFeatures);
|
LOG.debug("MAX FEATURES: " + maxFeatures);
|
||||||
|
LOG.debug("BBOX: " + mapBBOX);
|
||||||
|
LOG.debug("Output Format: " + outputFormat);
|
||||||
|
|
||||||
String outputformat = null;
|
String outputformat = null;
|
||||||
String boundingBox = "";
|
String boundingBox = null;
|
||||||
|
|
||||||
// CASE MAP SERVER
|
// CASE MAP SERVER
|
||||||
SERVERTYPE mapserverType = MapServerRecognize.recongnize(layerItem);
|
SERVERTYPE mapserverType = MapServerRecognize.recongnize(layerItem);
|
||||||
LOG.debug("Recongnized SERVERTYPE: " + mapserverType);
|
LOG.debug("Recongnized SERVERTYPE: " + mapserverType);
|
||||||
|
|
||||||
|
|
||||||
if (mapserverType != null) {
|
if (mapserverType != null) {
|
||||||
if (mapserverType.equals(SERVERTYPE.MAPSERVER)) {
|
if (mapserverType.equals(SERVERTYPE.MAPSERVER)) {
|
||||||
LOG.debug("wms url contains wxs is a map server? no appending /wfs ");
|
LOG.debug("wms url contains wxs is a map server? no appending /wfs ");
|
||||||
outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.MAPSERVER, outputFormat);
|
outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.MAPSERVER, outputFormat);
|
||||||
boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",",mapBBOX.getLowerLeftX(),mapBBOX.getLowerLeftY(),mapBBOX.getUpperRightX(),mapBBOX.getUpperRightY()); // USE AXIS XY
|
if (mapBBOX != null)
|
||||||
|
boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",", mapBBOX.getLowerLeftX(),
|
||||||
|
mapBBOX.getLowerLeftY(), mapBBOX.getUpperRightX(), mapBBOX.getUpperRightY()); // USE AXIS XY
|
||||||
// DEBUG
|
// DEBUG
|
||||||
LOG.debug("SERVERTYPE.MAPSERVER outputformat: " + outputformat);
|
LOG.debug("SERVERTYPE.MAPSERVER outputformat: " + outputformat);
|
||||||
LOG.debug("SERVERTYPE.MAPSERVER srsName: " + mapSrsName);
|
LOG.debug("SERVERTYPE.MAPSERVER srsName: " + mapSrsName);
|
||||||
|
@ -85,8 +87,10 @@ public class GisMakers {
|
||||||
LOG.debug("is geoserver appending suffix /wfs if is not present");
|
LOG.debug("is geoserver appending suffix /wfs if is not present");
|
||||||
link += link.endsWith("wfs") ? "" : "/wfs";
|
link += link.endsWith("wfs") ? "" : "/wfs";
|
||||||
outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.GEOSEVER, outputFormat);
|
outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.GEOSEVER, outputFormat);
|
||||||
mapSrsName = "urn:x-ogc:def:crs:"+mapSrsName;
|
mapSrsName = "urn:x-ogc:def:crs:" + mapSrsName;
|
||||||
boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",",mapBBOX.getLowerLeftX(),mapBBOX.getLowerLeftY(),mapBBOX.getUpperRightX(),mapBBOX.getUpperRightY()); // USE AXIS XY
|
if (mapBBOX != null)
|
||||||
|
boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",", mapBBOX.getLowerLeftX(),
|
||||||
|
mapBBOX.getLowerLeftY(), mapBBOX.getUpperRightX(), mapBBOX.getUpperRightY()); // USE AXIS XY
|
||||||
// DEBUG
|
// DEBUG
|
||||||
LOG.debug("SERVERTYPE.GEOSEVER outputformat: " + outputformat);
|
LOG.debug("SERVERTYPE.GEOSEVER outputformat: " + outputformat);
|
||||||
LOG.debug("SERVERTYPE.GEOSEVER srsName: " + mapSrsName);
|
LOG.debug("SERVERTYPE.GEOSEVER srsName: " + mapSrsName);
|
||||||
|
@ -98,23 +102,31 @@ public class GisMakers {
|
||||||
// + (outputformat == null ? "" : "&OUTPUTFORMAT=" + outputformat);
|
// + (outputformat == null ? "" : "&OUTPUTFORMAT=" + outputformat);
|
||||||
//
|
//
|
||||||
|
|
||||||
link += "?"+
|
link += "?"
|
||||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.SERVICE.getParameter(), WFSGetFeature.SERVICE.getValue(), false, true)+
|
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.SERVICE.getParameter(),
|
||||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.VERSION.getParameter(), WFSGetFeature.VERSION.getValue(), false, true)+
|
WFSGetFeature.SERVICE.getValue(), false, true)
|
||||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.REQUEST.getParameter(), WFSGetFeature.REQUEST.getValue(), false, true)+
|
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.VERSION.getParameter(),
|
||||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.SRSNAME.getParameter(), mapSrsName, false, true)+
|
WFSGetFeature.VERSION.getValue(), false, true)
|
||||||
URLParserUtil.addParameterToQueryString(WFSGetFeature.TYPENAME.getParameter(), layerItem.getName(), false, true)+
|
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.REQUEST.getParameter(),
|
||||||
(maxFeatures == 0 ? "" : URLParserUtil.addParameterToQueryString(WFSGetFeature.MAXFEATURES.getParameter(), maxFeatures+"", false, true))+
|
WFSGetFeature.REQUEST.getValue(), false, true)
|
||||||
(outputformat == null ? "" : URLParserUtil.addParameterToQueryString(WFSGetFeature.OUTPUTFORMAT.getParameter(), outputformat, false, false));
|
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.SRSNAME.getParameter(), mapSrsName, false, true)
|
||||||
|
+ URLParserUtil.addParameterToQueryString(WFSGetFeature.TYPENAME.getParameter(), layerItem.getName(),
|
||||||
|
false, true)
|
||||||
|
+ (maxFeatures == 0 ? ""
|
||||||
|
: URLParserUtil.addParameterToQueryString(WFSGetFeature.MAXFEATURES.getParameter(),
|
||||||
|
maxFeatures + "", false, true))
|
||||||
|
+ (outputformat == null ? ""
|
||||||
|
: URLParserUtil.addParameterToQueryString(WFSGetFeature.OUTPUTFORMAT.getParameter(),
|
||||||
|
outputformat, false, false));
|
||||||
|
|
||||||
if (layerItem.getCqlFilter() != null && !layerItem.getCqlFilter().isEmpty()) {
|
if (layerItem.getCqlFilter() != null && !layerItem.getCqlFilter().isEmpty()) {
|
||||||
if (layerItem.getCqlFilter().contains("BBOX("+GEOM_NAME_BOUNDED+"")) {
|
if (layerItem.getCqlFilter().contains("BBOX(" + GEOM_NAME_BOUNDED + "")) {
|
||||||
// THE BBOX IS ALREADY USED INTO CQL FILTERING, SO USING IT DIRECTLY
|
// THE BBOX IS ALREADY USED INTO CQL FILTERING, SO USING IT DIRECTLY
|
||||||
link += "&" + CQL_FILTER_PARAMETER + "=" + layerItem.getCqlFilter();
|
link += "&" + CQL_FILTER_PARAMETER + "=" + layerItem.getCqlFilter();
|
||||||
} else {
|
} else {
|
||||||
// I NEED TO ENCODE THE BBOX INTO CQL FILTERING,
|
// I NEED TO ENCODE THE BBOX INTO CQL FILTERING,
|
||||||
String cqlFilterValue = "BBOX("+GEOM_NAME_BOUNDED+"," + boundingBox + ")" + " AND " + layerItem.getCqlFilter();
|
String cqlFilterValue = "BBOX(" + GEOM_NAME_BOUNDED + "," + boundingBox + ")" + " AND "
|
||||||
|
+ layerItem.getCqlFilter();
|
||||||
|
|
||||||
link += "&" + CQL_FILTER_PARAMETER + "=" + cqlFilterValue;
|
link += "&" + CQL_FILTER_PARAMETER + "=" + cqlFilterValue;
|
||||||
}
|
}
|
||||||
|
@ -172,44 +184,30 @@ public class GisMakers {
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Format.
|
* Format.
|
||||||
*
|
*
|
||||||
* @param format the format
|
* @param format the format
|
||||||
* @param separator the separator
|
* @param separator the separator
|
||||||
* @return the string
|
* @return the string
|
||||||
*/
|
*/
|
||||||
public static String BBOX_FORMAT(COORDINATE_FORMAT format, String separator, double lowerLeftX, double lowerLeftY, double upperRightX, double upperRightY) {
|
public static String BBOX_FORMAT(COORDINATE_FORMAT format, String separator, double lowerLeftX, double lowerLeftY,
|
||||||
|
double upperRightX, double upperRightY) {
|
||||||
if(format==null)
|
|
||||||
|
if (format == null)
|
||||||
format = COORDINATE_FORMAT.XY;
|
format = COORDINATE_FORMAT.XY;
|
||||||
|
|
||||||
if(separator==null)
|
if (separator == null)
|
||||||
separator = ",";
|
separator = ",";
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case XY:
|
case XY:
|
||||||
return String.format("%s%s%s%s%s%s%s",
|
return String.format("%s%s%s%s%s%s%s", String.valueOf(lowerLeftX), separator, String.valueOf(lowerLeftY),
|
||||||
String.valueOf(lowerLeftX),
|
separator, String.valueOf(upperRightX), separator, String.valueOf(upperRightY));
|
||||||
separator,
|
|
||||||
String.valueOf(lowerLeftY),
|
|
||||||
separator,
|
|
||||||
String.valueOf(upperRightX),
|
|
||||||
separator,
|
|
||||||
String.valueOf(upperRightY)
|
|
||||||
);
|
|
||||||
case YX:
|
case YX:
|
||||||
return String.format("%s%s%s%s%s%s%s",
|
return String.format("%s%s%s%s%s%s%s", String.valueOf(lowerLeftY), separator, String.valueOf(lowerLeftX),
|
||||||
String.valueOf(lowerLeftY),
|
separator, String.valueOf(upperRightY), separator, String.valueOf(upperRightX));
|
||||||
separator,
|
|
||||||
String.valueOf(lowerLeftX),
|
|
||||||
separator,
|
|
||||||
String.valueOf(upperRightY),
|
|
||||||
separator,
|
|
||||||
String.valueOf(upperRightX)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue