5 #pragma warning( disable:4251 )
9 #include "SALOME_InteractiveObject.hxx"
13 class vtkActorCollection;
16 class SVTK_MainWindow;
21 //----------------------------------------------------------------------------
22 //! Main purpose of the class is to provide a way to customize #SVTK_MainWindow.
24 This class is initialized by #SVTK_MainWindow and just pass Qt signals from
25 corresponding #SVTK_RenderWindowInteractor of the #SVTK_MainWindow.
26 Its main purpose is to provide a simple and flexible way to customize the #SVTK_MainWindow.
27 So, in your own viewer it is possible to derive new #SVTK_MainWindow and
28 use existing functionality without any modifications.
30 class SVTK_EXPORT SVTK_SignalHandler : public QObject
35 SVTK_SignalHandler(SVTK_MainWindow* theMainWindow);
38 ~SVTK_SignalHandler();
40 //! Get reference to its #SVTK_MainWindow
44 //----------------------------------------------------------------------------
45 //! Redirect the request to #SVTK_MainWindow::Repaint (just for flexibility)
47 Repaint(bool theUpdateTrihedron = true);
49 //----------------------------------------------------------------------------
50 //! Redirect the request to #SVTK_MainWindow::GetRenderer (just for flexibility)
54 //! Redirect the request to #SVTK_MainWindow::getRenderer (just for flexibility)
58 //----------------------------------------------------------------------------
60 void onSelectionChanged();
64 void MouseMove( QMouseEvent* );
65 void MouseButtonPressed( QMouseEvent* );
66 void MouseButtonReleased( QMouseEvent* );
67 void MouseDoubleClicked( QMouseEvent* );
68 void ButtonPressed(const QMouseEvent *event);
69 void ButtonReleased(const QMouseEvent *event);
70 void WheelMoved( QWheelEvent* );
71 void KeyPressed( QKeyEvent* );
72 void KeyReleased( QKeyEvent* );
73 void contextMenuRequested( QContextMenuEvent *e );
74 void selectionChanged();
77 SVTK_MainWindow* myMainWindow;
81 //----------------------------------------------------------------------------
82 //! This class is introduced just for compatibility with old code.
84 This class contains frequantly used functionality in old code.
85 Now, you are supposed to extend existing functionality through
86 writing corresponding functors (see SVTK_Functor.h for example).
88 class SVTK_EXPORT SVTK_View : public SVTK_SignalHandler
93 SVTK_View(SVTK_MainWindow* theMainWindow);
98 /* interactive object management */
99 //! To highlight a VTK presentation with the same #SALOME_InteractiveObject
101 highlight(const Handle(SALOME_InteractiveObject)& IObject,
103 bool immediatly = true);
105 //! To unhighlight all VTK presentations
109 /* Selection Management */
110 Handle(SALOME_InteractiveObject)
111 FindIObject(const char* Entry);
113 //! Check, if the viewer contains a presentatin with defined #SALOME_InteractiveObject
115 isInViewer(const Handle(SALOME_InteractiveObject)& IObject);
117 //! Check, if a presentatin with defined #SALOME_InteractiveObject is visible
119 isVisible(const Handle(SALOME_InteractiveObject)& IObject);
122 rename(const Handle(SALOME_InteractiveObject)& IObject,
123 const QString& newName);
125 //----------------------------------------------------------------------------
126 // Displaymode management
127 //! Get current display mode (obsolete)
131 //! Set current display mode
135 //! Switch representation wireframe/shading
137 SetDisplayMode(const Handle(SALOME_InteractiveObject)& IObject,
140 //! Change all actors to wireframe
142 ChangeRepresentationToWireframe();
144 //! Change all actors to surface
146 ChangeRepresentationToSurface();
148 //! Change to wireframe a list of vtkactor
150 ChangeRepresentationToWireframe(vtkActorCollection* theListofActors);
152 //! Change to surface a list of vtkactor
154 ChangeRepresentationToSurface(vtkActorCollection* theListofActors);
156 //! Change transparency
158 SetTransparency(const Handle(SALOME_InteractiveObject)& theIObject,
161 //! Get current transparency
163 GetTransparency(const Handle(SALOME_InteractiveObject)& theIObject);
167 SetColor(const Handle(SALOME_InteractiveObject)& theIObject,
168 const QColor& theColor);
170 //! Get current color
172 GetColor(const Handle(SALOME_InteractiveObject)& theIObject);
174 //----------------------------------------------------------------------------
175 // Erase Display functions
176 //! To erase all existing VTK presentations
180 //! To display all existing VTK presentations
184 //! To remove from the view all existing VTK presentations
186 RemoveAll( const bool immediatly );
188 //! To erase VTK presentation with defined #SALOME_InteractiveObject
190 Erase(const Handle(SALOME_InteractiveObject)& IObject,
191 bool immediatly = true);
193 Remove(const Handle(SALOME_InteractiveObject)& IObject,
194 bool immediatly = true);
196 //! To display VTK presentation with defined #SALOME_InteractiveObject
198 Display(const Handle(SALOME_InteractiveObject)& IObject,
199 bool immediatly = true);
201 //! To display VTK presentation with defined #SALOME_InteractiveObject and erase all anothers
203 DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject);
205 //! To display the VTK presentation
207 Display(SALOME_Actor* SActor,
208 bool immediatly = true);
210 //! To erase the VTK presentation
212 Erase(SALOME_Actor* SActor,
213 bool immediatly = true);
215 //! To remove the VTK presentation
217 Remove(SALOME_Actor* SActor,
218 bool updateViewer = true);
220 //----------------------------------------------------------------------------
221 //! Redirect the request to #SVTK_Renderer::SetPreselectionProp
223 SetSelectionProp(const double& theRed = 1,
224 const double& theGreen = 1,
225 const double& theBlue = 0,
226 const int& theWidth = 5);
228 //! Redirect the request to #SVTK_Renderer::SetPreselectionProp
230 SetPreselectionProp(const double& theRed = 0,
231 const double& theGreen = 1,
232 const double& theBlue = 1,
233 const int& theWidth = 5);
235 //! Redirect the request to #SVTK_Renderer::SetPreselectionProp
237 SetSelectionTolerance(const double& theTolNodes = 0.025,
238 const double& theTolCell = 0.001);
245 #pragma warning( default:4251 )