ParameterValue.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/se/ParameterValue.cpp
22 
23  \brief The ParameterValueType uses WFS-Filter expressions to give values for SE graphic parameters.
24 */
25 
26 // TerraLib
27 #include "../common/STLUtils.h"
28 #include "../fe/Expression.h"
29 #include "../fe/Literal.h"
30 #include "ParameterValue.h"
31 
33  : m_mixedData(nullptr),
34  m_expression(nullptr)
35 {
36 }
37 
39  : m_mixedData(nullptr),
40  m_expression(nullptr)
41 {
42  if(rhs.m_mixedData)
43  m_mixedData = new std::string(*rhs.m_mixedData);
44 
45  if(rhs.m_expression)
47 }
48 
50 {
51  delete m_mixedData;
52  delete m_expression;
53 }
54 
56 
57 te::se::ParameterValue::ParameterValue(const std::string& value)
58 {
59  add(value);
60 }
61 
63 {
64  for(std::size_t i = 0; i < rhs.m_parameters.size(); ++i)
66 }
67 
69 {
71 }
72 
74 {
75  m_parameters.push_back(p);
76 }
77 
78 void te::se::ParameterValue::add(const std::string& value)
79 {
81  p->m_expression = new te::fe::Literal(value);
82  add(p);
83 }
84 
86 {
87  return m_parameters.size();
88 }
89 
91 {
92  assert(i < m_parameters.size());
93  return m_parameters[i];
94 }
95 
97 {
98  return new ParameterValue(*this);
99 }
te::fe::Expression * m_expression
Parameter from an expression.
The ParameterValueType uses WFS-Filter expressions to give values for SE graphic parameters.
std::string * m_mixedData
Parameter from a mixed data content.
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
const Parameter * getParameter(size_t i) const
virtual ~ParameterValue()
Virtual destructor.
std::pair< std::string, std::string > Parameter
Definition: LibraryInfo.h:62
virtual Expression * clone() const =0
It returns a clone of this object.
te::gm::Polygon * p
size_t getNParameters() const
ParameterValue * clone() const
It creates a new copy of this object.
This class can be used to represent literal values.
Definition: fe/Literal.h:56
ParameterValue()
It initializes an empty ParameterValue.
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...
Definition: BoostUtils.h:55
void add(Parameter *p)
std::vector< Parameter * > m_parameters
Regular text may be mixed and WFS-Filter expressions to give values for SE graphic parameters...