SAGA API v9.10
Loading...
Searching...
No Matches
tool_grid.cpp
Go to the documentation of this file.
1
3// //
4// SAGA //
5// //
6// System for Automated Geoscientific Analyses //
7// //
8// Application Programming Interface //
9// //
10// Library: SAGA_API //
11// //
12//-------------------------------------------------------//
13// //
14// tool_grid.cpp //
15// //
16// Copyright (C) 2005 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 Goettingen //
44// Goldschmidtstr. 5 //
45// 37077 Goettingen //
46// Germany //
47// //
48// e-mail: oconrad@saga-gis.org //
49// //
51
52//---------------------------------------------------------
53#include "tool.h"
54
55
57// //
58// //
59// //
61
62//---------------------------------------------------------
64 : CSG_Tool()
65{
66 m_pLock = NULL;
67
68 Parameters.Use_Grid_System();
69}
70
71//---------------------------------------------------------
76
77
79// //
81
82//---------------------------------------------------------
84{
85 if( Parameters.Get_Grid_System() )
86 {
87 return( Parameters.Get_Grid_System()->Create(System) );
88 }
89
90 return( false );
91}
92
93
95// //
97
98//---------------------------------------------------------
100{
101 if( Get_System().is_Valid() )
102 {
103 return( CSG_Tool::Set_Progress((double)Cell, (double)Get_NCells() - 1.) );
104 }
105
106 return( is_Progress() );
107}
108
109//---------------------------------------------------------
111{
112 return( CSG_Tool::Set_Progress((double)Row, (double)Get_NY() - 1.) );
113}
114
115
117// //
119
120//---------------------------------------------------------
122{
123 if( Get_System().is_Valid() )
124 {
125 if( m_pLock && Get_System().is_Equal(m_pLock->Get_System()) )
126 {
127 m_pLock->Assign(0.0);
128 }
129 else
130 {
131 Lock_Destroy();
132
133 m_pLock = new CSG_Grid(
135 );
136 }
137 }
138}
139
140//---------------------------------------------------------
142{
143 if( m_pLock )
144 {
145 delete(m_pLock);
146
147 m_pLock = NULL;
148 }
149}
150
151
153// //
154// //
155// //
157
158//---------------------------------------------------------
signed long long sLong
Definition api_core.h:158
@ SG_DATATYPE_Char
Definition api_core.h:1000
virtual ~CSG_Tool_Grid(void)
Definition tool_grid.cpp:72
double Get_XMin(void) const
Definition tool.h:425
void Lock_Destroy(void)
void Lock_Create(void)
bool Set_System(const CSG_Grid_System &System)
Definition tool_grid.cpp:83
virtual bool Set_Progress_Rows(int Row) const
const CSG_Grid_System & Get_System(void) const
Definition tool.h:410
virtual bool Set_Progress_Cells(sLong Cell) const
Definition tool_grid.cpp:99
int Get_NX(void) const
Definition tool.h:422
CSG_Tool_Grid(void)
Definition tool_grid.cpp:63
double Get_YMin(void) const
Definition tool.h:426
double Get_Cellsize(void) const
Definition tool.h:429
int Get_NY(void) const
Definition tool.h:423
sLong Get_NCells(void) const
Definition tool.h:424
CSG_Parameters Parameters
Definition tool.h:256
virtual bool Set_Progress(int Position, int Range) const
Definition tool.cpp:660
CSG_Tool(void)
Definition tool.cpp:67
bool is_Progress(void) const
Definition tool.h:224