All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AggregationOp.cpp
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 AggregationOp.cpp
22  */
23 
24 #include "../dataaccess/dataset/DataSet.h"
25 #include "../dataaccess/dataset/DataSetAdapter.h"
26 #include "../dataaccess/dataset/DataSetType.h"
27 #include "../dataaccess/dataset/DataSetTypeConverter.h"
28 #include "../dataaccess/dataset/ObjectIdSet.h"
29 #include "../dataaccess/datasource/DataSource.h"
30 #include "../dataaccess/datasource/DataSourceCapabilities.h"
31 #include "../dataaccess/utils/Utils.h"
32 
33 #include "../datatype/Property.h"
34 #include "../datatype/StringProperty.h"
35 
36 #include "../geometry/GeometryProperty.h"
37 
38 #include "../statistics/core/Utils.h"
39 
40 #include "AggregationOp.h"
41 
43  m_outDset("")
44 {
45 }
46 
48  std::string inDsetName,
49  std::auto_ptr<te::da::DataSetType> inDsetType,
50  const te::da::ObjectIdSet* oidSet)
51 {
52  m_inDsrc = inDsrc;
53  m_inDsetName = inDsetName;
54  m_inDsetType = inDsetType;
55  m_oidSet = oidSet;
56 }
57 
58 void te::vp::AggregationOp::setParams(std::vector<te::dt::Property*>& groupProps,
59  std::map<te::dt::Property*, std::vector<te::stat::StatisticalSummary> >&statSum)
60 {
61  m_groupProps = groupProps;
62  m_statSum = statSum;
63 }
64 
66 {
67  m_outDsrc = outDsrc;
68  m_outDset = dsname;
69 }
70 
72 {
73  if (geom == te::gm::PolygonType)
75 
76  if (geom == te::gm::LineStringType)
78 
79  if (geom == te::gm::PointType)
81 
82  return geom;
83 }
84 
86 {
87  if (!m_inDsetType.get())
88  return false;
89 
90  if (!m_inDsetType->hasGeom())
91  return false;
92 
93  if (m_groupProps.empty())
94  return false;
95 
96  if (m_outDset.empty() || !m_outDsrc.get())
97  return false;
98 
99  return true;
100 }
Aggregation operation.
void setInput(te::da::DataSourcePtr inDsrc, std::string inDsetName, std::auto_ptr< te::da::DataSetType > inDsetType, const te::da::ObjectIdSet *oidSet=0)
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:1435
te::gm::GeomType getGeomResultType(te::gm::GeomType geom)
It models a property definition.
Definition: Property.h:59
virtual bool paramsAreValid()
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Definition: ObjectIdSet.h:55
void setOutput(te::da::DataSourcePtr outDsrc, std::string dsname)
void setParams(std::vector< te::dt::Property * > &groupProps, std::map< te::dt::Property *, std::vector< te::stat::StatisticalSummary > > &statSum)