Version: 0.6.0
display.h
1 /******************************************************************************
2  * Project: wxGIS (GIS Catalog)
3  * Purpose: display header.
4  * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5  ******************************************************************************
6 * Copyright (C) 2009,2011,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/datasource/datasource.h"
25 
26 #include "wx/image.h"
27 
28 #undef LT_OBJDIR
29 #include "ogrsf_frmts.h"
30 
31 #ifndef wxGIS_USE_CAIRO
32  #error Cairo required
33 #endif
34 
35 #define MINPOLYAREA 0.25
36 #define MINPOLYDRAWAREA 2.2
37 #define ZOOM_FACTOR 0.4
38 
39 #define ENVMAX_X 179
40 #define ENVMAX_Y 85
41 #define ENVMIN_X -179
42 #define ENVMIN_Y -85
43 
50 enum wxGISEnumDrawPhase
51 {
52  wxGISDPGeography = 0x0001,
53  wxGISDPAnnotation = 0x0002,
54  wxGISDPSelection = 0x0004
55 };
56 
63 enum wxGISEnumDrawQuality
64 {
65  enumGISQualityNearest,
66  enumGISQualityBilinear,
67  enumGISQualityBicubic,
68  enumGISQualityHalfBilinear,
69  enumGISQualityHalfQuadBilinear,
70  enumGISQualityFourQuadBilinear
71 };
72 
79 enum wxGISEnumPointPosition
80 {
81  enumGISPtPosLeft = 0,
82  enumGISPtPosRight,
83  enumGISPtPosBottom,
84  enumGISPtPosTop
85 };
86 
100 //class IDisplayTransformation
101 //{
102 //public:
103 // virtual ~IDisplayTransformation(void){};
104 // virtual void Reset(void) = 0;
105 // virtual void SetDeviceFrame(wxRect rc) = 0;
106 // virtual wxRect GetDeviceFrame(void) = 0;
107 // virtual bool IsBoundsSet(void) = 0;
108 // virtual void SetBounds(OGREnvelope bounds) = 0;
109 // virtual OGREnvelope GetBounds(void) = 0;
110 // virtual OGREnvelope GetVisibleBounds(void) = 0;
111 // virtual double GetRatio(void) = 0;
112 // virtual double GetScaleRatio(void) = 0;
113 // virtual void SetSpatialReference(OGRSpatialReference* pSpatialReference) = 0;
114 // virtual OGRSpatialReference* GetSpatialReference(void) = 0;
115 // virtual wxPoint* TransformCoordWorld2DC(OGRRawPoint* pPoints, size_t nPointCount) = 0;
116 // virtual void TransformCoordWorld2DC(OGRRawPoint* pPoints, size_t nPointCount, wxPoint* pResult) = 0;
117 // virtual OGRRawPoint* TransformCoordDC2World(wxPoint* pPoints, size_t nPointCount) = 0;
118 // virtual void SetPPI(wxSize new_res) = 0;
119 // virtual OGREnvelope TransformRect(wxRect rect) = 0;
120 //};
121 //
122 //typedef std::vector<wxRect> RECTARARRAY;
123 //
124 //class IDisplay
125 //{
126 //public:
127 // virtual ~IDisplay(void){};
128 // virtual void OnDraw(wxDC &dc, wxCoord x = 0, wxCoord y = 0, bool bClearBackground = false) = 0;
129 // virtual void OnUpdate(void) = 0;
130 // virtual void SetDC(wxDC *pdc) = 0;
131 // virtual bool IsDerty(void) = 0;
132 // virtual void SetDerty(bool bIsDerty) = 0;
133 // virtual void SetBrush(wxBrush& Brush) = 0;
134 // virtual void SetPen(wxPen& Pen) = 0;
135 // virtual void SetFont(wxFont& Font) = 0;
136 // virtual void DrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fill_style = wxODDEVEN_RULE) = 0;
137 // virtual void DrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0, int fill_style = wxODDEVEN_RULE) = 0;
138 // virtual void DrawPoint(wxCoord x, wxCoord y) = 0;
139 // virtual void DrawLines(int n, wxPoint points[], wxCoord xoffset = 0, wxCoord yoffset = 0) = 0;
140 // virtual void DrawCircle(wxCoord x, wxCoord y, wxCoord radius) = 0;
141 // virtual void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0;
142 // virtual void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool transparent = false) = 0;
143 // virtual IDisplayTransformation* GetDisplayTransformation(void) = 0;
144 // virtual RECTARARRAY* GetInvalidRect(void) = 0;
145 // virtual void AddInvalidRect(wxRect Rect) = 0;
146 //};
147 //
148 //class ICachedDisplay :
149 // public IDisplay
150 //{
151 //public:
152 // virtual ~ICachedDisplay(void){};
153 // virtual void OnStretchDraw(wxDC &dc, wxCoord nDestWidth, wxCoord nDestHeight, wxCoord x = 0, wxCoord y = 0, bool bClearBackground = false, wxGISEnumDrawQuality quality = enumGISQualityNearest) = 0;
154 // virtual void OnStretchDraw2(wxDC &dc, wxRect Rect, bool bClearBackground = false, wxGISEnumDrawQuality quality = enumGISQualityNearest) = 0;
155 // virtual void OnPanDraw(wxDC &dc, wxCoord x, wxCoord y) = 0;
156 // virtual void OnPanStop(wxDC &dc) = 0;
157 // //virtual void OnDrawRectangle(wxDC &dc, wxCoord x, wxCoord y, wxCoord width, wxCoord height) = 0;
158 // //Check if cache_id is derty
159 // virtual bool IsCacheDerty(size_t cache_id) = 0;
160 // virtual void SetCacheDerty(size_t cache_id, bool bIsDerty) = 0;
161 // virtual size_t AddCache(void) = 0;
162 // virtual size_t GetLastCacheID(void) = 0;
163 // virtual void MergeCaches(size_t SrcCacheID, size_t DstCacheID) = 0;
164 // virtual void StartDrawing(size_t CacheID) = 0;
165 // virtual void FinishDrawing(void) = 0;
166 // virtual void ClearCaches(void) = 0;
167 //};
168 //
169 //class ISymbol
170 //{
171 //public:
173 // virtual ~ISymbol(void){};
174 // virtual void Draw(OGRGeometry* pGeometry, IDisplay* pDisplay) = 0;
175 // virtual void SetPen(wxPen NewPen){m_Pen = NewPen;};
176 // virtual wxPen GetPen(void){return m_Pen;};
177 // virtual void SetBrush(wxBrush NewBrush){m_Brush = NewBrush;};
178 // virtual wxBrush GetBrush(void){return m_Brush;};
179 // virtual void SetFont(wxFont NewFont){m_Font = NewFont;};
180 // virtual wxFont GetFont(void){return m_Font;};
181 //protected:
182 // wxPen m_Pen;//wxNullPen
183 // wxBrush m_Brush;//wxNullBrush
184 // wxFont m_Font;//wxNullFont
185 //};