if (myRenderer)
RemoveFromRender(myRenderer);
+ QMap<int, GEOM_Actor*>::iterator iter = myMapOfActors.begin();
+ for ( ; iter != myMapOfActors.end(); ++iter )
+ if ( GEOM_Actor* anActor = iter.value() )
+ anActor->Delete();
myMapOfActors.clear();
}
TopExp_Explorer exp( theShape, theType );
for ( ; exp.More(); exp.Next() ) {
int index = myMapOfShapes.FindIndex( exp.Current() );
- if ( index ) {
+ if ( index && !myMapOfActors.contains( index ) ) {
// create actor if the index is present
if ( GEOM_Actor* anActor = createActor( exp.Current() )) {
- // Create new entry for actor
- QString aString = theEntry;
- aString += QString("_%1").arg( index ); // add index to actor entry
-
- // Create interactive object
- Handle( SALOME_InteractiveObject ) anIO = new SALOME_InteractiveObject();
- anIO->setEntry( aString.toLatin1().constData() );
-
- // Init Actor
- anActor->SetVectorMode( true );
- anActor->setIO( anIO );
- anActor->SetSelector( mySelector );
- anActor->SetPickable( true );
- anActor->SetResolveCoincidentTopology( true );
-
- // Add Actor to the Actors Map
- myMapOfActors.insert(index, anActor);
+ // Create new entry for actor
+ QString aString = theEntry;
+ aString += QString("_%1").arg( index ); // add index to actor entry
+
+ // Create interactive object
+ Handle( SALOME_InteractiveObject ) anIO = new SALOME_InteractiveObject();
+ anIO->setEntry( aString.toLatin1().constData() );
+
+ // Init Actor
+ anActor->SetVectorMode( true );
+ anActor->setIO( anIO );
+ anActor->SetSelector( mySelector );
+ anActor->SetPickable( true );
+ anActor->SetResolveCoincidentTopology( true );
+
+ // Add Actor to the Actors Map
+ myMapOfActors.insert(index, anActor);
}
}
}
StdMeshersGUI_SubShapeSelectorWdg
::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent ):
- QWidget( parent )
+ QWidget( parent ),
+ myPreviewActor( 0 )
{
QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
StdMeshersGUI_SubShapeSelectorWdg::~StdMeshersGUI_SubShapeSelectorWdg()
{
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
- myPreviewActor->RemoveFromRender( myRenderer );
- aViewWindow->Repaint();
+ if ( myPreviewActor ) {
+ myPreviewActor->RemoveFromRender( myRenderer );
+ aViewWindow->Repaint();
+
+ delete myPreviewActor;
+ myPreviewActor = 0;
+ }
}
myEntry = "";
myParamValue = "";
myMainShape.Nullify();
-
- delete myPreviewActor;
}
//================================================================================
void StdMeshersGUI_SubShapeSelectorWdg::showPreview( bool visible)
{
+ if ( !myPreviewActor )
+ return;
+
if ( myIsShown != visible ) {
myPreviewActor->SetShown( visible );
//=================================================================================
void StdMeshersGUI_SubShapeSelectorWdg::SelectionIntoArgument()
{
+ if ( !myPreviewActor )
+ return;
+
mySelectedIDs.clear();
// get selected mesh
//=================================================================================
void StdMeshersGUI_SubShapeSelectorWdg::onListSelectionChanged()
{
+ if ( !myPreviewActor )
+ return;
+
mySelectionMgr->clearSelected();
TColStd_MapOfInteger aIndexes;
QList<QListWidgetItem*> selItems = myListWidget->selectedItems();
myAddButton->setEnabled( state );
myRemoveButton->setEnabled( state );
- if (state = true) {
+ if (state) {
myPreviewActor = new SMESH_PreviewActorsCollection();
myPreviewActor->SetSelector( mySelector );
//myPreviewActor->Init( myMainShape, TopAbs_EDGE, myEntry );