1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 #ifndef SVTK_VIEWMODEL_H
20 #define SVTK_VIEWMODEL_H
23 #include "SUIT_ViewModel.h"
24 #include "SVTK_ViewModelBase.h"
26 #include "SALOME_Prs.h"
27 #include "SALOME_InteractiveObject.hxx"
31 class SVTK_ViewWindow;
33 //! Extends two interfaces #SVTK_ViewModelBase and #SALOME_View
34 class SVTK_EXPORT SVTK_Viewer : public SVTK_ViewModelBase, public SALOME_View
39 typedef SVTK_ViewWindow TViewWindow;
41 //! Define string representation of the viewer type
42 static QString Type() { return "VTKViewer"; }
45 virtual ~SVTK_Viewer();
47 //! See #SUIT_ViewModel::createView
48 virtual SUIT_ViewWindow* createView(SUIT_Desktop*);
50 //! See #SUIT_ViewModel::createView
51 virtual void setViewManager(SUIT_ViewManager* theViewManager);
53 //! See #SUIT_ViewModel::contextMenuPopup
54 virtual void contextMenuPopup( QPopupMenu* );
56 //! See #SUIT_ViewModel::getType
57 virtual QString getType() const { return Type(); }
59 //! Get background color of the viewer
60 QColor backgroundColor() const;
62 //! Set background color to the viewer
63 void setBackgroundColor( const QColor& );
65 //! Get size of trihedron of the viewer (see #SVTK_Renderer::SetTrihedronSize)
66 int trihedronSize() const;
68 //! Shows if the size of trihedron relative (see #SVTK_Renderer::SetTrihedronSize)
69 bool trihedronRelative() const;
71 //! Set size of trihedron of the viewer (see #SVTK_Renderer::SetTrihedronSize)
72 void setTrihedronSize( const int, const bool = true );
75 void enableSelection(bool isEnabled);
76 bool isSelectionEnabled() const { return mySelectionEnabled; }
78 void enableMultiselection(bool isEnable);
79 bool isMultiSelectionEnabled() const { return myMultiSelectionEnabled; }
81 int getSelectionCount() const;
83 /* Reimplemented from SALOME_View */
85 //! See #SALOME_View::Display( const SALOME_Prs* )
86 void Display( const SALOME_VTKPrs* );
88 //! See #SALOME_View::Erase( const SALOME_VTKPrs*, const bool = false )
89 void Erase( const SALOME_VTKPrs*, const bool = false );
91 //! See #SALOME_View::EraseAll( const bool = false )
92 void EraseAll( const bool = false );
94 //! See #SALOME_View::CreatePrs( const char* entry = 0 )
95 SALOME_Prs* CreatePrs( const char* entry = 0 );
97 //! See #SALOME_View::BeforeDisplay( SALOME_Displayer* d )
98 virtual void BeforeDisplay( SALOME_Displayer* d );
100 //! See #SALOME_View::AfterDisplay( SALOME_Displayer* d )
101 virtual void AfterDisplay( SALOME_Displayer* d );
103 //! See #SALOME_View::isVisible( const Handle(SALOME_InteractiveObject)& )
104 virtual bool isVisible( const Handle(SALOME_InteractiveObject)& );
106 //! See #SALOME_View::Repaint()
107 virtual void Repaint();
110 void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
111 void onMouseMove(SUIT_ViewWindow*, QMouseEvent*);
112 void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*);
115 void onShowToolbar();
116 void onChangeBgColor();
121 bool myTrihedronRelative;
122 bool mySelectionEnabled;
123 bool myMultiSelectionEnabled;