| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeDecoder.h
Go to the documentation of this file.

    00001 /************************************************************************************
    00002 TerraLib - a library for developing GIS applications.
    00003 Copyright © 2001-2005 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_DECODER_H
    00027 #define  __TERRALIB_INTERNAL_DECODER_H
    00028
    00029 #include "TeDefines.h"
    00030 #include "TeFactory.h"
    00031 #include "TeCoord2D.h"
    00032 #include "TeRasterParams.h"
    00033
    00034 using namespace std;
    00035 #include <string>
    00036 #include <list>
    00037 #include <map>
    00038
    00039 class TeRaster;
    00040 class TeDecoderMemory;
    00041 class TeProjection;
    00042 struct TeBox;
    00043
    00045 /*
    00046            A decoder keeps its own copy of the  parameters associated
    00047            to the raster being decoded.
    00048 */
    00049 class TL_DLL TeDecoder {
    00050
    00051 public:
    00053            TeDecoder();
    00054
    00056
    00059            TeDecoder(const TeRasterParams& par);
    00060
    00062            virtual ~TeDecoder();
    00063
    00065            TeRasterParams& params();
    00066
    00068            void updateParams(TeRasterParams& par);
    00069
    00071
    00077            virtual bool setElement(int col, int lin, double val, int band=0 ) = 0;
    00078
    00080            /*
    00081                       This method should be used only to set the values of images with 3 bands associated
    00082                       to the three colour channes: RGB
    00083                       \param col column of the image
    00084                       \param lin line of the image
    00085                       \param Rval the value associated to the band 0 (associated to the R colour Channel)
    00086                       \param Gval the value associated to the band 1 (associated to the G colour Channel)
    00087                       \param Bval the value associated to the band 2 (associated to the B colour Channel)
    00088                       \param transp an optional transparency degree, with a range of 0 (totally transparent) to 255 (totally opaque)
    00089                       \return true if if succeed and false otherwise
    00090            */
    00091            virtual bool setElementRGB(int col, int lin, double Rval, double Gval, double Bval, unsigned int /*transp*/ = 255);
    00092
    00094
    00100            virtual bool getElement(int col, int lin, double& val, int band=0 ) = 0;
    00101
    00103            virtual TeCoord2D coord2Index (const TeCoord2D &pt);
    00104
    00106            virtual TeCoord2D index2Coord (const TeCoord2D &pt);
    00107
    00109            /*
    00110                \param par the raster parameters structure
    00111            */
    00112            virtual void init( TeRasterParams& par );
    00113
    00115            virtual void init() = 0;
    00116
    00118            virtual bool clear() = 0;
    00119
    00121            static TeDecoder* DefaultObject( const TeRasterParams& par);
    00122
    00129
    00130            /*
    00131                       \param bb             box        that represents the interest region
    00132                       \param resFac         resolution factor
    00133                       \param parBlock to return the common parameters of the blocks that are selected
    00134                       \returns TRUE if could select at least one block and FALSE otherwise
    00135            */
    00136            virtual bool selectBlocks(TeBox& /* bb */, int /* resFac */, TeRasterParams& /*parBlock*/);
    00137
    00139            virtual int numberOfSelectedBlocks();
    00140
    00142            virtual bool getSelectedRasterBlock(TeDecoderMemory* /* memDec */);
    00143
    00145            virtual void clearBlockSelection();
    00146
    00148            /*
    00149                       \param bb             box that represents the interest region
    00150                       \param ncols          number of columns in the box
    00151                       \param nlines         number of lines in the box
    00152                       \param proj                      pointer to the projection of the box
    00153            */
    00154            virtual int bestResolution(TeBox& /*bb*/, int /*ncols*/, int /*nlines*/, TeProjection* /*proj*/);
    00155
    00157            virtual int bestResolution(double /*res*/);
    00159
    00160 protected:
    00161
    00163            TeRasterParams  params_;
    00164 };
    00165
    00167
    00171 class TL_DLL TeDecoderFactory: public TeFactory<TeDecoder,TeRasterParams>
    00172 {
    00173 public:
    00174
    00176            TeDecoderFactory(const string& name);
    00177
    00179            virtual ~TeDecoderFactory();
    00180
    00181            static TeDecoder* loadDecoder(const TeRasterParams& params);
    00182
    00183            virtual bool acceptFile(const std::string& fileName);
    00184
    00186            typedef map<string,string> TeNames2Decoders;
    00187
    00189            static TeNames2Decoders& instanceName2Dec ()
    00190            {
    00191                       static TeNames2Decoders names2dec_;
    00192                       return names2dec_;
    00193            }
    00194 };
    00195
    00196 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines