![]() |
hivemind 1.0.0
|
#include <height_manager.h>
Classes | |
struct | heightdata |
Public Member Functions | |
HeightManager () | |
Constructor of HeightManager class. | |
void | UpdateOrigin (Core::UTMCoordinate UTMCoord, int size) |
Function to update the origin point. | |
bool | GetVertex (int inputRelativeX, int inputRelativeY, heightdata &vertex) |
Function to return the whole "height_management" for a given point. | |
bool | GetHeight (int inputRelativeX, int inputRelativeY, float &height) |
Function to return height, given relative coordinates (from a system where 0, 0 is in the upper left corner) | |
bool | GetVertexAbsolute (double inputX, double inputY, heightdata &vertex) |
Function to get the height_management of an absolute (geographic) coordinate, using the same coordinate system of the dataset. | |
float | GetHeightAbsolute (double inputX, double inputY) |
Function to get the height of an absolute (geographic) coordinate, using the same coordinate system of the dataset. | |
void | LoadTif (const char *filePath, double x, double y) |
Function to allow user to change GeoTiff file used in planning. | |
Private Member Functions | |
void | PopulateVertices () |
Function that will open the GeoTiff file and extract all heights for the given subset of the dataset used. | |
bool | ValidInput (int x, int y) |
Function to test whether a point exists within the scope of the selected data subset. | |
bool | ValidInput (double x, double y) |
Function to test whether a point exists within the scope of the elected data subset. | |
bool | OrigoWithinBounds (double x, double y) |
Function that tests whether the selected origin point is within the bounds of the currently active data set, given the buffer size required to extract the subset. | |
void | UpdateCornerCoords () |
Function to update the corner coordinates saved within the member instance of the chosen dataset. | |
Private Attributes | |
const char * | m_CachedTifName = "../res/Kongsberg.tif" |
const char * | m_CoordinateSystem { "UTM33" } |
int | m_Resolution { 1 } |
int | m_Size |
long | m_UpperLeftX |
long | m_UpperLeftY |
long | m_LowerRightX |
long | m_LowerRightY |
heightdata * | m_Vertices |
heightdata | m_Origo { 0, 0, 0 } |
heightdata | m_SelectionCorner |
Definition at line 11 of file height_manager.h.
HeightManagement::HeightManager::HeightManager | ( | ) |
Constructor of HeightManager class.
Definition at line 9 of file height_manager.cpp.
bool HeightManagement::HeightManager::GetHeight | ( | int | inputRelativeX, |
int | inputRelativeY, | ||
float & | height | ||
) |
Function to return height, given relative coordinates (from a system where 0, 0 is in the upper left corner)
inputRelativeX | The relative X value of the point. |
inputRelativeY | The relative Y value of the point. |
Definition at line 163 of file height_manager.cpp.
References m_Size, m_Vertices, ValidInput(), and HeightManagement::HeightManager::heightdata::z.
float HeightManagement::HeightManager::GetHeightAbsolute | ( | double | inputX, |
double | inputY | ||
) |
Function to get the height of an absolute (geographic) coordinate, using the same coordinate system of the dataset.
inputX | The absolute X value of the point. |
inputY | The absolute Y value of the point. |
Definition at line 148 of file height_manager.cpp.
References m_SelectionCorner, m_Size, m_Vertices, ValidInput(), HeightManagement::HeightManager::heightdata::x, HeightManagement::HeightManager::heightdata::y, and HeightManagement::HeightManager::heightdata::z.
Referenced by UpdateOrigin().
bool HeightManagement::HeightManager::GetVertex | ( | int | inputRelativeX, |
int | inputRelativeY, | ||
HeightManager::heightdata & | vertex | ||
) |
Function to return the whole "height_management" for a given point.
inputRelativeX | The X coordinate in the relative system (where 0,0 is the top left corner of the system). |
inputRelativeY | The Y coordinate in the relative system. |
Definition at line 116 of file height_manager.cpp.
References m_Size, m_Vertices, ValidInput(), and HeightManagement::HeightManager::heightdata::z.
bool HeightManagement::HeightManager::GetVertexAbsolute | ( | double | inputX, |
double | inputY, | ||
HeightManager::heightdata & | vertex | ||
) |
Function to get the height_management of an absolute (geographic) coordinate, using the same coordinate system of the dataset.
inputX | The absolute X value of the point. |
inputY | The absolute Y value of the point. |
Definition at line 131 of file height_manager.cpp.
References m_SelectionCorner, m_Size, m_Vertices, ValidInput(), HeightManagement::HeightManager::heightdata::x, HeightManagement::HeightManager::heightdata::y, and HeightManagement::HeightManager::heightdata::z.
void HeightManagement::HeightManager::LoadTif | ( | const char * | filePath, |
double | x, | ||
double | y | ||
) |
Function to allow user to change GeoTiff file used in planning.
If this function is not run, the user can still update the origin and Hivemind will run using the cached GeoTiff file.
filePath | Complete file path of the file to be used. |
x | X coordinate used for GeoTiff subset origin. Height data will be populated in a 500x500 pixel centered on the origin point. This is hard coded into the class. |
y | Y coordinate used for GeoTiff subset origin. |
Definition at line 12 of file height_manager.cpp.
References m_CachedTifName, m_Size, and UpdateOrigin().
|
private |
Function that tests whether the selected origin point is within the bounds of the currently active data set, given the buffer size required to extract the subset.
x | The X value of the origin point. |
y | The Y value of the origin point. |
Definition at line 195 of file height_manager.cpp.
References m_LowerRightX, m_LowerRightY, m_Size, m_UpperLeftX, and m_UpperLeftY.
Referenced by UpdateOrigin().
|
private |
Function that will open the GeoTiff file and extract all heights for the given subset of the dataset used.
Definition at line 46 of file height_manager.cpp.
References m_CachedTifName, m_Origo, m_SelectionCorner, m_Size, m_Vertices, HeightManagement::HeightManager::heightdata::x, HeightManagement::HeightManager::heightdata::y, and HeightManagement::HeightManager::heightdata::z.
Referenced by UpdateOrigin().
|
private |
Function to update the corner coordinates saved within the member instance of the chosen dataset.
Definition at line 206 of file height_manager.cpp.
References m_CachedTifName, m_LowerRightX, m_LowerRightY, m_UpperLeftX, and m_UpperLeftY.
Referenced by UpdateOrigin().
void HeightManagement::HeightManager::UpdateOrigin | ( | Core::UTMCoordinate | UTMCoord, |
int | size | ||
) |
Function to update the origin point.
Running this will also trigger the population of height data for the chosen subset of the GeoTiff file.
x | X coordinate used for GeoTiff subset origin. |
y | Y coordinate used for GeoTiff subset origin. |
Definition at line 21 of file height_manager.cpp.
References Core::UTMCoordinate::Easting, GetHeightAbsolute(), m_CoordinateSystem, m_LowerRightX, m_LowerRightY, m_Origo, m_Size, m_UpperLeftX, m_UpperLeftY, m_Vertices, Core::UTMCoordinate::Northing, OrigoWithinBounds(), PopulateVertices(), UpdateCornerCoords(), and HeightManagement::HeightManager::heightdata::z.
Referenced by LoadTif().
|
private |
Function to test whether a point exists within the scope of the elected data subset.
Overloaded version of ValidInput() that takes doubles.
x | The X value of the coordinate to be tested. |
y | The Y value of the coordinate to be tested. |
Definition at line 185 of file height_manager.cpp.
References m_SelectionCorner, m_Size, HeightManagement::HeightManager::heightdata::x, and HeightManagement::HeightManager::heightdata::y.
|
private |
Function to test whether a point exists within the scope of the selected data subset.
x | the X value of the coordinate to be tested. |
y | the Y value of the coordinate to be tested. |
Definition at line 178 of file height_manager.cpp.
References m_Size.
Referenced by GetHeight(), GetHeightAbsolute(), GetVertex(), and GetVertexAbsolute().
|
private |
Definition at line 130 of file height_manager.h.
Referenced by LoadTif(), PopulateVertices(), and UpdateCornerCoords().
|
private |
Definition at line 131 of file height_manager.h.
Referenced by UpdateOrigin().
|
private |
Definition at line 136 of file height_manager.h.
Referenced by OrigoWithinBounds(), UpdateCornerCoords(), and UpdateOrigin().
|
private |
Definition at line 137 of file height_manager.h.
Referenced by OrigoWithinBounds(), UpdateCornerCoords(), and UpdateOrigin().
|
private |
Definition at line 139 of file height_manager.h.
Referenced by PopulateVertices(), and UpdateOrigin().
|
private |
Definition at line 132 of file height_manager.h.
|
private |
Definition at line 140 of file height_manager.h.
Referenced by GetHeightAbsolute(), GetVertexAbsolute(), PopulateVertices(), and ValidInput().
|
private |
Definition at line 133 of file height_manager.h.
Referenced by GetHeight(), GetHeightAbsolute(), GetVertex(), GetVertexAbsolute(), LoadTif(), OrigoWithinBounds(), PopulateVertices(), UpdateOrigin(), and ValidInput().
|
private |
Definition at line 134 of file height_manager.h.
Referenced by OrigoWithinBounds(), UpdateCornerCoords(), and UpdateOrigin().
|
private |
Definition at line 135 of file height_manager.h.
Referenced by OrigoWithinBounds(), UpdateCornerCoords(), and UpdateOrigin().
|
private |
Definition at line 138 of file height_manager.h.
Referenced by GetHeight(), GetHeightAbsolute(), GetVertex(), GetVertexAbsolute(), PopulateVertices(), and UpdateOrigin().