SamplePointsGeneratorAbstract.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/SamplePointsGeneratorAbstract.h
22 
23  \brief This file contains a virtual class to generate samples points.
24 
25  \reference Adapted from TerraLib4.
26 */
27 
28 #ifndef __TERRALIB_SA_INTERNAL_SAMPLEPOINTSGENERATORABSTRACT_H
29 #define __TERRALIB_SA_INTERNAL_SAMPLEPOINTSGENERATORABSTRACT_H
30 
31 // Terralib Includes
32 #include "../../dataaccess/datasource/DataSource.h"
33 #include "../Config.h"
34 #include "../Enums.h"
35 
36 // STL Includes
37 #include <memory>
38 
39 //BOOST
40 #include <boost/random/mersenne_twister.hpp>
41 #include <boost/random/uniform_real_distribution.hpp>
42 
43 namespace te
44 {
45  //forward declarations
46  namespace da { class DataSetType; }
47  namespace gm { class Envelope; }
48  namespace gm { class Point; }
49  namespace mem { class DataSet; }
50 
51  namespace sa
52  {
53  /*!
54  \class SamplePointsGeneratorAbstract
55 
56  \brief Virtual class to generate samples points.
57 
58  */
60  {
61  public:
62 
63  /*! \brief Default constructor. */
65 
66  /*! \brief Virtual destructor. */
68 
69  public:
70 
71  /*! \brief Function to execute the kernel operation. */
72  void execute();
73 
74  /*! Function used to set the envelope parameter */
75  void setSRID(int srid);
76 
77  /*! Function used to set the envelope parameter */
78  void setEnvelope(te::gm::Envelope env);
79 
80  /*! Function used to set the output dataset name parameter */
81  void setOutputDataSetName(std::string dataSetName);
82 
83  /*! Function used to set the output data source parameter */
84  void setOutputDataSource(te::da::DataSourcePtr ds);
85 
86  protected:
87 
88  /*! Function used to create the output dataset type */
89  virtual std::auto_ptr<te::da::DataSetType> createDataSetType() = 0;
90 
91  /*! Function used to create the output data */
92  virtual std::auto_ptr<te::mem::DataSet> generateSamples(te::da::DataSetType* dsType) = 0;
93 
94  /*! Function used to save the output dataset */
95  void saveDataSet(te::mem::DataSet* dataSet, te::da::DataSetType* dsType);
96 
97  /*! Function used to generate a randon point inside a defined envelope */
98  te::gm::Point* getPoint(const te::gm::Envelope* env);
99 
100  protected:
101 
102  int m_srid; //!< Attribute with spatial reference information
103 
104  te::gm::Envelope m_env; //!< Attribute used to restrict the area to generate the samples.
105 
106  te::da::DataSourcePtr m_ds; //!< Pointer to the output datasource.
107 
108  std::string m_outputDataSetName; //!< Attribute that defines the output dataset name
109 
111 
112  boost::random::mt19937 m_gen;
113 
114  boost::random::uniform_real_distribution<> m_distReal;
115  };
116  } // end namespace sa
117 } // end namespace te
118 
119 
120 #endif // __TERRALIB_SA_INTERNAL_SAMPLEPOINTSGENERATORABSTRACT_H
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1435
te::sa::SamplePointsGeneratorType m_type
Generator Type.
A class that models the description of a dataset.
Definition: DataSetType.h:72
boost::random::uniform_real_distribution m_distReal
std::string m_outputDataSetName
Attribute that defines the output dataset name.
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver...
Definition: DataSet.h:65
A point with x and y coordinate values.
Definition: Point.h:50
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
URI C++ Library.
te::gm::Envelope m_env
Attribute used to restrict the area to generate the samples.
Virtual class to generate samples points.
#define TESAEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:133
te::da::DataSourcePtr m_ds
Pointer to the output datasource.
SamplePointsGeneratorType
Generator types used to create sample of points.
Definition: Enums.h:115
int m_srid
Attribute with spatial reference information.