30 #ifndef GDAL_RAT_H_INCLUDED
31 #define GDAL_RAT_H_INCLUDED
38 #define RAT_MAX_ELEM_FOR_CLONE 1000000
194 virtual void SetValue(
int iRow,
int iField,
const char *pszValue) = 0;
209 virtual void SetValue(
int iRow,
int iField,
int nValue) = 0;
224 virtual void SetValue(
int iRow,
int iField,
double dfValue) = 0;
260 int iLength,
double *pdfData);
262 int iLength,
int *pnData);
264 int iLength,
char **papszStrList);
266 virtual void SetRowCount(
int iCount);
267 virtual int GetRowOfValue(
double dfValue)
const;
268 virtual int GetRowOfValue(
int nValue)
const;
270 virtual CPLErr CreateColumn(
const char *pszFieldName,
273 virtual CPLErr SetLinearBinning(
double dfRow0Min,
double dfBinSize);
274 virtual int GetLinearBinning(
double *pdfRow0Min,
double *pdfBinSize)
const;
283 virtual void *SerializeJSON()
const;
287 virtual GDALColorTable *TranslateToColorTable(
int nEntryCount = -1);
289 virtual void DumpReadable(FILE * =
nullptr);
323 class GDALRasterAttributeField
332 std::vector<GInt32> anValues{};
333 std::vector<double> adfValues{};
334 std::vector<CPLString> aosValues{};
348 std::vector<GDALRasterAttributeField> aoFields{};
350 int bLinearBinning =
false;
351 double dfRow0Min = -0.5;
352 double dfBinSize = 1.0;
356 void AnalyseColumns();
357 int bColumnsAnalysed =
false;
371 int GetColumnCount()
const override;
373 const char *GetNameOfCol(
int)
const override;
379 int GetRowCount()
const override;
381 const char *GetValueAsString(
int iRow,
int iField)
const override;
382 int GetValueAsInt(
int iRow,
int iField)
const override;
383 double GetValueAsDouble(
int iRow,
int iField)
const override;
385 void SetValue(
int iRow,
int iField,
const char *pszValue)
override;
386 void SetValue(
int iRow,
int iField,
double dfValue)
override;
387 void SetValue(
int iRow,
int iField,
int nValue)
override;
389 int ChangesAreWrittenToFile()
override;
390 void SetRowCount(
int iCount)
override;
392 int GetRowOfValue(
double dfValue)
const override;
393 int GetRowOfValue(
int nValue)
const override;
397 CPLErr SetLinearBinning(
double dfRow0Min,
double dfBinSize)
override;
398 int GetLinearBinning(
double *pdfRow0Min,
double *pdfBinSize)
const override;
403 void RemoveStatistics()
override;
Convenient string class based on std::string.
Definition: cpl_string.h:320
A color table / palette.
Definition: gdal_priv.h:1348
Raster Attribute Table container.
Definition: gdal_rat.h:346
The GDALRasterAttributeTable (or RAT) class is used to encapsulate a table used to provide attribute ...
Definition: gdal_rat.h:48
virtual void SetValue(int iRow, int iField, const char *pszValue)=0
Set field value from string.
virtual double GetValueAsDouble(int iRow, int iField) const =0
Fetch field value as a double.
static GDALRasterAttributeTableH ToHandle(GDALRasterAttributeTable *poRAT)
Convert a GDALRasterAttributeTable* to a GDALRasterAttributeTableH.
Definition: gdal_rat.h:295
virtual void RemoveStatistics()=0
Remove statistics from the RAT.
virtual int GetRowCount() const =0
Fetch row count.
virtual int ChangesAreWrittenToFile()=0
Determine whether changes made to this RAT are reflected directly in the dataset.
static GDALRasterAttributeTable * FromHandle(GDALRasterAttributeTableH hRAT)
Convert a GDALRasterAttributeTableH to a GDALRasterAttributeTable*.
Definition: gdal_rat.h:304
virtual CPLErr SetTableType(const GDALRATTableType eInTableType)=0
Set the RAT table type.
virtual int GetColumnCount() const =0
Fetch table column count.
virtual GDALRATFieldUsage GetUsageOfCol(int iCol) const =0
Fetch column usage value.
virtual const char * GetValueAsString(int iRow, int iField) const =0
Fetch field value as a string.
virtual void SetValue(int iRow, int iField, int nValue)=0
Set field value from integer.
virtual GDALRATTableType GetTableType() const =0
Get the RAT table type.
virtual void SetValue(int iRow, int iField, double dfValue)=0
Set field value from double.
virtual int GetValueAsInt(int iRow, int iField) const =0
Fetch field value as a integer.
virtual const char * GetNameOfCol(int iCol) const =0
Fetch name of indicated column.
virtual int GetColOfUsage(GDALRATFieldUsage eUsage) const =0
Fetch column index for given usage.
virtual GDALRATFieldType GetTypeOfCol(int iCol) const =0
Fetch column type.
virtual GDALRasterAttributeTable * Clone() const =0
Copy Raster Attribute Table.
CPLErr
Error category.
Definition: cpl_error.h:53
Definitions for CPL mini XML Parser/Serializer.
GDALRATTableType
RAT table type (thematic or athematic)
Definition: gdal.h:2028
GDALRATFieldUsage
Field usage of raster attribute table.
Definition: gdal.h:2002
@ GFU_Generic
Definition: gdal.h:2003
GDALRATFieldType
Field type of raster attribute table.
Definition: gdal.h:1994
@ GFT_Integer
Definition: gdal.h:1995
void * GDALRasterAttributeTableH
Opaque type used for the C bindings of the C++ GDALRasterAttributeTable class.
Definition: gdal.h:304
GDALRWFlag
Definition: gdal.h:132
Document node structure.
Definition: cpl_minixml.h:71