From 8cdcb2990adef2b90ba1ac7805e1119d55071774 Mon Sep 17 00:00:00 2001 From: nkv Date: Mon, 2 Jun 2008 11:16:04 +0000 Subject: [PATCH] Update of view after camera modification --- src/SVTK/SVTK_InteractorStyle.cxx | 2 +- src/SVTK/SVTK_ViewParameterDlg.cxx | 45 +++++++++++++++--------------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/SVTK/SVTK_InteractorStyle.cxx b/src/SVTK/SVTK_InteractorStyle.cxx index 0f980090c..6fdc00ce7 100644 --- a/src/SVTK/SVTK_InteractorStyle.cxx +++ b/src/SVTK/SVTK_InteractorStyle.cxx @@ -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: diff --git a/src/SVTK/SVTK_ViewParameterDlg.cxx b/src/SVTK/SVTK_ViewParameterDlg.cxx index 057c1ae90..6be0cae4b 100755 --- a/src/SVTK/SVTK_ViewParameterDlg.cxx +++ b/src/SVTK/SVTK_ViewParameterDlg.cxx @@ -49,6 +49,7 @@ #include #include #include +#include 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(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() -- 2.39.2