Version: 0.6.0
gptoolbox.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Toolbox)
3  * Purpose: toolbox classes.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2009-2011 Dmitry Baryshnikov
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 #pragma once
22 /*
23 #include "wxgis/catalogui/catalogui.h"
24 #include "wxgis/geoprocessingui/geoprocessingui.h"
25 #include "wxgis/geoprocessing/gptoolmngr.h"
26 #include "wxgis/core/config.h"
27 
28 class WXDLLIMPEXP_GIS_GPU wxGxRootToolbox;
30 // wxGxToolbox
32 
33 class WXDLLIMPEXP_GIS_GPU wxGxToolbox :
34  public IGxObjectUI,
35  public IGxObjectContainer
36 {
37 public:
38  wxGxToolbox(void);
39  wxGxToolbox(wxGxRootToolbox* pRootToolbox, wxXmlNode* pDataNode = NULL, wxIcon LargeToolboxIcon = wxNullIcon, wxIcon SmallToolboxIcon = wxNullIcon, wxIcon LargeToolIcon = wxNullIcon, wxIcon SmallToolIcon = wxNullIcon);
40  virtual ~wxGxToolbox(void);
41  //IGxObject
42  virtual wxString GetName(void);
43  virtual wxString GetBaseName(void){return GetName();};
44  virtual CPLString GetInternalName(void){return CPLString();};
45  virtual wxString GetCategory(void){return wxString(_("Toolbox"));};
46  virtual void Refresh(void);
47  //IGxObjectUI
48  virtual wxIcon GetLargeImage(void);
49  virtual wxIcon GetSmallImage(void);
50  virtual wxString ContextMenu(void){return wxString(wxT("wxGxToolBox.ContextMenu"));};
51  virtual wxString NewMenu(void){return wxString(wxT("wxGxToolBox.NewMenu"));};
52  //IGxObjectContainer
53  virtual bool DeleteChild(IGxObject* pChild);
54  virtual bool AreChildrenViewable(void){return true;};
55  virtual bool HasChildren(void){LoadChildren(); return m_Children.size() > 0 ? true : false;};
56  //wxGxToolbox
57  virtual void LoadChildren(void);
58  virtual void LoadChildrenFromXml(wxXmlNode* pNode);
59  virtual void EmptyChildren(void);
60 protected:
61  wxString m_sName;
62  bool m_bIsChildrenLoaded;
63  wxGxRootToolbox* m_pRootToolbox;
64  wxXmlNode* m_pDataNode;
65  wxIcon m_LargeToolboxIcon, m_SmallToolboxIcon;
66  wxIcon m_LargeToolIcon, m_SmallToolIcon;
67 };
68 
70 // wxGxRootToolbox
72 
73 class WXDLLIMPEXP_GIS_GPU wxGxRootToolbox :
74  public wxGxToolbox,
75  public IGxRootObjectProperties,
76  public IToolManagerUI,
77  public wxObject
78 {
79  DECLARE_DYNAMIC_CLASS(wxGxRootToolbox)
80 public:
81  wxGxRootToolbox(void);
82  virtual ~wxGxRootToolbox(void);
83  //IGxObject
84  virtual wxString GetName(void){return wxString(_("Toolboxes"));};
85  virtual wxString GetBaseName(void){return GetName();};
86  //IGxRootObjectProperties
87  virtual void Init(wxXmlNode* const pConfigNode);
88  virtual void Serialize(wxXmlNode* pConfigNode);
89  //wxGxRootToolbox
90  virtual void LoadChildren(void);
91  virtual wxGISGPToolManager* GetGPToolManager(void);
92  //IToolManagerUI
93  virtual IGPToolSPtr GetGPTool(wxString sToolName);
94  virtual void ExecuteTool(wxWindow* pParentWnd, IGPToolSPtr pTool, bool bSync);
95  virtual bool PrepareTool(wxWindow* pParentWnd, IGPToolSPtr pTool, bool bSync);
96  virtual long Advise(wxEvtHandler* pEvtHandler);
97  virtual void Unadvise(long nCookie);
98 protected:
99  wxString m_sPath;
100  bool m_bIsChildrenLoaded;
101  wxGISGPToolManager* m_pToolMngr;
102 };
103 
107 /*
108 class WXDLLIMPEXP_GIS_GPU wxGxFavoritesToolbox :
109  public IGxObjectUI,
110  public IGxObjectContainer,
111  public IGxObjectSort
112 {
113 public:
114  wxGxFavoritesToolbox(wxGxRootToolbox* pRootToolbox, short nMaxCount = 10, wxIcon LargeToolIcon = wxNullIcon, wxIcon SmallToolIcon = wxNullIcon);
115  virtual ~wxGxFavoritesToolbox(void);
116  //IGxObject
117  virtual wxString GetName(void);
118  virtual wxString GetBaseName(void){return GetName();};
119  virtual CPLString GetInternalName(void){return CPLString();};
120  virtual wxString GetCategory(void){return wxString(_("Toolbox"));};
121  virtual void Refresh(void);
122  //IGxObjectUI
123  virtual wxIcon GetLargeImage(void);
124  virtual wxIcon GetSmallImage(void);
125  virtual wxString ContextMenu(void){return wxEmptyString;};
126  virtual wxString NewMenu(void){return wxEmptyString;};
127  //IGxObjectContainer
128  virtual bool DeleteChild(IGxObject* pChild);
129  virtual bool AreChildrenViewable(void){return true;};
130  virtual bool HasChildren(void){LoadChildren(); return m_Children.size() > 0 ? true : false;};
131  //IGxObjectSort
132  virtual bool IsAlwaysTop(void){return true;};
133  virtual bool IsSortEnabled(void){return false;};
134  //wxGxToolbox
135  virtual void LoadChildren(void);
136  virtual void EmptyChildren(void);
137 protected:
138  bool m_bIsChildrenLoaded;
139  wxGxRootToolbox* m_pRootToolbox;
140  size_t m_nMaxCount;
141  wxIcon m_LargeToolIcon, m_SmallToolIcon;
142 };
143 
147 /*
148 class WXDLLIMPEXP_GIS_GPU wxGxToolExecute :
149  public IGxObjectUI,
150  public IGxObjectSort,
151  public IGxObjectContainer,
152  public wxGISGPToolManager
153 {
154 public:
155  wxGxToolExecute(wxGxRootToolbox* pRootToolbox);
156  virtual ~wxGxToolExecute(void);
157  //IGxObject
158  virtual wxString GetName(void);
159  virtual wxString GetBaseName(void){return GetName();};
160  virtual CPLString GetInternalName(void){return CPLString();};
161  virtual wxString GetCategory(void){return wxString(_("Toolbox"));};
162  virtual void Refresh(void);
163  //IGxObjectUI
164  virtual wxIcon GetLargeImage(void);
165  virtual wxIcon GetSmallImage(void);
166  virtual wxString ContextMenu(void){return wxEmptyString;};
167  virtual wxString NewMenu(void){return wxEmptyString;};
168  //IGxObjectSort
169  virtual bool IsAlwaysTop(void){return true;};
170  virtual bool IsSortEnabled(void){return false;};
171  //IGxObjectContainer
172  virtual bool DeleteChild(IGxObject* pChild);
173  virtual bool AreChildrenViewable(void){return false;};
174  virtual bool HasChildren(void){return m_Children.size() > 0 ? true : false;};
175  // wxGISGPToolManager
176  virtual int Execute(IGPToolSPtr pTool, ITrackCancel* pTrackCancel = NULL);
177  virtual void StartProcess(size_t nIndex);
178  //virtual void CancelProcess(size_t nIndex);
179  virtual void OnFinish(IProcess* pProcess, bool bHasErrors);
180  virtual bool PrepareTool(wxWindow* pParentWnd, IGPToolSPtr pTool, bool bSync)
181  {
182  return m_pRootToolbox->PrepareTool(pParentWnd, pTool, bSync);
183  }
184 protected:
185  wxGxRootToolbox* m_pRootToolbox;
186  wxIcon m_LargeToolIcon, m_SmallToolIcon;
187 };
188 
189 
191 // wxGxTool
193 
194 class WXDLLIMPEXP_GIS_GPU wxGxTool :
195  public IGxObject,
196  public IGxObjectUI,
197  public IGxObjectWizard
198 {
199 public:
200  wxGxTool(wxGxRootToolbox* pRootToolbox, wxXmlNode* pDataNode = NULL, wxIcon LargeToolIcon = wxNullIcon, wxIcon SmallToolIcon = wxNullIcon);
201  wxGxTool(wxGxRootToolbox* pRootToolbox, wxString sInternalName, wxIcon LargeToolIcon = wxNullIcon, wxIcon SmallToolIcon = wxNullIcon);
202  virtual ~wxGxTool(void);
203  //IGxObject
204  virtual wxString GetName(void){return m_sName;};
205  virtual wxString GetBaseName(void){return GetName();};
206  virtual CPLString GetInternalName(void){return CPLString();};
207  virtual wxString GetCategory(void){return wxString(_("Tool"));};
208  virtual bool Attach(IGxObject* pParent, IGxCatalog* pCatalog);
209  //IGxObjectUI
210  virtual wxIcon GetLargeImage(void);
211  virtual wxIcon GetSmallImage(void);
212  virtual wxString ContextMenu(void){return wxString(wxT("wxGxTool.ContextMenu"));};
213  virtual wxString NewMenu(void){return wxEmptyString;};
214  //IGxObjectWizard
215  virtual bool Invoke(wxWindow* pParentWnd);
216 protected:
217  //wxString m_sPath;
218  wxString m_sName, m_sInternalName;
219  wxXmlNode* m_pDataNode;
220  wxGxRootToolbox* m_pRootToolbox;
221  wxIcon m_LargeToolIcon, m_SmallToolIcon;
222 };
223 */