KernelOperation.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/sa/core/KernelOperation.h
22 
23  \brief This file contains a class that represents the kernel operation.
24 
25  \reference Adapted from TerraLib4.
26 */
27 
28 #ifndef __TERRALIB_SA_INTERNAL_KERNELOPERATION_H
29 #define __TERRALIB_SA_INTERNAL_KERNELOPERATION_H
30 
31 // Terralib Includes
32 #include "../Config.h"
33 #include "KernelFunctions.h"
34 #include "KernelParams.h"
35 
36 // STL Includes
37 #include <map>
38 #include <memory>
39 
40 
41 namespace te
42 {
43  //forward declarations
44  namespace da { class DataSetType; }
45  namespace gm { class Geometry; }
46  namespace mem { class DataSet; }
47  namespace rst { class Raster; }
48 
49  namespace sa
50  {
51  /*!
52  \class KernelOperation
53 
54  \brief Virtual class used to execute the kernel operations
55 
56  \sa KernelFunctions
57  */
59  {
60  public:
61 
62  /*! \brief Default constructor. */
64 
65  /*! \brief Virtual destructor. */
66  virtual ~KernelOperation();
67 
68  public:
69 
70  /*! \brief Function to execute the kernel operation. */
71  virtual void execute() = 0;
72 
73  void setOutputParameters(te::sa::KernelOutputParams* outParams);
74 
75  protected:
76 
77  /*! Function used to build the tree with data set information */
78  virtual void buildTree() = 0;
79 
80  /*! Function used to run kernel when output data is a raster */
81  void runRasterKernel(te::sa::KernelInputParams* inputParams, te::sa::KernelTree& kTree, te::sa::KernelMap& kMap, te::rst::Raster* raster);
82 
83  /*! Function used to run kernel when output data is dataset */
84  std::auto_ptr<te::mem::DataSet> runDataSetKernel(te::sa::KernelInputParams* inputParams, te::sa::KernelTree& kTree, te::sa::KernelMap& kMap, te::da::DataSetType* dsType);
85 
86  /*! Function used to create the output raster */
87  std::auto_ptr<te::rst::Raster> buildRaster(te::sa::KernelInputParams* inputParams, te::sa::KernelTree& kTree, std::string driver);
88 
89  /*! Function used to save the output dataset */
90  void saveDataSet(te::da::DataSet* dataSet, te::da::DataSetType* dsType);
91 
92  /*! Function used to create the output dataset type */
93  std::auto_ptr<te::da::DataSetType> createDataSetType(te::da::DataSetType* dsType);
94 
95  /*! Function used to create the output dataset */
96  std::auto_ptr<te::mem::DataSet> createDataSet(te::da::DataSet* inputDataSet, te::da::DataSetType* dsType);
97 
98  protected:
99 
100  std::auto_ptr<te::sa::KernelOutputParams> m_outputParams; //!< Attribute with the kernel output parameters.
101 
102  te::sa::KernelTree m_kTree; //!< Attribute used to locate near geometries.
103  };
104  } // end namespace sa
105 } // end namespace te
106 
107 #endif //__TERRALIB_SA_INTERNAL_KERNELOPERATION_H
Class that represents the kernel input parameters.
Definition: KernelParams.h:54
te::sa::KernelTree m_kTree
Attribute used to locate near geometries.
std::auto_ptr< te::sa::KernelOutputParams > m_outputParams
Attribute with the kernel output parameters.
A class that models the description of a dataset.
Definition: DataSetType.h:72
std::map< int, std::pair< te::gm::Geometry *, double > > KernelMap
Virtual class used to execute the kernel operations.
This file contains a functions used by the kernel operation.
This file contains a class that represents the kernel parameters.
Class that represents the kernel output parameters.
Definition: KernelParams.h:95
An abstract class for raster data strucutures.
Definition: Raster.h:71
URI C++ Library.
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
#define TESAEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:133