| 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/image_processing/TePDIArithmetic.hpp
Go to the documentation of this file.

    00001 /*
    00002 TerraLib - a library for developing GIS applications.
    00003 Copyright  2001, 2002, 2003 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
    00017 purpose. The library provided hereunder is on an "as is" basis, and the
    00018 authors have no obligation to provide maintenance, support, updates,
    00019 enhancements, or modifications.
    00020 In no event shall INPE be held liable to any party
    00021 for direct, indirect, special, incidental, or consequential damages arising
    00022 out of the use of this library and its documentation.
    00023 */
    00024
    00025 #ifndef TEPDIARITHMETIC_HPP
    00026   #define TEPDIARITHMETIC_HPP
    00027
    00028   #include "TePDIAlgorithm.hpp"
    00029
    00030   #include <vector>
    00031   #include <string>
    00032
    00063   class PDI_DLL TePDIArithmetic : public TePDIAlgorithm
    00064   {
    00065     public :
    00066
    00067       TePDIArithmetic();
    00068
    00069       ~TePDIArithmetic();
    00070
    00071       //overloaded
    00072       bool CheckParameters( const TePDIParameters& parameters ) const;
    00073
    00074     protected :
    00075
    00080       class PDI_DLL ExecStackElement
    00081       {
    00082         public :
    00083
    00085           bool isRaster_;
    00086
    00088           bool isRealNumber_;
    00089
    00091           double realNumberValue_;
    00092
    00094           unsigned int rasterBand_;
    00095
    00097           TePDITypes::TePDIRasterPtrType rasterPtr_;
    00098
    00099           ExecStackElement()
    00100           : isRaster_( false ), isRealNumber_( false ), realNumberValue_( 0 ),
    00101             rasterBand_( 0 )
    00102           {};
    00103
    00104           ~ExecStackElement() {};
    00105
    00106       };
    00107
    00109       typedef std::stack< ExecStackElement > ExecStackT;
    00110
    00112       mutable TePDIPIManager progress_;
    00113
    00114       //overloaded
    00115       bool RunImplementation();
    00116
    00117       //overloaded
    00118       void ResetState( const TePDIParameters& params );
    00119
    00128       bool executeString( const std::string& aStr,
    00129         const TePDITypes::TePDIRasterVectorType& inRasters,
    00130         TePDITypes::TePDIRasterPtrType& outRaster,
    00131         bool generateOutput ) const;
    00132
    00139       void inFix2PostFix( const std::vector< std::string >& input,
    00140         std::vector< std::string >& output ) const;
    00141
    00146       void printTokens( const std::vector< std::string >& input ) const;
    00147
    00153       bool isOperator( const std::string& inputToken ) const;
    00154
    00160       bool isBinaryOperator( const std::string& inputToken ) const;
    00161
    00167       bool isUnaryOperator( const std::string& inputToken ) const;
    00168
    00177       bool op1HasGreaterOrEqualPrecedence( const std::string& operator1,
    00178         const std::string& operator2 ) const;
    00179
    00187       bool isRasterBandToken( const std::string& token, unsigned int& rasterIdx,
    00188         unsigned int& bandIdx ) const;
    00189
    00199       bool execBinaryOperator( const std::string& token, ExecStackT&
    00200         execStack, bool generateOutput ) const;
    00201
    00211       bool execUnaryOperator( const std::string& token, ExecStackT&
    00212         execStack, bool generateOutput ) const;
    00213
    00220       bool isRealNumberToken( const std::string& token, double& realValue ) const;
    00221
    00229       bool allocResultRaster( unsigned int nLines, unsigned int nCols,
    00230         TePDITypes::TePDIRasterPtrType& rasterPtr ) const;
    00231
    00237       void getTokensStrs( const std::string& inputStr,
    00238         std::vector< std::string >& outTokens ) const;
    00239   };
    00240
    00241 #endif

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines