00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef GDAL_RAT_H_INCLUDED
00037 #define GDAL_RAT_H_INCLUDED
00038
00039 #include "cpl_minixml.h"
00040
00041
00042
00043
00044
00045
00046
00047 class GDALRasterAttributeField
00048 {
00049 public:
00050 CPLString sName;
00051
00052 GDALRATFieldType eType;
00053
00054 GDALRATFieldUsage eUsage;
00055
00056 std::vector<GInt32> anValues;
00057 std::vector<double> adfValues;
00058 std::vector<CPLString> aosValues;
00059 };
00060
00061
00062
00063
00064
00066
00067 class CPL_DLL GDALRasterAttributeTable
00068 {
00069 friend const char * CPL_STDCALL GDALRATGetNameOfCol( GDALRasterAttributeTableH, int );
00070 friend const char * CPL_STDCALL GDALRATGetValueAsString( GDALRasterAttributeTableH, int, int );
00071
00072 private:
00073 std::vector<GDALRasterAttributeField> aoFields;
00074
00075 int bLinearBinning;
00076 double dfRow0Min;
00077 double dfBinSize;
00078
00079 int nMinCol;
00080 int nMaxCol;
00081
00082 int nRowCount;
00083
00084 CPLString osWorkingResult;
00085
00086 public:
00087 GDALRasterAttributeTable();
00088 GDALRasterAttributeTable(const GDALRasterAttributeTable&);
00089 ~GDALRasterAttributeTable();
00090
00091 GDALRasterAttributeTable *Clone() const;
00092
00093 int GetColumnCount() const;
00094
00095 CPLString GetNameOfCol( int ) const;
00096 GDALRATFieldUsage GetUsageOfCol( int ) const;
00097 GDALRATFieldType GetTypeOfCol( int ) const;
00098
00099 int GetColOfUsage( GDALRATFieldUsage ) const;
00100
00101 int GetRowCount() const;
00102
00103 CPLString GetValueAsString( int iRow, int iField ) const;
00104 int GetValueAsInt( int iRow, int iField ) const;
00105 double GetValueAsDouble( int iRow, int iField ) const;
00106
00107 void SetValue( int iRow, int iField, const char *pszValue );
00108 void SetValue( int iRow, int iField, double dfValue);
00109 void SetValue( int iRow, int iField, int nValue );
00110 void SetRowCount( int iCount );
00111
00112 int GetRowOfValue( double dfValue ) const;
00113 int GetRowOfValue( int nValue ) const;
00114 int GetColorOfValue( double dfValue, GDALColorEntry *psEntry ) const;
00115
00116 double GetRowMin( int iRow ) const;
00117 double GetRowMax( int iRow ) const;
00118
00119 CPLErr CreateColumn( CPLString osFieldName,
00120 GDALRATFieldType eFieldType,
00121 GDALRATFieldUsage eFieldUsage );
00122 CPLErr SetLinearBinning( double dfRow0Min, double dfBinSize );
00123 int GetLinearBinning( double *pdfRow0Min, double *pdfBinSize ) const;
00124
00125 CPLXMLNode *Serialize() const;
00126 CPLErr XMLInit( CPLXMLNode *, const char * );
00127
00128 CPLErr InitializeFromColorTable( const GDALColorTable * );
00129
00130 void DumpReadable( FILE * = NULL );
00131 };
00132
00133 #endif