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 DistanceBuffer.cpp
22 
23  \brief Distance buffer operator.
24  */
25 
26 // TerraLib
27 #include "../common/Distance.h"
28 #include "../geometry/Geometry.h"
29 #include "DistanceBuffer.h"
30 #include "PropertyName.h"
31 
32 //SLT
33 #include <string>
34 
36  : SpatialOp(opName),
37  m_property(nullptr),
38  m_geom(nullptr),
39  m_d(nullptr)
40 {
41 }
42 
44  PropertyName* p,
47  : SpatialOp(opName),
48  m_property(p),
49  m_geom(g),
50  m_d(d)
51 {
52 }
53 
55 {
56  delete m_property;
57  delete m_geom;
58  delete m_d;
59 }
60 
62 {
63  delete m_property;
64  m_property = p;
65 }
66 
68 {
69  return m_property;
70 }
71 
73 {
74  delete m_geom;
75  m_geom = g;
76 }
77 
79 {
80  return m_geom;
81 }
82 
84 {
85  delete m_d;
86  m_d = d;
87 }
88 
90 {
91  return m_d;
92 }
93 
95 {
96  DistanceBuffer* distB = new DistanceBuffer;
97 
98  if(m_name)
99  distB->setName(m_name);
100 
101  if(m_property)
102  distB->setProperty(new PropertyName(m_property->getName()));
103 
104  if(m_geom)
105  distB->setGeometry( static_cast<te::gm::Geometry*>(m_geom->clone()));
106 
107  if(m_d)
108  distB->setDistance(m_d->clone());
109 
110  return distB;
111 
112 }
const std::string & getName() const
It returns the property name.
te::gm::Geometry * getGeometry() const
It returns the geometry.
void setGeometry(te::gm::Geometry *g)
It sets the geometry.
te::common::Distance * getDistance() const
It returns the distance.
Distance buffer operator.
te::common::Distance * m_d
Distance. (mandatory)
void setName(const char *opName)
It sets the operator name.
Definition: AbstractOp.h:89
void setDistance(te::common::Distance *d)
It sets the distance.
A spatial operator determines whether its geometric arguments satisfy the stated spatial relationship...
Definition: SpatialOp.h:52
Distance * clone() const
Definition: Distance.cpp:57
te::gm::Geometry * m_geom
Geometry literal. (Mandatory, if m_property is not specified)
virtual ~DistanceBuffer()
Destructor.
void setProperty(PropertyName *p)
It sets property name.
This class is used to encode the name of any property of an object.
PropertyName * getProperty() const
It returns the property name.
static te::dt::DateTime d(2010, 8, 9, 15, 58, 39)
te::gm::Polygon * p
virtual AbstractData * clone() const =0
It returns a clone of this object.
Distance buffer operator.
SpatialOp * clone() const
It creates a new copy of this object.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
DistanceBuffer(const char *opName=0)
It initializes the DistanceBuffer operator.
const char * m_name
Operator name.
Definition: AbstractOp.h:123
PropertyName * m_property
A geometric property. (Mandatory, if m_geom is not specified)
A given distance has a measurement and a unit-of-measure.
Definition: Distance.h:44