hivemind 1.0.0
Loading...
Searching...
No Matches
HeightManagement::HeightManager Class Reference

#include <height_manager.h>

Collaboration diagram for HeightManagement::HeightManager:
Collaboration graph

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
 
heightdatam_Vertices
 
heightdata m_Origo { 0, 0, 0 }
 
heightdata m_SelectionCorner
 

Detailed Description

Definition at line 11 of file height_manager.h.

Constructor & Destructor Documentation

◆ HeightManager()

HeightManagement::HeightManager::HeightManager ( )

Constructor of HeightManager class.

Returns
No object.

Definition at line 9 of file height_manager.cpp.

Member Function Documentation

◆ GetHeight()

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)

Parameters
inputRelativeXThe relative X value of the point.
inputRelativeYThe relative Y value of the point.
Returns
A float containing the height value of the point in metres.

Definition at line 163 of file height_manager.cpp.

References m_Size, m_Vertices, ValidInput(), and HeightManagement::HeightManager::heightdata::z.

Here is the call graph for this function:

◆ GetHeightAbsolute()

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.

Parameters
inputXThe absolute X value of the point.
inputYThe absolute Y value of the point.
Returns
A float containing the height of the point in metres.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetVertex()

bool HeightManagement::HeightManager::GetVertex ( int  inputRelativeX,
int  inputRelativeY,
HeightManager::heightdata vertex 
)

Function to return the whole "height_management" for a given point.

Parameters
inputRelativeXThe X coordinate in the relative system (where 0,0 is the top left corner of the system).
inputRelativeYThe Y coordinate in the relative system.
Returns
A height_management, containing the geographic (absolute) x, y and z coordinates.

Definition at line 116 of file height_manager.cpp.

References m_Size, m_Vertices, ValidInput(), and HeightManagement::HeightManager::heightdata::z.

Here is the call graph for this function:

◆ GetVertexAbsolute()

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.

Parameters
inputXThe absolute X value of the point.
inputYThe absolute Y value of the point.
Returns
A float containing the height of the point in metres.

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.

Here is the call graph for this function:

◆ LoadTif()

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.

Parameters
filePathComplete file path of the file to be used.
xX 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.
yY coordinate used for GeoTiff subset origin.
Returns
No object, but will update the path for the cached tif.

Definition at line 12 of file height_manager.cpp.

References m_CachedTifName, m_Size, and UpdateOrigin().

Here is the call graph for this function:

◆ OrigoWithinBounds()

bool HeightManagement::HeightManager::OrigoWithinBounds ( double  x,
double  y 
)
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.

Parameters
xThe X value of the origin point.
yThe Y value of the origin point.
Returns
A bool indicating whether or not the origin point is within bounds.

Definition at line 195 of file height_manager.cpp.

References m_LowerRightX, m_LowerRightY, m_Size, m_UpperLeftX, and m_UpperLeftY.

Referenced by UpdateOrigin().

Here is the caller graph for this function:

◆ PopulateVertices()

void HeightManagement::HeightManager::PopulateVertices ( )
private

Function that will open the GeoTiff file and extract all heights for the given subset of the dataset used.

Returns
No object, but after this has run, all heights will have been imported into the instance of the class and the various GetHeight methods can be run.

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().

Here is the caller graph for this function:

◆ UpdateCornerCoords()

void HeightManagement::HeightManager::UpdateCornerCoords ( )
private

Function to update the corner coordinates saved within the member instance of the chosen dataset.

Returns
No object, but the corner coordinates will be updated, given there were no problems opening the GeoTiff file.

Definition at line 206 of file height_manager.cpp.

References m_CachedTifName, m_LowerRightX, m_LowerRightY, m_UpperLeftX, and m_UpperLeftY.

Referenced by UpdateOrigin().

Here is the caller graph for this function:

◆ 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.

Parameters
xX coordinate used for GeoTiff subset origin.
yY coordinate used for GeoTiff subset origin.
Returns
No object, but will update the origin for this instance of HeightManager and will populate the instance with height data.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ValidInput() [1/2]

bool HeightManagement::HeightManager::ValidInput ( double  x,
double  y 
)
private

Function to test whether a point exists within the scope of the elected data subset.

Overloaded version of ValidInput() that takes doubles.

Parameters
xThe X value of the coordinate to be tested.
yThe Y value of the coordinate to be tested.
Returns
A bool indicating whether or not the input exists in the subset and is valid.

Definition at line 185 of file height_manager.cpp.

References m_SelectionCorner, m_Size, HeightManagement::HeightManager::heightdata::x, and HeightManagement::HeightManager::heightdata::y.

◆ ValidInput() [2/2]

bool HeightManagement::HeightManager::ValidInput ( int  x,
int  y 
)
private

Function to test whether a point exists within the scope of the selected data subset.

Parameters
xthe X value of the coordinate to be tested.
ythe Y value of the coordinate to be tested.
Returns
A bool indicating whether or not the input exists in the subset and is valid.

Definition at line 178 of file height_manager.cpp.

References m_Size.

Referenced by GetHeight(), GetHeightAbsolute(), GetVertex(), and GetVertexAbsolute().

Here is the caller graph for this function:

Member Data Documentation

◆ m_CachedTifName

const char* HeightManagement::HeightManager::m_CachedTifName = "../res/Kongsberg.tif"
private

Definition at line 130 of file height_manager.h.

Referenced by LoadTif(), PopulateVertices(), and UpdateCornerCoords().

◆ m_CoordinateSystem

const char* HeightManagement::HeightManager::m_CoordinateSystem { "UTM33" }
private

Definition at line 131 of file height_manager.h.

Referenced by UpdateOrigin().

◆ m_LowerRightX

long HeightManagement::HeightManager::m_LowerRightX
private

Definition at line 136 of file height_manager.h.

Referenced by OrigoWithinBounds(), UpdateCornerCoords(), and UpdateOrigin().

◆ m_LowerRightY

long HeightManagement::HeightManager::m_LowerRightY
private

Definition at line 137 of file height_manager.h.

Referenced by OrigoWithinBounds(), UpdateCornerCoords(), and UpdateOrigin().

◆ m_Origo

heightdata HeightManagement::HeightManager::m_Origo { 0, 0, 0 }
private

Definition at line 139 of file height_manager.h.

Referenced by PopulateVertices(), and UpdateOrigin().

◆ m_Resolution

int HeightManagement::HeightManager::m_Resolution { 1 }
private

Definition at line 132 of file height_manager.h.

◆ m_SelectionCorner

heightdata HeightManagement::HeightManager::m_SelectionCorner
private

◆ m_Size

int HeightManagement::HeightManager::m_Size
private

◆ m_UpperLeftX

long HeightManagement::HeightManager::m_UpperLeftX
private

Definition at line 134 of file height_manager.h.

Referenced by OrigoWithinBounds(), UpdateCornerCoords(), and UpdateOrigin().

◆ m_UpperLeftY

long HeightManagement::HeightManager::m_UpperLeftY
private

Definition at line 135 of file height_manager.h.

Referenced by OrigoWithinBounds(), UpdateCornerCoords(), and UpdateOrigin().

◆ m_Vertices

heightdata* HeightManagement::HeightManager::m_Vertices
private

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