SFCGAL  2.3.0
Public Member Functions | List of all members
SFCGAL::detail::io::WktReader Class Reference

Reader for Well-Known Text (WKT) geometry format. More...

#include <WktReader.h>

Public Member Functions

 WktReader (std::istream &inputStream)
 Constructor: read WKT from input stream. More...
 
auto readSRID () -> srid_t
 read an SRID, if present More...
 
auto readGeometry () -> std::unique_ptr< Geometry >
 read a geometry from a string More...
 
auto readGeometryType () -> GeometryType
 read geometry type More...
 
auto readCoordinateType () -> CoordinateType
 read coordinate type [Z][M] More...
 
void readInnerPoint (Point &point)
 Read Point content from WKT. More...
 
void readInnerLineString (LineString &lineString)
 Read LineString content from WKT. More...
 
void readInnerPolygon (Polygon &polygon)
 Read Polygon content from WKT. More...
 
void readInnerTriangle (Triangle &triangle)
 Read Triangle content from WKT. More...
 
void readInnerMultiPoint (MultiPoint &multiPoint)
 Read MultiPoint content from WKT. More...
 
void readInnerMultiLineString (MultiLineString &multiLineString)
 Read MultiLineString content from WKT. More...
 
void readInnerMultiPolygon (MultiPolygon &multiPolygon)
 Read MultiPolygon content from WKT. More...
 
void readInnerGeometryCollection (GeometryCollection &collection)
 Read GeometryCollection content from WKT. More...
 
void readInnerTriangulatedSurface (TriangulatedSurface &tin)
 Read TriangulatedSurface content from WKT. More...
 
void readInnerPolyhedralSurface (PolyhedralSurface &surface)
 Read PolyhedralSurface content from WKT. More...
 
void readInnerSolid (Solid &solid)
 Read Solid content from WKT. More...
 
void readInnerMultiSolid (MultiSolid &multiSolid)
 Read MultiSolid content from WKT. More...
 
void readInnerNURBSCurve (NURBSCurve &g)
 Read NURBSCurve content from WKT (NEW ISO FORMAT). More...
 
auto readWeightsVector () -> std::vector< Kernel::FT >
 Read vector of weights from WKT format: (w1, w2, w3, ...) More...
 
auto readKnotsVector () -> std::vector< Kernel::FT >
 Read vector of knots from WKT format: (k1, k2, k3, ...) More...
 
auto readDegree () -> unsigned int
 Read degree value (unsigned integer) More...
 
auto readPointCoordinate (Point &point) -> bool
 Read coordinate from WKT. More...
 

Detailed Description

Reader for Well-Known Text (WKT) geometry format.

Parses WKT strings to create SFCGAL Geometry objects. Supports all standard geometry types including Points, LineStrings, Polygons, and collections, as well as 3D and measured coordinates.

Warning
M is ignored
Todo:
take M in account?

Constructor & Destructor Documentation

SFCGAL::detail::io::WktReader::WktReader ( std::istream &  inputStream)

Constructor: read WKT from input stream.

Parameters
inputStreaminput stream from which WKT will be read

Member Function Documentation

auto SFCGAL::detail::io::WktReader::readCoordinateType ( ) -> CoordinateType

read coordinate type [Z][M]

Returns
CoordinateType of the geometry
auto SFCGAL::detail::io::WktReader::readDegree ( ) -> unsigned int

Read degree value (unsigned integer)

Returns
NURBS curve degree
auto SFCGAL::detail::io::WktReader::readGeometry ( ) -> std::unique_ptr<Geometry>

read a geometry from a string

Returns
unique_ptr to newly created Geometry object
auto SFCGAL::detail::io::WktReader::readGeometryType ( ) -> GeometryType

read geometry type

Returns
GeometryType of the next geometry in the stream
void SFCGAL::detail::io::WktReader::readInnerGeometryCollection ( GeometryCollection &  collection)

Read GeometryCollection content from WKT.

Parameters
collectionGeometryCollection object to fill
void SFCGAL::detail::io::WktReader::readInnerLineString ( LineString &  lineString)

Read LineString content from WKT.

ex : (1.0 2.0,1.0,6.0)

Parameters
lineStringLineString object to fill with coordinates
void SFCGAL::detail::io::WktReader::readInnerMultiLineString ( MultiLineString &  multiLineString)

Read MultiLineString content from WKT.

Parameters
multiLineStringMultiLineString object to fill with coordinates
void SFCGAL::detail::io::WktReader::readInnerMultiPoint ( MultiPoint &  multiPoint)

Read MultiPoint content from WKT.

ex : (0.0 1.0,5.0 6.0) or ((0.0 4.0),(5.0 6.0))

Parameters
multiPointMultiPoint object to fill with coordinates
void SFCGAL::detail::io::WktReader::readInnerMultiPolygon ( MultiPolygon &  multiPolygon)

Read MultiPolygon content from WKT.

Parameters
multiPolygonMultiPolygon object to fill with coordinates
void SFCGAL::detail::io::WktReader::readInnerMultiSolid ( MultiSolid &  multiSolid)

Read MultiSolid content from WKT.

Parameters
multiSolidMultiSolid object to fill
void SFCGAL::detail::io::WktReader::readInnerNURBSCurve ( NURBSCurve &  g)

Read NURBSCurve content from WKT (NEW ISO FORMAT).

Supports syntax:

  • NURBSCURVE(degree, (points))
  • NURBSCURVE(degree, (points), (weights))
  • NURBSCURVE(degree, (points), (weights), (knots))
Parameters
gThe NURBSCurve geometry to populate with parsed data.
void SFCGAL::detail::io::WktReader::readInnerPoint ( Point &  point)

Read Point content from WKT.

ex : (1.0 2.0 14.0)

Parameters
pointPoint object to fill with coordinates
void SFCGAL::detail::io::WktReader::readInnerPolygon ( Polygon &  polygon)

Read Polygon content from WKT.

ex : ((30 10, 10 20, 20 40, 40 40, 30 10))

Parameters
polygonPolygon object to fill with coordinates
void SFCGAL::detail::io::WktReader::readInnerPolyhedralSurface ( PolyhedralSurface &  surface)

Read PolyhedralSurface content from WKT.

Parameters
surfacePolyhedralSurface object to fill
void SFCGAL::detail::io::WktReader::readInnerSolid ( Solid &  solid)

Read Solid content from WKT.

Parameters
solidSolid object to fill
void SFCGAL::detail::io::WktReader::readInnerTriangle ( Triangle &  triangle)

Read Triangle content from WKT.

Parameters
triangleTriangle object to fill with coordinates
void SFCGAL::detail::io::WktReader::readInnerTriangulatedSurface ( TriangulatedSurface &  tin)

Read TriangulatedSurface content from WKT.

Parameters
tinTriangulatedSurface object to fill
auto SFCGAL::detail::io::WktReader::readKnotsVector ( ) -> std::vector<Kernel::FT>

Read vector of knots from WKT format: (k1, k2, k3, ...)

Returns
Vector of knot values
auto SFCGAL::detail::io::WktReader::readPointCoordinate ( Point &  point) -> bool

Read coordinate from WKT.

Todo:
ZM management
Parameters
pointPoint object to fill with coordinate
Returns
true if coordinate was read successfully, false otherwise
auto SFCGAL::detail::io::WktReader::readSRID ( ) -> srid_t

read an SRID, if present

Returns
SRID value
auto SFCGAL::detail::io::WktReader::readWeightsVector ( ) -> std::vector<Kernel::FT>

Read vector of weights from WKT format: (w1, w2, w3, ...)

Returns
Vector of weight values