+
+
+//=======================================================================
+// name : SMESHGUI_FilterLibraryDlg::onSelectionDone
+// Purpose : SLOT called when selection changed.
+// If current cell corresponds to the threshold value of
+// BelongToGeom criterion name of selected object is set in this cell
+//=======================================================================
+
+void SMESHGUI_FilterLibraryDlg::onSelectionDone()
+{
+ SALOME_ListIO aList;
+ if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
+ aSel->selectedObjects( aList );
+
+ int aRow, aCol;
+ if (aList.Extent() != 1 || !myTable->CurrentCell(aRow, aCol))
+ return;
+
+ const int type = myTable->GetCriterionType(aRow);
+ QList<int> types;
+ types << SMESH::FT_BelongToGeom << SMESH::FT_BelongToPlane
+ << SMESH::FT_BelongToCylinder << SMESH::FT_BelongToGenSurface
+ << SMESH::FT_LyingOnGeom << SMESH::FT_CoplanarFaces
+ << SMESH::FT_ConnectedElements << SMESH::FT_BelongToMeshGroup;
+ if ( !types.contains( type ))
+ return;
+
+ Handle(SALOME_InteractiveObject) anIO = aList.First();
+ switch ( type )
+ {
+ case SMESH::FT_CoplanarFaces: // get ID of a selected mesh face
+ {
+ QString aString;
+ int nbElems = SMESH::GetNameOfSelectedElements(SMESH::GetSelector(), anIO, aString);
+ if (nbElems == 1)
+ myTable->SetThreshold(aRow, aString);
+ break;
+ }
+ case SMESH::FT_ConnectedElements: // get either VERTEX or a node ID
+ {
+ GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO);
+ if (!anObj->_is_nil())
+ {
+ myTable->SetThreshold(aRow, GEOMBase::GetName(anObj));
+ myTable->SetID (aRow, anIO->getEntry());
+ }
+ else
+ {
+ QString aString;
+ int nbElems = SMESH::GetNameOfSelectedElements(SMESH::GetSelector(), anIO, aString);
+ if (nbElems == 1)
+ myTable->SetThreshold(aRow, aString);
+ }
+ break;
+ }
+ case SMESH::FT_BelongToMeshGroup: // get a group name and IOR
+ {
+ myTable->SetThreshold(aRow, anIO->getName() );
+ }
+ default: // get a GEOM object
+ {
+ GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO);
+ if (!anObj->_is_nil())
+ {
+ myTable->SetThreshold(aRow, GEOMBase::GetName(anObj));
+ myTable->SetID (aRow, anIO->getEntry());
+ }
+ }
+ }
+}
+
+//=================================================================================
+// function : keyPressEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_FilterLibraryDlg::keyPressEvent( QKeyEvent* e )
+{
+ QDialog::keyPressEvent( e );
+ if ( e->isAccepted() )
+ return;
+
+ if ( e->key() == Qt::Key_F1 ) {
+ e->accept();
+ onHelp();
+ }
+}