WKBSize.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/WKBSize.h
22 
23  \brief A class that computes the number of bytes necessary to encode a geometry in WKB.
24 */
25 
26 #ifndef __TERRALIB_GEOMETRY_INTERNAL_WKBSIZE_H
27 #define __TERRALIB_GEOMETRY_INTERNAL_WKBSIZE_H
28 
29 // TerraLib
30 #include "Visitor.h"
31 
32 namespace te
33 {
34  namespace gm
35  {
36 
37  /*!
38  \class WKBSize
39 
40  \brief A class that computes the number of bytes necessary to encode a geometry in WKB.
41 
42  \sa WKBWriter
43  */
44  class TEGEOMEXPORT WKBSize : public Visitor
45  {
46  public:
47 
48  /*!
49  \brief It calculates the number of bytes required to encode the geometry in a WKB format.
50 
51  \param geom The geometry to calculate the WKB size.
52 
53  \return The number of bytes required to encode the geometry in a WKB format.
54  */
55  static std::size_t size(const Geometry* geom);
56 
57  /*!
58  \brief It calculates the number of bytes required to encode the geometry in a WKB format.
59 
60  \param geom The geometry to calculate the WKB size.
61 
62  \return The number of bytes required to encode the geometry in a WKB format.
63  */
64  static std::size_t size(const Geometry& geom);
65 
66  protected:
67 
68  void visit(const Curve& /*visited*/) {}
69  void visit(const Geometry& /*visited*/) {}
70  void visit(const GeometryCollection& visited);
71  void visit(const LinearRing& visited);
72  void visit(const LineString& visited);
73  void visit(const MultiCurve& /*visited*/) {}
74  void visit(const MultiLineString& visited);
75  void visit(const MultiPoint& visited);
76  void visit(const MultiPolygon& visited);
77  void visit(const MultiSurface& /*visited*/) {}
78  void visit(const Point& visited);
79  void visit(const Polygon& visited);
80  void visit(const PolyhedralSurface& visited);
81  void visit(const Surface& /*visited*/) {}
82  void visit(const TIN& visited);
83  void visit(const Triangle& visited);
84  void visit(const CircularString& /*visited*/) {}
85  void visit(const CompoundCurve& /*visited*/) {}
86  void visit(const CurvePolygon& /*visited*/) {}
87 
88  private:
89 
90  /*! \brief Not instantiable class. */
91  WKBSize();
92 
93  /*! \brief Destructor. */
94  ~WKBSize();
95 
96  private:
97 
98  std::size_t m_size; //!< A counter for the number of bytes required to store a given geometry in WKB.
99  };
100 
101  } // namespace gm
102 } // namespace te
103 
104 #endif // __TERRALIB_GEOMETRY_INTERNAL_WKBSIZE_H
PolyhedralSurface is a contiguous collection of polygons, which share common boundary segments...
void visit(const CircularString &)
Definition: WKBSize.h:84
MultiPolygon is a MultiSurface whose elements are Polygons.
Definition: MultiPolygon.h:50
Curve is an abstract class that represents 1-dimensional geometric objects stored as a sequence of co...
Definition: Curve.h:58
void visit(const CompoundCurve &)
Definition: WKBSize.h:85
A class that computes the number of bytes necessary to encode a geometry in WKB.
Definition: WKBSize.h:44
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76
TIN (triangulated irregular network) is a PolyhedralSurface consisting only of Triangle patches...
Definition: TIN.h:50
A LinearRing is a LineString that is both closed and simple.
Definition: LinearRing.h:53
void visit(const CurvePolygon &)
Definition: WKBSize.h:86
MultiPoint is a GeometryCollection whose elements are restricted to points.
Definition: MultiPoint.h:50
LineString is a curve with linear interpolation between points.
Definition: LineString.h:62
Triangle is a polygon with 3 distinct, non-collinear vertices and no interior boundary.
Definition: Triangle.h:50
A point with x and y coordinate values.
Definition: Point.h:50
URI C++ Library.
CompoundCurve is a curve that may have circular and linear segments.
Definition: CompoundCurve.h:53
CurvePolygon is a planar surface defined by 1 exterior boundary and 0 or more interior boundaries...
Definition: CurvePolygon.h:57
void visit(const MultiCurve &)
Definition: WKBSize.h:73
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:74
MultiLineString is a MultiCurve whose elements are LineStrings.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
MultiSurface is a class that represents a 2-dimensional GeometryCollection whose elements are surface...
Definition: MultiSurface.h:54
void visit(const MultiSurface &)
Definition: WKBSize.h:77
std::size_t m_size
A counter for the number of bytes required to store a given geometry in WKB.
Definition: WKBSize.h:98
void visit(const Surface &)
Definition: WKBSize.h:81
MultiCurve is a class that represents a 1-dimensional GeometryCollection whose elements are curves...
Definition: MultiCurve.h:50
It is a collection of other geometric objects.
void visit(const Curve &)
Definition: WKBSize.h:68
void visit(const Geometry &)
Definition: WKBSize.h:69
A visitor interface for the Geometry hierarchy.
CircularString is a curve with circular interpolation between points.
Surface is an abstract class that represents a 2-dimensional geometric objects.
Definition: Surface.h:54
A visitor interface for the Geometry hierarchy.
Definition: Visitor.h:44