binding/v8/jsi/geometry/Geometry.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 Geometry.h
22 
23  \brief JavaScript exporting routine for the TerraLib Geometry module.
24  */
25 
26 #ifndef __TERRALIB_BINDING_V8_JSI_GEOMETRY_INTERNAL_GEOMETRY_H
27 #define __TERRALIB_BINDING_V8_JSI_GEOMETRY_INTERNAL_GEOMETRY_H
28 
29 // TerraLib
30 #include "../Config.h"
31 
32 // Google V8
33 #include <v8.h>
34 
35 namespace te
36 {
37 // Forward declaration
38  namespace gm { class Geometry; }
39 
40  namespace v8
41  {
42  namespace jsi
43  {
44  /*!
45  \brief It register the Coord2D class.
46 
47  You can use the Coord2D class like:
48  \code
49  var c = new TeCoord2D(1.0, 2.0);
50  \endcode
51 
52  \param global The global object that will be used to register the Coord2D class
53 
54  \exception Exception It may throws an exception if it is not possible to register the class.
55  */
56  void RegisterCoord2D(::v8::Local<::v8::Object>& global);
57 
58  /*!
59  \brief It returns a reference to the persistent template of a Coord2D object.
60 
61  \return A reference to the persistent template of a Coord2D object.
62  */
63  ::v8::Persistent<::v8::FunctionTemplate>& GetCoord2DTemplate();
64 
65  /*!
66  \brief It register the Envelope class.
67 
68  You can use the Envelope class like:
69  \code
70  var e = new TeEnvelope(1.0, 1.0, 5.0, 5.0);
71  \endcode
72 
73  \param global The global object that will be used to register the Envelope class
74 
75  \exception Exception It may throws an exception if it is not possible to register the class.
76  */
77  void RegisterEnvelope(::v8::Local<::v8::Object>& global);
78 
79  /*!
80  \brief It returns a reference to the persistent template of a Envelope object.
81 
82  \return A reference to the persistent template of a Envelope object.
83  */
84  ::v8::Persistent<::v8::FunctionTemplate>& GetEnvelopeTemplate();
85 
86  /*!
87  \brief It registers the GeometryFactory class.
88 
89  You can use the GeometryFactory class as a singleton using the following syntax:
90  \code
91  var mygeom = TeGeometryFactory.make(TE_OGC_POINT, srid);
92  \endcode
93 
94  \param global The global object that will be used to register the GeometryFactory class
95 
96  \exception Exception It may throws an exception if it is not possible to register the class.
97  */
98  void RegisterGeometryFactory(::v8::Local<::v8::Object>& global);
99 
100  /*!
101  \brief It register a singleton for the Geometry class.
102 
103  You can use the GeometryFactory class like:
104  \code
105  var mygeom = TeGeometry.getGeomFromWKB(wkb);
106  \endcode
107 
108  \param global The global object that will be used to register the Geometry class
109 
110  \exception Exception It may throws an exception if it is not possible to register the class.
111  */
112  void RegisterGeometry(::v8::Local<::v8::Object>& global);
113 
114  /*!
115  \brief It returns a reference to the persistent template of a Geometry object.
116 
117  \return A reference to the persistent template of a Geometry object.
118  */
119  ::v8::Persistent<::v8::FunctionTemplate>& GetGeometryTemplate();
120 
121  /*!
122  \brief Given a C++ geometry this function creates a new JavaScript geometry cast to the right geometry subtype.
123 
124  \param g The C++ geometry object. The caller will loose the ownership of the given geometry.
125 
126  \return A JavaScript geometry object.
127  */
128  ::v8::Local<::v8::Object> Geometry_Make(te::gm::Geometry* g, const bool isOwner);
129 
130  /*!
131  \brief It register the Point class.
132 
133  You can use the Point class like:
134  \code
135  var mypt = new TePoint(1.0, 2.0, 4326);
136  \endcode
137 
138  \param global The global object that will be used to register the Point class
139 
140  \exception Exception It may throws an exception if it is not possible to register the class.
141  */
142  void RegisterPoint(::v8::Local<::v8::Object>& global);
143 
144  /*!
145  \brief It returns a reference to the persistent template of a Point object.
146 
147  \return A reference to the persistent template of a Point object.
148  */
149  ::v8::Persistent<::v8::FunctionTemplate>& GetPointTemplate();
150 
151  /*!
152  \brief It returns a reference to the persistent template of a Surface object.
153 
154  \return A reference to the persistent template of a Surface object.
155  */
156  ::v8::Persistent<::v8::FunctionTemplate>& GetSurfaceTemplate();
157 
158  /*!
159  \brief It register the Polygon class.
160 
161  You can use the Polygon class like:
162  \code
163  var mypoly = new TePolygon(2, TE_OGC_POLYGON, 4326);
164  \endcode
165 
166  \param global The global object that will be used to register the Polygon class
167 
168  \exception Exception It may throws an exception if it is not possible to register the class.
169  */
170  void RegisterPolygon(::v8::Local<::v8::Object>& global);
171 
172  /*!
173  \brief It returns a reference to the persistent template of a Polygon object.
174 
175  \return A reference to the persistent template of a Polygon object.
176  */
177  ::v8::Persistent<::v8::FunctionTemplate>& GetPolygonTemplate();
178 
179  /*!
180  \brief It returns a reference to the persistent template of a Curve object.
181 
182  \return A reference to the persistent template of a Curve object.
183  */
184  ::v8::Persistent<::v8::FunctionTemplate>& GetCurveTemplate();
185 
186  /*!
187  \brief It register the LineString class.
188 
189  You can use the LineString class like:
190  \code
191  var mygc = new TeLineString(2, TE_OGC_LINESTRING, 4326);
192  \endcode
193 
194  \param global The global object that will be used to register the LineString class
195 
196  \exception Exception It may throws an exception if it is not possible to register the class.
197  */
198  void RegisterLineString(::v8::Local<::v8::Object>& global);
199 
200  /*!
201  \brief It returns a reference to the persistent template of a LineString object.
202 
203  \return A reference to the persistent template of a LineString object.
204  */
205  ::v8::Persistent<::v8::FunctionTemplate>& GetLineStringTemplate();
206 
207  /*!
208  \brief It register the LinearRing class.
209 
210  You can use the LinearRing class like:
211  \code
212  var mygc = new LinearRing(2, TE_OGC_LINESTRING, 4326);
213  \endcode
214 
215  \param global The global object that will be used to register the LinearRing class
216 
217  \exception Exception It may throws an exception if it is not possible to register the class.
218  */
219  void RegisterLinearRing(::v8::Local<::v8::Object>& global);
220 
221  /*!
222  \brief It returns a reference to the persistent template of a LinearRing object.
223 
224  \return A reference to the persistent template of a LinearRing object.
225  */
226  ::v8::Persistent<::v8::FunctionTemplate>& GetLinearRingTemplate();
227 
228  /*!
229  \brief It register the GeometryCollection class.
230 
231  You can use the GeometryCollection class like:
232  \code
233  var mygc = new TeGeometryCollection(2, TE_OGC_GEOMETRYCOLLECTION, 4326);
234  \endcode
235 
236  \param global The global object that will be used to register the GeometryCollection class
237 
238  \exception Exception It may throws an exception if it is not possible to register the class.
239  */
240  void RegisterGeometryCollection(::v8::Local<::v8::Object>& global);
241 
242  /*!
243  \brief It returns a reference to the persistent template of a GeometryCollection object.
244 
245  \return A reference to the persistent template of a GeometryCollection object.
246  */
247  ::v8::Persistent<::v8::FunctionTemplate>& GetGeometryCollectionTemplate();
248 
249  /*!
250  \brief It returns a reference to the persistent template of a MultiSurface object.
251 
252  \return A reference to the persistent template of a MultiSurface object.
253  */
254  ::v8::Persistent<::v8::FunctionTemplate>& GetMultiSurfaceTemplate();
255 
256  /*!
257  \brief It returns a reference to the persistent template of a MultiCurve object.
258 
259  \return A reference to the persistent template of a MultiCurve object.
260  */
261  ::v8::Persistent<::v8::FunctionTemplate>& GetMultiCurveTemplate();
262 
263  /*!
264  \brief It register the MultiPoint class.
265 
266  You can use the MultiPoint class like:
267  \code
268  var mympt = new TeMultiPoint(2, TE_OGC_MULTIPOINT, 4326);
269  \endcode
270 
271  \param global The global object that will be used to register the Point class
272 
273  \exception Exception It may throws an exception if it is not possible to register the class.
274  */
275  void RegisterMultiPoint(::v8::Local<::v8::Object>& global);
276 
277  /*!
278  \brief It returns a reference to the persistent template of a MultiPoint object.
279 
280  \return A reference to the persistent template of a MultiPoint object.
281  */
282  ::v8::Persistent<::v8::FunctionTemplate>& GetMultiPointTemplate();
283 
284  /*!
285  \brief It register the MultiLineString class.
286 
287  You can use the MultiLineString class like:
288  \code
289  var mygc = new TeMultiLineString(2, TE_OGC_MULTIINESTRING, 4326);
290  \endcode
291 
292  \param global The global object that will be used to register the MultiLineString class
293 
294  \exception Exception It may throws an exception if it is not possible to register the class.
295  */
296  void RegisterMultiLineString(::v8::Local<::v8::Object>& global);
297 
298  /*!
299  \brief It returns a reference to the persistent template of a MultiLineString object.
300 
301  \return A reference to the persistent template of a MultiLineString object.
302  */
303  ::v8::Persistent<::v8::FunctionTemplate>& GetMultiLineStringTemplate();
304 
305  /*!
306  \brief It register the MultiPolygon class.
307 
308  You can use the MultiPolygon class like:
309  \code
310  var mygc = new TeMultiPolygon(2, TE_OGC_MULTIPOLYGON, 4326);
311  \endcode
312 
313  \param global The global object that will be used to register the MultiPolygon class
314 
315  \exception Exception It may throws an exception if it is not possible to register the class.
316  */
317  void RegisterMultiPolygon(::v8::Local<::v8::Object>& global);
318 
319  /*!
320  \brief It returns a reference to the persistent template of a MultiPolygon object.
321 
322  \return A reference to the persistent template of a MultiPolygon object.
323  */
324  ::v8::Persistent<::v8::FunctionTemplate>& GetMultiPolygonTemplate();
325 
326 
327  } // end namespace jsi
328  } // end namespace v8
329 } // end namespace te
330 
331 #endif // __TERRALIB_BINDING_V8_JSI_GEOMETRY_INTERNAL_GEOMETRY_H
332 
::v8::Persistent<::v8::FunctionTemplate > & GetMultiPointTemplate()
It returns a reference to the persistent template of a MultiPoint object.
::v8::Persistent<::v8::FunctionTemplate > & GetPointTemplate()
It returns a reference to the persistent template of a Point object.
::v8::Persistent<::v8::FunctionTemplate > & GetLinearRingTemplate()
It returns a reference to the persistent template of a LinearRing object.
void RegisterMultiPoint(::v8::Local<::v8::Object > &global)
It register the MultiPoint class.
::v8::Persistent<::v8::FunctionTemplate > & GetMultiCurveTemplate()
It returns a reference to the persistent template of a MultiCurve object.
void RegisterPoint(::v8::Local<::v8::Object > &global)
It register the Point class.
::v8::Persistent<::v8::FunctionTemplate > & GetCoord2DTemplate()
It returns a reference to the persistent template of a Coord2D object.
Definition: Coord2D.cpp:144
void RegisterCoord2D(::v8::Local<::v8::Object > &global)
It register the Coord2D class.
Definition: Coord2D.cpp:133
::v8::Persistent<::v8::FunctionTemplate > & GetLineStringTemplate()
It returns a reference to the persistent template of a LineString object.
::v8::Persistent<::v8::FunctionTemplate > & GetEnvelopeTemplate()
It returns a reference to the persistent template of a Envelope object.
::v8::Persistent<::v8::FunctionTemplate > & GetMultiPolygonTemplate()
It returns a reference to the persistent template of a MultiPolygon object.
void RegisterGeometry(::v8::Local<::v8::Object > &global)
It register a singleton for the Geometry class.
URI C++ Library.
Definition: Attributes.h:37
void RegisterLinearRing(::v8::Local<::v8::Object > &global)
It register the LinearRing class.
::v8::Persistent<::v8::FunctionTemplate > & GetPolygonTemplate()
It returns a reference to the persistent template of a Polygon object.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
void RegisterMultiPolygon(::v8::Local<::v8::Object > &global)
It register the MultiPolygon class.
void RegisterPolygon(::v8::Local<::v8::Object > &global)
It register the Polygon class.
void RegisterMultiLineString(::v8::Local<::v8::Object > &global)
It register the MultiLineString class.
::v8::Persistent<::v8::FunctionTemplate > & GetGeometryTemplate()
It returns a reference to the persistent template of a Geometry object.
void RegisterLineString(::v8::Local<::v8::Object > &global)
It register the LineString class.
::v8::Local<::v8::Object > Geometry_Make(te::gm::Geometry *g, const bool isOwner)
Given a C++ geometry this function creates a new JavaScript geometry cast to the right geometry subty...
::v8::Persistent<::v8::FunctionTemplate > & GetCurveTemplate()
It returns a reference to the persistent template of a Curve object.
void RegisterGeometryFactory(::v8::Local<::v8::Object > &global)
It registers the GeometryFactory class.
void RegisterEnvelope(::v8::Local<::v8::Object > &global)
It register the Envelope class.
::v8::Persistent<::v8::FunctionTemplate > & GetMultiLineStringTemplate()
It returns a reference to the persistent template of a MultiLineString object.
::v8::Persistent<::v8::FunctionTemplate > & GetSurfaceTemplate()
It returns a reference to the persistent template of a Surface object.
::v8::Persistent<::v8::FunctionTemplate > & GetMultiSurfaceTemplate()
It returns a reference to the persistent template of a MultiSurface object.
::v8::Persistent<::v8::FunctionTemplate > & GetGeometryCollectionTemplate()
It returns a reference to the persistent template of a GeometryCollection object. ...
void RegisterGeometryCollection(::v8::Local<::v8::Object > &global)
It register the GeometryCollection class.