root/tags/gdal_1_3_2/gcore/gdal_rat.h

Revision 8478, 4.8 kB (checked in by fwarmerdam, 3 years ago)

added RAT documentation

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /******************************************************************************
2  * $Id$
3  *
4  * Project:  GDAL Core
5  * Purpose:  GDALRasterAttributeTable class declarations.
6  * Author:   Frank Warmerdam, warmerdam@pobox.com
7  *
8  ******************************************************************************
9  * Copyright (c) 2005, Frank Warmerdam <warmerdam@pobox.com>
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included
19  * in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  ******************************************************************************
29  *
30  * $Log$
31  * Revision 1.2  2005/09/28 21:29:30  fwarmerdam
32  * added RAT documentation
33  *
34  */
35
36 #ifndef GDAL_RAT_H_INCLUDED
37 #define GDAL_RAT_H_INCLUDED
38
39 #include "cpl_minixml.h"
40
41 /************************************************************************/
42 /*                       GDALRasterAttributeField                       */
43 /*                                                                      */
44 /*      (private)                                                       */
45 /************************************************************************/
46
47 class GDALRasterAttributeField
48 {
49 public:
50     CPLString         sName;
51
52     GDALRATFieldType  eType;
53
54     GDALRATFieldUsage eUsage;
55
56     std::vector<GInt32> anValues;
57     std::vector<double> adfValues;
58     std::vector<CPLString> aosValues;
59 };
60
61 /************************************************************************/
62 /*                       GDALRasterAttributeTable                       */
63 /************************************************************************/
64
65 //! Raster Attribute Table container.
66
67 class CPL_DLL GDALRasterAttributeTable
68 {
69     friend const char * CPL_STDCALL GDALRATGetNameOfCol( GDALRasterAttributeTableH, int );
70     friend const char * CPL_STDCALL GDALRATGetValueAsString( GDALRasterAttributeTableH, int, int );
71
72 private:
73     std::vector<GDALRasterAttributeField> aoFields;
74
75     int bLinearBinning;
76     double dfRow0Min;
77     double dfBinSize;
78
79     int   nMinCol;
80     int   nMaxCol;
81
82     int   nRowCount;
83
84     CPLString     osWorkingResult;
85
86 public:
87     GDALRasterAttributeTable();
88     GDALRasterAttributeTable(const GDALRasterAttributeTable&);
89     ~GDALRasterAttributeTable();
90
91     GDALRasterAttributeTable *Clone() const;
92    
93     int           GetColumnCount() const;
94
95     CPLString     GetNameOfCol( int ) const;
96     GDALRATFieldUsage GetUsageOfCol( int ) const;
97     GDALRATFieldType GetTypeOfCol( int ) const;
98    
99     int           GetColOfUsage( GDALRATFieldUsage ) const;
100
101     int           GetRowCount() const;
102
103     CPLString     GetValueAsString( int iRow, int iField ) const;
104     int           GetValueAsInt( int iRow, int iField ) const;
105     double        GetValueAsDouble( int iRow, int iField ) const;
106
107     void          SetValue( int iRow, int iField, const char *pszValue );
108     void          SetValue( int iRow, int iField, double dfValue);
109     void          SetValue( int iRow, int iField, int nValue );
110     void          SetRowCount( int iCount );
111
112     int           GetRowOfValue( double dfValue ) const;
113     int           GetRowOfValue( int nValue ) const;
114     int           GetColorOfValue( double dfValue, GDALColorEntry *psEntry ) const;
115
116     double        GetRowMin( int iRow ) const;
117     double        GetRowMax( int iRow ) const;
118
119     CPLErr        CreateColumn( CPLString osFieldName,
120                                 GDALRATFieldType eFieldType,
121                                 GDALRATFieldUsage eFieldUsage );
122     CPLErr        SetLinearBinning( double dfRow0Min, double dfBinSize );
123     int           GetLinearBinning( double *pdfRow0Min, double *pdfBinSize ) const;
124
125     CPLXMLNode   *Serialize() const;
126     CPLErr        XMLInit( CPLXMLNode *, const char * );
127
128     CPLErr        InitializeFromColorTable( const GDALColorTable * );
129    
130     void          DumpReadable( FILE * = NULL );
131 };
132
133 #endif /* ndef GDAL_RAT_H_INCLUDED */
Note: See TracBrowser for help on using the browser.