mirror of
https://gitlab.com/Trygve/contour-creator.git
synced 2024-11-24 00:00:17 +00:00
Remove cellmap class
This commit is contained in:
parent
264c0341ed
commit
f857f7e951
@ -1,20 +0,0 @@
|
||||
#include <cstdint>
|
||||
#include <gdal/ogr_spatialref.h>
|
||||
#include <ogr_spatialref.h>
|
||||
#include "contour_creator.hh"
|
||||
|
||||
|
||||
CellMap::CellMap(int width, int height, uint8_t* cells, OGRSpatialReference reference_system, double* geotransform)
|
||||
{
|
||||
this->width = width;
|
||||
this->height = height;
|
||||
this->cells = cells;
|
||||
this->reference_system = reference_system;
|
||||
this->geotransform = geotransform;
|
||||
}
|
||||
int CellMap::get_cell(int x, int y)
|
||||
{
|
||||
// all the cells are in an array of ints from left to right, top to bottom
|
||||
int offset = ((this->width * y) + x);
|
||||
return *(this->cells + offset);
|
||||
}
|
@ -22,26 +22,11 @@ class HeightMap
|
||||
delete[] data;
|
||||
delete[] geotransform;
|
||||
}
|
||||
const char* filepath;
|
||||
const char* filepath; //!< Where the heightmap was read from
|
||||
float get_pixel(int x,int y);
|
||||
void blur(float standard_deviation);
|
||||
void statistics();
|
||||
void calculate_steepness(const char*);
|
||||
};
|
||||
|
||||
/**
|
||||
@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);
|
||||
void statistics(); //!< Print statistical information about the heightmap
|
||||
void calculate_steepness(const char*); //!< Output a raster file with the steepness of each pixel
|
||||
};
|
||||
|
||||
class Point
|
||||
@ -49,8 +34,8 @@ class Point
|
||||
public:
|
||||
int x;
|
||||
int y;
|
||||
int mscase;
|
||||
bool allocated = false;
|
||||
uint8_t mscase; //!< The case outputted by the algorithm. A number between 0 and 15
|
||||
bool allocated = false; //!< Used when sorting the points to see if it has been sorted
|
||||
Point(int x, int y, int mscase){
|
||||
this -> x = x;
|
||||
this -> y = y;
|
||||
|
@ -250,8 +250,8 @@ void write_output_file(std::vector<std::vector<Point>> all_points, const char *f
|
||||
if ((points[k].x - points[k-1].x) < 0)
|
||||
left_to_right = false;
|
||||
bool top_to_bottom = true;
|
||||
if ((points[k].y - points[k-1].y) <= 0)
|
||||
left_to_right = false;
|
||||
if ((points[k].y - points[k-1].y) < 0)
|
||||
top_to_bottom = false;
|
||||
|
||||
|
||||
|
||||
@ -261,7 +261,7 @@ void write_output_file(std::vector<std::vector<Point>> all_points, const char *f
|
||||
|
||||
auto [x1, y1, x2, y2] = marching_squares_lookup(points[k].mscase);
|
||||
|
||||
if (left_to_right or !top_to_bottom)
|
||||
if (left_to_right or top_to_bottom)
|
||||
{
|
||||
geometry->setPoint(geometry->getNumPoints(),x + (x1/4) ,y + (y1/4));
|
||||
geometry->setPoint(geometry->getNumPoints(),x + (x2/4) ,y + (y2/4));
|
||||
|
Loading…
Reference in New Issue
Block a user