rdf4j-postgis  Version 0.1.0.0
AsX3D Class Reference

Returns an X3D representation of a given geometry. More...

Inheritance diagram for AsX3D:
Collaboration diagram for AsX3D:

Public Member Functions

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

Package Attributes

String header
 
String footer ="</Shape></Scene></X3D>"
 

Detailed Description

Returns an X3D representation of a 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 arguments, 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  String result = operation(geom);
25  return valueFactory.createLiteral(result);
26  }
27  throw new ValueExprEvaluationException("Argument given is not a geometry literal");
28 
29  }

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

Referenced by AsBinaryTest.testAsBinary(), AsEncodedPolylineTest.testAsEncodedPolyline(), AsGARSTest.testAsGARS(), AsGeoJSONTest.testAsGeoJSON(), AsGeoRSSTest.testAsGeoRSS(), AsGeoURITest.testAsGeoURI(), AsLatLonTextTest.testAsLatLonText(), AsOSMLinkTest.testAsOSMLink(), AsPolyshapeTest.testAsPolyShape(), AsTextTest.testAsText(), AsTextRawTest.testAsTextRaw(), AsTextTest.testAsTextZ(), DumpTest.testDump(), GeomCRSToWKTTest.testGeomCRSToWKT(), GeometryTypeTest.testLineString(), SridGetAxis1OrientationTest.testSridAxis1Orientation(), SridGetAxis2OrientationTest.testSridAxis2Orientation(), SridGetAxis1NameTest.testSridGetAxis1Name(), SridGetAxis2NameTest.testSridGetAxis2Name(), and SridGetDatumTest.testSridGetDatum().

◆ getURI()

String getURI ( )
37  {
38  // TODO Auto-generated method stub
39  return POSTGIS.ST_ASX3D.stringValue();
40  }

References POSTGIS.ST_ASX3D.

◆ operation()

String operation ( Geometry  geom)

Reimplemented from GeometricStringExportFunction.

15  {
16  StringBuilder builder=new StringBuilder();
17  builder.append("<IndexedFaceSet coordIndex=\"");
18  Integer index=0;
19  for(Coordinate coord:geom.getCoordinates()) {
20  builder.append(index.toString());
21  index++;
22  }
23  builder.append("</IndexedFaceSet>");
24  builder.append("<Coordinate point=\"");
25  for(Coordinate coord:geom.getCoordinates()) {
26  builder.append(coord.getX()+" "+coord.getY()+" "+coord.getZ()+" ");
27  }
28  builder.append("\"/>");
29  return header+builder.toString()+footer;
30  }

References AsX3D.footer, and AsX3D.header.

Member Data Documentation

◆ footer

String footer ="</Shape></Scene></X3D>"
package

Referenced by AsX3D.operation().

◆ header

String header
package
Initial value:
="<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
"<!DOCTYPE X3D PUBLIC \"ISO//Web3D//DTD X3D 3.2//EN\""+
"http://www.web3d.org/specifications/x3d-3.2.dtd\"><Scene><Shape>"

Referenced by AsX3D.operation().