From 0f76672717c959056f8a9e4de60e00627034ddc6 Mon Sep 17 00:00:00 2001 From: apo Date: Tue, 16 Aug 2005 13:24:19 +0000 Subject: [PATCH] To provide possibility to customize the package --- src/SVTK/Makefile.in | 6 ++++-- src/SVTK/SVTK_ViewModel.cxx | 10 ++-------- src/SVTK/SVTK_ViewModel.h | 17 ++++++----------- src/SVTK/SVTK_ViewModelBase.h | 23 +++++++++++++++++++++++ src/SVTK/SVTK_ViewWindow.cxx | 5 ++--- src/SVTK/SVTK_ViewWindow.h | 5 ++--- 6 files changed, 39 insertions(+), 27 deletions(-) create mode 100644 src/SVTK/SVTK_ViewModelBase.h diff --git a/src/SVTK/Makefile.in b/src/SVTK/Makefile.in index 7a5f2ad6a..f197eaff1 100755 --- a/src/SVTK/Makefile.in +++ b/src/SVTK/Makefile.in @@ -27,7 +27,8 @@ EXPORT_HEADERS= SVTK.h \ SVTK_RenderWindowInteractor.h \ SVTK_Selector.h \ SVTK_Selection.h \ - SVTK_SelectionEvent.h + SVTK_SelectionEvent.h \ + SVTK_ViewModelBase.h # Libraries targets LIB = libSVTK.la @@ -52,7 +53,8 @@ LIB_MOC = SVTK_RenderWindowInteractor.h \ SVTK_View.h \ SVTK_ViewWindow.h \ SVTK_ViewModel.h \ - SVTK_ViewManager.h + SVTK_ViewManager.h \ + SVTK_ViewModelBase.h LIB_CLIENT_IDL = SALOMEDS.idl \ SALOME_Exception.idl \ diff --git a/src/SVTK/SVTK_ViewModel.cxx b/src/SVTK/SVTK_ViewModel.cxx index 603e59ca1..1eef62e4c 100644 --- a/src/SVTK/SVTK_ViewModel.cxx +++ b/src/SVTK/SVTK_ViewModel.cxx @@ -16,6 +16,8 @@ #include "SVTK_RenderWindowInteractor.h" #include "SVTK_RenderWindow.h" +#include "VTKViewer_ViewModel.h" + #include "ToolsGUI.h" #include "SALOME_Actor.h" @@ -433,11 +435,3 @@ SVTK_Viewer if(SVTK_RenderWindow* aRW = aView->getView()) aRW->update(); } - -void -SVTK_Viewer -::onSelectionChanged() -{ - emit selectionChanged(); -} - diff --git a/src/SVTK/SVTK_ViewModel.h b/src/SVTK/SVTK_ViewModel.h index 912e31f3d..24b6a3006 100644 --- a/src/SVTK/SVTK_ViewModel.h +++ b/src/SVTK/SVTK_ViewModel.h @@ -2,6 +2,8 @@ #define SVTK_VIEWMODEL_H #include "SVTK.h" +#include "SVTK_ViewModelBase.h" + #include "VTKViewer_ViewModel.h" #include "SALOME_Prs.h" @@ -9,11 +11,14 @@ #include -class SVTK_EXPORT SVTK_Viewer : public SUIT_ViewModel, public SALOME_View +class SVTK_ViewWindow; + +class SVTK_EXPORT SVTK_Viewer : public SVTK_ViewModelBase, public SALOME_View { Q_OBJECT; public: + typedef SVTK_ViewWindow TViewWindow; static QString Type() { return "VTKViewer"; } SVTK_Viewer(); @@ -50,16 +55,6 @@ public: virtual bool isVisible( const Handle(SALOME_InteractiveObject)& ); virtual void Repaint(); - //implemented in SOCC, but were not found in VTKVIEwer_ViewFrame, so not implemented here.. - //?virtual void LocalSelection( const SALOME_OCCPrs*, const int ); - //?virtual void GlobalSelection( const bool = false ) const; - -public slots: - void onSelectionChanged(); - - signals: - void selectionChanged(); - protected slots: void onMousePress(SUIT_ViewWindow*, QMouseEvent*); void onMouseMove(SUIT_ViewWindow*, QMouseEvent*); diff --git a/src/SVTK/SVTK_ViewModelBase.h b/src/SVTK/SVTK_ViewModelBase.h new file mode 100644 index 000000000..abe805ca7 --- /dev/null +++ b/src/SVTK/SVTK_ViewModelBase.h @@ -0,0 +1,23 @@ +#ifndef SVTK_SELECTIONCHANGED_H +#define SVTK_SELECTIONCHANGED_H + +#include + +#include "SVTK.h" +#include "SUIT_ViewModel.h" + +class SVTK_EXPORT SVTK_ViewModelBase: public SUIT_ViewModel +{ + Q_OBJECT; + +public slots: + void onSelectionChanged() + { + emit selectionChanged(); + } + + signals: + void selectionChanged(); +}; + +#endif diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index 34870b38d..d23fe6ddd 100755 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -26,7 +26,7 @@ //#include "SVTK_View.h" #include "SVTK_ViewWindow.h" -#include "SVTK_ViewModel.h" +#include "SVTK_ViewModelBase.h" #include "SVTK_RenderWindowInteractor.h" #include "SVTK_InteractorStyle.h" @@ -40,10 +40,9 @@ //---------------------------------------------------------------------------- SVTK_ViewWindow ::SVTK_ViewWindow( SUIT_Desktop* theDesktop, - SVTK_Viewer* theModel) + SVTK_ViewModelBase* theModel) : SUIT_ViewWindow( theDesktop ) { - myModel = theModel; mySelector = new SVTK_SelectorDef(); connect(this,SIGNAL(selectionChanged()),theModel,SLOT(onSelectionChanged())); diff --git a/src/SVTK/SVTK_ViewWindow.h b/src/SVTK/SVTK_ViewWindow.h index 86f666251..461a34e43 100755 --- a/src/SVTK/SVTK_ViewWindow.h +++ b/src/SVTK/SVTK_ViewWindow.h @@ -18,7 +18,7 @@ class SUIT_Desktop; class VTKViewer_Actor; class VTKViewer_Trihedron; -class SVTK_Viewer; +class SVTK_ViewModelBase; class SVTK_Selector; //class SVTK_View; @@ -33,7 +33,7 @@ class SVTK_EXPORT SVTK_ViewWindow : public SUIT_ViewWindow Q_OBJECT public: - SVTK_ViewWindow( SUIT_Desktop*, SVTK_Viewer* ); + SVTK_ViewWindow( SUIT_Desktop*, SVTK_ViewModelBase* ); virtual ~SVTK_ViewWindow(); void setBackgroundColor( const QColor& ); @@ -148,7 +148,6 @@ private: //void MoveActor( VTKViewer_Actor* theActor ); private: - SVTK_Viewer* myModel; SVTK_Selector* mySelector; SVTK_View* myView; -- 2.39.2