All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ST_DistanceBuffer.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 terralib/dataaccess/query/ST_DistanceBuffer.cpp
22 
23  \brief Spatial distance buffer operator.
24 */
25 
26 // TerraLib
27 #include "../../common/Distance.h"
28 #include "../../geometry/Geometry.h"
29 #include "ST_DistanceBuffer.h"
30 
35  : Function(name),
36  m_geom(g),
37  m_d(d)
38 {
39  m_args.push_back(e);
40 }
41 
43  const te::da::Expression& e,
44  const te::gm::Geometry& g,
45  const te::common::Distance& d)
46  : Function(name),
47  m_geom(0),
48  m_d(0)
49 {
50  m_args.push_back(e.clone());
51  m_geom.reset(static_cast<te::gm::Geometry*>(g.clone()));
52  m_d.reset(new te::common::Distance(d));
53 }
54 
56  : Function(rhs),
57  m_geom(0),
58  m_d(0)
59 {
60  m_geom.reset(rhs.m_geom.get() ? static_cast<te::gm::Geometry*>(rhs.m_geom->clone()) : 0);
61  m_d.reset(rhs.m_d.get() ? new te::common::Distance(*rhs.m_d) : 0);
62 }
63 
65 {
66 }
67 
69 {
70  if(this != &rhs)
71  {
73 
74  m_geom.reset(rhs.m_geom.get() ? static_cast<te::gm::Geometry*>(rhs.m_geom->clone()) : 0);
75  m_d.reset(rhs.m_d.get() ? new te::common::Distance(*rhs.m_d) : 0);
76  }
77 
78  return *this;
79 }
80 
82 {
83  return new ST_DistanceBuffer(*this);
84 }
85 
87 {
88  m_geom.reset(g);
89 }
90 
92 {
93  return m_geom.get();
94 }
95 
97 {
98  m_d.reset(d);
99 }
100 
102 {
103  return m_d.get();
104 }
ST_DistanceBuffer & operator=(const ST_DistanceBuffer &rhs)
TE_DEFINE_VISITABLE ST_DistanceBuffer(const std::string &name, Expression *e, te::gm::Geometry *g, te::common::Distance *d)
Constructor.
void setDistance(te::common::Distance *d)
It sets the distance.
This is an abstract class that models a query expression.
Definition: Expression.h:47
Spatial distance buffer operator.
Expression * clone() const
It creates a new copy of this expression.
Spatial Distance Buffer operator.
te::common::Distance * getDistance() const
It returns the distance.
te::gm::Geometry * getGeometry() const
It returns the geometry.
A class that models a Function expression.
Definition: Function.h:47
std::auto_ptr< te::gm::Geometry > m_geom
Geometry literal.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
void setGeometry(te::gm::Geometry *g)
It sets the geometry.
Function & operator=(const Function &rhs)
Definition: Function.cpp:44
virtual Expression * clone() const =0
It creates a new copy of this expression.
std::vector< Expression * > m_args
The list of arguments.
Definition: Function.h:118
virtual AbstractData * clone() const =0
It returns a clone of this object.
std::auto_ptr< te::common::Distance > m_d
Distance.
A given distance has a measurement and a unit-of-measure.
Definition: Distance.h:44