Polygon.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/Polygon.h
22 
23  \brief Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
24 */
25 
26 #ifndef __TERRALIB_GEOMETRY_INTERNAL_POLYGON_H
27 #define __TERRALIB_GEOMETRY_INTERNAL_POLYGON_H
28 
29 // TerraLib
30 #include "CurvePolygon.h"
31 
32 namespace te
33 {
34  namespace gm
35  {
36  /*!
37  \class Polygon
38 
39  \brief Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
40 
41  \ingroup geometry
42 
43  \sa Geometry,
44  AbstractPoint, Point, PointM, PointZ, PointZM, PointKd,
45  Curve, LineString, LinearRing, Line, CircularString, CompoundCurve,
46  Surface, CurvePolygon, Triangle, PolyhedralSurface, TIN,
47  GeometryCollection, MultiSurface, MultiCurve,
48  MultiPoint, MultiLineString, MultiPolygon
49  */
51  {
52  public:
53 
55 
56  /** @name Initializer methods on geometric objects
57  * Methods for initializing a geometric object.
58  */
59  //@{
60 
61  /*!
62  \brief It initializes the Geometry with the specified spatial reference system id and envelope.
63 
64  \param nRings The number of rings forming the polygon.
65  \param t The internal type of the Geometry.
66  \param srid The Spatial Reference System ID associated to the Geometry.
67  \param mbr The minimum bounding rectangle of this geometry (i.e., its envelope). It may be a NULL value.
68 
69  \note The Geometry will take the ownership of the given mbr.
70 
71  \warning Set all nRing informed, otherwise you can not use methods like computeMBR().
72  */
73  Polygon(std::size_t nRings, GeomType t, int srid = 0, Envelope* mbr = 0);
74 
75  /*!
76  \brief Copy constructor.
77 
78  \param rhs The other geometry.
79  */
80  Polygon(const Polygon& rhs);
81 
82  /*! \brief Virtual destructor. */
83  virtual ~Polygon();
84 
85  /*!
86  \brief Assignment operator.
87 
88  \param rhs The other geometry.
89 
90  \return A reference for this.
91  */
92  virtual Polygon& operator=(const Polygon& rhs);
93 
94  //@}
95 
96  /** @name Re-Implementation from AbstractData
97  * Methods re-Implementated from AbstractData.
98  */
99  //@{
100 
101  /*!
102  \brief It clones the linestring.
103 
104  \return A copy of the given linestring.
105 
106  \note The caller of this method will take the ownership of the returned linestring.
107 
108  \note The cloned linestring will not have the
109  MBR computed. This will save time when you
110  are just cloning a geometry and don't intend
111  to waste time computing the bounding box.
112  If you have another suggestion, please, let me know.
113  */
114  virtual te::dt::AbstractData* clone() const;
115 
116  //@}
117 
118  /** @name Re-Implmentation of methods from Geometry class
119  * Re-Implmentation of basic methods from Geometry class.
120  */
121  //@{
122 
123  /*!
124  \brief It returns the name of the instantiable subtype of Geometry of which this geometric object is an instantiable member.
125 
126  The name of the Geometry subtype for Polygons is: Polygon.
127 
128  \return The name of the instantiable subtype of Geometry of which this geometric object is an instantiable member. In this case, it returns Polygon.
129  */
130  virtual const std::string& getGeometryType() const throw();
131 
132  //@}
133 
134  private:
135 
136  static const std::string sm_typeName; //! Geometry type name for Polygon.
137  };
138 
139  } // end namespace gm
140 } // end namespace te
141 
142 #endif // __TERRALIB_GEOMETRY_INTERNAL_POLYGON_H
143 
144 
145 
146 
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:41
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76
static const std::string sm_typeName
Definition: Polygon.h:136
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
CurvePolygon is a planar surface defined by 1 exterior boundary and 0 or more interior boundaries...
URI C++ Library.
CurvePolygon is a planar surface defined by 1 exterior boundary and 0 or more interior boundaries...
Definition: CurvePolygon.h:57
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
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50