32 <<
"Selected origin not within bounds! Please ensure x is "
35 <<
" and Y is within the range " << long(
m_LowerRightY) <<
" - "
51 GDALDataset* dataset =
53 if (dataset == NULL) {
54 std::cerr <<
"Failed to open file" << std::endl;
59 GDALRasterBand* band = dataset->GetRasterBand(1);
61 std::cerr <<
"Failed to get raster band" << std::endl;
65 double geoTransform[6];
66 dataset->GetGeoTransform(geoTransform);
70 double upperLeftX = geoTransform[0];
71 double upperLeftY = geoTransform[3];
86 int xOffset = (selectionCornerX - upperLeftX);
87 int yOffset = (upperLeftY - selectionCornerY);
92 band->RasterIO(GF_Read, xOffset, yOffset,
m_Size,
m_Size,
101 for (
int yDex = 0; yDex <
m_Size; yDex++) {
102 for (
int xDex = 0; xDex <
m_Size; xDex++) {
106 elevationData[yDex *
m_Size + xDex];
111 delete[] elevationData;
119 if (
ValidInput(inputRelativeX, inputRelativeY)) {
125 std::cerr <<
"Request out of bounds" << std::endl;
142 std::cerr <<
"Request out of bounds" << std::endl;
157 std::cerr <<
"Request out of bounds" << std::endl;
166 if (
ValidInput(inputRelativeX, inputRelativeY)) {
172 std::cerr <<
"Request out of bounds" << std::endl;
180 bool validInput = (0 <= y) && (y <
m_Size) && (0 <= x) && (x <
m_Size);
202 return ((x <= max_x) && (x >= min_x) && (y <= max_y) && (y >= min_y));
210 GDALDataset* dataset =
212 if (dataset == NULL) {
213 std::cerr <<
"Failed to open file" << std::endl;
216 GDALRasterBand* band = dataset->GetRasterBand(1);
218 std::cerr <<
"Failed to get raster band" << std::endl;
221 double geoTransform[6];
222 dataset->GetGeoTransform(geoTransform);
227 m_UpperLeftX + geoTransform[1] * dataset->GetRasterXSize();
229 m_UpperLeftY + geoTransform[5] * dataset->GetRasterXSize();
bool GetVertexAbsolute(double inputX, double inputY, heightdata &vertex)
Function to get the height_management of an absolute (geographic) coordinate, using the same coordina...
void UpdateCornerCoords()
Function to update the corner coordinates saved within the member instance of the chosen dataset.
void PopulateVertices()
Function that will open the GeoTiff file and extract all heights for the given subset of the dataset ...
HeightManager()
Constructor of HeightManager class.
void LoadTif(const char *filePath, double x, double y)
Function to allow user to change GeoTiff file used in planning.
const char * m_CachedTifName
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 ...
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.
heightdata m_SelectionCorner
const char * m_CoordinateSystem
bool ValidInput(int x, int y)
Function to test whether a point exists within the scope of the selected data subset.
float GetHeightAbsolute(double inputX, double inputY)
Function to get the height of an absolute (geographic) coordinate, using the same coordinate system o...
bool OrigoWithinBounds(double x, double y)
Function that tests whether the selected origin point is within the bounds of the currently active da...
\ A structure that represents a coordinate in the Universal Transverse Mercator coordinate system