SAGA API  v9.2
grids.h
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 // grids.h //
15 // //
16 // Copyright (C) 2017 by //
17 // Olaf Conrad //
18 // //
19 //-------------------------------------------------------//
20 // //
21 // This file is part of 'SAGA - System for Automated //
22 // Geoscientific Analyses'. //
23 // //
24 // This library is free software; you can redistribute //
25 // it and/or modify it under the terms of the GNU Lesser //
26 // General Public License as published by the Free //
27 // Software Foundation, either version 2.1 of the //
28 // License, or (at your option) any later version. //
29 // //
30 // This library is distributed in the hope that it will //
31 // be useful, but WITHOUT ANY WARRANTY; without even the //
32 // implied warranty of MERCHANTABILITY or FITNESS FOR A //
33 // PARTICULAR PURPOSE. See the GNU Lesser General Public //
34 // License for more details. //
35 // //
36 // You should have received a copy of the GNU Lesser //
37 // General Public License along with this program; if //
38 // not, see <http://www.gnu.org/licenses/>. //
39 // //
40 //-------------------------------------------------------//
41 // //
42 // e-mail: oconrad@saga-gis.org //
43 // //
44 // contact: Olaf Conrad //
45 // Institute of Geography //
46 // University of Hamburg //
47 // Germany //
48 // //
50 
51 //---------------------------------------------------------
52 #ifndef HEADER_INCLUDED__SAGA_API__grids_H
53 #define HEADER_INCLUDED__SAGA_API__grids_H
54 
55 
57 // //
58 // //
59 // //
61 
62 //---------------------------------------------------------
73 // //
75 // //
76 // //
78 
79 //---------------------------------------------------------
80 #include "grid.h"
81 
82 
84 // //
85 // CSG_Grids //
86 // //
88 
89 //---------------------------------------------------------
90 typedef enum
91 {
96 }
98 
99 //---------------------------------------------------------
100 #define SG_GRIDS_NAME_OWNER 0x01
101 #define SG_GRIDS_NAME_INDEX 0x02
102 #define SG_GRIDS_NAME_VALUE 0x04
103 #define SG_GRIDS_NAME_GRID 0x08
104 
105 
107 // //
108 // CSG_Grids //
109 // //
111 
112 //---------------------------------------------------------
117 //---------------------------------------------------------
119 {
120 //---------------------------------------------------------
121 public:
122 
123  //-----------------------------------------------------
124  CSG_Grids(void);
125  virtual ~CSG_Grids(void);
126 
127  CSG_Grids (const CSG_Grids &Grids);
128  virtual bool Create (const CSG_Grids &Grids);
129 
130  CSG_Grids (const CSG_Grids *pGrids, bool bCopyData = false);
131  virtual bool Create (const CSG_Grids *pGrids, bool bCopyData = false);
132 
133  CSG_Grids (const char *FileName, bool bLoadData = true);
134  virtual bool Create (const char *FileName, bool bLoadData = true);
135  CSG_Grids (const wchar_t *FileName, bool bLoadData = true);
136  virtual bool Create (const wchar_t *FileName, bool bLoadData = true);
137  CSG_Grids (const CSG_String &FileName, bool bLoadData = true);
138  virtual bool Create (const CSG_String &FileName, bool bLoadData = true);
139 
140  CSG_Grids (const CSG_Grid_System &System, int NZ = 0, double zMin = 0., TSG_Data_Type Type = SG_DATATYPE_Undefined);
141  virtual bool Create (const CSG_Grid_System &System, int NZ = 0, double zMin = 0., TSG_Data_Type Type = SG_DATATYPE_Undefined);
142 
143  CSG_Grids (const CSG_Grid_System &System, const CSG_Table &Attributes, int zAttribute = 0, TSG_Data_Type Type = SG_DATATYPE_Undefined, bool bCreateGrids = false);
144  virtual bool Create (const CSG_Grid_System &System, const CSG_Table &Attributes, int zAttribute = 0, TSG_Data_Type Type = SG_DATATYPE_Undefined, bool bCreateGrids = false);
145 
146  CSG_Grids (int NX, int NY, int NZ = 0, double Cellsize = 0., double xMin = 0., double yMin = 0., double zMin = 0., TSG_Data_Type Type = SG_DATATYPE_Undefined);
147  virtual bool Create (int NX, int NY, int NZ = 0, double Cellsize = 0., double xMin = 0., double yMin = 0., double zMin = 0., TSG_Data_Type Type = SG_DATATYPE_Undefined);
148 
149  virtual bool Destroy (void);
150 
151 
152  //-----------------------------------------------------
153  virtual bool Load (const CSG_String &File, bool bLoadData = true);
154 
155  virtual bool Save (const CSG_String &File, int Format = 0);
156  virtual bool Save (const char *File, int Format = 0) { return( Save(CSG_String(File), Format) ); }
157  virtual bool Save (const wchar_t *File, int Format = 0) { return( Save(CSG_String(File), Format) ); }
158 
159 
160  //-----------------------------------------------------
164 
165 
166  //-----------------------------------------------------
167  // Data-Info...
168 
169  TSG_Data_Type Get_Type (void) const { return( m_pGrids[0]->Get_Type() ); }
170 
171  int Get_nValueBytes (void) const { return( m_pGrids[0]->Get_nValueBytes() ); }
172  int Get_nLineBytes (void) const { return( m_pGrids[0]->Get_nLineBytes () ); }
173 
174  void Set_Unit (const CSG_String &Unit);
175  const SG_Char * Get_Unit (void) const { return( m_pGrids[0]->Get_Unit() ); }
176 
177 
178  //-----------------------------------------------------
179  // Georeference...
180 
181  const CSG_Grid_System & Get_System (void) const { return( m_pGrids[0]->Get_System() ); }
182 
183  virtual const CSG_Rect & Get_Extent (void) { return( Get_System().Get_Extent() ); }
184 
185  int Get_NX (void) const { return( m_pGrids[0]->Get_System().Get_NX() ); }
186  int Get_NY (void) const { return( m_pGrids[0]->Get_System().Get_NY() ); }
187  int Get_NZ (void) const { return( (int)m_Attributes.Get_Count() ); }
188  sLong Get_NCells (void) const { return( Get_System().Get_NCells() * Get_NZ() ); }
189  sLong Get_Data_Count (void);
190  sLong Get_NoData_Count (void);
191 
192  double Get_Cellsize (void) const { return( m_pGrids[0]->Get_System().Get_Cellsize() ); }
193  double Get_Cellarea (void) const { return( m_pGrids[0]->Get_System().Get_Cellarea() ); }
194 
195  const CSG_Rect & Get_Extent (bool bCells = false) const { return( m_pGrids[0]->Get_System().Get_Extent(bCells) ); }
196 
197  double Get_XMin (bool bCells = false) const { return( m_pGrids[0]->Get_System().Get_XMin (bCells) ); }
198  double Get_XMax (bool bCells = false) const { return( m_pGrids[0]->Get_System().Get_XMax (bCells) ); }
199  double Get_XRange (bool bCells = false) const { return( m_pGrids[0]->Get_System().Get_XRange(bCells) ); }
200 
201  double Get_YMin (bool bCells = false) const { return( m_pGrids[0]->Get_System().Get_YMin (bCells) ); }
202  double Get_YMax (bool bCells = false) const { return( m_pGrids[0]->Get_System().Get_YMax (bCells) ); }
203  double Get_YRange (bool bCells = false) const { return( m_pGrids[0]->Get_System().Get_YRange(bCells) ); }
204 
205  double Get_ZMin (bool bCells = false) const { return( m_Attributes.Get_Minimum(m_Z_Attribute) ); }
206  double Get_ZMax (bool bCells = false) const { return( m_Attributes.Get_Maximum(m_Z_Attribute) ); }
207  double Get_ZRange (bool bCells = false) const { return( m_Attributes.Get_Range (m_Z_Attribute) ); }
208 
209 
210  //-----------------------------------------------------
211  // Attributes...
212 
213  bool Add_Attribute (const CSG_String &Name, TSG_Data_Type Type, int iField = -1);
214  bool Del_Attribute (int iField);
215 
216  const CSG_Table & Get_Attributes (void) const { return( m_Attributes ); }
217  CSG_Table * Get_Attributes_Ptr (void) { return( &m_Attributes ); }
218 
219  CSG_Table_Record & Get_Attributes (int i) const { return( m_Attributes[i] ); }
220 
221  bool Set_Z_Attribute (int i);
222  int Get_Z_Attribute (void) const { return( m_Z_Attribute ); }
223 
224  bool Set_Z_Name_Field (int i);
225  int Get_Z_Name_Field (void) const;
226 
227  bool Set_Z (int i, double Value);
228  double Get_Z (int i) const { return( m_Attributes[i].asDouble(m_Z_Attribute) ); }
229 
230  bool Update_Z_Order (void);
231 
232 
233  //-----------------------------------------------------
234  // Grids...
235 
236  bool Set_Grid_Count (int Count);
237  int Get_Grid_Count (void) const { return( (int)m_Attributes.Get_Count() ); }
238 
239  bool Add_Grid (double Z);
240  bool Add_Grid (double Z, CSG_Grid *pGrid, bool bAttach = false);
241  bool Add_Grid (CSG_Table_Record &Attributes);
242  bool Add_Grid (CSG_Table_Record &Attributes, CSG_Grid *pGrid, bool bAttach = false);
243 
244  bool Del_Grid (int i, bool bDetach = false);
245  bool Del_Grids ( bool bDetach = false);
246 
247  const CSG_Grid & Get_Grid (int i) const { return( *m_pGrids[i] ); }
248  CSG_Grid * Get_Grid_Ptr (int i) const { return( m_pGrids[i] ); }
249  CSG_String Get_Grid_Name (int i, int Style = 0) const;
250 
251  sLong Get_Memory_Size (void) const { return( m_pGrids[0]->Get_Memory_Size() * Get_NZ() ); }
252 
253 
254  //-----------------------------------------------------
255  // Values...
256 
257  void Set_Scaling (double Scale = 1., double Offset = 0.);
258  double Get_Scaling (void) const { return( m_pGrids[0]->Get_Scaling() ); }
259  double Get_Offset (void) const { return( m_pGrids[0]->Get_Offset () ); }
260  bool is_Scaled (void) const { return( m_pGrids[0]->is_Scaled () ); }
261 
262  double Get_Mean (void);
263  double Get_Min (void);
264  double Get_Max (void);
265  double Get_Range (void);
266  double Get_StdDev (void);
267  double Get_Variance (void);
268  double Get_Quantile (double Quantile, bool bFromHistogram = true);
269  double Get_Percentile (double Percentile, bool bFromHistogram = true);
270 
271  const CSG_Simple_Statistics & Get_Statistics (void);
272  bool Get_Statistics (const CSG_Rect &rWorld, CSG_Simple_Statistics &Statistics, bool bHoldValues = false) const;
273 
274  const CSG_Histogram & Get_Histogram (size_t nClasses = 0);
275  bool Get_Histogram (const CSG_Rect &rWorld, CSG_Histogram &Histogram, size_t nClasses = 0) const;
276 
277  virtual bool Set_Max_Samples (sLong Max_Samples);
278 
279 
280  //-----------------------------------------------------
281  // Checks...
282 
283  virtual bool is_Valid (void) const;
284 
285  TSG_Intersection is_Intersecting (const CSG_Rect &Extent) const { return( m_pGrids[0]->is_Intersecting(Extent) ); }
286  TSG_Intersection is_Intersecting (const TSG_Rect &Extent) const { return( m_pGrids[0]->is_Intersecting(Extent) ); }
287  TSG_Intersection is_Intersecting (double xMin, double yMin, double xMax, double yMax) const { return( m_pGrids[0]->is_Intersecting(xMin, yMin, xMax, yMax) ); }
288 
289  bool is_Compatible (CSG_Grid *pGrid ) const;
290  bool is_Compatible (CSG_Grids *pGrids) const;
291  bool is_Compatible (const CSG_Grid_System &System) const;
292  bool is_Compatible (int NX, int NY, double Cellsize, double xMin, double yMin) const;
293 
294  bool is_InGrid (int x, int y, int z, bool bCheckNoData = true) const { return( Get_System().is_InGrid(x, y) && z >= 0 && z < Get_NZ() && (!bCheckNoData || !is_NoData(x, y, z)) ); }
295  bool is_InGrid_byPos (double x, double y, double z, bool bCheckNoData = true) const { return( Get_Extent(true).Contains(x, y) && z >= Get_ZMin() && z <= Get_ZMax() && (!bCheckNoData || !is_NoData(Get_System().Get_xWorld_to_Grid(x), Get_System().Get_yWorld_to_Grid(y), (int)z)) ); }
296  bool is_InGrid_byPos (const TSG_Point_3D &p, bool bCheckNoData = true) const { return( is_InGrid_byPos(p.x, p.y, p.z, bCheckNoData) ); }
297 
298 
299  //-----------------------------------------------------
300  // Set update flag when modified...
301 
302  virtual void Set_Modified (bool bModified = true)
303  {
305 
306  m_Attributes.Set_Modified(bModified);
307 
308  if( bModified )
309  {
310  Set_Update_Flag();
311  }
312  }
313 
314  virtual bool is_Modified (void) const
315  {
316  return( CSG_Data_Object::is_Modified() || m_Attributes.is_Modified() );
317  }
318 
319 
320  //-----------------------------------------------------
321  // Operations...
322 
323  void Assign_NoData (void);
324 
325  virtual bool Assign (double Value = 0.);
326  virtual bool Assign (CSG_Data_Object *pObject);
327  virtual bool Assign (CSG_Grids *pGrids, TSG_Grid_Resampling Interpolation);
328 
329 
330  //-----------------------------------------------------
331  // Operators...
332 
333  virtual CSG_Grids & operator = (const CSG_Grids &Grids);
334  virtual CSG_Grids & operator = (double Value );
335 
336  virtual CSG_Grids & operator += (double Value );
337  virtual CSG_Grids & Add (double Value );
338 
339  virtual CSG_Grids & operator -= (double Value );
340  virtual CSG_Grids & Subtract (double Value );
341 
342  virtual CSG_Grids & operator *= (double Value );
343  virtual CSG_Grids & Multiply (double Value );
344 
345  virtual CSG_Grids & operator /= (double Value );
346  virtual CSG_Grids & Divide (double Value );
347 
348  virtual double operator () (int x, int y, int z) const { return( asDouble(x, y, z) ); }
349 
350  virtual CSG_Grid & operator [] (int i) { return( *m_pGrids[i] ); }
351 
352 
353  //-----------------------------------------------------
354  // No Data Value...
355 
356  virtual bool Set_NoData_Value_Range (double loValue, double hiValue);
357 
358  virtual bool is_NoData (int x, int y, int z) const { return( is_NoData_Value(asDouble(x, y, z, false)) ); }
359  virtual bool is_NoData (sLong i) const { return( is_NoData_Value(asDouble( i, false)) ); }
360 
361  virtual void Set_NoData (int x, int y, int z) { Set_Value(x, y, z, Get_NoData_Value(), false); }
362  virtual void Set_NoData (sLong i) { Set_Value( i, Get_NoData_Value(), false); }
363 
364 
365  //-----------------------------------------------------
366  // Get Value...
367 
368  double Get_Value (double x, double y, double z, TSG_Grid_Resampling Resampling = GRID_RESAMPLING_BSpline, TSG_Grid_Resampling ZResampling = GRID_RESAMPLING_Undefined) const;
369  double Get_Value (const TSG_Point_3D &p, TSG_Grid_Resampling Resampling = GRID_RESAMPLING_BSpline, TSG_Grid_Resampling ZResampling = GRID_RESAMPLING_Undefined) const;
370  bool Get_Value (double x, double y, double z, double &Value, TSG_Grid_Resampling Resampling = GRID_RESAMPLING_BSpline, TSG_Grid_Resampling ZResampling = GRID_RESAMPLING_Undefined) const;
371  bool Get_Value (const TSG_Point_3D &p, double &Value, TSG_Grid_Resampling Resampling = GRID_RESAMPLING_BSpline, TSG_Grid_Resampling ZResampling = GRID_RESAMPLING_Undefined) const;
372 
373  virtual BYTE asByte (int x, int y, int z, bool bScaled = true) const { return( SG_ROUND_TO_BYTE (asDouble(x, y, z, bScaled)) ); }
374  virtual BYTE asByte (sLong i, bool bScaled = true) const { return( SG_ROUND_TO_BYTE (asDouble( i, bScaled)) ); }
375  virtual char asChar (int x, int y, int z, bool bScaled = true) const { return( SG_ROUND_TO_CHAR (asDouble(x, y, z, bScaled)) ); }
376  virtual char asChar (sLong i, bool bScaled = true) const { return( SG_ROUND_TO_CHAR (asDouble( i, bScaled)) ); }
377  virtual short asShort (int x, int y, int z, bool bScaled = true) const { return( SG_ROUND_TO_SHORT(asDouble(x, y, z, bScaled)) ); }
378  virtual short asShort (sLong i, bool bScaled = true) const { return( SG_ROUND_TO_SHORT(asDouble( i, bScaled)) ); }
379  virtual int asInt (int x, int y, int z, bool bScaled = true) const { return( SG_ROUND_TO_INT (asDouble(x, y, z, bScaled)) ); }
380  virtual int asInt (sLong i, bool bScaled = true) const { return( SG_ROUND_TO_INT (asDouble( i, bScaled)) ); }
381  virtual sLong asLong (int x, int y, int z, bool bScaled = true) const { return( SG_ROUND_TO_SLONG(asDouble(x, y, z, bScaled)) ); }
382  virtual sLong asLong (sLong i, bool bScaled = true) const { return( SG_ROUND_TO_SLONG(asDouble( i, bScaled)) ); }
383  virtual float asFloat (int x, int y, int z, bool bScaled = true) const { return( (float) (asDouble(x, y, z, bScaled)) ); }
384  virtual float asFloat (sLong i, bool bScaled = true) const { return( (float) (asDouble( i, bScaled)) ); }
385 
386  //-----------------------------------------------------
387  virtual double asDouble(sLong i, bool bScaled = true) const
388  {
389  int z = (int)(i / m_pGrids[0]->Get_NCells());
390 
391  return( m_pGrids[z]->asDouble((sLong)(i % m_pGrids[0]->Get_NCells()), bScaled) );
392  }
393 
394  virtual double asDouble(int x, int y, int z, bool bScaled = true) const
395  {
396  return( m_pGrids[z]->asDouble(x, y, bScaled) );
397  }
398 
399 
400  //-----------------------------------------------------
401  // Set Value...
402 
403  virtual void Add_Value(int x, int y, int z, double Value) { Set_Value(x, y, z, asDouble(x, y, z) + Value ); }
404  virtual void Add_Value(sLong i, double Value) { Set_Value( i, asDouble( i) + Value ); }
405 
406  virtual void Mul_Value(int x, int y, int z, double Value) { Set_Value(x, y, z, asDouble(x, y, z) * Value ); }
407  virtual void Mul_Value(sLong i, double Value) { Set_Value( i, asDouble( i) * Value ); }
408 
409  //-----------------------------------------------------
410  virtual void Set_Value(sLong i, double Value, bool bScaled = true)
411  {
412  int z = (int)(i / m_pGrids[0]->Get_NCells());
413 
414  m_pGrids[z]->Set_Value((sLong)(i % m_pGrids[0]->Get_NCells()), Value, bScaled);
415  }
416 
417  virtual void Set_Value(int x, int y, int z, double Value, bool bScaled = true)
418  {
419  m_pGrids[z]->Set_Value(x, y, Value, bScaled);
420  }
421 
422 
423  //-----------------------------------------------------
424  // Index...
425 
426  bool Set_Index (bool bOn = true)
427  {
428  if( !bOn )
429  {
430  SG_FREE_SAFE(m_Index);
431 
432  return( true );
433  }
434 
435  return( _Get_Index() );
436  }
437 
438  sLong Get_Sorted (sLong Position, bool bDown = true, bool bCheckNoData = true)
439  {
440  if( Position >= 0 && Position < Get_NCells() && _Get_Index() )
441  {
442  Position = m_Index[bDown ? Get_NCells() - Position - 1 : Position];
443 
444  if( !bCheckNoData || !is_NoData(Position) )
445  {
446  return( Position );
447  }
448  }
449 
450  return( -1 );
451  }
452 
453  bool Get_Sorted (sLong Position, sLong &i, bool bDown = true, bool bCheckNoData = true)
454  {
455  return( (i = Get_Sorted(Position, bDown, bCheckNoData)) >= 0 );
456  }
457 
458  bool Get_Sorted (sLong Position, int &x, int &y, int &z, bool bDown = true, bool bCheckNoData = true)
459  {
460  if( (Position = Get_Sorted(Position, bDown, bCheckNoData)) >= 0 )
461  {
462  z = (int)(Position / m_pGrids[0]->Get_NCells());
463 
464  Position = Position % m_pGrids[0]->Get_NCells();
465 
466  x = (int)(Position % Get_NX());
467  y = (int)(Position / Get_NX());
468 
469  return( true );
470  }
471 
472  return( false );
473  }
474 
475 
476 //---------------------------------------------------------
477 protected:
478 
479  virtual bool On_Update (void);
480  virtual bool On_Reload (void);
481  virtual bool On_Delete (void);
482 
483 
484 //---------------------------------------------------------
485 private:
486 
487  int m_Z_Attribute, m_Z_Name;
488 
489  sLong *m_Index;
490 
491  CSG_Table m_Attributes;
492 
493  CSG_Array_Pointer m_Grids;
494 
495  CSG_Grid **m_pGrids;
496 
497  CSG_Simple_Statistics m_Statistics;
498 
499  CSG_Histogram m_Histogram;
500 
501 
502  //-----------------------------------------------------
503  void _On_Construction (void);
504 
505  void _Synchronize (CSG_Grid *pGrid);
506 
507  //-----------------------------------------------------
508  bool _Get_Z (double Value, int &iz, double &dz) const;
509 
510  //-----------------------------------------------------
511  bool _Set_Index (void);
512  bool _Get_Index (void)
513  {
514  if( Get_Update_Flag() )
515  {
516  Update();
517  }
518 
519  return( m_Index || _Set_Index() );
520  }
521 
522  //-----------------------------------------------------
523  bool _Load_External (const CSG_String &FileName);
524  bool _Load_PGSQL (const CSG_String &FileName);
525 
526  bool _Load_Normal (const CSG_String &FileName);
527  bool _Save_Normal (const CSG_String &FileName);
528 
529  bool _Load_Compressed (const CSG_String &FileName);
530  bool _Save_Compressed (const CSG_String &FileName);
531 
532  bool _Load_Header (CSG_File &Stream);
533  bool _Save_Header (CSG_File &Stream);
534 
535  bool _Load_Attributes (CSG_File &Stream);
536  bool _Save_Attributes (CSG_File &Stream);
537 
538  bool _Load_Data (CSG_File &Stream, CSG_Grid *pGrid);
539  bool _Save_Data (CSG_File &Stream, CSG_Grid *pGrid);
540 
541  //-----------------------------------------------------
542  bool _Assign_Interpolated (CSG_Grids *pSource, TSG_Grid_Resampling Interpolation);
543  bool _Assign_MeanValue (CSG_Grids *pSource, bool bVolumeProportional);
544  bool _Assign_ExtremeValue (CSG_Grids *pSource, bool bMaximum);
545  bool _Assign_Majority (CSG_Grids *pSource);
546 
547  //-----------------------------------------------------
548  CSG_Grids & _Operation_Arithmetic (const CSG_Grids &Grids, TSG_Grid_Operation Operation);
549  CSG_Grids & _Operation_Arithmetic (double Value , TSG_Grid_Operation Operation);
550 
551 };
552 
553 
555 // //
556 // Functions //
557 // //
559 
560 //---------------------------------------------------------
561 #define SG_GRIDS_PTR_SAFE_SET_NODATA(g, x, y, z) { if( g && g->is_InGrid(x, y, z, false) ) { g->Set_NoData(x, y, z ); } }
562 #define SG_GRIDS_PTR_SAFE_SET_VALUE(g, x, y, z, v) { if( g && g->is_InGrid(x, y, z, false) ) { g->Set_Value (x, y, z, v); } }
563 
564 //---------------------------------------------------------
567 
570 
572 SAGA_API_DLL_EXPORT CSG_Grids * SG_Create_Grids (const CSG_Grids *pGrids, bool bCopyData = false);
573 
575 SAGA_API_DLL_EXPORT CSG_Grids * SG_Create_Grids (const char *FileName, bool bLoadData = true);
577 SAGA_API_DLL_EXPORT CSG_Grids * SG_Create_Grids (const wchar_t *FileName, bool bLoadData = true);
579 SAGA_API_DLL_EXPORT CSG_Grids * SG_Create_Grids (const CSG_String &FileName, bool bLoadData = true);
580 
582 SAGA_API_DLL_EXPORT CSG_Grids * SG_Create_Grids (const CSG_Grid_System &System, int NZ = 0, double zMin = 0., TSG_Data_Type Type = SG_DATATYPE_Undefined);
583 
585 SAGA_API_DLL_EXPORT CSG_Grids * SG_Create_Grids (const CSG_Grid_System &System, const CSG_Table &Attributes, int zAttribute = 0, TSG_Data_Type Type = SG_DATATYPE_Undefined, bool bCreateGrids = false);
586 
588 SAGA_API_DLL_EXPORT CSG_Grids * SG_Create_Grids (int NX, int NY, int NZ = 0, double Cellsize = 0., double xMin = 0., double yMin = 0., double zMin = 0., TSG_Data_Type Type = SG_DATATYPE_Undefined);
589 
590 
592 // //
593 // //
594 // //
596 
597 //---------------------------------------------------------
598 #endif // #ifndef HEADER_INCLUDED__SAGA_API__grids_H
CSG_Grids::asChar
virtual char asChar(sLong i, bool bScaled=true) const
Definition: grids.h:376
CSG_Grids::is_InGrid
bool is_InGrid(int x, int y, int z, bool bCheckNoData=true) const
Definition: grids.h:294
CSG_Rect
Definition: geo_tools.h:471
GRIDS_FILE_FORMAT_Normal
@ GRIDS_FILE_FORMAT_Normal
Definition: grids.h:93
CSG_Grids::is_Intersecting
TSG_Intersection is_Intersecting(const CSG_Rect &Extent) const
Definition: grids.h:285
CSG_Grids::Get_NY
int Get_NY(void) const
Definition: grids.h:186
CSG_Data_Object::Assign
virtual bool Assign(CSG_Data_Object *pObject)
Definition: dataobject.cpp:734
SG_DATATYPE_Undefined
@ SG_DATATYPE_Undefined
Definition: api_core.h:1001
SG_FREE_SAFE
#define SG_FREE_SAFE(PTR)
Definition: api_core.h:205
CSG_Grids::Set_NoData
virtual void Set_NoData(int x, int y, int z)
Definition: grids.h:361
CSG_Grids::asInt
virtual int asInt(int x, int y, int z, bool bScaled=true) const
Definition: grids.h:379
TSG_Intersection
TSG_Intersection
Definition: geo_tools.h:101
CSG_Grids::Get_ZRange
double Get_ZRange(bool bCells=false) const
Definition: grids.h:207
CSG_Grids::is_NoData
virtual bool is_NoData(sLong i) const
Definition: grids.h:359
CSG_Grids::Mul_Value
virtual void Mul_Value(sLong i, double Value)
Definition: grids.h:407
TSG_Grids_File_Format
TSG_Grids_File_Format
Definition: grids.h:91
CSG_Grids::Get_Sorted
sLong Get_Sorted(sLong Position, bool bDown=true, bool bCheckNoData=true)
Definition: grids.h:438
CSG_Grids::Get_Offset
double Get_Offset(void) const
Definition: grids.h:259
CSG_Data_Object::On_Reload
virtual bool On_Reload(void)=0
CSG_Data_Object::On_Delete
virtual bool On_Delete(void)=0
CSG_Grids::Set_Value
virtual void Set_Value(sLong i, double Value, bool bScaled=true)
Definition: grids.h:410
CSG_Data_Object::Update
bool Update(bool bForce=false)
Definition: dataobject.cpp:714
CSG_Grids::is_Intersecting
TSG_Intersection is_Intersecting(double xMin, double yMin, double xMax, double yMax) const
Definition: grids.h:287
SG_ROUND_TO_INT
#define SG_ROUND_TO_INT(x)
Definition: mat_tools.h:140
CSG_Table_Record
Definition: table.h:130
CSG_Grids::Get_Scaling
double Get_Scaling(void) const
Definition: grids.h:258
CSG_Data_Object::Get_NoData_Value
double Get_NoData_Value(bool bUpper=false) const
Definition: dataobject.h:244
CSG_Grids::Get_Attributes
const CSG_Table & Get_Attributes(void) const
Definition: grids.h:216
CSG_Grid_System
Definition: grid.h:200
TSG_Grid_Resampling
TSG_Grid_Resampling
Definition: grid.h:156
CSG_Histogram
Definition: mat_tools.h:986
CSG_Grids::Get_YRange
double Get_YRange(bool bCells=false) const
Definition: grids.h:203
CSG_Grids::Get_Attributes
CSG_Table_Record & Get_Attributes(int i) const
Definition: grids.h:219
CSG_Grids::Get_Grid_Count
int Get_Grid_Count(void) const
Definition: grids.h:237
SSG_Point_3D
Definition: geo_tools.h:264
CSG_Data_Object::is_NoData_Value
bool is_NoData_Value(double Value) const
Definition: dataobject.h:246
GRID_RESAMPLING_Undefined
@ GRID_RESAMPLING_Undefined
Definition: grid.h:168
CSG_Grids::Get_Extent
virtual const CSG_Rect & Get_Extent(void)
Definition: grids.h:183
CSG_Grids::is_InGrid_byPos
bool is_InGrid_byPos(double x, double y, double z, bool bCheckNoData=true) const
Definition: grids.h:295
CSG_Data_Object::Save
virtual bool Save(const CSG_String &File, int Format=0)=0
CSG_Grids::Add_Value
virtual void Add_Value(sLong i, double Value)
Definition: grids.h:404
grid.h
CSG_Grids::asByte
virtual BYTE asByte(int x, int y, int z, bool bScaled=true) const
Definition: grids.h:373
SSG_Point_3D::x
double x
Definition: geo_tools.h:265
CSG_Grids::Get_NCells
sLong Get_NCells(void) const
Definition: grids.h:188
SG_DATAOBJECT_TYPE_Grids
@ SG_DATAOBJECT_TYPE_Grids
Definition: dataobject.h:119
SG_ROUND_TO_SLONG
#define SG_ROUND_TO_SLONG(x)
Definition: mat_tools.h:143
CSG_Grids::Get_Type
TSG_Data_Type Get_Type(void) const
Definition: grids.h:169
CSG_Grids::Get_Z_Attribute
int Get_Z_Attribute(void) const
Definition: grids.h:222
CSG_Grids::is_Scaled
bool is_Scaled(void) const
Definition: grids.h:260
CSG_Data_Object::Set_Max_Samples
virtual bool Set_Max_Samples(sLong Max_Samples)
Definition: dataobject.cpp:558
CSG_Data_Object::Set_Update_Flag
void Set_Update_Flag(bool bOn=true)
Definition: dataobject.h:273
CSG_Grids::asDouble
virtual double asDouble(int x, int y, int z, bool bScaled=true) const
Definition: grids.h:394
CSG_File
Definition: api_core.h:1116
SSG_Rect
Definition: geo_tools.h:464
GRIDS_FILE_FORMAT_Undefined
@ GRIDS_FILE_FORMAT_Undefined
Definition: grids.h:92
CSG_Grids::Get_YMax
double Get_YMax(bool bCells=false) const
Definition: grids.h:202
CSG_Grids::Get_Unit
const SG_Char * Get_Unit(void) const
Definition: grids.h:175
CSG_Grids::Get_Sorted
bool Get_Sorted(sLong Position, int &x, int &y, int &z, bool bDown=true, bool bCheckNoData=true)
Definition: grids.h:458
CSG_Grids::asLong
virtual sLong asLong(sLong i, bool bScaled=true) const
Definition: grids.h:382
CSG_Grids::Get_NX
int Get_NX(void) const
Definition: grids.h:185
CSG_Grids::asShort
virtual short asShort(sLong i, bool bScaled=true) const
Definition: grids.h:378
CSG_Data_Object
Definition: dataobject.h:180
CSG_Grids::Get_System
const CSG_Grid_System & Get_System(void) const
Definition: grids.h:181
CSG_Grids::Get_nLineBytes
int Get_nLineBytes(void) const
Definition: grids.h:172
CSG_Grids::Get_YMin
double Get_YMin(bool bCells=false) const
Definition: grids.h:201
CSG_Grids::asLong
virtual sLong asLong(int x, int y, int z, bool bScaled=true) const
Definition: grids.h:381
CSG_Grids::asByte
virtual BYTE asByte(sLong i, bool bScaled=true) const
Definition: grids.h:374
CSG_Grids::Get_XRange
double Get_XRange(bool bCells=false) const
Definition: grids.h:199
CSG_Grids::Add_Value
virtual void Add_Value(int x, int y, int z, double Value)
Definition: grids.h:403
CSG_Data_Object::Get_Extent
virtual const CSG_Rect & Get_Extent(void)=0
CSG_Grids::Get_Extent
const CSG_Rect & Get_Extent(bool bCells=false) const
Definition: grids.h:195
CSG_Grids::is_NoData
virtual bool is_NoData(int x, int y, int z) const
Definition: grids.h:358
sLong
signed long long sLong
Definition: api_core.h:158
CSG_Grids::asShort
virtual short asShort(int x, int y, int z, bool bScaled=true) const
Definition: grids.h:377
SG_ROUND_TO_CHAR
#define SG_ROUND_TO_CHAR(x)
Definition: mat_tools.h:136
CSG_Data_Object::On_Update
virtual bool On_Update(void)
Definition: dataobject.h:275
CSG_Grids::Get_Grid_Ptr
CSG_Grid * Get_Grid_Ptr(int i) const
Definition: grids.h:248
GRIDS_FILE_FORMAT_Compressed
@ GRIDS_FILE_FORMAT_Compressed
Definition: grids.h:94
CSG_Data_Object::is_Modified
virtual bool is_Modified(void) const
Definition: dataobject.h:219
CSG_Grids::is_InGrid_byPos
bool is_InGrid_byPos(const TSG_Point_3D &p, bool bCheckNoData=true) const
Definition: grids.h:296
SAGA_API_DLL_EXPORT
#define SAGA_API_DLL_EXPORT
Definition: api_core.h:94
GRID_RESAMPLING_BSpline
@ GRID_RESAMPLING_BSpline
Definition: grid.h:160
CSG_Data_Object::Set_Modified
virtual void Set_Modified(bool bOn=true)
Definition: dataobject.h:218
SG_ROUND_TO_BYTE
#define SG_ROUND_TO_BYTE(x)
Definition: mat_tools.h:135
CSG_Grids::Get_XMax
double Get_XMax(bool bCells=false) const
Definition: grids.h:198
CSG_Grids::Set_Index
bool Set_Index(bool bOn=true)
Definition: grids.h:426
CSG_Grids::Get_Memory_Size
sLong Get_Memory_Size(void) const
Definition: grids.h:251
CSG_Grids::Get_ZMax
double Get_ZMax(bool bCells=false) const
Definition: grids.h:206
CSG_Grids::Get_XMin
double Get_XMin(bool bCells=false) const
Definition: grids.h:197
CSG_Table
Definition: table.h:283
CSG_Data_Object::Get_Update_Flag
bool Get_Update_Flag(void)
Definition: dataobject.h:274
CSG_Grids::Save
virtual bool Save(const char *File, int Format=0)
Definition: grids.h:156
CSG_Grids::asFloat
virtual float asFloat(int x, int y, int z, bool bScaled=true) const
Definition: grids.h:383
CSG_Grids::asDouble
virtual double asDouble(sLong i, bool bScaled=true) const
Definition: grids.h:387
SG_Char
#define SG_Char
Definition: api_core.h:530
TSG_Data_Object_Type
TSG_Data_Object_Type
Definition: dataobject.h:117
CSG_String
Definition: api_core.h:557
CSG_Grids::Get_Z
double Get_Z(int i) const
Definition: grids.h:228
CSG_Array_Pointer
Definition: api_core.h:368
CSG_Grids::asFloat
virtual float asFloat(sLong i, bool bScaled=true) const
Definition: grids.h:384
SSG_Point_3D::y
double y
Definition: geo_tools.h:265
CSG_Grids::asChar
virtual char asChar(int x, int y, int z, bool bScaled=true) const
Definition: grids.h:375
CSG_Grids::Save
virtual bool Save(const wchar_t *File, int Format=0)
Definition: grids.h:157
SG_ROUND_TO_SHORT
#define SG_ROUND_TO_SHORT(x)
Definition: mat_tools.h:138
CSG_Grids::Get_Cellarea
double Get_Cellarea(void) const
Definition: grids.h:193
CSG_Grid
Definition: grid.h:473
CSG_Grids::Get_Cellsize
double Get_Cellsize(void) const
Definition: grids.h:192
CSG_Grids::is_Modified
virtual bool is_Modified(void) const
Definition: grids.h:314
SSG_Point_3D::z
double z
Definition: geo_tools.h:265
CSG_Grids::is_Intersecting
TSG_Intersection is_Intersecting(const TSG_Rect &Extent) const
Definition: grids.h:286
SG_Create_Grids
SAGA_API_DLL_EXPORT CSG_Grids * SG_Create_Grids(void)
Definition: grids.cpp:65
CSG_Grids::Set_Modified
virtual void Set_Modified(bool bModified=true)
Definition: grids.h:302
CSG_Grids::Set_NoData
virtual void Set_NoData(sLong i)
Definition: grids.h:362
TSG_Data_Type
TSG_Data_Type
Definition: api_core.h:985
CSG_Grids::Set_Value
virtual void Set_Value(int x, int y, int z, double Value, bool bScaled=true)
Definition: grids.h:417
CSG_Grids::Get_ZMin
double Get_ZMin(bool bCells=false) const
Definition: grids.h:205
CSG_Grids::asInt
virtual int asInt(sLong i, bool bScaled=true) const
Definition: grids.h:380
CSG_Grids::Mul_Value
virtual void Mul_Value(int x, int y, int z, double Value)
Definition: grids.h:406
CSG_Grids
Definition: grids.h:119
CSG_Grids::Get_nValueBytes
int Get_nValueBytes(void) const
Definition: grids.h:171
CSG_Simple_Statistics
Definition: mat_tools.h:708
CSG_Grids::Get_Attributes_Ptr
CSG_Table * Get_Attributes_Ptr(void)
Definition: grids.h:217
CSG_Data_Object::Set_NoData_Value_Range
virtual bool Set_NoData_Value_Range(double Lower, double Upper)
Definition: dataobject.cpp:519
CSG_Data_Object::Destroy
virtual bool Destroy(void)
Definition: dataobject.cpp:218
CSG_Data_Object::is_Valid
virtual bool is_Valid(void) const =0
CSG_Grids::Get_Grid
const CSG_Grid & Get_Grid(int i) const
Definition: grids.h:247
TSG_Grid_Operation
TSG_Grid_Operation
Definition: grid.h:174
CSG_Grids::Get_Sorted
bool Get_Sorted(sLong Position, sLong &i, bool bDown=true, bool bCheckNoData=true)
Definition: grids.h:453
CSG_Grids::Get_ObjectType
virtual TSG_Data_Object_Type Get_ObjectType(void) const
Definition: grids.h:163
CSG_Grids::Get_NZ
int Get_NZ(void) const
Definition: grids.h:187
GRIDS_FILE_FORMAT_GeoTIFF
@ GRIDS_FILE_FORMAT_GeoTIFF
Definition: grids.h:95