GDAL
|
00001 /****************************************************************************** 00002 * $Id: gdal_alg_priv.h 25627 2013-02-10 10:17:19Z rouault $ 00003 * 00004 * Project: GDAL Image Processing Algorithms 00005 * Purpose: Prototypes and definitions for various GDAL based algorithms: 00006 * private declarations. 00007 * Author: Andrey Kiselev, dron@ak4719.spb.edu 00008 * 00009 ****************************************************************************** 00010 * Copyright (c) 2008, Andrey Kiselev <dron@ak4719.spb.edu> 00011 * 00012 * Permission is hereby granted, free of charge, to any person obtaining a 00013 * copy of this software and associated documentation files (the "Software"), 00014 * to deal in the Software without restriction, including without limitation 00015 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00016 * and/or sell copies of the Software, and to permit persons to whom the 00017 * Software is furnished to do so, subject to the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be included 00020 * in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00023 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00024 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00025 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00026 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00027 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00028 * DEALINGS IN THE SOFTWARE. 00029 ****************************************************************************/ 00030 00031 #ifndef GDAL_ALG_PRIV_H_INCLUDED 00032 #define GDAL_ALG_PRIV_H_INCLUDED 00033 00034 #include "gdal_alg.h" 00035 00036 CPL_C_START 00037 00039 typedef enum { GBV_UserBurnValue = 0, GBV_Z = 1, GBV_M = 2 00043 } GDALBurnValueSrc; 00044 00045 typedef struct { 00046 unsigned char * pabyChunkBuf; 00047 int nXSize; 00048 int nYSize; 00049 int nBands; 00050 GDALDataType eType; 00051 double *padfBurnValue; 00052 GDALBurnValueSrc eBurnValueSource; 00053 } GDALRasterizeInfo; 00054 00055 /************************************************************************/ 00056 /* Low level rasterizer API. */ 00057 /************************************************************************/ 00058 00059 typedef void (*llScanlineFunc)( void *, int, int, int, double ); 00060 typedef void (*llPointFunc)( void *, int, int, double ); 00061 00062 void GDALdllImagePoint( int nRasterXSize, int nRasterYSize, 00063 int nPartCount, int *panPartSize, 00064 double *padfX, double *padfY, double *padfVariant, 00065 llPointFunc pfnPointFunc, void *pCBData ); 00066 00067 void GDALdllImageLine( int nRasterXSize, int nRasterYSize, 00068 int nPartCount, int *panPartSize, 00069 double *padfX, double *padfY, double *padfVariant, 00070 llPointFunc pfnPointFunc, void *pCBData ); 00071 00072 void GDALdllImageLineAllTouched(int nRasterXSize, int nRasterYSize, 00073 int nPartCount, int *panPartSize, 00074 double *padfX, double *padfY, 00075 double *padfVariant, 00076 llPointFunc pfnPointFunc, void *pCBData ); 00077 00078 void GDALdllImageFilledPolygon(int nRasterXSize, int nRasterYSize, 00079 int nPartCount, int *panPartSize, 00080 double *padfX, double *padfY, 00081 double *padfVariant, 00082 llScanlineFunc pfnScanlineFunc, void *pCBData ); 00083 00084 CPL_C_END 00085 00086 /************************************************************************/ 00087 /* Polygon Enumerator */ 00088 /************************************************************************/ 00089 00090 class GDALRasterPolygonEnumerator 00091 00092 { 00093 private: 00094 void MergePolygon( int nSrcId, int nDstId ); 00095 int NewPolygon( GInt32 nValue ); 00096 00097 public: // these are intended to be readonly. 00098 00099 GInt32 *panPolyIdMap; 00100 GInt32 *panPolyValue; 00101 00102 int nNextPolygonId; 00103 int nPolyAlloc; 00104 00105 int nConnectedness; 00106 00107 public: 00108 GDALRasterPolygonEnumerator( int nConnectedness=4 ); 00109 ~GDALRasterPolygonEnumerator(); 00110 00111 void ProcessLine( GInt32 *panLastLineVal, GInt32 *panThisLineVal, 00112 GInt32 *panLastLineId, GInt32 *panThisLineId, 00113 int nXSize ); 00114 00115 void CompleteMerges(); 00116 00117 void Clear(); 00118 }; 00119 00120 #ifdef OGR_ENABLED 00121 /************************************************************************/ 00122 /* Polygon Enumerator */ 00123 /* */ 00124 /* Buffers has float values instead og GInt32 */ 00125 /************************************************************************/ 00126 class GDALRasterFPolygonEnumerator 00127 00128 { 00129 private: 00130 void MergePolygon( int nSrcId, int nDstId ); 00131 int NewPolygon( float fValue ); 00132 00133 public: // these are intended to be readonly. 00134 00135 GInt32 *panPolyIdMap; 00136 float *pafPolyValue; 00137 00138 int nNextPolygonId; 00139 int nPolyAlloc; 00140 00141 int nConnectedness; 00142 00143 public: 00144 GDALRasterFPolygonEnumerator( int nConnectedness=4 ); 00145 ~GDALRasterFPolygonEnumerator(); 00146 00147 void ProcessLine( float *pafLastLineVal, float *pafThisLineVal, 00148 GInt32 *panLastLineId, GInt32 *panThisLineId, 00149 int nXSize ); 00150 00151 void CompleteMerges(); 00152 00153 void Clear(); 00154 }; 00155 #endif 00156 00157 typedef void* (*GDALTransformDeserializeFunc)( CPLXMLNode *psTree ); 00158 00159 void* GDALRegisterTransformDeserializer(const char* pszTransformName, 00160 GDALTransformerFunc pfnTransformerFunc, 00161 GDALTransformDeserializeFunc pfnDeserializeFunc); 00162 void GDALUnregisterTransformDeserializer(void* pData); 00163 00164 void GDALCleanupTransformDeserializerMutex(); 00165 00166 /* Transformer cloning */ 00167 00168 void* GDALCloneTPSTransformer( void *pTransformArg ); 00169 void* GDALCloneGenImgProjTransformer( void *pTransformArg ); 00170 void* GDALCloneApproxTransformer( void *pTransformArg ); 00171 /* TODO : GDALCloneGeoLocTransformer? , GDALCloneRPCTransformer? */ 00172 00173 00174 void CPL_DLL * GDALCloneTransformer( void *pTranformerArg ); 00175 00176 /************************************************************************/ 00177 /* Float comparison function. */ 00178 /************************************************************************/ 00179 00186 #define MAX_ULPS 10 00187 00188 GBool GDALFloatEquals(float A, float B); 00189 00190 #endif /* ndef GDAL_ALG_PRIV_H_INCLUDED */