diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index de22390..b3fd7d1 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -63,9 +63,6 @@ - - uses - diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java index 566e5d0..1a24ba3 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java @@ -334,7 +334,7 @@ public class GeoportalDataViewer implements EntryPoint { GWT.log("X: "+x +", Y:"+y); if(x!=null && y!=null) { Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y), GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857); - GeoQuery select = olMapMng.toDataPointQuery(transfCoord); + GeoQuery select = olMapMng.toDataPointQuery(transfCoord,false); GWT.log("GeoQuery: "+select); //GeoportalDataViewerConstants.print("fireEvent QueryDataEvent"); layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, transfCoord, record.getItemId(), true)); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java index ec4903a..38feb24 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java @@ -155,6 +155,7 @@ public class LayerManager { @Override public void onSuccess(List listGeonaDataObjects) { + GWT.log("GeoNaDataObject's is/are " + listGeonaDataObjects.size()); GWT.log("GeoNaDataObject's: " + listGeonaDataObjects); // GeoportalDataViewerConstants.print("GeoNaDataObject's: // "+listGeonaDataObjects); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/OLMapManager.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/OLMapManager.java index 24fb887..41e13da 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/OLMapManager.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/OLMapManager.java @@ -65,7 +65,7 @@ public class OLMapManager { // // } - GeoQuery select = toDataPointQuery(coordinate); + GeoQuery select = toDataPointQuery(coordinate,true); layerManagerBus.fireEvent(new QueryDataEvent(select, coordinate, null, true)); } @@ -136,7 +136,7 @@ public class OLMapManager { * @param coordinate the coordinate * @return the geo query */ - public GeoQuery toDataPointQuery(Coordinate coordinate) { + public GeoQuery toDataPointQuery(Coordinate coordinate, boolean manualClick) { double lon = coordinate.getX(); double lat = coordinate.getY(); @@ -149,7 +149,17 @@ public class OLMapManager { // ratio - mapPixelWeight : bboxWeight = 20px : geoRectangleWidth // where 10px is the pixel diameter dimension of the clicked point double bboxWidth = Math.abs(olMap.getExtent().getLowerLeftX() - olMap.getExtent().getUpperRightX()); - double geoWidth = (bboxWidth / w) * (20 / 2); + double geoWidth = 0; + //adding a tolerance in case of manual click + if(manualClick) { + //adding a tolerance for clicking + geoWidth = (bboxWidth / w) * (14 / 2); + } + else { + //data point selection for coordinate loaded from concessione + geoWidth = (bboxWidth / w) * (2); + } + double x1 = Math.min(lon + geoWidth, lon - geoWidth); double x2 = Math.max(lon + geoWidth, lon - geoWidth); double y1 = Math.min(lat + geoWidth, lat - geoWidth); diff --git a/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GetConcessione.java b/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GetConcessione.java index 5bf0b80..58b3a59 100644 --- a/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GetConcessione.java +++ b/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GetConcessione.java @@ -1,6 +1,8 @@ package org.gcube.portlets.user.geoportaldataviewer; -import org.gcube.application.geoportal.client.legacy.ConcessioniManager; +import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni; + +import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI; import org.gcube.application.geoportal.common.model.legacy.Concessione; import org.gcube.application.geoportalcommon.ConvertToDataViewModel; import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; @@ -16,20 +18,21 @@ public class GetConcessione { private static final String YOUR_TOKEN = ""; public static String SCOPE = "/gcube/devsec/devVRE"; - public static long concessioneId = 8; + public static String concessioneId = "6102c07002ad3d05b5f81ddc"; - public static ConcessioneDV getConcessioneForId(Long id) throws Exception{ - LOG.info("getConcessioneForId "+id+ "called"); + public static ConcessioneDV getConcessioneForId(String mongoID) throws Exception{ + LOG.info("getConcessioneForId "+mongoID+ "called"); ConcessioneDV concessionDV = null; - if(id==null) + if(mongoID==null) throw new Exception("Invalid parameter. The Id is null"); try { - LOG.info("Trying to get record for id "+id); - Concessione concessione = new ConcessioniManager().getById(id+""); - LOG.info("For id "+id+", got concessione "+concessione); + LOG.info("Trying to get record for id "+mongoID); + ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build(); + Concessione concessione = concessioniManager.getById(mongoID); + LOG.info("For id "+mongoID+", got concessione "+concessione); LOG.info("Immagini Rappresentative are: "+concessione.getImmaginiRappresentative()); LOG.info("Relazione scavo: "+concessione.getRelazioneScavo()); LOG.info("Pianta Fine scavo: "+concessione.getPianteFineScavo()); @@ -45,7 +48,7 @@ public class GetConcessione { return concessionDV; }catch (Exception e) { - String erroMsg = Concessione.class.getSimpleName() +" with id "+id+" not available"; + String erroMsg = Concessione.class.getSimpleName() +" with id "+mongoID+" not available"; LOG.error(erroMsg,e); throw new Exception(erroMsg); }