SAGA API Version 9.14
Loading...
Searching...
No Matches
api_core.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// api_core.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 Hamburg //
44// Germany //
45// //
46// e-mail: oconrad@saga-gis.org //
47// //
49
50//---------------------------------------------------------
51#include <wx/utils.h>
52#include <wx/app.h>
53#include <wx/dir.h>
54#include <wx/stdpaths.h>
55#include <wx/html/winpars.h>
56
57#include "api_core.h"
58#include "tool_library.h"
59
60
62// //
63// //
64// //
66
67//---------------------------------------------------------
68#ifdef _OPENMP
69
70#include <omp.h>
71
72//---------------------------------------------------------
73int g_SG_OMP_Max_Num_Threads = omp_get_num_procs();
74
75//---------------------------------------------------------
76void SG_OMP_Set_Max_Num_Threads (int iCores)
77{
78 if( iCores < 1 )
79 {
80 iCores = 1;
81 }
82 else if( iCores > omp_get_num_procs() )
83 {
84 iCores = omp_get_num_procs();
85 }
86
87 omp_set_num_threads(g_SG_OMP_Max_Num_Threads = iCores);
88}
89
90//---------------------------------------------------------
92{
93 return( g_SG_OMP_Max_Num_Threads );
94}
95
96//---------------------------------------------------------
98{
99 return( omp_get_num_procs() );
100}
101
102//---------------------------------------------------------
103int SG_OMP_Get_Thread_Num (void)
104{
105 return( omp_get_thread_num() );
106}
107
108//---------------------------------------------------------
109#else
110void SG_OMP_Set_Max_Num_Threads (int iCores) {}
111int SG_OMP_Get_Max_Num_Threads (void) { return( 1 ); }
112int SG_OMP_Get_Max_Num_Procs (void) { return( 1 ); }
113int SG_OMP_Get_Thread_Num (void) { return( 0 ); }
114#endif
115
116
118// //
119// //
120// //
122
123//---------------------------------------------------------
125{
126 switch( Type )
127 {
128 case SG_DATATYPE_Bit : return( _TL("bit" ) );
129 case SG_DATATYPE_Byte : return( bShort ? _TL("uint8" ) : _TL("unsigned 1 byte integer" ) );
130 case SG_DATATYPE_Char : return( bShort ? _TL("int8" ) : _TL("signed 1 byte integer" ) );
131 case SG_DATATYPE_Word : return( bShort ? _TL("uint16") : _TL("unsigned 2 byte integer" ) );
132 case SG_DATATYPE_Short : return( bShort ? _TL("int16" ) : _TL("signed 2 byte integer" ) );
133 case SG_DATATYPE_DWord : return( bShort ? _TL("uint32") : _TL("unsigned 4 byte integer" ) );
134 case SG_DATATYPE_Int : return( bShort ? _TL("int32" ) : _TL("signed 4 byte integer" ) );
135 case SG_DATATYPE_ULong : return( bShort ? _TL("uint64") : _TL("unsigned 8 byte integer" ) );
136 case SG_DATATYPE_Long : return( bShort ? _TL("int64" ) : _TL("signed 8 byte integer" ) );
137 case SG_DATATYPE_Float : return( bShort ? _TL("float" ) : _TL("4 byte floating point number") );
138 case SG_DATATYPE_Double: return( bShort ? _TL("double") : _TL("8 byte floating point number") );
139 case SG_DATATYPE_String: return( _TL("string") );
140 case SG_DATATYPE_Date : return( _TL("date" ) );
141 case SG_DATATYPE_Color : return( _TL("color" ) );
142 case SG_DATATYPE_Binary: return( _TL("binary") );
143 default : return( bShort ? _TL("none" ) : _TL("undefined" ) );
144 }
145};
146
147//---------------------------------------------------------
152
153//---------------------------------------------------------
155{
156 if( !Identifier.Cmp(gSG_Data_Type_Identifier[SG_DATATYPE_Bit ]) ) return( SG_DATATYPE_Bit );
157 if( !Identifier.Cmp(gSG_Data_Type_Identifier[SG_DATATYPE_Byte ]) ) return( SG_DATATYPE_Byte );
158 if( !Identifier.Cmp(gSG_Data_Type_Identifier[SG_DATATYPE_Char ]) ) return( SG_DATATYPE_Char );
159 if( !Identifier.Cmp(gSG_Data_Type_Identifier[SG_DATATYPE_Word ]) ) return( SG_DATATYPE_Word );
162 if( !Identifier.Cmp(gSG_Data_Type_Identifier[SG_DATATYPE_Int ]) ) return( SG_DATATYPE_Int );
164 if( !Identifier.Cmp(gSG_Data_Type_Identifier[SG_DATATYPE_Long ]) ) return( SG_DATATYPE_Long );
168 if( !Identifier.Cmp(gSG_Data_Type_Identifier[SG_DATATYPE_Date ]) ) return( SG_DATATYPE_Date );
170
171 return( SG_DATATYPE_Undefined );
172}
173
174//---------------------------------------------------------
176{
177 switch( Type )
178 {
179 case SG_DATATYPE_Bit : return( SG_DATATYPES_Bit );
180 case SG_DATATYPE_Byte : return( SG_DATATYPES_Byte );
181 case SG_DATATYPE_Char : return( SG_DATATYPES_Char );
182 case SG_DATATYPE_Word : return( SG_DATATYPES_Word );
183 case SG_DATATYPE_Short : return( SG_DATATYPES_Short );
184 case SG_DATATYPE_DWord : return( SG_DATATYPES_DWord );
185 case SG_DATATYPE_Int : return( SG_DATATYPES_Int );
186 case SG_DATATYPE_ULong : return( SG_DATATYPES_ULong );
187 case SG_DATATYPE_Long : return( SG_DATATYPES_Long );
188 case SG_DATATYPE_Float : return( SG_DATATYPES_Float );
191 case SG_DATATYPE_Date : return( SG_DATATYPES_Date );
192 case SG_DATATYPE_Color : return( SG_DATATYPES_Color );
194 default : return( SG_DATATYPES_Undefined );
195 }
196};
197
198//---------------------------------------------------------
200{
201 switch( Type )
202 {
203 case SG_DATATYPE_Bit :
204 case SG_DATATYPE_Byte :
205 case SG_DATATYPE_Char :
206 case SG_DATATYPE_Word :
207 case SG_DATATYPE_Short :
208 case SG_DATATYPE_DWord :
209 case SG_DATATYPE_Int :
210 case SG_DATATYPE_ULong :
211 case SG_DATATYPE_Long :
212 case SG_DATATYPE_Float :
214 return( true );
215
217 case SG_DATATYPE_Date :
218 case SG_DATATYPE_Color :
219 case SG_DATATYPE_Binary: default:
220 return( false );
221 }
222}
223
224//---------------------------------------------------------
226{
227 double min, max;
228
229 switch( Type )
230 {
231 default:
232 case SG_DATATYPE_Double: Value = (double)Value; return( true );
233 case SG_DATATYPE_Float : Value = (float )Value; return( true );
234
235 case SG_DATATYPE_Bit : min = 0.; max = 1.; break;
236 case SG_DATATYPE_Byte : min = 0.; max = 255.; break;
237 case SG_DATATYPE_Char : min = -128.; max = 127.; break;
238 case SG_DATATYPE_Word : min = 0.; max = 65535.; break;
239 case SG_DATATYPE_Short : min = -32768.; max = 32767.; break;
240 case SG_DATATYPE_DWord : min = 0.; max = 4294967295.; break;
241 case SG_DATATYPE_Int : min = -2147483648.; max = 2147483647.; break;
242 }
243
244 if( Value < min )
245 {
246 Value = min;
247 }
248 else if( Value > max )
249 {
250 Value = max;
251 }
252
253 return( true );
254}
255
256
258// //
259// Environment //
260// //
262
263//---------------------------------------------------------
264#if defined(_SAGA_MSW)
265bool SG_Environment_Add_Dll_Paths(const CSG_String &Directory);
266#endif
267
268//---------------------------------------------------------
269static struct SSG_Environment
270{
271 bool wxInitialized = false;
272
273 wxApp *pApp = NULL;
274
275 wxHtmlTagsModule *pHtmlTags = NULL;
276
277 CSG_String App_FullPath, App_Path, App_Name, API_Path;
278
279 CSG_MetaData Options;
280}
282
283
285// //
287
288//---------------------------------------------------------
289bool CSG_Environment::Initialize(bool bInitializeWX, bool bInitializeGUI, bool bProjections, bool bLibraries, const SG_Char *SAGA_Path)
290{
291 static bool bInitialized = false;
292
293 if( bInitialized )
294 {
295 #ifdef _DEBUG
296 SG_UI_Console_Print_StdOut("\n!!! WARNING - Environment has already been initialized (=> saga_api/api_core.cpp) !!!");
297 #endif
298
299 return( false );
300 }
301
302 bInitialized = true;
303
304 //-----------------------------------------------------
305 #ifdef _DEBUG
306 SG_UI_Console_Print_StdOut("\n!!! Loading SAGA API => DEBUG !!!");
307 #endif
308
309 //-----------------------------------------------------
310 if( bInitializeGUI )
311 {
312 theEnvironment.pApp = new wxApp();
313
314 theEnvironment.pHtmlTags = new wxHtmlTagsModule();
315 }
316
317 if( bInitializeWX && theEnvironment.wxInitialized == false )
318 {
319 theEnvironment.wxInitialized = wxInitialize();
320
321 if( theEnvironment.wxInitialized == false )
322 {
323 SG_UI_Console_Print_StdErr("\nFailed to run wxInitialize()!");
324 }
325 }
326
327 //-----------------------------------------------------
328 /* workaround: wxwidgets 2.9.3 is complaining about setlocale
329 * mismatch between c setlocale and wxLocale. since saga has its own
330 * translation system, we use english as default. this assures
331 * using . as decimal separator in printf like formatting of
332 * floating point values. wxXLocale is currently not fully
333 * implemented (wxPrintf_l and similar still missing).
334 */
335
336 wxLocale Locale; Locale.Init(wxLANGUAGE_ENGLISH);
337
338 setlocale(LC_NUMERIC, "C");
339
340 //-----------------------------------------------------
342
343 //-----------------------------------------------------
344 #if defined(_SAGA_MSW)
345 {
346 SetDefaultDllDirectories(
347 LOAD_LIBRARY_SEARCH_APPLICATION_DIR |
348 LOAD_LIBRARY_SEARCH_USER_DIRS |
349 LOAD_LIBRARY_SEARCH_SYSTEM32
350 );
351
352 CSG_String API_Path;
353
354 if( SAGA_Path && SG_Dir_Exists(SAGA_Path) )
355 {
356 API_Path = SAGA_Path;
357 }
358 else
359 {
360 API_Path = Get_Application_Path(true).c_str();
361 }
362
363 Set_API_Path(API_Path);
364
365 if( !AddDllDirectory(API_Path.c_str()) )
366 {
367 SG_UI_Console_Print_StdErr(CSG_String::Format("Failed to add application directory to path environment!\n> %s\n", API_Path.c_str()));
368
369 return( false );
370 }
371
372 SG_Environment_Add_Dll_Paths(SG_File_Make_Path(API_Path, "dll"));
373 }
374
375 //-----------------------------------------------------
376 #elif defined(__WXMAC__)
377 {
379
380 if( SG_Dir_Exists(Path + "/proj-data" ) ) { Set_Option("PROJ_LIB" , Path + "/proj-data" ); } // AppBundle
381 if( SG_Dir_Exists(Path + "/gdal-data" ) ) { Set_Option("GDAL_DATA" , Path + "/gdal-data" ); } // AppBundle
382 if( SG_Dir_Exists(Path + "/gdal-plugins") ) { Set_Option("GDAL_DRIVER_PATH", Path + "/gdal-plugins"); } // AppBundle
383
384 if( SG_File_Exists(Path + "/curl-ca-bundle.crt") ) { Set_Variable("CURL_CA_BUNDLE", Path + "/curl-ca-bundle.crt"); } // AppBundle
385 }
386
387 //-----------------------------------------------------
388 #else // #if defined(_SAGA_LINUX)
389 {
390 #if defined(__WXGTK__)
391 #if !defined(_DEBUG)
392 wxApp::GTKSuppressDiagnostics();
393 #endif
394
395 wxApp::GTKAllowDiagnosticsControl(); // allow wxWidgets to suppress some spurious GTK error messages
396 #endif
397 }
398 #endif
399
400 //-----------------------------------------------------
401 SG_Get_Projections().Create(bProjections);
402
403 if( bLibraries )
404 {
406 }
407
408 //-----------------------------------------------------
410
411 return( true );
412}
413
414//---------------------------------------------------------
416{
417 if( theEnvironment.wxInitialized )
418 {
419 wxUninitialize();
420
421 theEnvironment.wxInitialized = false;
422 }
423
424 return( true );
425}
426
427
429// //
431
432//---------------------------------------------------------
434{
435 if( theEnvironment.App_FullPath.is_Empty() )
436 {
437 theEnvironment.App_FullPath = wxStandardPaths::Get().GetExecutablePath().wx_str();
438
440
441 theEnvironment.App_Path = SG_File_Get_Path(theEnvironment.App_FullPath);
442 }
443
444 return( bPathOnly ? theEnvironment.App_Path : theEnvironment.App_FullPath );
445}
446
447//---------------------------------------------------------
449{
450 if( theEnvironment.App_Name.is_Empty() )
451 {
452 theEnvironment.App_Name = SG_File_Get_Name(Get_Application_Path(false), false);
453 }
454
455 return( theEnvironment.App_Name );
456}
457
458//---------------------------------------------------------
460{
461 theEnvironment.App_Name = Name;
462
463 return( true );
464}
465
466//---------------------------------------------------------
468{
469 if( SG_Dir_Exists(Path) )
470 {
471 theEnvironment.API_Path = Path;
472
473 return( true );
474 }
475
476 return( false );
477}
478
479//---------------------------------------------------------
481{
482 if( theEnvironment.API_Path.is_Empty() && theEnvironment.App_Name.Find("saga") == 0 )
483 {
484 theEnvironment.API_Path = Get_Application_Path(true);
485 }
486
487 return( theEnvironment.API_Path );
488}
489
490//---------------------------------------------------------
492{
493 CSG_String Path;
494
495 #if defined(_SAGA_MSW)
496 {
497 Path = Get_Application_Path(true);
498 }
499 #elif defined(__WXMAC__)
500 {
501 Path = Get_Application_Path(true);
502
503 if( Path.Find("SAGA.app/Contents/MacOS") > 0 ) // AppBundle
504 {
505 Path = Path.Left(Path.Find("SAGA.app/Contents/MacOS")) + "SAGA.app/Contents/Share";
506 }
507 else
508 {
509 Path.Clear();
510
511 #ifdef SHARE_PATH
512 Path = SHARE_PATH;
513 #endif
514 }
515 }
516 #else // defined(_SAGA_LINUX)
517 {
518 #ifdef SHARE_PATH
519 Path = SHARE_PATH;
520 #endif
521 }
522 #endif
523
524 return( SG_File_Make_Path(Path, AddPath) );
525}
526
527//---------------------------------------------------------
529{
531
532 #if defined(_SAGA_MSW)
533 {
534 Path = SG_File_Make_Path(Path, "resources");
535 }
536 #endif
537
538 return( SG_File_Make_Path(Path, AddPath) );
539}
540
541//---------------------------------------------------------
543{
544 CSG_Strings Paths;
545
546 #if defined(_SAGA_MSW)
547 {
549 }
550 #elif defined(__WXMAC__)
551 {
552 CSG_String Path = Get_Application_Path(true);
553
554 if( Path.Find("SAGA.app/Contents/MacOS") > 0 ) // AppBundle
555 {
556 Path = Path.Left(Path.Find("SAGA.app/Contents/MacOS")) + "SAGA.app/Contents";
557
558 Paths += Path + "/Tools";
559 Paths += Path + "/Share/toolchains";
560 }
561 else
562 {
563 #ifdef TOOLS_PATH
564 Paths += TOOLS_PATH;
565 #endif
566
567 #ifdef SHARE_PATH
568 Paths += SG_File_Make_Path(SHARE_PATH, "toolchains");
569 #endif
570 }
571 }
572 #else // #if defined(_SAGA_LINUX)
573 {
574 #ifdef TOOLS_PATH
575 Paths += TOOLS_PATH;
576 #endif
577
578 #ifdef SHARE_PATH
579 Paths += SG_File_Make_Path(SHARE_PATH, "toolchains");
580 #endif
581 }
582 #endif
583
584 //-----------------------------------------------------
585 CSG_String Additional;
586
587 if( CSG_Environment::Get_Variable("SAGA_TLB", Additional) )
588 {
589 #if defined(_SAGA_MSW)
590 CSG_Strings Additionals = SG_String_Tokenize(Additional, ";" ); // colon (':') would split drive from paths!
591 #else
592 CSG_Strings Additionals = SG_String_Tokenize(Additional, ";:"); // colon (':') is more native to non-windows os than semi-colon (';'), we support both...
593 #endif
594
595 for(int i=0; i<Additionals.Get_Count(); i++)
596 {
597 Paths += Additionals[i];
598 }
599 }
600
601 return( Paths );
602}
603
604
606// //
608
609//---------------------------------------------------------
610bool CSG_Environment::is_GUI (void) { return( Get_Application_Name().is_Same_As("saga_gui") ); }
611bool CSG_Environment::is_CMD (void) { return( Get_Application_Name().is_Same_As("saga_cmd") ); }
612bool CSG_Environment::is_Python (void) { return( Get_Application_Name().is_Same_As("python" ) ); }
613
614
616// //
618
619//---------------------------------------------------------
620CSG_String CSG_Environment::Get_Option(const CSG_String &Variable, bool bGetVariable)
621{
622 CSG_String Value; Get_Option(Variable, Value, bGetVariable); return( Value );
623}
624
625//---------------------------------------------------------
626bool CSG_Environment::Get_Option(const CSG_String &Variable, CSG_String &Value, bool bGetVariable)
627{
628 if( theEnvironment.Options(Variable) )
629 {
630 Value = theEnvironment.Options[Variable].Get_Content();
631
632 return( true );
633 }
634
635 return( bGetVariable ? Get_Variable(Variable, Value) : false );
636}
637
638//---------------------------------------------------------
639bool CSG_Environment::Set_Option(const CSG_String &Variable, const CSG_String &Value, bool bSetVariable)
640{
641 if( bSetVariable )
642 {
643 Set_Variable(Variable, Value);
644 }
645
646 if( theEnvironment.Options(Variable) )
647 {
648 theEnvironment.Options[Variable].Set_Content(Value);
649
650 return( true );
651 }
652
653 return( theEnvironment.Options.Add_Child(Variable, Value) != NULL );
654}
655
656
658// //
660
661//---------------------------------------------------------
663{
664 return( wxGetEnv(Variable.wx_str(), NULL) );
665}
666
668{
669 wxString s;
670
671 if( wxGetEnv(Variable.wx_str(), &s) )
672 {
673 Value = s.wx_str();
674
675 return( true );
676 }
677
678 return( false );
679}
680
681//---------------------------------------------------------
682bool CSG_Environment::Set_Variable(const CSG_String &Variable, const CSG_String &Value)
683{
684 return( wxSetEnv(Variable.wx_str(), Value.wx_str()) );
685}
686
687//---------------------------------------------------------
688bool SG_Get_Environment(const CSG_String &Variable, CSG_String *Value) { return( Value ? CSG_Environment::Get_Variable(Variable, *Value) : CSG_Environment::Get_Variable(Variable) ); }
689bool SG_Set_Environment(const CSG_String &Variable, const CSG_String &Value) { return( CSG_Environment::Set_Variable(Variable, Value) ); }
690
691
693// //
695
696//---------------------------------------------------------
697#if defined(_SAGA_MSW)
698bool SG_Environment_Add_Dll_Paths(const CSG_String &Directory)
699{
700 wxDir Dir(Directory.wx_str()); bool bNoWarnings = true;
701
702 if( Dir.IsOpened() )
703 {
704 wxString Path;
705
706 if( Dir.GetFirst(&Path, "*.dll", wxDIR_HIDDEN|wxDIR_FILES) )
707 {
708 CSG_String Path; CSG_Environment::Get_Variable("PATH", Path); if( Path.Find(Directory) < 0 ) { CSG_Environment::Set_Variable("PATH", Directory + ";" + Path); }
709
710 if( !AddDllDirectory(Directory.c_str()) )
711 {
712 SG_UI_Console_Print_StdErr(CSG_String::Format("Failed to add DLL directory to path environment!\n> %s\n", Directory.c_str()));
713
714 bNoWarnings = false;
715 }
716 }
717
718 if( Dir.GetFirst(&Path, "gdal_*.dll", wxDIR_HIDDEN|wxDIR_FILES) && CSG_Environment::Get_Option("GDAL_DRIVER_PATH").is_Empty() )
719 {
720 CSG_Environment::Set_Option("GDAL_DRIVER_PATH", Directory);
721 }
722
723 if( Dir.GetFirst(&Path, "pdalcpp.dll", wxDIR_HIDDEN|wxDIR_FILES) )
724 {
725 CSG_Environment::Set_Option("PDAL_DRIVER_PATH", Directory);
726 }
727
728 if( Dir.GetFirst(&Path, wxEmptyString, wxDIR_HIDDEN|wxDIR_DIRS) )
729 {
730 do
731 {
732 CSG_String SubDir(Directory + "\\" + Path.wx_str());
733
734 if( !Path.CmpNoCase("gdal-plugins") ) { CSG_Environment::Set_Option("GDAL_DRIVER_PATH", SubDir); } else
735 if( !Path.CmpNoCase("gdal-data" ) ) { CSG_Environment::Set_Option("GDAL_DATA" , SubDir); } else
736 if( !Path.CmpNoCase("proj-data" ) ) { CSG_Environment::Set_Option("PROJ_LIB" , SubDir); }
737
738 if( !SG_Environment_Add_Dll_Paths(SubDir) )
739 {
740 bNoWarnings = false;
741 }
742 }
743 while( Dir.GetNext(&Path) );
744 }
745 }
746
747 return( bNoWarnings );
748}
749#endif // #if defined(_SAGA_MSW)
750
751
753// //
754// //
755// //
void SG_UI_Console_Print_StdErr(const char *Text, SG_Char End, bool bFlush)
TSG_Data_Type SG_Data_Type_Get_Type(const CSG_String &Identifier)
Definition api_core.cpp:154
int SG_Data_Type_Get_Flag(TSG_Data_Type Type)
Definition api_core.cpp:175
void SG_OMP_Set_Max_Num_Threads(int iCores)
Definition api_core.cpp:110
int SG_OMP_Get_Max_Num_Procs(void)
Definition api_core.cpp:112
static struct SSG_Environment theEnvironment
int SG_OMP_Get_Thread_Num(void)
Definition api_core.cpp:113
CSG_String SG_Data_Type_Get_Name(TSG_Data_Type Type, bool bShort)
Definition api_core.cpp:124
bool SG_Data_Type_is_Numeric(TSG_Data_Type Type)
Definition api_core.cpp:199
bool SG_Set_Environment(const CSG_String &Variable, const CSG_String &Value)
Definition api_core.cpp:689
bool SG_Data_Type_Range_Check(TSG_Data_Type Type, double &Value)
Definition api_core.cpp:225
bool SG_Get_Environment(const CSG_String &Variable, CSG_String *Value)
Definition api_core.cpp:688
int SG_OMP_Get_Max_Num_Threads(void)
Definition api_core.cpp:111
CSG_String SG_Data_Type_Get_Identifier(TSG_Data_Type Type)
Definition api_core.cpp:148
SAGA_API_DLL_EXPORT bool SG_File_Exists(const CSG_String &FileName)
SAGA_API_DLL_EXPORT void SG_UI_Console_Print_StdErr(const char *Text, SG_Char End='\n', bool bFlush=true)
#define SG_DATATYPES_DWord
Definition api_core.h:1070
SAGA_API_DLL_EXPORT void SG_UI_Console_Print_StdOut(const char *Text, SG_Char End='\n', bool bFlush=true)
#define SG_DATATYPES_Byte
Definition api_core.h:1066
#define SG_DATATYPES_Word
Definition api_core.h:1068
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Path_Absolute(const CSG_String &full_Path, const CSG_String &CWD="")
#define SG_DATATYPES_Bit
Definition api_core.h:1065
#define SG_DATATYPES_Short
Definition api_core.h:1069
#define SG_DATATYPES_String
Definition api_core.h:1076
#define SG_DATATYPES_Double
Definition api_core.h:1075
SAGA_API_DLL_EXPORT void SG_UI_ProgressAndMsg_Lock(bool bOn)
#define SG_DATATYPES_Date
Definition api_core.h:1077
#define SG_DATATYPES_Binary
Definition api_core.h:1079
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Path(const CSG_String &full_Path)
SAGA_API_DLL_EXPORT CSG_String SG_File_Make_Path(const CSG_String &Directory, const CSG_String &Name)
#define SG_DATATYPES_Int
Definition api_core.h:1071
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Name(const CSG_String &full_Path, bool bExtension)
SAGA_API_DLL_EXPORT CSG_Strings SG_String_Tokenize(const CSG_String &String, const CSG_String &Delimiters=SG_DEFAULT_DELIMITERS, TSG_String_Tokenizer_Mode Mode=SG_TOKEN_DEFAULT)
#define SG_DATATYPES_Char
Definition api_core.h:1067
const char gSG_Data_Type_Identifier[][32]
Definition api_core.h:1089
SAGA_API_DLL_EXPORT bool SG_Dir_Exists(const CSG_String &Directory)
Definition api_file.cpp:976
#define SG_DATATYPES_Undefined
Definition api_core.h:1064
#define SG_DATATYPES_Long
Definition api_core.h:1073
#define SG_DATATYPES_ULong
Definition api_core.h:1072
TSG_Data_Type
Definition api_core.h:1043
@ SG_DATATYPE_Long
Definition api_core.h:1052
@ SG_DATATYPE_Byte
Definition api_core.h:1045
@ SG_DATATYPE_Bit
Definition api_core.h:1044
@ SG_DATATYPE_Short
Definition api_core.h:1048
@ SG_DATATYPE_Word
Definition api_core.h:1047
@ SG_DATATYPE_ULong
Definition api_core.h:1051
@ SG_DATATYPE_Float
Definition api_core.h:1053
@ SG_DATATYPE_Undefined
Definition api_core.h:1059
@ SG_DATATYPE_Binary
Definition api_core.h:1058
@ SG_DATATYPE_Double
Definition api_core.h:1054
@ SG_DATATYPE_Color
Definition api_core.h:1057
@ SG_DATATYPE_Int
Definition api_core.h:1050
@ SG_DATATYPE_Char
Definition api_core.h:1046
@ SG_DATATYPE_String
Definition api_core.h:1055
@ SG_DATATYPE_DWord
Definition api_core.h:1049
@ SG_DATATYPE_Date
Definition api_core.h:1056
#define SG_Char
Definition api_core.h:536
#define _TL(s)
Definition api_core.h:1619
#define SG_DATATYPES_Color
Definition api_core.h:1078
#define SG_DATATYPES_Float
Definition api_core.h:1074
static bool Set_Option(const CSG_String &Variable, const CSG_String &Value, bool bSetVariable=true)
Definition api_core.cpp:639
static bool is_GUI(void)
Definition api_core.cpp:610
static const CSG_String & Get_Application_Name(void)
Definition api_core.cpp:448
static bool Set_Variable(const CSG_String &Variable, const CSG_String &Value)
Definition api_core.cpp:682
static const CSG_String & Get_Application_Path(bool bPathOnly)
Definition api_core.cpp:433
static CSG_Strings Get_Tool_Paths(void)
Definition api_core.cpp:542
static bool is_CMD(void)
Definition api_core.cpp:611
static bool Set_Application_Name(const CSG_String &Name="")
Definition api_core.cpp:459
static bool Initialize(bool bInitializeWX=false, bool bInitializeGUI=false, bool bProjections=true, bool bLibraries=false, const SG_Char *SAGA_Path=NULL)
Definition api_core.cpp:289
static CSG_String Get_Ressources_Path(const CSG_String &AddPath="")
Definition api_core.cpp:528
static const CSG_String & Get_API_Path(void)
Definition api_core.cpp:480
static bool Set_API_Path(const CSG_String &Path="")
Definition api_core.cpp:467
static bool Get_Variable(const CSG_String &Variable)
Definition api_core.cpp:662
static bool is_Python(void)
Definition api_core.cpp:612
static CSG_String Get_Option(const CSG_String &Variable, bool bGetVariable=true)
Definition api_core.cpp:620
static CSG_String Get_Share_Path(const CSG_String &AddPath="")
Definition api_core.cpp:491
static bool Uninitialize(void)
Definition api_core.cpp:415
bool Create(bool LoadCodeList=true)
int CmpNoCase(const CSG_String &String) const
int Cmp(const CSG_String &String) const
void Clear(void)
static CSG_String Format(const char *Format,...)
int Find(char Character, bool fromEnd=false) const
const SG_Char * c_str(void) const
CSG_String Left(size_t count) const
const class wxString & wx_str(void) const
Definition api_core.h:595
int Get_Count(void) const
Definition api_core.h:725
bool Add_Default_Libraries(bool bVerbose=false)
SAGA_API_DLL_EXPORT CSG_Projections & SG_Get_Projections(void)
CSG_Tool_Library_Manager & SG_Get_Tool_Library_Manager(void)