SAGA API v9.10
Loading...
Searching...
No Matches
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//---------------------------------------------------------
143
144
146// //
147// //
148// //
150
151//---------------------------------------------------------
153
154void 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//---------------------------------------------------------
264bool CSG_Data_Object::m_Track = false; int CSG_Data_Object::m_Track_nObjects = 0; int CSG_Data_Object::m_Track_Offset = 0;
265
266//---------------------------------------------------------
267void 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//---------------------------------------------------------
298void CSG_Data_Object::Set_Name(const char *Name) { Set_Name(CSG_String(Name)); }
299void 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//---------------------------------------------------------
313void 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//---------------------------------------------------------
330void 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//---------------------------------------------------------
372void 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
386 if( m_Name.is_Empty() || m_Name.Cmp(_TL("Data")) == 0 )
387 {
388 m_Name = SG_File_Get_Name(FileName, false);
389 }
390 }
391}
392
393//---------------------------------------------------------
394const SG_Char * CSG_Data_Object::Get_File_Name(bool bNative) const
395{
396 if( bNative && !m_File_bNative )
397 {
398 return( SG_T("") );
399 }
400
401 if( m_pOwner )
402 {
403 if( m_pOwner->Get_ObjectType() == SG_DATAOBJECT_TYPE_Grids )
404 {
405 return( m_pOwner->m_FileName.c_str() );
406 }
407 }
408
409 return( m_FileName.c_str() );
410}
411
412//---------------------------------------------------------
414{
415 return( m_File_Type );
416}
417
418
420// //
422
423//---------------------------------------------------------
424/*
425* If the data object has a file association, this function
426* can be used to reload its content.
427*/
428//---------------------------------------------------------
430{
431 return( SG_File_Exists(m_FileName) && On_Reload() );
432}
433
434//---------------------------------------------------------
435/*
436* If the data object is stored in a native SAGA format,
437* this function can be used to delete all files associated
438* with it.
439*/
440//---------------------------------------------------------
442{
443 if( m_File_bNative && SG_File_Exists(m_FileName) && On_Delete() )
444 {
445 CSG_String FileName = m_FileName;
446
447 switch( Get_ObjectType() )
448 {
449 case SG_DATAOBJECT_TYPE_Grid : SG_File_Set_Extension(FileName, "mgrd" ); break;
450 case SG_DATAOBJECT_TYPE_Grids : SG_File_Set_Extension(FileName, "sg-info"); break;
451 case SG_DATAOBJECT_TYPE_Table : SG_File_Set_Extension(FileName, "mtab" ); break;
452 case SG_DATAOBJECT_TYPE_Shapes : SG_File_Set_Extension(FileName, "mshp" ); break;
453 case SG_DATAOBJECT_TYPE_TIN : SG_File_Set_Extension(FileName, "sg-info"); break;
454 case SG_DATAOBJECT_TYPE_PointCloud: SG_File_Set_Extension(FileName, "sg-info"); break;
455 default : SG_File_Set_Extension(FileName, "sg-info"); break;
456 }
457
458 SG_File_Delete(FileName);
459
460 SG_File_Set_Extension(FileName, "prj"); SG_File_Delete(FileName);
461 SG_File_Set_Extension(FileName, "sg-prj"); SG_File_Delete(FileName);
462
463 //-------------------------------------------------
464 m_FileName = "";
465 m_File_bNative = false;
466 m_File_Type = 0;
467
468 m_bModified = true;
469
470 m_pMD_Database->Destroy();
471
472 return( true );
473 }
474
475 return( false );
476}
477
478
480// //
482
483//---------------------------------------------------------
484/*
485* Type cast function. Returns NULL if object is not exactly
486* of class type CSG_Table with bPolymorph = false or of
487* one of its derivatives (CSG_Shapes, CSG_PointCloud,
488* CSG_TIN) with bPolymorph = true.
489*/
490//---------------------------------------------------------
491CSG_Table * CSG_Data_Object::asTable(bool bPolymorph) const
492{
493 if( bPolymorph )
494 {
499 ? (CSG_Table *)this : NULL
500 );
501 }
502
503 return( Get_ObjectType() == SG_DATAOBJECT_TYPE_Table ? (CSG_Table *)this : NULL );
504}
505
506//---------------------------------------------------------
507/*
508* Type cast function. Returns NULL if object is not exactly
509* of class type CSG_Shapes with bPolymorph = false or of
510* one of its derivatives (CSG_PointCloud) with bPolymorph = true.
511*/
512//---------------------------------------------------------
513CSG_Shapes * CSG_Data_Object::asShapes(bool bPolymorph) const
514{
515 if( bPolymorph )
516 {
519 ? (CSG_Shapes *)this : NULL
520 );
521 }
522
523 return( Get_ObjectType() == SG_DATAOBJECT_TYPE_Shapes ? (CSG_Shapes *)this : NULL );
524}
525
526//---------------------------------------------------------
527/*
528* Type cast function. Returns NULL if object is not exactly
529* of class type CSG_TIN. The bPolymorph flag has no effect.
530*/
531//---------------------------------------------------------
532CSG_TIN * CSG_Data_Object::asTIN(bool bPolymorph) const
533{
534 return( Get_ObjectType() == SG_DATAOBJECT_TYPE_TIN ? (CSG_TIN *)this : NULL );
535}
536
537//---------------------------------------------------------
538/*
539* Type cast function. Returns NULL if object is not exactly
540* of class type CSG_PointCloud. The bPolymorph flag has no effect.
541*/
542//---------------------------------------------------------
544{
545 return( Get_ObjectType() == SG_DATAOBJECT_TYPE_PointCloud ? (CSG_PointCloud *)this : NULL );
546}
547
548//---------------------------------------------------------
549/*
550* Type cast function. Returns NULL if object is not exactly
551* of class type CSG_Grid. The bPolymorph flag has no effect.
552*/
553//---------------------------------------------------------
554CSG_Grid * CSG_Data_Object::asGrid(bool bPolymorph) const
555{
556 return( Get_ObjectType() == SG_DATAOBJECT_TYPE_Grid ? (CSG_Grid *)this : NULL );
557}
558
559//---------------------------------------------------------
560/*
561* Type cast function. Returns NULL if object is not exactly
562* of class type CSG_Grids. The bPolymorph flag has no effect.
563*/
564//---------------------------------------------------------
565CSG_Grids * CSG_Data_Object::asGrids(bool bPolymorph) const
566{
567 return( Get_ObjectType() == SG_DATAOBJECT_TYPE_Grids ? (CSG_Grids *)this : NULL );
568}
569
570
572// //
574
575//---------------------------------------------------------
577{
578 return( Set_NoData_Value_Range(Value, Value) );
579}
580
581//---------------------------------------------------------
582bool CSG_Data_Object::Set_NoData_Value_Range(double Lower, double Upper)
583{
584 if( Lower > Upper )
585 {
586 double d = Lower; Lower = Upper; Upper = d;
587 }
588
589 if( Lower != m_NoData_Value[0] || Upper != m_NoData_Value[1] )
590 {
591 m_NoData_Value[0] = Lower;
592 m_NoData_Value[1] = Upper;
593
594 Set_Modified();
595
597
598 return( true );
599 }
600
601 return( false );
602}
603
604//---------------------------------------------------------
606{
607 if( !Get_Update_Flag() )
608 {
610 }
611
612 return( true );
613}
614
615
617// //
619
620//---------------------------------------------------------
622{
623 #define Min_Samples 100
624
625 if( m_Max_Samples != Max_Samples && Max_Samples >= Min_Samples )
626 {
627 m_Max_Samples = Max_Samples;
628
629 Update(true);
630 }
631
632 return( true );
633}
634
635
637// //
639
640//---------------------------------------------------------
642{
643 return( m_pOwner ? m_pOwner->m_Projection : m_Projection );
644}
645
646//---------------------------------------------------------
648{
649 return( m_pOwner ? m_pOwner->m_Projection : m_Projection );
650}
651
652
654// //
656
657//---------------------------------------------------------
659{
660 CSG_String FileName(_FileName);
661
662 switch( Get_ObjectType() )
663 {
664 case SG_DATAOBJECT_TYPE_Grid : SG_File_Set_Extension(FileName, "mgrd" ); break;
665 case SG_DATAOBJECT_TYPE_Grids : SG_File_Set_Extension(FileName, "sg-info"); break;
666 case SG_DATAOBJECT_TYPE_Table : SG_File_Set_Extension(FileName, "mtab" ); break;
667 case SG_DATAOBJECT_TYPE_Shapes : SG_File_Set_Extension(FileName, "mshp" ); break;
668 case SG_DATAOBJECT_TYPE_TIN : SG_File_Set_Extension(FileName, "sg-info"); break;
669 case SG_DATAOBJECT_TYPE_PointCloud: SG_File_Set_Extension(FileName, "sg-info");
670 if( !SG_File_Get_Extension(_FileName).CmpNoCase("spc") )
671 {
672 SG_File_Set_Extension(FileName, "mpts");
673 }
674 break;
675
676 default: return( false );
677 }
678
679 CSG_File Stream(FileName, SG_FILE_R, false);
680
681 return( Load_MetaData(Stream) );
682}
683
684//---------------------------------------------------------
686{
687 CSG_String FileName(_FileName);
688
689 switch( Get_ObjectType() )
690 {
691 case SG_DATAOBJECT_TYPE_Grid : SG_File_Set_Extension(FileName, "mgrd" ); break;
692 case SG_DATAOBJECT_TYPE_Grids : SG_File_Set_Extension(FileName, "sg-info"); break;
693 case SG_DATAOBJECT_TYPE_Table : SG_File_Set_Extension(FileName, "mtab" ); break;
694 case SG_DATAOBJECT_TYPE_Shapes : SG_File_Set_Extension(FileName, "mshp" ); break;
695 case SG_DATAOBJECT_TYPE_TIN : SG_File_Set_Extension(FileName, "sg-info"); break;
696 case SG_DATAOBJECT_TYPE_PointCloud: SG_File_Set_Extension(FileName, "sg-info"); break;
697
698 default: return( false );
699 }
700
701 CSG_File Stream(FileName, SG_FILE_W, false);
702
703 return( Save_MetaData(Stream) );
704}
705
706//---------------------------------------------------------
708{
709 CSG_MetaData m;
710
711 if( !m.Load(Stream) )
712 {
713 return( false );
714 }
715
716 //-----------------------------------------------------
717 if( m("DESCRIPTION") && !m["DESCRIPTION"].Get_Content().is_Empty() )
718 {
719 Set_Description(m["DESCRIPTION"].Get_Content());
720 }
721
722 //-----------------------------------------------------
723 m_pMD_Source->Destroy();
724
725 if( m(SG_META_SOURCE) )
726 m_pMD_Source->Assign(m[SG_META_SOURCE]);
727
728 //-----------------------------------------------------
729 m_pMD_Database->Destroy();
730
731 if( m(SG_META_DATABASE) )
732 m_pMD_Database->Assign(m[SG_META_DATABASE]);
733
734 //-----------------------------------------------------
735 m_MetaData.Del_Child(SG_META_PROJECTION);
736
737 if( m(SG_META_PROJECTION) && m_Projection.Load(m[SG_META_PROJECTION]) )
738 m_MetaData.Add_Child(m[SG_META_PROJECTION]);
740 m_MetaData.Add_Child(m[SG_META_SOURCE][SG_META_PROJECTION]);
741
742 //-----------------------------------------------------
743 m_pMD_History->Destroy();
744
745 if( m(SG_META_HISTORY) )
746 m_pMD_History->Assign(m[SG_META_HISTORY]);
747 else
748 m_pMD_History->Add_Child(SG_META_FILEPATH, Get_File_Name());
749
750 return( true );
751}
752
753//---------------------------------------------------------
755{
756 //-----------------------------------------------------
757 if( m_MetaData(SG_META_FILEPATH) )
758 m_MetaData(SG_META_FILEPATH)->Set_Content(m_FileName);
759 else
760 m_MetaData.Add_Child(SG_META_FILEPATH, m_FileName);
761
762 //-----------------------------------------------------
763 if( m_MetaData("DESCRIPTION") )
764 m_MetaData("DESCRIPTION")->Set_Content(Get_Description());
765 else
766 m_MetaData.Add_Child("DESCRIPTION", Get_Description());
767
768 //-----------------------------------------------------
769 if( m_Projection.Get_Type() == ESG_CRS_Type::Undefined )
770 m_MetaData.Del_Child(SG_META_PROJECTION);
771 else if( m_MetaData(SG_META_PROJECTION) )
772 m_Projection.Save(*m_MetaData(SG_META_PROJECTION));
773 else
774 m_Projection.Save(*m_MetaData.Add_Child(SG_META_PROJECTION));
775
776 //-----------------------------------------------------
777 return( m_MetaData.Save(Stream) );
778}
779
780//---------------------------------------------------------
781bool CSG_Data_Object::Update(bool bForce)
782{
783 if( m_bUpdate || bForce )
784 {
785 m_bUpdate = false;
786
787 bool bResult = On_Update();
788
789 return( bResult );
790 }
791
792 return( true );
793}
794
795
797// //
799
800//---------------------------------------------------------
801bool CSG_Data_Object::Assign(CSG_Data_Object *pObject, bool bProgress)
802{
803 if( pObject )// && pObject->is_Valid() )
804 {
805 Destroy();
806
807 m_Name = pObject->Get_Name();
808 m_Description = pObject->Get_Description();
809 m_Projection = pObject->m_Projection;
810 Get_MetaData() = pObject->Get_MetaData();
811 // Get_History () = pObject->Get_History ();
812 Set_NoData_Value_Range(pObject->m_NoData_Value[0], pObject->m_NoData_Value[1]);
813
814 return( true );
815 }
816
817 return( false );
818}
819
820
822// //
824
825//---------------------------------------------------------
826#include "tool_chain.h"
827
828//---------------------------------------------------------
833
834
836// //
837// //
838// //
840
841//---------------------------------------------------------
void SG_UI_Console_Print_StdOut(const char *Text, SG_Char End, bool bFlush)
SAGA_API_DLL_EXPORT bool SG_File_Exists(const CSG_String &FileName)
signed long long sLong
Definition api_core.h:158
#define SG_T(s)
Definition api_core.h:537
SAGA_API_DLL_EXPORT bool SG_File_Delete(const CSG_String &FileName)
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Name(const CSG_String &full_Path, bool bExtension)
SAGA_API_DLL_EXPORT bool SG_File_Set_Extension(CSG_String &File, const CSG_String &Extension)
#define SG_Char
Definition api_core.h:536
#define _TL(s)
Definition api_core.h:1568
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Extension(const CSG_String &File)
@ SG_FILE_W
Definition api_core.h:1115
@ SG_FILE_R
Definition api_core.h:1114
const SG_Char * Get_Name(void) const
CSG_Data_Object * m_pOwner
Definition dataobject.h:271
int Get_File_Type(void) const
virtual bool On_NoData_Changed(void)
void Set_Name(const CSG_String &Name)
void Set_Update_Flag(bool bOn=true)
Definition dataobject.h:285
virtual bool Set_Max_Samples(sLong Max_Samples)
int Get_Managed(void) const
Definition dataobject.h:192
bool Save_MetaData(const CSG_String &FileName)
bool Get_Update_Flag(void)
Definition dataobject.h:286
CSG_MetaData & Get_MetaData(void) const
Definition dataobject.h:234
virtual bool Set_NoData_Value_Range(double Lower, double Upper)
const SG_Char * Get_File_Name(bool bNative=true) const
bool Load_MetaData(const CSG_String &FileName)
bool Update(bool bForce=false)
virtual bool Destroy(void)
class CSG_PointCloud * asPointCloud(bool bPolymorph=false) const
class CSG_TIN * asTIN(bool bPolymorph=false) const
void Set_Description(const CSG_String &Description)
virtual void Set_Modified(bool bOn=true)
Definition dataobject.h:227
class CSG_Shapes * asShapes(bool bPolymorph=false) const
virtual ~CSG_Data_Object(void)
CSG_MetaData & Get_History(void)
Definition dataobject.h:236
virtual bool Set_NoData_Value(double Value)
virtual bool Assign(CSG_Data_Object *pObject, bool bProgress=false)
const SG_Char * Get_Description(void) const
virtual bool On_Update(void)
Definition dataobject.h:287
bool Save_History_to_Model(const CSG_String &File) const
CSG_Projection & Get_Projection(void)
virtual bool On_Delete(void)=0
class CSG_Grids * asGrids(bool bPolymorph=false) const
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.
void Fmt_Name(const char *Format,...)
class CSG_Grid * asGrid(bool bPolymorph=false) const
virtual bool On_Reload(void)=0
void Set_File_Name(const CSG_String &FileName)
bool Delete(void)
Deletes all files associated with this data object if possible. Works only with native SAGA files....
static void Track(bool Track=true, bool Offset=false)
Activate/deactivate lifetime tracking (data object construction/destruction). Needs compiler flag WIT...
class CSG_Table * asTable(bool bPolymorph=false) const
bool Reload(void)
If there is an associated file data can be reloaded with this command.
bool Load(const CSG_String &File, const SG_Char *Extension=NULL)
Definition metadata.cpp:786
void Destroy(void)
Definition metadata.cpp:140
static CSG_String Format(const char *Format,...)
bool is_Empty(void) const
Definition tin.h:222
static bool Save_History_to_Model(const CSG_MetaData &History, const CSG_String &File)
int g_History_Depth
int SG_Get_History_Depth(void)
void * SG_Get_Create_Pointer(void)
void SG_Set_History_Depth(int Depth)
bool SG_Data_Object_Delete(CSG_Data_Object *pObject)
sLong SG_DataObject_Get_Max_Samples(void)
static sLong gSG_DataObject_Max_Samples
void SG_Set_History_Ignore_Lists(int Ignore)
int SG_Get_History_Ignore_Lists(void)
CSG_String SG_Get_DataObject_Name(TSG_Data_Object_Type Type)
bool SG_DataObject_Set_Max_Samples(sLong Max_Samples)
CSG_String SG_Get_DataObject_Identifier(TSG_Data_Object_Type Type)
int g_History_Ignore_Lists
CSG_String SG_Get_DataObject_Class_Name(TSG_Data_Object_Type Type)
#define Min_Samples
TSG_Data_Object_Type
Definition dataobject.h:117
@ SG_DATAOBJECT_TYPE_PointCloud
Definition dataobject.h:123
@ SG_DATAOBJECT_TYPE_Grids
Definition dataobject.h:119
@ SG_DATAOBJECT_TYPE_TIN
Definition dataobject.h:122
@ SG_DATAOBJECT_TYPE_Shapes
Definition dataobject.h:121
@ SG_DATAOBJECT_TYPE_Grid
Definition dataobject.h:118
@ SG_DATAOBJECT_TYPE_Table
Definition dataobject.h:120
#define DATAOBJECT_CREATE
Definition dataobject.h:130
#define SG_META_DATABASE
Definition dataobject.h:91
#define SG_META_HISTORY
Definition dataobject.h:93
#define SG_META_FILEPATH
Definition dataobject.h:90
#define SG_META_SOURCE
Definition dataobject.h:89
#define SG_META_PROJECTION
Definition dataobject.h:92