GeometryProperty.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/geometry/GeometryProperty.h
22 
23  \brief Geometric property.
24 */
25 
26 #ifndef __TERRALIB_GEOMETRY_INTERNAL_GEOMETRYPROPERTY_H
27 #define __TERRALIB_GEOMETRY_INTERNAL_GEOMETRYPROPERTY_H
28 
29 // TerraLib
30 #include "../datatype/SimpleProperty.h"
31 #include "Config.h"
32 #include "Enums.h"
33 
34 
35 namespace te
36 {
37  namespace gm
38  {
39 // Forward declarations
40  class Envelope;
41 
42  /*!
43  \class GeometryProperty
44 
45  \brief Geometric property.
46 
47  \ingroup geometry
48 
49  \sa SimpleProperty
50  */
52  {
53  public:
54 
55  /** @name Basic Methods
56  * Basic methods on a GeometryProperty.
57  */
58  //@{
59 
60  /*!
61  \brief It constructs a new GeometryProperty.
62 
63  This constructor will set:
64  <ul>
65  <li>the associated SRS to 0;</li>
66  <li>the subtype of geometry to te::gm::UnknownGeometryProperty;</li>
67  <li>the coordinate dimension to 2;</li>
68  <li>the extent to NULL.</li>
69  </ul>
70 
71  \param name The geometric property name.
72  \param isRequired Tells if the the property is required (mandatory) or not.
73  \param defaultValue The default value to be used if none is informed.
74  \param id The property identifier.
75  \param parent A reference to the parent Property of the new object if it has one.
76 
77  \post The GeometryProperty will take the ownership of the defaultValue.
78 
79  \warning The identifier value (id) may be used by data source implementations. So, don't rely on its value!
80  */
81  GeometryProperty(const std::string& name,
82  bool isRequired = false,
83  std::string* defaultValue = 0,
84  unsigned int id = 0,
85  te::dt::Property* parent = 0);
86 
87  /*!
88  \brief It constructs a new GeometryProperty.
89 
90  \param name The geometric property name.
91  \param srid The SRS of the geometries.
92  \param t The subtype of geometries.
93  \param isRequired Indicates if the property is required (mandatory) or not.
94  \param defaultValue The default value to be used, if none is informed.
95  \param id The property identifier.
96  \param parent A reference to the parent Property of the new object if it has one.
97 
98  \post The GeometryProperty will take the ownership of the defaultValue.
99 
100  \warning The identifier value (id) may be used by data source implementations. So, don't rely on its value!
101  */
102  GeometryProperty(const std::string& name,
103  int srid,
104  te::gm::GeomType subtype,
105  bool isRequired = false,
106  std::string* defaultValue = 0,
107  unsigned int id = 0,
108  te::dt::Property* parent = 0);
109 
110  /*!
111  \brief Copy constructor.
112 
113  \param rhs The right-hand-side copy that would be used to copy from.
114  */
116 
117  /*! \brief Destructor. */
118  ~GeometryProperty();
119 
120  /*!
121  \brief It returns the spatial reference system identifier associated to this property.
122 
123  \return The SRS id associated to the property.
124  */
125  int getSRID() const { return m_srid; }
126 
127  /*!
128  \brief It sets the spatial reference system identifier associated to this property.
129 
130  \param srid The SRS id associated to the property.
131  */
132  void setSRID(int srid) { m_srid = srid; }
133 
134  /*!
135  \brief It returns the geometry subtype allowed for the property.
136 
137  \return The geometry subtype.
138  */
139  GeomType getGeometryType() const { return m_geomType; }
140 
141  /*!
142  \brief It sets the geometry subtype.
143 
144  \param t The geometry subtype.
145  */
146  void setGeometryType(GeomType t) { m_geomType = t; }
147 
148  //@}
149 
150  /** @name Implementation From Superclass Property
151  * Methods re-implemented from the superclass Property.
152  */
153  //@{
154 
155  /*!
156  \brief It returns a clone of the object.
157 
158  The new property will NOT have associations to other elements.
159 
160  \return A clone of the object.
161  */
162  te::dt::Property* clone() const;
163 
164  //@}
165 
166  private:
167 
168  /*!
169  \brief Assignment operator not allowed.
170 
171  \param rhs The right-hand-side copy that would be used to copy from.
172 
173  \return A reference to this object.
174  */
175  GeometryProperty& operator=(const GeometryProperty& rhs);
176 
177  protected:
178 
179  int m_srid; //!< The SRS associated to the property.
180  GeomType m_geomType; //!< The geometry type.
181  };
182 
183  } // end namespace gm
184 } // end namespace te
185 
186 #endif // __TERRALIB_GEOMETRY_INTERNAL_GEOMETRYPROPERTY_H
187 
Geometric property.
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:41
void setSRID(int srid)
It sets the spatial reference system identifier associated to this property.
void setGeometryType(GeomType t)
It sets the geometry subtype.
An atomic property like an integer or double.
It models a property definition.
Definition: Property.h:59
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76
Enumerations related to Geometry module.
int getSRID() const
It returns the spatial reference system identifier associated to this property.
GeomType m_geomType
The geometry type.
URI C++ Library.
GeomType getGeometryType() const
It returns the geometry subtype allowed for the property.
int m_srid
The SRS associated to the property.
Configuration flags for the Vector Geometry Model of TerraLib.