From 123ee8fcf6124dfef86c5d3d22af6e30280ac260 Mon Sep 17 00:00:00 2001 From: apo Date: Fri, 11 Nov 2005 10:12:04 +0000 Subject: [PATCH] To document the sources --- src/VVTK/VVTK_InteractorStyle.h | 30 +++++++++++++++++------- src/VVTK/VVTK_MainWindow.h | 41 ++++++++++++++++++++++++++------- src/VVTK/VVTK_Renderer.h | 29 +++++++++++++++++++---- src/VVTK/VVTK_ViewManager.h | 5 +++- src/VVTK/VVTK_ViewModel.h | 21 +++++++++++++---- src/VVTK/VVTK_ViewWindow.h | 29 +++++++++++++++++++---- 6 files changed, 125 insertions(+), 30 deletions(-) diff --git a/src/VVTK/VVTK_InteractorStyle.h b/src/VVTK/VVTK_InteractorStyle.h index f180b788..5eaf23e9 100644 --- a/src/VVTK/VVTK_InteractorStyle.h +++ b/src/VVTK/VVTK_InteractorStyle.h @@ -35,22 +35,19 @@ class VISU_PickingSettings; - +//! Introduce new style of interaction (keyboard free) class VVTK_EXPORT VVTK_InteractorStyle : public SVTK_InteractorStyle { public: - // Description: - // This class must be supplied with a vtkRenderWindowInteractor wrapper or - // parent. This class should not normally be instantiated by application - // programmers. static VVTK_InteractorStyle *New(); vtkTypeMacro(VVTK_InteractorStyle,SVTK_InteractorStyle); - // redefined in order to add an observer (callback) for custorm event (space mouse event) + //! Redefined from SVTK_InteractorStyle::SetInteractor in order to add an observer (callback) for custorm event (space mouse event) virtual void SetInteractor( vtkRenderWindowInteractor* ); + //! To share the VISU_PickingSettings void SetPickingSettings(VISU_PickingSettings* thePickingSettings); @@ -62,14 +59,26 @@ class VVTK_EXPORT VVTK_InteractorStyle : public SVTK_InteractorStyle void operator=(const VVTK_InteractorStyle&); // Not implemented // Generic event bindings must be overridden in subclasses + + //! Redefine SVTK_InteractorStyle::OnLeftButtonDown virtual void OnLeftButtonDown(int ctrl, int shift, int x, int y); + + //! Redefine SVTK_InteractorStyle::OnMiddleButtonDown virtual void OnMiddleButtonDown(int ctrl, int shift, int x, int y); + + //! Redefine SVTK_InteractorStyle::OnLeftButtonUp virtual void OnLeftButtonUp(int ctrl, int shift, int x, int y); + + //! Redefine SVTK_InteractorStyle::OnMiddleButtonUp virtual void OnMiddleButtonUp(int ctrl, int shift, int x, int y); + + //! Redefine vtkInteractorStyle::OnKeyDown virtual void OnKeyDown(); + + //! Redefine SVTK_InteractorStyle::onFinishOperation virtual void onFinishOperation(); - // Main process VTK event method + //! Main process VTK event method static void ProcessEvents(vtkObject* object, @@ -77,11 +86,16 @@ class VVTK_EXPORT VVTK_InteractorStyle : public SVTK_InteractorStyle void* clientData, void* callData ); + //! Redefine SVTK_InteractorStyle::onSpaceMouseButton virtual void onSpaceMouseButton( int button ); + + //! To decrease magnification of the Gauss Points void DecreaseGaussPointMagnification(); + + //! To increase magnification of the Gauss Points void IncreaseGaussPointMagnification(); - // SpaceMouse short cuts + //! SpaceMouse short cuts int mySMDecreaseMagnificationBtn; int mySMIncreaseMagnificationBtn; diff --git a/src/VVTK/VVTK_MainWindow.h b/src/VVTK/VVTK_MainWindow.h index 4220d5ce..718bd296 100644 --- a/src/VVTK/VVTK_MainWindow.h +++ b/src/VVTK/VVTK_MainWindow.h @@ -21,26 +21,33 @@ class VVTK_Renderer1; class VVTK_Renderer2; //---------------------------------------------------------------------------- +//! Customize SVTK_MainWindow to provide VVTK functionality class VVTK_EXPORT VVTK_MainWindow: public SVTK_MainWindow { Q_OBJECT; public: + //! Construct instance of the class VVTK_MainWindow(QWidget* theParent, const char* theName, SUIT_ResourceMgr* theResourceMgr); + + //! Reimplement SVTK_MainWindow::Initialize virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor); + //! Destroy instance of the class virtual ~VVTK_MainWindow(); public slots: + //! To change active interactor style at run-time virtual void OnInteractorStyleSwitch(bool theIsGaussStyleOn); + //! To change active selection mode at run-time virtual void OnSelectionModeSwitch(bool theIsSelectionOn); @@ -55,73 +62,91 @@ public: //---------------------------------------------------------------------------- +//! Extend VVTK_MainWindow to implement functionality for base view class VVTK_EXPORT VVTK_MainWindow1: public VVTK_MainWindow { Q_OBJECT; public: + //! Construct instance of the class VVTK_MainWindow1(QSplitter* theParent, const char* theName, SUIT_ResourceMgr* theResourceMgr); + + //! Reimplement VVTK_MainWindow::Initialize virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor, VVTK_Renderer1* theRenderer); - + //! Destroy instance of the class virtual ~VVTK_MainWindow1(); + //! Create instance of the segmented VVTK_MainWindow + /*! + The two views (VVTK_MainWindow1 and VVTK_MainWindow2) should change its behaviour in the same time. + So, it is necessary to synhronize them through sharing some common pointers. + */ VVTK_MainWindow2* CreateMainWindow2(QWidget* theParent, const char* theName, SUIT_ResourceMgr* theResourceMgr, VISU_PickingSettings* thePickingSettings); + //! Get contained VISU_ImplicitFunctionWidget VISU_ImplicitFunctionWidget* GetImplicitFunctionWidget(); + //! Get contained VISU_OutsideCursorSettings VISU_OutsideCursorSettings* GetOutsideCursorSettings(); + //! Get contained VISU_PickingSettings VISU_PickingSettings* GetPickingSettings(); public slots: + //! To activate/ deactivate the segementation cursor at run-time void OnPlaneSegmentationSwitch(bool theIsPlaneSegmentationOn); + //! Customize VVTK_MainWindow::OnSelectionModeSwitch virtual void OnSelectionModeSwitch(bool theIsSelectionOn); protected: - VVTK_Renderer1* myRenderer; + VVTK_Renderer1* myRenderer; //!< Keeps extended version of SVTK_Renderer - VVTK_MainWindow2* myMainWindow2; + VVTK_MainWindow2* myMainWindow2; //!< Refer to segmented view - QtxAction* myStyleSwitchAction; - QToolBar* myPtsToolBar; - QSplitter* mySplitter; + QtxAction* myStyleSwitchAction; //!< Action for switch interactor style + QToolBar* myPtsToolBar; //!< Additional tool bar + //! To implement show/hide segmented view on acttivate/ deactivate segementation cursor + QSplitter* mySplitter; - VVTK_SegmentationCursorDlg* mySegmentationCursorDlg; - VVTK_PickingDlg* myPickingDlg; + VVTK_SegmentationCursorDlg* mySegmentationCursorDlg; //!< Keep reference to VVTK_SegmentationCursorDlg + VVTK_PickingDlg* myPickingDlg; //!< Keep reference to VVTK_PickingDlg }; //---------------------------------------------------------------------------- +//! Extend VVTK_MainWindow to implement functionality for segmented view class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindow { Q_OBJECT; friend class VVTK_MainWindow1; + //! Construct instance of the class VVTK_MainWindow2(QWidget* theParent, const char* theName, SUIT_ResourceMgr* theResourceMgr, VISU_PickingSettings* thePickingSettings, QtxAction* theStyleSwitchAction); public: + //! Destroy instance of the class virtual ~VVTK_MainWindow2(); }; diff --git a/src/VVTK/VVTK_Renderer.h b/src/VVTK/VVTK_Renderer.h index 0c50b277..b23cb026 100644 --- a/src/VVTK/VVTK_Renderer.h +++ b/src/VVTK/VVTK_Renderer.h @@ -41,20 +41,27 @@ class VISU_FPSActor; class vtkImplicitFunction; //---------------------------------------------------------------------------- +//! To customize SVTK_Renderer according to VVTK functionality class VVTK_EXPORT VVTK_Renderer : public SVTK_Renderer { public: vtkTypeMacro(VVTK_Renderer,SVTK_Renderer); static VVTK_Renderer* New(); + //! Reimplement SVTK_Renderer::AddActor + /*! + Perform an additional action - apply picking settings on the published VISU_GaussPtsAct actors + */ virtual void AddActor(VTKViewer_Actor* theActor); + //! Reimplement SVTK_Renderer::RemoveActor (remove additional settings) virtual void RemoveActor(VTKViewer_Actor* theActor); + //! To set VISU_PickingSettings to share them among all VISU_GaussPtsAct actors published into the view void SetPickingSettings(VISU_PickingSettings* thePickingSettings); @@ -62,34 +69,40 @@ class VVTK_EXPORT VVTK_Renderer : public SVTK_Renderer VVTK_Renderer(); ~VVTK_Renderer(); - VISU_PickingSettings* myPickingSettings; - vtkSmartPointer myFPSActor; + VISU_PickingSettings* myPickingSettings; //! Keeps reference of the VISU_PickingSettings + vtkSmartPointer myFPSActor; //!< To show FPS of the rendering at run-time }; //---------------------------------------------------------------------------- +//! To extend VVTK_Renderer to implement base view functionality class VVTK_EXPORT VVTK_Renderer1 : public VVTK_Renderer { public: vtkTypeMacro(VVTK_Renderer1,VVTK_Renderer); static VVTK_Renderer1* New(); + //! Reimplement SVTK_Renderer::Initialize virtual void Initialize(vtkRenderWindowInteractor* theInteractor, SVTK_Selector* theSelector); + //! Reimplement VVTK_Renderer::AddActor to apply to the actor additional settings virtual void AddActor(VTKViewer_Actor* theActor); + //! Reimplement VVTK_Renderer::RemoveActor virtual void RemoveActor(VTKViewer_Actor* theActor); + //! To set VISU_PickingSettings to share them among all VISU_GaussPtsAct1 actors published into the view void SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings); + //! Get VISU_ImplicitFunctionWidget VISU_ImplicitFunctionWidget* GetImplicitFunctionWidget(); @@ -97,10 +110,12 @@ class VVTK_EXPORT VVTK_Renderer1 : public VVTK_Renderer VVTK_Renderer1(); ~VVTK_Renderer1(); + //! Reimplement VVTK_Renderer::OnAdjustActors virtual bool OnAdjustActors(); + //! To adjust the VISU_ImplicitFunctionWidget to the current bounding box void AdjustImplicitFunctionWidget(); vtkSmartPointer myImplicitFunctionWidget; @@ -116,17 +131,21 @@ class VVTK_EXPORT VVTK_Renderer2 : public VVTK_Renderer vtkTypeMacro(VVTK_Renderer2,VVTK_Renderer); static VVTK_Renderer2* New(); + //! Reimplement VVTK_Renderer::AddActor to apply to the actor additional settings virtual void AddActor(VTKViewer_Actor* theActor); + //! Reimplement VVTK_Renderer::RemoveActor virtual void RemoveActor(VTKViewer_Actor* theActor); + //! Set VISU_ImplicitFunctionWidget void SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget); + //! To handle vtkCommand::EndInteractionEvent to redraw the view void OnEndInteractionEvent(); @@ -134,7 +153,7 @@ class VVTK_EXPORT VVTK_Renderer2 : public VVTK_Renderer VVTK_Renderer2(); ~VVTK_Renderer2(); - // Main process VTK event method + //! Main process VTK event method static void ProcessEvents(vtkObject* theObject, @@ -142,10 +161,10 @@ class VVTK_EXPORT VVTK_Renderer2 : public VVTK_Renderer void* theClientData, void* theCallData); - // Used to process VTK events + //! Used to process VTK events vtkSmartPointer myEventCallbackCommand; - // Priority at which events are processed + //! Priority at which events are processed float myPriority; VISU_ImplicitFunctionWidget* myWidget; diff --git a/src/VVTK/VVTK_ViewManager.h b/src/VVTK/VVTK_ViewManager.h index 9e70cbc4..101fa583 100644 --- a/src/VVTK/VVTK_ViewManager.h +++ b/src/VVTK/VVTK_ViewManager.h @@ -6,12 +6,15 @@ class SUIT_Desktop; +//! Extend SUIT_ViewManager to deal with VVTK_Viewer class VVTK_EXPORT VVTK_ViewManager : public SUIT_ViewManager { Q_OBJECT; public: - + //! Construct the view manager VVTK_ViewManager( SUIT_Study* study, SUIT_Desktop* ); + + //! Destroy the view manager virtual ~VVTK_ViewManager(); protected: diff --git a/src/VVTK/VVTK_ViewModel.h b/src/VVTK/VVTK_ViewModel.h index 6c2453b1..0846edcd 100644 --- a/src/VVTK/VVTK_ViewModel.h +++ b/src/VVTK/VVTK_ViewModel.h @@ -11,6 +11,7 @@ class VVTK_ViewWindow; +//! Extends two interfaces #SVTK_ViewModelBase and #SALOME_View class VVTK_EXPORT VVTK_Viewer : public SVTK_ViewModelBase, public SALOME_View { Q_OBJECT; @@ -22,20 +23,32 @@ public: VVTK_Viewer(); virtual ~VVTK_Viewer(); + //! Redefine SUIT_ViewModel::createView virtual SUIT_ViewWindow* createView(SUIT_Desktop*); - virtual void setViewManager(SUIT_ViewManager* theViewManager); - virtual void contextMenuPopup( QPopupMenu* ); - virtual QString getType() const { return Type(); } + //! Redefine SUIT_ViewModel::setViewManager + virtual void setViewManager(SUIT_ViewManager* theViewManager); + //! Redefine SUIT_ViewModel::contextMenuPopup + virtual void contextMenuPopup( QPopupMenu* ); + //! See SUIT_ViewModel::getType + virtual QString getType() const { return Type(); } + //! Redefine SALOME_View::Repaint virtual void Repaint(); - virtual bool isVisible( const Handle(SALOME_InteractiveObject)& ); + //! Redefine SALOME_View::isVisible + virtual bool isVisible( const Handle(SALOME_InteractiveObject)& ); + //! Get background color of the viewer QColor backgroundColor() const; + + //! Set background color to the viewer void setBackgroundColor( const QColor& ); + //! Get size of trihedron of the viewer (see SVTK_Renderer::SetTrihedronSize) int trihedronSize() const; + + //! Set size of trihedron of the viewer (see SVTK_Renderer::SetTrihedronSize) void setTrihedronSize( const int ); protected slots: diff --git a/src/VVTK/VVTK_ViewWindow.h b/src/VVTK/VVTK_ViewWindow.h index a6ddca69..8f952ab9 100755 --- a/src/VVTK/VVTK_ViewWindow.h +++ b/src/VVTK/VVTK_ViewWindow.h @@ -15,63 +15,84 @@ class VVTK_MainWindow2; class SVTK_View; //---------------------------------------------------------------------------- +//! Customize the SVTK_ViewWindow in order to manage two SVTK_View (base and segmented one) class VVTK_EXPORT VVTK_ViewWindow : public SVTK_ViewWindow { Q_OBJECT; public: + //! To construct the class VVTK_ViewWindow(SUIT_Desktop* theDesktop); + //! Destroy virtual ~VVTK_ViewWindow(); + //! To initialize virtual void Initialize(SVTK_ViewModelBase* theModel); //---------------------------------------------------------------------------- + //! Get access to base SVTK_MainWindow VVTK_MainWindow1* getMainWindow1(); + //! Get access to segmented SVTK_MainWindow VVTK_MainWindow2* getMainWindow2(); //---------------------------------------------------------------------------- + //! Redefine SVTK_ViewWindow::AddActor method + /*! + This is an entry point for publication the presentation into the viewer. + Pointed actor published into the basic MainWindow. If the actor is + a Gauss Points one second actor is created from initial actor and + is put into segemented MainWindow. + */ virtual void AddActor(VTKViewer_Actor* theActor, bool theIsUpdate = false); + //! Redefine SVTK_ViewWindow::RemoveActor method virtual void RemoveActor(VTKViewer_Actor* theActor, bool theIsUpdate = false); + //! Redefine SVTK_ViewWindow::Repaint method virtual void Repaint(bool theUpdateTrihedron = true); //---------------------------------------------------------------------------- /* interactive object management */ + //! Redefine SVTK_ViewWindow::highlight method virtual void highlight(const Handle(SALOME_InteractiveObject)& theIO, bool theIsHighlight = true, bool theIsUpdate = true); + + //! Redefine SVTK_ViewWindow::unHighlightAll method virtual void unHighlightAll(); //---------------------------------------------------------------------------- public slots: + //! Redefine SVTK_ViewWindow::onSelectionChanged method virtual void onSelectionChanged(); + //! Redefine SVTK_ViewWindow::onResetView method virtual void onResetView(); + //! Redefine SVTK_ViewWindow::onFitAll method virtual void onFitAll(); @@ -82,11 +103,11 @@ protected: void action( const int ); - VVTK_MainWindow1* myMainWindow1; - SVTK_View* myView1; + VVTK_MainWindow1* myMainWindow1; //!< The manage base view + SVTK_View* myView1; //!< The manage base view - VVTK_MainWindow2* myMainWindow2; - SVTK_View* myView2; + VVTK_MainWindow2* myMainWindow2; //!< The manage segmented view + SVTK_View* myView2; //!< The manage segmented view }; #ifdef WIN32 -- 2.39.2