#include <gdal/ogr_spatialref.h>
#include <gdal/ogr_spatialref.h>
#include <ogr_spatialref.h>

/**
    @brief stores the contents of a tif file with float32 values
 */
class HeightMap
{
    public:
        float* data;
        double* geotransform; //!< Six double buffer for storing the affine transformations
        // https://gdal.org/api/gdaldataset_cpp.html#_CPPv4N11GDALDataset15GetGeoTransformEPd
        int width; //!< width of image in pixels
        int height; //!< height of image in pixels
        float min; //!< Minimum value in image
        float max; //!< Maximum value in image
        OGRSpatialReference reference_system;

        HeightMap(const char* filepath);
        float get_pixel(int x,int y);
        void blur(float standard_deviation);
};

/**
    @brief stores the cells from marching squars for one elevation level
 */
class CellMap
{
    public:
        uint8_t* cells; //!< pointer to the first cell in the array. uint8_t is a 8 bit unsigned integer 
        double* geotransform; //!< Six double buffer for storing the affine transformations
        int width; //!< width of image in cells
        int height; //!< height of image in cells
        OGRSpatialReference reference_system;
        CellMap(int width, int height, uint8_t* cells, OGRSpatialReference reference_system, double* geotransform);
        int get_cell(int x,int y);
};

class Point
{
    public:
        int x;
        int y;
        int mscase;
        bool allocated = false;
        Point(int x, int y, int mscase){
            this -> x = x;
            this -> y = y;
            this -> mscase = mscase;
        };
};
