Version: 0.6.0
gpdomain.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Toolbox)
3  * Purpose: geoprocessing tool parameters domains.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2009-2012 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 
22 #pragma once
23 
24 #include "wxgis/geoprocessing/geoprocessing.h"
25 #include "wxgis/catalog/catalog.h"
26 #include "wxgis/catalog/gxfilters.h"
27 #include "wxgis/datasource/sysop.h"
28 
37 {
38 public:
40  virtual ~IGISGPDomainParent(void){};
49  virtual void OnValueAdded(const wxVariant &Value, const wxString &sName) = 0;
51  virtual void OnCleared(void) = 0;
52 };
53 
54 
55 
63 class WXDLLIMPEXP_GIS_GP wxGISGPValueDomain :
64  public wxObject,
66 {
67  DECLARE_CLASS(wxGISGPValueDomain)
68 public:
69  wxGISGPValueDomain(void);
70  virtual ~wxGISGPValueDomain (void);
71  virtual void AddValue(const wxVariant& Element, const wxString &soNameStr);
72  virtual size_t GetCount(void) const;
73  virtual wxVariant GetValue(size_t nIndex) const;
74  virtual wxString GetName(size_t nIndex) const;
75  virtual void Clear(void);
76  virtual bool GetAltered(void) const {return m_bAltered;};
77  virtual void SetAltered(bool bAltered){m_bAltered = bAltered;};
78  //
79  virtual wxVariant GetValueByName(const wxString &soNameStr) const;
80  virtual int GetPosByName(const wxString &sName) const;
81  virtual int GetPosByValue(const wxVariant &oVal) const;
82  //
83  virtual void SetParent(IGISGPDomainParent* const pDomParet){m_pDomParet = pDomParet;};
84 protected:
85  wxArrayString m_asoNames;
86  wxVector<wxVariant> m_asoData;
87  bool m_bAltered;
88  IGISGPDomainParent* m_pDomParet;
89 };
90 
95 class WXDLLIMPEXP_GIS_GP wxGISGPGxObjectDomain : public wxGISGPValueDomain
96 {
97  DECLARE_CLASS(wxGISGPGxObjectDomain)
98 public:
99  wxGISGPGxObjectDomain (void);
100  virtual ~wxGISGPGxObjectDomain (void);
101  virtual wxGxObjectFilter* const GetFilter(size_t nIndex) const;
102  virtual void AddFilter(wxGxObjectFilter* pFilter);
103  virtual int GetPosByValue(const wxVariant &oVal) const;
104 };
105 
106 WXDLLIMPEXP_GIS_GP inline void AddAllVectorFilters(wxGISGPGxObjectDomain* pDomain)
107 {
108  for (size_t i = enumVecUnknown + 1; i < enumVecMAX; ++i)
109  {
110  pDomain->AddFilter(new wxGxFeatureDatasetFilter(wxGISEnumVectorDatasetType(i)));
111  }
112 }
113 
114 WXDLLIMPEXP_GIS_GP inline void AddAllVectorFileFilters(wxGISGPGxObjectDomain* pDomain)
115 {
116  for (size_t i = enumVecUnknown + 1; i < enumVecMAX; ++i)
117  {
118  if (IsFileDataset(enumGISFeatureDataset, wxGISEnumVectorDatasetType(i)))
119  {
120  pDomain->AddFilter(new wxGxFeatureDatasetFilter(wxGISEnumVectorDatasetType(i)));
121  }
122  }
123 }
124 
125 WXDLLIMPEXP_GIS_GP inline void AddAllVectorDBFilters(wxGISGPGxObjectDomain* pDomain)
126 {
127  pDomain->AddFilter(new wxGxFeatureDatasetFilter(enumVecPostGIS));
128 }
129 
130 
131 WXDLLIMPEXP_GIS_GP inline void AddAllRasterFilters(wxGISGPGxObjectDomain* pDomain)
132 {
133 // for(size_t i = enumRasterUnknown + 1; i < enumRasterMAX; ++i)
134 // pDomain->AddFilter(new wxGxRasterFilter(wxGISEnumRasterDatasetType(i)));
135 }
136 
137 
141 class WXDLLIMPEXP_GIS_GP wxGISGPStringDomain : public wxGISGPValueDomain
142 {
143  DECLARE_CLASS(wxGISGPStringDomain)
144 public:
145  wxGISGPStringDomain (void);
146  virtual ~wxGISGPStringDomain (void);
147  virtual void AddString(const wxString &soStr, const wxString &soNameStr = wxEmptyString);
148  virtual wxString GetString(size_t nIndex) const;
149 };
150 
151 
The domain storing GxObjectFilters.
Definition: gpdomain.h:95
Definition: gpdomain.h:36
Definition: pointer.h:34
virtual void OnCleared(void)=0
virtual void OnValueAdded(const wxVariant &Value, const wxString &sName)=0
Definition: gpdomain.h:63
virtual ~IGISGPDomainParent(void)
Definition: gpdomain.h:40
The domain storing strings.
Definition: gpdomain.h:141
Definition: gxfilters.h:122
Definition: gxfilters.h:33