@Test(expected = ValueExprEvaluationException.class) public void testEvaluateWithInvalidRadius() { buffer.evaluate(f, point, f.createLiteral("foobar", XMLSchema.DECIMAL), unit); }
@Override public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args.length != 3) { throw new ValueExprEvaluationException(getURI() + " requires exactly 3 arguments, got " + args.length); } SpatialContext geoContext = SpatialSupport.getSpatialContext(); Shape geom = FunctionArguments.getShape(this, args[0], geoContext); double radiusUom = FunctionArguments.getDouble(this, args[1]); IRI units = FunctionArguments.getUnits(this, args[2]); double radiusDegs = FunctionArguments.convertToDegrees(radiusUom, units); Shape buffered = SpatialSupport.getSpatialAlgebra().buffer(geom, radiusDegs); String wkt; try { wkt = SpatialSupport.getWktWriter().toWkt(buffered); } catch (IOException ioe) { throw new ValueExprEvaluationException(ioe); } return valueFactory.createLiteral(wkt, GEO.WKT_LITERAL); }
Buffer implements Function { @Override public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args.length != 3) { throw new ValueExprEvaluationException(getURI() + " requires exactly 3 arguments, got " + args.length); } SpatialContext geoContext = SpatialSupport.getSpatialContext(); Shape geom = FunctionArguments.getShape(this, args[0], geoContext); double radiusUom = FunctionArguments.getDouble(this, args[1]); IRI units = FunctionArguments.getUnits(this, args[2]); double radiusDegs = FunctionArguments.convertToDegrees(radiusUom, units); Shape buffered = SpatialSupport.getSpatialAlgebra().buffer(geom, radiusDegs); String wkt; try { wkt = SpatialSupport.getWktWriter().toWkt(buffered); } catch (IOException ioe) { throw new ValueExprEvaluationException(ioe); } return valueFactory.createLiteral(wkt, GEO.WKT_LITERAL); } }
Buffer implements Function { @Override public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args.length != 3) { throw new ValueExprEvaluationException(getURI() + " requires exactly 3 arguments, got " + args.length); } SpatialContext geoContext = SpatialSupport.getSpatialContext(); Shape geom = FunctionArguments.getShape(this, args[0], geoContext); double radiusUom = FunctionArguments.getDouble(this, args[1]); IRI units = FunctionArguments.getUnits(this, args[2]); double radiusDegs = FunctionArguments.convertToDegrees(radiusUom, units); Shape buffered = SpatialSupport.getSpatialAlgebra().buffer(geom, radiusDegs); String wkt; try { wkt = SpatialSupport.getWktWriter().toWkt(buffered); } catch (IOException ioe) { throw new ValueExprEvaluationException(ioe); } return valueFactory.createLiteral(wkt, GEO.WKT_LITERAL); }  }
Buffer implements Function { @Override public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args.length != 3) { throw new ValueExprEvaluationException(getURI() + " requires exactly 3 arguments, got " + args.length); } SpatialContext geoContext = SpatialSupport.getSpatialContext(); Shape geom = FunctionArguments.getShape(this, args[0], geoContext); double radiusUom = FunctionArguments.getDouble(this, args[1]); IRI units = FunctionArguments.getUnits(this, args[2]); double radiusDegs = FunctionArguments.convertToDegrees(radiusUom, units); Shape buffered = SpatialSupport.getSpatialAlgebra().buffer(geom, radiusDegs); String wkt; try { wkt = SpatialSupport.getWktWriter().toWkt(buffered); } catch (IOException ioe) { throw new ValueExprEvaluationException(ioe); } return valueFactory.createLiteral(wkt, GEO.WKT_LITERAL); }  @Override String getURI(); @Override Value evaluate(ValueFactory valueFactory, Value... args); }
Buffer implements Function { @Override public Value evaluate(ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException { if (args.length != 3) { throw new ValueExprEvaluationException(getURI() + " requires exactly 3 arguments, got " + args.length); } SpatialContext geoContext = SpatialSupport.getSpatialContext(); Shape geom = FunctionArguments.getShape(this, args[0], geoContext); double radiusUom = FunctionArguments.getDouble(this, args[1]); IRI units = FunctionArguments.getUnits(this, args[2]); double radiusDegs = FunctionArguments.convertToDegrees(radiusUom, units); Shape buffered = SpatialSupport.getSpatialAlgebra().buffer(geom, radiusDegs); String wkt; try { wkt = SpatialSupport.getWktWriter().toWkt(buffered); } catch (IOException ioe) { throw new ValueExprEvaluationException(ioe); } return valueFactory.createLiteral(wkt, GEO.WKT_LITERAL); }  @Override String getURI(); @Override Value evaluate(ValueFactory valueFactory, Value... args);  }