SAGA API Version 9.13
Loading...
Searching...
No Matches
parameters.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// parameters.cpp //
15// //
16// Copyright (C) 2005 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 Goettingen //
44// Goldschmidtstr. 5 //
45// 37077 Goettingen //
46// Germany //
47// //
48// e-mail: oconrad@saga-gis.org //
49// //
51
52//---------------------------------------------------------
53#include "parameters.h"
54#include "data_manager.h"
55#include "tool.h"
56
57
59// //
60// //
61// //
63
64//---------------------------------------------------------
66{
67 _On_Construction();
68}
69
70//---------------------------------------------------------
72{
73 _On_Construction();
74
75 Create(Parameters);
76}
77
78//---------------------------------------------------------
79CSG_Parameters::CSG_Parameters(const SG_Char *Name, const SG_Char *Description, const SG_Char *Identifier, bool bGrid_System)
80{
81 _On_Construction();
82
83 Create(Name, Description, Identifier, bGrid_System);
84}
85
86//---------------------------------------------------------
87CSG_Parameters::CSG_Parameters(void *pOwner, const SG_Char *Name, const SG_Char *Description, const SG_Char *Identifier, bool bGrid_System)
88{
89 _On_Construction();
90
91 Create(pOwner, Name, Description, Identifier, bGrid_System);
92}
93
94//---------------------------------------------------------
99
100
102// //
104
105//---------------------------------------------------------
106void CSG_Parameters::_On_Construction(void)
107{
108 m_pOwner = NULL;
109 m_pTool = NULL;
110 m_pManager = &SG_Get_Data_Manager();
111
112 m_Callback = NULL;
113 m_bCallback = true;
114
115 m_Parameters = NULL;
116 m_nParameters = 0;
117
118 m_pGrid_System = NULL;
119
120 m_pStack = NULL;
121
122 m_bInfo = false;
123 m_Info = "";
124}
125
126//---------------------------------------------------------
128{
129 Destroy();
130
131 Set_Identifier (Parameters.Get_Identifier ());
132 Set_Name (Parameters.Get_Name ());
133 Set_Description(Parameters.Get_Description());
134
135 m_pOwner = Parameters.m_pOwner;
136 m_pTool = Parameters.m_pTool;
137 m_pManager = Parameters.m_pManager;
138
139 m_Callback = Parameters.m_Callback;
140 m_bCallback = Parameters.m_bCallback;
141
142 for(int i=0; i<Parameters.m_nParameters; i++)
143 {
144 _Add(Parameters.m_Parameters[i]);
145 }
146
147 if( Parameters.m_pGrid_System )
148 {
149 m_pGrid_System = Get_Parameter(Parameters.m_pGrid_System->Get_Identifier());
150 }
151
152 return( m_nParameters == Parameters.m_nParameters );
153}
154
155//---------------------------------------------------------
156bool CSG_Parameters::Create(const SG_Char *Name, const SG_Char *Description, const SG_Char *Identifier, bool bGrid_System)
157{
158 Destroy();
159
160 Set_Identifier (Identifier);
161 Set_Name (Name);
162 Set_Description(Description ? Description : SG_T(""));
163
164 if( bGrid_System )
165 {
167 }
168
169 return( true );
170}
171
172//---------------------------------------------------------
173bool CSG_Parameters::Create(void *pOwner, const SG_Char *Name, const SG_Char *Description, const SG_Char *Identifier, bool bGrid_System)
174{
175 if( Create(Name, Description, Identifier, bGrid_System) )
176 {
177 m_pOwner = pOwner;
178
179 return( true );
180 }
181
182 return( false );
183}
184
185//---------------------------------------------------------
187{
188 Pop();
189
190 m_pOwner = NULL;
191 m_pTool = NULL;
192 m_pGrid_System = NULL;
193
195}
196
197
199// //
201
202//---------------------------------------------------------
204{
205 m_pTool = pTool;
206
207 for(int i=0; i<Get_Count(); i++)
208 {
209 if( m_Parameters[i]->Get_Type() == PARAMETER_TYPE_Parameters )
210 {
211 m_Parameters[i]->asParameters()->Set_Tool(pTool);
212 }
213 }
214}
215
216//---------------------------------------------------------
223//---------------------------------------------------------
225{
226 m_pManager = pManager;
227
228 for(int i=0; i<Get_Count(); i++)
229 {
230 if( m_Parameters[i]->Get_Type() == PARAMETER_TYPE_Parameters )
231 {
232 m_Parameters[i]->asParameters()->Set_Manager(pManager);
233 }
234 }
235}
236
237//---------------------------------------------------------
241//---------------------------------------------------------
243{
244 if( !m_pGrid_System )
245 {
246 m_pGrid_System = Add_Grid_System("", "PARAMETERS_GRID_SYSTEM", _TL("Grid System"), _TL(""));
247
248 return( true );
249 }
250
251 return( false );
252}
253
254
255//---------------------------------------------------------
262//---------------------------------------------------------
263bool CSG_Parameters::Push(CSG_Data_Manager *pManager, bool bRestoreDefaults)
264{
265 CSG_Parameters *pStack = m_pStack;
266
267 m_pStack = new CSG_Parameters(*this);
268
269 m_pStack->m_pStack = pStack;
270
271 m_pManager = pManager;
272
273 if( bRestoreDefaults )
274 {
275 Restore_Defaults(true);
276 }
277
278 return( true );
279}
280
281//---------------------------------------------------------
285//---------------------------------------------------------
287{
288 if( m_pStack )
289 {
290 m_pManager = m_pStack->m_pManager;
291
292 Assign_Values(m_pStack);
293
294 CSG_Parameters *pStack = m_pStack->m_pStack;
295
296 delete( m_pStack );
297
298 m_pStack = pStack;
299
300 return( true );
301 }
302
303 return( false );
304}
305
306//---------------------------------------------------------
311//---------------------------------------------------------
313{
314 return( Get_Tool() ? Get_Tool()->has_GUI() : (Get_Owner() && SG_UI_Get_Window_Main()) );
315}
316
317//---------------------------------------------------------
321//---------------------------------------------------------
323{
324 m_Identifier = Identifier;
325}
326
327//---------------------------------------------------------
331//---------------------------------------------------------
332bool CSG_Parameters::Cmp_Identifier(const CSG_String &Identifier) const
333{
334 return( m_Identifier.Cmp(Identifier) == 0 );
335}
336
337//---------------------------------------------------------
341//---------------------------------------------------------
343{
344 m_Name = Name;
345}
346
347//---------------------------------------------------------
351//---------------------------------------------------------
353{
354 m_Description = Description;
355}
356
357//---------------------------------------------------------
361//---------------------------------------------------------
363{
364 for(int i=0; i<m_nParameters; i++)
365 {
366 m_Parameters[i]->Set_Enabled(bEnabled);
367 }
368}
369
370//---------------------------------------------------------
374//---------------------------------------------------------
375void CSG_Parameters::Set_Enabled(const CSG_String &Identifier, bool bEnabled)
376{
377 CSG_Parameter *pParameter = Get_Parameter(Identifier);
378
379 if( pParameter )
380 {
381 pParameter->Set_Enabled(bEnabled);
382 }
383}
384
385
387// //
389
390//---------------------------------------------------------
392{
393 return( _Add(pParameter) );
394}
395
396//---------------------------------------------------------
397CSG_Parameter * CSG_Parameters::Add_Node(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool bCollapsed)
398{
399 return( _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Node, bCollapsed ? PARAMETER_GUI_COLLAPSED|PARAMETER_INFORMATION : PARAMETER_INFORMATION) );
400}
401
402//---------------------------------------------------------
411CSG_Parameter * CSG_Parameters::Add_Value(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, TSG_Parameter_Type Type, double Value, double Minimum, bool bMinimum, double Maximum, bool bMaximum)
412{
413 return( _Add_Value(ParentID, ID, Name, Description, false, Type, Value, Minimum, bMinimum, Maximum, bMaximum) );
414}
415
416CSG_Parameter * CSG_Parameters::Add_Info_Value(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, TSG_Parameter_Type Type, double Value)
417{
418 return( _Add_Value(ParentID, ID, Name, Description, true, Type, Value, 0.0, false, 0.0, false) );
419}
420
421//---------------------------------------------------------
422CSG_Parameter * CSG_Parameters::Add_Bool (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool Value)
423{
424 return( Add_Value(ParentID, ID, Name, Description, PARAMETER_TYPE_Bool , Value ? 1.0 : 0.0) );
425}
426
427CSG_Parameter * CSG_Parameters::Add_Int (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Value, int Minimum, bool bMinimum, int Maximum, bool bMaximum)
428{
429 return( Add_Value(ParentID, ID, Name, Description, PARAMETER_TYPE_Int , Value, Minimum, bMinimum, Maximum, bMaximum) );
430}
431
432CSG_Parameter * CSG_Parameters::Add_Double(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value, double Minimum, bool bMinimum, double Maximum, bool bMaximum)
433{
434 return( Add_Value(ParentID, ID, Name, Description, PARAMETER_TYPE_Double, Value, Minimum, bMinimum, Maximum, bMaximum) );
435}
436
437CSG_Parameter * CSG_Parameters::Add_Degree(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value, double Minimum, bool bMinimum, double Maximum, bool bMaximum)
438{
439 return( Add_Value(ParentID, ID, Name, Description, PARAMETER_TYPE_Degree, Value, Minimum, bMinimum, Maximum, bMaximum) );
440}
441
442CSG_Parameter * CSG_Parameters::Add_Date (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value) // Julian Day Number
443{
444 if( !Value )
445 {
446 Value = CSG_DateTime::Now().Get_JDN();
447 }
448
449 return( Add_Value(ParentID, ID, Name, Description, PARAMETER_TYPE_Date , Value) );
450}
451
452CSG_Parameter * CSG_Parameters::Add_Color (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Value)
453{
454 return( Add_Value(ParentID, ID, Name, Description, PARAMETER_TYPE_Color , Value) );
455}
456
457//---------------------------------------------------------
458CSG_Parameter * CSG_Parameters::Add_Range (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Range_Min, double Range_Max, double Minimum, bool bMinimum, double Maximum, bool bMaximum)
459{
460 return( _Add_Range(ParentID, ID, Name, Description, false, Range_Min, Range_Max, Minimum, bMinimum, Maximum, bMaximum) );
461}
462
463CSG_Parameter * CSG_Parameters::Add_Info_Range(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Range_Min, double Range_Max)
464{
465 return( _Add_Range(ParentID, ID, Name, Description, true, Range_Min, Range_Max, 0.0, false, 0.0, false) );
466}
467
468//---------------------------------------------------------
477//---------------------------------------------------------
478CSG_Parameter * CSG_Parameters::Add_Data_Type(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Data_Types, TSG_Data_Type Default, const CSG_String &User)
479{
480 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Data_Type, 0);
481
482 bool bCallback = Set_Callback(false);
483 pParameter->asDataType()->Set_Data_Types(Data_Types, Default, User);
484 Set_Callback(bCallback);
485
486 return( pParameter );
487}
488
489//---------------------------------------------------------
490CSG_Parameter * CSG_Parameters::Add_Choice(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &Items, int Default)
491{
492 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Choice, 0);
493
494 pParameter->asChoice()->Set_Items(Items);
495
496 bool bCallback = Set_Callback(false);
497 pParameter->Set_Value (Default);
498 pParameter->Set_Default(Default);
499 Set_Callback(bCallback);
500
501 return( pParameter );
502}
503
504//---------------------------------------------------------
505CSG_Parameter * CSG_Parameters::Add_Choices(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &Items)
506{
507 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Choices, 0);
508
509 pParameter->asChoices()->Set_Items(Items);
510
511 return( pParameter );
512}
513
514//---------------------------------------------------------
515CSG_Parameter * CSG_Parameters::Add_String(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &String, bool bLongText, bool bPassword)
516{
517 return( _Add_String(ParentID, ID, Name, Description, false, String, bLongText, bPassword) );
518}
519
520CSG_Parameter * CSG_Parameters::Add_Info_String(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &String, bool bLongText)
521{
522 return( _Add_String(ParentID, ID, Name, Description, true, String, bLongText, false) );
523}
524
525//---------------------------------------------------------
526CSG_Parameter * CSG_Parameters::Add_FilePath(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const SG_Char *Filter, const SG_Char *Default, bool bSave, bool bDirectory, bool bMultiple)
527{
528 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_FilePath, 0);
529
530 pParameter->asFilePath()->Set_Filter (Filter );
531 pParameter->asFilePath()->Set_Flag_Save (bSave );
532 pParameter->asFilePath()->Set_Flag_Multiple (bMultiple );
533 pParameter->asFilePath()->Set_Flag_Directory(bDirectory);
534
535 bool bCallback = Set_Callback(false);
536 pParameter->Set_Value (Default);
537 pParameter->Set_Default(Default);
538 Set_Callback(bCallback);
539
540 return( pParameter );
541}
542
543//---------------------------------------------------------
544CSG_Parameter * CSG_Parameters::Add_Colors(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Palette, int nColors, bool bRevert)
545{
546 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Colors, 0);
547
548 pParameter->asColors()->Create(nColors, Palette, bRevert);
549
550 return( pParameter );
551}
552
553CSG_Parameter * CSG_Parameters::Add_Colors(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Colors *pInit)
554{
555 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Colors, 0);
556
557 if( pInit )
558 {
559 pParameter->asColors()->Create(*pInit);
560 }
561
562 return( pParameter );
563}
564
565//---------------------------------------------------------
566CSG_Parameter * CSG_Parameters::Add_Font(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const SG_Char *pInit)
567{
568 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Font, 0);
569
570 if( pInit && *pInit )
571 {
572 bool bCallback = Set_Callback(false);
573 pParameter->Set_Value (pInit);
574 pParameter->Set_Default(pInit);
575 Set_Callback(bCallback);
576 }
577
578 return( pParameter );
579}
580
581//---------------------------------------------------------
582CSG_Parameter * CSG_Parameters::Add_FixedTable(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Table *pTemplate)
583{
584 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_FixedTable, 0);
585
586 pParameter->asTable()->Create(pTemplate);
587 pParameter->asTable()->Set_Name(Name);
588 pParameter->asTable()->Assign_Values(pTemplate);
589
590 return( pParameter );
591}
592
593
595// //
597
598//---------------------------------------------------------
599CSG_Parameter * CSG_Parameters::Add_Grid_Resampling(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Grid_Resampling Methods, CSG_Grid_Resampling Default)
600{
601 CSG_String Choices; int Choice = 0, nChoices = 0;
602
603 #define ADD_METHOD(method, name) if( ((int)Methods & (int)method) != 0 ) { if( !Choices.is_Empty() ) { Choices += "|"; } Choices += CSG_String::Format("{%d}", (int)method); Choices += name; if( method == Default ) { Choice = nChoices; } nChoices++; }
604
610 ADD_METHOD(CSG_Grid_Resampling::Mean_Cells , _TL("Mean Value (cell area weighted)"));
611 ADD_METHOD(CSG_Grid_Resampling::Minimum , _TL("Minimum Value"));
612 ADD_METHOD(CSG_Grid_Resampling::Maximum , _TL("Maximum Value"));
614
615 //-----------------------------------------------------
616 if( nChoices > 0 )
617 {
618 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Choice, 0);
619
620 pParameter->asChoice()->Set_Items(Choices);
621
622 bool bCallback = Set_Callback(false);
623 pParameter->Set_Value (Choice);
624 pParameter->Set_Default(Choice);
625 Set_Callback(bCallback);
626
627 return( pParameter );
628 }
629
630 return( NULL );
631}
632
633//---------------------------------------------------------
634CSG_Parameter * CSG_Parameters::Add_Grid_System(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Grid_System *pInit)
635{
636 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Grid_System, 0);
637
638 if( pInit )
639 {
640 pParameter->asGrid_System()->Assign(*pInit);
641 }
642
643 return( pParameter );
644}
645
646//---------------------------------------------------------
647CSG_Parameter * CSG_Parameters::Add_Grid(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, bool bSystem_Dependent, TSG_Data_Type Preferred_Type)
648{
649 CSG_String SystemID; CSG_Parameter *pParent = Get_Parameter(ParentID);
650
651 if( pParent && pParent->Get_Type() == PARAMETER_TYPE_Grid_System )
652 {
653 SystemID = pParent->Get_Identifier();
654 }
655 else if( bSystem_Dependent && m_pGrid_System )
656 {
657 SystemID = m_pGrid_System->Get_Identifier();
658 }
659 else
660 {
661 pParent = Add_Grid_System(pParent ? pParent->Get_Identifier() : SG_T(""), ID + "_GRIDSYSTEM", _TL("Grid system"), "");
662 SystemID = pParent->Get_Identifier();
663 }
664
665 CSG_Parameter *pParameter = _Add(SystemID, ID, Name, Description, PARAMETER_TYPE_Grid, Constraint);
666
667 ((CSG_Parameter_Grid *)pParameter)->Set_Preferred_Type(Preferred_Type);
668
669 return( pParameter );
670}
671
672//---------------------------------------------------------
673CSG_Parameter * CSG_Parameters::Add_Grid_or_Const(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value, double Minimum, bool bMinimum, double Maximum, bool bMaximum, bool bSystem_Dependent)
674{
675 CSG_Parameter *pParameter = Add_Grid(ParentID, ID, Name, Description, PARAMETER_INPUT_OPTIONAL, bSystem_Dependent);
676
677 ((CSG_Parameter_Grid *)pParameter)->Add_Default(Value, Minimum, bMinimum, Maximum, bMaximum);
678
679 return( pParameter );
680}
681
682//---------------------------------------------------------
683CSG_Parameter * CSG_Parameters::Add_Grid_Output(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
684{
685 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_DataObject_Output, PARAMETER_OUTPUT_OPTIONAL);
686
687 ((CSG_Parameter_Data_Object_Output *)pParameter)->Set_DataObject_Type(SG_DATAOBJECT_TYPE_Grid);
688
689 return( pParameter );
690}
691
692//---------------------------------------------------------
693CSG_Parameter * CSG_Parameters::Add_Grid_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, bool bSystem_Dependent)
694{
695 CSG_String SystemID; CSG_Parameter *pParent = Get_Parameter(ParentID);
696
697 if( pParent && pParent->Get_Type() == PARAMETER_TYPE_Grid_System )
698 {
699 SystemID = pParent->Get_Identifier();
700 }
701 else if( bSystem_Dependent && m_pGrid_System && !((Constraint & PARAMETER_OUTPUT) && (Constraint & PARAMETER_OPTIONAL)) )
702 {
703 SystemID = m_pGrid_System->Get_Identifier();
704 }
705
706 CSG_Parameter *pParameter = _Add(SystemID, ID, Name, Description, PARAMETER_TYPE_Grid_List, Constraint);
707
708 return( pParameter );
709}
710
711
713// //
715
716//---------------------------------------------------------
717CSG_Parameter * CSG_Parameters::Add_Grids(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, bool bSystem_Dependent, TSG_Data_Type Preferred_Type)
718{
719 CSG_String SystemID; CSG_Parameter *pParent = Get_Parameter(ParentID);
720
721 if( pParent && pParent->Get_Type() == PARAMETER_TYPE_Grid_System )
722 {
723 SystemID = pParent->Get_Identifier();
724 }
725 else if( bSystem_Dependent && m_pGrid_System )
726 {
727 SystemID = m_pGrid_System->Get_Identifier();
728 }
729 else
730 {
731 pParent = Add_Grid_System(pParent ? pParent->Get_Identifier() : SG_T(""), ID + "_GRIDSYSTEM", _TL("Grid system"), "");
732 SystemID = pParent->Get_Identifier();
733 }
734
735 CSG_Parameter *pParameter = _Add(SystemID, ID, Name, Description, PARAMETER_TYPE_Grids, Constraint);
736
737 ((CSG_Parameter_Grids *)pParameter)->Set_Preferred_Type(Preferred_Type);
738
739 return( pParameter );
740}
741
742//---------------------------------------------------------
743CSG_Parameter * CSG_Parameters::Add_Grids_Output(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
744{
745 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_DataObject_Output, PARAMETER_OUTPUT_OPTIONAL);
746
747 ((CSG_Parameter_Data_Object_Output *)pParameter)->Set_DataObject_Type(SG_DATAOBJECT_TYPE_Grids);
748
749 return( pParameter );
750}
751
752//---------------------------------------------------------
753CSG_Parameter * CSG_Parameters::Add_Grids_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, bool bSystem_Dependent)
754{
755 CSG_String SystemID; CSG_Parameter *pParent = Get_Parameter(ParentID);
756
757 if( pParent && pParent->Get_Type() == PARAMETER_TYPE_Grid_System )
758 {
759 SystemID = pParent->Get_Identifier();
760 }
761 else if( bSystem_Dependent && m_pGrid_System && !((Constraint & PARAMETER_OUTPUT) && (Constraint & PARAMETER_OPTIONAL)) )
762 {
763 SystemID = m_pGrid_System->Get_Identifier();
764 }
765
766 CSG_Parameter *pParameter = _Add(SystemID, ID, Name, Description, PARAMETER_TYPE_Grids_List, Constraint);
767
768 return( pParameter );
769}
770
771
773// //
775
776//---------------------------------------------------------
777CSG_Parameter * CSG_Parameters::Add_Table_Field(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool bAllowNone)
778{
779 CSG_Parameter *pParent = Get_Parameter(ParentID);
780
781 if( pParent && (
782 pParent->Get_Type() == PARAMETER_TYPE_Table
783 || pParent->Get_Type() == PARAMETER_TYPE_Shapes
784 || pParent->Get_Type() == PARAMETER_TYPE_TIN
785 || pParent->Get_Type() == PARAMETER_TYPE_PointCloud) )
786 {
787 return( _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Table_Field, bAllowNone ? PARAMETER_OPTIONAL : 0) );
788 }
789
790 return( NULL );
791}
792
793//---------------------------------------------------------
794CSG_Parameter * CSG_Parameters::Add_Table_Field_or_Const(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value, double Minimum, bool bMinimum, double Maximum, bool bMaximum)
795{
796 CSG_Parameter *pParameter = Add_Table_Field(ParentID, ID, Name, Description, true);
797
798 if( pParameter )
799 {
800 ((CSG_Parameter_Table_Field *)pParameter)->Add_Default(Value, Minimum, bMinimum, Maximum, bMaximum);
801 }
802
803 return( pParameter );
804}
805
806//---------------------------------------------------------
807CSG_Parameter * CSG_Parameters::Add_Table_Fields(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
808{
809 CSG_Parameter *pParent = Get_Parameter(ParentID);
810
811 if( pParent && (
812 pParent->Get_Type() == PARAMETER_TYPE_Table
813 || pParent->Get_Type() == PARAMETER_TYPE_Shapes
814 || pParent->Get_Type() == PARAMETER_TYPE_TIN
815 || pParent->Get_Type() == PARAMETER_TYPE_PointCloud) )
816 {
817 return( _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Table_Fields, 0) );
818 }
819
820 return( NULL );
821}
822
823//---------------------------------------------------------
824CSG_Parameter * CSG_Parameters::Add_Table(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
825{
826 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Table, Constraint);
827
828 return( pParameter );
829}
830
831//---------------------------------------------------------
832CSG_Parameter * CSG_Parameters::Add_Table_Output(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
833{
834 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_DataObject_Output, PARAMETER_OUTPUT_OPTIONAL);
835
836 ((CSG_Parameter_Data_Object_Output *)pParameter)->Set_DataObject_Type(SG_DATAOBJECT_TYPE_Table);
837
838 return( pParameter );
839}
840
841//---------------------------------------------------------
842CSG_Parameter * CSG_Parameters::Add_Table_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
843{
844 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Table_List, Constraint);
845
846 return( pParameter );
847}
848
849
851// //
853
854//---------------------------------------------------------
855CSG_Parameter * CSG_Parameters::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)
856{
857 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Shapes, Constraint);
858
859 ((CSG_Parameter_Shapes *)pParameter)->Set_Shape_Type(Shape_Type);
860
861 return( pParameter );
862}
863
864//---------------------------------------------------------
865CSG_Parameter * CSG_Parameters::Add_Shapes_Output(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
866{
867 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_DataObject_Output, PARAMETER_OUTPUT_OPTIONAL);
868
869 ((CSG_Parameter_Data_Object_Output *)pParameter)->Set_DataObject_Type(SG_DATAOBJECT_TYPE_Shapes);
870
871 return( pParameter );
872}
873
874//---------------------------------------------------------
875CSG_Parameter * CSG_Parameters::Add_Shapes_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, TSG_Shape_Type Type)
876{
877 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Shapes_List, Constraint);
878
879 ((CSG_Parameter_Shapes_List *)pParameter)->Set_Shape_Type(Type);
880
881 return( pParameter );
882}
883
884
886// //
888
889//---------------------------------------------------------
890CSG_Parameter * CSG_Parameters::Add_TIN(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
891{
892 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_TIN, Constraint);
893
894 return( pParameter );
895}
896
897//---------------------------------------------------------
898CSG_Parameter * CSG_Parameters::Add_TIN_Output(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
899{
900 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_DataObject_Output, PARAMETER_OUTPUT_OPTIONAL);
901
902 ((CSG_Parameter_Data_Object_Output *)pParameter)->Set_DataObject_Type(SG_DATAOBJECT_TYPE_TIN);
903
904 return( pParameter );
905}
906
907//---------------------------------------------------------
908CSG_Parameter * CSG_Parameters::Add_TIN_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
909{
910 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_TIN_List, Constraint);
911
912 return( pParameter );
913}
914
915
917// //
919
920//---------------------------------------------------------
921CSG_Parameter * CSG_Parameters::Add_PointCloud(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
922{
923 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_PointCloud, Constraint);
924
925 return( pParameter );
926}
927
928//---------------------------------------------------------
929CSG_Parameter * CSG_Parameters::Add_PointCloud_Output(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
930{
931 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_DataObject_Output, PARAMETER_OUTPUT_OPTIONAL);
932
933 ((CSG_Parameter_Data_Object_Output *)pParameter)->Set_DataObject_Type(SG_DATAOBJECT_TYPE_PointCloud);
934
935 return( pParameter );
936}
937
938//---------------------------------------------------------
939CSG_Parameter * CSG_Parameters::Add_PointCloud_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
940{
941 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_PointCloud_List, Constraint);
942
943 return( pParameter );
944}
945
946
948// //
950
951//---------------------------------------------------------
952CSG_Parameter * CSG_Parameters::Add_Parameters(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
953{
954 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Parameters, 0);
955
956 pParameter->asParameters()->m_Callback = m_Callback;
957 pParameter->asParameters()->m_pTool = m_pTool;
958
959 return( pParameter );
960}
961
962
964// //
966
967//---------------------------------------------------------
968CSG_Parameter * CSG_Parameters::_Add_Value(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool bInformation, TSG_Parameter_Type Type, double Value, double Minimum, bool bMinimum, double Maximum, bool bMaximum)
969{
970 switch( Type ) // Check if Type is valid...
971 {
973 case PARAMETER_TYPE_Int :
978 break;
979
980 default: // if not valid set Type to [double]...
982 }
983
984 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, Type, bInformation ? PARAMETER_INFORMATION : 0);
985
986 bool bCallback = Set_Callback(false);
987
988 if( !bInformation )
989 {
990 if( Type == PARAMETER_TYPE_Int
991 || Type == PARAMETER_TYPE_Double
992 || Type == PARAMETER_TYPE_Degree )
993 {
994 pParameter->asValue()->Set_Minimum(Minimum, bMinimum);
995 pParameter->asValue()->Set_Maximum(Maximum, bMaximum);
996 }
997 }
998
999 pParameter->Set_Value(Value);
1000
1001 Set_Callback(bCallback);
1002
1003 if( !bInformation )
1004 {
1005 switch( Type )
1006 {
1007 case PARAMETER_TYPE_Bool :
1008 case PARAMETER_TYPE_Int :
1010 pParameter->Set_Default((int)Value);
1011 break;
1012
1013 case PARAMETER_TYPE_Date :
1014 pParameter->Set_Default(pParameter->asString());
1015 break;
1016
1017 default:
1018 pParameter->Set_Default( Value);
1019 }
1020 }
1021
1022 return( pParameter );
1023}
1024
1025//---------------------------------------------------------
1026CSG_Parameter * CSG_Parameters::_Add_Range(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool bInformation, double Default_Min, double Default_Max, double Minimum, bool bMinimum, double Maximum, bool bMaximum)
1027{
1028 //-----------------------------------------------------
1029 if( Default_Min > Default_Max )
1030 {
1031 double d = Default_Min;
1032 Default_Min = Default_Max;
1033 Default_Max = d;
1034 }
1035
1036 //-----------------------------------------------------
1037 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, PARAMETER_TYPE_Range, bInformation ? PARAMETER_INFORMATION : 0);
1038
1039 pParameter->asRange()->Get_Min_Parameter()->Set_Minimum(Minimum, bMinimum);
1040 pParameter->asRange()->Get_Min_Parameter()->Set_Maximum(Maximum, bMaximum);
1041 pParameter->asRange()->Get_Min_Parameter()->Set_Default(Default_Min);
1042 pParameter->asRange()->Set_Min(Default_Min);
1043
1044 pParameter->asRange()->Get_Max_Parameter()->Set_Minimum(Minimum, bMinimum);
1045 pParameter->asRange()->Get_Max_Parameter()->Set_Maximum(Maximum, bMaximum);
1046 pParameter->asRange()->Get_Max_Parameter()->Set_Default(Default_Max);
1047 pParameter->asRange()->Set_Max(Default_Max);
1048
1049 return( pParameter );
1050}
1051
1052//---------------------------------------------------------
1053CSG_Parameter * CSG_Parameters::_Add_String(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool bInformation, const SG_Char *String, bool bLongText, bool bPassword)
1054{
1055 CSG_Parameter *pParameter = _Add(ParentID, ID, Name, Description, bLongText ? PARAMETER_TYPE_Text : PARAMETER_TYPE_String, bInformation ? PARAMETER_INFORMATION : 0);
1056
1057 bool bCallback = Set_Callback(false);
1058 pParameter->Set_Value (String);
1059 pParameter->Set_Default(String);
1060 Set_Callback(bCallback);
1061
1062 ((CSG_Parameter_String *)pParameter)->Set_Password(bPassword);
1063
1064 return( pParameter );
1065}
1066
1067
1069// //
1071
1072//---------------------------------------------------------
1073#ifdef _DEBUG
1074#include <wx/debug.h>
1075#include <wx/string.h>
1076#endif
1077
1078//---------------------------------------------------------
1079CSG_Parameter * CSG_Parameters::_Add(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, TSG_Parameter_Type Type, int Constraint)
1080{
1081#ifdef _DEBUG
1082 wxASSERT_MSG(!ID.is_Empty() , wxString::Format("CSG_Parameter::_Add(): Parameter ID is empty!"));
1083 wxASSERT_MSG(!Get_Parameter(ID), wxString::Format("CSG_Parameter::_Add(): Parameter ID \"%s\" is already in use!", ID.c_str()));
1084#endif
1085
1086 CSG_Parameter *pParameter;
1087
1088 switch( Type )
1089 {
1090 default:
1091 return( NULL );
1092
1093 case PARAMETER_TYPE_Node : pParameter = new CSG_Parameter_Node (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1094
1095 case PARAMETER_TYPE_Bool : pParameter = new CSG_Parameter_Bool (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1096 case PARAMETER_TYPE_Int : pParameter = new CSG_Parameter_Int (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1097 case PARAMETER_TYPE_Double : pParameter = new CSG_Parameter_Double (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1098 case PARAMETER_TYPE_Degree : pParameter = new CSG_Parameter_Degree (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1099 case PARAMETER_TYPE_Date : pParameter = new CSG_Parameter_Date (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1100 case PARAMETER_TYPE_Range : pParameter = new CSG_Parameter_Range (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1101 case PARAMETER_TYPE_Data_Type : pParameter = new CSG_Parameter_Data_Type (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1102 case PARAMETER_TYPE_Choice : pParameter = new CSG_Parameter_Choice (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1103 case PARAMETER_TYPE_Choices : pParameter = new CSG_Parameter_Choices (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1104
1105 case PARAMETER_TYPE_String : pParameter = new CSG_Parameter_String (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1106 case PARAMETER_TYPE_Text : pParameter = new CSG_Parameter_Text (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1107 case PARAMETER_TYPE_FilePath : pParameter = new CSG_Parameter_File_Name (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1108
1109 case PARAMETER_TYPE_Font : pParameter = new CSG_Parameter_Font (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1110 case PARAMETER_TYPE_Color : pParameter = new CSG_Parameter_Color (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1111 case PARAMETER_TYPE_Colors : pParameter = new CSG_Parameter_Colors (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1112 case PARAMETER_TYPE_FixedTable : pParameter = new CSG_Parameter_Fixed_Table (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1113 case PARAMETER_TYPE_Grid_System : pParameter = new CSG_Parameter_Grid_System (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1114 case PARAMETER_TYPE_Table_Field : pParameter = new CSG_Parameter_Table_Field (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1115 case PARAMETER_TYPE_Table_Fields : pParameter = new CSG_Parameter_Table_Fields (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1116
1117 case PARAMETER_TYPE_DataObject_Output: pParameter = new CSG_Parameter_Data_Object_Output(this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1118 case PARAMETER_TYPE_Grid : pParameter = new CSG_Parameter_Grid (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1119 case PARAMETER_TYPE_Grids : pParameter = new CSG_Parameter_Grids (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1120 case PARAMETER_TYPE_Table : pParameter = new CSG_Parameter_Table (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1121 case PARAMETER_TYPE_Shapes : pParameter = new CSG_Parameter_Shapes (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1122 case PARAMETER_TYPE_TIN : pParameter = new CSG_Parameter_TIN (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1123 case PARAMETER_TYPE_PointCloud : pParameter = new CSG_Parameter_PointCloud (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1124
1125 case PARAMETER_TYPE_Grid_List : pParameter = new CSG_Parameter_Grid_List (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1126 case PARAMETER_TYPE_Grids_List : pParameter = new CSG_Parameter_Grids_List (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1127 case PARAMETER_TYPE_Table_List : pParameter = new CSG_Parameter_Table_List (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1128 case PARAMETER_TYPE_Shapes_List : pParameter = new CSG_Parameter_Shapes_List (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1129 case PARAMETER_TYPE_TIN_List : pParameter = new CSG_Parameter_TIN_List (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1130 case PARAMETER_TYPE_PointCloud_List : pParameter = new CSG_Parameter_PointCloud_List (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1131
1132 case PARAMETER_TYPE_Parameters : pParameter = new CSG_Parameter_Parameters (this, Get_Parameter(ParentID), ID, Name, Description, Constraint); break;
1133 }
1134
1135 m_Parameters = (CSG_Parameter **)SG_Realloc(m_Parameters, (m_nParameters + 1) * sizeof(CSG_Parameter *));
1136 m_Parameters[m_nParameters++] = pParameter;
1137
1138 pParameter->_Set_String();
1139
1140 return( pParameter );
1141}
1142
1143//---------------------------------------------------------
1144CSG_Parameter * CSG_Parameters::_Add(CSG_Parameter *pSource)
1145{
1146 CSG_Parameter *pParameter = !pSource ? NULL : _Add(
1147 pSource->Get_Parent() ? pSource->Get_Parent()->Get_Identifier() : SG_T(""),
1148 pSource->Get_Identifier (),
1149 pSource->Get_Name (),
1150 pSource->Get_Description(),
1151 pSource->Get_Type (),
1152 pSource->m_Constraint
1153 );
1154
1155 if( pParameter )
1156 {
1157 pParameter->Assign(pSource);
1158 }
1159
1160 return( pParameter );
1161}
1162
1163
1165// //
1167
1168//---------------------------------------------------------
1169CSG_Parameter * CSG_Parameters::Get_Parameter(int i, bool MsgOnError) const
1170{
1171 if( i >= 0 && i < m_nParameters )
1172 {
1173 return( m_Parameters[i] );
1174 }
1175
1176 if( MsgOnError )
1177 {
1178 SG_UI_Msg_Add_Error(CSG_String::Format("%s index=[%d]", _TL("Could not find requested parameter!"), i));
1179 }
1180
1181 return( NULL );
1182}
1183
1184//---------------------------------------------------------
1185CSG_Parameter * CSG_Parameters::Get_Parameter(const char *ID, bool MsgOnError) const { return( Get_Parameter(CSG_String(ID), MsgOnError) ); }
1186CSG_Parameter * CSG_Parameters::Get_Parameter(const wchar_t *ID, bool MsgOnError) const { return( Get_Parameter(CSG_String(ID), MsgOnError) ); }
1187CSG_Parameter * CSG_Parameters::Get_Parameter(const CSG_String &ID, bool MsgOnError) const
1188{
1189 if( m_Parameters && !ID.is_Empty() )
1190 {
1191 for(int i=0; i<m_nParameters; i++)
1192 {
1193 if( m_Parameters[i]->Cmp_Identifier(ID) )
1194 {
1195 return( m_Parameters[i] );
1196 }
1197 }
1198
1199 //-------------------------------------------------
1200 if( ID.Find('.') > 0 ) // id not found? check for sub-parameter ('id.id')!
1201 {
1202 CSG_Parameter *pParameter = Get_Parameter(ID.BeforeFirst('.'));
1203
1204 if( pParameter )
1205 {
1206 switch( pParameter->Get_Type() )
1207 {
1209 return( pParameter->asParameters()->Get_Parameter(ID.AfterFirst('.')) );
1210
1212 if( !ID.AfterFirst('.').CmpNoCase("min") || !ID.AfterFirst('.').CmpNoCase("minimum") )
1213 {
1214 return( pParameter->asRange()->Get_Min_Parameter() );
1215 }
1216
1217 if( !ID.AfterFirst('.').CmpNoCase("max") || !ID.AfterFirst('.').CmpNoCase("maximum") )
1218 {
1219 return( pParameter->asRange()->Get_Max_Parameter() );
1220 }
1221 break;
1222
1223 default:
1224 break;
1225 }
1226 }
1227 }
1228
1229 //-------------------------------------------------
1230 if( MsgOnError )
1231 {
1232 SG_UI_Msg_Add_Error(CSG_String::Format("%s id=[%s]", _TL("Could not find requested parameter!"), ID.c_str()));
1233 }
1234 }
1235
1236 return( NULL );
1237}
1238
1239//---------------------------------------------------------
1241{
1242 if( m_Parameters && iParameter >= 0 && iParameter < m_nParameters )
1243 {
1244 CSG_Parameter *pParameter = m_Parameters[iParameter];
1245
1246 for(m_nParameters--; iParameter<m_nParameters; iParameter++)
1247 {
1248 m_Parameters[iParameter] = m_Parameters[iParameter + 1];
1249 }
1250
1251 m_Parameters = (CSG_Parameter **)SG_Realloc(m_Parameters, m_nParameters * sizeof(CSG_Parameter *));
1252
1253 for(iParameter=pParameter->Get_Children_Count()-1; iParameter>=0; iParameter--)
1254 {
1255 Del_Parameter(pParameter->Get_Child(iParameter)->Get_Identifier());
1256 }
1257
1258 CSG_Parameter *pParent = pParameter->Get_Parent();
1259
1260 if( pParent )
1261 {
1262 for(iParameter=0; iParameter<pParent->m_nChildren; iParameter++)
1263 {
1264 if( pParent->m_Children[iParameter] == pParameter )
1265 {
1266 pParent->m_nChildren--;
1267
1268 for( ; iParameter<pParent->m_nChildren; iParameter++)
1269 {
1270 pParent->m_Children[iParameter] = pParent->m_Children[iParameter + 1];
1271 }
1272 }
1273 }
1274
1275 pParent->m_Children = (CSG_Parameter **)SG_Realloc(pParent->m_Children, pParent->m_nChildren * sizeof(CSG_Parameter *));
1276 }
1277
1278 delete(pParameter);
1279
1280 return( true );
1281 }
1282
1283 return( false );
1284}
1285
1286//---------------------------------------------------------
1288{
1289 if( m_Parameters && Identifier.Length() )
1290 {
1291 for(int i=0; i<m_nParameters; i++)
1292 {
1293 if( !m_Parameters[i]->m_Identifier.Cmp(Identifier) )
1294 {
1295 return( Del_Parameter(i) );
1296 }
1297 }
1298 }
1299
1300 return( false );
1301}
1302
1303//---------------------------------------------------------
1305{
1306 if( m_nParameters > 0 )
1307 {
1308 m_pGrid_System = NULL;
1309
1310 for(int i=0; i<m_nParameters; i++)
1311 {
1312 delete(m_Parameters[i]);
1313 }
1314
1315 SG_Free(m_Parameters);
1316
1317 m_Parameters = NULL;
1318 m_nParameters = 0;
1319 }
1320
1321 return( true );
1322}
1323
1324
1326// //
1327// Callback //
1328// //
1330
1331//---------------------------------------------------------
1332// Callback function used to react on parameter changes.
1333// Return value is the previously set callback function.
1335{
1336 TSG_PFNC_Parameter_Changed Previous = m_Callback;
1337
1338 m_Callback = Callback;
1339
1340 for(int i=0; i<m_nParameters; i++)
1341 {
1342 if( m_Parameters[i]->Get_Type() == PARAMETER_TYPE_Parameters)
1343 {
1344 m_Parameters[i]->asParameters()->Set_Callback_On_Parameter_Changed(Callback);
1345 }
1346 }
1347
1348 return( Previous );
1349}
1350
1351//---------------------------------------------------------
1352// If switched off parameter changes will not invoke a
1353// consecutive call to the On_Parameter_Changed function.
1354// Return value is the previous state.
1356{
1357 bool bPrevious = m_bCallback;
1358
1359 m_bCallback = bActive;
1360
1361 for(int i=0; i<m_nParameters; i++)
1362 {
1363 if( m_Parameters[i]->Get_Type() == PARAMETER_TYPE_Parameters)
1364 {
1365 m_Parameters[i]->asParameters()->Set_Callback(bActive);
1366 }
1367 }
1368
1369 return( bPrevious );
1370}
1371
1372//---------------------------------------------------------
1373bool CSG_Parameters::_On_Parameter_Changed(CSG_Parameter *pParameter, int Flags)
1374{
1375 if( m_Callback && m_bCallback )
1376 {
1377 bool bCallback = Set_Callback(false);
1378
1379 m_Callback(pParameter, Flags);
1380
1381 Set_Callback(bCallback);
1382
1383 return( true );
1384 }
1385
1386 return( false );
1387}
1388
1389
1391// //
1393
1394//---------------------------------------------------------
1395bool CSG_Parameters::Set_Parameter(const char *ID, CSG_Parameter *pValue) { return( Set_Parameter(CSG_String(ID), pValue) ); }
1396bool CSG_Parameters::Set_Parameter(const wchar_t *ID, CSG_Parameter *pValue) { return( Set_Parameter(CSG_String(ID), pValue) ); }
1398{
1399 CSG_Parameter *pTarget = Get_Parameter(ID);
1400
1401 return( pTarget && pValue && pTarget->Get_Type() == pValue->Get_Type() && pTarget->Assign(pValue) );
1402}
1403
1404//---------------------------------------------------------
1405bool CSG_Parameters::Set_Parameter(const char *ID, void *Value, int Type) { return( Set_Parameter(CSG_String(ID), Value, Type) ); }
1406bool CSG_Parameters::Set_Parameter(const wchar_t *ID, void *Value, int Type) { return( Set_Parameter(CSG_String(ID), Value, Type) ); }
1407bool CSG_Parameters::Set_Parameter(const CSG_String &ID, void *Value, int Type)
1408{
1409 CSG_Parameter *pTarget = Get_Parameter(ID);
1410
1411 return( pTarget && (Type == PARAMETER_TYPE_Undefined || Type == pTarget->Get_Type()) && pTarget->Set_Value(Value) );
1412}
1413
1414//---------------------------------------------------------
1415bool CSG_Parameters::Set_Parameter(const char *ID, CSG_Data_Object *Value, int Type) { return( Set_Parameter(CSG_String(ID), Value, Type) ); }
1416bool CSG_Parameters::Set_Parameter(const wchar_t *ID, CSG_Data_Object *Value, int Type) { return( Set_Parameter(CSG_String(ID), Value, Type) ); }
1418{
1419 CSG_Parameter *pTarget = Get_Parameter(ID);
1420
1421 return( pTarget && (Type == PARAMETER_TYPE_Undefined || Type == pTarget->Get_Type()) && pTarget->Set_Value(Value) );
1422}
1423
1424//---------------------------------------------------------
1425bool CSG_Parameters::Set_Parameter(const char *ID, int Value, int Type) { return( Set_Parameter(CSG_String(ID), Value, Type) ); }
1426bool CSG_Parameters::Set_Parameter(const wchar_t *ID, int Value, int Type) { return( Set_Parameter(CSG_String(ID), Value, Type) ); }
1427bool CSG_Parameters::Set_Parameter(const CSG_String &ID, int Value, int Type)
1428{
1429 CSG_Parameter *pTarget = Get_Parameter(ID);
1430
1431 return( pTarget && (Type == PARAMETER_TYPE_Undefined || Type == pTarget->Get_Type()) && pTarget->Set_Value(Value) );
1432}
1433
1434//---------------------------------------------------------
1435bool CSG_Parameters::Set_Parameter(const char *ID, double Value, int Type) { return( Set_Parameter(CSG_String(ID), Value, Type) ); }
1436bool CSG_Parameters::Set_Parameter(const wchar_t *ID, double Value, int Type) { return( Set_Parameter(CSG_String(ID), Value, Type) ); }
1437bool CSG_Parameters::Set_Parameter(const CSG_String &ID, double Value, int Type)
1438{
1439 CSG_Parameter *pTarget = Get_Parameter(ID);
1440
1441 return( pTarget && (Type == PARAMETER_TYPE_Undefined || Type == pTarget->Get_Type()) && pTarget->Set_Value(Value) );
1442}
1443
1444//---------------------------------------------------------
1445bool CSG_Parameters::Set_Parameter(const char *ID, const CSG_String &Value, int Type) { return( Set_Parameter(CSG_String(ID), Value, Type) ); }
1446bool CSG_Parameters::Set_Parameter(const wchar_t *ID, const CSG_String &Value, int Type) { return( Set_Parameter(CSG_String(ID), Value, Type) ); }
1447bool CSG_Parameters::Set_Parameter(const CSG_String &ID, const CSG_String &Value, int Type)
1448{
1449 CSG_Parameter *pTarget = Get_Parameter(ID);
1450
1451 return( pTarget && (Type == PARAMETER_TYPE_Undefined || Type == pTarget->Get_Type()) && pTarget->Set_Value(Value) );
1452}
1453
1454//---------------------------------------------------------
1455bool CSG_Parameters::Set_Parameter(const CSG_String &ID, const char *Value, int Type) { return( Set_Parameter(ID, CSG_String(Value)) ); }
1456bool CSG_Parameters::Set_Parameter(const char *ID, const char *Value, int Type) { return( Set_Parameter(ID, CSG_String(Value)) ); }
1457bool CSG_Parameters::Set_Parameter(const wchar_t *ID, const char *Value, int Type) { return( Set_Parameter(ID, CSG_String(Value)) ); }
1458
1459//---------------------------------------------------------
1460bool CSG_Parameters::Set_Parameter(const CSG_String &ID, const wchar_t *Value, int Type) { return( Set_Parameter(ID, CSG_String(Value)) ); }
1461bool CSG_Parameters::Set_Parameter(const char *ID, const wchar_t *Value, int Type) { return( Set_Parameter(ID, CSG_String(Value)) ); }
1462bool CSG_Parameters::Set_Parameter(const wchar_t *ID, const wchar_t *Value, int Type) { return( Set_Parameter(ID, CSG_String(Value)) ); }
1463
1464
1466// //
1468
1469//---------------------------------------------------------
1471{
1472 Set_Callback(false);
1473
1474 for(int i=0; i<Get_Count(); i++)
1475 {
1476 m_Parameters[i]->Restore_Default();
1477
1478 if( bClearData )
1479 {
1480 if( m_Parameters[i]->is_DataObject() )
1481 {
1482 m_Parameters[i]->Set_Value(DATAOBJECT_NOTSET);
1483 }
1484 else if( m_Parameters[i]->is_DataObject_List() )
1485 {
1486 m_Parameters[i]->asList()->Del_Items();
1487 }
1488 }
1489 }
1490
1491 Set_Callback(true);
1492
1493 return( true );
1494}
1495
1496
1498// //
1500
1501//---------------------------------------------------------
1503{
1504 return( pSource && pSource != this && Create(*pSource) );
1505}
1506
1507//---------------------------------------------------------
1509{
1510 if( !pSource || pSource == this )
1511 {
1512 return( false );
1513 }
1514
1515 //-----------------------------------------------------
1516 int n = 0;
1517
1518 for(int i=0; i<pSource->Get_Count(); i++)
1519 {
1520 CSG_Parameter *pParameter = Get_Parameter(pSource->Get_Parameter(i)->Get_Identifier());
1521
1522 if( pParameter && pParameter->Get_Type() == pSource->Get_Parameter(i)->Get_Type() )
1523 {
1524 n++; pParameter->Assign(pSource->Get_Parameter(i));
1525 }
1526 }
1527
1528 return( n > 0 );
1529}
1530
1531//---------------------------------------------------------
1533{
1534 if( !pSource || pSource == this )
1535 {
1536 return( false );
1537 }
1538
1540
1541 //-----------------------------------------------------
1542 for(int i=0; i<pSource->m_nParameters; i++)
1543 {
1544 _Add(pSource->m_Parameters[i]);
1545
1546 if( m_Parameters[i]->asParameters() )
1547 {
1548 m_Parameters[i]->asParameters()->Set_Tool(m_pTool);
1549 }
1550 }
1551
1552 if( pSource->m_pGrid_System )
1553 {
1554 m_pGrid_System = Get_Parameter(pSource->m_pGrid_System->Get_Identifier());
1555 }
1556
1557 return( m_nParameters == pSource->m_nParameters );
1558}
1559
1560
1562// //
1564
1565//---------------------------------------------------------
1567{
1568 bool bResult = true; CSG_String sError;
1569
1570 //-----------------------------------------------------
1571 for(int i=0; i<Get_Count(); i++)
1572 {
1573 if( m_Parameters[i]->Check(bSilent) == false )
1574 {
1575 bResult = false;
1576
1577 sError.Append(CSG_String::Format("\n%s: %s", m_Parameters[i]->Get_Type_Name().c_str(), m_Parameters[i]->Get_Name()));
1578 }
1579 }
1580
1581 //-----------------------------------------------------
1582 if( !bResult && !bSilent )
1583 {
1584 SG_UI_Dlg_Message(CSG_String::Format("%s\n%s", _TL("invalid input!"), sError.c_str()), Get_Name() );
1585 }
1586
1587 return( bResult );
1588}
1589
1590//---------------------------------------------------------
1591bool CSG_Parameters::DataObjects_Create(void)
1592{
1593 bool bResult = true;
1594
1595 for(int i=0; bResult && i<Get_Count(); i++)
1596 {
1597 CSG_Parameter &P = *m_Parameters[i];
1598
1599 //-------------------------------------------------
1601 {
1602 if( !P.asParameters()->DataObjects_Create() )
1603 {
1604 bResult = false;
1605 }
1606 }
1607 else if( P.is_Input() )
1608 {
1609 if( P.is_Enabled() && P.Check(true) == false )
1610 {
1611 bResult = false;
1612
1613 SG_UI_Dlg_Message(CSG_String::Format("%s\n[%s]\n%s", _TL("Input Error"), P.Get_Identifier(), P.Get_Name()), Get_Name());
1614 }
1615 }
1616
1617 //-------------------------------------------------
1618 else if( P.is_DataObject_List() )
1619 {
1620 for(int j=P.asList()->Get_Item_Count()-1; j>=0; j--)
1621 {
1622 if( m_pManager && !m_pManager->Exists(P.asList()->Get_Item(j)) )
1623 {
1624 P.asList()->Del_Item(j);
1625 }
1626 }
1627 }
1628
1629 //-------------------------------------------------
1630 else if( P.is_DataObject() && P.is_Enabled() == false && has_GUI() )
1631 {
1632 if( P.asDataObject() != DATAOBJECT_CREATE && (m_pManager && !m_pManager->Exists(P.asDataObject())) )
1633 {
1635 }
1636 }
1637
1638 else if( P.is_DataObject() )
1639 {
1640 CSG_Data_Object *pObject = P.asDataObject();
1641
1642 if( pObject != DATAOBJECT_CREATE )
1643 {
1645 {
1646 pObject = (CSG_Data_Object *)DATAOBJECT_CREATE;
1647 }
1648 else if( m_pManager && !m_pManager->Exists(pObject) )
1649 {
1650 pObject = (CSG_Data_Object *)DATAOBJECT_NOTSET;
1651 }
1652
1653 if( pObject == DATAOBJECT_NOTSET && !P.is_Optional() )
1654 {
1655 pObject = (CSG_Data_Object *)DATAOBJECT_CREATE;
1656 }
1657 }
1658
1659 if( pObject == DATAOBJECT_CREATE )
1660 {
1661 switch( P.Get_DataObject_Type() )
1662 {
1663 case SG_DATAOBJECT_TYPE_Table : pObject = SG_Create_Table (); break;
1664 case SG_DATAOBJECT_TYPE_Shapes : pObject = SG_Create_Shapes (); break;
1665 case SG_DATAOBJECT_TYPE_PointCloud: pObject = SG_Create_PointCloud(); break;
1666 case SG_DATAOBJECT_TYPE_TIN : pObject = SG_Create_TIN (); break;
1667 case SG_DATAOBJECT_TYPE_Grid : pObject = SG_Create_Grid (); break;
1668 case SG_DATAOBJECT_TYPE_Grids : pObject = SG_Create_Grids (); break;
1669 default : pObject = NULL ; break;
1670 }
1671 }
1672
1673 if( pObject )
1674 {
1676 && ((CSG_Parameter_Shapes *)&P)->Get_Shape_Type() != SHAPE_TYPE_Undefined
1677 && ((CSG_Parameter_Shapes *)&P)->Get_Shape_Type() != pObject->asShapes()->Get_Type() )
1678 {
1679 if( has_GUI() && pObject->asShapes()->Get_Type() != SHAPE_TYPE_Undefined )
1680 {
1681 pObject = SG_Create_Shapes (((CSG_Parameter_Shapes *)&P)->Get_Shape_Type());
1682 }
1683 else
1684 {
1685 pObject->asShapes()->Create(((CSG_Parameter_Shapes *)&P)->Get_Shape_Type());
1686 }
1687 }
1688
1690 {
1691 if( P.Get_Parent() && P.Get_Parent()->asGrid_System() && P.Get_Parent()->asGrid_System()->is_Valid() )
1692 {
1693 CSG_Grid_System System(*P.Get_Parent()->asGrid_System());
1694
1695 if( P.Get_Type() == PARAMETER_TYPE_Grid && !System.is_Equal(pObject->asGrid ()->Get_System()) )
1696 {
1697 pObject->asGrid ()->Create(System , ((CSG_Parameter_Grid *)&P)->Get_Preferred_Type());
1698 }
1699
1700 if( P.Get_Type() == PARAMETER_TYPE_Grids && !System.is_Equal(pObject->asGrids()->Get_System()) )
1701 {
1702 pObject->asGrids()->Create(System, 0, 0., ((CSG_Parameter_Grids *)&P)->Get_Preferred_Type());
1703 }
1704 }
1705 }
1706
1707 if( P.Set_Value(pObject) )
1708 {
1709 pObject->Set_Name(P.Get_Name());
1710 pObject->Get_MetaData().Del_Children();
1711
1712 if( m_pManager )
1713 {
1714 m_pManager->Add(pObject);
1715 }
1716 }
1717 else
1718 {
1719 delete(pObject);
1720
1721 bResult = false;
1722
1723 SG_UI_Dlg_Message(CSG_String::Format("%s\n[%s]\n%s", _TL("Output Error"), P.Get_Identifier(), P.Get_Name()), Get_Name());
1724 }
1725 }
1726 else // if( pObject == NULL )
1727 {
1728 if( !P.is_Optional() )
1729 {
1730 bResult = false;
1731
1732 SG_UI_Dlg_Message(CSG_String::Format("%s\n[%s]\n%s", _TL("Output Error"), P.Get_Identifier(), P.Get_Name()), Get_Name());
1733 }
1734 }
1735 }
1736 }
1737
1738 return( bResult );
1739}
1740
1741//---------------------------------------------------------
1742bool CSG_Parameters::DataObjects_Synchronize(void)
1743{
1744 for(int i=0; i<Get_Count(); i++)
1745 {
1746 CSG_Parameter &P = *m_Parameters[i];
1747
1749 {
1750 P.asParameters()->DataObjects_Synchronize();
1751 }
1752
1753 //-------------------------------------------------
1754 else if( P.is_Output() )
1755 {
1756 if( P.is_DataObject() )
1757 {
1758 CSG_Data_Object *pObject = P.asDataObject();
1759
1760 if( pObject == DATAOBJECT_CREATE )
1761 {
1763 }
1764 else if( pObject != DATAOBJECT_NOTSET )
1765 {
1766 if( pObject->asShapes() && pObject->asShapes()->Get_Type() == SHAPE_TYPE_Undefined
1767 && (m_pManager == &SG_Get_Data_Manager() || !SG_Get_Data_Manager().Exists(pObject)) )
1768 {
1769 if( m_pManager && !m_pManager->Delete(pObject) )
1770 {
1771 delete(pObject);
1772 }
1773
1775 }
1776 else
1777 {
1778 if( m_pManager )
1779 {
1780 m_pManager->Add(pObject);
1781
1782 if( m_pManager == &SG_Get_Data_Manager() )
1783 {
1784 SG_UI_DataObject_Add(pObject, 0);
1785 }
1786 }
1787
1789 }
1790 }
1791 }
1792
1793 //---------------------------------------------
1794 else if( P.is_DataObject_List() )
1795 {
1796 for(int j=0; j<P.asList()->Get_Item_Count(); j++)
1797 {
1798 CSG_Data_Object *pObject = P.asList()->Get_Item(j);
1799
1800 if( m_pManager )
1801 {
1802 m_pManager->Add(pObject);
1803
1804 if( m_pManager == &SG_Get_Data_Manager() )
1805 {
1806 SG_UI_DataObject_Add(pObject, 0);
1807 }
1808 }
1809
1811 }
1812 }
1813 }
1814 }
1815
1816 return( true );
1817}
1818
1819//---------------------------------------------------------
1820bool CSG_Parameters::DataObjects_Get_Projection(CSG_Projection &Projection) const
1821{
1822 for(int i=0; i<Get_Count() && !Projection.is_Okay(); i++)
1823 {
1824 CSG_Parameter *p = m_Parameters[i];
1825
1826 if( p->is_Enabled() && !p->ignore_Projection() )
1827 {
1829 {
1830 p->asParameters()->DataObjects_Get_Projection(Projection);
1831 }
1832 else if( p->is_Input() )
1833 {
1834 if( p->is_DataObject()
1836 && p->asDataObject() != DATAOBJECT_CREATE )
1837 {
1839 }
1840 else if( p->is_DataObject_List() )
1841 {
1842 for(int j=0; j<p->asList()->Get_Item_Count() && !Projection.is_Okay(); j++)
1843 {
1845 }
1846 }
1847 }
1848 }
1849 }
1850
1851 return( Projection.is_Okay() );
1852}
1853
1854//---------------------------------------------------------
1855bool CSG_Parameters::DataObjects_Set_Projection(const CSG_Projection &Projection)
1856{
1857 if( !Projection.is_Okay() )
1858 {
1859 return( false );
1860 }
1861
1862 for(int i=0; i<Get_Count(); i++)
1863 {
1864 CSG_Parameter *p = m_Parameters[i];
1865
1866 if( !p->ignore_Projection() )
1867 {
1869 {
1870 p->asParameters()->DataObjects_Set_Projection(Projection);
1871 }
1872 else if( p->is_Output() )
1873 {
1874 if( p->is_DataObject()
1876 && p->asDataObject() != DATAOBJECT_CREATE )
1877 {
1879 }
1880 else if( p->is_DataObject_List() )
1881 {
1882 for(int j=0; j<p->asList()->Get_Item_Count(); j++)
1883 {
1885 }
1886 }
1887 }
1888 }
1889 }
1890
1891 return( true );
1892}
1893
1894
1896// //
1898
1899//---------------------------------------------------------
1900bool CSG_Parameters::Get_String(CSG_String &String, bool bOptionsOnly)
1901{
1902 bool bResult = false;
1903
1904 if( Get_Count() > 0 )
1905 {
1906 if( m_pGrid_System )
1907 {
1908 m_pGrid_System->_Set_String();
1909
1910 String += CSG_String::Format("%s: %s\n", m_pGrid_System->Get_Name(), m_pGrid_System->asString());
1911 }
1912
1913 for(int i=0; i<Get_Count(); i++)
1914 {
1915 CSG_Parameter &P = *m_Parameters[i];
1916
1917 if( (!bOptionsOnly || P.is_Option()) && !P.asGrid_System() && P.is_Enabled() && !P.is_Information() && !(P.Get_Type() == PARAMETER_TYPE_String && ((CSG_Parameter_String *)&P)->is_Password()) )
1918 {
1919 bResult = true;
1920
1921 P._Set_String(); // forcing update (at scripting level some parameter types can be changed without the Set_Parameter() mechanism)
1922
1923 CSG_String s(P.asString()); if( s.Length() > 256 ) { s = s.Left(256) + "..."; }
1924
1925 String += CSG_String::Format("%s: %s\n", P.Get_Name(), s.c_str());
1926 }
1927 }
1928 }
1929
1930 return( bResult );
1931}
1932
1933//---------------------------------------------------------
1934bool CSG_Parameters::Msg_String(bool bOptionsOnly)
1935{
1936 CSG_String Message;
1937
1938 if( Get_String(Message, bOptionsOnly) )
1939 {
1940 SG_UI_Msg_Add_Execution(CSG_String::Format("\n__________\n[%s] %s:\n", m_Name.c_str(),
1941 bOptionsOnly ? _TL("Options") : _TL("Parameters")),
1943 );
1944
1946
1947 return( true );
1948 }
1949
1950 return( false );
1951}
1952
1953
1955// //
1957
1958//---------------------------------------------------------
1959bool CSG_Parameters::Set_History(CSG_MetaData &MetaData, bool bOptions, bool bDataObjects)
1960{
1961 if( bOptions ) // get options...
1962 {
1963 for(int i=0; i<Get_Count(); i++)
1964 {
1965 CSG_Parameter &P = *m_Parameters[i];
1966
1967 if( P.is_Option() && P.is_Enabled() && !P.is_Information() && !(P.Get_Type() == PARAMETER_TYPE_String && ((CSG_Parameter_String *)&P)->is_Password()) )
1968 {
1969 P.Serialize(MetaData, true);
1970 }
1971 else if( P.is_Parameters() )
1972 {
1973 P.asParameters()->Set_History(MetaData, true, false);
1974 }
1975 }
1976 }
1977
1978 //-----------------------------------------------------
1979 if( bDataObjects ) // get input with history...
1980 {
1981 for(int i=0; i<Get_Count(); i++)
1982 {
1983 CSG_Parameter &P = *m_Parameters[i];
1984
1985 //---------------------------------------------
1986 if( P.is_Input() )
1987 {
1988 if( P.is_DataObject() && P.asDataObject() )
1989 {
1990 CSG_Data_Object *pObject = P.asDataObject();
1991
1992 CSG_MetaData *pEntry = MetaData.Add_Child("INPUT");
1993
1994 pEntry->Add_Property("type" , P.Get_Type_Identifier());
1995 pEntry->Add_Property("id" , P.Get_Identifier ());
1996 pEntry->Add_Property("name" , P.Get_Name ());
1997 pEntry->Add_Property("parms", Get_Identifier ());
1998
1999 if( P.Get_Type() == PARAMETER_TYPE_Grid
2000 || P.Get_Type() == PARAMETER_TYPE_Grids )
2001 {
2002 pEntry->Add_Property("system", P.Get_Parent()->Get_Identifier());
2003 }
2004
2005 if( pObject->Get_History().Get_Children_Count() > 0 )
2006 {
2007 pEntry->Add_Children(pObject->Get_History());
2008 }
2009 else if( pObject->Get_File_Name() && *pObject->Get_File_Name() )
2010 {
2011 pEntry = pEntry->Add_Child("FILE", pObject->Get_File_Name());
2012 }
2013 }
2014
2015 else if( P.is_DataObject_List() && P.asList()->Get_Item_Count() > 0 )
2016 {
2017 CSG_MetaData *pList = MetaData.Add_Child("INPUT_LIST");
2018
2019 pList->Add_Property("type" , P.Get_Type_Identifier());
2020 pList->Add_Property("id" , P.Get_Identifier ());
2021 pList->Add_Property("name" , P.Get_Name ());
2022 pList->Add_Property("parms", Get_Identifier ());
2023
2025 {
2026 pList->Add_Property("system", P.Get_Parent()->Get_Identifier());
2027 }
2028
2029 for(int j=0; j<P.asList()->Get_Item_Count(); j++)
2030 {
2031 CSG_Data_Object *pObject = P.asList()->Get_Item(j);
2032
2033 CSG_MetaData *pEntry = pList->Add_Child(*pList, false);
2034
2035 pEntry->Set_Name("INPUT");
2036
2038 {
2039 pEntry->Add_Children(pObject->Get_History());
2040 }
2041 else if( pObject->Get_File_Name() && *pObject->Get_File_Name() )
2042 {
2043 pEntry = pEntry->Add_Child("FILE", pObject->Get_File_Name());
2044 }
2045 }
2046 }
2047 }
2048
2049 //---------------------------------------------
2050 else if( P.is_Parameters() )
2051 {
2052 P.asParameters()->Set_History(MetaData, false, true);
2053 }
2054 }
2055 }
2056
2057 return( true );
2058}
2059
2060
2062// //
2063// Grid System //
2064// //
2066
2067//---------------------------------------------------------
2074{
2075 return( m_pGrid_System && m_pGrid_System->asGrid_System() && m_pGrid_System->Set_Value((void *)&System) );
2076}
2077
2078//---------------------------------------------------------
2085{
2086 CSG_Grid_System System;
2087
2088 return( Set_Grid_System(System) );
2089}
2090
2091
2093// //
2094// Serialize //
2095// //
2097
2098//---------------------------------------------------------
2100{
2101 if( Data.Cmp_Name("parameters") )
2102 {
2103 Data.Get_Property("name", m_Name);
2104
2105 for(int i=0; i<Data.Get_Children_Count(); i++)
2106 {
2107 CSG_Parameter *pParameter = Get_Parameter(Data(i)->Get_Property("id"));
2108
2109 if( pParameter && pParameter->Serialize(*Data(i), false) )
2110 {
2111 pParameter->has_Changed();
2112 }
2113 }
2114
2115 return( true );
2116 }
2117
2118 return( false );
2119}
2120
2121//---------------------------------------------------------
2123{
2124 Data.Destroy();
2125
2126 Data.Set_Name("parameters");
2127 Data.Set_Property("name", m_Name);
2128
2129 for(int i=0; i<Get_Count(); i++)
2130 {
2131 m_Parameters[i]->Serialize(Data, true);
2132 }
2133
2134 return( true );
2135}
2136
2137//---------------------------------------------------------
2139{
2140 CSG_MetaData Data; return( Data.Load(File) && Load(Data) );
2141}
2142
2143//---------------------------------------------------------
2144bool CSG_Parameters::Save(const CSG_String &File) const
2145{
2146 CSG_MetaData Data; return( Save(Data) && Data.Save(File) );
2147}
2148
2149//---------------------------------------------------------
2150// SAGA 2.0 compatibility...
2152{
2153 CSG_Parameter *pParameter = NULL;
2154 CSG_String sLine;
2155
2156 if( !Stream.is_Open() )
2157 {
2158 return( false );
2159 }
2160
2161 //-----------------------------------------------------
2162 while( Stream.Read_Line(sLine) && sLine.Cmp("[PARAMETER_ENTRIES_BEGIN]") );
2163
2164 if( sLine.Cmp("[PARAMETER_ENTRIES_BEGIN]") )
2165 {
2166 return( false );
2167 }
2168
2169 //-----------------------------------------------------
2170 while( Stream.Read_Line(sLine) && sLine.Cmp("[PARAMETER_ENTRIES_END]") )
2171 {
2172 if( !sLine.Cmp("[PARAMETER_ENTRY_BEGIN]")
2173 && Stream.Read_Line(sLine) && (pParameter = Get_Parameter(sLine)) != NULL
2174 && Stream.Read_Line(sLine) )
2175 {
2176 int i;
2177 double d;
2178 TSG_Rect r;
2179 CSG_String s;
2180 CSG_Table t;
2181
2182 switch( sLine.asInt() )
2183 {
2184 case 1: // PARAMETER_TYPE_Bool:
2185 case 2: // PARAMETER_TYPE_Int:
2186 case 6: // PARAMETER_TYPE_Choice:
2187 case 11: // PARAMETER_TYPE_Color:
2188 case 15: // PARAMETER_TYPE_Table_Field:
2189 pParameter->Set_Value(Stream.Scan_Int());
2190 break;
2191
2192 case 3: // PARAMETER_TYPE_Double:
2193 case 4: // PARAMETER_TYPE_Degree:
2194 pParameter->Set_Value(Stream.Scan_Double());
2195 break;
2196
2197 case 5: // PARAMETER_TYPE_Range:
2198 pParameter->asRange()->Set_Range(Stream.Scan_Double(), Stream.Scan_Double());
2199 break;
2200
2201 case 7: // PARAMETER_TYPE_String:
2202 case 9: // PARAMETER_TYPE_FilePath:
2203 Stream.Read_Line(sLine);
2204 pParameter->Set_Value(sLine);
2205 break;
2206
2207 case 8: // PARAMETER_TYPE_Text:
2208 s.Clear();
2209 while( Stream.Read_Line(sLine) && sLine.Cmp("[TEXT_ENTRY_END]") )
2210 {
2211 s += sLine + "\n";
2212 }
2213 pParameter->Set_Value(s);
2214 break;
2215
2216 case 10: // PARAMETER_TYPE_Font:
2217 Stream.Read(&i, sizeof(i));
2218 pParameter->Set_Value(i);
2219 break;
2220
2221 case 12: // PARAMETER_TYPE_Colors:
2222 pParameter->asColors()->Serialize(Stream, false, false);
2223 break;
2224
2225 case 13: // PARAMETER_TYPE_FixedTable:
2226 if( t.Serialize(Stream, false) )
2227 {
2228 pParameter->asTable()->Assign_Values(&t);
2229 }
2230 break;
2231
2232 case 14: // PARAMETER_TYPE_Grid_System:
2233 Stream.Read(&d, sizeof(d));
2234 Stream.Read(&r, sizeof(r));
2235 pParameter->asGrid_System()->Assign(d, r);
2236 break;
2237
2238 case 16: // PARAMETER_TYPE_Grid:
2239 case 17: // PARAMETER_TYPE_Table:
2240 case 18: // PARAMETER_TYPE_Shapes:
2241 case 19: // PARAMETER_TYPE_TIN:
2242 case 24: // PARAMETER_TYPE_DataObject_Output:
2243 if( Stream.Read_Line(sLine) )
2244 {
2245 if( !sLine.Cmp("[ENTRY_DATAOBJECT_CREATE]") )
2246 {
2247 pParameter->Set_Value(DATAOBJECT_CREATE);
2248 }
2249 else
2250 {
2251 pParameter->Set_Value(m_pManager ? m_pManager->Find(sLine) : NULL);
2252 }
2253 }
2254 break;
2255
2256 case 20: // PARAMETER_TYPE_Grid_List:
2257 case 21: // PARAMETER_TYPE_Table_List:
2258 case 22: // PARAMETER_TYPE_Shapes_List:
2259 case 23: // PARAMETER_TYPE_TIN_List:
2260 while( Stream.Read_Line(sLine) && sLine.Cmp("[ENTRY_DATAOBJECTLIST_END]") )
2261 {
2262 CSG_Data_Object *pObject = m_pManager ? m_pManager->Find(sLine) : NULL;
2263
2264 if( pObject )
2265 {
2266 pParameter->asList()->Add_Item(pObject);
2267 }
2268 }
2269 break;
2270
2271 case 25: // PARAMETER_TYPE_Parameters:
2272 pParameter->asParameters()->Serialize_Compatibility(Stream);
2273 break;
2274 }
2275 }
2276 }
2277
2278 return( true );
2279}
2280
2281//---------------------------------------------------------
2283{
2284 m_Info = HTML;
2285 m_bInfo = true;
2286}
2287
2288
2290// //
2291// //
2292// //
2294
2295//---------------------------------------------------------
bool SG_UI_DataObject_Update(CSG_Data_Object *pDataObject, int Show, CSG_Parameters *pParameters)
void SG_UI_Msg_Add_Error(const char *Message)
bool SG_UI_DataObject_Add(CSG_Data_Object *pDataObject, int Show)
void SG_UI_Msg_Add_Execution(const char *Message, bool bNewLine, TSG_UI_MSG_STYLE Style)
void * SG_UI_Get_Window_Main(void)
void SG_UI_Dlg_Message(const CSG_String &Message, const CSG_String &Caption)
@ SG_UI_MSG_STYLE_NORMAL
Definition api_core.h:1631
@ SG_UI_MSG_STYLE_01
Definition api_core.h:1638
#define SG_T(s)
Definition api_core.h:537
SAGA_API_DLL_EXPORT void SG_Free(void *memblock)
SAGA_API_DLL_EXPORT void * SG_Realloc(void *memblock, size_t size)
@ SG_UI_DATAOBJECT_UPDATE
Definition api_core.h:1647
TSG_Data_Type
Definition api_core.h:1043
#define SG_Char
Definition api_core.h:536
#define _TL(s)
Definition api_core.h:1618
bool Serialize(CSG_File &Stream, bool bSave, bool bBinary)
bool Create(void)
void Set_Name(const CSG_String &Name)
CSG_MetaData & Get_MetaData(void) const
Definition dataobject.h:237
const SG_Char * Get_File_Name(bool bNative=true) const
class CSG_Shapes * asShapes(bool bPolymorph=false) const
CSG_MetaData & Get_History(void)
Definition dataobject.h:239
CSG_Projection & Get_Projection(void)
class CSG_Grids * asGrids(bool bPolymorph=false) const
class CSG_Grid * asGrid(bool bPolymorph=false) const
double Get_JDN(void) const
Definition datetime.cpp:426
static CSG_DateTime Now(void)
Definition datetime.cpp:600
bool is_Open(void) const
Definition api_core.h:1195
bool Read_Line(CSG_String &Line) const
Definition api_file.cpp:409
int Scan_Int(void) const
Definition api_file.cpp:567
size_t Read(void *Buffer, size_t Size, size_t Count=1) const
Definition api_file.cpp:338
double Scan_Double(void) const
Definition api_file.cpp:572
bool Assign(const CSG_Grid_System &System)
bool is_Valid(void) const
bool Create(const CSG_Grid &Grid)
Definition grid.cpp:235
const CSG_Grid_System & Get_System(void) const
Definition grid.h:559
const CSG_Grid_System & Get_System(void) const
Definition grids.h:184
virtual bool Create(const CSG_Grids &Grids)
Definition grids.cpp:319
bool Cmp_Name(const CSG_String &String, bool bNoCase=true) const
Definition metadata.cpp:484
bool Save(const CSG_String &File, const SG_Char *Extension=NULL) const
Definition metadata.cpp:904
bool Del_Children(int Depth=0, const SG_Char *Name=NULL)
Definition metadata.cpp:381
int Get_Children_Count(void) const
Definition metadata.h:154
bool Set_Property(const CSG_String &Name, const CSG_String &Value, bool bAddIfNotExists=true)
Definition metadata.cpp:638
bool Add_Children(const CSG_MetaData &MetaData)
Definition metadata.cpp:359
const SG_Char * Get_Property(int Index) const
Definition metadata.h:188
void Set_Name(const CSG_String &Name)
Definition metadata.h:136
CSG_MetaData * Add_Child(void)
Definition metadata.cpp:166
bool Load(const CSG_String &File, const SG_Char *Extension=NULL)
Definition metadata.cpp:809
void Destroy(void)
Definition metadata.cpp:140
bool Add_Property(const CSG_String &Name, const CSG_String &Value)
Definition metadata.cpp:582
bool Set_Items(const SG_Char *String)
void Set_Items(const CSG_String &Items)
bool Set_Data_Types(int Data_Types, TSG_Data_Type Default=SG_DATATYPE_Undefined, const CSG_String &User="")
void Set_Filter(const SG_Char *Filter)
void Set_Flag_Directory(bool bFlag)
void Set_Flag_Save(bool bFlag)
void Set_Flag_Multiple(bool bFlag)
virtual TSG_Parameter_Type Get_Type(void) const
virtual bool Del_Item(CSG_Data_Object *pItem, bool bUpdateData=true)
CSG_Data_Object * Get_Item(int Index) const
virtual bool Add_Item(CSG_Data_Object *pItem)
int Get_Item_Count(void) const
CSG_Parameter_Double * Get_Min_Parameter(void) const
Definition parameters.h:628
CSG_Parameter_Double * Get_Max_Parameter(void) const
Definition parameters.h:632
bool Set_Max(double Max)
bool Set_Min(double Min)
bool Set_Range(double Min, double Max)
virtual TSG_Parameter_Type Get_Type(void) const
void Set_Minimum(double Minimum, bool bOn=true)
void Set_Maximum(double Maximum, bool bOn=true)
const SG_Char * Get_Identifier(void) const
bool is_DataObject(void) const
class CSG_Parameters * asParameters(void) const
bool Check(bool bSilent=true)
bool Assign(CSG_Parameter *pSource)
bool is_Parameters(void) const
CSG_String Get_Type_Identifier(void) const
void ignore_Projection(bool bIgnore)
bool Set_Default(int Value)
bool Set_Enabled(bool bEnabled=true)
bool is_Optional(void) const
Definition parameters.h:238
TSG_Data_Object_Type Get_DataObject_Type(void) const
bool Serialize(CSG_MetaData &MetaData, bool bSave)
int Get_Children_Count(void) const
Definition parameters.h:259
class CSG_Parameter_Choice * asChoice(void) const
class CSG_Parameter_Value * asValue(void) const
CSG_Parameter * Get_Parent(void) const
virtual TSG_Parameter_Type Get_Type(void) const =0
class CSG_Parameter_Data_Type * asDataType(void) const
bool is_Input(void) const
Definition parameters.h:236
const SG_Char * Get_Name(void) const
class CSG_Parameter_Choices * asChoices(void) const
virtual void _Set_String(void)
CSG_Colors * asColors(void) const
bool is_Enabled(bool bCheckEnv=true) const
bool is_Option(void) const
virtual bool Set_Value(int Value)
class CSG_Parameter_List * asList(void) const
CSG_Grid_System * asGrid_System(void) const
CSG_Data_Object * asDataObject(void) const
class CSG_Parameter_Range * asRange(void) const
CSG_Parameter * Get_Child(int iChild) const
Definition parameters.h:260
bool is_Output(void) const
Definition parameters.h:237
bool has_Changed(int Check_Flags=PARAMETER_CHECK_ALL)
class CSG_Parameter_File_Name * asFilePath(void) const
bool is_Information(void) const
Definition parameters.h:239
const SG_Char * asString(void) const
Definition parameters.h:290
CSG_Table * asTable(void) const
const SG_Char * Get_Description(void) const
bool is_DataObject_List(void) const
void Set_Tool(class CSG_Tool *pTool)
CSG_Parameter * Add_TIN_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
virtual ~CSG_Parameters(void)
CSG_Parameter * Add_Shapes_Output(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
CSG_Parameter * Add_Table_Fields(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
void Set_Name(const CSG_String &Name)
CSG_Parameter * Add_TIN(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
bool Set_Callback(bool bActive=true)
CSG_Parameter * Add_Grid_Resampling(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Grid_Resampling Methods=CSG_Grid_Resampling::Interpolations, CSG_Grid_Resampling Default=CSG_Grid_Resampling::Bicubic_2)
bool has_GUI(void) const
CSG_Parameter * Add_Table_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
CSG_Parameter * Add_Table(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
CSG_Parameter * Add_Parameter(CSG_Parameter *pParameter)
const CSG_String & Get_Identifier(void) const
CSG_Parameter * Add_Info_Value(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, TSG_Parameter_Type Type, double Value=0.0)
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)
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)
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)
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)
bool Reset_Grid_System(void)
CSG_Parameter * Add_PointCloud(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
bool Msg_String(bool bOptionsOnly)
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)
int Get_Count(void) const
CSG_Parameter * Add_TIN_Output(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
CSG_Parameter * Add_Table_Field_or_Const(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)
void Set_Manager(class CSG_Data_Manager *pManager)
class CSG_Tool * Get_Tool(void) const
bool Assign_Values(CSG_Parameters *pSource)
CSG_Parameter * Add_Grid_or_Const(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, bool bSystem_Dependent=true)
bool Use_Grid_System(void)
void Set_Enabled(bool bEnabled=true)
bool Get_String(CSG_String &String, bool bOptionsOnly)
CSG_Parameter * Add_Choices(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &Items)
bool Set_History(CSG_MetaData &History, bool bOptions=true, bool bDataObjects=true)
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)
CSG_Parameter * Add_Grid_Output(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
void Set_Description(const CSG_String &Description)
bool Set_Grid_System(const CSG_Grid_System &System)
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)
CSG_Parameter * Add_Table_Field(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool bAllowNone=false)
bool Del_Parameters(void)
void Set_Identifier(const CSG_String &Identifier)
CSG_Parameter * Add_Value(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, TSG_Parameter_Type Type, double Value=0.0, double Minimum=0.0, bool bMinimum=false, double Maximum=0.0, bool bMaximum=false)
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)
const CSG_String & Get_Name(void) const
CSG_Parameter * Add_PointCloud_List(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
CSG_Parameter * Get_Parameter(int i) const
bool Create(const CSG_Parameters &Parameters)
bool Restore_Defaults(bool bClearData=false)
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)
bool Serialize_Compatibility(CSG_File &Stream)
friend class CSG_Tool
CSG_Parameter * Add_Parameters(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
bool Push(class CSG_Data_Manager *pManager=NULL, bool bRestoreDefaults=true)
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)
TSG_PFNC_Parameter_Changed Set_Callback_On_Parameter_Changed(TSG_PFNC_Parameter_Changed pCallback)
bool Assign(CSG_Parameters *pSource)
bool DataObjects_Check(bool bSilent=false)
bool Del_Parameter(int i)
void Set_Info(const CSG_String &HTML)
CSG_Parameter * Add_Node(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool bCollapsed=false)
CSG_Parameter * Add_Color(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Value=0)
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)
CSG_Parameter * Add_Grids_Output(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
void * Get_Owner(void) const
void Destroy(void)
const CSG_String & Get_Description(void) const
CSG_Parameter * Add_FixedTable(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Table *pInit=NULL)
bool Set_Parameter(const CSG_String &ID, CSG_Parameter *pValue)
CSG_Parameter * Add_Table_Output(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
CSG_Parameter * Add_Font(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const SG_Char *pInit=NULL)
CSG_Parameter * Add_Data_Type(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Data_Types, TSG_Data_Type Default=SG_DATATYPE_Undefined, const CSG_String &User="")
bool Assign_Parameters(CSG_Parameters *pSource)
bool Save(CSG_MetaData &Data) const
bool Pop(void)
CSG_Parameter * Add_Bool(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool Value=false)
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)
CSG_Parameter * Add_Date(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value=0.0)
friend class CSG_Parameter
CSG_Parameter * Add_Info_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 Cmp_Identifier(const CSG_String &Identifier) const
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)
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)
CSG_Parameter * Add_PointCloud_Output(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
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)
CSG_Parameter * Add_Info_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)
bool Load(const CSG_MetaData &Data)
bool Create(const CSG_Shapes &Shapes)
Definition shapes.cpp:209
virtual TSG_Shape_Type Get_Type(void) const
Definition shapes.h:814
size_t Length(void) const
CSG_String AfterFirst(char Character) const
bool asInt(int &Value) const
int CmpNoCase(const CSG_String &String) const
int Cmp(const CSG_String &String) const
void Clear(void)
CSG_String BeforeFirst(char Character) const
static CSG_String Format(const char *Format,...)
CSG_String & Append(const CSG_String &String)
int Find(char Character, bool fromEnd=false) const
const SG_Char * c_str(void) const
bool is_Empty(void) const
CSG_String Left(size_t count) const
bool Create(void)
Definition table.cpp:153
bool Assign_Values(const CSG_Table &Table)
Definition table.cpp:378
bool Serialize(CSG_File &Stream, bool bSave)
Definition table_io.cpp:706
CSG_Data_Manager & SG_Get_Data_Manager(void)
int SG_Get_History_Ignore_Lists(void)
@ SG_DATAOBJECT_TYPE_PointCloud
Definition dataobject.h:123
@ SG_DATAOBJECT_TYPE_Grids
Definition dataobject.h:119
@ SG_DATAOBJECT_TYPE_TIN
Definition dataobject.h:122
@ SG_DATAOBJECT_TYPE_Shapes
Definition dataobject.h:121
@ SG_DATAOBJECT_TYPE_Grid
Definition dataobject.h:118
@ SG_DATAOBJECT_TYPE_Table
Definition dataobject.h:120
#define DATAOBJECT_NOTSET
Definition dataobject.h:129
#define DATAOBJECT_CREATE
Definition dataobject.h:130
struct SSG_Rect TSG_Rect
CSG_Grid * SG_Create_Grid(void)
Definition grid.cpp:72
CSG_Grid_Resampling
Definition grid.h:156
CSG_Grids * SG_Create_Grids(void)
Definition grids.cpp:65
#define ADD_METHOD(method, name)
int(* TSG_PFNC_Parameter_Changed)(CSG_Parameter *pParameter, int Flags)
#define PARAMETER_INPUT_OPTIONAL
Definition parameters.h:103
#define PARAMETER_INFORMATION
Definition parameters.h:97
#define PARAMETER_OUTPUT_OPTIONAL
Definition parameters.h:104
#define PARAMETER_OPTIONAL
Definition parameters.h:96
#define PARAMETER_GUI_COLLAPSED
Definition parameters.h:101
TSG_Parameter_Type
Definition parameters.h:123
@ PARAMETER_TYPE_Degree
Definition parameters.h:129
@ PARAMETER_TYPE_FixedTable
Definition parameters.h:142
@ PARAMETER_TYPE_Node
Definition parameters.h:124
@ PARAMETER_TYPE_Grid
Definition parameters.h:149
@ PARAMETER_TYPE_Grid_List
Definition parameters.h:155
@ PARAMETER_TYPE_Text
Definition parameters.h:136
@ PARAMETER_TYPE_TIN
Definition parameters.h:153
@ PARAMETER_TYPE_Table
Definition parameters.h:151
@ PARAMETER_TYPE_Int
Definition parameters.h:127
@ PARAMETER_TYPE_Table_Fields
Definition parameters.h:146
@ PARAMETER_TYPE_Grids
Definition parameters.h:150
@ PARAMETER_TYPE_Color
Definition parameters.h:140
@ PARAMETER_TYPE_Colors
Definition parameters.h:141
@ PARAMETER_TYPE_DataObject_Output
Definition parameters.h:162
@ PARAMETER_TYPE_Table_List
Definition parameters.h:157
@ PARAMETER_TYPE_Double
Definition parameters.h:128
@ PARAMETER_TYPE_TIN_List
Definition parameters.h:159
@ PARAMETER_TYPE_Grid_System
Definition parameters.h:144
@ PARAMETER_TYPE_Font
Definition parameters.h:139
@ PARAMETER_TYPE_Date
Definition parameters.h:130
@ PARAMETER_TYPE_PointCloud_List
Definition parameters.h:160
@ PARAMETER_TYPE_Choices
Definition parameters.h:134
@ PARAMETER_TYPE_Undefined
Definition parameters.h:166
@ PARAMETER_TYPE_Data_Type
Definition parameters.h:132
@ PARAMETER_TYPE_Shapes
Definition parameters.h:152
@ PARAMETER_TYPE_Shapes_List
Definition parameters.h:158
@ PARAMETER_TYPE_Range
Definition parameters.h:131
@ PARAMETER_TYPE_PointCloud
Definition parameters.h:148
@ PARAMETER_TYPE_Table_Field
Definition parameters.h:145
@ PARAMETER_TYPE_Parameters
Definition parameters.h:164
@ PARAMETER_TYPE_FilePath
Definition parameters.h:137
@ PARAMETER_TYPE_Bool
Definition parameters.h:126
@ PARAMETER_TYPE_Grids_List
Definition parameters.h:156
@ PARAMETER_TYPE_String
Definition parameters.h:135
@ PARAMETER_TYPE_Choice
Definition parameters.h:133
#define PARAMETER_OUTPUT
Definition parameters.h:95
CSG_PointCloud * SG_Create_PointCloud(void)
CSG_Shapes * SG_Create_Shapes(void)
Definition shapes.cpp:85
TSG_Shape_Type
Definition shapes.h:100
@ SHAPE_TYPE_Undefined
Definition shapes.h:101
CSG_Table * SG_Create_Table(void)
Definition table.cpp:65
CSG_TIN * SG_Create_TIN(void)
Definition tin.cpp:63