EWKBReader.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/sqlite/EWKBReader.h
22 
23  \brief An utility class for reading a SpatiaLite EWKB geometry.
24 */
25 
26 #ifndef __TERRALIB_SQLITE_INTERNAL_EWKBREADER_H
27 #define __TERRALIB_SQLITE_INTERNAL_EWKBREADER_H
28 
29 // TerraLib
30 #include "../common/Static.h"
31 #include "Config.h"
32 
33 // Forward declarations
34 #include "../geometry_fw.h"
35 
36 #ifdef TE_ENABLE_SPATIALITE
37 
38 namespace te
39 {
40  namespace sqlite
41  {
42  class EWKBReader : public te::common::Static
43  {
44  public:
45 
46  static te::gm::Geometry* read(const unsigned char* ewkb);
47 
48  static te::gm::Geometry* readHex(const unsigned char* hewkb);
49 
50  private:
51 
52  static te::gm::Geometry* getGeometry(const unsigned char* ewkb,
53  const unsigned char** endptr,
54  unsigned char ewkbByteOrder,
55  int srid,
56  te::gm::Envelope* mbr);
57 
58  static te::gm::Point* getPoint(const unsigned char* ewkb,
59  const unsigned char** endptr,
60  unsigned char ewkbByteOrder,
61  unsigned int gtype,
62  int srid,
63  te::gm::Envelope* mbr);
64 
65  static te::gm::LineString* getLineString(const unsigned char* ewkb,
66  const unsigned char** endptr,
67  unsigned char ewkbByteOrder,
68  unsigned int gtype,
69  int srid,
70  te::gm::Envelope* mbr);
71 
72  static te::gm::LinearRing* getLinearRing(const unsigned char* ewkb,
73  unsigned int gtype,
74  const unsigned char** endptr,
75  unsigned char ewkbByteOrder,
76  int srid);
77 
78  static te::gm::Polygon* getPolygon(const unsigned char* ewkb,
79  const unsigned char** endptr,
80  unsigned char ewkbByteOrder,
81  unsigned int gtype,
82  int srid,
83  te::gm::Envelope* mbr);
84 
85  static te::gm::GeometryCollection* getGeometryCollection(const unsigned char* ewkb,
86  const unsigned char** endptr,
87  unsigned char ewkbByteOrder,
88  unsigned int gtype,
89  int srid,
90  te::gm::Envelope* mbr);
91  };
92 
93  } // end namespace sqlite
94 } // end namespace te
95 
96 #endif // TE_ENABLE_SPATIALITE
97 
98 #endif // __TERRALIB_SQLITE_INTERNAL_EWKBREADER_H
99 
Configuration flags for the SQLite Data Access driver.
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
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
URI C++ Library.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
An utility class for reading a TerraLib 4.x geometry.
It is a collection of other geometric objects.
A base type for static classes.
Definition: Static.h:43