@Test public void testMultiPointCornerCases() { GeometryIndexOperation operation = new MoveVertexOperation(service, new Coordinate(NEW_VALUE, 0)); try { operation.execute(multiPoint, service.create(GeometryIndexType.TYPE_EDGE, 1, 0)); Assert.fail(); } catch (GeometryOperationFailedException e) { } try { operation.execute(multiPoint, service.create(GeometryIndexType.TYPE_VERTEX, 1, 1)); Assert.fail(); } catch (GeometryOperationFailedException e) { } try { operation.execute(multiPoint, service.create(GeometryIndexType.TYPE_VERTEX, 0)); Assert.fail(); } catch (GeometryOperationFailedException e) { } try { operation.execute(multiPoint, service.create(GeometryIndexType.TYPE_VERTEX, 0, 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 { oldLocation = service.getVertex(geometry, index); setVertex(geometry, index, newLocation); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } }
MoveVertexOperation 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 { oldLocation = service.getVertex(geometry, index); setVertex(geometry, index, newLocation); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } }
MoveVertexOperation 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 { oldLocation = service.getVertex(geometry, index); setVertex(geometry, index, newLocation); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } MoveVertexOperation(GeometryIndexService service, Coordinate newLocation); }
MoveVertexOperation 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 { oldLocation = service.getVertex(geometry, index); setVertex(geometry, index, newLocation); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } MoveVertexOperation(GeometryIndexService service, Coordinate newLocation); @Override Geometry execute(Geometry geometry, GeometryIndex index); @Override GeometryIndexOperation getInverseOperation(); @Override GeometryIndex getGeometryIndex(); }
MoveVertexOperation 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 { oldLocation = service.getVertex(geometry, index); setVertex(geometry, index, newLocation); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } MoveVertexOperation(GeometryIndexService service, Coordinate newLocation); @Override Geometry execute(Geometry geometry, GeometryIndex index); @Override GeometryIndexOperation getInverseOperation(); @Override GeometryIndex getGeometryIndex();  }