Strabon
changeset 332:1fc7c20f440e
replaced StrabonPolyhedron.convertSRID with JTSWrapper.transform
author | Babis Nikolaou <charnik@di.uoa.gr> |
---|---|
date | Fri Jun 22 20:38:40 2012 +0300 (2012-06-22) |
parents | f9c40e79fe8b |
children | b83490fedef5 |
files | evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java |
line diff
1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java Fri Jun 22 20:30:04 2012 +0300 1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java Fri Jun 22 20:38:40 2012 +0300 1.3 @@ -150,16 +150,10 @@ 1.4 this.geometry = geometry; 1.5 } 1.6 1.7 - 1.8 - 1.9 public static StrabonPolyhedron ConstructFromWKB(byte[] byteArray) throws Exception { 1.10 return new StrabonPolyhedron(jts.WKBread((byteArray))); 1.11 } 1.12 1.13 - public static Geometry convertSRID(Geometry A, int sourceSRID, int targetSRID) { 1.14 - return JTSWrapper.getInstance().transform(A, sourceSRID, targetSRID); 1.15 - } 1.16 - 1.17 //public StrabonPolyhedron(int partitionAlgorithmIgnored, String constraints) throws Exception { 1.18 // Polyhedron poly = new Polyhedron(constraints); 1.19 // this.geometry = jts.WKTread(poly.toWKT()); 1.20 @@ -714,14 +708,12 @@ 1.21 return jts.WKBwrite(this.geometry); 1.22 } 1.23 1.24 - 1.25 - 1.26 public static StrabonPolyhedron union(StrabonPolyhedron A, StrabonPolyhedron B) throws Exception { 1.27 StrabonPolyhedron poly = new StrabonPolyhedron(); 1.28 1.29 int targetSRID = A.getGeometry().getSRID(); 1.30 int sourceSRID = B.getGeometry().getSRID(); 1.31 - Geometry x = convertSRID(B.getGeometry(), sourceSRID, targetSRID); 1.32 + Geometry x = JTSWrapper.getInstance().transform(B.getGeometry(), sourceSRID, targetSRID); 1.33 1.34 poly.geometry = A.geometry.union(x); 1.35 poly.geometry.setSRID(targetSRID); 1.36 @@ -760,7 +752,7 @@ 1.37 1.38 int targetSRID = A.getGeometry().getSRID(); 1.39 int sourceSRID = B.getGeometry().getSRID(); 1.40 - Geometry x = convertSRID(B.getGeometry(), sourceSRID, targetSRID); 1.41 + Geometry x = JTSWrapper.getInstance().transform(B.getGeometry(), sourceSRID, targetSRID); 1.42 Geometry geo = A.geometry.intersection(x); 1.43 geo.setSRID(targetSRID); 1.44 return new StrabonPolyhedron(geo); 1.45 @@ -771,7 +763,7 @@ 1.46 1.47 int targetSRID = A.getGeometry().getSRID(); 1.48 int sourceSRID = B.getGeometry().getSRID(); 1.49 - Geometry x = convertSRID(B.getGeometry(), sourceSRID, targetSRID); 1.50 + Geometry x = JTSWrapper.getInstance().transform(B.getGeometry(), sourceSRID, targetSRID); 1.51 1.52 poly.geometry = A.geometry.difference(x); 1.53 poly.geometry.setSRID(targetSRID); 1.54 @@ -782,7 +774,7 @@ 1.55 StrabonPolyhedron poly = new StrabonPolyhedron(); 1.56 int targetSRID = A.getGeometry().getSRID(); 1.57 int sourceSRID = B.getGeometry().getSRID(); 1.58 - Geometry x = convertSRID(B.getGeometry(), sourceSRID, targetSRID); 1.59 + Geometry x = JTSWrapper.getInstance().transform(B.getGeometry(), sourceSRID, targetSRID); 1.60 poly.geometry = A.geometry.symDifference(x); 1.61 poly.geometry.setSRID(targetSRID); 1.62 return poly; 1.63 @@ -795,7 +787,7 @@ 1.64 public static double distance(StrabonPolyhedron A, StrabonPolyhedron B) throws Exception { 1.65 int targetSRID = A.getGeometry().getSRID(); 1.66 int sourceSRID = B.getGeometry().getSRID(); 1.67 - Geometry x = convertSRID(B.getGeometry(), sourceSRID, targetSRID); 1.68 + Geometry x = JTSWrapper.getInstance().transform(B.getGeometry(), sourceSRID, targetSRID); 1.69 return A.geometry.distance(x); 1.70 } 1.71 1.72 @@ -811,7 +803,7 @@ 1.73 public static StrabonPolyhedron transform(StrabonPolyhedron A, URI srid) throws Exception { 1.74 1.75 int parsedSRID = Integer.parseInt(srid.toString().substring(srid.toString().lastIndexOf('/')+1)); 1.76 - Geometry converted = StrabonPolyhedron.convertSRID(A.getGeometry(),A.getGeometry().getSRID(), parsedSRID); 1.77 + Geometry converted = JTSWrapper.getInstance().transform(A.getGeometry(), A.getGeometry().getSRID(), parsedSRID); 1.78 return new StrabonPolyhedron(converted); 1.79 } 1.80
2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Fri Jun 22 20:30:04 2012 +0300 2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Fri Jun 22 20:38:40 2012 +0300 2.3 @@ -85,6 +85,7 @@ 2.4 import org.openrdf.query.algebra.evaluation.impl.EvaluationStrategyImpl; 2.5 import org.openrdf.query.algebra.evaluation.iterator.StSPARQLGroupIterator; 2.6 import org.openrdf.query.algebra.evaluation.iterator.OrderIterator; 2.7 +import org.openrdf.query.algebra.evaluation.util.JTSWrapper; 2.8 import org.openrdf.query.algebra.evaluation.util.StSPARQLOrderComparator; 2.9 import org.openrdf.sail.generaldb.util.StSPARQLValueComparator; 2.10 import org.openrdf.sail.generaldb.GeneralDBSpatialFuncInfo; 2.11 @@ -377,77 +378,77 @@ 2.12 { 2.13 int targetSRID = leftGeom.getSRID(); 2.14 int sourceSRID = rightGeom.getSRID(); 2.15 - Geometry rightConverted = StrabonPolyhedron.convertSRID(rightGeom, sourceSRID, targetSRID); 2.16 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 2.17 funcResult = leftGeom.getEnvelopeInternal().getMinY() > rightConverted.getEnvelopeInternal().getMaxY(); 2.18 } 2.19 else if(function instanceof AnyInteractFunc) 2.20 { 2.21 int targetSRID = leftGeom.getSRID(); 2.22 int sourceSRID = rightGeom.getSRID(); 2.23 - Geometry rightConverted = StrabonPolyhedron.convertSRID(rightGeom, sourceSRID, targetSRID); 2.24 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 2.25 funcResult = leftGeom.intersects(rightConverted); 2.26 } 2.27 else if(function instanceof BelowFunc) 2.28 { 2.29 int targetSRID = leftGeom.getSRID(); 2.30 int sourceSRID = rightGeom.getSRID(); 2.31 - Geometry rightConverted = StrabonPolyhedron.convertSRID(rightGeom, sourceSRID, targetSRID); 2.32 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 2.33 funcResult = leftGeom.getEnvelopeInternal().getMaxY() < rightConverted.getEnvelopeInternal().getMinY(); 2.34 } 2.35 else if(function instanceof ContainsFunc) 2.36 { 2.37 int targetSRID = leftGeom.getSRID(); 2.38 int sourceSRID = rightGeom.getSRID(); 2.39 - Geometry rightConverted = StrabonPolyhedron.convertSRID(rightGeom, sourceSRID, targetSRID); 2.40 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 2.41 funcResult = leftGeom.contains(rightConverted); 2.42 } 2.43 else if(function instanceof CoveredByFunc) 2.44 { 2.45 int targetSRID = leftGeom.getSRID(); 2.46 int sourceSRID = rightGeom.getSRID(); 2.47 - Geometry rightConverted = StrabonPolyhedron.convertSRID(rightGeom, sourceSRID, targetSRID); 2.48 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 2.49 funcResult = leftGeom.coveredBy(rightConverted); 2.50 } 2.51 else if(function instanceof CoversFunc) 2.52 { 2.53 int targetSRID = leftGeom.getSRID(); 2.54 int sourceSRID = rightGeom.getSRID(); 2.55 - Geometry rightConverted = StrabonPolyhedron.convertSRID(rightGeom, sourceSRID, targetSRID); 2.56 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 2.57 funcResult = leftGeom.covers(rightConverted); 2.58 } 2.59 else if(function instanceof DisjointFunc) 2.60 { 2.61 int targetSRID = leftGeom.getSRID(); 2.62 int sourceSRID = rightGeom.getSRID(); 2.63 - Geometry rightConverted = StrabonPolyhedron.convertSRID(rightGeom, sourceSRID, targetSRID); 2.64 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 2.65 funcResult = leftGeom.disjoint(rightConverted); 2.66 } 2.67 else if(function instanceof EqualsFunc) 2.68 { 2.69 int targetSRID = leftGeom.getSRID(); 2.70 int sourceSRID = rightGeom.getSRID(); 2.71 - Geometry rightConverted = StrabonPolyhedron.convertSRID(rightGeom, sourceSRID, targetSRID); 2.72 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 2.73 funcResult = leftGeom.equals(rightConverted); 2.74 } 2.75 else if(function instanceof InsideFunc) 2.76 { 2.77 int targetSRID = leftGeom.getSRID(); 2.78 int sourceSRID = rightGeom.getSRID(); 2.79 - Geometry rightConverted = StrabonPolyhedron.convertSRID(rightGeom, sourceSRID, targetSRID); 2.80 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 2.81 funcResult = leftGeom.within(rightConverted); 2.82 } 2.83 else if(function instanceof LeftFunc) 2.84 { 2.85 int targetSRID = leftGeom.getSRID(); 2.86 int sourceSRID = rightGeom.getSRID(); 2.87 - Geometry rightConverted = StrabonPolyhedron.convertSRID(rightGeom, sourceSRID, targetSRID); 2.88 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 2.89 funcResult = leftGeom.getEnvelopeInternal().getMaxX() < rightConverted.getEnvelopeInternal().getMinX(); 2.90 } 2.91 else if(function instanceof OverlapFunc) 2.92 { 2.93 int targetSRID = leftGeom.getSRID(); 2.94 int sourceSRID = rightGeom.getSRID(); 2.95 - Geometry rightConverted = StrabonPolyhedron.convertSRID(rightGeom, sourceSRID, targetSRID); 2.96 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 2.97 //System.out.println(rightConverted.toString()); 2.98 funcResult = leftGeom.overlaps(rightConverted); 2.99 } 2.100 @@ -455,14 +456,14 @@ 2.101 { 2.102 int targetSRID = leftGeom.getSRID(); 2.103 int sourceSRID = rightGeom.getSRID(); 2.104 - Geometry rightConverted = StrabonPolyhedron.convertSRID(rightGeom, sourceSRID, targetSRID); 2.105 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 2.106 funcResult = leftGeom.getEnvelopeInternal().getMinX() > rightConverted.getEnvelopeInternal().getMaxX(); 2.107 } 2.108 else if(function instanceof TouchFunc) 2.109 { 2.110 int targetSRID = leftGeom.getSRID(); 2.111 int sourceSRID = rightGeom.getSRID(); 2.112 - Geometry rightConverted = StrabonPolyhedron.convertSRID(rightGeom, sourceSRID, targetSRID); 2.113 + Geometry rightConverted = JTSWrapper.getInstance().transform(rightGeom, sourceSRID, targetSRID); 2.114 funcResult = leftGeom.touches(rightConverted); 2.115 } 2.116 2.117 @@ -519,7 +520,7 @@ 2.118 { 2.119 RdbmsURI srid = (RdbmsURI) right; 2.120 int parsedSRID = Integer.parseInt(srid.toString().substring(srid.toString().lastIndexOf('/')+1)); 2.121 - Geometry converted = StrabonPolyhedron.convertSRID(leftArg.getGeometry(),leftArg.getGeometry().getSRID(), parsedSRID); 2.122 + Geometry converted = JTSWrapper.getInstance().transform(leftArg.getGeometry(),leftArg.getGeometry().getSRID(), parsedSRID); 2.123 return new StrabonPolyhedron(converted); 2.124 } 2.125