Loading...
Searching...
No Matches
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/postgis/EWKBReader.h
22
23 \brief An utility class for reading a PostGIS EWKB.
24*/
25
26#ifndef __TERRALIB_POSTGIS_INTERNAL_EWKBREADER_H
27#define __TERRALIB_POSTGIS_INTERNAL_EWKBREADER_H
28
29// TerraLib
30#include "../common/Static.h"
31#include "../geometry/Enums.h"
32#include "Config.h"
33
34// Forward declarations
35#include "../geometry_fw.h"
36
37namespace te
38{
39 namespace pgis
40 {
41 /*!
42 \class EWKBReader
43
44 \brief An utility class for reading a PostGIS EWKB.
45 */
47 {
48 public:
49
50 /*!
51 \brief It returns a valid geometry from a given EWKB.
52
53 \param ewkb A valid EWKB geometry.
54
55 \return A geometry created from reading the EWKB. The caller of this method will take the ownership of the returned geometry.
56 */
57 static te::gm::Geometry* read(const char* ewkb);
58
59 /*!
60 \brief It returns a valid geometry from a given hex-encoded EWKB.
61
62 \param hewkb An hex-encoded EWKB geometry.
63
64 \return A geometry created from reading the HEWKB. The caller of this method will take the ownership of the returned geometry.
65 */
66 static te::gm::Geometry* readHex(const char* hewkb);
67
68 private:
69
70 static te::gm::Geometry* getGeometry(const char* ewkb, const char** endptr);
71
72 static te::gm::Point* getPoint(const char* ewkb, const char** endptr);
73
74 static te::gm::LineString* getLineString(const char* ewkb, const char** endptr);
75
76 static te::gm::LinearRing* getLinearRing(const char* ewkb, te::gm::GeomType t, int srid, char wkbByteOrder, const char** endptr);
77
78 static te::gm::Polygon* getPolygon(const char* ewkb, const char** endptr);
79
80 static te::gm::GeometryCollection* getGeometryCollection(const char* ewkb, const char** endptr);
81 };
82
83 } // end namespace pgis
84} // end namespace te
85
86#endif // __TERRALIB_POSTGIS_INTERNAL_EWKBREADER_H
A base type for static classes.
Definition: Static.h:44
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 LinearRing is a LineString that is both closed and simple.
Definition: LinearRing.h:54
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
An utility class for reading a PostGIS EWKB.
Definition: EWKBReader.h:47
static te::gm::GeometryCollection * getGeometryCollection(const char *ewkb, const char **endptr)
static te::gm::Geometry * readHex(const char *hewkb)
It returns a valid geometry from a given hex-encoded EWKB.
static te::gm::Point * getPoint(const char *ewkb, const char **endptr)
static te::gm::LinearRing * getLinearRing(const char *ewkb, te::gm::GeomType t, int srid, char wkbByteOrder, const char **endptr)
static te::gm::Geometry * read(const char *ewkb)
It returns a valid geometry from a given EWKB.
static te::gm::Geometry * getGeometry(const char *ewkb, const char **endptr)
static te::gm::LineString * getLineString(const char *ewkb, const char **endptr)
static te::gm::Polygon * getPolygon(const char *ewkb, const char **endptr)
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:42
TerraLib.
#define TEPGISEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:195
Proxy configuration file for TerraView (see terraview_config.h).