Salome HOME
PR: merge from tag BR_CCRT2_mergeto_V2_1_0b1
[modules/kernel.git] / src / OCCViewer / OCCViewer_ViewFrame.h
index 918c9e117ce42a6d723b3d1475903b26bce00eae..42b3c0685ff07ace1318b84245de1abd2593d975 100644 (file)
 //  File   : OCCViewer_ViewFrame.h
 //  Author : Nicolas REJNERI
 //  Module : SALOME
-//  $Header$
+//  $Header$           
 
 #ifndef OCCViewer_ViewFrame_H
 #define OCCViewer_ViewFrame_H
 
 #include "OCCViewer_ViewPort.h"
 #include "QAD_ViewFrame.h"
+#include "SALOME_Selection.h"
 
 class OCCViewer_Viewer3d;
+
+/*
+  Class       : OCCViewer_ViewFrame
+  Description : View frame for Open CASCADE view
+*/
+
 class QAD_EXPORT OCCViewer_ViewFrame : public QAD_ViewFrame
 {
   Q_OBJECT
 
- public:
-  OCCViewer_ViewFrame(QWidget* parent, const QString& title);
-  OCCViewer_ViewFrame(QWidget* parent = 0);
-  virtual ~OCCViewer_ViewFrame();
-
- protected:
-  virtual void     initViewPort();
-  void              initialize();
-  void              cleanup();
-
- public:
-  ViewType          getTypeView() const{ return VIEW_OCC;};
-  QWidget*          getViewWidget();
-  void              setViewPort(OCCViewer_ViewPort* view);
-  OCCViewer_ViewPort*      getViewPort() const;
-
-  void             setViewer(OCCViewer_Viewer3d* viewer);
-  OCCViewer_Viewer3d*     getViewer() const;
+public:
 
-  void              setVisible( bool isVisible = true );
+                              OCCViewer_ViewFrame( QWidget* parent, const QString& title );
+                              OCCViewer_ViewFrame( QWidget* parent = 0 );
+  virtual                     ~OCCViewer_ViewFrame();
 
-  void              setBackgroundColor( const QColor& );
-  QColor            backgroundColor() const;
+  /*
+    Reimplemented from QAD_ViewFrame
+  */
 
-  void              setCursor( const QCursor& );
-  QCursor           cursor() const;
-
-  void              SetSelectionMode( int mode ) {};
-
-  void              SetTrihedronSize( int dim );
+  virtual ViewType            getTypeView() const { return VIEW_OCC; }
+  virtual QWidget*            getViewWidget();
+  virtual void                setBackgroundColor( const QColor& );
+  virtual QColor              backgroundColor() const;
+  virtual void                SetSelectionMode( Selection_Mode mode ) {};
 
   /*  popup management */
-  void              setPopupServer( QAD_Application* );
-
+  
+  virtual void                setPopupServer( QAD_Application* );
 
   /*  interactive object management */
-  void              highlight( const Handle(SALOME_InteractiveObject)& IObject, 
-                              bool highlight, bool update = true );
-  void              unHighlightAll();
-  void              rename( const Handle(SALOME_InteractiveObject)& IObject,
-                           QString newName );
-  bool              isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
-  bool              isVisible( const Handle(SALOME_InteractiveObject)& IObject );
+
+  virtual void                highlight( const Handle(SALOME_InteractiveObject)&,
+                                         const bool highlight,
+                                         const bool update = true );
+  virtual void                unHighlightAll();
+  virtual void                rename( const Handle(SALOME_InteractiveObject)&,
+                                      QString );
+  virtual bool                isInViewer( const Handle(SALOME_InteractiveObject)& );
+  virtual bool                isVisible( const Handle(SALOME_InteractiveObject)& );
 
   /*  undo/redo management */
-  void              undo(SALOMEDS::Study_var aStudy,
-                        const char* StudyFrameEntry);
-  void              redo(SALOMEDS::Study_var aStudy,
-                        const char* StudyFrameEntry);
+  
+  void                        undo( QAD_Study* aStudy, const char* StudyFrameEntry );
+  void                        redo( QAD_Study* aStudy, const char* StudyFrameEntry );
 
   /* selection */
-  Handle(SALOME_InteractiveObject) FindIObject(const char* Entry);
-
-  /* display */                
-  void           Display(const Handle(SALOME_InteractiveObject)& IObject, bool update = true);
-  void           DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject);
-  void           Erase(const Handle(SALOME_InteractiveObject)& IObject, bool update = true);
-  void           DisplayAll();
-  void           EraseAll();
-  void           Repaint();
-
- protected:    
-  void              closeEvent(QCloseEvent* e);
-  void              resizeEvent(QResizeEvent* e);
-  void              keyPressEvent( QKeyEvent *k );
-
- signals:
-  void              vfTransformationStarted ( OCCViewer_ViewPort::OperationType );
-  void              vfTransformationFinished( OCCViewer_ViewPort::OperationType );
-  void              vfDrawExternal(QPainter* painter);
-  void              vfMousePress(QMouseEvent*);
-  void              vfMouseRelease(QMouseEvent*);
-  void              vfMouseMove(QMouseEvent*);
-  void              vfMouseDoubleClick(QMouseEvent*);
-  void              vfKeyPress(QKeyEvent*);
-  void              vfKeyRelease(QKeyEvent*);
-  void              vfResize(QResizeEvent*);
-  void              vfPrint(QPaintEvent*);
-  void              vfViewClosing(QCloseEvent*);
-  void              vfMoved (QMoveEvent*);
-
-  public slots:
-
-  void           onViewPan(); 
-  void           onViewZoom();
-  void           onViewFitAll();
-  void           onViewFitArea();
-  void           onViewGlobalPan(); 
-  void           onViewRotate();
-  void           onViewReset();     
-  void           onViewFront(); 
-  void           onViewBack(); 
-  void           onViewRight(); 
-  void           onViewLeft();     
-  void           onViewBottom();
-  void           onViewTop();
-  void           onViewTrihedron(); 
+  
+  virtual Handle(SALOME_InteractiveObject) FindIObject( const char* Entry );
+
+  /* display */
+  virtual void                Display( const Handle(SALOME_InteractiveObject)&,
+                                       bool update = true);
+  virtual void                DisplayOnly( const Handle(SALOME_InteractiveObject)& );
+  virtual void                Erase( const Handle(SALOME_InteractiveObject)&,
+                                     bool update = true);
+  virtual void                DisplayAll();
+  virtual void                EraseAll();
+  virtual void                Repaint();
+
+  void                        AdjustTrihedrons( const bool forced  = false );
+
+  /* Reimplemented from SALOME_View */
+  
+  virtual void                Display( const SALOME_OCCPrs* );
+  virtual void                Erase( const SALOME_OCCPrs*, const bool = false );
+  virtual SALOME_Prs*         CreatePrs( const char* entry = 0 );
+  virtual void                BeforeDisplay( SALOME_Displayer* d );
+  virtual void                AfterDisplay ( SALOME_Displayer* d );
+  virtual void                LocalSelection( const SALOME_OCCPrs*, const int );
+  virtual void                GlobalSelection( const bool = false ) const;
+
+  /* Own public methods */
+  
+  void                        setViewPort( OCCViewer_ViewPort* );
+  OCCViewer_ViewPort*         getViewPort() const;
+
+  void                        setViewer( OCCViewer_Viewer3d* );
+  OCCViewer_Viewer3d*         getViewer() const;
+
+  void                        setVisible( const bool isVisible = true );
+
+  void                        setCursor( const QCursor& );
+  QCursor                     cursor() const;
+
+signals:
+
+  void                        vfTransformationStarted ( OCCViewer_ViewPort::OperationType );
+  void                        vfTransformationFinished( OCCViewer_ViewPort::OperationType );
+  void                        vfDrawExternal( QPainter* painter );
+  void                        vfMousePress( QMouseEvent* );
+  void                        vfMouseRelease( QMouseEvent* );
+  void                        vfMouseMove( QMouseEvent* );
+  void                        vfMouseDoubleClick( QMouseEvent* );
+  void                        vfKeyPress( QKeyEvent* );
+  void                        vfKeyRelease( QKeyEvent* );
+  void                        vfResize( QResizeEvent* );
+  void                        vfPrint( QPaintEvent* );
+  void                        vfViewClosing( QCloseEvent* );
+  void                        vfMoved ( QMoveEvent* );
+
+public slots:
+
+  void                        onViewPan();
+  void                        onViewZoom();
+  void                        onViewFitAll();
+  void                        onViewFitArea();
+  void                        onViewGlobalPan();
+  void                        onViewRotate();
+  void                        onViewReset();
+  void                        onViewFront();
+  void                        onViewBack();
+  void                        onViewRight();
+  void                        onViewLeft();
+  void                        onViewBottom();
+  void                        onViewTop();
+  void                        onViewTrihedron();
+  void                        onAdjustTrihedron();
+
+protected:
+
+  void                        initViewPort();
+  void                        initialize();
+  void                        cleanup();
+  void                        closeEvent( QCloseEvent* );
+  void                        resizeEvent( QResizeEvent* );
+  void                        keyPressEvent( QKeyEvent * );
+private:
+
+  bool                        getTrihedronSize( double& theNewSize, double& theSize );
+  void                        redisplayAll( QAD_Study*, const bool = true );
  
- protected:
-  OCCViewer_Viewer3d*      myViewer;    // my owner
-  OCCViewer_ViewPort*      myViewPort; // child viewport
+private:
+
+  OCCViewer_Viewer3d*         myViewer;         // my owner
+  OCCViewer_ViewPort*         myViewPort; // child viewport
 };
 
 #endif