From: mkr Date: Wed, 29 Nov 2006 07:11:07 +0000 (+0000) Subject: Some corrections concerning PAL10048: X-Git-Tag: V3_2_4pre1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6dd2f1533f9e4ef76302e51ff448bad6e9aa210c;p=modules%2Fgui.git Some corrections concerning PAL10048: it is impossible to release "Select Point from View" button... --- diff --git a/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx b/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx index 1ce5ab4a4..0aed2c230 100644 --- a/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx +++ b/src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx @@ -186,7 +186,11 @@ OCCViewer_SetRotationPointDlg setEnabled(myGroupBoxCoord,!myIsBBCenter->isChecked()); if ( myIsBBCenter->isChecked() ) + { + if ( mySelectPoint->state() == QButton::On ) + mySelectPoint->toggle(); myView->activateSetRotationGravity(); + } else myView->activateSetRotationSelected(myX->text().toDouble(), myY->text().toDouble(), @@ -197,6 +201,8 @@ void OCCViewer_SetRotationPointDlg ::onToOrigin() { + if ( mySelectPoint->state() == QButton::On ) + mySelectPoint->toggle(); setCoords(); myView->activateSetRotationSelected(myX->text().toDouble(), myY->text().toDouble(), @@ -218,9 +224,15 @@ OCCViewer_SetRotationPointDlg ::onCoordChanged() { if ( !myIsBBCenter->isChecked() ) + { + if ( mySelectPoint->state() == QButton::On + && + ( myX->hasFocus() || myY->hasFocus() || myZ->hasFocus() ) ) + mySelectPoint->toggle(); myView->activateSetRotationSelected(myX->text().toDouble(), myY->text().toDouble(), myZ->text().toDouble()); + } } void diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index d921e3053..0ec1a641d 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -356,7 +356,11 @@ void OCCViewer_ViewWindow::vpMousePressEvent(QMouseEvent* theEvent) if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) { gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) ); - if ( mySetRotationPointDlg ) mySetRotationPointDlg->setCoords(aPnt.X(), aPnt.Y(), aPnt.Z()); + if ( mySetRotationPointDlg ) + { + myRotationPointSelection = false; + mySetRotationPointDlg->setCoords(aPnt.X(), aPnt.Y(), aPnt.Z()); + } } else { @@ -507,6 +511,16 @@ bool OCCViewer_ViewWindow::computeGravityCenter( double& theX, double& theY, dou */ void OCCViewer_ViewWindow::activateSetRotationGravity() { + if ( myRotationPointSelection ) + { + Handle(AIS_InteractiveContext) ic = myModel->getAISContext(); + ic->CloseAllContexts(); + myOperation = NOTHING; + setCursor( myCursor ); + myCursorIsHand = false; + myRotationPointSelection = false; + } + myPrevPointType = myCurrPointType; myCurrPointType = GRAVITY; @@ -533,6 +547,16 @@ void OCCViewer_ViewWindow::updateGravityCoords() */ void OCCViewer_ViewWindow::activateSetRotationSelected(double theX, double theY, double theZ) { + if ( myRotationPointSelection ) + { + Handle(AIS_InteractiveContext) ic = myModel->getAISContext(); + ic->CloseAllContexts(); + myOperation = NOTHING; + setCursor( myCursor ); + myCursorIsHand = false; + myRotationPointSelection = false; + } + myPrevPointType = myCurrPointType; myCurrPointType = SELECTED; mySelectedPoint.SetCoord(theX,theY,theZ); @@ -1074,8 +1098,6 @@ void OCCViewer_ViewWindow::onFitAll() */ void OCCViewer_ViewWindow::onSetRotationPoint( bool on ) { - SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); - if ( on ) { if ( !mySetRotationPointDlg ) diff --git a/src/SVTK/SVTK_InteractorStyle.cxx b/src/SVTK/SVTK_InteractorStyle.cxx index de0dbbb74..08f0f2134 100644 --- a/src/SVTK/SVTK_InteractorStyle.cxx +++ b/src/SVTK/SVTK_InteractorStyle.cxx @@ -536,10 +536,6 @@ SVTK_InteractorStyle // invoke event for update coordinates in SVTK_SetRotationPointDlg InvokeEvent(SVTK::RotationPointChanged,(void*)aCoords); - - myHighlightRotationPointActor->SetVisibility( false ); - if(GetCurrentRenderer() != NULL) - GetCurrentRenderer()->RemoveActor( myHighlightRotationPointActor.GetPointer() ); } else { @@ -555,6 +551,10 @@ SVTK_InteractorStyle myCurrRotationPointType = myPrevRotationPointType; } + myHighlightRotationPointActor->SetVisibility( false ); + if(GetCurrentRenderer() != NULL) + GetCurrentRenderer()->RemoveActor( myHighlightRotationPointActor.GetPointer() ); + GetRenderWidget()->setCursor(myDefCursor); } else @@ -1586,6 +1586,13 @@ SVTK_InteractorStyle return; case SVTK::SetRotateGravity: + if ( self->myCurrRotationPointType == SVTK::StartPointSelection ) + { + self->myHighlightRotationPointActor->SetVisibility( false ); + if( self->GetCurrentRenderer() != NULL ) + self->GetCurrentRenderer()->RemoveActor( self->myHighlightRotationPointActor.GetPointer() ); + self->GetRenderWidget()->setCursor(self->myDefCursor); + } self->myPrevRotationPointType = self->myCurrRotationPointType; self->myCurrRotationPointType = SVTK::SetRotateGravity; if ( ComputeBBCenter(self->GetCurrentRenderer(),aCenter) ) @@ -1597,6 +1604,13 @@ SVTK_InteractorStyle return; case SVTK::ChangeRotationPoint: + if ( self->myCurrRotationPointType == SVTK::StartPointSelection ) + { + self->myHighlightRotationPointActor->SetVisibility( false ); + if( self->GetCurrentRenderer() != NULL ) + self->GetCurrentRenderer()->RemoveActor( self->myHighlightRotationPointActor.GetPointer() ); + self->GetRenderWidget()->setCursor(self->myDefCursor); + } self->myPrevRotationPointType = self->myCurrRotationPointType; self->myCurrRotationPointType = SVTK::SetRotateSelected; aSelectedPoint = (vtkFloatingPointType*)callData; diff --git a/src/SVTK/SVTK_SetRotationPointDlg.cxx b/src/SVTK/SVTK_SetRotationPointDlg.cxx index 248e3ecd0..d98efaa21 100755 --- a/src/SVTK/SVTK_SetRotationPointDlg.cxx +++ b/src/SVTK/SVTK_SetRotationPointDlg.cxx @@ -260,7 +260,10 @@ SVTK_SetRotationPointDlg setEnabled(myGroupBoxCoord,!myIsBBCenter->isChecked()); if ( myIsBBCenter->isChecked() ) - { // activate mode : the rotation point is the center of the bounding box + { + if ( mySelectPoint->state() == QButton::On ) + mySelectPoint->toggle(); + // activate mode : the rotation point is the center of the bounding box // send the data to the SVTK_InteractorStyle: set the type of the rotation point // calculate coordinates of the rotation point myMainWindow->activateSetRotationGravity(); @@ -277,6 +280,8 @@ void SVTK_SetRotationPointDlg ::onToOrigin() { + if ( mySelectPoint->state() == QButton::On ) + mySelectPoint->toggle(); myX->setText(QString::number(0.0)); myY->setText(QString::number(0.0)); myZ->setText(QString::number(0.0)); @@ -297,6 +302,10 @@ SVTK_SetRotationPointDlg ::onCoordChanged() { if ( !myIsBBCenter->isChecked() ) { + if ( mySelectPoint->state() == QButton::On + && + ( myX->hasFocus() || myY->hasFocus() || myZ->hasFocus() ) ) + mySelectPoint->toggle(); vtkFloatingPointType aCenter[3] = {myX->text().toDouble(), myY->text().toDouble(), myZ->text().toDouble()};