1 2 /////////////////////////////////////////////////////////// 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.h // 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 // // 50 /////////////////////////////////////////////////////////// 51 52 //--------------------------------------------------------- 53 #ifndef HEADER_INCLUDED__SAGA_API__parameters_H 54 #define HEADER_INCLUDED__SAGA_API__parameters_H 55 56 57 /////////////////////////////////////////////////////////// 58 // // 59 // // 60 // // 61 /////////////////////////////////////////////////////////// 62 63 //--------------------------------------------------------- 64 /** \file parameters.h 65 * The core classes defining the parameters for SAGA tool 66 * interfaces. 67 * @see CSG_Parameters 68 * @see CSG_Parameter 69 */ 70 71 72 /////////////////////////////////////////////////////////// 73 // // 74 // // 75 // // 76 /////////////////////////////////////////////////////////// 77 78 //--------------------------------------------------------- 79 #include "grids.h" 80 #include "table.h" 81 #include "shapes.h" 82 #include "tin.h" 83 #include "pointcloud.h" 84 #include "datetime.h" 85 86 87 /////////////////////////////////////////////////////////// 88 // // 89 // // 90 // // 91 /////////////////////////////////////////////////////////// 92 93 //--------------------------------------------------------- 94 #define PARAMETER_INPUT 0x01 95 #define PARAMETER_OUTPUT 0x02 96 #define PARAMETER_OPTIONAL 0x04 97 #define PARAMETER_INFORMATION 0x08 98 #define PARAMETER_IGNORE_PROJECTION 0x10 99 #define PARAMETER_NOT_FOR_GUI 0x20 100 #define PARAMETER_NOT_FOR_CMD 0x40 101 102 #define PARAMETER_INPUT_OPTIONAL (PARAMETER_INPUT | PARAMETER_OPTIONAL) 103 #define PARAMETER_OUTPUT_OPTIONAL (PARAMETER_OUTPUT | PARAMETER_OPTIONAL) 104 105 //--------------------------------------------------------- 106 #define PARAMETER_DESCRIPTION_NAME 0x01 107 #define PARAMETER_DESCRIPTION_TYPE 0x02 108 #define PARAMETER_DESCRIPTION_OPTIONAL 0x04 109 #define PARAMETER_DESCRIPTION_PROPERTIES 0x08 110 #define PARAMETER_DESCRIPTION_TEXT 0x10 111 #define PARAMETER_DESCRIPTION_ALL (PARAMETER_DESCRIPTION_NAME | PARAMETER_DESCRIPTION_TYPE | PARAMETER_DESCRIPTION_OPTIONAL | PARAMETER_DESCRIPTION_PROPERTIES | PARAMETER_DESCRIPTION_TEXT) 112 113 114 /////////////////////////////////////////////////////////// 115 // // 116 // // 117 // // 118 /////////////////////////////////////////////////////////// 119 120 //--------------------------------------------------------- 121 typedef enum ESG_Parameter_Type 122 { 123 PARAMETER_TYPE_Node = 0, 124 125 PARAMETER_TYPE_Bool, 126 PARAMETER_TYPE_Int, 127 PARAMETER_TYPE_Double, 128 PARAMETER_TYPE_Degree, 129 PARAMETER_TYPE_Date, 130 PARAMETER_TYPE_Range, 131 PARAMETER_TYPE_Choice, 132 PARAMETER_TYPE_Choices, 133 PARAMETER_TYPE_String, 134 PARAMETER_TYPE_Text, 135 PARAMETER_TYPE_FilePath, 136 137 PARAMETER_TYPE_Font, 138 PARAMETER_TYPE_Color, 139 PARAMETER_TYPE_Colors, 140 PARAMETER_TYPE_FixedTable, 141 142 PARAMETER_TYPE_Grid_System, 143 PARAMETER_TYPE_Table_Field, 144 PARAMETER_TYPE_Table_Fields, 145 146 PARAMETER_TYPE_PointCloud, 147 PARAMETER_TYPE_Grid, 148 PARAMETER_TYPE_Grids, 149 PARAMETER_TYPE_Table, 150 PARAMETER_TYPE_Shapes, 151 PARAMETER_TYPE_TIN, 152 153 PARAMETER_TYPE_Grid_List, 154 PARAMETER_TYPE_Grids_List, 155 PARAMETER_TYPE_Table_List, 156 PARAMETER_TYPE_Shapes_List, 157 PARAMETER_TYPE_TIN_List, 158 PARAMETER_TYPE_PointCloud_List, 159 160 PARAMETER_TYPE_DataObject_Output, 161 162 PARAMETER_TYPE_Parameters, 163 164 PARAMETER_TYPE_Undefined 165 } 166 TSG_Parameter_Type; 167 168 169 /////////////////////////////////////////////////////////// 170 // // 171 // // 172 // // 173 /////////////////////////////////////////////////////////// 174 175 //--------------------------------------------------------- 176 SAGA_API_DLL_EXPORT CSG_String SG_Parameter_Type_Get_Name (TSG_Parameter_Type Type); 177 SAGA_API_DLL_EXPORT CSG_String SG_Parameter_Type_Get_Identifier (TSG_Parameter_Type Type); 178 SAGA_API_DLL_EXPORT TSG_Parameter_Type SG_Parameter_Type_Get_Type (const CSG_String &Identifier); 179 180 181 /////////////////////////////////////////////////////////// 182 // // 183 // // 184 // // 185 /////////////////////////////////////////////////////////// 186 187 //--------------------------------------------------------- 188 #define PARAMETER_CHECK_VALUES 0x01 189 #define PARAMETER_CHECK_ENABLE 0x02 190 #define PARAMETER_CHECK_ALL (PARAMETER_CHECK_VALUES | PARAMETER_CHECK_ENABLE) 191 192 //--------------------------------------------------------- 193 #define SG_PARAMETER_DATA_SET_FALSE 0 194 #define SG_PARAMETER_DATA_SET_TRUE 1 195 #define SG_PARAMETER_DATA_SET_CHANGED 2 196 197 198 /////////////////////////////////////////////////////////// 199 // // 200 // CSG_Parameter // 201 // // 202 /////////////////////////////////////////////////////////// 203 204 //--------------------------------------------------------- 205 class SAGA_API_DLL_EXPORT CSG_Parameter 206 { 207 public: /////////////////////////////////////////////////// 208 209 CSG_Parameters * Get_Parameters (void) const; 210 CSG_Parameter * Get_Parent (void) const; 211 class CSG_Data_Manager * Get_Manager (void) const; 212 213 virtual TSG_Parameter_Type Get_Type (void) const = 0; 214 CSG_String Get_Type_Identifier (void) const; 215 CSG_String Get_Type_Name (void) const; 216 217 const SG_Char * Get_Identifier (void) const; 218 bool Cmp_Identifier (const CSG_String &Identifier) const; 219 bool Set_Name (const CSG_String &Name); 220 const SG_Char * Get_Name (void) const; 221 const SG_Char * Get_Description (void) const; 222 bool Set_Description (const CSG_String &Description); 223 CSG_String Get_Description (int Flags) const; 224 CSG_String Get_Description (int Flags, const SG_Char *Separator) const; 225 226 bool Set_Enabled (bool bEnabled = true); 227 bool is_Enabled (bool bCheckEnv = true) const; 228 is_Valid(void)229 virtual bool is_Valid (void) const { return( true ); } is_Input(void)230 bool is_Input (void) const { return( !!(m_Constraint & PARAMETER_INPUT ) ); } is_Output(void)231 bool is_Output (void) const { return( !!(m_Constraint & PARAMETER_OUTPUT ) ); } is_Optional(void)232 bool is_Optional (void) const { return( !!(m_Constraint & PARAMETER_OPTIONAL ) ); } is_Information(void)233 bool is_Information (void) const { return( !!(m_Constraint & PARAMETER_INFORMATION) ); } 234 bool is_Option (void) const; 235 bool is_DataObject (void) const; 236 bool is_DataObject_List (void) const; 237 bool is_Parameters (void) const; 238 bool is_Serializable (void) const; 239 bool is_Compatible (CSG_Parameter *pParameter) const; 240 bool is_Value_Equal (CSG_Parameter *pParameter) const; 241 242 void Set_UseInGUI (bool bDoUse = false); 243 void Set_UseInCMD (bool bDoUse = false); 244 245 bool do_UseInGUI (void) const; 246 bool do_UseInCMD (void) const; 247 248 void ignore_Projection (bool bIgnore); ignore_Projection(void)249 bool ignore_Projection (void) const { return( !!(m_Constraint & PARAMETER_IGNORE_PROJECTION) ); } 250 251 TSG_Data_Object_Type Get_DataObject_Type (void) const; 252 Get_Children_Count(void)253 int Get_Children_Count (void) const { return( m_nChildren ); } Get_Child(int iChild)254 CSG_Parameter * Get_Child (int iChild) const { return( iChild >= 0 && iChild < m_nChildren ? m_Children[iChild] : NULL ); } 255 bool Set_Children_Enabled (bool bEnabled = true); 256 257 //----------------------------------------------------- 258 virtual bool Set_Value (int Value); 259 virtual bool Set_Value (double Value); 260 virtual bool Set_Value (const CSG_String &Value); 261 virtual bool Set_Value (const char *Value); 262 virtual bool Set_Value (const wchar_t *Value); 263 virtual bool Set_Value (void *Value); 264 virtual bool Set_Value (CSG_Parameter *Value); 265 266 bool Set_Default (int Value); 267 bool Set_Default (double Value); 268 bool Set_Default (const CSG_String &Value); 269 const CSG_String & Get_Default (void) const; 270 virtual bool Restore_Default (void); 271 272 bool Check (bool bSilent = true); 273 274 bool has_Changed (int Check_Flags = PARAMETER_CHECK_ALL); 275 asBool(void)276 bool asBool (void) const { return( (bool )!!_asInt () ); } asInt(void)277 int asInt (void) const { return( (int )_asInt () ); } asColor(void)278 long asColor (void) const { return( (long )_asInt () ); } asDouble(void)279 double asDouble (void) const { return( (double )_asDouble () ); } asString(void)280 const SG_Char * asString (void) const { return( (const SG_Char *)_asString () ); } asPointer(void)281 void * asPointer (void) const { return( (void *)_asPointer() ); } 282 283 CSG_Colors * asColors (void) const; 284 const SG_Char * asFont (void) const; 285 CSG_Grid_System * asGrid_System (void) const; 286 287 CSG_Data_Object * asDataObject (void) const; 288 CSG_Grid * asGrid (void) const; 289 CSG_Grids * asGrids (void) const; 290 CSG_Table * asTable (void) const; 291 CSG_Shapes * asShapes (void) const; 292 CSG_TIN * asTIN (void) const; 293 CSG_PointCloud * asPointCloud (void) const; 294 295 //----------------------------------------------------- 296 class CSG_Parameter_Value * asValue (void) const; 297 class CSG_Parameter_Date * asDate (void) const; 298 class CSG_Parameter_Choice * asChoice (void) const; 299 class CSG_Parameter_Choices * asChoices (void) const; 300 class CSG_Parameter_Range * asRange (void) const; 301 class CSG_Parameter_File_Name * asFilePath (void) const; 302 class CSG_Parameter_Table_Fields * asTableFields (void) const; 303 class CSG_Parameters * asParameters (void) const; 304 305 class CSG_Parameter_List * asList (void) const; 306 class CSG_Parameter_Grid_List * asGridList (void) const; 307 class CSG_Parameter_Grids_List * asGridsList (void) const; 308 class CSG_Parameter_Table_List * asTableList (void) const; 309 class CSG_Parameter_Shapes_List * asShapesList (void) const; 310 class CSG_Parameter_TIN_List * asTINList (void) const; 311 class CSG_Parameter_PointCloud_List * asPointCloudList(void) const; 312 313 //----------------------------------------------------- 314 bool Assign (CSG_Parameter *pSource); 315 bool Serialize (CSG_MetaData &MetaData, bool bSave); 316 317 318 protected: //////////////////////////////////////////////// 319 320 friend class CSG_Parameters; 321 322 CSG_Parameter(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 323 virtual ~CSG_Parameter(void); 324 325 CSG_String m_String; 326 327 328 virtual int _Set_Value (int Value); 329 virtual int _Set_Value (double Value); 330 virtual int _Set_Value (const CSG_String &Value); 331 virtual int _Set_Value (void *Value); 332 333 virtual void _Set_String (void); 334 335 virtual int _asInt (void) const; 336 virtual double _asDouble (void) const; 337 virtual void * _asPointer (void) const; 338 virtual const SG_Char * _asString (void) const; 339 340 virtual bool _Assign (CSG_Parameter *pSource); 341 virtual bool _Serialize (CSG_MetaData &MetaData, bool bSave); 342 343 344 private: ////////////////////////////////////////////////// 345 346 void _Add_Child (CSG_Parameter *pChild); 347 348 349 bool m_bEnabled; 350 351 int m_Constraint, m_nChildren; 352 353 CSG_Parameter **m_Children; 354 355 CSG_String m_Identifier, m_Name, m_Description, m_Default; 356 357 CSG_Parameter *m_pParent; 358 359 CSG_Parameters *m_pParameters; 360 361 }; 362 363 364 /////////////////////////////////////////////////////////// 365 // // 366 /////////////////////////////////////////////////////////// 367 368 //--------------------------------------------------------- 369 class SAGA_API_DLL_EXPORT CSG_Parameter_Node : public CSG_Parameter 370 { 371 public: 372 Get_Type(void)373 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Node ); } 374 375 376 protected: 377 378 CSG_Parameter_Node(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 379 380 friend class CSG_Parameters; 381 }; 382 383 384 /////////////////////////////////////////////////////////// 385 // // 386 /////////////////////////////////////////////////////////// 387 388 //--------------------------------------------------------- 389 class SAGA_API_DLL_EXPORT CSG_Parameter_Bool : public CSG_Parameter 390 { 391 public: 392 Get_Type(void)393 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Bool ); } 394 395 396 protected: 397 398 CSG_Parameter_Bool(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 399 400 bool m_Value; 401 402 403 virtual int _Set_Value (int Value); 404 virtual int _Set_Value (double Value); 405 virtual int _Set_Value (const CSG_String &Value); 406 407 virtual void _Set_String (void); 408 _asInt(void)409 virtual int _asInt (void) const { return( m_Value ); } 410 411 virtual bool _Assign (CSG_Parameter *pSource); 412 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 413 414 415 friend class CSG_Parameters; 416 }; 417 418 419 /////////////////////////////////////////////////////////// 420 // // 421 /////////////////////////////////////////////////////////// 422 423 //--------------------------------------------------------- 424 class SAGA_API_DLL_EXPORT CSG_Parameter_Value : public CSG_Parameter 425 { 426 public: 427 428 bool Set_Valid_Range (double Minimum, double Maximum); 429 430 void Set_Minimum (double Minimum, bool bOn = true); Get_Minimum(void)431 double Get_Minimum (void) const { return( m_Minimum ); } has_Minimum(void)432 bool has_Minimum (void) const { return( m_bMinimum ); } 433 434 void Set_Maximum (double Maximum, bool bOn = true); Get_Maximum(void)435 double Get_Maximum (void) const { return( m_Maximum ); } has_Maximum(void)436 bool has_Maximum (void) const { return( m_bMaximum ); } 437 438 439 protected: 440 441 CSG_Parameter_Value(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 442 443 bool m_bMinimum, m_bMaximum; 444 445 double m_Minimum, m_Maximum; 446 447 448 virtual bool _Assign (CSG_Parameter *pSource); 449 450 451 friend class CSG_Parameters; 452 }; 453 454 455 /////////////////////////////////////////////////////////// 456 // // 457 /////////////////////////////////////////////////////////// 458 459 //--------------------------------------------------------- 460 class SAGA_API_DLL_EXPORT CSG_Parameter_Int : public CSG_Parameter_Value 461 { 462 public: 463 Get_Type(void)464 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Int ); } 465 466 467 protected: 468 469 CSG_Parameter_Int(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 470 471 int m_Value; 472 473 474 virtual int _Set_Value (int Value); 475 virtual int _Set_Value (double Value); 476 virtual int _Set_Value (const CSG_String &Value); 477 478 virtual void _Set_String (void); 479 _asInt(void)480 virtual int _asInt (void) const { return( m_Value ); } _asDouble(void)481 virtual double _asDouble (void) const { return( m_Value ); } 482 483 virtual bool _Assign (CSG_Parameter *pSource); 484 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 485 486 487 friend class CSG_Parameters; 488 }; 489 490 491 /////////////////////////////////////////////////////////// 492 // // 493 /////////////////////////////////////////////////////////// 494 495 //--------------------------------------------------------- 496 class SAGA_API_DLL_EXPORT CSG_Parameter_Double : public CSG_Parameter_Value 497 { 498 public: 499 Get_Type(void)500 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Double ); } 501 502 503 protected: 504 505 CSG_Parameter_Double(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 506 507 double m_Value; 508 509 510 virtual int _Set_Value (int Value); 511 virtual int _Set_Value (double Value); 512 virtual int _Set_Value (const CSG_String &Value); 513 514 virtual void _Set_String (void); 515 _asInt(void)516 virtual int _asInt (void) const { return( (int)m_Value ); } _asDouble(void)517 virtual double _asDouble (void) const { return( m_Value ); } 518 519 virtual bool _Assign (CSG_Parameter *pSource); 520 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 521 522 523 friend class CSG_Parameters; 524 }; 525 526 527 /////////////////////////////////////////////////////////// 528 // // 529 /////////////////////////////////////////////////////////// 530 531 //--------------------------------------------------------- 532 class SAGA_API_DLL_EXPORT CSG_Parameter_Degree : public CSG_Parameter_Double 533 { 534 public: 535 Get_Type(void)536 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Degree ); } 537 538 539 protected: 540 541 CSG_Parameter_Degree(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 542 543 virtual int _Set_Value (const CSG_String &Value); 544 545 virtual void _Set_String (void); 546 547 548 friend class CSG_Parameters; 549 }; 550 551 552 /////////////////////////////////////////////////////////// 553 // // 554 /////////////////////////////////////////////////////////// 555 556 //--------------------------------------------------------- 557 class SAGA_API_DLL_EXPORT CSG_Parameter_Date : public CSG_Parameter 558 { 559 public: 560 Get_Type(void)561 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Date ); } 562 563 void Set_Date (const CSG_DateTime &Date); Get_Date(void)564 const CSG_DateTime & Get_Date (void) const { return( m_Date ); } 565 566 567 protected: 568 569 CSG_Parameter_Date(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 570 571 CSG_DateTime m_Date; 572 573 574 virtual int _Set_Value (int Value); 575 virtual int _Set_Value (double Value); 576 virtual int _Set_Value (const CSG_String &Value); 577 578 virtual void _Set_String (void); 579 580 virtual int _asInt (void) const; 581 virtual double _asDouble (void) const; 582 583 virtual bool _Assign (CSG_Parameter *pSource); 584 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 585 586 587 friend class CSG_Parameters; 588 }; 589 590 591 /////////////////////////////////////////////////////////// 592 // // 593 /////////////////////////////////////////////////////////// 594 595 //--------------------------------------------------------- 596 class SAGA_API_DLL_EXPORT CSG_Parameter_Range : public CSG_Parameter 597 { 598 public: 599 Get_Type(void)600 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Range ); } 601 602 bool Set_Range (double Min, double Max); Get_Range(void)603 double Get_Range (void) const { return( Get_Max() - Get_Min() ); } 604 605 bool Set_Min (double Min); 606 double Get_Min (void) const; Get_Min_Parameter(void)607 CSG_Parameter_Double * Get_Min_Parameter (void) const { return( m_pMin ); } 608 609 bool Set_Max (double Max); 610 double Get_Max (void) const; Get_Max_Parameter(void)611 CSG_Parameter_Double * Get_Max_Parameter (void) const { return( m_pMax ); } 612 613 virtual bool Restore_Default (void); 614 615 616 protected: 617 618 CSG_Parameter_Range(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 619 virtual ~CSG_Parameter_Range(void); 620 621 CSG_Parameters *m_pRange; 622 623 CSG_Parameter_Double *m_pMin, *m_pMax; 624 625 626 virtual int _Set_Value (const CSG_String &Value); 627 628 virtual void _Set_String (void); 629 630 virtual bool _Assign (CSG_Parameter *pSource); 631 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 632 633 634 friend class CSG_Parameters; 635 }; 636 637 638 /////////////////////////////////////////////////////////// 639 // // 640 /////////////////////////////////////////////////////////// 641 642 //--------------------------------------------------------- 643 class SAGA_API_DLL_EXPORT CSG_Parameter_Choice : public CSG_Parameter 644 { 645 public: 646 Get_Type(void)647 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Choice ); } 648 649 void Set_Items (const SG_Char *String); 650 CSG_String Get_Items (void) const; 651 652 const SG_Char * Get_Item (int Index) const; 653 CSG_String Get_Item_Data (int Index) const; 654 655 bool Get_Data (int &Value) const; 656 bool Get_Data (double &Value) const; 657 bool Get_Data (CSG_String &Value) const; 658 CSG_String Get_Data (void) const; 659 Get_Count(void)660 int Get_Count (void) const { return( m_Items.Get_Count() ); } 661 662 663 protected: 664 665 CSG_Parameter_Choice(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 666 667 int m_Value; 668 669 CSG_Strings m_Items; 670 671 672 virtual int _Set_Value (int Value); 673 virtual int _Set_Value (double Value); 674 virtual int _Set_Value (const CSG_String &Value); 675 676 virtual void _Set_String (void); 677 _asInt(void)678 virtual int _asInt (void) const { return( m_Value ); } _asDouble(void)679 virtual double _asDouble (void) const { return( m_Value ); } 680 681 virtual bool _Assign (CSG_Parameter *pSource); 682 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 683 684 685 friend class CSG_Parameters; 686 }; 687 688 689 /////////////////////////////////////////////////////////// 690 // // 691 /////////////////////////////////////////////////////////// 692 693 //--------------------------------------------------------- 694 class SAGA_API_DLL_EXPORT CSG_Parameter_Choices : public CSG_Parameter 695 { 696 public: 697 Get_Type(void)698 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Choices ); } 699 700 void Set_Items (const CSG_String &Items); 701 void Set_Items (const CSG_Strings &Items); 702 CSG_String Get_Items (void) const; 703 void Del_Items (void); 704 void Add_Item (const CSG_String &Item, const CSG_String &Data = ""); 705 Get_Item_Count(void)706 int Get_Item_Count (void) const { return( m_Items[0].Get_Count() ); } Get_Item(int i)707 const CSG_String & Get_Item (int i) const { return( m_Items[0][i] ); } Get_Item_Data(int i)708 const CSG_String & Get_Item_Data (int i) const { return( m_Items[1][i] ); } 709 Get_Selection_Count(void)710 int Get_Selection_Count (void) const { return( (int)m_Selection.Get_Size() ); } Get_Selection(int i)711 const CSG_String & Get_Selection (int i) const { return( Get_Item (Get_Selection_Index(i)) ); } Get_Selection_Data(int i)712 const CSG_String & Get_Selection_Data (int i) const { return( Get_Item_Data(Get_Selection_Index(i)) ); } Get_Selection_Index(int i)713 int Get_Selection_Index (int i) const { return( i >= 0 && i < Get_Selection_Count() ? m_Selection[i] : -1 ); } 714 715 bool is_Selected (int Index); 716 bool Select (int Index, bool bSelect = true); 717 bool Clr_Selection (void); 718 719 720 protected: 721 722 CSG_Parameter_Choices(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 723 724 CSG_Strings m_Items[2]; 725 726 CSG_Array_Int m_Selection; 727 728 729 virtual int _Set_Value (const CSG_String &Value); 730 731 virtual void _Set_String (void); 732 733 virtual bool _Assign (CSG_Parameter *pSource); 734 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 735 736 737 friend class CSG_Parameters; 738 }; 739 740 741 /////////////////////////////////////////////////////////// 742 // // 743 /////////////////////////////////////////////////////////// 744 745 //--------------------------------------------------------- 746 class SAGA_API_DLL_EXPORT CSG_Parameter_String : public CSG_Parameter 747 { 748 public: 749 Get_Type(void)750 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_String ); } 751 752 virtual bool is_Valid (void) const; 753 754 void Set_Password (bool bOn); 755 bool is_Password (void) const; 756 757 758 protected: 759 760 CSG_Parameter_String(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 761 762 bool m_bPassword; 763 764 765 virtual int _Set_Value (const CSG_String &Value); 766 767 virtual bool _Assign (CSG_Parameter *pSource); 768 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 769 770 771 friend class CSG_Parameters; 772 }; 773 774 775 /////////////////////////////////////////////////////////// 776 // // 777 /////////////////////////////////////////////////////////// 778 779 //--------------------------------------------------------- 780 class SAGA_API_DLL_EXPORT CSG_Parameter_Text : public CSG_Parameter_String 781 { 782 public: Get_Type(void)783 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Text ); } 784 785 786 protected: 787 788 CSG_Parameter_Text(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 789 790 791 friend class CSG_Parameters; 792 }; 793 794 795 /////////////////////////////////////////////////////////// 796 // // 797 /////////////////////////////////////////////////////////// 798 799 //--------------------------------------------------------- 800 class SAGA_API_DLL_EXPORT CSG_Parameter_File_Name : public CSG_Parameter_String 801 { 802 public: 803 Get_Type(void)804 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_FilePath ); } 805 806 void Set_Filter (const SG_Char *Filter); 807 const SG_Char * Get_Filter (void) const; 808 809 void Set_Flag_Save (bool bFlag); is_Save(void)810 bool is_Save (void) const { return( m_bSave ); } 811 812 void Set_Flag_Multiple (bool bFlag); is_Multiple(void)813 bool is_Multiple (void) const { return( m_bMultiple ); } 814 815 void Set_Flag_Directory (bool bFlag); is_Directory(void)816 bool is_Directory (void) const { return( m_bDirectory ); } 817 818 bool Get_FilePaths (CSG_Strings &FilePaths) const; 819 820 821 protected: 822 823 CSG_Parameter_File_Name(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 824 825 bool m_bSave, m_bMultiple, m_bDirectory; 826 827 CSG_String m_Filter; 828 829 830 virtual bool _Assign (CSG_Parameter *pSource); 831 832 833 friend class CSG_Parameters; 834 }; 835 836 837 /////////////////////////////////////////////////////////// 838 // // 839 /////////////////////////////////////////////////////////// 840 841 //--------------------------------------------------------- 842 class SAGA_API_DLL_EXPORT CSG_Parameter_Font : public CSG_Parameter 843 { 844 public: 845 Get_Type(void)846 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Font ); } 847 848 virtual bool Restore_Default (void); 849 850 851 protected: 852 853 CSG_Parameter_Font(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 854 855 int m_Color; 856 857 CSG_String m_Font; 858 859 860 virtual int _Set_Value (int Value); 861 virtual int _Set_Value (const CSG_String &Value); 862 863 virtual int _asInt (void) const; 864 virtual void * _asPointer (void) const; 865 866 virtual bool _Assign (CSG_Parameter *pSource); 867 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 868 869 870 friend class CSG_Parameters; 871 }; 872 873 874 /////////////////////////////////////////////////////////// 875 // // 876 /////////////////////////////////////////////////////////// 877 878 //--------------------------------------------------------- 879 class SAGA_API_DLL_EXPORT CSG_Parameter_Color : public CSG_Parameter_Int 880 { 881 public: 882 Get_Type(void)883 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Color ); } 884 885 virtual int _Set_Value (const CSG_String &Value); 886 887 888 protected: 889 890 CSG_Parameter_Color(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 891 892 893 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 894 895 896 friend class CSG_Parameters; 897 }; 898 899 900 /////////////////////////////////////////////////////////// 901 // // 902 /////////////////////////////////////////////////////////// 903 904 //--------------------------------------------------------- 905 class SAGA_API_DLL_EXPORT CSG_Parameter_Colors : public CSG_Parameter 906 { 907 public: 908 Get_Type(void)909 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Colors ); } 910 911 912 protected: 913 914 CSG_Parameter_Colors(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 915 916 CSG_Colors m_Colors; 917 918 919 virtual void _Set_String (void); 920 921 virtual int _asInt (void) const; 922 virtual void * _asPointer (void) const; 923 924 virtual bool _Assign (CSG_Parameter *pSource); 925 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 926 927 928 friend class CSG_Parameters; 929 }; 930 931 932 /////////////////////////////////////////////////////////// 933 // // 934 /////////////////////////////////////////////////////////// 935 936 //--------------------------------------------------------- 937 class SAGA_API_DLL_EXPORT CSG_Parameter_Fixed_Table : public CSG_Parameter 938 { 939 public: 940 Get_Type(void)941 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_FixedTable ); } 942 943 944 protected: 945 946 CSG_Parameter_Fixed_Table(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 947 948 CSG_Table m_Table; 949 950 951 virtual void _Set_String (void); 952 953 virtual void * _asPointer (void) const; 954 955 virtual bool _Assign (CSG_Parameter *pSource); 956 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 957 958 959 friend class CSG_Parameters; 960 }; 961 962 963 /////////////////////////////////////////////////////////// 964 // // 965 /////////////////////////////////////////////////////////// 966 967 //--------------------------------------------------------- 968 class SAGA_API_DLL_EXPORT CSG_Parameter_Grid_System : public CSG_Parameter 969 { 970 public: 971 Get_Type(void)972 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Grid_System ); } 973 974 975 protected: 976 977 CSG_Parameter_Grid_System(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 978 979 CSG_Grid_System m_System; 980 981 982 virtual int _Set_Value (void *Value); 983 984 virtual void _Set_String (void); 985 986 virtual void * _asPointer (void) const; 987 988 virtual bool _Assign (CSG_Parameter *pSource); 989 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 990 991 992 friend class CSG_Parameters; 993 }; 994 995 996 /////////////////////////////////////////////////////////// 997 // // 998 /////////////////////////////////////////////////////////// 999 1000 //--------------------------------------------------------- 1001 class SAGA_API_DLL_EXPORT CSG_Parameter_Table_Field : public CSG_Parameter_Int 1002 { 1003 public: 1004 Get_Type(void)1005 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Table_Field ); } 1006 1007 bool Add_Default (double Value, double Minimum, bool bMinimum, double Maximum, bool bMaximum); 1008 1009 CSG_Table * Get_Table (void) const; 1010 1011 1012 protected: 1013 1014 CSG_Parameter_Table_Field(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1015 1016 int m_Default; 1017 1018 1019 virtual int _Set_Value (int Value); 1020 virtual int _Set_Value (const CSG_String &Value); 1021 1022 virtual void _Set_String (void); 1023 1024 virtual double _asDouble (void) const; 1025 1026 virtual bool _Assign (CSG_Parameter *pSource); 1027 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 1028 1029 1030 friend class CSG_Parameters; 1031 }; 1032 1033 1034 /////////////////////////////////////////////////////////// 1035 // // 1036 /////////////////////////////////////////////////////////// 1037 1038 //--------------------------------------------------------- 1039 class SAGA_API_DLL_EXPORT CSG_Parameter_Table_Fields : public CSG_Parameter 1040 { 1041 public: 1042 Get_Type(void)1043 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Table_Fields ); } 1044 Get_Count(void)1045 int Get_Count (void) const { return( m_nFields ); } Get_Index(int i)1046 int Get_Index (int i) const { return( i >= 0 && i < m_nFields ? m_Fields[i] : -1 ); } 1047 1048 CSG_Table * Get_Table (void) const; 1049 1050 1051 protected: 1052 1053 CSG_Parameter_Table_Fields(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1054 virtual ~CSG_Parameter_Table_Fields(void); 1055 1056 int m_nFields, *m_Fields; 1057 1058 1059 virtual int _Set_Value (const CSG_String &Value); 1060 1061 virtual int _asInt (void) const; 1062 virtual void * _asPointer (void) const; 1063 1064 virtual bool _Assign (CSG_Parameter *pSource); 1065 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 1066 1067 1068 friend class CSG_Parameters; 1069 }; 1070 1071 1072 /////////////////////////////////////////////////////////// 1073 // // 1074 /////////////////////////////////////////////////////////// 1075 1076 //--------------------------------------------------------- 1077 class SAGA_API_DLL_EXPORT CSG_Parameter_Data_Object : public CSG_Parameter 1078 { 1079 public: 1080 1081 virtual bool is_Valid (void) const; 1082 1083 1084 protected: 1085 1086 CSG_Parameter_Data_Object(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1087 1088 CSG_Data_Object *m_pDataObject; 1089 1090 1091 virtual int _Set_Value (void *Value); 1092 1093 virtual void _Set_String (void); 1094 1095 virtual void * _asPointer (void) const; 1096 1097 virtual bool _Assign (CSG_Parameter *pSource); 1098 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 1099 1100 1101 friend class CSG_Parameters; 1102 }; 1103 1104 1105 /////////////////////////////////////////////////////////// 1106 // // 1107 /////////////////////////////////////////////////////////// 1108 1109 //--------------------------------------------------------- 1110 class SAGA_API_DLL_EXPORT CSG_Parameter_Data_Object_Output : public CSG_Parameter_Data_Object 1111 { 1112 public: 1113 Get_Type(void)1114 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_DataObject_Output ); } 1115 1116 bool Set_DataObject_Type (TSG_Data_Object_Type Type); Get_DataObject_Type(void)1117 TSG_Data_Object_Type Get_DataObject_Type (void) const { return( m_Type ); } 1118 1119 1120 protected: 1121 1122 CSG_Parameter_Data_Object_Output(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1123 1124 TSG_Data_Object_Type m_Type; 1125 1126 1127 virtual int _Set_Value (void *Value); 1128 1129 1130 friend class CSG_Parameters; 1131 }; 1132 1133 1134 /////////////////////////////////////////////////////////// 1135 // // 1136 /////////////////////////////////////////////////////////// 1137 1138 //--------------------------------------------------------- 1139 class SAGA_API_DLL_EXPORT CSG_Parameter_Grid : public CSG_Parameter_Data_Object 1140 { 1141 public: 1142 Get_Type(void)1143 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Grid ); } 1144 1145 void Set_Preferred_Type (TSG_Data_Type Type); Get_Preferred_Type(void)1146 TSG_Data_Type Get_Preferred_Type (void) const { return( m_Type ); } 1147 1148 CSG_Grid_System * Get_System (void) const; 1149 1150 bool Add_Default (double Value, double Minimum, bool bMinimum, double Maximum, bool bMaximum); 1151 1152 1153 protected: 1154 1155 CSG_Parameter_Grid(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1156 1157 int m_Default; 1158 1159 TSG_Data_Type m_Type; 1160 1161 1162 virtual int _Set_Value (void *Value); 1163 1164 virtual int _asInt (void) const; 1165 virtual double _asDouble (void) const; 1166 1167 virtual bool _Assign (CSG_Parameter *pSource); 1168 1169 1170 friend class CSG_Parameters; 1171 }; 1172 1173 1174 /////////////////////////////////////////////////////////// 1175 // // 1176 /////////////////////////////////////////////////////////// 1177 1178 //--------------------------------------------------------- 1179 class SAGA_API_DLL_EXPORT CSG_Parameter_Grids : public CSG_Parameter_Grid 1180 { 1181 public: 1182 Get_Type(void)1183 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Grids ); } 1184 1185 1186 protected: 1187 1188 CSG_Parameter_Grids(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1189 1190 1191 friend class CSG_Parameters; 1192 }; 1193 1194 1195 /////////////////////////////////////////////////////////// 1196 // // 1197 /////////////////////////////////////////////////////////// 1198 1199 //--------------------------------------------------------- 1200 class SAGA_API_DLL_EXPORT CSG_Parameter_Table : public CSG_Parameter_Data_Object 1201 { 1202 public: 1203 Get_Type(void)1204 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Table ); } 1205 1206 CSG_Parameter_Table(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1207 1208 1209 protected: 1210 1211 virtual int _Set_Value (void *Value); 1212 1213 1214 friend class CSG_Parameters; 1215 }; 1216 1217 1218 /////////////////////////////////////////////////////////// 1219 // // 1220 /////////////////////////////////////////////////////////// 1221 1222 //--------------------------------------------------------- 1223 class SAGA_API_DLL_EXPORT CSG_Parameter_Shapes : public CSG_Parameter_Data_Object 1224 { 1225 public: 1226 Get_Type(void)1227 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Shapes ); } 1228 1229 void Set_Shape_Type (TSG_Shape_Type Type); Get_Shape_Type(void)1230 TSG_Shape_Type Get_Shape_Type (void) const { return( m_Type ); } 1231 1232 1233 protected: 1234 1235 CSG_Parameter_Shapes(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1236 1237 TSG_Shape_Type m_Type; 1238 1239 1240 virtual int _Set_Value (void *Value); 1241 1242 virtual bool _Assign (CSG_Parameter *pSource); 1243 1244 1245 friend class CSG_Parameters; 1246 }; 1247 1248 1249 /////////////////////////////////////////////////////////// 1250 // // 1251 /////////////////////////////////////////////////////////// 1252 1253 //--------------------------------------------------------- 1254 class SAGA_API_DLL_EXPORT CSG_Parameter_TIN : public CSG_Parameter_Data_Object 1255 { 1256 public: 1257 Get_Type(void)1258 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_TIN ); } 1259 1260 1261 protected: 1262 1263 CSG_Parameter_TIN(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1264 1265 1266 virtual int _Set_Value (void *Value); 1267 1268 1269 friend class CSG_Parameters; 1270 }; 1271 1272 1273 /////////////////////////////////////////////////////////// 1274 // // 1275 /////////////////////////////////////////////////////////// 1276 1277 //--------------------------------------------------------- 1278 class SAGA_API_DLL_EXPORT CSG_Parameter_PointCloud : public CSG_Parameter_Data_Object 1279 { 1280 public: 1281 Get_Type(void)1282 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_PointCloud ); } 1283 1284 1285 protected: 1286 1287 CSG_Parameter_PointCloud(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1288 1289 1290 virtual int _Set_Value (void *Value); 1291 1292 virtual bool _Assign (CSG_Parameter *pSource); 1293 1294 1295 friend class CSG_Parameters; 1296 }; 1297 1298 1299 /////////////////////////////////////////////////////////// 1300 // // 1301 /////////////////////////////////////////////////////////// 1302 1303 //--------------------------------------------------------- 1304 class SAGA_API_DLL_EXPORT CSG_Parameter_List : public CSG_Parameter 1305 { 1306 public: 1307 1308 virtual bool Add_Item (CSG_Data_Object *pItem); 1309 virtual bool Del_Item (CSG_Data_Object *pItem, bool bUpdateData = true); 1310 virtual bool Del_Item (int Index , bool bUpdateData = true); 1311 virtual bool Del_Items (void); 1312 Get_Item_Count(void)1313 int Get_Item_Count (void) const { return( (int)m_Objects.Get_Size() ); } Get_Item(int Index)1314 CSG_Data_Object * Get_Item (int Index) const { return( Index >= 0 && Index < Get_Item_Count() ? (CSG_Data_Object *)m_Objects[Index] : NULL ); } 1315 Update_Data(void)1316 virtual bool Update_Data (void) { return( true ); } 1317 Get_Data_Count(void)1318 virtual int Get_Data_Count (void) const { return( Get_Item_Count() ); } Get_Data(int Index)1319 virtual CSG_Data_Object * Get_Data (int Index) const { return( Get_Item(Index) ); } 1320 1321 1322 protected: 1323 1324 CSG_Parameter_List(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1325 1326 1327 virtual void _Set_String (void); 1328 1329 virtual int _asInt (void) const; 1330 virtual void * _asPointer (void) const; 1331 1332 virtual bool _Assign (CSG_Parameter *pSource); 1333 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 1334 1335 1336 private: 1337 1338 CSG_Array_Pointer m_Objects; 1339 1340 1341 friend class CSG_Parameters; 1342 }; 1343 1344 1345 /////////////////////////////////////////////////////////// 1346 // // 1347 /////////////////////////////////////////////////////////// 1348 1349 //--------------------------------------------------------- 1350 class SAGA_API_DLL_EXPORT CSG_Parameter_Grid_List : public CSG_Parameter_List 1351 { 1352 public: 1353 Get_Type(void)1354 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Grid_List ); } 1355 1356 CSG_Grid_System * Get_System (void) const; 1357 1358 virtual bool Add_Item (CSG_Data_Object *pItem); 1359 virtual bool Del_Item (CSG_Data_Object *pItem, bool bUpdateData = true); 1360 virtual bool Del_Item (int Index , bool bUpdateData = true); 1361 virtual bool Del_Items (void); 1362 1363 virtual bool Update_Data (void); 1364 Get_Data_Count(void)1365 virtual int Get_Data_Count (void) const { return( Get_Grid_Count() ); } Get_Data(int Index)1366 virtual CSG_Data_Object * Get_Data (int Index) const { return( (CSG_Data_Object *)Get_Grid(Index) ); } 1367 Get_Grid_Count(void)1368 int Get_Grid_Count (void) const { return( (int)m_Grids.Get_Size() ); } Get_Grid(int Index)1369 CSG_Grid * Get_Grid (int Index) const { return( Index >= 0 && Index < Get_Data_Count() ? (CSG_Grid *)m_Grids[Index] : NULL ); } 1370 1371 1372 protected: 1373 1374 CSG_Parameter_Grid_List(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1375 1376 CSG_Array_Pointer m_Grids; 1377 1378 1379 friend class CSG_Parameters; 1380 }; 1381 1382 1383 /////////////////////////////////////////////////////////// 1384 // // 1385 /////////////////////////////////////////////////////////// 1386 1387 //--------------------------------------------------------- 1388 class SAGA_API_DLL_EXPORT CSG_Parameter_Grids_List : public CSG_Parameter_List 1389 { 1390 public: Get_Type(void)1391 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Grids_List ); } 1392 1393 CSG_Grid_System * Get_System (void) const; 1394 1395 virtual bool Add_Item (CSG_Data_Object *pItem); 1396 Get_Grids(int Index)1397 CSG_Grids * Get_Grids (int Index) const { return( (CSG_Grids *)Get_Item(Index) ); } 1398 1399 1400 protected: 1401 1402 CSG_Parameter_Grids_List(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1403 1404 1405 friend class CSG_Parameters; 1406 }; 1407 1408 1409 /////////////////////////////////////////////////////////// 1410 // // 1411 /////////////////////////////////////////////////////////// 1412 1413 //--------------------------------------------------------- 1414 class SAGA_API_DLL_EXPORT CSG_Parameter_Table_List : public CSG_Parameter_List 1415 { 1416 public: 1417 Get_Type(void)1418 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Table_List ); } 1419 Get_Table(int Index)1420 CSG_Table * Get_Table (int Index) const { return( (CSG_Table *)Get_Item(Index) ); } 1421 1422 1423 protected: 1424 1425 CSG_Parameter_Table_List(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1426 1427 1428 friend class CSG_Parameters; 1429 }; 1430 1431 1432 /////////////////////////////////////////////////////////// 1433 // // 1434 /////////////////////////////////////////////////////////// 1435 1436 //--------------------------------------------------------- 1437 class SAGA_API_DLL_EXPORT CSG_Parameter_Shapes_List : public CSG_Parameter_List 1438 { 1439 public: 1440 Get_Type(void)1441 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Shapes_List ); } 1442 1443 void Set_Shape_Type (TSG_Shape_Type Type); Get_Shape_Type(void)1444 TSG_Shape_Type Get_Shape_Type (void) const { return( m_Type );} 1445 Get_Shapes(int Index)1446 CSG_Shapes * Get_Shapes (int Index) const { return( (CSG_Shapes *)Get_Item(Index) ); } 1447 1448 1449 protected: 1450 1451 CSG_Parameter_Shapes_List(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1452 1453 TSG_Shape_Type m_Type; 1454 1455 1456 virtual bool _Assign (CSG_Parameter *pSource); 1457 1458 1459 friend class CSG_Parameters; 1460 }; 1461 1462 1463 /////////////////////////////////////////////////////////// 1464 // // 1465 /////////////////////////////////////////////////////////// 1466 1467 //--------------------------------------------------------- 1468 class SAGA_API_DLL_EXPORT CSG_Parameter_TIN_List : public CSG_Parameter_List 1469 { 1470 public: 1471 Get_Type(void)1472 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_TIN_List ); } 1473 asTIN(int Index)1474 CSG_TIN * asTIN (int Index) const { return( (CSG_TIN *)Get_Item(Index) ); } 1475 1476 1477 protected: 1478 1479 CSG_Parameter_TIN_List(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1480 1481 1482 friend class CSG_Parameters; 1483 }; 1484 1485 1486 /////////////////////////////////////////////////////////// 1487 // // 1488 /////////////////////////////////////////////////////////// 1489 1490 //--------------------------------------------------------- 1491 class SAGA_API_DLL_EXPORT CSG_Parameter_PointCloud_List : public CSG_Parameter_List 1492 { 1493 public: 1494 Get_Type(void)1495 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_PointCloud_List ); } 1496 Get_PointCloud(int Index)1497 CSG_PointCloud * Get_PointCloud (int Index) const { return( (CSG_PointCloud *)Get_Item(Index) ); } 1498 1499 1500 protected: 1501 1502 CSG_Parameter_PointCloud_List(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1503 1504 1505 friend class CSG_Parameters; 1506 }; 1507 1508 1509 /////////////////////////////////////////////////////////// 1510 // // 1511 /////////////////////////////////////////////////////////// 1512 1513 //--------------------------------------------------------- 1514 class SAGA_API_DLL_EXPORT CSG_Parameter_Parameters : public CSG_Parameter 1515 { 1516 public: 1517 Get_Type(void)1518 virtual TSG_Parameter_Type Get_Type (void) const { return( PARAMETER_TYPE_Parameters ); } 1519 1520 virtual bool Restore_Default (void); 1521 1522 1523 protected: 1524 1525 CSG_Parameter_Parameters(CSG_Parameters *pOwner, CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1526 virtual ~CSG_Parameter_Parameters(void); 1527 1528 CSG_Parameters *m_pParameters; 1529 1530 1531 virtual void _Set_String (void); 1532 1533 virtual void * _asPointer (void) const; 1534 1535 virtual bool _Assign (CSG_Parameter *pSource); 1536 virtual bool _Serialize (CSG_MetaData &Entry, bool bSave); 1537 1538 1539 friend class CSG_Parameters; 1540 }; 1541 1542 1543 /////////////////////////////////////////////////////////// 1544 // // 1545 // Grid Target Selector // 1546 // // 1547 /////////////////////////////////////////////////////////// 1548 1549 //--------------------------------------------------------- 1550 class SAGA_API_DLL_EXPORT CSG_Parameters_Grid_Target 1551 { 1552 public: 1553 CSG_Parameters_Grid_Target(void); 1554 1555 bool Create (CSG_Parameters *pParameters, bool bAddDefaultGrid , CSG_Parameter *pParent , const CSG_String &Prefix = ""); 1556 bool Create (CSG_Parameters *pParameters, bool bAddDefaultGrid = true, const CSG_String &ParentID = "", const CSG_String &Prefix = ""); 1557 1558 bool Add_Grid (const CSG_String &ID, const CSG_String &Name, bool bOptional); 1559 bool Add_Grids (const CSG_String &ID, const CSG_String &Name, bool bOptional, bool bZLevels = false); 1560 1561 bool On_Parameter_Changed (CSG_Parameters *pParameters, CSG_Parameter *pParameter); 1562 bool On_Parameters_Enable (CSG_Parameters *pParameters, CSG_Parameter *pParameter); 1563 1564 bool Set_User_Defined (CSG_Parameters *pParameters, const TSG_Rect &Extent, int Rows = 0, int Rounding = 2); 1565 bool Set_User_Defined (CSG_Parameters *pParameters, CSG_Shapes *pPoints, int Scale = 4 , int Rounding = 2); 1566 bool Set_User_Defined (CSG_Parameters *pParameters, double xMin, double yMin, double Size, int nx, int ny); 1567 bool Set_User_Defined (CSG_Parameters *pParameters, const CSG_Grid_System &System); 1568 1569 bool Set_User_Defined_ZLevels (CSG_Parameters *pParameters, double zMin, double zMax, int nLevels, int Rounding = 2); 1570 1571 CSG_Grid_System Get_System (void); 1572 1573 CSG_Grid * Get_Grid (const CSG_String &ID, TSG_Data_Type Type = SG_DATATYPE_Float); 1574 CSG_Grid * Get_Grid ( TSG_Data_Type Type = SG_DATATYPE_Float); 1575 1576 CSG_Grids * Get_Grids (const CSG_String &ID, TSG_Data_Type Type = SG_DATATYPE_Float); 1577 CSG_Grids * Get_Grids ( TSG_Data_Type Type = SG_DATATYPE_Float); 1578 1579 1580 private: 1581 1582 CSG_String m_Prefix; 1583 1584 CSG_Parameters *m_pParameters; 1585 1586 }; 1587 1588 1589 /////////////////////////////////////////////////////////// 1590 // // 1591 // CSG_Parameters // 1592 // // 1593 /////////////////////////////////////////////////////////// 1594 1595 //--------------------------------------------------------- 1596 typedef int (* TSG_PFNC_Parameter_Changed) (CSG_Parameter *pParameter, int Flags); 1597 1598 //--------------------------------------------------------- 1599 class SAGA_API_DLL_EXPORT CSG_Parameters 1600 { 1601 friend class CSG_Parameter; 1602 friend class CSG_Tool; 1603 1604 public: 1605 CSG_Parameters(void); 1606 virtual ~CSG_Parameters(void); 1607 1608 CSG_Parameters (const CSG_Parameters &Parameters); 1609 bool Create (const CSG_Parameters &Parameters); 1610 1611 CSG_Parameters (const SG_Char *Name, const SG_Char *Description = NULL, const SG_Char *Identifier = NULL, bool bGrid_System = false); 1612 bool Create (const SG_Char *Name, const SG_Char *Description = NULL, const SG_Char *Identifier = NULL, bool bGrid_System = false); 1613 1614 CSG_Parameters (void *pOwner, const SG_Char *Name, const SG_Char *Description = NULL, const SG_Char *Identifier = NULL, bool bGrid_System = false); 1615 bool Create (void *pOwner, const SG_Char *Name, const SG_Char *Description = NULL, const SG_Char *Identifier = NULL, bool bGrid_System = false); 1616 1617 void Destroy (void); 1618 1619 //----------------------------------------------------- Get_Owner(void)1620 void * Get_Owner (void) const { return( m_pOwner ); } 1621 Get_Tool(void)1622 class CSG_Tool * Get_Tool (void) const { return( m_pTool ); } 1623 Get_Manager(void)1624 class CSG_Data_Manager * Get_Manager (void) const { return( m_pManager ); } 1625 void Set_Manager (class CSG_Data_Manager *pManager); 1626 1627 bool Use_Grid_System (void); 1628 1629 bool has_GUI (void) const; 1630 Get_Count(void)1631 int Get_Count (void) const { return( m_nParameters ); } 1632 1633 void Set_Identifier (const CSG_String &Identifier); 1634 bool Cmp_Identifier (const CSG_String &Identifier) const; Get_Identifier(void)1635 const CSG_String & Get_Identifier (void) const { return( m_Identifier ); } 1636 1637 void Set_Name (const CSG_String &Name); Get_Name(void)1638 const CSG_String & Get_Name (void) const { return( m_Name ); } 1639 1640 void Set_Description (const CSG_String &Description); Get_Description(void)1641 const CSG_String & Get_Description (void) const { return( m_Description ); } 1642 1643 void Add_Reference (const CSG_String &Authors, const CSG_String &Year, const CSG_String &Title, const CSG_String &Where, const SG_Char *Link = NULL, const SG_Char *Link_Text = NULL); 1644 void Add_Reference (const CSG_String &Link, const SG_Char *Link_Text = NULL); 1645 void Del_References (void); Get_References(void)1646 const CSG_Strings & Get_References (void) const { return( m_References ); } 1647 1648 void Set_Enabled (bool bEnabled = true); 1649 void Set_Enabled (const CSG_String &Identifier, bool bEnabled = true); 1650 1651 //----------------------------------------------------- 1652 TSG_PFNC_Parameter_Changed Set_Callback_On_Parameter_Changed (TSG_PFNC_Parameter_Changed pCallback); 1653 bool Set_Callback (bool bActive = true); 1654 1655 //----------------------------------------------------- 1656 CSG_Parameters & operator = (const CSG_Parameters &Parameters) { Create(Parameters); return( *this ); } 1657 Get_Parameter(int i)1658 CSG_Parameter * Get_Parameter (int i ) const { return( i >= 0 && i < m_nParameters ? m_Parameters[i] : NULL ); } 1659 CSG_Parameter * Get_Parameter (const CSG_String &ID) const; 1660 operator()1661 CSG_Parameter * operator() (int i ) const { return( Get_Parameter(i ) ); } operator()1662 CSG_Parameter * operator() (const CSG_String &ID) const { return( Get_Parameter(ID) ); } operator()1663 CSG_Parameter * operator() (const char *ID) const { return( Get_Parameter(ID) ); } operator()1664 CSG_Parameter * operator() (const wchar_t *ID) const { return( Get_Parameter(ID) ); } 1665 1666 CSG_Parameter & operator[] (int i ) const { return( *Get_Parameter(i ) ); } 1667 CSG_Parameter & operator[] (const CSG_String &ID) const { return( *Get_Parameter(ID) ); } 1668 CSG_Parameter & operator[] (const char *ID) const { return( *Get_Parameter(ID) ); } 1669 CSG_Parameter & operator[] (const wchar_t *ID) const { return( *Get_Parameter(ID) ); } 1670 1671 //----------------------------------------------------- 1672 bool Del_Parameter (int i); 1673 bool Del_Parameter (const CSG_String &ID); 1674 1675 bool Del_Parameters (void); 1676 1677 //----------------------------------------------------- 1678 CSG_Parameter * Add_Parameter (CSG_Parameter *pParameter); 1679 1680 CSG_Parameter * Add_Node (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description); 1681 1682 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); 1683 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); 1684 1685 CSG_Parameter * Add_Bool (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool Value = false); 1686 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); 1687 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); 1688 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); 1689 CSG_Parameter * Add_Date (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value = 0.0); // Julian Day Number 1690 CSG_Parameter * Add_Color (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Value = 0); 1691 1692 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); 1693 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); 1694 1695 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); 1696 CSG_Parameter * Add_Choices (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &Items); 1697 1698 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); 1699 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); 1700 1701 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); 1702 1703 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); 1704 CSG_Parameter * Add_Colors (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Colors *pInit = NULL); 1705 CSG_Parameter * Add_FixedTable (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Table *pInit = NULL); 1706 1707 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); 1708 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); 1709 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); 1710 CSG_Parameter * Add_Grid_Output (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description); 1711 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); 1712 1713 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); 1714 CSG_Parameter * Add_Grids_Output (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description); 1715 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); 1716 1717 CSG_Parameter * Add_Table_Field (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool bAllowNone = false); 1718 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); 1719 CSG_Parameter * Add_Table_Fields (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description); 1720 CSG_Parameter * Add_Table (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1721 CSG_Parameter * Add_Table_Output (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description); 1722 CSG_Parameter * Add_Table_List (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1723 1724 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); 1725 CSG_Parameter * Add_Shapes_Output (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description); 1726 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); 1727 1728 CSG_Parameter * Add_TIN (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1729 CSG_Parameter * Add_TIN_Output (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description); 1730 CSG_Parameter * Add_TIN_List (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1731 1732 CSG_Parameter * Add_PointCloud (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1733 CSG_Parameter * Add_PointCloud_Output (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description); 1734 CSG_Parameter * Add_PointCloud_List (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint); 1735 1736 CSG_Parameter * Add_Parameters (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description); 1737 1738 //----------------------------------------------------- 1739 bool Set_Parameter (const CSG_String &ID, CSG_Parameter *pValue); 1740 bool Set_Parameter (const char *ID, CSG_Parameter *pValue); 1741 bool Set_Parameter (const wchar_t *ID, CSG_Parameter *pValue); 1742 bool Set_Parameter (const CSG_String &ID, void *Value, int Type = PARAMETER_TYPE_Undefined); 1743 bool Set_Parameter (const char *ID, void *Value, int Type = PARAMETER_TYPE_Undefined); 1744 bool Set_Parameter (const wchar_t *ID, void *Value, int Type = PARAMETER_TYPE_Undefined); 1745 bool Set_Parameter (const CSG_String &ID, CSG_Data_Object *Value, int Type = PARAMETER_TYPE_Undefined); 1746 bool Set_Parameter (const char *ID, CSG_Data_Object *Value, int Type = PARAMETER_TYPE_Undefined); 1747 bool Set_Parameter (const wchar_t *ID, CSG_Data_Object *Value, int Type = PARAMETER_TYPE_Undefined); 1748 bool Set_Parameter (const CSG_String &ID, int Value, int Type = PARAMETER_TYPE_Undefined); 1749 bool Set_Parameter (const char *ID, int Value, int Type = PARAMETER_TYPE_Undefined); 1750 bool Set_Parameter (const wchar_t *ID, int Value, int Type = PARAMETER_TYPE_Undefined); 1751 bool Set_Parameter (const CSG_String &ID, double Value, int Type = PARAMETER_TYPE_Undefined); 1752 bool Set_Parameter (const char *ID, double Value, int Type = PARAMETER_TYPE_Undefined); 1753 bool Set_Parameter (const wchar_t *ID, double Value, int Type = PARAMETER_TYPE_Undefined); 1754 bool Set_Parameter (const CSG_String &ID, const CSG_String &Value, int Type = PARAMETER_TYPE_Undefined); 1755 bool Set_Parameter (const char *ID, const CSG_String &Value, int Type = PARAMETER_TYPE_Undefined); 1756 bool Set_Parameter (const wchar_t *ID, const CSG_String &Value, int Type = PARAMETER_TYPE_Undefined); 1757 bool Set_Parameter (const CSG_String &ID, const char *Value, int Type = PARAMETER_TYPE_Undefined); 1758 bool Set_Parameter (const char *ID, const char *Value, int Type = PARAMETER_TYPE_Undefined); 1759 bool Set_Parameter (const wchar_t *ID, const char *Value, int Type = PARAMETER_TYPE_Undefined); 1760 bool Set_Parameter (const CSG_String &ID, const wchar_t *Value, int Type = PARAMETER_TYPE_Undefined); 1761 bool Set_Parameter (const char *ID, const wchar_t *Value, int Type = PARAMETER_TYPE_Undefined); 1762 bool Set_Parameter (const wchar_t *ID, const wchar_t *Value, int Type = PARAMETER_TYPE_Undefined); 1763 1764 bool Restore_Defaults (bool bClearData = false); 1765 1766 bool Assign (CSG_Parameters *pSource); 1767 bool Assign_Values (CSG_Parameters *pSource); 1768 bool Assign_Parameters (CSG_Parameters *pSource); 1769 1770 bool Serialize (const CSG_String &File ) const; 1771 bool Serialize (const CSG_String &File, bool bSave); 1772 bool Serialize (CSG_MetaData &Root ) const; 1773 bool Serialize (CSG_MetaData &Root, bool bSave); 1774 1775 bool Serialize_Compatibility (CSG_File &Stream); 1776 1777 //----------------------------------------------------- 1778 bool DataObjects_Check (bool bSilent = false); 1779 1780 //----------------------------------------------------- 1781 bool Get_String (CSG_String &String, bool bOptionsOnly); 1782 bool Msg_String (bool bOptionsOnly); 1783 1784 bool Set_History (CSG_MetaData &History, bool bOptions = true, bool bDataObjects = true); 1785 is_Managed(void)1786 bool is_Managed (void) const { return( m_pManager != NULL ); } 1787 Get_Grid_System_Parameter(void)1788 CSG_Parameter * Get_Grid_System_Parameter (void) const { return( m_pGrid_System ); } Get_Grid_System(void)1789 CSG_Grid_System * Get_Grid_System (void) const { return( m_pGrid_System ? m_pGrid_System->asGrid_System() : NULL ); } 1790 bool Set_Grid_System (const CSG_Grid_System &System); 1791 bool Reset_Grid_System (void); 1792 1793 1794 private: 1795 1796 void *m_pOwner; 1797 1798 class CSG_Tool *m_pTool; 1799 1800 class CSG_Data_Manager *m_pManager; 1801 1802 bool m_bCallback; 1803 1804 CSG_String m_Identifier, m_Name, m_Description; 1805 1806 CSG_Strings m_References; 1807 1808 int m_nParameters; 1809 1810 CSG_Parameter **m_Parameters, *m_pGrid_System; 1811 1812 TSG_PFNC_Parameter_Changed m_Callback; 1813 1814 1815 void _On_Construction (void); 1816 1817 bool _On_Parameter_Changed (CSG_Parameter *pParameter, int Flags); 1818 1819 CSG_Parameter * _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); 1820 CSG_Parameter * _Add_Range (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool bInformation, double Range_Min, double Range_Max, double Minimum, bool bMinimum, double Maximum, bool bMaximum); 1821 CSG_Parameter * _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); 1822 1823 CSG_Parameter * _Add (const CSG_String &ParentID, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, TSG_Parameter_Type Type, int Constraint); 1824 CSG_Parameter * _Add (CSG_Parameter *pSource); 1825 1826 bool DataObjects_Create (void); 1827 bool DataObjects_Synchronize (void); 1828 bool DataObjects_Get_Projection (CSG_Projection &Projection) const; 1829 bool DataObjects_Set_Projection (const CSG_Projection &Projection); 1830 1831 1832 public: // DEPRECATED BEGIN 1833 1834 // old style calls (parent as csg_parameter pointer instead of identifier) 1835 Add_Node(CSG_Parameter * pParent,const CSG_String & ID,const CSG_String & Name,const CSG_String & Description)1836 CSG_Parameter * Add_Node (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description) 1837 { return( Add_Node (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description) ); } 1838 CSG_Parameter * Add_Value (CSG_Parameter *pParent, 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) 1839 { return( Add_Value (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Type, Value, Minimum, bMinimum, Maximum, bMaximum) ); } 1840 CSG_Parameter * Add_Info_Value (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, TSG_Parameter_Type Type, double Value = 0.0) 1841 { return( Add_Info_Value (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Type, Value) ); } 1842 CSG_Parameter * Add_Bool (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool Value = false) 1843 { return( Add_Bool (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Value) ); } 1844 CSG_Parameter * Add_Int (CSG_Parameter *pParent, 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) 1845 { return( Add_Int (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Value, Minimum, bMinimum, Maximum, bMaximum) ); } 1846 CSG_Parameter * Add_Double (CSG_Parameter *pParent, 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) 1847 { return( Add_Double (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Value, Minimum, bMinimum, Maximum, bMaximum) ); } 1848 CSG_Parameter * Add_Degree (CSG_Parameter *pParent, 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) 1849 { return( Add_Degree (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Value, Minimum, bMinimum, Maximum, bMaximum) ); } 1850 CSG_Parameter * Add_Date (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Value = 0.0) 1851 { return( Add_Date (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Value) ); } 1852 CSG_Parameter * Add_Color (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Value = 0) 1853 { return( Add_Color (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Value) ); } 1854 CSG_Parameter * Add_Range (CSG_Parameter *pParent, 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) 1855 { return( Add_Range (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Range_Min, Range_Max, Minimum, bMinimum, Maximum, bMaximum) ); } 1856 CSG_Parameter * Add_Info_Range (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, double Range_Min = 0.0, double Range_Max = 0.0) 1857 { return( Add_Info_Range (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Range_Min, Range_Max) ); } 1858 CSG_Parameter * Add_Choice (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &Items, int Default = 0) 1859 { return( Add_Choice (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Items, Default) ); } 1860 CSG_Parameter * Add_String (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &String, bool bLongText = false, bool bPassword = false) 1861 { return( Add_String (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, String, bLongText, bPassword) ); } 1862 CSG_Parameter * Add_Info_String (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const CSG_String &String, bool bLongText = false) 1863 { return( Add_Info_String (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, String, bLongText) ); } 1864 CSG_Parameter * Add_FilePath (CSG_Parameter *pParent, 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) 1865 { return( Add_FilePath (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Filter, Default, bSave, bDirectory, bMultiple) ); } 1866 CSG_Parameter * Add_Font (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, const SG_Char *pInit = NULL) 1867 { return( Add_Font (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, pInit) ); } 1868 CSG_Parameter * Add_Colors (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Colors *pInit = NULL) 1869 { return( Add_Colors (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, pInit) ); } 1870 CSG_Parameter * Add_FixedTable (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Table *pInit = NULL) 1871 { return( Add_FixedTable (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, pInit) ); } 1872 CSG_Parameter * Add_Grid_System (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, CSG_Grid_System *pInit = NULL) 1873 { return( Add_Grid_System (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, pInit) ); } 1874 CSG_Parameter * Add_Grid (CSG_Parameter *pParent, 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) 1875 { return( Add_Grid (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Constraint, bSystem_Dependent, Preferred_Type) ); } 1876 CSG_Parameter * Add_Grid_or_Const (CSG_Parameter *pParent, 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) 1877 { return( Add_Grid_or_Const (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Value, Minimum, bMinimum, Maximum, bMaximum, bSystem_Dependent) ); } Add_Grid_Output(CSG_Parameter * pParent,const CSG_String & ID,const CSG_String & Name,const CSG_String & Description)1878 CSG_Parameter * Add_Grid_Output (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description) 1879 { return( Add_Grid_Output (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description) ); } 1880 CSG_Parameter * Add_Grid_List (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, bool bSystem_Dependent = true) 1881 { return( Add_Grid_List (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Constraint, bSystem_Dependent) ); } 1882 CSG_Parameter * Add_Table_Field (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, bool bAllowNone = false) 1883 { return( Add_Table_Field (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, bAllowNone) ); } 1884 CSG_Parameter * Add_Table_Field_or_Const(CSG_Parameter *pParent, 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) 1885 { return( Add_Table_Field_or_Const(pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Value, Minimum, bMinimum, Maximum, bMaximum) ); } Add_Table_Fields(CSG_Parameter * pParent,const CSG_String & ID,const CSG_String & Name,const CSG_String & Description)1886 CSG_Parameter * Add_Table_Fields (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description) 1887 { return( Add_Table_Fields (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description) ); } Add_Table(CSG_Parameter * pParent,const CSG_String & ID,const CSG_String & Name,const CSG_String & Description,int Constraint)1888 CSG_Parameter * Add_Table (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint) 1889 { return( Add_Table (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Constraint) ); } Add_Table_Output(CSG_Parameter * pParent,const CSG_String & ID,const CSG_String & Name,const CSG_String & Description)1890 CSG_Parameter * Add_Table_Output (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description) 1891 { return( Add_Table_Output (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description) ); } Add_Table_List(CSG_Parameter * pParent,const CSG_String & ID,const CSG_String & Name,const CSG_String & Description,int Constraint)1892 CSG_Parameter * Add_Table_List (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint) 1893 { return( Add_Table_List (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Constraint) ); } 1894 CSG_Parameter * Add_Shapes (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, TSG_Shape_Type Shape_Type = SHAPE_TYPE_Undefined) 1895 { return( Add_Shapes (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Constraint, Shape_Type) ); } Add_Shapes_Output(CSG_Parameter * pParent,const CSG_String & ID,const CSG_String & Name,const CSG_String & Description)1896 CSG_Parameter * Add_Shapes_Output (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description) 1897 { return( Add_Shapes_Output (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description) ); } 1898 CSG_Parameter * Add_Shapes_List (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint, TSG_Shape_Type Shape_Type = SHAPE_TYPE_Undefined) 1899 { return( Add_Shapes_List (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Constraint, Shape_Type) ); } Add_TIN(CSG_Parameter * pParent,const CSG_String & ID,const CSG_String & Name,const CSG_String & Description,int Constraint)1900 CSG_Parameter * Add_TIN (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint) 1901 { return( Add_TIN (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Constraint) ); } Add_TIN_Output(CSG_Parameter * pParent,const CSG_String & ID,const CSG_String & Name,const CSG_String & Description)1902 CSG_Parameter * Add_TIN_Output (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description) 1903 { return( Add_TIN_Output (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description) ); } Add_TIN_List(CSG_Parameter * pParent,const CSG_String & ID,const CSG_String & Name,const CSG_String & Description,int Constraint)1904 CSG_Parameter * Add_TIN_List (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint) 1905 { return( Add_TIN_List (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Constraint) ); } Add_PointCloud(CSG_Parameter * pParent,const CSG_String & ID,const CSG_String & Name,const CSG_String & Description,int Constraint)1906 CSG_Parameter * Add_PointCloud (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint) 1907 { return( Add_PointCloud (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Constraint) ); } Add_PointCloud_Output(CSG_Parameter * pParent,const CSG_String & ID,const CSG_String & Name,const CSG_String & Description)1908 CSG_Parameter * Add_PointCloud_Output (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description) 1909 { return( Add_PointCloud_Output (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description) ); } Add_PointCloud_List(CSG_Parameter * pParent,const CSG_String & ID,const CSG_String & Name,const CSG_String & Description,int Constraint)1910 CSG_Parameter * Add_PointCloud_List (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description, int Constraint) 1911 { return( Add_PointCloud_List (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description, Constraint) ); } Add_Parameters(CSG_Parameter * pParent,const CSG_String & ID,const CSG_String & Name,const CSG_String & Description)1912 CSG_Parameter * Add_Parameters (CSG_Parameter *pParent, const CSG_String &ID, const CSG_String &Name, const CSG_String &Description) 1913 { return( Add_Parameters (pParent ? pParent->Get_Identifier() : SG_T(""), ID, Name, Description) ); } 1914 1915 // DEPRECATED END 1916 1917 }; 1918 1919 1920 /////////////////////////////////////////////////////////// 1921 // // 1922 // // 1923 // // 1924 /////////////////////////////////////////////////////////// 1925 1926 //--------------------------------------------------------- 1927 #endif // #ifndef HEADER_INCLUDED__SAGA_API__parameters_H 1928