SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
NBHeightMapper Class Reference

Set z-values for all network positions based on data from a height map. More...

#include <NBHeightMapper.h>

Collaboration diagram for NBHeightMapper:
Collaboration graph

Data Structures

class  QueryResult
 class for cirumventing the const-restriction of RTree::Search-context More...
 
class  Triangle
 

Public Types

typedef std::vector< const
Triangle * > 
Triangles
 

Public Member Functions

const BoundarygetBoundary ()
 returns the convex boundary of all known triangles More...
 
SUMOReal getZ (const Position &geo) const
 returns height for the given geo coordinate (WGS84) More...
 
bool ready () const
 returns whether the NBHeightMapper has data More...
 

Static Public Member Functions

static const NBHeightMapperget ()
 return the singleton instance (maybe 0) More...
 
static void loadIfSet (OptionsCont &oc)
 loads heigh map data if any loading options are set More...
 

Private Member Functions

void addTriangle (PositionVector corners)
 adds one triangles worth of height data More...
 
void clearData ()
 clears loaded data More...
 
int loadShapeFile (const std::string &file)
 load height data from Arcgis-shape file and returns the number of parsed features More...
 
int loadTiff (const std::string &file)
 load height data from GeoTIFF file and returns the number of non void pixels More...
 
 NBHeightMapper ()
 private constructor and destructor (Singleton) More...
 
 NBHeightMapper (const NBHeightMapper &)
 Invalidated copy constructor. More...
 
NBHeightMapperoperator= (const NBHeightMapper &)
 Invalidated assignment operator. More...
 
 ~NBHeightMapper ()
 

Private Attributes

Boundary myBoundary
 convex boundary of all known triangles; More...
 
int16_t * myRaster
 raster height information in m More...
 
TRIANGLE_RTREE_QUAL myRTree
 The RTree for spatial queries. More...
 
Position mySizeOfPixel
 dimensions of one pixel in raster data More...
 
Triangles myTriangles
 

Static Private Attributes

static NBHeightMapper Singleton
 the singleton instance More...
 

Friends

class NBHeightMapperTest
 

Detailed Description

Set z-values for all network positions based on data from a height map.

Importing data from '.shp'-files works only if SUMO was compiled with GDAL-support. If not, an error message is generated.

Definition at line 65 of file NBHeightMapper.h.

Member Typedef Documentation

typedef std::vector<const Triangle*> NBHeightMapper::Triangles

Definition at line 120 of file NBHeightMapper.h.

Constructor & Destructor Documentation

NBHeightMapper::NBHeightMapper ( )
private

private constructor and destructor (Singleton)

Definition at line 63 of file NBHeightMapper.cpp.

NBHeightMapper::~NBHeightMapper ( )
private

Definition at line 68 of file NBHeightMapper.cpp.

References clearData().

NBHeightMapper::NBHeightMapper ( const NBHeightMapper )
private

Invalidated copy constructor.

Member Function Documentation

void NBHeightMapper::addTriangle ( PositionVector  corners)
private

adds one triangles worth of height data

Definition at line 140 of file NBHeightMapper.cpp.

References PositionVector::getBoxBoundary(), myRTree, myTriangles, Boundary::xmax(), Boundary::xmin(), Boundary::ymax(), and Boundary::ymin().

Referenced by loadShapeFile().

void NBHeightMapper::clearData ( )
private

clears loaded data

Definition at line 330 of file NBHeightMapper.cpp.

References myBoundary, myRaster, myTriangles, and Boundary::reset().

Referenced by loadTiff(), and ~NBHeightMapper().

const NBHeightMapper & NBHeightMapper::get ( )
static

return the singleton instance (maybe 0)

Definition at line 74 of file NBHeightMapper.cpp.

References Singleton.

Referenced by NBNetBuilder::transformCoordinates().

const Boundary& NBHeightMapper::getBoundary ( )
inline

returns the convex boundary of all known triangles

Definition at line 84 of file NBHeightMapper.h.

References myBoundary, and Singleton.

Referenced by loadIfSet().

void NBHeightMapper::loadIfSet ( OptionsCont oc)
static

loads heigh map data if any loading options are set

Parameters
[in]ocThe options container to get further options from
Exceptions
ProcessErrorif something fails

Definition at line 151 of file NBHeightMapper.cpp.

References MsgHandler::endProcessMsg(), getBoundary(), MsgHandler::getMessageInstance(), OptionsCont::getStringVector(), OptionsCont::isSet(), loadShapeFile(), loadTiff(), PROGRESS_BEGIN_MESSAGE, Singleton, and toString().

Referenced by NILoader::load().

int NBHeightMapper::loadShapeFile ( const std::string &  file)
private

load height data from Arcgis-shape file and returns the number of parsed features

Returns
The number of parsed features
Exceptions
ProcessError

Definition at line 178 of file NBHeightMapper.cpp.

References Boundary::add(), addTriangle(), myBoundary, SUMOReal, WRITE_ERROR, and WRITE_WARNING.

Referenced by loadIfSet().

int NBHeightMapper::loadTiff ( const std::string &  file)
private

load height data from GeoTIFF file and returns the number of non void pixels

Returns
The number of valid pixels
Exceptions
ProcessError

Definition at line 277 of file NBHeightMapper.cpp.

References Boundary::add(), clearData(), myBoundary, myRaster, mySizeOfPixel, Position::set(), WRITE_ERROR, Position::x(), and Position::y().

Referenced by loadIfSet().

NBHeightMapper& NBHeightMapper::operator= ( const NBHeightMapper )
private

Invalidated assignment operator.

bool NBHeightMapper::ready ( ) const

returns whether the NBHeightMapper has data

Definition at line 80 of file NBHeightMapper.cpp.

References myRaster, and myTriangles.

Referenced by getZ(), and NBNetBuilder::transformCoordinates().

Friends And Related Function Documentation

friend class NBHeightMapperTest
friend

Definition at line 67 of file NBHeightMapper.h.

Field Documentation

Boundary NBHeightMapper::myBoundary
private

convex boundary of all known triangles;

Definition at line 150 of file NBHeightMapper.h.

Referenced by clearData(), getBoundary(), getZ(), loadShapeFile(), and loadTiff().

int16_t* NBHeightMapper::myRaster
private

raster height information in m

Definition at line 144 of file NBHeightMapper.h.

Referenced by clearData(), getZ(), loadTiff(), and ready().

TRIANGLE_RTREE_QUAL NBHeightMapper::myRTree
private

The RTree for spatial queries.

Definition at line 141 of file NBHeightMapper.h.

Referenced by addTriangle(), and getZ().

Position NBHeightMapper::mySizeOfPixel
private

dimensions of one pixel in raster data

Definition at line 147 of file NBHeightMapper.h.

Referenced by getZ(), and loadTiff().

Triangles NBHeightMapper::myTriangles
private

Definition at line 138 of file NBHeightMapper.h.

Referenced by addTriangle(), clearData(), and ready().

NBHeightMapper NBHeightMapper::Singleton
staticprivate

the singleton instance

Definition at line 136 of file NBHeightMapper.h.

Referenced by get(), getBoundary(), and loadIfSet().


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