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::auto_ptr<te::da::DataSetTypeConverter> firstConverter,
70  te::da::DataSourcePtr inSecondDsrc,
71  std::string inSecondDsetName,
72  std::auto_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::auto_ptr<te::da::DataSetType> firstDsType,
79  std::auto_ptr<te::da::DataSet> firstDs,
80  std::auto_ptr<te::da::DataSetTypeConverter> firstConverter,
81  te::da::DataSourcePtr inSecondDsrc,
82  std::string inSecondDsetName,
83  std::auto_ptr<te::da::DataSetType> secondDsType,
84  std::auto_ptr<te::da::DataSet> secondDs,
85  std::auto_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<std::string, std::string> >& attributeVec);
90 
91  void setOutput(te::da::DataSourcePtr outDsrc, std::string dsname);
92 
93  te::da::DataSetType* getOutputDsType();
94 
95  void setIsFirstQuery();
96 
97  void setIsSecondQuery();
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.
104  te::gm::GeomType setGeomResultType(te::gm::GeomType firstGeom, te::gm::GeomType secondGeom);
105 
106  bool isSelectedProperty(const std::string& dsName, te::dt::Property* prop);
107 
108  protected:
110  std::string m_inFirstDsetName;
111  std::auto_ptr<te::da::DataSetTypeConverter> m_firstConverter;
113  std::string m_inSecondDsetName;
114  std::auto_ptr<te::da::DataSetTypeConverter> m_secondConverter;
117 
118  std::auto_ptr<te::da::DataSetType> m_firstDsType;
119  std::auto_ptr<te::da::DataSet> m_firstDs;
120  std::auto_ptr<te::da::DataSetType> m_secondDsType;
121  std::auto_ptr<te::da::DataSet> m_secondDs;
122 
125 
126  std::vector<std::pair<std::string, std::string> > m_attributeVec;
127 
129  std::string m_outDsetName;
130  };
131  }
132 }
133 #endif // __TERRALIB_VP_INTERNAL_INTERSECTION_OP_H
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
std::string m_inSecondDsetName
std::auto_ptr< te::da::DataSetTypeConverter > m_firstConverter
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:41
boost::shared_ptr< DataSource > DataSourcePtr
Definition: DataSource.h:1438
const te::da::ObjectIdSet * m_firstOidSet
std::auto_ptr< te::da::DataSetType > m_firstDsType
A class that models the description of a dataset.
Definition: DataSetType.h:72
It models a property definition.
Definition: Property.h:59
te::da::DataSourcePtr m_inSecondDsrc
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Definition: ObjectIdSet.h:55
std::auto_ptr< te::da::DataSet > m_firstDs
URI C++ Library.
te::da::DataSourcePtr m_outDsrc
std::auto_ptr< te::da::DataSetTypeConverter > m_secondConverter
Intersection operation.
std::string m_inFirstDsetName
std::auto_ptr< te::da::DataSetType > m_secondDsType
te::da::DataSourcePtr m_inFirstDsrc
std::auto_ptr< te::da::DataSet > m_secondDs
std::vector< std::pair< std::string, std::string > > m_attributeVec
Configuration flags for the Terrralib Vector Processing module.
const te::da::ObjectIdSet * m_secondOidSet