PAL7864, PAL7951, PAL7915

This commit is contained in:
vsr 2005-02-03 12:31:13 +00:00
parent c9be7f0ec9
commit 29b9e89cb6
2 changed files with 30 additions and 58 deletions

View File

@ -97,7 +97,7 @@ SMESHGUI_MultiEditDlg::SMESHGUI_MultiEditDlg( QWidget* theParent,
const bool the3d2d, const bool the3d2d,
const char* theName ) const char* theName )
: QDialog( theParent, theName, false, : QDialog( theParent, theName, false,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
{ {
myFilterDlg = 0; myFilterDlg = 0;
mySubmeshFilter = new SMESH_TypeFilter( SUBMESH ); mySubmeshFilter = new SMESH_TypeFilter( SUBMESH );
@ -214,11 +214,10 @@ QFrame* SMESHGUI_MultiEditDlg::createButtonFrame( QWidget* theParent )
// name : SMESHGUI_MultiEditDlg::isValid // name : SMESHGUI_MultiEditDlg::isValid
// Purpose : Verify validity of input data // Purpose : Verify validity of input data
//======================================================================= //=======================================================================
bool SMESHGUI_MultiEditDlg::isValid( const bool /*theMess*/ ) bool SMESHGUI_MultiEditDlg::isValid( const bool /*theMess*/ ) const
{ {
SMESH::long_array_var anIds = getIds();
return (!myMesh->_is_nil() && return (!myMesh->_is_nil() &&
(myListBox->count() > 0 || (myToAllChk->isChecked() && myActor)) && anIds->length() > 0); (myListBox->count() > 0 || (myToAllChk->isChecked() && myActor)));
} }
//======================================================================= //=======================================================================
@ -288,16 +287,10 @@ void SMESHGUI_MultiEditDlg::Init( SALOME_Selection* theSelection )
connect( myListBox, SIGNAL( selectionChanged() ), SLOT( onListSelectionChanged() ) ); connect( myListBox, SIGNAL( selectionChanged() ), SLOT( onListSelectionChanged() ) );
int nbSel = mySelection->IObjectCount(); onSelectionDone();
if ( nbSel == 1 )
myIO = mySelection->firstIObject();
// set selection mode // set selection mode
setSelectionMode(); setSelectionMode();
// process selection
//onSelectionDone();
updateButtons(); updateButtons();
} }
@ -323,9 +316,12 @@ SMESH::long_array_var SMESHGUI_MultiEditDlg::getIds()
if ( myToAllChk->isChecked() ) if ( myToAllChk->isChecked() )
{ {
myIds.Clear(); myIds.Clear();
if ( myActor != 0 ) SMESH_Actor * anActor = SMESH::FindActorByObject( myMesh );
if ( !anActor )
anActor = myActor;
if ( anActor != 0 )
{ {
TVisualObjPtr aVisualObj = myActor->GetObject(); TVisualObjPtr aVisualObj = anActor->GetObject();
vtkUnstructuredGrid* aGrid = aVisualObj->GetUnstructuredGrid(); vtkUnstructuredGrid* aGrid = aVisualObj->GetUnstructuredGrid();
if ( aGrid != 0 ) if ( aGrid != 0 )
{ {
@ -372,11 +368,7 @@ void SMESHGUI_MultiEditDlg::onClose()
disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 ); disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
SMESHGUI::GetSMESHGUI()->ResetState(); SMESHGUI::GetSMESHGUI()->ResetState();
SMESH::RemoveFilter(SMESHGUI_EdgeFilter); SMESH::RemoveFilters();
SMESH::RemoveFilter(SMESHGUI_FaceFilter);
SMESH::RemoveFilter(SMESHGUI_VolumeFilter);
SMESH::RemoveFilter(SMESHGUI_QuadFilter);
SMESH::RemoveFilter(SMESHGUI_TriaFilter);
SMESH::SetPickable(); SMESH::SetPickable();
mySelection->ClearIObjects(); mySelection->ClearIObjects();
@ -394,9 +386,6 @@ void SMESHGUI_MultiEditDlg::onSelectionDone()
if ( myBusy || !isEnabled() ) return; if ( myBusy || !isEnabled() ) return;
myBusy = true; myBusy = true;
myMesh = SMESH::SMESH_Mesh::_nil();
myActor = 0;
int nbSel = mySelection->IObjectCount(); int nbSel = mySelection->IObjectCount();
myListBox->clearSelection(); myListBox->clearSelection();
@ -453,20 +442,14 @@ void SMESHGUI_MultiEditDlg::onSelectionDone()
if ( nbSel == 1 ) { if ( nbSel == 1 ) {
myActor = SMESH::FindActorByEntry(mySelection->firstIObject()->getEntry()); myActor = SMESH::FindActorByEntry(mySelection->firstIObject()->getEntry());
//if ( !myActor && !myMesh->_is_nil() ) if (!myActor)
// myActor = SMESH::FindActorByObject( myMesh ); myActor = SMESH::FindActorByObject( myMesh );
VTKViewer_InteractorStyleSALOME* aStyle = SMESH::GetInteractorStyle(); VTKViewer_InteractorStyleSALOME* aStyle = SMESH::GetInteractorStyle();
Handle(VTKViewer_Filter) aFilter = aStyle->GetFilter( myFilterType ); Handle(VTKViewer_Filter) aFilter = aStyle->GetFilter( myFilterType );
if ( myActor ) { if ( !aFilter.IsNull() )
if ( !aFilter.IsNull() ) {
aFilter->SetActor( myActor ); aFilter->SetActor( myActor );
//SMESH::SetPickable( myActor ); //if ( myActor )
myIO = myActor->getIO(); // SMESH::SetPickable(myActor);
}
}
else {
myIO.Nullify();
}
} }
myBusy = false; myBusy = false;
@ -571,6 +554,7 @@ bool SMESHGUI_MultiEditDlg::isIdValid( const int theId ) const
VTKViewer_InteractorStyleSALOME* aStyle = SMESH::GetInteractorStyle(); VTKViewer_InteractorStyleSALOME* aStyle = SMESH::GetInteractorStyle();
Handle(SMESHGUI_Filter) aFilter = Handle(SMESHGUI_Filter) aFilter =
Handle(SMESHGUI_Filter)::DownCast( aStyle->GetFilter( myFilterType ) ); Handle(SMESHGUI_Filter)::DownCast( aStyle->GetFilter( myFilterType ) );
return ( !aFilter.IsNull() && aFilter->IsObjValid( theId ) ); return ( !aFilter.IsNull() && aFilter->IsObjValid( theId ) );
} }
@ -600,7 +584,7 @@ void SMESHGUI_MultiEditDlg::onAddBtn()
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>( anIter.Value() ); SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>( anIter.Value() );
if ( !aSubMesh->_is_nil() ) if ( !aSubMesh->_is_nil() )
{ {
if ( !myMesh->_is_nil() && aSubMesh->GetFather()->GetId() == myMesh->GetId() ) if ( aSubMesh->GetFather()->GetId() == myMesh->GetId() )
{ {
SMESH::long_array_var anIds = aSubMesh->GetElementsId(); SMESH::long_array_var anIds = aSubMesh->GetElementsId();
for ( int i = 0, n = anIds->length(); i < n; i++ ) for ( int i = 0, n = anIds->length(); i < n; i++ )
@ -619,9 +603,9 @@ void SMESHGUI_MultiEditDlg::onAddBtn()
{ {
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase_var aGroup =
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>( anIter.Value() ); SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>( anIter.Value() );
if ( !aGroup->_is_nil() && ( aGroup->GetType() == SMESH::FACE || aGroup->GetType() == SMESH::VOLUME ) ) if ( !aGroup->_is_nil() && ( aGroup->GetType() == SMESH::FACE && entityType() == 0 || aGroup->GetType() == SMESH::VOLUME && entityType() == 1 ) )
{ {
if ( !myMesh->_is_nil() && aGroup->GetMesh()->GetId() == myMesh->GetId() ) if ( aGroup->GetMesh()->GetId() == myMesh->GetId() )
{ {
SMESH::long_array_var anIds = aGroup->GetListOfID(); SMESH::long_array_var anIds = aGroup->GetListOfID();
for ( int i = 0, n = anIds->length(); i < n; i++ ) for ( int i = 0, n = anIds->length(); i < n; i++ )
@ -845,11 +829,11 @@ void SMESHGUI_MultiEditDlg::onToAllChk()
emit ListContensChanged(); emit ListContensChanged();
updateButtons();
setSelectionMode(); setSelectionMode();
//if ( !myIO.IsNull() ) if ( myActor )
//mySelection->AddIObject( myIO, true ); mySelection->AddIObject( myActor->getIO(), true );
updateButtons();
} }
@ -859,27 +843,20 @@ void SMESHGUI_MultiEditDlg::onToAllChk()
//======================================================================= //=======================================================================
void SMESHGUI_MultiEditDlg::setSelectionMode() void SMESHGUI_MultiEditDlg::setSelectionMode()
{ {
SMESH::RemoveFilter(SMESHGUI_EdgeFilter); SMESH::RemoveFilters();
SMESH::RemoveFilter(SMESHGUI_FaceFilter);
SMESH::RemoveFilter(SMESHGUI_VolumeFilter);
SMESH::RemoveFilter(SMESHGUI_QuadFilter);
SMESH::RemoveFilter(SMESHGUI_TriaFilter);
SMESH::SetPickable();
mySelection->ClearIObjects(); mySelection->ClearIObjects();
mySelection->ClearFilters(); mySelection->ClearFilters();
if ( mySubmeshChk->isChecked() ) if ( mySubmeshChk->isChecked() ) {
{
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true ); QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
mySelection->AddFilter( mySubmeshFilter ); mySelection->AddFilter( mySubmeshFilter );
} }
else if ( myGroupChk->isChecked() ) else if ( myGroupChk->isChecked() ) {
{
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true ); QAD_Application::getDesktop()->SetSelectionMode( ActorSelection, true );
mySelection->AddFilter( myGroupFilter ); mySelection->AddFilter( myGroupFilter );
} }
if ( myFilterType == SMESHGUI_VolumeFilter ) { if ( entityType() ) {
QAD_Application::getDesktop()->SetSelectionMode( VolumeSelection, true ); QAD_Application::getDesktop()->SetSelectionMode( VolumeSelection, true );
SMESH::SetFilter( new SMESHGUI_VolumesFilter() ); SMESH::SetFilter( new SMESHGUI_VolumesFilter() );
} }
@ -892,8 +869,6 @@ void SMESHGUI_MultiEditDlg::setSelectionMode()
else else
SMESH::SetFilter( new SMESHGUI_FacesFilter() ); SMESH::SetFilter( new SMESHGUI_FacesFilter() );
} }
if ( !myIO.IsNull() )
mySelection->AddIObject( myIO, true );
} }
//======================================================================= //=======================================================================
@ -954,11 +929,9 @@ void SMESHGUI_MultiEditDlg::on3d2dChanged(int type)
myFilterType = SMESHGUI_VolumeFilter; myFilterType = SMESHGUI_VolumeFilter;
else else
myFilterType = SMESHGUI_FaceFilter; myFilterType = SMESHGUI_FaceFilter;
setSelectionMode();
updateButtons(); updateButtons();
setSelectionMode();
//myActor = 0;
} }
} }

View File

@ -100,7 +100,7 @@ protected:
void hideEvent ( QHideEvent * ); /* ESC key */ void hideEvent ( QHideEvent * ); /* ESC key */
QFrame* createButtonFrame( QWidget* ); QFrame* createButtonFrame( QWidget* );
QFrame* createMainFrame ( QWidget*, const bool ); QFrame* createMainFrame ( QWidget*, const bool );
bool isValid( const bool ); bool isValid( const bool ) const;
SMESH::long_array_var getIds(); SMESH::long_array_var getIds();
void updateButtons(); void updateButtons();
void setSelectionMode(); void setSelectionMode();
@ -143,7 +143,6 @@ protected:
Handle(SMESH_TypeFilter) myGroupFilter; Handle(SMESH_TypeFilter) myGroupFilter;
bool myBusy; bool myBusy;
int myEntityType; int myEntityType;
Handle(SALOME_InteractiveObject) myIO;
}; };
/* /*