SkaterOperation.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/SkaterOperation.h
22 
23  \brief This file contains a class that represents the skater operation.
24 
25  \reference Adapted from TerraLib4.
26 */
27 
28 #ifndef __TERRALIB_SA_INTERNAL_SKATEROPERATION_H
29 #define __TERRALIB_SA_INTERNAL_SKATEROPERATION_H
30 
31 // Terralib Includes
32 #include "SkaterParams.h"
33 #include "../Config.h"
34 
35 // STL Includes
36 #include <memory>
37 
38 namespace te
39 {
40  //forward declarations
41  namespace graph
42  {
43  class AbstractGraph;
44  class Vertex;
45  }
46 
47  namespace sa
48  {
49  /*!
50  \class SkaterOperation
51 
52  \brief Class used to execute the skater operations
53 
54  */
56  {
57  public:
58 
59  /*! \brief Default constructor. */
61 
62  /*! \brief Virtual destructor. */
63  ~SkaterOperation();
64 
65  public:
66 
67  /*! \brief Function to execute the skater operation. */
68  void execute();
69 
70  void setParameters(te::sa::SkaterInputParams* inParams, te::sa::SkaterOutputParams* outParams);
71 
72  int getNumberOfClasses();
73 
74  protected:
75 
76  /*! Function used to create the output dataset type */
77  std::auto_ptr<te::da::DataSetType> createDataSetType(te::da::DataSetType* dsType);
78 
79  /*! Function used to create the output dataset */
80  std::auto_ptr<te::mem::DataSet> createDataSet(te::da::DataSet* inputDataSet, te::da::DataSetType* dsType, std::map<int, int>& skaterMap, std::string linkName);
81 
82  /*! Function used to save the output dataset */
83  void saveDataSet(te::da::DataSet* dataSet, te::da::DataSetType* dsType);
84 
85  /*! \brief Function to create the weight attribute. */
86  void createWeightAttribute(int weightAttrIdx, std::vector<int> attrsIdx);
87 
88  /*! \brief Function to calculate the weight attribute using the euclidean distance. */
89  double calculateWeight(std::vector<int> attrsIdx, te::graph::Vertex* vFrom, te::graph::Vertex* vTo);
90 
91  std::map<int, int> createSkaterMap(te::graph::AbstractGraph* graph, std::vector<std::size_t>& roots);
92 
93  protected:
94 
95  std::auto_ptr<te::sa::SkaterInputParams> m_inputParams; //!< Attribute with the skater input parameters.
96 
97  std::auto_ptr<te::sa::SkaterOutputParams> m_outputParams; //!< Attribute with the skater output parameters.
98 
99  int m_nClassGroups; //!< Number of classes (clusters) generated.
100  };
101  } // end namespace sa
102 } // end namespace te
103 
104 #endif //__TERRALIB_SA_INTERNAL_SKATEROPERATION_H
A class that models the description of a dataset.
Definition: DataSetType.h:72
Class that represents the skater input parameters.
Definition: SkaterParams.h:56
std::auto_ptr< te::sa::SkaterOutputParams > m_outputParams
Attribute with the skater output parameters.
Class that represents the skater output parameters.
Definition: SkaterParams.h:98
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
Definition: Vertex.h:68
Class used to execute the skater operations.
Abstract class used to define the main functions of graph struct. All graph implementations must used...
Definition: AbstractGraph.h:55
URI C++ Library.
int m_nClassGroups
Number of classes (clusters) generated.
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
This file contains a class that represents the skater parameters.
std::auto_ptr< te::sa::SkaterInputParams > m_inputParams
Attribute with the skater input parameters.