0021338: EDF 1926 SMESH: New controls and filters

+    FT_EqualNodes,
+    FT_EqualEdges,
+    FT_EqualFaces,
+    FT_EqualVolumes,
This commit is contained in:
eap 2012-01-26 16:04:00 +00:00
parent 8931be9b66
commit c1e553583f
6 changed files with 89 additions and 24 deletions

View File

@ -53,6 +53,10 @@ module SMESH
FT_FreeEdges, FT_FreeEdges,
FT_FreeNodes, FT_FreeNodes,
FT_FreeFaces, FT_FreeFaces,
FT_EqualNodes,
FT_EqualEdges,
FT_EqualFaces,
FT_EqualVolumes,
FT_MultiConnection, FT_MultiConnection,
FT_MultiConnection2D, FT_MultiConnection2D,
FT_Length, FT_Length,
@ -193,6 +197,31 @@ module SMESH
*/ */
interface OverConstrainedFace: Predicate {}; interface OverConstrainedFace: Predicate {};
/*!
* Logical functor (predicate) "Equal Nodes".
* Verify whether there is another mesh node with same coordinates
*/
interface EqualNodes: Predicate
{
void SetTolerance( in double theToler );
double GetTolerance();
};
/*!
* Logical functor (predicate) "Equal Edges".
* Verify whether there is another mesh edge basing on the same nodes
*/
interface EqualEdges: Predicate {};
/*!
* Logical functor (predicate) "Equal Faces".
* Verify whether there is another mesh face basing on the same nodes
*/
interface EqualFaces: Predicate {};
/*!
* Logical functor (predicate) "Equal Volumes".
* Verify whether there is another mesh volumes basing on the same nodes
*/
interface EqualVolumes: Predicate {};
/*! /*!
* Logical functor (predicate) "Belong To Geometry". * Logical functor (predicate) "Belong To Geometry".
* Verify whether mesh element or node belong to pointed Geom Object * Verify whether mesh element or node belong to pointed Geom Object
@ -527,6 +556,11 @@ module SMESH
FreeNodes CreateFreeNodes(); FreeNodes CreateFreeNodes();
FreeFaces CreateFreeFaces(); FreeFaces CreateFreeFaces();
EqualNodes CreateEqualNodes();
EqualEdges CreateEqualEdges();
EqualFaces CreateEqualFaces();
EqualVolumes CreateEqualVolumes();
RangeOfIds CreateRangeOfIds(); RangeOfIds CreateRangeOfIds();
BadOrientedVolume CreateBadOrientedVolume(); BadOrientedVolume CreateBadOrientedVolume();

View File

@ -872,21 +872,21 @@ SetControlMode(eControl theMode,
if (!myIsEntityModeCache){ if (!myIsEntityModeCache){
myEntityModeCache = GetEntityMode(); myEntityModeCache = GetEntityMode();
myIsEntityModeCache=true; myIsEntityModeCache=true;
} }
SetEntityMode(eFaces); SetEntityMode(eFaces);
break; break;
default: default:
if (!myIsEntityModeCache){ if (!myIsEntityModeCache){
myEntityModeCache = GetEntityMode(); myEntityModeCache = GetEntityMode();
myIsEntityModeCache=true; myIsEntityModeCache=true;
} }
SetEntityMode(eFaces); SetEntityMode(eFaces);
} }
}else if(myControlActor == my3DActor) { }else if(myControlActor == my3DActor) {
if (!myIsEntityModeCache){ if (!myIsEntityModeCache){
myEntityModeCache = GetEntityMode(); myEntityModeCache = GetEntityMode();
myIsEntityModeCache=true; myIsEntityModeCache=true;
} }
SetEntityMode(eVolumes); SetEntityMode(eVolumes);
} }
} }
@ -1219,24 +1219,27 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
if(myControlMode != eNone){ if(myControlMode != eNone){
switch(myControlMode){ switch(myControlMode){
case eFreeNodes: case eFreeNodes:
case eCoincidentNodes:
myNodeExtActor->VisibilityOn(); myNodeExtActor->VisibilityOn();
break; break;
case eFreeEdges: case eFreeEdges:
case eFreeBorders: case eFreeBorders:
case eCoincidentElems1D:
case eLength2D:
case eMultiConnection2D:
my1DExtActor->VisibilityOn(); my1DExtActor->VisibilityOn();
break; break;
case eFreeFaces: case eFreeFaces:
case eBareBorderFace: case eBareBorderFace:
case eOverConstrainedFace: case eOverConstrainedFace:
case eCoincidentElems2D:
my2DExtActor->VisibilityOn(); my2DExtActor->VisibilityOn();
break; break;
case eBareBorderVolume: case eBareBorderVolume:
case eOverConstrainedVolume: case eOverConstrainedVolume:
case eCoincidentElems3D:
my3DExtActor->VisibilityOn(); my3DExtActor->VisibilityOn();
break; break;
case eLength2D:
case eMultiConnection2D:
my1DExtActor->VisibilityOn();
default: default:
if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells()) if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
myScalarBarActor->VisibilityOn(); myScalarBarActor->VisibilityOn();

View File

@ -489,19 +489,18 @@ SMESH_DeviceActor
dynamic_cast<BareBorderVolume *>(theFunctor.get()) || dynamic_cast<BareBorderVolume *>(theFunctor.get()) ||
dynamic_cast<BareBorderFace *>(theFunctor.get()) || dynamic_cast<BareBorderFace *>(theFunctor.get()) ||
dynamic_cast<OverConstrainedVolume*>(theFunctor.get()) || dynamic_cast<OverConstrainedVolume*>(theFunctor.get()) ||
dynamic_cast<CoincidentNodes *>(theFunctor.get()) ||
dynamic_cast<CoincidentElements1D *>(theFunctor.get()) || dynamic_cast<CoincidentElements1D *>(theFunctor.get()) ||
dynamic_cast<CoincidentElements2D *>(theFunctor.get()) || dynamic_cast<CoincidentElements2D *>(theFunctor.get()) ||
dynamic_cast<CoincidentElements3D *>(theFunctor.get()) || dynamic_cast<CoincidentElements3D *>(theFunctor.get()) ||
dynamic_cast<OverConstrainedFace *>(theFunctor.get())) dynamic_cast<OverConstrainedFace *>(theFunctor.get()))
{ {
Predicate* aFreePredicate = dynamic_cast<Predicate*>(theFunctor.get()); Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get());
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid(); vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
vtkIdType aNbCells = aGrid->GetNumberOfCells(); vtkIdType aNbCells = aGrid->GetNumberOfCells();
for( vtkIdType i = 0; i < aNbCells; i++ ){ for( vtkIdType i = 0; i < aNbCells; i++ ){
vtkIdType anObjId = myVisualObj->GetElemObjId(i); vtkIdType anObjId = myVisualObj->GetElemObjId(i);
if(aFreePredicate->IsSatisfy(anObjId)) if(aPredicate->IsSatisfy(anObjId))
myExtractUnstructuredGrid->RegisterCell(i); myExtractUnstructuredGrid->RegisterCell(i);
} }
if(!myExtractUnstructuredGrid->IsCellsRegistered()) if(!myExtractUnstructuredGrid->IsCellsRegistered())
@ -557,13 +556,15 @@ SMESH_DeviceActor
SetUnstructuredGrid(aDataSet); SetUnstructuredGrid(aDataSet);
aDataSet->Delete(); aDataSet->Delete();
} }
else if(FreeNodes* aFreeNodes = dynamic_cast<FreeNodes*>(theFunctor.get())) else if(dynamic_cast<FreeNodes *>(theFunctor.get()) ||
dynamic_cast<CoincidentNodes*>(theFunctor.get()))
{ {
Predicate* aPredicate = dynamic_cast<Predicate*>(theFunctor.get());
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding);
vtkIdType aNbNodes = myVisualObj->GetNbEntities(SMDSAbs_Node); vtkIdType aNbNodes = myVisualObj->GetNbEntities(SMDSAbs_Node);
for( vtkIdType i = 0; i < aNbNodes; i++ ){ for( vtkIdType i = 0; i < aNbNodes; i++ ){
vtkIdType anObjId = myVisualObj->GetNodeObjId(i); vtkIdType anObjId = myVisualObj->GetNodeObjId(i);
if(aFreeNodes->IsSatisfy(anObjId)) if(aPredicate->IsSatisfy(anObjId))
myExtractUnstructuredGrid->RegisterCell(i); myExtractUnstructuredGrid->RegisterCell(i);
} }
if(!myExtractUnstructuredGrid->IsCellsRegistered()) if(!myExtractUnstructuredGrid->IsCellsRegistered())

View File

@ -1351,7 +1351,8 @@ void SMESHGUI_FilterTable::SetCriterion (const int theRow,
theCriterion.Type == SMESH::FT_BelongToGenSurface || theCriterion.Type == SMESH::FT_BelongToGenSurface ||
theCriterion.Type == SMESH::FT_BelongToGeom || theCriterion.Type == SMESH::FT_BelongToGeom ||
theCriterion.Type == SMESH::FT_LyingOnGeom || theCriterion.Type == SMESH::FT_LyingOnGeom ||
theCriterion.Type == SMESH::FT_CoplanarFaces) theCriterion.Type == SMESH::FT_CoplanarFaces ||
theCriterion.Type == SMESH::FT_EqualNodes)
{ {
QTableWidgetItem* anItem = aTable->item(theRow, 0); QTableWidgetItem* anItem = aTable->item(theRow, 0);
if (!myAddWidgets.contains(anItem)) if (!myAddWidgets.contains(anItem))
@ -1534,6 +1535,7 @@ const char* SMESHGUI_FilterTable::getPrecision( const int aType )
case SMESH::FT_BelongToCylinder: case SMESH::FT_BelongToCylinder:
case SMESH::FT_BelongToGenSurface: case SMESH::FT_BelongToGenSurface:
case SMESH::FT_LyingOnGeom: case SMESH::FT_LyingOnGeom:
case SMESH::FT_EqualNodes:
retval = "len_tol_precision"; break; retval = "len_tol_precision"; break;
case SMESH::FT_Length: case SMESH::FT_Length:
case SMESH::FT_Length2D: case SMESH::FT_Length2D:
@ -1729,15 +1731,19 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
aTable->blockSignals( isSignalsBlocked ); aTable->blockSignals( isSignalsBlocked );
} }
if ((aType == SMESH::NODE && aCriterionType == SMESH::FT_FreeNodes ) || if ((aType == SMESH::NODE && (aCriterionType == SMESH::FT_FreeNodes ||
(aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders ) || aCriterionType == SMESH::FT_EqualNodes )) ||
(aType == SMESH::FACE && (aCriterionType == SMESH::FT_BareBorderFace || (aType == SMESH::EDGE && (aCriterionType == SMESH::FT_FreeBorders ||
aCriterionType == SMESH::FT_OverConstrainedFace || aCriterionType == SMESH::FT_EqualEdges )) ||
aCriterionType == SMESH::FT_FreeEdges || (aType == SMESH::FACE && (aCriterionType == SMESH::FT_BareBorderFace ||
aCriterionType == SMESH::FT_FreeFaces)) || aCriterionType == SMESH::FT_OverConstrainedFace ||
(aType == SMESH::VOLUME && (aCriterionType == SMESH::FT_BadOrientedVolume || aCriterionType == SMESH::FT_FreeEdges ||
aCriterionType == SMESH::FT_FreeFaces ||
aCriterionType == SMESH::FT_EqualFaces)) ||
(aType == SMESH::VOLUME && (aCriterionType == SMESH::FT_BadOrientedVolume ||
aCriterionType == SMESH::FT_OverConstrainedVolume || aCriterionType == SMESH::FT_OverConstrainedVolume ||
aCriterionType == SMESH::FT_BareBorderVolume)) || aCriterionType == SMESH::FT_BareBorderVolume ||
aCriterionType == SMESH::FT_EqualVolumes )) ||
aCriterionType == SMESH::FT_LinearOrQuadratic || aCriterionType == SMESH::FT_LinearOrQuadratic ||
aCriterionType == SMESH::FT_GroupColor || aCriterionType == SMESH::FT_GroupColor ||
aCriterionType == SMESH::FT_ElemGeomType || aCriterionType == SMESH::FT_ElemGeomType ||
@ -1980,6 +1986,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM"); aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
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");
} }
return aCriteria; return aCriteria;
} }
@ -2000,6 +2007,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_EqualEdges ] = tr("EQUAL_EDGE");
} }
return aCriteria; return aCriteria;
} }
@ -2031,6 +2039,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
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_CoplanarFaces ] = tr("COPLANAR_FACES"); aCriteria[ SMESH::FT_CoplanarFaces ] = tr("COPLANAR_FACES");
aCriteria[ SMESH::FT_EqualFaces ] = tr("EQUAL_FACE");
} }
return aCriteria; return aCriteria;
} }
@ -2051,6 +2060,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_EqualVolumes ] = tr("EQUAL_VOLUME");
} }
return aCriteria; return aCriteria;
} }

View File

@ -411,6 +411,10 @@
<source>STB_FIND_ELEM</source> <source>STB_FIND_ELEM</source>
<translation>Find Element by Point</translation> <translation>Find Element by Point</translation>
</message> </message>
<message>
<source>EQUAL_NODE</source>
<translation>Double nodes</translation>
</message>
<message> <message>
<source>MEN_EQUAL_NODE</source> <source>MEN_EQUAL_NODE</source>
<translation>Double nodes</translation> <translation>Double nodes</translation>
@ -423,6 +427,10 @@
<source>TOP_EQUAL_NODE</source> <source>TOP_EQUAL_NODE</source>
<translation>Double nodes</translation> <translation>Double nodes</translation>
</message> </message>
<message>
<source>EQUAL_EDGE</source>
<translation>Double edges</translation>
</message>
<message> <message>
<source>MEN_EQUAL_EDGE</source> <source>MEN_EQUAL_EDGE</source>
<translation>Double edges</translation> <translation>Double edges</translation>
@ -435,6 +443,10 @@
<source>TOP_EQUAL_EDGE</source> <source>TOP_EQUAL_EDGE</source>
<translation>Double edges</translation> <translation>Double edges</translation>
</message> </message>
<message>
<source>EQUAL_FACE</source>
<translation>Double faces</translation>
</message>
<message> <message>
<source>MEN_EQUAL_FACE</source> <source>MEN_EQUAL_FACE</source>
<translation>Double faces</translation> <translation>Double faces</translation>
@ -447,6 +459,10 @@
<source>TOP_EQUAL_FACE</source> <source>TOP_EQUAL_FACE</source>
<translation>Double faces</translation> <translation>Double faces</translation>
</message> </message>
<message>
<source>EQUAL_VOLUME</source>
<translation>Double volumes</translation>
</message>
<message> <message>
<source>MEN_EQUAL_VOLUME</source> <source>MEN_EQUAL_VOLUME</source>
<translation>Double volumes</translation> <translation>Double volumes</translation>

View File

@ -901,10 +901,11 @@ class smeshDC(SMESH._objref_SMESH_Gen):
print "Error: The threshold value should be of SALOMEDS.Color type" print "Error: The threshold value should be of SALOMEDS.Color type"
return None return None
pass pass
elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_BadOrientedVolume, FT_FreeNodes, elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_FreeNodes, FT_FreeFaces,
FT_FreeFaces, FT_LinearOrQuadratic, FT_LinearOrQuadratic, FT_BadOrientedVolume,
FT_BareBorderFace, FT_BareBorderVolume, FT_BareBorderFace, FT_BareBorderVolume,
FT_OverConstrainedFace, FT_OverConstrainedVolume]: FT_OverConstrainedFace, FT_OverConstrainedVolume,
FT_EqualNodes,FT_EqualEdges,FT_EqualFaces,FT_EqualVolumes ]:
# At this point the treshold is unnecessary # At this point the treshold is unnecessary
if aTreshold == FT_LogicalNOT: if aTreshold == FT_LogicalNOT:
aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT) aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT)
@ -940,7 +941,7 @@ class smeshDC(SMESH._objref_SMESH_Gen):
# @param Treshold the threshold value (range of id ids as string, shape, numeric) # @param Treshold the threshold value (range of id ids as string, shape, numeric)
# @param UnaryOp FT_LogicalNOT or FT_Undefined # @param UnaryOp FT_LogicalNOT or FT_Undefined
# @param Tolerance the tolerance used by FT_BelongToGeom, FT_BelongToSurface, # @param Tolerance the tolerance used by FT_BelongToGeom, FT_BelongToSurface,
# FT_LyingOnGeom, FT_CoplanarFaces criteria # FT_LyingOnGeom, FT_CoplanarFaces and FT_EqualNodes criteria
# @return SMESH_Filter # @return SMESH_Filter
# #
# <a href="../tui_filters_page.html#tui_filters">Example of Filters usage</a> # <a href="../tui_filters_page.html#tui_filters">Example of Filters usage</a>