GDAL
gdal_alg_priv.h
1/******************************************************************************
2 * $Id: gdal_alg_priv.h e40d0a17ddb8ca683d53dd68777a74094f8f1bde 2019-03-12 13:31:28 +0100 Even Rouault $
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#include "ogr_spatialref.h"
39
41
43typedef enum { GBV_UserBurnValue = 0, GBV_Z = 1, GBV_M = 2
47} GDALBurnValueSrc;
48
49typedef enum {
50 GRMA_Replace = 0,
51 GRMA_Add = 1,
52} GDALRasterMergeAlg;
53
54typedef struct {
55 unsigned char * pabyChunkBuf;
56 int nXSize;
57 int nYSize;
58 int nBands;
59 GDALDataType eType;
60 int nPixelSpace;
61 GSpacing nLineSpace;
62 GSpacing nBandSpace;
63 double *padfBurnValue;
64 GDALBurnValueSrc eBurnValueSource;
65 GDALRasterMergeAlg eMergeAlg;
66} GDALRasterizeInfo;
67
68typedef enum {
69 GRO_Raster = 0,
70 GRO_Vector = 1,
71 GRO_Auto = 2,
72} GDALRasterizeOptim;
73
74
75/************************************************************************/
76/* Low level rasterizer API. */
77/************************************************************************/
78
79typedef void (*llScanlineFunc)( void *, int, int, int, double );
80typedef void (*llPointFunc)( void *, int, int, double );
81
82void GDALdllImagePoint( int nRasterXSize, int nRasterYSize,
83 int nPartCount, int *panPartSize,
84 double *padfX, double *padfY, double *padfVariant,
85 llPointFunc pfnPointFunc, void *pCBData );
86
87void GDALdllImageLine( int nRasterXSize, int nRasterYSize,
88 int nPartCount, int *panPartSize,
89 double *padfX, double *padfY, double *padfVariant,
90 llPointFunc pfnPointFunc, void *pCBData );
91
92void GDALdllImageLineAllTouched( int nRasterXSize, int nRasterYSize,
93 int nPartCount, int *panPartSize,
94 double *padfX, double *padfY,
95 double *padfVariant,
96 llPointFunc pfnPointFunc, void *pCBData,
97 int bAvoidBurningSamePoints );
98
99void GDALdllImageFilledPolygon( int nRasterXSize, int nRasterYSize,
100 int nPartCount, int *panPartSize,
101 double *padfX, double *padfY,
102 double *padfVariant,
103 llScanlineFunc pfnScanlineFunc, void *pCBData );
104
106
107/************************************************************************/
108/* Polygon Enumerator */
109/************************************************************************/
110
111#define GP_NODATA_MARKER -51502112
112
113template<class DataType, class EqualityTest> class GDALRasterPolygonEnumeratorT
114
115{
116private:
117 void MergePolygon( int nSrcId, int nDstId );
118 int NewPolygon( DataType nValue );
119
120 CPL_DISALLOW_COPY_ASSIGN(GDALRasterPolygonEnumeratorT)
121
122public: // these are intended to be readonly.
123
124 GInt32 *panPolyIdMap = nullptr;
125 DataType *panPolyValue = nullptr;
126
127 int nNextPolygonId = 0;
128 int nPolyAlloc = 0;
129
130 int nConnectedness = 0;
131
132public:
133 explicit GDALRasterPolygonEnumeratorT( int nConnectedness=4 );
134 ~GDALRasterPolygonEnumeratorT();
135
136 void ProcessLine( DataType *panLastLineVal, DataType *panThisLineVal,
137 GInt32 *panLastLineId, GInt32 *panThisLineId,
138 int nXSize );
139
140 void CompleteMerges();
141
142 void Clear();
143};
144
145struct IntEqualityTest
146{
147 bool operator()(GInt32 a, GInt32 b) const { return a == b; }
148};
149
150typedef GDALRasterPolygonEnumeratorT<GInt32, IntEqualityTest> GDALRasterPolygonEnumerator;
151
152typedef void* (*GDALTransformDeserializeFunc)( CPLXMLNode *psTree );
153
154void CPL_DLL *GDALRegisterTransformDeserializer(const char* pszTransformName,
155 GDALTransformerFunc pfnTransformerFunc,
156 GDALTransformDeserializeFunc pfnDeserializeFunc);
157void CPL_DLL GDALUnregisterTransformDeserializer(void* pData);
158
159void GDALCleanupTransformDeserializerMutex();
160
161/* Transformer cloning */
162
163void* GDALCreateTPSTransformerInt( int nGCPCount, const GDAL_GCP *pasGCPList,
164 int bReversed, char** papszOptions );
165
166void CPL_DLL * GDALCloneTransformer( void *pTransformerArg );
167
168/************************************************************************/
169/* Color table related */
170/************************************************************************/
171
172// Definitions exists for T = GUInt32 and T = GUIntBig.
173template<class T> int
174GDALComputeMedianCutPCTInternal( GDALRasterBandH hRed,
175 GDALRasterBandH hGreen,
176 GDALRasterBandH hBlue,
177 GByte* pabyRedBand,
178 GByte* pabyGreenBand,
179 GByte* pabyBlueBand,
180 int (*pfnIncludePixel)(int,int,void*),
181 int nColors,
182 int nBits,
183 T* panHistogram,
184 GDALColorTableH hColorTable,
185 GDALProgressFunc pfnProgress,
186 void * pProgressArg );
187
188int GDALDitherRGB2PCTInternal( GDALRasterBandH hRed,
189 GDALRasterBandH hGreen,
190 GDALRasterBandH hBlue,
191 GDALRasterBandH hTarget,
192 GDALColorTableH hColorTable,
193 int nBits,
194 GInt16* pasDynamicColorMap,
195 int bDither,
196 GDALProgressFunc pfnProgress,
197 void * pProgressArg );
198
199#define PRIME_FOR_65536 98317
200
201// See HashHistogram structure in gdalmediancut.cpp and ColorIndex structure in
202// gdaldither.cpp 6 * sizeof(int) should be the size of the largest of both
203// structures.
204#define MEDIAN_CUT_AND_DITHER_BUFFER_SIZE_65536 (6 * sizeof(int) * PRIME_FOR_65536)
205
206/************************************************************************/
207/* Float comparison function. */
208/************************************************************************/
209
216#define MAX_ULPS 10
217
218GBool GDALFloatEquals(float A, float B);
219
220struct FloatEqualityTest
221{
222 bool operator()(float a, float b) { return GDALFloatEquals(a,b) == TRUE; }
223};
224
225bool GDALComputeAreaOfInterest(OGRSpatialReference* poSRS,
226 double adfGT[6],
227 int nXSize,
228 int nYSize,
229 double& dfWestLongitudeDeg,
230 double& dfSouthLatitudeDeg,
231 double& dfEastLongitudeDeg,
232 double& dfNorthLatitudeDeg );
233
234bool GDALComputeAreaOfInterest(OGRSpatialReference* poSRS,
235 double dfX1,
236 double dfY1,
237 double dfX2,
238 double dfY2,
239 double& dfWestLongitudeDeg,
240 double& dfSouthLatitudeDeg,
241 double& dfEastLongitudeDeg,
242 double& dfNorthLatitudeDeg );
243
244
245#endif /* #ifndef DOXYGEN_SKIP */
246
247#endif /* ndef GDAL_ALG_PRIV_H_INCLUDED */
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:157
short GInt16
Int16 type.
Definition: cpl_port.h:211
#define CPL_C_END
Macro to end a block of C symbols.
Definition: cpl_port.h:339
#define CPL_C_START
Macro to start a block of C symbols.
Definition: cpl_port.h:337
int GBool
Type for boolean values (alias to int)
Definition: cpl_port.h:223
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:997
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:215
int GInt32
Int32 type.
Definition: cpl_port.h:205
GIntBig GSpacing
Type to express pixel, line or band spacing.
Definition: gdal.h:273
GDALDataType
Definition: gdal.h:60
void * GDALRasterBandH
Opaque type used for the C bindings of the C++ GDALRasterBand class.
Definition: gdal.h:258
void * GDALColorTableH
Opaque type used for the C bindings of the C++ GDALColorTable class.
Definition: gdal.h:264
Public (C callable) GDAL algorithm entry points, and definitions.
int(* GDALTransformerFunc)(void *pTransformerArg, int bDstToSrc, int nPointCount, double *x, double *y, double *z, int *panSuccess)
Definition: gdal_alg.h:114
Coordinate systems services.
Document node structure.
Definition: cpl_minixml.h:67
Ground Control Point.
Definition: gdal.h:564

Generated for GDAL by doxygen 1.9.4.