Loading...
Searching...
No Matches
SubdividerTilling.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 SubdividerTilling.h
22
23 \brief Algorithm to help tilling a box from a given resolution
24
25 \ingroup vp
26 */
27
28#ifndef __TERRALIB_VP_INTERNAL_SUBDIVIDERTILLING_H
29#define __TERRALIB_VP_INTERNAL_SUBDIVIDERTILLING_H
30
31// Terralib
32#include "Config.h"
33
34#include "../geometry/Envelope.h"
35
36#include <cstdio>
37
38namespace te
39{
40 namespace gm
41 {
42 class Envelope;
43 class LineString;
44 }
45
46 namespace vp
47 {
48 /*!
49 \class SubdividerTilling
50
51 \brief Algorithm to help controlling creating and iterating in a tile
52 */
54 {
55 public:
56
58 {
59 TOP, BOTTOM, LEFT, RIGHT, MIDDLE_VERTICAL, MIDDLE_HORIZONTAL
60 };
61
62 /*!
63 * \brief Constructor
64 *
65 * \param envelope The envelope to be used for tilling
66 * \param resolution The resolution of each tile
67 */
68 SubdividerTilling(const te::gm::Envelope& envelope, double resolutionX, double resolutionY);
69
70 //!< Destructor
71 ~SubdividerTilling() = default;
72
73 /*!
74 * \brief Returns the number of columns of the tilling
75 *
76 * \return The number of columns of the tilling
77 */
78 std::size_t getNumColumns() const;
79
80 /*!
81 * \brief Returns the number of rows of the tilling
82 *
83 * \return The number of rows of the tilling
84 */
85 std::size_t getNumRows() const;
86
87 /*!
88 * \brief Returns the number of tiles of the tilling
89 *
90 * \return The number of tiles of the tilling
91 */
92 std::size_t getNumTiles() const;
93
94 /*!
95 * \brief Returns the tile located in the given row and column
96 *
97 * \return The tile located in the given row and column
98 */
99 te::gm::Envelope getTile(std::size_t column, std::size_t row) const;
100
101 //!< Find the tile column index where the given coordinate is located
102 std::size_t getTileColumn(const te::gm::Coord2D& coord) const;
103
104 //!< Find the tile row index where the given coordinate is located
105 std::size_t getTileRow(const te::gm::Coord2D& coord) const;
106
107 /*!
108 * \brief Returns the split line located in the given envelope and line position
109 *
110 * \return The split line located in the given envelope and position
111 */
113
114 /*!
115 * \brief Returns the split line located in the given row, column and position
116 *
117 * \return The split line located in the given row, column and position
118 */
119 te::gm::LineString getSplitLine(std::size_t column, std::size_t row, SplitLinePosition position) const;
120
121 /*!
122 * \brief Returns the i-th tile
123 *
124 * \return The i-th tile
125 */
126 te::gm::Envelope getTileN(std::size_t i) const;
127
128 protected:
129
130 te::gm::Envelope m_envelope; //!< The reference envelope
131 double m_resolutionX; //!< The resolution of the tilling in the x-axis
132 double m_resolutionY; //!< The resolution of the tilling in the y-axis
133 std::size_t m_numColumns; //!< The number of columns of the tilling
134 std::size_t m_numRows; //!< The number of rows of the tilling
135 };
136 }
137}
138
139#endif //__TERRALIB_VP_INTERNAL_SUBDIVIDERTILLING_H
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:52
LineString is a curve with linear interpolation between points.
Definition: LineString.h:65
Algorithm to help controlling creating and iterating in a tile.
std::size_t getTileColumn(const te::gm::Coord2D &coord) const
Find the tile row index where the given coordinate is located.
SubdividerTilling(const te::gm::Envelope &envelope, double resolutionX, double resolutionY)
Constructor.
te::gm::LineString getSplitLine(std::size_t column, std::size_t row, SplitLinePosition position) const
Returns the split line located in the given row, column and position.
std::size_t m_numColumns
The number of columns of the tilling.
double m_resolutionX
The resolution of the tilling in the x-axis.
te::gm::Envelope getTile(std::size_t column, std::size_t row) const
Returns the tile located in the given row and column.
double m_resolutionY
The resolution of the tilling in the y-axis.
std::size_t getTileRow(const te::gm::Coord2D &coord) const
std::size_t m_numRows
The number of rows of the tilling.
std::size_t getNumColumns() const
Returns the number of columns of the tilling.
std::size_t getNumTiles() const
Returns the number of tiles of the tilling.
static te::gm::LineString getSplitLine(const te::gm::Envelope &tile, SplitLinePosition position)
Returns the split line located in the given envelope and line position.
te::gm::Envelope getTileN(std::size_t i) const
Returns the i-th tile.
std::size_t getNumRows() const
Returns the number of rows of the tilling.
te::gm::Envelope m_envelope
The reference envelope.
TerraLib.
An utility struct for representing 2D coordinates.
Definition: Coord2D.h:41
#define TEVPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:61
Proxy configuration file for TerraView (see terraview_config.h).