25#ifndef __TERRALIB_RP_INTERNAL_ARITHMETICOPERATIONS_H
26#define __TERRALIB_RP_INTERNAL_ARITHMETICOPERATIONS_H
235 double& outputValue )
const;
246 inline void additionBinOp(
const double& inputValue1,
const double& inputValue2,
247 double& outputValue )
const { outputValue = inputValue1 + inputValue2; }
253 double& outputValue )
const { outputValue = inputValue1 - inputValue2; }
259 double& outputValue )
const { outputValue = inputValue1 * inputValue2; }
264 inline void divisionBinOp(
const double& inputValue1,
const double& inputValue2,
265 double& outputValue )
const {
266 ( inputValue2 == 0.0 ) ? ( outputValue = 0 )
267 : ( outputValue = inputValue1 / inputValue2 );
274 double& outputValue )
const { outputValue = pow(inputValue1, inputValue2); }
280 double& outputValue)
const { outputValue = sqrt(inputValue); }
286 double& outputValue)
const { outputValue = sin(inputValue); }
292 double& outputValue)
const { outputValue = asin(inputValue); }
298 double& outputValue)
const { outputValue = cos(inputValue); }
304 double& outputValue)
const { outputValue = acos(inputValue); }
310 double& outputValue)
const { outputValue = log10(inputValue); }
316 double& outputValue)
const { outputValue = tan(inputValue); }
322 double& outputValue)
const { outputValue = atan(inputValue); }
328 double& outputValue)
const { outputValue = log(inputValue); }
339 const std::vector< te::rst::Raster* >& inRasters,
340 std::unique_ptr<te::rst::Raster>& outRaster,
350 std::vector< std::string >& output )
const;
356 void printTokens(
const std::vector< std::string >& input )
const;
386 const std::string& operator2 )
const;
396 unsigned int& bandIdx )
const;
406 execStack,
bool generateOutput )
const;
420 const unsigned int band2,
422 std::unique_ptr<te::rst::Raster>& outRasterPtr )
const;
434 const unsigned int bandIdx,
const double value,
436 std::unique_ptr<te::rst::Raster>& outRasterPtr,
437 const bool realNumberIsRigthtTerm )
const;
447 execStack,
bool generateOutput )
const;
459 std::unique_ptr<te::rst::Raster>& outRasterPtr)
const;
470 std::unique_ptr<te::rst::Raster>& outRasterPtr,
471 const bool realNumberIsRigthtTerm)
const;
488 std::unique_ptr<te::rst::Raster>& rasterPtr )
const;
496 std::vector< std::string >& outTokens )
const;
It interpolates one pixel based on a selected algorithm.
This class can be used to inform the progress of a task.
AbstractParameters()
Constructor.
This class can be used to inform the progress of a task.
Raster Processing algorithm output parameters base interface.
AlgorithmOutputParameters()
std::string m_binaryOp
Binary operator.
te::rst::Raster * m_rasterNPtr
Raster pointer.
bool m_isRaster
true if this is a raster pointer element.
std::string m_unaryOp
Unary operator.
ExecStackElement(const ExecStackElement &rhs)
bool m_isUnaryOp
true if this is a unary operator pointer element.
double m_realNumberValue
Real number value.
std::unique_ptr< te::rst::Raster > m_rasterHandler
Raster handler.
unsigned int m_rasterBand
Raster band index.
bool m_isRealNumber
true if this is a real number element.
ExecStackElement & operator=(const ExecStackElement &rhs)
bool m_isBinaryOp
true if this is a binary operator pointer element.
AbstractParameters * clone() const
Create a clone copy of this instance.
std::string m_rType
Output raster data source type (as described in te::raster::RasterFactory ).
std::unique_ptr< te::rst::Raster > m_outputRasterPtr
The generated output registered raster.
void reset() _NOEXCEPT_OP(false)
Clear all internal allocated resources and reset the parameters instance to its initial state.
std::map< std::string, std::string > m_rInfo
The necessary information to create the output rasters (as described in te::raster::RasterFactory).
OutputParameters(const OutputParameters &)
bool op1HasGreaterOrEqualPrecedence(const std::string &operator1, const std::string &operator2)const
Returns true if operator1 has greater of equal precedence over operator2.
void(ArithmeticOperations::* BinOpFuncPtrT)(const double &inputValue1, const double &inputValue2, double &outputValue) const
Type definition for a operation function pointer.
bool execUnaryOperator(const std::string &token, ExecStackT &execStack, bool generateOutput) const
Execute the given unary operator using the current given execution stack.
void atanUnaryOp(const double &inputValue, double &outputValue) const
Arc Tangent unary operator function.
bool execBinaryOperator(const std::string &token, ExecStackT &execStack, bool generateOutput) const
Execute the given binary operator using the current given execution stack.
bool execute(AlgorithmOutputParameters &outputParams) _NOEXCEPT_OP(false)
Executes the algorithm using the supplied parameters.
bool isInitialized() const
Returns true if the algorithm instance is initialized and ready for execution.
void reset() _NOEXCEPT_OP(false)
Clear all internal allocated objects and reset the algorithm to its initial state.
bool isRealNumberToken(const std::string &token, double &realValue) const
Returns true if the given token is a real number.
bool isRasterBandToken(const std::string &token, unsigned int &rasterIdx, unsigned int &bandIdx) const
Returns true if the given token is a raster data token.
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.
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.
void asinUnaryOp(const double &inputValue, double &outputValue) const
Arc sine unary operator function.
std::stack< ExecStackElement > ExecStackT
Execution stack type definition.
void exponencialBinOp(const double &inputValue1, const double &inputValue2, double &outputValue) const
Exponencial binary operator function.
ArithmeticOperations::InputParameters m_inputParameters
Input execution parameters.
void lnUnaryOp(const double &inputValue, double &outputValue) const
unary operator function.
bool m_isInitialized
Tells if this instance is initialized.
void multiplicationBinOp(const double &inputValue1, const double &inputValue2, double &outputValue) const
Multiplication binary operator function.
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.
bool isBinaryOperator(const std::string &inputToken) const
Returns true if the given token is a binary operator.
void sqrtUnaryOp(const double &inputValue, double &outputValue) const
Square root unary operator function.
bool isUnaryOperator(const std::string &inputToken) const
Returns true if the given token is a unary operator.
void sinUnaryOp(const double &inputValue, double &outputValue) const
Sine unary operator function.
void acosUnaryOp(const double &inputValue, double &outputValue) const
Arc cosine unary operator function.
void logUnaryOp(const double &inputValue, double &outputValue) const
Common logarithm unary operator function.
void getTokensStrs(const std::string &inputStr, std::vector< std::string > &outTokens) const
Split the input string into a vector of token strings.
bool isOperator(const std::string &inputToken) const
Returns true if the given token is an operator.
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.
void cosUnaryOp(const double &inputValue, double &outputValue) const
Cosine unary operator function.
void subtractionBinOp(const double &inputValue1, const double &inputValue2, double &outputValue) const
Subtraction binary operator function.
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.
void printTokens(const std::vector< std::string > &input) const
Print tokens to stout.
void additionBinOp(const double &inputValue1, const double &inputValue2, double &outputValue) const
Addition binary operator function.
void divisionBinOp(const double &inputValue1, const double &inputValue2, double &outputValue) const
Division binary operator function.
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.
void tanUnaryOp(const double &inputValue, double &outputValue) const
Tangent unary operator function.
void(ArithmeticOperations::* UnaryOpFuncPtrT)(const double &inputValue1, double &outputValue) const
bool allocResultRaster(const te::rst::Grid &grid, std::unique_ptr< te::rst::Raster > &rasterPtr) const
Allocate a new RAM memory raster.
bool initialize(const AlgorithmInputParameters &inputParams) _NOEXCEPT_OP(false)
Initialize the algorithm instance making it ready for execution.
A rectified grid is the spatial support for raster data.
InterpolationMethod Method
Allowed interpolation methods.
An abstract class for raster data strucutures.
Namespace for Raster Processing module of TerraLib.
Namespace for the Raster module of TerraLib.
A rectified grid is the spatial support for raster data.
Raster Processing algorithm base interface class.
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.