Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/gui.git] / src / SOCC / SOCC_ViewModel.h
1 //  Copyright (C) 2007-2008  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.
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 #ifndef SOCC_VIEWMODEL_H
23 #define SOCC_VIEWMODEL_H
24
25 #ifdef WIN32
26 #pragma warning( disable:4251 )
27 #endif
28
29 #include "SOCC.h"
30 #include "SALOME_Prs.h"
31 #include "OCCViewer_ViewModel.h"
32
33 class Handle(SALOME_InteractiveObject);
34
35 class SOCC_EXPORT SOCC_Viewer: public OCCViewer_Viewer, public SALOME_View
36 {
37   Q_OBJECT
38
39 public:
40   SOCC_Viewer( bool DisplayTrihedron = true );
41   virtual ~SOCC_Viewer();
42
43   /* Selection management */
44   bool      highlight( const Handle(SALOME_InteractiveObject)&, bool, bool=true );
45   bool      isInViewer( const Handle(SALOME_InteractiveObject)&, bool=false );
46
47   void      setColor( const Handle(SALOME_InteractiveObject)&, const QColor&, bool=true );
48   void      switchRepresentation( const Handle(SALOME_InteractiveObject)&, int, bool=true );
49   void      setTransparency( const Handle(SALOME_InteractiveObject)&, float, bool=true );
50
51   void      rename( const Handle(SALOME_InteractiveObject)&, const QString& );
52
53   virtual   SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
54
55   /* Reimplemented from SALOME_View */
56   virtual void                Display( const SALOME_OCCPrs* );
57   virtual void                Erase( const SALOME_OCCPrs*, const bool = false );
58   virtual void                EraseAll( const bool = false );
59   virtual SALOME_Prs*         CreatePrs( const char* entry = 0 );
60   virtual void                BeforeDisplay( SALOME_Displayer* d );
61   virtual void                AfterDisplay ( SALOME_Displayer* d );
62   virtual void                LocalSelection( const SALOME_OCCPrs*, const int );
63   virtual void                GlobalSelection( const bool = false ) const;
64   virtual bool                isVisible( const Handle(SALOME_InteractiveObject)& );
65   virtual void                Repaint();
66
67   // a utility function, used by SALOME_View_s methods
68   bool                        getTrihedronSize( double& theNewSize, double& theSize );
69
70 };
71
72 #ifdef WIN32
73 #pragma warning( default:4251 )
74 #endif
75
76 #endif