Loading...
Searching...
No Matches
GEOSReader.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/GEOSReader.h
22
23 \brief A class that converts a GEOS geometry to a TerraLib geometry.
24*/
25
26#ifndef __TERRALIB_GEOMETRY_INTERNAL_GEOSREADER_H
27#define __TERRALIB_GEOMETRY_INTERNAL_GEOSREADER_H
28
29// TerraLib
30#include "../common/Static.h"
31#include "Config.h"
32
33#ifdef TERRALIB_GEOS_ENABLED
34
35// Forward declaration
36namespace geos
37{
38 namespace geom
39 {
40 //class CoordinateSequence;
41 class Geometry;
42 class GeometryCollection;
43 class LinearRing;
44 class LineString;
45 class MultiLineString;
46 class MultiPoint;
47 class MultiPolygon;
48 class Point;
49 class Polygon;
50 } // end namespace geom
51} // end namespace geos
52
53namespace te
54{
55 namespace gm
56 {
57// Forward declaration
58 class Geometry;
59 class GeometryCollection;
60 class LinearRing;
61 class LineString;
62 class MultiLineString;
63 class MultiPoint;
64 class MultiPolygon;
65 class Point;
66 class Polygon;
67
68 /*!
69 \class GEOSReader
70
71 \brief A class that converts a GEOS geometry to a TerraLib geometry.
72
73 \sa GEOSWriter
74 */
75 class TEGEOMEXPORT GEOSReader : public te::common::Static
76 {
77 public:
78
79 /*!
80 \brief It reads a GEOS geometry and make a TerraLib geometry.
81
82 \param geosGeom The GEOS geometry to be used to create the TerraLib geometry.
83
84 \return A TerraLib geometry. The client will take its ownership.
85
86 \exception It throws an exception if a conversion is not possible.
87 */
88 static Geometry* read(const geos::geom::Geometry* geosGeom);
89
90 /*!
91 \brief It converts the GEOS point to a TerraLib point.
92
93 \param geosPt The GEOS point to be used to create the TerraLib point.
94
95 \return A TerraLib point geometry. The client will take its ownership.
96
97 \exception It throws an exception if a conversion is not possible.
98 */
99 static Point* read(const geos::geom::Point* geosPt);
100
101 /*!
102 \brief It converts the GEOS line string to a TerraLib line string.
103
104 \param geosLine The GEOS line string to be used to create the TerraLib line string.
105
106 \return A TerraLib line string geometry. The client will take its ownership.
107
108 \exception It throws an exception if a conversion is not possible.
109 */
110 static LineString* read(const geos::geom::LineString* geosLine);
111
112 /*!
113 \brief It converts the GEOS linear ring to a TerraLib linear ring.
114
115 \param geosRing The GEOS linear ring to be used to create the TerraLib linear ring.
116
117 \return A TerraLib linear ring geometry. The client will take its ownership.
118
119 \exception It throws an exception if a conversion is not possible.
120 */
121 static LinearRing* read(const geos::geom::LinearRing* geosRing);
122
123 /*!
124 \brief It converts the GEOS polygon to a TerraLib polygon.
125
126 \param geosPoly The GEOS polygon to be used to create the TerraLib polygon.
127
128 \return A TerraLib polygon geometry. The client will take its ownership.
129
130 \exception It throws an exception if a conversion is not possible.
131 */
132 static Polygon* read(const geos::geom::Polygon* geosPoly);
133
134 /*!
135 \brief It converts the GEOS multi polygon to a TerraLib multi polygon.
136
137 \param geosMPoly The GEOS multi polygon to be used to create the TerraLib multi polygon.
138
139 \return A TerraLib multi polygon geometry. The client will take its ownership.
140
141 \exception It throws an exception if a conversion is not possible.
142 */
143 static MultiPolygon* read(const geos::geom::MultiPolygon* geosMPoly);
144
145 /*!
146 \brief It converts the GEOS multi line string to a TerraLib multi line string.
147
148 \param geosMLine The GEOS multi line string to be used to create the TerraLib multi line string.
149
150 \return A TerraLib multi line string geometry. The client will take its ownership.
151
152 \exception It throws an exception if a conversion is not possible.
153 */
154 static MultiLineString* read(const geos::geom::MultiLineString* geosMLine);
155
156 /*!
157 \brief It converts the GEOS multi point to a TerraLib multi point.
158
159 \param geosMPt The GEOS multi point to be used to create the TerraLib multi point.
160
161 \return A TerraLib multi point geometry. The client will take its ownership.
162
163 \exception It throws an exception if a conversion is not possible.
164 */
165 static MultiPoint* read(const geos::geom::MultiPoint* geosMPt);
166
167 /*!
168 \brief It converts the GEOS geometry collection to a TerraLib geometry collection.
169
170 \param geosGeomColl The GEOS geometry collection to be used to create the TerraLib geometry collection.
171
172 \return A TerraLib geometry collection. The client will take its ownership.
173
174 \exception It throws an exception if a conversion is not possible.
175 */
176 static GeometryCollection* read(const geos::geom::GeometryCollection* geosGeomColl);
177
178 //protected:
179
180 /*!
181 \brief It sets the TerraLib line string coordinates using a GEOS coordinate sequence.
182
183 \param teLine The TerraLib line string to be used to create the GEOS coordinate sequence.
184 \param cs A GEOS coordinate sequence to be used to extract the TerraLib line string coordinates.
185 \param nPts The number of coordinates to be extracted from the coordinate sequence.
186
187 \note The TerraLib line string must have the same capacity (number of vertex) as the input GEOS coordinate sequence.
188 */
189 //static void setCoords(const LineString* teLine, geos::geom::CoordinateSequence* cs, std::size_t nPts) const;
190 };
191
192 } // end namespace gm
193} // end namespace te
194
195#endif // TERRALIB_GEOS_ENABLED
196
197#endif // __TERRALIB_GEOMETRY_INTERNAL_GEOSREADER_H
198
199
200
A base type for static classes.
Definition: Static.h:44
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).