QCAD Application Framework
CAD Application Development and Automation.
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
RGraphicsViewImage.h
Go to the documentation of this file.
1
#ifndef RGRAPHICSVIEWIMAGE_H
2
#define RGRAPHICSVIEWIMAGE_H
3
4
#include <QtCore>
5
#include <QPinchGesture>
6
7
#include "
RGraphicsView.h
"
8
#include "
RPainterPath.h
"
9
10
class
RAction
;
11
class
RDocument
;
12
class
RDocumentInterface
;
13
class
RFocusFrame
;
14
class
RGraphicsSceneQt
;
15
class
RLine
;
16
class
RSnap
;
17
class
RSnapRestriction
;
18
19
20
31
class
RGraphicsViewImage
:
public
RGraphicsView
{
32
33
public
:
34
RGraphicsViewImage
();
35
virtual
~RGraphicsViewImage
();
36
37
// TODO: these methods are not found in RGraphicsViewQt, due to the
38
// multiple inheritance of RGraphicsViewQt (QWidget and RGraphicsViewImage)
39
// unless they are declared here again:
40
void
setNavigationAction
(
RAction
* action) {
41
RGraphicsView::setNavigationAction
(action);
42
}
43
44
RBox
getBox
()
const
{
45
return
RGraphicsView::getBox
();
46
}
47
48
void
autoZoom
(
int
margin
=
RDEFAULT_MIN1
) {
49
RGraphicsView::autoZoom
(
margin
);
50
}
51
52
void
zoomTo
(
const
RBox
&window,
int
margin
= 0) {
53
RGraphicsView::zoomTo
(window,
margin
);
54
}
55
56
void
setGrid
(
RGrid
*
grid
) {
57
RGraphicsView::setGrid
(grid);
58
}
59
60
RGrid
*
getGrid
() {
61
return
RGraphicsView::getGrid
();
62
}
63
64
double
getFactor
(
bool
includeStepFactor=
true
)
const
{
65
return
RGraphicsView::getFactor
(includeStepFactor);
66
}
67
68
void
setFactor
(
double
f,
bool
regen=
true
) {
69
RGraphicsView::setFactor
(f, regen);
70
}
71
72
RVector
getOffset
(
bool
includeStepOffset=
true
)
const
{
73
return
RGraphicsView::getOffset
(includeStepOffset);
74
}
75
76
void
setOffset
(
const
RVector
&
offset
,
bool
regen=
true
) {
77
RGraphicsView::setOffset
(offset, regen);
78
}
79
80
QColor
getBackgroundColor
() {
81
return
RGraphicsView::getBackgroundColor
();
82
}
83
84
void
setMargin
(
int
m) {
85
RGraphicsView::setMargin
(m);
86
}
87
88
void
setColorMode
(
RGraphicsView::ColorMode
cm) {
89
RGraphicsView::setColorMode
(cm);
90
}
91
92
RGraphicsScene
*
getScene
() {
93
return
RGraphicsView::getScene
();
94
}
95
96
RDocument
*
getDocument
() {
97
return
RGraphicsView::getDocument
();
98
}
99
100
RDocumentInterface
*
getDocumentInterface
() {
101
return
RGraphicsView::getDocumentInterface
();
102
}
103
104
void
setDraftMode
(
bool
on) {
105
RGraphicsView::setDraftMode
(on);
106
}
107
108
bool
getDraftMode
()
const
{
109
return
RGraphicsView::getDraftMode
();
110
}
111
112
void
setPrinting
(
bool
on) {
113
RGraphicsView::setPrinting
(on);
114
}
115
116
bool
isPrinting
()
const
{
117
return
RGraphicsView::isPrinting
();
118
}
119
120
void
setPrintPreview
(
bool
on) {
121
RGraphicsView::setPrintPreview
(on);
122
}
123
124
bool
isPrintPreview
()
const
{
125
return
RGraphicsView::isPrintPreview
();
126
}
127
128
void
setPrintPointSize
(
const
RVector
& s) {
129
RGraphicsView::setPrintPointSize
(s);
130
}
131
132
virtual
void
simulateMouseMoveEvent
() {
133
RGraphicsView::simulateMouseMoveEvent
();
134
}
135
136
virtual
void
setScene
(
RGraphicsSceneQt
*
scene
,
bool
regen=
true
);
137
138
virtual
void
setBackgroundColor
(
const
QColor& col);
139
140
virtual
void
regenerate
(
bool
force=
false
);
141
virtual
void
repaintView
();
142
virtual
void
updateImage
();
143
144
virtual
bool
hasFocus
() {
145
return
true
;
146
}
147
148
virtual
void
removeFocus
() {
149
return
;
150
}
151
152
void
saveViewport
();
153
void
restoreViewport
();
154
155
virtual
RVector
mapFromView
(
const
RVector
& v,
double
z=0.0)
const
;
156
virtual
RVector
mapToView
(
const
RVector
& v)
const
;
157
virtual
double
mapDistanceFromView
(
double
d)
const
;
158
virtual
double
mapDistanceToView
(
double
d)
const
;
159
160
virtual
int
getWidth
()
const
;
161
virtual
int
getHeight
()
const
;
162
void
resizeImage
(
int
w,
int
h);
163
164
virtual
void
paintGridPoint
(
const
RVector
& ucsPosition);
165
virtual
void
paintMetaGridLine
(
const
RLine
& ucsPosition);
166
167
void
setPaintOrigin
(
bool
val);
168
169
void
setAntialiasing
(
bool
val);
170
bool
getAntialiasing
();
171
172
void
setPanOptimization
(
bool
on);
173
bool
getPanOptimization
();
174
175
virtual
void
paintEntities
(QPainter* painter,
const
RBox
& queryBox);
176
virtual
void
paintEntity
(QPainter* painter,
REntity::Id
id
);
177
178
QImage
getBuffer
()
const
;
179
QTransform
getTransform
()
const
;
180
181
virtual
void
emitUpdateSnapInfo
(
RSnap
* snap,
RSnapRestriction
* restriction) {
182
Q_UNUSED(snap)
183
Q_UNUSED(restriction)
184
}
185
virtual
void
emitUpdateTextLabel
(
const
RTextLabel
& textLabel) {
186
Q_UNUSED(textLabel)
187
}
188
virtual
void
emitDecorateBackground
(QPainter* painter) { Q_UNUSED(painter) }
189
virtual
void
emitDecorateForeground
(QPainter* painter) { Q_UNUSED(painter) }
190
191
void
clearBackground
();
192
void
addToBackground
(
const
RPainterPath
& path);
193
void
setBackgroundTransform
(
double
bgFactor,
const
RVector
& bgOffset);
194
195
void
setColorCorrectionOverride
(
bool
on) {
196
colorCorrectionOverride
= on;
197
}
198
199
bool
getColorCorrectionOverride
()
const
{
200
return
colorCorrectionOverride
;
201
}
202
203
void
setTextHeightThresholdOverride
(
int
v) {
204
textHeightThresholdOverride
= v;
205
}
206
207
int
getTextHeightThresholdOverride
()
const
{
208
return
textHeightThresholdOverride
;
209
}
210
211
protected
:
212
virtual
void
paintImage
(QPainter* painter,
RImageData
& image);
213
virtual
void
paintOrigin
(QPaintDevice& device);
214
virtual
void
paintErase
(QPaintDevice& device,
const
QRect& rect = QRect());
215
virtual
void
paintGrid
(QPaintDevice& device,
const
QRect& rect = QRect());
216
virtual
void
paintMetaGrid
(QPaintDevice& device,
const
QRect& rect = QRect());
217
virtual
void
paintCursor
(QPaintDevice& device);
218
virtual
void
paintRelativeZero
(QPaintDevice& device);
219
virtual
void
paintDocument
(
const
QRect& rect = QRect());
220
virtual
void
paintBackground
(QPainter* painter,
const
QRect& rect = QRect());
221
225
QPainter*
initPainter
(QPaintDevice& device,
bool
erase,
bool
screen =
false
,
const
QRect& rect = QRect());
226
227
void
invalidate
(
bool
force=
false
);
228
void
updateGraphicsBuffer
();
229
void
updateTransformation
()
const
;
230
231
protected
:
232
QImage
graphicsBuffer
;
233
QImage
graphicsBufferWithPreview
;
234
235
protected
:
236
bool
panOptimization
;
237
QMutex
mutexSi
;
238
239
RGraphicsSceneQt
*
sceneQt
;
240
double
currentScale
;
241
QSize
lastSize
;
242
RVector
lastOffset
;
243
double
lastFactor
;
244
bool
graphicsBufferNeedsUpdate
;
245
mutable
QTransform
transform
;
246
QTransform
previousView
;
247
248
QPainter*
gridPainter
;
249
bool
doPaintOrigin
;
250
bool
antialiasing
;
251
252
bool
isSelected
;
253
QSet<RObject::Id>
selectedIds
;
254
int
bgColorLightness
;
255
256
bool
colorCorrectionOverride
;
257
bool
colorCorrection
;
258
int
colorThreshold
;
259
260
int
textHeightThresholdOverride
;
261
int
textHeightThreshold
;
262
263
double
drawingScale
;
264
265
QList<RPainterPath>
backgroundDecoration
;
266
//QTransform backgroundTransform;
267
double
backgroundFactor
;
268
RVector
backgroundOffset
;
269
RBox
clipBox
;
270
};
271
272
Q_DECLARE_METATYPE
(
RGraphicsViewImage
*)
273
274
#endif
src
gui
RGraphicsViewImage.h
Generated on Tue Jun 26 2012 18:41:08 for QCAD Application Framework by
1.8.1.1