Version: 9.15.0
SVTK_ViewModel.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 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 SVTK_VIEWMODEL_H
24 #define SVTK_VIEWMODEL_H
25 
26 #include "SVTK.h"
27 #include "SVTK_ViewModelBase.h"
28 #include "SVTK_Selection.h"
29 
30 #include "Qtx.h"
31 
32 #include <SALOME_Prs.h>
34 #include <SALOME_ListIO.hxx>
35 
36 #include <QColor>
37 #include <QMap>
38 
39 class QMouseEvent;
40 
41 class SVTK_ViewWindow;
42 class VTKViewer_Actor;
43 
46 {
47  Q_OBJECT
48 
49 public:
51  enum {
60  LastGradient = FourthCornerGradient,
61  };
62 
63  enum {
64  CrystalEyesType, RedBlueType,
65  InterlacedType, LeftType,
66  RightType, DresdenType,
67  AnaglyphType, CheckerboardType,
68  SplitViewPortHorizontalType
69  };
71 
73  static QString Type() { return "VTKViewer"; }
74  static QString backgroundData( QStringList&, QIntList&, QIntList& );
75  static void stereoData( QStringList&, QIntList&);
76 
77  SVTK_Viewer();
78  virtual ~SVTK_Viewer();
79 
82 
84  virtual void setViewManager(SUIT_ViewManager* theViewManager);
85 
87  virtual void contextMenuPopup( QMenu* );
88 
90  virtual QString getType() const { return Type(); }
91 
93  QColor backgroundColor() const;
94 
96  void setBackgroundColor( const QColor& );
97 
99  Qtx::BackgroundData background() const;
100 
102  void setBackground( const Qtx::BackgroundData& );
103 
105  double trihedronSize() const;
106 
108  bool trihedronRelative() const;
109 
111  void setTrihedronSize( const double, const bool = true );
112 
114  void setTrihedronTextColor();
115 
117  bool isStaticTrihedronVisible() const;
118 
120  void setStaticTrihedronVisible( const bool );
121 
123  void setStaticTrihedronTextColor();
124 
126  int projectionMode() const;
127 
129  void setProjectionMode( const int );
130 
132  int stereoType() const;
133 
135  void setStereoType( const int );
136 
138  int anaglyphFilter() const;
139 
141  void setAnaglyphFilter( const int );
142 
144  bool isQuadBufferSupport() const;
145 
147  void setQuadBufferSupport( const bool );
148 
150  int interactionStyle() const;
151 
153  void setInteractionStyle( const int );
154 
156  int zoomingStyle() const;
157 
159  void setZoomingStyle( const int );
160 
162  Preselection_Mode preSelectionMode() const;
163 
165  void setPreSelectionMode( Preselection_Mode );
166 
168  int incrementalSpeed() const;
169 
171  int incrementalSpeedMode() const;
172 
174  void setIncrementalSpeed( const int, const int = 0 );
175 
177  int spacemouseBtn( const int ) const;
178 
180  void setSpacemouseButtons( const int, const int, const int );
181 
182 public:
183  void enableSelection(bool isEnabled);
184  bool isSelectionEnabled() const { return mySelectionEnabled; }
185 
186  void enableMultiselection(bool isEnable);
187  bool isMultiSelectionEnabled() const { return myMultiSelectionEnabled; }
188 
189  int getSelectionCount() const;
190 
191  /* Reimplemented from SALOME_View */
192 
194  void Display( const SALOME_VTKPrs* );
195 
197  void Erase( const SALOME_VTKPrs*, const bool = false );
198 
200  void EraseAll( SALOME_Displayer*, const bool = false );
201 
203  virtual void GetVisible( SALOME_ListIO& );
204 
206  SALOME_Prs* CreatePrs( const char* entry = 0 );
207 
209  virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
210 
212  virtual void Repaint();
213 
214  signals:
217 
218 protected slots:
219  void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
220  void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
221  void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
222 
223  void onDumpView();
224  void onChangeBackground();
225 
226  void onActorAdded(VTKViewer_Actor*);
227  void onActorRemoved(VTKViewer_Actor*);
228 
229  void onViewCreated( SUIT_ViewWindow* );
230 
231 private:
233 
246  int myStyle;
249  int mySpaceBtn[3];
250 };
251 
252 #endif
Handle(TDocStd_Application) CAF_Application
Get OCAF application.
Definition: CAF_Application.cxx:97
QList< int > QIntList
list of int values
Definition: Qtx.h:55
#define SVTK_EXPORT
Definition: SVTK.h:37
int Preselection_Mode
Preselection modes.
Definition: SVTK_Selection.h:45
Stores background data.
Definition: Qtx.h:178
Definition: SALOME_Prs.h:366
Definition: SALOME_ListIO.hxx:29
Definition: SALOME_Prs.h:53
Definition: SALOME_Prs.h:160
Definition: SALOME_Prs.h:292
virtual bool isVisible(const Handle(SALOME_InteractiveObject)&)
Definition: SALOME_Prs.h:356
virtual SALOME_Prs * CreatePrs(const char *=0)
Creates empty presentation of corresponding type.
Definition: SALOME_Prs.h:344
virtual void GetVisible(SALOME_ListIO &)
Definition: SALOME_Prs.h:358
void Erase(SALOME_Displayer *, const SALOME_Prs *, const bool=false)
This Erase() method should be called to erase given presentation created anywhere by anybody.
Definition: SALOME_Prs.cxx:340
void Display(SALOME_Displayer *, const SALOME_Prs *)
This Display() method should be called to display given presentation created anywhere by anybody.
Definition: SALOME_Prs.cxx:331
virtual void Repaint()
Null body here.
Definition: SALOME_Prs.h:357
virtual void EraseAll(SALOME_Displayer *, const bool=false)
This EraseAll() method should be called to erase all presentations created anywhere by anybody.
Definition: SALOME_Prs.cxx:431
Definition: SUIT_Desktop.h:47
Definition: SUIT_ViewManager.h:50
virtual void contextMenuPopup(QMenu *)
Definition: SUIT_ViewModel.h:69
virtual SUIT_ViewWindow * createView(SUIT_Desktop *theDesktop)
Definition: SUIT_ViewModel.cxx:77
virtual void setViewManager(SUIT_ViewManager *theViewManager)
Definition: SUIT_ViewModel.cxx:85
Definition: SUIT_ViewWindow.h:42
To define minimal interface for SVTK_ViewWindow initialization.
Definition: SVTK_ViewModelBase.h:34
Define a container for SALOME VTK view window.
Definition: SVTK_ViewWindow.h:86
Extends two interfaces SVTK_ViewModelBase and SALOME_View.
Definition: SVTK_ViewModel.h:46
bool myMultiSelectionEnabled
Definition: SVTK_ViewModel.h:239
bool isMultiSelectionEnabled() const
Definition: SVTK_ViewModel.h:187
@ CrystalEyesType
Definition: SVTK_ViewModel.h:64
@ DresdenType
Definition: SVTK_ViewModel.h:66
@ InterlacedType
Definition: SVTK_ViewModel.h:65
@ AnaglyphType
Definition: SVTK_ViewModel.h:67
Preselection_Mode myPreSelectionMode
Definition: SVTK_ViewModel.h:248
bool myTrihedronRelative
Definition: SVTK_ViewModel.h:236
bool isSelectionEnabled() const
Definition: SVTK_ViewModel.h:184
int myAnaglyphFilter
Definition: SVTK_ViewModel.h:244
void updateToolBars()
@ HorizontalGradient
Definition: SVTK_ViewModel.h:52
@ FourthCornerGradient
Definition: SVTK_ViewModel.h:59
@ SecondCornerGradient
Definition: SVTK_ViewModel.h:57
@ FirstCornerGradient
Definition: SVTK_ViewModel.h:56
@ FirstDiagonalGradient
Definition: SVTK_ViewModel.h:54
@ SecondDiagonalGradient
Definition: SVTK_ViewModel.h:55
@ VerticalGradient
Definition: SVTK_ViewModel.h:53
@ ThirdCornerGradient
Definition: SVTK_ViewModel.h:58
static QString Type()
Define string representation of the viewer type.
Definition: SVTK_ViewModel.h:73
int myIncrementSpeed
Definition: SVTK_ViewModel.h:240
int getSelectionCount() const
virtual QString getType() const
See SUIT_ViewModel::getType.
Definition: SVTK_ViewModel.h:90
bool myIsStaticTrihedronVisible
Definition: SVTK_ViewModel.h:237
int myStereoType
Definition: SVTK_ViewModel.h:243
void actorRemoved(SVTK_ViewWindow *, VTKViewer_Actor *)
int myProjMode
Definition: SVTK_ViewModel.h:242
int myIncrementMode
Definition: SVTK_ViewModel.h:241
int myStyle
Definition: SVTK_ViewModel.h:246
SVTK_ViewWindow TViewWindow
Definition: SVTK_ViewModel.h:70
void actorAdded(SVTK_ViewWindow *, VTKViewer_Actor *)
bool myQuadBufferSupport
Definition: SVTK_ViewModel.h:245
int myZoomingStyle
Definition: SVTK_ViewModel.h:247
bool mySelectionEnabled
Definition: SVTK_ViewModel.h:238
Qtx::BackgroundData myDefaultBackground
Definition: SVTK_ViewModel.h:234
double myTrihedronSize
Definition: SVTK_ViewModel.h:235
Definition: VTKViewer_Actor.h:79
int Type
Definition: VTKViewer_Actor.h:62