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 #ifndef GDAL_ALG_PRIV_H_INCLUDED
00033 #define GDAL_ALG_PRIV_H_INCLUDED
00034
00035 #include "gdal_alg.h"
00036
00037 CPL_C_START
00038
00040 typedef enum { GBV_UserBurnValue = 0, GBV_Z = 1, GBV_M = 2
00044 } GDALBurnValueSrc;
00045
00046 typedef enum {
00047 GRMA_Replace = 0,
00048 GRMA_Add = 1,
00049 } GDALRasterMergeAlg;
00050
00051 typedef struct {
00052 unsigned char * pabyChunkBuf;
00053 int nXSize;
00054 int nYSize;
00055 int nBands;
00056 GDALDataType eType;
00057 double *padfBurnValue;
00058 GDALBurnValueSrc eBurnValueSource;
00059 GDALRasterMergeAlg eMergeAlg;
00060 } GDALRasterizeInfo;
00061
00062
00063
00064
00065
00066 typedef void (*llScanlineFunc)( void *, int, int, int, double );
00067 typedef void (*llPointFunc)( void *, int, int, double );
00068
00069 void GDALdllImagePoint( int nRasterXSize, int nRasterYSize,
00070 int nPartCount, int *panPartSize,
00071 double *padfX, double *padfY, double *padfVariant,
00072 llPointFunc pfnPointFunc, void *pCBData );
00073
00074 void GDALdllImageLine( int nRasterXSize, int nRasterYSize,
00075 int nPartCount, int *panPartSize,
00076 double *padfX, double *padfY, double *padfVariant,
00077 llPointFunc pfnPointFunc, void *pCBData );
00078
00079 void GDALdllImageLineAllTouched(int nRasterXSize, int nRasterYSize,
00080 int nPartCount, int *panPartSize,
00081 double *padfX, double *padfY,
00082 double *padfVariant,
00083 llPointFunc pfnPointFunc, void *pCBData );
00084
00085 void GDALdllImageFilledPolygon(int nRasterXSize, int nRasterYSize,
00086 int nPartCount, int *panPartSize,
00087 double *padfX, double *padfY,
00088 double *padfVariant,
00089 llScanlineFunc pfnScanlineFunc, void *pCBData );
00090
00091 CPL_C_END
00092
00093
00094
00095
00096
00097 #define GP_NODATA_MARKER -51502112
00098
00099 class GDALRasterPolygonEnumerator
00100
00101 {
00102 private:
00103 void MergePolygon( int nSrcId, int nDstId );
00104 int NewPolygon( GInt32 nValue );
00105
00106 public:
00107
00108 GInt32 *panPolyIdMap;
00109 GInt32 *panPolyValue;
00110
00111 int nNextPolygonId;
00112 int nPolyAlloc;
00113
00114 int nConnectedness;
00115
00116 public:
00117 GDALRasterPolygonEnumerator( int nConnectedness=4 );
00118 ~GDALRasterPolygonEnumerator();
00119
00120 void ProcessLine( GInt32 *panLastLineVal, GInt32 *panThisLineVal,
00121 GInt32 *panLastLineId, GInt32 *panThisLineId,
00122 int nXSize );
00123
00124 void CompleteMerges();
00125
00126 void Clear();
00127 };
00128
00129 #ifdef OGR_ENABLED
00130
00131
00132
00133
00134
00135 class GDALRasterFPolygonEnumerator
00136
00137 {
00138 private:
00139 void MergePolygon( int nSrcId, int nDstId );
00140 int NewPolygon( float fValue );
00141
00142 public:
00143
00144 GInt32 *panPolyIdMap;
00145 float *pafPolyValue;
00146
00147 int nNextPolygonId;
00148 int nPolyAlloc;
00149
00150 int nConnectedness;
00151
00152 public:
00153 GDALRasterFPolygonEnumerator( int nConnectedness=4 );
00154 ~GDALRasterFPolygonEnumerator();
00155
00156 void ProcessLine( float *pafLastLineVal, float *pafThisLineVal,
00157 GInt32 *panLastLineId, GInt32 *panThisLineId,
00158 int nXSize );
00159
00160 void CompleteMerges();
00161
00162 void Clear();
00163 };
00164 #endif
00165
00166 typedef void* (*GDALTransformDeserializeFunc)( CPLXMLNode *psTree );
00167
00168 void* GDALRegisterTransformDeserializer(const char* pszTransformName,
00169 GDALTransformerFunc pfnTransformerFunc,
00170 GDALTransformDeserializeFunc pfnDeserializeFunc);
00171 void GDALUnregisterTransformDeserializer(void* pData);
00172
00173 void GDALCleanupTransformDeserializerMutex();
00174
00175
00176
00177 void* GDALCreateTPSTransformerInt( int nGCPCount, const GDAL_GCP *pasGCPList,
00178 int bReversed, char** papszOptions );
00179
00180 void CPL_DLL * GDALCloneTransformer( void *pTranformerArg );
00181
00182
00183
00184
00185
00186 int
00187 GDALComputeMedianCutPCTInternal( GDALRasterBandH hRed,
00188 GDALRasterBandH hGreen,
00189 GDALRasterBandH hBlue,
00190 GByte* pabyRedBand,
00191 GByte* pabyGreenBand,
00192 GByte* pabyBlueBand,
00193 int (*pfnIncludePixel)(int,int,void*),
00194 int nColors,
00195 int nBits,
00196 int* panHistogram,
00197 GDALColorTableH hColorTable,
00198 GDALProgressFunc pfnProgress,
00199 void * pProgressArg );
00200
00201 int GDALDitherRGB2PCTInternal( GDALRasterBandH hRed,
00202 GDALRasterBandH hGreen,
00203 GDALRasterBandH hBlue,
00204 GDALRasterBandH hTarget,
00205 GDALColorTableH hColorTable,
00206 int nBits,
00207 GInt16* pasDynamicColorMap,
00208 int bDither,
00209 GDALProgressFunc pfnProgress,
00210 void * pProgressArg );
00211
00212 #define PRIME_FOR_65536 98317
00213 #define MEDIAN_CUT_AND_DITHER_BUFFER_SIZE_65536 (6 * sizeof(int) * PRIME_FOR_65536)
00214
00215
00216
00217
00218
00225 #define MAX_ULPS 10
00226
00227 GBool GDALFloatEquals(float A, float B);
00228
00229 #endif