Version: 0.6.0
rubberband.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Catalog)
3  * Purpose: wxGISRubberBand class.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2009,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 
22 #pragma once
23 
24 #include "wxgis/display/display.h"
25 #include "wxgis/display/gisdisplay.h"
26 #include "wxgis/datasource/gdalinh.h"
27 
35 class WXDLLIMPEXP_GIS_DSP wxGISRubberBand :
36  public wxEvtHandler
37 {
38  DECLARE_CLASS(wxGISRubberBand)
39 public:
40  wxGISRubberBand(wxPen oPen, wxWindow *pWnd, wxGISDisplay *pDisp, const wxGISSpatialReference &SpaRef = wxNullSpatialReference);
41  virtual ~wxGISRubberBand(void);
42  virtual wxGISGeometry TrackNew(wxCoord x, wxCoord y);
43  virtual void OnUnlock(void);
44  //events
45  virtual void OnKeyDown(wxKeyEvent & event);
46  virtual void OnMouseMove(wxMouseEvent& event);
47  virtual void OnMouseDown(wxMouseEvent& event);
48  virtual void OnMouseUp(wxMouseEvent& event);
49  virtual void OnMouseDoubleClick(wxMouseEvent& event);
50  virtual void OnLeave(wxMouseEvent& event);
51  virtual void OnEnter(wxMouseEvent& event);
52  virtual void OnCaptureLost(wxMouseCaptureLostEvent & event);
53 protected:
54  wxGISGeometry m_RetGeom;
55  bool m_bLock;
56  wxCoord m_StartX;
57  wxCoord m_StartY;
58  wxCoord m_StartXScr;
59  wxCoord m_StartYScr;
60  wxWindow *m_pWnd;
61  wxGISDisplay *m_pDisp;
62  wxPen m_oPen;
63 
64  //wxRect m_PrevRect;
65  wxGISSpatialReference m_SpaRef;
66 private:
67  DECLARE_EVENT_TABLE()
68 };
69 
78 class WXDLLIMPEXP_GIS_DSP wxGISRubberEnvelope :
79  public wxGISRubberBand
80 {
81  DECLARE_CLASS(wxGISRubberEnvelope)
82 public:
83  wxGISRubberEnvelope(wxPen oPen, wxWindow *pWnd, wxGISDisplay *pDisp, const wxGISSpatialReference &SpaRef = wxNullSpatialReference);
84  virtual ~wxGISRubberEnvelope(void);
85  virtual void OnMouseMove(wxMouseEvent& event);
86  virtual void OnMouseUp(wxMouseEvent& event);
87 };
88 
96 class WXDLLIMPEXP_GIS_DSP wxGISRubberCircle :
97  public wxGISRubberBand
98 {
99  DECLARE_CLASS(wxGISRubberCircle)
100 public:
101  wxGISRubberCircle(wxPen oPen, wxWindow *pWnd, wxGISDisplay *pDisp, const wxGISSpatialReference &SpaRef = wxNullSpatialReference);
102  virtual ~wxGISRubberCircle(void);
103  virtual void OnMouseMove(wxMouseEvent& event);
104  virtual void OnMouseUp(wxMouseEvent& event);
105 };
106 
114 class WXDLLIMPEXP_GIS_DSP wxGISRubberEllipse :
115  public wxGISRubberEnvelope
116 {
117  DECLARE_CLASS(wxGISRubberEllipse)
118 public:
119  wxGISRubberEllipse(wxPen oPen, wxWindow *pWnd, wxGISDisplay *pDisp, const wxGISSpatialReference &SpaRef = wxNullSpatialReference);
120  virtual ~wxGISRubberEllipse(void);
121  virtual void OnMouseMove(wxMouseEvent& event);
122 };
123 
131 class WXDLLIMPEXP_GIS_DSP wxGISRubberFreeHand :
132  public wxGISRubberBand
133 {
134  DECLARE_CLASS(wxGISRubberFreeHand)
135 public:
136  wxGISRubberFreeHand(wxPen oPen, wxWindow *pWnd, wxGISDisplay *pDisp, const wxGISSpatialReference &SpaRef = wxNullSpatialReference);
137  virtual ~wxGISRubberFreeHand(void);
138  virtual void OnMouseMove(wxMouseEvent& event);
139  virtual void OnMouseUp(wxMouseEvent& event);
140 protected:
141  wxVector<wxPoint> m_aoPoints;
142 };
143 
151 class WXDLLIMPEXP_GIS_DSP wxGISRubberMarker :
152  public wxGISRubberBand
153 {
154  DECLARE_CLASS(wxGISRubberMarker)
155 public:
156  wxGISRubberMarker(wxPen oPen, wxWindow *pWnd, wxGISDisplay *pDisp, const wxGISSpatialReference &SpaRef = wxNullSpatialReference);
157  virtual ~wxGISRubberMarker(void);
158  virtual void OnMouseUp(wxMouseEvent& event);
159 };
160 
168 class WXDLLIMPEXP_GIS_DSP wxGISRubberLine :
169  public wxGISRubberBand
170 {
171  DECLARE_CLASS(wxGISRubberLine)
172 public:
173  wxGISRubberLine(wxPen oPen, wxWindow *pWnd, wxGISDisplay *pDisp, const wxGISSpatialReference &SpaRef = wxNullSpatialReference);
174  virtual ~wxGISRubberLine(void);
175  virtual void OnMouseMove(wxMouseEvent& event);
176  virtual void OnMouseDown(wxMouseEvent& event);
177  virtual void OnMouseDoubleClick(wxMouseEvent& event);
178 protected:
179  wxVector<wxPoint> m_aoPoints;
180 };
181 
189 class WXDLLIMPEXP_GIS_DSP wxGISRubberPolygon :
190  public wxGISRubberLine
191 {
192  DECLARE_CLASS(wxGISRubberPolygon)
193 public:
194  wxGISRubberPolygon(wxPen oPen, wxWindow *pWnd, wxGISDisplay *pDisp, const wxGISSpatialReference &SpaRef = wxNullSpatialReference);
195  virtual ~wxGISRubberPolygon(void);
196  virtual void OnMouseMove(wxMouseEvent& event);
197  virtual void OnMouseDoubleClick(wxMouseEvent& event);
198 };
199 
200 #ifdef wxGIS_USE_SPLINE
201 
209 class WXDLLIMPEXP_GIS_DSP wxGISRubberSpline :
210  public wxGISRubberLine
211 {
212  DECLARE_CLASS(wxGISRubberSpline)
213 public:
214  wxGISRubberSpline(wxPen oPen, wxWindow *pWnd, wxGISDisplay *pDisp, const wxGISSpatialReference &SpaRef = wxNullSpatialReference);
215  virtual ~wxGISRubberSpline(void);
216  virtual void OnMouseMove(wxMouseEvent& event);
217 };
218 #endif // wxGIS_USE_SPLINE
219 
Definition: rubberband.h:114
Definition: gdalinh.h:333
Definition: rubberband.h:131
Definition: rubberband.h:151
Definition: gisdisplay.h:43
Definition: rubberband.h:78
Definition: gdalinh.h:57
Definition: rubberband.h:189
Definition: rubberband.h:35
Definition: rubberband.h:168
Definition: rubberband.h:96