@Test public void testEmptyPolygon() throws GeometryOperationFailedException { GeometryIndexOperation operation = new InsertVertexOperation(service, target, geometryEditService); Geometry polygon = new Geometry(Geometry.POLYGON, 0, 0); try { operation.execute(polygon, service.create(GeometryIndexType.TYPE_EDGE, 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 && service.getType(index) != GeometryIndexType.TYPE_EDGE) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_VERTEX or TYPE_EDGE."); } try { insert(geometry, index, coordinate); updateGeometryEditServiceProperties(geometry, index, coordinate); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } }
InsertVertexOperation implements GeometryIndexOperation { @Override public Geometry execute(Geometry geometry, GeometryIndex index) throws GeometryOperationFailedException { this.index = index; if (service.getType(index) != GeometryIndexType.TYPE_VERTEX && service.getType(index) != GeometryIndexType.TYPE_EDGE) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_VERTEX or TYPE_EDGE."); } try { insert(geometry, index, coordinate); updateGeometryEditServiceProperties(geometry, index, coordinate); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } }
InsertVertexOperation implements GeometryIndexOperation { @Override public Geometry execute(Geometry geometry, GeometryIndex index) throws GeometryOperationFailedException { this.index = index; if (service.getType(index) != GeometryIndexType.TYPE_VERTEX && service.getType(index) != GeometryIndexType.TYPE_EDGE) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_VERTEX or TYPE_EDGE."); } try { insert(geometry, index, coordinate); updateGeometryEditServiceProperties(geometry, index, coordinate); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } InsertVertexOperation(GeometryIndexService service, Coordinate coordinate,
								 GeometryEditService geometryEditService); }
InsertVertexOperation implements GeometryIndexOperation { @Override public Geometry execute(Geometry geometry, GeometryIndex index) throws GeometryOperationFailedException { this.index = index; if (service.getType(index) != GeometryIndexType.TYPE_VERTEX && service.getType(index) != GeometryIndexType.TYPE_EDGE) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_VERTEX or TYPE_EDGE."); } try { insert(geometry, index, coordinate); updateGeometryEditServiceProperties(geometry, index, coordinate); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } InsertVertexOperation(GeometryIndexService service, Coordinate coordinate,
								 GeometryEditService geometryEditService); @Override Geometry execute(Geometry geometry, GeometryIndex index); @Override GeometryIndexOperation getInverseOperation(); @Override GeometryIndex getGeometryIndex(); }
InsertVertexOperation implements GeometryIndexOperation { @Override public Geometry execute(Geometry geometry, GeometryIndex index) throws GeometryOperationFailedException { this.index = index; if (service.getType(index) != GeometryIndexType.TYPE_VERTEX && service.getType(index) != GeometryIndexType.TYPE_EDGE) { throw new GeometryOperationFailedException("Index of wrong type. Must be TYPE_VERTEX or TYPE_EDGE."); } try { insert(geometry, index, coordinate); updateGeometryEditServiceProperties(geometry, index, coordinate); return geometry; } catch (GeometryIndexNotFoundException e) { throw new GeometryOperationFailedException(e); } } InsertVertexOperation(GeometryIndexService service, Coordinate coordinate,
								 GeometryEditService geometryEditService); @Override Geometry execute(Geometry geometry, GeometryIndex index); @Override GeometryIndexOperation getInverseOperation(); @Override GeometryIndex getGeometryIndex();  }