GeometryFile Class Reference

A class that can parses a file with wkb encoded geometries. More...

#include <GeometryFile.h>

Public Member Functions

te::gm::Geometrynext ()
 Returns the next geometry. More...
 
void openFile (const char *fileName) throw (te::common::Exception)
 Opens the file fileName. More...
 
void setGeometries (const std::vector< unsigned int > &gids)
 Sets the desired geometries to get from file. More...
 
Initializer methods.

Methods for initializing and destructing object.

 GeometryFile ()
 Constructor. More...
 
 ~GeometryFile ()
 Destructor. More...
 

Static Public Member Functions

static void writeGeometries (const char *fileName, const std::map< int, te::gm::Geometry * > &geoms)
 
static void writeGeometries (const char *fileName, const std::vector< te::gm::Geometry * > &geoms)
 

Protected Attributes

std::auto_ptr< std::ifstream > m_file
 Pointer to the geometry file. More...
 
std::vector< unsigned int > m_gids
 Selected ids to use on traverse operation. More...
 
unsigned int m_i
 Current position on traversing. More...
 
std::auto_ptr< std::ifstream > m_posFile
 Pointer to the geometry pos file. More...
 

Detailed Description

A class that can parses a file with wkb encoded geometries.

Definition at line 54 of file GeometryFile.h.

Constructor & Destructor Documentation

GeometryFile::GeometryFile ( )

Constructor.

GeometryFile::~GeometryFile ( )

Destructor.

Member Function Documentation

te::gm::Geometry* GeometryFile::next ( )

Returns the next geometry.

If the setGeometries was used, then the geometries to be returned are the geometries identified by ids given to the function, otherwise it will traverse the entire file.

Returns
The next geometry on the file or NULL if there's no more geometries to get.
Note
The ownership of the returned geometries are given to the caller.
void GeometryFile::openFile ( const char *  fileName)
throw (te::common::Exception
)

Opens the file fileName.

Parameters
fileNameThe name of geometry file. (File extension is .geom)
Exceptions
Ifthe file could not be opened an te::common::Exception will be raised.
Note
There's no check about the file contents, just for its existence. It means that if an unknown type of file was passed, it will try to open it. The behavior of the class then is unknown.
void GeometryFile::setGeometries ( const std::vector< unsigned int > &  gids)

Sets the desired geometries to get from file.

This is a filter of the traversing file. If this is used before next was called, only geometries indentified by gids will be returned by next function. If not defined the file will be entirely traversed.

Parameters
gidsIds of the geometries to be filtered. These values comes from 'FID' column.
static void GeometryFile::writeGeometries ( const char *  fileName,
const std::map< int, te::gm::Geometry * > &  geoms 
)
static
static void GeometryFile::writeGeometries ( const char *  fileName,
const std::vector< te::gm::Geometry * > &  geoms 
)
static

Member Data Documentation

std::auto_ptr<std::ifstream> GeometryFile::m_file
protected

Pointer to the geometry file.

Definition at line 115 of file GeometryFile.h.

std::vector<unsigned int> GeometryFile::m_gids
protected

Selected ids to use on traverse operation.

Definition at line 117 of file GeometryFile.h.

unsigned int GeometryFile::m_i
protected

Current position on traversing.

Definition at line 118 of file GeometryFile.h.

std::auto_ptr<std::ifstream> GeometryFile::m_posFile
protected

Pointer to the geometry pos file.

Definition at line 116 of file GeometryFile.h.


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