@Test public void testLinearRingCornerCases() { GeometryIndexOperation operation = new DeleteGeometryOperation(service); try { operation.execute(linearRing, service.create(GeometryIndexType.TYPE_EDGE, 0)); Assert.fail(); } catch (GeometryOperationFailedException e) { } try { operation.execute(linearRing, service.create(GeometryIndexType.TYPE_VERTEX, 0)); Assert.fail(); } catch (GeometryOperationFailedException e) { } try { operation.execute(linearRing, service.create(GeometryIndexType.TYPE_GEOMETRY, 0, 0)); Assert.fail(); } catch (GeometryOperationFailedException e) { } }
@Override public Geometry execute(Geometry geometry, GeometryIndex index) throws GeometryOperationFailedException { this.index = index; if (service.getType(index) != GeometryIndexType.TYPE_GEOMETRY) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_GEOMETRY."); } try { deleted = service.getGeometry(geometry, index); delete(geometry, index); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } }
DeleteGeometryOperation implements GeometryIndexOperation { @Override public Geometry execute(Geometry geometry, GeometryIndex index) throws GeometryOperationFailedException { this.index = index; if (service.getType(index) != GeometryIndexType.TYPE_GEOMETRY) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_GEOMETRY."); } try { deleted = service.getGeometry(geometry, index); delete(geometry, index); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } }
DeleteGeometryOperation implements GeometryIndexOperation { @Override public Geometry execute(Geometry geometry, GeometryIndex index) throws GeometryOperationFailedException { this.index = index; if (service.getType(index) != GeometryIndexType.TYPE_GEOMETRY) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_GEOMETRY."); } try { deleted = service.getGeometry(geometry, index); delete(geometry, index); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } DeleteGeometryOperation(GeometryIndexService service); }
DeleteGeometryOperation implements GeometryIndexOperation { @Override public Geometry execute(Geometry geometry, GeometryIndex index) throws GeometryOperationFailedException { this.index = index; if (service.getType(index) != GeometryIndexType.TYPE_GEOMETRY) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_GEOMETRY."); } try { deleted = service.getGeometry(geometry, index); delete(geometry, index); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } DeleteGeometryOperation(GeometryIndexService service); @Override Geometry execute(Geometry geometry, GeometryIndex index); @Override GeometryIndexOperation getInverseOperation(); @Override GeometryIndex getGeometryIndex(); }
DeleteGeometryOperation implements GeometryIndexOperation { @Override public Geometry execute(Geometry geometry, GeometryIndex index) throws GeometryOperationFailedException { this.index = index; if (service.getType(index) != GeometryIndexType.TYPE_GEOMETRY) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_GEOMETRY."); } try { deleted = service.getGeometry(geometry, index); delete(geometry, index); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } DeleteGeometryOperation(GeometryIndexService service); @Override Geometry execute(Geometry geometry, GeometryIndex index); @Override GeometryIndexOperation getInverseOperation(); @Override GeometryIndex getGeometryIndex();  }