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
8 int clamped_pixel_offset_x;
9 int clamped_pixel_offset_y;
10 int min_raster_size; // Currently unused
11 int remainder_x_left;
12 int remainder_y_top;
13 int target_height;
14 int target_width;
15 int usable_height;
16 int usable_width;
17};
18
19// Forward declaration of GDALDataset from <gdal/gdal_priv.h>
20class GDALDataset;
21
24class GeoRaster {
25 public:
26 enum FORMAT { // size (bits) | data type | Number of chanels
27 RGB, // 8 | int | 3
28 RGBA, // 8 | int | 4
29 RF, // 32<=X<=64 | float | X >= 1
30 BYTE, // 8 | int | X >= 1
31 MIXED, // 8<=X<=64 | int and/or float | X >= 2
32 UNKNOWN // unknown | unknown | X >= 1
33 };
34
35 GeoRaster(GDALDataset *data, int interpolation_type);
36
37 GeoRaster(GDALDataset *data, int pixel_offset_x, int pixel_offset_y,
38 int source_window_size_pixels, int destination_window_size_pixels,
39 int interpolation_type);
40
41 ~GeoRaster() = default;
42
43 static FORMAT get_format_for_dataset(GDALDataset *data);
44
52 void *get_as_array();
53
58 void *get_band_as_array(int band_index);
59
64
66 FORMAT get_format();
67
73 FORMAT get_band_format(int band_index);
74
75 int get_pixel_size_x();
76
77 int get_pixel_size_y();
78
82 uint64_t *get_histogram();
83
88 int *get_most_common(int number_of_elements);
89
90 private:
91 GDALDataset *data;
92
93 FORMAT format;
94
95 int pixel_offset_x;
96
97 int pixel_offset_y;
98
99 int source_window_size_pixels;
100
101 int destination_window_size_pixels;
102
103 int interpolation_type;
104
107 RasterIOHelper get_raster_io_helper();
108};
109
110#endif // RASTERTILEEXTRACTOR_GEORASTER_H
Definition: GeoRaster.h:24
void * get_as_array()
Definition: GeoRaster.cpp:92
uint64_t * get_histogram()
Definition: GeoRaster.cpp:346
int get_size_in_bytes()
Definition: GeoRaster.cpp:293
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:314
int * get_most_common(int number_of_elements)
Definition: GeoRaster.cpp:457
FORMAT get_format()
Return the format of the data of this GeoRaster.
Definition: GeoRaster.cpp:310
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:222
Definition: GeoRaster.h:7