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"?>
<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>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</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>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -35,6 +35,6 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</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="output" path="target/geoportal-data-viewer-app-1.0.0-SNAPSHOT/WEB-INF/classes"/>
<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/WEB-INF/classes"/>
</classpath>

View File

@ -1,4 +1,4 @@
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
warSrcDirIsOutput=false

View File

@ -271,7 +271,7 @@ public class GeoportalDataViewer implements EntryPoint {
}
if(attempt>MAX_RETRY) {
GWT.log("cancelled timer");
GWT.log("MAX_RETRY reached, cancelled timer");
this.cancel();
}
@ -317,10 +317,15 @@ public class GeoportalDataViewer implements EntryPoint {
ConcessioneDV concessioneDV = (ConcessioneDV) record;
Double x = concessioneDV.getCentroidLong();
Double y = concessioneDV.getCentroidLat();
Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y), GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
GeoQuery select = olMapMng.toDataPointQuery(transfCoord);
//GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, transfCoord, record.getId(), true));
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);
//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
*/
// public static native void print(String msg)/*-{
// console.log("js console: "+msg);
// }-*/;
public static native void printJs(String 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 transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
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);
//Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
boolean authenticatedUser = myLogin!=null?true:false;
mapView.addMarker(transfCoord, authenticatedUser);
mapViewPanel.add(mapView);
if(concessioneDV!=null && concessioneDV.getCentroidLat()!=null && concessioneDV.getCentroidLong()!=null) {
Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
Coordinate transfCoord = MapUtils.transformCoordiante(coord, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
//Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
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() {

View File

@ -36,6 +36,10 @@ public class CustomFlexTable extends FlexTable {
*/
public void addNextKeyValues(String key, List<String> listValues, String separator) {
GWT.log("adding key "+key +", values: "+listValues);
if(key==null)
return;
Label keyLabel = new Label(key);
int row = getRowCount() + 1;
setWidget(row, 0, keyLabel);
@ -46,6 +50,9 @@ public class CustomFlexTable extends FlexTable {
String valuesAsString = "";
for (String value : listValues) {
String theValue = value;
if(theValue==null)
theValue = "";
if(theValue.startsWith("http://") || (theValue.startsWith("https://"))){
theValue = "<a href=\""+value+"\" target=\"_blank\">"+value+"</a>";
}
@ -63,6 +70,10 @@ public class CustomFlexTable extends FlexTable {
* @param value the value
*/
public void addNextKeyValue(String key, String value) {
if(key==null)
return;
Label keyLabel = new Label(key);
// 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 com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.Window;
/**
* The Class StringUtil.

View File

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