SAGA API  v9.2
parameter.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 // parameter.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 // Germany //
45 // //
46 // e-mail: oconrad@saga-gis.org //
47 // //
49 
50 //---------------------------------------------------------
51 #include "parameters.h"
52 #include "data_manager.h"
53 #include "tool.h"
54 
55 
57 // //
58 // //
59 // //
61 
62 //---------------------------------------------------------
63 CSG_Parameter::CSG_Parameter(CSG_Parameters *pParameters, CSG_Parameter *pParent, const CSG_String &Identifier, const CSG_String &Name, const CSG_String &Description, int Constraint)
64 {
65  m_pParameters = pParameters;
66  m_pParent = pParent;
67  m_Identifier = Identifier;
68  m_Name = Name;
69  m_Description = Description;
70  m_Constraint = Constraint;
71 
72  m_bEnabled = true;
73 
74  //-----------------------------------------------------
75  m_nChildren = 0;
76  m_Children = NULL;
77 
78  if( m_pParent )
79  {
80  m_pParent->_Add_Child(this);
81  }
82 }
83 
84 //---------------------------------------------------------
86 {
87  if( m_Children )
88  {
89  SG_Free(m_Children);
90  }
91 }
92 
93 
95 // //
97 
98 //---------------------------------------------------------
100 {
101  return( m_pParameters );
102 }
103 
104 //---------------------------------------------------------
106 {
107  return( m_pParent );
108 }
109 
110 //---------------------------------------------------------
112 {
113  return( m_pParameters ? m_pParameters->Get_Manager() : NULL );
114 }
115 
116 
118 // //
120 
121 //---------------------------------------------------------
123 {
125 }
126 
127 //---------------------------------------------------------
129 {
131 }
132 
133 
135 // //
137 
138 //---------------------------------------------------------
140 {
141  if( bDoUse )
142  {
143  m_Constraint &= ~PARAMETER_NOT_FOR_GUI;
144  }
145  else
146  {
147  m_Constraint |= PARAMETER_NOT_FOR_GUI;
148  }
149 }
150 
151 //---------------------------------------------------------
153 {
154  if( bDoUse )
155  {
156  m_Constraint &= ~PARAMETER_NOT_FOR_CMD;
157  }
158  else
159  {
160  m_Constraint |= PARAMETER_NOT_FOR_CMD;
161  }
162 }
163 
164 //---------------------------------------------------------
166 {
167  return( !(m_Constraint & PARAMETER_NOT_FOR_GUI) && (Get_Parent() == NULL || Get_Parent()->do_UseInGUI()) );
168 }
169 
170 //---------------------------------------------------------
172 {
173  return( !(m_Constraint & PARAMETER_NOT_FOR_CMD) && (Get_Parent() == NULL || Get_Parent()->do_UseInCMD()) );
174 }
175 
176 //---------------------------------------------------------
178 {
179  if( bIgnore )
180  {
181  m_Constraint &= ~PARAMETER_IGNORE_PROJECTION;
182  }
183  else
184  {
185  m_Constraint |= PARAMETER_IGNORE_PROJECTION;
186  }
187 }
188 
189 
191 // //
193 
194 //---------------------------------------------------------
195 bool CSG_Parameter::Set_Enabled(bool bEnabled)
196 {
197  if( m_bEnabled != bEnabled )
198  {
199  m_bEnabled = bEnabled;
200 
201  return( !bEnabled );
202  }
203 
204  return( bEnabled );
205 }
206 
207 //---------------------------------------------------------
208 bool CSG_Parameter::is_Enabled(bool bCheckEnv) const
209 {
210  if( bCheckEnv )
211  {
212  if( !do_UseInGUI() && m_pParameters->has_GUI() )
213  {
214  return( false );
215  }
216 
217  if( !do_UseInCMD() && !m_pParameters->has_GUI() )
218  {
219  return( false );
220  }
221  }
222 
223  return( m_bEnabled && (m_pParent == NULL || m_pParent->is_Enabled()) );
224 }
225 
226 //---------------------------------------------------------
228 {
229  for(int i=0; i<Get_Children_Count(); i++)
230  {
231  Get_Child(i)->Set_Enabled(bEnabled);
232  }
233 
234  return( true );
235 }
236 
237 //---------------------------------------------------------
238 bool CSG_Parameter::is_Option(void) const
239 {
240  if( !is_Information() )
241  {
242  switch( Get_Type() )
243  {
244  case PARAMETER_TYPE_Bool :
245  case PARAMETER_TYPE_Int :
246  case PARAMETER_TYPE_Double :
247  case PARAMETER_TYPE_Degree :
248  case PARAMETER_TYPE_Date :
249  case PARAMETER_TYPE_Range :
251  case PARAMETER_TYPE_Choice :
253  case PARAMETER_TYPE_String :
254  case PARAMETER_TYPE_Text :
256  case PARAMETER_TYPE_Font :
257  case PARAMETER_TYPE_Color :
258  case PARAMETER_TYPE_Colors :
264  return( true );
265 
266  default:
267  return( false );
268  }
269  }
270 
271  return( false );
272 }
273 
274 //---------------------------------------------------------
276 {
277  switch( Get_Type() )
278  {
280  case PARAMETER_TYPE_Grid :
281  case PARAMETER_TYPE_Grids :
282  case PARAMETER_TYPE_Table :
283  case PARAMETER_TYPE_Shapes :
284  case PARAMETER_TYPE_TIN :
286  return( true );
287 
288  default:
289  return( false );
290  }
291 }
292 
293 //---------------------------------------------------------
295 {
296  switch( Get_Type() )
297  {
304  return( true );
305 
306  default:
307  return( false );
308  }
309 }
310 
311 //---------------------------------------------------------
313 {
314  return( Get_Type() == PARAMETER_TYPE_Parameters );
315 }
316 
317 //---------------------------------------------------------
319 {
320  switch( Get_Type() )
321  {
323  case PARAMETER_TYPE_Node :
325  return( false );
326 
327  case PARAMETER_TYPE_String :
328  return( ((CSG_Parameter_String *)this)->is_Password() == false );
329 
330  default:
331  return( !is_Information() );
332  }
333 }
334 
335 //---------------------------------------------------------
337 {
338  if( pParameter && pParameter->Get_Type() == Get_Type() )
339  {
340  switch( Get_Type() )
341  {
342  //-------------------------------------------------
344  case PARAMETER_TYPE_Choice :
345  {
346  bool bResult = pParameter->asChoice()->Get_Count() == asChoice()->Get_Count();
347 
348  for(int i=0; bResult && i<asChoice()->Get_Count(); i++)
349  {
350  bResult = SG_STR_CMP(pParameter->asChoice()->Get_Item(i), asChoice()->Get_Item(i)) == 0;
351  }
352 
353  return( bResult );
354  }
355 
356  //-------------------------------------------------
358  {
359  bool bResult = pParameter->asChoices()->Get_Item_Count() == asChoices()->Get_Item_Count();
360 
361  for(int i=0; bResult && i<asChoices()->Get_Item_Count(); i++)
362  {
363  bResult = SG_STR_CMP(pParameter->asChoices()->Get_Item(i), asChoices()->Get_Item(i)) == 0;
364  }
365 
366  return( bResult );
367  }
368 
369  //-------------------------------------------------
370  case PARAMETER_TYPE_FixedTable : return( pParameter->asTable()->is_Compatible(asTable()) );
371 
372  //-------------------------------------------------
374  {
375  bool bResult = pParameter->asParameters()->Get_Count() == asParameters()->Get_Count();
376 
377  for(int i=0; bResult && i<asParameters()->Get_Count(); i++)
378  {
379  bResult = pParameter->asParameters()->Get_Parameter(i)->is_Compatible(asParameters()->Get_Parameter(i));
380  }
381 
382  return( bResult );
383  }
384 
385  //-------------------------------------------------
386  default:
387  return( true );
388  }
389  }
390 
391  return( false );
392 }
393 
394 //---------------------------------------------------------
396 {
397  if( pParameter && pParameter->Get_Type() == Get_Type() )
398  {
399  switch( Get_Type() )
400  {
401  case PARAMETER_TYPE_Node : return( true );
402 
403  //-------------------------------------------------
404  case PARAMETER_TYPE_Bool : return( pParameter->asBool () == asBool () );
407  case PARAMETER_TYPE_Choice :
408  case PARAMETER_TYPE_Color :
409  case PARAMETER_TYPE_Int : return( pParameter->asInt () == asInt () );
410  case PARAMETER_TYPE_Date :
411  case PARAMETER_TYPE_Degree :
412  case PARAMETER_TYPE_Double : return( pParameter->asDouble() == asDouble() );
413 
415  case PARAMETER_TYPE_Font :
416  case PARAMETER_TYPE_Text :
418  case PARAMETER_TYPE_String : return( SG_STR_CMP(pParameter->asString(), asString()) == 0 );
419 
420  case PARAMETER_TYPE_Range : return( pParameter->asRange()->Get_Min() == asRange()->Get_Min()
421  && pParameter->asRange()->Get_Max() == asRange()->Get_Max() );
422 
423  case PARAMETER_TYPE_Grid_System : return( pParameter->asGrid_System()->is_Equal(*asGrid_System()) );
424 
425  //-------------------------------------------------
427  {
428  bool bResult = pParameter->asChoices()->Get_Selection_Count() == asChoices()->Get_Selection_Count();
429 
430  for(int i=0; bResult && i<asChoices()->Get_Selection_Count(); i++)
431  {
432  bResult = pParameter->asChoices()->Get_Selection_Index(i) == asChoices()->Get_Selection_Index(i);
433  }
434 
435  return( bResult );
436  }
437 
438  //-------------------------------------------------
439  case PARAMETER_TYPE_Colors :
440  {
441  bool bResult = pParameter->asColors()->Get_Count() == asColors()->Get_Count();
442 
443  for(int i=0; bResult && i<asColors()->Get_Count(); i++)
444  {
445  bResult = pParameter->asColors()->Get_Color(i) == asColors()->Get_Color(i);
446  }
447 
448  return( bResult );
449  }
450 
451  //-------------------------------------------------
453  {
454  bool bResult = pParameter->asTable()->is_Compatible(asTable()) && pParameter->asTable()->Get_Count() == asTable()->Get_Count();
455 
456  for(int i=0; bResult && i<asTable()->Get_Count(); i++)
457  {
458  CSG_Table_Record *pA = pParameter->asTable()->Get_Record(i), *pB = asTable()->Get_Record(i);
459 
460  for(int j=0; bResult && j<asTable()->Get_Field_Count(); j++)
461  {
462  bResult = SG_STR_CMP(pA->asString(j), pB->asString(j)) == 0;
463  }
464  }
465 
466  return( bResult );
467  }
468 
469  //-------------------------------------------------
471  case PARAMETER_TYPE_Grid :
472  case PARAMETER_TYPE_Grids :
473  case PARAMETER_TYPE_Table :
474  case PARAMETER_TYPE_Shapes :
475  case PARAMETER_TYPE_TIN :
476  case PARAMETER_TYPE_PointCloud : return( pParameter->asDataObject() == asDataObject() );
477 
478  //-------------------------------------------------
485  {
486  bool bResult = pParameter->asList()->Get_Item_Count() == asList()->Get_Item_Count();
487 
488  for(int i=0; bResult && i<asList()->Get_Item_Count(); i++)
489  {
490  bResult = pParameter->asList()->Get_Item(i) == asList()->Get_Item(i);
491  }
492 
493  return( bResult );
494  }
495 
496  //-------------------------------------------------
498  {
499  bool bResult = pParameter->asParameters()->Get_Count() == asParameters()->Get_Count();
500 
501  for(int i=0; bResult && i<asParameters()->Get_Count(); i++)
502  {
503  bResult = pParameter->asParameters()->Get_Parameter(i)->is_Value_Equal(asParameters()->Get_Parameter(i));
504  }
505 
506  return( bResult );
507  }
508 
509  //-------------------------------------------------
510  default: break;
511  }
512  }
513 
514  return( false );
515 }
516 
517 //---------------------------------------------------------
519 {
520  switch( Get_Type() )
521  {
522  default : return( SG_DATAOBJECT_TYPE_Undefined );
523  case PARAMETER_TYPE_Grid :
525  case PARAMETER_TYPE_Grids :
527  case PARAMETER_TYPE_Table :
529  case PARAMETER_TYPE_Shapes :
531  case PARAMETER_TYPE_TIN :
537  }
538 }
539 
540 
542 // //
544 
545 //---------------------------------------------------------
547 {
548  return( m_Identifier );
549 }
550 
551 //---------------------------------------------------------
552 bool CSG_Parameter::Cmp_Identifier(const CSG_String &Identifier) const
553 {
554  return( !m_Identifier.Cmp(Identifier) || !m_Identifier.Cmp(Identifier + ".Default") );
555 }
556 
557 //---------------------------------------------------------
559 {
560  m_Name = Name;
561 
562  return( true );
563 }
564 
565 const SG_Char * CSG_Parameter::Get_Name(void) const
566 {
567  return( m_Name );
568 }
569 
570 //---------------------------------------------------------
572 {
573  m_Description = Description;
574 
575  return( true );
576 }
577 
579 {
580  return( m_Description );
581 }
582 
583 //---------------------------------------------------------
585 {
586  return( Get_Description(Flags, SG_T("\n")) );
587 }
588 
589 //---------------------------------------------------------
590 CSG_String CSG_Parameter::Get_Description(int Flags, const SG_Char *Separator) const
591 {
592  #define SEPARATE if( !s.is_Empty() ) { s.Append(Separator); }
593 
594  if( !Separator || !Separator[0] )
595  {
596  return( Get_Description(Flags) );
597  }
598 
599  CSG_String s;
600 
601  //-----------------------------------------------------
602  if( (Flags & PARAMETER_DESCRIPTION_NAME) != 0 )
603  {
604  SEPARATE; s += CSG_String::Format("%s", Get_Name());
605  }
606 
607  //-----------------------------------------------------
608  if( (Flags & PARAMETER_DESCRIPTION_TYPE) != 0 )
609  {
610  SEPARATE;
611 
613  {
614  s += CSG_String::Format("%s %s", Get_Type_Name().c_str(), SG_Get_DataObject_Name(Get_DataObject_Type()).c_str());
615  }
616  else
617  {
618  s += CSG_String::Format("%s", Get_Type_Name().c_str());
619  }
620 
621  if( is_DataObject() || is_DataObject_List() )
622  {
623  s += CSG_String::Format(", %s", is_Input() ? _TL("input") : _TL("output"));
624 
625  if( is_Optional() )
626  {
627  s += CSG_String::Format(", %s", _TL("optional"));
628  }
629  }
630 
631  if( do_UseInGUI() != do_UseInCMD() )
632  {
633  s += CSG_String::Format(", %s", do_UseInGUI() ? SG_T("GUI") : SG_T("CMD"));
634  }
635  }
636 
637  //-----------------------------------------------------
638  if( (Flags & PARAMETER_DESCRIPTION_OPTIONAL) != 0 && is_Optional() )
639  {
640  SEPARATE; s += CSG_String::Format("%s", _TL("optional"));
641  }
642 
643  //-----------------------------------------------------
644  if( (Flags & PARAMETER_DESCRIPTION_PROPERTIES) != 0 )
645  {
646  switch( Get_Type() )
647  {
648  default:
649  break;
650 
653  SEPARATE; s += CSG_String::Format("%s:", _TL("Available Choices"));
654 
655  for(int i=0; i<asChoice()->Get_Count(); i++)
656  {
657  s += CSG_String::Format("%s[%d] %s", Separator, i, asChoice()->Get_Item(i));
658  }
659  break;
660 
662  SEPARATE; s += CSG_String::Format("%s:", _TL("Available Choices"));
663 
664  for(int i=0; i<asChoices()->Get_Item_Count(); i++)
665  {
666  s += CSG_String::Format("%s[%d] %s", Separator, i, asChoices()->Get_Item(i).c_str());
667  }
668  break;
669 
670  case PARAMETER_TYPE_Int:
671  if( asValue()->has_Minimum() )
672  {
673  SEPARATE; s += CSG_String::Format("%s: %d", _TL("Minimum"), (int)asValue()->Get_Minimum());
674  }
675 
676  if( asValue()->has_Maximum() )
677  {
678  SEPARATE; s += CSG_String::Format("%s: %d", _TL("Maximum"), (int)asValue()->Get_Maximum());
679  }
680  break;
681 
684 // case PARAMETER_TYPE_Range:
685  if( asValue()->has_Minimum() )
686  {
687  SEPARATE; s += CSG_String::Format("%s: %f", _TL("Minimum"), asValue()->Get_Minimum());
688  }
689 
690  if( asValue()->has_Maximum() )
691  {
692  SEPARATE; s += CSG_String::Format("%s: %f", _TL("Maximum"), asValue()->Get_Maximum());
693  }
694  break;
695 
697  SEPARATE; s += CSG_String::Format("%d %s:%s", asTable()->Get_Field_Count(), _TL("Fields"), Separator);
698 
699  for(int i=0; i<asTable()->Get_Field_Count(); i++)
700  {
701  s += CSG_String::Format("- %d. [%s] %s%s", i + 1, SG_Data_Type_Get_Name(asTable()->Get_Field_Type(i)).c_str(), asTable()->Get_Field_Name(i), Separator);
702  }
703  break;
704 
706  SEPARATE; s += CSG_String::Format("%d %s:%s", asParameters()->Get_Count(), _TL("Parameters"), Separator);
707 
708  for(int i=0; i<asParameters()->Get_Count(); i++)
709  {
710  s += CSG_String::Format("- %d. %s%s", i + 1, asParameters()->Get_Parameter(i)->Get_Description(Flags, Separator).c_str(), Separator);
711  }
712  break;
713  }
714 
715  if( !m_Default.is_Empty() )
716  {
717  SEPARATE; s += CSG_String::Format("%s: %s", _TL("Default"), m_Default.c_str());
718  }
719  }
720 
721  //-----------------------------------------------------
722  if( (Flags & PARAMETER_DESCRIPTION_TEXT) != 0 && m_Description.Length() > 0 )
723  {
724  SEPARATE; s += m_Description;
725  }
726 
727  //-----------------------------------------------------
728  #undef SEPARATE
729 
730  return( s );
731 }
732 
733 
735 // //
737 
738 //---------------------------------------------------------
743 
744 //---------------------------------------------------------
746 {
747  switch( _Set_Value(Value) )
748  {
750  return( false );
751 
753  has_Changed();
754  }
755 
756  return( true );
757 }
758 
759 //---------------------------------------------------------
760 bool CSG_Parameter::Set_Value(double Value)
761 {
762  switch( _Set_Value(Value) )
763  {
765  return( false );
766 
768  has_Changed();
769  }
770 
771  return( true );
772 }
773 
774 //---------------------------------------------------------
775 bool CSG_Parameter::Set_Value(const char *Value) { return( Set_Value(CSG_String(Value)) ); }
776 bool CSG_Parameter::Set_Value(const wchar_t *Value) { return( Set_Value(CSG_String(Value)) ); }
778 {
779  switch( _Set_Value(Value) )
780  {
782  return( false );
783 
785  has_Changed();
786  }
787 
788  return( true );
789 }
790 
791 //---------------------------------------------------------
792 bool CSG_Parameter::Set_Value(void *Value)
793 {
794  switch( _Set_Value(Value) )
795  {
797  return( false );
798 
800  has_Changed();
801  }
802 
803  return( true );
804 }
805 
806 //---------------------------------------------------------
808 {
809  if( Value )
810  {
811  switch( Value->Get_Type() )
812  {
813  default:
814  break;
815 
818  return( Set_Value(Value->asInt()) );
819  }
820  }
821 
822  return( Assign(Value) );
823 }
824 
825 //---------------------------------------------------------
827 {
828  return( false );
829 }
830 
831 //---------------------------------------------------------
832 bool CSG_Parameter::has_Changed(int Check_Flags)
833 {
834  _Set_String();
835 
836  return( m_pParameters && m_pParameters->_On_Parameter_Changed(this, Check_Flags) );
837 }
838 
839 //---------------------------------------------------------
841 {
842  // nop
843 }
844 
845 
847 // //
849 
850 //---------------------------------------------------------
852 {
853  m_Default.Printf("%d", Value);
854 
855  return( true );
856 }
857 
858 //---------------------------------------------------------
859 bool CSG_Parameter::Set_Default(double Value)
860 {
861  m_Default.Printf("%f", Value);
862 
863  return( true );
864 }
865 
866 //---------------------------------------------------------
868 {
869  m_Default = Value;
870 
871  return( true );
872 }
873 
874 //---------------------------------------------------------
876 {
877  return( m_Default );
878 }
879 
880 //---------------------------------------------------------
882 {
883  return( m_Default.Cmp(asString()) == 0 );
884 }
885 
886 //---------------------------------------------------------
888 {
889  return( Set_Value(m_Default) );
890 }
891 
892 
894 // //
896 
897 //---------------------------------------------------------
898 bool CSG_Parameter::Check(bool bSilent)
899 {
901  {
902  return( asParameters()->DataObjects_Check(bSilent) );
903  }
904 
905  //-----------------------------------------------------
907  {
908  if( m_pParameters->Get_Manager() && !m_pParameters->Get_Manager()->Exists(*asGrid_System()) )
909  {
910  Set_Value((void *)NULL);
911  }
912 
913  return( true ); // ( false );
914  }
915 
916  //-----------------------------------------------------
917  if( is_DataObject() )
918  {
919  if( is_Input() || (is_Output() && asDataObject() != DATAOBJECT_CREATE) )
920  {
921  if( m_pParameters->Get_Manager() && !m_pParameters->Get_Manager()->Exists(asDataObject()) )
922  {
924  }
925  }
926 
927  return( is_Optional() || !is_Enabled() || asDataObject() );
928  }
929 
930  //-----------------------------------------------------
931  else if( is_DataObject_List() )
932  {
933  for(int j=asList()->Get_Item_Count()-1; j>=0; j--)
934  {
935  CSG_Data_Object *pDataObject = asList()->Get_Item(j);
936 
937  if( !pDataObject || (m_pParameters->Get_Manager() && !m_pParameters->Get_Manager()->Exists(pDataObject)) )
938  {
939  asList()->Del_Item(j, false);
940  }
941  }
942 
943  _Set_String();
944 
945  asList()->Update_Data();
946 
947  return( is_Optional() || !is_Enabled() || is_Output() || asList()->Get_Item_Count() > 0 );
948  }
949 
950  //-----------------------------------------------------
951  return( true );
952 }
953 
954 
956 // //
958 
959 //---------------------------------------------------------
960 int CSG_Parameter::_asInt (void) const { return( 0 ); }
961 double CSG_Parameter::_asDouble (void) const { return( 0. ); }
962 void * CSG_Parameter::_asPointer (void) const { return( NULL ); }
963 const SG_Char * CSG_Parameter::_asString (void) const { return( m_String ); }
964 
965 //---------------------------------------------------------
967 const SG_Char * CSG_Parameter::asFont (void) const { return( Get_Type() != PARAMETER_TYPE_Font ? NULL : (const SG_Char *)asPointer() ); }
970 
971 //---------------------------------------------------------
973 CSG_Grid * CSG_Parameter::asGrid (void) const { CSG_Data_Object *pObject = asDataObject(); return( !pObject || pObject == DATAOBJECT_CREATE || pObject->Get_ObjectType() != SG_DATAOBJECT_TYPE_Grid ? NULL : (CSG_Grid *)pObject ); }
974 CSG_Grids * CSG_Parameter::asGrids (void) const { CSG_Data_Object *pObject = asDataObject(); return( !pObject || pObject == DATAOBJECT_CREATE || pObject->Get_ObjectType() != SG_DATAOBJECT_TYPE_Grids ? NULL : (CSG_Grids *)pObject ); }
975 CSG_TIN * CSG_Parameter::asTIN (void) const { CSG_Data_Object *pObject = asDataObject(); return( !pObject || pObject == DATAOBJECT_CREATE || pObject->Get_ObjectType() != SG_DATAOBJECT_TYPE_TIN ? NULL : (CSG_TIN *)pObject ); }
976 CSG_PointCloud * CSG_Parameter::asPointCloud (void) const { CSG_Data_Object *pObject = asDataObject(); return( !pObject || pObject == DATAOBJECT_CREATE || pObject->Get_ObjectType() != SG_DATAOBJECT_TYPE_PointCloud ? NULL : (CSG_PointCloud *)pObject ); }
977 
978 //---------------------------------------------------------
980 {
981  CSG_Data_Object *pObject = asDataObject();
982 
983  if( pObject && pObject != DATAOBJECT_CREATE
984  && (pObject->Get_ObjectType() == SG_DATAOBJECT_TYPE_Shapes
986  {
987  return( (CSG_Shapes *)pObject );
988  }
989 
990  return( NULL );
991 }
992 
993 //---------------------------------------------------------
995 {
996  switch( Get_Type() )
997  {
998  default: {
999  CSG_Data_Object *pObject = asDataObject();
1000 
1001  if( pObject && pObject != DATAOBJECT_CREATE
1002  && (pObject->Get_ObjectType() == SG_DATAOBJECT_TYPE_Table
1003  || pObject->Get_ObjectType() == SG_DATAOBJECT_TYPE_Shapes
1004  || pObject->Get_ObjectType() == SG_DATAOBJECT_TYPE_TIN
1005  || pObject->Get_ObjectType() == SG_DATAOBJECT_TYPE_PointCloud) )
1006  {
1007  return( (CSG_Table *)pObject );
1008  }
1009  } break;
1010 
1011  case PARAMETER_TYPE_Grids :
1012  return( asGrids() ? asGrids()->Get_Attributes_Ptr() : NULL );
1013 
1015  return( (CSG_Table *)asPointer() );
1016  }
1017 
1018  return( NULL );
1019 }
1020 
1021 //---------------------------------------------------------
1023 {
1029  {
1030  return( (CSG_Parameter_Value *)this );
1031  }
1032 
1033  return( NULL );
1034 }
1035 
1039  && Get_Type() != PARAMETER_TYPE_Data_Type ? NULL : (CSG_Parameter_Choice *)this ); }
1044 
1045 //---------------------------------------------------------
1046 CSG_Parameter_List * CSG_Parameter::asList (void) const { return( !is_DataObject_List() ? NULL : (CSG_Parameter_List *)this ); }
1053 
1054 
1056 // //
1058 
1059 //---------------------------------------------------------
1060 void CSG_Parameter::_Add_Child(CSG_Parameter *pChild)
1061 {
1062  m_Children = (CSG_Parameter **)SG_Realloc(m_Children, (m_nChildren + 1) * sizeof(CSG_Parameter *));
1063  m_Children[m_nChildren++] = pChild;
1064 }
1065 
1066 
1068 // //
1070 
1071 //---------------------------------------------------------
1073 {
1074  if( pSource && Get_Type() == pSource->Get_Type() )
1075  {
1076  m_bEnabled = pSource->m_bEnabled;
1077  m_Default = pSource->m_Default;
1078 
1079  if( _Assign(pSource) )
1080  {
1081  _Set_String();
1082 
1083  return( true );
1084  }
1085  }
1086 
1087  return( false );
1088 }
1089 
1091 {
1092  return( true );
1093 }
1094 
1095 //---------------------------------------------------------
1096 bool CSG_Parameter::Serialize(CSG_MetaData &MetaData, bool bSave)
1097 {
1098  if( bSave )
1099  {
1101  {
1102  return( true );
1103  }
1104 
1105  CSG_MetaData &Child = *MetaData.Add_Child(
1106  is_Option () ? "OPTION" :
1107  is_DataObject () ? "DATA" :
1108  is_DataObject_List() ? "DATA_LIST" : "PARAMETER"
1109  );
1110 
1111  Child.Add_Property("type" , Get_Type_Identifier ());
1112  Child.Add_Property("id" , Get_Identifier ());
1113  Child.Add_Property("name" , Get_Name ());
1114  Child.Add_Property("parms", Get_Parameters()->Get_Identifier());
1115 
1116  _Serialize(Child, bSave);
1117 
1118  return( true );
1119  }
1120  else if( MetaData.Cmp_Property("type", Get_Type_Identifier())
1121  && MetaData.Cmp_Property("id" , Get_Identifier ())
1122  && _Serialize(MetaData, bSave) )
1123  {
1124  _Set_String();
1125 
1126  return( true );
1127  }
1128 
1129  return( false );
1130 }
1131 
1132 bool CSG_Parameter::_Serialize(CSG_MetaData &Entry, bool bSave)
1133 {
1134  Entry.Set_Content("-");
1135 
1136  return( true );
1137 }
1138 
1139 
1141 // //
1143 
1144 //---------------------------------------------------------
1146 {
1147  m_pParameters = NULL;
1148 }
1149 
1150 //---------------------------------------------------------
1151 bool CSG_Parameters_Grid_Target::Create(CSG_Parameters *pParameters, bool bAddDefaultGrid, CSG_Parameter *pParent, const CSG_String &Prefix)
1152 {
1153  return( Create(pParameters, bAddDefaultGrid, pParent ? pParent->Get_Identifier() : SG_T(""), Prefix) );
1154 }
1155 
1156 bool CSG_Parameters_Grid_Target::Create(CSG_Parameters *pParameters, bool bAddDefaultGrid, const CSG_String &ParentID, const CSG_String &Prefix)
1157 {
1158  if( pParameters == NULL )
1159  {
1160  return( false );
1161  }
1162 
1163  m_pParameters = pParameters;
1164  m_Prefix = Prefix;
1165 
1166  //-----------------------------------------------------
1167  CSG_String TargetID(m_Prefix + "DEFINITION");
1168 
1169  m_pParameters->Add_Choice(
1170  ParentID, TargetID, _TL("Target Grid System"),
1171  _TL(""),
1172  CSG_String::Format("%s|%s",
1173  _TL("user defined"),
1174  _TL("grid or grid system")
1175  ), 0
1176  );
1177 
1178  //-----------------------------------------------------
1179  m_pParameters->Add_Double(TargetID, m_Prefix + "USER_SIZE", _TL("Cellsize"), _TL(""), 1., 0., true);
1180  m_pParameters->Add_Double(TargetID, m_Prefix + "USER_XMIN", _TL("West" ), _TL(""), 0.);
1181  m_pParameters->Add_Double(TargetID, m_Prefix + "USER_XMAX", _TL("East" ), _TL(""), 100.);
1182  m_pParameters->Add_Double(TargetID, m_Prefix + "USER_YMIN", _TL("South" ), _TL(""), 0.);
1183  m_pParameters->Add_Double(TargetID, m_Prefix + "USER_YMAX", _TL("North" ), _TL(""), 100.);
1184  m_pParameters->Add_Int (TargetID, m_Prefix + "USER_COLS", _TL("Columns" ), _TL("Number of cells in East-West direction." ), 101, 1, true);
1185  m_pParameters->Add_Int (TargetID, m_Prefix + "USER_ROWS", _TL("Rows" ), _TL("Number of cells in North-South direction."), 101, 1, true);
1186  m_pParameters->Add_Choice(TargetID, m_Prefix + "USER_FITS", _TL("Fit" ), _TL(""),
1187  CSG_String::Format("%s|%s",
1188  _TL("nodes"),
1189  _TL("cells")
1190  ), 0
1191  );
1192 
1193  //-----------------------------------------------------
1194  m_pParameters->Add_Grid_System(TargetID, m_Prefix + "SYSTEM", _TL("Grid System"), _TL(""));
1195 
1196  m_pParameters->Add_Grid(m_Prefix + "SYSTEM", m_Prefix + "TEMPLATE", _TL("Target System"),
1197  _TL("use this grid's system for output grids"), PARAMETER_INPUT_OPTIONAL, false
1198  )->Set_UseInGUI(false);
1199 
1200  //-----------------------------------------------------
1201  if( bAddDefaultGrid )
1202  {
1203  Add_Grid(m_Prefix + "OUT_GRID", _TL("Target Grid"), false);
1204  }
1205 
1206  return( true );
1207 }
1208 
1209 
1211 // //
1213 
1214 //---------------------------------------------------------
1216 {
1217  return( pParameter && pParameters && m_pParameters && m_pParameters->Get_Identifier().Cmp(pParameters->Get_Identifier()) == 0
1218  && On_Parameter_Changed(pParameters, pParameter, m_Prefix)
1219  );
1220 }
1221 
1222 //---------------------------------------------------------
1224 {
1225  if( !pParameter || !pParameters )
1226  {
1227  return( false );
1228  }
1229 
1230  CSG_Parameter *pSize = (*pParameters)(Prefix + "USER_SIZE");
1231  CSG_Parameter *pXMin = (*pParameters)(Prefix + "USER_XMIN");
1232  CSG_Parameter *pXMax = (*pParameters)(Prefix + "USER_XMAX");
1233  CSG_Parameter *pYMin = (*pParameters)(Prefix + "USER_YMIN");
1234  CSG_Parameter *pYMax = (*pParameters)(Prefix + "USER_YMAX");
1235  CSG_Parameter *pRows = (*pParameters)(Prefix + "USER_ROWS");
1236  CSG_Parameter *pCols = (*pParameters)(Prefix + "USER_COLS");
1237  CSG_Parameter *pFits = (*pParameters)(Prefix + "USER_FITS");
1238 
1239  double Size = pSize->asDouble();
1240 
1241  double xMin = pXMin->asDouble(), xMax = pXMax->asDouble();
1242  double yMin = pYMin->asDouble(), yMax = pYMax->asDouble();
1243 
1244  //-----------------------------------------------------
1245  bool bChanged = true;
1246 
1247  if( pParameter->Cmp_Identifier(pFits->Get_Identifier()) )
1248  {
1249  if( pFits->asInt() == 0 ) // fit cells >> fit nodes
1250  {
1251  xMin += 0.5 * Size; xMax -= 0.5 * Size;
1252  yMin += 0.5 * Size; yMax -= 0.5 * Size;
1253  }
1254  }
1255  else
1256  {
1257  if( pFits->asInt() == 1 ) // fit cells >> fit nodes
1258  {
1259  xMin += 0.5 * Size; xMax -= 0.5 * Size;
1260  yMin += 0.5 * Size; yMax -= 0.5 * Size;
1261  }
1262 
1263  if( pParameter->Cmp_Identifier(pSize->Get_Identifier()) && Size > 0. )
1264  {
1265  xMax = xMin + Size * (int)(0.5 + (xMax - xMin) / Size);
1266  yMax = yMin + Size * (int)(0.5 + (yMax - yMin) / Size);
1267  }
1268  else if( pParameter->Cmp_Identifier(pCols->Get_Identifier()) && pCols->asInt() > 0 )
1269  {
1270  xMax = xMin + Size * (pCols->asInt() - 1);
1271  }
1272  else if( pParameter->Cmp_Identifier(pXMin->Get_Identifier()) )
1273  {
1274  xMax = xMin + Size * (xMin > xMax ? (pCols->asInt() - 1) : (int)(0.5 + (xMax - xMin) / Size));
1275  }
1276  else if( pParameter->Cmp_Identifier(pXMax->Get_Identifier()) )
1277  {
1278  xMin = xMax - Size * (xMin > xMax ? (pCols->asInt() - 1) : (int)(0.5 + (xMax - xMin) / Size));
1279  }
1280  else if( pParameter->Cmp_Identifier(pRows->Get_Identifier()) && pRows->asInt() > 0 )
1281  {
1282  yMax = yMin + Size * (pRows->asInt() - 1);
1283  }
1284  else if( pParameter->Cmp_Identifier(pYMin->Get_Identifier()) )
1285  {
1286  yMax = yMin + Size * (yMin > yMax ? (pRows->asInt() - 1) : (int)(0.5 + (yMax - yMin) / Size));
1287  }
1288  else if( pParameter->Cmp_Identifier(pYMax->Get_Identifier()) )
1289  {
1290  yMin = yMax - Size * (yMin > yMax ? (pRows->asInt() - 1) : (int)(0.5 + (yMax - yMin) / Size));
1291  }
1292  else
1293  {
1294  bChanged = false; // none of the relevant parameters did change so far
1295  }
1296  }
1297 
1298  //-----------------------------------------------------
1299  if( bChanged )
1300  {
1301  pCols->Set_Value(1 + (int)((xMax - xMin) / Size));
1302  pRows->Set_Value(1 + (int)((yMax - yMin) / Size));
1303 
1304  if( pFits->asInt() == 1 )
1305  {
1306  xMin -= 0.5 * Size; xMax += 0.5 * Size;
1307  yMin -= 0.5 * Size; yMax += 0.5 * Size;
1308  }
1309 
1310  pXMin->Set_Value(xMin);
1311  pXMax->Set_Value(xMax);
1312  pYMin->Set_Value(yMin);
1313  pYMax->Set_Value(yMax);
1314 
1315  return( true );
1316  }
1317 
1318  //-----------------------------------------------------
1319  CSG_Parameter *pZSize = (*pParameters)(Prefix + "USER_ZSIZE");
1320  CSG_Parameter *pZMin = (*pParameters)(Prefix + "USER_ZMIN" );
1321  CSG_Parameter *pZMax = (*pParameters)(Prefix + "USER_ZMAX" );
1322  CSG_Parameter *pZNum = (*pParameters)(Prefix + "USER_ZNUM" );
1323 
1324  if( pZSize && pZMin && pZMax && pZNum )
1325  {
1326  double zSize = pZSize->asDouble(), zMin = pZMin ->asDouble(), zMax = pZMax ->asDouble();
1327 
1328  bChanged = true;
1329 
1330  if( pParameter->Cmp_Identifier(pZSize->Get_Identifier()) && zSize > 0. )
1331  {
1332  zMax = zMin + zSize * (int)(0.5 + (zMax - zMin) / zSize);
1333  }
1334  else if( pParameter->Cmp_Identifier(pZNum->Get_Identifier()) && pZNum->asInt() > 0 )
1335  {
1336  zMax = zMin + zSize * pZNum->asInt();
1337  }
1338  else if( pParameter->Cmp_Identifier(pZMin->Get_Identifier()) )
1339  {
1340  zMax = zMin + zSize * (zMin > zMax ? pZNum->asInt() : (int)(0.5 + (zMax - zMin) / zSize));
1341  }
1342  else if( pParameter->Cmp_Identifier(pZMax->Get_Identifier()) )
1343  {
1344  zMin = zMax - zSize * (zMin > zMax ? pZNum->asInt() : (int)(0.5 + (zMax - zMin) / zSize));
1345  }
1346  else
1347  {
1348  bChanged = false;
1349  }
1350 
1351  if( bChanged )
1352  {
1353  pZNum->Set_Value(1 + (int)((zMax - zMin) / zSize));
1354 
1355  pZMin->Set_Value(zMin);
1356  pZMax->Set_Value(zMax);
1357  }
1358  }
1359 
1360  return( true );
1361 }
1362 
1363 //---------------------------------------------------------
1365 {
1366  return( pParameter && pParameters && m_pParameters && m_pParameters->Get_Identifier().Cmp(pParameters->Get_Identifier()) == 0
1367  && On_Parameters_Enable(pParameters, pParameter, m_Prefix)
1368  );
1369 }
1370 
1371 //---------------------------------------------------------
1373 {
1374  if( !pParameter || !pParameters || !(pParameter = (*pParameters)(Prefix + "DEFINITION")) )
1375  {
1376  return( false );
1377  }
1378 
1379  pParameters->Set_Enabled(Prefix + "SYSTEM" , pParameter->asInt() == 1);
1380  pParameters->Set_Enabled(Prefix + "TEMPLATE" , pParameter->asInt() == 1);
1381 
1382  pParameters->Set_Enabled(Prefix + "USER_SIZE", pParameter->asInt() == 0);
1383  pParameters->Set_Enabled(Prefix + "USER_XMIN", pParameter->asInt() == 0);
1384  pParameters->Set_Enabled(Prefix + "USER_XMAX", pParameter->asInt() == 0);
1385  pParameters->Set_Enabled(Prefix + "USER_YMIN", pParameter->asInt() == 0);
1386  pParameters->Set_Enabled(Prefix + "USER_YMAX", pParameter->asInt() == 0);
1387  pParameters->Set_Enabled(Prefix + "USER_ROWS", pParameter->asInt() == 0);
1388  pParameters->Set_Enabled(Prefix + "USER_COLS", pParameter->asInt() == 0);
1389  pParameters->Set_Enabled(Prefix + "USER_FITS", pParameter->asInt() == 0);
1390  pParameters->Set_Enabled(Prefix + "USER_OPTS", pParameter->asInt() == 0);
1391  pParameters->Set_Enabled(Prefix + "USER_Z" , pParameter->asInt() == 0);
1392 
1393  return( true );
1394 }
1395 
1396 
1398 // //
1400 
1401 //---------------------------------------------------------
1410 bool CSG_Parameters_Grid_Target::Set_User_Defined(CSG_Parameters *pParameters, const TSG_Rect &Extent, int Rows, int Rounding)
1411 {
1412  if( !m_pParameters->Get_Tool() || !m_pParameters->Get_Tool()->has_GUI() ) // no cancel button, so set parameters directly
1413  {
1414  pParameters = m_pParameters;
1415  }
1416 
1417  if( !m_pParameters || !pParameters || m_pParameters->Get_Identifier().Cmp(pParameters->Get_Identifier()) )
1418  {
1419  return( false );
1420  }
1421 
1422  if( Rows < 1 && (Rows = (*m_pParameters)(m_Prefix + "USER_ROWS")->asInt()) < 1 )
1423  {
1424  Rows = 100;
1425  }
1426 
1427  //-----------------------------------------------------
1428  CSG_Rect r(Extent);
1429 
1430  if( r.Get_XRange() == 0. && r.Get_YRange() == 0. )
1431  {
1432  r.Inflate(0.5 * Rows, false); // assume cellsize = 1.
1433  }
1434  else if( r.Get_XRange() == 0. )
1435  {
1436  double d = 0.5 * r.Get_YRange() / Rows; r.xMin -= d; r.xMax += d; // inflate by half cellsize
1437  }
1438  else if( r.Get_YRange() == 0. )
1439  {
1440  double d = 0.5 * r.Get_XRange() / Rows; r.yMin -= d; r.yMax += d; // inflate by half cellsize
1441  }
1442 
1443  //-----------------------------------------------------
1444  double Size = r.Get_YRange() / (Rows - 1);
1445 
1446  int Cols = 1 + (int)(0.5 + r.Get_XRange() / Size);
1447 
1448  if( Rounding > 0 )
1449  {
1450  Size = SG_Get_Rounded_To_SignificantFigures(Size, Rounding);
1451 
1452  r.xMin = r.Get_XCenter() - Size * Cols / 2.;
1453  r.yMin = r.Get_YCenter() - Size * Rows / 2.;
1454  r.yMax = r.Get_YMin () + Size * (Rows - 1);
1455  }
1456 
1457  r.xMax = r.Get_XMin() + Size * (Cols - 1);
1458 
1459  //-----------------------------------------------------
1460  if( (*pParameters)(m_Prefix + "USER_FITS")->asInt() == 1 ) // fit to cells
1461  {
1462  r.Inflate(0.5 * Size, false);
1463  }
1464 
1465  bool bCallback = pParameters->Set_Callback(false);
1466 
1467  pParameters->Set_Parameter(m_Prefix + "USER_SIZE", Size );
1468  pParameters->Set_Parameter(m_Prefix + "USER_XMIN", r.Get_XMin());
1469  pParameters->Set_Parameter(m_Prefix + "USER_XMAX", r.Get_XMax());
1470  pParameters->Set_Parameter(m_Prefix + "USER_YMIN", r.Get_YMin());
1471  pParameters->Set_Parameter(m_Prefix + "USER_YMAX", r.Get_YMax());
1472  pParameters->Set_Parameter(m_Prefix + "USER_COLS", Cols );
1473  pParameters->Set_Parameter(m_Prefix + "USER_ROWS", Rows );
1474 
1475  pParameters->Set_Callback(bCallback);
1476 
1477  return( true );
1478 }
1479 
1480 //---------------------------------------------------------
1485 bool CSG_Parameters_Grid_Target::Set_User_Defined(CSG_Parameters *pParameters, CSG_Shapes *pPoints, int Scale, int Rounding)
1486 {
1487  if( !pPoints || pPoints->Get_Count() <= 0 || pPoints->Get_Extent().Get_Area() <= 0. )
1488  {
1489  return( false );
1490  }
1491 
1492  CSG_Rect r = pPoints->Get_Extent();
1493 
1494  double Size = sqrt(r.Get_Area() / pPoints->Get_Count()) / (Scale > 1 ? Scale : 1); // edge length of a square given as average area per point (cell size)
1495 
1496  if( Rounding > 0 )
1497  {
1498  Size = SG_Get_Rounded_To_SignificantFigures(Size, Rounding);
1499 
1500  r.xMin = Size * floor(r.xMin / Size);
1501  r.xMax = Size * ceil (r.xMax / Size);
1502  r.yMin = Size * floor(r.yMin / Size);
1503  r.yMax = Size * ceil (r.yMax / Size);
1504  }
1505 
1506  int Rows = 1 + (int)(0.5 + r.Get_YRange() / Size);
1507 
1508  return( Set_User_Defined(pParameters, r, Rows, 0) );
1509 }
1510 
1511 //---------------------------------------------------------
1516 {
1517  return( System.is_Valid() && Set_User_Defined(pParameters, System.Get_Extent(), System.Get_NY(), 0) );
1518 }
1519 
1520 //---------------------------------------------------------
1524 bool CSG_Parameters_Grid_Target::Set_User_Defined(CSG_Parameters *pParameters, double xMin, double yMin, double Cellsize, int nx, int ny)
1525 {
1526  return( Set_User_Defined(pParameters, CSG_Grid_System(Cellsize, xMin, yMin, nx, ny)) );
1527 }
1528 
1529 //---------------------------------------------------------
1533 bool CSG_Parameters_Grid_Target::Set_User_Defined_ZLevels(CSG_Parameters *pParameters, double zMin, double zMax, int nLevels, int Rounding)
1534 {
1535  if( !m_pParameters->Get_Tool()->has_GUI() ) // no cancel button, so set parameters directly
1536  {
1537  pParameters = m_pParameters;
1538  }
1539 
1540  if( !m_pParameters || !pParameters || m_pParameters->Get_Identifier().Cmp(pParameters->Get_Identifier()) )
1541  {
1542  return( false );
1543  }
1544 
1545  if( nLevels < 1 )
1546  {
1547  nLevels = 100;
1548  }
1549 
1550  //-----------------------------------------------------
1551  if( zMin > zMax )
1552  {
1553  double z = zMin; zMin = zMax; zMax = z;
1554  }
1555 
1556  if( zMax - zMin <= 0. )
1557  {
1558  zMin -= 0.5 * nLevels;
1559  zMax += 0.5 * nLevels; // assume cellsize = 1.
1560  }
1561 
1562  //-----------------------------------------------------
1563  double Size = (zMax - zMin) / (nLevels - 1.);
1564 
1565  if( Rounding > 0 )
1566  {
1567  Size = SG_Get_Rounded_To_SignificantFigures(Size, Rounding);
1568 
1569  zMin = Size * floor(zMin / Size);
1570  zMax = Size * ceil (zMax / Size);
1571  }
1572 
1573  //-----------------------------------------------------
1574  if( (*pParameters)(m_Prefix + "USER_FITS")->asInt() == 1 )
1575  {
1576  zMin -= 0.5 * Size;
1577  zMax += 0.5 * Size;
1578  }
1579 
1580  bool bCallback = pParameters->Set_Callback(false);
1581 
1582  pParameters->Set_Parameter(m_Prefix + "USER_ZSIZE", Size );
1583  pParameters->Set_Parameter(m_Prefix + "USER_ZMIN" , zMin );
1584  pParameters->Set_Parameter(m_Prefix + "USER_ZMAX" , zMax );
1585  pParameters->Set_Parameter(m_Prefix + "USER_ZNUM" , nLevels);
1586 
1587  pParameters->Set_Callback(bCallback);
1588 
1589  return( true );
1590 }
1591 
1592 
1594 // //
1596 
1597 //---------------------------------------------------------
1598 bool CSG_Parameters_Grid_Target::Add_Grid(const CSG_String &Identifier, const CSG_String &Name, bool bOptional)
1599 {
1600  if( !m_pParameters || Identifier.Length() == 0 || (*m_pParameters)(Identifier) != NULL )
1601  {
1602  return( false );
1603  }
1604 
1605  CSG_Parameter *pTarget = (*m_pParameters)(m_Prefix + "DEFINITION");
1606  CSG_Parameter *pSystem = NULL;
1607 
1608  for(int i=0; i<pTarget->Get_Children_Count() && !pSystem; i++)
1609  {
1610  if( pTarget->Get_Child(i)->Get_Type() == PARAMETER_TYPE_Grid_System )
1611  {
1612  pSystem = pTarget->Get_Child(i);
1613  }
1614  }
1615 
1616  m_pParameters->Add_Grid (pSystem ? pSystem->Get_Identifier() : SG_T(""), Identifier, Name, _TL(""), bOptional ? PARAMETER_OUTPUT_OPTIONAL : PARAMETER_OUTPUT, false);
1617 
1618  if( bOptional && m_pParameters->Get_Tool()->has_GUI() )
1619  {
1620  CSG_Parameter *pNode = (*m_pParameters)(m_Prefix + "USER_OPTS");
1621 
1622  if( !pNode )
1623  {
1624  pNode = m_pParameters->Add_Node(pTarget->Get_Identifier(), m_Prefix + "USER_OPTS", _TL("Optional Target Grids"), _TL(""));
1625  }
1626 
1627  m_pParameters->Add_Bool(pNode->Get_Identifier(), Identifier + "_CREATE", Name, _TL(""), false);
1628  }
1629 
1630  return( true );
1631 }
1632 
1633 //---------------------------------------------------------
1634 bool CSG_Parameters_Grid_Target::Add_Grids(const CSG_String &Identifier, const CSG_String &Name, bool bOptional, bool bZLevels)
1635 {
1636  if( !m_pParameters || Identifier.Length() == 0 || (*m_pParameters)(Identifier) != NULL )
1637  {
1638  return( false );
1639  }
1640 
1641  CSG_Parameter *pTarget = (*m_pParameters)(m_Prefix + "DEFINITION");
1642  CSG_Parameter *pSystem = NULL;
1643 
1644  for(int i=0; i<pTarget->Get_Children_Count() && !pSystem; i++)
1645  {
1646  if( pTarget->Get_Child(i)->Get_Type() == PARAMETER_TYPE_Grid_System )
1647  {
1648  pSystem = pTarget->Get_Child(i);
1649  }
1650  }
1651 
1652  m_pParameters->Add_Grids(pSystem ? pSystem->Get_Identifier() : SG_T(""), Identifier, Name, _TL(""), bOptional ? PARAMETER_OUTPUT_OPTIONAL : PARAMETER_OUTPUT, false);
1653 
1654  if( bOptional && m_pParameters->Get_Tool()->has_GUI() )
1655  {
1656  CSG_Parameter *pNode = (*m_pParameters)(m_Prefix + "USER_OPTS");
1657 
1658  if( !pNode )
1659  {
1660  pNode = m_pParameters->Add_Node(pTarget->Get_Identifier(), m_Prefix + "USER_OPTS", _TL("Optional Target Grids"), _TL(""));
1661  }
1662 
1663  m_pParameters->Add_Bool(pNode->Get_Identifier(), Identifier + "_CREATE", Name, _TL(""), false);
1664  }
1665 
1666  if( bZLevels )
1667  {
1668  pTarget = m_pParameters->Add_Node(pTarget, "USER_Z", _TL("Z Levels"), _TL(""));
1669 
1670  m_pParameters->Add_Double(pTarget, m_Prefix + "USER_ZSIZE", _TL("Cellsize"), _TL(""), 1., 0., true);
1671  m_pParameters->Add_Double(pTarget, m_Prefix + "USER_ZMIN" , _TL("Bottom" ), _TL(""), 0.);
1672  m_pParameters->Add_Double(pTarget, m_Prefix + "USER_ZMAX" , _TL("Top" ), _TL(""), 100.);
1673  m_pParameters->Add_Int (pTarget, m_Prefix + "USER_ZNUM" , _TL("Levels" ), _TL(""), 101, 1, true);
1674  }
1675 
1676  return( true );
1677 }
1678 
1679 
1681 // //
1683 
1684 //---------------------------------------------------------
1686 {
1687  CSG_Grid_System System;
1688 
1689  if( m_pParameters )
1690  {
1691  if( (*m_pParameters)(m_Prefix + "DEFINITION")->asInt() == 0 ) // user defined
1692  {
1693  double Size = (*m_pParameters)(m_Prefix + "USER_SIZE")->asDouble();
1694 
1695  CSG_Rect r(
1696  (*m_pParameters)(m_Prefix + "USER_XMIN")->asDouble(),
1697  (*m_pParameters)(m_Prefix + "USER_YMIN")->asDouble(),
1698  (*m_pParameters)(m_Prefix + "USER_XMAX")->asDouble(),
1699  (*m_pParameters)(m_Prefix + "USER_YMAX")->asDouble()
1700  );
1701 
1702  if( (*m_pParameters)(m_Prefix + "USER_FITS")->asInt() == 1 )
1703  {
1704  r.Deflate(0.5 * Size, false);
1705  }
1706 
1707  System.Assign(Size, r);
1708  }
1709  else
1710  {
1711  CSG_Parameter *pParameter = (*m_pParameters)(m_Prefix + "SYSTEM");
1712 
1713  if( pParameter->asGrid_System() )
1714  {
1715  System.Assign(*pParameter->asGrid_System());
1716  }
1717  }
1718  }
1719 
1720  return( System );
1721 }
1722 
1723 //---------------------------------------------------------
1725 {
1726  if( !m_pParameters )
1727  {
1728  return( NULL );
1729  }
1730 
1731  CSG_Parameter *pParameter = (*m_pParameters)(Identifier);
1732 
1733  if( !pParameter || pParameter->Get_Type() != PARAMETER_TYPE_Grid )
1734  {
1735  return( NULL );
1736  }
1737 
1738  CSG_Grid_System System(Get_System());
1739 
1740  if( !System.is_Valid() )
1741  {
1742  return( NULL );
1743  }
1744 
1745  CSG_Parameter *pSystem = (*m_pParameters)(m_Prefix + "SYSTEM");
1746 
1747  if( pSystem->asGrid_System() && !pSystem->asGrid_System()->is_Equal(System) )
1748  {
1749  pSystem->asGrid_System()->Assign(System);
1750  }
1751 
1752  CSG_Grid *pGrid = NULL;
1753 
1754  if( (*m_pParameters)(m_Prefix + "DEFINITION")->asInt() == 0 && m_pParameters->Get_Tool()->has_GUI() )
1755  {
1756  if( (*m_pParameters)(Identifier + "_CREATE") == NULL
1757  || (*m_pParameters)(Identifier + "_CREATE")->asBool() )
1758  {
1759  pGrid = SG_Create_Grid(System, Type);
1760  }
1761  }
1762  else
1763  {
1764  pGrid = pParameter->asGrid();
1765 
1766  if( pParameter->asPointer() == DATAOBJECT_CREATE || (!pGrid && !pParameter->is_Optional()) )
1767  {
1768  pGrid = SG_Create_Grid(System, Type);
1769  }
1770  else if( pGrid && pGrid->Get_Type() != Type )
1771  {
1772  pGrid->Create(pGrid->Get_System(), Type);
1773  }
1774  }
1775 
1776  if( pGrid && pGrid != pParameter->asGrid() )
1777  {
1778  pParameter->Set_Value(pGrid);
1779  }
1780 
1781  return( pGrid );
1782 }
1783 
1784 
1786 // //
1788 
1789 //---------------------------------------------------------
1791 {
1792  return( Get_Grid(m_Prefix + "OUT_GRID", Type) );
1793 }
1794 
1795 //---------------------------------------------------------
1797 {
1798  if( !m_pParameters )
1799  {
1800  return( NULL );
1801  }
1802 
1803  CSG_Parameter *pParameter = (*m_pParameters)(Identifier);
1804 
1805  if( !pParameter || pParameter->Get_Type() != PARAMETER_TYPE_Grids )
1806  {
1807  return( NULL );
1808  }
1809 
1810  CSG_Grid_System System(Get_System());
1811 
1812  if( !System.is_Valid() )
1813  {
1814  return( NULL );
1815  }
1816 
1817  CSG_Grids *pGrids = NULL;
1818 
1819  if( (*m_pParameters)(m_Prefix + "DEFINITION")->asInt() == 0
1820  && (*m_pParameters)(Identifier + "_CREATE") )
1821  {
1822  if( (*m_pParameters)(Identifier + "_CREATE")->asBool() )
1823  {
1824  pGrids = SG_Create_Grids(System, 0, 0., Type);
1825  }
1826  }
1827  else
1828  {
1829  pGrids = pParameter->asGrids();
1830 
1831  if( pParameter->asPointer() == DATAOBJECT_CREATE || (!pGrids && !pParameter->is_Optional()) )
1832  {
1833  pGrids = SG_Create_Grids(System, 0, 0., Type);
1834  }
1835  }
1836 
1837  if( pGrids && pGrids != pParameter->asGrids() )
1838  {
1839  pParameter->Set_Value(pGrids);
1840  }
1841 
1842  if( pGrids
1843  && (*m_pParameters)(m_Prefix + "USER_ZSIZE")
1844  && (*m_pParameters)(m_Prefix + "USER_ZMIN" )
1845  && (*m_pParameters)(m_Prefix + "USER_ZNUM" ) )
1846  {
1847  int nz = (*m_pParameters)(m_Prefix + "USER_ZNUM" )->asInt ();
1848  double z = (*m_pParameters)(m_Prefix + "USER_ZMIN" )->asDouble();
1849  double dz = (*m_pParameters)(m_Prefix + "USER_ZSIZE")->asDouble();
1850 
1851  pGrids->Del_Grids();
1852 
1853  for(int iz=0; iz<nz; iz++, z+=dz)
1854  {
1855  pGrids->Add_Grid(z);
1856  }
1857  }
1858 
1859  return( pGrids );
1860 }
1861 
1862 //---------------------------------------------------------
1864 {
1865  return( Get_Grids(m_Prefix + "OUT_GRIDS", Type) );
1866 }
1867 
1868 
1870 // //
1871 // //
1872 // //
1874 
1875 //---------------------------------------------------------
CSG_Parameter::asColors
CSG_Colors * asColors(void) const
Definition: parameter.cpp:966
CSG_Grid::Get_Type
TSG_Data_Type Get_Type(void) const
Definition: grid.h:519
CSG_Parameter::asGridsList
class CSG_Parameter_Grids_List * asGridsList(void) const
Definition: parameter.cpp:1048
CSG_Rect
Definition: geo_tools.h:471
CSG_Parameter_Date
Definition: parameters.h:571
CSG_Parameter::Set_Value
virtual bool Set_Value(int Value)
Definition: parameter.cpp:745
CSG_Parameter::asPointer
void * asPointer(void) const
Definition: parameters.h:285
PARAMETER_TYPE_Double
@ PARAMETER_TYPE_Double
Definition: parameters.h:127
CSG_Parameter_Choices::Get_Selection_Count
int Get_Selection_Count(void) const
Definition: parameters.h:762
CSG_Parameters::Get_Parameter
CSG_Parameter * Get_Parameter(int i) const
Definition: parameters.h:1708
PARAMETER_TYPE_FilePath
@ PARAMETER_TYPE_FilePath
Definition: parameters.h:136
CSG_Parameters_Grid_Target::Add_Grid
bool Add_Grid(const CSG_String &ID, const CSG_String &Name, bool bOptional)
Definition: parameter.cpp:1598
PARAMETER_TYPE_Degree
@ PARAMETER_TYPE_Degree
Definition: parameters.h:128
SG_T
#define SG_T(s)
Definition: api_core.h:531
CSG_String::Printf
int Printf(const char *Format,...)
Definition: api_string.cpp:308
CSG_Parameters::Add_Grid_System
CSG_Parameter * Add_Grid_System(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Grid_System *pInit=NULL)
Definition: parameters.cpp:567
_TL
#define _TL(s)
Definition: api_core.h:1480
CSG_Parameter::asShapesList
class CSG_Parameter_Shapes_List * asShapesList(void) const
Definition: parameter.cpp:1050
PARAMETER_TYPE_Table_Fields
@ PARAMETER_TYPE_Table_Fields
Definition: parameters.h:145
CSG_String::Length
size_t Length(void) const
Definition: api_string.cpp:172
CSG_Parameter::m_String
CSG_String m_String
Definition: parameters.h:330
CSG_Parameter_Range::Get_Max
double Get_Max(void) const
Definition: parameter_data.cpp:832
CSG_Parameter::Get_Identifier
const SG_Char * Get_Identifier(void) const
Definition: parameter.cpp:546
CSG_Parameter::asInt
int asInt(void) const
Definition: parameters.h:281
CSG_Parameters::Get_Manager
class CSG_Data_Manager * Get_Manager(void) const
Definition: parameters.h:1674
PARAMETER_TYPE_Node
@ PARAMETER_TYPE_Node
Definition: parameters.h:123
CSG_Parameter::asString
const SG_Char * asString(void) const
Definition: parameters.h:284
CSG_Parameter::Get_Type_Name
CSG_String Get_Type_Name(void) const
Definition: parameter.cpp:128
CSG_Parameter::asTable
CSG_Table * asTable(void) const
Definition: parameter.cpp:994
CSG_Table_Record
Definition: table.h:130
CSG_MetaData::Set_Content
void Set_Content(const CSG_String &Content)
Definition: metadata.h:142
data_manager.h
CSG_Parameter_Table_List
Definition: parameters.h:1463
CSG_Rect::Get_XMax
double Get_XMax(void) const
Definition: geo_tools.h:501
PARAMETER_TYPE_Grids_List
@ PARAMETER_TYPE_Grids_List
Definition: parameters.h:155
CSG_Parameter::asTINList
class CSG_Parameter_TIN_List * asTINList(void) const
Definition: parameter.cpp:1051
PARAMETER_TYPE_String
@ PARAMETER_TYPE_String
Definition: parameters.h:134
CSG_Parameter::_Assign
virtual bool _Assign(CSG_Parameter *pSource)
Definition: parameter.cpp:1090
CSG_Grid_System
Definition: grid.h:200
CSG_Parameter::asDate
class CSG_Parameter_Date * asDate(void) const
Definition: parameter.cpp:1036
SG_Get_DataObject_Name
CSG_String SG_Get_DataObject_Name(TSG_Data_Object_Type Type)
Definition: dataobject.cpp:86
CSG_Table::Get_Record
virtual CSG_Table_Record * Get_Record(sLong Index) const
Definition: table.h:387
PARAMETER_TYPE_Int
@ PARAMETER_TYPE_Int
Definition: parameters.h:126
CSG_Grid::Create
bool Create(const CSG_Grid &Grid)
Definition: grid.cpp:230
CSG_Parameter_List::Get_Item
CSG_Data_Object * Get_Item(int Index) const
Definition: parameters.h:1368
SG_Get_Rounded_To_SignificantFigures
double SG_Get_Rounded_To_SignificantFigures(double Value, int Decimals)
Definition: mat_tools.cpp:107
CSG_Parameters::Add_Node
CSG_Parameter * Add_Node(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description)
Definition: parameters.cpp:371
CSG_Parameter::is_Input
bool is_Input(void) const
Definition: parameters.h:231
CSG_Parameter_Choices
Definition: parameters.h:747
CSG_Parameter::is_Compatible
bool is_Compatible(CSG_Parameter *pParameter) const
Definition: parameter.cpp:336
PARAMETER_TYPE_TIN
@ PARAMETER_TYPE_TIN
Definition: parameters.h:152
CSG_Parameter_Data_Object_Output
Definition: parameters.h:1165
CSG_Parameter::Get_Description
const SG_Char * Get_Description(void) const
Definition: parameter.cpp:578
CSG_Parameters::Add_Double
CSG_Parameter * Add_Double(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value=0.0, double Minimum=0.0, bool bMinimum=false, double Maximum=0.0, bool bMaximum=false)
Definition: parameters.cpp:406
CSG_Parameters_Grid_Target::Set_User_Defined
bool Set_User_Defined(CSG_Parameters *pParameters, const TSG_Rect &Extent, int Rows=0, int Rounding=2)
Definition: parameter.cpp:1410
CSG_Parameter::asTIN
CSG_TIN * asTIN(void) const
Definition: parameter.cpp:975
CSG_Parameter_Choices::Get_Item_Count
int Get_Item_Count(void) const
Definition: parameters.h:758
SSG_Rect::xMax
double xMax
Definition: geo_tools.h:465
SG_DATAOBJECT_TYPE_Grids
@ SG_DATAOBJECT_TYPE_Grids
Definition: dataobject.h:119
CSG_Parameters_Grid_Target::Get_System
CSG_Grid_System Get_System(void)
Definition: parameter.cpp:1685
CSG_Parameter::do_UseInCMD
bool do_UseInCMD(void) const
Definition: parameter.cpp:171
PARAMETER_TYPE_FixedTable
@ PARAMETER_TYPE_FixedTable
Definition: parameters.h:141
CSG_Parameters_Grid_Target::Create
bool Create(CSG_Parameters *pParameters, bool bAddDefaultGrid, CSG_Parameter *pParent, const CSG_String &Prefix="")
Definition: parameter.cpp:1151
CSG_Table::Get_Field_Count
int Get_Field_Count(void) const
Definition: table.h:355
CSG_Data_Manager::Exists
bool Exists(CSG_Data_Object *pObject) const
Definition: data_manager.cpp:389
CSG_Parameter::_asString
virtual const SG_Char * _asString(void) const
Definition: parameter.cpp:963
CSG_Parameter::_asDouble
virtual double _asDouble(void) const
Definition: parameter.cpp:961
SG_Free
SAGA_API_DLL_EXPORT void SG_Free(void *memblock)
Definition: api_memory.cpp:83
CSG_Data_Object::Get_ObjectType
virtual TSG_Data_Object_Type Get_ObjectType(void) const =0
Returns the object type as defined by TSG_Data_Object_Type. Used for run time type checking.
CSG_Parameter::asDataObject
CSG_Data_Object * asDataObject(void) const
Definition: parameter.cpp:972
CSG_Parameter::Assign
bool Assign(CSG_Parameter *pSource)
Definition: parameter.cpp:1072
CSG_Parameter_Value
Definition: parameters.h:434
SG_STR_CMP
#define SG_STR_CMP(s1, s2)
Definition: api_core.h:538
CSG_Rect::Get_Area
double Get_Area(void) const
Definition: geo_tools.h:508
PARAMETER_TYPE_PointCloud
@ PARAMETER_TYPE_PointCloud
Definition: parameters.h:147
CSG_Parameter::CSG_Parameter
CSG_Parameter(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint)
Definition: parameter.cpp:63
CSG_Parameter::asValue
class CSG_Parameter_Value * asValue(void) const
Definition: parameter.cpp:1022
CSG_Parameter::Set_Description
bool Set_Description(const CSG_String &Description)
Definition: parameter.cpp:571
CSG_Parameter::Get_Parameters
CSG_Parameters * Get_Parameters(void) const
Definition: parameter.cpp:99
CSG_Parameter::_Set_Value
virtual int _Set_Value(int Value)
Definition: parameter.cpp:739
CSG_Grid::Get_System
const CSG_Grid_System & Get_System(void) const
Definition: grid.h:531
CSG_String::Cmp
int Cmp(const CSG_String &String) const
Definition: api_string.cpp:515
tool.h
PARAMETER_INPUT_OPTIONAL
#define PARAMETER_INPUT_OPTIONAL
Definition: parameters.h:102
SSG_Rect::xMin
double xMin
Definition: geo_tools.h:465
SG_Parameter_Type_Get_Name
CSG_String SG_Parameter_Type_Get_Name(TSG_Parameter_Type Type)
Definition: parameter_data.cpp:64
PARAMETER_TYPE_Shapes_List
@ PARAMETER_TYPE_Shapes_List
Definition: parameters.h:157
SSG_Rect
Definition: geo_tools.h:464
CSG_Parameter::asGridList
class CSG_Parameter_Grid_List * asGridList(void) const
Definition: parameter.cpp:1047
PARAMETER_TYPE_Grids
@ PARAMETER_TYPE_Grids
Definition: parameters.h:149
CSG_Parameters::has_GUI
bool has_GUI(void) const
Definition: parameters.cpp:242
CSG_Parameter::Get_Type
virtual TSG_Parameter_Type Get_Type(void) const =0
CSG_Parameter::Serialize
bool Serialize(CSG_MetaData &MetaData, bool bSave)
Definition: parameter.cpp:1096
CSG_Table::is_Compatible
bool is_Compatible(const CSG_Table &Table, bool bExactMatch=false) const
Definition: table.cpp:436
CSG_Parameter::asGrid
CSG_Grid * asGrid(void) const
Definition: parameter.cpp:973
CSG_Parameter::is_DataObject_List
bool is_DataObject_List(void) const
Definition: parameter.cpp:294
CSG_Parameter::Set_UseInCMD
void Set_UseInCMD(bool bDoUse=false)
Definition: parameter.cpp:152
PARAMETER_TYPE_Choices
@ PARAMETER_TYPE_Choices
Definition: parameters.h:133
CSG_Parameter::ignore_Projection
bool ignore_Projection(void) const
Definition: parameters.h:250
PARAMETER_TYPE_Data_Type
@ PARAMETER_TYPE_Data_Type
Definition: parameters.h:131
CSG_TIN
Definition: tin.h:222
PARAMETER_TYPE_Colors
@ PARAMETER_TYPE_Colors
Definition: parameters.h:140
CSG_Parameters_Grid_Target::On_Parameter_Changed
bool On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
Definition: parameter.cpp:1215
CSG_Rect::Deflate
void Deflate(double d, bool bPercent=true)
Definition: geo_classes.cpp:826
CSG_Rect::Get_XRange
double Get_XRange(void) const
Definition: geo_tools.h:505
CSG_Colors::Get_Count
int Get_Count(void) const
Definition: api_core.h:1345
CSG_Table_Record::asString
const SG_Char * asString(int Field, int Decimals=-99) const
Definition: table_record.cpp:461
CSG_Data_Object
Definition: dataobject.h:180
CSG_Parameter
Definition: parameters.h:207
CSG_Rect::Get_YMin
double Get_YMin(void) const
Definition: geo_tools.h:502
PARAMETER_TYPE_Undefined
@ PARAMETER_TYPE_Undefined
Definition: parameters.h:165
CSG_Parameter::_asInt
virtual int _asInt(void) const
Definition: parameter.cpp:960
PARAMETER_TYPE_Table
@ PARAMETER_TYPE_Table
Definition: parameters.h:150
PARAMETER_TYPE_Bool
@ PARAMETER_TYPE_Bool
Definition: parameters.h:125
CSG_Colors::Get_Color
long Get_Color(int Index) const
Definition: api_core.h:1357
CSG_Parameter_List::Update_Data
virtual bool Update_Data(void)
Definition: parameters.h:1370
CSG_Parameters::Get_Count
int Get_Count(void) const
Definition: parameters.h:1681
SG_PARAMETER_DATA_SET_CHANGED
#define SG_PARAMETER_DATA_SET_CHANGED
Definition: parameters.h:196
DATAOBJECT_CREATE
#define DATAOBJECT_CREATE
Definition: dataobject.h:130
CSG_Parameter::asPointCloud
CSG_PointCloud * asPointCloud(void) const
Definition: parameter.cpp:976
CSG_Grid_System::is_Equal
bool is_Equal(const CSG_Grid_System &System) const
Definition: grid_system.cpp:302
PARAMETER_TYPE_Table_Field
@ PARAMETER_TYPE_Table_Field
Definition: parameters.h:144
CSG_Parameter::asShapes
CSG_Shapes * asShapes(void) const
Definition: parameter.cpp:979
CSG_Parameter::is_Enabled
bool is_Enabled(bool bCheckEnv=true) const
Definition: parameter.cpp:208
PARAMETER_DESCRIPTION_OPTIONAL
#define PARAMETER_DESCRIPTION_OPTIONAL
Definition: parameters.h:108
CSG_Parameter::Set_Default
bool Set_Default(int Value)
Definition: parameter.cpp:851
CSG_Parameter_List::Del_Item
virtual bool Del_Item(CSG_Data_Object *pItem, bool bUpdateData=true)
Definition: parameter_data.cpp:3025
PARAMETER_TYPE_Choice
@ PARAMETER_TYPE_Choice
Definition: parameters.h:132
CSG_Parameter::_Serialize
virtual bool _Serialize(CSG_MetaData &MetaData, bool bSave)
Definition: parameter.cpp:1132
CSG_Parameter_File_Name
Definition: parameters.h:853
CSG_Parameters_Grid_Target::Get_Grid
CSG_Grid * Get_Grid(const CSG_String &ID, TSG_Data_Type Type=SG_DATATYPE_Float)
Definition: parameter.cpp:1724
SG_Parameter_Type_Get_Identifier
CSG_String SG_Parameter_Type_Get_Identifier(TSG_Parameter_Type Type)
Definition: parameter_data.cpp:114
CSG_Parameter::asParameters
class CSG_Parameters * asParameters(void) const
Definition: parameter.cpp:969
CSG_Parameters_Grid_Target::Set_User_Defined_ZLevels
bool Set_User_Defined_ZLevels(CSG_Parameters *pParameters, double zMin, double zMax, int nLevels, int Rounding=2)
Definition: parameter.cpp:1533
CSG_Parameters::Get_Tool
class CSG_Tool * Get_Tool(void) const
Definition: parameters.h:1672
CSG_Parameter::Set_Name
bool Set_Name(const CSG_String &Name)
Definition: parameter.cpp:558
CSG_Parameters::Set_Enabled
void Set_Enabled(bool bEnabled=true)
Definition: parameters.cpp:336
CSG_Rect::Inflate
void Inflate(double d, bool bPercent=true)
Definition: geo_classes.cpp:816
CSG_Parameter_Grids_List
Definition: parameters.h:1437
CSG_Parameter_Choice::Get_Count
int Get_Count(void) const
Definition: parameters.h:682
CSG_MetaData::Add_Property
bool Add_Property(const CSG_String &Name, const CSG_String &Value)
Definition: metadata.cpp:544
CSG_Parameter::asDataType
class CSG_Parameter_Data_Type * asDataType(void) const
Definition: parameter.cpp:1037
CSG_Parameter::_asPointer
virtual void * _asPointer(void) const
Definition: parameter.cpp:962
CSG_Parameter::Get_Child
CSG_Parameter * Get_Child(int iChild) const
Definition: parameters.h:255
PARAMETER_DESCRIPTION_TYPE
#define PARAMETER_DESCRIPTION_TYPE
Definition: parameters.h:107
CSG_Parameter_Grid_List
Definition: parameters.h:1402
CSG_Parameter::~CSG_Parameter
virtual ~CSG_Parameter(void)
Definition: parameter.cpp:85
CSG_Parameter::is_Serializable
bool is_Serializable(void) const
Definition: parameter.cpp:318
CSG_Table::Get_Count
sLong Get_Count(void) const
Definition: table.h:385
CSG_Parameters_Grid_Target::Add_Grids
bool Add_Grids(const CSG_String &ID, const CSG_String &Name, bool bOptional, bool bZLevels=false)
Definition: parameter.cpp:1634
CSG_Parameters::Add_Int
CSG_Parameter * Add_Int(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Value=0, int Minimum=0, bool bMinimum=false, int Maximum=0, bool bMaximum=false)
Definition: parameters.cpp:401
CSG_Grid_System::Assign
bool Assign(const CSG_Grid_System &System)
Definition: grid_system.cpp:225
CSG_Parameters_Grid_Target::Get_Grids
CSG_Grids * Get_Grids(const CSG_String &ID, TSG_Data_Type Type=SG_DATATYPE_Float)
Definition: parameter.cpp:1796
SG_PARAMETER_DATA_SET_FALSE
#define SG_PARAMETER_DATA_SET_FALSE
Definition: parameters.h:194
PARAMETER_TYPE_Grid
@ PARAMETER_TYPE_Grid
Definition: parameters.h:148
CSG_Parameters_Grid_Target::CSG_Parameters_Grid_Target
CSG_Parameters_Grid_Target(void)
Definition: parameter.cpp:1145
CSG_Parameter::asPointCloudList
class CSG_Parameter_PointCloud_List * asPointCloudList(void) const
Definition: parameter.cpp:1052
CSG_Parameter_Range
Definition: parameters.h:610
PARAMETER_IGNORE_PROJECTION
#define PARAMETER_IGNORE_PROJECTION
Definition: parameters.h:98
PARAMETER_TYPE_Date
@ PARAMETER_TYPE_Date
Definition: parameters.h:129
CSG_Parameter::Toggle_Value
virtual bool Toggle_Value(void)
Definition: parameter.cpp:826
PARAMETER_TYPE_Grid_List
@ PARAMETER_TYPE_Grid_List
Definition: parameters.h:154
SG_Data_Type_Get_Name
CSG_String SG_Data_Type_Get_Name(TSG_Data_Type Type, bool bShort)
Definition: api_core.cpp:122
CSG_Parameter::_Set_String
virtual void _Set_String(void)
Definition: parameter.cpp:840
CSG_Parameters::Add_Grids
CSG_Parameter * Add_Grids(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, bool bSystem_Dependent=true, TSG_Data_Type Preferred_Type=SG_DATATYPE_Undefined)
Definition: parameters.cpp:658
CSG_Parameter::is_Optional
bool is_Optional(void) const
Definition: parameters.h:233
SSG_Rect::yMax
double yMax
Definition: geo_tools.h:465
SG_DATAOBJECT_TYPE_TIN
@ SG_DATAOBJECT_TYPE_TIN
Definition: dataobject.h:122
CSG_Parameters::Add_Grid
CSG_Parameter * Add_Grid(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, bool bSystem_Dependent=true, TSG_Data_Type Preferred_Type=SG_DATATYPE_Undefined)
Definition: parameters.cpp:582
SG_DATAOBJECT_TYPE_Grid
@ SG_DATAOBJECT_TYPE_Grid
Definition: dataobject.h:118
CSG_Parameter::is_Value_Equal
bool is_Value_Equal(CSG_Parameter *pParameter) const
Definition: parameter.cpp:395
CSG_Shapes::Get_Extent
virtual const CSG_Rect & Get_Extent(void)
Definition: shapes.h:811
CSG_Parameter::asFilePath
class CSG_Parameter_File_Name * asFilePath(void) const
Definition: parameter.cpp:1042
CSG_Grid_System::Get_NY
int Get_NY(void) const
Definition: grid.h:235
CSG_Parameter::is_Output
bool is_Output(void) const
Definition: parameters.h:232
parameters.h
SG_Create_Grids
CSG_Grids * SG_Create_Grids(void)
Definition: grids.cpp:65
CSG_String::Format
static CSG_String Format(const char *Format,...)
Definition: api_string.cpp:270
CSG_Parameter_List::Get_Item_Count
int Get_Item_Count(void) const
Definition: parameters.h:1367
CSG_Parameter_Shapes_List
Definition: parameters.h:1486
CSG_Parameters::Get_Identifier
const CSG_String & Get_Identifier(void) const
Definition: parameters.h:1685
CSG_Tool::has_GUI
bool has_GUI(void) const
Definition: tool.cpp:233
CSG_Table
Definition: table.h:283
CSG_MetaData::Cmp_Property
bool Cmp_Property(const CSG_String &Name, const CSG_String &String, bool bNoCase=false) const
Definition: metadata.cpp:673
SG_DATAOBJECT_TYPE_Shapes
@ SG_DATAOBJECT_TYPE_Shapes
Definition: dataobject.h:121
PARAMETER_NOT_FOR_GUI
#define PARAMETER_NOT_FOR_GUI
Definition: parameters.h:99
SG_DATAOBJECT_TYPE_Undefined
@ SG_DATAOBJECT_TYPE_Undefined
Definition: dataobject.h:124
CSG_Parameter::Get_Default
const CSG_String & Get_Default(void) const
Definition: parameter.cpp:875
CSG_Parameter::Get_Children_Count
int Get_Children_Count(void) const
Definition: parameters.h:254
CSG_Parameter_Choice::Get_Item
const SG_Char * Get_Item(int Index) const
Definition: parameter_data.cpp:992
CSG_Parameter::Get_Parent
CSG_Parameter * Get_Parent(void) const
Definition: parameter.cpp:105
CSG_Parameter::is_DataObject
bool is_DataObject(void) const
Definition: parameter.cpp:275
CSG_Grid_System::Get_Extent
const CSG_Rect & Get_Extent(bool bCells=false) const
Definition: grid.h:238
PARAMETER_NOT_FOR_CMD
#define PARAMETER_NOT_FOR_CMD
Definition: parameters.h:100
SG_Char
#define SG_Char
Definition: api_core.h:530
TSG_Data_Object_Type
TSG_Data_Object_Type
Definition: dataobject.h:117
CSG_String
Definition: api_core.h:557
CSG_Parameter::asTableFields
class CSG_Parameter_Table_Fields * asTableFields(void) const
Definition: parameter.cpp:1043
CSG_Parameter::Set_Children_Enabled
bool Set_Children_Enabled(bool bEnabled=true)
Definition: parameter.cpp:227
CSG_Parameter::asChoice
class CSG_Parameter_Choice * asChoice(void) const
Definition: parameter.cpp:1038
SG_DATAOBJECT_TYPE_Table
@ SG_DATAOBJECT_TYPE_Table
Definition: dataobject.h:120
CSG_Data_Manager
Definition: data_manager.h:164
CSG_MetaData
Definition: metadata.h:88
CSG_Parameter_Table_Fields
Definition: parameters.h:1094
CSG_Parameter::Check
bool Check(bool bSilent=true)
Definition: parameter.cpp:898
CSG_Parameter_String
Definition: parameters.h:799
CSG_String::is_Empty
bool is_Empty(void) const
Definition: api_string.cpp:178
PARAMETER_DESCRIPTION_TEXT
#define PARAMETER_DESCRIPTION_TEXT
Definition: parameters.h:110
CSG_Parameter::has_Changed
bool has_Changed(int Check_Flags=PARAMETER_CHECK_ALL)
Definition: parameter.cpp:832
CSG_Parameter::asDouble
double asDouble(void) const
Definition: parameters.h:283
PARAMETER_TYPE_Grid_System
@ PARAMETER_TYPE_Grid_System
Definition: parameters.h:143
SSG_Rect::yMin
double yMin
Definition: geo_tools.h:465
PARAMETER_TYPE_PointCloud_List
@ PARAMETER_TYPE_PointCloud_List
Definition: parameters.h:159
CSG_Rect::Get_XCenter
double Get_XCenter(void) const
Definition: geo_tools.h:515
CSG_Rect::Get_YMax
double Get_YMax(void) const
Definition: geo_tools.h:503
CSG_Rect::Get_XMin
double Get_XMin(void) const
Definition: geo_tools.h:500
PARAMETER_TYPE_Table_List
@ PARAMETER_TYPE_Table_List
Definition: parameters.h:156
CSG_Parameter::asRange
class CSG_Parameter_Range * asRange(void) const
Definition: parameter.cpp:1041
CSG_Parameter_Choices::Get_Selection_Index
int Get_Selection_Index(int i) const
Definition: parameters.h:765
CSG_Parameter::Get_Manager
class CSG_Data_Manager * Get_Manager(void) const
Definition: parameter.cpp:111
CSG_Grid
Definition: grid.h:473
CSG_Parameter::asTableList
class CSG_Parameter_Table_List * asTableList(void) const
Definition: parameter.cpp:1049
CSG_Parameter::do_UseInGUI
bool do_UseInGUI(void) const
Definition: parameter.cpp:165
CSG_Rect::Get_YCenter
double Get_YCenter(void) const
Definition: geo_tools.h:516
PARAMETER_TYPE_DataObject_Output
@ PARAMETER_TYPE_DataObject_Output
Definition: parameters.h:161
CSG_Parameters::Set_Parameter
bool Set_Parameter(const CSG_String &ID, CSG_Parameter *pValue)
Definition: parameters.cpp:1348
CSG_Parameter_Choice
Definition: parameters.h:659
CSG_Parameter_Choices::Get_Item
const CSG_String & Get_Item(int i) const
Definition: parameters.h:759
PARAMETER_DESCRIPTION_PROPERTIES
#define PARAMETER_DESCRIPTION_PROPERTIES
Definition: parameters.h:109
CSG_Parameter::Set_Enabled
bool Set_Enabled(bool bEnabled=true)
Definition: parameter.cpp:195
CSG_Shapes
Definition: shapes.h:773
CSG_String::c_str
const SG_Char * c_str(void) const
Definition: api_string.cpp:236
CSG_Grids::Add_Grid
bool Add_Grid(double Z)
Definition: grids.cpp:638
CSG_PointCloud
Definition: pointcloud.h:105
CSG_Parameter::Set_UseInGUI
void Set_UseInGUI(bool bDoUse=false)
Definition: parameter.cpp:139
CSG_Parameter_PointCloud_List
Definition: parameters.h:1540
CSG_Parameter_TIN_List
Definition: parameters.h:1517
SG_Create_Grid
CSG_Grid * SG_Create_Grid(void)
Definition: grid.cpp:72
CSG_Parameters
Definition: parameters.h:1650
TSG_Data_Type
TSG_Data_Type
Definition: api_core.h:985
CSG_Parameter::Get_DataObject_Type
TSG_Data_Object_Type Get_DataObject_Type(void) const
Definition: parameter.cpp:518
CSG_Parameter_Range::Get_Min
double Get_Min(void) const
Definition: parameter_data.cpp:814
SG_Realloc
SAGA_API_DLL_EXPORT void * SG_Realloc(void *memblock, size_t size)
Definition: api_memory.cpp:77
CSG_MetaData::Add_Child
CSG_MetaData * Add_Child(void)
Definition: metadata.cpp:174
CSG_Parameter::Cmp_Identifier
bool Cmp_Identifier(const CSG_String &Identifier) const
Definition: parameter.cpp:552
CSG_Parameter::is_Parameters
bool is_Parameters(void) const
Definition: parameter.cpp:312
CSG_Parameter::asGrids
CSG_Grids * asGrids(void) const
Definition: parameter.cpp:974
CSG_Parameter_List
Definition: parameters.h:1359
CSG_Parameter::asGrid_System
CSG_Grid_System * asGrid_System(void) const
Definition: parameter.cpp:968
CSG_Parameter::Get_Name
const SG_Char * Get_Name(void) const
Definition: parameter.cpp:565
CSG_Parameter::asFont
const SG_Char * asFont(void) const
Definition: parameter.cpp:967
CSG_Parameter::is_Default
virtual bool is_Default(void) const
Definition: parameter.cpp:881
PARAMETER_TYPE_Range
@ PARAMETER_TYPE_Range
Definition: parameters.h:130
CSG_Parameter::is_Option
bool is_Option(void) const
Definition: parameter.cpp:238
PARAMETER_OUTPUT
#define PARAMETER_OUTPUT
Definition: parameters.h:95
CSG_Grids
Definition: grids.h:119
PARAMETER_TYPE_TIN_List
@ PARAMETER_TYPE_TIN_List
Definition: parameters.h:158
PARAMETER_TYPE_Parameters
@ PARAMETER_TYPE_Parameters
Definition: parameters.h:163
SEPARATE
#define SEPARATE
PARAMETER_TYPE_Font
@ PARAMETER_TYPE_Font
Definition: parameters.h:138
CSG_Parameter::asList
class CSG_Parameter_List * asList(void) const
Definition: parameter.cpp:1046
PARAMETER_TYPE_Color
@ PARAMETER_TYPE_Color
Definition: parameters.h:139
PARAMETER_TYPE_Shapes
@ PARAMETER_TYPE_Shapes
Definition: parameters.h:151
CSG_Parameter::Restore_Default
virtual bool Restore_Default(void)
Definition: parameter.cpp:887
CSG_Parameters_Grid_Target::On_Parameters_Enable
bool On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
Definition: parameter.cpp:1364
CSG_Rect::Get_YRange
double Get_YRange(void) const
Definition: geo_tools.h:506
SG_DATAOBJECT_TYPE_PointCloud
@ SG_DATAOBJECT_TYPE_PointCloud
Definition: dataobject.h:123
CSG_Parameters::Set_Callback
bool Set_Callback(bool bActive=true)
Definition: parameters.cpp:1306
CSG_Parameter::asChoices
class CSG_Parameter_Choices * asChoices(void) const
Definition: parameter.cpp:1040
CSG_Parameter::is_Information
bool is_Information(void) const
Definition: parameters.h:234
PARAMETER_DESCRIPTION_NAME
#define PARAMETER_DESCRIPTION_NAME
Definition: parameters.h:106
CSG_Parameters::Add_Bool
CSG_Parameter * Add_Bool(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool Value=false)
Definition: parameters.cpp:396
CSG_Grid_System::is_Valid
bool is_Valid(void) const
Definition: grid_system.cpp:243
CSG_Parameter::Get_Type_Identifier
CSG_String Get_Type_Identifier(void) const
Definition: parameter.cpp:122
CSG_Parameter_Data_Type
Definition: parameters.h:717
CSG_Colors
Definition: api_core.h:1329
CSG_Grids::Del_Grids
bool Del_Grids(bool bDetach=false)
Definition: grids.cpp:803
CSG_Parameter::asBool
bool asBool(void) const
Definition: parameters.h:280
PARAMETER_OUTPUT_OPTIONAL
#define PARAMETER_OUTPUT_OPTIONAL
Definition: parameters.h:103
DATAOBJECT_NOTSET
#define DATAOBJECT_NOTSET
Definition: dataobject.h:129
PARAMETER_TYPE_Text
@ PARAMETER_TYPE_Text
Definition: parameters.h:135
CSG_Parameters::Add_Choice
CSG_Parameter * Add_Choice(const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &Items, int Default=0)
Definition: parameters.cpp:464