|
|
|
@ -62,7 +62,7 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Integer> dbexpected = expectationsFactory.getDimension();
|
|
|
|
|
String hql = format( "SELECT id, dimension(geom) FROM org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
|
|
|
|
String hql = format( "SELECT id, dimension(geom) FROM %s", entityName( pckg ) );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -81,7 +81,7 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, String> dbexpected = expectationsFactory.getAsText();
|
|
|
|
|
String hql = format( "SELECT id, astext(geom) from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
|
|
|
|
String hql = format( "SELECT id, astext(geom) from %s", entityName( pckg ) );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -101,7 +101,7 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, byte[]> dbexpected = expectationsFactory.getAsBinary();
|
|
|
|
|
String hql = format( "SELECT id, asbinary(geom) from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
|
|
|
|
String hql = format( "SELECT id, asbinary(geom) from %s", entityName( pckg ) );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -121,10 +121,10 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, String> dbexpected = expectationsFactory.getGeometryType();
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, geometrytype(geom) from org.hibernate.spatial.integration.%s.GeomEntity",
|
|
|
|
|
pckg
|
|
|
|
|
"SELECT id, geometrytype(geom) from %s",
|
|
|
|
|
entityName( pckg )
|
|
|
|
|
);
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, entityName( pckg ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@ -142,7 +142,7 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Integer> dbexpected = expectationsFactory.getSrid();
|
|
|
|
|
String hql = format( "SELECT id, srid(geom) from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
|
|
|
|
String hql = format( "SELECT id, srid(geom) from %s", entityName( pckg ) );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -161,7 +161,7 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Boolean> dbexpected = expectationsFactory.getIsSimple();
|
|
|
|
|
String hql = format( "SELECT id, issimple(geom) from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
|
|
|
|
String hql = format( "SELECT id, issimple(geom) from %s", entityName( pckg ) );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -180,7 +180,7 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Boolean> dbexpected = expectationsFactory.getIsEmpty();
|
|
|
|
|
String hql = format( "SELECT id, isEmpty(geom) from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
|
|
|
|
String hql = format( "SELECT id, isEmpty(geom) from %s", entityName( pckg ) );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -199,7 +199,7 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Geometry> dbexpected = expectationsFactory.getBoundary();
|
|
|
|
|
String hql = format( "SELECT id, boundary(geom) from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
|
|
|
|
String hql = format( "SELECT id, boundary(geom) from %s", entityName( pckg ) );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -218,7 +218,7 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Geometry> dbexpected = expectationsFactory.getEnvelope();
|
|
|
|
|
String hql = format( "SELECT id, envelope(geom) from org.hibernate.spatial.integration.%s.GeomEntity", pckg );
|
|
|
|
|
String hql = format( "SELECT id, envelope(geom) from %s", entityName( pckg ) );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, pckg );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -238,9 +238,9 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Boolean> dbexpected = expectationsFactory.getWithin( expectationsFactory.getTestPolygon() );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, within(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"SELECT id, within(geom, :filter) from %s " +
|
|
|
|
|
"where within(geom, :filter) = true and srid(geom) = %d",
|
|
|
|
|
pckg,
|
|
|
|
|
entityName( pckg ),
|
|
|
|
|
expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
|
|
|
@ -263,9 +263,9 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Boolean> dbexpected = expectationsFactory.getEquals( expectationsFactory.getTestPolygon() );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, equals(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"SELECT id, equals(geom, :filter) from %s " +
|
|
|
|
|
"where equals(geom, :filter) = true and srid(geom) = %d",
|
|
|
|
|
pckg,
|
|
|
|
|
entityName( pckg ),
|
|
|
|
|
expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
|
|
|
@ -288,9 +288,9 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Boolean> dbexpected = expectationsFactory.getCrosses( expectationsFactory.getTestPolygon() );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, crosses(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"SELECT id, crosses(geom, :filter) from %s " +
|
|
|
|
|
"where crosses(geom, :filter) = true and srid(geom) = %d",
|
|
|
|
|
pckg,
|
|
|
|
|
entityName( pckg ),
|
|
|
|
|
expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
|
|
|
@ -314,9 +314,9 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Boolean> dbexpected = expectationsFactory.getContains( expectationsFactory.getTestPolygon() );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, contains(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"SELECT id, contains(geom, :filter) from %s " +
|
|
|
|
|
"where contains(geom, :filter) = true and srid(geom) = %d",
|
|
|
|
|
pckg,
|
|
|
|
|
entityName( pckg ),
|
|
|
|
|
expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
|
|
|
@ -339,9 +339,9 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Boolean> dbexpected = expectationsFactory.getDisjoint( expectationsFactory.getTestPolygon() );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, disjoint(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"SELECT id, disjoint(geom, :filter) from %s " +
|
|
|
|
|
"where disjoint(geom, :filter) = true and srid(geom) = %d",
|
|
|
|
|
pckg,
|
|
|
|
|
entityName( pckg ),
|
|
|
|
|
expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
|
|
|
@ -364,9 +364,9 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Boolean> dbexpected = expectationsFactory.getIntersects( expectationsFactory.getTestPolygon() );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, intersects(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"SELECT id, intersects(geom, :filter) from %s " +
|
|
|
|
|
"where intersects(geom, :filter) = true and srid(geom) = %d",
|
|
|
|
|
pckg,
|
|
|
|
|
entityName( pckg ),
|
|
|
|
|
expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
|
|
|
@ -389,9 +389,8 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Boolean> dbexpected = expectationsFactory.getOverlaps( expectationsFactory.getTestPolygon() );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, overlaps(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"where overlaps(geom, :filter) = true and srid(geom) = %d",
|
|
|
|
|
pckg,
|
|
|
|
|
"SELECT id, overlaps(geom, :filter) from %s where overlaps(geom, :filter) = true and srid(geom) = %d",
|
|
|
|
|
entityName( pckg ),
|
|
|
|
|
expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
|
|
|
@ -413,9 +412,8 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, touches(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"where touches(geom, :filter) = true and srid(geom) = %d",
|
|
|
|
|
pckg,
|
|
|
|
|
"SELECT id, touches(geom, :filter) from %s where touches(geom, :filter) = true and srid(geom) = %d",
|
|
|
|
|
entityName( pckg ),
|
|
|
|
|
expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<Integer, Boolean> dbexpected = expectationsFactory.getTouches( expectationsFactory.getTestPolygon() );
|
|
|
|
@ -443,9 +441,9 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
matrix
|
|
|
|
|
);
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, relate(geom, :filter, :matrix) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"SELECT id, relate(geom, :filter, :matrix) from %s " +
|
|
|
|
|
"where relate(geom, :filter, :matrix) = true and srid(geom) = %d",
|
|
|
|
|
pckg,
|
|
|
|
|
entityName( pckg ),
|
|
|
|
|
expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
|
|
|
@ -475,8 +473,7 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Double> dbexpected = expectationsFactory.getDistance( expectationsFactory.getTestPolygon() );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, distance(geom, :filter) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"where srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
|
|
|
|
"SELECT id, distance(geom, :filter) from %s where srid(geom) = %d", entityName( pckg ), expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPolygon() );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
|
|
|
@ -498,8 +495,8 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Geometry> dbexpected = expectationsFactory.getBuffer( Double.valueOf( 1.0 ) );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, buffer(geom, :distance) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"where srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
|
|
|
|
"SELECT id, buffer(geom, :distance) from %s where srid(geom) = %d",
|
|
|
|
|
entityName( pckg ), expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "distance", Double.valueOf( 1.0 ) );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
|
|
|
@ -528,8 +525,8 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Geometry> dbexpected = expectationsFactory.getConvexHull( expectationsFactory.getTestPolygon() );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, convexhull(geomunion(geom, :polygon)) from org.hibernate.spatial.integration" +
|
|
|
|
|
".%s.GeomEntity where srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
|
|
|
|
"SELECT id, convexhull(geomunion(geom, :polygon)) from %s where srid(geom) = %d",
|
|
|
|
|
entityName( pckg ), expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "polygon", expectationsFactory.getTestPolygon() );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
|
|
|
@ -556,8 +553,8 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Geometry> dbexpected = expectationsFactory.getIntersection( expectationsFactory.getTestPolygon() );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, intersection(geom, :polygon) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"where srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
|
|
|
|
"SELECT id, intersection(geom, :polygon) from %s where srid(geom) = %d",
|
|
|
|
|
entityName( pckg ), expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "polygon", expectationsFactory.getTestPolygon() );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
|
|
|
@ -579,8 +576,8 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Geometry> dbexpected = expectationsFactory.getDifference( expectationsFactory.getTestPolygon() );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, difference(geom, :polygon) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"where srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
|
|
|
|
"SELECT id, difference(geom, :polygon) from %s where srid(geom) = %d",
|
|
|
|
|
entityName( pckg ), expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "polygon", expectationsFactory.getTestPolygon() );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
|
|
|
@ -602,9 +599,8 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Geometry> dbexpected = expectationsFactory.getSymDifference( expectationsFactory.getTestPolygon() );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, symdifference(geom, :polygon) from " +
|
|
|
|
|
"org.hibernate.spatial.integration.%s.GeomEntity where srid(geom) = %d",
|
|
|
|
|
pckg,
|
|
|
|
|
"SELECT id, symdifference(geom, :polygon) from %s where srid(geom) = %d",
|
|
|
|
|
entityName( pckg ),
|
|
|
|
|
expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "polygon", expectationsFactory.getTestPolygon() );
|
|
|
|
@ -627,8 +623,8 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
Map<Integer, Geometry> dbexpected = expectationsFactory.getGeomUnion( expectationsFactory.getTestPolygon() );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, geomunion(geom, :polygon) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"where srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
|
|
|
|
"SELECT id, geomunion(geom, :polygon) from %s " +
|
|
|
|
|
"where srid(geom) = %d", entityName( pckg ), expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "polygon", expectationsFactory.getTestPolygon() );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
|
|
|
@ -655,8 +651,8 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
);
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, dwithin(geom, :filter, :distance) from " +
|
|
|
|
|
"org.hibernate.spatial.integration.%s.GeomEntity where dwithin(geom, :filter, :distance) = true " +
|
|
|
|
|
"and srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
|
|
|
|
"%s where dwithin(geom, :filter, :distance) = true " +
|
|
|
|
|
"and srid(geom) = %d", entityName( pckg ), expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "filter", expectationsFactory.getTestPoint() );
|
|
|
|
|
if ( getDialect() instanceof OracleSpatial10gDialect ) {
|
|
|
|
@ -693,8 +689,8 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
int epsg = 4324;
|
|
|
|
|
Map<Integer, Geometry> dbexpected = expectationsFactory.getTransform( epsg );
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, transform(geom, :epsg) from org.hibernate.spatial.integration.%s.GeomEntity " +
|
|
|
|
|
"where srid(geom) = %d", pckg, expectationsFactory.getTestSrid()
|
|
|
|
|
"SELECT id, transform(geom, :epsg) from %s " +
|
|
|
|
|
"where srid(geom) = %d", entityName( pckg ), expectationsFactory.getTestSrid()
|
|
|
|
|
);
|
|
|
|
|
Map<String, Object> params = createQueryParams( "epsg", Integer.valueOf( epsg ) );
|
|
|
|
|
retrieveHQLResultsAndCompare( dbexpected, hql, params, pckg );
|
|
|
|
@ -717,7 +713,7 @@ public class TestSpatialFunctions extends SpatialFunctionalTestCase {
|
|
|
|
|
}
|
|
|
|
|
// here we just check if we get a result, and can read it
|
|
|
|
|
String hql = format(
|
|
|
|
|
"SELECT id, extent(geom) from org.hibernate.spatial.integration.%s.GeomEntity group by id", pckg
|
|
|
|
|
"SELECT id, extent(geom) from %s group by id", entityName( pckg )
|
|
|
|
|
);
|
|
|
|
|
Map<Integer, Object> hsreceived = new HashMap<Integer, Object>();
|
|
|
|
|
doInSession( hql, hsreceived, new HashMap<String, Object>() );
|
|
|
|
|