Loading...
Searching...
No Matches
GEOSWriter.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/GEOSWriter.h
22
23 \brief A class that converts a TerraLib geometry to a GEOS geometry.
24*/
25
26#ifndef __TERRALIB_GEOMETRY_INTERNAL_GEOSWRITER_H
27#define __TERRALIB_GEOMETRY_INTERNAL_GEOSWRITER_H
28
29// TerraLib
30#include "../common/Static.h"
31#include "Config.h"
32
33// STL
34#include <vector>
35#include <memory>
36
37// Forward declaration
38namespace geos
39{
40 namespace geom
41 {
42 class CoordinateSequence;
43 class Envelope;
44 class Geometry;
45 class GeometryCollection;
46 class LinearRing;
47 class LineSegment;
48 class LineString;
49 class MultiLineString;
50 class MultiPoint;
51 class MultiPolygon;
52 class Point;
53 class Polygon;
54 } // end namespace geom
55} // end namespace geos
56
57namespace te
58{
59 namespace gm
60 {
61// Forward declaration
62 class Geometry;
63 class GeometryCollection;
64 class Line;
65 class LinearRing;
66 class LineString;
67 class MultiLineString;
68 class MultiPoint;
69 class MultiPolygon;
70 class Point;
71 class Polygon;
72 class Envelope;
73
74 /*!
75 \class GEOSWriter
76
77 \brief A class that converts a TerraLib geometry to a GEOS geometry.
78
79 \sa GEOSReader
80 */
82 {
83 public:
84
85 /*!
86 \brief It reads a TerraLib geometry and make a GEOS geometry.
87
88 \param teGeom The TerraLib geometry to be used to create the GEOS geometry.
89
90 \return A GEOS geometry. The client will take its ownership.
91
92 \exception It throws an exception if a conversion is not possible.
93 */
94 static geos::geom::Geometry* write(const Geometry* teGeom);
95
96 /*!
97 \brief It converts the TerraLib point to a GEOS point.
98
99 \param tePt The TerraLib point to be used to create the GEOS point.
100
101 \return A GEOS point geometry. The client will take it ownership.
102
103 \exception It throws an exception if a conversion is not possible.
104 */
105 static geos::geom::Point* write(const Point* tePt);
106
107 /*!
108 \brief It converts the TerraLib line string to a GEOS line string.
109
110 \param teLine The TerraLib line string to be used to create the GEOS line string.
111
112 \return A GEOS line string geometry. The client will take its ownership.
113
114 \exception It throws an exception if a conversion is not possible.
115 */
116 static geos::geom::LineString* write(const LineString* teLine);
117
118 /*!
119 \brief It converts the TerraLib linear ring to a GEOS linear ring.
120
121 \param teRing The TerraLib linear ring to be used to create the GEOS linear ring.
122
123 \return A GEOS linear ring geometry. The client will take its ownership.
124
125 \exception It throws an exception if a conversion is not possible.
126 */
127 static geos::geom::LinearRing* write(const LinearRing* teRing);
128
129 /*!
130 \brief It converts the TerraLib polygon to a GEOS polygon.
131
132 \param tePoly The TerraLib polygon to be used to create the GEOS polygon.
133
134 \return A GEOS polygon geometry. The client will take its ownership.
135
136 \exception It throws an exception if a conversion is not possible.
137 */
138 static geos::geom::Polygon* write(const Polygon* tePoly);
139
140 /*!
141 \brief It converts the TerraLib multi polygon to a GEOS multi polygon.
142
143 \param teMPoly The TerraLib multi polygon to be used to create the GEOS multi polygon.
144
145 \return A GEOS multi polygon geometry. The client will take its ownership.
146
147 \exception It throws an exception if a conversion is not possible.
148 */
149 static geos::geom::MultiPolygon* write(const MultiPolygon* teMPoly);
150
151 /*!
152 \brief It converts the TerraLib multi line string to a GEOS multi line string.
153
154 \param teMLine The TerraLib multi line string to be used to create the GEOS multi line string.
155
156 \return A GEOS multi line string geometry. The client will take its ownership.
157
158 \exception It throws an exception if a conversion is not possible.
159 */
160 static geos::geom::MultiLineString* write(const MultiLineString* teMLine);
161
162 /*!
163 \brief It converts the TerraLib multi point to a GEOS multi point.
164
165 \param teMPt The TerraLib multi point to be used to create the GEOS multi point.
166
167 \return A GEOS multi point geometry. The client will take its ownership.
168
169 \exception It throws an exception if a conversion is not possible.
170 */
171 static geos::geom::MultiPoint* write(const MultiPoint* teMPt);
172
173 /*!
174 \brief It converts the TerraLib Geometry Envelope to a GEOS Envelope.
175
176 \param teEnv The TerraLib Envelope to be used to create the GEOS Envelope.
177
178 \return A GEOS Envelope geometry. The client will take its ownership.
179
180 \exception It throws an exception if a conversion is not possible.
181 */
182 static geos::geom::Envelope* write(const Envelope* teEnv);
183 static geos::geom::LineSegment* write(const Line* teLine);
184
185 /*!
186 \brief It converts the TerraLib geometry collection to a GEOS geometry collection.
187
188 \param teGeomColl The TerraLib geometry collection to be used to create the GEOS geometry collection.
189
190 \return A GEOS geometry collection. The client will take its ownership.
191
192 \exception It throws an exception if a conversion is not possible.
193 */
194 static geos::geom::GeometryCollection* write(const GeometryCollection* teGeomColl);
195
196 protected:
197
198 /*!
199 \brief It creates a coordinate sequence from the input TerraLib line string (or TerraLib linear ring).
200
201 \param teLine The TerraLib line string to be used to create the GEOS coordinate sequence.
202
203 \return A GEOS coordinate sequence. The caller will take its ownership.
204 */
205 static geos::geom::CoordinateSequence* getCoordinateSequence(const LineString* teLine);
206
207 /*!
208 \brief It creates a vector of GEOS geometry from the input TerraLib geometry collection.
209
210 \param teGeomColl The TerraLib line string to be used to create the GEOS coordinate sequence.
211
212 \return A vector of GEOS geometry. The caller will take its ownership.
213 */
214 static std::vector<geos::geom::Geometry*>* getGeometries(const GeometryCollection* teGeomColl);
215
216 /*!
217 \brief It creates a vector of GEOS geometry from the input TerraLib geometry collection.
218
219 \param teGeomColl The TerraLib line string to be used to create the GEOS coordinate sequence.
220
221 \return A vector of GEOS geometry. The caller will take its ownership.
222 */
223 static std::vector<std::unique_ptr<geos::geom::Geometry>>
225
226 /*!
227 \brief Return polygon holes.
228
229 \param tePoly The TerraLib polygon.
230
231 \return A vector of GEOS LinearRing geometries. The caller will take its ownership.
232 */
233 static std::vector<std::unique_ptr<geos::geom::LinearRing>>
234 getPolygonHoles( const Polygon* tePoly );
235 };
236
237 } // end namespace gm
238} // end namespace te
239
240#endif // __TERRALIB_GEOMETRY_INTERNAL_GEOSWRITER_H
241
242
243
A base type for static classes.
Definition Static.h:44
An Envelope defines a 2D rectangular region.
Definition Envelope.h:52
A class that converts a TerraLib geometry to a GEOS geometry.
Definition GEOSWriter.h:82
static geos::geom::CoordinateSequence * getCoordinateSequence(const LineString *teLine)
It creates a coordinate sequence from the input TerraLib line string (or TerraLib linear ring).
static geos::geom::LinearRing * write(const LinearRing *teRing)
It converts the TerraLib linear ring to a GEOS linear ring.
static geos::geom::MultiLineString * write(const MultiLineString *teMLine)
It converts the TerraLib multi line string to a GEOS multi line string.
static geos::geom::Point * write(const Point *tePt)
It converts the TerraLib point to a GEOS point.
static geos::geom::GeometryCollection * write(const GeometryCollection *teGeomColl)
It converts the TerraLib geometry collection to a GEOS geometry collection.
static std::vector< geos::geom::Geometry * > * getGeometries(const GeometryCollection *teGeomColl)
It creates a vector of GEOS geometry from the input TerraLib geometry collection.
static geos::geom::Envelope * write(const Envelope *teEnv)
It converts the TerraLib Geometry Envelope to a GEOS Envelope.
static geos::geom::LineString * write(const LineString *teLine)
It converts the TerraLib line string to a GEOS line string.
static geos::geom::Geometry * write(const Geometry *teGeom)
It reads a TerraLib geometry and make a GEOS geometry.
static std::vector< std::unique_ptr< geos::geom::LinearRing > > getPolygonHoles(const Polygon *tePoly)
Return polygon holes.
static geos::geom::MultiPoint * write(const MultiPoint *teMPt)
It converts the TerraLib multi point to a GEOS multi point.
static geos::geom::Polygon * write(const Polygon *tePoly)
It converts the TerraLib polygon to a GEOS polygon.
static geos::geom::MultiPolygon * write(const MultiPolygon *teMPoly)
It converts the TerraLib multi polygon to a GEOS multi polygon.
static std::vector< std::unique_ptr< geos::geom::Geometry > > getGeometries(const GeometryCollection &teGeomColl)
It creates a vector of GEOS geometry from the input TerraLib geometry collection.
static geos::geom::LineSegment * write(const Line *teLine)
It is a collection of other geometric objects.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition Geometry.h:78
LineString is a curve with linear interpolation between points.
Definition LineString.h:65
A Line is LineString with 2 points.
Definition Line.h:51
A LinearRing is a LineString that is both closed and simple.
Definition LinearRing.h:54
MultiLineString is a MultiCurve whose elements are LineStrings.
MultiPoint is a GeometryCollection whose elements are restricted to points.
Definition MultiPoint.h:54
MultiPolygon is a MultiSurface whose elements are Polygons.
A point with x and y coordinate values.
Definition Point.h:51
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition Polygon.h:51
TerraLib.
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition Config.h:76
Proxy configuration file for TerraView (see terraview_config.h).