Version: 0.6.0
mapview.h
1 /******************************************************************************
2  * Project: wxGIS
3  * Purpose: wxGISMapView class.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2009,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/carto/map.h"
26 #include "wxgis/cartoui/mxeventui.h"
27 #include "wxgis/carto/mxevent.h"
28 
36 class WXDLLIMPEXP_GIS_CTU wxGISMapView :
37  public wxWindow,
38  public wxGISExtentStack,
40  public wxThreadHelper
41 {
42  DECLARE_CLASS(wxGISMapView)
43  enum
44  {
45  TIMER_ID = 1015
46  };
47 public:
48  wxGISMapView(void);
49  wxGISMapView(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE);//wxSTATIC_BORDER|
50  virtual ~wxGISMapView(void);
51  virtual bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL | wxCLIP_CHILDREN | wxNO_FULL_REPAINT_ON_RESIZE, const wxString& name = wxT("GISMapView"));//wxSTATIC_BORDER|
52  virtual void SetTrackCancel(ITrackCancel* pTrackCancel);
53  virtual wxGISDisplay* GetDisplay(void) const {return m_pGISDisplay;};
54  //wxGISExtentStack
55  virtual bool AddLayer(wxGISLayer* pLayer);
56  virtual void Clear(void);
57  virtual void SetSpatialReference(const wxGISSpatialReference &SpatialReference);
58  virtual void SetExtent(const OGREnvelope& Env);
59  virtual void SetFullExtent(void);
60  virtual OGREnvelope GetFullExtent(void);
61  //
62  virtual double GetScaleRatio(OGREnvelope& Bounds, wxDC& dc);
63  virtual void PanStart(wxPoint MouseLocation);
64  virtual void PanMoveTo(wxPoint MouseLocation);
65  virtual void PanStop(wxPoint MouseLocation);
66  virtual void RotateStart(wxPoint MouseLocation);
67  virtual bool CanRotate(void);
68  virtual void RotateBy(wxPoint MouseLocation);
69  virtual void RotateStop(wxPoint MouseLocation);
70  virtual void SetRotate(double dAngleRad);
71  virtual double GetCurrentRotate(void);
72  //virtual void FlashGeometry(const wxGISGeometryArray& Geoms);
73  virtual void AddFlashGeometry(const wxGISGeometry& Geometry, wxGISSymbol* const pSymbol, unsigned char nPhase = 1);
74  virtual void StartFlashing(wxGISEnumFlashStyle eFlashStyle = enumGISMapFlashNewColor);
75 
82  typedef struct _flash_geometry
83  {
84  wxGISGeometry Geometry;
85  unsigned char nPhase;
86  wxGISSymbol* pSymbol;
88 protected:
89  //events
90  virtual void OnPaint(wxPaintEvent & event);
91  virtual void OnEraseBackground(wxEraseEvent & event);
92  virtual void OnSize(wxSizeEvent & event);
93  virtual void OnTimer( wxTimerEvent & event);
94  virtual void OnKeyDown(wxKeyEvent & event);
95  virtual void OnCaptureLost(wxMouseCaptureLostEvent & event);
96  virtual void OnMouseWheel(wxMouseEvent& event);
97  //
98  virtual void OnDraw(wxGISEnumDrawPhase nPhase);
99  virtual void OnMapDrawing(wxMxMapViewUIEvent& event);
100  virtual void OnLayerChanged(wxMxMapViewEvent& event);
101  virtual void OnLayerLoading(wxMxMapViewEvent& event);
102  //misc
103  virtual void DrawToolTip(wxClientDC& dc, const wxString& sText);
104  virtual OGREnvelope CreateEnvelopeFromZoomFactor(double dZoom);
105  virtual void UpdateFrameCenter(void);
106  //virtual void FillClipGeometry(wxRect rect, wxCoord x, wxCoord y);
107  virtual void Flash(wxGISEnumFlashStyle eFlashStyle = enumGISMapFlashNewColor);
108  virtual void DrawGeometry(const wxGISGeometry &Geometry, wxGISSymbol* const pSymbol);
109 protected:
110  void Refresh(void);
111  //void OnZooming( wxCommandEvent & event );
112 protected:
113  virtual bool IsDrawing() const;
114  virtual wxThread::ExitCode Entry();
115  virtual bool CreateAndRunDrawThread(void);
116  virtual void DestroyDrawThread(void);
117 protected:
118  wxTimer m_timer;
119  ITrackCancel *m_pTrackCancel;
120  IProgressor *m_pAni;
121  wxDword m_nDrawingState;
122  double m_nFactor;
123  wxPoint m_StartMouseLocation;
124  wxPoint m_FrameCenter;
125  double m_dOriginAngle;
126  double m_dCurrentAngle;
127  //flash
128  wxVector<FLASH_GEOMETRY> m_staFlashGeoms;
129  wxGISEnumFlashStyle m_eFlashStyle;
130 
131  wxCriticalSection m_CritSect, m_KeysCritSect, m_FlashCritSect;
132 
133  //wxGISPointsArray m_ClipGeometry;
134  wxSize m_PrevSize;
135  wxDateTime m_dtNow;
136 private:
137  DECLARE_EVENT_TABLE()
138 };
Definition: symbol.h:35
Definition: mxeventui.h:54
Definition: mapview.h:82
Definition: mapview.h:36
Definition: gdalinh.h:333
Definition: gisdisplay.h:43
Definition: pointer.h:34
A TrackCancel interface class.
Definition: core.h:144
Definition: mxevent.h:40
Definition: layer.h:35
Definition: gdalinh.h:57
Definition: core.h:86
Definition: map.h:68