From 8d1d4432434b779f5337b9df202ff1c3339d7180 Mon Sep 17 00:00:00 2001 From: enk Date: Fri, 24 Jun 2005 06:21:49 +0000 Subject: [PATCH] =?utf8?q?Fixes=20for:=20-=20Bug=20IPAL8767:=20Polyhedron?= =?utf8?q?=20created=20on=20nodes=20is=20invisible=20-=20Id=20of=20the=20f?= =?utf8?q?irst=20node/face=20should=20be=20appeared=20in=20the=20field=20r?= =?utf8?q?ight=20after=20selection=20-=20Preview=20of=20faces=20by=20nodes?= =?utf8?q?=20for=20polyhedron=20doesn=C3=83=C2=A2=C3=82=C2=80=C3=82=C2=99t?= =?utf8?q?=20disappear=20after=20removing=20it=20from=20list=20in=20the=20?= =?utf8?q?"Create=20Polyhedral=20Volume"=20dialog=20box.=20-=20Preview=20o?= =?utf8?q?f=20polyhedron=20doesn=C3=83=C2=A2=C3=82=C2=80=C3=82=C2=99t=20di?= =?utf8?q?sappear=20after=20removing=20a=20face=20from=20list=20in=20the?= =?utf8?q?=20"Create=20Polyhedral=20Volume"=20dialog=20box.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../SMESHGUI_CreatePolyhedralVolumeDlg.cxx | 96 ++++++++++--------- 1 file changed, 52 insertions(+), 44 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx index a3079f9bf..6e7223ed4 100644 --- a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx @@ -151,11 +151,15 @@ class TPolySimulation{ anIds->InsertId(i,theIds[i]); myGrid->InsertNextCell(theType,anIds); + if(theIds.size()!=0){ + myGrid->InsertNextCell(theType,anIds); + myGrid->Modified(); + } + anIds->Delete(); - myGrid->Modified(); - SetVisibility(true); + } void ResetGrid(bool theReset=true){ @@ -382,7 +386,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::Init() //================================================================================= void SMESHGUI_CreatePolyhedralVolumeDlg::ConstructorsClicked(int constructorId) { - disconnect(mySelectionMgr, 0, this, 0); + //disconnect(mySelectionMgr, 0, this, 0); SALOME_ListIO aList; mySelectionMgr->setSelectedObjects( aList ); @@ -398,6 +402,8 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ConstructorsClicked(int constructorId) { if ( myActor ){ myActor->SetPointRepresentation(true); + myActor->SetEntityMode(SMESH_Actor::eVolumes); + myActor->SetRepresentation(SMESH_Actor::eSurface); } else SMESH::SetPointRepresentation(true); @@ -416,7 +422,14 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ConstructorsClicked(int constructorId) } case 1 : { - SMESH::SetPointRepresentation(false); + if( myActor ){ + myActor->SetPointRepresentation(false); + myActor->SetEntityMode(SMESH_Actor::eFaces); + myActor->SetEntityMode(SMESH_Actor::eVolumes); + myActor->SetRepresentation(SMESH_Actor::eSurface); + } else { + SMESH::SetPointRepresentation(false); + } myViewWindow->SetSelectionMode(FaceSelection); TextLabelIds->setText( tr( "SMESH_ID_FACES" ) ); @@ -429,7 +442,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ConstructorsClicked(int constructorId) } } - connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + //connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } //================================================================================= @@ -581,37 +594,25 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText) for ( int i = 0; i < aListId.count(); i++ ) { const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ); if ( n ) { - /*if ( mySelectionMgr->IsIndexSelected( myActor->getIO(), n->GetID() )) - allOk = false; - else - mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);*/ if (selectedIndices.Add(n->GetID())) newIndices.Add(n->GetID()); myNbOkElements++; } } - + if (newIndices.Extent() > 0){ mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true ); myViewWindow->highlight( myActor->getIO(), true, true ); } -/* bool aNodesOK = false; - if (aListId.count() >= 3) - aNodesOK = true; - - allOk = (allOk && aNodesOK);*/ - if ( myNbOkElements>0 && aListId.count()>=3) AddButton->setEnabled(true); - else - AddButton->setEnabled(false); - -// if (allOk && !myOkElements) - displaySimulation(); - } + else + AddButton->setEnabled(false); + + displaySimulation(); } - else if (GetConstructorId() == 1) + } else if (GetConstructorId() == 1) { myNbOkElements = 0; buttonOk->setEnabled( false ); @@ -632,10 +633,6 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText) for ( int i = 0; i < aListId.count(); i++ ) { const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() ); if ( e ) { - /*if ( mySelectionMgr->IsIndexSelected( myActor->getIO(), e->GetID() )) - myOkElements = false; - else - mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);*/ if (selectedIndices.Add(e->GetID())) newIndices.Add(e->GetID()); myNbOkElements++; @@ -715,8 +712,9 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::SelectionIntoArgument() int anbNodes = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aString); if (anbNodes >= 3) AddButton->setEnabled(true); - else - break; + else if (anbNodes < 3){ + AddButton->setEnabled(false); + } busy = true; myEditCurrentArgument->setText( aString ); busy = false; @@ -725,16 +723,19 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::SelectionIntoArgument() case 1:{ // get selected faces int aNbFaces = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString); - if (aNbFaces<=1) - return; + if (aNbFaces<=1){ + buttonOk->setEnabled( false ); + buttonApply->setEnabled( false ); + } else { + buttonOk->setEnabled( true ); + buttonApply->setEnabled( true ); + } busy = true; myEditCurrentArgument->setText( aString ); busy = false; // OK myNbOkElements = 1; - buttonOk->setEnabled( true ); - buttonApply->setEnabled( true ); break; } default: return; @@ -772,6 +773,11 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::displaySimulation() mySimulation->SetPosition(myActor, aType, aVTKIds_faces,false); } } + if(myFacesByNodes->count() == 0){ + mySimulation->SetVisibility(false); + } else { + mySimulation->SetVisibility(true); + } if(Preview->isChecked()){ mySimulation->SetPosition(myActor, aType, aVTKIds); } @@ -818,7 +824,8 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::displaySimulation() mySimulation->SetPosition(myActor, aType, aVTKIds); } } - } + SMESH::UpdateView(); + } } //================================================================================= @@ -937,7 +944,6 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onAdd() myNbOkElements = 1; myEditCurrentArgument->clear(); AddButton->setEnabled(false); - RemoveButton->setEnabled(true); buttonOk->setEnabled( true ); if(myFacesByNodes->count()>1) buttonApply->setEnabled( true ); } @@ -956,22 +962,20 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onRemove() for (int i = myFacesByNodes->count(); i > 0; i--) { if (myFacesByNodes->isSelected(i-1)) { myFacesByNodes->removeItem(i-1); + myNbOkElements = 1; } } if (myFacesByNodes->count() < 1){ - myNbOkElements = 0; RemoveButton->setEnabled(false); buttonOk->setEnabled( false ); buttonApply->setEnabled( false ); } else if (myFacesByNodes->count() == 1){ - myNbOkElements = 0; buttonOk->setEnabled( false ); buttonApply->setEnabled( false ); } - displaySimulation(); busy = false; - onListSelectionChanged(); + displaySimulation(); } //================================================================================= @@ -982,22 +986,26 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onListSelectionChanged() { if (busy || !myActor) return; busy = true; - - SALOME_ListIO list; - mySelectionMgr->setSelectedObjects( list ); + bool isSelected=false; + SALOME_ListIO aList; + mySelectionMgr->setSelectedObjects( aList ); TColStd_MapOfInteger aIndexes; QListBoxItem* anItem; for (anItem = myFacesByNodes->firstItem(); anItem != 0; anItem = anItem->next()) { if (anItem->isSelected()) { + isSelected = true; QStringList anIds = QStringList::split(" ", anItem->text()); for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it) aIndexes.Add((*it).toInt()); } } + if(isSelected) RemoveButton->setEnabled(true); + else RemoveButton->setEnabled(false); mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, true ); myViewWindow->highlight( myActor->getIO(), true, true ); - list.Append( myActor->getIO() ); - mySelectionMgr->setSelectedObjects( list ); + mySelectionMgr->clearFilters(); + aList.Append( myActor->getIO() ); + mySelectionMgr->setSelectedObjects( aList ); busy = false; } -- 2.39.2