Fixes for:

- Bug IPAL8767: Polyhedron created on nodes is invisible
- Id of the first node/face should be appeared in the field right after selection
- Preview of faces by nodes for polyhedron doesn’t disappear after removing it from list in the "Create Polyhedral Volume" dialog box.
- Preview of polyhedron doesn’t disappear after removing a face from list in the "Create Polyhedral Volume" dialog box.
This commit is contained in:
enk 2005-06-24 06:21:49 +00:00
parent d72c027376
commit 8d1d443243

View File

@ -151,11 +151,15 @@ class TPolySimulation{
anIds->InsertId(i,theIds[i]); anIds->InsertId(i,theIds[i]);
myGrid->InsertNextCell(theType,anIds); myGrid->InsertNextCell(theType,anIds);
if(theIds.size()!=0){
myGrid->InsertNextCell(theType,anIds);
myGrid->Modified();
}
anIds->Delete(); anIds->Delete();
myGrid->Modified();
SetVisibility(true); SetVisibility(true);
} }
void ResetGrid(bool theReset=true){ void ResetGrid(bool theReset=true){
@ -382,7 +386,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::Init()
//================================================================================= //=================================================================================
void SMESHGUI_CreatePolyhedralVolumeDlg::ConstructorsClicked(int constructorId) void SMESHGUI_CreatePolyhedralVolumeDlg::ConstructorsClicked(int constructorId)
{ {
disconnect(mySelectionMgr, 0, this, 0); //disconnect(mySelectionMgr, 0, this, 0);
SALOME_ListIO aList; SALOME_ListIO aList;
mySelectionMgr->setSelectedObjects( aList ); mySelectionMgr->setSelectedObjects( aList );
@ -398,6 +402,8 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ConstructorsClicked(int constructorId)
{ {
if ( myActor ){ if ( myActor ){
myActor->SetPointRepresentation(true); myActor->SetPointRepresentation(true);
myActor->SetEntityMode(SMESH_Actor::eVolumes);
myActor->SetRepresentation(SMESH_Actor::eSurface);
} }
else else
SMESH::SetPointRepresentation(true); SMESH::SetPointRepresentation(true);
@ -416,7 +422,14 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ConstructorsClicked(int constructorId)
} }
case 1 : 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); myViewWindow->SetSelectionMode(FaceSelection);
TextLabelIds->setText( tr( "SMESH_ID_FACES" ) ); 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,10 +594,6 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText)
for ( int i = 0; i < aListId.count(); i++ ) { for ( int i = 0; i < aListId.count(); i++ ) {
const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ); const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
if ( n ) { if ( n ) {
/*if ( mySelectionMgr->IsIndexSelected( myActor->getIO(), n->GetID() ))
allOk = false;
else
mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), n->GetID(), true);*/
if (selectedIndices.Add(n->GetID())) if (selectedIndices.Add(n->GetID()))
newIndices.Add(n->GetID()); newIndices.Add(n->GetID());
myNbOkElements++; myNbOkElements++;
@ -596,22 +605,14 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText)
myViewWindow->highlight( myActor->getIO(), true, 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) if ( myNbOkElements>0 && aListId.count()>=3)
AddButton->setEnabled(true); AddButton->setEnabled(true);
else else
AddButton->setEnabled(false); AddButton->setEnabled(false);
// if (allOk && !myOkElements) displaySimulation();
displaySimulation();
}
} }
else if (GetConstructorId() == 1) } else if (GetConstructorId() == 1)
{ {
myNbOkElements = 0; myNbOkElements = 0;
buttonOk->setEnabled( false ); buttonOk->setEnabled( false );
@ -632,10 +633,6 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText)
for ( int i = 0; i < aListId.count(); i++ ) { for ( int i = 0; i < aListId.count(); i++ ) {
const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() ); const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
if ( e ) { if ( e ) {
/*if ( mySelectionMgr->IsIndexSelected( myActor->getIO(), e->GetID() ))
myOkElements = false;
else
mySelectionMgr->AddOrRemoveIndex (myActor->getIO(), e->GetID(), true);*/
if (selectedIndices.Add(e->GetID())) if (selectedIndices.Add(e->GetID()))
newIndices.Add(e->GetID()); newIndices.Add(e->GetID());
myNbOkElements++; myNbOkElements++;
@ -715,8 +712,9 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::SelectionIntoArgument()
int anbNodes = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aString); int anbNodes = SMESH::GetNameOfSelectedNodes(mySelector, myActor->getIO(), aString);
if (anbNodes >= 3) if (anbNodes >= 3)
AddButton->setEnabled(true); AddButton->setEnabled(true);
else else if (anbNodes < 3){
break; AddButton->setEnabled(false);
}
busy = true; busy = true;
myEditCurrentArgument->setText( aString ); myEditCurrentArgument->setText( aString );
busy = false; busy = false;
@ -725,16 +723,19 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::SelectionIntoArgument()
case 1:{ case 1:{
// get selected faces // get selected faces
int aNbFaces = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString); int aNbFaces = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aString);
if (aNbFaces<=1) if (aNbFaces<=1){
return; buttonOk->setEnabled( false );
buttonApply->setEnabled( false );
} else {
buttonOk->setEnabled( true );
buttonApply->setEnabled( true );
}
busy = true; busy = true;
myEditCurrentArgument->setText( aString ); myEditCurrentArgument->setText( aString );
busy = false; busy = false;
// OK // OK
myNbOkElements = 1; myNbOkElements = 1;
buttonOk->setEnabled( true );
buttonApply->setEnabled( true );
break; break;
} }
default: return; default: return;
@ -772,6 +773,11 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::displaySimulation()
mySimulation->SetPosition(myActor, aType, aVTKIds_faces,false); mySimulation->SetPosition(myActor, aType, aVTKIds_faces,false);
} }
} }
if(myFacesByNodes->count() == 0){
mySimulation->SetVisibility(false);
} else {
mySimulation->SetVisibility(true);
}
if(Preview->isChecked()){ if(Preview->isChecked()){
mySimulation->SetPosition(myActor, aType, aVTKIds); mySimulation->SetPosition(myActor, aType, aVTKIds);
} }
@ -818,6 +824,7 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::displaySimulation()
mySimulation->SetPosition(myActor, aType, aVTKIds); mySimulation->SetPosition(myActor, aType, aVTKIds);
} }
} }
SMESH::UpdateView();
} }
} }
@ -937,7 +944,6 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onAdd()
myNbOkElements = 1; myNbOkElements = 1;
myEditCurrentArgument->clear(); myEditCurrentArgument->clear();
AddButton->setEnabled(false); AddButton->setEnabled(false);
RemoveButton->setEnabled(true);
buttonOk->setEnabled( true ); buttonOk->setEnabled( true );
if(myFacesByNodes->count()>1) buttonApply->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--) { for (int i = myFacesByNodes->count(); i > 0; i--) {
if (myFacesByNodes->isSelected(i-1)) { if (myFacesByNodes->isSelected(i-1)) {
myFacesByNodes->removeItem(i-1); myFacesByNodes->removeItem(i-1);
myNbOkElements = 1;
} }
} }
if (myFacesByNodes->count() < 1){ if (myFacesByNodes->count() < 1){
myNbOkElements = 0;
RemoveButton->setEnabled(false); RemoveButton->setEnabled(false);
buttonOk->setEnabled( false ); buttonOk->setEnabled( false );
buttonApply->setEnabled( false ); buttonApply->setEnabled( false );
} }
else if (myFacesByNodes->count() == 1){ else if (myFacesByNodes->count() == 1){
myNbOkElements = 0;
buttonOk->setEnabled( false ); buttonOk->setEnabled( false );
buttonApply->setEnabled( false ); buttonApply->setEnabled( false );
} }
displaySimulation();
busy = false; busy = false;
onListSelectionChanged(); displaySimulation();
} }
//================================================================================= //=================================================================================
@ -982,22 +986,26 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onListSelectionChanged()
{ {
if (busy || !myActor) return; if (busy || !myActor) return;
busy = true; busy = true;
bool isSelected=false;
SALOME_ListIO list; SALOME_ListIO aList;
mySelectionMgr->setSelectedObjects( list ); mySelectionMgr->setSelectedObjects( aList );
TColStd_MapOfInteger aIndexes; TColStd_MapOfInteger aIndexes;
QListBoxItem* anItem; QListBoxItem* anItem;
for (anItem = myFacesByNodes->firstItem(); anItem != 0; anItem = anItem->next()) { for (anItem = myFacesByNodes->firstItem(); anItem != 0; anItem = anItem->next()) {
if (anItem->isSelected()) { if (anItem->isSelected()) {
isSelected = true;
QStringList anIds = QStringList::split(" ", anItem->text()); QStringList anIds = QStringList::split(" ", anItem->text());
for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it) for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it)
aIndexes.Add((*it).toInt()); aIndexes.Add((*it).toInt());
} }
} }
if(isSelected) RemoveButton->setEnabled(true);
else RemoveButton->setEnabled(false);
mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, true ); mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, true );
myViewWindow->highlight( myActor->getIO(), true, true ); myViewWindow->highlight( myActor->getIO(), true, true );
list.Append( myActor->getIO() ); mySelectionMgr->clearFilters();
mySelectionMgr->setSelectedObjects( list ); aList.Append( myActor->getIO() );
mySelectionMgr->setSelectedObjects( aList );
busy = false; busy = false;
} }