Loading...
Searching...
No Matches
BufferOp.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 BufferOp.h
22
23 \brief Buffer operation.
24
25 \ingroup vp
26 */
27
28#ifndef __TERRALIB_VP_INTERNAL_BUFFER_OP_H
29#define __TERRALIB_VP_INTERNAL_BUFFER_OP_H
30
31//Terralib
32
33#include "../dataaccess/dataset/DataSet.h"
34#include "../dataaccess/dataset/DataSetTypeConverter.h"
35#include "../dataaccess/datasource/DataSource.h"
36
37#include "../datatype/Property.h"
38
39#include "../memory/DataSet.h"
40#include "../statistics/core/Enums.h"
41
42#include "Config.h"
43#include "Enums.h"
44
45// STL
46#include <map>
47#include <memory>
48#include <string>
49
50namespace te
51{
52 namespace vp
53 {
54 /*!
55 \class BufferOp
56
57 \brief An abstract class to compute the buffer memory and buffer query operation.
58
59 \ingroup vp
60 */
62 {
63 public:
64
65 /*! \brief Default constructor that can be called by subclasses. */
67
68 /*! \brief Virtual destructor. */
69 virtual ~BufferOp() {}
70
71 /*!
72 \brief It executes the operation.
73
74 \return A Boolean value that means if the operation successfully completed or not.
75 */
76 virtual bool run() = 0;
77
78 /*!
79 \brief It verifies if the parameters are valid.
80
81 \return A Boolean value that means if the operation successfully completed or not.
82 */
83 virtual bool paramsAreValid();
84
85 /*!
86 \brief It sets the input data will be calculated.
87
88 \param inDsrc Where data is located.
89 \param inDsetName DataSet name.
90 \param converter DataSetTypeConverterr.
91 \param oidSet ObjectIdSet - It is necessary if has need to execute with a set of specific objects
92 */
94 std::string inDsetName,
95 std::unique_ptr<te::da::DataSetTypeConverter> converter,
96 const te::da::ObjectIdSet* oidSet = 0);
97
98 /*!
99 \brief It sets the input parameters that will be consumed to execute the operation.
100
101 \param distance A numeric value to set a fixed distance to buffer.
102 \param bufferPolygonRule The rule used for buffer result (INSIDE_OUTSIDE = 0, ONLY_OUTSIDE = 1, ONLY_INSIDE = 2).
103 \param bufferBoundariesRule The BoundariesBetweenBuffers can be dissolved or not - (DISSOLVE = 0 and NOT_DISSOLVE = 1).
104 \param copyInputColumns Copy columns from input DataSet.
105 \param levels The number of levels buffer will have.
106 \param attributePosition The buffer can be calculated by attribute values. The attribute must be numeric type.
107
108 \note If uses attibutePosition parameter, the fixed distance will be ignored.
109 \note The attributePosition parameter must be numeric type.
110 \note If there is a null value or zero in chosen attribute, the line that has this value will be ignored.
111 */
112 void setParams(const double& distance,
113 const int& newSrid,
114 const int& bufferPolygonRule,
115 const int& bufferBoundariesRule,
116 const bool& copyInputColumns,
117 const int& levels,
118 const int& attributePosition = -1);
119
120 /*!
121 \brief It sets the output parameters that will be used to persist operation result.
122
123 \param outDsrc Where data is will be persisted.
124 \param dsname The name os output data.
125
126 \note The output name must be different from other data that is already in dataSource.
127 */
128 void setOutput(te::da::DataSourcePtr outDsrc, std::string dsname);
129
130 protected:
131
132 /*!
133 \brief It builds the output DataSetType.
134 */
136
137 te::da::DataSourcePtr m_inDsrc; //!< The input datasource.
138 std::string m_inDsetName; //!< The input dataset name
139 std::unique_ptr<te::da::DataSetTypeConverter> m_converter; //!< The input datasettype
140 const te::da::ObjectIdSet* m_oidSet; //!< The input objectid set
141
142 double m_distance; //!< The fixed distance
143 int m_newSRID; //!< A new SRID if it's necessary to transform the data.
144 int m_bufferPolygonRule; //!< The buffer polygon rule (INSIDE_OUTSIDE = 0, ONLY_OUTSIDE = 1, ONLY_INSIDE = 2).
145 int m_bufferBoundariesRule; //!< The buffer boundary rule (DISSOLVE = 0 and NOT_DISSOLVE = 1).
146 bool m_copyInputColumns; //!< Copy columns from input DataSet.
147 int m_levels; //!< The number of levels buffer will have.
148 int m_attributePosition; //!< The buffer can be calculated by attribute values. The attribute must be numeric type.
149
150 te::da::DataSourcePtr m_outDsrc; //!< The output datasource.
151 std::string m_outDsetName; //!< The output dataset name.
152 };
153 }
154}
155#endif // __TERRALIB_VP_INTERNAL_BUFFER_OP_H
A class that models the description of a dataset.
Definition: DataSetType.h:73
This class represents a set of unique ids created in the same context. i.e. from the same data set.
Definition: ObjectIdSet.h:56
An abstract class to compute the buffer memory and buffer query operation.
Definition: BufferOp.h:62
te::da::DataSetType * GetDataSetType()
It builds the output DataSetType.
int m_bufferBoundariesRule
The buffer boundary rule (DISSOLVE = 0 and NOT_DISSOLVE = 1).
Definition: BufferOp.h:145
double m_distance
The fixed distance.
Definition: BufferOp.h:142
virtual bool run()=0
It executes the operation.
void setOutput(te::da::DataSourcePtr outDsrc, std::string dsname)
It sets the output parameters that will be used to persist operation result.
te::da::DataSourcePtr m_outDsrc
The output datasource.
Definition: BufferOp.h:150
BufferOp()
Default constructor that can be called by subclasses.
int m_bufferPolygonRule
The buffer polygon rule (INSIDE_OUTSIDE = 0, ONLY_OUTSIDE = 1, ONLY_INSIDE = 2).
Definition: BufferOp.h:144
int m_attributePosition
The buffer can be calculated by attribute values. The attribute must be numeric type.
Definition: BufferOp.h:148
std::string m_inDsetName
The input dataset name.
Definition: BufferOp.h:138
te::da::DataSourcePtr m_inDsrc
The input datasource.
Definition: BufferOp.h:137
void setParams(const double &distance, const int &newSrid, const int &bufferPolygonRule, const int &bufferBoundariesRule, const bool &copyInputColumns, const int &levels, const int &attributePosition=-1)
It sets the input parameters that will be consumed to execute the operation.
int m_levels
The number of levels buffer will have.
Definition: BufferOp.h:147
virtual bool paramsAreValid()
It verifies if the parameters are valid.
virtual ~BufferOp()
Virtual destructor.
Definition: BufferOp.h:69
bool m_copyInputColumns
Copy columns from input DataSet.
Definition: BufferOp.h:146
int m_newSRID
A new SRID if it's necessary to transform the data.
Definition: BufferOp.h:143
void setInput(te::da::DataSourcePtr inDsrc, std::string inDsetName, std::unique_ptr< te::da::DataSetTypeConverter > converter, const te::da::ObjectIdSet *oidSet=0)
It sets the input data will be calculated.
std::unique_ptr< te::da::DataSetTypeConverter > m_converter
The input datasettype.
Definition: BufferOp.h:139
const te::da::ObjectIdSet * m_oidSet
The input objectid set.
Definition: BufferOp.h:140
std::string m_outDsetName
The output dataset name.
Definition: BufferOp.h:151
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1449
TerraLib.
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
Proxy configuration file for TerraView (see terraview_config.h).
Enumerations of XML module.