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