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

Public Member Functions

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

Protected Member Functions

double relation (Geometry g1, Geometry g2)
 

Member Function Documentation

◆ evaluate()

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

References LiteralRegistry.getLiteral(), and GeometricRelationDoubleFunction.relation().

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

◆ getURI()

String getURI ( )

References POSTGIS.ST_DISTANCE3D.

13  {
14  return POSTGIS.ST_DISTANCE3D.stringValue();
15  }

◆ relation()

double relation ( Geometry  g1,
Geometry  g2 
)
protected

References LiteralUtils.transform().

18  {
19  Geometry transformed=LiteralUtils.transform(g2, g1);
20  Distance3DOp op3d=new Distance3DOp(g1, transformed);
21  double distance3d=op3d.distance();
22  return distance3d;
23  }