added check to skip coordinates of centroid on null

This commit is contained in:
Francesco Mangiacrapa 2020-12-11 09:51:20 +01:00
parent adba2f1973
commit e9fff02e29
8 changed files with 49 additions and 20 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/geoportal-data-viewer-app-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/geoportal-data-viewer-app-1.0.0/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-1.0.0/WEB-INF/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
@ -35,6 +35,6 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="/home/francesco-mangiacrapa/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar"/> <classpathentry kind="lib" path="/home/francescomangiacrapa/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar"/>
<classpathentry kind="output" path="target/geoportal-data-viewer-app-1.0.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/geoportal-data-viewer-app-1.0.0/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -1,4 +1,4 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-1.0.0-SNAPSHOT lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-1.0.0
warSrcDir=src/main/webapp warSrcDir=src/main/webapp
warSrcDirIsOutput=false warSrcDirIsOutput=false

View File

@ -271,7 +271,7 @@ public class GeoportalDataViewer implements EntryPoint {
} }
if(attempt>MAX_RETRY) { if(attempt>MAX_RETRY) {
GWT.log("cancelled timer"); GWT.log("MAX_RETRY reached, cancelled timer");
this.cancel(); this.cancel();
} }
@ -317,10 +317,15 @@ public class GeoportalDataViewer implements EntryPoint {
ConcessioneDV concessioneDV = (ConcessioneDV) record; ConcessioneDV concessioneDV = (ConcessioneDV) record;
Double x = concessioneDV.getCentroidLong(); Double x = concessioneDV.getCentroidLong();
Double y = concessioneDV.getCentroidLat(); Double y = concessioneDV.getCentroidLat();
Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y), GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857); GWT.log("X: "+x +", Y:"+y);
GeoQuery select = olMapMng.toDataPointQuery(transfCoord); if(x!=null && y!=null) {
//GeoportalDataViewerConstants.print("fireEvent QueryDataEvent"); Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y), GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, transfCoord, record.getId(), true)); GeoQuery select = olMapMng.toDataPointQuery(transfCoord);
//GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, transfCoord, record.getId(), true));
}else {
GeoportalDataViewerConstants.printJs("I cannot select the point one or both coordiantes are null. X: "+x +", Y:"+y);
}
} }
} }
} }

View File

@ -52,9 +52,9 @@ public class GeoportalDataViewerConstants {
* *
* @param msg the msg * @param msg the msg
*/ */
// public static native void print(String msg)/*-{ public static native void printJs(String msg)/*-{
// console.log("js console: "+msg); console.log("js console: "+msg);
// }-*/; }-*/;
} }

View File

@ -301,12 +301,17 @@ public class ConcessioneView extends Composite {
Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT); Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT);
Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857); Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
MapView mapView = new MapView(transformedCenterCoordinate, GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON); MapView mapView = new MapView(transformedCenterCoordinate, GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON);
Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
Coordinate transfCoord = MapUtils.transformCoordiante(coord, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857); if(concessioneDV!=null && concessioneDV.getCentroidLat()!=null && concessioneDV.getCentroidLong()!=null) {
//Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord); Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
boolean authenticatedUser = myLogin!=null?true:false; Coordinate transfCoord = MapUtils.transformCoordiante(coord, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
mapView.addMarker(transfCoord, authenticatedUser); //Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
mapViewPanel.add(mapView); boolean authenticatedUser = myLogin!=null?true:false;
mapView.addMarker(transfCoord, authenticatedUser);
mapViewPanel.add(mapView);
}else if(concessioneDV!=null){
GeoportalDataViewerConstants.printJs("I cannot add centroid as maker one or both coordinates are null. Lat: "+concessioneDV.getCentroidLong() +", Long:"+concessioneDV.getCentroidLat());
}
} }
private void addUploadedImages() { private void addUploadedImages() {

View File

@ -36,6 +36,10 @@ public class CustomFlexTable extends FlexTable {
*/ */
public void addNextKeyValues(String key, List<String> listValues, String separator) { public void addNextKeyValues(String key, List<String> listValues, String separator) {
GWT.log("adding key "+key +", values: "+listValues); GWT.log("adding key "+key +", values: "+listValues);
if(key==null)
return;
Label keyLabel = new Label(key); Label keyLabel = new Label(key);
int row = getRowCount() + 1; int row = getRowCount() + 1;
setWidget(row, 0, keyLabel); setWidget(row, 0, keyLabel);
@ -46,6 +50,9 @@ public class CustomFlexTable extends FlexTable {
String valuesAsString = ""; String valuesAsString = "";
for (String value : listValues) { for (String value : listValues) {
String theValue = value; String theValue = value;
if(theValue==null)
theValue = "";
if(theValue.startsWith("http://") || (theValue.startsWith("https://"))){ if(theValue.startsWith("http://") || (theValue.startsWith("https://"))){
theValue = "<a href=\""+value+"\" target=\"_blank\">"+value+"</a>"; theValue = "<a href=\""+value+"\" target=\"_blank\">"+value+"</a>";
} }
@ -63,6 +70,10 @@ public class CustomFlexTable extends FlexTable {
* @param value the value * @param value the value
*/ */
public void addNextKeyValue(String key, String value) { public void addNextKeyValue(String key, String value) {
if(key==null)
return;
Label keyLabel = new Label(key); Label keyLabel = new Label(key);
// keyLabel.getElement().getStyle().setMarginRight(5, Unit.PX); // keyLabel.getElement().getStyle().setMarginRight(5, Unit.PX);

View File

@ -6,7 +6,6 @@ package org.gcube.portlets.user.geoportaldataviewer.client.util;
import java.util.Date; import java.util.Date;
import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.Window;
/** /**
* The Class StringUtil. * The Class StringUtil.

View File

@ -7,3 +7,12 @@
/d4science.research-infrastructures.eu.gcubekey /d4science.research-infrastructures.eu.gcubekey
/devVRE.gcubekey /devVRE.gcubekey
/gCubeApps.gcubekey /gCubeApps.gcubekey
/CNR.it.gcubekey
/D4OS.gcubekey
/D4Research.gcubekey
/FARM.gcubekey
/ISTI.gcubekey
/OpenAIRE.gcubekey
/ParthenosVO.gcubekey
/SmartArea.gcubekey
/SoBigData.gcubekey