Version: 9.16.0
OCCViewer_ViewPort.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, 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#ifndef OCCVIEWER_VIEWPORT_H
24#define OCCVIEWER_VIEWPORT_H
25
26#include "OCCViewer.h"
27
28#include "QtxAction.h"
29
30#include <QList>
31#include <QWidget>
32
33#include <Aspect_Window.hxx>
34
35class QColor;
36class QRect;
37class QPainter;
39
40#ifdef WIN32
41#pragma warning ( disable:4251 )
42#endif
43
49{
50 Q_OBJECT
51
53
54public:
55 OCCViewer_ViewPort( QWidget* parent );
56 virtual ~OCCViewer_ViewPort();
57
58public:
59 void setSketchingEnabled( bool );
60 bool isSketchingEnabled() const;
61 void setTransformEnabled( bool );
62 bool isTransformEnabled() const;
63
64 virtual QColor backgroundColor() const;
65 virtual void setBackgroundColor( const QColor& );
66
67 void redrawPainters();
68
69 virtual void onUpdate();
70
71 virtual QPaintEngine* paintEngine() const;
72
73protected:
74// enum ViewType { Type2D, Type3D };
75 void selectVisualId();
76
77// EVENTS
78 virtual void paintEvent( QPaintEvent *);
79 virtual void mouseMoveEvent( QMouseEvent *);
80 virtual void mouseReleaseEvent( QMouseEvent *);
81 virtual void mousePressEvent( QMouseEvent *);
82 virtual void mouseDoubleClickEvent( QMouseEvent *);
83 virtual void keyPressEvent( QKeyEvent *);
84 virtual void keyReleaseEvent( QKeyEvent *);
85
86// TO BE REDEFINED
87 virtual void reset() = 0;
88 virtual void pan( int, int ) = 0;
89 virtual void setCenter( int, int ) = 0;
90 virtual void fitRect( const QRect& ) = 0;
91 virtual void zoom( int, int, int, int ) = 0;
92 virtual void fitAll( bool keepScale = false, bool withZ = true, bool upd = true ) = 0;
93
94public slots:
95 virtual bool synchronize( OCCViewer_ViewPort* );
96
97protected slots:
98 virtual void onChangeBackground();
99
100signals:
101 void vpKeyEvent( QKeyEvent* );
102 void vpMouseEvent( QMouseEvent* );
103 void vpDrawExternal( QPainter* );
104 void vpChangeBGColor( QColor );
106
107private:
108 void initialize();
109 void cleanup();
110
111protected:
112 Handle(Aspect_Window) myWindow;
115 bool myPaintersRedrawing; /* set to draw externally */
117
118private:
119 static int nCounter; /* objects counter */
120};
121
122#ifdef WIN32
123#pragma warning ( default:4251 )
124#endif
125
126#endif
#define OCCVIEWER_EXPORT
Definition: OCCViewer.h:33
TrgItem synchronize(const SrcItem &, const TrgItem &, const TreeData &)
Synchronize two data trees by recurive comparing of the corresponding items.
Definition: SUIT_TreeSync.h:118
Definition: OCCViewer_ViewPort.h:49
Handle(Aspect_Window) myWindow
virtual void setCenter(int, int)=0
bool myEnableTransform
Definition: OCCViewer_ViewPort.h:114
void vpChangeBGColor(QColor)
virtual void fitRect(const QRect &)=0
static int nCounter
Definition: OCCViewer_ViewPort.h:119
void vpMouseEvent(QMouseEvent *)
void vpDrawExternal(QPainter *)
virtual void reset()=0
QList< QtxAction * > myPopupActions
Definition: OCCViewer_ViewPort.h:116
virtual void fitAll(bool keepScale=false, bool withZ=true, bool upd=true)=0
virtual void pan(int, int)=0
virtual void zoom(int, int, int, int)=0
void vpTransformed(OCCViewer_ViewPort *)
bool myPaintersRedrawing
Definition: OCCViewer_ViewPort.h:115
void vpKeyEvent(QKeyEvent *)
bool myEnableSketching
Definition: OCCViewer_ViewPort.h:113
Definition: OCCViewer_ViewSketcher.h:47