kiwi-postgis  Version 0.1.0.0
DXFDatatype Class Reference

WKTDatatype class allows the URI "geo:wktLiteral" to be used as a datatype and it will parse that datatype to a JTS Geometry. More...

Inheritance diagram for DXFDatatype:
Collaboration diagram for DXFDatatype:

Public Member Functions

String unparse (Geometry geometry)
 This method Un-parses the JTS Geometry to the WKT literal. More...
 
Geometry read (String geometryLiteral)
 
String toString ()
 

Static Public Member Functions

static ArrayList< LineString > readDXFLiteral (String literalContent) throws ParseException
 

Static Public Attributes

static final String URI = POSTGIS.DXF
 The default WKT type URI. More...
 
static final DXFDatatype INSTANCE = new DXFDatatype()
 A static instance of WKTDatatype. More...
 

Detailed Description

WKTDatatype class allows the URI "geo:wktLiteral" to be used as a datatype and it will parse that datatype to a JTS Geometry.

Req 10 All RDFS Literals of type geo:wktLiteral shall consist of an optional URI identifying the coordinate reference system followed by Simple Features Well Known Text (WKT) describing a geometric value. Valid geo:wktLiterals are formed by concatenating a valid, absolute URI as defined in [RFC 2396], one or more spaces (Unicode U+0020 character) as a separator, and a WKT string as defined in Simple Features [ISO 19125-1].

Req 11 The URI

<http://www.opengis.net/def/crs/OGC/1.3/CRS84>

shall be assumed as the spatial reference system for geo:wktLiterals that do not * specify an explicit spatial reference system URI.

Member Function Documentation

◆ read()

Geometry read ( String  geometryLiteral)
103  {
104  return null;
105  /*GeometryWrapper wrapper;
106  try {
107  wrapper = GeometryWrapperFactory.createMultiLineString(readDXFLiteral(geometryLiteral), "<http://www.opengis.net/def/crs/EPSG/0/4326>", EncodedPolylineDatatype.URI);
108  return wrapper;
109  } catch (ParseException e) {
110  // TODO Auto-generated catch block
111  throw new RuntimeException(e.getMessage());
112 
113  }*/
114 
115  }

◆ readDXFLiteral()

static ArrayList<LineString> readDXFLiteral ( String  literalContent) throws ParseException
static
83  {
84  ArrayList<LineString> lines = new ArrayList<>();
85  Parser parser = ParserBuilder.createDefaultParser();
86  InputStream targetStream = new ByteArrayInputStream(literalContent.getBytes());
87  parser.parse(targetStream, DXFParser.DEFAULT_ENCODING);
88  DXFDocument doc = parser.getDocument();
89  List<DXFLine> lst = doc.getDXFLayer("layername").getDXFEntities(DXFConstants.ENTITY_TYPE_LINE);
90  GeometryFactory fac=new GeometryFactory();
91  for (int index = 0; index < lst.size(); index++) {
92  Bounds bounds = lst.get(index).getBounds();
93  Coordinate[] coords=new Coordinate[2];
94  coords[0]=new Coordinate(bounds.getMinimumX(), bounds.getMinimumY());
95  coords[1]=new Coordinate(bounds.getMaximumX(),bounds.getMaximumY());
96  LineString ls=fac.createLineString(coords);
97  lines.add(ls);
98  }
99  return lines;
100  }

◆ toString()

String toString ( )
119  {
120  return "DXFDatatype{" + URI + '}';
121  }
static final String URI
The default WKT type URI.
Definition: DXFDatatype.java:44

◆ unparse()

String unparse ( Geometry  geometry)

This method Un-parses the JTS Geometry to the WKT literal.

Parameters
geometry- the JTS Geometry to be un-parsed
Returns
WKT - the returned WKT Literal.
Notice that the Spatial Reference System is not specified in returned WKT literal.
62  {
63  DXFDocument doc=new DXFDocument();
64  return null;
65  /*if(geom instanceof Point) {
66  DXFPoint point=new DXFPoint();
67  point.setX(((Point)geom).getX());
68  point.setY(((Point)geom).getY());
69  doc.add
70  }else if(geom instanceof LineString) {
71  DXFLine line=new DXFLine();
72  }
73  if(geometryWrapper.getXYGeometry().getGeometryType().equals("LineString")){
74  return encodePolyline((LineString)geometryWrapper.getXYGeometry());
75  }else {
76  throw new AssertionError("Object passed to EncodedPolylineDatatype is not a LineString: " + geometry);
77  }
78  } else {
79  throw new AssertionError("Object passed to EncodedPolylineDatatype is not a GeometryWrapper: " + geometry);
80  }*/
81  }

Member Data Documentation

◆ INSTANCE

final DXFDatatype INSTANCE = new DXFDatatype()
static

A static instance of WKTDatatype.

Referenced by LiteralRegistry.LiteralRegistry().

◆ URI

final String URI = POSTGIS.DXF
static

The default WKT type URI.

Referenced by LiteralRegistry.LiteralRegistry().