1 
2 ///////////////////////////////////////////////////////////
3 //                                                       //
4 //                         SAGA                          //
5 //                                                       //
6 //      System for Automated Geoscientific Analyses      //
7 //                                                       //
8 //           Application Programming Interface           //
9 //                                                       //
10 //                  Library: SAGA_API                    //
11 //                                                       //
12 //-------------------------------------------------------//
13 //                                                       //
14 //                    grid_pyramids.h                    //
15 //                                                       //
16 //          Copyright (C) 2009 by Olaf Conrad            //
17 //                                                       //
18 //-------------------------------------------------------//
19 //                                                       //
20 // This file is part of 'SAGA - System for Automated     //
21 // Geoscientific Analyses'.                              //
22 //                                                       //
23 // This library is free software; you can redistribute   //
24 // it and/or modify it under the terms of the GNU Lesser //
25 // General Public License as published by the Free       //
26 // Software Foundation, either version 2.1 of the        //
27 // License, or (at your option) any later version.       //
28 //                                                       //
29 // This library is distributed in the hope that it will  //
30 // be useful, but WITHOUT ANY WARRANTY; without even the //
31 // implied warranty of MERCHANTABILITY or FITNESS FOR A  //
32 // PARTICULAR PURPOSE. See the GNU Lesser General Public //
33 // License for more details.                             //
34 //                                                       //
35 // You should have received a copy of the GNU Lesser     //
36 // General Public License along with this program; if    //
37 // not, see <http://www.gnu.org/licenses/>.              //
38 //                                                       //
39 //-------------------------------------------------------//
40 //                                                       //
41 //    contact:    Olaf Conrad                            //
42 //                Institute of Geography                 //
43 //                University of Hamburg                  //
44 //                Bundesstr. 55                          //
45 //                20146 Hamburg                          //
46 //                Germany                                //
47 //                                                       //
48 //    e-mail:     oconrad@saga-gis.org                   //
49 //                                                       //
50 ///////////////////////////////////////////////////////////
51 
52 //---------------------------------------------------------
53 #ifndef HEADER_INCLUDED__SAGA_API__grid_pyramid_H
54 #define HEADER_INCLUDED__SAGA_API__grid_pyramid_H
55 
56 
57 ///////////////////////////////////////////////////////////
58 //														 //
59 //														 //
60 //														 //
61 ///////////////////////////////////////////////////////////
62 
63 //---------------------------------------------------------
64 /** \file grid_pyramid.h
65 * A class for the automated construction of pyramids for a
66 * given raster data set, i.e. a set of aggregated raster cell
67 * values for increasing raster cell sizes.
68 * @see CSG_Grid_Pyramid
69 */
70 
71 
72 ///////////////////////////////////////////////////////////
73 //														 //
74 //														 //
75 //														 //
76 ///////////////////////////////////////////////////////////
77 
78 //---------------------------------------------------------
79 #include "grid.h"
80 
81 
82 ///////////////////////////////////////////////////////////
83 //														 //
84 //														 //
85 //														 //
86 ///////////////////////////////////////////////////////////
87 
88 //---------------------------------------------------------
89 typedef enum ESG_Grid_Pyramid_Generalisation
90 {
91 	GRID_PYRAMID_Mean	= 0,
92 	GRID_PYRAMID_Max,
93 	GRID_PYRAMID_Min,
94 	GRID_PYRAMID_MaxCount
95 }
96 TSG_Grid_Pyramid_Generalisation;
97 
98 //---------------------------------------------------------
99 typedef enum ESG_Grid_Pyramid_Grow_Type
100 {
101 	GRID_PYRAMID_Arithmetic	= 0,
102 	GRID_PYRAMID_Geometric
103 }
104 TSG_Grid_Pyramid_Grow_Type;
105 
106 
107 ///////////////////////////////////////////////////////////
108 //														 //
109 //														 //
110 //														 //
111 ///////////////////////////////////////////////////////////
112 
113 //---------------------------------------------------------
114 class SAGA_API_DLL_EXPORT CSG_Grid_Pyramid
115 {
116 public:
117 	CSG_Grid_Pyramid(void);
118 
119 										CSG_Grid_Pyramid	(class CSG_Grid *pGrid, double Grow = 2.0, TSG_Grid_Pyramid_Generalisation Generalisation = GRID_PYRAMID_Mean, TSG_Grid_Pyramid_Grow_Type Grow_Type = GRID_PYRAMID_Geometric);
120 	bool								Create				(class CSG_Grid *pGrid, double Grow = 2.0, TSG_Grid_Pyramid_Generalisation Generalisation = GRID_PYRAMID_Mean, TSG_Grid_Pyramid_Grow_Type Grow_Type = GRID_PYRAMID_Geometric);
121 
122 										CSG_Grid_Pyramid	(class CSG_Grid *pGrid, double Grow, double Start, int nMaxLevels, TSG_Grid_Pyramid_Generalisation Generalisation = GRID_PYRAMID_Mean, TSG_Grid_Pyramid_Grow_Type Grow_Type = GRID_PYRAMID_Geometric);
123 	bool								Create				(class CSG_Grid *pGrid, double Grow, double Start, int nMaxLevels, TSG_Grid_Pyramid_Generalisation Generalisation = GRID_PYRAMID_Mean, TSG_Grid_Pyramid_Grow_Type Grow_Type = GRID_PYRAMID_Geometric);
124 
125 	virtual ~CSG_Grid_Pyramid(void);
126 
127 	bool								Destroy				(void);
128 
129 
Get_Count(void)130 	int									Get_Count			(void)			{	return( m_nLevels );	}
Get_Grid(int iLevel)131 	class CSG_Grid *					Get_Grid			(int iLevel)	{	return( iLevel >= 0 && iLevel < m_nLevels ? m_pLevels[iLevel] : m_pGrid );	}
132 
133 
134 private:
135 
136 	int									m_nLevels, m_nMaxLevels;
137 
138 	double								m_Grow;
139 
140 	TSG_Grid_Pyramid_Generalisation		m_Generalisation;
141 
142 	TSG_Grid_Pyramid_Grow_Type			m_Grow_Type;
143 
144 	class CSG_Grid						**m_pLevels, *m_pGrid;
145 
146 
147 	bool								_Get_Next_Level		(class CSG_Grid *pGrid);
148 	bool								_Get_Next_Level		(class CSG_Grid *pGrid, double Cellsize);
149 
150 };
151 
152 
153 ///////////////////////////////////////////////////////////
154 //														 //
155 //														 //
156 //														 //
157 ///////////////////////////////////////////////////////////
158 
159 //---------------------------------------------------------
160 #endif // #ifndef HEADER_INCLUDED__SAGA_API__grid_pyramid_H
161