X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_FilterDlg.cxx;h=108f7bed5e24780e97ff32670d68faba6248ebfb;hb=f0bf265fc0ea849ad1a359e10ad0c9cf6b0b9bb8;hp=b3f81c9d534aa67bcfecbab2e09650ca68946b06;hpb=f932a6abb6c38b379f501ceec12d90cce92d90c7;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index b3f81c9d5..108f7bed5 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -23,8 +23,9 @@ // SMESH SMESHGUI : GUI for SMESH component // File : SMESHGUI_FilterDlg.cxx // Author : Sergey LITONIN, Open CASCADE S.A.S. -// SMESH includes // + +// SMESH includes #include "SMESHGUI_FilterDlg.h" #include "SMESHGUI.h" @@ -1001,6 +1002,17 @@ void SMESHGUI_FilterTable::Init (const QList& theTypes) myLibDlg = 0; } + else + { + QList::const_iterator typeIt = theTypes.begin(); + for ( ; typeIt != theTypes.end(); ++typeIt ) { + if ( !myTables[ *typeIt ] ) { + Table* aTable = createTable(mySwitchTableGrp, *typeIt); + myTables[ *typeIt ] = aTable; + ((QVBoxLayout*)mySwitchTableGrp->layout())->addWidget(myTables[ *typeIt ]); + } + } + } // Hide buttons of entity types if necessary const QMap& aSupportedTypes = getSupportedTypes(); @@ -1628,6 +1640,14 @@ static QList geomTypes( const int theType ) typeIds.append( SMESH::Geom_HEXAGONAL_PRISM ); typeIds.append( SMESH::Geom_POLYHEDRA ); } + if ( theType == SMESH::ALL || theType == SMESH::ELEM0D ) + { + typeIds.append( SMESH::Geom_POINT ); + } + if ( theType == SMESH::ALL || theType == SMESH::BALL ) + { + typeIds.append( SMESH::Geom_BALL ); + } return typeIds; } @@ -1734,6 +1754,7 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con aTable->blockSignals( isSignalsBlocked ); } + // set Compare and enable/desable Threshold if ((aType == SMESH::NODE && (aCriterionType == SMESH::FT_FreeNodes || aCriterionType == SMESH::FT_EqualNodes )) || (aType == SMESH::EDGE && (aCriterionType == SMESH::FT_FreeBorders || @@ -1961,6 +1982,8 @@ const QMap& SMESHGUI_FilterTable::getSupportedTypes() const if (aTypes.isEmpty()) { aTypes[ SMESH::NODE ] = tr("NODES"); + aTypes[ SMESH::ELEM0D ] = tr("ELEM0D"); + aTypes[ SMESH::BALL ] = tr("BALLS"); aTypes[ SMESH::EDGE ] = tr("EDGES"); aTypes[ SMESH::FACE ] = tr("FACES"); aTypes[ SMESH::VOLUME ] = tr("VOLUMES"); @@ -2067,6 +2090,49 @@ const QMap& SMESHGUI_FilterTable::getCriteria (const int theType) } return aCriteria; } + else if (theType == SMESH::ELEM0D) + { + static QMap aCriteria; + if (aCriteria.isEmpty()) + { + aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS"); + aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM"); + aCriteria[ SMESH::FT_BelongToPlane ] = tr("BELONG_TO_PLANE"); + aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER"); + aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE"); + aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR"); + } + return aCriteria; + } + else if (theType == SMESH::BALL) + { + static QMap aCriteria; + if (aCriteria.isEmpty()) + { + aCriteria[ SMESH::FT_BallDiameter ] = tr("BALL_DIAMETER"); + aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS"); + aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM"); + aCriteria[ SMESH::FT_BelongToPlane ] = tr("BELONG_TO_PLANE"); + aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER"); + aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE"); + aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR"); + } + return aCriteria; + } + else if (theType == SMESH::ELEM0D) + { + static QMap aCriteria; + if (aCriteria.isEmpty()) + { + aCriteria[ SMESH::FT_RangeOfIds ] = tr("RANGE_OF_IDS"); + aCriteria[ SMESH::FT_BelongToGeom ] = tr("BELONG_TO_GEOM"); + aCriteria[ SMESH::FT_BelongToPlane ] = tr("BELONG_TO_PLANE"); + aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER"); + aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE"); + aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR"); + } + return aCriteria; + } else // SMESH::ALL { static QMap aCriteria; @@ -2608,18 +2674,18 @@ SMESHGUI_FilterDlg::~SMESHGUI_FilterDlg() // name : SMESHGUI_FilterDlg::Init // Purpose : Init dialog fields, connect signals and slots, show dialog //======================================================================= -void SMESHGUI_FilterDlg::Init (const int type) +void SMESHGUI_FilterDlg::Init (const int type, const bool setInViewer) { QList aTypes; aTypes.append(type); - Init(aTypes); + Init(aTypes,setInViewer); } //======================================================================= // name : SMESHGUI_FilterDlg::Init // Purpose : Init dialog fields, connect signals and slots, show dialog //======================================================================= -void SMESHGUI_FilterDlg::Init (const QList& theTypes) +void SMESHGUI_FilterDlg::Init (const QList& theTypes, const bool setInViewer) { mySourceWg = 0; myTypes = theTypes; @@ -2634,6 +2700,8 @@ void SMESHGUI_FilterDlg::Init (const QList& theTypes) { int aType = theTypes.first(); if (aType == SMESH::NODE ) setWindowTitle(tr("NODES_TLT")); + else if (aType == SMESH::ELEM0D) setWindowTitle(tr("ELEM0D_TLT")); + else if (aType == SMESH::BALL ) setWindowTitle(tr("BALL_TLT")); else if (aType == SMESH::EDGE ) setWindowTitle(tr("EDGES_TLT")); else if (aType == SMESH::FACE ) setWindowTitle(tr("FACES_TLT")); else if (aType == SMESH::VOLUME) setWindowTitle(tr("VOLUMES_TLT")); @@ -2674,7 +2742,7 @@ void SMESHGUI_FilterDlg::Init (const QList& theTypes) if (myInsertState.contains(theTypes.first())) mySetInViewer->setChecked(myInsertState[ theTypes.first() ]); else - mySetInViewer->setChecked(true); + mySetInViewer->setChecked(setInViewer); mySourceGrp->button(myApplyToState.contains(theTypes.first()) ? myApplyToState[ theTypes.first() ] : @@ -2840,6 +2908,8 @@ Selection_Mode SMESHGUI_FilterDlg::getSelMode (const int theType) const switch (theType) { case SMESH::NODE : return NodeSelection; + case SMESH::ELEM0D : return Elem0DSelection; + case SMESH::BALL : return BallSelection; case SMESH::EDGE : return EdgeSelection; case SMESH::FACE : return FaceSelection; case SMESH::VOLUME : return VolumeSelection; @@ -2969,7 +3039,7 @@ bool SMESHGUI_FilterDlg::isValid() const //======================================================================= // name : SMESHGUI_FilterDlg::SetSourceWg -// Purpose : Set widget of parent dialog containing idsto be filtered if +// Purpose : Set widget of parent dialog containing ids to be filtered if // user select corresponding source radio button //======================================================================= void SMESHGUI_FilterDlg::SetSourceWg (QWidget* theWg, @@ -3188,6 +3258,7 @@ void SMESHGUI_FilterDlg::filterSource (const int theType, // filter ids SMESH::Predicate_ptr aPred = myFilter[ theType ]->GetPredicate(); + myFilter[ theType ]->SetMesh(myMesh); QList::const_iterator anIter; for (anIter = aDialogIds.begin(); anIter != aDialogIds.end(); ++ anIter) if (aPred->IsSatisfy(*anIter)) @@ -3260,6 +3331,7 @@ void SMESHGUI_FilterDlg::filterSelectionSource (const int theType, // Filter entities SMESH::Predicate_ptr aPred = myFilter[ theType ]->GetPredicate(); + myFilter[ theType ]->SetMesh(myMesh); TColStd_MapIteratorOfMapOfInteger aResIter(aToBeFiltered); for ( ; aResIter.More(); aResIter.Next()) if (aPred->IsSatisfy(aResIter.Key())) @@ -3460,6 +3532,8 @@ void SMESHGUI_FilterDlg::updateSelection() } else { + mySelector->SetSelectionMode( getSelMode( myTable->GetType() )); + if (myIsSelectionChanged) { // mySelectionMgr->installFilter( new GEOM_TypeFilter( aStudy, -1 ) ); // This filter deactivates selection // Impossible to select any object in the OB on the second opening of FilterDlg