Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SVTK_ViewModel.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 #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  bool isStaticTrihedronVisible() const;
115 
117  void setStaticTrihedronVisible( const bool );
118 
120  int projectionMode() const;
121 
123  void setProjectionMode( const int );
124 
126  int stereoType() const;
127 
129  void setStereoType( const int );
130 
132  int anaglyphFilter() const;
133 
135  void setAnaglyphFilter( const int );
136 
138  bool isQuadBufferSupport() const;
139 
141  void setQuadBufferSupport( const bool );
142 
144  int interactionStyle() const;
145 
147  void setInteractionStyle( const int );
148 
150  int zoomingStyle() const;
151 
153  void setZoomingStyle( const int );
154 
156  Preselection_Mode preSelectionMode() const;
157 
159  void setPreSelectionMode( Preselection_Mode );
160 
162  int incrementalSpeed() const;
163 
165  int incrementalSpeedMode() const;
166 
168  void setIncrementalSpeed( const int, const int = 0 );
169 
171  int spacemouseBtn( const int ) const;
172 
174  void setSpacemouseButtons( const int, const int, const int );
175 
176 public:
177  void enableSelection(bool isEnabled);
178  bool isSelectionEnabled() const { return mySelectionEnabled; }
179 
180  void enableMultiselection(bool isEnable);
181  bool isMultiSelectionEnabled() const { return myMultiSelectionEnabled; }
182 
183  int getSelectionCount() const;
184 
185  /* Reimplemented from SALOME_View */
186 
188  void Display( const SALOME_VTKPrs* );
189 
191  void Erase( const SALOME_VTKPrs*, const bool = false );
192 
194  void EraseAll( SALOME_Displayer*, const bool = false );
195 
197  virtual void GetVisible( SALOME_ListIO& );
198 
200  SALOME_Prs* CreatePrs( const char* entry = 0 );
201 
203  virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
204 
206  virtual void Repaint();
207 
208  signals:
209  void actorAdded(SVTK_ViewWindow*, VTKViewer_Actor*);
210  void actorRemoved(SVTK_ViewWindow*, VTKViewer_Actor*);
211 
212 protected slots:
213  void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
214  void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
215  void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
216 
217  void onDumpView();
218  void onChangeBackground();
219 
220  void onActorAdded(VTKViewer_Actor*);
221  void onActorRemoved(VTKViewer_Actor*);
222 
223 private:
224  void updateToolBars();
225 
238  int myStyle;
241  int mySpaceBtn[3];
242 };
243 
244 #endif