ToolMap
Loading...
Searching...
No Matches
tmdrawer.h
1/***************************************************************************
2 tmdrawer.h
3 Draws GIS data into bitmap
4 -------------------
5 copyright : (C) 2007 CREALP Lucien Schreiber
6 ***************************************************************************/
7
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17// comment doxygen
18
19#ifndef _TM_DRAWER_H_
20#define _TM_DRAWER_H_
21
22// For compilers that support precompilation, includes "wx/wx.h".
23#include <wx/wxprec.h>
24
25// Include wxWidgets' headers
26#ifndef WX_PRECOMP
27#include <wx/wx.h>
28#endif
29
30#include "tmgisdata.h"
31#include "tmgisdataraster.h"
32#include "tmgisdatavector.h"
33#include "tmgisscale.h"
34#include "tmlayerproperties.h"
35#include "tmrenderer.h" // for drawing directly (edition mode)
36#include "tmselecteddatamemory.h" // for stroing selected data into memory
37// #include "tmgisdatavectormemory.h" // for drawing memory data
38
39// class tmGISDataVectorMemory;
40
41class DataBaseTM;
42
43class DataBaseResult;
44
45/***************************************************************************/
50class tmDrawer : public wxObject {
51 private:
52 wxBitmap* m_bmp;
53 tmGISScale* m_scale;
54 bool m_IsInitialised;
55 tmRealRect m_spatFilter;
56 static bool m_LogOn;
57 long m_ActuallayerID;
58 tmSelectedDataMemory* m_SelMem;
59 wxPoint m_PreviousPoint;
60
61 // load image using GDAL
62 // owned by image, do not destroy manually.
63 unsigned char* imgbuf;
64 unsigned int imglen;
65 unsigned char* maskbuf;
66 unsigned int masklen;
67
68 // drawing functions
69 bool DrawLines(tmLayerProperties* itemProp, tmGISData* pdata);
70
71 bool DrawLinesEnhanced(tmLayerProperties* itemProp, tmGISData* pdata);
72
73 bool DrawLinesRules(tmLayerProperties* itemProp, tmGISData* pdata);
74
75 bool DrawPoints(tmLayerProperties* itemProp, tmGISData* pdata);
76
77 bool DrawPointsEnhanced(tmLayerProperties* itemProp, tmGISData* pdata);
78
79 bool DrawPointsRules(tmLayerProperties* itemProp, tmGISData* pdata);
80
81 bool DrawPolygons(tmLayerProperties* itemProp, tmGISData* pdata);
82
83 bool DrawPolygonsRules(tmLayerProperties* itemProp, tmGISData* pdata);
84
85 bool DrawRaster(tmLayerProperties* itemProp, tmGISData* pdata);
86
87 bool _DrawOrientedLine(wxGraphicsContext* gdc, wxPoint* pts, int nbpts, wxPen actualPen);
88
89 void _LabelPoint(tmLayerProperties* itemprop, tmGISData* pdata);
90
91 void _LabelLine(tmLayerProperties* itemprop, tmGISData* pdata);
92
93 void _LabelPolygon(tmLayerProperties* itemprop, tmGISData* pdata);
94
95 wxString _GetLabelText(const wxString& definition, OGRFeature* featureref);
96
97 // void DrawMemoryDataLine (tmGISData * data, tmLayerProperties * layerprop, wxClientDC * dc);
98
99 // drawing vertex
100 bool DrawVertexLine(wxGraphicsContext* pgdc, wxPoint* pts, int nb_pts, tmLayerProperties* itemProp, wxPen* pen,
101 int nb_pen = 1);
102
103 bool DrawVertexPoly(tmLayerProperties* itemProp, tmGISData* pdata);
104
105 wxPen* CreateVertexUniquePen(tmLayerProperties* itemProp, int size);
106
107 wxPen* CreateEditUniqueVertexPen(int size);
108
109 wxPen* CreateEditUniqueSegmentPen(int size);
110
111 static void DrawPoint(const wxPoint& pt, wxMemoryDC* pMdc);
112
113 static void DrawPoint(const wxPoint& pt, wxClientDC* pcdc);
114
115 bool _SelectFeatureByQuery(long myQueryID, DataBaseTM* database, wxArrayLong& results);
116
117 bool _ExistsinResults(long Oid, const wxArrayLong& results);
118
119 protected:
120 public:
121 tmDrawer();
122
123 ~tmDrawer();
124
125 void SetSelectedData(tmSelectedDataMemory* selectedmemory) {
126 m_SelMem = selectedmemory;
127 }
128
129 void InitDrawer(wxBitmap* bitmap, tmGISScale* scale, const tmRealRect& filter);
130
131 // Extent Drawing
132 bool DrawExtentIntoBitmap(int width = 1, const wxColour& col = wxColour(*wxBLACK));
133
134 bool Draw(tmLayerProperties* itemProp, tmGISData* pdata);
135
136 static void EnableLogging(bool enable) {
137 m_LogOn = enable;
138 }
139
140 static bool IsLoggingEnabled() {
141 return m_LogOn;
142 }
143
144 void DrawEditVertex(const wxRealPoint& pt, int size, wxColour colour);
145
146 void DrawEditSegment(const wxRealPoint& pt1, const wxRealPoint& pt2, int size);
147
148 void DrawEditLine(const wxArrayRealPoints& pts, int size, wxColour colour = *wxRED);
149 // void DrawMemoryData (tmGISData * data, tmLayerProperties * layerprop,
150 // wxClientDC * dc);
151};
152
153#endif
Definition databaseresult.h:30
Definition database_tm.h:80
In charge of all the drawing into bitmaps.
Definition tmdrawer.h:50
void DrawEditVertex(const wxRealPoint &pt, int size, wxColour colour)
Draw a vertex (used during editing)
Definition tmdrawer.cpp:1712
void DrawEditLine(const wxArrayRealPoints &pts, int size, wxColour colour= *wxRED)
Draw all edited lines.
Definition tmdrawer.cpp:1800
bool DrawExtentIntoBitmap(int width=1, const wxColour &col=wxColour(*wxBLACK))
Draw the max extent.
Definition tmdrawer.cpp:75
void DrawEditSegment(const wxRealPoint &pt1, const wxRealPoint &pt2, int size)
Draw the segment between two points.
Definition tmdrawer.cpp:1731
Main class for dealing with GIS data.
Definition tmgisdata.h:48
Definition tmgisscale.h:100
Storing object of layer type.
Definition tmlayerproperties.h:47
Class representing real rectangle.
Definition tmgisscale.h:44
Store ID of selected data into memory.
Definition tmselecteddatamemory.h:43