IntersectionOp.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 IntersectionOp.h
22 
23  \brief Intersection operation.
24 
25  \ingroup vp
26  */
27 
28 #ifndef __TERRALIB_VP_INTERNAL_INTERSECTION_OP_H
29 #define __TERRALIB_VP_INTERNAL_INTERSECTION_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 "../geometry/Enums.h"
40 #include "../memory/DataSet.h"
41 
42 #include "IntersectionOp.h"
43 #include "Config.h"
44 
45 // STL
46 #include <map>
47 #include <memory>
48 #include <string>
49 #include <vector>
50 
51 namespace te
52 {
53  namespace vp
54  {
56  {
57  public:
58 
60 
61  virtual ~IntersectionOp() {}
62 
63  virtual bool run() = 0;
64 
65  virtual bool paramsAreValid();
66 
67  void setInput(te::da::DataSourcePtr inFirstDsrc,
68  std::string inFirstDsetName,
69  std::unique_ptr<te::da::DataSetTypeConverter> firstConverter,
70  te::da::DataSourcePtr inSecondDsrc,
71  std::string inSecondDsetName,
72  std::unique_ptr<te::da::DataSetTypeConverter> secondConverter,
73  const te::da::ObjectIdSet* firstOidSet = 0,
74  const te::da::ObjectIdSet* secondOidSet = 0);
75 
76  void setInput(te::da::DataSourcePtr inFirstDsrc,
77  std::string inFirstDsetName,
78  std::unique_ptr<te::da::DataSetType> firstDsType,
79  std::unique_ptr<te::da::DataSet> firstDs,
80  std::unique_ptr<te::da::DataSetTypeConverter> firstConverter,
81  te::da::DataSourcePtr inSecondDsrc,
82  std::string inSecondDsetName,
83  std::unique_ptr<te::da::DataSetType> secondDsType,
84  std::unique_ptr<te::da::DataSet> secondDs,
85  std::unique_ptr<te::da::DataSetTypeConverter> secondConverter,
86  const te::da::ObjectIdSet* firstOidSet = 0,
87  const te::da::ObjectIdSet* secondOidSet = 0);
88 
89  void setParams(const std::vector<std::pair<int, std::string> > &attributeVec);
90 
91  void setOutput(te::da::DataSourcePtr outDsrc, std::string dsname);
92 
94 
96 
98 
99  protected:
100 
101  std::vector<te::dt::Property*> getTabularProps(te::da::DataSetType* dsType);
102 
103  // it defines the type of the result considering the input geometries.
105 
106  bool isSelectedProperty(const int &id, const dt::Property &prop);
107 
108  protected:
110  std::string m_inFirstDsetName;
111  std::unique_ptr<te::da::DataSetTypeConverter> m_firstConverter;
113  std::string m_inSecondDsetName;
114  std::unique_ptr<te::da::DataSetTypeConverter> m_secondConverter;
117 
118  std::unique_ptr<te::da::DataSetType> m_firstDsType;
119  std::unique_ptr<te::da::DataSet> m_firstDs;
120  std::unique_ptr<te::da::DataSetType> m_secondDsType;
121  std::unique_ptr<te::da::DataSet> m_secondDs;
122 
125 
126  std::vector<std::pair<int, std::string> > m_attributeVec;
127 
129  std::string m_outDsetName;
130  };
131  }
132 }
133 #endif // __TERRALIB_VP_INTERNAL_INTERSECTION_OP_H
te::vp::IntersectionOp::m_outDsrc
te::da::DataSourcePtr m_outDsrc
Definition: IntersectionOp.h:128
te::vp::IntersectionOp::run
virtual bool run()=0
te::vp::IntersectionOp::getTabularProps
std::vector< te::dt::Property * > getTabularProps(te::da::DataSetType *dsType)
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::vp::IntersectionOp::m_firstConverter
std::unique_ptr< te::da::DataSetTypeConverter > m_firstConverter
Definition: IntersectionOp.h:111
te::vp::IntersectionOp::paramsAreValid
virtual bool paramsAreValid()
te::vp::IntersectionOp::m_inSecondDsrc
te::da::DataSourcePtr m_inSecondDsrc
Definition: IntersectionOp.h:112
te::vp::IntersectionOp::setParams
void setParams(const std::vector< std::pair< int, std::string > > &attributeVec)
te::vp::IntersectionOp::setGeomResultType
te::gm::GeomType setGeomResultType(te::gm::GeomType firstGeom, te::gm::GeomType secondGeom)
te::vp::IntersectionOp::setIsSecondQuery
void setIsSecondQuery()
te::vp::IntersectionOp::setOutput
void setOutput(te::da::DataSourcePtr outDsrc, std::string dsname)
te::vp::IntersectionOp::m_firstDsType
std::unique_ptr< te::da::DataSetType > m_firstDsType
Definition: IntersectionOp.h:118
te::vp::IntersectionOp::m_firstDs
std::unique_ptr< te::da::DataSet > m_firstDs
Definition: IntersectionOp.h:119
te::vp::IntersectionOp::IntersectionOp
IntersectionOp()
te::vp::IntersectionOp::~IntersectionOp
virtual ~IntersectionOp()
Definition: IntersectionOp.h:61
te::vp::IntersectionOp::m_isFistQuery
bool m_isFistQuery
Definition: IntersectionOp.h:123
te::vp::IntersectionOp::m_secondOidSet
const te::da::ObjectIdSet * m_secondOidSet
Definition: IntersectionOp.h:116
te::vp::IntersectionOp::m_inFirstDsetName
std::string m_inFirstDsetName
Definition: IntersectionOp.h:110
te::vp::IntersectionOp::m_inFirstDsrc
te::da::DataSourcePtr m_inFirstDsrc
Definition: IntersectionOp.h:109
te::vp::IntersectionOp::m_secondConverter
std::unique_ptr< te::da::DataSetTypeConverter > m_secondConverter
Definition: IntersectionOp.h:114
te::vp::IntersectionOp::setInput
void setInput(te::da::DataSourcePtr inFirstDsrc, std::string inFirstDsetName, std::unique_ptr< te::da::DataSetTypeConverter > firstConverter, te::da::DataSourcePtr inSecondDsrc, std::string inSecondDsetName, std::unique_ptr< te::da::DataSetTypeConverter > secondConverter, const te::da::ObjectIdSet *firstOidSet=0, const te::da::ObjectIdSet *secondOidSet=0)
TEVPEXPORT
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
te::vp::IntersectionOp::m_outDsetName
std::string m_outDsetName
Definition: IntersectionOp.h:129
te::vp::IntersectionOp::setInput
void setInput(te::da::DataSourcePtr inFirstDsrc, std::string inFirstDsetName, std::unique_ptr< te::da::DataSetType > firstDsType, std::unique_ptr< te::da::DataSet > firstDs, std::unique_ptr< te::da::DataSetTypeConverter > firstConverter, te::da::DataSourcePtr inSecondDsrc, std::string inSecondDsetName, std::unique_ptr< te::da::DataSetType > secondDsType, std::unique_ptr< te::da::DataSet > secondDs, std::unique_ptr< te::da::DataSetTypeConverter > secondConverter, const te::da::ObjectIdSet *firstOidSet=0, const te::da::ObjectIdSet *secondOidSet=0)
te::vp::IntersectionOp::m_firstOidSet
const te::da::ObjectIdSet * m_firstOidSet
Definition: IntersectionOp.h:115
te::vp::IntersectionOp::m_isSecondQuery
bool m_isSecondQuery
Definition: IntersectionOp.h:124
te::vp::IntersectionOp::m_secondDsType
std::unique_ptr< te::da::DataSetType > m_secondDsType
Definition: IntersectionOp.h:120
te::vp::IntersectionOp::m_secondDs
std::unique_ptr< te::da::DataSet > m_secondDs
Definition: IntersectionOp.h:121
te::vp::IntersectionOp::m_attributeVec
std::vector< std::pair< int, std::string > > m_attributeVec
Definition: IntersectionOp.h:126
te::dt::Property
It models a property definition.
Definition: Property.h:60
te::da::DataSourcePtr
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1449
te::vp::IntersectionOp::m_inSecondDsetName
std::string m_inSecondDsetName
Definition: IntersectionOp.h:113
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::vp::IntersectionOp::setIsFirstQuery
void setIsFirstQuery()
te::vp::IntersectionOp::isSelectedProperty
bool isSelectedProperty(const int &id, const dt::Property &prop)
te::da::DataSetType
A class that models the description of a dataset.
Definition: DataSetType.h:73
IntersectionOp.h
Intersection operation.
te::gm::GeomType
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:42
te::vp::IntersectionOp::getOutputDsType
te::da::DataSetType * getOutputDsType()
te::vp::IntersectionOp
Definition: IntersectionOp.h:56
te::da::ObjectIdSet
This class represents a set of unique ids created in the same context. i.e. from the same data set.
Definition: ObjectIdSet.h:56