![]() |
TerraLib 4.1
|
00001 /************************************************************************************ 00002 TerraLib - a library for developing GIS applications. 00003 Copyright © 2001-2007 INPE and Tecgraf/PUC-Rio. 00004 00005 This code is part of the TerraLib library. 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Lesser General Public 00008 License as published by the Free Software Foundation; either 00009 version 2.1 of the License, or (at your option) any later version. 00010 00011 You should have received a copy of the GNU Lesser General Public 00012 License along with this library. 00013 00014 The authors reassure the license terms regarding the warranties. 00015 They specifically disclaim any warranties, including, but not limited to, 00016 the implied warranties of merchantability and fitness for a particular purpose. 00017 The library provided hereunder is on an "as is" basis, and the authors have no 00018 obligation to provide maintenance, support, updates, enhancements, or modifications. 00019 In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct, 00020 indirect, special, incidental, or consequential damages arising out of the use 00021 of this library and its documentation. 00022 *************************************************************************************/ 00026 #ifndef __TERRALIB_INTERNAL_RASTERREMAP_H 00027 #define __TERRALIB_INTERNAL_RASTERREMAP_H 00028 00029 #include "TeRaster.h" 00030 #include "TeGeometry.h" 00031 #include "TeRasterTransform.h" 00032 00034 00045 class TL_DLL TeRasterRemap 00046 { 00047 protected: 00048 TeRaster* rasterIn_; 00049 TeRaster* rasterOut_; 00050 00051 TeRasterTransform* transformer_; 00052 00053 int interpolation_; 00054 bool showProgress_; 00055 bool useOptimizedReprojection_; 00056 00057 00058 TeBox ROI_; // region of interest (from input) where the remmaping should be done 00059 00060 bool TeOptimizedInterpolateIn ( const TeBox &box ); 00061 bool TeInterpolateIn ( const TeBox &box ); 00062 00063 bool remap (); 00064 bool copy (); 00065 bool resample (); 00066 00067 public: 00068 00070 /* 00071 \param rasterIn pointer to the input raster 00072 \param rasterOut pointer to the output raster 00073 \para showProgress flag to indicate that a progress status hould be reported 00074 */ 00075 TeRasterRemap (TeRaster* rasterIn=0, TeRaster* rasterOut=0, 00076 bool showProgress = false); 00077 00079 void setInput(TeRaster* rasterIn) 00080 { 00081 rasterIn_ = rasterIn; 00082 if (transformer_) 00083 transformer_->setRasterIn(rasterIn_); 00084 } 00085 00087 void setOutput(TeRaster* rasterOut) 00088 { 00089 rasterOut_ = rasterOut; 00090 if (transformer_) 00091 transformer_->setRasterOut(rasterOut_); 00092 } 00093 00095 void setInterpolation(int interpolation) 00096 { interpolation_ = interpolation; } 00097 00099 void setTransformer(TeRasterTransform* transf) 00100 { 00101 if (transf) 00102 { 00103 transformer_ = transf; 00104 transformer_->setRasterOut(rasterOut_); 00105 transformer_->setRasterIn(rasterIn_); 00106 } 00107 } 00108 00110 TeRasterTransform* transformer() 00111 { return transformer_; } 00112 00114 bool apply(bool showProgress = false); 00115 00117 /* 00118 \par roi a box that represents the region of interest. It should 00119 be inside the raster in bounding box; 00120 \return false if the roi in invalid or it is not within the input 00121 raster. True otherwise 00122 */ 00123 bool setROI(TeBox& roi); 00124 00126 /* 00127 \param enabled Enabled/disabled flag (default:enabled). 00128 */ 00129 void setOptmizedReprojection( bool enabled ) 00130 { 00131 useOptimizedReprojection_ = enabled; 00132 }; 00133 }; 00134 00135 #endif 00136