21 #ifndef NBHeightMapper_h 22 #define NBHeightMapper_h 35 typedef __int16 int16_t;
46 #define TRIANGLE_RTREE_QUAL RTree<NBHeightMapper::Triangle*, NBHeightMapper::Triangle, float, 2, NBHeightMapper::QueryResult> 169 int loadTiff(
const std::string& file);
187 inline float TRIANGLE_RTREE_QUAL::RectSphericalVolume(Rect* a_rect) {
189 const float extent0 = a_rect->m_max[0] - a_rect->m_min[0];
190 const float extent1 = a_rect->m_max[1] - a_rect->m_min[1];
191 return .78539816f * (extent0 * extent0 + extent1 * extent1);
195 inline TRIANGLE_RTREE_QUAL::Rect TRIANGLE_RTREE_QUAL::CombineRect(Rect* a_rectA, Rect* a_rectB) {
196 ASSERT(a_rectA && a_rectB);
198 newRect.m_min[0] =
rtree_min(a_rectA->m_min[0], a_rectB->m_min[0]);
199 newRect.m_max[0] =
rtree_max(a_rectA->m_max[0], a_rectB->m_max[0]);
200 newRect.m_min[1] =
rtree_min(a_rectA->m_min[1], a_rectB->m_min[1]);
201 newRect.m_max[1] =
rtree_max(a_rectA->m_max[1], a_rectB->m_max[1]);
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 ...
Triangle(const PositionVector &corners)
double getZ(const Position &geo) const
returns the projection of the give geoCoordinate (WGS84) onto triangle plane
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
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
Set z-values for all network positions based on data from a height map.