use of com.esri.core.geometry.ogc.OGCGeometry in project pigeon by aseldawy.
the class Buffer method exec.
@Override
public DataByteArray exec(Tuple input) throws IOException {
OGCGeometry geom = null;
try {
Object v = input.get(0);
geom = geometryParser.parseGeom(v);
double dist;
Object distance = input.get(1);
if (distance instanceof Double)
dist = (Double) distance;
else if (distance instanceof Float)
dist = (Float) distance;
else if (distance instanceof Integer)
dist = (Integer) distance;
else if (distance instanceof Long)
dist = (Long) distance;
else if (distance instanceof String)
dist = Double.parseDouble((String) distance);
else if (distance instanceof DataByteArray)
dist = Double.parseDouble(new String(((DataByteArray) distance).get()));
else
throw new GeoException("Invalid second argument in call to Buffer. Expecting Double, Integer or Long");
return new DataByteArray(geom.buffer(dist).asBinary().array());
} catch (ExecException ee) {
throw new GeoException(geom, ee);
}
}
Aggregations