kiwi-postgis  Version 0.1.0.0
AsBinary Class Reference
Inheritance diagram for AsBinary:
Collaboration diagram for AsBinary:

Public Member Functions

String operation (Geometry geom)
 
String getURI ()
 
Value evaluate (ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException
 

Member Function Documentation

◆ evaluate()

Value evaluate ( ValueFactory  valueFactory,
Value...  args 
) throws ValueExprEvaluationException
inherited

References LiteralRegistry.getLiteral(), and GeometricStringExportFunction.operation().

16  {
17  if (args.length != 1) {
18  throw new ValueExprEvaluationException(getURI() + " requires exactly 1 arguments, got " + args.length);
19  }
20 
21  LiteralType l=LiteralRegistry.getLiteral(((Literal)args[0]).getDatatype().toString());
22  if(l instanceof VectorLiteral) {
23  Geometry geom=((VectorLiteral)l).read(args[0].stringValue());
24  String result = operation(geom);
25  return valueFactory.createLiteral(result);
26  }
27  throw new ValueExprEvaluationException("Argument given is not a geometry literal");
28 
29  }

◆ getURI()

String getURI ( )

References POSTGIS.ST_ASBINARY.

32  {
33  return POSTGIS.ST_ASBINARY.stringValue();
34  }

◆ operation()

String operation ( Geometry  geom)

References WKBDatatype.INSTANCE, and WKBDatatype.unparse().

13  {
14  return WKBDatatype.INSTANCE.unparse(geom);
15  /* String endianness = arg1.getString();
16  WKBWriter writer=new WKBWriter();
17 
18  byte[] result=writer.write(geom);
19  if(arg1!=null) {
20  ByteBuffer bb = ByteBuffer.wrap(result);
21  if("XDR".equals(endianness)) {
22  bb.order( ByteOrder.BIG_ENDIAN);
23  }else if("NDR".equals(endianness)) {
24  bb.order( ByteOrder.LITTLE_ENDIAN);
25  }
26  return bb.toString();
27  }
28  return result.toString();*/
29  }