FormatNumber.h
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/FormatNumber.h
22 
23  \brief Numeric formatting function.
24 */
25 
26 #ifndef __TERRALIB_SE_INTERNAL_FORMATNUMBER_H
27 #define __TERRALIB_SE_INTERNAL_FORMATNUMBER_H
28 
29 // TerraLib
30 #include "Function.h"
31 
32 namespace te
33 {
34  namespace se
35  {
36 // Forward declaration
37  class ParameterValue;
38 
39  /*!
40  \class FormatNumber
41 
42  \brief Numeric formatting function.
43 
44  Function for formatting numbers to make them human readable.
45  One of the most needed is a function for formatting numbers
46  to make them human readable. You need such a function
47  whenever a TextSymbolizer is employed to output a
48  numeric property value.
49 
50  \sa Function, ParameterValue
51  */
53  {
54  public:
55 
56  /** @name Initializer Methods
57  * Methods related to instantiation and destruction.
58  */
59  //@{
60 
61  /*! \brief It initializes a new FormatNumber. */
62  FormatNumber();
63 
64  /*! \brief Destructor. */
65  ~FormatNumber();
66 
67  //@}
68 
69  /*
70  The Pattern is build-up of characters as follows:
71  <ul>
72  <li><b>#:</b> digit, which is omitted if irrelevant (leading or trailing zero);</li>
73  <li><b>0:</b> digit;</li>
74  <li><b>.:</b> decimal point;</li>
75  <li><b>,:</b> grouping separator;</li>
76  <li><b>E:</b> exponent indicator;</li>
77  <li><b>-:</b> minus sign;</li>
78  <li><b>':</b> apostrophe (for quoting).</li>
79  </ul>
80 
81  Due to required distinctions in the notation of numbers,
82  two of the pattern characters can be defined as attributes
83  of the FormatNumber element:
84  decimalPoint="."
85  groupingSeperator=","
86 
87  If there is no NegativePattern, "-" is prefixed to the Pattern.
88  */
89  void setNumericValue(ParameterValue* v);
90  void setPattern(const std::string& p);
91  void setNegativePattern(const std::string& np);
92  void setDecimalPoint(const std::string& dp);
93  void setGroupingSeparator(const std::string& gs);
94 
95  private:
96 
97  /** @name Not Allowed Methods
98  * No copy allowed.
99  */
100  //@{
101 
102  /*!
103  \brief No copy constructor allowed.
104 
105  \param rhs The other object.
106  */
107  FormatNumber(const FormatNumber& rhs);
108 
109  /*!
110  \brief No assignment operator allowed.
111 
112  \param rhs The other object.
113 
114  \return A reference for this.
115  */
116  FormatNumber& operator=(const FormatNumber& rhs);
117 
118  //@}
119 
120  private:
121 
122  ParameterValue* m_numericValue; //!< Mandatory.
123  std::string m_pattern; //!< Mandatory.
124  std::string m_negativePattern; //!< Optional.
125  std::string m_decimalPoint; //!< Optional. Default: ".".
126  std::string m_groupingSeparator; //!< Optional. Default: ",".
127  };
128 
129  } // end namespace se
130 } // end namespace te
131 
132 #endif // __TERRALIB_SE_INTERNAL_FORMATNUMBER_H
Symbology Encoding functions.
Definition: Function.h:65
ParameterValue * m_numericValue
Mandatory.
Definition: FormatNumber.h:122
std::string m_negativePattern
Optional.
Definition: FormatNumber.h:124
The "ParameterValueType" uses WFS-Filter expressions to give values for SE graphic parameters...
Numeric formatting function.
Definition: FormatNumber.h:52
URI C++ Library.
#define TESEEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:187
Symbology Encoding functions.
std::string m_groupingSeparator
Optional. Default: ",".
Definition: FormatNumber.h:126
std::string m_decimalPoint
Optional. Default: ".".
Definition: FormatNumber.h:125
std::string m_pattern
Mandatory.
Definition: FormatNumber.h:123