Start "Create group" with selected GEOM object occurs crash

This commit is contained in:
asl 2005-06-16 10:25:13 +00:00
parent 78d606fbc6
commit cf0ecc3c36
2 changed files with 30 additions and 23 deletions

View File

@ -1097,11 +1097,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if( !mgr ) if( !mgr )
return false; return false;
SUIT_ViewManager* vm = application()->activeViewManager(); SUIT_ViewWindow* view = application()->desktop()->activeWindow();
if( !vm )
return false;
SUIT_ViewWindow* view =vm->getActiveView();
SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view ); SVTK_ViewWindow* vtkwnd = dynamic_cast<SVTK_ViewWindow*>( view );
QAction* act = action( theCommandID ); QAction* act = action( theCommandID );
@ -1179,6 +1175,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
{ {
if(checkLock(aStudy)) break; if(checkLock(aStudy)) break;
SMESH::UpdateView(); SMESH::UpdateView();
SALOME_ListIO l;
SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
aSel->setSelectedObjects( l );
break; break;
} }
@ -1532,6 +1532,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
} }
case 801: // CREATE GROUP case 801: // CREATE GROUP
{ {
if ( !vtkwnd )
{
SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
break;
}
if(checkLock(aStudy)) break; if(checkLock(aStudy)) break;
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil(); SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
@ -1553,6 +1560,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case 802: // CONSTRUCT GROUP case 802: // CONSTRUCT GROUP
{ {
if ( !vtkwnd )
{
SUIT_MessageBox::warn1( desktop(), tr( "SMESH_WRN_WARNING" ),
tr( "NOT_A_VTK_VIEWER" ),tr( "SMESH_BUT_OK" ) );
break;
}
if(checkLock(aStudy)) break; if(checkLock(aStudy)) break;
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
@ -2833,17 +2847,18 @@ void SMESHGUI::initialize( CAM_Application* app )
isNotEmpty("numberOfNodes <> 0"), isNotEmpty("numberOfNodes <> 0"),
// has nodes, edges, etc in VISIBLE! actor // has nodes, edges, etc in VISIBLE! actor
hasNodes("(numberOfNodes > 0 && isVisible)"), hasNodes("(numberOfNodes > 0 )"),//&& isVisible)"),
hasElems("count( elemTypes ) > 0"), hasElems("(count( elemTypes ) > 0)"),
hasDifferentElems("count( elemTypes ) > 1"), hasDifferentElems("(count( elemTypes ) > 1)"),
hasEdges("{'Edge'} in elemTypes"), hasEdges("({'Edge'} in elemTypes)"),
hasFaces("{'Face'} in elemTypes"), hasFaces("({'Face'} in elemTypes)"),
hasVolumes("{'Volume'} in elemTypes"); hasVolumes("({'Volume'} in elemTypes)");
QString aSelCount = QString( "%1 = 1" ).arg( QtxPopupMgr::Selection::defSelCountParam() ); QString aSelCount = QString( "%1 = 1" ).arg( QtxPopupMgr::Selection::defSelCountParam() );
QString aClient = QString( "%1client in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( View ); QString lc = QtxPopupMgr::Selection::defEquality();
QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer' 'ObjectBrowser'" );
QString aType = QString( "%1type in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( mesh_group ); QString aType = QString( "%1type in {%2}" ).arg( QtxPopupMgr::Selection::defEquality() ).arg( mesh_group );
QString aMeshInVTK = aClient + "&&" + aType + "&&" + aSelCount; QString aMeshInVTK = aClient + "&&" + aType;// + "&&" + aSelCount;
//------------------------------------------------- //-------------------------------------------------
// Numbering // Numbering

View File

@ -145,16 +145,8 @@ namespace SMESH{
SVTK_ViewWindow* SVTK_ViewWindow*
GetViewWindow(const SalomeApp_Module* theModule) GetViewWindow(const SalomeApp_Module* theModule)
{ {
if(SalomeApp_Application* anApp = theModule->getApp()){ if(SalomeApp_Application* anApp = theModule->getApp())
if(SUIT_ViewManager* aViewManager = anApp->activeViewManager()){ return dynamic_cast<SVTK_ViewWindow*>(anApp->desktop()->activeWindow());
if(aViewManager->getType() == SVTK_Viewer::Type()){
if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){
return dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
}
}
}
}
return NULL;
} }
SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager* theMgr, SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager* theMgr,