Version: 0.6.0
remoteconndlgs.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Catalog)
3  * Purpose: Create Remote Database connection dialog.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2011,2013,2014 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 
25 #ifdef wxGIS_USE_POSTGRES
26 
27 #include <wx/statline.h>
28 
36 class WXDLLIMPEXP_GIS_CLU wxGISRemoteDBConnDlg : public wxDialog
37 {
38 protected:
39  enum
40  {
41  ID_REMOTECONNDLG = 1000,
42  ID_CONNNAME,
43  ID_SERVERTEXTCTRL,
44  ID_PORTTEXTCTRL,
45  ID_DATABASESTATICTEXT,
46  ID_DATABASETEXTCTRL,
47  ID_USERSTATICTEXT,
48  ID_PASSSTATICTEXT,
49  ID_PASSTEXTCTRL,
50  ID_TESTBUTTON
51  };
52 public:
53  wxGISRemoteDBConnDlg(CPLString pszConnPath, wxWindow* parent, wxWindowID id = ID_REMOTECONNDLG, const wxString& title = _("Remote Database Connection"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
54  wxGISRemoteDBConnDlg(wxXmlNode* pConnectionNode, wxWindow* parent, wxWindowID id = ID_REMOTECONNDLG, const wxString& title = _("Remote Database Connection"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
55  virtual ~wxGISRemoteDBConnDlg();
56  virtual CPLString GetPath(void);
57  virtual wxString GetName(void);
58 protected: //events
59  virtual void OnTest(wxCommandEvent& event);
60  virtual void OnOK(wxCommandEvent& event);
61 protected:
62  void CreateUI(bool bHasConnectionPath = true);
63 protected:
64  wxBoxSizer* m_bMainSizer;
65  wxTextCtrl* m_ConnName;
66  wxStaticLine* m_staticline1;
67  wxStaticText* m_SetverStaticText;
68  wxTextCtrl* m_sServerTextCtrl;
69  wxStaticText* m_PortStaticText;
70  wxTextCtrl* m_PortTextCtrl;
71  wxStaticText* m_DatabaseStaticText;
72  wxTextCtrl* m_DatabaseTextCtrl;
73  wxStaticText* m_UserStaticText;
74  wxTextCtrl* m_UsesTextCtrl;
75  wxStaticText* m_PassStaticText;
76  wxTextCtrl* m_PassTextCtrl;
77  wxButton* m_TestButton;
78  wxStaticLine* m_staticline2;
79  wxStdDialogButtonSizer* m_sdbSizer;
80  wxButton* m_sdbSizerOK;
81  wxButton* m_sdbSizerCancel;
82  wxCheckBox* m_checkBoxBinaryCursor;
83 
84  wxString m_sConnName;
85  wxString m_sServer;
86  wxString m_sPort;
87  wxString m_sDatabase;
88  wxString m_sUser;
89  wxString m_sPass;
90  bool m_bIsBinaryCursor;
91  bool m_bCreateNew;
92  bool m_bIsFile;
93  wxXmlNode* m_pConnectionNode;
94 
95  wxString m_sOutputPath;
96  CPLString m_sOriginOutput;
97 
98  wxString m_sDefaultTimeOut;
99  wxString m_sDefaultTestTimeOut;
100  unsigned int m_nConnTimeout;
101 
102 private:
103  DECLARE_EVENT_TABLE()
104 };
105 
106 #endif //wxGIS_USE_POSTGRES
107 
108 #ifdef wxGIS_USE_CURL
109 
110 #include <wx/statline.h>
111 
119 class WXDLLIMPEXP_GIS_CLU wxGISTMSConnDlg : public wxDialog
120 {
121 protected:
122  enum
123  {
124  ID_REMOTECONNDLG = 1000,
125  ID_TESTBUTTON,
126  ID_CONNNAME,
127  ID_PRESETTYPE,
128  ID_SELECTSRS
129  };
130 public:
131  wxGISTMSConnDlg(CPLString pszConnPath, wxWindow* parent, wxWindowID id = ID_REMOTECONNDLG, const wxString& title = _("TMS Connection"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
132  wxGISTMSConnDlg(wxXmlNode* pConnectionNode, wxWindow* parent, wxWindowID id = ID_REMOTECONNDLG, const wxString& title = _("TMS Connection"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
133  virtual ~wxGISTMSConnDlg();
134  virtual CPLString GetPath(void);
135  virtual wxString GetName(void);
136 protected: //events
137  virtual void OnTest(wxCommandEvent& event);
138  virtual void OnOK(wxCommandEvent& event);
139  virtual void OnSelectSRS(wxCommandEvent& event);
140  virtual void OnSelectPreset(wxCommandEvent& event);
141 protected:
142  void CreateUI(bool bHasConnectionPath = true);
143  void FillDefaults();
144  void FillValues(wxXmlNode* pRootNode);
145  void LoadServiceValues(wxXmlNode* pRootNode);
146  void LoadDataWindowValues(wxXmlNode* pRootNode);
147  void LoadValues(wxXmlNode* pRootNode);
148  wxXmlNode* CreateContentNode(wxXmlNode* pParentNode, wxString sName, wxString sContent);
149  wxXmlNode* CreateContentNode(wxXmlNode* pParentNode, wxString sName, double dfContent);
150 protected:
151  wxBoxSizer* m_bMainSizer;
152  wxTextCtrl* m_ConnName;
153  wxTextCtrl* m_pSRSTextCtrl;
154  wxChoice *m_PresetsType;
155 
156  wxButton* m_TestButton;
157  wxStaticLine* m_staticline2;
158  wxStdDialogButtonSizer* m_sdbSizer;
159  wxButton* m_sdbSizerOK;
160  wxButton* m_sdbSizerCancel;
161 protected:
162  wxString m_sConnName;
163  wxString m_sURL;
164  wxString m_sCachePath;
165  wxString m_sCacheDepth;
166  int m_nMaxConnections;
167  wxString m_sTimeout;
168  wxString m_sZeroBlockHttpCodes;
169  wxString m_sZeroBlockOnServerException;
170  wxString m_sOfflineMode;
171  wxString m_sAdviseRead;
172  wxString m_sVerifyAdviseRead;
173  wxString m_sClampRequests;
174  wxString m_sUserAgent;
175  wxString m_sReferer;
176  double m_dfULX;
177  double m_dfULY;
178  double m_dfLRX;
179  double m_dfLRY;
180  wxString m_sOriginTypeChoice;
181  int m_nTileSizeX;
182  int m_nTileSizeY;
183  int m_nBandsCount;
184  wxString m_sUser;
185  wxString m_sPass;
186  wxString m_sSRS;
187  int m_nTileLevel;
188 
189  bool m_bCreateNew;
190  bool m_bIsFile;
191  wxXmlNode* m_pConnectionNode;
192 
193  wxString m_sOutputPath;
194  CPLString m_sOriginOutput;
195 
196 private:
197  DECLARE_EVENT_TABLE()
198 };
199 
207 class WXDLLIMPEXP_GIS_CLU wxGISNGWConnDlg : public wxDialog
208 {
209 protected:
210  enum
211  {
212  ID_REMOTECONNDLG = 1000,
213  ID_TESTBUTTON,
214  ID_CONNNAME
215  };
216 public:
217  wxGISNGWConnDlg(CPLString pszConnPath, wxWindow* parent, wxWindowID id = ID_REMOTECONNDLG, const wxString& title = _("NGW Connection"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
218  wxGISNGWConnDlg(wxXmlNode* pConnectionNode, wxWindow* parent, wxWindowID id = ID_REMOTECONNDLG, const wxString& title = _("NGW Connection"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER);
219  virtual ~wxGISNGWConnDlg();
220  virtual CPLString GetPath(void);
221  virtual wxString GetName(void);
222 protected: //events
223  virtual void OnTest(wxCommandEvent& event);
224  virtual void OnOK(wxCommandEvent& event);
225 protected:
226  void CreateUI(bool bHasConnectionPath = true);
227  void FillDefaults();
228 protected:
229  wxBoxSizer* m_bMainSizer;
230  wxTextCtrl* m_ConnName;
231 
232  wxButton* m_TestButton;
233  wxStaticLine* m_staticline2;
234  wxStdDialogButtonSizer* m_sdbSizer;
235  wxButton* m_sdbSizerOK;
236  wxButton* m_sdbSizerCancel;
237 protected:
238  wxString m_sConnName;
239  wxString m_sURL;
240  wxString m_sUser;
241  wxString m_sPass;
242  wxString m_sUserAgent;
243 
244  bool m_bCreateNew;
245  bool m_bIsFile;
246  wxXmlNode* m_pConnectionNode;
247 
248  wxString m_sOutputPath;
249  CPLString m_sOriginOutput;
250 
251 private:
252  DECLARE_EVENT_TABLE()
253 };
254 
255 #endif // wxGIS_USE_CURL