GDAL

- Main Page
- Related Pages
- Classes
- Files
- Download
- Issue Tracker

- File List
- File Members

gdal_alg_priv.h
1 /******************************************************************************
2 * $Id$
3 *
4 * Project: GDAL Image Processing Algorithms
5 * Purpose: Prototypes and definitions for various GDAL based algorithms:
6 * private declarations.
7 * Author: Andrey Kiselev, dron@ak4719.spb.edu
8 *
9 ******************************************************************************
10 * Copyright (c) 2008, Andrey Kiselev <dron@ak4719.spb.edu>
11 * Copyright (c) 2010-2013, Even Rouault <even dot rouault at mines-paris dot org>
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be included
21 * in all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 * DEALINGS IN THE SOFTWARE.
30 ****************************************************************************/
31
32 #ifndef GDAL_ALG_PRIV_H_INCLUDED
33 #define GDAL_ALG_PRIV_H_INCLUDED
34
35 #ifndef DOXYGEN_SKIP
36
37 #include "gdal_alg.h"
38
39 CPL_C_START
40
42 typedef enum { GBV_UserBurnValue = 0, GBV_Z = 1, GBV_M = 2
46 } GDALBurnValueSrc;
47
48 typedef enum {
49 GRMA_Replace = 0,
50 GRMA_Add = 1,
51 } GDALRasterMergeAlg;
52
53 typedef struct {
54 unsigned char * pabyChunkBuf;
55 int nXSize;
56 int nYSize;
57 int nBands;
58 GDALDataType eType;
59 double *padfBurnValue;
60 GDALBurnValueSrc eBurnValueSource;
61 GDALRasterMergeAlg eMergeAlg;
62 } GDALRasterizeInfo;
63
64 typedef enum {
65 GRO_Raster = 0,
66 GRO_Vector = 1,
67 GRO_Auto = 2,
68 } GDALRasterizeOptim;
69
70
71 /************************************************************************/
72 /* Low level rasterizer API. */
73 /************************************************************************/
74
75 typedef void (*llScanlineFunc)( void *, int, int, int, double );
76 typedef void (*llPointFunc)( void *, int, int, double );
77
78 void GDALdllImagePoint( int nRasterXSize, int nRasterYSize,
79 int nPartCount, int *panPartSize,
80 double *padfX, double *padfY, double *padfVariant,
81 llPointFunc pfnPointFunc, void *pCBData );
82
83 void GDALdllImageLine( int nRasterXSize, int nRasterYSize,
84 int nPartCount, int *panPartSize,
85 double *padfX, double *padfY, double *padfVariant,
86 llPointFunc pfnPointFunc, void *pCBData );
87
88 void GDALdllImageLineAllTouched( int nRasterXSize, int nRasterYSize,
89 int nPartCount, int *panPartSize,
90 double *padfX, double *padfY,
91 double *padfVariant,
92 llPointFunc pfnPointFunc, void *pCBData );
93
94 void GDALdllImageFilledPolygon( int nRasterXSize, int nRasterYSize,
95 int nPartCount, int *panPartSize,
96 double *padfX, double *padfY,
97 double *padfVariant,
98 llScanlineFunc pfnScanlineFunc, void *pCBData );
99
100 CPL_C_END
101
102 /************************************************************************/
103 /* Polygon Enumerator */
104 /************************************************************************/
105
106 #define GP_NODATA_MARKER -51502112
107
108 template<class DataType, class EqualityTest> class GDALRasterPolygonEnumeratorT
109
110 {
111 private:
112 void MergePolygon( int nSrcId, int nDstId );
113 int NewPolygon( DataType nValue );
114
115 public: // these are intended to be readonly.
116
117 GInt32 *panPolyIdMap;
118 DataType *panPolyValue;
119
120 int nNextPolygonId;
121 int nPolyAlloc;
122
123 int nConnectedness;
124
125 public:
126 explicit GDALRasterPolygonEnumeratorT( int nConnectedness=4 );
127 ~GDALRasterPolygonEnumeratorT();
128
129 void ProcessLine( DataType *panLastLineVal, DataType *panThisLineVal,
130 GInt32 *panLastLineId, GInt32 *panThisLineId,
131 int nXSize );
132
133 void CompleteMerges();
134
135 void Clear();
136 };
137
138 struct IntEqualityTest
139 {
140 bool operator()(GInt32 a, GInt32 b) const { return a == b; }
141 };
142
143 typedef GDALRasterPolygonEnumeratorT<GInt32, IntEqualityTest> GDALRasterPolygonEnumerator;
144
145 typedef void* (*GDALTransformDeserializeFunc)( CPLXMLNode *psTree );
146
147 void CPL_DLL *GDALRegisterTransformDeserializer(const char* pszTransformName,
148 GDALTransformerFunc pfnTransformerFunc,
149 GDALTransformDeserializeFunc pfnDeserializeFunc);
150 void CPL_DLL GDALUnregisterTransformDeserializer(void* pData);
151
152 void GDALCleanupTransformDeserializerMutex();
153
154 /* Transformer cloning */
155
156 void* GDALCreateTPSTransformerInt( int nGCPCount, const GDAL_GCP *pasGCPList,
157 int bReversed, char** papszOptions );
158
159 void CPL_DLL * GDALCloneTransformer( void *pTransformerArg );
160
161 /************************************************************************/
162 /* Color table related */
163 /************************************************************************/
164
165 // Definitions exists for T = GUInt32 and T = GUIntBig.
166 template<class T> int
167 GDALComputeMedianCutPCTInternal( GDALRasterBandH hRed,
168 GDALRasterBandH hGreen,
169 GDALRasterBandH hBlue,
170 GByte* pabyRedBand,
171 GByte* pabyGreenBand,
172 GByte* pabyBlueBand,
173 int (*pfnIncludePixel)(int,int,void*),
174 int nColors,
175 int nBits,
176 T* panHistogram,
177 GDALColorTableH hColorTable,
178 GDALProgressFunc pfnProgress,
179 void * pProgressArg );
180
181 int GDALDitherRGB2PCTInternal( GDALRasterBandH hRed,
182 GDALRasterBandH hGreen,
183 GDALRasterBandH hBlue,
184 GDALRasterBandH hTarget,
185 GDALColorTableH hColorTable,
186 int nBits,
187 GInt16* pasDynamicColorMap,
188 int bDither,
189 GDALProgressFunc pfnProgress,
190 void * pProgressArg );
191
192 #define PRIME_FOR_65536 98317
193
194 // See HashHistogram structure in gdalmediancut.cpp and ColorIndex structure in
195 // gdaldither.cpp 6 * sizeof(int) should be the size of the largest of both
196 // structures.
197 #define MEDIAN_CUT_AND_DITHER_BUFFER_SIZE_65536 (6 * sizeof(int) * PRIME_FOR_65536)
198
199 /************************************************************************/
200 /* Float comparison function. */
201 /************************************************************************/
202
209 #define MAX_ULPS 10
210
211 GBool GDALFloatEquals(float A, float B);
212
213 struct FloatEqualityTest
214 {
215 bool operator()(float a, float b) { return GDALFloatEquals(a,b) == TRUE; }
216 };
217
218 #endif /* #ifndef DOXYGEN_SKIP */
219
220 #endif /* ndef GDAL_ALG_PRIV_H_INCLUDED */
GDALDataType
GDALDataType
Definition: gdal.h:60
CPLXMLNode
Document node structure.
Definition: cpl_minixml.h:66
CPL_C_START
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:341
GBool
int GBool
Type for boolean values (alias to int)
Definition: cpl_port.h:221
GInt32
int GInt32
Int32 type.
Definition: cpl_port.h:203
GInt16
short GInt16
Int16 type.
Definition: cpl_port.h:209
GByte
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:213
GDALRasterBandH
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:258
GDALTransformerFunc
int(* GDALTransformerFunc)(void *pTransformerArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
Definition: gdal_alg.h:114
gdal_alg.h
Public (C callable) GDAL algorithm entry points, and definitions.
CPL_C_END
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:343
GDALColorTableH
void * GDALColorTableH
Opaque type used for the C bindings of the C++ GDALColorTable class.
Definition: gdal.h:264
GDAL_GCP
Ground Control Point.
Definition: gdal.h:560

Generated for GDAL by 1.8.8.