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 *************************************************************************************/ 00023 /*! \file TeDecoderSPR.h 00024 \brief This file deals with decoding of raster data in a ASCII SPRING format 00025 */ 00026 #ifndef __TERRALIB_INTERNAL_DECODERSPR_H 00027 #define __TERRALIB_INTERNAL_DECODERSPR_H 00028 00029 #include "TeDecoderSmartMem.h" 00030 00031 class TeAsciiFile; 00032 00033 //! Implements a decoder for raster data in ASCII-SPRING format 00034 /*! The description of this format can be found at SPRING website <http://www.dpi.inpe.br/spring>.\par 00035 The default file extension associated to this format is ".spr". 00036 */ 00037 class TL_DLL TeDecoderSPR : public TeDecoderSmartMem 00038 { 00039 public: 00040 //! Empty constructor 00041 TeDecoderSPR(); 00042 00043 //! Constructor from some parameters 00044 TeDecoderSPR(const TeRasterParams& par); 00045 00046 //! Destructor 00047 ~TeDecoderSPR(); 00048 00049 //! Intializes the internal structures 00050 void init(); 00051 00052 //! Releases the internal structures 00053 bool clear(); 00054 00055 //! Writes an element 00056 bool setElement (int col,int lin, double val, int band=0); 00057 00058 private: 00059 00060 bool isModified_; 00061 00062 bool readFile(const string& filename); 00063 bool readParameters(); 00064 bool writeParameters(TeAsciiFile& pFile); 00065 bool saveData(TeAsciiFile& pFile); 00066 }; 00067 00068 //! Implements a factory to build decoders to ASCII-SPRING raster 00069 class TL_DLL TeDecoderSPRFactory : public TeDecoderFactory 00070 { 00071 public: 00072 //! Factory constructor 00073 TeDecoderSPRFactory(const string& name); 00074 00075 //! Builds the object 00076 TeDecoder* build (const TeRasterParams& arg) 00077 { return new TeDecoderSPR(arg); } 00078 }; 00079 00080 #endif
1.5.3