SAGA API v9.10
Loading...
Searching...
No Matches
tool.h
Go to the documentation of this file.
1
3// //
4// SAGA //
5// //
6// System for Automated Geoscientific Analyses //
7// //
8// Application Programming Interface //
9// //
10// Library: SAGA_API //
11// //
12//-------------------------------------------------------//
13// //
14// tool.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// //
51
52//---------------------------------------------------------
53#ifndef HEADER_INCLUDED__SAGA_API__tool_H
54#define HEADER_INCLUDED__SAGA_API__tool_H
55
56
58// //
59// //
60// //
62
63//---------------------------------------------------------
72
73
75// //
76// //
77// //
79
80//---------------------------------------------------------
81#include "parameters.h"
82
83
85// //
86// //
87// //
89
90//---------------------------------------------------------
98
99//---------------------------------------------------------
109
110//---------------------------------------------------------
117
118
120// //
121// CSG_Tool //
122// //
124
125//---------------------------------------------------------
133//---------------------------------------------------------
135{
139 friend class CSG_Tool_Chain;
140
141public:
142
143 CSG_Tool(void);
144 virtual ~CSG_Tool(void);
145
146 virtual void Destroy (void);
147
148 virtual TSG_Tool_Type Get_Type (void) const { return( TOOL_TYPE_Base ); }
149
150 const CSG_String & Get_ID (void) const { return( m_ID ); }
151
152 const CSG_String & Get_Library (void) const;
153 const CSG_String & Get_File_Name (void) const; // Returns the file name of the tool's library or, if this is a tool chain, the associated XML file.
154 const CSG_String & Get_Name (void) const;
155 const CSG_String & Get_Author (void) const;
156 const CSG_String & Get_Version (void) const;
157 const CSG_String & Get_Description (void) const;
158 const CSG_Strings & Get_References (void) const;
159 const SG_Char * Get_Icon (void) { return( NULL ); }
160 CSG_String Get_Summary (bool bParameters = true, const CSG_String &Menu = "", const CSG_String &Description = "", int Format = SG_SUMMARY_FMT_HTML);
161
162 virtual CSG_String Get_MenuPath (void) { return( SG_T("") ); }
163 virtual CSG_String Get_MenuPath (bool bSolved);
164
165 CSG_Parameters * Get_Parameters (void) { return( &Parameters ); }
166
167 int Get_Parameters_Count (void) const { return( (int)m_pParameters.Get_Size() ); }
168 CSG_Parameters * Get_Parameters (int i) const { return( i >= 0 && i < Get_Parameters_Count() ? (CSG_Parameters *)m_pParameters[i] : NULL ); }
169 CSG_Parameters * Get_Parameters (int i) { return( i >= 0 && i < Get_Parameters_Count() ? (CSG_Parameters *)m_pParameters[i] : NULL ); }
170 CSG_Parameters * Get_Parameters (const CSG_String &Identifier) const;
171
172 CSG_Parameter * Get_Parameter (const CSG_String &ID) const { return( Parameters(ID) ); }
173 CSG_Parameter * Get_Parameter (const char *ID) const { return( Parameters(ID) ); }
174 CSG_Parameter * Get_Parameter (const wchar_t *ID) const { return( Parameters(ID) ); }
175 bool Set_Parameter (const CSG_String &ID, CSG_Parameter *pValue);
176 bool Set_Parameter (const char *ID, CSG_Parameter *pValue);
177 bool Set_Parameter (const wchar_t *ID, CSG_Parameter *pValue);
178 bool Set_Parameter (const CSG_String &ID, int Value, int Type = PARAMETER_TYPE_Undefined);
179 bool Set_Parameter (const char *ID, int Value, int Type = PARAMETER_TYPE_Undefined);
180 bool Set_Parameter (const wchar_t *ID, int Value, int Type = PARAMETER_TYPE_Undefined);
181 bool Set_Parameter (const CSG_String &ID, double Value, int Type = PARAMETER_TYPE_Undefined);
182 bool Set_Parameter (const char *ID, double Value, int Type = PARAMETER_TYPE_Undefined);
183 bool Set_Parameter (const wchar_t *ID, double Value, int Type = PARAMETER_TYPE_Undefined);
184 bool Set_Parameter (const CSG_String &ID, void *Value, int Type = PARAMETER_TYPE_Undefined);
185 bool Set_Parameter (const char *ID, void *Value, int Type = PARAMETER_TYPE_Undefined);
186 bool Set_Parameter (const wchar_t *ID, void *Value, int Type = PARAMETER_TYPE_Undefined);
187 bool Set_Parameter (const CSG_String &ID, const CSG_String &Value, int Type = PARAMETER_TYPE_Undefined);
188 bool Set_Parameter (const char *ID, const CSG_String &Value, int Type = PARAMETER_TYPE_Undefined);
189 bool Set_Parameter (const wchar_t *ID, const CSG_String &Value, int Type = PARAMETER_TYPE_Undefined);
190 bool Set_Parameter (const CSG_String &ID, const char *Value, int Type = PARAMETER_TYPE_Undefined);
191 bool Set_Parameter (const char *ID, const char *Value, int Type = PARAMETER_TYPE_Undefined);
192 bool Set_Parameter (const wchar_t *ID, const char *Value, int Type = PARAMETER_TYPE_Undefined);
193 bool Set_Parameter (const CSG_String &ID, const wchar_t *Value, int Type = PARAMETER_TYPE_Undefined);
194 bool Set_Parameter (const char *ID, const wchar_t *Value, int Type = PARAMETER_TYPE_Undefined);
195 bool Set_Parameter (const wchar_t *ID, const wchar_t *Value, int Type = PARAMETER_TYPE_Undefined);
196
197 bool Reset (bool bManager = true);
198 bool Reset_Manager (void);
199 bool Reset_Grid_System (void);
200
201 bool Update_Parameter_States (void);
202
203 void Set_Callback (bool bActive = true);
204
205 bool Set_Manager (class CSG_Data_Manager *pManager);
206 class CSG_Data_Manager * Get_Manager (void) const;
207 class CSG_Data_Manager * Create_Manager (void);
208 bool Delete_Manager (bool bDetachData = false, bool bReset = true);
209
210 bool Set_Grid_System (const CSG_Grid_System &System);
211 CSG_Grid_System * Get_Grid_System (void) const;
212
213 bool Settings_Push (class CSG_Data_Manager *pManager = NULL);
214 bool Settings_Pop (void);
215
216 virtual bool do_Sync_Projections (void) const { return( true ); }
217
218 virtual bool needs_GUI (void) const { return( false ); }
219 bool has_GUI (void) const;
220 bool has_CMD (void) const;
221
222 virtual bool is_Grid (void) const { return( false ); }
223 virtual bool is_Interactive (void) const { return( false ); }
224 bool is_Progress (void) const { return( SG_UI_Process_Get_Okay(false) ); }
225 bool is_Executing (void) const { return( m_bExecutes ); }
226
227 void Set_Show_Progress (bool bOn = true);
228
229 virtual bool On_Before_Execution (void) { return( true ); }
230 virtual bool On_After_Execution (void) { return( true ); }
231
232 bool Execute (bool bAddHistory = false);
233
234 const SG_Char * Get_Execution_Info (void) const { return( m_Execution_Info ); }
235
236 CSG_MetaData Get_History (int Depth = -1);
237 bool Set_History (CSG_Data_Object *pDataObject, int Depth = -1);
238
239
240 //-----------------------------------------------------
250
251 CSG_String Get_Script (Script_Format Format, bool bHeader = true, int Arguments = 0, bool bWrapArgs = true);
252
253
254protected:
255
257
259
260
261 //-----------------------------------------------------
262 void Set_Name (const CSG_String &String);
263 void Set_Author (const CSG_String &String);
264 void Set_Version (const CSG_String &String);
265 void Set_Description (const CSG_String &String);
266
267 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);
268 void Add_Reference (const CSG_String &Link, const SG_Char *Link_Text = NULL);
269
270 //-----------------------------------------------------
271 virtual bool On_Execute (void) = 0;
272
273 virtual int On_Parameter_Changed (CSG_Parameters *pParameters, CSG_Parameter *pParameter);
274 virtual int On_Parameters_Enable (CSG_Parameters *pParameters, CSG_Parameter *pParameter);
275
277
278 //-----------------------------------------------------
279 CSG_Parameters * Add_Parameters (const CSG_String &Identifier, const CSG_String &Name, const CSG_String &Description);
280 bool Dlg_Parameters (const CSG_String &Identifier); // deprecated
281
282 bool Dlg_Parameters (CSG_Parameters *pParameters, const CSG_String &Caption = "");
283 bool Dlg_Parameters (CSG_Parameters &Parameters, const CSG_String &Caption = "");
284
285 //-----------------------------------------------------
286 virtual bool Set_Progress (int Position, int Range ) const;
287 virtual bool Set_Progress (sLong Position, sLong Range ) const;
288 virtual bool Set_Progress (double Position, double Range = 1.) const;
289
290 bool Stop_Execution (bool bDialog = true);
291
292 void Message_Dlg (const CSG_String &Text, const SG_Char *Caption = NULL);
293 bool Message_Dlg_Confirm (const CSG_String &Text, const SG_Char *Caption = NULL);
294
295 void Message_Add (const CSG_String &Text, bool bNewLine = true);
296 void Message_Fmt (const char *Format, ...);
297 void Message_Fmt (const wchar_t *Format, ...);
298
299 bool Error_Set (TSG_Tool_Error Error_ID = TOOL_ERROR_Unknown);
300 bool Error_Set (const CSG_String &Text);
301 bool Error_Fmt (const char *Format, ...);
302 bool Error_Fmt (const wchar_t *Format, ...);
303
304 //-----------------------------------------------------
305 bool DataObject_Add (CSG_Data_Object *pDataObject, bool bUpdate = false);
306
307 bool DataObject_Update_All (void);
308
309 bool DataObject_Set_History (CSG_Parameter *pParameter, CSG_MetaData *pHistory = NULL);
310
311 bool Get_Projection (CSG_Projection &Projection) const;
312
313
314protected: // static functions...
315
316 static int _On_Parameter_Changed (CSG_Parameter *pParameter, int Flags);
317
318 static bool Process_Get_Okay (bool bBlink = false);
319 static void Process_Set_Text (const CSG_String &Text);
320 static void Process_Set_Text (const char *Format, ...);
321 static void Process_Set_Text (const wchar_t *Format, ...);
322
323 static bool DataObject_Update (CSG_Data_Object *pDataObject , int Show = SG_UI_DATAOBJECT_UPDATE);
324 static bool DataObject_Update (CSG_Data_Object *pDataObject, double Minimum, double Maximum, int Show = SG_UI_DATAOBJECT_UPDATE);
325
326 static bool DataObject_Get_Colors (CSG_Data_Object *pDataObject, CSG_Colors &Colors);
327 static bool DataObject_Set_Colors (CSG_Data_Object *pDataObject, const CSG_Colors &Colors);
328 static bool DataObject_Set_Colors (CSG_Data_Object *pDataObject, int nColors = 0, int Colors = SG_COLORS_DEFAULT, bool bRevert = false);
329 static bool DataObject_Set_Colors (CSG_Data_Object *pDataObject, const CSG_String &Colors, int nColors = 0, bool bRevert = false);
330
331 static bool DataObject_Get_Parameters (CSG_Data_Object *pDataObject, CSG_Parameters &Parameters);
332 static bool DataObject_Set_Parameters (CSG_Data_Object *pDataObject, CSG_Parameters &Parameters);
333 static bool DataObject_Set_Parameters (CSG_Data_Object *pDataObject, CSG_Data_Object *pCopy);
334
335 static CSG_Parameter * DataObject_Get_Parameter (CSG_Data_Object *pDataObject, const CSG_String &ID);
336 static bool DataObject_Set_Parameter (CSG_Data_Object *pDataObject, CSG_Parameter *pParameter);
337 static bool DataObject_Set_Parameter (CSG_Data_Object *pDataObject, CSG_Data_Object *pCopy, const CSG_String &ID);
338 static bool DataObject_Set_Parameter (CSG_Data_Object *pDataObject, const CSG_String &ID, int Value);
339 static bool DataObject_Set_Parameter (CSG_Data_Object *pDataObject, const CSG_String &ID, double Value);
340 static bool DataObject_Set_Parameter (CSG_Data_Object *pDataObject, const CSG_String &ID, void *Value);
341 static bool DataObject_Set_Parameter (CSG_Data_Object *pDataObject, const CSG_String &ID, const SG_Char *Value);
342 static bool DataObject_Set_Parameter (CSG_Data_Object *pDataObject, const CSG_String &ID, double loVal, double hiVal); // Range Parameter
343
344 static bool DataObject_Set_Stretch_Linear (CSG_Data_Object *pDataObject, int Field = -1, double Minimum = 5., double Maximum = 95. , int Interval_Mode = 0, double Interval_Log = 1., int Colors = -1, bool bUpdateNow = false);
345 static bool DataObject_Set_Stretch_StdDev (CSG_Data_Object *pDataObject, int Field = -1, double StdDev = 2., bool bKeepInRange = false, int Interval_Mode = 0, double Interval_Log = 1., int Colors = -1, bool bUpdateNow = false);
346 static bool DataObject_Set_Stretch_Percentile (CSG_Data_Object *pDataObject, int Field = -1, double Minimum = 2., double Maximum = 98. , int Interval_Mode = 0, double Interval_Log = 1., int Colors = -1, bool bUpdateNow = false);
347 static bool DataObject_Set_Stretch (CSG_Data_Object *pDataObject, int Field , double Minimum , double Maximum , int Interval_Mode = 0, double Interval_Log = 1., int Colors = -1, bool bUpdateNow = false);
348
349 static bool DataObject_Classify_Unique (CSG_Data_Object *pDataObject, int Field = -1, int Classes_Max = 1024 , int Colors = -1);
350 static bool DataObject_Classify_Equal (CSG_Data_Object *pDataObject, int Field = -1, int Classes = 10 , int Colors = -1);
351 static bool DataObject_Classify_Defined (CSG_Data_Object *pDataObject, int Field , double Interval, bool bOffset = false, double Offset = 0., int Colors = -1);
352 static bool DataObject_Classify_Quantile (CSG_Data_Object *pDataObject, int Field = -1, int Classes = 10, bool bHistogram = true , int Colors = -1);
353 static bool DataObject_Classify_Geometric (CSG_Data_Object *pDataObject, int Field = -1, int Classes = 10, bool bIncreasing = true , int Colors = -1);
354 static bool DataObject_Classify_Natural (CSG_Data_Object *pDataObject, int Field = -1, int Classes = 10 , int Colors = -1);
355 static bool DataObject_Classify_StdDev (CSG_Data_Object *pDataObject, int Field = -1, double StdDev = 0.5, double StdDev_Max = 4.5 , int Colors = -1);
356
357
358private:
359
360 bool m_bExecutes, m_bError_Ignore, m_bShow_Progress, m_bGUI, m_bCMD;
361
362 CSG_Array_Pointer m_pParameters;
363
364 CSG_String m_ID, m_Library, m_Library_Menu, m_File_Name, m_Author, m_Version, m_Execution_Info;
365
366
367 bool _Synchronize_DataObjects (void);
368
369 CSG_String _Get_Script_CMD (bool bHeader , bool bAllArguments, bool bWrapArgs, bool bBatch);
370 void _Get_Script_CMD (CSG_String &Script, CSG_Parameters *pParameters, bool bAllArguments, bool bWrapArgs, bool bBatch);
371
372 CSG_String _Get_Script_CMD_Usage (void);
373 void _Get_Script_CMD_Usage (CSG_Parameters *pParameters, class wxCmdLineParser &Parser);
374
375 CSG_String _Get_Script_Python (bool bHeader, bool bAllArguments);
376 void _Get_Script_Python (CSG_String &Script, CSG_Parameters *pParameters, bool bAllArguments, const CSG_String &Prefix = "");
377
378 CSG_String _Get_Script_Python_Wrap (bool bHeader, bool bName, bool bCall, int AllArguments, bool bWrapArgs);
379 bool _Get_Script_Python_Wrap (const CSG_Parameter &Parameter, int Constraint, CSG_String &Arguments, CSG_String &Description, CSG_String &Code, bool bCall, bool bOnlyNonDefaults, bool bWrapArgs, const CSG_String &Prefix = "");
380
381 CSG_String _Get_Script_Markdown (bool bHeader, int iArguments);
382 void _Get_Script_Markdown (CSG_String &Description, CSG_Parameters *pParameters, int iArguments, const CSG_String &Prefix = "");
383
384 void _Set_Output_History (void);
385
386 void _Update_Parameter_States (CSG_Parameters *pParameters);
387
388};
389
390
392// //
393// CSG_Tool_Grid //
394// //
396
397//---------------------------------------------------------
401//---------------------------------------------------------
403{
404public:
405 CSG_Tool_Grid(void);
406 virtual ~CSG_Tool_Grid(void);
407
408 virtual TSG_Tool_Type Get_Type (void) const { return( TOOL_TYPE_Grid ); }
409
410 const CSG_Grid_System & Get_System (void) const { return( *Parameters.Get_Grid_System() ); }
411 bool Set_System (const CSG_Grid_System &System);
412
413 virtual bool is_Grid (void) const { return( true ); }
414
415
416protected:
417
418 virtual bool Set_Progress_Cells (sLong Cell) const;
419 virtual bool Set_Progress_Rows (int Row) const;
420
421 //-----------------------------------------------------
422 int Get_NX (void) const { return( Get_System().Get_NX () ); }
423 int Get_NY (void) const { return( Get_System().Get_NY () ); }
424 sLong Get_NCells (void) const { return( Get_System().Get_NCells () ); }
425 double Get_XMin (void) const { return( Get_System().Get_XMin () ); }
426 double Get_YMin (void) const { return( Get_System().Get_YMin () ); }
427 double Get_XMax (void) const { return( Get_System().Get_XMax () ); }
428 double Get_YMax (void) const { return( Get_System().Get_YMax () ); }
429 double Get_Cellsize (void) const { return( Get_System().Get_Cellsize() ); }
430 double Get_Cellarea (void) const { return( Get_System().Get_Cellarea() ); }
431
432 double Get_Length (int i) const { return( Get_System().Get_Length (i) ); }
433 double Get_UnitLength (int i) const { return( Get_System().Get_UnitLength(i) ); }
434 bool is_InGrid (int x, int y) const { return( Get_System().is_InGrid(x, y) ); }
435 bool is_InGrid (int x, int y, int Rand) const { return( Get_System().is_InGrid(x, y, Rand) ); }
436
437 static int Get_xTo (int i, int x = 0) { return( CSG_Grid_System::Get_xTo (i, x) ); }
438 static int Get_yTo (int i, int y = 0) { return( CSG_Grid_System::Get_yTo (i, y) ); }
439 static int Get_xFrom (int i, int x = 0) { return( CSG_Grid_System::Get_xFrom(i, x) ); }
440 static int Get_yFrom (int i, int y = 0) { return( CSG_Grid_System::Get_yFrom(i, y) ); }
441
442 //-----------------------------------------------------
443 void Lock_Create (void);
444 void Lock_Destroy (void);
445
446 bool is_Locked (int x, int y) { return( Lock_Get(x, y) != 0 ); }
447 char Lock_Get (int x, int y) { return( m_pLock && x >= 0 && x < Get_NX() && y >= 0 && y < Get_NY() ? m_pLock->asChar(x, y) : 0 ); }
448
449 void Lock_Set (int x, int y, char Value = 1)
450 {
451 if( m_pLock && x >= 0 && x < Get_NX() && y >= 0 && y < Get_NY() )
452 {
453 m_pLock->Set_Value(x, y, Value);
454 }
455 }
456
457
458private:
459
460 CSG_Grid *m_pLock;
461
462};
463
464
466// //
467// CSG_Tool_Interactive_Base //
468// //
470
471//---------------------------------------------------------
490
491//---------------------------------------------------------
500
501//---------------------------------------------------------
502#define TOOL_INTERACTIVE_KEY_LEFT 0x01
503#define TOOL_INTERACTIVE_KEY_MIDDLE 0x02
504#define TOOL_INTERACTIVE_KEY_RIGHT 0x04
505#define TOOL_INTERACTIVE_KEY_SHIFT 0x08
506#define TOOL_INTERACTIVE_KEY_ALT 0x10
507#define TOOL_INTERACTIVE_KEY_CTRL 0x20
508
509//---------------------------------------------------------
513//---------------------------------------------------------
515{
518
519public:
521 virtual ~CSG_Tool_Interactive_Base(void);
522
524
525 bool Execute_Position (CSG_Point ptWorld, TSG_Tool_Interactive_Mode Mode, int Keys);
526 bool Execute_Keyboard (int Character, int Keys);
527 bool Execute_Finish (void);
528
529 int Get_Drag_Mode (void) const { return( m_Drag_Mode ); }
530
531
532protected:
533
534 const CSG_Projection & Get_Projection (void) const { return( m_Projection ); }
535
536 virtual bool On_Execute_Position (CSG_Point ptWorld, TSG_Tool_Interactive_Mode Mode);
537 virtual bool On_Execute_Keyboard (int Character);
538 virtual bool On_Execute_Finish (void);
539
540 const CSG_Point & Get_Position (void) const { return( m_Point ); }
541 double Get_xPosition (void) const { return( m_Point .x ); }
542 double Get_yPosition (void) const { return( m_Point .y ); }
543
544 const CSG_Point & Get_Position_Last (void) const { return( m_Point_Last ); }
545 double Get_xPosition_Last (void) const { return( m_Point_Last.x ); }
546 double Get_yPosition_Last (void) const { return( m_Point_Last.y ); }
547
548 bool is_Shift (void) const { return( (m_Keys & TOOL_INTERACTIVE_KEY_SHIFT) != 0 ); }
549 bool is_Alt (void) const { return( (m_Keys & TOOL_INTERACTIVE_KEY_ALT ) != 0 ); }
550 bool is_Ctrl (void) const { return( (m_Keys & TOOL_INTERACTIVE_KEY_CTRL ) != 0 ); }
551
552 void Set_Drag_Mode (int Drag_Mode);
553
554
555private:
556
557 int m_Keys, m_Drag_Mode;
558
559 CSG_Point m_Point, m_Point_Last;
560
561 CSG_Projection m_Projection;
562
563 CSG_Tool *m_pTool;
564
565};
566
567
569// //
570// CSG_Tool_Interactive //
571// //
573
574//---------------------------------------------------------
578//---------------------------------------------------------
580{
581public:
583 virtual ~CSG_Tool_Interactive(void);
584
585 virtual TSG_Tool_Type Get_Type (void) const { return( TOOL_TYPE_Interactive ); }
586
587 virtual bool needs_GUI (void) const { return( true ); }
588
589 virtual bool is_Interactive (void) const { return( true ); }
590
591};
592
593
595// //
596// CSG_Tool_Grid_Interactive //
597// //
599
600//---------------------------------------------------------
604//---------------------------------------------------------
606{
607public:
609 virtual ~CSG_Tool_Grid_Interactive(void);
610
611 virtual TSG_Tool_Type Get_Type (void) const { return( TOOL_TYPE_Grid_Interactive ); }
612
613 virtual bool needs_GUI (void) const { return( true ); }
614
615 virtual bool is_Interactive (void) const { return( true ); }
616
617
618protected:
619
620 bool Get_Grid_Pos (int &x, int &y) const;
621
622 int Get_xGrid (void) const;
623 int Get_yGrid (void) const;
624
625};
626
627
629// //
630// Tool Library Interface Definitions //
631// //
633
634//---------------------------------------------------------
650
651//---------------------------------------------------------
652typedef CSG_Tool * (* TSG_PFNC_TLB_Create_Tool) (int i);
654
655//---------------------------------------------------------
657{
658public:
660 virtual ~CSG_Tool_Library_Interface(void);
661
662 bool Create (const CSG_String &Version, const CSG_String &TLB_Path, TSG_PFNC_TLB_Get_Info Fnc_Info, TSG_PFNC_TLB_Create_Tool Fnc_Create_Tool);
663 bool Destroy (void);
664
665 const CSG_String & Get_Info (int ID);
666
667 int Get_Count (void);
668 CSG_Tool * Get_Tool (int i);
669
670 CSG_Tool * Create_Tool (int i, bool bWithGUI = false, bool bWithCMD =true);
671 bool Delete_Tool (CSG_Tool *pTool);
672 bool Delete_Tools (void);
673
674
675private:
676
677 CSG_Strings m_Info;
678
679 CSG_Array_Pointer m_Tools, m_xTools;
680
681 TSG_PFNC_TLB_Create_Tool m_Fnc_Create_Tool;
682
683};
684
685//---------------------------------------------------------
686#define SYMBOL_TLB_Initialize "TLB_Initialize"
687typedef bool (* TSG_PFNC_TLB_Initialize) (const SG_Char *);
688
689#define SYMBOL_TLB_Finalize "TLB_Finalize"
690typedef bool (* TSG_PFNC_TLB_Finalize) (void);
691
692#define SYMBOL_TLB_Get_Interface "TLB_Get_Interface"
693typedef CSG_Tool_Library_Interface * (* TSG_PFNC_TLB_Get_Interface) (void);
694
695//---------------------------------------------------------
696#define TLB_INTERFACE_SKIP_TOOL ((CSG_Tool *)0x1)
697
698//---------------------------------------------------------
699#define TLB_INTERFACE_ESTABLISH CSG_Tool_Library_Interface TLB_Interface;\
700\
701extern "C" _SAGA_DLL_EXPORT CSG_Tool_Library_Interface * TLB_Get_Interface (void)\
702{\
703 return( &TLB_Interface );\
704}\
705
706//---------------------------------------------------------
707#define TLB_INTERFACE_INITIALIZE extern "C" _SAGA_DLL_EXPORT bool TLB_Initialize(const SG_Char *TLB_Path)\
708{\
709 return( TLB_Interface.Create(SAGA_VERSION, TLB_Path, Get_Info, Create_Tool) );\
710}\
711
712//---------------------------------------------------------
713#define TLB_INTERFACE_FINALIZE extern "C" _SAGA_DLL_EXPORT bool TLB_Finalize (void)\
714{\
715 return( true );\
716}\
717
718//---------------------------------------------------------
719#define TLB_INTERFACE TLB_INTERFACE_ESTABLISH TLB_INTERFACE_INITIALIZE TLB_INTERFACE_FINALIZE
720
721//---------------------------------------------------------
722#ifndef SWIG
723
725
726#endif // #ifdef SWIG
727
728
730// //
731// //
732// //
734
735//---------------------------------------------------------
736#endif // #ifndef HEADER_INCLUDED__SAGA_API__tool_H
bool SG_UI_Process_Get_Okay(bool bBlink)
signed long long sLong
Definition api_core.h:158
#define SG_T(s)
Definition api_core.h:537
@ SG_UI_DATAOBJECT_UPDATE
Definition api_core.h:1597
#define SAGA_API_DLL_EXPORT
Definition api_core.h:94
#define SG_Char
Definition api_core.h:536
@ SG_COLORS_DEFAULT
Definition api_core.h:1329
static int Get_yTo(int Direction, int y=0)
Definition grid.h:352
static int Get_yFrom(int Direction, int y=0)
Definition grid.h:367
static int Get_xTo(int Direction, int x=0)
Definition grid.h:338
static int Get_xFrom(int Direction, int x=0)
Definition grid.h:366
virtual bool needs_GUI(void) const
Definition tool.h:613
virtual bool is_Interactive(void) const
Definition tool.h:615
virtual TSG_Tool_Type Get_Type(void) const
Definition tool.h:611
double Get_Cellarea(void) const
Definition tool.h:430
void Lock_Set(int x, int y, char Value=1)
Definition tool.h:449
virtual TSG_Tool_Type Get_Type(void) const
Definition tool.h:408
double Get_Length(int i) const
Definition tool.h:432
bool is_InGrid(int x, int y) const
Definition tool.h:434
double Get_XMin(void) const
Definition tool.h:425
double Get_UnitLength(int i) const
Definition tool.h:433
bool is_InGrid(int x, int y, int Rand) const
Definition tool.h:435
static int Get_xTo(int i, int x=0)
Definition tool.h:437
static int Get_yFrom(int i, int y=0)
Definition tool.h:440
double Get_XMax(void) const
Definition tool.h:427
virtual bool is_Grid(void) const
Definition tool.h:413
const CSG_Grid_System & Get_System(void) const
Definition tool.h:410
static int Get_yTo(int i, int y=0)
Definition tool.h:438
static int Get_xFrom(int i, int x=0)
Definition tool.h:439
int Get_NX(void) const
Definition tool.h:422
CSG_Tool_Grid(void)
Definition tool_grid.cpp:63
double Get_YMin(void) const
Definition tool.h:426
char Lock_Get(int x, int y)
Definition tool.h:447
bool is_Locked(int x, int y)
Definition tool.h:446
double Get_Cellsize(void) const
Definition tool.h:429
int Get_NY(void) const
Definition tool.h:423
sLong Get_NCells(void) const
Definition tool.h:424
double Get_YMax(void) const
Definition tool.h:428
int Get_Drag_Mode(void) const
Definition tool.h:529
bool is_Ctrl(void) const
Definition tool.h:550
double Get_xPosition(void) const
Definition tool.h:541
bool is_Alt(void) const
Definition tool.h:549
bool Set_Projection(const CSG_Projection &Projection)
double Get_yPosition(void) const
Definition tool.h:542
double Get_xPosition_Last(void) const
Definition tool.h:545
bool is_Shift(void) const
Definition tool.h:548
friend class CSG_Tool_Grid_Interactive
Definition tool.h:517
const CSG_Projection & Get_Projection(void) const
Definition tool.h:534
const CSG_Point & Get_Position_Last(void) const
Definition tool.h:544
bool Execute_Keyboard(int Character, int Keys)
double Get_yPosition_Last(void) const
Definition tool.h:546
friend class CSG_Tool_Interactive
Definition tool.h:516
const CSG_Point & Get_Position(void) const
Definition tool.h:540
bool Execute_Position(CSG_Point ptWorld, TSG_Tool_Interactive_Mode Mode, int Keys)
virtual TSG_Tool_Type Get_Type(void) const
Definition tool.h:585
virtual bool needs_GUI(void) const
Definition tool.h:587
virtual bool is_Interactive(void) const
Definition tool.h:589
CSG_Tool * Create_Tool(int i, bool bWithGUI=false, bool bWithCMD=true)
const CSG_String & Get_Info(int ID)
bool Create(const CSG_String &Version, const CSG_String &TLB_Path, TSG_PFNC_TLB_Get_Info Fnc_Info, TSG_PFNC_TLB_Create_Tool Fnc_Create_Tool)
int Get_Parameters_Count(void) const
Definition tool.h:167
virtual bool On_After_Execution(void)
Definition tool.h:230
friend class CSG_Tool_Library_Interface
Definition tool.h:137
friend class CSG_Tool_Interactive_Base
Definition tool.h:136
friend class CSG_Tool_Library_Manager
Definition tool.h:138
const SG_Char * Get_Execution_Info(void) const
Definition tool.h:234
virtual bool is_Interactive(void) const
Definition tool.h:223
CSG_Parameters * Get_Parameters(void)
Definition tool.h:165
CSG_Parameter * Get_Parameter(const wchar_t *ID) const
Definition tool.h:174
virtual void Destroy(void)
Definition tool.cpp:102
virtual bool On_Execute(void)=0
friend class CSG_Tool_Chain
Definition tool.h:139
CSG_MetaData History_Supplement
Definition tool.h:258
CSG_Parameter * Get_Parameter(const CSG_String &ID) const
Definition tool.h:172
virtual bool On_Before_Execution(void)
Definition tool.h:229
static int _On_Parameter_Changed(CSG_Parameter *pParameter, int Flags)
Definition tool.cpp:452
virtual bool needs_GUI(void) const
Definition tool.h:218
CSG_Parameters Parameters
Definition tool.h:256
virtual TSG_Tool_Type Get_Type(void) const
Definition tool.h:148
virtual bool do_Sync_Projections(void) const
Definition tool.h:216
CSG_Tool(void)
Definition tool.cpp:67
virtual CSG_String Get_MenuPath(void)
Definition tool.h:162
void Set_Description(const CSG_String &String)
Definition tool.cpp:160
TSG_PFNC_Parameter_Changed Get_Parameter_Changed(void)
Definition tool.h:276
void Set_Author(const CSG_String &String)
Definition tool.cpp:138
virtual bool is_Grid(void) const
Definition tool.h:222
bool is_Progress(void) const
Definition tool.h:224
const CSG_String & Get_ID(void) const
Definition tool.h:150
Script_Format
Definition tool.h:242
virtual int On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
Definition tool.cpp:482
bool is_Executing(void) const
Definition tool.h:225
virtual int On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
Definition tool.cpp:476
void Add_Reference(const CSG_String &Authors, const CSG_String &Year, const CSG_String &Title, const CSG_String &Where, const SG_Char *Link=NULL, const SG_Char *Link_Text=NULL)
Definition tool.cpp:171
void Set_Version(const CSG_String &String)
Definition tool.cpp:149
const SG_Char * Get_Icon(void)
Definition tool.h:159
CSG_Parameters * Get_Parameters(int i) const
Definition tool.h:168
void Set_Name(const CSG_String &String)
Definition tool.cpp:127
CSG_Parameter * Get_Parameter(const char *ID) const
Definition tool.h:173
CSG_Parameters * Get_Parameters(int i)
Definition tool.h:169
int(* TSG_PFNC_Parameter_Changed)(CSG_Parameter *pParameter, int Flags)
@ PARAMETER_TYPE_Undefined
Definition parameters.h:166
TSG_Tool_Interactive_DragMode
Definition tool.h:493
@ TOOL_INTERACTIVE_DRAG_BOX
Definition tool.h:496
@ TOOL_INTERACTIVE_DRAG_LINE
Definition tool.h:495
@ TOOL_INTERACTIVE_DRAG_CIRCLE
Definition tool.h:497
@ TOOL_INTERACTIVE_DRAG_NONE
Definition tool.h:494
CSG_Tool *(* TSG_PFNC_TLB_Create_Tool)(int i)
Definition tool.h:652
CSG_Tool_Library_Interface TLB_Interface
TSG_Summary_Format
Definition tool.h:92
@ SG_SUMMARY_FMT_HTML
Definition tool.h:94
@ SG_SUMMARY_FMT_FLAT
Definition tool.h:93
@ SG_SUMMARY_FMT_XML
Definition tool.h:95
TSG_TLB_Info
Definition tool.h:636
@ TLB_INFO_Library
Definition tool.h:645
@ TLB_INFO_SAGA_Version
Definition tool.h:646
@ TLB_INFO_Menu_Path
Definition tool.h:641
@ TLB_INFO_Name
Definition tool.h:637
@ TLB_INFO_Version
Definition tool.h:640
@ TLB_INFO_Category
Definition tool.h:642
@ TLB_INFO_Description
Definition tool.h:638
@ TLB_INFO_User
Definition tool.h:643
@ TLB_INFO_File
Definition tool.h:644
@ TLB_INFO_Count
Definition tool.h:647
@ TLB_INFO_Author
Definition tool.h:639
#define TOOL_INTERACTIVE_KEY_SHIFT
Definition tool.h:505
TSG_Tool_Error
Definition tool.h:112
@ TOOL_ERROR_Calculation
Definition tool.h:114
@ TOOL_ERROR_Unknown
Definition tool.h:113
bool(* TSG_PFNC_TLB_Finalize)(void)
Definition tool.h:690
TSG_Tool_Type
Definition tool.h:101
@ TOOL_TYPE_Interactive
Definition tool.h:103
@ TOOL_TYPE_Grid
Definition tool.h:104
@ TOOL_TYPE_Base
Definition tool.h:102
@ TOOL_TYPE_Chain
Definition tool.h:106
@ TOOL_TYPE_Grid_Interactive
Definition tool.h:105
TSG_Tool_Interactive_Mode
Definition tool.h:473
@ TOOL_INTERACTIVE_RDOWN
Definition tool.h:481
@ TOOL_INTERACTIVE_LUP
Definition tool.h:476
@ TOOL_INTERACTIVE_MOVE_RDOWN
Definition tool.h:487
@ TOOL_INTERACTIVE_LDCLICK
Definition tool.h:477
@ TOOL_INTERACTIVE_LDOWN
Definition tool.h:475
@ TOOL_INTERACTIVE_MOVE_LDOWN
Definition tool.h:485
@ TOOL_INTERACTIVE_RUP
Definition tool.h:482
@ TOOL_INTERACTIVE_MUP
Definition tool.h:479
@ TOOL_INTERACTIVE_MOVE_MDOWN
Definition tool.h:486
@ TOOL_INTERACTIVE_UNDEFINED
Definition tool.h:474
@ TOOL_INTERACTIVE_MDOWN
Definition tool.h:478
@ TOOL_INTERACTIVE_RDCLICK
Definition tool.h:483
@ TOOL_INTERACTIVE_MOVE
Definition tool.h:484
@ TOOL_INTERACTIVE_MDCLICK
Definition tool.h:480
CSG_String(* TSG_PFNC_TLB_Get_Info)(int i)
Definition tool.h:653
bool(* TSG_PFNC_TLB_Initialize)(const SG_Char *)
Definition tool.h:687
#define TOOL_INTERACTIVE_KEY_ALT
Definition tool.h:506
#define TOOL_INTERACTIVE_KEY_CTRL
Definition tool.h:507