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