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

Public Member Functions

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

Protected Member Functions

Geometry relation (Geometry line, Geometry point, Integer value)
 

Member Function Documentation

◆ evaluate()

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

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

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

◆ getURI()

String getURI ( )

References POSTGIS.st_LengthToPoint.

10  {
11  return POSTGIS.st_LengthToPoint.stringValue();
12  }

◆ relation()

Geometry relation ( Geometry  line,
Geometry  point,
Integer  value 
)
protected
15  {
16  /*org.locationtech.jump.algorithm.LengthToPoint ltop=new org.locationtech.jump.algorithm.LengthToPoint(line, point.getCoordinates()[0]);
17  GeometryWrapper transGeom2;
18  try {
19  transGeom2 = geom2.transform(geom1.getSrsInfo());
20  if(geom1.getXYGeometry().getGeometryType().equalsIgnoreCase("LineString") &&
21  transGeom2.getXYGeometry().getGeometryType().equalsIgnoreCase("Point")) {
22  LineString line=(LineString) geom1.getXYGeometry();
23  Point point=(Point) transGeom2.getXYGeometry();
24  //Double minDistance=Double.MAX_VALUE;
25 
26  return NodeValue.makeDouble(ltop.getLength());
27  }
28  throw new ExprEvalException("Input geometries were not a point and a linestring");
29  } catch (MismatchedDimensionException | TransformException | FactoryException e) {
30  // TODO Auto-generated catch block
31  e.printStackTrace();
32  throw new ExprEvalException("An exception occurred: "+e.getMessage());
33  }*/
34  return null;
35  }