rdf4j-postgis  Version 0.1.0.0
LineInterpolatePoint Class Reference
Inheritance diagram for LineInterpolatePoint:
Collaboration diagram for LineInterpolatePoint:

Public Member Functions

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

Protected Member Functions

Geometry relation (Geometry geom, Double a_fraction)
 

Member Function Documentation

◆ evaluate()

Value evaluate ( ValueFactory  valueFactory,
Value...  args 
) throws ValueExprEvaluationException
inherited
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  Double value=Double.valueOf(args[1].stringValue());
23  if(l instanceof VectorLiteral) {
24  Geometry geom=((VectorLiteral)l).read(args[0].stringValue());
25  Geometry result = relation(geom,value);
26  return valueFactory.createLiteral(((VectorLiteral) l).unparse(result),((Literal)args[0]).getDatatype());
27  }
28  throw new ValueExprEvaluationException("Argument given is not a geometry literal");
29  }

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

Referenced by DensifyTest.testDensify(), EnsureClosedTest.testEnsureClosed(), EnsureClosedTest.testEnsureClosed2(), RemoveGeometryTest.testRemoveGeometry1(), RemoveGeometryTest.testRemoveGeometry1Z(), RemoveGeometryTest.testRemoveGeometry2(), RemoveGeometryTest.testRemoveGeometry2Z(), RemoveRepeatedPointsTest.testRemoveRepeatedPoints(), SimplifyTest.testSimplify(), and SimplifyVWTest.testSimplifyVW().

◆ getURI()

String getURI ( )
15  {
16  return POSTGIS.st_lineInterpolatePoint.stringValue();
17  }

References POSTGIS.st_lineInterpolatePoint.

◆ relation()

Geometry relation ( Geometry  geom,
Double  a_fraction 
)
protected

Reimplemented from GeometricModifierDoubleFunction.

20  {
21  GeometryFactory fac=new GeometryFactory();
22  Double length=geom.getLength();
23  Double fractionlength=a_fraction*length;
24  LengthLocationMap locmap=new LengthLocationMap(geom);
25  LinearLocation linloc=locmap.getLocation(fractionlength);
26  Coordinate coord=linloc.getCoordinate(geom);
27  return fac.createPoint(coord);
28  }