|
SAGA API
v9.6
|
Go to the documentation of this file.
53 #ifndef HEADER_INCLUDED__SAGA_API__tool_library_H
54 #define HEADER_INCLUDED__SAGA_API__tool_library_H
128 virtual int Get_Count (
void)
const {
return( m_pInterface ? m_pInterface->Get_Count() : 0 ); }
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);
141 virtual bool Delete_Tools (
void);
148 void Del_References (
void);
164 bool _Destroy (
void);
171 class wxDynamicLibrary *m_pLibrary;
192 int Get_Tool_Count (
void)
const;
194 bool Add_Default_Libraries (
bool bVerbose =
false);
200 int Add_Directory (
const CSG_String &Directory,
bool bOnlySubDirectories =
false);
201 int Add_Directory (
const char *Directory,
bool bOnlySubDirectories =
false);
202 int Add_Directory (
const wchar_t *Directory,
bool bOnlySubDirectories =
false);
204 bool Del_Library (
int i);
215 CSG_Tool * Get_Tool (
const char *Library,
int Index)
const;
216 CSG_Tool * Get_Tool (
const wchar_t *Library,
int Index)
const;
218 CSG_Tool * Get_Tool (
const char *Library,
const char *Name)
const;
219 CSG_Tool * Get_Tool (
const wchar_t *Library,
const wchar_t *Name)
const;
221 CSG_Tool * Create_Tool (
const CSG_String &Library,
int Index,
bool bWithGUI =
false,
bool bWithCMD =
true)
const;
222 CSG_Tool * Create_Tool (
const char *Library,
int Index,
bool bWithGUI =
false,
bool bWithCMD =
true)
const;
223 CSG_Tool * Create_Tool (
const wchar_t *Library,
int Index,
bool bWithGUI =
false,
bool bWithCMD =
true)
const;
225 CSG_Tool * Create_Tool (
const char *Library,
const char *Name,
bool bWithGUI =
false,
bool bWithCMD =
true)
const;
226 CSG_Tool * Create_Tool (
const wchar_t *Library,
const wchar_t *Name,
bool bWithGUI =
false,
bool bWithCMD =
true)
const;
227 bool Delete_Tool (
CSG_Tool *pTool)
const;
230 bool Get_Summary (
const CSG_String &Path)
const;
232 bool Create_Python_ToolBox (
const CSG_String &Destination,
bool bClean =
true,
bool bName =
true,
bool bSingleFile =
false)
const;
242 bool _Add_Library (
const CSG_String &Library);
260 #define SG_RUN_TOOL(bRetVal, LIBRARY, TOOL, CONDITION) {\
264 CSG_Tool *pTool = SG_Get_Tool_Library_Manager().Create_Tool(SG_T(LIBRARY), TOOL);\
268 SG_UI_Msg_Add_Error(CSG_String::Format("%s [%s]", _TL("could not find tool"), SG_T(LIBRARY)));\
272 SG_UI_Process_Set_Text(pTool->Get_Name());\
274 pTool->Settings_Push();\
276 if( !pTool->On_Before_Execution() || !(CONDITION) )\
278 SG_UI_Msg_Add_Error(CSG_String::Format("%s [%s].[%s]", _TL("could not initialize tool"), SG_T(LIBRARY), pTool->Get_Name().c_str()));\
280 else if( !pTool->Execute(false) )\
282 SG_UI_Msg_Add_Error(CSG_String::Format("%s [%s].[%s]", _TL("could not execute tool" ), SG_T(LIBRARY), pTool->Get_Name().c_str()));\
289 SG_Get_Tool_Library_Manager().Delete_Tool(pTool);\
293 #define SG_RUN_TOOL_ExitOnError(LIBRARY, TOOL, CONDITION) {\
297 SG_RUN_TOOL(bResult, LIBRARY, TOOL, CONDITION)\
306 #define SG_RUN_TOOL_KEEP_PARMS(bRetVal, LIBRARY, TOOL, PARMS, CONDITION) {\
310 CSG_Tool *pTool = SG_Get_Tool_Library_Manager().Create_Tool(SG_T(LIBRARY), TOOL);\
314 SG_UI_Msg_Add_Error(CSG_String::Format("%s [%s]", _TL("could not find tool"), SG_T(LIBRARY)));\
318 SG_UI_Process_Set_Text(pTool->Get_Name());\
320 pTool->Settings_Push();\
322 if( !pTool->On_Before_Execution() || !(CONDITION) )\
324 SG_UI_Msg_Add_Error(CSG_String::Format("%s [%s].[%s]", _TL("could not initialize tool"), SG_T(LIBRARY), pTool->Get_Name().c_str()));\
326 else if( !pTool->Execute(false) )\
328 SG_UI_Msg_Add_Error(CSG_String::Format("%s [%s].[%s]", _TL("could not execute tool" ), SG_T(LIBRARY), pTool->Get_Name().c_str()));\
334 PARMS.Set_Manager(NULL); PARMS.Assign_Parameters(pTool->Get_Parameters());\
337 SG_Get_Tool_Library_Manager().Delete_Tool(pTool);\
341 #define SG_RUN_TOOL_KEEP_PARMS_ExitOnError(LIBRARY, TOOL, PARMS, CONDITION) {\
345 SG_RUN_TOOL_KEEP_PARMS(bResult, LIBRARY, TOOL, PARMS, CONDITION)\
354 #define SG_TOOL_PARAMETER_SET(IDENTIFIER, VALUE) (pTool->Get_Parameters()->Get_Parameter(IDENTIFIER, true) && pTool->Set_Parameter(IDENTIFIER, VALUE))
356 #define SG_TOOL_PARAMLIST_ADD(IDENTIFIER, VALUE) (\
357 pTool->Get_Parameters()->Get_Parameter(IDENTIFIER, true)\
358 && pTool->Get_Parameters()->Get_Parameter(IDENTIFIER)->asList()\
359 && pTool->Get_Parameters()->Get_Parameter(IDENTIFIER)->asList()->Add_Item(VALUE)\
362 #define SG_TOOL_SET_DATAOBJECT_LIST(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()->Assign(VALUE)\
376 #endif // #ifndef HEADER_INCLUDED__SAGA_API__tool_library_H
#define SAGA_API_DLL_EXPORT