Coordinates management
This commit is contained in:
parent
7d908af2a6
commit
8b5d672cfd
|
@ -2,6 +2,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
# Changelog for org.gcube.application.geoportal-logic
|
||||
|
||||
## [v1.0.7-SNAPSHOT] - 2020-12-7
|
||||
Concessione : Automatic coordinates from posizionamento scavo
|
||||
|
||||
## [v1.0.6-SNAPSHOT] - 2020-12-4
|
||||
Fix layer coordinates
|
||||
Geoserver folder management
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -4,7 +4,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-logic</artifactId>
|
||||
<version>1.0.6-SNAPSHOT</version>
|
||||
<version>1.0.7-SNAPSHOT</version>
|
||||
<name>Geoportal Logic</name>
|
||||
|
||||
|
||||
|
|
|
@ -179,13 +179,13 @@ public abstract class AbstractRecordManager<T extends Record> {
|
|||
contentHandler.publish();
|
||||
commit();
|
||||
|
||||
transaction.begin();
|
||||
log.debug("Registering centroid of "+theRecord);
|
||||
registerCentroid();
|
||||
// storeInfo();
|
||||
commit();
|
||||
}
|
||||
|
||||
|
||||
log.debug("Successufully committing "+theRecord);
|
||||
|
||||
return theRecord;
|
||||
}catch(ValidationException | PublishException | PersistenceException e) {
|
||||
|
@ -197,6 +197,7 @@ public abstract class AbstractRecordManager<T extends Record> {
|
|||
|
||||
|
||||
private void commit() {
|
||||
log.debug("Successufully committing "+theRecord);
|
||||
entityManager.flush();
|
||||
entityManager.clear();
|
||||
transaction.commit();
|
||||
|
|
|
@ -214,6 +214,28 @@ public class ConcessioneManager extends AbstractRecordManager<Concessione> {
|
|||
centroidsRow.put(DBConstants.Concessioni.ANNO, record.getDataInizioProgetto().getYear()+"");
|
||||
centroidsRow.put(DBConstants.Concessioni.NOME, record.getNome());
|
||||
centroidsRow.put(DBConstants.Concessioni.REGIONE, ""); //TODO
|
||||
|
||||
|
||||
|
||||
if(record.getCentroidLat()==null||record.getCentroidLat()==0)
|
||||
try {
|
||||
log.debug("Evaluating Centroid latitude for record "+record);
|
||||
record.setCentroidLat((record.getPosizionamentoScavo().getBbox().getMaxLat()+
|
||||
record.getPosizionamentoScavo().getBbox().getMinLat())/2);
|
||||
}catch (Throwable t) {
|
||||
log.warn("Unable to evaluate centroid latitude "+t);
|
||||
}
|
||||
|
||||
if(record.getCentroidLong()==null||record.getCentroidLong()==0)
|
||||
try {
|
||||
log.debug("Evaluating Centroid Longituted for record "+record);
|
||||
record.setCentroidLong((record.getPosizionamentoScavo().getBbox().getMaxLong()+
|
||||
record.getPosizionamentoScavo().getBbox().getMinLong())/2);
|
||||
}catch (Throwable t) {
|
||||
log.warn("Unable to evaluate centroid latitude "+t);
|
||||
}
|
||||
|
||||
|
||||
centroidsRow.put(DBConstants.Defaults.XCOORD_FIELD, record.getCentroidLong()+"");
|
||||
centroidsRow.put(DBConstants.Defaults.YCOORD_FIELD, record.getCentroidLat()+"");
|
||||
|
||||
|
|
|
@ -197,11 +197,11 @@ public class Concessione extends Record{
|
|||
|
||||
|
||||
validator.checkMandatory(authors, "Lista Autori");
|
||||
if(validator.checkMandatory(centroidLat, "Latitudine"))
|
||||
if(centroidLat>90||centroidLat<-90) validator.addMessage(ValidationStatus.ERROR, "Latitudine non valida : "+centroidLat);
|
||||
|
||||
if(validator.checkMandatory(centroidLong, "Longitudine"))
|
||||
if(centroidLong>180||centroidLong<-180) validator.addMessage(ValidationStatus.ERROR, "Longitudine non valida : "+centroidLong);
|
||||
// if(validator.checkMandatory(centroidLat, "Latitudine"))
|
||||
// if(centroidLat>90||centroidLat<-90) validator.addMessage(ValidationStatus.ERROR, "Latitudine non valida : "+centroidLat);
|
||||
//
|
||||
// if(validator.checkMandatory(centroidLong, "Longitudine"))
|
||||
// if(centroidLong>180||centroidLong<-180) validator.addMessage(ValidationStatus.ERROR, "Longitudine non valida : "+centroidLong);
|
||||
|
||||
validator.checkMandatory(contributore, "Contributore");
|
||||
if(validator.checkMandatory(dataFineProgetto, "Data Fine Progetto") &&
|
||||
|
@ -273,6 +273,8 @@ public class Concessione extends Record{
|
|||
public void setDefaults() {
|
||||
super.setDefaults();
|
||||
|
||||
setCentroidLat(centroidLat);
|
||||
|
||||
setDescrizioneContenuto(ConstraintCheck.defaultFor(getDescrizioneContenuto(),
|
||||
"Relazione di fine scavo e relativo abstract; selezione di immagini rappresentative;"
|
||||
+ " posizionamento topografico dell'area indagata, pianta di fine scavo.").evaluate());
|
||||
|
|
|
@ -2,11 +2,11 @@ package org.gcube.application.geoportal;
|
|||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.gcube.application.geoportal.utils.Files;
|
||||
import org.geotoolkit.data.DataStore;
|
||||
import org.geotoolkit.data.DataStoreFactory;
|
||||
import org.geotoolkit.data.DataStoreFinder;
|
||||
import org.geotoolkit.storage.DataStoreException;
|
||||
|
||||
|
@ -15,10 +15,19 @@ public class ShapeFilesTest {
|
|||
public static void main(String[] args) throws MalformedURLException, DataStoreException {
|
||||
|
||||
File shp=Files.getFileFromResources("concessioni/pos.shp");
|
||||
|
||||
DataStoreFinder.scanForPlugins();
|
||||
System.out.println("File "+shp.getAbsolutePath()+" : "+shp.getTotalSpace()+"b");
|
||||
// DataStoreFinder.scanForPlugins();
|
||||
System.out.println("Factories are");
|
||||
DataStoreFinder.getAllFactories(null).forEach((DataStoreFactory f)->{
|
||||
System.out.println(f.getDisplayName()+"\t"+f.getDescription());
|
||||
});
|
||||
System.out.println();
|
||||
DataStore inputDataStore = DataStoreFinder.open(
|
||||
Collections.singletonMap("url", shp.toURI().toURL()));
|
||||
|
||||
System.out.println("Datastore is "+inputDataStore);
|
||||
|
||||
|
||||
System.out.println(inputDataStore.getTypeNames());
|
||||
}
|
||||
|
||||
|
|
|
@ -48,10 +48,10 @@ public class TestModel {
|
|||
concessione.setParoleChiaveLibere(Arrays.asList(new String[] {"Robba","Stuff"}));
|
||||
concessione.setParoleChiaveICCD(Arrays.asList(new String[] {"vattelapesca","somthing something"}));
|
||||
|
||||
|
||||
concessione.setCentroidLat(Double.parseDouble("33."+System.currentTimeMillis())); //N-S
|
||||
concessione.setCentroidLong(Double.parseDouble("11."+System.currentTimeMillis())); //E-W
|
||||
|
||||
//
|
||||
// concessione.setCentroidLat(Double.parseDouble("33."+System.currentTimeMillis())); //N-S
|
||||
// concessione.setCentroidLong(Double.parseDouble("11."+System.currentTimeMillis())); //E-W
|
||||
//
|
||||
return concessione;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue