GeometrySubdivider.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/algorithms/GeometrySubdivider.h
22 
23  \brief This class contains functions to help subdivide a geometry into small parts
24  */
25 
26 #ifndef __TERRALIB_GEOMETRY_INTERNAL_GEOMETRYSUBDIVIDER_H
27 #define __TERRALIB_GEOMETRY_INTERNAL_GEOMETRYSUBDIVIDER_H
28 
29  // TerraLib
30 #include "../Config.h"
31 
32 #include "../CommonDataStructures.h"
33 
34 namespace te
35 {
36  namespace gm
37  {
38  class CellTilling;
39  class Geometry;
40  class GeometryPtr;
41 
42  /*!
43  \class GeometrySubdivider
44 
45  \brief This class contains functions to help subdivide a geometry into small parts
46  */
48  {
49  public:
50 
51  struct ColumnRow
52  {
53  ColumnRow(std::size_t column, std::size_t row)
54  : m_column(column)
55  , m_row(row)
56  {
57  }
58 
59  std::size_t m_column;
60  std::size_t m_row;
61  };
62 
63 
64  /*!
65  * \brief Constructor
66  */
68 
69  /*!
70  * \brief Destructor
71  */
73 
75 
76  static te::gm::GeometryVector subdivideByCellTilling(const te::gm::Geometry* geometry, const te::gm::CellTilling& cellTilling, std::vector<ColumnRow>& vecColumnRow);
77 
78  /*!
79  * \brief Subdivides the given geometry recursivelly using its envelope spplited in 4 parts until all the subparts have less then the given 'maxCoordinates' coordinates
80  *
81  * \param geometry The input geometry to be subdivided
82  * \param maxCoordinates The maximum nunber of coordinates of each part
83  *
84  * \return A vector containg all the subparts of the geometry
85  */
86  static te::gm::GeometryVector subdivideByMaxCoordinates(const te::gm::Geometry* geometry, std::size_t maxCoordinates);
87 
88  protected:
89 
90  static te::gm::Geometry* fixNoding(const te::gm::Geometry* geometry);
91 
93 
95 
96  static te::gm::GeometryVector subdivideByCellTillingImpl(const te::gm::Geometry* geometry, const te::gm::CellTilling& cellTilling, std::vector<ColumnRow>& vecColumnRow);
97 
98  /*!
99  * \brief Subdivides the given geometry recursivelly using its envelope spplited in 4 parts until all the subparts have less then the given 'maxCoordinates' coordinates
100  *
101  * \param geometry The input geometry to be subdivided
102  * \param maxCoordinates The maximum nunber of coordinates of each part
103  *
104  * \return A vector containg all the subparts of the geometry
105  */
106  static te::gm::GeometryVector subdivideByMaxCoordinatesImpl(const te::gm::Geometry* geometry, std::size_t maxCoordinates);
107 
108  /*!
109  * \brief Subdivides the given geometry recursivelly using its envelope spplited in 4 parts until all the subparts have less then the given 'maxCoordinates' coordinates
110  *
111  * \param geometry The input geometry to be subdivided
112  * \param envelope The envelope to be used to clip the geometry.
113  * \param maxCoordinates The maximum nunber of coordinates of each part
114  *
115  * \return A vector containg all the subparts of the geometry
116  */
117  static te::gm::GeometryVector subdivideByMaxCoordinatesImpl(const te::gm::Geometry* geometry, const te::gm::Envelope& envelope, std::size_t maxCoordinates);
118 
119  };
120  } //namespace gm
121 } //namespace te
122 
123 #endif // __TERRALIB_GEOMETRY_INTERNAL_GEOMETRYSUBDIVIDER_H
Algorithm to help controlling creating and iterating in a tile.
Definition: CellTilling.h:49
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
This class contains functions to help subdivide a geometry into small parts.
static te::gm::Geometry * fixNoding(const te::gm::Geometry *geometry)
static te::gm::GeometryVector subdivideByMaxCoordinates(const te::gm::Geometry *geometry, std::size_t maxCoordinates)
Subdivides the given geometry recursivelly using its envelope spplited in 4 parts until all the subpa...
static te::gm::GeometryVector subdivideByCellTilling(const te::gm::Geometry *geometry, const te::gm::CellTilling &cellTilling, std::vector< ColumnRow > &vecColumnRow)
static te::gm::GeometryPtr subdivideByClippingImpl(const te::gm::Geometry *geometry, const te::gm::Envelope &envelope)
static te::gm::GeometryVector subdivideByMaxCoordinatesImpl(const te::gm::Geometry *geometry, const te::gm::Envelope &envelope, std::size_t maxCoordinates)
Subdivides the given geometry recursivelly using its envelope spplited in 4 parts until all the subpa...
static te::gm::GeometryPtr subdivideByClipping(const te::gm::Geometry *geometry, const te::gm::Envelope &envelope)
static te::gm::GeometryVector subdivideByMaxCoordinatesImpl(const te::gm::Geometry *geometry, std::size_t maxCoordinates)
Subdivides the given geometry recursivelly using its envelope spplited in 4 parts until all the subpa...
static te::gm::GeometryVector subdivideByCellTillingImpl(const te::gm::Geometry *geometry, const te::gm::CellTilling &cellTilling, std::vector< ColumnRow > &vecColumnRow)
virtual ~GeometrySubdivider()
Destructor.
GeometrySubdivider()
Constructor.
static te::gm::GeometryVector fixNoding(const te::gm::GeometryVector &vecGeometries)
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
std::vector< te::gm::Geometry * > GeometryVector
TerraLib.
ColumnRow(std::size_t column, std::size_t row)
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76