use of org.eclipse.persistence.testing.models.spatial.jgeometry.SimpleSpatial in project eclipselink by eclipse-ee4j.
the class SampleGeometries method simplePopulation.
/**
* @return population objects for database initialization
*/
public List<SimpleSpatial> simplePopulation() throws Exception {
List<SimpleSpatial> population = new ArrayList<SimpleSpatial>();
population.add(new SimpleSpatial(1000, pointCluster1()));
population.add(new SimpleSpatial(1001, pointCluster2()));
population.add(new SimpleSpatial(1002, simplyPolygon()));
population.add(new SimpleSpatial(1003, polygonOfCircularArcs()));
population.add(new SimpleSpatial(1004, circle()));
population.add(new SimpleSpatial(1005, rectangle()));
population.add(new SimpleSpatial(1006, compoundLineAndRectangle()));
population.add(new SimpleSpatial(1007, compoundPolygonWithRectangularHole()));
population.add(new SimpleSpatial(1008, geometry1008()));
population.add(new SimpleSpatial(1009, geometryWithNulls()));
population.add(new SimpleSpatial(1010, null));
population.add(new SimpleSpatial(1011, polygon1011()));
population.add(new SimpleSpatial(1012, polygon1012()));
population.add(new SimpleSpatial(1013, point()));
return population;
}
use of org.eclipse.persistence.testing.models.spatial.jgeometry.SimpleSpatial in project eclipselink by eclipse-ee4j.
the class Query_Basic_Tests method testReadNotNullGeometry.
/**
* Comparisons to geometry != NULL always fail.
*/
public void testReadNotNullGeometry() throws Exception {
ReadAllQuery roq = new ReadAllQuery(SimpleSpatial.class);
ExpressionBuilder eb = roq.getExpressionBuilder();
roq.setSelectionCriteria(eb.get("geometry").notNull());
List<SimpleSpatial> results = (List<SimpleSpatial>) session.executeQuery(roq);
assertNotNull(results);
int countAll = DeleteTests.countSimpleSpatial(session);
assertEquals("More then one found", countAll - 1, results.size());
}
use of org.eclipse.persistence.testing.models.spatial.jgeometry.SimpleSpatial in project eclipselink by eclipse-ee4j.
the class UpdateTests method testUpdateSingleToNull.
public void testUpdateSingleToNull() throws Exception {
UnitOfWork uow = session.acquireUnitOfWork();
SimpleSpatial ss = (SimpleSpatial) uow.readObject(SimpleSpatial.class, new ExpressionBuilder().get("geometry").notNull());
assertNotNull("No SimpleSpatial instances found", ss);
ss.setJGeometry(null);
uow.writeChanges();
uow.release();
}
use of org.eclipse.persistence.testing.models.spatial.jgeometry.SimpleSpatial in project eclipselink by eclipse-ee4j.
the class Query_SpatialOp_ExpReport_Tests method populateTestGeometry.
private void populateTestGeometry(JGeometry g) {
UnitOfWork uow = session.acquireUnitOfWork();
uow.registerNewObject(new SimpleSpatial(6666, g));
uow.commit();
}
use of org.eclipse.persistence.testing.models.spatial.jgeometry.SimpleSpatial in project eclipselink by eclipse-ee4j.
the class Query_Basic_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 {
double[] points = new double[] { 1, 1, 1, 20, 10, 20, 20, 1, 1, 1 };
JGeometry rectangle = JGeometry.createLinearPolygon(points, 2, 0);
ReadAllQuery raq = new ReadAllQuery(WrappedSpatial.class);
ExpressionBuilder eb = raq.getExpressionBuilder();
SpatialParameters parameters = new SpatialParameters();
parameters.setQueryType(SpatialParameters.QueryType.WINDOW).setMask(Mask.ANYINTERACT);
Expression selectionCriteria = SpatialExpressionFactory.relate(eb.get("geometry").getField("geom"), rectangle, parameters);
raq.setSelectionCriteria(selectionCriteria);
raq.addAscendingOrdering("id");
List<SimpleSpatial> results = (List<SimpleSpatial>) session.executeQuery(raq);
assertNotNull(results);
}
Aggregations