diff --git a/src/casemap.cpp b/src/casemap.cpp new file mode 100644 index 0000000..35d5f70 --- /dev/null +++ b/src/casemap.cpp @@ -0,0 +1,22 @@ +#include +#include "gdal/gdal_priv.h" +#include + +#include + +#include "CaseMap.hh" +#include "HeightMap.hh" + +CaseMap::CaseMap(int width, int height, int* cases) +{ + this->width = width; + this->height = height; + this->cases = cases; + +} +int CaseMap::get_case(int x, int y) +{ + // all the pixels are in an array of floats from left to right, top to bottom + int offset = ((this->width * y) + x); + return *(this->cases + offset); +} \ No newline at end of file diff --git a/src/casemap.hh b/src/casemap.hh new file mode 100644 index 0000000..5b4cce8 --- /dev/null +++ b/src/casemap.hh @@ -0,0 +1,13 @@ +/** + @brief stores the cases produced from image + */ +class CaseMap +{ + public: + float* data; + int width; //!< width of image in cases + int height; //!< height of image in cases + + CaseMap(int width, int height, int* cases); + float get_case(int x,int y); +}; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 4871dbb..617c683 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,20 @@ #include "HeightMap.hh" +#include "CaseMap.hh" #include #include +#include +#include + +std::vector produce_casemap(HeightMap* heightmap) +{ + std::vector output; + int* test = (int *) CPLMalloc(sizeof(int)*heightmap->width*heightmap->height); + CaseMap casemap1(heightmap->width-1, heightmap->height-1, test); + output.push_back(casemap1); + return output +} +//(int a, int b, ) + int main(int argc, const char* argv[]) { @@ -19,4 +33,6 @@ int main(int argc, const char* argv[]) std::cout << "\n"; } std::cout << "\nend🤡\n"; + casemap = produce_casemap(map); + std::cout << casemap.get_case( 2, 2) } \ No newline at end of file