|
SAGA API
v9.6
|
Go to the documentation of this file.
53 #include <wx/dynlib.h>
55 #include <wx/filename.h>
79 if( m_pLibrary->IsLoaded()
106 bool CSG_Tool_Library::_Destroy(
void)
135 if( m_pInterface != NULL )
137 return( m_pInterface->
Get_Info(Type) );
192 return( m_pInterface ? m_pInterface->
Create_Tool(Index, bWithGUI, bWithCMD) : NULL );
200 int Index;
return( Name.
asInt(Index) ?
Create_Tool(Index, bWithGUI, bWithCMD) : NULL );
211 return( m_pInterface ? m_pInterface->
Delete_Tool(pTool) :
false );
217 return( m_pInterface ? m_pInterface->
Delete_Tools() :
false );
230 return(
Get_Tool(i)->Get_MenuPath(
true) );
250 Reference +=
CSG_String::Format(
" <a href=\"%s\">%s</a>.", Link, Link_Text && *Link_Text ? Link_Text : Link);
255 m_References += Reference;
272 m_References.
Clear();
324 for(
int i=0; i<m_nLibraries; i++)
340 if( bVerbose ==
false )
346 #if defined(_SAGA_MSW)
350 #elif defined(__WXMAC__)
363 #else // #if defined(_SAGA_LINUX)
380 #if defined(_SAGA_MSW)
382 #else // #if defined(_SAGA_LINUX) || defined(__WXMAC__)
393 if( bVerbose ==
false )
418 return( _Add_Tool_Chain(File) );
429 wxFileName FileName(File.
c_str());
449 m_pLibraries[m_nLibraries++] = pLibrary;
468 int nOpened = 0; wxDir Dir;
470 if( Dir.Open(Directory.
c_str()) )
472 wxString FileName, DirName(Dir.GetName());
474 if( !bOnlySubDirectories && Dir.GetFirst(&FileName, wxEmptyString, wxDIR_FILES) )
477 {
if( FileName.Find(
"saga_") < 0 && FileName.Find(
"wx") < 0 )
483 while( Dir.GetNext(&FileName) );
486 if( Dir.GetFirst(&FileName, wxEmptyString, wxDIR_DIRS) )
490 if( FileName.CmpNoCase(
"dll") )
495 while( Dir.GetNext(&FileName) );
520 wxFileName FileName(File.
c_str());
522 for(
int iLibrary=0; !pTool && iLibrary<
Get_Count(); iLibrary++)
557 if( !pTool || !pTool->
is_Okay() )
570 for(
int iLibrary=0; !pLibrary && iLibrary<
Get_Count(); iLibrary++)
582 m_pLibraries[m_nLibraries++] = pLibrary;
615 m_pLibraries[i]->m_pLibrary->Detach();
619 delete(m_pLibraries[i]);
655 delete(m_pLibraries[i]);
657 for(m_nLibraries--; i<m_nLibraries; i++)
659 m_pLibraries[i] = m_pLibraries[i + 1];
716 bool CSG_Tool_Library_Manager::_Add_Library(
const CSG_String &Library)
723 #if defined(_SAGA_MSW)
726 #elif defined(__WXMAC__)
735 #else // #if defined(_SAGA_LINUX)
749 #if defined(_SAGA_MSW)
751 #elif defined(__WXMAC__)
753 #else // #if defined(_SAGA_LINUX)
760 if( _Add_Library_Chains(Library , Path[i]) ) { bOkay =
true; }
771 bool CSG_Tool_Library_Manager::_Add_Library_Chains(
const CSG_String &Library,
const CSG_String &Directory)
773 wxDir dir; wxString file;
bool bOkay =
false;
775 if( dir.Open(Directory.
c_str()) && dir.GetFirst(&file, wxEmptyString, wxDIR_FILES) )
781 if( Tool.is_Okay() && Tool.Get_Library().Cmp(Library) == 0 && _Add_Tool_Chain(path,
false) )
786 while( dir.GetNext(&file) );
887 "#! /usr/bin/env python\n\n"
889 "Python Interface to SAGA Tools Library\n"
897 "from PySAGA.helper import Tool_Wrapper\n\n";
915 Stream.
Write(
"#! /usr/bin/env python\n\n'''\n");
916 Stream.
Write(
"Python Interface to SAGA Tools\n");
917 Stream.
Write(
"----------\n'''\n\n");
918 Stream.
Write(
"from PySAGA.helper import Tool_Wrapper\n\n");
955 || pLibrary->
Get_Type() == ESG_Library_Type::Chain )
972 for(
int iTool=0; iTool<pLibrary->
Get_Count(); iTool++)
998 || pLibrary->
Get_Type() != ESG_Library_Type::Chain )
1029 for(
int iTool=0; iTool<pLibrary->
Get_Count(); iTool++)
virtual bool Open(const CSG_String &FileName, int Mode=SG_FILE_R, bool bBinary=true, int Encoding=SG_FILE_ENCODING_ANSI)
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Path(const CSG_String &full_Path)
int Printf(const char *Format,...)
SAGA_API_DLL_EXPORT CSG_String SG_HTML_Tag_Replacer(const CSG_String &Text)
SAGA_API_DLL_EXPORT bool SG_Dir_Exists(const CSG_String &Directory)
@ SG_UI_MSG_STYLE_SUCCESS
SAGA_API_DLL_EXPORT bool SG_File_Cmp_Extension(const CSG_String &FileName, const CSG_String &Extension)
SAGA_API_DLL_EXPORT bool SG_File_Delete(const CSG_String &FileName)
SAGA_API_DLL_EXPORT void SG_Free(void *memblock)
int Cmp(const CSG_String &String) const
SAGA_API_DLL_EXPORT bool SG_Get_Environment(const CSG_String &Variable, CSG_String *Value=NULL)
@ SG_UI_MSG_STYLE_FAILURE
static void Initialize(void)
SAGA_API_DLL_EXPORT bool SG_File_Exists(const CSG_String &FileName)
SAGA_API_DLL_EXPORT bool SG_Dir_Create(const CSG_String &Directory, bool bFullPath=false)
int SG_UI_Msg_Lock(bool bOn)
void SG_UI_Process_Set_Text(const CSG_String &Text)
CSG_String SG_UI_Set_Application_Name(const CSG_String &Name)
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)
SAGA_API_DLL_EXPORT bool SG_Dir_List_Files(CSG_Strings &List, const CSG_String &Directory)
static CSG_String Format(const char *Format,...)
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Path_Absolute(const CSG_String &full_Path)
CSG_String SG_UI_Get_Application_Path(bool bPathOnly)
bool Sort(bool Ascending=true)
int Printf(const char *Format,...)
bool is_Empty(void) const
bool SG_UI_Process_Set_Progress(int Position, int Range)
CSG_String SG_UI_Get_API_Path(void)
void * SG_UI_Get_Window_Main(void)
SAGA_API_DLL_EXPORT CSG_String SG_File_Make_Path(const CSG_String &Directory, const CSG_String &Name)
void SG_UI_ProgressAndMsg_Lock(bool bOn)
const SG_Char * c_str(void) const
size_t Write(void *Buffer, size_t Size, size_t Count=1) const
int Get_Count(void) const
SAGA_API_DLL_EXPORT void * SG_Realloc(void *memblock, size_t size)
void SG_UI_Msg_Add_Error(const char *Message)
bool Seek_End(void) const
void SG_UI_Msg_Add(const char *Message, bool bNewLine, TSG_UI_MSG_STYLE Style)