GEOS  3.9.1dev
Public Member Functions | Private Member Functions | Private Attributes | List of all members
geos::io::WKBWriter Class Reference

Writes a Geometry into Well-Known Binary format. More...

#include <WKBWriter.h>

Public Member Functions

 WKBWriter (uint8_t dims=2, int bo=getMachineByteOrder(), bool includeSRID=false)
 
virtual ~WKBWriter ()=default
 
virtual uint8_t getOutputDimension () const
 
virtual void setOutputDimension (uint8_t newOutputDimension)
 
virtual int getByteOrder () const
 
virtual void setByteOrder (int newByteOrder)
 
virtual bool getIncludeSRID () const
 
virtual void setIncludeSRID (bool newIncludeSRID)
 
void write (const geom::Geometry &g, std::ostream &os)
 Write a Geometry to an ostream. More...
 
void writeHEX (const geom::Geometry &g, std::ostream &os)
 Write a Geometry to an ostream in binary hex format. More...
 

Private Member Functions

void writePoint (const geom::Point &p)
 
void writePointEmpty (const geom::Point &p)
 
void writeLineString (const geom::LineString &ls)
 
void writePolygon (const geom::Polygon &p)
 
void writeGeometryCollection (const geom::GeometryCollection &c, int wkbtype)
 
void writeCoordinateSequence (const geom::CoordinateSequence &cs, bool sized)
 
void writeCoordinate (const geom::CoordinateSequence &cs, size_t idx, bool is3d)
 
void writeGeometryType (int geometryType, int SRID)
 
void writeSRID (int SRID)
 
void writeByteOrder ()
 
void writeInt (int intValue)
 

Private Attributes

uint8_t defaultOutputDimension
 
uint8_t outputDimension
 
int byteOrder
 
bool includeSRID
 
std::ostream * outStream
 
unsigned char buf [8]
 

Detailed Description

Writes a Geometry into Well-Known Binary format.

The WKB format is specified in the OGC Simple Features for SQL specification. This implementation supports the extended WKB standard for representing 3-dimensional coordinates. The presence of 3D coordinates is signified by setting the high bit of the wkbType word.

Empty Points cannot be represented in WKB; an IllegalArgumentException will be thrown if one is written. The WKB specification does not support representing LinearRing they will be written as LineString

This class is designed to support reuse of a single instance to read multiple geometries. This class is not thread-safe; each thread should create its own instance.

See also
WKBReader

Definition at line 73 of file WKBWriter.h.

Constructor & Destructor Documentation

geos::io::WKBWriter::WKBWriter ( uint8_t  dims = 2,
int  bo = getMachineByteOrder(),
bool  includeSRID = false 
)
virtual geos::io::WKBWriter::~WKBWriter ( )
virtualdefault

Member Function Documentation

virtual int geos::io::WKBWriter::getByteOrder ( ) const
inlinevirtual

Definition at line 122 of file WKBWriter.h.

virtual bool geos::io::WKBWriter::getIncludeSRID ( ) const
inlinevirtual

Definition at line 139 of file WKBWriter.h.

virtual uint8_t geos::io::WKBWriter::getOutputDimension ( ) const
inlinevirtual

Definition at line 102 of file WKBWriter.h.

virtual void geos::io::WKBWriter::setByteOrder ( int  newByteOrder)
virtual
virtual void geos::io::WKBWriter::setIncludeSRID ( bool  newIncludeSRID)
inlinevirtual

Definition at line 149 of file WKBWriter.h.

virtual void geos::io::WKBWriter::setOutputDimension ( uint8_t  newOutputDimension)
virtual
void geos::io::WKBWriter::write ( const geom::Geometry g,
std::ostream &  os 
)

Write a Geometry to an ostream.

Parameters
gthe geometry to write
osthe output stream
Exceptions
IOException
void geos::io::WKBWriter::writeByteOrder ( )
private
void geos::io::WKBWriter::writeCoordinate ( const geom::CoordinateSequence cs,
size_t  idx,
bool  is3d 
)
private
void geos::io::WKBWriter::writeCoordinateSequence ( const geom::CoordinateSequence cs,
bool  sized 
)
private
void geos::io::WKBWriter::writeGeometryCollection ( const geom::GeometryCollection c,
int  wkbtype 
)
private
void geos::io::WKBWriter::writeGeometryType ( int  geometryType,
int  SRID 
)
private
void geos::io::WKBWriter::writeHEX ( const geom::Geometry g,
std::ostream &  os 
)

Write a Geometry to an ostream in binary hex format.

Parameters
gthe geometry to write
osthe output stream
Exceptions
IOException
void geos::io::WKBWriter::writeInt ( int  intValue)
private
void geos::io::WKBWriter::writeLineString ( const geom::LineString ls)
private
void geos::io::WKBWriter::writePoint ( const geom::Point p)
private
void geos::io::WKBWriter::writePointEmpty ( const geom::Point p)
private
void geos::io::WKBWriter::writePolygon ( const geom::Polygon p)
private
void geos::io::WKBWriter::writeSRID ( int  SRID)
private

Member Data Documentation

unsigned char geos::io::WKBWriter::buf[8]
private

Definition at line 185 of file WKBWriter.h.

int geos::io::WKBWriter::byteOrder
private

Definition at line 179 of file WKBWriter.h.

uint8_t geos::io::WKBWriter::defaultOutputDimension
private

Definition at line 176 of file WKBWriter.h.

bool geos::io::WKBWriter::includeSRID
private

Definition at line 181 of file WKBWriter.h.

uint8_t geos::io::WKBWriter::outputDimension
private

Definition at line 177 of file WKBWriter.h.

std::ostream* geos::io::WKBWriter::outStream
private

Definition at line 183 of file WKBWriter.h.


The documentation for this class was generated from the following file: