Loading...
Searching...
No Matches
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 "../../geometry/Envelope.h"
34#include "../Config.h"
35#include "../Enums.h"
36
37// STL Includes
38#include <memory>
39
40//BOOST
41#include <boost/random/mersenne_twister.hpp>
42#include <boost/random/uniform_real_distribution.hpp>
43
44namespace te
45{
46 //forward declarations
47 namespace da { class DataSetType; }
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 */
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 */
85
86 protected:
87
88 /*! Function used to create the output dataset type */
89 virtual std::unique_ptr<te::da::DataSetType> createDataSetType() = 0;
90
91 /*! Function used to create the output data */
92 virtual std::unique_ptr<te::mem::DataSet> generateSamples(te::da::DataSetType* dsType) = 0;
93
94 /*! Function used to save the output dataset */
96
97 /*! Function used to generate a randon point inside a defined envelope */
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
A class that models the description of a dataset.
Definition: DataSetType.h:73
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
A point with x and y coordinate values.
Definition: Point.h:51
Implementation of a random-access dataset class for the TerraLib In-Memory Data Access driver.
Definition: DataSet.h:66
Virtual class to generate samples points.
virtual std::unique_ptr< te::mem::DataSet > generateSamples(te::da::DataSetType *dsType)=0
void setOutputDataSource(te::da::DataSourcePtr ds)
virtual ~SamplePointsGeneratorAbstract()
Virtual destructor.
void execute()
Function to execute the kernel operation.
te::gm::Point * getPoint(const te::gm::Envelope *env)
te::da::DataSourcePtr m_ds
Pointer to the output datasource.
void setOutputDataSetName(std::string dataSetName)
void saveDataSet(te::mem::DataSet *dataSet, te::da::DataSetType *dsType)
boost::random::uniform_real_distribution m_distReal
te::sa::SamplePointsGeneratorType m_type
Generator Type.
std::string m_outputDataSetName
Attribute that defines the output dataset name.
te::gm::Envelope m_env
Attribute used to restrict the area to generate the samples.
virtual std::unique_ptr< te::da::DataSetType > createDataSetType()=0
void setEnvelope(te::gm::Envelope env)
int m_srid
Attribute with spatial reference information.
SamplePointsGeneratorAbstract()
Default constructor.
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1449
SamplePointsGeneratorType
Generator types used to create sample of points.
Definition: Enums.h:117
TerraLib.
#define TESAEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:133