53#ifndef HEADER_INCLUDED__SAGA_API__tool_library_H
54#define HEADER_INCLUDED__SAGA_API__tool_library_H
118 virtual const CSG_String & Get_Info (
int Type)
const;
126 bool Get_Summary (
const CSG_String &Path)
const;
128 virtual int Get_Count (
void)
const {
return( m_pInterface ? m_pInterface->Get_Count() : 0 ); }
135 virtual CSG_Tool * Create_Tool (
int Index,
bool bWithGUI =
false,
bool bWithCMD =
true);
136 virtual CSG_Tool * Create_Tool (
const CSG_String &Name,
bool bWithGUI =
false,
bool bWithCMD =
true);
137 virtual CSG_Tool * Create_Tool (
const char *Name,
bool bWithGUI =
false,
bool bWithCMD =
true);
138 virtual CSG_Tool * Create_Tool (
const wchar_t *Name,
bool bWithGUI =
false,
bool bWithCMD =
true);
140 virtual bool Delete_Tool (
CSG_Tool *pTool);
141 virtual bool Delete_Tools (
void);
146 bool Load_Description (
void);
149 CSG_Strings Get_References (
bool bHTML =
true)
const;
150 bool Del_References (
void);
167 bool _Destroy (
void);
176 class wxDynamicLibrary *m_pLibrary;
197 int Get_Tool_Count (
void)
const;
199 bool Add_Default_Libraries (
bool bVerbose =
false);
205 int Add_Directory (
const CSG_String &Directory,
bool bOnlySubDirectories =
false);
206 int Add_Directory (
const char *Directory,
bool bOnlySubDirectories =
false);
207 int Add_Directory (
const wchar_t *Directory,
bool bOnlySubDirectories =
false);
209 bool Del_Library (
int i);
225 CSG_Tool * Get_Tool (
const wchar_t *
Library,
const wchar_t *Name)
const;
228 CSG_Tool * Create_Tool (
const char *
Library,
int Index,
bool bWithGUI =
false,
bool bWithCMD =
true)
const;
229 CSG_Tool * Create_Tool (
const wchar_t *
Library,
int Index,
bool bWithGUI =
false,
bool bWithCMD =
true)
const;
231 CSG_Tool * Create_Tool (
const char *
Library,
const char *Name,
bool bWithGUI =
false,
bool bWithCMD =
true)
const;
232 CSG_Tool * Create_Tool (
const wchar_t *
Library,
const wchar_t *Name,
bool bWithGUI =
false,
bool bWithCMD =
true)
const;
233 bool Delete_Tool (
CSG_Tool *pTool)
const;
236 bool Get_Summary (
const CSG_String &Path)
const;
238 bool Create_Python_ToolBox (
const CSG_String &Destination,
bool bClean =
true,
bool bName =
true,
bool bSingleFile =
false,
CSG_Table *pDeprecated_Names = NULL)
const;
266#define SG_RUN_TOOL(bRetVal, LIBRARY, TOOL, CONDITION) {\
270 CSG_Tool *pTool = SG_Get_Tool_Library_Manager().Create_Tool(SG_T(LIBRARY), TOOL);\
274 SG_UI_Msg_Add_Error(CSG_String::Format("%s [%s]", _TL("could not find tool"), SG_T(LIBRARY)));\
278 SG_UI_Process_Set_Text(pTool->Get_Name());\
280 pTool->Settings_Push();\
282 if( !pTool->On_Before_Execution() || !(CONDITION) )\
284 SG_UI_Msg_Add_Error(CSG_String::Format("%s [%s].[%s]", _TL("could not initialize tool"), SG_T(LIBRARY), pTool->Get_Name().c_str()));\
286 else if( !pTool->Execute(false) )\
288 SG_UI_Msg_Add_Error(CSG_String::Format("%s [%s].[%s]", _TL("could not execute tool" ), SG_T(LIBRARY), pTool->Get_Name().c_str()));\
295 SG_Get_Tool_Library_Manager().Delete_Tool(pTool);\
299#define SG_RUN_TOOL_ExitOnError(LIBRARY, TOOL, CONDITION) {\
303 SG_RUN_TOOL(bResult, LIBRARY, TOOL, CONDITION)\
312#define SG_RUN_TOOL_KEEP_PARMS(bRetVal, LIBRARY, TOOL, PARMS, CONDITION) {\
316 CSG_Tool *pTool = SG_Get_Tool_Library_Manager().Create_Tool(SG_T(LIBRARY), TOOL);\
320 SG_UI_Msg_Add_Error(CSG_String::Format("%s [%s]", _TL("could not find tool"), SG_T(LIBRARY)));\
324 SG_UI_Process_Set_Text(pTool->Get_Name());\
326 pTool->Settings_Push();\
328 if( !pTool->On_Before_Execution() || !(CONDITION) )\
330 SG_UI_Msg_Add_Error(CSG_String::Format("%s [%s].[%s]", _TL("could not initialize tool"), SG_T(LIBRARY), pTool->Get_Name().c_str()));\
332 else if( !pTool->Execute(false) )\
334 SG_UI_Msg_Add_Error(CSG_String::Format("%s [%s].[%s]", _TL("could not execute tool" ), SG_T(LIBRARY), pTool->Get_Name().c_str()));\
340 PARMS.Set_Manager(NULL); PARMS.Assign_Parameters(pTool->Get_Parameters());\
343 SG_Get_Tool_Library_Manager().Delete_Tool(pTool);\
347#define SG_RUN_TOOL_KEEP_PARMS_ExitOnError(LIBRARY, TOOL, PARMS, CONDITION) {\
351 SG_RUN_TOOL_KEEP_PARMS(bResult, LIBRARY, TOOL, PARMS, CONDITION)\
360#define SG_TOOL_PARAMETER_SET(IDENTIFIER, VALUE) (pTool->Get_Parameters()->Get_Parameter(IDENTIFIER, true) && pTool->Set_Parameter(IDENTIFIER, VALUE))
362#define SG_TOOL_PARAMLIST_ADD(IDENTIFIER, VALUE) (\
363 pTool->Get_Parameters()->Get_Parameter(IDENTIFIER, true)\
364 && pTool->Get_Parameters()->Get_Parameter(IDENTIFIER)->asList()\
365 && pTool->Get_Parameters()->Get_Parameter(IDENTIFIER)->asList()->Add_Item(VALUE)\
368#define SG_TOOL_SET_DATAOBJECT_LIST(IDENTIFIER, VALUE) (\
369 pTool->Get_Parameters()->Get_Parameter(IDENTIFIER, true)\
370 && pTool->Get_Parameters()->Get_Parameter(IDENTIFIER)->asList()\
371 && pTool->Get_Parameters()->Get_Parameter(IDENTIFIER)->asList()->Assign(VALUE)\
#define SAGA_API_DLL_EXPORT