00001 /****************************************************************************** 00002 * $Id: gdal_alg_priv.h 15701 2008-11-10 15:40:02Z warmerdam $ 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 00038 /************************************************************************/ 00039 /* Low level rasterizer API. */ 00040 /************************************************************************/ 00041 00042 typedef void (*llScanlineFunc)( void *, int, int, int ); 00043 typedef void (*llPointFunc)( void *, int, int ); 00044 00045 void GDALdllImagePoint( int, int, int, int *, double *, double *, 00046 llPointFunc, void * ); 00047 00048 void GDALdllImageLine( int nRasterXSize, int nRasterYSize, 00049 int nPartCount, int *panPartSize, 00050 double *padfX, double *padfY, 00051 llPointFunc pfnPointFunc, void *pCBData ); 00052 00053 void GDALdllImageFilledPolygon( int, int, int, int *, double *, double *, 00054 llScanlineFunc, void * ); 00055 00056 CPL_C_END 00057 00058 /************************************************************************/ 00059 /* Polygon Enumerator */ 00060 /************************************************************************/ 00061 00062 class GDALRasterPolygonEnumerator 00063 00064 { 00065 private: 00066 void MergePolygon( int nSrcId, int nDstId ); 00067 int NewPolygon( GInt32 nValue ); 00068 00069 public: // these are intended to be readonly. 00070 00071 GInt32 *panPolyIdMap; 00072 GInt32 *panPolyValue; 00073 00074 int nNextPolygonId; 00075 int nPolyAlloc; 00076 00077 int nConnectedness; 00078 00079 public: 00080 GDALRasterPolygonEnumerator( int nConnectedness=4 ); 00081 ~GDALRasterPolygonEnumerator(); 00082 00083 void ProcessLine( GInt32 *panLastLineVal, GInt32 *panThisLineVal, 00084 GInt32 *panLastLineId, GInt32 *panThisLineId, 00085 int nXSize ); 00086 00087 void CompleteMerges(); 00088 00089 void Clear(); 00090 }; 00091 00092 #endif /* ndef GDAL_ALG_PRIV_H_INCLUDED */