rdf4j-postgis  Version 0.1.0.0
StartPoint Class Reference

Returns the first point of the given geometry. More...

Inheritance diagram for StartPoint:
Collaboration diagram for StartPoint:

Public Member Functions

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

Protected Member Functions

Geometry operation (Geometry geom)
 

Detailed Description

Returns the first point of the given geometry.

Member Function Documentation

◆ evaluate()

Value evaluate ( ValueFactory  valueFactory,
Value...  args 
) throws ValueExprEvaluationException
inherited
16  {
17  if (args.length != 1) {
18  throw new ValueExprEvaluationException(getURI() + " requires exactly 1 argument, got " + args.length);
19  }
20 
21  LiteralType l=LiteralRegistry.getLiteral(((Literal)args[0]).getDatatype().toString());
22  if(l instanceof VectorLiteral) {
23  Geometry geom=((VectorLiteral)l).read(args[0].stringValue());
24  Geometry result = operation(geom);
25  return valueFactory.createLiteral(((VectorLiteral) l).unparse(result),((Literal)args[0]).getDatatype());
26  }
27  throw new ValueExprEvaluationException("Argument given is not a geometry literal");
28  }

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

Referenced by BoundaryTest.testBoundary(), BoundingDiagonalTest.testBoundingDiagonal(), CentroidTest.testCentroid(), StartPointTest.testCircularString(), CircumcentreTest.testCircumcentre1(), CollectionHomogenizeTest.testCollectionHomogenize(), FlipCoordinatesTest.testFlipCoordinates(), Force2DTest.testForce2D(), Force3DTest.testForce3D(), Force3DMTest.testForce3DM(), Force3DMTest.testForce3DM2(), Force4DTest.testForce4D(), ForceCollectionTest.testForceCollection(), ForceCollectionTest.testForceCollectionZ(), ForcePolygonCCWTest.testForcePolygonCCW(), ForcePolygonCWTest.testForcePolygonCW(), EndPointTest.testLineString2D(), StartPointTest.testLineString2D(), EndPointTest.testLineString3D(), StartPointTest.testLineString3D(), MinimumBoundingCircleCenterTest.testMinimumBoundingCircle(), MinimumBoundingCircleTest.testMinimumBoundingCircle(), MinimumClearanceLineTest.testMinimumClearanceLine(), MinimumDiameterLineTest.testMinimumDiameterLine(), MinimumRectangleTest.testMinimumRectangle(), MultiTest.testMulti2D(), MultiTest.testMulti3D(), SelfIntersectionsTest.testNoSelfIntersections(), EndPointTest.testPoint(), StartPointTest.testPoint(), PointsTest.testPoints(), PointsTest.testPoints3D(), ReverseTest.testReverse(), SelfIntersectionsTest.testSelfIntersections(), ShiftLongitudeTest.testShiftLongitude(), SimplifyPreserveTopologyTest.testSimplifyVW(), and TransScaleTest.testTransScale().

◆ getURI()

String getURI ( )
16  {
17  return POSTGIS.st_startPoint.stringValue();
18  }

References POSTGIS.st_startPoint.

◆ operation()

Geometry operation ( Geometry  geom)
protected

Reimplemented from GeometricUnaryFunction.

21  {
22  if (geom instanceof LineString) {
23  Point point = ((LineString) geom).getStartPoint();
24  return point;
25  }else if(geom instanceof Point) {
26  return geom;
27  }
28  return null;
29 
30  }