GDAL

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

gdal_alg_priv.h
1 /******************************************************************************
2 * $Id: gdal_alg_priv.h 33757 2016-03-20 20:22:33Z goatbar $
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 #include "gdal_alg.h"
36
37 CPL_C_START
38
40 typedef enum { GBV_UserBurnValue = 0, GBV_Z = 1, GBV_M = 2
44 } GDALBurnValueSrc;
45
46 typedef enum {
47 GRMA_Replace = 0,
48 GRMA_Add = 1,
49 } GDALRasterMergeAlg;
50
51 typedef struct {
52 unsigned char * pabyChunkBuf;
53 int nXSize;
54 int nYSize;
55 int nBands;
56 GDALDataType eType;
57 double *padfBurnValue;
58 GDALBurnValueSrc eBurnValueSource;
59 GDALRasterMergeAlg eMergeAlg;
60 } GDALRasterizeInfo;
61
62 /************************************************************************/
63 /* Low level rasterizer API. */
64 /************************************************************************/
65
66 typedef void (*llScanlineFunc)( void *, int, int, int, double );
67 typedef void (*llPointFunc)( void *, int, int, double );
68
69 void GDALdllImagePoint( int nRasterXSize, int nRasterYSize,
70 int nPartCount, int *panPartSize,
71 double *padfX, double *padfY, double *padfVariant,
72 llPointFunc pfnPointFunc, void *pCBData );
73
74 void GDALdllImageLine( int nRasterXSize, int nRasterYSize,
75 int nPartCount, int *panPartSize,
76 double *padfX, double *padfY, double *padfVariant,
77 llPointFunc pfnPointFunc, void *pCBData );
78
79 void GDALdllImageLineAllTouched(int nRasterXSize, int nRasterYSize,
80 int nPartCount, int *panPartSize,
81 double *padfX, double *padfY,
82 double *padfVariant,
83 llPointFunc pfnPointFunc, void *pCBData );
84
85 void GDALdllImageFilledPolygon(int nRasterXSize, int nRasterYSize,
86 int nPartCount, int *panPartSize,
87 double *padfX, double *padfY,
88 double *padfVariant,
89 llScanlineFunc pfnScanlineFunc, void *pCBData );
90
91 CPL_C_END
92
93 /************************************************************************/
94 /* Polygon Enumerator */
95 /************************************************************************/
96
97 #define GP_NODATA_MARKER -51502112
98
99 template<class DataType, class EqualityTest> class GDALRasterPolygonEnumeratorT
100
101 {
102 private:
103 void MergePolygon( int nSrcId, int nDstId );
104 int NewPolygon( DataType nValue );
105
106 public: // these are intended to be readonly.
107
108 GInt32 *panPolyIdMap;
109 DataType *panPolyValue;
110
111 int nNextPolygonId;
112 int nPolyAlloc;
113
114 int nConnectedness;
115
116 public:
117 GDALRasterPolygonEnumeratorT( int nConnectedness=4 );
118 ~GDALRasterPolygonEnumeratorT();
119
120 void ProcessLine( DataType *panLastLineVal, DataType *panThisLineVal,
121 GInt32 *panLastLineId, GInt32 *panThisLineId,
122 int nXSize );
123
124 void CompleteMerges();
125
126 void Clear();
127 };
128
129 struct IntEqualityTest
130 {
131 bool operator()(GInt32 a, GInt32 b) { return a == b; }
132 };
133
134 typedef GDALRasterPolygonEnumeratorT<GInt32, IntEqualityTest> GDALRasterPolygonEnumerator;
135
136 typedef void* (*GDALTransformDeserializeFunc)( CPLXMLNode *psTree );
137
138 void* GDALRegisterTransformDeserializer(const char* pszTransformName,
139 GDALTransformerFunc pfnTransformerFunc,
140 GDALTransformDeserializeFunc pfnDeserializeFunc);
141 void GDALUnregisterTransformDeserializer(void* pData);
142
143 void GDALCleanupTransformDeserializerMutex();
144
145 /* Transformer cloning */
146
147 void* GDALCreateTPSTransformerInt( int nGCPCount, const GDAL_GCP *pasGCPList,
148 int bReversed, char** papszOptions );
149
150 void CPL_DLL * GDALCloneTransformer( void *pTransformerArg );
151
152 /************************************************************************/
153 /* Color table related */
154 /************************************************************************/
155
156 /* definitions exists for T = GUInt32 and T = GUIntBig */
157 template<class T> int
158 GDALComputeMedianCutPCTInternal( GDALRasterBandH hRed,
159 GDALRasterBandH hGreen,
160 GDALRasterBandH hBlue,
161 GByte* pabyRedBand,
162 GByte* pabyGreenBand,
163 GByte* pabyBlueBand,
164 int (*pfnIncludePixel)(int,int,void*),
165 int nColors,
166 int nBits,
167 T* panHistogram,
168 GDALColorTableH hColorTable,
169 GDALProgressFunc pfnProgress,
170 void * pProgressArg );
171
172 int GDALDitherRGB2PCTInternal( GDALRasterBandH hRed,
173 GDALRasterBandH hGreen,
174 GDALRasterBandH hBlue,
175 GDALRasterBandH hTarget,
176 GDALColorTableH hColorTable,
177 int nBits,
178 GInt16* pasDynamicColorMap,
179 int bDither,
180 GDALProgressFunc pfnProgress,
181 void * pProgressArg );
182
183 #define PRIME_FOR_65536 98317
184
185 /* See HashHistogram structure in gdalmediancut.cpp and ColorIndex structure in gdaldither.cpp */
186 /* 6 * sizeof(int) should be the size of the largest of both structures */
187 #define MEDIAN_CUT_AND_DITHER_BUFFER_SIZE_65536 (6 * sizeof(int) * PRIME_FOR_65536)
188
189
190 /************************************************************************/
191 /* Float comparison function. */
192 /************************************************************************/
193
200 #define MAX_ULPS 10
201
202 GBool GDALFloatEquals(float A, float B);
203
204 struct FloatEqualityTest
205 {
206 bool operator()(float a, float b) { return GDALFloatEquals(a,b) == TRUE; }
207 };
208
209 #endif /* ndef GDAL_ALG_PRIV_H_INCLUDED */
GDALDataType
GDALDataType
Definition: gdal.h:57
GDALRasterizeInfo
Definition: gdal_alg_priv.h:51
CPLXMLNode
Document node structure.
Definition: cpl_minixml.h:65
IntEqualityTest
Definition: gdal_alg_priv.h:129
GDALRasterBandH
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:233
GDALRasterPolygonEnumeratorT
Definition: gdal_alg_priv.h:99
GDALTransformerFunc
int(* GDALTransformerFunc)(void *pTransformerArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
Definition: gdal_alg.h:114
FloatEqualityTest
Definition: gdal_alg_priv.h:204
gdal_alg.h
Public (C callable) GDAL algorithm entry points, and definitions.
GDALColorTableH
void * GDALColorTableH
Opaque type used for the C bindings of the C++ GDALColorTable class.
Definition: gdal.h:239
GDAL_GCP
Ground Control Point.
Definition: gdal.h:492

Generated for GDAL by 1.8.8.