]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Update of view after camera modification
authornkv <nkv@opencascade.com>
Mon, 2 Jun 2008 11:16:04 +0000 (11:16 +0000)
committernkv <nkv@opencascade.com>
Mon, 2 Jun 2008 11:16:04 +0000 (11:16 +0000)
src/SVTK/SVTK_InteractorStyle.cxx
src/SVTK/SVTK_ViewParameterDlg.cxx

index 0f980090c6e7542e8ad7e41ee105990806861a08..6fdc00ce758281a7836ef175b25f17dba1c0d452 100644 (file)
@@ -1561,7 +1561,7 @@ void SVTK_InteractorStyle::ProcessEvents( vtkObject* object,
        self->myCurrFocalPointType = SVTK::SetFocalPointGravity;
        if ( ComputeBBCenter(self->GetCurrentRenderer(),aCenter) ) {
          // invoke event for update coordinates in SVTK_ViewParameterDlg
-         self->InvokeEvent(SVTK::BBCenterChanged,(void*)aCenter);
+         self->InvokeEvent(SVTK::FocalPointChanged,(void*)aCenter);
        }
        return;
       case SVTK::StartFocalPointSelection:
index 057c1ae90e142e312d44c5ccf6c49db2680934c5..6be0cae4b4ce73663d389dc2ac8f1655f3ccdabd 100755 (executable)
@@ -49,6 +49,7 @@
 #include <vtkCallbackCommand.h>
 #include <vtkRenderer.h>
 #include <vtkCamera.h>
+#include <vtkGenericRenderWindowInteractor.h>
 
 using namespace std;
 
@@ -91,12 +92,6 @@ SVTK_ViewParameterDlg::SVTK_ViewParameterDlg(QtxAction* theAction,
   QGroupBox* aGroupBoxFocal = new QGroupBox(tr("FOCAL_POINT"), this);
   QVBoxLayout* aLayout2 = new QVBoxLayout(aGroupBoxFocal);
 
-  /*
-  myIsBBCenter = new QCheckBox(tr("USE_BBCENTER"), aGroupBoxFocal);
-  aLayout2->addWidget(myIsBBCenter);
-  connect(myIsBBCenter, SIGNAL(stateChanged(int)), SLOT(onBBCenterChecked()));
-  */
-
   myToBBCenter = new QPushButton(aGroupBoxFocal);
   myToBBCenter->setText(tr("LBL_TOBBCENTER"));
   aLayout2->addWidget(myToBBCenter);
@@ -408,7 +403,6 @@ void SVTK_ViewParameterDlg::addObserver()
 {
   if ( !myIsObserverAdded ) {
     vtkInteractorStyle* aIStyle = myRWInteractor->GetInteractorStyle();
-    aIStyle->AddObserver(SVTK::BBCenterChanged, myEventCallbackCommand.GetPointer(), myPriority);
     aIStyle->AddObserver(SVTK::FocalPointChanged, myEventCallbackCommand.GetPointer(), myPriority);
 
     vtkRenderer *aRenderer = myRWInteractor->getRenderer();
@@ -429,18 +423,6 @@ void SVTK_ViewParameterDlg::ProcessEvents(vtkObject* vtkNotUsed(theObject),
   SVTK_ViewParameterDlg* self = reinterpret_cast<SVTK_ViewParameterDlg*>(theClientData);
   vtkFloatingPointType* aCoord;
   switch ( theEvent ) {
-  case SVTK::BBCenterChanged:
-    if ( theCallData )
-    {
-      aCoord = (vtkFloatingPointType*)theCallData;
-      self->myBusy = true;
-      self->myFocalX->setText( QString::number(aCoord[0]) );
-      self->myFocalY->setText( QString::number(aCoord[1]) );
-      self->myFocalZ->setText( QString::number(aCoord[2]) );
-      self->myBusy = false;
-      self->onFocalCoordChanged();
-    }
-    break;
   case SVTK::FocalPointChanged:
     if ( theCallData )
     {
@@ -524,7 +506,9 @@ void SVTK_ViewParameterDlg::onProjectionModeChanged(int mode)
 
   vtkCamera* aCamera = myRWInteractor->getRenderer()->GetActiveCamera();
   aCamera->SetParallelProjection(aBtn == 0);
-  myRWInteractor->getRenderer()->Render();
+
+  // update view
+  myRWInteractor->GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
 
   myScaleBox->setVisible(aBtn == 0);
   myViewAngleBox->setVisible(aBtn == 1);
@@ -576,7 +560,12 @@ void SVTK_ViewParameterDlg::onFocalCoordChanged()
   aCamera->SetFocalPoint(myFocalX->text().toDouble(),
                         myFocalY->text().toDouble(),
                         myFocalZ->text().toDouble());
-  myRWInteractor->getRenderer()->Render();
+
+  aCamera->OrthogonalizeViewUp();
+  myRWInteractor->getRenderer()->ResetCameraClippingRange();
+
+  // update view
+  myRWInteractor->GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
 
   myMainWindow->activateSetFocalPointSelected();
 
@@ -592,6 +581,12 @@ void SVTK_ViewParameterDlg::onCameraCoordChanged()
                       myCameraY->text().toDouble(),
                       myCameraZ->text().toDouble());
 
+  aCamera->OrthogonalizeViewUp();
+  myRWInteractor->getRenderer()->ResetCameraClippingRange();
+
+  // update view
+  myRWInteractor->GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
+
   //updateProjection();
 }
 
@@ -617,7 +612,9 @@ void SVTK_ViewParameterDlg::onViewDirectionChanged()
   aCamera->SetViewUp(myViewDirX->text().toDouble(),
                     myViewDirY->text().toDouble(),
                     myViewDirZ->text().toDouble());
-  myRWInteractor->getRenderer()->Render();
+
+  // update view
+  myRWInteractor->GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
 }
 
 void SVTK_ViewParameterDlg::onZoomChanged()
@@ -634,7 +631,9 @@ void SVTK_ViewParameterDlg::onZoomChanged()
     aCamera->SetViewAngle(myViewAngle->text().toDouble());
     break;
   }
-  myRWInteractor->getRenderer()->Render();
+
+  // update view
+  myRWInteractor->GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
 }
 
 void SVTK_ViewParameterDlg::onClickClose()