X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_CreatePolyhedralVolumeDlg.cxx;h=d32bd78d7a74281c06db05dbcd80c3ee7208cf8e;hb=9efbaa6f5e4947bdcfdd04e5412ae1ece49b02fd;hp=6e7223ed498b92dcdc626a1a863cc3ddaea45abb;hpb=8d1d4432434b779f5337b9df202ff1c3339d7180;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx index 6e7223ed4..d32bd78d7 100644 --- a/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePolyhedralVolumeDlg.cxx @@ -39,8 +39,6 @@ #include "SMESH_TypeFilter.hxx" #include "SMDS_Mesh.hxx" -#include "VTKViewer_ViewWindow.h" - #include "SUIT_ResourceMgr.h" #include "SalomeApp_Application.h" @@ -112,19 +110,15 @@ class TPolySimulation{ myPreviewActor->VisibilityOff(); myPreviewActor->SetMapper( myMapper ); - vtkProperty* aProp = vtkProperty::New(); float anRGB[3]; - anRGB[0] = GetFloat("SMESH:SettingsFillColorRed", 0)/255.; - anRGB[1] = GetFloat("SMESH:SettingsFillColorGreen", 170)/255.; - anRGB[2] = GetFloat("SMESH:SettingsFillColorBlue", 255)/255.; + vtkProperty* aProp = vtkProperty::New(); + GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) ); aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myPreviewActor->SetProperty( aProp ); aProp->Delete(); vtkProperty* aBackProp = vtkProperty::New(); - anRGB[0] = GetFloat("SMESH:SettingsBackFaceColorRed", 0)/255.; - anRGB[1] = GetFloat("SMESH:SettingsBackFaceColorGreen", 0)/255.; - anRGB[2] = GetFloat("SMESH:SettingsBackFaceColorBlue", 255)/255.; + GetColor( "SMESH", "backface_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 0, 255 ) ); aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); myPreviewActor->SetBackfaceProperty( aBackProp ); aBackProp->Delete(); @@ -195,9 +189,7 @@ SMESHGUI_CreatePolyhedralVolumeDlg::SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI bool modal, WFlags fl ) : 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 ) ) { QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH",tr("ICON_SELECT"))); @@ -314,6 +306,8 @@ SMESHGUI_CreatePolyhedralVolumeDlg::SMESHGUI_CreatePolyhedralVolumeDlg( SMESHGUI Preview = new QCheckBox( GroupContent, "Preview" ); Preview->setText( tr( "SMESH_POLYEDRE_PREVIEW" ) ); GroupContentLayout->addWidget( Preview , 5, 0 ); + + mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); SMESHGUI_CreatePolyhedralVolumeDlgLayout->addWidget( GroupContent, 1, 0 ); @@ -407,7 +401,8 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ConstructorsClicked(int constructorId) } else SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode(NodeSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(NodeSelection); AddButton->setEnabled(false); RemoveButton->setEnabled(false); @@ -430,7 +425,8 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ConstructorsClicked(int constructorId) } else { SMESH::SetPointRepresentation(false); } - myViewWindow->SetSelectionMode(FaceSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(FaceSelection); TextLabelIds->setText( tr( "SMESH_ID_FACES" ) ); myFacesByNodesLabel->hide(); @@ -558,7 +554,8 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ClickOnCancel() mySelectionMgr->setSelectedObjects( aList ); SMESH::SetPointRepresentation(false); mySimulation->SetVisibility(false); - myViewWindow->SetSelectionMode( ActorSelection ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( ActorSelection ); disconnect( mySelectionMgr, 0, this, 0 ); mySMESHGUI->ResetState() ; reject() ; @@ -583,28 +580,22 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText) if (GetConstructorId() == 0) { if ( aMesh ) { - SALOME_ListIO aList; aList.Append( myActor->getIO() ); - mySelectionMgr->setSelectedObjects( aList ); - - TColStd_IndexedMapOfInteger selectedIndices; TColStd_MapOfInteger newIndices; - mySelector->GetIndex( myActor->getIO(), selectedIndices); - + QStringList aListId = QStringList::split( " ", theNewText, false); for ( int i = 0; i < aListId.count(); i++ ) { const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ); if ( n ) { - if (selectedIndices.Add(n->GetID())) - newIndices.Add(n->GetID()); + newIndices.Add(n->GetID()); myNbOkElements++; } } - if (newIndices.Extent() > 0){ - mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true ); - myViewWindow->highlight( myActor->getIO(), true, true ); - } - + mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false ); + + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->highlight( myActor->getIO(), true, true ); + if ( myNbOkElements>0 && aListId.count()>=3) AddButton->setEnabled(true); else @@ -621,29 +612,22 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onTextChange(const QString& theNewText) // check entered ids of faces and hilight them QStringList aListId; if ( aMesh ) { - SALOME_ListIO aList; aList.Append( myActor->getIO() ); - mySelectionMgr->setSelectedObjects( aList ); - - TColStd_IndexedMapOfInteger selectedIndices; TColStd_MapOfInteger newIndices; - mySelector->GetIndex( myActor->getIO(), selectedIndices); - + aListId = QStringList::split( " ", theNewText, false); for ( int i = 0; i < aListId.count(); i++ ) { const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() ); if ( e ) { - if (selectedIndices.Add(e->GetID())) - newIndices.Add(e->GetID()); + newIndices.Add(e->GetID()); myNbOkElements++; } } - if (newIndices.Extent() > 0){ - mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, true ); - myViewWindow->highlight( myActor->getIO(), true, true ); - } - + mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->highlight( myActor->getIO(), true, true ); + if ( myNbOkElements ) { if (aListId.count()>1){ buttonOk->setEnabled( true ); @@ -873,7 +857,8 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::ActivateThisDialog() mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; - myViewWindow->SetSelectionMode( FaceSelection ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode( FaceSelection ); SelectionIntoArgument(); } @@ -1002,7 +987,8 @@ void SMESHGUI_CreatePolyhedralVolumeDlg::onListSelectionChanged() if(isSelected) RemoveButton->setEnabled(true); else RemoveButton->setEnabled(false); mySelector->AddOrRemoveIndex(myActor->getIO(), aIndexes, true ); - myViewWindow->highlight( myActor->getIO(), true, true ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->highlight( myActor->getIO(), true, true ); mySelectionMgr->clearFilters(); aList.Append( myActor->getIO() ); mySelectionMgr->setSelectedObjects( aList );