X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ClippingDlg.cxx;h=18aede561ad2457ed2965a9348177aa63d491b1c;hb=0a237be4b91b6db526b340c534f40a385d6d65ab;hp=09c3a39420f869d27685f798771776cca1b77fbf;hpb=1a1b88b9cf10382f90a5e34f4ca8777b8b8550d8;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx index 09c3a3942..18aede561 100644 --- a/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ClippingDlg.cxx @@ -552,7 +552,7 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( SMESHGUI* theModule, SVTK_ViewWindow myIsSelectPlane = false; - myHelpFileName = "clipping_page.html"; + myHelpFileName = "clipping.html"; // signals and slots connections : connect( ComboBoxPlanes, SIGNAL( activated( int ) ), this, SLOT( onSelectPlane( int ) ) ); @@ -1068,11 +1068,7 @@ void SMESHGUI_ClippingDlg::updateActorList() { ActorList->clear(); - SalomeApp_Study* anAppStudy = SMESHGUI::activeStudy(); - if( !anAppStudy ) - return; - - _PTR(Study) aStudy = anAppStudy->studyDS(); + _PTR(Study) aStudy = SMESH::getStudy(); if( !aStudy ) return; @@ -1086,6 +1082,8 @@ void SMESHGUI_ClippingDlg::updateActorList() std::for_each( myPlanes.begin(),myPlanes.end(), TSetVisibility( PreviewCheckBox->isChecked() ) ); aPlaneData.Plane.GetPointer()->myActor->SetVisibility( false ); + std::map< std::string, QListWidgetItem* > itemMap; // used to sort items by entry + VTK::ActorCollectionCopy aCopy( myViewWindow->getRenderer()->GetActors() ); vtkActorCollection* anAllActors = aCopy.GetActors(); anAllActors->InitTraversal(); @@ -1111,13 +1109,20 @@ void SMESHGUI_ClippingDlg::updateActorList() if ( !aFatherName.isEmpty() ) aName = aFatherName + " / " + aName; aName += QString(" (%1)").arg( aSObj->GetID().c_str() ); - QListWidgetItem* anItem = new ActorItem( anActor, aName, ActorList ); + QListWidgetItem* anItem = new ActorItem( anActor, aName, 0 ); anItem->setCheckState( anIsChecked ? Qt::Checked : Qt::Unchecked ); - updateActorItem( anItem, true, false ); + itemMap.insert( std::make_pair( aSObj->GetID(), anItem )); } } } } + std::map< std::string, QListWidgetItem* >::iterator s2i = itemMap.begin(); + for ( ; s2i != itemMap.end(); ++s2i ) + { + QListWidgetItem* anItem = s2i->second; + ActorList->addItem( anItem ); + } + updateActorItem( 0, true, false ); } /*! @@ -1258,16 +1263,19 @@ void SMESHGUI_ClippingDlg::ClickOnNew() SMESH::OrientedPlane* aPlane = SMESH::OrientedPlane::New(myViewWindow); SMESH::TPlane aTPlane(aPlane); aPlane->PlaneMode = CurrentMode; - SMESH::TActorList anActorList; + SMESH::TActorList anActorList, aVisibleActorList; VTK::ActorCollectionCopy aCopy( myViewWindow->getRenderer()->GetActors() ); vtkActorCollection* anAllActors = aCopy.GetActors(); anAllActors->InitTraversal(); while( vtkActor* aVTKActor = anAllActors->GetNextActor() ) if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( aVTKActor ) ) + { anActorList.push_back( anActor ); - - SMESH::TPlaneData aPlaneData(aTPlane, anActorList); - + if ( anActor->GetVisibility() ) + aVisibleActorList.push_back( anActor ); + } + SMESH::TPlaneData aPlaneData(aTPlane, + aVisibleActorList.empty() ? anActorList : aVisibleActorList); myPlanes.push_back(aPlaneData);