implementing task #21946
This commit is contained in:
parent
97db5d2c12
commit
b2e6830bbe
|
@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
|
|
||||||
[#21890] Porting to ConcessioniManagerI and pass to mongoID
|
[#21890] Porting to ConcessioniManagerI and pass to mongoID
|
||||||
[#20595] Porting and using the model view provided by geoportal-common
|
[#20595] Porting and using the model view provided by geoportal-common
|
||||||
|
[#21946] Show layers of a concessione automatically on map according to zoom level
|
||||||
|
|
||||||
## [v1.2.0-SNAPSHOT] - 2021-07-19
|
## [v1.2.0-SNAPSHOT] - 2021-07-19
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,11 @@ The GeoPortal Data Viewer App is an application to access, discovery and navigat
|
||||||
* [OpenJDK](https://openjdk.java.net/) - The JDK used
|
* [OpenJDK](https://openjdk.java.net/) - The JDK used
|
||||||
* [Maven](https://maven.apache.org/) - Dependency Management
|
* [Maven](https://maven.apache.org/) - Dependency Management
|
||||||
|
|
||||||
|
** Uses **
|
||||||
|
|
||||||
|
* [GWT-OL3](https://github.com/TDesjardins/gwt-ol) GWT-OpenLayers 3+ v.8.0.0-gwt2_9
|
||||||
|
* [OpenLayers](https://openlayers.org/) OpenLayers v.6.X
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
N/A
|
N/A
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
|
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;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
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.ClosedViewDetailsEvent;
|
||||||
|
@ -167,7 +168,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
GWT.log("The layerItem is: " + layerItem);
|
GWT.log("The layerItem is: " + layerItem);
|
||||||
layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false,
|
layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false,
|
||||||
null, true);
|
null, false);
|
||||||
|
|
||||||
if (paramGeonaItemID != null) {
|
if (paramGeonaItemID != null) {
|
||||||
if (paramGeonaItemType == null) {
|
if (paramGeonaItemType == null) {
|
||||||
|
@ -308,6 +309,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
if(mainPanel.getDisplyedRecord()==null && !olMapMng.isQueryPointActive()) {
|
if(mainPanel.getDisplyedRecord()==null && !olMapMng.isQueryPointActive()) {
|
||||||
olMapMng.hidePopInfo();
|
olMapMng.hidePopInfo();
|
||||||
|
olMapMng.removeDetailLayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -337,7 +339,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
GeoQuery select = olMapMng.toDataPointQuery(transfCoord,false);
|
GeoQuery select = olMapMng.toDataPointQuery(transfCoord,false);
|
||||||
GWT.log("GeoQuery: "+select);
|
GWT.log("GeoQuery: "+select);
|
||||||
//GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
|
//GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
|
||||||
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, transfCoord, record.getItemId(), true));
|
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, transfCoord, record.getItemId(), true, MapEventType.ADDED_LAYER_TO_MAP));
|
||||||
}else {
|
}else {
|
||||||
GeoportalDataViewerConstants.printJs("I cannot select the point one or both coordiantes are null. X: "+x +", Y:"+y);
|
GeoportalDataViewerConstants.printJs("I cannot select the point one or both coordiantes are null. X: "+x +", Y:"+y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@ public class GeoportalDataViewerConstants {
|
||||||
public static final String GET_ZOOM = OpenLayersMapParameters.OL_MAP_PARAM.zoom.name();
|
public static final String GET_ZOOM = OpenLayersMapParameters.OL_MAP_PARAM.zoom.name();
|
||||||
public static final String GET_CENTER_MAP_TO_LONG_LAT = OpenLayersMapParameters.OL_MAP_PARAM.centermap.name();
|
public static final String GET_CENTER_MAP_TO_LONG_LAT = OpenLayersMapParameters.OL_MAP_PARAM.centermap.name();
|
||||||
|
|
||||||
|
public static enum MapEventType {INIT, MAP_ZOOM_END, MOVE_END, ADDED_LAYER_TO_MAP}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum LayerType.
|
* The Enum LayerType.
|
||||||
*
|
*
|
||||||
|
|
|
@ -111,4 +111,17 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
List<LayerConcessioneDV> getLayersForId(String itemType, String itemId) throws Exception;
|
List<LayerConcessioneDV> getLayersForId(String itemType, String itemId) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the WFS features.
|
||||||
|
*
|
||||||
|
* @param layerObjects the layer objects
|
||||||
|
* @param mapSrsName the map srs name
|
||||||
|
* @param selectBBOX the select BBOX
|
||||||
|
* @param maxWFSFeature the max WFS feature
|
||||||
|
* @param zoomLevel the zoom level
|
||||||
|
* @return the WFS features
|
||||||
|
*/
|
||||||
|
List<GeoNaSpatialQueryResult> getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName,
|
||||||
|
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,4 +54,7 @@ public interface GeoportalDataViewerServiceAsync {
|
||||||
void getLayersForId(String itemType, String itemId,
|
void getLayersForId(String itemType, String itemId,
|
||||||
AsyncCallback<List<LayerConcessioneDV>> asyncCallback);
|
AsyncCallback<List<LayerConcessioneDV>> asyncCallback);
|
||||||
|
|
||||||
|
void getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature,
|
||||||
|
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,10 @@ import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
|
||||||
|
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;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
||||||
|
@ -63,7 +65,7 @@ public class LayerManager {
|
||||||
/** The ol map. */
|
/** The ol map. */
|
||||||
private OpenLayerOSM olMap;
|
private OpenLayerOSM olMap;
|
||||||
|
|
||||||
private List<LayerObject> layerObjects = new ArrayList<LayerObject>();
|
private Map<String, LayerObject> layerObjects = new HashMap<String, LayerObject>();
|
||||||
|
|
||||||
private HandlerManager layerManagerBus = new HandlerManager("");
|
private HandlerManager layerManagerBus = new HandlerManager("");
|
||||||
|
|
||||||
|
@ -98,7 +100,7 @@ public class LayerManager {
|
||||||
GWT.log("(" + selectDataInfo.getX1() + "," + selectDataInfo.getY1() + ")(" + selectDataInfo.getX2()
|
GWT.log("(" + selectDataInfo.getX1() + "," + selectDataInfo.getY1() + ")(" + selectDataInfo.getX2()
|
||||||
+ "," + selectDataInfo.getY2() + ")");
|
+ "," + selectDataInfo.getY2() + ")");
|
||||||
|
|
||||||
for (LayerObject layerObj : layerObjects) {
|
for (LayerObject layerObj : layerObjects.values()) {
|
||||||
// TODO
|
// TODO
|
||||||
isLayerVisible(layerObj.getLayerItem());
|
isLayerVisible(layerObj.getLayerItem());
|
||||||
|
|
||||||
|
@ -141,10 +143,10 @@ public class LayerManager {
|
||||||
GWT.log("Bounds is: " + mapBBOX);
|
GWT.log("Bounds is: " + mapBBOX);
|
||||||
GWT.log("MAX_WFS_FEATURES is: " + GeoportalDataViewerConstants.MAX_WFS_FEATURES);
|
GWT.log("MAX_WFS_FEATURES is: " + GeoportalDataViewerConstants.MAX_WFS_FEATURES);
|
||||||
// GeoportalDataViewerConstants.print("calling getDataResult");
|
// GeoportalDataViewerConstants.print("calling getDataResult");
|
||||||
|
List<LayerObject> listLO = new ArrayList<LayerObject>(layerObjects.values());
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getDataResult(layerObjects,
|
GeoportalDataViewerServiceAsync.Util.getInstance().getDataResult(listLO, olMap.getProjectionCode(),
|
||||||
olMap.getProjectionCode(), mapBBOX, GeoportalDataViewerConstants.MAX_WFS_FEATURES,
|
mapBBOX, GeoportalDataViewerConstants.MAX_WFS_FEATURES, olMap.getCurrentZoomLevel(),
|
||||||
olMap.getCurrentZoomLevel(), new AsyncCallback<List<GeoNaSpatialQueryResult>>() {
|
new AsyncCallback<List<GeoNaSpatialQueryResult>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -184,7 +186,7 @@ public class LayerManager {
|
||||||
.get("product_id");
|
.get("product_id");
|
||||||
theProductId = productIdLst.get(0);
|
theProductId = productIdLst.get(0);
|
||||||
try {
|
try {
|
||||||
//long productId = Long.parseLong(thePID);
|
// long productId = Long.parseLong(thePID);
|
||||||
if (theProductId == mongoItemId) {
|
if (theProductId == mongoItemId) {
|
||||||
feature = fRow;
|
feature = fRow;
|
||||||
GWT.log("Found recorId == product_id with id: "
|
GWT.log("Found recorId == product_id with id: "
|
||||||
|
@ -202,6 +204,12 @@ public class LayerManager {
|
||||||
feature = features.get(0);
|
feature = features.get(0);
|
||||||
List<String> productIdLst = feature.getMapProperties()
|
List<String> productIdLst = feature.getMapProperties()
|
||||||
.get("product_id");
|
.get("product_id");
|
||||||
|
if (productIdLst == null) {
|
||||||
|
// in this case the feature returned is a (detail) layer belonging
|
||||||
|
// to a record/concessione (not centroid layer),
|
||||||
|
// so returning
|
||||||
|
return;
|
||||||
|
}
|
||||||
theProductId = productIdLst.get(0);
|
theProductId = productIdLst.get(0);
|
||||||
} else {
|
} else {
|
||||||
// the recordId to show has been passed but not found into list of
|
// the recordId to show has been passed but not found into list of
|
||||||
|
@ -211,10 +219,13 @@ public class LayerManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GWT.log("the product id is: "+theProductId);
|
GWT.log("the product id is: " + theProductId);
|
||||||
|
|
||||||
/*if(olMap.getCurrentZoomLevel()>10) {
|
// retrieving and showing WMS layers of a concessione if the ZOOM level is > QUERY_MIN_ZOOM_LEVEL
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getLayersForId("concessione", theProductId, new AsyncCallback<List<LayerConcessioneDV>>() {
|
if (olMap.getCurrentZoomLevel() > OLMapManager.QUERY_MIN_ZOOM_LEVEL) {
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getLayersForId(
|
||||||
|
"concessione", theProductId,
|
||||||
|
new AsyncCallback<List<LayerConcessioneDV>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -224,9 +235,11 @@ public class LayerManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<LayerConcessioneDV> result) {
|
public void onSuccess(List<LayerConcessioneDV> result) {
|
||||||
GWT.log("Adding layers: "+result);
|
GWT.log("Adding layers: " + result);
|
||||||
for (LayerConcessioneDV layer : result) {
|
for (LayerConcessioneDV layer : result) {
|
||||||
addLayer("concessione", layer.getLayerName(), layer.getLayerName(), layer.getWmsLink(), false, false, layer.getLayerUUID(), true);
|
addLayer("concessione", layer.getLayerName(),
|
||||||
|
layer.getLayerName(), layer.getWmsLink(),
|
||||||
|
false, false, layer.getLayerUUID(), true);
|
||||||
// LayerItem li = new LayerItem();
|
// LayerItem li = new LayerItem();
|
||||||
// li.setBaseLayer(false);
|
// li.setBaseLayer(false);
|
||||||
// li.setWmsLink(layer.getWmsLink());
|
// li.setWmsLink(layer.getWmsLink());
|
||||||
|
@ -236,10 +249,17 @@ public class LayerManager {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// removing all WMS detail layers if the ZOOM level is < QUERY_MIN_ZOOM_LEVEL
|
||||||
|
olMap.removeAllDetailLayers();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(queryEvent.getSourceMapEventType() != null && queryEvent.getSourceMapEventType().equals(MapEventType.MAP_ZOOM_END)) {
|
||||||
|
GWT.log("EVENT IS "+MapEventType.MAP_ZOOM_END +" retuning");
|
||||||
return;
|
return;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Showing properties belonging to concessioni centroid layer
|
||||||
Map<String, List<String>> entries = feature.getMapProperties();
|
Map<String, List<String>> entries = feature.getMapProperties();
|
||||||
|
|
||||||
String nome = "";
|
String nome = "";
|
||||||
|
@ -433,11 +453,11 @@ public class LayerManager {
|
||||||
* @param isBase the is base
|
* @param isBase the is base
|
||||||
* @param displayInLayerSwitcher the display in layer switcher
|
* @param displayInLayerSwitcher the display in layer switcher
|
||||||
* @param UUID the uuid
|
* @param UUID the uuid
|
||||||
* @param onTop the on top
|
* @param asDetailLayer the as detail layer
|
||||||
*/
|
*/
|
||||||
public void addLayer(final String geonaItemType, final String layerTitle, final String layerName,
|
public void addLayer(final String geonaItemType, final String layerTitle, final String layerName,
|
||||||
final String wmsLink, final boolean isBase, final boolean displayInLayerSwitcher, final String UUID,
|
final String wmsLink, final boolean isBase, final boolean displayInLayerSwitcher, final String UUID,
|
||||||
final boolean onTop) {
|
final boolean asDetailLayer) {
|
||||||
|
|
||||||
// final LayoutContainer westPanel = (LayoutContainer) layersPanel.getParent();
|
// final LayoutContainer westPanel = (LayoutContainer) layersPanel.getParent();
|
||||||
//
|
//
|
||||||
|
@ -448,6 +468,12 @@ public class LayerManager {
|
||||||
|
|
||||||
final LayerType featureType = isBase ? LayerType.RASTER_BASELAYER : LayerType.FEATURE_TYPE;
|
final LayerType featureType = isBase ? LayerType.RASTER_BASELAYER : LayerType.FEATURE_TYPE;
|
||||||
// Info.display("Adding Layer", layerName);
|
// Info.display("Adding Layer", layerName);
|
||||||
|
|
||||||
|
if(wmsLink==null || wmsLink.isEmpty()) {
|
||||||
|
GeoportalDataViewerConstants.printJs("Skipping add layer for wmsLink as null or empty");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().parseWmsRequest(wmsLink, layerName,
|
GeoportalDataViewerServiceAsync.Util.getInstance().parseWmsRequest(wmsLink, layerName,
|
||||||
new AsyncCallback<GeoInformationForWMSRequest>() {
|
new AsyncCallback<GeoInformationForWMSRequest>() {
|
||||||
|
|
||||||
|
@ -475,8 +501,19 @@ public class LayerManager {
|
||||||
LayerObject lo = new LayerObject();
|
LayerObject lo = new LayerObject();
|
||||||
lo.setLayerItem(layerItem);
|
lo.setLayerItem(layerItem);
|
||||||
lo.setItemType(geonaItemType);
|
lo.setItemType(geonaItemType);
|
||||||
layerObjects.add(lo);
|
|
||||||
|
String key = layerItem.getMapServerHost() + "/layer/" + layerItem.getName();
|
||||||
|
|
||||||
|
// //if a detail layer checking if it is already added to map
|
||||||
|
// if (asDetailLayer && layerObjects.containsKey(key)) {
|
||||||
|
// GWT.log("Skipping layer already added to Map");
|
||||||
|
// } else {
|
||||||
|
layerObjects.put(key, lo);
|
||||||
|
if (!asDetailLayer)
|
||||||
olMap.addWMSLayer(layerItem);
|
olMap.addWMSLayer(layerItem);
|
||||||
|
else
|
||||||
|
olMap.addWMSDetailLayer(layerItem);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||||
|
@ -32,7 +33,7 @@ public class OLMapManager {
|
||||||
private Double zoomStart = null;
|
private Double zoomStart = null;
|
||||||
private Double zoomEnd = null;
|
private Double zoomEnd = null;
|
||||||
private ol.Extent dragEndExtent = null;
|
private ol.Extent dragEndExtent = null;
|
||||||
private static final int QUERY_MIN_ZOOM_LEVEL = 13;
|
public static final int QUERY_MIN_ZOOM_LEVEL = 13;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new OL map manager.
|
* Instantiates a new OL map manager.
|
||||||
|
@ -56,7 +57,7 @@ public class OLMapManager {
|
||||||
@Override
|
@Override
|
||||||
public void clickListener(MapBrowserEvent event) {
|
public void clickListener(MapBrowserEvent event) {
|
||||||
Coordinate coordinate = event.getCoordinate();
|
Coordinate coordinate = event.getCoordinate();
|
||||||
if(!olMap.mapInstancied())
|
if (!olMap.mapInstancied())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// if (olMap.isQueryPointActive()) {
|
// if (olMap.isQueryPointActive()) {
|
||||||
|
@ -65,26 +66,26 @@ public class OLMapManager {
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
|
||||||
GeoQuery select = toDataPointQuery(coordinate,true);
|
GeoQuery select = toDataPointQuery(coordinate, true);
|
||||||
layerManagerBus.fireEvent(new QueryDataEvent(select, coordinate, null, true));
|
layerManagerBus.fireEvent(new QueryDataEvent(select, coordinate, null, true, MapEventType.INIT));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void moveEndListener(MapEvent event) {
|
public void moveEndListener(MapEvent event) {
|
||||||
//onInit
|
// onInit
|
||||||
if(!olMap.mapInstancied())
|
if (!olMap.mapInstancied())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
checkSelectQuery();
|
checkSelectQuery(MapEventType.MOVE_END);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void moveStartListener(MapEvent event) {
|
public void moveStartListener(MapEvent event) {
|
||||||
|
|
||||||
//onInit
|
// onInit
|
||||||
if(!olMap.mapInstancied())
|
if (!olMap.mapInstancied())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setDragStart();
|
setDragStart();
|
||||||
|
@ -94,26 +95,26 @@ public class OLMapManager {
|
||||||
@Override
|
@Override
|
||||||
public void mapZoomListener(MapEvent event) {
|
public void mapZoomListener(MapEvent event) {
|
||||||
|
|
||||||
//onInit
|
// onInit
|
||||||
if(!olMap.mapInstancied())
|
if (!olMap.mapInstancied())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setDragStart();
|
setDragStart();
|
||||||
zoomStart = olMap.getCurrentZoomLevel();
|
zoomStart = olMap.getCurrentZoomLevel();
|
||||||
GWT.log("zoomStart: "+zoomStart);
|
GWT.log("zoomStart: " + zoomStart);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mapZoomEndListener(MapEvent event) {
|
public void mapZoomEndListener(MapEvent event) {
|
||||||
//onInit
|
// onInit
|
||||||
if(!olMap.mapInstancied())
|
if (!olMap.mapInstancied())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setDragStart();
|
setDragStart();
|
||||||
zoomEnd = olMap.getCurrentZoomLevel();
|
zoomEnd = olMap.getCurrentZoomLevel();
|
||||||
GWT.log("zoomEnd: "+zoomEnd);
|
GWT.log("zoomEnd: " + zoomEnd);
|
||||||
checkSelectQuery();
|
checkSelectQuery(MapEventType.MAP_ZOOM_END);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +141,7 @@ public class OLMapManager {
|
||||||
|
|
||||||
double lon = coordinate.getX();
|
double lon = coordinate.getX();
|
||||||
double lat = coordinate.getY();
|
double lat = coordinate.getY();
|
||||||
GWT.log("To quey DP: "+coordinate);
|
GWT.log("To quey DP: " + coordinate);
|
||||||
|
|
||||||
int w = (int) olMap.getSize().getWidth();
|
int w = (int) olMap.getSize().getWidth();
|
||||||
int h = (int) olMap.getSize().getHeight();
|
int h = (int) olMap.getSize().getHeight();
|
||||||
|
@ -150,13 +151,12 @@ public class OLMapManager {
|
||||||
// where 10px is the pixel diameter dimension of the clicked point
|
// where 10px is the pixel diameter dimension of the clicked point
|
||||||
double bboxWidth = Math.abs(olMap.getExtent().getLowerLeftX() - olMap.getExtent().getUpperRightX());
|
double bboxWidth = Math.abs(olMap.getExtent().getLowerLeftX() - olMap.getExtent().getUpperRightX());
|
||||||
double geoWidth = 0;
|
double geoWidth = 0;
|
||||||
//adding a tolerance in case of manual click
|
// adding a tolerance in case of manual click
|
||||||
if(manualClick) {
|
if (manualClick) {
|
||||||
//adding a tolerance for clicking
|
// adding a tolerance for clicking
|
||||||
geoWidth = (bboxWidth / w) * (14 / 2);
|
geoWidth = (bboxWidth / w) * (14 / 2);
|
||||||
}
|
} else {
|
||||||
else {
|
// data point selection for coordinate loaded from concessione
|
||||||
//data point selection for coordinate loaded from concessione
|
|
||||||
geoWidth = (bboxWidth / w) * (2);
|
geoWidth = (bboxWidth / w) * (2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ public class OLMapManager {
|
||||||
/**
|
/**
|
||||||
* Check select query.
|
* Check select query.
|
||||||
*/
|
*/
|
||||||
private void checkSelectQuery() {
|
private void checkSelectQuery(MapEventType mapEventType) {
|
||||||
|
|
||||||
GWT.log("Zoom is:" + olMap.getCurrentZoomLevel());
|
GWT.log("Zoom is:" + olMap.getCurrentZoomLevel());
|
||||||
|
|
||||||
|
@ -199,12 +199,11 @@ public class OLMapManager {
|
||||||
GWT.log("the distance is: " + dist);
|
GWT.log("the distance is: " + dist);
|
||||||
if (dist > 5000 || startExt.containsExtent(endExt)) {
|
if (dist > 5000 || startExt.containsExtent(endExt)) {
|
||||||
GeoQuery select = toDataBoxQuery(dragEndExtent);
|
GeoQuery select = toDataBoxQuery(dragEndExtent);
|
||||||
layerManagerBus.fireEvent(new QueryDataEvent(select, endExt.getCenter(), null, false));
|
layerManagerBus.fireEvent(new QueryDataEvent(select, endExt.getCenter(), null, false, mapEventType));
|
||||||
}
|
}
|
||||||
}
|
} else if (zoomStart != null && zoomEnd != null) {
|
||||||
else if(zoomStart!=null && zoomEnd!=null) {
|
|
||||||
|
|
||||||
if(zoomEnd<QUERY_MIN_ZOOM_LEVEL) {
|
if (zoomEnd < QUERY_MIN_ZOOM_LEVEL) {
|
||||||
layerManagerBus.fireEvent(new ZoomOutOverMinimumEvent(zoomStart, zoomEnd, QUERY_MIN_ZOOM_LEVEL));
|
layerManagerBus.fireEvent(new ZoomOutOverMinimumEvent(zoomStart, zoomEnd, QUERY_MIN_ZOOM_LEVEL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,10 +228,10 @@ public class OLMapManager {
|
||||||
*/
|
*/
|
||||||
private GeoQuery toDataBoxQuery(ol.Extent extent) {
|
private GeoQuery toDataBoxQuery(ol.Extent extent) {
|
||||||
|
|
||||||
return new GeoQuery(extent.getLowerLeftX(), extent.getLowerLeftY(), extent.getUpperRightX(), extent.getUpperRightY(), TYPE.BOX);
|
return new GeoQuery(extent.getLowerLeftX(), extent.getLowerLeftY(), extent.getUpperRightX(),
|
||||||
|
extent.getUpperRightY(), TYPE.BOX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is query point active.
|
* Checks if is query point active.
|
||||||
*
|
*
|
||||||
|
@ -249,5 +248,11 @@ public class OLMapManager {
|
||||||
olMap.hidePopup();
|
olMap.hidePopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the detail layers.
|
||||||
|
*/
|
||||||
|
public void removeDetailLayers() {
|
||||||
|
olMap.removeAllDetailLayers();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.GeoportalDataViewerConstants.MapEventType;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
@ -9,9 +10,9 @@ import ol.Coordinate;
|
||||||
/**
|
/**
|
||||||
* The Class QueryDataEvent.
|
* The Class QueryDataEvent.
|
||||||
*
|
*
|
||||||
* @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
|
* Aug 31, 2021
|
||||||
*/
|
*/
|
||||||
public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
|
public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
|
||||||
public static Type<QueryDataEventHandler> TYPE = new Type<QueryDataEventHandler>();
|
public static Type<QueryDataEventHandler> TYPE = new Type<QueryDataEventHandler>();
|
||||||
|
@ -19,6 +20,7 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
|
||||||
private Coordinate onFailureCenterTo;
|
private Coordinate onFailureCenterTo;
|
||||||
private String mongoItemId;
|
private String mongoItemId;
|
||||||
private boolean onInit;
|
private boolean onInit;
|
||||||
|
private MapEventType sourceMapEventType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new query data event.
|
* Instantiates a new query data event.
|
||||||
|
@ -27,12 +29,15 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
|
||||||
* @param onFailureCenterTo the on failure center to
|
* @param onFailureCenterTo the on failure center to
|
||||||
* @param mongoItemId the mongo item id
|
* @param mongoItemId the mongo item id
|
||||||
* @param onInit the on init
|
* @param onInit the on init
|
||||||
|
* @param mapEventType the map event type
|
||||||
*/
|
*/
|
||||||
public QueryDataEvent(GeoQuery select, Coordinate onFailureCenterTo, String mongoItemId, boolean onInit) {
|
public QueryDataEvent(GeoQuery select, Coordinate onFailureCenterTo, String mongoItemId, boolean onInit,
|
||||||
|
MapEventType mapEventType) {
|
||||||
this.select = select;
|
this.select = select;
|
||||||
this.onFailureCenterTo = onFailureCenterTo;
|
this.onFailureCenterTo = onFailureCenterTo;
|
||||||
this.mongoItemId = mongoItemId;
|
this.mongoItemId = mongoItemId;
|
||||||
this.onInit = onInit;
|
this.onInit = onInit;
|
||||||
|
this.sourceMapEventType = mapEventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,6 +50,11 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
|
||||||
return TYPE;
|
return TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the mongo item id.
|
||||||
|
*
|
||||||
|
* @return the mongo item id
|
||||||
|
*/
|
||||||
public String getMongoItemId() {
|
public String getMongoItemId() {
|
||||||
return mongoItemId;
|
return mongoItemId;
|
||||||
}
|
}
|
||||||
|
@ -78,10 +88,29 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
|
||||||
return select;
|
return select;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the on failure center to.
|
||||||
|
*
|
||||||
|
* @return the on failure center to
|
||||||
|
*/
|
||||||
public Coordinate getOnFailureCenterTo() {
|
public Coordinate getOnFailureCenterTo() {
|
||||||
return onFailureCenterTo;
|
return onFailureCenterTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the source map event type.
|
||||||
|
*
|
||||||
|
* @return the source map event type
|
||||||
|
*/
|
||||||
|
public MapEventType getSourceMapEventType() {
|
||||||
|
return sourceMapEventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To string.
|
||||||
|
*
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
@ -93,6 +122,8 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
|
||||||
builder.append(mongoItemId);
|
builder.append(mongoItemId);
|
||||||
builder.append(", onInit=");
|
builder.append(", onInit=");
|
||||||
builder.append(onInit);
|
builder.append(onInit);
|
||||||
|
builder.append(", sourceMapEventType=");
|
||||||
|
builder.append(sourceMapEventType);
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
@ -13,6 +15,8 @@ import com.google.gwt.user.client.Event;
|
||||||
|
|
||||||
import ol.Collection;
|
import ol.Collection;
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
|
import ol.Feature;
|
||||||
|
import ol.FeatureOptions;
|
||||||
import ol.Map;
|
import ol.Map;
|
||||||
import ol.MapBrowserEvent;
|
import ol.MapBrowserEvent;
|
||||||
import ol.MapEvent;
|
import ol.MapEvent;
|
||||||
|
@ -25,6 +29,7 @@ import ol.View;
|
||||||
import ol.ViewOptions;
|
import ol.ViewOptions;
|
||||||
import ol.control.Attribution;
|
import ol.control.Attribution;
|
||||||
import ol.event.EventListener;
|
import ol.event.EventListener;
|
||||||
|
import ol.geom.Geometry;
|
||||||
import ol.interaction.Draw;
|
import ol.interaction.Draw;
|
||||||
import ol.interaction.DrawOptions;
|
import ol.interaction.DrawOptions;
|
||||||
import ol.interaction.Extent;
|
import ol.interaction.Extent;
|
||||||
|
@ -36,6 +41,7 @@ import ol.layer.Base;
|
||||||
import ol.layer.Image;
|
import ol.layer.Image;
|
||||||
import ol.layer.LayerOptions;
|
import ol.layer.LayerOptions;
|
||||||
import ol.layer.Tile;
|
import ol.layer.Tile;
|
||||||
|
import ol.layer.VectorLayerOptions;
|
||||||
import ol.proj.Projection;
|
import ol.proj.Projection;
|
||||||
import ol.proj.ProjectionOptions;
|
import ol.proj.ProjectionOptions;
|
||||||
import ol.source.ImageWms;
|
import ol.source.ImageWms;
|
||||||
|
@ -45,7 +51,6 @@ import ol.source.Osm;
|
||||||
import ol.source.Vector;
|
import ol.source.Vector;
|
||||||
import ol.source.XyzOptions;
|
import ol.source.XyzOptions;
|
||||||
|
|
||||||
|
|
||||||
// TODO: Auto-generated Javadoc
|
// TODO: Auto-generated Javadoc
|
||||||
/**
|
/**
|
||||||
* The Class OpenLayerOSM.
|
* The Class OpenLayerOSM.
|
||||||
|
@ -56,14 +61,39 @@ import ol.source.XyzOptions;
|
||||||
*/
|
*/
|
||||||
public abstract class OpenLayerOSM {
|
public abstract class OpenLayerOSM {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Click listener.
|
||||||
|
*
|
||||||
|
* @param event the event
|
||||||
|
*/
|
||||||
public abstract void clickListener(MapBrowserEvent event);
|
public abstract void clickListener(MapBrowserEvent event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move end listener.
|
||||||
|
*
|
||||||
|
* @param event the event
|
||||||
|
*/
|
||||||
public abstract void moveEndListener(MapEvent event);
|
public abstract void moveEndListener(MapEvent event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move start listener.
|
||||||
|
*
|
||||||
|
* @param event the event
|
||||||
|
*/
|
||||||
public abstract void moveStartListener(MapEvent event);
|
public abstract void moveStartListener(MapEvent event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map zoom listener.
|
||||||
|
*
|
||||||
|
* @param event the event
|
||||||
|
*/
|
||||||
public abstract void mapZoomListener(MapEvent event);
|
public abstract void mapZoomListener(MapEvent event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map zoom end listener.
|
||||||
|
*
|
||||||
|
* @param event the event
|
||||||
|
*/
|
||||||
public abstract void mapZoomEndListener(MapEvent event);
|
public abstract void mapZoomEndListener(MapEvent event);
|
||||||
|
|
||||||
/** The map. */
|
/** The map. */
|
||||||
|
@ -92,6 +122,7 @@ public abstract class OpenLayerOSM {
|
||||||
|
|
||||||
private boolean isQueryPointActive;
|
private boolean isQueryPointActive;
|
||||||
|
|
||||||
|
private java.util.Map<String, Image> wmsDetailsLayerMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new open layer OSM.
|
* Instantiates a new open layer OSM.
|
||||||
|
@ -99,7 +130,9 @@ public abstract class OpenLayerOSM {
|
||||||
* @param divTargetId the div target id
|
* @param divTargetId the div target id
|
||||||
* @param eventBus the event bus
|
* @param eventBus the event bus
|
||||||
*/
|
*/
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see de.desjardins.ol3.demo.client.example.Example#show()
|
* @see de.desjardins.ol3.demo.client.example.Example#show()
|
||||||
*/
|
*/
|
||||||
public OpenLayerOSM(String divTargetId, HandlerManager eventBus) {
|
public OpenLayerOSM(String divTargetId, HandlerManager eventBus) {
|
||||||
|
@ -121,7 +154,6 @@ public abstract class OpenLayerOSM {
|
||||||
viewOptions.setProjection(projection);
|
viewOptions.setProjection(projection);
|
||||||
viewOptions.setMaxZoom(19);
|
viewOptions.setMaxZoom(19);
|
||||||
|
|
||||||
|
|
||||||
// create a view
|
// create a view
|
||||||
view = new View(viewOptions);
|
view = new View(viewOptions);
|
||||||
|
|
||||||
|
@ -133,7 +165,7 @@ public abstract class OpenLayerOSM {
|
||||||
map = new Map(mapOptions);
|
map = new Map(mapOptions);
|
||||||
|
|
||||||
map.addLayer(osmLayer);
|
map.addLayer(osmLayer);
|
||||||
//map.addLayer(tileDebugLayer);
|
// map.addLayer(tileDebugLayer);
|
||||||
|
|
||||||
// add some controls
|
// add some controls
|
||||||
map.addControl(OLFactory.createScaleLine());
|
map.addControl(OLFactory.createScaleLine());
|
||||||
|
@ -151,6 +183,9 @@ public abstract class OpenLayerOSM {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind events.
|
||||||
|
*/
|
||||||
private void bindEvents() {
|
private void bindEvents() {
|
||||||
|
|
||||||
map.addClickListener(new EventListener<MapBrowserEvent>() {
|
map.addClickListener(new EventListener<MapBrowserEvent>() {
|
||||||
|
@ -206,19 +241,24 @@ public abstract class OpenLayerOSM {
|
||||||
/**
|
/**
|
||||||
* Sets the center.
|
* Sets the center.
|
||||||
*
|
*
|
||||||
* @param centerCoordinate the new center
|
* @param zoom the new zoom
|
||||||
*/
|
*/
|
||||||
public void setZoom(int zoom) {
|
public void setZoom(int zoom) {
|
||||||
view.setZoom(zoom);
|
view.setZoom(zoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show popup.
|
||||||
|
*
|
||||||
|
* @param html the html
|
||||||
|
* @param coordinate the coordinate
|
||||||
|
*/
|
||||||
public void showPopup(String html, Coordinate coordinate) {
|
public void showPopup(String html, Coordinate coordinate) {
|
||||||
GWT.log("Showing popup on: "+coordinate);
|
GWT.log("Showing popup on: " + coordinate);
|
||||||
//GeoportalDataViewerConstants.print("Showing popup on: "+coordinate);
|
// GeoportalDataViewerConstants.print("Showing popup on: "+coordinate);
|
||||||
Element elPopup = DOM.getElementById("popup");
|
Element elPopup = DOM.getElementById("popup");
|
||||||
elPopup.getStyle().setVisibility(Visibility.VISIBLE);
|
elPopup.getStyle().setVisibility(Visibility.VISIBLE);
|
||||||
if(popupOverlay==null) {
|
if (popupOverlay == null) {
|
||||||
popupOverlay = addOverlay(elPopup);
|
popupOverlay = addOverlay(elPopup);
|
||||||
addPopupCloserHandelr(popupOverlay);
|
addPopupCloserHandelr(popupOverlay);
|
||||||
}
|
}
|
||||||
|
@ -227,8 +267,11 @@ public abstract class OpenLayerOSM {
|
||||||
popupOverlay.setPosition(coordinate);
|
popupOverlay.setPosition(coordinate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide popup.
|
||||||
|
*/
|
||||||
public void hidePopup() {
|
public void hidePopup() {
|
||||||
if(popupOverlay!=null) {
|
if (popupOverlay != null) {
|
||||||
Element elPopup = DOM.getElementById("popup");
|
Element elPopup = DOM.getElementById("popup");
|
||||||
elPopup.getStyle().setVisibility(Visibility.HIDDEN);
|
elPopup.getStyle().setVisibility(Visibility.HIDDEN);
|
||||||
}
|
}
|
||||||
|
@ -271,7 +314,6 @@ public abstract class OpenLayerOSM {
|
||||||
|
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the WMS layer.
|
* Adds the WMS layer.
|
||||||
*
|
*
|
||||||
|
@ -285,7 +327,7 @@ public abstract class OpenLayerOSM {
|
||||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||||
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
||||||
imageWMSOptions.setParams(imageWMSParams);
|
imageWMSOptions.setParams(imageWMSParams);
|
||||||
//imageWMSOptions.setRatio(1.5f);
|
// imageWMSOptions.setRatio(1.5f);
|
||||||
|
|
||||||
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
|
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
|
||||||
|
|
||||||
|
@ -294,7 +336,7 @@ public abstract class OpenLayerOSM {
|
||||||
|
|
||||||
Image wmsLayer = new Image(layerOptions);
|
Image wmsLayer = new Image(layerOptions);
|
||||||
|
|
||||||
//visibleLayerItems
|
// visibleLayerItems
|
||||||
|
|
||||||
map.addLayer(wmsLayer);
|
map.addLayer(wmsLayer);
|
||||||
GWT.log("Fired the event Added Layer");
|
GWT.log("Fired the event Added Layer");
|
||||||
|
@ -302,13 +344,126 @@ public abstract class OpenLayerOSM {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the WMS detail layer.
|
||||||
|
*
|
||||||
|
* @param layerItem the layer item
|
||||||
|
*/
|
||||||
|
public void addWMSDetailLayer(LayerItem layerItem) {
|
||||||
|
|
||||||
|
if (wmsDetailsLayerMap == null)
|
||||||
|
wmsDetailsLayerMap = new HashMap<String, Image>();
|
||||||
|
|
||||||
|
String key = layerItem.getMapServerHost() + "/layer/" + layerItem.getName();
|
||||||
|
|
||||||
|
Image layer = wmsDetailsLayerMap.get(key);
|
||||||
|
|
||||||
|
if (layer == null) {
|
||||||
|
GWT.log("The detail layer with key: " + key + " does not exist, creating and adding it to map");
|
||||||
|
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||||
|
imageWMSParams.setLayers(layerItem.getName());
|
||||||
|
|
||||||
|
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||||
|
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
||||||
|
imageWMSOptions.setParams(imageWMSParams);
|
||||||
|
// imageWMSOptions.setRatio(1.5f);
|
||||||
|
|
||||||
|
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
|
||||||
|
|
||||||
|
LayerOptions layerOptions = OLFactory.createOptions();
|
||||||
|
layerOptions.setSource(imageWMSSource);
|
||||||
|
|
||||||
|
Image wmsLayer = new Image(layerOptions);
|
||||||
|
|
||||||
|
// visibleLayerItems
|
||||||
|
|
||||||
|
map.addLayer(wmsLayer);
|
||||||
|
wmsDetailsLayerMap.put(key, wmsLayer);
|
||||||
|
|
||||||
|
GWT.log("Fired the event Added Layer");
|
||||||
|
eventBus.fireEvent(new AddedLayerToMapEvent(layerItem));
|
||||||
|
} else {
|
||||||
|
GWT.log("The detail layer with key: " + key + " already exists, skipping");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeAllDetailLayers() {
|
||||||
|
if (wmsDetailsLayerMap == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (String key : wmsDetailsLayerMap.keySet()) {
|
||||||
|
Image layer = wmsDetailsLayerMap.get(key);
|
||||||
|
map.removeLayer(layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
wmsDetailsLayerMap.clear();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// public void addGeometry(Geometry theGeom) {
|
||||||
|
//
|
||||||
|
// if(theGeom==null)
|
||||||
|
// return;
|
||||||
|
//
|
||||||
|
// if(geometryLayer==null) {
|
||||||
|
// geometryLayer = new Vector("Feature selected");
|
||||||
|
// geometryLayer.setDisplayInLayerSwitcher(false);
|
||||||
|
// map.addLayer(geometryLayer);
|
||||||
|
// }else {
|
||||||
|
// geometryLayer.removeAllFeatures();
|
||||||
|
// }
|
||||||
|
// Style style = new Style();
|
||||||
|
// style.setFillColor("#00FF00");
|
||||||
|
// style.setGraphicName("circle");
|
||||||
|
// style.setPointRadius(10);
|
||||||
|
// VectorFeature vf = new VectorFeature(theGeom, style);
|
||||||
|
// geometryLayer.addFeature(vf);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// protected void removeGeometries() {
|
||||||
|
// if(geometryLayer!=null)
|
||||||
|
// geometryLayer.removeAllFeatures();
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the vector.
|
||||||
|
*
|
||||||
|
* @param geometry the geometry
|
||||||
|
*/
|
||||||
|
public void addVector(Geometry geometry) {
|
||||||
|
|
||||||
|
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
|
||||||
|
vectorLayerOptions.setMap(map);
|
||||||
|
|
||||||
|
// Style style = new Style();
|
||||||
|
// FillOptions fillOptions = new FillOptions();
|
||||||
|
// Color color = new Color(0, 0, 255, 1.0);
|
||||||
|
// fillOptions.setColor(color);
|
||||||
|
// Fill fill = new Fill(fillOptions);
|
||||||
|
// style.setFill(fill);
|
||||||
|
|
||||||
|
FeatureOptions featureOptions = new FeatureOptions();
|
||||||
|
featureOptions.setGeometry(geometry);
|
||||||
|
Feature feature = OLFactory.createFeature(featureOptions);
|
||||||
|
|
||||||
|
Vector vectorSource = OLFactory.createVectorSource();
|
||||||
|
vectorSource.addFeature(feature);
|
||||||
|
vectorLayerOptions.setSource(vectorSource);
|
||||||
|
|
||||||
|
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
|
||||||
|
|
||||||
|
map.addLayer(vector);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the point vector source.
|
* Adds the point vector source.
|
||||||
*
|
*
|
||||||
* @return the draw
|
* @return the draw
|
||||||
*/
|
*/
|
||||||
public Draw addPointVectorSource() {
|
public Draw addPointVectorSource() {
|
||||||
if(queryPoint==null)
|
if (queryPoint == null)
|
||||||
initPointInteraction();
|
initPointInteraction();
|
||||||
|
|
||||||
map.addInteraction(queryPoint);
|
map.addInteraction(queryPoint);
|
||||||
|
@ -353,7 +508,7 @@ public abstract class OpenLayerOSM {
|
||||||
*/
|
*/
|
||||||
public void removeQueryInteractions() {
|
public void removeQueryInteractions() {
|
||||||
Collection<Interaction> interactions = map.getInteractions();
|
Collection<Interaction> interactions = map.getInteractions();
|
||||||
if(interactions!=null) {
|
if (interactions != null) {
|
||||||
map.removeInteraction(queryBox);
|
map.removeInteraction(queryBox);
|
||||||
map.removeInteraction(queryPoint);
|
map.removeInteraction(queryPoint);
|
||||||
isQueryBoxActive = false;
|
isQueryBoxActive = false;
|
||||||
|
@ -369,17 +524,16 @@ public abstract class OpenLayerOSM {
|
||||||
public Extent addExtentInteraction() {
|
public Extent addExtentInteraction() {
|
||||||
ExtentOptions extentOptions = new ExtentOptions();
|
ExtentOptions extentOptions = new ExtentOptions();
|
||||||
extentOptions.setWrapX(false);
|
extentOptions.setWrapX(false);
|
||||||
//StyleOptions styleOptions = new StyleOptions();
|
// StyleOptions styleOptions = new StyleOptions();
|
||||||
//styleOptions.setStroke(stroke);
|
// styleOptions.setStroke(stroke);
|
||||||
//styleOptions.set
|
// styleOptions.set
|
||||||
//extentOptions.setBoxStyle(new ol.style.Style(styleOptions));
|
// extentOptions.setBoxStyle(new ol.style.Style(styleOptions));
|
||||||
queryBox = new Extent(extentOptions);
|
queryBox = new Extent(extentOptions);
|
||||||
map.addInteraction(queryBox);
|
map.addInteraction(queryBox);
|
||||||
isQueryBoxActive = true;
|
isQueryBoxActive = true;
|
||||||
return queryBox;
|
return queryBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the overlay.
|
* Adds the overlay.
|
||||||
*
|
*
|
||||||
|
@ -408,13 +562,13 @@ public abstract class OpenLayerOSM {
|
||||||
|
|
||||||
Collection<Base> layers = map.getLayers();
|
Collection<Base> layers = map.getLayers();
|
||||||
|
|
||||||
if(layers!=null) {
|
if (layers != null) {
|
||||||
Base[] layersArr = layers.getArray();
|
Base[] layersArr = layers.getArray();
|
||||||
for (int i = 0; i < layersArr.length; i++) {
|
for (int i = 0; i < layersArr.length; i++) {
|
||||||
Base layer = layersArr[i];
|
Base layer = layersArr[i];
|
||||||
String theLayerName = (String) layer.get("name");
|
String theLayerName = (String) layer.get("name");
|
||||||
GWT.log("The Layer name is: "+layerName);
|
GWT.log("The Layer name is: " + layerName);
|
||||||
if(theLayerName!=null && theLayerName.equals(layerName))
|
if (theLayerName != null && theLayerName.equals(layerName))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -422,7 +576,6 @@ public abstract class OpenLayerOSM {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the projection code.
|
* Gets the projection code.
|
||||||
*
|
*
|
||||||
|
@ -432,7 +585,6 @@ public abstract class OpenLayerOSM {
|
||||||
return map.getView().getProjection().getCode();
|
return map.getView().getProjection().getCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current zoom level.
|
* Gets the current zoom level.
|
||||||
*
|
*
|
||||||
|
@ -442,8 +594,6 @@ public abstract class OpenLayerOSM {
|
||||||
return map.getView().getZoom();
|
return map.getView().getZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the bbox.
|
* Gets the bbox.
|
||||||
*
|
*
|
||||||
|
@ -462,25 +612,52 @@ public abstract class OpenLayerOSM {
|
||||||
return this.map.getView().calculateExtent(map.getSize());
|
return this.map.getView().calculateExtent(map.getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Coordinate transform (Coordinate centerCoordinate, String source, String target){
|
/**
|
||||||
|
* Transform.
|
||||||
|
*
|
||||||
|
* @param centerCoordinate the center coordinate
|
||||||
|
* @param source the source
|
||||||
|
* @param target the target
|
||||||
|
* @return the coordinate
|
||||||
|
*/
|
||||||
|
public Coordinate transform(Coordinate centerCoordinate, String source, String target) {
|
||||||
return Projection.transform(centerCoordinate, source, target);
|
return Projection.transform(centerCoordinate, source, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is query box active.
|
||||||
|
*
|
||||||
|
* @return true, if is query box active
|
||||||
|
*/
|
||||||
public boolean isQueryBoxActive() {
|
public boolean isQueryBoxActive() {
|
||||||
return isQueryBoxActive;
|
return isQueryBoxActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is query point active.
|
||||||
|
*
|
||||||
|
* @return true, if is query point active
|
||||||
|
*/
|
||||||
public boolean isQueryPointActive() {
|
public boolean isQueryPointActive() {
|
||||||
return isQueryPointActive;
|
return isQueryPointActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the size.
|
||||||
|
*
|
||||||
|
* @return the size
|
||||||
|
*/
|
||||||
public Size getSize() {
|
public Size getSize() {
|
||||||
return map.getSize();
|
return map.getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map instancied.
|
||||||
|
*
|
||||||
|
* @return true, if successful
|
||||||
|
*/
|
||||||
public boolean mapInstancied() {
|
public boolean mapInstancied() {
|
||||||
return this.map!=null;
|
return this.map != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,6 +140,7 @@ public class ImagesGallery {
|
||||||
JSONArray jsonArray = new JSONArray();
|
JSONArray jsonArray = new JSONArray();
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (UploadedImageDV image : listImages) {
|
for (UploadedImageDV image : listImages) {
|
||||||
|
if(image.getListWsContent()!=null) {
|
||||||
for (WorkspaceContentDV imageContent : image.getListWsContent()) {
|
for (WorkspaceContentDV imageContent : image.getListWsContent()) {
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("src", new JSONString(imageContent.getLink()));
|
json.put("src", new JSONString(imageContent.getLink()));
|
||||||
|
@ -157,6 +158,7 @@ public class ImagesGallery {
|
||||||
jsonArray.set(index, json);
|
jsonArray.set(index, json);
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
showGallery(jsonArray.getJavaScriptObject(), galleryDivId);
|
showGallery(jsonArray.getJavaScriptObject(), galleryDivId);
|
||||||
|
|
|
@ -469,4 +469,36 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
return SessionUtil.isSessionExpired(this.getThreadLocalRequest());
|
return SessionUtil.isSessionExpired(this.getThreadLocalRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the WFS features.
|
||||||
|
*
|
||||||
|
* @param layerObjects the layer objects
|
||||||
|
* @param mapSrsName the map srs name
|
||||||
|
* @param selectBBOX the select BBOX
|
||||||
|
* @param maxWFSFeature the max WFS feature
|
||||||
|
* @param zoomLevel the zoom level
|
||||||
|
* @return the WFS features
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<GeoNaSpatialQueryResult> getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName,
|
||||||
|
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel) {
|
||||||
|
LOG.info("getWFSFeatures called");
|
||||||
|
|
||||||
|
List<GeoNaSpatialQueryResult> listDAO = new ArrayList<GeoNaSpatialQueryResult>(layerObjects.size());
|
||||||
|
|
||||||
|
for (LayerObject layerObject : layerObjects) {
|
||||||
|
GeoNaSpatialQueryResult geoDAO = new GeoNaSpatialQueryResult();
|
||||||
|
List<FeatureRow> features = FeatureParser.getWFSFeatures(layerObject.getLayerItem(), mapSrsName, selectBBOX,
|
||||||
|
maxWFSFeature);
|
||||||
|
LOG.debug("For layer name: " + layerObject.getLayerItem().getName() + " got features: " + features);
|
||||||
|
geoDAO.setFeatures(features);
|
||||||
|
geoDAO.setSourceLayerObject(layerObject);
|
||||||
|
LOG.info("For layer name: " + layerObject.getLayerItem().getName() + " got " + features.size()
|
||||||
|
+ " feature/s");
|
||||||
|
listDAO.add(geoDAO);
|
||||||
|
}
|
||||||
|
LOG.info("returning " + listDAO + " geona data objects");
|
||||||
|
return listDAO;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue