MultiSurface.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/MultiSurface.h
22 
23  \brief MultiSurface is a class that represents a 2-dimensional GeometryCollection whose elements are surfaces.
24 */
25 
26 #ifndef __TERRALIB_GEOMETRY_INTERNAL_MULTISURFACE_H
27 #define __TERRALIB_GEOMETRY_INTERNAL_MULTISURFACE_H
28 
29 // TerraLib
30 #include "Coord2D.h"
31 #include "GeometryCollection.h"
32 
33 namespace te
34 {
35  namespace gm
36  {
37 // Forward declarations
38  class Point;
39 
40  /*!
41  \class MultiSurface
42 
43  \brief MultiSurface is a class that represents a 2-dimensional GeometryCollection whose elements are surfaces.
44 
45  \ingroup geometry
46 
47  \sa Geometry,
48  Point,
49  Curve, LineString, LinearRing,
50  Surface, Polygon, Triangle, PolyhedralSurface, TIN,
51  GeometryCollection, MultiCurve,
52  MultiPoint, MultiLineString, MultiPolygon
53  */
55  {
56  public:
57 
59 
60  /*!
61  \brief It initializes the Geometry with the specified spatial reference system id and envelope.
62 
63  \param nGeom The number of geometries in the collection.
64  \param t The internal type of the Geometry.
65  \param srid The Spatial Reference System ID associated to the Geometry.
66  \param mbr The minimum bounding rectangle of this geometry (i.e., its envelope).
67 
68  \note The Geometry will take the ownership of the given mbr.
69  */
70  MultiSurface(std::size_t nGeom, GeomType t, int srid = 0, Envelope* mbr = 0);
71 
72  /*!
73  \brief Copy constructor.
74 
75  \param rhs The other geometry.
76  */
77  MultiSurface(const MultiSurface& rhs);
78 
79  /*! \brief Virtual destructor. */
80  virtual ~MultiSurface() { }
81 
82  /*!
83  \brief Assignment operator.
84 
85  \param rhs The other geometry.
86 
87  \return A reference for this.
88  */
89  virtual MultiSurface& operator=(const MultiSurface& rhs);
90 
91  /** @name Re-Implementation from AbstractData
92  * Methods re-Implementated from AbstractData.
93  */
94  //@{
95 
96  /*!
97  \brief It clones the multi surface.
98 
99  \return A copy of the given multi surface.
100 
101  \note The caller of this method will take the ownership of the returned multi surface.
102 
103  \note The cloned multi surface will not have the
104  MBR computed. This will save time when you
105  are just cloning a geometry and don't intend
106  to waste time computing the bounding box.
107  If you have another suggestion, please, let me know.
108  */
109  virtual te::dt::AbstractData* clone() const;
110 
111  //@}
112 
113  /** @name MultiSurface Specific Methods
114  * Specific methods for a MultiSurface.
115  */
116  //@{
117 
118  /*!
119  \brief It returns the area of this MultiSurface, as measured in the spatial reference system of this multisurface.
120 
121  \return The area of this multisurface.
122  */
123  double getArea() const;
124 
125  /*!
126  \brief It returns the mathematical centroid for this MultiSurface as a point.
127 
128  \return The mathematical centroid for this multisurface.
129 
130  \note The caller of this method will take the ownership of the returned point.
131 
132  \note The result is not guaranteed to be on this multisurface.
133  */
134  Point* getCentroid() const;
135 
136  /*!
137  \brief It returns the mathematical centroid for this MultiSurface as a coordinate.
138 
139  \return The mathematical centroid for this multisurface.
140 
141  \note The caller of this method will take the ownership of the returned coordinate.
142 
143  \note The result is not guaranteed to be on this multisurface.
144 
145  \note TerraLib extended method.
146  */
147  Coord2D* getCentroidCoord() const;
148 
149  /*!
150  \brief It returns a point guaranteed to be on this MultiSurface.
151 
152  \return A point guaranteed to be on this MultiSurface.
153 
154  \note The caller of this method will take the ownership of the returned point.
155  */
156  Point* getPointOnSurface() const;
157 
158  /*!
159  \brief It returns a coordinate guaranteed to be on this MultiSurface.
160 
161  \return A point guaranteed to be on this MultiSurface.
162 
163  \note The caller of this method will take the ownership of the returned coordinate.
164 
165  \note TerraLib extended method.
166  */
167  Coord2D* getCoordOnSurface() const;
168 
169  /*!
170  \brief It returns the length of the boundary for the surface.
171 
172  \return The length of the boundary for the surface.
173  */
174  double getPerimeter() const;
175 
176  //@}
177 
178  /** @name Re-Implmentation of methods from Geometry class
179  * Re-Implmentation of basic methods from Geometry class.
180  */
181  //@{
182 
183  /*!
184  \brief MultiSurface is 2-dimenional.
185 
186  \return 2-dimenional.
187  */
188  Dimensionality getDimension() const throw();
189 
190  //@}
191  };
192 
193  } // end namespace gm
194 } // end namespace te
195 
196 #endif // __TERRALIB_GEOMETRY_INTERNAL_MULTISURFACE_H
197 
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:41
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:40
virtual ~MultiSurface()
Virtual destructor.
Definition: MultiSurface.h:80
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76
A point with x and y coordinate values.
Definition: Point.h:50
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
Dimensionality
From Wikipedia: "in mathematics, the dimension of an object is an intrinsic property, independent of the space in which the object may happen to be embedded".
Definition: Enums.h:147
URI C++ Library.
A base class for values that can be retrieved from the data access module.
Definition: AbstractData.h:57
#define TE_DEFINE_VISITABLE
Definition: BaseVisitable.h:75
MultiSurface is a class that represents a 2-dimensional GeometryCollection whose elements are surface...
Definition: MultiSurface.h:54
It is a collection of other geometric objects.
An utility struct for representing 2D coordinates.
It is a collection of other geometric objects.