Version: 0.6.0
gptoolmngr.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Toolbox)
3  * Purpose: tools manager.
4  * Author: Baryshnikov Dmitriy (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2010-2011 Bishop
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  ****************************************************************************/
21 
22 #pragma once
23 
24 #include "wxgis/geoprocessing/geoprocessing.h"
25 #include "wxgis/core/process.h"
26 
27 class WXDLLIMPEXP_GIS_GP wxGISGPToolManager;
28 
32 class wxGPProcess :
33  public wxGISProcess
34 {
35 public:
36  wxGPProcess(wxString sCommand, wxArrayString saParams, IProcessParent* pParent, ITrackCancel* pTrackCancel);
37  virtual ~wxGPProcess(void);
38  //virtual void OnTerminate(int status);
39  virtual void ProcessInput(wxString sInputData);
40 protected:
41  ITrackCancel* m_pTrackCancel;
42  IProgressor* m_pProgressor;
43 };
44 
45 typedef struct _wxgisexecddata
46 {
47  IProcess* pProcess;
48  IGPToolSPtr pTool;
49  ITrackCancel* pTrackCancel;
51 
57 class WXDLLIMPEXP_GIS_GP wxGISGPToolManager :
58  public IProcessParent,
60 {
61 public:
62  wxGISGPToolManager(void);
63  virtual ~wxGISGPToolManager(void);
64  virtual bool IsOk(void){return m_bIsOk;};
65  virtual IGPToolSPtr GetTool(wxString sToolName, IGxCatalog* pCatalog = NULL);
66  virtual int Execute(IGPToolSPtr pTool, ITrackCancel* pTrackCancel = NULL);
67  virtual size_t GetToolCount();
68  virtual wxString GetPopularTool(size_t nIndex);
69  virtual void StartProcess(size_t nIndex);
70  virtual void CancelProcess(size_t nIndex);
71  //virtual WXGISEXECDDATA GetTask(size_t nIndex);
72  virtual wxGISEnumTaskStateType GetProcessState(size_t nIndex);
73  virtual wxDateTime GetProcessStart(size_t nIndex);
74  virtual wxDateTime GetProcessFinish(size_t nIndex);
75  virtual int GetProcessPriority(size_t nIndex);
76  virtual void SetProcessPriority(size_t nIndex, int nPriority);
77  virtual IGPToolSPtr GetProcessTool(size_t nIndex);
78  //IProcessParent
79  virtual void OnFinish(IProcess* pProcess, bool bHasErrors);
80 protected:
81  virtual int GetPriorityTaskIndex();
82  virtual bool ExecTask(WXGISEXECDDATA &data, size_t nIndex );
83  virtual void AddPriority(int nIndex, int nPriority);
84  virtual void RunNextTask(void);
85 public:
86  typedef struct _toolinfo
87  {
88  wxString sClassName;
89  int nCount;
90  IGPToolSPtr pTool;
91  } TOOLINFO;
92 
93  typedef struct _taskprioinfo
94  {
95  int nIndex;
96  int nPriority;
97  } TASKPRIOINFO;
98 
99 protected:
100  std::multimap<int, wxString> m_ToolsPopularMap;
101  std::map<wxString, TOOLINFO> m_ToolsMap;
102  std::vector<WXGISEXECDDATA> m_ProcessArray;
103  std::vector<TASKPRIOINFO> m_aPriorityArray;
104  short m_nMaxTasks, m_nRunningTasks;
105  wxString m_sGeoprocessPath;
106  bool m_bIsOk;
107 };
108 
A Geoprocess class.
Definition: gptoolmngr.h:32
Definition: gptoolmngr.h:45
A Geoprocessing tools manager.
Definition: gptoolmngr.h:57
The process class which stores the application execution data.
Definition: process.h:43
wxGPProcess(wxString sCommand, wxArrayString saParams, IProcessParent *pParent, ITrackCancel *pTrackCancel)
Class wxGPProcess.
Definition: gptoolmngr.cpp:33
Definition: pointer.h:34
A TrackCancel interface class.
Definition: core.h:144
Definition: gptoolmngr.h:86
Definition: core.h:86
Definition: gptoolmngr.h:93