Geodot Plugin
Loading...
Searching...
No Matches
GeoRaster.h
1#ifndef RASTERTILEEXTRACTOR_GEORASTER_H
2#define RASTERTILEEXTRACTOR_GEORASTER_H
3
4#include "defines.h"
5#include <cstdint>
6#include <mutex>
7
9 int clamped_pixel_offset_x;
10 int clamped_pixel_offset_y;
11 int min_raster_size; // Currently unused
12 int remainder_x_left;
13 int remainder_y_top;
14 int target_height;
15 int target_width;
16 int usable_height;
17 int usable_width;
18
19 static std::mutex rasterio_mutex;
20
22
24};
25
26// Forward declaration of GDALDataset from <gdal/gdal_priv.h>
27class GDALDataset;
28
31class GeoRaster {
32 public:
33 enum FORMAT { // size (bits) | data type | Number of chanels
34 RGB, // 8 | int | 3
35 RGBA, // 8 | int | 4
36 RF, // 32<=X<=64 | float | X >= 1
37 BYTE, // 8 | int | X >= 1
38 MIXED, // 8<=X<=64 | int and/or float | X >= 2
39 UNKNOWN // unknown | unknown | X >= 1
40 };
41
42 GeoRaster(GDALDataset *data, int interpolation_type);
43
44 GeoRaster(GDALDataset *data, int pixel_offset_x, int pixel_offset_y,
45 int source_window_size_pixels, int destination_window_size_pixels,
46 int interpolation_type);
47
48 ~GeoRaster() = default;
49
50 static FORMAT get_format_for_dataset(GDALDataset *data);
51
59 void *get_as_array();
60
65 void *get_band_as_array(int band_index);
66
71
73 FORMAT get_format();
74
80 FORMAT get_band_format(int band_index);
81
82 int get_pixel_size_x();
83
84 int get_pixel_size_y();
85
89 uint64_t *get_histogram();
90
95 int *get_most_common(int number_of_elements);
96
97 private:
98 GDALDataset *data;
99
100 FORMAT format;
101
102 int pixel_offset_x;
103
104 int pixel_offset_y;
105
106 int source_window_size_pixels;
107
108 int destination_window_size_pixels;
109
110 int interpolation_type;
111
114 RasterIOHelper get_raster_io_helper();
115};
116
117#endif // RASTERTILEEXTRACTOR_GEORASTER_H
Definition: GeoRaster.h:31
void * get_as_array()
Definition: GeoRaster.cpp:102
uint64_t * get_histogram()
Definition: GeoRaster.cpp:353
int get_size_in_bytes()
Definition: GeoRaster.cpp:300
FORMAT get_band_format(int band_index)
get the FORMAT of the band at band_index within the dataset. This function is most useful when workin...
Definition: GeoRaster.cpp:321
int * get_most_common(int number_of_elements)
Definition: GeoRaster.cpp:464
FORMAT get_format()
Return the format of the data of this GeoRaster.
Definition: GeoRaster.cpp:317
void * get_band_as_array(int band_index)
Return the data within a single band of the GeoRaster as an array. The type of the array can be any o...
Definition: GeoRaster.cpp:232
Definition: GeoRaster.h:8