SAGA API
v9.6
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
//---------------------------------------------------------
63
CSG_Tool_Grid::CSG_Tool_Grid
(
void
)
64
:
CSG_Tool
()
65
{
66
m_pLock = NULL;
67
68
Parameters
.
Use_Grid_System
();
69
}
70
71
//---------------------------------------------------------
72
CSG_Tool_Grid::~CSG_Tool_Grid
(
void
)
73
{
74
Lock_Destroy
();
75
}
76
77
79
// //
81
82
//---------------------------------------------------------
83
bool
CSG_Tool_Grid::Set_System
(
const
CSG_Grid_System
&System)
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
//---------------------------------------------------------
99
bool
CSG_Tool_Grid::Set_Progress_Cells
(
sLong
Cell)
const
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
//---------------------------------------------------------
110
bool
CSG_Tool_Grid::Set_Progress_Rows
(
int
Row)
const
111
{
112
return
(
CSG_Tool::Set_Progress
((
double
)Row, (
double
)
Get_NY
() - 1.) );
113
}
114
115
117
// //
119
120
//---------------------------------------------------------
121
void
CSG_Tool_Grid::Lock_Create
(
void
)
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
(
134
SG_DATATYPE_Char
,
Get_NX
(),
Get_NY
(),
Get_Cellsize
(),
Get_XMin
(),
Get_YMin
()
135
);
136
}
137
}
138
}
139
140
//---------------------------------------------------------
141
void
CSG_Tool_Grid::Lock_Destroy
(
void
)
142
{
143
if
( m_pLock )
144
{
145
delete
(m_pLock);
146
147
m_pLock = NULL;
148
}
149
}
150
151
153
// //
154
// //
155
// //
157
158
//---------------------------------------------------------
CSG_Parameters::Get_Grid_System
CSG_Grid_System * Get_Grid_System(void) const
Definition:
parameters.h:1895
CSG_Tool::Parameters
CSG_Parameters Parameters
Definition:
tool.h:257
CSG_Tool_Grid::Lock_Create
void Lock_Create(void)
Definition:
tool_grid.cpp:121
CSG_Tool_Grid::Get_NY
int Get_NY(void) const
Definition:
tool.h:408
CSG_Grid_System
Definition:
grid.h:200
CSG_Tool_Grid::Lock_Destroy
void Lock_Destroy(void)
Definition:
tool_grid.cpp:141
CSG_Tool_Grid::Get_YMin
double Get_YMin(void) const
Definition:
tool.h:411
CSG_Tool
Definition:
tool.h:151
CSG_Tool_Grid::CSG_Tool_Grid
CSG_Tool_Grid(void)
Definition:
tool_grid.cpp:63
CSG_Grid_System::Create
bool Create(const CSG_Grid_System &System, int Precision=-1)
Definition:
grid_system.cpp:140
CSG_Grid::Get_System
const CSG_Grid_System & Get_System(void) const
Definition:
grid.h:533
tool.h
CSG_Tool_Grid::Set_System
bool Set_System(const CSG_Grid_System &System)
Definition:
tool_grid.cpp:83
CSG_Parameters::Use_Grid_System
bool Use_Grid_System(void)
Definition:
parameters.cpp:241
sLong
signed long long sLong
Definition:
api_core.h:158
CSG_Grid::Assign
virtual bool Assign(double Value=0.0)
Definition:
grid_operation.cpp:77
CSG_Tool::is_Progress
bool is_Progress(void) const
Definition:
tool.h:240
CSG_Tool_Grid::Set_Progress_Cells
virtual bool Set_Progress_Cells(sLong Cell) const
Definition:
tool_grid.cpp:99
CSG_Tool_Grid::Set_Progress_Rows
virtual bool Set_Progress_Rows(int Row) const
Definition:
tool_grid.cpp:110
CSG_Tool_Grid::~CSG_Tool_Grid
virtual ~CSG_Tool_Grid(void)
Definition:
tool_grid.cpp:72
CSG_Tool_Grid::Get_NX
int Get_NX(void) const
Definition:
tool.h:407
CSG_Tool_Grid::Get_XMin
double Get_XMin(void) const
Definition:
tool.h:410
CSG_Tool::Set_Progress
virtual bool Set_Progress(int Position, int Range) const
Definition:
tool.cpp:660
CSG_Grid
Definition:
grid.h:475
CSG_Tool_Grid::Get_System
const CSG_Grid_System & Get_System(void) const
Definition:
tool.h:395
CSG_Tool_Grid::Get_NCells
sLong Get_NCells(void) const
Definition:
tool.h:409
CSG_Tool_Grid::Get_Cellsize
double Get_Cellsize(void) const
Definition:
tool.h:414
SG_DATATYPE_Char
@ SG_DATATYPE_Char
Definition:
api_core.h:996
saga_core
saga_api
tool_grid.cpp
Generated on Mon Sep 23 2024 14:13:04 for SAGA API by
1.8.19