Version: 8.3.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
GLViewer_ViewPort2d.h
Go to the documentation of this file.
1
// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2
//
3
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5
//
6
// This library is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU Lesser General Public
8
// License as published by the Free Software Foundation; either
9
// version 2.1 of the License, or (at your option) any later version.
10
//
11
// This library is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
// Lesser General Public License for more details.
15
//
16
// You should have received a copy of the GNU Lesser General Public
17
// License along with this library; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
//
20
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21
//
22
23
// Author : OPEN CASCADE
24
// File: GLViewer_ViewPort2d.h
25
// Created: November, 2004
26
//
27
#ifndef GLVIEWER_VIEWPORT2D_H
28
#define GLVIEWER_VIEWPORT2D_H
29
30
#ifdef WIN32
31
#include <windows.h>
32
#endif
33
34
#ifdef __APPLE__
35
#include <OpenGL/gl.h>
36
#include <OpenGL/glu.h>
37
#else
38
#include <GL/gl.h>
39
#include <GL/glu.h>
40
#endif
41
42
#include "
GLViewer_ViewPort.h
"
43
#include "
GLViewer_Widget.h
"
44
#include "
GLViewer_Geom.h
"
45
46
#include <QtOpenGL>
47
#include <QColor>
48
#include <QPaintDevice>
49
50
#ifdef WIN32
51
#pragma warning( disable:4251 )
52
#endif
53
54
class
GLViewer_Compass
;
55
class
GLViewer_Grid
;
56
class
GLViewer_Object
;
57
class
GLViewer_ViewFrame
;
58
59
class
QtxToolTip
;
60
61
class
QWidget
;
62
class
QRubberBand;
63
68
class
GLViewer_ViewPort2d
:
public
GLViewer_ViewPort
69
{
70
Q_OBJECT
71
73
enum
vpDragState
{
noDrag
,
initDrag
,
inDrag
};
74
75
public
:
76
GLViewer_ViewPort2d
(
QWidget
* parent,
GLViewer_ViewFrame
* theViewFrame = NULL );
77
~GLViewer_ViewPort2d
();
78
80
void
turnGrid
( GLboolean on );
82
GLViewer_Grid
*
getGrid
()
const
{
return
myGrid
; }
84
void
setGridColor
(
const
QColor gridColor,
const
QColor axisColor );
85
87
GLViewer_ViewFrame
*
getViewFrame
()
const
{
return
myViewFrame
; }
89
GLViewer_Widget
*
getGLWidget
()
const
{
return
myGLWidget
; }
90
virtual
QPaintDevice*
getPaintDevice
() {
return
myGLWidget
; }
91
93
void
setBackgroundColor
(
const
QColor&
color
);
95
QColor
backgroundColor
()
const
;
96
98
void
setBorder
(
GLViewer_Rect
* border ) {
myBorder
= border; }
100
GLViewer_Rect
*
getBorder
()
const
{
return
myBorder
; }
101
103
void
setMargin
( GLfloat margin ) {
myMargin
= margin; }
105
GLfloat
getMargin
()
const
{
return
myMargin
; }
106
108
int
getWidth
()
const
{
return
myWidth
; }
110
int
getHeight
()
const
{
return
myHeight
; }
111
112
114
void
getScale
( GLfloat& xSc, GLfloat& ySc )
const
{ xSc =
myXScale
; ySc =
myYScale
; }
116
void
getPan
( GLfloat& xPan, GLfloat& yPan )
const
{ xPan =
myXPan
; yPan =
myYPan
; }
117
119
void
initResize
(
int
width,
int
height );
120
122
void
startRotation
(
int
,
int
);
124
void
rotate
(
int
,
int
);
126
void
endRotation
();
127
129
bool
isDragProcess
(){
return
myIsDragProcess
; }
130
132
void
turnCompass
( GLboolean on );
134
void
drawCompass
();
135
137
int
getViewPortId
(){
return
myViewPortId
; }
138
140
virtual
BlockStatus
currentBlock
();
141
143
void
startSelectByRect
(
int
x,
int
y );
145
void
drawSelectByRect
(
int
x,
int
y );
147
void
finishSelectByRect
();
148
150
bool
startPulling
(
GLViewer_Pnt
);
152
void
drawPulling
(
GLViewer_Pnt
);
154
void
finishPulling
();
156
bool
isPulling
()
const
{
return
myIsPulling
; }
157
159
QRect
selectionRect
();
160
162
GLViewer_Rect
win2GLV
(
const
QRect& )
const
;
164
QRect
GLV2win
(
const
GLViewer_Rect
& )
const
;
165
166
signals:
168
void
vpUpdateValues
();
169
170
void
objectMoved
();
171
172
protected
:
173
void
onDragObject
( QMouseEvent* );
174
175
virtual
void
mouseMoveEvent
( QMouseEvent *);
176
virtual
void
mousePressEvent
( QMouseEvent *);
177
virtual
void
mouseReleaseEvent
( QMouseEvent *);
178
virtual
void
mouseDoubleClickEvent
( QMouseEvent *);
179
180
virtual
void
paintEvent
( QPaintEvent* );
181
virtual
void
resizeEvent
( QResizeEvent* );
182
184
virtual
void
reset
();
186
virtual
void
pan
(
int
dx,
int
dy );
188
virtual
void
setCenter
(
int
x,
int
y );
190
virtual
void
zoom
(
int
x0,
int
y0,
int
x1,
int
y1 );
192
virtual
void
fitRect
(
const
QRect& );
194
virtual
void
fitSelect
();
196
virtual
void
fitAll
(
bool
keepScale =
false
,
bool
withZ =
true
);
197
198
protected
slots:
200
void
onStartDragObject
();
202
void
onPasteObject
();
204
void
onCutObject
();
206
void
onCopyObject
();
207
209
void
onMaybeTip
( QPoint thePoint, QString& text, QFont& font, QRect& theTextReg, QRect& theViewReg );
210
211
protected
:
212
GLViewer_ViewFrame
*
myViewFrame
;
213
GLViewer_Widget
*
myGLWidget
;
214
GLViewer_Rect
*
myBorder
;
215
QColor
myBackgroundColor
;
216
217
GLfloat
myMargin
;
218
int
myHeight
;
219
int
myWidth
;
220
221
GLfloat
myXScale
;
222
GLfloat
myYScale
;
223
GLfloat
myXOldScale
;
224
GLfloat
myYOldScale
;
225
GLfloat
myXPan
;
226
GLfloat
myYPan
;
227
228
GLViewer_Grid
*
myGrid
;
229
GLViewer_Compass
*
myCompass
;
230
231
//dragging
232
int
myIsDragProcess
;
233
float
*
myCurDragPosX
;
234
float
*
myCurDragPosY
;
235
236
//selection by rect
237
QPoint*
mypFirstPoint
;
238
QPoint*
mypLastPoint
;
239
240
//pulling
241
bool
myIsPulling
;
242
GLViewer_Object
*
myPullingObject
;
243
244
int
myViewPortId
;
245
246
//GLViewer_ObjectTip* myObjectTip;
247
QtxToolTip
*
myObjectTip
;
249
bool
myIsMouseReleaseBlock
;
250
251
QRubberBand*
myRectBand
;
252
};
253
254
#ifdef WIN32
255
#pragma warning ( default:4251 )
256
#endif
257
258
#endif
src
GLViewer
GLViewer_ViewPort2d.h
Copyright © 2007-2017 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS