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

Public Member Functions

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

Protected Member Functions

Geometry relation (Geometry geom1, Geometry geom2, Integer zerobasedposition)
 

Member Function Documentation

◆ evaluate()

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

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

Referenced by SetPointTest.testSetPoint().

◆ getURI()

String getURI ( )
14  {
15  return POSTGIS.st_setPoint.stringValue();
16  }

References POSTGIS.st_setPoint.

◆ relation()

Geometry relation ( Geometry  geom1,
Geometry  geom2,
Integer  zerobasedposition 
)
protected

Reimplemented from GeometricDoubleModifierIntegerFunction.

19  {
20  if (geom2 instanceof Point) {
21  Coordinate[] coords=geom1.getCoordinates();
22  System.out.println(coords);
23  Coordinate[] newcoords=coords;
24  newcoords[zerobasedposition.intValue()]=geom2.getCoordinate();
25  return LiteralUtils.createGeometry(newcoords, geom1.getGeometryType(), geom1.getSRID());
26  }
27  return null;
28  }

References LiteralUtils.createGeometry().