SAGA API Version 9.14
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_String & Get_Dynamic_Description (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 static bool Set_Description_Source (const CSG_String &Source = "");
163 static const CSG_String & Get_Description_Source (void);
164 CSG_String Get_Description_Editors (bool bHTML = true);
165 bool Load_Description (void);
166
167 virtual CSG_String Get_MenuPath (void) { return( "" ); }
168 virtual CSG_String Get_MenuPath (bool bSolved);
169
170 const CSG_Table & Get_References_Table (void) const { return( m_References ); }
171 CSG_Strings Get_References (bool bHTML = true) const;
172 bool Del_References (void);
173
174 CSG_Table Get_Parameters_Table (void) const;
175 CSG_Parameters * Get_Parameters (void) { return( &Parameters ); }
176
177 int Get_Parameters_Count (void) const { return( (int)m_pParameters.Get_Size() ); }
178 CSG_Parameters * Get_Parameters (int i) const { return( i >= 0 && i < Get_Parameters_Count() ? (CSG_Parameters *)m_pParameters[i] : NULL ); }
179 CSG_Parameters * Get_Parameters (int i) { return( i >= 0 && i < Get_Parameters_Count() ? (CSG_Parameters *)m_pParameters[i] : NULL ); }
180 CSG_Parameters * Get_Parameters (const CSG_String &Identifier) const;
181
182 CSG_Parameter * Get_Parameter (const CSG_String &ID) const;
183 CSG_Parameter * Get_Parameter (const char *ID) const;
184 CSG_Parameter * Get_Parameter (const wchar_t *ID) const;
185 bool Set_Parameter (const CSG_String &ID, CSG_Parameter *pValue);
186 bool Set_Parameter (const char *ID, CSG_Parameter *pValue);
187 bool Set_Parameter (const wchar_t *ID, CSG_Parameter *pValue);
188 bool Set_Parameter (const CSG_String &ID, int Value, int Type = PARAMETER_TYPE_Undefined);
189 bool Set_Parameter (const char *ID, int Value, int Type = PARAMETER_TYPE_Undefined);
190 bool Set_Parameter (const wchar_t *ID, int Value, int Type = PARAMETER_TYPE_Undefined);
191 bool Set_Parameter (const CSG_String &ID, double Value, int Type = PARAMETER_TYPE_Undefined);
192 bool Set_Parameter (const char *ID, double Value, int Type = PARAMETER_TYPE_Undefined);
193 bool Set_Parameter (const wchar_t *ID, double Value, int Type = PARAMETER_TYPE_Undefined);
194 bool Set_Parameter (const CSG_String &ID, void *Value, int Type = PARAMETER_TYPE_Undefined);
195 bool Set_Parameter (const char *ID, void *Value, int Type = PARAMETER_TYPE_Undefined);
196 bool Set_Parameter (const wchar_t *ID, void *Value, int Type = PARAMETER_TYPE_Undefined);
197 bool Set_Parameter (const CSG_String &ID, const CSG_String &Value, int Type = PARAMETER_TYPE_Undefined);
198 bool Set_Parameter (const char *ID, const CSG_String &Value, int Type = PARAMETER_TYPE_Undefined);
199 bool Set_Parameter (const wchar_t *ID, const CSG_String &Value, int Type = PARAMETER_TYPE_Undefined);
200 bool Set_Parameter (const CSG_String &ID, const char *Value, int Type = PARAMETER_TYPE_Undefined);
201 bool Set_Parameter (const char *ID, const char *Value, int Type = PARAMETER_TYPE_Undefined);
202 bool Set_Parameter (const wchar_t *ID, const char *Value, int Type = PARAMETER_TYPE_Undefined);
203 bool Set_Parameter (const CSG_String &ID, const wchar_t *Value, int Type = PARAMETER_TYPE_Undefined);
204 bool Set_Parameter (const char *ID, const wchar_t *Value, int Type = PARAMETER_TYPE_Undefined);
205 bool Set_Parameter (const wchar_t *ID, const wchar_t *Value, int Type = PARAMETER_TYPE_Undefined);
206 bool Set_Parameter (const CSG_String &ID, const CSG_Grid_System &System);
207 bool Set_Parameter (const char *ID, const CSG_Grid_System &System);
208 bool Set_Parameter (const wchar_t *ID, const CSG_Grid_System &System);
209
210 bool Reset (bool bManager = true);
211 bool Reset_Manager (void);
212 bool Reset_Grid_System (void);
213
214 bool Update_Parameter_States (void);
215
216 void Set_Callback (bool bActive = true);
217
218 bool Set_Manager (class CSG_Data_Manager *pManager);
219 class CSG_Data_Manager * Get_Manager (void) const;
220 class CSG_Data_Manager * Create_Manager (void);
221 bool Delete_Manager (bool bDetachData = false, bool bReset = true);
222
223 bool Set_Grid_System (const CSG_Grid_System &System);
224 CSG_Grid_System * Get_Grid_System (void) const;
225
226 bool Settings_Push (class CSG_Data_Manager *pManager = NULL);
227 bool Settings_Pop (void);
228
229 virtual bool do_Sync_Projections (void) const { return( true ); }
230
231 virtual bool needs_GUI (void) const { return( false ); }
232 bool has_GUI (void) const;
233 bool has_CMD (void) const;
234
235 virtual bool is_Grid (void) const { return( false ); }
236 virtual bool is_Interactive (void) const { return( false ); }
237 bool is_Progress (void) const { return( SG_UI_Process_Get_Okay(false) ); }
238 bool is_Executing (void) const { return( m_bExecutes ); }
239
240 void Set_Show_Progress (bool bOn = true);
241
242 virtual bool On_Before_Execution (void) { return( true ); }
243 virtual bool On_After_Execution (void) { return( true ); }
244
245 bool Execute (bool bAddHistory = false);
246
247 const SG_Char * Get_Execution_Info (void) const { return( m_Execution_Info ); }
248
249 CSG_MetaData Get_History (int Depth = -1);
250 bool Set_History (CSG_Data_Object *pDataObject, int Depth = -1);
251
252
253 //-----------------------------------------------------
263
264 CSG_String Get_Script (Script_Format Format, bool bHeader = true, int Arguments = 0, bool bWrapArgs = true);
265
266
267protected:
268
270
272
273
274 //-----------------------------------------------------
275 void Set_Name (const CSG_String &String);
276 void Set_Author (const CSG_String &String);
277 void Set_Version (const CSG_String &String);
278 void Set_Description (const CSG_String &String);
279 void Add_Description (const CSG_String &String, bool bNewLine = true);
280 void Set_Dynamic_Description (const CSG_String &String);
281 void Add_Dynamic_Description (const CSG_String &String, bool bNewLine = true);
282
283 void Add_Reference (const CSG_String &Authors, const CSG_String &Date, const CSG_String &Title, const CSG_String &Source, const CSG_String &Link = "", const CSG_String &Link_Text = "");
284 void Add_Reference ( const CSG_String &Link , const CSG_String &Link_Text = "");
285
286 //-----------------------------------------------------
287 virtual bool On_Execute (void) = 0;
288
289 virtual int On_Parameter_Changed (CSG_Parameters *pParameters, CSG_Parameter *pParameter);
290 virtual int On_Parameters_Enable (CSG_Parameters *pParameters, CSG_Parameter *pParameter);
291
293
294 //-----------------------------------------------------
295 CSG_Parameters * Add_Parameters (const CSG_String &Identifier, const CSG_String &Name, const CSG_String &Description);
296 bool Dlg_Parameters (const CSG_String &Identifier); // deprecated
297
298 bool Dlg_Parameters (CSG_Parameters *pParameters, const CSG_String &Caption = "");
299 bool Dlg_Parameters (CSG_Parameters &Parameters, const CSG_String &Caption = "");
300
301 //-----------------------------------------------------
302 virtual bool Set_Progress (int Position, int Range ) const;
303 virtual bool Set_Progress (sLong Position, sLong Range ) const;
304 virtual bool Set_Progress (double Position, double Range = 1.) const;
305
306 bool Stop_Execution (bool bDialog = true);
307
308 void Message_Dlg (const CSG_String &Text, const SG_Char *Caption = NULL);
309 bool Message_Dlg_Confirm (const CSG_String &Text, const SG_Char *Caption = NULL);
310
311 void Message_Add (const CSG_String &Text, bool bNewLine = true);
312 void Message_Fmt (const char *Format, ...);
313 void Message_Fmt (const wchar_t *Format, ...);
314
315 bool Error_Set (TSG_Tool_Error Error_ID = TOOL_ERROR_Unknown);
316 bool Error_Set (const CSG_String &Text);
317 bool Error_Fmt (const char *Format, ...);
318 bool Error_Fmt (const wchar_t *Format, ...);
319
320 //-----------------------------------------------------
321 bool DataObject_Add (CSG_Data_Object *pDataObject, bool bShow = false);
322
323 bool DataObject_Update_All (void);
324
325 bool DataObject_Set_History (CSG_Parameter *pParameter, CSG_MetaData *pHistory = NULL);
326
327 bool Get_Projection (CSG_Projection &Projection) const;
328
329
330protected: // static functions...
331
332 static int _On_Parameter_Changed (CSG_Parameter *pParameter, int Flags);
333
334 static bool Process_Get_Okay (bool bBlink = false);
335 static void Process_Set_Text (const CSG_String &Text);
336 static void Process_Set_Text (const char *Format, ...);
337 static void Process_Set_Text (const wchar_t *Format, ...);
338
339 static bool DataObject_Update (CSG_Data_Object *pDataObject , int Show = SG_UI_DATAOBJECT_UPDATE);
340 static bool DataObject_Update (CSG_Data_Object *pDataObject, double Minimum, double Maximum, int Show = SG_UI_DATAOBJECT_UPDATE);
341
342 static bool DataObject_Get_Colors (CSG_Data_Object *pDataObject, CSG_Colors &Colors);
343 static bool DataObject_Set_Colors (CSG_Data_Object *pDataObject, const CSG_Colors &Colors);
344 static bool DataObject_Set_Colors (CSG_Data_Object *pDataObject, int nColors = 0, int Colors = SG_COLORS_DEFAULT, bool bRevert = false);
345 static bool DataObject_Set_Colors (CSG_Data_Object *pDataObject, const CSG_String &Colors, int nColors = 0, bool bRevert = false);
346
347 static CSG_Table * DataObject_Get_Classification (CSG_Data_Object *pDataObject);
348 static bool DataObject_Get_Classification (CSG_Data_Object *pDataObject, CSG_Table &LUT);
349 static bool DataObject_Set_Classification (CSG_Data_Object *pDataObject, const CSG_Table &LUT, int Field = -1, bool bSetClassify = true);
350 static bool DataObject_Set_Classification (CSG_Data_Object *pDataObject, CSG_Table *pLUT, int Field = -1, bool bSetClassify = true);
351
353 static ESymbology DataObject_Get_Symbology (CSG_Data_Object *pDataObject);
354 static bool DataObject_Set_Symbology (CSG_Data_Object *pDataObject, ESymbology Symbology);
355
356 static bool DataObject_Get_Parameters (CSG_Data_Object *pDataObject, CSG_Parameters &Parameters);
357 static bool DataObject_Set_Parameters (CSG_Data_Object *pDataObject, CSG_Parameters &Parameters);
358 static bool DataObject_Set_Parameters (CSG_Data_Object *pDataObject, CSG_Data_Object *pCopy);
359
360 static CSG_Parameter * DataObject_Get_Parameter (CSG_Data_Object *pDataObject, const CSG_String &ID);
361 static bool DataObject_Set_Parameter (CSG_Data_Object *pDataObject, CSG_Parameter *pParameter);
362 static bool DataObject_Set_Parameter (CSG_Data_Object *pDataObject, CSG_Data_Object *pCopy, const CSG_String &ID);
363 static bool DataObject_Set_Parameter (CSG_Data_Object *pDataObject, const CSG_String &ID, int Value);
364 static bool DataObject_Set_Parameter (CSG_Data_Object *pDataObject, const CSG_String &ID, double Value);
365 static bool DataObject_Set_Parameter (CSG_Data_Object *pDataObject, const CSG_String &ID, void *Value);
366 static bool DataObject_Set_Parameter (CSG_Data_Object *pDataObject, const CSG_String &ID, const SG_Char *Value);
367 static bool DataObject_Set_Parameter (CSG_Data_Object *pDataObject, const CSG_String &ID, double loVal, double hiVal); // Range Parameter
368
369 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);
370 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);
371 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);
372 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);
373
374 static bool DataObject_Classify_Unique (CSG_Data_Object *pDataObject, int Field = -1, int Classes_Max = 1024 , int Colors = -1);
375 static bool DataObject_Classify_Equal (CSG_Data_Object *pDataObject, int Field = -1, int Classes = 10 , int Colors = -1);
376 static bool DataObject_Classify_Defined (CSG_Data_Object *pDataObject, int Field , double Interval, bool bOffset = false, double Offset = 0., int Colors = -1);
377 static bool DataObject_Classify_Quantile (CSG_Data_Object *pDataObject, int Field = -1, int Classes = 10, bool bHistogram = true , int Colors = -1);
378 static bool DataObject_Classify_Geometric (CSG_Data_Object *pDataObject, int Field = -1, int Classes = 10, bool bIncreasing = true , int Colors = -1);
379 static bool DataObject_Classify_Natural (CSG_Data_Object *pDataObject, int Field = -1, int Classes = 10 , int Colors = -1);
380 static bool DataObject_Classify_StdDev (CSG_Data_Object *pDataObject, int Field = -1, double StdDev = 0.5, double StdDev_Max = 4.5 , int Colors = -1);
381
382
383private:
384
385 static CSG_String m_Description_Source;
386
387 bool m_bExecutes, m_bError_Ignore, m_bShow_Progress, m_bGUI, m_bCMD;
388
389 CSG_Array_Pointer m_pParameters;
390
391 CSG_String m_ID, m_Library, m_Library_Menu, m_File_Name, m_Author, m_Version, m_Execution_Info, m_Dynamic_Description;
392
393 CSG_Table m_References, m_Editors;
394
395
396 bool _Synchronize_DataObjects (void);
397
398 bool _Add_Parameters (CSG_Table &Table, const CSG_Parameters *pParameters, const CSG_String &IDprefix = "") const;
399
400 CSG_String _Get_Script_CMD (bool bHeader , bool bAllArguments, bool bWrapArgs, bool bBatch);
401 void _Get_Script_CMD (CSG_String &Script, CSG_Parameters *pParameters, bool bAllArguments, bool bWrapArgs, bool bBatch);
402
403 CSG_String _Get_Script_CMD_Usage (void);
404 void _Get_Script_CMD_Usage (CSG_Parameters *pParameters, class wxCmdLineParser &Parser);
405
406 CSG_String _Get_Script_Python (bool bHeader, bool bAllArguments);
407 void _Get_Script_Python (CSG_String &Script, CSG_Parameters *pParameters, bool bAllArguments, const CSG_String &Prefix = "");
408
409 CSG_String _Get_Script_Python_Wrap (bool bHeader, bool bName, bool bCall, int AllArguments, bool bWrapArgs);
410 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 = "");
411
412 CSG_String _Get_Script_Markdown (bool bHeader, int iArguments);
413 void _Get_Script_Markdown (CSG_String &Description, CSG_Parameters *pParameters, int iArguments, const CSG_String &Prefix = "");
414 void _Format_Markdown (CSG_Parameter *p, CSG_String &Script, CSG_MetaData &Properties, int iArguments, CSG_String Prefix);
415
416 void _Set_Output_History (void);
417
418 void _Update_Parameter_States (CSG_Parameters *pParameters);
419
420};
421
422
424// //
425// CSG_Tool_Grid //
426// //
428
429//---------------------------------------------------------
433//---------------------------------------------------------
435{
436public:
437 CSG_Tool_Grid(void);
438 virtual ~CSG_Tool_Grid(void);
439
440 virtual TSG_Tool_Type Get_Type (void) const { return( TOOL_TYPE_Grid ); }
441
442 const CSG_Grid_System & Get_System (void) const { return( *Parameters.Get_Grid_System() ); }
443 bool Set_System (const CSG_Grid_System &System);
444
445 virtual bool is_Grid (void) const { return( true ); }
446
447
448protected:
449
450 virtual bool Set_Progress_Cells (sLong Cell) const;
451 virtual bool Set_Progress_Rows (int Row) const;
452
453 //-----------------------------------------------------
454 int Get_NX (void) const { return( Get_System().Get_NX () ); }
455 int Get_NY (void) const { return( Get_System().Get_NY () ); }
456 sLong Get_NCells (void) const { return( Get_System().Get_NCells () ); }
457 double Get_XMin (void) const { return( Get_System().Get_XMin () ); }
458 double Get_YMin (void) const { return( Get_System().Get_YMin () ); }
459 double Get_XMax (void) const { return( Get_System().Get_XMax () ); }
460 double Get_YMax (void) const { return( Get_System().Get_YMax () ); }
461 double Get_Cellsize (void) const { return( Get_System().Get_Cellsize() ); }
462 double Get_Cellarea (void) const { return( Get_System().Get_Cellarea() ); }
463
464 double Get_Length (int i) const { return( Get_System().Get_Length (i) ); }
465 double Get_UnitLength (int i) const { return( Get_System().Get_UnitLength(i) ); }
466 bool is_InGrid (int x, int y) const { return( Get_System().is_InGrid(x, y) ); }
467 bool is_InGrid (int x, int y, int Rand) const { return( Get_System().is_InGrid(x, y, Rand) ); }
468
469 static int Get_xTo (int i, int x = 0) { return( CSG_Grid_System::Get_xTo (i, x) ); }
470 static int Get_yTo (int i, int y = 0) { return( CSG_Grid_System::Get_yTo (i, y) ); }
471 static int Get_xFrom (int i, int x = 0) { return( CSG_Grid_System::Get_xFrom(i, x) ); }
472 static int Get_yFrom (int i, int y = 0) { return( CSG_Grid_System::Get_yFrom(i, y) ); }
473
474 //-----------------------------------------------------
475 void Lock_Create (void);
476 void Lock_Destroy (void);
477
478 bool is_Locked (int x, int y) { return( Lock_Get(x, y) != 0 ); }
479 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 ); }
480
481 void Lock_Set (int x, int y, char Value = 1)
482 {
483 if( m_pLock && x >= 0 && x < Get_NX() && y >= 0 && y < Get_NY() )
484 {
485 m_pLock->Set_Value(x, y, Value);
486 }
487 }
488
489
490private:
491
492 CSG_Grid *m_pLock;
493
494};
495
496
498// //
499// CSG_Tool_Interactive_Base //
500// //
502
503//---------------------------------------------------------
522
523//---------------------------------------------------------
532
533//---------------------------------------------------------
534#define TOOL_INTERACTIVE_KEY_LEFT 0x01
535#define TOOL_INTERACTIVE_KEY_MIDDLE 0x02
536#define TOOL_INTERACTIVE_KEY_RIGHT 0x04
537#define TOOL_INTERACTIVE_KEY_SHIFT 0x08
538#define TOOL_INTERACTIVE_KEY_ALT 0x10
539#define TOOL_INTERACTIVE_KEY_CTRL 0x20
540
541//---------------------------------------------------------
545//---------------------------------------------------------
547{
550
551public:
553 virtual ~CSG_Tool_Interactive_Base(void);
554
556
557 bool Execute_Position (CSG_Point ptWorld, TSG_Tool_Interactive_Mode Mode, int Keys);
558 bool Execute_Keyboard (int Character, int Keys);
559 bool Execute_Finish (void);
560
561 int Get_Drag_Mode (void) const { return( m_Drag_Mode ); }
562
563
564protected:
565
566 const CSG_Projection & Get_Projection (void) const { return( m_Projection ); }
567
568 virtual bool On_Execute_Position (CSG_Point ptWorld, TSG_Tool_Interactive_Mode Mode);
569 virtual bool On_Execute_Keyboard (int Character);
570 virtual bool On_Execute_Finish (void);
571
572 const CSG_Point & Get_Position (void) const { return( m_Point ); }
573 double Get_xPosition (void) const { return( m_Point .x ); }
574 double Get_yPosition (void) const { return( m_Point .y ); }
575
576 const CSG_Point & Get_Position_Last (void) const { return( m_Point_Last ); }
577 double Get_xPosition_Last (void) const { return( m_Point_Last.x ); }
578 double Get_yPosition_Last (void) const { return( m_Point_Last.y ); }
579
580 bool is_Shift (void) const { return( (m_Keys & TOOL_INTERACTIVE_KEY_SHIFT) != 0 ); }
581 bool is_Alt (void) const { return( (m_Keys & TOOL_INTERACTIVE_KEY_ALT ) != 0 ); }
582 bool is_Ctrl (void) const { return( (m_Keys & TOOL_INTERACTIVE_KEY_CTRL ) != 0 ); }
583
584 void Set_Drag_Mode (int Drag_Mode);
585
586
587private:
588
589 int m_Keys, m_Drag_Mode;
590
591 CSG_Point m_Point, m_Point_Last;
592
593 CSG_Projection m_Projection;
594
595 CSG_Tool *m_pTool;
596
597};
598
599
601// //
602// CSG_Tool_Interactive //
603// //
605
606//---------------------------------------------------------
610//---------------------------------------------------------
612{
613public:
615 virtual ~CSG_Tool_Interactive(void);
616
617 virtual TSG_Tool_Type Get_Type (void) const { return( TOOL_TYPE_Interactive ); }
618
619 virtual bool needs_GUI (void) const { return( true ); }
620
621 virtual bool is_Interactive (void) const { return( true ); }
622
623};
624
625
627// //
628// CSG_Tool_Grid_Interactive //
629// //
631
632//---------------------------------------------------------
636//---------------------------------------------------------
638{
639public:
641 virtual ~CSG_Tool_Grid_Interactive(void);
642
643 virtual TSG_Tool_Type Get_Type (void) const { return( TOOL_TYPE_Grid_Interactive ); }
644
645 virtual bool needs_GUI (void) const { return( true ); }
646
647 virtual bool is_Interactive (void) const { return( true ); }
648
649
650protected:
651
652 bool Get_Grid_Pos (int &x, int &y) const;
653
654 int Get_xGrid (void) const;
655 int Get_yGrid (void) const;
656
657};
658
659
661// //
662// Tool Library Interface Definitions //
663// //
665
666//---------------------------------------------------------
682
683//---------------------------------------------------------
684typedef CSG_Tool * (* TSG_PFNC_TLB_Create_Tool) (int i);
686
687//---------------------------------------------------------
689{
690public:
692 virtual ~CSG_Tool_Library_Interface(void);
693
694 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);
695 bool Destroy (void);
696
697 const CSG_String & Get_Info (int ID);
698
699 int Get_Count (void);
700 CSG_Tool * Get_Tool (int i);
701
702 CSG_Tool * Create_Tool (int i, bool bWithGUI = false, bool bWithCMD =true);
703 bool Delete_Tool (CSG_Tool *pTool);
704 bool Delete_Tools (void);
705
706
707private:
708
709 CSG_Strings m_Info;
710
711 CSG_Array_Pointer m_Tools, m_xTools;
712
713 TSG_PFNC_TLB_Create_Tool m_Fnc_Create_Tool;
714
715};
716
717//---------------------------------------------------------
718#define SYMBOL_TLB_Initialize "TLB_Initialize"
719typedef bool (* TSG_PFNC_TLB_Initialize) (const SG_Char *);
720
721#define SYMBOL_TLB_Finalize "TLB_Finalize"
722typedef bool (* TSG_PFNC_TLB_Finalize) (void);
723
724#define SYMBOL_TLB_Get_Interface "TLB_Get_Interface"
725typedef CSG_Tool_Library_Interface * (* TSG_PFNC_TLB_Get_Interface) (void);
726
727//---------------------------------------------------------
728#define TLB_INTERFACE_SKIP_TOOL ((CSG_Tool *)0x1)
729
730//---------------------------------------------------------
731#define TLB_INTERFACE_ESTABLISH CSG_Tool_Library_Interface TLB_Interface;\
732\
733extern "C" _SAGA_DLL_EXPORT CSG_Tool_Library_Interface * TLB_Get_Interface (void)\
734{\
735 return( &TLB_Interface );\
736}\
737
738//---------------------------------------------------------
739#define TLB_INTERFACE_INITIALIZE extern "C" _SAGA_DLL_EXPORT bool TLB_Initialize(const SG_Char *TLB_Path)\
740{\
741 return( TLB_Interface.Create(SAGA_VERSION, TLB_Path, Get_Info, Create_Tool) );\
742}\
743
744//---------------------------------------------------------
745#define TLB_INTERFACE_FINALIZE extern "C" _SAGA_DLL_EXPORT bool TLB_Finalize (void)\
746{\
747 return( true );\
748}\
749
750//---------------------------------------------------------
751#define TLB_INTERFACE TLB_INTERFACE_ESTABLISH TLB_INTERFACE_INITIALIZE TLB_INTERFACE_FINALIZE
752
753//---------------------------------------------------------
754#ifndef SWIG
755
757
758#endif // #ifdef SWIG
759
760
762// //
763// //
764// //
766
767//---------------------------------------------------------
768#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
@ SG_UI_DATAOBJECT_UPDATE
Definition api_core.h:1648
#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:1377
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:645
virtual bool is_Interactive(void) const
Definition tool.h:647
virtual TSG_Tool_Type Get_Type(void) const
Definition tool.h:643
double Get_Cellarea(void) const
Definition tool.h:462
void Lock_Set(int x, int y, char Value=1)
Definition tool.h:481
virtual TSG_Tool_Type Get_Type(void) const
Definition tool.h:440
double Get_Length(int i) const
Definition tool.h:464
bool is_InGrid(int x, int y) const
Definition tool.h:466
double Get_XMin(void) const
Definition tool.h:457
double Get_UnitLength(int i) const
Definition tool.h:465
bool is_InGrid(int x, int y, int Rand) const
Definition tool.h:467
static int Get_xTo(int i, int x=0)
Definition tool.h:469
static int Get_yFrom(int i, int y=0)
Definition tool.h:472
double Get_XMax(void) const
Definition tool.h:459
virtual bool is_Grid(void) const
Definition tool.h:445
const CSG_Grid_System & Get_System(void) const
Definition tool.h:442
static int Get_yTo(int i, int y=0)
Definition tool.h:470
static int Get_xFrom(int i, int x=0)
Definition tool.h:471
int Get_NX(void) const
Definition tool.h:454
CSG_Tool_Grid(void)
Definition tool_grid.cpp:63
double Get_YMin(void) const
Definition tool.h:458
char Lock_Get(int x, int y)
Definition tool.h:479
bool is_Locked(int x, int y)
Definition tool.h:478
double Get_Cellsize(void) const
Definition tool.h:461
int Get_NY(void) const
Definition tool.h:455
sLong Get_NCells(void) const
Definition tool.h:456
double Get_YMax(void) const
Definition tool.h:460
int Get_Drag_Mode(void) const
Definition tool.h:561
bool is_Ctrl(void) const
Definition tool.h:582
double Get_xPosition(void) const
Definition tool.h:573
bool is_Alt(void) const
Definition tool.h:581
bool Set_Projection(const CSG_Projection &Projection)
double Get_yPosition(void) const
Definition tool.h:574
double Get_xPosition_Last(void) const
Definition tool.h:577
bool is_Shift(void) const
Definition tool.h:580
friend class CSG_Tool_Grid_Interactive
Definition tool.h:549
const CSG_Projection & Get_Projection(void) const
Definition tool.h:566
const CSG_Point & Get_Position_Last(void) const
Definition tool.h:576
bool Execute_Keyboard(int Character, int Keys)
double Get_yPosition_Last(void) const
Definition tool.h:578
friend class CSG_Tool_Interactive
Definition tool.h:548
const CSG_Point & Get_Position(void) const
Definition tool.h:572
bool Execute_Position(CSG_Point ptWorld, TSG_Tool_Interactive_Mode Mode, int Keys)
virtual TSG_Tool_Type Get_Type(void) const
Definition tool.h:617
virtual bool needs_GUI(void) const
Definition tool.h:619
virtual bool is_Interactive(void) const
Definition tool.h:621
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:177
virtual bool On_After_Execution(void)
Definition tool.h:243
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 CSG_Table & Get_References_Table(void) const
Definition tool.h:170
const SG_Char * Get_Execution_Info(void) const
Definition tool.h:247
virtual bool is_Interactive(void) const
Definition tool.h:236
CSG_Parameters * Get_Parameters(void)
Definition tool.h:175
void Add_Reference(const CSG_String &Authors, const CSG_String &Date, const CSG_String &Title, const CSG_String &Source, const CSG_String &Link="", const CSG_String &Link_Text="")
Definition tool.cpp:294
virtual void Destroy(void)
Definition tool.cpp:114
virtual bool On_Execute(void)=0
friend class CSG_Tool_Chain
Definition tool.h:139
CSG_MetaData History_Supplement
Definition tool.h:271
virtual bool On_Before_Execution(void)
Definition tool.h:242
static int _On_Parameter_Changed(CSG_Parameter *pParameter, int Flags)
Definition tool.cpp:756
void Add_Description(const CSG_String &String, bool bNewLine=true)
Definition tool.cpp:179
virtual bool needs_GUI(void) const
Definition tool.h:231
CSG_Parameters Parameters
Definition tool.h:269
virtual TSG_Tool_Type Get_Type(void) const
Definition tool.h:148
virtual bool do_Sync_Projections(void) const
Definition tool.h:229
void Add_Dynamic_Description(const CSG_String &String, bool bNewLine=true)
Definition tool.cpp:199
CSG_Tool(void)
Definition tool.cpp:67
virtual CSG_String Get_MenuPath(void)
Definition tool.h:167
void Set_Description(const CSG_String &String)
Definition tool.cpp:174
TSG_PFNC_Parameter_Changed Get_Parameter_Changed(void)
Definition tool.h:292
void Set_Author(const CSG_String &String)
Definition tool.cpp:152
virtual bool is_Grid(void) const
Definition tool.h:235
bool is_Progress(void) const
Definition tool.h:237
const CSG_String & Get_ID(void) const
Definition tool.h:150
Script_Format
Definition tool.h:255
virtual int On_Parameters_Enable(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
Definition tool.cpp:786
bool is_Executing(void) const
Definition tool.h:238
virtual int On_Parameter_Changed(CSG_Parameters *pParameters, CSG_Parameter *pParameter)
Definition tool.cpp:780
void Set_Dynamic_Description(const CSG_String &String)
Definition tool.cpp:194
void Set_Version(const CSG_String &String)
Definition tool.cpp:163
const SG_Char * Get_Icon(void)
Definition tool.h:159
ESymbology
Definition tool.h:352
CSG_Parameters * Get_Parameters(int i) const
Definition tool.h:178
void Set_Name(const CSG_String &String)
Definition tool.cpp:141
CSG_Parameters * Get_Parameters(int i)
Definition tool.h:179
int(* TSG_PFNC_Parameter_Changed)(CSG_Parameter *pParameter, int Flags)
@ PARAMETER_TYPE_Undefined
Definition parameters.h:166
TSG_Tool_Interactive_DragMode
Definition tool.h:525
@ TOOL_INTERACTIVE_DRAG_BOX
Definition tool.h:528
@ TOOL_INTERACTIVE_DRAG_LINE
Definition tool.h:527
@ TOOL_INTERACTIVE_DRAG_CIRCLE
Definition tool.h:529
@ TOOL_INTERACTIVE_DRAG_NONE
Definition tool.h:526
CSG_Tool *(* TSG_PFNC_TLB_Create_Tool)(int i)
Definition tool.h:684
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:668
@ TLB_INFO_Library
Definition tool.h:677
@ TLB_INFO_SAGA_Version
Definition tool.h:678
@ TLB_INFO_Menu_Path
Definition tool.h:673
@ TLB_INFO_Name
Definition tool.h:669
@ TLB_INFO_Version
Definition tool.h:672
@ TLB_INFO_Category
Definition tool.h:674
@ TLB_INFO_Description
Definition tool.h:670
@ TLB_INFO_User
Definition tool.h:675
@ TLB_INFO_File
Definition tool.h:676
@ TLB_INFO_Count
Definition tool.h:679
@ TLB_INFO_Author
Definition tool.h:671
#define TOOL_INTERACTIVE_KEY_SHIFT
Definition tool.h:537
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:722
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:505
@ TOOL_INTERACTIVE_RDOWN
Definition tool.h:513
@ TOOL_INTERACTIVE_LUP
Definition tool.h:508
@ TOOL_INTERACTIVE_MOVE_RDOWN
Definition tool.h:519
@ TOOL_INTERACTIVE_LDCLICK
Definition tool.h:509
@ TOOL_INTERACTIVE_LDOWN
Definition tool.h:507
@ TOOL_INTERACTIVE_MOVE_LDOWN
Definition tool.h:517
@ TOOL_INTERACTIVE_RUP
Definition tool.h:514
@ TOOL_INTERACTIVE_MUP
Definition tool.h:511
@ TOOL_INTERACTIVE_MOVE_MDOWN
Definition tool.h:518
@ TOOL_INTERACTIVE_UNDEFINED
Definition tool.h:506
@ TOOL_INTERACTIVE_MDOWN
Definition tool.h:510
@ TOOL_INTERACTIVE_RDCLICK
Definition tool.h:515
@ TOOL_INTERACTIVE_MOVE
Definition tool.h:516
@ TOOL_INTERACTIVE_MDCLICK
Definition tool.h:512
CSG_String(* TSG_PFNC_TLB_Get_Info)(int i)
Definition tool.h:685
bool(* TSG_PFNC_TLB_Initialize)(const SG_Char *)
Definition tool.h:719
#define TOOL_INTERACTIVE_KEY_ALT
Definition tool.h:538
#define TOOL_INTERACTIVE_KEY_CTRL
Definition tool.h:539