use of org.locationtech.jts.geom.util.AffineTransformation in project h2database by h2database.
the class TestSpatial method testInPlaceUpdate.
/**
* If the user mutate the geometry of the object, the object cache must not
* be updated.
*/
private void testInPlaceUpdate() throws SQLException {
try (Connection conn = getConnection(URL)) {
ResultSet rs = conn.createStatement().executeQuery("SELECT 'POINT(1 1)'::geometry");
assertTrue(rs.next());
// Mutate the geometry
((Geometry) rs.getObject(1)).apply(new AffineTransformation(1, 0, 1, 1, 0, 1));
rs.close();
rs = conn.createStatement().executeQuery("SELECT 'POINT(1 1)'::geometry");
assertTrue(rs.next());
// Check if the geometry is the one requested
assertEquals(1, ((Point) rs.getObject(1)).getX());
assertEquals(1, ((Point) rs.getObject(1)).getY());
rs.close();
}
}
Aggregations