SAGA API  v9.6
dataobject.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 // dataobject.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 "dataobject.h"
54 
55 #include <wx/string.h>
56 
57 
59 // //
60 // //
61 // //
63 
64 //---------------------------------------------------------
66 {
67  return( DATAOBJECT_CREATE );
68 }
69 
70 //---------------------------------------------------------
72 {
73  switch( Type )
74  {
75  case SG_DATAOBJECT_TYPE_Grid : return( "GRID" );
76  case SG_DATAOBJECT_TYPE_Grids : return( "GRIDS" );
77  case SG_DATAOBJECT_TYPE_Table : return( "TABLE" );
78  case SG_DATAOBJECT_TYPE_Shapes : return( "SHAPES" );
79  case SG_DATAOBJECT_TYPE_TIN : return( "TIN" );
80  case SG_DATAOBJECT_TYPE_PointCloud: return( "POINTS" );
81  default : return( "UNDEFINED" );
82  }
83 }
84 
85 //---------------------------------------------------------
87 {
88  switch( Type )
89  {
90  case SG_DATAOBJECT_TYPE_Grid : return( _TL("Grid" ) );
91  case SG_DATAOBJECT_TYPE_Grids : return( _TL("Grids" ) );
92  case SG_DATAOBJECT_TYPE_Table : return( _TL("Table" ) );
93  case SG_DATAOBJECT_TYPE_Shapes : return( _TL("Shapes" ) );
94  case SG_DATAOBJECT_TYPE_TIN : return( _TL("TIN" ) );
95  case SG_DATAOBJECT_TYPE_PointCloud: return( _TL("Point Cloud") );
96  default : return( _TL("Undefined" ) );
97  }
98 }
99 
100 //---------------------------------------------------------
102 {
103  switch( Type )
104  {
105  case SG_DATAOBJECT_TYPE_Grid : return( "CSG_Grid" );
106  case SG_DATAOBJECT_TYPE_Grids : return( "CSG_Grids" );
107  case SG_DATAOBJECT_TYPE_Table : return( "CSG_Table" );
108  case SG_DATAOBJECT_TYPE_Shapes : return( "CSG_Shapes" );
109  case SG_DATAOBJECT_TYPE_TIN : return( "CSG_TIN" );
110  case SG_DATAOBJECT_TYPE_PointCloud: return( "CSG_PointCloud" );
111  default : return( "CSG_DataObject" );
112  }
113 }
114 
115 
117 // //
118 // Data Object Statistics //
119 // //
121 
122 //---------------------------------------------------------
124 
125 //---------------------------------------------------------
127 {
128  if( Max_Samples >= 0 )
129  {
130  gSG_DataObject_Max_Samples = Max_Samples;
131 
132  return( true );
133  }
134 
135  return( false );
136 }
137 
138 //---------------------------------------------------------
140 {
141  return( gSG_DataObject_Max_Samples );
142 }
143 
144 
146 // //
147 // //
148 // //
150 
151 //---------------------------------------------------------
153 
154 void SG_Set_History_Depth (int Depth)
155 {
156  g_History_Depth = Depth;
157 }
158 
160 {
161  return( g_History_Depth );
162 }
163 
164 //---------------------------------------------------------
166 
168 {
169  g_History_Ignore_Lists = Ignore != 0;
170 }
171 
173 {
174  return( g_History_Ignore_Lists );
175 }
176 
177 
179 // //
180 // //
181 // //
183 
184 //---------------------------------------------------------
186 {
187  if( pObject && !pObject->Get_Managed() )
188  {
189  delete(pObject);
190 
191  return( true );
192  }
193 
194  return( false );
195 }
196 
197 
199 // //
200 // //
201 // //
203 
204 //---------------------------------------------------------
206 {
207  static int RefCount = 0;
208 
209  #pragma omp critical
210  {
211  m_RefID = ++RefCount;
212  }
213 
214  m_pOwner = NULL;
215 
216  m_File_bNative = false;
217  m_File_Type = 0;
218 
219  m_NoData_Value[0] = -99999.;
220  m_NoData_Value[1] = -99999.;
221 
222  m_Max_Samples = gSG_DataObject_Max_Samples;
223  m_bModified = true;
224  m_bUpdate = false;
225 
226  m_MetaData.Set_Name("SAGA_METADATA");
227 
228  m_pMD_Database = m_MetaData.Add_Child(SG_META_DATABASE);
229  m_pMD_Source = m_MetaData.Add_Child(SG_META_SOURCE );
230  m_pMD_History = m_MetaData.Add_Child(SG_META_HISTORY );
231 
232  #ifdef WITH_LIFETIME_TRACKER
233  #pragma omp critical
234  {
235  ++m_Track_nObjects;
236 
237  if( m_Track )
238  {
239  SG_UI_Console_Print_StdOut(CSG_String::Format("data object (refid=%04d) constructed, new object count is %d", m_RefID, m_Track_nObjects - m_Track_Offset));
240  }
241  }
242  #endif // WITH_LIFETIME_TRACKER
243 }
244 
245 //---------------------------------------------------------
247 {
248  Destroy();
249 
250  #ifdef WITH_LIFETIME_TRACKER
251  #pragma omp critical
252  {
253  --m_Track_nObjects;
254 
255  if( m_Track )
256  {
257  SG_UI_Console_Print_StdOut(CSG_String::Format("data object (refid=%04d) destructed, new object count is %d", m_RefID, m_Track_nObjects - m_Track_Offset));
258  }
259  }
260  #endif // WITH_LIFETIME_TRACKER
261 }
262 
263 //---------------------------------------------------------
264 bool CSG_Data_Object::m_Track = false; int CSG_Data_Object::m_Track_nObjects = 0; int CSG_Data_Object::m_Track_Offset = 0;
265 
266 //---------------------------------------------------------
267 void CSG_Data_Object::Track(bool Track, bool Offset)
268 {
269  #ifdef WITH_LIFETIME_TRACKER
270  m_Track = Track; m_Track_Offset = Offset ? m_Track_nObjects : 0;
271 
272  SG_UI_Console_Print_StdOut(CSG_String::Format("data object construction/destruction tracker, state=%s, offset=%s, current object count is %d",
273  m_Track ? SG_T("ON") : SG_T("OFF"), m_Track_Offset ? SG_T("ON") : SG_T("OFF"), m_Track_nObjects
274  ));
275  #else
276  SG_UI_Console_Print_StdOut("CSG_Data_Object::Track() functionality (aka data object lifetime tracker) has not been built for this configuration!");
277  #endif // WITH_LIFETIME_TRACKER
278 }
279 
280 //---------------------------------------------------------
282 {
283  m_Name.Clear(); m_Description.Clear();
284 
285  m_pMD_Database->Destroy();
286  m_pMD_Source ->Destroy();
287  m_pMD_History ->Destroy();
288 
289  return( true );
290 }
291 
292 
294 // //
296 
297 //---------------------------------------------------------
298 void CSG_Data_Object::Set_Name(const char *Name) { Set_Name(CSG_String(Name)); }
299 void CSG_Data_Object::Set_Name(const wchar_t *Name) { Set_Name(CSG_String(Name)); }
301 {
302  if( Name.is_Empty() )
303  {
304  m_Name = _TL("Data");
305  }
306  else
307  {
308  m_Name = Name;
309  }
310 }
311 
312 //---------------------------------------------------------
313 void CSG_Data_Object::Fmt_Name(const char *Format, ...)
314 {
315  wxString _s; va_list argptr;
316 
317 #ifdef _SAGA_LINUX
318  wxString _Format(Format); _Format.Replace("%s", "%ls"); // workaround as we only use wide characters since wx 2.9.4 so interpret strings as multibyte
319  va_start(argptr, _Format); _s.PrintfV(_Format, argptr);
320 #else
321  va_start(argptr, Format); _s.PrintfV( Format, argptr);
322 #endif
323 
324  va_end(argptr);
325 
326  Set_Name(CSG_String(&_s));
327 }
328 
329 //---------------------------------------------------------
330 void CSG_Data_Object::Fmt_Name(const wchar_t *Format, ...)
331 {
332  wxString _s; va_list argptr;
333 
334 #ifdef _SAGA_LINUX
335  // workaround as we only use wide characters
336  // since wx 2.9.4 so interpret strings as multibyte
337  wxString _Format(Format); _Format.Replace("%s", "%ls"); // workaround as we only use wide characters since wx 2.9.4 so interpret strings as multibyte
338  va_start(argptr, _Format); _s.PrintfV(_Format, argptr);
339 #else
340  va_start(argptr, Format); _s.PrintfV( Format, argptr);
341 #endif
342 
343  va_end(argptr);
344 
345  Set_Name(CSG_String(&_s));
346 }
347 
348 //---------------------------------------------------------
350 {
351  return( m_Name );
352 }
353 
354 //---------------------------------------------------------
356 {
357  m_Description = Description;
358 }
359 
361 {
362  return( m_Description.is_Empty() && m_pOwner ? m_pOwner->m_Description : m_Description );
363 }
364 
365 //---------------------------------------------------------
367 {
368  Set_File_Name(FileName, false);
369 }
370 
371 //---------------------------------------------------------
372 void CSG_Data_Object::Set_File_Name(const CSG_String &FileName, bool bNative)
373 {
374  if( FileName.is_Empty() )
375  {
376  m_FileName .Clear();
377  m_File_bNative = false;
378  m_bModified = true;
379  }
380  else
381  {
382  m_FileName = FileName;
383  m_File_bNative = bNative;
384  m_bModified = false;
385  m_Name = SG_File_Get_Name(FileName, false);
386  }
387 }
388 
389 //---------------------------------------------------------
390 const SG_Char * CSG_Data_Object::Get_File_Name(bool bNative) const
391 {
392  if( bNative && !m_File_bNative )
393  {
394  return( SG_T("") );
395  }
396 
397  if( m_pOwner )
398  {
400  {
401  return( m_pOwner->m_FileName.c_str() );
402  }
403  }
404 
405  return( m_FileName.c_str() );
406 }
407 
408 //---------------------------------------------------------
410 {
411  return( m_File_Type );
412 }
413 
414 
416 // //
418 
419 //---------------------------------------------------------
420 /*
421 * If the data object has a file asssociation, this function
422 * can be used to reload its content.
423 */
424 //---------------------------------------------------------
426 {
427  return( SG_File_Exists(m_FileName) && On_Reload() );
428 }
429 
430 //---------------------------------------------------------
431 /*
432 * If the data object is stored in a native SAGA format,
433 * this function can be used to delete all files asssociated
434 * with it.
435 */
436 //---------------------------------------------------------
438 {
439  if( m_File_bNative && SG_File_Exists(m_FileName) && On_Delete() )
440  {
441  CSG_String FileName = m_FileName;
442 
443  switch( Get_ObjectType() )
444  {
445  case SG_DATAOBJECT_TYPE_Grid : SG_File_Set_Extension(FileName, "mgrd" ); break;
446  case SG_DATAOBJECT_TYPE_Grids : SG_File_Set_Extension(FileName, "sg-info"); break;
447  case SG_DATAOBJECT_TYPE_Table : SG_File_Set_Extension(FileName, "mtab" ); break;
448  case SG_DATAOBJECT_TYPE_Shapes : SG_File_Set_Extension(FileName, "mshp" ); break;
449  case SG_DATAOBJECT_TYPE_TIN : SG_File_Set_Extension(FileName, "sg-info"); break;
450  case SG_DATAOBJECT_TYPE_PointCloud: SG_File_Set_Extension(FileName, "sg-info"); break;
451  default : SG_File_Set_Extension(FileName, "sg-info"); break;
452  }
453 
454  SG_File_Delete(FileName);
455 
456  SG_File_Set_Extension(FileName, "prj"); SG_File_Delete(FileName);
457  SG_File_Set_Extension(FileName, "sg-prj"); SG_File_Delete(FileName);
458 
459  //-------------------------------------------------
460  m_FileName = "";
461  m_File_bNative = false;
462  m_File_Type = 0;
463 
464  m_bModified = true;
465 
466  m_pMD_Database->Destroy();
467 
468  return( true );
469  }
470 
471  return( false );
472 }
473 
474 
476 // //
478 
479 //---------------------------------------------------------
480 /*
481 * Type cast function. Returns NULL if object is not exactly
482 * of class type CSG_Table with bPolymorph = false or of
483 * one of its derivatives (CSG_Shapes, CSG_PointCloud,
484 * CSG_TIN) with bPolymorph = true.
485 */
486 //---------------------------------------------------------
487 CSG_Table * CSG_Data_Object::asTable(bool bPolymorph) const
488 {
489  if( bPolymorph )
490  {
495  ? (CSG_Table *)this : NULL
496  );
497  }
498 
499  return( Get_ObjectType() == SG_DATAOBJECT_TYPE_Table ? (CSG_Table *)this : NULL );
500 }
501 
502 //---------------------------------------------------------
503 /*
504 * Type cast function. Returns NULL if object is not exactly
505 * of class type CSG_Shapes with bPolymorph = false or of
506 * one of its derivatives (CSG_PointCloud) with bPolymorph = true.
507 */
508 //---------------------------------------------------------
509 CSG_Shapes * CSG_Data_Object::asShapes(bool bPolymorph) const
510 {
511  if( bPolymorph )
512  {
515  ? (CSG_Shapes *)this : NULL
516  );
517  }
518 
519  return( Get_ObjectType() == SG_DATAOBJECT_TYPE_Shapes ? (CSG_Shapes *)this : NULL );
520 }
521 
522 //---------------------------------------------------------
523 /*
524 * Type cast function. Returns NULL if object is not exactly
525 * of class type CSG_TIN. The bPolymorph flag has no effect.
526 */
527 //---------------------------------------------------------
528 CSG_TIN * CSG_Data_Object::asTIN(bool bPolymorph) const
529 {
530  return( Get_ObjectType() == SG_DATAOBJECT_TYPE_TIN ? (CSG_TIN *)this : NULL );
531 }
532 
533 //---------------------------------------------------------
534 /*
535 * Type cast function. Returns NULL if object is not exactly
536 * of class type CSG_PointCloud. The bPolymorph flag has no effect.
537 */
538 //---------------------------------------------------------
540 {
541  return( Get_ObjectType() == SG_DATAOBJECT_TYPE_PointCloud ? (CSG_PointCloud *)this : NULL );
542 }
543 
544 //---------------------------------------------------------
545 /*
546 * Type cast function. Returns NULL if object is not exactly
547 * of class type CSG_Grid. The bPolymorph flag has no effect.
548 */
549 //---------------------------------------------------------
550 CSG_Grid * CSG_Data_Object::asGrid(bool bPolymorph) const
551 {
552  return( Get_ObjectType() == SG_DATAOBJECT_TYPE_Grid ? (CSG_Grid *)this : NULL );
553 }
554 
555 //---------------------------------------------------------
556 /*
557 * Type cast function. Returns NULL if object is not exactly
558 * of class type CSG_Grids. The bPolymorph flag has no effect.
559 */
560 //---------------------------------------------------------
561 CSG_Grids * CSG_Data_Object::asGrids(bool bPolymorph) const
562 {
563  return( Get_ObjectType() == SG_DATAOBJECT_TYPE_Grids ? (CSG_Grids *)this : NULL );
564 }
565 
566 
568 // //
570 
571 //---------------------------------------------------------
573 {
574  return( Set_NoData_Value_Range(Value, Value) );
575 }
576 
577 //---------------------------------------------------------
578 bool CSG_Data_Object::Set_NoData_Value_Range(double Lower, double Upper)
579 {
580  if( Lower > Upper )
581  {
582  double d = Lower; Lower = Upper; Upper = d;
583  }
584 
585  if( Lower != m_NoData_Value[0] || Upper != m_NoData_Value[1] )
586  {
587  m_NoData_Value[0] = Lower;
588  m_NoData_Value[1] = Upper;
589 
590  Set_Modified();
591 
593 
594  return( true );
595  }
596 
597  return( false );
598 }
599 
600 //---------------------------------------------------------
602 {
603  if( !Get_Update_Flag() )
604  {
605  Set_Update_Flag();
606  }
607 
608  return( true );
609 }
610 
611 
613 // //
615 
616 //---------------------------------------------------------
618 {
619  #define Min_Samples 100
620 
621  if( m_Max_Samples != Max_Samples && Max_Samples >= Min_Samples )
622  {
623  m_Max_Samples = Max_Samples;
624 
625  Update(true);
626  }
627 
628  return( true );
629 }
630 
631 
633 // //
635 
636 //---------------------------------------------------------
638 {
639  return( m_pOwner ? m_pOwner->m_Projection : m_Projection );
640 }
641 
642 //---------------------------------------------------------
644 {
645  return( m_pOwner ? m_pOwner->m_Projection : m_Projection );
646 }
647 
648 
650 // //
652 
653 //---------------------------------------------------------
655 {
656  CSG_String FileName(_FileName);
657 
658  switch( Get_ObjectType() )
659  {
660  case SG_DATAOBJECT_TYPE_Grid : SG_File_Set_Extension(FileName, "mgrd" ); break;
661  case SG_DATAOBJECT_TYPE_Grids : SG_File_Set_Extension(FileName, "sg-info"); break;
662  case SG_DATAOBJECT_TYPE_Table : SG_File_Set_Extension(FileName, "mtab" ); break;
663  case SG_DATAOBJECT_TYPE_Shapes : SG_File_Set_Extension(FileName, "mshp" ); break;
664  case SG_DATAOBJECT_TYPE_TIN : SG_File_Set_Extension(FileName, "sg-info"); break;
665  case SG_DATAOBJECT_TYPE_PointCloud: SG_File_Set_Extension(FileName, "sg-info");
666  if( !SG_File_Get_Extension(_FileName).CmpNoCase("spc") ) SG_File_Set_Extension(FileName, "mpts"); break;
667 
668  default: return( false );
669  }
670 
671  CSG_File Stream(FileName, SG_FILE_R, false);
672 
673  return( Load_MetaData(Stream) );
674 }
675 
676 //---------------------------------------------------------
678 {
679  CSG_String FileName(_FileName);
680 
681  switch( Get_ObjectType() )
682  {
683  case SG_DATAOBJECT_TYPE_Grid : SG_File_Set_Extension(FileName, "mgrd" ); break;
684  case SG_DATAOBJECT_TYPE_Grids : SG_File_Set_Extension(FileName, "sg-info"); break;
685  case SG_DATAOBJECT_TYPE_Table : SG_File_Set_Extension(FileName, "mtab" ); break;
686  case SG_DATAOBJECT_TYPE_Shapes : SG_File_Set_Extension(FileName, "mshp" ); break;
687  case SG_DATAOBJECT_TYPE_TIN : SG_File_Set_Extension(FileName, "sg-info"); break;
688  case SG_DATAOBJECT_TYPE_PointCloud: SG_File_Set_Extension(FileName, "sg-info"); break;
689 
690  default: return( false );
691  }
692 
693  CSG_File Stream(FileName, SG_FILE_W, false);
694 
695  return( Save_MetaData(Stream) );
696 }
697 
698 //---------------------------------------------------------
700 {
701  CSG_MetaData m;
702 
703  if( !m.Load(Stream) )
704  {
705  return( false );
706  }
707 
708  //-----------------------------------------------------
709  if( m("DESCRIPTION") && !m["DESCRIPTION"].Get_Content().is_Empty() )
710  {
711  Set_Description(m["DESCRIPTION"].Get_Content());
712  }
713 
714  //-----------------------------------------------------
715  m_pMD_Source->Destroy();
716 
717  if( m(SG_META_SOURCE) )
718  m_pMD_Source->Assign(m[SG_META_SOURCE]);
719 
720  //-----------------------------------------------------
721  m_pMD_Database->Destroy();
722 
723  if( m(SG_META_DATABASE) )
724  m_pMD_Database->Assign(m[SG_META_DATABASE]);
725 
726  //-----------------------------------------------------
727  m_MetaData.Del_Child(SG_META_PROJECTION);
728 
729  if( m(SG_META_PROJECTION) && m_Projection.Load(m[SG_META_PROJECTION]) )
730  m_MetaData.Add_Child(m[SG_META_PROJECTION]);
731  else if( m[SG_META_SOURCE](SG_META_PROJECTION) && m_Projection.Load(m[SG_META_SOURCE][SG_META_PROJECTION]) )
733 
734  //-----------------------------------------------------
735  m_pMD_History->Destroy();
736 
737  if( m(SG_META_HISTORY) )
738  m_pMD_History->Assign(m[SG_META_HISTORY]);
739  else
740  m_pMD_History->Add_Child(SG_META_FILEPATH, Get_File_Name());
741 
742  return( true );
743 }
744 
745 //---------------------------------------------------------
747 {
748  //-----------------------------------------------------
749  if( m_MetaData(SG_META_FILEPATH) )
750  m_MetaData(SG_META_FILEPATH)->Set_Content(m_FileName);
751  else
752  m_MetaData.Add_Child(SG_META_FILEPATH, m_FileName);
753 
754  //-----------------------------------------------------
755  if( m_MetaData("DESCRIPTION") )
756  m_MetaData("DESCRIPTION")->Set_Content(Get_Description());
757  else
758  m_MetaData.Add_Child("DESCRIPTION", Get_Description());
759 
760  //-----------------------------------------------------
761  if( m_Projection.Get_Type() == ESG_CRS_Type::Undefined )
762  m_MetaData.Del_Child(SG_META_PROJECTION);
763  else if( m_MetaData(SG_META_PROJECTION) )
764  m_Projection.Save(*m_MetaData(SG_META_PROJECTION));
765  else
766  m_Projection.Save(*m_MetaData.Add_Child(SG_META_PROJECTION));
767 
768  //-----------------------------------------------------
769  return( m_MetaData.Save(Stream) );
770 }
771 
772 //---------------------------------------------------------
773 bool CSG_Data_Object::Update(bool bForce)
774 {
775  if( m_bUpdate || bForce )
776  {
777  m_bUpdate = false;
778 
779  bool bResult = On_Update();
780 
781  return( bResult );
782  }
783 
784  return( true );
785 }
786 
787 
789 // //
791 
792 //---------------------------------------------------------
794 {
795  if( pObject )// && pObject->is_Valid() )
796  {
797  Destroy();
798 
799  m_Name = pObject->Get_Name();
800  m_Projection = pObject->m_Projection;
801  Get_MetaData() = pObject->Get_MetaData();
802  // Get_History () = pObject->Get_History ();
803 
804  return( true );
805  }
806 
807  return( false );
808 }
809 
810 
812 // //
814 
815 //---------------------------------------------------------
816 #include "tool_chain.h"
817 
818 //---------------------------------------------------------
820 {
822 }
823 
824 
826 // //
827 // //
828 // //
830 
831 //---------------------------------------------------------
CSG_MetaData::Destroy
void Destroy(void)
Definition: metadata.cpp:140
CSG_Data_Object::Assign
virtual bool Assign(CSG_Data_Object *pObject)
Definition: dataobject.cpp:793
CSG_Data_Object::m_pOwner
CSG_Data_Object * m_pOwner
Definition: dataobject.h:271
CSG_Projection::Save
bool Save(const CSG_String &File, ESG_CRS_Format Format=ESG_CRS_Format::WKT) const
Definition: projections.cpp:227
SG_T
#define SG_T(s)
Definition: api_core.h:537
SG_Data_Object_Delete
bool SG_Data_Object_Delete(CSG_Data_Object *pObject)
Definition: dataobject.cpp:185
Min_Samples
#define Min_Samples
CSG_MetaData::Del_Child
bool Del_Child(int Index)
Definition: metadata.cpp:321
_TL
#define _TL(s)
Definition: api_core.h:1489
CSG_Data_Object::On_Reload
virtual bool On_Reload(void)=0
CSG_Data_Object::Set_File_Name
void Set_File_Name(const CSG_String &FileName)
Definition: dataobject.cpp:366
CSG_Data_Object::On_Delete
virtual bool On_Delete(void)=0
CSG_Data_Object::Get_History
CSG_MetaData & Get_History(void)
Definition: dataobject.h:236
CSG_Data_Object::Get_Description
const SG_Char * Get_Description(void) const
Definition: dataobject.cpp:360
CSG_Data_Object::Update
bool Update(bool bForce=false)
Definition: dataobject.cpp:773
CSG_Data_Object::Get_Managed
int Get_Managed(void) const
Definition: dataobject.h:192
CSG_MetaData::Set_Content
void Set_Content(const CSG_String &Content)
Definition: metadata.h:139
SG_Get_DataObject_Name
CSG_String SG_Get_DataObject_Name(TSG_Data_Object_Type Type)
Definition: dataobject.cpp:86
CSG_Data_Object::Save_MetaData
bool Save_MetaData(const CSG_String &FileName)
Definition: dataobject.cpp:677
SG_UI_Console_Print_StdOut
void SG_UI_Console_Print_StdOut(const char *Text, SG_Char End, bool bFlush)
Definition: api_callback.cpp:77
tool_chain.h
CSG_Data_Object::Get_Name
const SG_Char * Get_Name(void) const
Definition: dataobject.cpp:349
SG_DATAOBJECT_TYPE_Grids
@ SG_DATAOBJECT_TYPE_Grids
Definition: dataobject.h:119
CSG_Data_Object::asTIN
class CSG_TIN * asTIN(bool bPolymorph=false) const
Definition: dataobject.cpp:528
SG_Get_Create_Pointer
void * SG_Get_Create_Pointer(void)
Definition: dataobject.cpp:65
SG_File_Delete
SAGA_API_DLL_EXPORT bool SG_File_Delete(const CSG_String &FileName)
Definition: api_file.cpp:856
CSG_Data_Object::Get_ObjectType
virtual TSG_Data_Object_Type Get_ObjectType(void) const =0
Returns the object type as defined by TSG_Data_Object_Type. Used for run time type checking.
CSG_Data_Object::Set_Max_Samples
virtual bool Set_Max_Samples(sLong Max_Samples)
Definition: dataobject.cpp:617
CSG_MetaData::Save
bool Save(const CSG_String &File, const SG_Char *Extension=NULL) const
Definition: metadata.cpp:879
SG_FILE_R
@ SG_FILE_R
Definition: api_core.h:1109
ESG_CRS_Type::Geographic
@ Geographic
CSG_Data_Object::Set_Update_Flag
void Set_Update_Flag(bool bOn=true)
Definition: dataobject.h:285
CSG_File
Definition: api_core.h:1124
CSG_Data_Object::asShapes
class CSG_Shapes * asShapes(bool bPolymorph=false) const
Definition: dataobject.cpp:509
SG_File_Get_Name
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Name(const CSG_String &full_Path, bool bExtension)
Definition: api_file.cpp:878
CSG_TIN
Definition: tin.h:222
SG_File_Exists
SAGA_API_DLL_EXPORT bool SG_File_Exists(const CSG_String &FileName)
Definition: api_file.cpp:850
SG_META_SOURCE
#define SG_META_SOURCE
Definition: dataobject.h:89
CSG_Data_Object
Definition: dataobject.h:180
CSG_Data_Object::On_NoData_Changed
virtual bool On_NoData_Changed(void)
Definition: dataobject.cpp:601
CSG_Data_Object::asGrids
class CSG_Grids * asGrids(bool bPolymorph=false) const
Definition: dataobject.cpp:561
SG_DataObject_Get_Max_Samples
sLong SG_DataObject_Get_Max_Samples(void)
Definition: dataobject.cpp:139
SG_Get_DataObject_Identifier
CSG_String SG_Get_DataObject_Identifier(TSG_Data_Object_Type Type)
Definition: dataobject.cpp:71
DATAOBJECT_CREATE
#define DATAOBJECT_CREATE
Definition: dataobject.h:130
SG_META_HISTORY
#define SG_META_HISTORY
Definition: dataobject.h:93
sLong
signed long long sLong
Definition: api_core.h:158
SG_Set_History_Depth
void SG_Set_History_Depth(int Depth)
Definition: dataobject.cpp:154
CSG_Data_Object::On_Update
virtual bool On_Update(void)
Definition: dataobject.h:287
CSG_Projection::Get_Type
ESG_CRS_Type Get_Type(void) const
Definition: geo_tools.h:900
CSG_Data_Object::Get_File_Name
const SG_Char * Get_File_Name(bool bNative=true) const
Definition: dataobject.cpp:390
SG_Set_History_Ignore_Lists
void SG_Set_History_Ignore_Lists(int Ignore)
Definition: dataobject.cpp:167
SG_File_Get_Extension
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Extension(const CSG_String &FileName)
Definition: api_file.cpp:977
CSG_Data_Object::Set_Modified
virtual void Set_Modified(bool bOn=true)
Definition: dataobject.h:227
SG_FILE_W
@ SG_FILE_W
Definition: api_core.h:1110
CSG_Projection::Load
bool Load(const CSG_String &File)
Definition: projections.cpp:219
SG_DATAOBJECT_TYPE_TIN
@ SG_DATAOBJECT_TYPE_TIN
Definition: dataobject.h:122
dataobject.h
CSG_Data_Object::asTable
class CSG_Table * asTable(bool bPolymorph=false) const
Definition: dataobject.cpp:487
SG_DATAOBJECT_TYPE_Grid
@ SG_DATAOBJECT_TYPE_Grid
Definition: dataobject.h:118
SG_DataObject_Set_Max_Samples
bool SG_DataObject_Set_Max_Samples(sLong Max_Samples)
Definition: dataobject.cpp:126
CSG_Tool_Chain::Save_History_to_Model
static bool Save_History_to_Model(const CSG_MetaData &History, const CSG_String &File)
CSG_Data_Object::Set_Name
void Set_Name(const CSG_String &Name)
Definition: dataobject.cpp:300
CSG_MetaData::Assign
bool Assign(const CSG_MetaData &MetaData, bool bAddChildren=true)
Definition: metadata.cpp:757
CSG_String::Format
static CSG_String Format(const char *Format,...)
Definition: api_string.cpp:270
CSG_Projection
Definition: geo_tools.h:824
CSG_Table
Definition: table.h:283
SG_DATAOBJECT_TYPE_Shapes
@ SG_DATAOBJECT_TYPE_Shapes
Definition: dataobject.h:121
SG_File_Set_Extension
SAGA_API_DLL_EXPORT bool SG_File_Set_Extension(CSG_String &FileName, const CSG_String &Extension)
Definition: api_file.cpp:958
CSG_Data_Object::Get_Update_Flag
bool Get_Update_Flag(void)
Definition: dataobject.h:286
CSG_String::Clear
void Clear(void)
Definition: api_string.cpp:259
CSG_Data_Object::Delete
bool Delete(void)
Deletes all files associated with this data object if possible. Works only with native SAGA files....
Definition: dataobject.cpp:437
SG_Get_History_Ignore_Lists
int SG_Get_History_Ignore_Lists(void)
Definition: dataobject.cpp:172
SG_Char
#define SG_Char
Definition: api_core.h:536
SG_META_PROJECTION
#define SG_META_PROJECTION
Definition: dataobject.h:92
TSG_Data_Object_Type
TSG_Data_Object_Type
Definition: dataobject.h:117
CSG_String
Definition: api_core.h:563
CSG_Data_Object::asGrid
class CSG_Grid * asGrid(bool bPolymorph=false) const
Definition: dataobject.cpp:550
SG_DATAOBJECT_TYPE_Table
@ SG_DATAOBJECT_TYPE_Table
Definition: dataobject.h:120
SG_META_DATABASE
#define SG_META_DATABASE
Definition: dataobject.h:91
CSG_MetaData
Definition: metadata.h:88
CSG_Data_Object::Set_Description
void Set_Description(const CSG_String &Description)
Definition: dataobject.cpp:355
CSG_Data_Object::Save_History_to_Model
bool Save_History_to_Model(const CSG_String &File) const
Definition: dataobject.cpp:819
SG_Get_History_Depth
int SG_Get_History_Depth(void)
Definition: dataobject.cpp:159
CSG_MetaData::Load
bool Load(const CSG_String &File, const SG_Char *Extension=NULL)
Definition: metadata.cpp:786
CSG_String::is_Empty
bool is_Empty(void) const
Definition: api_string.cpp:178
CSG_Data_Object::Get_MetaData
CSG_MetaData & Get_MetaData(void) const
Definition: dataobject.h:234
CSG_Data_Object::Get_File_Type
int Get_File_Type(void) const
Definition: dataobject.cpp:409
g_History_Ignore_Lists
int g_History_Ignore_Lists
Definition: dataobject.cpp:165
CSG_Data_Object::Load_MetaData
bool Load_MetaData(const CSG_String &FileName)
Definition: dataobject.cpp:654
CSG_Data_Object::Fmt_Name
void Fmt_Name(const char *Format,...)
Definition: dataobject.cpp:313
CSG_Data_Object::asPointCloud
class CSG_PointCloud * asPointCloud(bool bPolymorph=false) const
Definition: dataobject.cpp:539
CSG_Grid
Definition: grid.h:475
CSG_Data_Object::Track
static void Track(bool Track=true, bool Offset=false)
Activate/deactivate lifetime tracking (data object construction/destruction). Needs compiler flag WIT...
Definition: dataobject.cpp:267
CSG_MetaData::Set_Name
void Set_Name(const CSG_String &Name)
Definition: metadata.h:129
CSG_Data_Object::Set_NoData_Value
virtual bool Set_NoData_Value(double Value)
Definition: dataobject.cpp:572
CSG_Shapes
Definition: shapes.h:775
CSG_String::c_str
const SG_Char * c_str(void) const
Definition: api_string.cpp:236
CSG_Data_Object::CSG_Data_Object
CSG_Data_Object(void)
Definition: dataobject.cpp:205
CSG_PointCloud
Definition: pointcloud.h:105
CSG_MetaData::Add_Child
CSG_MetaData * Add_Child(void)
Definition: metadata.cpp:166
CSG_Data_Object::Reload
bool Reload(void)
If there is an associated file data can be reloaded with this command.
Definition: dataobject.cpp:425
CSG_Data_Object::~CSG_Data_Object
virtual ~CSG_Data_Object(void)
Definition: dataobject.cpp:246
CSG_Grids
Definition: grids.h:119
g_History_Depth
int g_History_Depth
Definition: dataobject.cpp:152
CSG_Data_Object::Set_NoData_Value_Range
virtual bool Set_NoData_Value_Range(double Lower, double Upper)
Definition: dataobject.cpp:578
CSG_Data_Object::Get_Projection
CSG_Projection & Get_Projection(void)
Definition: dataobject.cpp:637
CSG_Data_Object::Destroy
virtual bool Destroy(void)
Definition: dataobject.cpp:281
SG_Get_DataObject_Class_Name
CSG_String SG_Get_DataObject_Class_Name(TSG_Data_Object_Type Type)
Definition: dataobject.cpp:101
SG_DATAOBJECT_TYPE_PointCloud
@ SG_DATAOBJECT_TYPE_PointCloud
Definition: dataobject.h:123
SG_META_FILEPATH
#define SG_META_FILEPATH
Definition: dataobject.h:90
gSG_DataObject_Max_Samples
static sLong gSG_DataObject_Max_Samples
Definition: dataobject.cpp:123