ArithmeticOperations.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/rp/ArithmeticOperations.h
22  \brief Performs arithmetic operation over raster data.
23  */
24 
25 #ifndef __TERRALIB_RP_INTERNAL_ARITHMETICOPERATIONS_H
26 #define __TERRALIB_RP_INTERNAL_ARITHMETICOPERATIONS_H
27 
28 #include "Algorithm.h"
29 #include "../raster/Grid.h"
30 #include "../raster/Interpolator.h"
31 #include "../common/progress/TaskProgress.h"
32 
33 #include <map>
34 #include <memory>
35 #include <stack>
36 #include <string>
37 #include <vector>
38 #include <cmath>
39 
40 namespace te
41 {
42  namespace rst
43  {
44  class Raster;
45  }
46 
47  namespace rp
48  {
49  /*!
50  \class ArithmeticOperations
51 
52  \brief Performs arithmetic operation over raster data.
53 
54  \details The expression (arithmetic stringIt) must be formed by a combination of the following elements,
55  separated by spaces:
56 
57  Operators:
58  +(Sum of Rasters or a raster and a real number),
59  -(Subtraction of Rasters or a raster and a real number),
60  *(Multiplication of Rasters or a raster and a real number),
61  /(Division of Rasters or a raster and a real number)
62  ^(Exponential of a raster and a real number)
63  sqrt() (Square root of a raster)
64  sin() (Sine of a raster)
65  asin() (Arc Sine of a raster)
66  cos() (Cosine of a raster)
67  acos() (Arc Cosine of a raster)
68  log() (Common (base-10) logarithm of a raster)
69  tan() (Tangent of a raster)
70  atan() (Arc tangent of a raster)
71  ln() (Natural (base e) logarithm of a raster)
72 
73  Real Numbers (negative numbers must follow the form "-1.0")
74 
75  Raster bands: R0:1, R0:1, R1:0, .... (R0:1 is a reference to the first raster - with index 0 - from feeder, second band - with index 1).
76 
77  \ingroup rp_gen
78  */
80  {
81  public:
82 
83  /*!
84  \class InputParameters
85  \brief ArithmeticOperations input parameters
86  */
88  {
89  public:
90 
91  std::vector< te::rst::Raster* > m_inputRasters; //!< Input rasters vector.
92 
93  std::string m_arithmeticString; //!< Arithmetic string.
94 
95  bool m_normalize; //!< Output values normalization will be performed to fit the original input raster values range (default:true).
96 
97  bool m_enableProgress; //!< Enable/Disable the progress interface (default:false).
98 
99  te::rst::Interpolator::Method m_interpMethod; //!< The raster interpolator method (default:NearestNeighbor).
100 
102 
104 
106 
107  //overload
108  void reset() _NOEXCEPT_OP(false);
109 
110  //overload
111  const InputParameters& operator=( const InputParameters& params );
112 
113  //overload
114  AbstractParameters* clone() const;
115  };
116 
117  /*!
118  \class OutputParameters
119  \brief ArithmeticOperations output parameters
120  */
122  {
123  public:
124 
125  std::string m_rType; //!< Output raster data source type (as described in te::raster::RasterFactory ).
126 
127  std::map< std::string, std::string > m_rInfo; //!< The necessary information to create the output rasters (as described in te::raster::RasterFactory).
128 
129  std::unique_ptr< te::rst::Raster > m_outputRasterPtr; //!< The generated output registered raster.
130 
132 
134 
136 
137  //overload
138  void reset() _NOEXCEPT_OP(false);
139 
140  //overload
141  const OutputParameters& operator=( const OutputParameters& params );
142 
143  //overload
144  AbstractParameters* clone() const;
145  };
146 
148 
150 
151  //overload
152  bool execute( AlgorithmOutputParameters& outputParams ) _NOEXCEPT_OP(false);
153 
154  //overload
155  void reset() _NOEXCEPT_OP(false);
156 
157  //overload
158  bool initialize( const AlgorithmInputParameters& inputParams ) _NOEXCEPT_OP(false);
159 
160  bool isInitialized() const;
161 
162  protected:
163 
164  /*!
165  \class ExecStackElement
166  \brief Execution stack element.
167  */
169  {
170  public :
171 
172  bool m_isRaster; //!< true if this is a raster pointer element.
173 
174  bool m_isRealNumber; //!< true if this is a real number element.
175 
176  bool m_isBinaryOp; //!< true if this is a binary operator pointer element.
177 
178  bool m_isUnaryOp; //!< true if this is a unary operator pointer element.
179 
180  double m_realNumberValue; //!< Real number value.
181 
182  unsigned int m_rasterBand; //!< Raster band index.
183 
184  te::rst::Raster* m_rasterNPtr; //!< Raster pointer.
185 
186  std::string m_binaryOp; //!< Binary operator.
187 
188  std::string m_unaryOp; //!< Unary operator.
189 
190  mutable std::unique_ptr< te::rst::Raster > m_rasterHandler; //!< Raster handler.
191 
193  : m_isRaster(false), m_isRealNumber(false), m_isBinaryOp(false), m_isUnaryOp(false),
194  m_realNumberValue(0), m_rasterBand(0), m_rasterNPtr(0), m_binaryOp(""), m_unaryOp("")
195  {
196  operator=( rhs );
197  }
198 
200  : m_isRaster(false), m_isRealNumber(false), m_isBinaryOp(false), m_isUnaryOp(false),
201  m_realNumberValue(0), m_rasterBand(0), m_rasterNPtr(0), m_binaryOp(""), m_unaryOp("")
202  {}
203 
205  {
206  m_isRaster = rhs.m_isRaster;
207  m_isRealNumber = rhs.m_isRealNumber;
208  m_isBinaryOp = rhs.m_isBinaryOp;
209  m_isUnaryOp = rhs.m_isUnaryOp;
210  m_realNumberValue = rhs.m_realNumberValue;
211  m_rasterBand = rhs.m_rasterBand;
212  m_rasterNPtr = rhs.m_rasterNPtr;
213  m_binaryOp = rhs.m_binaryOp;
214  m_unaryOp = rhs.m_unaryOp;
215  m_rasterHandler.reset( rhs.m_rasterHandler.release() );
216 
217  return *this;
218  }
219 
221  };
222 
223  typedef std::stack< ExecStackElement > ExecStackT; //!< Execution stack type definition.
224 
225  /*!
226  \brief Type definition for a operation function pointer.
227  */
228  typedef void (ArithmeticOperations::*BinOpFuncPtrT)( const double& inputValue1, const double& inputValue2,
229  double& outputValue ) const;
230 
231  typedef void (ArithmeticOperations::*UnaryOpFuncPtrT)(const double& inputValue1, double& outputValue) const;
232 
234 
235  bool m_isInitialized; //!< Tells if this instance is initialized.
236 
237  /*!
238  \brief Addition binary operator function.
239  */
240  inline void additionBinOp( const double& inputValue1, const double& inputValue2,
241  double& outputValue ) const { outputValue = inputValue1 + inputValue2; }
242 
243  /*!
244  \brief Subtraction binary operator function.
245  */
246  inline void subtractionBinOp( const double& inputValue1, const double& inputValue2,
247  double& outputValue ) const { outputValue = inputValue1 - inputValue2; }
248 
249  /*!
250  \brief Multiplication binary operator function.
251  */
252  inline void multiplicationBinOp( const double& inputValue1, const double& inputValue2,
253  double& outputValue ) const { outputValue = inputValue1 * inputValue2; }
254 
255  /*!
256  \brief Division binary operator function.
257  */
258  inline void divisionBinOp( const double& inputValue1, const double& inputValue2,
259  double& outputValue ) const {
260  ( inputValue2 == 0.0 ) ? ( outputValue = 0 )
261  : ( outputValue = inputValue1 / inputValue2 );
262  }
263 
264  /*!
265  \brief Exponencial binary operator function.
266  */
267  inline void exponencialBinOp( const double& inputValue1, const double& inputValue2,
268  double& outputValue ) const { outputValue = pow(inputValue1, inputValue2); }
269 
270  /*!
271  \brief Square root unary operator function.
272  */
273  inline void sqrtUnaryOp(const double& inputValue,
274  double& outputValue) const { outputValue = sqrt(inputValue); }
275 
276  /*!
277  \brief Sine unary operator function.
278  */
279  inline void sinUnaryOp(const double& inputValue,
280  double& outputValue) const { outputValue = sin(inputValue); }
281 
282  /*!
283  \brief Arc sine unary operator function.
284  */
285  inline void asinUnaryOp(const double& inputValue,
286  double& outputValue) const { outputValue = asin(inputValue); }
287 
288  /*!
289  \brief Cosine unary operator function.
290  */
291  inline void cosUnaryOp(const double& inputValue,
292  double& outputValue) const { outputValue = cos(inputValue); }
293 
294  /*!
295  \brief Arc cosine unary operator function.
296  */
297  inline void acosUnaryOp(const double& inputValue,
298  double& outputValue) const { outputValue = acos(inputValue); }
299 
300  /*!
301  \brief Common logarithm unary operator function.
302  */
303  inline void logUnaryOp(const double& inputValue,
304  double& outputValue) const { outputValue = log10(inputValue); }
305 
306  /*!
307  \brief Tangent unary operator function.
308  */
309  inline void tanUnaryOp(const double& inputValue,
310  double& outputValue) const { outputValue = tan(inputValue); }
311 
312  /*!
313  \brief Arc Tangent unary operator function.
314  */
315  inline void atanUnaryOp(const double& inputValue,
316  double& outputValue) const { outputValue = atan(inputValue); }
317 
318  /*!
319  \brief unary operator function.
320  */
321  inline void lnUnaryOp(const double& inputValue,
322  double& outputValue) const { outputValue = log(inputValue); }
323 
324  /*!
325  \brief Execute the automata parsing the given input string.
326  \param aStr The input arithmetic expression string.
327  \param inRasters Input rasters pointers.
328  \param outRaster Output raster pointer (pre-initiated).
329  \param generateOutput If true, the output raster data will be generated, if false only the automata execution will be performed..
330  \param progressPtr A pointer to a progress interface to be pulsed on each operation or a null pointer.
331  */
332  bool executeString( const std::string& aStr,
333  const std::vector< te::rst::Raster* >& inRasters,
334  std::unique_ptr<te::rst::Raster>& outRaster,
335  bool generateOutput,
336  te::common::TaskProgress* const progressPtr ) const;
337 
338  /*!
339  \brief Convert the input tokens vector from the infix notation to postfix notation.
340  \param input The input tokens vector.
341  \param output The output tokens vector.
342  */
343  void inFix2PostFix( const std::vector< std::string >& input,
344  std::vector< std::string >& output ) const;
345 
346  /*!
347  \brief Print tokens to stout.
348  \param input The input tokens vector.
349  */
350  void printTokens( const std::vector< std::string >& input ) const;
351 
352  /*!
353  \brief Returns true if the given token is an operator.
354  \param inputToken Input token.
355  \return Returns true if the given token is an operator.
356  */
357  bool isOperator( const std::string& inputToken ) const;
358 
359  /*!
360  \brief Returns true if the given token is a binary operator.
361  \param inputToken Input token.
362  \return Returns true if the given token is a binary operator.
363  */
364  bool isBinaryOperator( const std::string& inputToken ) const;
365 
366  /*!
367  \brief Returns true if the given token is a unary operator.
368  \param inputToken Input token.
369  \return Returns true if the given token is a unary operator.
370  */
371  bool isUnaryOperator( const std::string& inputToken ) const;
372 
373  /*!
374  \brief Returns true if operator1 has greater of equal precedence over operator2.
375  \param operator1 Operator1 input token.
376  \param operator2 Operator2 input token.
377  \return Returns true if operator1 has greater of equal precedence over operator2.
378  */
379  bool op1HasGreaterOrEqualPrecedence( const std::string& operator1,
380  const std::string& operator2 ) const;
381 
382  /*!
383  \brief Returns true if the given token is a raster data token.
384  \param token Input token.
385  \param rasterIdx The output converted raster index value.
386  \param bandIdx The output converted band index value.
387  \return Returns true if the given token is a raster data token.
388  */
389  bool isRasterBandToken( const std::string& token, unsigned int& rasterIdx,
390  unsigned int& bandIdx ) const;
391 
392  /*!
393  \brief Execute the given binary operator using the current given execution stack.
394  \param token Operator token.
395  \param execStack Execution stack.
396  \param generateOutput if true the execution will generate valid output data, if false only dummy stack elements will be generated.
397  \return true if OK, false on errors..
398  */
399  bool execBinaryOperator( const std::string& token, ExecStackT&
400  execStack, bool generateOutput ) const;
401 
402  /*!
403  \brief Execute the given binary operator using the given input rasters
404  \param inRaster1 Input raster 1.
405  \param band1 Input raster 1 band.
406  \param inRaster2 Input raster 2.
407  \param band2 Input raster 2 band.
408  \param binOptFunctPtr The binary operation function pointer.
409  \param outRasterPtr The generated output raster.
410  \return true if OK, false on errors..
411  */
413  const unsigned int band1, const te::rst::Raster& inRaster2,
414  const unsigned int band2,
415  const BinOpFuncPtrT binOptFunctPtr,
416  std::unique_ptr<te::rst::Raster>& outRasterPtr ) const;
417 
418  /*!
419  \brief Execute the given binary operator using the given input raster and a real number
420  \param inRaster Input raster.
421  \param bandIdx Input raster band.
422  \param binOptFunctPtr The binary operation function pointer.
423  \param outRasterPtr The generated output raster.
424  \param realNumberIsRigthtTerm true if the real number is the right term.
425  \return true if OK, false on errors..
426  */
428  const unsigned int bandIdx, const double value,
429  const BinOpFuncPtrT binOptFunctPtr,
430  std::unique_ptr<te::rst::Raster>& outRasterPtr,
431  const bool realNumberIsRigthtTerm ) const;
432 
433  /*!
434  \brief Execute the given unary operator using the current given execution stack.
435  \param token Operator token.
436  \param execStack Execution stack.
437  \param generateOutput if true the execution will generate valid output data, if false only dummy stack elements will be generated.
438  \return true if OK, false on errors..
439  */
440  bool execUnaryOperator( const std::string& token, ExecStackT&
441  execStack, bool generateOutput ) const;
442 
443  /*!
444  \brief Execute the given unary operator using the given input raster
445  \param inRaster Input raster.
446  \param band1 Input raster band.
447  \param unaryOptFunctPtr The unary operation function pointer.
448  \param outRasterPtr The generated output raster.
449  \return true if OK, false on errors..
450  */
452  const unsigned int band, const UnaryOpFuncPtrT unaryOptFunctPtr,
453  std::unique_ptr<te::rst::Raster>& outRasterPtr) const;
454 
455  /*!
456  \brief Execute the given unary operator using the given a real number
457  \param unaryOptFunctPtr The unary operation function pointer.
458  \param outRasterPtr The generated output raster.
459  \param realNumberIsRigthtTerm true if the real number is the right term.
460  \return true if OK, false on errors..
461  */
462  bool execUnaryOperatorReal(const double value,
463  const UnaryOpFuncPtrT unaryOptFunctPtr,
464  std::unique_ptr<te::rst::Raster>& outRasterPtr,
465  const bool realNumberIsRigthtTerm) const;
466 
467  /*!
468  \brief Returns true if the given token is a real number.
469  \param token Input token.
470  \param realValue The output converted value.
471  \return Returns true if the given token is a real number.
472  */
473  bool isRealNumberToken( const std::string& token, double& realValue ) const;
474 
475  /*!
476  \brief Allocate a new RAM memory raster.
477  \param grid The output raster grid.
478  \param rasterPtr The output raster pointer.
479  \return Returns true if OK, false on errors.
480  */
481  bool allocResultRaster( const te::rst::Grid& grid,
482  std::unique_ptr<te::rst::Raster>& rasterPtr ) const;
483 
484  /*!
485  \brief Split the input string into a vector of token strings
486  \param inputStr The input string.
487  \param outTokens The generated output tokens vector.
488  */
489  void getTokensStrs( const std::string& inputStr,
490  std::vector< std::string >& outTokens ) const;
491  };
492  } // end namespace rp
493 } // end namespace te
494 
495 #endif // __TERRALIB_RP_INTERNAL_ARITHMETICOPERATIONS_H
te::rp::ArithmeticOperations::execBinaryOperatorRasterXRaster
bool execBinaryOperatorRasterXRaster(const te::rst::Raster &inRaster1, const unsigned int band1, const te::rst::Raster &inRaster2, const unsigned int band2, const BinOpFuncPtrT binOptFunctPtr, std::unique_ptr< te::rst::Raster > &outRasterPtr) const
Execute the given binary operator using the given input rasters.
te::rp::ArithmeticOperations::isOperator
bool isOperator(const std::string &inputToken) const
Returns true if the given token is an operator.
te::rp::ArithmeticOperations::InputParameters::m_arithmeticString
std::string m_arithmeticString
Arithmetic string.
Definition: ArithmeticOperations.h:93
te::rp::ArithmeticOperations::additionBinOp
void additionBinOp(const double &inputValue1, const double &inputValue2, double &outputValue) const
Addition binary operator function.
Definition: ArithmeticOperations.h:240
te::rp::ArithmeticOperations::executeString
bool executeString(const std::string &aStr, const std::vector< te::rst::Raster * > &inRasters, std::unique_ptr< te::rst::Raster > &outRaster, bool generateOutput, te::common::TaskProgress *const progressPtr) const
Execute the automata parsing the given input string.
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::rp::AlgorithmOutputParameters
Raster Processing algorithm output parameters base interface.
Definition: AlgorithmOutputParameters.h:40
te::rp::ArithmeticOperations::ExecStackT
std::stack< ExecStackElement > ExecStackT
Execution stack type definition.
Definition: ArithmeticOperations.h:223
te::rp::ArithmeticOperations::OutputParameters::m_outputRasterPtr
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
The generated output registered raster.
Definition: ArithmeticOperations.h:129
te::rp::ArithmeticOperations::execUnaryOperatorReal
bool execUnaryOperatorReal(const double value, const UnaryOpFuncPtrT unaryOptFunctPtr, std::unique_ptr< te::rst::Raster > &outRasterPtr, const bool realNumberIsRigthtTerm) const
Execute the given unary operator using the given a real number.
te::rst::Raster
An abstract class for raster data strucutures.
Definition: Raster.h:72
te::rp::ArithmeticOperations::InputParameters::InputParameters
InputParameters()
te::rp::ArithmeticOperations::execBinaryOperator
bool execBinaryOperator(const std::string &token, ExecStackT &execStack, bool generateOutput) const
Execute the given binary operator using the current given execution stack.
te::rp::AlgorithmInputParameters
Raster Processing algorithm input parameters base interface.
Definition: AlgorithmInputParameters.h:40
te::rp::ArithmeticOperations::ExecStackElement::m_rasterNPtr
te::rst::Raster * m_rasterNPtr
Raster pointer.
Definition: ArithmeticOperations.h:184
te::rp::ArithmeticOperations::ExecStackElement::ExecStackElement
ExecStackElement(const ExecStackElement &rhs)
Definition: ArithmeticOperations.h:192
_NOEXCEPT_OP
#define _NOEXCEPT_OP(x)
Definition: NoExceptDefinition.h:36
te::rp::ArithmeticOperations::printTokens
void printTokens(const std::vector< std::string > &input) const
Print tokens to stout.
te::rp::ArithmeticOperations::ExecStackElement::m_rasterHandler
std::unique_ptr< te::rst::Raster > m_rasterHandler
Raster handler.
Definition: ArithmeticOperations.h:190
te::rp::ArithmeticOperations::isRasterBandToken
bool isRasterBandToken(const std::string &token, unsigned int &rasterIdx, unsigned int &bandIdx) const
Returns true if the given token is a raster data token.
te::rp::ArithmeticOperations::isRealNumberToken
bool isRealNumberToken(const std::string &token, double &realValue) const
Returns true if the given token is a real number.
te::rp::ArithmeticOperations::isBinaryOperator
bool isBinaryOperator(const std::string &inputToken) const
Returns true if the given token is a binary operator.
te::rp::ArithmeticOperations::execUnaryOperator
bool execUnaryOperator(const std::string &token, ExecStackT &execStack, bool generateOutput) const
Execute the given unary operator using the current given execution stack.
te::rp::ArithmeticOperations::OutputParameters::reset
void reset() _NOEXCEPT_OP(false)
Clear all internal allocated resources and reset the parameters instance to its initial state.
te::rp::ArithmeticOperations::lnUnaryOp
void lnUnaryOp(const double &inputValue, double &outputValue) const
unary operator function.
Definition: ArithmeticOperations.h:321
te::rp::ArithmeticOperations::ExecStackElement::m_isRealNumber
bool m_isRealNumber
true if this is a real number element.
Definition: ArithmeticOperations.h:174
te::rp::ArithmeticOperations::ExecStackElement::m_isUnaryOp
bool m_isUnaryOp
true if this is a unary operator pointer element.
Definition: ArithmeticOperations.h:178
te::rp::Algorithm
Raster Processing algorithm base interface.
Definition: Algorithm.h:42
te::rst::Grid
A rectified grid is the spatial support for raster data.
Definition: Grid.h:69
te::rp::ArithmeticOperations::OutputParameters::m_rType
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
Definition: ArithmeticOperations.h:125
te::rp::ArithmeticOperations
Performs arithmetic operation over raster data.
Definition: ArithmeticOperations.h:80
te::rp::ArithmeticOperations::allocResultRaster
bool allocResultRaster(const te::rst::Grid &grid, std::unique_ptr< te::rst::Raster > &rasterPtr) const
Allocate a new RAM memory raster.
te::rp::ArithmeticOperations::ExecStackElement::m_binaryOp
std::string m_binaryOp
Binary operator.
Definition: ArithmeticOperations.h:186
te::rp::ArithmeticOperations::tanUnaryOp
void tanUnaryOp(const double &inputValue, double &outputValue) const
Tangent unary operator function.
Definition: ArithmeticOperations.h:309
te::rp::ArithmeticOperations::atanUnaryOp
void atanUnaryOp(const double &inputValue, double &outputValue) const
Arc Tangent unary operator function.
Definition: ArithmeticOperations.h:315
te::rst::InterpolationMethod
InterpolationMethod
Allowed interpolation methods.
Definition: Enums.h:93
te::rp::ArithmeticOperations::InputParameters::m_enableProgress
bool m_enableProgress
Enable/Disable the progress interface (default:false).
Definition: ArithmeticOperations.h:97
te::rp::ArithmeticOperations::ExecStackElement::~ExecStackElement
~ExecStackElement()
Definition: ArithmeticOperations.h:220
te::rp::ArithmeticOperations::execBinaryOperatorRasterXReal
bool execBinaryOperatorRasterXReal(const te::rst::Raster &inRaster, const unsigned int bandIdx, const double value, const BinOpFuncPtrT binOptFunctPtr, std::unique_ptr< te::rst::Raster > &outRasterPtr, const bool realNumberIsRigthtTerm) const
Execute the given binary operator using the given input raster and a real number.
te::rp::ArithmeticOperations::getTokensStrs
void getTokensStrs(const std::string &inputStr, std::vector< std::string > &outTokens) const
Split the input string into a vector of token strings.
te::rp::ArithmeticOperations::ExecStackElement::m_isBinaryOp
bool m_isBinaryOp
true if this is a binary operator pointer element.
Definition: ArithmeticOperations.h:176
te::rp::ArithmeticOperations::sqrtUnaryOp
void sqrtUnaryOp(const double &inputValue, double &outputValue) const
Square root unary operator function.
Definition: ArithmeticOperations.h:273
te::rp::ArithmeticOperations::InputParameters::InputParameters
InputParameters(const InputParameters &)
te::rp::ArithmeticOperations::inFix2PostFix
void inFix2PostFix(const std::vector< std::string > &input, std::vector< std::string > &output) const
Convert the input tokens vector from the infix notation to postfix notation.
TERPEXPORT
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:139
te::rp::ArithmeticOperations::multiplicationBinOp
void multiplicationBinOp(const double &inputValue1, const double &inputValue2, double &outputValue) const
Multiplication binary operator function.
Definition: ArithmeticOperations.h:252
te::rp::ArithmeticOperations::logUnaryOp
void logUnaryOp(const double &inputValue, double &outputValue) const
Common logarithm unary operator function.
Definition: ArithmeticOperations.h:303
te::rp::ArithmeticOperations::OutputParameters::~OutputParameters
~OutputParameters()
te::rp::ArithmeticOperations::OutputParameters::m_rInfo
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
Definition: ArithmeticOperations.h:127
te::rp::ArithmeticOperations::OutputParameters::OutputParameters
OutputParameters()
te::rp::ArithmeticOperations::InputParameters
ArithmeticOperations input parameters.
Definition: ArithmeticOperations.h:88
te::rp::ArithmeticOperations::op1HasGreaterOrEqualPrecedence
bool op1HasGreaterOrEqualPrecedence(const std::string &operator1, const std::string &operator2)const
Returns true if operator1 has greater of equal precedence over operator2.
te::rp::ArithmeticOperations::ExecStackElement::m_rasterBand
unsigned int m_rasterBand
Raster band index.
Definition: ArithmeticOperations.h:182
te::rp::ArithmeticOperations::InputParameters::reset
void reset() _NOEXCEPT_OP(false)
Clear all internal allocated resources and reset the parameters instance to its initial state.
te::rp::ArithmeticOperations::OutputParameters::OutputParameters
OutputParameters(const OutputParameters &)
te::rp::ArithmeticOperations::m_inputParameters
ArithmeticOperations::InputParameters m_inputParameters
Input execution parameters.
Definition: ArithmeticOperations.h:233
te::rp::ArithmeticOperations::isUnaryOperator
bool isUnaryOperator(const std::string &inputToken) const
Returns true if the given token is a unary operator.
te::rp::ArithmeticOperations::InputParameters::m_normalize
bool m_normalize
Output values normalization will be performed to fit the original input raster values range (default:...
Definition: ArithmeticOperations.h:95
te::rp::ArithmeticOperations::OutputParameters
ArithmeticOperations output parameters.
Definition: ArithmeticOperations.h:122
te::rp::ArithmeticOperations::ExecStackElement
Execution stack element.
Definition: ArithmeticOperations.h:169
te::rp::ArithmeticOperations::ExecStackElement::operator=
ExecStackElement & operator=(const ExecStackElement &rhs)
Definition: ArithmeticOperations.h:204
te::rp::ArithmeticOperations::ExecStackElement::m_realNumberValue
double m_realNumberValue
Real number value.
Definition: ArithmeticOperations.h:180
Algorithm.h
Abstract algorithm.
te::common::TaskProgress
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:54
te::rp::ArithmeticOperations::InputParameters::~InputParameters
~InputParameters()
te::rp::ArithmeticOperations::ExecStackElement::ExecStackElement
ExecStackElement()
Definition: ArithmeticOperations.h:199
te::rp::ArithmeticOperations::InputParameters::m_inputRasters
std::vector< te::rst::Raster * > m_inputRasters
Input rasters vector.
Definition: ArithmeticOperations.h:91
te::rp::ArithmeticOperations::subtractionBinOp
void subtractionBinOp(const double &inputValue1, const double &inputValue2, double &outputValue) const
Subtraction binary operator function.
Definition: ArithmeticOperations.h:246
te::rp::ArithmeticOperations::exponencialBinOp
void exponencialBinOp(const double &inputValue1, const double &inputValue2, double &outputValue) const
Exponencial binary operator function.
Definition: ArithmeticOperations.h:267
te::rp::ArithmeticOperations::divisionBinOp
void divisionBinOp(const double &inputValue1, const double &inputValue2, double &outputValue) const
Division binary operator function.
Definition: ArithmeticOperations.h:258
te::rp::ArithmeticOperations::ExecStackElement::m_isRaster
bool m_isRaster
true if this is a raster pointer element.
Definition: ArithmeticOperations.h:172
te::rp::ArithmeticOperations::sinUnaryOp
void sinUnaryOp(const double &inputValue, double &outputValue) const
Sine unary operator function.
Definition: ArithmeticOperations.h:279
te::rp::ArithmeticOperations::m_isInitialized
bool m_isInitialized
Tells if this instance is initialized.
Definition: ArithmeticOperations.h:235
te::rp::ArithmeticOperations::ExecStackElement::m_unaryOp
std::string m_unaryOp
Unary operator.
Definition: ArithmeticOperations.h:188
te::rp::ArithmeticOperations::execUnaryOperatorRaster
bool execUnaryOperatorRaster(const te::rst::Raster &inRaster, const unsigned int band, const UnaryOpFuncPtrT unaryOptFunctPtr, std::unique_ptr< te::rst::Raster > &outRasterPtr) const
Execute the given unary operator using the given input raster.
te::rp::ArithmeticOperations::InputParameters::m_interpMethod
te::rst::Interpolator::Method m_interpMethod
The raster interpolator method (default:NearestNeighbor).
Definition: ArithmeticOperations.h:99
te::rp::ArithmeticOperations::acosUnaryOp
void acosUnaryOp(const double &inputValue, double &outputValue) const
Arc cosine unary operator function.
Definition: ArithmeticOperations.h:297
te::rp::ArithmeticOperations::asinUnaryOp
void asinUnaryOp(const double &inputValue, double &outputValue) const
Arc sine unary operator function.
Definition: ArithmeticOperations.h:285
te::rp::ArithmeticOperations::cosUnaryOp
void cosUnaryOp(const double &inputValue, double &outputValue) const
Cosine unary operator function.
Definition: ArithmeticOperations.h:291