Gianpaolo Coro 2013-07-15 13:38:36 +00:00
parent e0de8aa112
commit ab02a49369
3 changed files with 30 additions and 6 deletions

View File

@ -96,7 +96,7 @@ public class MapsComparator extends DataAnalysis {
// delete this force
// String scope = config.getGcubeScope();
String scope = ScopeProvider.instance.get();
// String scope = "/gcube";
// String scope = null;
AnalysisLogger.getLogger().debug("MapsComparator: Using Scope: " + scope + " Z: " + z + " Values Threshold: " + valuesthreshold + " Layer1: " + layerT1 + " vs " + layerT2);
GeoIntersector intersector = new GeoIntersector(scope, config.getConfigPath());

View File

@ -33,8 +33,10 @@ public class RegressionTestMapsComparison {
config.setParam("DatabasePassword","d4science2");
config.setParam("DatabaseURL","jdbc:postgresql://localhost/testdb");
config.setParam("DatabaseDriver","org.postgresql.Driver");
config.setParam("Layer_1","86a7ac79-866a-49c6-b5d5-602fc2d87ddd");
config.setParam("Layer_2","86a7ac79-866a-49c6-b5d5-602fc2d87ddd");
// config.setParam("Layer_1","86a7ac79-866a-49c6-b5d5-602fc2d87ddd");
// config.setParam("Layer_2","86a7ac79-866a-49c6-b5d5-602fc2d87ddd");
config.setParam("Layer_1","aeabfdb5-9ddb-495e-b628-5b7d2cf1d8a2");
config.setParam("Layer_2","aeabfdb5-9ddb-495e-b628-5b7d2cf1d8a2");
config.setParam("ValuesComparisonThreshold",""+0.1);
config.setParam("Z","0");
config.setGcubeScope(null);

View File

@ -19,6 +19,7 @@ import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon;
import com.vividsolutions.jts.geom.PrecisionModel;
import com.vividsolutions.jts.geom.impl.CoordinateArraySequence;
import com.vividsolutions.jts.geom.util.GeometryTransformer;
public class EnvDataExplorer {
@ -133,7 +134,8 @@ public class EnvDataExplorer {
if (p != null) {
poly.setPolygon(p);
AnalysisLogger.getLogger().trace(p);
// AnalysisLogger.getLogger().trace("Setting polygon p");
// AnalysisLogger.getLogger().trace(p);
}
/*
* GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326); Polygon p = null; if (coords != null) {
@ -209,10 +211,13 @@ public class EnvDataExplorer {
for (Polygon polnh : polysnoholes) {
if (polnh.covers(pp)) {
// System.out.println("found hole! "+pp+" vs "+polnh);
polysnoholes.set(h, (Polygon) polnh.difference(pp));
addDifference(h, polysnoholes, polnh, pp);
found = true;
} else if (pp.covers(polnh)) {
polysnoholes.set(h, (Polygon) pp.difference(polnh));
// polysnoholes.set(h, (Polygon) pp.difference(polnh));
addDifference(h, polysnoholes, pp, polnh);
found = true;
}
h++;
@ -227,6 +232,23 @@ public class EnvDataExplorer {
return p;
}
private static void addDifference(int h , List<Polygon> polysnoholes, Polygon polnh, Polygon pp){
Geometry mp = polnh.difference(pp);
if (mp instanceof com.vividsolutions.jts.geom.Polygon)
polysnoholes.set(h, (Polygon) mp);
else {
MultiPolygon mup = (MultiPolygon) mp;
int innerpolygons = mup.getNumGeometries();
for (int k = 0; k < innerpolygons; k++) {
Polygon ip = (Polygon) mup.getGeometryN(k);
polysnoholes.set(h, ip);
}
}
}
private static LinearRing sequence2Ring(GeometryFactory factory, List<Coordinate> coordinatesArray) {
// System.out.println(coordinatesArray);
Coordinate[] coordrawarray = coordinatesArray.toArray(new Coordinate[coordinatesArray.size()]);