0022098: EDF 2036 SMESH: Create groups from none conected parts of a mesh

0022100: EDF 2413 SMESH: Take into account TRIA7
This commit is contained in:
eap 2013-05-16 17:18:28 +00:00
parent 9791c651e7
commit 0e9e37a6e8
4 changed files with 287 additions and 82 deletions

View File

@ -36,9 +36,10 @@
#include "SMESHGUI_FilterLibraryDlg.h" #include "SMESHGUI_FilterLibraryDlg.h"
#include "SMESHGUI_SpinBox.h" #include "SMESHGUI_SpinBox.h"
#include <SMESH_Actor.h> #include "SMESH_Actor.h"
#include <SMESH_NumberFilter.hxx> #include "SMESH_NumberFilter.hxx"
#include <SMESH_TypeFilter.hxx> #include "SMESH_TypeFilter.hxx"
#include "SMESH_LogicalFilter.hxx"
// SALOME GEOM includes // SALOME GEOM includes
#include <GEOMBase.h> #include <GEOMBase.h>
@ -1127,7 +1128,8 @@ bool SMESHGUI_FilterTable::IsValid (const bool theMess, const int theEntityType)
{ {
int aCriterion = GetCriterionType(i, aType); int aCriterion = GetCriterionType(i, aType);
QString errMsg; QString errMsg;
if (aCriterion == SMESH::FT_GroupColor ) { if (aCriterion == SMESH::FT_GroupColor )
{
QtxColorButton* clrBtn = qobject_cast<QtxColorButton*>(aTable->cellWidget(i, 2)); QtxColorButton* clrBtn = qobject_cast<QtxColorButton*>(aTable->cellWidget(i, 2));
if (clrBtn && !clrBtn->color().isValid()) if (clrBtn && !clrBtn->color().isValid())
errMsg = tr( "GROUPCOLOR_ERROR" ); errMsg = tr( "GROUPCOLOR_ERROR" );
@ -1140,12 +1142,14 @@ bool SMESHGUI_FilterTable::IsValid (const bool theMess, const int theEntityType)
aCriterion == SMESH::FT_ElemGeomType || aCriterion == SMESH::FT_ElemGeomType ||
aCriterion == SMESH::FT_EntityType || aCriterion == SMESH::FT_EntityType ||
aCriterion == SMESH::FT_CoplanarFaces || aCriterion == SMESH::FT_CoplanarFaces ||
aCriterion == SMESH::FT_LyingOnGeom) aCriterion == SMESH::FT_LyingOnGeom ||
aCriterion == SMESH::FT_ConnectedElements )
{ {
if (aTable->text(i, 2).isEmpty()) if (aTable->text(i, 2).isEmpty())
errMsg = tr( "ERROR" ); errMsg = tr( "ERROR" );
} }
else { else
{
bool aRes = false; bool aRes = false;
bool isSignalsBlocked = aTable->signalsBlocked(); bool isSignalsBlocked = aTable->signalsBlocked();
aTable->blockSignals(true); aTable->blockSignals(true);
@ -1254,12 +1258,35 @@ void SMESHGUI_FilterTable::GetCriterion (const int theRow,
theCriterion.ThresholdStr = clrStr.toLatin1().constData(); theCriterion.ThresholdStr = clrStr.toLatin1().constData();
} }
} }
else if ( aCriterionType == SMESH::FT_ElemGeomType ) else if ( aCriterionType == SMESH::FT_ElemGeomType ||
theCriterion.Threshold = (double)((ComboItem*)aTable->item(theRow, 2))->value(); aCriterionType == SMESH::FT_EntityType )
else if ( aCriterionType == SMESH::FT_EntityType ) {
theCriterion.Threshold = (double)((ComboItem*)aTable->item(theRow, 2))->value(); theCriterion.Threshold = (double)((ComboItem*)aTable->item(theRow, 2))->value();
}
else if ( aCriterionType == SMESH::FT_CoplanarFaces ) else if ( aCriterionType == SMESH::FT_CoplanarFaces )
{
theCriterion.ThresholdID = aTable->text(theRow, 2).toLatin1().constData(); theCriterion.ThresholdID = aTable->text(theRow, 2).toLatin1().constData();
}
else if ( aCriterionType == SMESH::FT_ConnectedElements )
{
QString id = aTable->text(theRow, 5);
if ( !id.isEmpty() ) // shape ID
{
theCriterion.ThresholdID = id.toLatin1().constData();
}
else
{
QString text = aTable->text(theRow, 2).trimmed();
QString workText = text;
for ( char c = '0'; c <= '9'; ++c )
workText.remove( c );
if ( workText.isEmpty() ) // node ID
theCriterion.Threshold = text.toDouble();
else // point coordinates
theCriterion.ThresholdStr = text.toLatin1().constData();
}
}
else if ( aCriterionType != SMESH::FT_RangeOfIds && else if ( aCriterionType != SMESH::FT_RangeOfIds &&
aCriterionType != SMESH::FT_BelongToGeom && aCriterionType != SMESH::FT_BelongToGeom &&
aCriterionType != SMESH::FT_BelongToPlane && aCriterionType != SMESH::FT_BelongToPlane &&
@ -1329,12 +1356,8 @@ void SMESHGUI_FilterTable::SetCriterion (const int theRow,
clrBtn->setColor( qClr ); clrBtn->setColor( qClr );
} }
} }
else if (theCriterion.Type == SMESH::FT_ElemGeomType ) else if (theCriterion.Type == SMESH::FT_ElemGeomType ||
{ theCriterion.Type == SMESH::FT_EntityType )
ComboItem* typeBox = (ComboItem*)aTable->item(theRow, 2);
typeBox->setValue( (int)(theCriterion.Threshold + 0.5) );
}
else if (theCriterion.Type == SMESH::FT_EntityType )
{ {
ComboItem* typeBox = (ComboItem*)aTable->item(theRow, 2); ComboItem* typeBox = (ComboItem*)aTable->item(theRow, 2);
typeBox->setValue( (int)(theCriterion.Threshold + 0.5) ); typeBox->setValue( (int)(theCriterion.Threshold + 0.5) );
@ -1343,13 +1366,32 @@ void SMESHGUI_FilterTable::SetCriterion (const int theRow,
{ {
aTable->item( theRow, 2 )->setText( QString( theCriterion.ThresholdID ) ); aTable->item( theRow, 2 )->setText( QString( theCriterion.ThresholdID ) );
} }
else if (theCriterion.Type == SMESH::FT_ConnectedElements )
{
if ( strlen( theCriterion.ThresholdID ) > 0 ) // shape ID -> name
{
_PTR(SObject) sobj =
SMESH::GetActiveStudyDocument()->FindObjectID( theCriterion.ThresholdID.in() );
if ( !sobj )
aTable->item( theRow, 2 )->setText( QString( theCriterion.ThresholdID ) );
else
aTable->item( theRow, 2 )->setText( QString( sobj->GetName().c_str() ));
}
else if ( strlen( theCriterion.ThresholdStr ) > 0 ) // point coords
{
aTable->item( theRow, 2 )->setText( QString( theCriterion.ThresholdStr ));
}
else // node ID
{
aTable->item( theRow, 2 )->setText( QString("%1").arg((int) theCriterion.Threshold ));
}
}
else if (theCriterion.Type != SMESH::FT_RangeOfIds && else if (theCriterion.Type != SMESH::FT_RangeOfIds &&
theCriterion.Type != SMESH::FT_BelongToGeom && theCriterion.Type != SMESH::FT_BelongToGeom &&
theCriterion.Type != SMESH::FT_BelongToPlane && theCriterion.Type != SMESH::FT_BelongToPlane &&
theCriterion.Type != SMESH::FT_BelongToCylinder && theCriterion.Type != SMESH::FT_BelongToCylinder &&
theCriterion.Type != SMESH::FT_BelongToGenSurface && theCriterion.Type != SMESH::FT_BelongToGenSurface &&
theCriterion.Type != SMESH::FT_LyingOnGeom && theCriterion.Type != SMESH::FT_LyingOnGeom &&
theCriterion.Type != SMESH::FT_CoplanarFaces &&
theCriterion.Type != SMESH::FT_FreeBorders && theCriterion.Type != SMESH::FT_FreeBorders &&
theCriterion.Type != SMESH::FT_FreeEdges && theCriterion.Type != SMESH::FT_FreeEdges &&
theCriterion.Type != SMESH::FT_FreeNodes && theCriterion.Type != SMESH::FT_FreeNodes &&
@ -1670,22 +1712,44 @@ static QList<int> entityTypes( const int theType )
{ {
QList<int> typeIds; QList<int> typeIds;
if ( theType == SMESH::EDGE ) switch ( theType )
{ {
case SMESH::NODE:
typeIds.append( SMDSEntity_Node );
case SMESH::EDGE:
typeIds.append( SMDSEntity_Edge ); typeIds.append( SMDSEntity_Edge );
typeIds.append( SMDSEntity_Quad_Edge ); typeIds.append( SMDSEntity_Quad_Edge );
} break;
if ( theType == SMESH::FACE ) case SMESH::FACE:
{ typeIds.append( SMDSEntity_Triangle );
typeIds.append( SMDSEntity_Quad_Triangle );
typeIds.append( SMDSEntity_BiQuad_Triangle );
typeIds.append( SMDSEntity_Quadrangle ); typeIds.append( SMDSEntity_Quadrangle );
typeIds.append( SMDSEntity_Quad_Quadrangle ); typeIds.append( SMDSEntity_Quad_Quadrangle );
typeIds.append( SMDSEntity_BiQuad_Quadrangle ); typeIds.append( SMDSEntity_BiQuad_Quadrangle );
} typeIds.append( SMDSEntity_Polygon );
if ( theType == SMESH::VOLUME ) //typeIds.append( SMDSEntity_Quad_Polygon );
{ break;
case SMESH::VOLUME:
typeIds.append( SMDSEntity_Tetra );
typeIds.append( SMDSEntity_Quad_Tetra );
typeIds.append( SMDSEntity_Pyramid );
typeIds.append( SMDSEntity_Quad_Pyramid );
typeIds.append( SMDSEntity_Hexa ); typeIds.append( SMDSEntity_Hexa );
typeIds.append( SMDSEntity_Quad_Hexa ); typeIds.append( SMDSEntity_Quad_Hexa );
typeIds.append( SMDSEntity_TriQuad_Hexa ); typeIds.append( SMDSEntity_TriQuad_Hexa );
typeIds.append( SMDSEntity_Penta );
typeIds.append( SMDSEntity_Quad_Penta );
typeIds.append( SMDSEntity_Hexagonal_Prism );
typeIds.append( SMDSEntity_Polyhedra );
//typeIds.append( SMDSEntity_Quad_Polyhedra );
break;
case SMESH::ELEM0D:
typeIds.append( SMDSEntity_0D );
break;
case SMESH::BALL:
typeIds.append( SMDSEntity_Ball );
break;
} }
return typeIds; return typeIds;
} }
@ -1823,54 +1887,51 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
aCriterionType == SMESH::FT_BareBorderVolume || aCriterionType == SMESH::FT_BareBorderVolume ||
aCriterionType == SMESH::FT_EqualVolumes )) || aCriterionType == SMESH::FT_EqualVolumes )) ||
aCriterionType == SMESH::FT_LinearOrQuadratic || aCriterionType == SMESH::FT_LinearOrQuadratic ||
aCriterionType == SMESH::FT_GroupColor ||
aCriterionType == SMESH::FT_ElemGeomType ||
aCriterionType == SMESH::FT_CoplanarFaces || aCriterionType == SMESH::FT_CoplanarFaces ||
aCriterionType == SMESH::FT_EntityType aCriterionType == SMESH::FT_ConnectedElements
) )
{ {
// - No compare
bool isSignalsBlocked = aTable->signalsBlocked(); bool isSignalsBlocked = aTable->signalsBlocked();
aTable->blockSignals( true ); aTable->blockSignals( true );
if (aCompareItem->count() > 0) if (aCompareItem->count() > 0)
aCompareItem->clear(); aCompareItem->clear();
aTable->setEditable(false, row, 1); aTable->setEditable(false, row, 1);
// - Threshold is NOT editable for most of criteria
aTable->item(row, 2)->setText( QString("") ); aTable->item(row, 2)->setText( QString("") );
aTable->setEditable(aCriterionType == SMESH::FT_GroupColor || aTable->setEditable(( aCriterionType == SMESH::FT_ConnectedElements ||
aCriterionType == SMESH::FT_ElemGeomType || aCriterionType == SMESH::FT_CoplanarFaces ), row, 2);
aCriterionType == SMESH::FT_EntityType ||
aCriterionType == SMESH::FT_CoplanarFaces, row, 2);
aTable->blockSignals( isSignalsBlocked ); aTable->blockSignals( isSignalsBlocked );
} }
else if (aCriterionType == SMESH::FT_RangeOfIds || else if (aCriterionType == SMESH::FT_RangeOfIds ||
aCriterionType == SMESH::FT_GroupColor ||
aCriterionType == SMESH::FT_ElemGeomType ||
aCriterionType == SMESH::FT_EntityType ||
aCriterionType == SMESH::FT_BelongToGeom || aCriterionType == SMESH::FT_BelongToGeom ||
aCriterionType == SMESH::FT_BelongToPlane || aCriterionType == SMESH::FT_BelongToPlane ||
aCriterionType == SMESH::FT_BelongToCylinder || aCriterionType == SMESH::FT_BelongToCylinder ||
aCriterionType == SMESH::FT_BelongToGenSurface || aCriterionType == SMESH::FT_BelongToGenSurface ||
aCriterionType == SMESH::FT_LyingOnGeom) aCriterionType == SMESH::FT_LyingOnGeom)
{ {
// - EQUAL_TO compare ONLY
QMap<int, QString> aMap; QMap<int, QString> aMap;
aMap[ SMESH::FT_EqualTo ] = tr("EQUAL_TO"); aMap[ SMESH::FT_EqualTo ] = tr("EQUAL_TO");
aCompareItem->setItems(aMap); aCompareItem->setItems(aMap);
if (!aTable->isEditable(row, 2)) // if (!aTable->isEditable(row, 2))
aTable->setEditable(true, row, 1); aTable->setEditable(false, row, 1);
if (!aTable->isEditable(row, 2)) // - Threshold is editable
aTable->setEditable(true, row, 2);
}
else if (aCriterionType == SMESH::FT_GroupColor ||
aCriterionType == SMESH::FT_ElemGeomType ||
aCriterionType == SMESH::FT_EntityType)
{
if (!aTable->isEditable(row, 2)) if (!aTable->isEditable(row, 2))
aTable->setEditable(true, row, 2); aTable->setEditable(true, row, 2);
} }
else else
{ {
// All compare signs
if (aCompareItem && aCompareItem->count() != 3) if (aCompareItem && aCompareItem->count() != 3)
{ {
aCompareItem->setItems(getCompare()); aCompareItem->setItems(getCompare());
} }
// Threshold is editable
if (aTable->item( row, 2 )) { if (aTable->item( row, 2 )) {
QString aText = aTable->text(row, 2); QString aText = aTable->text(row, 2);
bool isOk = false; bool isOk = false;
@ -1897,6 +1958,8 @@ void SMESHGUI_FilterTable::onCriterionChanged (int row, int col)
{ {
if( col == 0 ) if( col == 0 )
onCriterionChanged(row, col, -1); onCriterionChanged(row, col, -1);
else if ( col == 2 )
emit ThresholdChanged(row, GetType());
} }
//======================================================================= //=======================================================================
@ -2070,6 +2133,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_FreeNodes ] = tr("FREE_NODES"); aCriteria[ SMESH::FT_FreeNodes ] = tr("FREE_NODES");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR"); aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
aCriteria[ SMESH::FT_EqualNodes ] = tr("EQUAL_NODE"); aCriteria[ SMESH::FT_EqualNodes ] = tr("EQUAL_NODE");
aCriteria[ SMESH::FT_ConnectedElements ] = tr("CONNECTED_ELEMS");
} }
return aCriteria; return aCriteria;
} }
@ -2092,6 +2156,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE"); aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE");
aCriteria[ SMESH::FT_EqualEdges ] = tr("EQUAL_EDGE"); aCriteria[ SMESH::FT_EqualEdges ] = tr("EQUAL_EDGE");
aCriteria[ SMESH::FT_EntityType ] = tr("ENTITY_TYPE"); aCriteria[ SMESH::FT_EntityType ] = tr("ENTITY_TYPE");
aCriteria[ SMESH::FT_ConnectedElements ] = tr("CONNECTED_ELEMS");
} }
return aCriteria; return aCriteria;
} }
@ -2125,6 +2190,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_CoplanarFaces ] = tr("COPLANAR_FACES"); aCriteria[ SMESH::FT_CoplanarFaces ] = tr("COPLANAR_FACES");
aCriteria[ SMESH::FT_EqualFaces ] = tr("EQUAL_FACE"); aCriteria[ SMESH::FT_EqualFaces ] = tr("EQUAL_FACE");
aCriteria[ SMESH::FT_EntityType ] = tr("ENTITY_TYPE"); aCriteria[ SMESH::FT_EntityType ] = tr("ENTITY_TYPE");
aCriteria[ SMESH::FT_ConnectedElements ] = tr("CONNECTED_ELEMS");
} }
return aCriteria; return aCriteria;
} }
@ -2147,6 +2213,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE"); aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE");
aCriteria[ SMESH::FT_EqualVolumes ] = tr("EQUAL_VOLUME"); aCriteria[ SMESH::FT_EqualVolumes ] = tr("EQUAL_VOLUME");
aCriteria[ SMESH::FT_EntityType ] = tr("ENTITY_TYPE"); aCriteria[ SMESH::FT_EntityType ] = tr("ENTITY_TYPE");
aCriteria[ SMESH::FT_ConnectedElements ] = tr("CONNECTED_ELEMS");
} }
return aCriteria; return aCriteria;
} }
@ -2161,6 +2228,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER"); aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER");
aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE"); aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR"); aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
aCriteria[ SMESH::FT_ConnectedElements ] = tr("CONNECTED_ELEMS");
} }
return aCriteria; return aCriteria;
} }
@ -2176,6 +2244,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER"); aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER");
aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE"); aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR"); aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
aCriteria[ SMESH::FT_ConnectedElements ] = tr("CONNECTED_ELEMS");
} }
return aCriteria; return aCriteria;
} }
@ -2190,6 +2259,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER"); aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER");
aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE"); aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR"); aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
aCriteria[ SMESH::FT_ConnectedElements ] = tr("CONNECTED_ELEMS");
} }
return aCriteria; return aCriteria;
} }
@ -2204,6 +2274,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR"); aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR");
aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR"); aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR");
aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE"); aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE");
aCriteria[ SMESH::FT_ConnectedElements ] = tr("CONNECTED_ELEMS");
} }
return aCriteria; return aCriteria;
@ -2473,7 +2544,13 @@ void SMESHGUI_FilterTable::SetThreshold (const int theRow,
const int theEntityType) const int theEntityType)
{ {
Table* aTable = myTables[ theEntityType == -1 ? GetType() : theEntityType ]; Table* aTable = myTables[ theEntityType == -1 ? GetType() : theEntityType ];
bool isSignalsBlocked = aTable->signalsBlocked();
aTable->blockSignals(true);
aTable->item( theRow, 2 )->setText(theText); aTable->item( theRow, 2 )->setText(theText);
aTable->blockSignals(isSignalsBlocked);
} }
//======================================================================= //=======================================================================
@ -2752,6 +2829,7 @@ void SMESHGUI_FilterDlg::Init (const QList<int>& theTypes, const bool setInViewe
myMesh = SMESH::SMESH_Mesh::_nil(); myMesh = SMESH::SMESH_Mesh::_nil();
myIObjects.Clear(); myIObjects.Clear();
myIsSelectionChanged = false; myIsSelectionChanged = false;
myToRestoreSelMode = false;
myTable->Init(theTypes); myTable->Init(theTypes);
@ -2818,6 +2896,7 @@ void SMESHGUI_FilterDlg::onOk()
{ {
if (onApply()) if (onApply())
{ {
restoreSelMode();
mySelectionMgr->clearFilters(); mySelectionMgr->clearFilters();
disconnect(mySMESHGUI, 0, this, 0); disconnect(mySMESHGUI, 0, this, 0);
disconnect(mySelectionMgr, 0, this, 0); disconnect(mySelectionMgr, 0, this, 0);
@ -2833,6 +2912,7 @@ void SMESHGUI_FilterDlg::onOk()
//======================================================================= //=======================================================================
void SMESHGUI_FilterDlg::reject() void SMESHGUI_FilterDlg::reject()
{ {
restoreSelMode();
// Restore previously selected object // Restore previously selected object
if (mySelectionMgr) if (mySelectionMgr)
{ {
@ -3174,9 +3254,11 @@ bool SMESHGUI_FilterDlg::onApply()
catch(const SALOME::SALOME_Exception& S_ex) catch(const SALOME::SALOME_Exception& S_ex)
{ {
SalomeApp_Tools::QtCatchCorbaException(S_ex); SalomeApp_Tools::QtCatchCorbaException(S_ex);
return false;
} }
catch(...) catch(...)
{ {
return false;
} }
return true; return true;
@ -3405,8 +3487,7 @@ void SMESHGUI_FilterDlg::selectInViewer (const int theType, const QList<int>& th
if ( aViewWindow && aViewWindow->SelectionMode()!=aSelMode) { if ( aViewWindow && aViewWindow->SelectionMode()!=aSelMode) {
mySelectionMgr->clearSelected(); mySelectionMgr->clearSelected();
mySelectionMgr->clearFilters(); mySelectionMgr->clearFilters();
if (aSelMode == NodeSelection) SMESH::SetPointRepresentation( aSelMode == NodeSelection );
SMESH::SetPointRepresentation(true);
aViewWindow->SetSelectionMode(aSelMode); aViewWindow->SetSelectionMode(aSelMode);
} }
@ -3476,42 +3557,64 @@ SMESH::Filter::Criterion SMESHGUI_FilterDlg::createCriterion()
//======================================================================= //=======================================================================
void SMESHGUI_FilterDlg::onSelectionDone() void SMESHGUI_FilterDlg::onSelectionDone()
{ {
int aRow, aCol;
const SALOME_ListIO& aList = mySelector->StoredIObjects(); const SALOME_ListIO& aList = mySelector->StoredIObjects();
if ( myMesh->_is_nil() && aList.Extent()>0 )
if ( myMesh->_is_nil() && aList.Extent()>0 ) { {
myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(aList.First()); myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(aList.First());
if ( !(myMesh->_is_nil()) ) { if ( !(myMesh->_is_nil()) ) {
myButtons[BTN_OK]->setEnabled(true); myButtons[BTN_OK]->setEnabled(true);
myButtons[BTN_Apply]->setEnabled(true); myButtons[BTN_Apply]->setEnabled(true);
} }
} }
int aRow, aCol;
if (aList.Extent() != 1 || !myTable->CurrentCell(aRow, aCol))
return;
const int type = myTable->GetCriterionType(aRow);
QList<int> types; QList<int> types;
types << SMESH::FT_BelongToGeom << SMESH::FT_BelongToPlane types << SMESH::FT_BelongToGeom << SMESH::FT_BelongToPlane
<< SMESH::FT_BelongToCylinder << SMESH::FT_BelongToGenSurface << SMESH::FT_BelongToCylinder << SMESH::FT_BelongToGenSurface
<< SMESH::FT_LyingOnGeom << SMESH::FT_CoplanarFaces; << SMESH::FT_LyingOnGeom << SMESH::FT_CoplanarFaces
if (aList.Extent() != 1 || !myTable->CurrentCell(aRow, aCol) || << SMESH::FT_ConnectedElements;
!types.contains(myTable->GetCriterionType(aRow))) if ( !types.contains( type ))
return; return;
if ( myTable->GetCriterionType(aRow) == SMESH::FT_CoplanarFaces ) Handle(SALOME_InteractiveObject) anIO = aList.First();
switch ( type )
{ {
QString aString; case SMESH::FT_CoplanarFaces: // get ID of a selected mesh face
int nbElems = SMESH::GetNameOfSelectedElements(mySelector,//myViewWindow->GetSelector(),
aList.First(), aString);
if (nbElems == 1)
myTable->SetThreshold(aRow, aString);
}
else
{
Handle(SALOME_InteractiveObject) anIO = aList.First();
GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO);
if (!anObj->_is_nil())
{ {
myTable->SetThreshold(aRow, GEOMBase::GetName(anObj)); QString aString;
//myTable->SetID( aRow, GEOMBase::GetIORFromObject(anObj)); int nbElems = SMESH::GetNameOfSelectedElements(mySelector, anIO, aString);
myTable->SetID(aRow, anIO->getEntry()); 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(mySelector, anIO, aString);
if (nbElems == 1)
myTable->SetThreshold(aRow, aString);
}
break;
}
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());
}
} }
} }
} }
@ -3526,6 +3629,20 @@ void SMESHGUI_FilterDlg::onCriterionChanged (const int, const int)
updateSelection(); updateSelection();
} }
//=======================================================================
// name : SMESHGUI_FilterDlg::onThresholdChanged
// Purpose : SLOT called when a threshold value is changed by the user and
// not by myTable->SetThreshold()
//=======================================================================
void SMESHGUI_FilterDlg::onThresholdChanged( const int row, const int type )
{
if ( myTable->GetCriterionType( row, type ) == SMESH::FT_ConnectedElements )
{
// to differ the text entered by the user from that got from selection
myTable->SetID( row, "", type );
}
}
//======================================================================= //=======================================================================
// name : SMESHGUI_FilterDlg::onCurrentChanged // name : SMESHGUI_FilterDlg::onCurrentChanged
// Purpose : SLOT called when current row changed. Update selection // Purpose : SLOT called when current row changed. Update selection
@ -3551,6 +3668,7 @@ void SMESHGUI_FilterDlg::updateSelection()
if( !aStudy ) if( !aStudy )
return; return;
restoreSelMode();
mySelectionMgr->clearFilters(); mySelectionMgr->clearFilters();
@ -3580,6 +3698,24 @@ void SMESHGUI_FilterDlg::updateSelection()
myIsSelectionChanged = true; myIsSelectionChanged = true;
} }
else if ( aCriterionType == SMESH::FT_ConnectedElements )
{
QList<SUIT_SelectionFilter*> fList;
fList.push_back( new SMESH_NumberFilter( "GEOM", TopAbs_SHAPE, 1, TopAbs_VERTEX ));
fList.push_back( new SMESH_TypeFilter( SMESH::IDSOURCE ));
mySelectionMgr->installFilter
( new SMESH_LogicalFilter( fList, SMESH_LogicalFilter::LO_OR,
!mySelectionMgr->autoDeleteFilter() ));
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
{
mySelModeToRestore = aViewWindow->SelectionMode();
aViewWindow->SetSelectionMode( NodeSelection );
myToRestoreSelMode = ( mySelModeToRestore != NodeSelection );
if ( myToRestoreSelMode )
SMESH::SetPointRepresentation( true );
}
}
else else
{ {
mySelector->SetSelectionMode( getSelMode( myTable->GetType() )); mySelector->SetSelectionMode( getSelMode( myTable->GetType() ));
@ -3606,3 +3742,22 @@ void SMESHGUI_FilterDlg::keyPressEvent( QKeyEvent* e )
onHelp(); onHelp();
} }
} }
//================================================================================
/*!
* \brief Restores a selection mode if it was changed to set up some criterion
*/
//================================================================================
void SMESHGUI_FilterDlg::restoreSelMode()
{
if ( myToRestoreSelMode )
{
SMESH::SetPointRepresentation( mySelModeToRestore == NodeSelection );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode( mySelModeToRestore );
myToRestoreSelMode = false;
}
}

View File

@ -141,6 +141,7 @@ signals:
void EntityTypeChanged( const int ); void EntityTypeChanged( const int );
void NeedValidation(); void NeedValidation();
void CriterionChanged( const int, const int ); void CriterionChanged( const int, const int );
void ThresholdChanged( const int, const int );
void CurrentChanged( int, int ); void CurrentChanged( int, int );
private slots: private slots:
@ -249,6 +250,7 @@ private slots:
void onDeactivate(); void onDeactivate();
void onSelectionDone(); void onSelectionDone();
void onCriterionChanged( const int, const int ); void onCriterionChanged( const int, const int );
void onThresholdChanged( const int, const int );
void onCurrentChanged( int, int ); void onCurrentChanged( int, int );
private: private:
@ -303,6 +305,10 @@ private:
QMap< int, int > myApplyToState; QMap< int, int > myApplyToState;
QString myHelpFileName; QString myHelpFileName;
bool myToRestoreSelMode;
int mySelModeToRestore;
void restoreSelMode();
}; };
#endif // SMESHGUI_FILTERDLG_H #endif // SMESHGUI_FILTERDLG_H

View File

@ -124,7 +124,7 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule,
SMESH::SMESH_Mesh_ptr theMesh ) SMESH::SMESH_Mesh_ptr theMesh )
: QDialog( SMESH::GetDesktop( theModule ) ), : QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ), mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myStoredShownEntity(0),
mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ), mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
myIsBusy( false ), myIsBusy( false ),
myNameChanged( false ), myNameChanged( false ),
@ -152,7 +152,7 @@ SMESHGUI_GroupDlg::SMESHGUI_GroupDlg( SMESHGUI* theModule,
const bool theIsConvert ) const bool theIsConvert )
: QDialog( SMESH::GetDesktop( theModule ) ), : QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ), mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), myStoredShownEntity(0),
mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ), mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
myIsBusy( false ), myIsBusy( false ),
myNameChanged( false ), myNameChanged( false ),
@ -1725,8 +1725,8 @@ void SMESHGUI_GroupDlg::setFilters()
myFilterDlg->Init( aType ); myFilterDlg->Init( aType );
} }
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMesh ); myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSelection();
myFilterDlg->SetSourceWg( myElements, false ); myFilterDlg->SetSourceWg( myElements, false );
myFilterDlg->show(); myFilterDlg->show();

View File

@ -1225,6 +1225,10 @@ Please enter correct values and try again</translation>
<source>SMESH_ADD_QUADRATIC_TRIANGLE_TITLE</source> <source>SMESH_ADD_QUADRATIC_TRIANGLE_TITLE</source>
<translation>Add Quadratic Triangle</translation> <translation>Add Quadratic Triangle</translation>
</message> </message>
<message>
<source>SMESH_ADD_BIQUADRATIC_TRIANGLE_TITLE</source>
<translation>Add BiQuadratic Triangle</translation>
</message>
<message> <message>
<source>SMESH_ADD_SUBMESH</source> <source>SMESH_ADD_SUBMESH</source>
<translation>SubMesh Construction</translation> <translation>SubMesh Construction</translation>
@ -2372,6 +2376,26 @@ Check algorithm documentation for supported geometry</translation>
<source>STB_BIQUADRATIC_QUADRANGLE</source> <source>STB_BIQUADRATIC_QUADRANGLE</source>
<translation>BiQuadratic Quadrangle</translation> <translation>BiQuadratic Quadrangle</translation>
</message> </message>
<message>
<source>SMESH_BIQUADRATIC_TRIANGLE</source>
<translation>BiQuadratic Triangle</translation>
</message>
<message>
<source>SMESH_BIQUADRATIC_TRIANGLES</source>
<translation>BiQuadratic Triangles</translation>
</message>
<message>
<source>MEN_BIQUADRATIC_TRIANGLE</source>
<translation>BiQuadratic Triangle</translation>
</message>
<message>
<source>TOP_BIQUADRATIC_TRIANGLE</source>
<translation>BiQuadratic Triangle</translation>
</message>
<message>
<source>STB_BIQUADRATIC_TRIANGLE</source>
<translation>BiQuadratic Triangle</translation>
</message>
<message> <message>
<source>SMESH_QUADRATIC_TETRAHEDRON</source> <source>SMESH_QUADRATIC_TETRAHEDRON</source>
<translation>Quadratic Tetrahedron</translation> <translation>Quadratic Tetrahedron</translation>
@ -4467,6 +4491,10 @@ Please, create VTK viewer and try again</translation>
<source>SMESH_ADD_QUADRATIC_TRIANGLE</source> <source>SMESH_ADD_QUADRATIC_TRIANGLE</source>
<translation>Add Quadratic Triangle</translation> <translation>Add Quadratic Triangle</translation>
</message> </message>
<message>
<source>SMESH_ADD_BIQUADRATIC_TRIANGLE</source>
<translation>Add BiQuadratic Triangle</translation>
</message>
<message> <message>
<source>SMESH_CORNER_NODES</source> <source>SMESH_CORNER_NODES</source>
<translation>Corner Nodes:</translation> <translation>Corner Nodes:</translation>
@ -5200,6 +5228,10 @@ Please check input data and try again</translation>
<source>COPLANAR_FACES</source> <source>COPLANAR_FACES</source>
<translation>Coplanar faces</translation> <translation>Coplanar faces</translation>
</message> </message>
<message>
<source>CONNECTED_ELEMS</source>
<translation>Elements of a domain</translation>
</message>
<message> <message>
<source>NUMBEROFNODESINELEMENT</source> <source>NUMBEROFNODESINELEMENT</source>
<translation>Number Of Nodes In Element</translation> <translation>Number Of Nodes In Element</translation>
@ -5377,6 +5409,10 @@ Please enter correct value and try again</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_0</source> <source>ENTITY_TYPE_0</source>
<translation>NONE</translation>
</message>
<message>
<source>ENTITY_TYPE_1</source>
<translation>POINT1</translation> <translation>POINT1</translation>
</message> </message>
<message> <message>
@ -5397,70 +5433,78 @@ Please enter correct value and try again</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_6</source> <source>ENTITY_TYPE_6</source>
<translation>QUAD4</translation> <translation>TRIA7</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_7</source> <source>ENTITY_TYPE_7</source>
<translation>QUAD8</translation> <translation>QUAD4</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_8</source> <source>ENTITY_TYPE_8</source>
<translation>QUAD9</translation> <translation>QUAD8</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_9</source> <source>ENTITY_TYPE_9</source>
<translation>TETRA4</translation> <translation>QUAD9</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_10</source> <source>ENTITY_TYPE_10</source>
<translation>TETRA10</translation> <translation>POLYGON</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_11</source> <source>ENTITY_TYPE_11</source>
<translation>PYRA5</translation> <translation>QPOLYGON</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_12</source> <source>ENTITY_TYPE_12</source>
<translation>PYRA13</translation> <translation>TETRA4</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_13</source> <source>ENTITY_TYPE_13</source>
<translation>PENTA6</translation> <translation>TETRA10</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_14</source> <source>ENTITY_TYPE_14</source>
<translation>PENTA15</translation> <translation>PYRA5</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_15</source> <source>ENTITY_TYPE_15</source>
<translation>HEXA8</translation> <translation>PYRA13</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_16</source> <source>ENTITY_TYPE_16</source>
<translation>HEXA20</translation> <translation>HEXA8</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_17</source> <source>ENTITY_TYPE_17</source>
<translation>HEXA27</translation> <translation>HEXA20</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_18</source> <source>ENTITY_TYPE_18</source>
<translation>OCTA12</translation> <translation>HEXA27</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_19</source> <source>ENTITY_TYPE_19</source>
<translation>POLYGONE</translation> <translation>PENTA6</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_20</source> <source>ENTITY_TYPE_20</source>
<translation>POLYEDRE</translation> <translation>PENTA15</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_21</source> <source>ENTITY_TYPE_21</source>
<translation>NONE</translation> <translation>OCTA12</translation>
</message>
<message>
<source>ENTITY_TYPE_21</source>
<translation>POLYEDRE</translation>
</message> </message>
<message> <message>
<source>ENTITY_TYPE_22</source> <source>ENTITY_TYPE_22</source>
<translation>QPOLYEDRE</translation>
</message>
<message>
<source>ENTITY_TYPE_23</source>
<translation>BALL</translation> <translation>BALL</translation>
</message> </message>
<message> <message>