X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ClippingDlg.cxx;h=5b3b35cf073ed5c144fc54d4e807d31ef1667990;hp=e9bf24bc05584deec7bcd6abc85ec8d85ba75c56;hb=cb6af2f3e332021f7c16b5d7e0c919ab4dce5c76;hpb=e2cd4bc2979dc84168954c7d562ced0dd34c4f69;ds=sidebyside diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx index e9bf24bc0..5b3b35cf0 100644 --- a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -476,7 +476,7 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule, SVTK_ViewWindow QFont fnt = SpinSliderDistance->font(); fnt.setBold( true ); SpinSliderDistance->setFont( fnt ); GroupParametersLayout->addWidget( SpinSliderDistance, 1, 1 ); - QString aUnitRot = "\xB0"; + QString aUnitRot = QString(QChar(0xB0)); TextLabelRotation1 = new QLabel( tr("ROTATION_AROUND_X_Y2Z"), GroupParameters ); TextLabelRotation1->setObjectName( "TextLabelRotation1" ); @@ -601,12 +601,12 @@ SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg() if (myViewWindow) SMESH::RenderViewWindow(myViewWindow); - for( int i=0; i< myPlanes.size(); i++ ) { + for ( size_t i = 0; i < myPlanes.size(); i++ ) { SMESH::TPlaneData aPlaneData = myPlanes[i]; aPlaneData.Plane->Delete(); } - if (myPreviewWidget) { + if ( myPreviewWidget ) { myPreviewWidget->Off(); myPreviewWidget->Delete(); } @@ -629,7 +629,7 @@ double SMESHGUI_ClippingDlg::getDistance() const */ void SMESHGUI_ClippingDlg::setDistance( const double theDistance ) { - SpinSliderDistance->setValue( theDistance*100 ); + SpinSliderDistance->setValue( theDistance ); } /*! @@ -766,7 +766,7 @@ bool SMESHGUI_ClippingDlg::AddPlane ( SMESH::TActorList theActorList, double aDir[2][3] = {{0, 0, 0}, {0, 0, 0}}; static double aCoeff = vtkMath::Pi()/180.0; - int anOrientation; + int anOrientation = 0; if ( thePlane->PlaneMode == SMESH::Absolute ) anOrientation = thePlane->myAbsoluteOrientation; else if ( thePlane->PlaneMode == SMESH::Relative ) @@ -1133,9 +1133,14 @@ void SMESHGUI_ClippingDlg::updateActorItem( QListWidgetItem* theItem, else if( theItem->checkState() == Qt::Unchecked && anIsPushed ) anActorList.remove( anActor ); - SMESH::ComputeBounds( anActorList, myBounds ); - myPreviewWidget->PlaceWidget( myBounds[0], myBounds[1], myBounds[2], - myBounds[3], myBounds[4], myBounds[5] ); + if( SMESH::ComputeBounds( anActorList, myBounds ) ) { + myPreviewWidget->PlaceWidget( myBounds[0], myBounds[1], myBounds[2], + myBounds[3], myBounds[4], myBounds[5] ); + if( PreviewCheckBox->isChecked() ) + myPreviewWidget->On(); + } + else + myPreviewWidget->Off(); } } } @@ -1244,9 +1249,15 @@ void SMESHGUI_ClippingDlg::ClickOnNew() bool anIsBlocked = ActorList->blockSignals( true ); - SMESH::ComputeBounds( anActorList, myBounds ); - myPreviewWidget->PlaceWidget( myBounds[0],myBounds[1],myBounds[2], - myBounds[3],myBounds[4],myBounds[5] ); + if( SMESH::ComputeBounds( anActorList, myBounds ) ) { + myPreviewWidget->PlaceWidget( myBounds[0], myBounds[1], myBounds[2], + myBounds[3], myBounds[4], myBounds[5] ); + if( PreviewCheckBox->isChecked() ) + myPreviewWidget->On(); + } + else + myPreviewWidget->Off(); + synchronize(); SetCurrentPlaneParam(); @@ -1331,9 +1342,16 @@ void SMESHGUI_ClippingDlg::onSelectPlane ( int theIndex ) } } myIsSelectPlane = false; - SMESH::ComputeBounds( aPlaneData.ActorList, myBounds ); - myPreviewWidget->PlaceWidget( myBounds[0], myBounds[1], myBounds[2], - myBounds[3], myBounds[4], myBounds[5] ); + + if( SMESH::ComputeBounds( aPlaneData.ActorList, myBounds ) ) { + myPreviewWidget->PlaceWidget( myBounds[0], myBounds[1], myBounds[2], + myBounds[3], myBounds[4], myBounds[5] ); + if( PreviewCheckBox->isChecked() ) + myPreviewWidget->On(); + } + else + myPreviewWidget->Off(); + SetCurrentPlaneParam(); // Actors @@ -1418,7 +1436,7 @@ void SMESHGUI_ClippingDlg::SetCurrentPlaneParam() static double aCoeff = vtkMath::Pi()/180.0; double aRot[2] = { getRotation1(), getRotation2() }; - int anOrient; + int anOrient = 0; if ( aPlane->PlaneMode == SMESH::Absolute ) anOrient = CBAbsoluteOrientation->currentIndex(); else if ( aPlane->PlaneMode == SMESH::Relative ) @@ -1605,8 +1623,8 @@ void SMESHGUI_ClippingDlg::absolutePlaneToRelative ( double theOrigin[3], double double eps = 0.0001; int anOrientation = CBRelativeOrientation->currentIndex(); - double aDirection[3]; - double aRotation1, aRotation2; + double aDirection[3] = { 0.,0.,0. }; + double aRotation1 = 0, aRotation2 = 0; switch( anOrientation ) { case 0: aDirection[0] = theDir[0] + eps; @@ -1779,11 +1797,9 @@ void SMESHGUI_ClippingDlg::ClickOnApply() aClippingPlaneInfoList.push_back( aClippingPlaneInfo ); } - SMESH_Actor* anSMESHActor; anAllActors->InitTraversal(); while( vtkActor* aVTKActor = anAllActors->GetNextActor() ) if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) ) { - anSMESHActor = anActor; anActor->SetOpenGLClippingPlane(); }