Version: 0.6.0
drawinglayer.h
1 /******************************************************************************
2 * Project: wxGIS
3 * Purpose: DrawingLayer header
4 * Author: Dmitry Baryshnikov (aka Bishop), polimax@mail.ru
5 ******************************************************************************
6 * Copyright (C) 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/carto/layer.h"
24 #include "wxgis/display/symbol.h"
25 //#include "wxgis/carto/featurerenderer.h"
26 //#include "wxgis/carto/rasterrenderer.h"
27 
35 enum wxGISEnumShapeType{
36  enumGISShapeTypeRectangle = 0,
37  enumGISShapeTypePolygon,
38  enumGISShapeTypeCircle,
39  enumGISShapeTypeEllipse,
40  enumGISShapeTypeLine,
41 #ifdef wxGIS_USE_SPLINE
42  enumGISShapeTypeCurve,
43 #endif // wxGIS_USE_SPLINE
44  enumGISShapeTypeFreeHand,
45  enumGISShapeTypeMarker,
46  enumGISShapeTypeMax
47 };
48 
49 enum wxGISEnumShapeState{
50  enumGISShapeStateNormal = 0,
51  enumGISShapeStateSelected,
52  enumGISShapeStateRotated,
53  enumGISShapeStatePoints,
54  enumGISShapeStateMax
55 };
56 
63 class wxGISShape : public wxObject
64 {
65  DECLARE_CLASS(wxGISShape)
66 public:
67  wxGISShape(const wxString &sName, const wxGISGeometry &Geom, wxGISEnumShapeType eType, wxGISSymbol* pSymbol);
68  virtual ~wxGISShape();
69  virtual wxGISEnumShapeType GetType() const;
70  virtual wxGISEnumShapeState GetState() const;
71  virtual void Draw(wxGISDisplay *pDisplay);
72  virtual OGREnvelope GetBounds() const;
73 protected:
74  wxGISGeometry m_oGeom;
75  wxGISSymbol* m_pSymbol;
76  wxGISEnumShapeState m_eState;
77  wxGISEnumShapeType m_eType;
78  wxString m_sName;
79 };
80 
81 
89 class WXDLLIMPEXP_GIS_CRT wxGISDrawingLayer :
90  public wxGISLayer
91 {
92  DECLARE_CLASS(wxGISDrawingLayer)
93 public:
94  wxGISDrawingLayer(const wxString &sName = _("new drawing layer"), wxGISDataset* pwxGISDataset = NULL);
95  virtual ~wxGISDrawingLayer(void);
96  //wxGISLayer
97  virtual bool Draw(wxGISEnumDrawPhase DrawPhase, ITrackCancel* const pTrackCancel = NULL);
98  virtual wxGISEnumDatasetType GetType(void) const { return enumGISDrawing; };
99  virtual bool AddShape(const wxGISGeometry &Geom, wxGISEnumShapeType eType);
100  virtual size_t GetShapeCount(void) const;
101  virtual wxGISShape* GetShape(size_t nIndex) const;
102  virtual wxGISSymbol* GetSymbol(wxGISEnumShapeType eType);
103  virtual void Clear();
104 protected:
105  wxGISSimpleEllipseSymbol* m_pEllipseSymbol;
106  wxGISSimpleCircleSymbol* m_pCircleSymbol;
107  wxGISSimpleMarkerSymbol *m_pMarkerSymbol;
108  wxGISSimpleLineSymbol *m_pLineSymbol;
109  wxGISSimpleFillSymbol *m_pFillSymbol;
110  wxVector<wxGISShape*> m_aoShapes;
111 // wxGISSpatialTree *pTree;
112  wxCriticalSection m_CritSect;
113  OGREnvelope m_oLayerExtent;
114 };
Definition: symbol.h:174
Definition: symbol.h:35
Definition: symbol.h:86
Definition: gdalinh.h:333
Definition: symbol.h:191
Definition: gisdisplay.h:43
A TrackCancel interface class.
Definition: core.h:144
Definition: layer.h:35
Definition: drawinglayer.h:63
Definition: dataset.h:33
Definition: symbol.h:156
Definition: symbol.h:131
Definition: drawinglayer.h:89