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

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

#include <WktWriter.h>

Public Member Functions

 WktWriter (std::ostream &outStream)
 Constructor. More...
 
void write (const Geometry &geometry, bool exact=false)
 Write a geometry as WKT. More...
 

Protected Member Functions

void writeCoordinateType (const Geometry &geometry)
 Write coordinate type ("" | " Z" | " ZM") More...
 
void writeCoordinate (const Point &point)
 Write a single coordinate. More...
 
void write (const Point &point)
 Write a Point geometry. More...
 
void writeInner (const Point &point)
 Write the inner coordinates of a Point. More...
 
void write (const LineString &lineString)
 Write a LineString geometry. More...
 
void writeInner (const LineString &lineString)
 Write the inner coordinates of a LineString. More...
 
void write (const Polygon &polygon)
 Write a Polygon geometry. More...
 
void writeInner (const Polygon &polygon)
 Write the inner rings of a Polygon. More...
 
void write (const GeometryCollection &collection)
 Write a GeometryCollection. More...
 
void write (const MultiPoint &multipoint)
 Write a MultiPoint geometry. More...
 
void write (const MultiLineString &multilinestring)
 Write a MultiLineString geometry. More...
 
void write (const MultiPolygon &multipolygon)
 Write a MultiPolygon geometry. More...
 
void writeWeights (const std::vector< Kernel::FT > &weights)
 Write vector of weights in WKT format: (w1, w2, w3, ...) More...
 
void writeKnots (const std::vector< Kernel::FT > &knots)
 Write vector of knots in WKT format: (k1, k2, k3, ...) More...
 
void write (const NURBSCurve &nurbsCurve)
 Write NURBSCurve to WKT format. More...
 
void writeInner (const NURBSCurve &nurbsCurve)
 Write inner content of NURBSCurve to WKT format. More...
 
void write (const MultiSolid &multisolid)
 Write a MultiSolid geometry. More...
 
void write (const Triangle &triangle)
 Write a Triangle geometry (as Polygon) More...
 
void writeInner (const Triangle &triangle)
 Write the inner coordinates of a Triangle. More...
 
void write (const TriangulatedSurface &tin)
 Write a TriangulatedSurface geometry. More...
 
void write (const PolyhedralSurface &surface)
 Write a PolyhedralSurface geometry. More...
 
void writeInner (const PolyhedralSurface &surface)
 Write the inner content of a PolyhedralSurface. More...
 
void write (const Solid &solid)
 Write a Solid geometry. More...
 
void writeInner (const Solid &solid)
 Write the inner shells of a Solid. More...
 
void writeRec (const Geometry &geometry)
 Recursive call to write a geometry. More...
 

Detailed Description

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

Converts SFCGAL Geometry objects to their WKT string representation. Supports all standard geometry types including 3D coordinates and measured values.

Warning
Triangles are transformed into polygons

Constructor & Destructor Documentation

SFCGAL::detail::io::WktWriter::WktWriter ( std::ostream &  outStream)

Constructor.

Parameters
outStreamoutput stream where WKT will be written

Member Function Documentation

void SFCGAL::detail::io::WktWriter::write ( const Geometry &  geometry,
bool  exact = false 
)

Write a geometry as WKT.

Todo:
replace with visitor dispatch
Parameters
geometrygeometry to serialize as WKT
exactif true, write exact representation (without simplifications)
void SFCGAL::detail::io::WktWriter::write ( const Point &  point)
protected

Write a Point geometry.

Parameters
pointPoint to serialize
void SFCGAL::detail::io::WktWriter::write ( const LineString &  lineString)
protected

Write a LineString geometry.

Parameters
lineStringLineString to serialize
void SFCGAL::detail::io::WktWriter::write ( const Polygon &  polygon)
protected

Write a Polygon geometry.

Parameters
polygonPolygon to serialize
void SFCGAL::detail::io::WktWriter::write ( const GeometryCollection &  collection)
protected

Write a GeometryCollection.

Parameters
collectionGeometryCollection to serialize
void SFCGAL::detail::io::WktWriter::write ( const MultiPoint &  multipoint)
protected

Write a MultiPoint geometry.

Parameters
multipointMultiPoint to serialize
void SFCGAL::detail::io::WktWriter::write ( const MultiLineString &  multilinestring)
protected

Write a MultiLineString geometry.

Parameters
multilinestringMultiLineString to serialize
void SFCGAL::detail::io::WktWriter::write ( const MultiPolygon &  multipolygon)
protected

Write a MultiPolygon geometry.

Parameters
multipolygonMultiPolygon to serialize
void SFCGAL::detail::io::WktWriter::write ( const NURBSCurve &  nurbsCurve)
protected

Write NURBSCurve to WKT format.

Outputs the complete WKT representation including geometry type and coordinate information.

Parameters
nurbsCurveThe NURBSCurve geometry to write.
void SFCGAL::detail::io::WktWriter::write ( const MultiSolid &  multisolid)
protected

Write a MultiSolid geometry.

Parameters
multisolidMultiSolid to serialize
void SFCGAL::detail::io::WktWriter::write ( const Triangle &  triangle)
protected

Write a Triangle geometry (as Polygon)

Parameters
triangleTriangle to serialize
void SFCGAL::detail::io::WktWriter::write ( const TriangulatedSurface &  tin)
protected

Write a TriangulatedSurface geometry.

Parameters
tinTriangulatedSurface to serialize
void SFCGAL::detail::io::WktWriter::write ( const PolyhedralSurface &  surface)
protected

Write a PolyhedralSurface geometry.

Parameters
surfacePolyhedralSurface to serialize
void SFCGAL::detail::io::WktWriter::write ( const Solid &  solid)
protected

Write a Solid geometry.

Parameters
solidSolid to serialize
void SFCGAL::detail::io::WktWriter::writeCoordinate ( const Point &  point)
protected

Write a single coordinate.

Parameters
pointpoint whose coordinates are written
void SFCGAL::detail::io::WktWriter::writeCoordinateType ( const Geometry &  geometry)
protected

Write coordinate type ("" | " Z" | " ZM")

Parameters
geometrygeometry whose coordinate type is written
void SFCGAL::detail::io::WktWriter::writeInner ( const Point &  point)
protected

Write the inner coordinates of a Point.

Parameters
pointPoint whose coordinates are written
void SFCGAL::detail::io::WktWriter::writeInner ( const LineString &  lineString)
protected

Write the inner coordinates of a LineString.

Parameters
lineStringLineString whose coordinates are written
void SFCGAL::detail::io::WktWriter::writeInner ( const Polygon &  polygon)
protected

Write the inner rings of a Polygon.

Parameters
polygonPolygon whose rings are written
void SFCGAL::detail::io::WktWriter::writeInner ( const NURBSCurve &  nurbsCurve)
protected

Write inner content of NURBSCurve to WKT format.

Outputs only the coordinate content without the geometry type prefix, used for nested geometry structures.

Parameters
nurbsCurveThe NURBSCurve geometry to write.
void SFCGAL::detail::io::WktWriter::writeInner ( const Triangle &  triangle)
protected

Write the inner coordinates of a Triangle.

Parameters
triangleTriangle whose coordinates are written
void SFCGAL::detail::io::WktWriter::writeInner ( const PolyhedralSurface &  surface)
protected

Write the inner content of a PolyhedralSurface.

Parameters
surfacePolyhedralSurface whose content is written
void SFCGAL::detail::io::WktWriter::writeInner ( const Solid &  solid)
protected

Write the inner shells of a Solid.

Parameters
solidSolid whose shells are written
void SFCGAL::detail::io::WktWriter::writeKnots ( const std::vector< Kernel::FT > &  knots)
protected

Write vector of knots in WKT format: (k1, k2, k3, ...)

Parameters
knotsVector of knot values to write
void SFCGAL::detail::io::WktWriter::writeRec ( const Geometry &  geometry)
protected

Recursive call to write a geometry.

Parameters
geometrygeometry to serialize recursively
void SFCGAL::detail::io::WktWriter::writeWeights ( const std::vector< Kernel::FT > &  weights)
protected

Write vector of weights in WKT format: (w1, w2, w3, ...)

Parameters
weightsVector of weight values to write