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