@Test public void testPointCornerCases() { GeometryIndexOperation operation = new DeleteVertexOperation(service, geometryEditService); try { operation.execute(point, service.create(GeometryIndexType.TYPE_EDGE, 0)); Assert.fail(); } catch (GeometryOperationFailedException e) { } try { operation.execute(point, service.create(GeometryIndexType.TYPE_GEOMETRY, 0)); Assert.fail(); } catch (GeometryOperationFailedException e) { } try { operation.execute(point, service.create(GeometryIndexType.TYPE_VERTEX, -1)); Assert.fail(); } catch (GeometryOperationFailedException e) { } try { operation.execute(point, service.create(GeometryIndexType.TYPE_VERTEX, 1)); Assert.fail(); } catch (GeometryOperationFailedException e) { } try { operation.execute(point, service.create(GeometryIndexType.TYPE_VERTEX, 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_VERTEX) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_VERTEX."); } try { coordinate = service.getVertex(geometry, index); tentativeMoveOrigin = null; delete(geometry, index); updateGeometryEditServiceProperties(geometry); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } }
DeleteVertexOperation implements GeometryIndexOperation { @Override public Geometry execute(Geometry geometry, GeometryIndex index) throws GeometryOperationFailedException { this.index = index; if (service.getType(index) != GeometryIndexType.TYPE_VERTEX) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_VERTEX."); } try { coordinate = service.getVertex(geometry, index); tentativeMoveOrigin = null; delete(geometry, index); updateGeometryEditServiceProperties(geometry); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } }
DeleteVertexOperation implements GeometryIndexOperation { @Override public Geometry execute(Geometry geometry, GeometryIndex index) throws GeometryOperationFailedException { this.index = index; if (service.getType(index) != GeometryIndexType.TYPE_VERTEX) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_VERTEX."); } try { coordinate = service.getVertex(geometry, index); tentativeMoveOrigin = null; delete(geometry, index); updateGeometryEditServiceProperties(geometry); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } DeleteVertexOperation(GeometryIndexService service, GeometryEditService geometryEditService); }
DeleteVertexOperation implements GeometryIndexOperation { @Override public Geometry execute(Geometry geometry, GeometryIndex index) throws GeometryOperationFailedException { this.index = index; if (service.getType(index) != GeometryIndexType.TYPE_VERTEX) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_VERTEX."); } try { coordinate = service.getVertex(geometry, index); tentativeMoveOrigin = null; delete(geometry, index); updateGeometryEditServiceProperties(geometry); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } DeleteVertexOperation(GeometryIndexService service, GeometryEditService geometryEditService); @Override Geometry execute(Geometry geometry, GeometryIndex index); @Override GeometryIndexOperation getInverseOperation(); @Override GeometryIndex getGeometryIndex(); }
DeleteVertexOperation implements GeometryIndexOperation { @Override public Geometry execute(Geometry geometry, GeometryIndex index) throws GeometryOperationFailedException { this.index = index; if (service.getType(index) != GeometryIndexType.TYPE_VERTEX) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_VERTEX."); } try { coordinate = service.getVertex(geometry, index); tentativeMoveOrigin = null; delete(geometry, index); updateGeometryEditServiceProperties(geometry); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } DeleteVertexOperation(GeometryIndexService service, GeometryEditService geometryEditService); @Override Geometry execute(Geometry geometry, GeometryIndex index); @Override GeometryIndexOperation getInverseOperation(); @Override GeometryIndex getGeometryIndex();  }