X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_AddMeshElementDlg.cxx;h=7a396fd41a05363b9719f6211f42086f4bca6fba;hp=bb36d5c0386560a69a3367ccfa2ef27d95267e36;hb=d0f366c4a3a66a71b0be94f7a6e2d146f80a94c4;hpb=576824da0480ebd29facad6ee8dec98961fc7b1c diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx index bb36d5c03..7a396fd41 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx @@ -65,6 +65,7 @@ #include #include #include +#include // QT Includes #include @@ -216,14 +217,13 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI* theModule, : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - myViewWindow( SMESH::GetViewWindow( theModule ) ), - mySelector( myViewWindow->GetSelector() ) + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { SalomeApp_Application* anApp = dynamic_cast (SUIT_Session::session()->activeApplication()); myIsPoly = false; mySimulation = new SMESH::TElementSimulation (anApp); + mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); // verify nb nodes and type myNbNodes = nbNodes; @@ -420,7 +420,8 @@ void SMESHGUI_AddMeshElementDlg::Init() // set selection mode SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode( NodeSelection ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( NodeSelection ); myBusy = false; @@ -457,6 +458,7 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply() } SALOME_ListIO aList; aList.Append( myActor->getIO() ); + mySelector->ClearIndex(); mySelectionMgr->setSelectedObjects( aList, false ); SMESH::UpdateView(); @@ -488,10 +490,11 @@ void SMESHGUI_AddMeshElementDlg::ClickOnOk() //================================================================================= void SMESHGUI_AddMeshElementDlg::ClickOnCancel() { - mySelectionMgr->clearSelected(); + //mySelectionMgr->clearSelected(); mySimulation->SetVisibility(false); SMESH::SetPointRepresentation(false); - myViewWindow->SetSelectionMode( ActorSelection ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( ActorSelection ); disconnect(mySelectionMgr, 0, this, 0); mySMESHGUI->ResetState(); reject(); @@ -523,22 +526,30 @@ void SMESHGUI_AddMeshElementDlg::onTextChange (const QString& theNewText) TColStd_MapOfInteger newIndices; QStringList aListId = QStringList::split(" ", theNewText, false); + bool allOk = true; for (int i = 0; i < aListId.count(); i++) { if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) ) { newIndices.Add( n->GetID() ); myNbOkNodes++; } + else + allOk = false; } mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false ); - myViewWindow->highlight( myActor->getIO(), true, true ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->highlight( myActor->getIO(), true, true ); - bool aNodesOK = false; - if (myIsPoly && myElementType == SMDSAbs_Face && aListId.count() >=3 ){ - myNbOkNodes = aListId.count(); - aNodesOK = true; - } + myNbOkNodes = ( allOk && myNbNodes == aListId.count() ); + + if (myIsPoly) + { + if ( !allOk || myElementType != SMDSAbs_Face || aListId.count() < 3 ) + myNbOkNodes = 0; + else + myNbOkNodes = aListId.count(); + } } if(myNbOkNodes) { @@ -693,7 +704,8 @@ void SMESHGUI_AddMeshElementDlg::ActivateThisDialog() SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode( NodeSelection ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( NodeSelection ); SelectionIntoArgument(); }