Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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:
[legend]

Data Structures

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

Public Types

typedef std::vector< const Triangle * > Triangles
 

Public Member Functions

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

Static Public Member Functions

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

Private Member Functions

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

Private Attributes

Boundary myBoundary
 convex boundary of all known triangles;
 
std::vector< RasterDatamyRasters
 raster height information in m for all loaded files
 
TRIANGLE_RTREE_QUAL myRTree
 The RTree for spatial queries.
 
Position mySizeOfPixel
 dimensions of one pixel in raster data
 
Triangles myTriangles
 

Static Private Attributes

static NBHeightMapper myInstance
 the singleton instance
 

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 55 of file NBHeightMapper.h.

Member Typedef Documentation

◆ Triangles

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

Definition at line 110 of file NBHeightMapper.h.

Constructor & Destructor Documentation

◆ NBHeightMapper() [1/2]

NBHeightMapper::NBHeightMapper ( )
private

private constructor and destructor (Singleton)

Definition at line 63 of file NBHeightMapper.cpp.

◆ ~NBHeightMapper()

NBHeightMapper::~NBHeightMapper ( )
private

Definition at line 68 of file NBHeightMapper.cpp.

References clearData().

◆ NBHeightMapper() [2/2]

NBHeightMapper::NBHeightMapper ( const NBHeightMapper )
private

Invalidated copy constructor.

Member Function Documentation

◆ addTriangle()

void NBHeightMapper::addTriangle ( PositionVector  corners)
private

adds one triangles worth of height data

Definition at line 142 of file NBHeightMapper.cpp.

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

Referenced by loadShapeFile().

Here is the caller graph for this function:

◆ clearData()

void NBHeightMapper::clearData ( )
private

clears loaded data

Definition at line 355 of file NBHeightMapper.cpp.

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

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

Here is the caller graph for this function:

◆ get()

const NBHeightMapper & NBHeightMapper::get ( )
static

return the singleton instance (maybe 0)

Definition at line 74 of file NBHeightMapper.cpp.

References myInstance.

Referenced by NBNetBuilder::transformCoordinate().

Here is the caller graph for this function:

◆ getBoundary()

const Boundary & NBHeightMapper::getBoundary ( )
inline

returns the convex boundary of all known triangles

Definition at line 74 of file NBHeightMapper.h.

References myBoundary, and myInstance.

Referenced by loadIfSet().

Here is the caller graph for this function:

◆ getZ()

double NBHeightMapper::getZ ( const Position geo) const

returns height for the given geo coordinate (WGS84)

Definition at line 86 of file NBHeightMapper.cpp.

References Boundary::around(), NBHeightMapper::Triangle::contains(), NBHeightMapper::Triangle::getZ(), myRasters, myRTree, mySizeOfPixel, ready(), TL, toString(), NBHeightMapper::QueryResult::triangles, UNUSED_PARAMETER, WRITE_WARNING, WRITE_WARNINGF, Position::x(), Boundary::xmin(), Position::y(), and Boundary::ymax().

Referenced by NBNetBuilder::transformCoordinate().

Here is the caller graph for this function:

◆ loadIfSet()

void NBHeightMapper::loadIfSet ( OptionsCont oc)
static

loads height 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 153 of file NBHeightMapper.cpp.

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

Referenced by NILoader::load().

Here is the caller graph for this function:

◆ loadShapeFile()

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 180 of file NBHeightMapper.cpp.

References Boundary::add(), addTriangle(), myBoundary, TL, TLF, UNUSED_PARAMETER, WRITE_ERROR, WRITE_WARNING, and WRITE_WARNINGF.

Referenced by loadIfSet().

Here is the caller graph for this function:

◆ loadTiff()

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 283 of file NBHeightMapper.cpp.

References Boundary::add(), NBHeightMapper::RasterData::boundary, clearData(), MAX2(), MIN2(), myRasters, mySizeOfPixel, NBHeightMapper::RasterData::raster, Position::set(), TL, toString(), UNUSED_PARAMETER, WRITE_ERROR, WRITE_ERRORF, WRITE_MESSAGE, Position::x(), NBHeightMapper::RasterData::xSize, Position::y(), and NBHeightMapper::RasterData::ySize.

Referenced by loadIfSet().

Here is the caller graph for this function:

◆ operator=()

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

Invalidated assignment operator.

◆ ready()

bool NBHeightMapper::ready ( ) const

returns whether the NBHeightMapper has data

Definition at line 80 of file NBHeightMapper.cpp.

References myRasters, and myTriangles.

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

Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ NBHeightMapperTest

friend class NBHeightMapperTest
friend

Definition at line 57 of file NBHeightMapper.h.

Field Documentation

◆ myBoundary

Boundary NBHeightMapper::myBoundary
private

convex boundary of all known triangles;

Definition at line 148 of file NBHeightMapper.h.

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

◆ myInstance

NBHeightMapper NBHeightMapper::myInstance
staticprivate

the singleton instance

Definition at line 134 of file NBHeightMapper.h.

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

◆ myRasters

std::vector<RasterData> NBHeightMapper::myRasters
private

raster height information in m for all loaded files

Definition at line 142 of file NBHeightMapper.h.

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

◆ myRTree

TRIANGLE_RTREE_QUAL NBHeightMapper::myRTree
private

The RTree for spatial queries.

Definition at line 139 of file NBHeightMapper.h.

Referenced by addTriangle(), and getZ().

◆ mySizeOfPixel

Position NBHeightMapper::mySizeOfPixel
private

dimensions of one pixel in raster data

Definition at line 145 of file NBHeightMapper.h.

Referenced by getZ(), and loadTiff().

◆ myTriangles

Triangles NBHeightMapper::myTriangles
private

Definition at line 136 of file NBHeightMapper.h.

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


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