use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.Spatial in project eclipselink by eclipse-ee4j.
the class Query_SpatialExpOp_ExpGeom_Tests method testSDOFilterRectangleNullParams.
public void testSDOFilterRectangleNullParams() throws Exception {
String sql = "select GID, GEOMETRY from WRAPPED_SPATIAL WS where mdsys.sdo_filter(" + "WS.geometry.geom, mdsys.sdo_geometry(3,null,null, " + "mdsys.sdo_elem_info_array(1,3,3), " + "mdsys.sdo_ordinate_array(1,1, 20, 20)), " + "NULL) = 'TRUE' ORDER BY GID";
SQLReader reader = new SQLReader(session, sql);
JGeometry rectangle = JGeometry.createLinearPolygon(new double[] { 1, 1, 1, 20, 10, 20, 20, 1, 1, 1 }, 2, 0);
ReadAllQuery raq = new ReadAllQuery(WrappedSpatial.class);
ExpressionBuilder eb = raq.getExpressionBuilder();
Expression selectionCriteria = SpatialExpressionFactory.filter(eb.get("geometry").getField("geom"), rectangle, null);
raq.setSelectionCriteria(selectionCriteria);
raq.addAscendingOrdering("id");
List<Spatial> results = (List<Spatial>) session.executeQuery(raq);
String compareResult = reader.compare(results);
assertNull(compareResult, compareResult);
}
use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.Spatial in project eclipselink by eclipse-ee4j.
the class Query_OrderedHint method testReadAll.
public void testReadAll() throws Exception {
String sql = "select GID, GEOMETRY from SIMPLE_SPATIAL ORDER BY GID";
SQLReader reader = new SQLReader(session, sql);
ReadAllQuery raq = new ReadAllQuery(SimpleSpatial.class);
raq.addAscendingOrdering("id");
raq.setHintString("/*+ ORDERED */ ");
List<Spatial> results = (List<Spatial>) session.executeQuery(raq);
String compareResult = reader.compare(results);
assertNull(compareResult, compareResult);
}
use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.Spatial in project eclipselink by eclipse-ee4j.
the class Query_SpatialExpOp_ExpGeom_Tests method testSDOFilterCircle.
/**
* SDO_FILTER using a with a circle of radius 10 around (0,0)
*/
public void testSDOFilterCircle() throws Exception {
String sql = "select GID, GEOMETRY from SIMPLE_SPATIAL where mdsys.sdo_filter(" + "geometry, mdsys.sdo_geometry(3,null,null, " + "mdsys.sdo_elem_info_array(1,3,4), " + "mdsys.sdo_ordinate_array(-10,0, 0, 10, 10, 0)), " + "'QUERYTYPE=WINDOW') = 'TRUE' ORDER BY GID";
SQLReader reader = new SQLReader(session, sql);
JGeometry circle = JGeometry.createCircle(-10, 0, 0, 10, 10, 0, 0);
ReadAllQuery raq = new ReadAllQuery(SimpleSpatial.class);
ExpressionBuilder eb = raq.getExpressionBuilder();
Expression selectionCriteria = SpatialExpressionFactory.filter(eb.get("geometry"), circle, new SpatialParameters("QUERYTYPE=WINDOW"));
raq.setSelectionCriteria(selectionCriteria);
raq.addAscendingOrdering("id");
List<Spatial> results = (List<Spatial>) session.executeQuery(raq);
String compareResult = reader.compare(results);
assertNull(compareResult, compareResult);
}
use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.Spatial in project eclipselink by eclipse-ee4j.
the class Query_SpatialExpOp_ExpGeom_Tests method testSDORelateCircle.
/**
* SDO_RELATE using a with a circle of radius 10 around (0,0)
*/
public void testSDORelateCircle() throws Exception {
String sql = "select GID, GEOMETRY from SIMPLE_SPATIAL where mdsys.sdo_relate(geometry, " + "mdsys.sdo_geometry(3,null,null, " + "mdsys.sdo_elem_info_array(1,3,4), " + "mdsys.sdo_ordinate_array(-10,0, 0, 10, 10, 0)), " + "'MASK=ANYINTERACT QUERYTYPE=WINDOW') = 'TRUE' ORDER BY GID";
SQLReader reader = new SQLReader(session, sql);
JGeometry circle = JGeometry.createCircle(-10, 0, 0, 10, 10, 0, 0);
ReadAllQuery raq = new ReadAllQuery(SimpleSpatial.class);
ExpressionBuilder eb = raq.getExpressionBuilder();
Expression selectionCriteria = SpatialExpressionFactory.relate(eb.get("geometry"), circle, new SpatialParameters("MASK=ANYINTERACT QUERYTYPE=WINDOW"));
raq.setSelectionCriteria(selectionCriteria);
raq.addAscendingOrdering("id");
List<Spatial> results = (List<Spatial>) session.executeQuery(raq);
String compareResult = reader.compare(results);
assertNull(compareResult, compareResult);
}
use of org.eclipse.persistence.testing.models.spatial.jgeometry.wrapped.Spatial in project eclipselink by eclipse-ee4j.
the class Query_SpatialExpOp_ExpGeom_Tests method testSDOWithinDistanceRectangleUsingMaxResolution.
public void testSDOWithinDistanceRectangleUsingMaxResolution() throws Exception {
String sql = "select GID, GEOMETRY from SIMPLE_SPATIAL where mdsys.sdo_within_distance(" + "geometry, mdsys.sdo_geometry(3,null,null, mdsys.sdo_elem_info_array(1,3,3), " + "mdsys.sdo_ordinate_array(1,1, 20, 20)), " + "'DISTANCE=10 MAX_RESOLUTION=5') = 'TRUE' ORDER BY GID";
SQLReader reader = new SQLReader(session, sql);
JGeometry rectangle = JGeometry.createLinearPolygon(new double[] { 1, 1, 1, 20, 10, 20, 20, 1, 1, 1 }, 2, 0);
ReadAllQuery raq = new ReadAllQuery(SimpleSpatial.class);
ExpressionBuilder eb = raq.getExpressionBuilder();
Expression selectionCriteria = SpatialExpressionFactory.withinDistance(eb.get("geometry"), rectangle, new SpatialParameters("DISTANCE=10 MAX_RESOLUTION=5"));
raq.setSelectionCriteria(selectionCriteria);
raq.addAscendingOrdering("id");
List<Spatial> results = (List<Spatial>) session.executeQuery(raq);
String compareResult = reader.compare(results);
assertNull(compareResult, compareResult);
}
Aggregations