SubdivideDataHandler.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 terralin/vp/AbstractDataHandler.h
22 
23  \brief This class represents handler to help reading and writing data from/to a dataSource by dividing it into smaller groups
24  */
25 
26 #ifndef __TERRALIB_VP_INTERNAL_SUBDIVIDEDATAHANDLER_H
27 #define __TERRALIB_VP_INTERNAL_SUBDIVIDEDATAHANDLER_H
28 
29 #include "AbstractDataHandler.h"
30 #include "Config.h"
31 
32 #include <memory>
33 #include <vector>
34 
35 class SubdivideDataHandlerImpl;
36 
37 namespace te
38 {
39  namespace da
40  {
41  class DataAccess;
42  }
43  namespace dt
44  {
45  class AbstractData;
46  }
47 
48  namespace gm
49  {
50  class Envelope;
51  }
52 
53  namespace vp
54  {
56  {
57  public:
58  SubdivideKey(const std::vector<te::dt::AbstractData*>& vecKey);
59 
60  SubdivideKey(const SubdivideKey& other);
61 
63 
65 
66  bool operator<(const SubdivideKey& other) const;
67 
68  void clear();
69 
70  void init();
71 
72  std::string m_keyStr;
73  std::vector<te::dt::AbstractData*> m_vecKeys;
74  };
75 
76 
77  class FeatureSet;
78 
80  {
81  public:
82  /*! \brief Default constructor. */
84 
85  /*! \brief Virtual destructor. */
87 
88  //!< Initializes the data handler
89  virtual void initialize(te::vp::AbstractParameters* absParams, te::common::TaskProgress* taskProgress) override;
90 
91  //!< Finalizes the data handler
92  virtual void finalize(te::common::TaskProgress* taskProgress) override;
93 
94  //!< Returns the number of groups of the data handler
95  virtual std::size_t getGroupCount() const override;
96 
97  //!< Returns the inputIndex-th featureSet og the groupIndex-th group considering the given filter
98  virtual te::vp::FeatureSet getFeatureSet(std::size_t groupIndex, std::size_t inputIndex, const te::gm::Envelope& filter) override;
99 
100  //!< Adds a featureSet related to groupIndex-th group the to be added to the outputIndex-th output data access
101  virtual void addFeatureSet(std::size_t groupIndex, std::size_t outputIndex, const te::vp::FeatureSet& featureSet) override;
102 
103  protected:
104 
105  virtual void initGroups();
106 
107  virtual void setGroupInfo(const std::vector<te::vp::SubdivideKey>& vecGroups, const std::vector< std::vector<std::string> >& vecSubdivideColumns, const std::vector< std::vector<std::string> >& vecMergeColumns);
108 
109  protected:
110 
111  std::unique_ptr<SubdivideDataHandlerImpl> m_impl;
112  };
113 
115  {
116  public:
117 
119 
121 
122  protected:
123 
124  virtual te::vp::AbstractDataHandler* build() override;
125  };
126  }
127 }
128 
129 #endif //__TERRALIB_VP_INTERNAL_SUBDIVIDEDATAHANDLER_H
te::gm::Envelope
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::vp::SubdivideDataHandlerFactory::build
virtual te::vp::AbstractDataHandler * build() override
Concrete factories (derived from this one) must implement this method in order to create objects.
te::vp::SubdivideKey::m_vecKeys
std::vector< te::dt::AbstractData * > m_vecKeys
Definition: SubdivideDataHandler.h:73
te::vp::SubdivideDataHandler::finalize
virtual void finalize(te::common::TaskProgress *taskProgress) override
Returns the number of groups of the data handler.
te::vp::AbstractParameters
Abstract class used to define the input/ ouptut parameters for TerraAmazon Operations.
Definition: AbstractOperation.h:66
te::vp::SubdivideKey::SubdivideKey
SubdivideKey(const SubdivideKey &other)
te::vp::SubdivideKey::SubdivideKey
SubdivideKey(const std::vector< te::dt::AbstractData * > &vecKey)
te::vp::SubdivideDataHandler::initialize
virtual void initialize(te::vp::AbstractParameters *absParams, te::common::TaskProgress *taskProgress) override
Finalizes the data handler.
te::vp::SubdivideDataHandlerFactory
Definition: SubdivideDataHandler.h:115
te::vp::SubdivideDataHandler::getGroupCount
virtual std::size_t getGroupCount() const override
Returns the inputIndex-th featureSet og the groupIndex-th group considering the given filter.
te::vp::SubdivideKey::operator<
bool operator<(const SubdivideKey &other) const
te::vp::SubdivideDataHandler::initGroups
virtual void initGroups()
te::vp::SubdivideDataHandler::m_impl
std::unique_ptr< SubdivideDataHandlerImpl > m_impl
Definition: SubdivideDataHandler.h:111
te::vp::SubdivideKey::m_keyStr
std::string m_keyStr
Definition: SubdivideDataHandler.h:72
te::vp::SubdivideDataHandler::SubdivideDataHandler
SubdivideDataHandler()
Default constructor.
AbstractDataHandler.h
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::SubdivideKey::~SubdivideKey
~SubdivideKey()
te::vp::SubdivideDataHandlerFactory::SubdivideDataHandlerFactory
SubdivideDataHandlerFactory()
te::vp::SubdivideKey::operator=
SubdivideKey & operator=(const SubdivideKey &other)
te::vp::SubdivideKey::init
void init()
te::vp::SubdivideDataHandler
Definition: SubdivideDataHandler.h:80
te::vp::SubdivideDataHandler::~SubdivideDataHandler
virtual ~SubdivideDataHandler()
Virtual destructor.
te::vp::SubdivideDataHandler::getFeatureSet
virtual te::vp::FeatureSet getFeatureSet(std::size_t groupIndex, std::size_t inputIndex, const te::gm::Envelope &filter) override
Adds a featureSet related to groupIndex-th group the to be added to the outputIndex-th output data ac...
te::vp::SubdivideKey::clear
void clear()
te::vp::AbstractDataHandler
This abstract class represents handler to help reading and writing data from/to a dataSource by divid...
Definition: AbstractDataHandler.h:63
te::vp::SubdivideDataHandler::setGroupInfo
virtual void setGroupInfo(const std::vector< te::vp::SubdivideKey > &vecGroups, const std::vector< std::vector< std::string > > &vecSubdivideColumns, const std::vector< std::vector< std::string > > &vecMergeColumns)
te::vp::SubdivideDataHandlerFactory::~SubdivideDataHandlerFactory
virtual ~SubdivideDataHandlerFactory()
te::vp::FeatureSet
An alias for a set of Features.
Definition: Feature.h:60
te::common::TaskProgress
This class can be used to inform the progress of a task.
Definition: TaskProgress.h:54
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
te::vp::SubdivideDataHandler::addFeatureSet
virtual void addFeatureSet(std::size_t groupIndex, std::size_t outputIndex, const te::vp::FeatureSet &featureSet) override
te::vp::SubdivideKey
Definition: SubdivideDataHandler.h:56
te::vp::AbstractDataHandlerFactory
Definition: AbstractDataHandler.h:114