Version: 0.6.0
identifydlg.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Catalog)
3  * Purpose: wxGISIdentifyDlg class - dialog/dock window with the results of identify.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2011-2013 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/cartoui/cartoui.h"
24 #include "wxgis/display/symbol.h"
25 #include "wxgis/framework/applicationbase.h"
26 #include "wxgis/cartoui/mapview.h"
27 #include "wxgis/carto/featurelayer.h"
28 #include "wxgis/cartoui/formatmenu.h"
29 #include "wxgis/datasource/gdalinh.h"
30 
31 #include <wx/intl.h>
32 #include <wx/string.h>
33 #include <wx/stattext.h>
34 #include <wx/gdicmn.h>
35 #include <wx/font.h>
36 #include <wx/colour.h>
37 #include <wx/settings.h>
38 #include <wx/choice.h>
39 #include <wx/bitmap.h>
40 #include <wx/image.h>
41 #include <wx/icon.h>
42 #include <wx/bmpbuttn.h>
43 #include <wx/button.h>
44 #include <wx/sizer.h>
45 #include <wx/splitter.h>
46 #include <wx/panel.h>
47 #include <wx/treectrl.h>
48 #include <wx/listctrl.h>
49 #include <wx/valgen.h>
50 #include <wx/imaglist.h>
51 
59 class wxIdentifyTreeItemData : public wxTreeItemData
60 {
61 public:
62  wxIdentifyTreeItemData(wxGISFeatureDataset* pDataset, long nOID = wxNOT_FOUND, const wxGISGeometry &Geometry = wxNullGeometry)
63  {
64  m_pDataset = pDataset;
65  m_nOID = nOID;
66  m_Geometry = Geometry;
67  }
68 
70  {
71  }
72 
73  long m_nOID;
74  wxGISFeatureDataset* m_pDataset;
75  wxGISGeometry m_Geometry;
76 };
77 
78 typedef struct _fieldsortdata
79 {
80  int nSortAsc;
81  short currentSortCol;
82  wxGISFeature Feature;
84 
92 class wxGISFeatureDetailsPanel : public wxPanel
93 {
94  enum
95  {
96  ID_LISTCTRL = 3050,
97  ID_MASKBTN,
98  ID_WG_COPY_NAME,
99  ID_WG_COPY_VALUE,
100  ID_WG_COPY,
101  ID_WG_HIDE,
102  ID_WG_RESET_SORT,
103  ID_WG_RESET_HIDE,
104  ID_WG_ENCODING_START
105  };
106 public:
107  wxGISFeatureDetailsPanel( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL );
108  virtual ~wxGISFeatureDetailsPanel();
109  virtual void SetClickPositionText(const OGRPoint *pPt);
110  virtual void FillPanel(const wxGISFeature &Feature);
111  virtual void Clear(bool bFull = false);
112  //events
113  virtual void OnContextMenu(wxContextMenuEvent& event);
114  virtual void OnMenu(wxCommandEvent& event);
115  virtual void OnMenuUpdateUI(wxUpdateUIEvent& event);
116  virtual void OnColClick(wxListEvent& event);
117  virtual void OnMaskMenu(wxCommandEvent& event);
118  virtual void OnMouseLeftUp(wxMouseEvent& event);
119  virtual void OnMouseMove(wxMouseEvent& event);
120 
121  //not work on GTK
122  //virtual void OnSetCursor(wxSetCursorEvent& event);
123 protected:
124  void WriteStringToClipboard(const wxString &sData);
125 protected:
126  wxString m_sLocation;
127  wxGISCoordinatesFormatMenu *m_pCFormat;
128  wxStaticText* m_staticText1;
129  wxTextCtrl* m_textCtrl;
130  wxBitmapButton* m_bpSelStyleButton;
131  wxListCtrl* m_listCtrl;
132  wxMenu *m_pMenu;
133  wxArrayLong m_anExcludeFields;
134  wxGISFeature m_Feature;
135  int m_nSortAsc;
136  short m_currentSortCol;
137  wxImageList m_ImageListSmall;
138  double m_dfX, m_dfY;
139 private:
140  wxString m_sAppName;
141 private:
142  DECLARE_EVENT_TABLE()
143 };
144 
152 class WXDLLIMPEXP_GIS_CTU wxGISIdentifyDlg : public wxPanel
153 {
154 protected:
155  enum
156  {
157  ID_WXGISIDENTIFYDLG = 1001,
158  ID_WXGISTREECTRL,
159  ID_SWITCHSPLIT,
160  ID_WGMENU_FLASH,
161  ID_WGMENU_PAN,
162  ID_WGMENU_ZOOM
163  };
164 
165  DECLARE_DYNAMIC_CLASS(wxGISIdentifyDlg)
166 public:
167  wxGISIdentifyDlg(void);
168  wxGISIdentifyDlg( wxWindow* parent, wxWindowID id = ID_WXGISIDENTIFYDLG, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL );
169  virtual ~wxGISIdentifyDlg();
170  virtual bool Create(wxWindow* parent, wxWindowID id = ID_WXGISIDENTIFYDLG, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL, const wxString& name = wxT("IdentifyView"));
171 
172  void SplitterOnIdle( wxIdleEvent& )
173  {
174  //m_splitter->SetSashPosition( 0 );
175  //m_splitter->Disconnect( wxEVT_IDLE, wxIdleEventHandler( wxGISIdentifyDlg::SplitterOnIdle ), NULL, this );
176 
177  m_splitter->SetSashPosition( m_nSashPos );
178  m_splitter->Unbind(wxEVT_IDLE, &wxGISIdentifyDlg::SplitterOnIdle, this );
179  }
180  //event
181  virtual void OnSwitchSplit(wxCommandEvent& event);
182  virtual void OnSelChanged(wxTreeEvent& event);
183  virtual void OnLeftDown(wxMouseEvent& event);
184  virtual void OnMenu(wxCommandEvent& event);
185  virtual void OnItemRightClick(wxTreeEvent& event);
186  virtual void OnDoubleClickSash(wxSplitterEvent& event);
187  virtual void SetEncoding(const wxFontEncoding& eEnc);
188 protected:
189  wxBoxSizer* m_bMainSizer;
190  wxFlexGridSizer* m_fgTopSizer;
191  wxStaticText* m_staticText1;
192  wxChoice* m_LayerChoice;
193  wxBitmapButton* m_bpSplitButton;
194  wxSplitterWindow* m_splitter;
195  wxBitmap m_BmpVert, m_BmpHorz;
196  wxTreeCtrl *m_pTreeCtrl;
197  wxGISFeatureDetailsPanel* m_pFeatureDetailsPanel;
198  wxImageList m_TreeImageList;
199  wxXmlNode* m_pConf;
200  wxMenu *m_pMenu;
201 protected:
202  int m_nSashPos;
203  wxString m_sAppName;
204 private:
205  DECLARE_EVENT_TABLE()
206 };
207 
215 class WXDLLIMPEXP_GIS_CTU wxAxIdentifyView :
216  public wxGISIdentifyDlg,
217  public IView
218 {
219 protected:
220  enum
221  {
222  ID_WXGISIDENTIFYVIEW = 1000,
223  };
224 
225  DECLARE_DYNAMIC_CLASS(wxAxIdentifyView)
226 public:
227  wxAxIdentifyView(void);
228  wxAxIdentifyView(wxWindow* parent, wxWindowID id = ID_WXGISIDENTIFYVIEW, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
229  virtual ~wxAxIdentifyView(void);
230 //IView
231  virtual bool Create(wxWindow* parent, wxWindowID id = ID_WXGISIDENTIFYVIEW, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxBORDER_NONE | wxTAB_TRAVERSAL, const wxString& name = wxT("IdentifyView"));
232  virtual bool Activate(IApplication* const pApplication, wxXmlNode* const pConf);
233  virtual void Deactivate(void);
234  virtual void Refresh(void){};
235  virtual wxString GetViewName(void) const {return m_sViewName;};
236  virtual wxIcon GetViewIcon(void){return wxNullIcon;};
237  virtual void SetViewIcon(wxIcon Icon){};
238  //wxGISIdentifyDlg
239  virtual void Identify(wxGISMapView* pMapView, wxGISGeometry &GeometryBounds);
240  //events
241  virtual void OnSelChanged(wxTreeEvent& event);
242  virtual void OnLeftDown(wxMouseEvent& event);
243  virtual void OnMenu(wxCommandEvent& event);
244  virtual void OnLayerRemoved(wxMxMapViewUIEvent& event);
245 
246  typedef struct _filltreedata{
247  wxGISLayer* const pLayer;
248  wxGISSpatialTreeCursor Cursor;
249  } FILLTREEDATA;
250 protected:
251  virtual void FillTree(const wxVector<FILLTREEDATA> &data);
252  virtual wxGISSymbol* GetDrawSymbol(OGRwkbGeometryType eType) const;
253 protected:
254  wxString m_sViewName;
255  wxGISApplicationBase* m_pApp;
256  wxGISMapView* m_pMapView;
257  long m_nConnectionPointMapCookie;
258  //wxGxToolboxTreeView* m_pGxToolboxView;
259  //wxGxToolExecuteView *m_pGxToolExecuteView;
260 private:
261  DECLARE_EVENT_TABLE()
262 };
Definition: symbol.h:35
Definition: mxeventui.h:54
Definition: mapview.h:36
Definition: framework.h:40
Definition: applicationbase.h:65
Definition: identifydlg.h:246
Definition: gdalinh.h:333
The class to format coordinates according different masks.
Definition: formatmenu.h:30
Definition: identifydlg.h:215
Definition: gdalinh.h:117
Definition: identifydlg.h:78
Definition: layer.h:35
Definition: identifydlg.h:92
Definition: featuredataset.h:32
Definition: identifydlg.h:152
Definition: identifydlg.h:59
Definition: app.h:32