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 
48 {
49  m_args.push_back(e.clone());
50  m_geom.reset(static_cast<te::gm::Geometry*>(g.clone()));
51  m_d.reset(new te::common::Distance(d));
52 }
53 
55  : Function(rhs)
56 
57 {
58  m_geom.reset(rhs.m_geom.get() ? static_cast<te::gm::Geometry*>(rhs.m_geom->clone()) : nullptr);
59  m_d.reset(rhs.m_d.get() ? new te::common::Distance(*rhs.m_d) : nullptr);
60 }
61 
63 
65 {
66  if(this != &rhs)
67  {
69 
70  m_geom.reset(rhs.m_geom.get() ? static_cast<te::gm::Geometry*>(rhs.m_geom->clone()) : nullptr);
71  m_d.reset(rhs.m_d.get() ? new te::common::Distance(*rhs.m_d) : nullptr);
72  }
73 
74  return *this;
75 }
76 
78 {
79  return new ST_DistanceBuffer(*this);
80 }
81 
83 {
84  m_geom.reset(g);
85 }
86 
88 {
89  return m_geom.get();
90 }
91 
93 {
94  m_d.reset(d);
95 }
96 
98 {
99  return m_d.get();
100 }
ST_DistanceBuffer & operator=(const ST_DistanceBuffer &rhs)
virtual Expression * clone() const =0
It creates a new copy of this expression.
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.
Spatial distance buffer operator.
Expression * clone() const
It creates a new copy of this expression.
Spatial Distance Buffer operator.
static te::dt::DateTime d(2010, 8, 9, 15, 58, 39)
te::common::Distance * getDistance() const
It returns the distance.
te::gm::Geometry * getGeometry() const
It returns the geometry.
virtual AbstractData * clone() const =0
It returns a clone of this object.
A class that models a Function expression.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
std::unique_ptr< te::common::Distance > m_d
Distance.
double Distance(const double pt1x, const double pt1y, const double pt2x, const double pt2y)
Definition: GAP.cpp:63
void setGeometry(te::gm::Geometry *g)
It sets the geometry.
Function & operator=(const Function &rhs)
std::vector< Expression * > m_args
The list of arguments.
~ST_DistanceBuffer()
Destructor.
std::unique_ptr< te::gm::Geometry > m_geom
Geometry literal.
A given distance has a measurement and a unit-of-measure.
Definition: Distance.h:44