SAGA API  v9.5
tool_chain.cpp
Go to the documentation of this file.
1 
3 // //
4 // SAGA //
5 // //
6 // System for Automated Geoscientific Analyses //
7 // //
8 // Application Programming Interface //
9 // //
10 // Library: SAGA_API //
11 // //
12 //-------------------------------------------------------//
13 // //
14 // tool_chain.cpp //
15 // //
16 // Copyright (C) 2014 by Olaf Conrad //
17 // //
18 //-------------------------------------------------------//
19 // //
20 // This file is part of 'SAGA - System for Automated //
21 // Geoscientific Analyses'. //
22 // //
23 // This library is free software; you can redistribute //
24 // it and/or modify it under the terms of the GNU Lesser //
25 // General Public License as published by the Free //
26 // Software Foundation, either version 2.1 of the //
27 // License, or (at your option) any later version. //
28 // //
29 // This library is distributed in the hope that it will //
30 // be useful, but WITHOUT ANY WARRANTY; without even the //
31 // implied warranty of MERCHANTABILITY or FITNESS FOR A //
32 // PARTICULAR PURPOSE. See the GNU Lesser General Public //
33 // License for more details. //
34 // //
35 // You should have received a copy of the GNU Lesser //
36 // General Public License along with this program; if //
37 // not, see <http://www.gnu.org/licenses/>. //
38 // //
39 //-------------------------------------------------------//
40 // //
41 // contact: Olaf Conrad //
42 // Institute of Geography //
43 // University of Hamburg //
44 // Germany //
45 // //
46 // e-mail: oconrad@saga-gis.org //
47 // //
49 
50 //---------------------------------------------------------
51 #include "saga_api.h"
52 
53 #include "tool_chain.h"
54 
55 
57 // //
58 // //
59 // //
61 
62 //---------------------------------------------------------
63 #define GET_XML_CONTENT(XML, ID, DEFAULT, TRANSLATE) (!XML(ID) ? CSG_String(DEFAULT) : !TRANSLATE ? XML[ID].Get_Content() : CSG_String(SG_Translate(XML[ID].Get_Content())))
64 
65 #define IS_TRUE_STRING(String) (!String.CmpNoCase("true") || !String.CmpNoCase("1"))
66 #define IS_TRUE_PROPERTY(Item, Property) (Item.Cmp_Property(Property, "true", true) || Item.Cmp_Property(Property, "1"))
67 
68 #define Get_List_Count(p) (p->asGridList() ? p->asGridList()->Get_Grid_Count() : p->asList() ? p->asList()->Get_Item_Count() : 0)
69 #define Get_List_Item(p, i) (p->asGridList() ? p->asGridList()->Get_Grid (i) : p->asList() ? p->asList()->Get_Item (i) : NULL)
70 
71 
73 // //
74 // //
75 // //
77 
78 //---------------------------------------------------------
80 {
81  // nop
82 }
83 
84 //---------------------------------------------------------
86 {
87  Create(Tool, bWithGUI);
88 }
89 
90 //---------------------------------------------------------
92 {
93  Create(File);
94 }
95 
96 //---------------------------------------------------------
98 {
99  Create(Chain);
100 }
101 
102 //---------------------------------------------------------
104 {
105  Reset();
106 }
107 
108 //---------------------------------------------------------
109 void CSG_Tool_Chain::Reset(void)
110 {
113 
114  m_Chain.Destroy();
115 
116  m_Conditions.Destroy();
117 
118  m_Menu.Clear();
119 }
120 
121 //---------------------------------------------------------
123 {
124  m_Library_Menu = Menu;
125 }
126 
127 
129 // //
131 
132 //---------------------------------------------------------
133 bool CSG_Tool_Chain::Create(const CSG_Tool_Chain &Tool, bool bWithGUI)
134 {
135  if( !Create(Tool.m_Chain) )
136  {
137  return( false );
138  }
139 
140  m_ID = Tool.m_ID;
141  m_Library = Tool.m_Library;
142  m_Library_Menu = Tool.m_Library_Menu;
143  m_File_Name = Tool.m_File_Name;
144  m_bGUI = bWithGUI && m_bGUI;
145 
146  return( true );
147 }
148 
149 //---------------------------------------------------------
151 {
152  CSG_MetaData Chain;
153 
154  if( File.Right(sizeof(".pyt.xml")).Make_Lower().Find(".pyt.xml") >= 0 )
155  {
156  return( false );
157  }
158 
159  if( !Chain.Load(File) )
160  {
161  Error_Fmt("%s: %s", _TL("failed to load or parse xml file"), File.c_str());
162 
163  return( false );
164  }
165 
166  if( Chain.Cmp_Name("toolchains") ) // don't report any error, this xml-file provides info for a category of tool chains
167  {
168  return( false );
169  }
170 
171  if( !Chain.Cmp_Name("toolchain") || !Chain("identifier") || !Chain("parameters") )
172  {
173  Error_Fmt("%s: %s", _TL("xml file is not a valid tool chain"), File.c_str());
174 
175  return( false );
176  }
177 
178  //-----------------------------------------------------
179  SG_UI_Msg_Add(CSG_String::Format("%s: %s...", File.Cmp(m_File_Name) ? _TL("Loading tool chain") : _TL("Reloading tool chain"), File.c_str()), true);
180 
181  if( Create(Chain) )
182  {
183  m_File_Name = File;
184 
185  SG_UI_Msg_Add(_TL("okay"), false, SG_UI_MSG_STYLE_SUCCESS);
186 
187  return( true );
188  }
189 
190  m_File_Name.Clear(); Reset();
191 
192  SG_UI_Msg_Add(_TL("failed"), false, SG_UI_MSG_STYLE_FAILURE);
193 
194  return( false );
195 }
196 
197 //---------------------------------------------------------
199 {
200  if( !Chain.Cmp_Name("toolchain") || !Chain("identifier") || !Chain("parameters") || !Chain("tools") )
201  {
202  return( false );
203  }
204 
205  if( SG_Compare_Version(Chain.Get_Property("saga-version"), "2.1.3") < 0 )
206  {
207  Error_Fmt("%s %s: %s", _TL("Warning"), _TL("unsupported tool chain version"), Chain.Get_Property("saga-version"));
208  }
209 
210  //-----------------------------------------------------
211  Reset();
212 
213  m_Chain = Chain;
214  m_ID = GET_XML_CONTENT(m_Chain, "identifier" , "" , false) ;
215  m_Library = GET_XML_CONTENT(m_Chain, "group" , "toolchains" , false) ;
216  m_Menu = GET_XML_CONTENT(m_Chain, "menu" , "" , true) ;
217  Set_Name (GET_XML_CONTENT(m_Chain, "name" , _TL("Not Named" ), true));
218  Set_Author (GET_XML_CONTENT(m_Chain, "author" , _TL("unknown" ), false));
219  Set_Description (GET_XML_CONTENT(m_Chain, "description", _TL("no description"), true));
220 
221  if( m_Library.is_Empty() )
222  {
223  m_Library = "toolchains";
224  }
225 
226  Add_References();
227 
228  CSG_String Description = Get_Description();
229  Description.Replace("[[", "<"); // support for xml/html tags
230  Description.Replace("]]", ">");
231  Set_Description(Description);
232 
233  if( !m_Menu.is_Empty() && (m_Menu.Length() < 2 || m_Menu[1] != ':') )
234  {
235  if( IS_TRUE_PROPERTY(m_Chain["menu"], "absolute") )
236  m_Menu.Prepend("A:"); // absolute path
237  else
238  m_Menu.Prepend("R:"); // relative path
239  }
240 
241  m_bAddHistory = IS_TRUE_PROPERTY(m_Chain["tools"], "history");
242 
243  //-----------------------------------------------------
244  for(int i=0; i<m_Chain["parameters"].Get_Children_Count(); i++)
245  {
246  const CSG_MetaData &Parameter = m_Chain["parameters"][i];
247 
248  CSG_String ID = Parameter.Get_Property("varname");
249 
250  if( ID.is_Empty() || Parameters(ID) )
251  {
252  continue;
253  }
254 
255  if( Parameter.Get_Property("with_gui") && !IS_TRUE_PROPERTY(Parameter, "with_gui") && has_GUI() == false )
256  {
257  continue;
258  }
259 
260  if( Parameter.Get_Property("with_cmd") && !IS_TRUE_PROPERTY(Parameter, "with_cmd") && has_GUI() != false )
261  {
262  continue;
263  }
264 
265  //-------------------------------------------------
266  int Constraint = 0;
267  CSG_String Value;
268  bool bMin = false, bMax = false;
269  double Min = 0. , Max = 0.;
270 
271  if( Parameter.Cmp_Name("input") )
272  {
273  Constraint = IS_TRUE_PROPERTY(Parameter, "optional") ? PARAMETER_INPUT_OPTIONAL : PARAMETER_INPUT;
274  }
275  else if( Parameter.Cmp_Name("output") )
276  {
277  Constraint = IS_TRUE_PROPERTY(Parameter, "optional") ? PARAMETER_OUTPUT_OPTIONAL : PARAMETER_OUTPUT;
278  }
279  else if( Parameter.Cmp_Name("option") && Parameter("value") )
280  {
281  Value = Parameter.Get_Content("value");
282 
283  bMin = Parameter["value"].Get_Property("min", Min);
284  bMax = Parameter["value"].Get_Property("max", Max);
285  }
286 
287  //-------------------------------------------------
288  if( Parameter("condition") )
289  {
290  CSG_MetaData &Conditions = *m_Conditions.Add_Child(ID);
291 
292  for(int j=0; j<Parameter.Get_Children_Count(); j++) // there might be more than one condition to be checked
293  {
294  if( Parameter[j].Cmp_Name("condition") )
295  {
296  Conditions.Add_Child(Parameter[j]);
297  }
298  }
299  }
300 
301  //-------------------------------------------------
302  CSG_String Name = SG_Translate(Parameter.Get_Content("name" ));
303  CSG_String Desc = SG_Translate(Parameter.Get_Content("description"));
304 
305  CSG_Parameter *pParent = Parameters(Parameter.Get_Property("parent"));
306  CSG_String ParentID(pParent ? pParent->Get_Identifier() : SG_T(""));
307 
308  //-------------------------------------------------
309  switch( SG_Parameter_Type_Get_Type(Parameter.Get_Property("type")) )
310  {
311  case PARAMETER_TYPE_Node : Parameters.Add_Node (ParentID, ID, Name, Desc); break;
312 
313  case PARAMETER_TYPE_Bool : Parameters.Add_Bool (ParentID, ID, Name, Desc, IS_TRUE_STRING(Value)); break;
314  case PARAMETER_TYPE_Int : Parameters.Add_Int (ParentID, ID, Name, Desc, Value.asInt (), (int)Min, bMin, (int)Max, bMax); break;
315  case PARAMETER_TYPE_Double : Parameters.Add_Double (ParentID, ID, Name, Desc, Value.asDouble(), Min, bMin, Max, bMax); break;
316  case PARAMETER_TYPE_Degree : Parameters.Add_Degree (ParentID, ID, Name, Desc, Value.asDouble(), Min, bMin, Max, bMax); break;
317 
318  case PARAMETER_TYPE_Date : Parameters.Add_Date (ParentID, ID, Name, Desc, 0.)->Set_Value(Value); break;
319 
320  case PARAMETER_TYPE_Range : Parameters.Add_Range (ParentID, ID, Name, Desc, Value.BeforeFirst(';').asDouble(), Value.AfterFirst(';').asDouble(), Min, bMin, Max, bMax); break;
322  case PARAMETER_TYPE_Choice : Parameters.Add_Choice (ParentID, ID, Name, Desc, Parameter.Get_Content("choices"))->Set_Value(Value); break;
323  case PARAMETER_TYPE_Choices : Parameters.Add_Choices (ParentID, ID, Name, Desc, Parameter.Get_Content("choices"))->Set_Value(Value); break;
324 
325  case PARAMETER_TYPE_String : Parameters.Add_String (ParentID, ID, Name, Desc, Value, false); break;
326  case PARAMETER_TYPE_Text : Parameters.Add_String (ParentID, ID, Name, Desc, Value, true); break;
327 
328  case PARAMETER_TYPE_FilePath : Parameters.Add_FilePath (ParentID, ID, Name, Desc, Parameter.Get_Content("filter"), Value,
329  IS_TRUE_PROPERTY(Parameter, "save" ),
330  IS_TRUE_PROPERTY(Parameter, "directory"),
331  IS_TRUE_PROPERTY(Parameter, "multiple" )
332  ); break;
333 
334  case PARAMETER_TYPE_Font : break;
335  case PARAMETER_TYPE_Color : Parameters.Add_Color (ParentID, ID, Name, Desc, Value.asInt()); break;
336  case PARAMETER_TYPE_Colors : Parameters.Add_Colors (ParentID, ID, Name, Desc); break;
337  case PARAMETER_TYPE_FixedTable : Parameters.Add_FixedTable (ParentID, ID, Name, Desc)->Serialize(*Parameter("option"), false); break;
338 
339  case PARAMETER_TYPE_Grid_System : Parameters.Add_Grid_System (ParentID, ID, Name, Desc); break;
340 
341  case PARAMETER_TYPE_Table_Field : Parameters.Add_Table_Field (ParentID, ID, Name, Desc, (!Value.CmpNoCase("true") || !Value.CmpNoCase("1"))); break;
342  case PARAMETER_TYPE_Table_Fields : Parameters.Add_Table_Fields (ParentID, ID, Name, Desc); break;
343 
344  case PARAMETER_TYPE_Grid : Parameter.Cmp_Property("target", "none")
345  ? Parameters.Add_Grid_Output ( "", ID, Name, Desc)
346  : Parameters.Add_Grid (ParentID, ID, Name, Desc, Constraint); break;
347 
348  case PARAMETER_TYPE_Grids : Parameter.Cmp_Property("target", "none")
349  ? Parameters.Add_Grids_Output ( "", ID, Name, Desc)
350  : Parameters.Add_Grids (ParentID, ID, Name, Desc, Constraint); break;
351 
352  case PARAMETER_TYPE_Table : Parameters.Add_Table (ParentID, ID, Name, Desc, Constraint); break;
353 
354  case PARAMETER_TYPE_Shapes : Parameters.Add_Shapes (ParentID, ID, Name, Desc, Constraint,
355  Parameter.Cmp_Property("feature_type", "point" ) ? SHAPE_TYPE_Point :
356  Parameter.Cmp_Property("feature_type", "points" ) ? SHAPE_TYPE_Points :
357  Parameter.Cmp_Property("feature_type", "line" ) ? SHAPE_TYPE_Line :
358  Parameter.Cmp_Property("feature_type", "polygon") ? SHAPE_TYPE_Polygon : SHAPE_TYPE_Undefined
359  ); break;
360 
361  case PARAMETER_TYPE_TIN : Parameters.Add_TIN (ParentID, ID, Name, Desc, Constraint); break;
362  case PARAMETER_TYPE_PointCloud : Parameters.Add_PointCloud (ParentID, ID, Name, Desc, Constraint); break;
363 
364  case PARAMETER_TYPE_Grid_List : Parameters.Add_Grid_List (ParentID, ID, Name, Desc, Constraint, !IS_TRUE_PROPERTY(Parameter, "no_system")); break;
365  case PARAMETER_TYPE_Grids_List : Parameters.Add_Grids_List (ParentID, ID, Name, Desc, Constraint, !IS_TRUE_PROPERTY(Parameter, "no_system")); break;
366  case PARAMETER_TYPE_Table_List : Parameters.Add_Table_List (ParentID, ID, Name, Desc, Constraint); break;
367  case PARAMETER_TYPE_Shapes_List : Parameters.Add_Shapes_List (ParentID, ID, Name, Desc, Constraint); break;
368  case PARAMETER_TYPE_TIN_List : Parameters.Add_TIN_List (ParentID, ID, Name, Desc, Constraint); break;
369  case PARAMETER_TYPE_PointCloud_List : Parameters.Add_PointCloud_List(ParentID, ID, Name, Desc, Constraint); break;
370 
372  case PARAMETER_TYPE_Parameters : break; // to do ?
373 
374  default: break;
375  }
376  }
377 
378  //-----------------------------------------------------
379  return( is_Okay() );
380 }
381 
382 
384 // //
386 
387 //---------------------------------------------------------
389 {
390  return( !m_Chain("CRS_SYNC") || IS_TRUE_STRING(m_Chain["CRS_SYNC"].Get_Content()) );
391 }
392 
393 //---------------------------------------------------------
394 void CSG_Tool_Chain::Add_References(void)
395 {
396  for(int i=0; i<m_Chain.Get_Children_Count(); i++)
397  {
398  if( !m_Chain[i].Get_Name().CmpNoCase("REFERENCE") )
399  {
400  CSG_String Authors, Year, Title, Where, Link, Link_Text, DOI;
401 
402  if( m_Chain[i]("AUTHORS" ) ) Authors = m_Chain[i].Get_Content("AUTHORS" );
403  if( m_Chain[i]("YEAR" ) ) Year = m_Chain[i].Get_Content("YEAR" );
404  if( m_Chain[i]("TITLE" ) ) Title = m_Chain[i].Get_Content("TITLE" );
405  if( m_Chain[i]("WHERE" ) ) Where = m_Chain[i].Get_Content("WHERE" );
406  if( m_Chain[i]("LINK" ) ) Link = m_Chain[i].Get_Content("LINK" );
407  if( m_Chain[i]("LINK_TEXT") ) Link_Text = m_Chain[i].Get_Content("LINK_TEXT");
408  if( m_Chain[i]("DOI" ) ) DOI = m_Chain[i].Get_Content("DOI" );
409 
410  if( !DOI.is_Empty() )
411  {
412  Link = "https://doi.org/" + DOI; Link_Text = "doi:" + DOI;
413  }
414 
415  if( !Authors.is_Empty() && !Year.is_Empty() && !Title.is_Empty() )
416  {
417  Add_Reference(Authors, Year, Title, Where, Link.c_str(), Link_Text.c_str());
418  }
419  else if( !Link.is_Empty() )
420  {
421  Add_Reference(Link, Link_Text.c_str());
422  }
423  }
424  }
425 }
426 
427 
429 // //
431 
432 //---------------------------------------------------------
434 {
435  for(int iParameter=0; iParameter<m_Conditions.Get_Children_Count(); iParameter++)
436  {
437  const CSG_MetaData &Conditions = m_Conditions[iParameter];
438 
439  if( (*pParameters)(Conditions.Get_Name()) )
440  {
441  bool bEnable = true;
442 
443  for(int iCondition=0; bEnable && iCondition<Conditions.Get_Children_Count(); iCondition++)
444  {
445  bEnable = Check_Condition(Conditions[iCondition], pParameters);
446  }
447 
448  (*pParameters)(Conditions.Get_Name())->Set_Enabled(bEnable);
449  }
450  }
451 
452  return( CSG_Tool::On_Parameters_Enable(pParameters, pParameter) );
453 }
454 
455 
457 // //
459 
460 //---------------------------------------------------------
462 {
463  bool bResult = Data_Initialize();
464 
465  if( !bResult )
466  {
467  Error_Set(_TL("no data objects"));
468  }
469 
470  for(int i=0; bResult && i<m_Chain["tools"].Get_Children_Count(); i++)
471  {
472  bResult = Tool_Run(m_Chain["tools"][i]);
473  }
474 
475  Data_Finalize();
476 
477  return( bResult );
478 }
479 
480 
482 // //
484 
485 //---------------------------------------------------------
486 bool CSG_Tool_Chain::Data_Add(const CSG_String &ID, CSG_Parameter *pData)
487 {
488  if( !pData )
489  {
490  return( false );
491  }
492 
493  CSG_Parameter *pParameter = m_Data(ID); // check if the local data manager already has a parameter with this identifier
494 
495  if( pParameter ) // it has, so don't add twice!
496  {
497  if( pParameter->is_Input() && pParameter->Get_Type() != pData->Get_Type() ) // don't allow to change parameter's data object type!
498  {
499  Error_Fmt("%s\n[%s] %s <> %s", _TL("Tool chain uses same variable name for different data object types."),
500  ID.c_str(), pParameter->Get_Type_Identifier().c_str(), pData->Get_Type_Identifier().c_str()
501  );
502 
503  return( false );
504  }
505  }
506 
507  //-----------------------------------------------------
508  else switch( pData->Get_Type() )
509  {
510  case PARAMETER_TYPE_PointCloud : pParameter = m_Data.Add_PointCloud ("", ID, "", "", 0 ); break;
511  case PARAMETER_TYPE_Grid : pParameter = m_Data.Add_Grid ("", ID, "", "", 0 ); break;
512  case PARAMETER_TYPE_Grids : pParameter = m_Data.Add_Grids ("", ID, "", "", 0 ); break;
513  case PARAMETER_TYPE_Table : pParameter = m_Data.Add_Table ("", ID, "", "", 0 ); break;
514  case PARAMETER_TYPE_Shapes : pParameter = m_Data.Add_Shapes ("", ID, "", "", 0 ); break;
515  case PARAMETER_TYPE_TIN : pParameter = m_Data.Add_TIN ("", ID, "", "", 0 ); break;
516 
517  case PARAMETER_TYPE_PointCloud_List: pParameter = m_Data.Add_PointCloud_List("", ID, "", "", 0 ); break;
518  case PARAMETER_TYPE_Grid_List : pParameter = m_Data.Add_Grid_List ("", ID, "", "", 0, false); break;
519  case PARAMETER_TYPE_Grids_List : pParameter = m_Data.Add_Grids_List ("", ID, "", "", 0, false); break;
520  case PARAMETER_TYPE_Table_List : pParameter = m_Data.Add_Table_List ("", ID, "", "", 0 ); break;
521  case PARAMETER_TYPE_Shapes_List : pParameter = m_Data.Add_Shapes_List ("", ID, "", "", 0 ); break;
522  case PARAMETER_TYPE_TIN_List : pParameter = m_Data.Add_TIN_List ("", ID, "", "", 0 ); break;
523 
525  switch( pData->Get_DataObject_Type() )
526  {
527  case SG_DATAOBJECT_TYPE_PointCloud: pParameter = m_Data.Add_PointCloud ("", ID, "", "", 0 ); break;
528  case SG_DATAOBJECT_TYPE_Grid : pParameter = m_Data.Add_Grid ("", ID, "", "", 0 ); break;
529  case SG_DATAOBJECT_TYPE_Grids : pParameter = m_Data.Add_Grids ("", ID, "", "", 0 ); break;
530  case SG_DATAOBJECT_TYPE_Table : pParameter = m_Data.Add_Table ("", ID, "", "", 0 ); break;
531  case SG_DATAOBJECT_TYPE_Shapes : pParameter = m_Data.Add_Shapes ("", ID, "", "", 0 ); break;
532  case SG_DATAOBJECT_TYPE_TIN : pParameter = m_Data.Add_TIN ("", ID, "", "", 0 ); break;
533  default:
534  return( true );
535  }
536  break;
537 
538  default:
539  return( true );
540  }
541 
542  //-----------------------------------------------------
543  if( pData->is_DataObject() )
544  {
545  if( pParameter->is_DataObject() )
546  {
547  pParameter->Set_Value(pData->asDataObject());
548  }
549  else
550  {
551  pParameter->asList()->Add_Item(pData->asDataObject());
552  }
553 
554  m_Data_Manager.Add(pData->asDataObject());
555  }
556  else if( pData->is_DataObject_List() && pParameter->is_DataObject_List() )
557  {
558  for(int i=0; i<Get_List_Count(pData); i++)
559  {
560  pParameter->asList()->Add_Item(Get_List_Item(pData, i));
561  m_Data_Manager.Add (Get_List_Item(pData, i));
562  }
563  }
564 
565  return( true );
566 }
567 
568 //---------------------------------------------------------
569 bool CSG_Tool_Chain::Data_Add_TempList(const CSG_String &ID, const CSG_String &Type)
570 {
571  if( !m_Data(ID) )
572  {
573  switch( SG_Parameter_Type_Get_Type(Type) )
574  {
575  case PARAMETER_TYPE_PointCloud_List: m_Data.Add_PointCloud_List("", ID, "", "", 0 ); break;
576  case PARAMETER_TYPE_Grid_List : m_Data.Add_Grid_List ("", ID, "", "", 0, false); break;
577  case PARAMETER_TYPE_Grids_List : m_Data.Add_Grids_List ("", ID, "", "", 0, false); break;
578  case PARAMETER_TYPE_Table_List : m_Data.Add_Table_List ("", ID, "", "", 0 ); break;
579  case PARAMETER_TYPE_Shapes_List : m_Data.Add_Shapes_List ("", ID, "", "", 0 ); break;
580  case PARAMETER_TYPE_TIN_List : m_Data.Add_TIN_List ("", ID, "", "", 0 ); break;
581 
582  default:
583  Error_Fmt("%s: %s [%s|%s]", SG_T("datalist"), _TL("unsupported data list type"), ID.c_str(), Type.c_str());
584 
585  return( false );
586  }
587  }
588 
589  return( true );
590 }
591 
592 //---------------------------------------------------------
593 bool CSG_Tool_Chain::Data_Del_Temp(const CSG_String &ID, bool bData)
594 {
595  CSG_Parameter *pData = m_Data(ID);
596 
597  if( pData )
598  {
599  if( bData )
600  {
601  if( pData->is_DataObject() )
602  {
603  m_Data_Manager.Delete(pData->asDataObject());
604  }
605  else if( pData->is_DataObject_List() )
606  {
607  for(int i=0; i<Get_List_Count(pData); i++)
608  {
609  m_Data_Manager.Delete(Get_List_Item(pData, i));
610  }
611  }
612  }
613 
614  m_Data.Del_Parameter(ID);
615  }
616 
617  return( true );
618 }
619 
620 //---------------------------------------------------------
621 bool CSG_Tool_Chain::Data_Update(const CSG_String &ID, bool bShow)
622 {
623  CSG_Parameter *pData = m_Data(ID);
624 
625  if( pData && pData->asDataObject() && pData->asDataObject()->is_Valid() )
626  {
628  }
629 
630  return( true );
631 }
632 
633 
635 // //
637 
638 //---------------------------------------------------------
639 bool CSG_Tool_Chain::Data_Exists(CSG_Data_Object *pData)
640 {
641  for(int i=0; i<m_Data.Get_Count(); i++)
642  {
643  if( m_Data(i)->is_DataObject() )
644  {
645  if( pData == m_Data(i)->asDataObject() )
646  {
647  return( true );
648  }
649  }
650  else if( m_Data(i)->is_DataObject_List() )
651  {
652  for(int j=0; j<Get_List_Count(m_Data(i)); j++)
653  {
654  if( pData == Get_List_Item(m_Data(i), j) )
655  {
656  return( true );
657  }
658  }
659  }
660  }
661 
662  return( false );
663 }
664 
665 //---------------------------------------------------------
666 bool CSG_Tool_Chain::Data_Initialize(void)
667 {
668  m_Data.Set_Manager(NULL);
669 
670  for(int i=0; i<Parameters.Get_Count(); i++)
671  {
672  CSG_Parameter &P = Parameters[i];
673 
674  if( !(P.is_DataObject() && !P.asDataObject()) )
675  {
676  if( !Data_Add(P.Get_Identifier(), &P) )
677  {
678  return( false );
679  }
680  }
681  }
682 
683  return( true );
684 }
685 
686 //---------------------------------------------------------
687 bool CSG_Tool_Chain::Data_Finalize(void)
688 {
689  for(int i=0; i<Parameters.Get_Count(); i++) // detach non temporary data before freeing the local data manager !!!
690  {
691  CSG_Parameter &P = Parameters[i];
692 
693  if( P.is_DataObject() )
694  {
695  if( m_Data(P.Get_Identifier()) )
696  {
697  if( P.Get_Type() == PARAMETER_TYPE_DataObject_Output || (P.is_Output() && !P.is_Optional()) )
698  {
699  P.Set_Value(m_Data(P.Get_Identifier())->asDataObject());
700  }
701  }
702 
703  m_Data_Manager.Delete(P.asDataObject(), true);
704  }
705  else if( P.is_DataObject_List() )
706  {
707  if( P.is_Output() && m_Data(P.Get_Identifier()) ) // output lists cannot be up-to-date yet
708  {
709  CSG_Parameter *pData = m_Data(P.Get_Identifier());
710 
711  for(int j=0; j<Get_List_Count(pData); j++) // csg_parameter::assign() will not work, if parameters data manager is the standard data manager because it checks for existing data sets
712  {
713  P.asList()->Add_Item(Get_List_Item(pData, j));
714  }
715  }
716 
717  for(int j=0; j<Get_List_Count(Parameters(i)); j++)
718  {
719  m_Data_Manager.Delete(Get_List_Item(Parameters(i), j), true);
720  }
721  }
722  }
723 
724  m_Data_Manager.Delete();
725 
726  m_Data.Destroy();
727 
728  //-----------------------------------------------------
729  for(int i=0; i<m_Chain["parameters"].Get_Children_Count(); i++)
730  {
731  const CSG_MetaData &Parameter = m_Chain["parameters"][i];
732 
733  if( Parameter.Cmp_Name("output") )
734  {
735  CSG_Parameter *pParameter = Parameters(Parameter.Get_Property("varname"));
736 
737  if( pParameter && pParameter->is_DataObject() && pParameter->asDataObject() && pParameter->asDataObject() != DATAOBJECT_CREATE )
738  {
739  if( Parameter("colours") )
740  {
741  DataObject_Set_Colors(pParameter->asDataObject(), 11,
742  Parameter["colours"].Get_Content().asInt(), IS_TRUE_PROPERTY(Parameter["colours"], "revert")
743  );
744  }
745 
746  if( Parameter("output_name") )
747  {
748  if( IS_TRUE_PROPERTY(Parameter["output_name"], "input") )
749  {
750  CSG_Parameter *pInput = Parameters(Parameter["output_name"].Get_Content());
751 
752  if( pInput && pInput->is_DataObject() && pInput->asDataObject() )
753  {
754  CSG_String Suffix;
755 
756  if( Parameter["output_name"].Get_Property("suffix", Suffix) && !Suffix.is_Empty() )
757  {
758  Suffix = " [" + Suffix + "]";
759  }
760 
761  pParameter->asDataObject()->Set_Name(pInput->asDataObject()->Get_Name() + Suffix);
762  }
763  }
764  else if( !Parameter["output_name"].Get_Content().is_Empty() )
765  {
766  pParameter->asDataObject()->Set_Name(Parameter["output_name"].Get_Content());
767  }
768  }
769  }
770  }
771  }
772 
773  //-----------------------------------------------------
774  return( true );
775 }
776 
777 
779 // //
781 
782 //---------------------------------------------------------
783 bool CSG_Tool_Chain::Parameter_isCompatible(TSG_Parameter_Type A, TSG_Parameter_Type B)
784 {
785  if( A == B )
786  {
787  return( true );
788  }
789 
790  switch( A )
791  {
792  default:
793  return( false );
794 
796  return( B == PARAMETER_TYPE_Shapes
798  || B == PARAMETER_TYPE_TIN );
799 
801  return( B == PARAMETER_TYPE_PointCloud );
802  }
803 }
804 
805 
807 // //
809 
810 //---------------------------------------------------------
811 bool CSG_Tool_Chain::Message(const CSG_MetaData &Message)
812 {
813  if( Message.Cmp_Name("message") )
814  {
815  if( IS_TRUE_PROPERTY(Message, "dialog") )
816  {
817  Message_Dlg(Message.Get_Content());
818  }
819 
820  Message_Fmt("\n%s", Message.Get_Content().c_str());
821  }
822 
823  return( true );
824 }
825 
826 
828 // //
830 
831 //---------------------------------------------------------
832 bool CSG_Tool_Chain::Check_Condition(const CSG_MetaData &Condition, CSG_Parameters *pData)
833 {
834  CSG_String Type;
835 
836  if( !Condition.Cmp_Name("condition") || !Condition.Get_Property("type", Type) )
837  {
838  return( true );
839  }
840 
841  //-----------------------------------------------------
842  CSG_String Variable;
843 
844  if( !Condition.Get_Property("varname", Variable) && !Condition.Get_Property("variable", Variable) )
845  {
846  Variable = Condition.Get_Content();
847  }
848 
849  //-----------------------------------------------------
850  if( !Type.CmpNoCase("has_gui" ) ) // executed from saga_gui ? (tool might offer different parameters if called from saga_cmd, python etc.)
851  {
852  return( IS_TRUE_STRING(Variable) ? has_GUI() != false : has_GUI() == false );
853  }
854 
855  //-----------------------------------------------------
856  if( !Type.CmpNoCase("exists" ) ) // data object exists
857  {
858  CSG_Parameter *pParameter = (*pData)(Variable);
859 
860  return( pParameter && ((pParameter->is_DataObject() && pParameter->asDataObject()) || (pParameter->is_DataObject_List() && pParameter->asList()->Get_Item_Count())) );
861  }
862 
863  if( !Type.CmpNoCase("not_exists") ) // data object does not exist
864  {
865  return( (*pData)(Variable) == NULL || (*pData)(Variable)->asDataObject() == NULL );
866  }
867 
868  //-----------------------------------------------------
869  CSG_Parameter *pOption = (*pData)(Variable);
870 
871  if( pOption == NULL )
872  {
873  return( true );
874  }
875 
876  switch( pOption->Get_Type() )
877  {
878  //-----------------------------------------------------
879  case PARAMETER_TYPE_Bool :
880  {
881  CSG_String Value;
882 
883  if( Condition.Get_Property("value", Value) )
884  {
885  if( !Type.CmpNoCase("=") || !Type.CmpNoCase("equal" ) ) { return( (IS_TRUE_STRING(Value) ? pOption->asBool() : !pOption->asBool()) ); }
886  else if( !Type.CmpNoCase("!") || !Type.CmpNoCase("not_equal") ) { return( (IS_TRUE_STRING(Value) ? !pOption->asBool() : pOption->asBool()) ); }
887  }
888  }
889  break;
890 
891  //-----------------------------------------------------
892  case PARAMETER_TYPE_Int :
893  case PARAMETER_TYPE_Color :
895  case PARAMETER_TYPE_Choice :
896  {
897  int Value;
898 
899  if( Condition.Get_Property("value", Value) )
900  {
901  if( !Type.CmpNoCase("=") || !Type.CmpNoCase("equal" ) ) { if( Value != pOption->asInt() ) { return( false ); } }
902  else if( !Type.CmpNoCase("!") || !Type.CmpNoCase("not_equal") ) { if( Value == pOption->asInt() ) { return( false ); } }
903  else if( !Type.CmpNoCase("<") || !Type.CmpNoCase("less" ) ) { if( Value >= pOption->asInt() ) { return( false ); } }
904  else if( !Type.CmpNoCase(">") || !Type.CmpNoCase("greater" ) ) { if( Value <= pOption->asInt() ) { return( false ); } }
905  }
906  }
907  break;
908 
909  //-----------------------------------------------------
910  case PARAMETER_TYPE_Double :
911  case PARAMETER_TYPE_Degree :
912  {
913  double Value;
914 
915  if( Condition.Get_Property("value", Value) )
916  {
917  if( !Type.CmpNoCase("=") || !Type.CmpNoCase("equal" ) ) { if( Value != pOption->asDouble() ) { return( false ); } }
918  else if( !Type.CmpNoCase("!") || !Type.CmpNoCase("not_equal") ) { if( Value == pOption->asDouble() ) { return( false ); } }
919  else if( !Type.CmpNoCase("<") || !Type.CmpNoCase("less" ) ) { if( Value >= pOption->asDouble() ) { return( false ); } }
920  else if( !Type.CmpNoCase(">") || !Type.CmpNoCase("greater" ) ) { if( Value <= pOption->asDouble() ) { return( false ); } }
921  }
922  }
923  break;
924 
925  //-----------------------------------------------------
926  case PARAMETER_TYPE_String :
927  case PARAMETER_TYPE_Text :
929  {
930  CSG_String Value;
931 
932  Condition.Get_Property("value", Value); // no 'if', bcos empty string would return false !!
933 
934  {
935  if( !Type.CmpNoCase("=") || !Type.CmpNoCase("equal" ) ) { if( Value.Cmp(pOption->asString()) != 0 ) { return( false ); } }
936  else if( !Type.CmpNoCase("!") || !Type.CmpNoCase("not_equal") ) { if( Value.Cmp(pOption->asString()) == 0 ) { return( false ); } }
937  else if( !Type.CmpNoCase("<") || !Type.CmpNoCase("less" ) ) { if( Value.Cmp(pOption->asString()) >= 0 ) { return( false ); } }
938  else if( !Type.CmpNoCase(">") || !Type.CmpNoCase("greater" ) ) { if( Value.Cmp(pOption->asString()) <= 0 ) { return( false ); } }
939  }
940  }
941  break;
942 
943  //-----------------------------------------------------
945  {
946  CSG_String Value;
947 
948  if( Condition.Get_Property("value", Value) )
949  {
950  bool bValid = pOption->asGrid_System()->is_Valid();
951 
952  if( !Type.CmpNoCase("=") || !Type.CmpNoCase("equal" ) ) { return( (IS_TRUE_STRING(Value) ? bValid : !bValid) ); }
953  else if( !Type.CmpNoCase("!") || !Type.CmpNoCase("not_equal") ) { return( (IS_TRUE_STRING(Value) ? !bValid : bValid) ); }
954  }
955  }
956  break;
957 
958  //-----------------------------------------------------
959  default:
960  // nop
961  break;
962  }
963 
964  return( true );
965 }
966 
967 
969 // //
971 
972 //---------------------------------------------------------
973 bool CSG_Tool_Chain::ForEach(const CSG_MetaData &Commands)
974 {
975  for(int i=0; i<Commands.Get_Children_Count(); i++) // add internal target lists, if any..
976  {
977  if( Commands[i].Cmp_Name("output") || Commands[i].Cmp_Name("datalist") )
978  {
979  Data_Add_TempList(Commands[i].Get_Content(), Commands[i].Get_Property("type"));
980  }
981  }
982 
983  //-----------------------------------------------------
984  bool bIgnoreErrors = IS_TRUE_PROPERTY(Commands, "ignore_errors");
985 
986  CSG_String VarName;
987 
988  if( Commands.Get_Property("varname", VarName) )
989  {
990  return( ForEach_Iterator(Commands, VarName, bIgnoreErrors) );
991  }
992 
993  if( Commands.Get_Property("input", VarName) )
994  {
995  return( ForEach_Object (Commands, VarName, bIgnoreErrors)
996  || ForEach_File (Commands, VarName, bIgnoreErrors) );
997  }
998 
999  Error_Set("foreach statement misses iterator or input list definition");
1000 
1001  return( false );
1002 }
1003 
1004 //---------------------------------------------------------
1005 bool CSG_Tool_Chain::ForEach_Iterator(const CSG_MetaData &Commands, const CSG_String &VarName, bool bIgnoreErrors)
1006 {
1007  CSG_Parameter *pIterator = Parameters(VarName);
1008 
1009  if( pIterator )
1010  {
1011  Error_Set("foreach statement iterator variable name is already in use");
1012 
1013  return( false );
1014  }
1015 
1016  //-----------------------------------------------------
1017  CSG_String s;
1018 
1019  double begin = Commands.Get_Property("begin", s) ? (Parameters(s) ? Parameters[s].asDouble() : s.asDouble()) : 0.;
1020  double end = Commands.Get_Property("end" , s) ? (Parameters(s) ? Parameters[s].asDouble() : s.asDouble()) : 0.;
1021 
1022  if( begin >= end )
1023  {
1024  Error_Set("foreach iterator statement with invalid range (define begin < end)");
1025 
1026  return( false );
1027  }
1028 
1029  double step = 1.;
1030 
1031  if( Commands.Get_Property("steps", s) )
1032  {
1033  double steps = Parameters(s) ? Parameters[s].asDouble() : s.asDouble();
1034 
1035  if( steps > 0 )
1036  {
1037  step = (end - begin) / steps;
1038  }
1039  }
1040  else if( Commands.Get_Property("step", s) )
1041  {
1042  step = Parameters(s) ? Parameters[s].asDouble() : s.asDouble();
1043  }
1044 
1045  if( step <= 0. )
1046  {
1047  Error_Set("foreach iterator statement with invalid step size (define step > 0 or steps > 0)");
1048 
1049  return( false );
1050  }
1051 
1052  Message_Fmt("\nfor i = %f to %f step %f (%d steps)", begin, end, step, (int)((end - begin) / step));
1053 
1054  //-----------------------------------------------------
1055  bool bResult = true;
1056 
1057  pIterator = Parameters.Add_Double("", VarName, "Iterator", "");
1058 
1059  for(double i=begin; bResult && i<=end; i+=step)
1060  {
1061  Message_Fmt("\nfor step: %f", i);
1062 
1063  pIterator->Set_Value(i);
1064 
1065  for(int iTool=0; bResult && iTool<Commands.Get_Children_Count(); iTool++)
1066  {
1067  const CSG_MetaData &Tool = Commands[iTool];
1068 
1069  if( Tool.Cmp_Name("tool") )
1070  {
1071  bResult = Tool_Run(Tool, bIgnoreErrors);
1072 
1073  if( !bResult && bIgnoreErrors )
1074  {
1075  bResult = true;
1076  }
1077  }
1078  }
1079  }
1080 
1081  Parameters.Del_Parameter(VarName);
1082 
1083  return( bResult );
1084 }
1085 
1086 //---------------------------------------------------------
1087 bool CSG_Tool_Chain::ForEach_Object(const CSG_MetaData &Commands, const CSG_String &ListVarName, bool bIgnoreErrors)
1088 {
1089  CSG_Parameter *pList = m_Data(ListVarName);
1090 
1091  if( !pList )
1092  {
1093  return( false );
1094  }
1095 
1096  //-----------------------------------------------------
1097  bool bResult = true;
1098 
1099  if( pList->is_DataObject_List() )
1100  {
1101  for(int iObject=0; bResult && iObject<Get_List_Count(pList->asList()); iObject++)
1102  {
1103  for(int iTool=0; bResult && iTool<Commands.Get_Children_Count(); iTool++)
1104  {
1105  const CSG_MetaData &Tool = Commands[iTool];
1106 
1107  if( Tool.Cmp_Name("tool") )
1108  {
1109  for(int j=0; j<Tool.Get_Children_Count(); j++)
1110  {
1111  if( Tool[j].Cmp_Name("input") && Tool[j].Get_Content().Find(ListVarName) == 0 )
1112  {
1113  Tool(j)->Set_Content(ListVarName + CSG_String::Format("[%d]", iObject));
1114  }
1115  }
1116  }
1117 
1118  bResult = Tool_Run(Tool, bIgnoreErrors);
1119  }
1120 
1121  if( !bResult && bIgnoreErrors )
1122  {
1123  bResult = true;
1124  }
1125  }
1126  }
1127 
1128  //-----------------------------------------------------
1129  else if( pList->Get_Type() == PARAMETER_TYPE_Grids )
1130  {
1131  for(int iObject=0; bResult && iObject<pList->asGrids()->Get_Grid_Count(); iObject++)
1132  {
1133  for(int iTool=0; bResult && iTool<Commands.Get_Children_Count(); iTool++)
1134  {
1135  const CSG_MetaData &Tool = Commands[iTool];
1136 
1137  if( Tool.Cmp_Name("tool") )
1138  {
1139  for(int j=0; j<Tool.Get_Children_Count(); j++)
1140  {
1141  if( Tool[j].Cmp_Name("input") && Tool[j].Get_Content().Find(ListVarName) == 0 )
1142  {
1143  Tool(j)->Set_Content(ListVarName + CSG_String::Format("[%d]", iObject));
1144  }
1145  }
1146  }
1147 
1148  bResult = Tool_Run(Tool, bIgnoreErrors);
1149  }
1150 
1151  if( !bResult && bIgnoreErrors )
1152  {
1153  bResult = true;
1154  }
1155  }
1156  }
1157 
1158  return( bResult );
1159 }
1160 
1161 //---------------------------------------------------------
1162 bool CSG_Tool_Chain::ForEach_File(const CSG_MetaData &Commands, const CSG_String &ListVarName, bool bIgnoreErrors)
1163 {
1164  CSG_Parameter *pList = Parameters(ListVarName);
1165 
1166  if( !pList || pList->Get_Type() != PARAMETER_TYPE_FilePath )
1167  {
1168  return( false );
1169  }
1170 
1171  CSG_Strings Files;
1172 
1173  pList->asFilePath()->Get_FilePaths(Files);
1174 
1175  //-----------------------------------------------------
1176  bool bResult = true;
1177 
1178  for(int iFile=0; bResult && iFile<Files.Get_Count(); iFile++)
1179  {
1180  for(int iTool=0; bResult && iTool<Commands.Get_Children_Count(); iTool++)
1181  {
1182  const CSG_MetaData &Tool = Commands[iTool];
1183 
1184  if( Tool.Cmp_Name("tool") )
1185  {
1186  CSG_Array_Int Input;
1187 
1188  for(int j=0; j<Tool.Get_Children_Count(); j++)
1189  {
1190  if( Tool[j].Cmp_Name("option") && Tool[j].Get_Content().Find(ListVarName) == 0 && IS_TRUE_PROPERTY(Tool[j], "varname") )
1191  {
1192  Tool(j)->Set_Content(Files[iFile]);
1193  Tool(j)->Set_Property("varname", "false");
1194 
1195  Input += j;
1196  }
1197  }
1198 
1199  bResult = Tool_Run(Tool, bIgnoreErrors);
1200 
1201  for(size_t i=0; i<Input.Get_uSize(); i++)
1202  {
1203  Tool(Input[i])->Set_Content(ListVarName);
1204  Tool(Input[i])->Set_Property("varname", "true");
1205  }
1206  }
1207  else
1208  {
1209  bResult = Tool_Run(Tool, bIgnoreErrors);
1210  }
1211 
1212  if( !bResult && bIgnoreErrors )
1213  {
1214  bResult = true;
1215  }
1216  }
1217  }
1218 
1219  return( bResult );
1220 }
1221 
1222 
1224 // //
1226 
1227 //---------------------------------------------------------
1228 bool CSG_Tool_Chain::Tool_Run(const CSG_MetaData &Tool, bool bShowError)
1229 {
1230  if( Tool.Cmp_Name("message") )
1231  {
1232  Message(Tool);
1233 
1234  return( true );
1235  }
1236 
1237  //-----------------------------------------------------
1238  if( Tool.Cmp_Name("comment") )
1239  {
1240  return( true );
1241  }
1242 
1243  //-----------------------------------------------------
1244  if( Tool.Cmp_Name("datalist") )
1245  {
1246  return( Data_Add_TempList(Tool.Get_Content(), Tool.Get_Property("type")) );
1247  }
1248 
1249  if( Tool.Cmp_Name("delete") )
1250  {
1251  return( Data_Del_Temp(Tool.Get_Content(), IS_TRUE_PROPERTY(Tool, "data")) );
1252  }
1253 
1254  if( Tool.Cmp_Name("update") )
1255  {
1256  return( Data_Update(Tool.Get_Content(), IS_TRUE_PROPERTY(Tool, "show")) );
1257  }
1258 
1259  //-----------------------------------------------------
1260  if( Tool.Cmp_Name("condition") )
1261  {
1262  const CSG_MetaData *pTools = (!Check_Condition(Tool, &m_Data) || !Check_Condition(Tool, &Parameters))
1263  ? Tool("else") : (Tool("if") ? Tool("if") : &Tool);
1264 
1265  for(int i=0; pTools && i<pTools->Get_Children_Count(); i++)
1266  {
1267  if( !Tool_Run((*pTools)[i]) )
1268  {
1269  return( false );
1270  }
1271  }
1272 
1273  return( true );
1274  }
1275 
1276  //-----------------------------------------------------
1277  if( Tool.Cmp_Name("foreach") )
1278  {
1279  return( ForEach(Tool) );
1280  }
1281 
1282  //-----------------------------------------------------
1283  if( !Tool.Cmp_Name("tool") )
1284  {
1285  return( true ); // only proceed, if it is tagged as tool...
1286  }
1287 
1288  if( !Tool.Get_Property("library") || !(Tool.Get_Property("tool") || Tool.Get_Property("module")) )
1289  {
1290  if( bShowError ) Error_Set(_TL("invalid tool definition"));
1291 
1292  return( false );
1293  }
1294 
1295  //-----------------------------------------------------
1296  const SG_Char *Name = Tool.Get_Property("tool") ? Tool.Get_Property("tool") : Tool.Get_Property("module");
1297 
1298  CSG_Tool *pTool = SG_Get_Tool_Library_Manager().Create_Tool(Tool.Get_Property("library"), Name,
1299  IS_TRUE_PROPERTY(Tool, "with_gui") // this option allows to run a tool in 'gui-mode', e.g. to popup variogram dialogs for kriging interpolation
1300  );
1301 
1302  if( !pTool )
1303  {
1304  if( bShowError ) Error_Fmt("%s [%s].[%s]", _TL("could not find tool"), Tool.Get_Property("library"), Name);
1305 
1306  return( false );
1307  }
1308 
1309  //-----------------------------------------------------
1310  Process_Set_Text(pTool->Get_Name());
1311 
1312  pTool->Settings_Push(&m_Data_Manager);
1313 
1314  bool bResult = false;
1315 
1316  if( !pTool->On_Before_Execution() )
1317  {
1318  if( bShowError ) Error_Fmt("%s [%s].[%s]", _TL("before tool execution check failed"), pTool->Get_Library().c_str(), pTool->Get_Name().c_str());
1319  }
1320  else if( !Tool_Initialize(Tool, pTool) )
1321  {
1322  if( bShowError ) Error_Fmt("%s [%s].[%s]", _TL("tool initialization failed" ), pTool->Get_Library().c_str(), pTool->Get_Name().c_str());
1323  }
1324  else if( !(bResult = pTool->Execute(m_bAddHistory)) )
1325  {
1326  Message_Fmt ("%s [%s].[%s]", _TL("tool execution failed" ), pTool->Get_Library().c_str(), pTool->Get_Name().c_str());
1327  }
1328 
1329  if( bResult )
1330  {
1331  pTool->On_After_Execution();
1332  }
1333 
1334  Tool_Finalize(Tool, pTool);
1335 
1336  pTool->Settings_Pop();
1337 
1339 
1340  return( bResult );
1341 }
1342 
1343 
1345 // //
1347 
1348 //---------------------------------------------------------
1349 bool CSG_Tool_Chain::Tool_Check_Condition(const CSG_MetaData &Tool)
1350 {
1351  if( Tool("condition") )
1352  {
1353  for(int i=0; i<Tool.Get_Children_Count(); i++) // there might be more than one condition to be checked
1354  {
1355  if( !Check_Condition(Tool[i], &m_Data) )
1356  {
1357  return( false );
1358  }
1359  }
1360  }
1361 
1362  return( true );
1363 }
1364 
1365 
1367 // //
1369 
1370 //---------------------------------------------------------
1371 bool CSG_Tool_Chain::Tool_Get_Parameter(CSG_String ID, CSG_Parameters *pParameters, CSG_Parameter **ppParameter, CSG_Parameter **ppOwner)
1372 {
1373  CSG_Parameter *pParameter = (*pParameters)(ID.BeforeFirst('.'));
1374 
1375  if( pParameter )
1376  {
1377  switch( pParameter->Get_Type() )
1378  {
1379  default:
1380  *ppParameter = pParameter;
1381 
1382  return( true );
1383 
1385  *ppOwner = pParameter;
1386 
1387  return( Tool_Get_Parameter(ID.AfterFirst('.'), pParameter->asParameters(), ppParameter, ppOwner) );
1388 
1389  case PARAMETER_TYPE_Range:
1390  if( !ID.AfterFirst('.').CmpNoCase("min") || !ID.AfterFirst('.').CmpNoCase("minimum") )
1391  {
1392  *ppParameter = pParameter->asRange()->Get_Min_Parameter();
1393  *ppOwner = pParameter;
1394  }
1395  else if( !ID.AfterFirst('.').CmpNoCase("max") || !ID.AfterFirst('.').CmpNoCase("maximum") )
1396  {
1397  *ppParameter = pParameter->asRange()->Get_Max_Parameter();
1398  *ppOwner = pParameter;
1399  }
1400  else
1401  {
1402  *ppParameter = pParameter;
1403  }
1404 
1405  return( true );
1406  }
1407  }
1408 
1409  return( false );
1410 }
1411 
1412 //---------------------------------------------------------
1413 bool CSG_Tool_Chain::Tool_Get_Parameter(const CSG_MetaData &Parameter, CSG_Tool *pTool, CSG_Parameter **ppParameter, CSG_Parameter **ppOwner)
1414 {
1415  CSG_String ID(Parameter.Get_Property("parms"));
1416 
1417  if( !ID.is_Empty() )
1418  {
1419  ID += '.';
1420  }
1421 
1422  ID += Parameter.Get_Property("id");
1423 
1424  //-----------------------------------------------------
1425  CSG_Parameter *pOwner; if( !ppOwner ) { ppOwner = &pOwner; } *ppOwner = NULL;
1426 
1427  CSG_Parameters *pParameters = pTool->Get_Parameters(ID.BeforeFirst('.'));
1428 
1429  if( pParameters )
1430  {
1431  ID = ID.AfterFirst('.');
1432  }
1433  else
1434  {
1435  pParameters = pTool->Get_Parameters();
1436  }
1437 
1438  return( Tool_Get_Parameter(ID, pParameters, ppParameter, ppOwner) );
1439 }
1440 
1441 //---------------------------------------------------------
1442 bool CSG_Tool_Chain::Tool_Initialize(const CSG_MetaData &Tool, CSG_Tool *pTool)
1443 {
1444  //-----------------------------------------------------
1445  for(int i=0; i<Tool.Get_Children_Count(); i++) // check for invalid parameters...
1446  {
1447  const CSG_MetaData &Parameter = Tool[i]; if( Parameter.Cmp_Name("comment") ) { continue; }
1448 
1449  if( Parameter.Cmp_Name("message") )
1450  {
1451  Message(Parameter);
1452 
1453  continue;
1454  }
1455 
1456  CSG_Parameter *pParameter, *pOwner;
1457 
1458  if( !Tool_Get_Parameter(Parameter, pTool, &pParameter, &pOwner) )
1459  {
1460  Error_Fmt("%s: %s", _TL("parameter not found"), Parameter.Get_Property("id"));
1461 
1462  return( false );
1463  }
1464  }
1465 
1466  //-----------------------------------------------------
1467  if( Tool.Get_Property("grid_system") )
1468  {
1469  CSG_Parameter *pParameter = Parameters(Tool.Get_Property("grid_system"));
1470 
1471  if( pParameter && pParameter->asGrid_System() )
1472  {
1473  if( !pTool->Set_Grid_System(*pParameter->asGrid_System()) )
1474  {
1475  Message_Fmt("\n%s: %s\n", _TL("Warning"), _TL("failed to set tool's grid system"));
1476  }
1477  }
1478  }
1479 
1480  //-----------------------------------------------------
1481  for(int i=0; i<Tool.Get_Children_Count(); i++) // initialize all options first, some might en-/disable mandatory input data
1482  {
1483  const CSG_MetaData &Parameter = Tool[i]; if( !Parameter.Cmp_Name("option") ) { continue; }
1484 
1485  CSG_Parameter *pParameter, *pOwner; Tool_Get_Parameter(Parameter, pTool, &pParameter, &pOwner);
1486 
1487  if( pParameter->Get_Type() == PARAMETER_TYPE_Grid_System )
1488  {
1489  CSG_Parameter *pData = m_Data(Parameter.Get_Content());
1490 
1491  if( pData && pData->asDataObject() && pData->asDataObject()->asGrid() && pData->asDataObject()->asGrid()->Get_System().is_Valid() )
1492  {
1493  pParameter->asGrid_System()->Create(pData->asDataObject()->asGrid()->Get_System());
1494 
1495  continue;
1496  }
1497  }
1498 
1499  if( IS_TRUE_PROPERTY(Parameter, "varname")
1500  ? pParameter->Set_Value(Parameters(Parameter.Get_Content()))
1501  : pParameter->Set_Value( Parameter.Get_Content() ) )
1502  {
1503  pParameter->has_Changed(); if( pOwner ) { pOwner->has_Changed(); }
1504  }
1505  }
1506 
1507  //-----------------------------------------------------
1508  for(int i=0; i<Tool.Get_Children_Count(); i++) // set data input first
1509  {
1510  const CSG_MetaData &Parameter = Tool[i]; if( !Parameter.Cmp_Name("input") ) { continue; }
1511 
1512  CSG_Parameter *pParameter, *pOwner; Tool_Get_Parameter(Parameter, pTool, &pParameter, &pOwner);
1513 
1514  int Index;
1515 
1516  if( Parameter.Get_Content().Find('[') < 1 || !Parameter.Get_Content().AfterFirst('[').asInt(Index) )
1517  {
1518  Index = -1;
1519  }
1520 
1521  bool bResult = false;
1522 
1523  CSG_Parameter *pData = m_Data(Index < 0 ? Parameter.Get_Content() : Parameter.Get_Content().BeforeFirst('['));
1524 
1525  if( pData && (pParameter->is_DataObject() || pParameter->is_DataObject_List()) )
1526  {
1527  if( Index >= 0 && (pData->is_DataObject_List() || pData->asGrids()) )
1528  {
1529  CSG_Data_Object *pObject = pData->is_DataObject_List()
1530  ? pData->asList ()->Get_Item (Index)
1531  : pData->asGrids()->Get_Grid_Ptr(Index);
1532 
1533  if( pParameter->is_DataObject() )
1534  {
1535  bResult = pParameter->Set_Value(pObject);
1536  }
1537  if( pParameter->is_DataObject_List() )
1538  {
1539  bResult = pParameter->asList()->Add_Item(pObject);
1540  }
1541  }
1542  else if( pParameter->Get_Type() == pData->Get_Type() )
1543  {
1544  if( pParameter->is_DataObject_List() && pParameter->asList()->Get_Item_Count() > 0 )
1545  {
1546  bResult = true;
1547 
1548  for(int i=0; bResult && i<pData->asList()->Get_Item_Count(); i++)
1549  {
1550  bResult = pParameter->asList()->Add_Item(pData->asList()->Get_Item(i));
1551  }
1552  }
1553  else
1554  {
1555  bResult = pParameter->Assign(pData);
1556  }
1557  }
1558  else if( pParameter->is_DataObject_List() && pData->is_DataObject() )
1559  {
1560  bResult = pParameter->asList()->Add_Item(pData->asDataObject());
1561  }
1562  else if( Parameter_isCompatible(pParameter->Get_Type(), pData->Get_Type()) )
1563  {
1564  bResult = pParameter->Set_Value(pData->asDataObject());
1565  }
1566  }
1567 
1568  if( bResult )
1569  {
1570  pParameter->has_Changed(); if( pOwner ) { pOwner->has_Changed(); }
1571  }
1572  else if( pParameter->is_Enabled() )
1573  {
1574  Error_Fmt("%s: %s", _TL("set input"), Parameter.Get_Property("id"));
1575 
1576  return( false );
1577  }
1578  }
1579 
1580  //-----------------------------------------------------
1581  for(int i=0; i<Tool.Get_Children_Count(); i++) // now set all options
1582  {
1583  const CSG_MetaData &Parameter = Tool[i]; if( !Parameter.Cmp_Name("option") ) { continue; }
1584 
1585  CSG_Parameter *pParameter, *pOwner; Tool_Get_Parameter(Parameter, pTool, &pParameter, &pOwner);
1586 
1587  if( IS_TRUE_PROPERTY(Parameter, "varname") )
1588  { // does option want a value from tool chain parameters and do these provide one ?
1589  switch( pParameter->Get_Type() )
1590  {
1591  default:
1592  pParameter->Set_Value(Parameters(Parameter.Get_Content()));
1593  break;
1594 
1596  if( m_Data(Parameter.Get_Content()) && pParameter->asTable()->Assign_Values(m_Data(Parameter.Get_Content())->asTable()) )
1597  {
1598  pParameter->has_Changed();
1599  }
1600  break;
1601  }
1602  }
1603  else
1604  {
1605  switch( pParameter->Get_Type() )
1606  {
1608  if( Parameter("OPTION") )
1609  {
1610  pParameter->Serialize(*Parameter("OPTION"), false);
1611  }
1612  break;
1613 
1614  default: {
1615  CSG_String Value(Parameter.Get_Content());
1616 
1617  if( Value.Find("$(") >= 0 )
1618  {
1619  for(int j=0; j<Parameters.Get_Count(); j++)
1620  {
1621  CSG_String Var; Var.Printf("$(%s)", Parameters(j)->Get_Identifier());
1622 
1623  if( Value.Find(Var) >= 0 )
1624  {
1625  Value.Replace(Var, Parameters(j)->asString());
1626  }
1627  }
1628  }
1629 
1630  pParameter->Set_Value(Value);
1631 
1632  if( pOwner )
1633  {
1634  pOwner->has_Changed();
1635  }
1636 
1637  break; }
1638  }
1639  }
1640  }
1641 
1642  //-----------------------------------------------------
1643  for(int i=0; i<Tool.Get_Children_Count(); i++) // finally set the data output
1644  {
1645  const CSG_MetaData &Parameter = Tool[i]; if( !Parameter.Cmp_Name("output") ) { continue; }
1646 
1647  CSG_Parameter *pParameter, *pOwner; Tool_Get_Parameter(Parameter, pTool, &pParameter, &pOwner);
1648 
1649  if( !pParameter->Assign(m_Data(Parameter.Get_Content())) )
1650  {
1651  if( pParameter->is_DataObject() )
1652  {
1653  pParameter->Set_Value(DATAOBJECT_CREATE);
1654  }
1655  else if( pParameter->is_DataObject_List() )
1656  {
1657  pParameter->asList()->Del_Items();
1658  }
1659  else if( pParameter->asGrids() )
1660  {
1661  pParameter->asGrids()->Del_Grids();
1662  }
1663  }
1664  }
1665 
1666  //-----------------------------------------------------
1667  return( true );
1668 }
1669 
1670 //---------------------------------------------------------
1671 bool CSG_Tool_Chain::Tool_Finalize(const CSG_MetaData &Tool, CSG_Tool *pTool)
1672 {
1673  for(int i=0; i<Tool.Get_Children_Count(); i++) // add all data objects declared as output to variable list
1674  {
1675  const CSG_MetaData &Parameter = Tool[i];
1676 
1677  if( Parameter.Cmp_Name("output") )
1678  {
1679  CSG_String ID (Parameter.Get_Property("id" ));
1680  CSG_String ID_parms(Parameter.Get_Property("parms"));
1681 
1682  CSG_Parameter *pParameter = pTool->Get_Parameters(ID_parms)
1683  ? (*pTool->Get_Parameters(ID_parms))(ID)
1684  : (*pTool->Get_Parameters( ))(ID);
1685 
1686  if( !pParameter || !Data_Add(Parameter.Get_Content(), pParameter) )
1687  {
1688  return( false );
1689  }
1690  }
1691  }
1692 
1693  //-----------------------------------------------------
1694  for(int i=-1; i<pTool->Get_Parameters_Count(); i++) // save memory: free all data objects that have not been added to variable list
1695  {
1696  CSG_Parameters *pParameters = i < 0 ? pTool->Get_Parameters() : pTool->Get_Parameters(i);
1697 
1698  for(int j=0; j<pParameters->Get_Count(); j++)
1699  {
1700  CSG_Parameter *pParameter = (*pParameters)(j);
1701 
1702  if( pParameter->is_Output() )
1703  {
1704  if( pParameter->is_DataObject() )
1705  {
1706  if( !Data_Exists(pParameter->asDataObject()) )
1707  {
1708  m_Data_Manager.Delete(pParameter->asDataObject());
1709  }
1710  }
1711  else if( pParameter->is_DataObject_List() )
1712  {
1713  for(int k=0; k<Get_List_Count(pParameter); k++)
1714  {
1715  if( !Data_Exists(Get_List_Item(pParameter, k)) )
1716  {
1717  m_Data_Manager.Delete(Get_List_Item(pParameter, k));
1718  }
1719  }
1720  }
1721  }
1722  }
1723  }
1724 
1725  //-----------------------------------------------------
1726  return( true );
1727 }
1728 
1729 
1731 // //
1732 // //
1733 // //
1735 
1736 //---------------------------------------------------------
1737 CSG_String CSG_Tool_Chain::Get_Script(CSG_Tool *pTool, bool bHeader, bool bAllParameters)
1738 {
1739  CSG_MetaData Tool; Tool.Set_Name("tool");
1740 
1741  Tool.Add_Property("library", pTool->Get_Library());
1742  Tool.Add_Property("tool" , pTool->Get_ID ());
1743  Tool.Add_Property("name" , pTool->Get_Name ());
1744 
1745  _Get_Script_Tool(Tool, pTool->Get_Parameters(), bAllParameters, "", bHeader);
1746 
1747  for(int i=0; i<pTool->Get_Parameters_Count(); i++)
1748  {
1749  _Get_Script_Tool(Tool, pTool->Get_Parameters(i), bAllParameters, pTool->Get_Parameters(i)->Get_Identifier() + '.', bHeader);
1750  }
1751 
1752  if( !bHeader )
1753  {
1754  return( Tool.asText(1) );
1755  }
1756 
1757  //-----------------------------------------------------
1759 
1760  _Get_Script_Parameters(Parameters, pTool->Get_Parameters(), "");
1761 
1762  for(int i=0; i<pTool->Get_Parameters_Count(); i++)
1763  {
1764  _Get_Script_Parameters(Parameters, pTool->Get_Parameters(i), pTool->Get_Parameters(i)->Get_Identifier() + '.');
1765  }
1766 
1767  //-----------------------------------------------------
1768  CSG_MetaData Tools; Tools.Set_Name("toolchain");
1769 
1770  Tools.Add_Property("saga-version", SAGA_VERSION);
1771 
1772  Tools.Add_Child("group" );
1773  Tools.Add_Child("identifier" , "define-a-unique-tool-identifier-here");
1774  Tools.Add_Child("name" , pTool->Get_Name() + " [Tool Chain]");
1775  Tools.Add_Child("author" );
1776  Tools.Add_Child("description");
1777  Tools.Add_Child("menu" , pTool->Get_MenuPath(true))->Add_Property("absolute", "true");
1778  Tools.Add_Child("crs_sync" , "true");
1779  Tools.Add_Child("parameters" )->Add_Children(Parameters);
1780  Tools.Add_Child("tools" )->Add_Child(Tool);
1781  Tools ("tools" )->Add_Property("history", "false");
1782 
1783  return( Tools.asText(1) );
1784 }
1785 
1786 //---------------------------------------------------------
1787 bool CSG_Tool_Chain::_Get_Script_Tool(CSG_MetaData &Tool, CSG_Parameters *pParameters, bool bAllParameters, const CSG_String &Prefix, bool bVarNames)
1788 {
1789  for(int iParameter=0; iParameter<pParameters->Get_Count(); iParameter++)
1790  {
1791  CSG_Parameter &P = *pParameters->Get_Parameter(iParameter);
1792 
1793  if( !bAllParameters && (!P.is_Enabled(false) || P.is_Information()) )
1794  {
1795  continue;
1796  }
1797 
1798  CSG_MetaData *pChild = NULL;
1799 
1800  switch( P.Get_Type() )
1801  {
1803  _Get_Script_Tool(Tool, P.asParameters(), bAllParameters, Prefix + P.Get_Identifier() + '.', true);
1804  break;
1805 
1806  case PARAMETER_TYPE_Bool :
1807  pChild = Tool.Add_Child("option", P.asBool() ? "true" : "false");
1808  break;
1809 
1810  case PARAMETER_TYPE_Int :
1811  case PARAMETER_TYPE_Double :
1812  case PARAMETER_TYPE_Degree :
1813  case PARAMETER_TYPE_Date :
1814  case PARAMETER_TYPE_Range :
1815  case PARAMETER_TYPE_String :
1816  case PARAMETER_TYPE_Text :
1818  case PARAMETER_TYPE_Choices :
1821  pChild = Tool.Add_Child("option", P.asString());
1822  break;
1823 
1825  case PARAMETER_TYPE_Choice :
1826  pChild = Tool.Add_Child("option", P.asInt());
1827  break;
1828 
1830  pChild = Tool.Add_Child("option");
1831  P.Serialize(*pChild, true);
1832  break;
1833 
1835  if( P.Get_Children_Count() == 0 )
1836  {
1837  pChild = Tool.Add_Child("option", P.asString());
1838  }
1839  break;
1840 
1841  default:
1842  if( P.is_Input() )
1843  {
1844  pChild = Tool.Add_Child("input");
1845  pChild->Set_Content(P.is_Optional() ? "INPUT_OPTIONAL" : "INPUT");
1846  }
1847  else if( P.is_Output() )
1848  {
1849  pChild = Tool.Add_Child("output");
1850  pChild->Set_Content("OUTPUT");
1851  }
1852  break;
1853  }
1854 
1855  if( pChild )
1856  {
1857  pChild->Add_Property("id", Prefix + P.Get_Identifier());
1858 
1859  if( bVarNames )
1860  {
1861  if( P.is_Option() )
1862  {
1863  pChild->Add_Property("varname", "true");
1864  }
1865 
1866  pChild->Set_Content(Prefix + P.Get_Identifier());
1867  }
1868  }
1869  }
1870 
1871  return( true );
1872 }
1873 
1874 //---------------------------------------------------------
1875 bool CSG_Tool_Chain::_Get_Script_Parameters(CSG_MetaData &Parameters, CSG_Parameters *pParameters, const CSG_String &Prefix)
1876 {
1877  for(int i=0; i<pParameters->Get_Count(); i++)
1878  {
1879  CSG_Parameter &P = *pParameters->Get_Parameter(i);
1880 
1881  if( P.Get_Type() == PARAMETER_TYPE_Parameters )
1882  {
1883  _Get_Script_Parameters(Parameters, P.asParameters(), Prefix + P.Get_Identifier() + '.');
1884 
1885  continue; // no support for sub-parameter-lists in here
1886  }
1887 
1888  CSG_MetaData &Parameter = *Parameters.Add_Child(
1889  P.is_Option() ? "option" :
1890  P.is_Output() ? "output" : "input"
1891  );
1892 
1893  Parameter.Add_Property("varname" , P.Get_Identifier ());
1894  Parameter.Add_Property("type" , SG_Parameter_Type_Get_Identifier(P.Get_Type()));
1895  Parameter.Add_Child ("name" , P.Get_Name ());
1896  Parameter.Add_Child ("description", P.Get_Description());
1897 
1898  if( P.Get_Parent() )
1899  {
1900  Parameter.Add_Property("parent", P.Get_Parent()->Get_Identifier());
1901  }
1902 
1903  if( P.Get_Type() == PARAMETER_TYPE_Node
1905  {
1906  continue; // nothing more to do for these types
1907  }
1908 
1909  if( P.is_Option() )
1910  {
1911  CSG_MetaData &Value = *Parameter.Add_Child("value", P.asString());
1912 
1913  if( P.asValue() )
1914  {
1915  if( P.asValue()->has_Minimum() ) Value.Add_Property("min", P.asValue()->Get_Minimum());
1916  if( P.asValue()->has_Maximum() ) Value.Add_Property("max", P.asValue()->Get_Maximum());
1917  }
1918 
1919  if( P.asChoice () ) Parameter.Add_Child("choices", P.asChoice ()->Get_Items());
1920  if( P.asChoices() ) Parameter.Add_Child("choices", P.asChoices()->Get_Items());
1921 
1922  if( P.asFilePath() )
1923  {
1924  Parameter.Add_Property("save" , P.asFilePath()->is_Save () ? "true" : "false");
1925  Parameter.Add_Property("directory", P.asFilePath()->is_Directory() ? "true" : "false");
1926  Parameter.Add_Property("multiple" , P.asFilePath()->is_Multiple () ? "true" : "false");
1927  Parameter.Add_Child ("filter" , P.asFilePath()->Get_Filter());
1928  }
1929 
1930  if( P.Get_Type() == PARAMETER_TYPE_FixedTable )
1931  {
1932  P.Serialize(Parameter, true);
1933  }
1934 
1936  {
1937  Value.Set_Content(P.is_Optional() ? "true" : "false");
1938  }
1939  }
1940  else // data objects
1941  {
1942  if( P.is_Optional() )
1943  {
1944  Parameter.Add_Property("optional", "true");
1945  }
1946 
1948  {
1949  switch( ((CSG_Parameter_Data_Object_Output *)&P)->Get_DataObject_Type() )
1950  {
1953  Parameter.Add_Property("target", "none");
1954  break;
1955 
1958  Parameter.Add_Property("target", "none");
1959  break;
1960 
1961  default:
1962  break;
1963  }
1964  }
1965 
1966  if( P.Get_Type() == PARAMETER_TYPE_Shapes )
1967  {
1968  switch( ((CSG_Parameter_Shapes *)&P)->Get_Shape_Type() )
1969  {
1970  case SHAPE_TYPE_Point : Parameter.Add_Property("feature_type", "point" ); break;
1971  case SHAPE_TYPE_Points : Parameter.Add_Property("feature_type", "points" ); break;
1972  case SHAPE_TYPE_Line : Parameter.Add_Property("feature_type", "line" ); break;
1973  case SHAPE_TYPE_Polygon: Parameter.Add_Property("feature_type", "polygon"); break;
1974  default: break;
1975  }
1976  }
1977 
1979  && !((CSG_Parameter_Grid_List *)&P)->Get_System() )
1980  {
1981  Parameter.Add_Property("no_system", "true");
1982  }
1983 
1985  && !((CSG_Parameter_Grid_List *)&P)->Get_System() )
1986  {
1987  Parameter.Add_Property("no_system", "true");
1988  }
1989  }
1990  }
1991 
1992  return( true );
1993 }
1994 
1995 
1997 // //
1998 // //
1999 // //
2001 
2002 //---------------------------------------------------------
2003 CSG_Tool_Chains::CSG_Tool_Chains(const CSG_String &Library_Name, const CSG_String &Path)
2004 {
2005  m_Library_Name = Library_Name;
2006 
2007  //-----------------------------------------------------
2008  if( m_Library_Name.is_Empty() || !m_Library_Name.Cmp("toolchains") )
2009  {
2010  m_Library_Name = "_tool_chains_uncategorized";
2011  m_Name = _TL("Uncategorized Tool Chains");
2012  m_Description = _TL("Uncategorized Tool Chains");
2013  m_Menu = _TL("Uncategorized Tool Chains");
2014  }
2015 
2016  //-----------------------------------------------------
2017  else
2018  {
2019  CSG_MetaData XML(SG_File_Make_Path(Path, Library_Name, "xml"));
2020 
2021  if( !XML.Cmp_Name("toolchains") )
2022  {
2023  XML.Destroy();
2024  }
2025 
2026  m_Name = GET_XML_CONTENT(XML, "name" , m_Library_Name , true);
2027  m_Description = GET_XML_CONTENT(XML, "description", _TL("no description"), true);
2028  m_Menu = GET_XML_CONTENT(XML, "menu" , _TL("Tool Chains" ), true);
2029 
2030  m_Description.Replace("[[", "<"); // support for xml/html tags
2031  m_Description.Replace("]]", ">");
2032 
2033  // add references...
2034  for(int i=0; i<XML.Get_Children_Count(); i++)
2035  {
2036  if( !XML[i].Get_Name().CmpNoCase("REFERENCE") )
2037  {
2038  CSG_String Authors, Year, Title, Where, Link, Link_Text, DOI;
2039 
2040  if( XML[i]("AUTHORS" ) ) Authors = XML[i].Get_Content("AUTHORS" );
2041  if( XML[i]("YEAR" ) ) Year = XML[i].Get_Content("YEAR" );
2042  if( XML[i]("TITLE" ) ) Title = XML[i].Get_Content("TITLE" );
2043  if( XML[i]("WHERE" ) ) Where = XML[i].Get_Content("WHERE" );
2044  if( XML[i]("LINK" ) ) Link = XML[i].Get_Content("LINK" );
2045  if( XML[i]("LINK_TEXT") ) Link_Text = XML[i].Get_Content("LINK_TEXT");
2046  if( XML[i]("DOI" ) ) DOI = XML[i].Get_Content("DOI" );
2047 
2048  if( !DOI.is_Empty() )
2049  {
2050  Link = "https://doi.org/" + DOI; Link_Text = "doi:" + DOI;
2051  }
2052 
2053  if( !Authors.is_Empty() && !Year.is_Empty() && !Title.is_Empty() )
2054  {
2055  Add_Reference(Authors, Year, Title, Where, Link.c_str(), Link_Text.c_str());
2056  }
2057  else if( !Link.is_Empty() )
2058  {
2059  Add_Reference(Link, Link_Text.c_str());
2060  }
2061  }
2062  }
2063  }
2064 }
2065 
2066 //---------------------------------------------------------
2068 {
2069  Delete_Tools();
2070 
2071  for(size_t i=0; i<m_Tools.Get_uSize(); i++)
2072  {
2073  delete((CSG_Tool_Chain *)m_Tools[i]);
2074  }
2075 }
2076 
2077 
2079 // //
2081 
2082 //---------------------------------------------------------
2083 CSG_String CSG_Tool_Chains::Get_Info(int Type) const
2084 {
2085  switch( Type )
2086  {
2087  case TLB_INFO_Name : return( m_Name );
2088  case TLB_INFO_Description: return( m_Description );
2089  case TLB_INFO_Menu_Path : return( m_Menu );
2090  case TLB_INFO_Category : return( _TL("Tool Chains") );
2091  }
2092 
2093  return( "" );
2094 }
2095 
2096 //---------------------------------------------------------
2098 {
2099  m_Tools.Add(pTool);
2100 
2102 
2103  return( true );
2104 }
2105 
2106 //---------------------------------------------------------
2107 CSG_Tool * CSG_Tool_Chains::Get_Tool(int Index, TSG_Tool_Type Type) const
2108 {
2109  CSG_Tool *pTool = Index >= 0 && Index < Get_Count() ? (CSG_Tool_Chain *)m_Tools[Index] : NULL;
2110 
2111  return( pTool && (Type == TOOL_TYPE_Base || Type == pTool->Get_Type()) ? pTool : NULL );
2112 }
2113 
2114 
2116 // //
2118 
2119 //---------------------------------------------------------
2120 CSG_Tool * CSG_Tool_Chains::Create_Tool(const CSG_String &Name, bool bWithGUI)
2121 {
2122  CSG_Tool *pTool = CSG_Tool_Library::Get_Tool(Name);
2123 
2124  if( pTool && pTool->Get_Type() == TOOL_TYPE_Chain )
2125  {
2126  m_xTools.Add(pTool = new CSG_Tool_Chain(*((CSG_Tool_Chain *)pTool), bWithGUI));
2127 
2128  return( pTool );
2129  }
2130 
2131  return( NULL );
2132 }
2133 
2134 //---------------------------------------------------------
2136 {
2137  if( m_xTools.Del(pTool) || m_Tools.Del(pTool) )
2138  {
2139  delete((CSG_Tool_Chain *)pTool);
2140 
2141  return( true );
2142  }
2143 
2144  return( false );
2145 }
2146 
2147 //---------------------------------------------------------
2149 {
2150  for(size_t i=0; i<m_xTools.Get_uSize(); i++)
2151  {
2152  delete((CSG_Tool_Chain *)m_xTools[i]);
2153  }
2154 
2155  m_xTools.Destroy();
2156 
2157  return( true );
2158 }
2159 
2160 
2162 // //
2163 // //
2164 // //
2166 
2167 //---------------------------------------------------------
2168 bool CSG_Tool_Chain::Save_History_to_Model(const CSG_MetaData &History, const CSG_String &File)
2169 {
2170  if( SG_Compare_Version(History.Get_Property("saga-version"), "2.1.3") < 0 || !(History("TOOL") || History("MODULE")) )
2171  {
2172  return( false );
2173  }
2174 
2175  const CSG_MetaData &Tool(History("TOOL") ? History["TOOL"] : History["MODULE"]);
2176 
2177  if( !Tool("OUTPUT") )
2178  {
2179  return( false );
2180  }
2181 
2182  //-----------------------------------------------------
2183  CSG_MetaData Chain;
2184 
2185  Chain.Set_Name ("toolchain" );
2186  Chain.Add_Property("saga-version", SAGA_VERSION);
2187 
2188  Chain.Add_Child ("group" , "toolchains");
2189  Chain.Add_Child ("identifier" , SG_File_Get_Name(File, false));
2190  Chain.Add_Child ("name" , SG_File_Get_Name(File, false));
2191  Chain.Add_Child ("description", _TL("created from history"));
2192 
2193  Chain.Add_Child ("parameters" );
2194  Chain.Add_Child ("tools" );
2195 
2196  _Save_History_Add_Tool(Tool, *Chain("parameters"), *Chain("tools"), true);
2197 
2198  for(int i=0; i<Chain["tools"].Get_Children_Count(); i++)
2199  {
2200  Chain["tools"](i)->Del_Property("id");
2201  }
2202 
2203  return( Chain.Save(File) );
2204 }
2205 
2206 //---------------------------------------------------------
2207 bool CSG_Tool_Chain::_Save_History_Add_Tool(const CSG_MetaData &History, CSG_MetaData &Parms, CSG_MetaData &Tools, bool bAddOutput)
2208 {
2209  if( !History("OUTPUT") || !History["OUTPUT"].Get_Property("id") )
2210  {
2211  return( false );
2212  }
2213 
2214  //-----------------------------------------------------
2215  CSG_MetaData *pParameter, &Tool = *Tools.Ins_Child("tool", 0);
2216 
2217  CSG_String Tool_ID(CSG_String::Format("tool_%02d", Tools.Get_Children_Count()));
2218 
2219  Tool.Add_Property("id" , Tool_ID);
2220  Tool.Add_Property("library", History.Get_Property("library"));
2221  Tool.Add_Property("tool" , History.Get_Property("id" ));
2222  Tool.Add_Property("name" , History.Get_Property("name" ));
2223 
2224  //-----------------------------------------------------
2225  const CSG_MetaData &Output = History["OUTPUT"];
2226 
2227  CSG_String VarName = CSG_String::Format("%s__%s", Tool_ID.c_str(), Output.Get_Property("id"));
2228 
2229  pParameter = Tool.Add_Child("output", VarName);
2230  pParameter->Add_Property("parms", Output.Get_Property("parms"));
2231  pParameter->Add_Property("id" , Output.Get_Property("id" ));
2232 
2233  if( bAddOutput )
2234  {
2235  pParameter = Parms.Add_Child("output");
2236 
2237  pParameter->Add_Property("varname" , VarName);
2238  pParameter->Add_Property("type" , Output.Get_Property("type"));
2239  pParameter->Add_Child ("name" , Output.Get_Property("name"));
2240  // pParameter->Add_Child ("description", Output.Get_Property("name"));
2241  }
2242 
2243  //-----------------------------------------------------
2244  for(int i=0; i<History.Get_Children_Count(); i++) // Options and Input
2245  {
2246  CSG_MetaData *pChild = History.Get_Child(i);
2247 
2248  if( !pChild->Get_Name().Cmp("OPTION") )
2249  {
2250  pParameter = NULL;
2251 
2252  switch( SG_Parameter_Type_Get_Type(pChild->Get_Property("type")) )
2253  {
2254  case PARAMETER_TYPE_Bool :
2255  case PARAMETER_TYPE_Int :
2256  case PARAMETER_TYPE_Double :
2257  case PARAMETER_TYPE_Degree :
2258  case PARAMETER_TYPE_Date :
2259  case PARAMETER_TYPE_Range :
2260  case PARAMETER_TYPE_String :
2261  case PARAMETER_TYPE_Text :
2265  case PARAMETER_TYPE_Choices :
2266  pParameter = Tool.Add_Child("option", pChild->Get_Content());
2267  break;
2268 
2270  case PARAMETER_TYPE_Choice :
2271  pParameter = Tool.Add_Child("option", pChild->Get_Property("index"));
2272  break;
2273 
2275  if( pChild->Get_Children_Count() == 0 )
2276  {
2277  pParameter = Tool.Add_Child("option", pChild->Get_Content());
2278  }
2279  break;
2280 
2281  default: break;
2282  }
2283 
2284  if( pParameter )
2285  {
2286  pParameter->Add_Property("parms", pChild->Get_Property("parms"));
2287  pParameter->Add_Property("id" , pChild->Get_Property("id" ));
2288  }
2289  }
2290  else if( !pChild->Get_Name().Cmp("INPUT") )
2291  {
2292  _Save_History_Add_Input(*pChild, Parms, Tool);
2293  }
2294  else if( !pChild->Get_Name().Cmp("INPUT_LIST") )
2295  {
2296  for(int j=0; j<pChild->Get_Children_Count(); j++)
2297  {
2298  _Save_History_Add_Input(*pChild->Get_Child(j), Parms, Tool);
2299  }
2300  }
2301  }
2302 
2303  return( true );
2304 }
2305 
2306 //---------------------------------------------------------
2307 bool CSG_Tool_Chain::_Save_History_Add_Input(const CSG_MetaData &History, CSG_MetaData &Parms, CSG_MetaData &Tool)
2308 {
2309  CSG_MetaData *pInput = Tool.Add_Child("input");
2310 
2311  pInput->Add_Property("parms", History.Get_Property("parms"));
2312  pInput->Add_Property("id" , History.Get_Property("id" ));
2313 
2314  if( History("TOOL") || History("MODULE") )
2315  {
2316  const CSG_MetaData &History_Tool(History("TOOL") ? History["TOOL"] : History["MODULE"]);
2317 
2318  if( History_Tool("OUTPUT") && History_Tool["OUTPUT"].Get_Property("id") )
2319  {
2320  pInput->Fmt_Content("tool_%02d__%s", Tool.Get_Parent()->Get_Children_Count() + 1, History_Tool["OUTPUT"].Get_Property("id"));
2321 
2322  return( _Save_History_Add_Tool(History_Tool, Parms, *Tool.Get_Parent()) );
2323  }
2324  }
2325 
2326  CSG_String VarName = CSG_String::Format("%s__%s", Tool.Get_Property("id"), History.Get_Property("id"));
2327 
2328  pInput->Set_Content(VarName);
2329 
2330  CSG_MetaData *pParameter = Parms.Ins_Child("input", 0);
2331 
2332  pParameter->Add_Property("varname" , VarName);
2333  pParameter->Add_Property("type" , History.Get_Property("type"));
2334  pParameter->Add_Child ("name" , History.Get_Property("name"));
2335 // pParameter->Add_Child ("description", History.Get_Property("name"));
2336 
2337  return( true );
2338 }
2339 
2340 
2342 // //
2343 // //
2344 // //
2346 
2347 //---------------------------------------------------------
CSG_String::BeforeFirst
CSG_String BeforeFirst(char Character) const
Definition: api_string.cpp:666
CSG_MetaData::Destroy
void Destroy(void)
Definition: metadata.cpp:140
CSG_Parameter::Set_Value
virtual bool Set_Value(int Value)
Definition: parameter.cpp:799
PARAMETER_TYPE_Double
@ PARAMETER_TYPE_Double
Definition: parameters.h:127
CSG_Parameter_File_Name::Get_Filter
const SG_Char * Get_Filter(void) const
Definition: parameter_data.cpp:1553
CSG_Tool_Chains::Add_Tool
bool Add_Tool(CSG_Tool_Chain *pTool)
CSG_Parameters::Get_Parameter
CSG_Parameter * Get_Parameter(int i) const
Definition: parameters.h:1752
PARAMETER_TYPE_FilePath
@ PARAMETER_TYPE_FilePath
Definition: parameters.h:136
PARAMETER_TYPE_Degree
@ PARAMETER_TYPE_Degree
Definition: parameters.h:128
CSG_Tool::Parameters
CSG_Parameters Parameters
Definition: tool.h:256
CSG_Parameter_File_Name::Get_FilePaths
bool Get_FilePaths(CSG_Strings &FilePaths) const
Definition: parameter_data.cpp:1575
CSG_Parameters::Del_References
void Del_References(void)
Definition: parameters.cpp:395
SG_T
#define SG_T(s)
Definition: api_core.h:537
CSG_Parameters::Add_Date
CSG_Parameter * Add_Date(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value=0.0)
Definition: parameters.cpp:485
CSG_String::Printf
int Printf(const char *Format,...)
Definition: api_string.cpp:308
CSG_Parameters::Add_Grid_System
CSG_Parameter * Add_Grid_System(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Grid_System *pInit=NULL)
Definition: parameters.cpp:642
CSG_Tool_Chain::Get_Script
static CSG_String Get_Script(CSG_Tool *pTool, bool bHeader, bool bAllParameters=true)
CSG_Parameters::Add_Degree
CSG_Parameter * Add_Degree(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value=0.0, double Minimum=0.0, bool bMinimum=false, double Maximum=0.0, bool bMaximum=false)
Definition: parameters.cpp:480
TOOL_TYPE_Chain
@ TOOL_TYPE_Chain
Definition: tool.h:106
_TL
#define _TL(s)
Definition: api_core.h:1489
CSG_String::Make_Lower
CSG_String & Make_Lower(void)
Definition: api_string.cpp:543
CSG_Parameter_List::Add_Item
virtual bool Add_Item(CSG_Data_Object *pItem)
Definition: parameter_data.cpp:3032
SAGA_VERSION
#define SAGA_VERSION
Definition: saga_api.h:90
PARAMETER_TYPE_Table_Fields
@ PARAMETER_TYPE_Table_Fields
Definition: parameters.h:145
CSG_String::Length
size_t Length(void) const
Definition: api_string.cpp:172
CSG_Tool_Chain::CSG_Tool_Chain
CSG_Tool_Chain(void)
Definition: tool_chain.cpp:79
CSG_Tool_Chains::CSG_Tool_Chains
CSG_Tool_Chains(const CSG_String &Library_Name, const CSG_String &Path)
CSG_MetaData::Get_Children_Count
int Get_Children_Count(void) const
Definition: metadata.h:147
CSG_Parameter::Get_Identifier
const SG_Char * Get_Identifier(void) const
Definition: parameter.cpp:547
CSG_Parameter::asInt
int asInt(void) const
Definition: parameters.h:282
PARAMETER_TYPE_Node
@ PARAMETER_TYPE_Node
Definition: parameters.h:123
CSG_Tool::On_After_Execution
virtual bool On_After_Execution(void)
Definition: tool.h:245
CSG_Parameter::asString
const SG_Char * asString(void) const
Definition: parameters.h:285
CSG_Parameter::asTable
CSG_Table * asTable(void) const
Definition: parameter.cpp:1063
CSG_MetaData::Get_Content
const CSG_String & Get_Content(void) const
Definition: metadata.h:132
A
#define A
CSG_MetaData::Set_Content
void Set_Content(const CSG_String &Content)
Definition: metadata.h:139
CSG_Parameter_Value::Get_Maximum
double Get_Maximum(void) const
Definition: parameters.h:445
CSG_Tool_Chains::Get_Info
virtual CSG_String Get_Info(int Type) const
CSG_Parameters::Del_Parameters
bool Del_Parameters(void)
Definition: parameters.cpp:1312
CSG_Parameter_Value::has_Minimum
bool has_Minimum(void) const
Definition: parameters.h:442
CSG_Tool_Chain::do_Sync_Projections
virtual bool do_Sync_Projections(void) const
SG_UI_MSG_STYLE_SUCCESS
@ SG_UI_MSG_STYLE_SUCCESS
Definition: api_core.h:1505
PARAMETER_TYPE_Grids_List
@ PARAMETER_TYPE_Grids_List
Definition: parameters.h:155
PARAMETER_TYPE_String
@ PARAMETER_TYPE_String
Definition: parameters.h:134
CSG_String::asInt
int asInt(void) const
Definition: api_string.cpp:722
PARAMETER_TYPE_Int
@ PARAMETER_TYPE_Int
Definition: parameters.h:126
CSG_Parameter_List::Get_Item
CSG_Data_Object * Get_Item(int Index) const
Definition: parameters.h:1373
CSG_Tool_Chain::On_Parameters_Enable
virtual int On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
CSG_Parameters::Add_Node
CSG_Parameter * Add_Node(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
Definition: parameters.cpp:440
SHAPE_TYPE_Polygon
@ SHAPE_TYPE_Polygon
Definition: shapes.h:105
CSG_MetaData::Set_Property
bool Set_Property(const CSG_String &Name, const CSG_String &Value, bool bAddIfNotExists=true)
Definition: metadata.cpp:615
CSG_Parameter::is_Input
bool is_Input(void) const
Definition: parameters.h:232
tool_chain.h
CSG_Tool_Library::Get_Name
CSG_String Get_Name(void) const
Definition: tool_library.h:120
TLB_INFO_Category
@ TLB_INFO_Category
Definition: tool.h:626
saga_api.h
PARAMETER_TYPE_TIN
@ PARAMETER_TYPE_TIN
Definition: parameters.h:152
CSG_Parameters::Add_Grids_List
CSG_Parameter * Add_Grids_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, bool bSystem_Dependent=true)
Definition: parameters.cpp:761
CSG_Parameter_Data_Object_Output
Definition: parameters.h:1170
CSG_Tool
Definition: tool.h:151
SG_Translate
SAGA_API_DLL_EXPORT const SG_Char * SG_Translate(const CSG_String &Text)
Definition: api_translator.cpp:93
CSG_Parameters::Add_String
CSG_Parameter * Add_String(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &String, bool bLongText=false, bool bPassword=false)
Definition: parameters.cpp:558
CSG_Data_Object::Get_Name
const SG_Char * Get_Name(void) const
Definition: dataobject.cpp:349
CSG_Tool::Execute
bool Execute(bool bAddHistory=false)
Definition: tool.cpp:258
CSG_Parameter::Get_Description
const SG_Char * Get_Description(void) const
Definition: parameter.cpp:602
CSG_Parameters::Add_Double
CSG_Parameter * Add_Double(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value=0.0, double Minimum=0.0, bool bMinimum=false, double Maximum=0.0, bool bMaximum=false)
Definition: parameters.cpp:475
CSG_Tool::Add_Reference
void Add_Reference(const CSG_String &Authors, const CSG_String &Year, const CSG_String &Title, const CSG_String &Where, const SG_Char *Link=NULL, const SG_Char *Link_Text=NULL)
Definition: tool.cpp:171
CSG_Grid_System::Create
bool Create(const CSG_Grid_System &System, int Precision=-1)
Definition: grid_system.cpp:140
SG_DATAOBJECT_TYPE_Grids
@ SG_DATAOBJECT_TYPE_Grids
Definition: dataobject.h:119
CSG_Tool::Error_Set
bool Error_Set(TSG_Tool_Error Error_ID=TOOL_ERROR_Unknown)
Definition: tool.cpp:705
PARAMETER_TYPE_FixedTable
@ PARAMETER_TYPE_FixedTable
Definition: parameters.h:141
CSG_Tool::Get_Name
const CSG_String & Get_Name(void) const
Definition: tool.cpp:132
CSG_Parameter::asDataObject
CSG_Data_Object * asDataObject(void) const
Definition: parameter.cpp:1041
CSG_Parameter::Assign
bool Assign(CSG_Parameter *pSource)
Definition: parameter.cpp:1141
CSG_Parameter_File_Name::is_Directory
bool is_Directory(void) const
Definition: parameters.h:869
CSG_MetaData::Save
bool Save(const CSG_String &File, const SG_Char *Extension=NULL) const
Definition: metadata.cpp:879
TSG_Tool_Type
TSG_Tool_Type
Definition: tool.h:101
CSG_MetaData::Get_Child
CSG_MetaData * Get_Child(int Index) const
Definition: metadata.h:148
TLB_INFO_Name
@ TLB_INFO_Name
Definition: tool.h:621
CSG_MetaData::Get_Name
const CSG_String & Get_Name(void) const
Definition: metadata.h:131
PARAMETER_TYPE_PointCloud
@ PARAMETER_TYPE_PointCloud
Definition: parameters.h:147
CSG_String::Prepend
CSG_String & Prepend(const CSG_String &String)
Definition: api_string.cpp:347
CSG_Parameter_File_Name::is_Save
bool is_Save(void) const
Definition: parameters.h:863
CSG_Parameter::asValue
class CSG_Parameter_Value * asValue(void) const
Definition: parameter.cpp:1091
CSG_String::Replace
size_t Replace(const CSG_String &sOld, const CSG_String &sNew, bool bReplaceAll=true)
Definition: api_string.cpp:563
CSG_Tool_Library_Manager::Delete_Tool
bool Delete_Tool(CSG_Tool *pTool) const
Definition: tool_library.cpp:725
CSG_Tool::Set_Author
void Set_Author(const CSG_String &String)
Definition: tool.cpp:138
CSG_Grid::Get_System
const CSG_Grid_System & Get_System(void) const
Definition: grid.h:531
CSG_String::Cmp
int Cmp(const CSG_String &String) const
Definition: api_string.cpp:515
CSG_Parameter_File_Name::is_Multiple
bool is_Multiple(void) const
Definition: parameters.h:866
CSG_Tool::Get_Parameters_Count
int Get_Parameters_Count(void) const
Definition: tool.h:182
CSG_Parameters::Add_PointCloud
CSG_Parameter * Add_PointCloud(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
Definition: parameters.cpp:929
PARAMETER_INPUT_OPTIONAL
#define PARAMETER_INPUT_OPTIONAL
Definition: parameters.h:102
PARAMETER_TYPE_Shapes_List
@ PARAMETER_TYPE_Shapes_List
Definition: parameters.h:157
PARAMETER_TYPE_Grids
@ PARAMETER_TYPE_Grids
Definition: parameters.h:149
Get_List_Count
#define Get_List_Count(p)
Definition: tool_chain.cpp:68
CSG_Parameter::Get_Type
virtual TSG_Parameter_Type Get_Type(void) const =0
CSG_Parameter::Serialize
bool Serialize(CSG_MetaData &MetaData, bool bSave)
Definition: parameter.cpp:1165
CSG_Parameters::Add_Range
CSG_Parameter * Add_Range(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Range_Min=0.0, double Range_Max=0.0, double Minimum=0.0, bool bMinimum=false, double Maximum=0.0, bool bMaximum=false)
Definition: parameters.cpp:501
CSG_Tool_Chain::On_Execute
virtual bool On_Execute(void)
SG_UI_MSG_STYLE_FAILURE
@ SG_UI_MSG_STYLE_FAILURE
Definition: api_core.h:1506
SG_UI_DATAOBJECT_UPDATE
@ SG_UI_DATAOBJECT_UPDATE
Definition: api_core.h:1518
SG_File_Get_Name
SAGA_API_DLL_EXPORT CSG_String SG_File_Get_Name(const CSG_String &full_Path, bool bExtension)
Definition: api_file.cpp:878
CSG_Parameter::is_DataObject_List
bool is_DataObject_List(void) const
Definition: parameter.cpp:295
PARAMETER_TYPE_Choices
@ PARAMETER_TYPE_Choices
Definition: parameters.h:133
TLB_INFO_Description
@ TLB_INFO_Description
Definition: tool.h:622
PARAMETER_TYPE_Data_Type
@ PARAMETER_TYPE_Data_Type
Definition: parameters.h:131
CSG_Parameter_Shapes
Definition: parameters.h:1283
CSG_Parameter_List::Del_Items
virtual bool Del_Items(void)
Definition: parameter_data.cpp:3074
CSG_Tool_Chains::Delete_Tools
virtual bool Delete_Tools(void)
CSG_MetaData::Cmp_Name
bool Cmp_Name(const CSG_String &String, bool bNoCase=true) const
Definition: metadata.cpp:461
PARAMETER_TYPE_Colors
@ PARAMETER_TYPE_Colors
Definition: parameters.h:140
CSG_Parameters::Add_TIN_List
CSG_Parameter * Add_TIN_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
Definition: parameters.cpp:916
CSG_MetaData::Ins_Child
CSG_MetaData * Ins_Child(int Position)
Definition: metadata.cpp:207
CSG_Data_Object
Definition: dataobject.h:180
CSG_Parameter
Definition: parameters.h:207
CSG_Array_Pointer::Del
bool Del(sLong Index)
Definition: api_memory.cpp:512
CSG_Parameters::Add_FixedTable
CSG_Parameter * Add_FixedTable(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Table *pInit=NULL)
Definition: parameters.cpp:625
PARAMETER_TYPE_Table
@ PARAMETER_TYPE_Table
Definition: parameters.h:150
PARAMETER_TYPE_Bool
@ PARAMETER_TYPE_Bool
Definition: parameters.h:125
CSG_Tool_Chains::Create_Tool
virtual CSG_Tool * Create_Tool(const CSG_String &Name, bool bWithGUI=false)
CSG_Parameters::Get_Count
int Get_Count(void) const
Definition: parameters.h:1725
DATAOBJECT_CREATE
#define DATAOBJECT_CREATE
Definition: dataobject.h:130
CSG_Tool::Get_Parameters
CSG_Parameters * Get_Parameters(void)
Definition: tool.h:180
PARAMETER_TYPE_Table_Field
@ PARAMETER_TYPE_Table_Field
Definition: parameters.h:144
CSG_Array_Pointer::Get_uSize
size_t Get_uSize(void) const
Definition: api_core.h:382
CSG_Parameters::Add_FilePath
CSG_Parameter * Add_FilePath(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const SG_Char *Filter=NULL, const SG_Char *Default=NULL, bool bSave=false, bool bDirectory=false, bool bMultiple=false)
Definition: parameters.cpp:569
CSG_Parameter::is_Enabled
bool is_Enabled(bool bCheckEnv=true) const
Definition: parameter.cpp:209
CSG_Tool_Chain::Set_Library_Menu
void Set_Library_Menu(const CSG_String &Menu)
Definition: tool_chain.cpp:122
PARAMETER_TYPE_Choice
@ PARAMETER_TYPE_Choice
Definition: parameters.h:132
CSG_Tool_Library_Manager::Create_Tool
CSG_Tool * Create_Tool(const CSG_String &Library, int Index, bool bWithGUI=false) const
Definition: tool_library.cpp:696
SG_Parameter_Type_Get_Identifier
CSG_String SG_Parameter_Type_Get_Identifier(TSG_Parameter_Type Type)
Definition: parameter_data.cpp:114
CSG_Parameters::Add_Shapes_List
CSG_Parameter * Add_Shapes_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, TSG_Shape_Type=SHAPE_TYPE_Undefined)
Definition: parameters.cpp:883
CSG_Parameter::asParameters
class CSG_Parameters * asParameters(void) const
Definition: parameter.cpp:1038
CSG_Parameters::Add_Grid_List
CSG_Parameter * Add_Grid_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, bool bSystem_Dependent=true)
Definition: parameters.cpp:701
CSG_Tool::Get_MenuPath
virtual CSG_String Get_MenuPath(void)
Definition: tool.h:177
CSG_Tool::Get_Library
const CSG_String & Get_Library(void) const
Definition: tool.cpp:115
SG_Get_Tool_Library_Manager
CSG_Tool_Library_Manager & SG_Get_Tool_Library_Manager(void)
Definition: tool_library.cpp:286
SG_UI_DataObject_Add
bool SG_UI_DataObject_Add(CSG_Data_Object *pDataObject, int Show)
Definition: api_callback.cpp:611
CSG_Tool_Chain::Create
bool Create(const CSG_Tool_Chain &Tool, bool bWithGUI)
Definition: tool_chain.cpp:133
CSG_MetaData::Add_Property
bool Add_Property(const CSG_String &Name, const CSG_String &Value)
Definition: metadata.cpp:559
CSG_Parameters::Add_Color
CSG_Parameter * Add_Color(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Value=0)
Definition: parameters.cpp:495
SG_Parameter_Type_Get_Type
TSG_Parameter_Type SG_Parameter_Type_Get_Type(const CSG_String &Identifier)
Definition: parameter_data.cpp:164
CSG_Grids::Get_Grid_Ptr
CSG_Grid * Get_Grid_Ptr(int i) const
Definition: grids.h:260
CSG_Parameter_Grid_List
Definition: parameters.h:1409
CSG_Parameters::Add_Int
CSG_Parameter * Add_Int(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Value=0, int Minimum=0, bool bMinimum=false, int Maximum=0, bool bMaximum=false)
Definition: parameters.cpp:470
CSG_Tool::Message_Dlg
void Message_Dlg(const CSG_String &Text, const SG_Char *Caption=NULL)
Definition: tool.cpp:693
CSG_Parameters::Add_Colors
CSG_Parameter * Add_Colors(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Palette=0, int nColors=11, bool bRevert=false)
Definition: parameters.cpp:587
PARAMETER_TYPE_Grid
@ PARAMETER_TYPE_Grid
Definition: parameters.h:148
CSG_Parameters::Add_Table_List
CSG_Parameter * Add_Table_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
Definition: parameters.cpp:850
CSG_Table::Assign_Values
bool Assign_Values(const CSG_Table &Table)
Definition: table.cpp:395
CSG_Array_Int
Definition: api_core.h:423
CSG_Parameters::Add_Table
CSG_Parameter * Add_Table(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
Definition: parameters.cpp:832
CSG_Tool_Library::m_Library_Name
CSG_String m_Library_Name
Definition: tool_library.h:161
PARAMETER_TYPE_Date
@ PARAMETER_TYPE_Date
Definition: parameters.h:129
CSG_Tool::Get_ID
const CSG_String & Get_ID(void) const
Definition: tool.h:165
PARAMETER_TYPE_Grid_List
@ PARAMETER_TYPE_Grid_List
Definition: parameters.h:154
CSG_Tool::Process_Set_Text
static void Process_Set_Text(const CSG_String &Text)
Definition: tool.cpp:850
CSG_Data_Manager::Delete
bool Delete(CSG_Data_Object *pObject, bool bDetach=false)
Definition: data_manager.cpp:623
CSG_Tool_Library::Add_Reference
void Add_Reference(const CSG_String &Authors, const CSG_String &Year, const CSG_String &Title, const CSG_String &Where, const SG_Char *Link=NULL, const SG_Char *Link_Text=NULL)
Definition: tool_library.cpp:242
CSG_Parameters::Add_Grids
CSG_Parameter * Add_Grids(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, bool bSystem_Dependent=true, TSG_Data_Type Preferred_Type=SG_DATATYPE_Undefined)
Definition: parameters.cpp:725
CSG_Parameter::is_Optional
bool is_Optional(void) const
Definition: parameters.h:234
SG_DATAOBJECT_TYPE_TIN
@ SG_DATAOBJECT_TYPE_TIN
Definition: dataobject.h:122
CSG_Strings
Definition: api_core.h:699
CSG_Parameters::Add_Table_Fields
CSG_Parameter * Add_Table_Fields(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
Definition: parameters.cpp:815
CSG_Parameters::Add_Grid
CSG_Parameter * Add_Grid(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, bool bSystem_Dependent=true, TSG_Data_Type Preferred_Type=SG_DATATYPE_Undefined)
Definition: parameters.cpp:655
CSG_Tool_Chains::Delete_Tool
virtual bool Delete_Tool(CSG_Tool *pTool)
SG_DATAOBJECT_TYPE_Grid
@ SG_DATAOBJECT_TYPE_Grid
Definition: dataobject.h:118
CSG_Tool_Chain::Save_History_to_Model
static bool Save_History_to_Model(const CSG_MetaData &History, const CSG_String &File)
CSG_Parameter::asFilePath
class CSG_Parameter_File_Name * asFilePath(void) const
Definition: parameter.cpp:1111
CSG_Parameters::Del_Parameter
bool Del_Parameter(int i)
Definition: parameters.cpp:1248
CSG_Data_Manager::Add
CSG_Data_Object * Add(CSG_Data_Object *pObject)
Definition: data_manager.cpp:310
CSG_Data_Object::Set_Name
void Set_Name(const CSG_String &Name)
Definition: dataobject.cpp:300
CSG_Parameter::is_Output
bool is_Output(void) const
Definition: parameters.h:233
CSG_MetaData::Add_Children
bool Add_Children(const CSG_MetaData &MetaData)
Definition: metadata.cpp:359
CSG_Tool::Set_Name
void Set_Name(const CSG_String &String)
Definition: tool.cpp:127
CSG_Parameters::Add_TIN
CSG_Parameter * Add_TIN(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
Definition: parameters.cpp:898
CSG_Tool::Set_Description
void Set_Description(const CSG_String &String)
Definition: tool.cpp:160
CSG_String::Format
static CSG_String Format(const char *Format,...)
Definition: api_string.cpp:270
CSG_Parameters::Add_Grids_Output
CSG_Parameter * Add_Grids_Output(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
Definition: parameters.cpp:751
CSG_Parameter_List::Get_Item_Count
int Get_Item_Count(void) const
Definition: parameters.h:1372
CSG_Tool_Chain
Definition: tool_chain.h:78
CSG_String::Find
int Find(char Character, bool fromEnd=false) const
Definition: api_string.cpp:616
CSG_Parameters::Get_Identifier
const CSG_String & Get_Identifier(void) const
Definition: parameters.h:1729
SHAPE_TYPE_Line
@ SHAPE_TYPE_Line
Definition: shapes.h:104
CSG_Parameter_Data_Object_Output::Get_Type
virtual TSG_Parameter_Type Get_Type(void) const
Definition: parameters.h:1173
CSG_Parameters::Add_Shapes
CSG_Parameter * Add_Shapes(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, TSG_Shape_Type Shape_Type=SHAPE_TYPE_Undefined)
Definition: parameters.cpp:863
CSG_Tool::has_GUI
bool has_GUI(void) const
Definition: tool.cpp:239
CSG_MetaData::Cmp_Property
bool Cmp_Property(const CSG_String &Name, const CSG_String &String, bool bNoCase=false) const
Definition: metadata.cpp:671
CSG_Parameter_Value::has_Maximum
bool has_Maximum(void) const
Definition: parameters.h:446
SG_DATAOBJECT_TYPE_Shapes
@ SG_DATAOBJECT_TYPE_Shapes
Definition: dataobject.h:121
GET_XML_CONTENT
#define GET_XML_CONTENT(XML, ID, DEFAULT, TRANSLATE)
Definition: tool_chain.cpp:63
CSG_String::CmpNoCase
int CmpNoCase(const CSG_String &String) const
Definition: api_string.cpp:521
CSG_String::AfterFirst
CSG_String AfterFirst(char Character) const
Definition: api_string.cpp:644
CSG_String::Clear
void Clear(void)
Definition: api_string.cpp:259
CSG_Parameter::Get_Children_Count
int Get_Children_Count(void) const
Definition: parameters.h:255
CSG_Parameter::Get_Parent
CSG_Parameter * Get_Parent(void) const
Definition: parameter.cpp:106
CSG_Parameter::is_DataObject
bool is_DataObject(void) const
Definition: parameter.cpp:276
CSG_MetaData::Get_Parent
CSG_MetaData * Get_Parent(void) const
Definition: metadata.h:144
CSG_Array_Pointer::Destroy
void Destroy(void)
Definition: api_core.h:376
SG_Char
#define SG_Char
Definition: api_core.h:536
B
#define B
CSG_Tool::DataObject_Set_Colors
static bool DataObject_Set_Colors(CSG_Data_Object *pDataObject, const CSG_Colors &Colors)
Definition: tool.cpp:1000
SG_UI_DATAOBJECT_SHOW_MAP
@ SG_UI_DATAOBJECT_SHOW_MAP
Definition: api_core.h:1519
CSG_String
Definition: api_core.h:563
CSG_Data_Object::asGrid
class CSG_Grid * asGrid(bool bPolymorph=false) const
Definition: dataobject.cpp:550
CSG_Parameter::asChoice
class CSG_Parameter_Choice * asChoice(void) const
Definition: parameter.cpp:1107
SHAPE_TYPE_Point
@ SHAPE_TYPE_Point
Definition: shapes.h:102
SG_DATAOBJECT_TYPE_Table
@ SG_DATAOBJECT_TYPE_Table
Definition: dataobject.h:120
CSG_Tool_Library::Get_Tool
virtual CSG_Tool * Get_Tool(int Index, TSG_Tool_Type Type=TOOL_TYPE_Base) const
Definition: tool_library.cpp:149
CSG_MetaData
Definition: metadata.h:88
CSG_Tool::Settings_Pop
bool Settings_Pop(void)
Definition: tool.cpp:634
CSG_Tool_Chain::is_Okay
bool is_Okay(void) const
Definition: tool_chain.h:96
CSG_MetaData::Load
bool Load(const CSG_String &File, const SG_Char *Extension=NULL)
Definition: metadata.cpp:786
CSG_Tool::Settings_Push
bool Settings_Push(class CSG_Data_Manager *pManager=NULL)
Definition: tool.cpp:621
CSG_Parameter_Shapes::Get_Type
virtual TSG_Parameter_Type Get_Type(void) const
Definition: parameters.h:1286
CSG_String::is_Empty
bool is_Empty(void) const
Definition: api_string.cpp:178
CSG_Parameter::has_Changed
bool has_Changed(int Check_Flags=PARAMETER_CHECK_ALL)
Definition: parameter.cpp:886
IS_TRUE_PROPERTY
#define IS_TRUE_PROPERTY(Item, Property)
Definition: tool_chain.cpp:66
CSG_Parameter::asDouble
double asDouble(void) const
Definition: parameters.h:284
CSG_Parameters::Add_Grid_Output
CSG_Parameter * Add_Grid_Output(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
Definition: parameters.cpp:691
CSG_Parameters::Destroy
void Destroy(void)
Definition: parameters.cpp:183
PARAMETER_TYPE_Grid_System
@ PARAMETER_TYPE_Grid_System
Definition: parameters.h:143
CSG_Tool::Get_Description
const CSG_String & Get_Description(void) const
Definition: tool.cpp:165
TOOL_TYPE_Base
@ TOOL_TYPE_Base
Definition: tool.h:102
PARAMETER_TYPE_PointCloud_List
@ PARAMETER_TYPE_PointCloud_List
Definition: parameters.h:159
CSG_Parameter_Grid_List::Get_Type
virtual TSG_Parameter_Type Get_Type(void) const
Definition: parameters.h:1412
PARAMETER_TYPE_Table_List
@ PARAMETER_TYPE_Table_List
Definition: parameters.h:156
CSG_Parameter_Value::Get_Minimum
double Get_Minimum(void) const
Definition: parameters.h:441
CSG_Array_Pointer::Add
bool Add(void *Value)
Definition: api_memory.cpp:485
CSG_Parameter::asRange
class CSG_Parameter_Range * asRange(void) const
Definition: parameter.cpp:1110
CSG_MetaData::Set_Name
void Set_Name(const CSG_String &Name)
Definition: metadata.h:129
CSG_Parameters::Add_PointCloud_List
CSG_Parameter * Add_PointCloud_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
Definition: parameters.cpp:947
SG_Compare_Version
int SG_Compare_Version(const CSG_String &Version, int Major, int Minor, int Release)
Definition: saga_api.cpp:82
CSG_MetaData::Fmt_Content
void Fmt_Content(const char *Format,...)
Definition: metadata.cpp:510
CSG_Parameters::Set_Manager
void Set_Manager(class CSG_Data_Manager *pManager)
Definition: parameters.cpp:223
PARAMETER_TYPE_DataObject_Output
@ PARAMETER_TYPE_DataObject_Output
Definition: parameters.h:161
CSG_Tool_Chains::Get_Tool
virtual CSG_Tool * Get_Tool(int Index, TSG_Tool_Type Type=TOOL_TYPE_Base) const
CSG_String::asDouble
double asDouble(void) const
Definition: api_string.cpp:760
CSG_Tool::On_Before_Execution
virtual bool On_Before_Execution(void)
Definition: tool.h:244
CSG_Parameter_Range::Get_Min_Parameter
CSG_Parameter_Double * Get_Min_Parameter(void) const
Definition: parameters.h:621
SG_File_Make_Path
SAGA_API_DLL_EXPORT CSG_String SG_File_Make_Path(const CSG_String &Directory, const CSG_String &Name)
Definition: api_file.cpp:919
CSG_String::c_str
const SG_Char * c_str(void) const
Definition: api_string.cpp:236
SHAPE_TYPE_Points
@ SHAPE_TYPE_Points
Definition: shapes.h:103
CSG_Parameters::Add_Choices
CSG_Parameter * Add_Choices(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &Items)
Definition: parameters.cpp:548
CSG_Tool_Chains::~CSG_Tool_Chains
virtual ~CSG_Tool_Chains(void)
CSG_Strings::Get_Count
int Get_Count(void) const
Definition: api_core.h:712
CSG_Parameters
Definition: parameters.h:1690
CSG_Parameter::Get_DataObject_Type
TSG_Data_Object_Type Get_DataObject_Type(void) const
Definition: parameter.cpp:519
CSG_Array_Int::Get_uSize
size_t Get_uSize(void) const
Definition: api_core.h:437
CSG_MetaData::Add_Child
CSG_MetaData * Add_Child(void)
Definition: metadata.cpp:166
CSG_MetaData::asText
CSG_String asText(int Flags=0) const
Definition: metadata.cpp:698
CSG_Parameter::asGrids
CSG_Grids * asGrids(void) const
Definition: parameter.cpp:1043
CSG_Parameter::asGrid_System
CSG_Grid_System * asGrid_System(void) const
Definition: parameter.cpp:1037
CSG_Tool::Error_Fmt
bool Error_Fmt(const char *Format,...)
Definition: tool.cpp:742
CSG_Tool::Get_Type
virtual TSG_Tool_Type Get_Type(void) const
Definition: tool.h:163
CSG_Tool::Message_Fmt
void Message_Fmt(const char *Format,...)
Definition: tool.cpp:919
CSG_Parameter::Get_Name
const SG_Char * Get_Name(void) const
Definition: parameter.cpp:589
PARAMETER_TYPE_Range
@ PARAMETER_TYPE_Range
Definition: parameters.h:130
CSG_Parameter_Range::Get_Max_Parameter
CSG_Parameter_Double * Get_Max_Parameter(void) const
Definition: parameters.h:625
CSG_Parameter::is_Option
bool is_Option(void) const
Definition: parameter.cpp:239
CSG_Tool_Chains::Get_Count
virtual int Get_Count(void) const
Definition: tool_chain.h:185
PARAMETER_OUTPUT
#define PARAMETER_OUTPUT
Definition: parameters.h:95
CSG_Parameter_Choices::Get_Items
CSG_String Get_Items(void) const
Definition: parameter_data.cpp:1327
CSG_Tool::Set_Grid_System
bool Set_Grid_System(const CSG_Grid_System &System)
Definition: tool.cpp:1258
PARAMETER_TYPE_TIN_List
@ PARAMETER_TYPE_TIN_List
Definition: parameters.h:158
TSG_Parameter_Type
TSG_Parameter_Type
Definition: parameters.h:122
Get_List_Item
#define Get_List_Item(p, i)
Definition: tool_chain.cpp:69
PARAMETER_TYPE_Parameters
@ PARAMETER_TYPE_Parameters
Definition: parameters.h:163
PARAMETER_TYPE_Font
@ PARAMETER_TYPE_Font
Definition: parameters.h:138
CSG_Parameter::asList
class CSG_Parameter_List * asList(void) const
Definition: parameter.cpp:1115
IS_TRUE_STRING
#define IS_TRUE_STRING(String)
Definition: tool_chain.cpp:65
PARAMETER_TYPE_Color
@ PARAMETER_TYPE_Color
Definition: parameters.h:139
PARAMETER_TYPE_Shapes
@ PARAMETER_TYPE_Shapes
Definition: parameters.h:151
CSG_MetaData::Get_Property
const SG_Char * Get_Property(int Index) const
Definition: metadata.h:180
CSG_Parameter_Choice::Get_Items
CSG_String Get_Items(void) const
Definition: parameter_data.cpp:974
CSG_String::Right
CSG_String Right(size_t count) const
Definition: api_string.cpp:693
SG_DATAOBJECT_TYPE_PointCloud
@ SG_DATAOBJECT_TYPE_PointCloud
Definition: dataobject.h:123
CSG_Tool::On_Parameters_Enable
virtual int On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
Definition: tool.cpp:482
SHAPE_TYPE_Undefined
@ SHAPE_TYPE_Undefined
Definition: shapes.h:101
CSG_Data_Object::is_Valid
virtual bool is_Valid(void) const =0
CSG_Parameter::asChoices
class CSG_Parameter_Choices * asChoices(void) const
Definition: parameter.cpp:1109
CSG_Parameter::is_Information
bool is_Information(void) const
Definition: parameters.h:235
PARAMETER_INPUT
#define PARAMETER_INPUT
Definition: parameters.h:94
CSG_Parameters::Add_Bool
CSG_Parameter * Add_Bool(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool Value=false)
Definition: parameters.cpp:465
CSG_Grid_System::is_Valid
bool is_Valid(void) const
Definition: grid_system.cpp:258
CSG_Parameter::Get_Type_Identifier
CSG_String Get_Type_Identifier(void) const
Definition: parameter.cpp:123
CSG_Grids::Del_Grids
bool Del_Grids(bool bDetach=false)
Definition: grids.cpp:823
CSG_Parameter::asBool
bool asBool(void) const
Definition: parameters.h:281
TLB_INFO_Menu_Path
@ TLB_INFO_Menu_Path
Definition: tool.h:625
PARAMETER_OUTPUT_OPTIONAL
#define PARAMETER_OUTPUT_OPTIONAL
Definition: parameters.h:103
SG_UI_Msg_Add
void SG_UI_Msg_Add(const char *Message, bool bNewLine, TSG_UI_MSG_STYLE Style)
Definition: api_callback.cpp:503
CSG_Parameters::Add_Table_Field
CSG_Parameter * Add_Table_Field(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool bAllowNone=false)
Definition: parameters.cpp:785
CSG_Tool_Chain::~CSG_Tool_Chain
virtual ~CSG_Tool_Chain(void)
Definition: tool_chain.cpp:103
PARAMETER_TYPE_Text
@ PARAMETER_TYPE_Text
Definition: parameters.h:135
CSG_Parameters::Add_Choice
CSG_Parameter * Add_Choice(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &Items, int Default=0)
Definition: parameters.cpp:533