From 630ed5959853fa901c87950352e8af7a23cb6c1f Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 30 Sep 2008 10:46:07 +0000 Subject: [PATCH] Merge with VISU 2008 --- src/ENGINE/VISU_Engine_i.cc | 46 +++++++++++ src/ENGINE/VISU_Engine_i.hh | 25 ++++++ src/VVTK/Makefile.am | 38 +-------- src/VVTK/VVTK_MainWindow.cxx | 152 +++++++++-------------------------- src/VVTK/VVTK_MainWindow.h | 99 +++++++---------------- src/VVTK/VVTK_PickingDlg.cxx | 89 ++++++++++++++++---- src/VVTK/VVTK_Renderer.cxx | 4 +- src/VVTK/VVTK_ViewModel.cxx | 22 +++-- 8 files changed, 222 insertions(+), 253 deletions(-) diff --git a/src/ENGINE/VISU_Engine_i.cc b/src/ENGINE/VISU_Engine_i.cc index d857f644..2187cce8 100644 --- a/src/ENGINE/VISU_Engine_i.cc +++ b/src/ENGINE/VISU_Engine_i.cc @@ -470,4 +470,50 @@ namespace VISU{ { return myVisuGen->GetColoredPrs3dCache(theStudy); } + + + + CORBA::Long VISU_Gen_i::CreateClippingPlane(CORBA::Double X,CORBA::Double Y, CORBA::Double Z, + CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, + CORBA::Boolean isAuto, const char* name) + { + return myVisuGen->CreateClippingPlane(X, Y, Z, dX, dY, dZ, isAuto, name); + } + + + void VISU_Gen_i::EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double Y, CORBA::Double Z, + CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, + CORBA::Boolean isAuto, const char* name) + { + myVisuGen->EditClippingPlane(id, X, Y, Z, dX, dY, dZ, isAuto, name); + } + + /* Returns clipping plane by its Id */ + VISU::ClippingPlane* VISU_Gen_i::GetClippingPlane(CORBA::Long id) + { + return myVisuGen->GetClippingPlane(id); + } + + /* Deletes clipping plane by its Id */ + CORBA::Boolean VISU_Gen_i::DeleteClippingPlane(CORBA::Long id) + { + return myVisuGen->DeleteClippingPlane(id); + } + + /* Applyes a clipping plane with Id to presentation thePrs */ + CORBA::Boolean VISU_Gen_i::ApplyClippingPlane(Prs3d_ptr thePrs, CORBA::Long id) + { + return myVisuGen->ApplyClippingPlane(thePrs, id); + } + + CORBA::Boolean VISU_Gen_i::DetachClippingPlane(Prs3d_ptr thePrs, CORBA::Long id) + { + return myVisuGen->DetachClippingPlane(thePrs, id); + } + + /* Get number of clipping planes */ + CORBA::Long VISU_Gen_i::GetClippingPlanesNb() + { + return myVisuGen->GetClippingPlanesNb(); + } }; diff --git a/src/ENGINE/VISU_Engine_i.hh b/src/ENGINE/VISU_Engine_i.hh index 247a1074..df49fb25 100644 --- a/src/ENGINE/VISU_Engine_i.hh +++ b/src/ENGINE/VISU_Engine_i.hh @@ -229,6 +229,31 @@ namespace VISU virtual VISU::ColoredPrs3dCache_ptr GetColoredPrs3dCache(SALOMEDS::Study_ptr theStudy); + + + + virtual CORBA::Long CreateClippingPlane(CORBA::Double X,CORBA::Double Y, CORBA::Double Z, + CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, + CORBA::Boolean isAuto, const char* name); + + virtual void EditClippingPlane(CORBA::Long id, CORBA::Double X,CORBA::Double Y, CORBA::Double Z, + CORBA::Double dX, CORBA::Double dY, CORBA::Double dZ, + CORBA::Boolean isAuto, const char* name); + + /* Returns clipping plane by its Id */ + virtual VISU::ClippingPlane* GetClippingPlane(CORBA::Long id); + + /* Deletes clipping plane by its Id */ + virtual CORBA::Boolean DeleteClippingPlane(CORBA::Long id); + + /* Applyes a clipping plane with Id to presentation thePrs */ + virtual CORBA::Boolean ApplyClippingPlane(Prs3d_ptr thePrs, CORBA::Long id); + + /* Detaches a clipping plane with Id from presentation thePrs */ + virtual CORBA::Boolean DetachClippingPlane(Prs3d_ptr thePrs, CORBA::Long id); + + /* Get number of clipping planes */ + virtual CORBA::Long GetClippingPlanesNb(); }; }; diff --git a/src/VVTK/Makefile.am b/src/VVTK/Makefile.am index 5c531a41..8afb0e31 100755 --- a/src/VVTK/Makefile.am +++ b/src/VVTK/Makefile.am @@ -29,47 +29,17 @@ lib_LTLIBRARIES= libVVTK.la # header files salomeinclude_HEADERS= \ VVTK.h \ - VVTK_ViewManager.h \ - VVTK_ViewModel.h \ - VVTK_InteractorStyle.h \ - VVTK_PickingDlg.h \ - VVTK_SegmentationCursorDlg.h \ VVTK_PrimitiveBox.h \ - VVTK_SizeBox.h \ - VVTK_Renderer.h \ - VVTK_ViewWindow.h \ - VVTK_MainWindow.h \ - VVTK_ImageWriter.h \ - VVTK_ImageWriterMgr.h \ - VVTK_RecorderDlg.h \ - VVTK_Recorder.h + VVTK_SizeBox.h dist_libVVTK_la_SOURCES= \ - VVTK_ViewManager.cxx \ - VVTK_ViewModel.cxx \ - VVTK_InteractorStyle.cxx \ - VVTK_PickingDlg.cxx \ - VVTK_SegmentationCursorDlg.cxx \ VVTK_PrimitiveBox.cxx \ - VVTK_SizeBox.cxx \ - VVTK_ViewWindow.cxx \ - VVTK_Renderer.cxx \ - VVTK_MainWindow.cxx \ - VVTK_ImageWriter.cxx \ - VVTK_ImageWriterMgr.cxx \ - VVTK_RecorderDlg.cxx \ - VVTK_Recorder.cxx + VVTK_SizeBox.cxx MOC_FILES= \ - VVTK_ViewWindow_moc.cxx \ - VVTK_ViewModel_moc.cxx \ - VVTK_ViewManager_moc.cxx \ - VVTK_PickingDlg_moc.cxx \ - VVTK_SegmentationCursorDlg_moc.cxx \ - VVTK_RecorderDlg_moc.cxx \ VVTK_PrimitiveBox_moc.cxx \ - VVTK_SizeBox_moc.cxx \ - VVTK_MainWindow_moc.cxx + VVTK_SizeBox_moc.cxx + nodist_libVVTK_la_SOURCES=$(MOC_FILES) libVVTK_la_CPPFLAGS= \ diff --git a/src/VVTK/VVTK_MainWindow.cxx b/src/VVTK/VVTK_MainWindow.cxx index 456b2715..158542a5 100644 --- a/src/VVTK/VVTK_MainWindow.cxx +++ b/src/VVTK/VVTK_MainWindow.cxx @@ -58,25 +58,19 @@ #include //---------------------------------------------------------------------------- -VVTK_MainWindow -::VVTK_MainWindow(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow): +VVTK_MainWindow::VVTK_MainWindow(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr, + SUIT_ViewWindow* theViewWindow): SVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow), - myInteractorStyle(VVTK_InteractorStyle::New()), myControllerIncrement(VVTK_ControllerIncrement::New()), myControllerOnKeyDown(VVTK_ControllerOnKeyDown::New()) { myToolMgr = new QtxActionToolMgr( this ); - myInteractorStyle->SetControllerIncrement(myControllerIncrement.GetPointer()); - myControllerIncrement->Delete(); - myInteractorStyle->SetControllerOnKeyDown(myControllerOnKeyDown.GetPointer()); + myControllerIncrement->Delete(); myControllerOnKeyDown->Delete(); - myInteractorStyle->Delete(); - // Recording myRecordingToolBar = new QToolBar(tr("LBL_TOOLBAR_RECORD_LABEL"), this); addToolBar(Qt::LeftToolBarArea, myRecordingToolBar ); @@ -132,9 +126,7 @@ QtxActionToolMgr* VVTK_MainWindow::toolMgr() const } //---------------------------------------------------------------------------- -void -VVTK_MainWindow -::Initialize(SVTK_RenderWindowInteractor* theInteractor) +void VVTK_MainWindow::Initialize(SVTK_RenderWindowInteractor* theInteractor) { vtkInteractorStyle* aStyle = theInteractor->GetInteractorStyle(); if(SVTK_InteractorStyle *anInteractorStyle = dynamic_cast(aStyle)){ @@ -189,17 +181,6 @@ void VVTK_MainWindow::onDumpView() QApplication::restoreOverrideCursor(); } -//---------------------------------------------------------------------------- -void -VVTK_MainWindow -::OnInteractorStyleSwitch(bool theIsGaussStyleOn) -{ - if ( theIsGaussStyleOn ) - this->PushInteractorStyle(myInteractorStyle.GetPointer()); - else - this->PopInteractorStyle(); -} - //---------------------------------------------------------------------------- void VVTK_MainWindow::OnStartRecording() { @@ -256,9 +237,7 @@ void VVTK_MainWindow::OnStopRecording() } //---------------------------------------------------------------------------- -void -VVTK_MainWindow -::action( const int accelAction ) +void VVTK_MainWindow::action( const int accelAction ) { if ( accelAction == SUIT_Accel::ZoomFit ) onFitAll(); @@ -269,13 +248,11 @@ VVTK_MainWindow } //---------------------------------------------------------------------------- -VVTK_MainWindow1 -::VVTK_MainWindow1(QSplitter* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow): +VVTK_MainWindow1::VVTK_MainWindow1(QSplitter* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr, + SUIT_ViewWindow* theViewWindow): VVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow), - myStyleSwitchAction(NULL), mySplitter(theParent), myPickingDlg(NULL) { @@ -285,23 +262,6 @@ VVTK_MainWindow1 QPixmap aPixmap; QtxAction* anAction; - aPixmap = theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_INTERACTOR_STYLE_SWITCH" ) ); - anAction = new QtxAction(tr("MNU_VVTK_INTERACTOR_STYLE_SWITCH"), - aPixmap, - tr( "MNU_VVTK_INTERACTOR_STYLE_SWITCH" ), - 0, - this, - //"VVTK/SVTK StyleSwitch", - true); - anAction->setCheckable(true); - anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH")); - - myPtsToolBar->addAction( anAction ); - myStyleSwitchAction = anAction; - - if( theResourceMgr->integerValue( "VISU", "mouse_behaviour", true ) == 1 ) - myStyleSwitchAction->toggle(); - aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH")); myPickingAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"), aPixmap, @@ -356,18 +316,12 @@ VVTK_MainWindow1 myPtsToolBar->addAction( aSegmentationAction ); } -void -VVTK_MainWindow1 -::Initialize(SVTK_RenderWindowInteractor* theInteractor, - VVTK_Renderer1* theRenderer) +void VVTK_MainWindow1::Initialize(SVTK_RenderWindowInteractor* theInteractor, + VVTK_Renderer1* theRenderer) { myRenderer = theRenderer; VVTK_MainWindow::Initialize(theInteractor); - if( myStyleSwitchAction->isChecked() ) - PushInteractorStyle(myInteractorStyle.GetPointer()); - connect(myStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool))); - mySegmentationCursorDlg->SetWidgetCtrl( theRenderer->GetWidgetCtrl() ); mySegmentationCursorDlg->SetInteractor( theInteractor ); @@ -375,31 +329,25 @@ VVTK_MainWindow1 myPickingDlg->SetInteractor( theInteractor ); } -VVTK_MainWindow1 -::~VVTK_MainWindow1() +VVTK_MainWindow1::~VVTK_MainWindow1() {} //---------------------------------------------------------------------------- -VVTK_MainWindow2* -VVTK_MainWindow1 -::CreateMainWindow2(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow) +VVTK_MainWindow2* VVTK_MainWindow1::CreateMainWindow2(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr, + SUIT_ViewWindow* theViewWindow) { myMainWindow2 = new VVTK_MainWindow2(theParent, theName, theResourceMgr, - theViewWindow, - myStyleSwitchAction); + theViewWindow); return myMainWindow2; } //---------------------------------------------------------------------------- -void -VVTK_MainWindow1 -::OnSelectionModeSwitch(bool theIsSelectionOn) +void VVTK_MainWindow1::OnSelectionModeSwitch(bool theIsSelectionOn) { if ( theIsSelectionOn && !isVisible() ) return; @@ -419,9 +367,7 @@ VVTK_MainWindow1 myPickingDlg->hide(); } -void -VVTK_MainWindow1 -::OnSelectionChanged() +void VVTK_MainWindow1::OnSelectionChanged() { Selection_Mode aSelectionMode = SelectionMode(); if(myPickingAction->isChecked() && aSelectionMode != GaussPointSelection) @@ -432,54 +378,40 @@ VVTK_MainWindow1 //---------------------------------------------------------------------------- -VISU_WidgetCtrl* -VVTK_MainWindow1 -::GetWidgetCtrl() +VISU_WidgetCtrl* VVTK_MainWindow1::GetWidgetCtrl() { return myRenderer->GetWidgetCtrl(); } -VISU_InsideCursorSettings* -VVTK_MainWindow1 -::GetInsideCursorSettings() +VISU_InsideCursorSettings* VVTK_MainWindow1::GetInsideCursorSettings() { return mySegmentationCursorDlg->GetInsideCursorSettings(); } -VISU_OutsideCursorSettings* -VVTK_MainWindow1 -::GetOutsideCursorSettings() +VISU_OutsideCursorSettings* VVTK_MainWindow1::GetOutsideCursorSettings() { return mySegmentationCursorDlg->GetOutsideCursorSettings(); } -VISU_PickingSettings* -VVTK_MainWindow1 -::GetPickingSettings() +VISU_PickingSettings* VVTK_MainWindow1::GetPickingSettings() { return myPickingDlg->GetPickingSettings(); } //---------------------------------------------------------------------------- -void -VVTK_MainWindow1 -::SetPlanesSegementation(bool theIsOn) +void VVTK_MainWindow1::SetPlanesSegementation(bool theIsOn) { myPlaneSegmentationAction->setChecked( theIsOn ); OnSegmentationSwitch(myPlaneSegmentationAction); } -void -VVTK_MainWindow1 -::SetSphereSegementation(bool theIsOn) +void VVTK_MainWindow1::SetSphereSegementation(bool theIsOn) { mySphereSegmentationAction->setChecked( theIsOn ); OnSegmentationSwitch(mySphereSegmentationAction); } -void -VVTK_MainWindow1 -::OnSegmentationSwitch(QtxAction* theAction) +void VVTK_MainWindow1::OnSegmentationSwitch(QtxAction* theAction) { bool anIsSegmentationOn = myPlaneSegmentationAction->isChecked() || mySphereSegmentationAction->isChecked(); @@ -516,9 +448,7 @@ VVTK_MainWindow1 } } -void -VVTK_MainWindow1 -::OnSegmentationSwitch() +void VVTK_MainWindow1::OnSegmentationSwitch() { QtxAction* anAction = ( QtxAction* )sender(); OnSegmentationSwitch(anAction); @@ -526,30 +456,20 @@ VVTK_MainWindow1 //---------------------------------------------------------------------------- -VVTK_MainWindow2 -::VVTK_MainWindow2(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow, - QtxAction* theStyleSwitchAction): - VVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow), - myStyleSwitchAction(theStyleSwitchAction) +VVTK_MainWindow2::VVTK_MainWindow2(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr, + SUIT_ViewWindow* theViewWindow): + VVTK_MainWindow(theParent,theName,theResourceMgr,theViewWindow) {} -VVTK_MainWindow2 -::~VVTK_MainWindow2() +VVTK_MainWindow2::~VVTK_MainWindow2() {} //---------------------------------------------------------------------------- -void -VVTK_MainWindow2 -::Initialize(SVTK_RenderWindowInteractor* theInteractor) +void VVTK_MainWindow2::Initialize(SVTK_RenderWindowInteractor* theInteractor) { VVTK_MainWindow::Initialize(theInteractor); - - if( myStyleSwitchAction->isChecked() ) - PushInteractorStyle(myInteractorStyle.GetPointer()); - connect(myStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool))); } diff --git a/src/VVTK/VVTK_MainWindow.h b/src/VVTK/VVTK_MainWindow.h index 24718220..068774ea 100644 --- a/src/VVTK/VVTK_MainWindow.h +++ b/src/VVTK/VVTK_MainWindow.h @@ -57,49 +57,28 @@ public: SUIT_ViewWindow* theViewWindow); //! Reimplement SVTK_MainWindow::Initialize - virtual - void - Initialize(SVTK_RenderWindowInteractor* theInteractor); + virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor); //! Destroy instance of the class - virtual - ~VVTK_MainWindow(); + virtual ~VVTK_MainWindow(); public slots: - virtual - void - onDumpView(); + virtual void onDumpView(); - //! To change active interactor style at run-time - virtual - void - OnInteractorStyleSwitch(bool theIsGaussStyleOn); + virtual void action( const int ); - virtual - void - action( const int ); + virtual void OnStartRecording(); - virtual - void - OnStartRecording(); + virtual void OnPlayRecording(); - virtual - void - OnPlayRecording(); + virtual void OnPauseRecording(); - virtual - void - OnPauseRecording(); - - virtual - void - OnStopRecording(); + virtual void OnStopRecording(); protected: virtual QtxActionToolMgr* toolMgr() const; - vtkSmartPointer myInteractorStyle; vtkSmartPointer myControllerIncrement; vtkSmartPointer myControllerOnKeyDown; @@ -128,69 +107,53 @@ public: SUIT_ViewWindow* theViewWindow); //! Reimplement VVTK_MainWindow::Initialize - virtual - void - Initialize(SVTK_RenderWindowInteractor* theInteractor, - VVTK_Renderer1* theRenderer); + virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor, + VVTK_Renderer1* theRenderer); //! Destroy instance of the class - virtual - ~VVTK_MainWindow1(); + 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, - SUIT_ViewWindow* theViewWindow); + VVTK_MainWindow2* CreateMainWindow2(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr, + SUIT_ViewWindow* theViewWindow); VISU_WidgetCtrl* GetWidgetCtrl(); - void - SetPlanesSegementation(bool theIsOn); + void SetPlanesSegementation(bool theIsOn); - void - SetSphereSegementation(bool theIsOn); + void SetSphereSegementation(bool theIsOn); - VISU_InsideCursorSettings* - GetInsideCursorSettings(); + VISU_InsideCursorSettings* GetInsideCursorSettings(); //! Get contained VISU_OutsideCursorSettings - VISU_OutsideCursorSettings* - GetOutsideCursorSettings(); + VISU_OutsideCursorSettings* GetOutsideCursorSettings(); //! Get contained VISU_PickingSettings - VISU_PickingSettings* - GetPickingSettings(); + VISU_PickingSettings* GetPickingSettings(); public slots: //! To activate/ deactivate the segementation cursor at run-time - void - OnSegmentationSwitch();//bool theIsSegmentationOn); + void OnSegmentationSwitch();//bool theIsSegmentationOn); - void - OnSegmentationSwitch(QtxAction* theAction);//bool theIsSegmentationOn); + void OnSegmentationSwitch(QtxAction* theAction);//bool theIsSegmentationOn); //! To change active selection mode at run-time - virtual - void - OnSelectionModeSwitch(bool theIsSelectionOn); + virtual void OnSelectionModeSwitch(bool theIsSelectionOn); //! To adjust to the current selection mode - virtual - void - OnSelectionChanged(); + virtual void OnSelectionChanged(); protected: VVTK_Renderer1* myRenderer; //!< Keeps extended version of SVTK_Renderer VVTK_MainWindow2* myMainWindow2; //!< Refer to segmented view - QtxAction* myStyleSwitchAction; //!< Action for switch interactor style QToolBar* myPtsToolBar; //!< Additional tool bar //! To implement show/hide segmented view on acttivate/ deactivate segementation cursor @@ -218,21 +181,13 @@ class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindow VVTK_MainWindow2(QWidget* theParent, const char* theName, SUIT_ResourceMgr* theResourceMgr, - SUIT_ViewWindow* theViewWindow, - QtxAction* theStyleSwitchAction); + SUIT_ViewWindow* theViewWindow); public: //! Destroy instance of the class - virtual - ~VVTK_MainWindow2(); + virtual ~VVTK_MainWindow2(); //! Reimplement SVTK_MainWindow::Initialize - virtual - void - Initialize(SVTK_RenderWindowInteractor* theInteractor); - - protected: - // Refer to the VVTK_MainWindow1::myStyleSwitchAction instance - QtxAction* myStyleSwitchAction; + virtual void Initialize(SVTK_RenderWindowInteractor* theInteractor); }; diff --git a/src/VVTK/VVTK_PickingDlg.cxx b/src/VVTK/VVTK_PickingDlg.cxx index 18b42fee..52d14ff1 100644 --- a/src/VVTK/VVTK_PickingDlg.cxx +++ b/src/VVTK/VVTK_PickingDlg.cxx @@ -24,7 +24,7 @@ #include "VVTK_PickingDlg.h" #include "VISU_GaussPtsAct.h" -#include "VISU_GaussPtsSettings.h" +#include "VISU_PickingSettings.h" #include "VISU_GaussPointsPL.hxx" #include "SUIT_MessageBox.h" @@ -454,29 +454,84 @@ VVTK_PickingDlg::~VVTK_PickingDlg() void VVTK_PickingDlg::AddActor( VISU_GaussPtsAct* theActor ) { - theActor->SetPickingSettings( myPickingSettings.GetPointer() ); + //theActor->SetPickingSettings( myPickingSettings.GetPointer() ); } void VVTK_PickingDlg::RemoveActor( VISU_GaussPtsAct* theActor ) { - theActor->SetPickingSettings( NULL ); + //theActor->SetPickingSettings( NULL ); } void VVTK_PickingDlg::Update() { - myCursorSizeSpinBox->setValue( myPickingSettings->GetCursorSize() ); - myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() ); - myPointToleranceSpinBox->setValue( myPickingSettings->GetPointTolerance() ); - myTransparencySpinBox->setValue( int(myPickingSettings->GetInfoWindowTransparency() * 100.0) ); - myPositionComboBox->setCurrentIndex( myPickingSettings->GetInfoWindowPosition() ); - myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() ); - myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() ); - myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() ); - - vtkFloatingPointType* aColor = myPickingSettings->GetColor(); - mySelectionColorButton->setColor( QColor( ( int )( aColor[0] * 255.0 ), - ( int )( aColor[1] * 255.0 ), - ( int )( aColor[2] * 255.0 ) ) ); + float aCursorSize = 0.5; + float aPyramidHeight = 10.0; + float aPointTolerance = 0.1; + QColor aColor = Qt::yellow; + int anInfoWindowTransparency = 50; + int anInfoWindowPosition = VISU_PickingSettings::BelowPoint; + float aZoomFactor = 1.5; + int aStepNumber = 10; + bool aDisplayParentMesh = false; + + //if( !myPickingSettings->GetInitial() ) + { + myCursorSizeSpinBox->setValue( myPickingSettings->GetCursorSize() ); + myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() ); + myPointToleranceSpinBox->setValue( myPickingSettings->GetPointTolerance() ); + myTransparencySpinBox->setValue( int(myPickingSettings->GetInfoWindowTransparency() * 100.0) ); + myPositionComboBox->setCurrentIndex( myPickingSettings->GetInfoWindowPosition() ); + myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() ); + myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() ); + myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() ); + + vtkFloatingPointType* aColor = myPickingSettings->GetColor(); + + //QPalette aPalette( mySelectionColorButton->palette() ); + /*aPalette.setColor( mySelectionColorButton->backgroundRole(), + QColor( ( int )( aColor[0] * 255.0 ), + ( int )( aColor[1] * 255.0 ), + ( int )( aColor[2] * 255.0 ) ) ); + mySelectionColorButton->setPalette( aPalette );*/ + mySelectionColorButton->setColor( + QColor( ( int )( aColor[0] * 255.0 ), + ( int )( aColor[1] * 255.0 ), + ( int )( aColor[2] * 255.0 ) ) ); + + return; + } + + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + + aCursorSize = aResourceMgr->doubleValue( "VISU", "picking_cursor_size", aCursorSize ); + myCursorSizeSpinBox->setValue( aCursorSize ); + + aPyramidHeight = aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", aPyramidHeight ); + myPyramidHeightSpinBox->setValue( aPyramidHeight ); + + aPointTolerance = aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", aPointTolerance ); + myPointToleranceSpinBox->setValue( aPointTolerance ); + + aColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", aColor ); + //QPalette aPalette( mySelectionColorButton->palette() ); + //aPalette.setColor( mySelectionColorButton->backgroundRole(), aColor ); + mySelectionColorButton->setColor( aColor ); + + anInfoWindowTransparency = aResourceMgr->integerValue( "VISU", "picking_transparency", anInfoWindowTransparency ); + myTransparencySpinBox->setValue( anInfoWindowTransparency ); + + anInfoWindowPosition = aResourceMgr->integerValue( "VISU", "picking_position", anInfoWindowPosition ); + myPositionComboBox->setCurrentIndex( anInfoWindowPosition ); + + aZoomFactor = aResourceMgr->doubleValue( "VISU", "picking_zoom_factor", aZoomFactor ); + myZoomFactorSpinBox->setValue( aZoomFactor ); + + aStepNumber = aResourceMgr->integerValue( "VISU", "picking_step_number", aStepNumber ); + myStepNumberSpinBox->setValue( aStepNumber ); + + aDisplayParentMesh = aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", aDisplayParentMesh ); + myDisplayParentMeshCheckBox->setChecked( aDisplayParentMesh ); + onClickApply(); } @@ -566,6 +621,8 @@ void VVTK_PickingDlg::KeyPressed() void VVTK_PickingDlg::onClickApply() { + //myPickingSettings->SetInitial( false ); + myPickingSettings->SetCursorSize( myCursorSizeSpinBox->value() ); myPickingSettings->SetPyramidHeight( myPyramidHeightSpinBox->value() ); myPickingSettings->SetPointTolerance( myPointToleranceSpinBox->value() ); diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx index 8b56aede..d0e3d6a1 100644 --- a/src/VVTK/VVTK_Renderer.cxx +++ b/src/VVTK/VVTK_Renderer.cxx @@ -194,7 +194,7 @@ VVTK_Renderer anActor->SetHighlightProperty(myGaussHighlightProperty.GetPointer()); anActor->SetInsideCursorSettings(myInsideCursorSettings); - anActor->SetPickingSettings(myPickingSettings); + //anActor->SetPickingSettings(myPickingSettings); } } @@ -210,7 +210,7 @@ VVTK_Renderer anActor->SetHighlightProperty(NULL); anActor->SetInsideCursorSettings(NULL); - anActor->SetPickingSettings(NULL); + //anActor->SetPickingSettings(NULL); } } diff --git a/src/VVTK/VVTK_ViewModel.cxx b/src/VVTK/VVTK_ViewModel.cxx index 977d3848..5a071c84 100644 --- a/src/VVTK/VVTK_ViewModel.cxx +++ b/src/VVTK/VVTK_ViewModel.cxx @@ -33,35 +33,33 @@ #include //--------------------------------------------------------------- -VVTK_Viewer -::VVTK_Viewer() +VVTK_Viewer::VVTK_Viewer() { } //--------------------------------------------------------------- -VVTK_Viewer -::~VVTK_Viewer() +VVTK_Viewer::~VVTK_Viewer() { } //--------------------------------------------------------------- -SUIT_ViewWindow* -VVTK_Viewer -::createView( SUIT_Desktop* theDesktop ) +SUIT_ViewWindow* VVTK_Viewer::createView( SUIT_Desktop* theDesktop ) { TViewWindow* aViewWindow = new TViewWindow (theDesktop); aViewWindow->Initialize(this); aViewWindow->setBackgroundColor( backgroundColor() ); aViewWindow->SetTrihedronSize( trihedronSize() ); + aViewWindow->SetProjectionMode( projectionMode() ); + aViewWindow->SetInteractionStyle( interactionStyle() ); + aViewWindow->SetIncrementalSpeed( incrementalSpeed(), incrementalSpeedMode() ); + aViewWindow->SetSpacemouseButtons( spacemouseBtn(1), spacemouseBtn(2), spacemouseBtn(3) ); return aViewWindow; } //--------------------------------------------------------------- -void -VVTK_Viewer -::Display(const SALOME_VTKPrs* thePrs) +void VVTK_Viewer::Display(const SALOME_VTKPrs* thePrs) { // try do downcast object if(const SVTK_Prs* aPrs = dynamic_cast(thePrs)){ @@ -106,9 +104,7 @@ namespace VVTK } //--------------------------------------------------------------- -bool -VVTK_Viewer -::isVisible( const Handle(SALOME_InteractiveObject)& theIO ) +bool VVTK_Viewer::isVisible( const Handle(SALOME_InteractiveObject)& theIO ) { QVector aViews = myViewManager->getViews(); for(int i = 0, iEnd = aViews.size(); i < iEnd; i++) -- 2.39.2