GeometryExamples.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 GeometryExamples.h
22 
23  \brief A set of geometry examples.
24  */
25 
26 #ifndef __TERRALIB_EXAMPLES_GEOMETRY_INTERNAL_GEOMETRYEXAMPLES_H
27 #define __TERRALIB_EXAMPLES_GEOMETRY_INTERNAL_GEOMETRYEXAMPLES_H
28 
29 // TerraLib
30 #include <terralib_buildconfig.h>
31 #include <terralib/geometry.h>
32 
33 /** @name Geometry constructors methods.
34  Methods used to create differentes types of geometries.
35  */
36 //@{
37 
38 /*
39  \brief It creates a Point 2D at (x, y).
40 
41  \param x The x coordinate
42  \param y The y coordinate
43 
44  \return A pointer to the created geometry point.
45  */
46 te::gm::Point* createPoint(const double& x, const double& y);
47 
48 /*
49 \brief It creates a Point 3D at (x, y, z).
50 
51 \param x The x coordinate
52 \param y The y coordinate
53 \param z The z coordinate
54 
55 \return A pointer to the created geometry point.
56 */
57 te::gm::Point* createPointZ(const double& x, const double& y, const double& z);
58 
59 /*
60  \brief It creates a Line 2D with initial coordinate at (xi, yi) and final coordinate (xf,yf).
61 
62  \param xi The initial point x coordinate
63  \param yi The initial point y coordinate
64  \param xf The final point x coordinate
65  \param yf The final point y coordinate
66 
67  \return A pointer to the created geometry line.
68  */
69 te::gm::LineString* createLineString(const double& xi, const double& yi,
70  const double& xf, const double& yf);
71 
72 /*
73  \brief It creates a Linear Ring that represents a square.
74 
75  \param xc The center point x coordinate
76  \param yc The center point y coordinate
77  \param size The size of square side.
78 
79  \return A pointer to the created geometry linear ring.
80  */
81 te::gm::LinearRing* createSquare(const double& xc, const double& yc, const double& size);
82 
83 /*
84  \brief It creates a Polygon that represents a square.
85 
86  \return A pointer to the created geometry polygon.
87  */
89 
90 /*
91  \brief It creates a Polygon that represents a square with hole.
92 
93  \return A pointer to the created geometry polygon.
94  */
96 
97 /*
98  \brief It creates a Geometry Collection that contains a point, a line, a polygon and a polygon with hole.
99 
100  \return A pointer to the created geometry collection.
101  */
103 
104 //@}
105 
106 /** @name Spatial relations methods.
107  Method used to calculate the spatial relation between geometries.
108  */
109 //@{
110 
111 /*
112  \brief This method calculates the spatial relation between two geometries.
113 
114  \param g1 The first geometry
115  \param g2 The second geometry
116  \param relation The spatial relation that will be evaluated.
117 
118  \return ture if the spatial relation is satisfied or false otherwise.
119  */
120 
122 
123 //@}
124 
125 /** @name Set operations methods.
126  Method used to execute set operations between geometries.
127  */
128 //@{
129 
130 /*
131  \brief This method executes the diferrence between two geometries.
132 
133  \param g1 The first geometry
134  \param g2 The second geometry
135 
136  \return a geometry representing the diferrence.
137  */
139 
140 /*
141  \brief This method executes the intersection between two geometries.
142 
143  \param g1 The first geometry
144  \param g2 The second geometry
145 
146  \return a geometry representing the intersection.
147  */
149 
150 /*
151  \brief This method executes the Union between two geometries.
152 
153  \param g1 The first geometry
154  \param g2 The second geometry
155 
156  \return a geometry representing the union.
157  */
159 
160 //@}
161 
162 /** @name Measurement operations methods.
163  Methods used to measurement some properties of geometries.
164  */
165 //@{
166 
167  // methods goes here
168 
169 //@}
170 
171 /** @name Wkt / Wkb manipulation methods.
172  Example methods that deal with Wkt and Wkb for geometries.
173  */
174 //@{
175 
176 /*
177  \brief Read a txt file that contains a set of Wkt geometries and convert each to the appropriate Geometry object.
178 
179  \param filePath The path to txt file that contains a set of Wkt geometries.
180  */
181 void readWkts(const std::string& filePath);
182 
183 //@}
184 
185 #endif // __TERRALIB_EXAMPLES_GEOMETRY_INTERNAL_GEOMETRYEXAMPLES_H
te::gm::LineString * createLineString(const double &xi, const double &yi, const double &xf, const double &yf)
SpatialRelation
Spatial relations between geometric objects.
void readWkts(const std::string &filePath)
Definition: Wkt.cpp:12
te::gm::LinearRing * createSquare(const double &xc, const double &yc, const double &size)
te::gm::Polygon * createPolygon()
te::gm::Geometry * intersection(te::gm::Geometry *g1, te::gm::Geometry *g2)
te::gm::Point * createPointZ(const double &x, const double &y, const double &z)
A LinearRing is a LineString that is both closed and simple.
Definition: LinearRing.h:53
LineString is a curve with linear interpolation between points.
Definition: LineString.h:62
A point with x and y coordinate values.
Definition: Point.h:50
te::gm::Point * createPoint(const double &x, const double &y)
te::gm::Geometry * difference(te::gm::Geometry *g1, te::gm::Geometry *g2)
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
te::gm::Polygon * createPolygonWithHole()
bool spatialRelation(te::gm::Geometry *g1, te::gm::Geometry *g2, te::gm::SpatialRelation relation)
te::gm::GeometryCollection * createGeometryCollection()
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
te::gm::Geometry * Union(te::gm::Geometry *g1, te::gm::Geometry *g2)
This file contains include headers for the Vector Geometry model of TerraLib.
It is a collection of other geometric objects.