SAGA API Version 9.11
Loading...
Searching...
No Matches
tool.cpp File Reference
#include "saga_api.h"
#include "data_manager.h"
#include "tool.h"
#include "tool_chain.h"
#include <wx/string.h>
#include <wx/cmdline.h>

Go to the source code of this file.

Macros

#define ADD_MESSAGE_EXECUTION(Text, Style)
#define _TOOL_EXCEPTION
#define INIT_STRETCH_OPTIONS(method)
#define INIT_CLASSIFY_OPTIONS(method)
#define GET_ID1(p)
#define GET_ID2(p, s)
#define WRITE_CHILD(pChild, Prefix)
#define CHECK_OBJECTS_NODE()
#define CHECK_DATA_NODE(Name)
#define GET_PARENT_NODE(prt)
#define FORMAT_DATASET()

Macro Definition Documentation

◆ _TOOL_EXCEPTION

#define _TOOL_EXCEPTION

◆ ADD_MESSAGE_EXECUTION

#define ADD_MESSAGE_EXECUTION ( Text,
Style )
Value:
{ SG_UI_Msg_Add(Text, true, Style); if( has_GUI() ) { SG_UI_Msg_Add_Execution(Text, true, Style); } }
void SG_UI_Msg_Add(const char *Message, bool bNewLine, TSG_UI_MSG_STYLE Style)
void SG_UI_Msg_Add_Execution(const char *Message, bool bNewLine, TSG_UI_MSG_STYLE Style)

Referenced by CSG_Tool::Execute(), and CSG_Tool_Interactive_Base::Execute_Finish().

◆ CHECK_DATA_NODE

#define CHECK_DATA_NODE ( Name)
Value:
pChild = Properties.Get_Child(Name);\
if( !pChild )\
{\
CSG_MetaData *pData = Properties.Get_Child(_TL("Data Objects"));\
if( !pData )\
{\
Properties.Add_Child(_TL("Data Objects"));\
}\
pChild = Properties.Add_Child(Name);\
}\
\
pRoot = pChild;
#define _TL(s)
Definition api_core.h:1568
CSG_MetaData * Get_Child(int Index) const
Definition metadata.h:149
CSG_MetaData * Add_Child(void)
Definition metadata.cpp:166

◆ CHECK_OBJECTS_NODE

#define CHECK_OBJECTS_NODE ( )
Value:
pChild = Properties.Get_Child(_TL("Options"));\
if( !pChild )\
{\
pChild = Properties.Add_Child(_TL("Options"));\
}\
\
pRoot = pChild;

◆ FORMAT_DATASET

#define FORMAT_DATASET ( )
Value:
if( p->is_Input() )\
{\
CSG_String Input = p->is_Optional() ? ">" : ">>";\
CSG_String s = p->asString();\
if( s.Contains(_TL("not set")) || s.Contains(_TL("No objects")) ) { Bold = ""; }\
s.Replace("<", "\\<");\
Parameter = CSG_String::Format("|%s%s %s%s%s|%s%s%s|", Space.c_str(), Input.c_str(), Bold.c_str(), Name.c_str(), Bold.c_str(), Bold.c_str(), s.c_str(), Bold.c_str());\
}\
else if( p->is_Output() )\
{\
CSG_String Output = p->is_Optional() ? "\\<" : "<<";\
CSG_String s = p->asString();\
if( !p->is_Optional() && s.Contains(_TL("create")) ) { Bold = ""; }\
else if( p->is_Optional() && (s.Contains(_TL("not set")) || s.Contains(_TL("No objects"))) ) { Bold = ""; }\
s.Replace("<", "\\<");\
Parameter = CSG_String::Format("|%s%s %s%s%s|%s%s%s|", Space.c_str(), Output.c_str(), Bold.c_str(), Name.c_str(), Bold.c_str(), Bold.c_str(), s.c_str(), Bold.c_str());\
}
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
bool Contains(const CSG_String &String) const

◆ GET_ID1

#define GET_ID1 ( p)
Value:
(p->Get_Parameters()->Get_Identifier().Length() > 0 \
? CSG_String::Format("%s_%s", p->Get_Parameters()->Get_Identifier().c_str(), p->Get_Identifier()) \
: CSG_String::Format(p->Get_Identifier())).c_str()

◆ GET_ID2

#define GET_ID2 ( p,
s )
Value:
CSG_String::Format("%s_%s", GET_ID1(p), s).c_str()
#define GET_ID1(p)

◆ GET_PARENT_NODE

#define GET_PARENT_NODE ( prt)
Value:
bool bFound = false;\
for (int i=0; i<Properties.Get_Children_Count(); i++)\
{\
CSG_MetaData *pDatatype = Properties.Get_Child(i);\
for (int j=0; j<Properties.Get_Children_Count(); j++)\
{\
pParent = pDatatype->Get_Child(prt);\
if( pParent )\
{\
bFound = true;\
break;\
}\
}\
if( bFound )\
{\
break;\
}\
}

◆ INIT_CLASSIFY_OPTIONS

#define INIT_CLASSIFY_OPTIONS ( method)
Value:
if( !pDataObject || (pDataObject->asTable(true) && (Field < 0 || Field >= pDataObject->asTable(true)->Get_Field_Count())) ) { return( false ); }\
CSG_MetaData Options; Options.Add_Child("METHOD", method); Options.Add_Child("COLORS", Colors); Options.Add_Child("FIELD", Field);

Definition at line 1208 of file tool.cpp.

Referenced by CSG_Tool::DataObject_Classify_Defined(), CSG_Tool::DataObject_Classify_Equal(), CSG_Tool::DataObject_Classify_Geometric(), CSG_Tool::DataObject_Classify_Natural(), CSG_Tool::DataObject_Classify_Quantile(), CSG_Tool::DataObject_Classify_StdDev(), and CSG_Tool::DataObject_Classify_Unique().

◆ INIT_STRETCH_OPTIONS

#define INIT_STRETCH_OPTIONS ( method)
Value:
{ if( !pDataObject || (pDataObject->asTable(true) && (Field < 0 || Field >= pDataObject->asTable(true)->Get_Field_Count())) ) { return( false ); }\
if( Colors >= 0 ) { DataObject_Set_Colors(pDataObject, -1, Colors); }\
DataObject_Set_Parameter(pDataObject, "COLORS_TYPE" , 3); /* graduated colors */\
DataObject_Set_Parameter(pDataObject, "STRETCH_DEFAULT" , method);\
DataObject_Set_Parameter(pDataObject, "METRIC_SCALE_MODE", Interval_Mode);\
DataObject_Set_Parameter(pDataObject, "METRIC_SCALE_LOG" , Interval_Log );\
if( pDataObject->asTable(true) )\
{ DataObject_Set_Parameter(pDataObject, "METRIC_FIELD" , Field);\
DataObject_Set_Parameter(pDataObject, "METRIC_MORMAL", pDataObject->asTable(true)->Get_Field_Count());\
}\
}

Definition at line 1145 of file tool.cpp.

Referenced by CSG_Tool::DataObject_Set_Stretch(), CSG_Tool::DataObject_Set_Stretch_Linear(), CSG_Tool::DataObject_Set_Stretch_Percentile(), and CSG_Tool::DataObject_Set_Stretch_StdDev().

◆ WRITE_CHILD

#define WRITE_CHILD ( pChild,
Prefix )
Value:
Script += CSG_String::Format("|%s%s||\n", Prefix.c_str(), pChild->Get_Name().c_str());\
for (int i=0; i<pChild->Get_Children_Count(); i++)\
{\
Script += CSG_String::Format("%s\n", pChild->Get_Child(i)->Get_Content().c_str());\
}