Surface.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/Surface.h
22 
23  \brief Surface is an abstract class that represents a 2-dimensional geometric objects.
24 */
25 
26 #ifndef __TERRALIB_GEOMETRY_INTERNAL_SURFACE_H
27 #define __TERRALIB_GEOMETRY_INTERNAL_SURFACE_H
28 
29 // TerraLib
30 #include "Geometry.h"
31 
32 namespace te
33 {
34  namespace gm
35  {
36 // Forward declarations
37  class Point;
38  struct Coord2D;
39 
40  /*!
41  \class Surface
42 
43  \brief Surface is an abstract class that represents a 2-dimensional geometric objects.
44 
45  \ingroup geometry
46 
47  \sa Geometry,
48  AbstractPoint, Point, PointM, PointZ, PointZM, PointKd,
49  Curve, LineString, LinearRing, Line, CircularString, CompoundCurve,
50  Polygon, Triangle, CurvePolygon, PolyhedralSurface, TIN,
51  GeometryCollection, MultiSurface, MultiCurve,
52  MultiPoint, MultiLineString, MultiPolygon
53  */
54  class TEGEOMEXPORT Surface : public Geometry
55  {
56  public:
57 
59 
60  /** @name Initializer methods on geometric objects
61  * Methods for initializing a geometric object.
62  */
63  //@{
64 
65  /*!
66  \brief It initializes the surface with the specified spatial reference system id and envelope.
67 
68  \param t The internal type of the surface.
69  \param srid The Spatial Reference System ID associated to the surface.
70  \param mbr The minimum bounding rectangle of this geometry (i.e., its envelope).
71 
72  \note The surface will take the ownership of the given mbr.
73  */
74  Surface(GeomType t, int srid = 0, Envelope* mbr = 0);
75 
76  /*!
77  \brief Copy constructor.
78 
79  \param rhs The other geometry.
80  */
81  Surface(const Surface& rhs);
82 
83  /*! \brief Virtual destructor. */
84  virtual ~Surface() { }
85 
86  /*!
87  \brief Assignment operator.
88 
89  \param rhs The other geometry.
90 
91  \return A reference for this.
92  */
93  virtual Surface& operator=(const Surface& rhs);
94 
95  //@}
96 
97  /** @name Re-Implmentation of methods from Geometry class
98  * Re-Implmentation of basic methods from Geometry class.
99  */
100  //@{
101 
102  /*!
103  \brief Surfaces are 2-dimensional objects.
104 
105  \return 2-dimensional.
106  */
107  Dimensionality getDimension() const throw();
108 
109  //@}
110 
111  /** @name Surface Specific Methods
112  * Specific methods for a Surface.
113  */
114  //@{
115 
116  /*!
117  \brief It returns the area of the surface measured in the spatial reference system of the surface.
118 
119  \return The area of the surface.
120  */
121  virtual double getArea() const = 0;
122 
123  /*!
124  \brief It returns the mathematical centroid for the surface as a point.
125 
126  \return The mathematical centroid for the surface.
127 
128  \note The caller of this method will take the ownership of the returned point.
129 
130  \note The result is not guaranteed to be on this Surface.
131  */
132  virtual Point* getCentroid() const = 0;
133 
134  /*!
135  \brief It returns the mathematical centroid for this surface as a coordinate.
136 
137  \return The mathematical centroid for this surface.
138 
139  \note The caller of this method will take the ownership of the returned coordinate.
140 
141  \note The result is not guaranteed to be on this Surface.
142 
143  \note TerraLib extended method.
144  */
145  virtual Coord2D* getCentroidCoord() const = 0;
146 
147  /*!
148  \brief It returns a point guaranteed to be on this surface.
149 
150  \return A point guaranteed to be on this surface.
151 
152  \note The caller of this method will take the ownership of the returned point.
153  */
154  virtual Point* getPointOnSurface() const = 0;
155 
156  /*!
157  \brief It returns a coordinate guaranteed to be on this surface.
158 
159  \return A point guaranteed to be on this surface.
160 
161  \note The caller of this method will take the ownership of the returned coordinate.
162 
163  \note TerraLib extended method.
164  */
165  virtual Coord2D* getCoordOnSurface() const = 0;
166 
167  /*!
168  \brief It returns the length of the boundary for the surface.
169 
170  \return The length of the boundary for the surface.
171  */
172  virtual double getPerimeter() const = 0;
173 
174  //@}
175  };
176 
177  } // end namespace gm
178 } // end namespace te
179 
180 #endif // __TERRALIB_GEOMETRY_INTERNAL_SURFACE_H
181 
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
#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.
#define TE_DEFINE_VISITABLE
Definition: BaseVisitable.h:75
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
virtual ~Surface()
Virtual destructor.
Definition: Surface.h:84
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Surface is an abstract class that represents a 2-dimensional geometric objects.
Definition: Surface.h:54