57#include <wx/cmdline.h> 
   72        m_bError_Ignore = 
false;
 
 
  104        m_bError_Ignore = 
false;
 
 
  123        return( m_File_Name );
 
 
  173        Parameters.Add_Reference(Authors, Year, Title, Where, Link, Link_Text);
 
 
  198                if( Menu[i].Length() > 1 && Menu[i][1] == 
':' )
 
  200                        if( Menu[i][0] == 
'A' || Menu[i][0] == 
'a' ) 
 
  202                                Menu[i] = Menu[i].AfterFirst(
':');
 
  207                        Menu[i] = Menu[i].AfterFirst(
':'); 
 
  210                if( !m_Library_Menu.is_Empty() )
 
  212                        if( Menu[i].is_Empty() )
 
  214                                Menu[i] = m_Library_Menu;
 
  218                                Menu[i] = m_Library_Menu + 
"|" + Menu[i];
 
 
  260        #define ADD_MESSAGE_EXECUTION(Text, Style) { SG_UI_Msg_Add(Text, true, Style); if( has_GUI() ) { SG_UI_Msg_Add_Execution(Text, true, Style); } } 
  270        m_bError_Ignore = 
false;
 
  272        bool bResult    = 
false;
 
  274        m_Execution_Info.
Clear();
 
  286        if( 
Parameters.DataObjects_Create() == 
false )
 
  288                _Synchronize_DataObjects();     
 
  299#define _TOOL_EXCEPTION 
  308#ifdef _TOOL_EXCEPTION 
  310        catch(
const std::exception &Exception)
 
  324                _Synchronize_DataObjects();
 
  333                if( bResult && bAddHistory )
 
  335                        _Set_Output_History();
 
  365                                        _TL(
"execution time"), Time.
c_str()),
 
  377                                        bResult ? 
_TL(
"Execution succeeded") : 
_TL(
"Execution failed"), Time.
c_str()),
 
 
  403bool CSG_Tool::_Synchronize_DataObjects(
void)
 
  499        pParameters->
Create(
this, Name, Description, Identifier);
 
  501        pParameters->m_pTool = 
this;
 
  503        m_pParameters.Add(pParameters);
 
  505        return( pParameters );
 
 
  545        return( pParameters ? 
Dlg_Parameters(*pParameters, Caption) : 
false );
 
 
  603                pManager->
Delete(bDetachData);
 
 
  656        m_bShow_Progress = bOn;
 
 
  662        return( 
Set_Progress((
double)Position / (
double)Range) );
 
 
  668        return( 
Set_Progress((
double)Position / (
double)Range) );
 
 
  722        m_Execution_Info += 
"\n____\n" + Text;
 
  733                        m_bError_Ignore = 
true;
 
 
  751        wxString        _Format(Format);        _Format.Replace(
"%s", 
"%ls");
 
  752        va_start(argptr, _Format);
 
  753        _s.PrintfV(_Format, argptr);
 
  755        va_start(argptr, Format);
 
  756        _s.PrintfV(Format, argptr);
 
 
  776        wxString        _Format(Format);        _Format.Replace(
"%s", 
"%ls");
 
  777        va_start(argptr, _Format);
 
  778        _s.PrintfV(_Format, argptr);
 
  780        va_start(argptr, Format);
 
  781        _s.PrintfV(Format, argptr);
 
 
  825                        else if( 
Parameters(i)->is_DataObject_List() )
 
  827                                for(
int j=0; j<
Parameters(i)->asList()->Get_Item_Count(); j++)
 
 
  867        wxString        _Format(Format);        _Format.Replace(
"%s", 
"%ls");
 
  868        va_start(argptr, _Format);
 
  869        _s.PrintfV(_Format, argptr);
 
  871        va_start(argptr, Format);
 
  872        _s.PrintfV(Format, argptr);
 
 
  892        wxString        _Format(Format);        _Format.Replace(
"%s", 
"%ls");
 
  893        va_start(argptr, _Format);
 
  894        _s.PrintfV(_Format, argptr);
 
  896        va_start(argptr, Format);
 
  897        _s.PrintfV(Format, argptr);
 
 
  914                m_Execution_Info += 
"\n";
 
  917        m_Execution_Info += Text;
 
 
  930        wxString        _Format(Format);        _Format.Replace(
"%s", 
"%ls");
 
  931        va_start(argptr, _Format);
 
  932        _s.PrintfV(_Format, argptr);
 
  934        va_start(argptr, Format);
 
  935        _s.PrintfV(Format, argptr);
 
 
  955        wxString        _Format(Format);        _Format.Replace(
"%s", 
"%ls");
 
  956        va_start(argptr, _Format);
 
  957        _s.PrintfV(_Format, argptr);
 
  959        va_start(argptr, Format);
 
  960        _s.PrintfV(Format, argptr);
 
 
 1029        if( pDataObject == pCopy )
 
 
 1136#define INIT_STRETCH_OPTIONS(method) { if( !pDataObject || (pDataObject->asTable(true) && (Field < 0 || Field >= pDataObject->asTable(true)->Get_Field_Count())) ) { return( false ); }\ 
 1137        if( Colors >= 0 ) { DataObject_Set_Colors(pDataObject, -1, Colors); }\ 
 1138        DataObject_Set_Parameter(pDataObject, "COLORS_TYPE"      , 3); \ 
 1139        DataObject_Set_Parameter(pDataObject, "STRETCH_DEFAULT"  , method);\ 
 1140        DataObject_Set_Parameter(pDataObject, "METRIC_SCALE_MODE", Interval_Mode);\ 
 1141        DataObject_Set_Parameter(pDataObject, "METRIC_SCALE_LOG" , Interval_Log );\ 
 1142        if( pDataObject->asTable(true) )\ 
 1143        {       DataObject_Set_Parameter(pDataObject, "METRIC_FIELD" , Field);\ 
 1144                DataObject_Set_Parameter(pDataObject, "METRIC_MORMAL", pDataObject->asTable(true)->Get_Field_Count());\ 
 
 1199#define INIT_CLASSIFY_OPTIONS(method) if( !pDataObject || (pDataObject->asTable(true) && (Field < 0 || Field >= pDataObject->asTable(true)->Get_Field_Count())) ) { return( false ); }\ 
 1200        CSG_MetaData Options; Options.Add_Child("METHOD", method); Options.Add_Child("COLORS", Colors); Options.Add_Child("FIELD", Field); 
 
 1207        Options.Add_Child(
"MAXCLASSES", maxClasses);
 
 
 1217        Options.Add_Child(
"CLASSES", Classes);
 
 
 1227        Options.Add_Child(
"INTERVAL", Interval); 
if( bOffset ) { Options.Add_Child(
"OFFSET", Offset); }
 
 
 1237        Options.Add_Child(
"CLASSES", Classes); Options.Add_Child(
"HISTOGRAM", bHistogram ? 1 : 0);
 
 
 1247        Options.Add_Child(
"CLASSES", Classes); Options.Add_Child(
"INCREASING", bIncreasing ? 1 : 0);
 
 
 1257        Options.Add_Child(
"CLASSES", Classes);
 
 
 1267        Options.Add_Child(
"STDDEV", StdDev); Options.Add_Child(
"STDDEV_MAX", StdDev_Max);
 
 
 1404        return( 
Parameters.Set_Grid_System(System) );
 
 
 1438void CSG_Tool::_Update_Parameter_States(
CSG_Parameters *pParameters)
 
 1442                for(
int i=0; i<pParameters->
Get_Count(); i++)
 
 1496CSG_String CSG_Tool::_Get_Script_CMD(
bool bHeader, 
bool bAllArguments, 
bool bWrapArgs, 
bool bBatch)
 
 1504                        Script += 
"@ECHO OFF\n\n";
 
 1505                        Script += 
"PUSHD %~dp0\n\n";
 
 1506                        Script += 
"REM SET SAGA_TLB=C:\\MyTools\n\n";
 
 1508                        Script += 
"REM Tool: " + 
Get_Name() + 
"\n\n";
 
 1509                        Script += 
"%SAGA_CMD%";
 
 1513                        Script += 
"#!/bin/bash\n\n";
 
 1514                        Script += 
"# export SAGA_TLB=~/mytools\n\n";
 
 1515                        Script += 
"# tool: " + 
Get_Name() + 
"\n\n";
 
 1516                        Script += 
"saga_cmd";
 
 1521                Script += 
"saga_cmd";
 
 1530                ? 
" \"" + 
Get_ID     () + 
"\"" 
 1533        _Get_Script_CMD(Script, 
Get_Parameters(), bAllArguments, bWrapArgs, bBatch);
 
 1537                _Get_Script_CMD(Script, 
Get_Parameters(i), bAllArguments, bWrapArgs, bBatch);
 
 1543                Script += bBatch ? 
"\n\nPAUSE\n" : 
"\n";
 
 1550void CSG_Tool::_Get_Script_CMD(
CSG_String &Script, 
CSG_Parameters *pParameters, 
bool bAllArguments, 
bool bWrapArgs, 
bool bBatch)
 
 1552        #define GET_ID1(p) (p->Get_Parameters()->Get_Identifier().Length() > 0 \ 
 1553                ? CSG_String::Format("%s_%s", p->Get_Parameters()->Get_Identifier().c_str(), p->Get_Identifier()) \ 
 1554                : CSG_String::Format(p->Get_Identifier())).c_str() 
 1556        #define GET_ID2(p, s) CSG_String::Format("%s_%s", GET_ID1(p), s).c_str() 
 1558        const char *Prefix = !bWrapArgs ? 
" -" : bBatch ? 
" ^\n -" : 
" \\\n -";
 
 1559        const char *StrFmt = bBatch ? 
"%s=\"%s\"" : 
"%s=\\\"\"%s\"\\\"";
 
 1562        for(
int iParameter=0; iParameter<pParameters->
Get_Count(); iParameter++)
 
 1610                        if( ((CSG_Parameter_String *)p)->is_Password() )
 
 1660                                default                           : File += 
".dat"     ; 
break;
 
 1679                                        Script += 
"file(s)";
 
 1686                                        for(
int iObject=1; iObject<p->
asList()->Get_Item_Count(); iObject++)
 
 1709CSG_String CSG_Tool::_Get_Script_CMD_Usage(
void)
 
 1711        wxCmdLineParser Parser; Parser.SetSwitchChars(
"-");
 
 1720        wxString Usage = wxString::Format(
"\nUsage: saga_cmd %s %s %s", 
Get_Library().c_str(), 
Get_ID().c_str(),
 
 1724        CSG_String _Usage(&Usage);
 
 1730void CSG_Tool::_Get_Script_CMD_Usage(
CSG_Parameters *pParameters, wxCmdLineParser &Parser)
 
 1732        for(
int i=0; i<pParameters->
Get_Count(); i++)
 
 1756                Description.Replace(
"\xb", 
""); 
 
 1762                        Parser.AddOption(ID, wxEmptyString, Description, wxCMD_LINE_VAL_STRING, wxCMD_LINE_NEEDS_SEPARATOR|wxCMD_LINE_PARAM_OPTIONAL);
 
 1771                                _Get_Script_CMD_Usage(pParameter->
asParameters(), Parser);
 
 1775                                Parser.AddOption(ID, wxEmptyString, Description, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);
 
 1779                                Parser.AddOption(ID, wxEmptyString, Description, wxCMD_LINE_VAL_NUMBER, wxCMD_LINE_PARAM_OPTIONAL);
 
 1787                                Parser.AddOption(ID, wxEmptyString, Description, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);
 
 1792                                Parser.AddOption(ID, wxEmptyString, Description, wxCMD_LINE_VAL_DOUBLE, wxCMD_LINE_PARAM_OPTIONAL);
 
 1796                                Parser.AddOption(ID, wxEmptyString, Description, wxCMD_LINE_VAL_DATE  , wxCMD_LINE_PARAM_OPTIONAL);
 
 1800                                Parser.AddOption(ID + 
"_MIN", wxEmptyString, Description, wxCMD_LINE_VAL_DOUBLE, wxCMD_LINE_PARAM_OPTIONAL);
 
 1801                                Parser.AddOption(ID + 
"_MAX", wxEmptyString, Description, wxCMD_LINE_VAL_DOUBLE, wxCMD_LINE_PARAM_OPTIONAL);
 
 1805                                Parser.AddOption(ID, wxEmptyString, Description, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);
 
 1809                                Parser.AddOption(ID, wxEmptyString, Description, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);
 
 1815                                Parser.AddOption(ID, wxEmptyString, Description, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);
 
 1819                                Parser.AddOption(ID, wxEmptyString, Description, wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);
 
 1825                                        Parser.AddOption(ID + 
"_D"   , wxEmptyString, 
_TL(
"Cell Size"                          ), wxCMD_LINE_VAL_DOUBLE, wxCMD_LINE_PARAM_OPTIONAL);
 
 1826                                        Parser.AddOption(ID + 
"_X"   , wxEmptyString, 
_TL(
"Lower Left Center Cell X-Coordinate"), wxCMD_LINE_VAL_DOUBLE, wxCMD_LINE_PARAM_OPTIONAL);
 
 1827                                        Parser.AddOption(ID + 
"_Y"   , wxEmptyString, 
_TL(
"Lower Left Center Cell Y-Coordinate"), wxCMD_LINE_VAL_DOUBLE, wxCMD_LINE_PARAM_OPTIONAL);
 
 1828                                        Parser.AddOption(ID + 
"_NX"  , wxEmptyString, 
_TL(
"Number of Columns"                  ), wxCMD_LINE_VAL_NUMBER, wxCMD_LINE_PARAM_OPTIONAL);
 
 1829                                        Parser.AddOption(ID + 
"_NY"  , wxEmptyString, 
_TL(
"Number of Rows"                     ), wxCMD_LINE_VAL_NUMBER, wxCMD_LINE_PARAM_OPTIONAL);
 
 1830                                        Parser.AddOption(ID + 
"_FILE", wxEmptyString, 
_TL(
"Grid File"                          ), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL);
 
 1847CSG_String CSG_Tool::_Get_Script_Python(
bool bHeader, 
bool bAllArguments)
 
 1849        CSG_String      Script, Name(
Get_Name());
 
 1851        Name.Replace(
" ", 
"_");
 
 1852        Name.Replace(
"(", 
"");
 
 1853        Name.Replace(
")", 
"");
 
 1854        Name.Replace(
"[", 
"");
 
 1855        Name.Replace(
"]", 
"");
 
 1856        Name.Replace(
".", 
"");
 
 1857        Name.Replace(
",", 
"");
 
 1858        Name.Replace(
"/", 
"");
 
 1859        Name.Replace(
"-", 
"");
 
 1864                Script += 
"#! /usr/bin/env python\n";
 
 1866                Script += 
"#_________________________________________\n";
 
 1867                Script += 
"##########################################\n";
 
 1871                Script += 
"# Initialize the environment...\n";
 
 1873                Script += 
"# Windows: Let the 'SAGA_PATH' environment variable point to\n";
 
 1874                Script += 
"# the SAGA installation folder before importing 'saga_api'!\n";
 
 1875                Script += 
"# This can be defined globally in the Windows system or\n";
 
 1876                Script += 
"# user environment variable settings, in the 'PySAGA/__init__.py'\n";
 
 1877                Script += 
"# file, or in the individual Python script itself. To do the latter\n";
 
 1878                Script += 
"# just uncomment the following line and adjust the path accordingly:\n";
 
 1879                Script += 
"###import os; os.environ['SAGA_PATH'] = '" + AppPath + 
"'\n";
 
 1881                Script += 
"# Windows: The most convenient way to make PySAGA available to all your\n";
 
 1882                Script += 
"# Python scripts is to copy the PySAGA folder to the 'Lib/site-packages/'\n";
 
 1883                Script += 
"# folder of your Python installation. If don't want to do this or if you\n";
 
 1884                Script += 
"# don't have the rights to do so, you can also copy it to the folder with\n";
 
 1885                Script += 
"# the Python scripts in which you want to use PySAGA, or alternatively\n";
 
 1886                Script += 
"# you can add the path containing the PySAGA folder (e.g. the path to your\n";
 
 1887                Script += 
"# SAGA installation) to the PYTHONPATH environment variable. To do this\n";
 
 1888                Script += 
"# from within your script you can also take the following command (just\n";
 
 1889                Script += 
"# uncomment the following line and adjust the path accordingly):\n";
 
 1890                Script += 
"###import sys; sys.path.insert(1, '" + AppPath + 
"')\n";
 
 1893                Script += 
"# Import saga_api from PySAGA:\n";
 
 1894                Script += 
"from PySAGA import saga_api\n";
 
 1897                Script += 
"#_________________________________________\n";
 
 1898                Script += 
"##########################################\n";
 
 1899                Script += 
"def Run_" + Name + 
"(Results):\n";
 
 1903        if( bHeader ) Script += 
"    # Get the tool:\n";
 
 1904        Script += 
"    Tool = saga_api.SG_Get_Tool_Library_Manager().Get_Tool('" + 
Get_Library() + 
"', '" + 
Get_ID() + 
"')\n";
 
 1905        Script += 
"    if not Tool:\n";
 
 1906        Script += 
"        saga_api.SG_UI_Msg_Add_Error('Failed to request tool: " + 
Get_Name() + 
"')\n";
 
 1907        Script += 
"        return False\n";
 
 1909        if( bHeader ) Script += 
"    # Set the parameter interface:\n";
 
 1910        Script += 
"    Tool.Reset()\n";
 
 1922        if( bHeader ) Script += 
"    # Execute the tool:\n";
 
 1923        Script += 
"    if not Tool.Execute():\n";
 
 1924        Script += 
"        saga_api.SG_UI_Msg_Add_Error('failed to execute tool: ' + Tool.Get_Name().c_str())\n";
 
 1925        Script += 
"        return False\n";
 
 1927        if( bHeader ) Script += 
"    # Request the results:\n";
 
 1945                        default                           : type = 
""          ; ext = 
""        ; 
break;
 
 1950                                Script += 
"    Data = Tool.Get_Parameter('" +  
id + 
"').as" + type + 
"()\n";
 
 1954                                        Script += 
"    Data.Save('{:s}/{:s}.{:s}'.format(Results, Data.Get_Name(), '" + ext + 
"'))\n\n";
 
 1959                                Script += 
"    List = Tool.Get_Parameter('" +  
id + 
"').as" + type + 
"List()\n";
 
 1960                                Script += 
"    for i in range(0, List.Get_Item_Count()):\n";
 
 1964                                        Script += 
"        List.Get_Item(i).Save('{:s}/{:s}_{:d}.{:s}'.format(Results, List.Get_Name(), i, '" + ext + 
"'))\n\n";
 
 1968                                        Script += 
"        Data = List.Get_Item(i)\n";
 
 1977                Script += 
"    # job is done, free memory resources:\n";
 
 1978                Script += 
"    saga_api.SG_Get_Data_Manager().Delete_All()\n";
 
 1980                Script += 
"    return True\n";
 
 1983                Script += 
"#_________________________________________\n";
 
 1984                Script += 
"##########################################\n";
 
 1985        Script += 
"print('This is a simple template for using a SAGA tool through Python.')\n";
 
 1986        Script += 
"print('Please edit the script to make it work properly before using it!')\n";
 
 1988                Script += 
"# Run_" + Name + 
"('.')\n";
 
 1997        for(
int iParameter=0; iParameter<pParameters->
Get_Count(); iParameter++)
 
 2010                        ID.Prepend(Prefix + 
".");
 
 2052                        if( ((CSG_Parameter_String *)p)->is_Password() )
 
 2065                        Script += 
CSG_String::Format(
"    Tool.Set_Parameter('%s', saga_api.SG_Create_Table('table.txt'))\n", ID.c_str());
 
 2071                                Script += 
CSG_String::Format(
"    Tool.Set_Parameter('%s', saga_api.CSG_Grid_System(%g, %g, %g, %d, %d))\n", ID.c_str(),
 
 2087                                Script += 
CSG_String::Format(
"    Tool.Set_Parameter('%s', saga_api.SG_Get_Data_Manager().Add('%s input file%s'))\n", ID.c_str(),
 
 2093                                Script += 
CSG_String::Format(
"    Tool.Set_Parameter('%s', saga_api.SG_Get_Create_Pointer()) # optional output, remove this line, if you don't want to create it\n", ID.c_str());
 
 2105                                Script += 
CSG_String::Format(
"    Tool.Get_Parameter('%s').asList().Add_Item('%s input list%s')\n", ID.c_str(),
 
 2112                        _Get_Script_Python(Script, p->
asParameters(), bAllArguments, ID);
 
 2124CSG_String CSG_Tool::_Get_Script_Python_Wrap(
bool bHeader, 
bool bName, 
bool bCall, 
int AllArguments, 
bool bWrapArgs)
 
 2126        CSG_String Arguments, Description, Code;
 
 2128        if( AllArguments >= 0 ) 
 
 2132                        _Get_Script_Python_Wrap(
Parameters[i], 
PARAMETER_INPUT         , Arguments, Description, Code, bCall && bHeader, AllArguments == 0, bWrapArgs);
 
 2142                        _Get_Script_Python_Wrap(
Parameters[i], 
PARAMETER_OUTPUT        , Arguments, Description, Code, bCall && bHeader, AllArguments == 0, bWrapArgs);
 
 2147                        _Get_Script_Python_Wrap(
Parameters[i], 0                       , Arguments, Description, Code, bCall           , AllArguments == 0, bWrapArgs);
 
 2152        CSG_String Name, Expected(
Get_Name()); Expected.Replace(
"'", 
"\\'");
 
 2158                if( isdigit(Name[0]) ) 
 
 2189                        Script += 
"from PySAGA.tools import " + 
Get_Library() + 
"\n\n";
 
 2193                                Script += Code + 
"\n";
 
 2197                Script += 
Get_Library() + 
'.' + Name + 
"(" + Arguments + 
")\n";
 
 2205                        Script += 
"#! /usr/bin/env python\n";
 
 2206                        Script += 
"from PySAGA.helper import Tool_Wrapper\n\n";
 
 2209                Script += 
"def " + Name + 
"(" + Arguments + 
", Verbose=2):\n";
 
 2212                Script += 
"    ----------\n";
 
 2214                for(
int i=0; i<_Description.
Get_Count(); i++)
 
 2216                        _Description[i].Trim_Both(); Script += 
"    " + _Description[i] + 
"\\n\n";
 
 2218                Script += 
"    Arguments\n";
 
 2219                Script += 
"    ----------\n";
 
 2220                Script += Description + 
"\n";
 
 2221                Script += 
"    - Verbose [`integer number`] : Verbosity level, 0=silent, 1=tool name and success notification, 2=complete tool output.\\n\n";
 
 2222                Script += 
"    Returns\n";
 
 2223                Script += 
"    ----------\n";
 
 2224                Script += 
"    `boolean` : `True` on success, `False` on failure.\n";
 
 2226                Script += 
"    Tool = Tool_Wrapper('" + 
Get_Library() + 
"', '" + 
Get_ID() + 
"', '" + Expected + 
"')\n";
 
 2227                Script += 
"    if Tool.is_Okay():\n";
 
 2229                Script += 
"        return Tool.Execute(Verbose)\n";
 
 2230                Script += 
"    return False\n\n";
 
 2257                ID.Prepend(Prefix + 
".");
 
 2260        CSG_String Argument(ID);
 
 2262        if( Argument[0] >= 
'0' && Argument[0] <= 
'9' )
 
 2264                Argument.Prepend(
'_');
 
 2267        Argument.Replace(
".", 
"_");
 
 2268        Argument.Replace(
"|", 
"_");
 
 2269        Argument.Replace(
" ", 
"_");
 
 2271        if( Argument.Length() > 2 )
 
 2273                Argument.Make_Upper();
 
 2279                bool bResult = 
false;
 
 2281                for(
int i=0; i<(*Parameter.
asParameters()).Get_Count(); i++)
 
 2283                        if( _Get_Script_Python_Wrap((*Parameter.
asParameters())[i], Constraint, Arguments, Description, Code, bCall, bOnlyNonDefaults, bWrapArgs, ID) )
 
 2296        if( Parameter.
is_Option() &&                             Constraint != 0                        ) { 
return( 
false ); }
 
 2316                                ); File.Replace(
"\\", 
"/");
 
 2350                        if( bOnlyNonDefaults && Parameter.
is_Default() )
 
 2386                        default                         : 
return( 
false );
 
 2394                                Arguments += !Arguments.
is_Empty() ? 
",\n    " : 
"\n    ";
 
 2401                        Arguments += Argument + 
"=" + Value;
 
 2410                Arguments += !Arguments.
is_Empty() ? 
",\n    " : 
"\n    ";
 
 2417        Arguments += Argument + 
"=None";
 
 2422        if( Parameter.
is_Input () ) { Code += 
"Tool.Set_Input "; }
 
 2423        if( Parameter.
is_Output() ) { Code += 
"Tool.Set_Output"; }
 
 2424        if( Parameter.
is_Option() ) { Code += 
"Tool.Set_Option"; }
 
 2429        Description += 
"    - " + Argument + 
" [`";
 
 2433                Description += Parameter.
is_Optional() ? 
"optional input " : 
"input ";
 
 2437                Description += 
"output ";
 
 2446                Description += 
". " + s;
 
 2449        Description += 
"\n";
 
 2459CSG_String CSG_Tool::_Get_Script_Markdown(
bool bHeader, 
int iArguments)
 
 2470                Script += 
CSG_String::Format(
"**Menu:** *%s*   //    **Category:** *%s*\n\n", Menu.
c_str(), Category.
c_str());
 
 2473        Script += 
"|**Parameter**|**Setting**|\n";
 
 2474        Script += 
"|---|---|\n";
 
 2491        for(
int iParameter=0; iParameter<pParameters->
Get_Count(); iParameter++)
 
 2527                        Space = 
"   ";
 
 2551                        if( s.
Contains(
"no choice available") ) { Bold = 
""; }
 
 2560                        if( s.
Contains(
"no attributes") )       { Bold = 
""; }
 
 2589                        if( ((CSG_Parameter_String *)p)->is_Password() )
 
 2639                                if( s.
Contains(
"not set") )     { Bold = 
""; }
 
 2645                                CSG_String Output = p->
is_Optional() ? 
"\\<" : 
"<<";
 
 2668                        CSG_String Prefix = 
"   → ";
 
 2669                        _Get_Script_Markdown(Script, p->
asParameters(), iArguments, Prefix);
 
 2720                CSG_MetaData *pOutput = History(
"TOOL") ? History[
"TOOL"](
"OUTPUT") : NULL;
 
 
 2736void CSG_Tool::_Set_Output_History(
void)
 
 2744                for(
int i=0; i<pParameters->
Get_Count(); i++)
 
 2796                for(
int j=0; j<pParameter->
asList()->Get_Item_Count(); j++)
 
 
bool SG_UI_DataObject_Update(CSG_Data_Object *pDataObject, int Show, CSG_Parameters *pParameters)
void SG_UI_Msg_Add_Error(const char *Message)
int SG_UI_Dlg_Error(const CSG_String &Message, const CSG_String &Caption)
bool SG_UI_Stop_Execution(bool bDialog)
bool SG_UI_Process_Get_Okay(bool bBlink)
bool SG_UI_Dlg_Parameters(CSG_Parameters *pParameters, const CSG_String &Caption)
bool SG_UI_DataObject_Colors_Get(CSG_Data_Object *pDataObject, CSG_Colors *pColors)
void SG_UI_Msg_Add(const char *Message, bool bNewLine, TSG_UI_MSG_STYLE Style)
bool SG_UI_DataObject_Params_Get(CSG_Data_Object *pDataObject, CSG_Parameters *pParameters)
void SG_UI_Process_Set_Text(const CSG_String &Text)
bool SG_UI_Process_Set_Ready(void)
bool SG_UI_Process_Set_Progress(int Position, int Range)
bool SG_UI_DataObject_Add(CSG_Data_Object *pDataObject, int Show)
void SG_UI_Msg_Add_Execution(const char *Message, bool bNewLine, TSG_UI_MSG_STYLE Style)
bool SG_UI_Process_Set_Okay(bool bOkay)
bool SG_UI_DataObject_Params_Set(CSG_Data_Object *pDataObject, CSG_Parameters *pParameters)
void SG_UI_Dlg_Message(const CSG_String &Message, const CSG_String &Caption)
bool SG_UI_DataObject_Colors_Set(CSG_Data_Object *pDataObject, CSG_Colors *pColors)
bool SG_UI_Dlg_Continue(const CSG_String &Message, const CSG_String &Caption)
bool SG_UI_DataObject_Classify(CSG_Data_Object *pDataObject, const CSG_MetaData &Options)
CSG_String SG_Color_To_Text(long Color, bool bHexadecimal)
CSG_String SG_UI_Get_Application_Name(void)
CSG_String SG_UI_Get_Application_Path(bool bPathOnly)
SAGA_API_DLL_EXPORT bool SG_File_Exists(const CSG_String &FileName)
@ SG_UI_MSG_STYLE_FAILURE
@ SG_UI_MSG_STYLE_SUCCESS
SAGA_API_DLL_EXPORT CSG_String SG_HTML_Tag_Replacer(const CSG_String &Text)
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)
@ SG_UI_DATAOBJECT_SHOW_MAP
@ SG_UI_DATAOBJECT_UPDATE
bool Set_Predefined(int Index, bool bRevert=false, int nColors=0)
bool Delete(CSG_Data_Object *pObject, bool bDetach=false)
const SG_Char * Get_Name(void) const
const SG_Char * Get_File_Name(bool bNative=true) const
CSG_MetaData & Get_History(void)
static CSG_DateTime Now(void)
double Get_XMin(bool bCells=false) const
double Get_YMin(bool bCells=false) const
double Get_Cellsize(void) const
const SG_Char * asString(void)
virtual bool Del_Items(void)
CSG_Data_Object * Get_Item(int Index) const
int Get_Item_Count(void) const
double Get_Max(void) const
double Get_Min(void) const
CSG_String Get_CmdID(void) const
const SG_Char * Get_Identifier(void) const
bool is_DataObject(void) const
class CSG_Parameters * asParameters(void) const
CSG_String Get_Type_Identifier(void) const
CSG_String Get_Type_Name(void) const
bool is_Optional(void) const
TSG_Data_Object_Type Get_DataObject_Type(void) const
int Get_Children_Count(void) const
double asDouble(void) const
CSG_Parameter * Get_Parent(void) const
virtual TSG_Parameter_Type Get_Type(void) const =0
bool is_Input(void) const
CSG_Parameters * Get_Parameters(void) const
const SG_Char * Get_Name(void) const
bool is_Enabled(bool bCheckEnv=true) const
bool is_Option(void) const
virtual bool Set_Value(int Value)
class CSG_Parameter_List * asList(void) const
CSG_Grid_System * asGrid_System(void) const
CSG_Data_Object * asDataObject(void) const
class CSG_Parameter_Range * asRange(void) const
bool is_Output(void) const
virtual bool is_Default(void) const
bool is_Information(void) const
bool do_UseInCMD(void) const
const SG_Char * asString(void) const
bool Cmp_Identifier(const CSG_String &Identifier) const
const SG_Char * Get_Description(void) const
bool do_UseInGUI(void) const
bool is_DataObject_List(void) const
bool is_Managed(void) const
bool Set_Callback(bool bActive=true)
bool Reset_Grid_System(void)
int Get_Count(void) const
void Set_Manager(class CSG_Data_Manager *pManager)
class CSG_Tool * Get_Tool(void) const
bool Set_History(CSG_MetaData &History, bool bOptions=true, bool bDataObjects=true)
CSG_Parameter * Get_Parameter(int i) const
bool Create(const CSG_Parameters &Parameters)
bool Restore_Defaults(bool bClearData=false)
bool Push(class CSG_Data_Manager *pManager=NULL, bool bRestoreDefaults=true)
TSG_PFNC_Parameter_Changed Set_Callback_On_Parameter_Changed(TSG_PFNC_Parameter_Changed pCallback)
bool Del_Parameter(int i)
bool Set_Parameter(const CSG_String &ID, CSG_Parameter *pValue)
CSG_String AfterFirst(char Character) const
int Cmp(const CSG_String &String) const
size_t Replace(const CSG_String &Old, const CSG_String &New, bool bReplaceAll=true)
static CSG_String Format(const char *Format,...)
const SG_Char * c_str(void) const
CSG_String & Make_Lower(void)
int Printf(const char *Format,...)
bool is_Empty(void) const
bool Contains(const CSG_String &String) const
CSG_String & Prepend(const CSG_String &String)
int Get_Count(void) const
CSG_String Format(const CSG_String &format="") const
int Get_Minutes(void) const
sLong Get_Milliseconds(void) const
sLong Get_Seconds(void) const
int Get_Hours(void) const
CSG_Data_Manager & SG_Get_Data_Manager(void)
int SG_Get_History_Depth(void)
CSG_String SG_Get_DataObject_Name(TSG_Data_Object_Type Type)
CSG_String SG_Get_DataObject_Class_Name(TSG_Data_Object_Type Type)
@ SG_DATAOBJECT_TYPE_PointCloud
@ SG_DATAOBJECT_TYPE_Grids
@ SG_DATAOBJECT_TYPE_Shapes
@ SG_DATAOBJECT_TYPE_Grid
@ SG_DATAOBJECT_TYPE_Table
#define DATAOBJECT_NOTSET
#define PARAMETER_CHECK_ENABLE
#define PARAMETER_DESCRIPTION_PROPERTIES
#define PARAMETER_CHECK_VALUES
#define PARAMETER_INPUT_OPTIONAL
#define PARAMETER_DESCRIPTION_TYPE
#define PARAMETER_DESCRIPTION_NAME
@ PARAMETER_TYPE_FixedTable
@ PARAMETER_TYPE_Grid_List
@ PARAMETER_TYPE_Table_Fields
@ PARAMETER_TYPE_DataObject_Output
@ PARAMETER_TYPE_Table_List
@ PARAMETER_TYPE_TIN_List
@ PARAMETER_TYPE_Grid_System
@ PARAMETER_TYPE_PointCloud_List
@ PARAMETER_TYPE_Data_Type
@ PARAMETER_TYPE_Shapes_List
@ PARAMETER_TYPE_PointCloud
@ PARAMETER_TYPE_Table_Field
@ PARAMETER_TYPE_Parameters
@ PARAMETER_TYPE_FilePath
@ PARAMETER_TYPE_Grids_List
#define PARAMETER_DESCRIPTION_TEXT