rdf4j-postgis  Version 0.1.0.0
GeometricBinaryCRSAttributeFunction Class Referenceabstract
Inheritance diagram for GeometricBinaryCRSAttributeFunction:
Collaboration diagram for GeometricBinaryCRSAttributeFunction:

Public Member Functions

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

Protected Member Functions

abstract boolean operation (Geometry g1, CoordinateReferenceSystem crs)
 

Member Function Documentation

◆ evaluate()

Value evaluate ( ValueFactory  valueFactory,
Value...  args 
) throws ValueExprEvaluationException
19  {
20  if (args.length != 2) {
21  throw new ValueExprEvaluationException(getURI() + " requires exactly 2 arguments, got " + args.length);
22  }
23 
24  LiteralType l=LiteralRegistry.getLiteral(((Literal)args[0]).getDatatype().toString());
25  Integer srid=Integer.valueOf(args[1].stringValue());
26  if(l instanceof VectorLiteral) {
27  Geometry geom=((VectorLiteral)l).read(args[0].stringValue());
28  boolean result;
29  try {
30  result = operation(geom,CRS.forCode("EPSG:"+srid));
31  return valueFactory.createLiteral(result);
32  } catch (FactoryException e) {
33  // TODO Auto-generated catch block
34  e.printStackTrace();
35  return null;
36  }
37 
38  }
39  throw new ValueExprEvaluationException("Arguments given are not geometry literals");
40  }

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

Referenced by IsInCRSAreaOfValidityTest.testIsInCRSAreaOfValidityFalse(), and IsInCRSAreaOfValidityTest.testIsInCRSAreaOfValidityTrue().

◆ operation()

abstract boolean operation ( Geometry  g1,
CoordinateReferenceSystem  crs 
)
abstractprotected