Loading...
Searching...
No Matches
CellTilling.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/CellTilling.h
22
23 \brief Algorithm to help controlling creating and iterating in a tile
24 */
25
26#ifndef __TERRALIB_GEOMETRY_INTERNAL_CELLTILLING_H
27#define __TERRALIB_GEOMETRY_INTERNAL_CELLTILLING_H
28
29 // TerraLib
30#include "../Config.h"
31
32//STL
33#include <cstdio>
34#include <memory>
35
36namespace te
37{
38 namespace gm
39 {
40 struct Coord2D;
41 class Envelope;
42
43 /*!
44 \class CellTilling
45
46 \brief Algorithm to help controlling creating and iterating in a tile
47 */
49 {
50 public:
51
52 /*!
53 * \brief Constructor
54 *
55 * \param envelope The envelope to be used for tilling
56 * \param resolution The resolution of each tile
57 */
58 CellTilling(const te::gm::Envelope& envelope, double resolutionX, double resolutionY);
59
60 //!< Destructor
62
63 /*!
64 * \brief Returns the number of columns of the tilling
65 *
66 * \return The number of columns of the tilling
67 */
68 std::size_t getNumColumns() const;
69
70 /*!
71 * \brief Returns the number of rows of the tilling
72 *
73 * \return The number of rows of the tilling
74 */
75 std::size_t getNumRows() const;
76
77 /*!
78 * \brief Returns the number of tiles of the tilling
79 *
80 * \return The number of tiles of the tilling
81 */
82 std::size_t getNumTiles() const;
83
84 /*!
85 * \brief Returns the tile located in the given row and column
86 *
87 * \return The tile located in the given row and column
88 */
89 te::gm::Envelope getTile(std::size_t column, std::size_t row) const;
90
91 //!< Find the tile column index where the given coordinate is located
92 std::size_t getTileColumn(const te::gm::Coord2D & coord) const;
93
94 //!< Find the tile row index where the given coordinate is located
95 std::size_t getTileRow(const te::gm::Coord2D & coord) const;
96
97 protected:
98
99 std::unique_ptr<te::gm::Envelope> m_envelope; //!< The reference envelope
100 double m_resolutionX; //!< The resolution of the tilling in the x-axis
101 double m_resolutionY; //!< The resolution of the tilling in the y-axis
102 std::size_t m_numColumns; //!< The number of columns of the tilling
103 std::size_t m_numRows; //!< The number of rows of the tilling
104 };
105 } //namespace gm
106} //namespace te
107
108#endif // __TERRALIB_GEOMETRY_INTERNAL_CELLTILLING_H
Algorithm to help controlling creating and iterating in a tile.
Definition: CellTilling.h:49
std::size_t m_numColumns
The number of columns of the tilling.
Definition: CellTilling.h:102
double m_resolutionY
The resolution of the tilling in the y-axis.
Definition: CellTilling.h:101
std::size_t getNumRows() const
Returns the number of rows of the tilling.
std::size_t getNumColumns() const
Returns the number of columns of the tilling.
CellTilling(const te::gm::Envelope &envelope, double resolutionX, double resolutionY)
Constructor.
std::size_t getTileRow(const te::gm::Coord2D &coord) const
std::unique_ptr< te::gm::Envelope > m_envelope
The reference envelope.
Definition: CellTilling.h:99
std::size_t getTileColumn(const te::gm::Coord2D &coord) const
Find the tile row index where the given coordinate is located.
double m_resolutionX
The resolution of the tilling in the x-axis.
Definition: CellTilling.h:100
te::gm::Envelope getTile(std::size_t column, std::size_t row) const
Returns the tile located in the given row and column.
std::size_t getNumTiles() const
Returns the number of tiles of the tilling.
std::size_t m_numRows
The number of rows of the tilling.
Definition: CellTilling.h:103
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
TerraLib.
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:41
#define TEGEOMEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:76