 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
18 #ifndef NBHeightMapper_h
19 #define NBHeightMapper_h
28 typedef __int16 int16_t;
39 #define TRIANGLE_RTREE_QUAL RTree<NBHeightMapper::Triangle*, NBHeightMapper::Triangle, float, 2, NBHeightMapper::QueryResult>
162 int loadTiff(
const std::string& file);
180 inline float TRIANGLE_RTREE_QUAL::RectSphericalVolume(Rect* a_rect) {
182 const float extent0 = a_rect->m_max[0] - a_rect->m_min[0];
183 const float extent1 = a_rect->m_max[1] - a_rect->m_min[1];
184 return .78539816f * (extent0 * extent0 + extent1 * extent1);
188 inline TRIANGLE_RTREE_QUAL::Rect TRIANGLE_RTREE_QUAL::CombineRect(Rect* a_rectA, Rect* a_rectB) {
189 ASSERT(a_rectA && a_rectB);
191 newRect.m_min[0] =
rtree_min(a_rectA->m_min[0], a_rectB->m_min[0]);
192 newRect.m_max[0] =
rtree_max(a_rectA->m_max[0], a_rectB->m_max[0]);
193 newRect.m_min[1] =
rtree_min(a_rectA->m_min[1], a_rectB->m_min[1]);
194 newRect.m_max[1] =
rtree_max(a_rectA->m_max[1], a_rectB->m_max[1]);
bool contains(const Position &pos) const
checks whether pos lies within triangle (only checks x,y)
TRIANGLE_RTREE_QUAL myRTree
The RTree for spatial queries.
static const NBHeightMapper & get()
return the singleton instance (maybe 0)
Set z-values for all network positions based on data from a height map.
void addSelf(const QueryResult &queryResult) const
callback for RTree search
bool ready() const
returns whether the NBHeightMapper has data
NBHeightMapper & operator=(const NBHeightMapper &)
Invalidated assignment operator.
Boundary myBoundary
convex boundary of all known triangles;
int loadTiff(const std::string &file)
load height data from GeoTIFF file and returns the number of non void pixels
PositionVector myCorners
the corners of the triangle
Position mySizeOfPixel
dimensions of one pixel in raster data
Position normalVector() const
returns the normal vector for this triangles plane
double getZ(const Position &geo) const
returns the projection of the give geoCoordinate (WGS84) onto triangle plane
A class that stores a 2D geometrical boundary.
A point in 2D or 3D with translation and scaling methods.
A storage for options typed value containers)
void add(Triangle *triangle) const
NBHeightMapper()
private constructor and destructor (Singleton)
static NBHeightMapper Singleton
the singleton instance
class for cirumventing the const-restriction of RTree::Search-context
void addTriangle(PositionVector corners)
adds one triangles worth of height data
std::vector< std::pair< Boundary, int16_t * > > myRasters
raster height information in m for all loaded files
#define TRIANGLE_RTREE_QUAL
int loadShapeFile(const std::string &file)
load height data from Arcgis-shape file and returns the number of parsed features
friend class NBHeightMapperTest
static void loadIfSet(OptionsCont &oc)
loads heigh map data if any loading options are set
Triangle(const PositionVector &corners)
double getZ(const Position &geo) const
returns height for the given geo coordinate (WGS84)
const Boundary & getBoundary()
returns the convex boundary of all known triangles
void clearData()
clears loaded data
std::vector< const Triangle * > Triangles