/** * Does the buffer for the source geomety * * @param sourceGeometry * @param width * @param sourceUnits * @param targetUnits * @param quadrantSegments * @param monitor * @return * @throws InterruptedException */ private Geometry makeBufferGeometry( final Geometry sourceGeometry, final double width, final Unit sourceUnits, final Unit targetUnits, final int quadrantSegments, final IProgressMonitor monitor) throws InterruptedException { double bufferWidth = getBufferWidth(width, sourceUnits, targetUnits); BufferOp bufOp = new BufferOp(sourceGeometry); bufOp.setQuadrantSegments(quadrantSegments); Geometry bufferedGeometry = bufOp.getResultGeometry(bufferWidth, new JTSProgressMonitor(monitor)); return bufferedGeometry; }
private Geometry createBuffer( List<Geometry> lineStrings, double bufferSize, boolean excludeTermini) { BufferParameters bufferParameters = new BufferParameters(); if (excludeTermini) { bufferParameters.setEndCapStyle(BufferParameters.CAP_FLAT); } else { bufferParameters.setEndCapStyle(BufferParameters.CAP_ROUND); } Geometry union = null; for (Geometry lineString : lineStrings) { Geometry buffer = BufferOp.bufferOp(lineString, bufferSize, bufferParameters); if (union == null) { union = buffer; } else { union = union.union(buffer); } } return union; }