use of org.eclipse.persistence.testing.tests.spatial.jgeometry.SQLReader in project eclipselink by eclipse-ee4j.
the class Query_SpatialExpOp_ExpGeom_Tests method testSDOWithinDistanceArbitraryLine.
/**
* SDO_WITHIN_DISTANCE using an arbitrary line string {(10,10), (20, 20), (30, 30), (45,45)}
*/
public void testSDOWithinDistanceArbitraryLine() throws Exception {
String sql = "select GID, GEOMETRY from WRAPPED_SPATIAL WS where " + "mdsys.sdo_within_distance(WS.geometry.geom, " + "mdsys.sdo_geometry(2,null,null, " + "mdsys.sdo_elem_info_array(1,2,1), " + "mdsys.sdo_ordinate_array(10,10, 20,20, 30,30, 45,45)), " + "'DISTANCE=10') = 'TRUE' ORDER BY GID";
SQLReader reader = new SQLReader(session, sql);
JGeometry line = JGeometry.createLinearLineString(new double[] { 10, 10, 20, 20, 30, 30, 45, 45 }, 2, 0);
ReadAllQuery raq = new ReadAllQuery(WrappedSpatial.class);
ExpressionBuilder eb = raq.getExpressionBuilder();
String params = "DISTANCE=10";
Expression selectionCriteria = SpatialExpressionFactory.withinDistance(eb.get("geometry").getField("geom"), line, new SpatialParameters(params));
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.tests.spatial.jgeometry.SQLReader in project eclipselink by eclipse-ee4j.
the class Query_SpatialExpOp_ExpGeom_Tests method testSDORelateRectangle.
/**
* SDO_RELATE using a dynamic rectangular window with lower left
* and upper right coordinates of {(1,1), (20,20)}
*/
public void testSDORelateRectangle() throws Exception {
String sql = "select GID, GEOMETRY from WRAPPED_SPATIAL ws where mdsys.sdo_relate(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)), " + "'MASK=ANYINTERACT QUERYTYPE=WINDOW') = '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();
String params = "MASK=ANYINTERACT QUERYTYPE=WINDOW";
Expression selectionCriteria = SpatialExpressionFactory.relate(eb.get("geometry").getField("geom"), rectangle, new SpatialParameters(params));
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.tests.spatial.jgeometry.SQLReader in project eclipselink by eclipse-ee4j.
the class Query_SpatialExpOp_ExpGeom_Tests method testSDORelateArbitraryLine.
/**
* SDO_RELATE using an arbitrary line string {(10,10), (20, 20), (30, 30), (45,45)}
*/
public void testSDORelateArbitraryLine() throws Exception {
String sql = "select GID, GEOMETRY from WRAPPED_SPATIAL WS where mdsys.sdo_relate(" + "WS.geometry.geom, mdsys.sdo_geometry(2,null,null, " + "mdsys.sdo_elem_info_array(1,2,1), " + "mdsys.sdo_ordinate_array(10,10, 20,20, 30,30, 45,45)), " + "'MASK=ANYINTERACT QUERYTYPE=WINDOW') = 'TRUE' ORDER BY GID";
SQLReader reader = new SQLReader(session, sql);
JGeometry line = JGeometry.createLinearLineString(new double[] { 10, 10, 20, 20, 30, 30, 45, 45 }, 2, 0);
ReadAllQuery raq = new ReadAllQuery(WrappedSpatial.class);
ExpressionBuilder eb = raq.getExpressionBuilder();
String params = "MASK=ANYINTERACT QUERYTYPE=WINDOW";
Expression selectionCriteria = SpatialExpressionFactory.relate(eb.get("geometry").getField("geom"), line, new SpatialParameters(params));
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.tests.spatial.jgeometry.SQLReader in project eclipselink by eclipse-ee4j.
the class Query_SpatialExpOp_ExpGeom_Tests method testSDOFilterArbitraryLine.
/**
* SDO_FILTER using an arbitrary line string {(10,10), (20, 20), (30, 30), (45,45)}
*/
public void testSDOFilterArbitraryLine() throws Exception {
String sql = "select GID, GEOMETRY from WRAPPED_SPATIAL WS where mdsys.sdo_filter(" + "WS.geometry.geom, mdsys.sdo_geometry(2,null,null, " + "mdsys.sdo_elem_info_array(1,2,1), " + "mdsys.sdo_ordinate_array(10,10, 20,20, 30,30, 45,45)), " + "'QUERYTYPE=WINDOW') = 'TRUE' ORDER BY GID";
SQLReader reader = new SQLReader(session, sql);
JGeometry line = JGeometry.createLinearLineString(new double[] { 10, 10, 20, 20, 30, 30, 45, 45 }, 2, 0);
ReadAllQuery raq = new ReadAllQuery(WrappedSpatial.class);
ExpressionBuilder eb = raq.getExpressionBuilder();
String params = "QUERYTYPE=WINDOW";
Expression selectionCriteria = SpatialExpressionFactory.filter(eb.get("geometry").getField("geom"), line, new SpatialParameters(params));
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.tests.spatial.jgeometry.SQLReader in project eclipselink by eclipse-ee4j.
the class Query_SpatialExpOp_ExpGeom_Tests method testSDOWithinDistanceNullParamsMatchingCircle1004.
/**
* SDO_WITHIN_DISTANCE with NULL params matching a known circle geometry (1004)
*/
public void testSDOWithinDistanceNullParamsMatchingCircle1004() throws Exception {
String sql = "select GID, GEOMETRY from WRAPPED_SPATIAL WS where " + "mdsys.sdo_within_distance(WS.geometry.geom, mdsys.sdo_geometry(3, " + "NULL, null, mdsys.sdo_elem_info_array(1,3,4), " + "mdsys.sdo_ordinate_array(1, 0, 0, 1, 0, -1)), " + "NULL) = 'TRUE' ORDER BY GID";
SQLReader reader = new SQLReader(session, sql);
JGeometry circle = JGeometry.createCircle(1, 0, 0, 1, 0, -1, 0);
ReadAllQuery raq = new ReadAllQuery(WrappedSpatial.class);
ExpressionBuilder eb = raq.getExpressionBuilder();
String params = "";
Expression selectionCriteria = SpatialExpressionFactory.withinDistance(eb.get("geometry").getField("geom"), circle, new SpatialParameters(params));
raq.setSelectionCriteria(selectionCriteria);
raq.addAscendingOrdering("id");
List<Spatial> results = (List<Spatial>) session.executeQuery(raq);
String compareResult = reader.compare(results);
assertNull(compareResult, compareResult);
}
Aggregations