From c1e553583fcbe76805b21dca2d0c6db8e1f067ba Mon Sep 17 00:00:00 2001 From: eap Date: Thu, 26 Jan 2012 16:04:00 +0000 Subject: [PATCH] 0021338: EDF 1926 SMESH: New controls and filters + FT_EqualNodes, + FT_EqualEdges, + FT_EqualFaces, + FT_EqualVolumes, --- idl/SMESH_Filter.idl | 34 +++++++++++++++++++++++++++++ src/OBJECT/SMESH_Actor.cxx | 15 ++++++++----- src/OBJECT/SMESH_DeviceActor.cxx | 11 +++++----- src/SMESHGUI/SMESHGUI_FilterDlg.cxx | 28 ++++++++++++++++-------- src/SMESHGUI/SMESH_msg_en.ts | 16 ++++++++++++++ src/SMESH_SWIG/smeshDC.py | 9 ++++---- 6 files changed, 89 insertions(+), 24 deletions(-) diff --git a/idl/SMESH_Filter.idl b/idl/SMESH_Filter.idl index e4e7bc04f..6983982d7 100644 --- a/idl/SMESH_Filter.idl +++ b/idl/SMESH_Filter.idl @@ -53,6 +53,10 @@ module SMESH FT_FreeEdges, FT_FreeNodes, FT_FreeFaces, + FT_EqualNodes, + FT_EqualEdges, + FT_EqualFaces, + FT_EqualVolumes, FT_MultiConnection, FT_MultiConnection2D, FT_Length, @@ -193,6 +197,31 @@ module SMESH */ 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". * Verify whether mesh element or node belong to pointed Geom Object @@ -527,6 +556,11 @@ module SMESH FreeNodes CreateFreeNodes(); FreeFaces CreateFreeFaces(); + EqualNodes CreateEqualNodes(); + EqualEdges CreateEqualEdges(); + EqualFaces CreateEqualFaces(); + EqualVolumes CreateEqualVolumes(); + RangeOfIds CreateRangeOfIds(); BadOrientedVolume CreateBadOrientedVolume(); diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 23a702774..25766c7b0 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -872,21 +872,21 @@ SetControlMode(eControl theMode, if (!myIsEntityModeCache){ myEntityModeCache = GetEntityMode(); myIsEntityModeCache=true; - } + } SetEntityMode(eFaces); break; default: if (!myIsEntityModeCache){ myEntityModeCache = GetEntityMode(); myIsEntityModeCache=true; - } + } SetEntityMode(eFaces); } }else if(myControlActor == my3DActor) { if (!myIsEntityModeCache){ myEntityModeCache = GetEntityMode(); myIsEntityModeCache=true; - } + } SetEntityMode(eVolumes); } } @@ -1219,24 +1219,27 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){ if(myControlMode != eNone){ switch(myControlMode){ case eFreeNodes: + case eCoincidentNodes: myNodeExtActor->VisibilityOn(); break; case eFreeEdges: case eFreeBorders: + case eCoincidentElems1D: + case eLength2D: + case eMultiConnection2D: my1DExtActor->VisibilityOn(); break; case eFreeFaces: case eBareBorderFace: case eOverConstrainedFace: + case eCoincidentElems2D: my2DExtActor->VisibilityOn(); break; case eBareBorderVolume: case eOverConstrainedVolume: + case eCoincidentElems3D: my3DExtActor->VisibilityOn(); break; - case eLength2D: - case eMultiConnection2D: - my1DExtActor->VisibilityOn(); default: if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells()) myScalarBarActor->VisibilityOn(); diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx index 41de5c531..7e2202460 100644 --- a/src/OBJECT/SMESH_DeviceActor.cxx +++ b/src/OBJECT/SMESH_DeviceActor.cxx @@ -489,19 +489,18 @@ SMESH_DeviceActor dynamic_cast(theFunctor.get()) || dynamic_cast(theFunctor.get()) || dynamic_cast(theFunctor.get()) || - dynamic_cast(theFunctor.get()) || dynamic_cast(theFunctor.get()) || dynamic_cast(theFunctor.get()) || dynamic_cast(theFunctor.get()) || dynamic_cast(theFunctor.get())) { - Predicate* aFreePredicate = dynamic_cast(theFunctor.get()); + Predicate* aPredicate = dynamic_cast(theFunctor.get()); myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid(); vtkIdType aNbCells = aGrid->GetNumberOfCells(); for( vtkIdType i = 0; i < aNbCells; i++ ){ vtkIdType anObjId = myVisualObj->GetElemObjId(i); - if(aFreePredicate->IsSatisfy(anObjId)) + if(aPredicate->IsSatisfy(anObjId)) myExtractUnstructuredGrid->RegisterCell(i); } if(!myExtractUnstructuredGrid->IsCellsRegistered()) @@ -557,13 +556,15 @@ SMESH_DeviceActor SetUnstructuredGrid(aDataSet); aDataSet->Delete(); } - else if(FreeNodes* aFreeNodes = dynamic_cast(theFunctor.get())) + else if(dynamic_cast(theFunctor.get()) || + dynamic_cast(theFunctor.get())) { + Predicate* aPredicate = dynamic_cast(theFunctor.get()); myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::eAdding); vtkIdType aNbNodes = myVisualObj->GetNbEntities(SMDSAbs_Node); for( vtkIdType i = 0; i < aNbNodes; i++ ){ vtkIdType anObjId = myVisualObj->GetNodeObjId(i); - if(aFreeNodes->IsSatisfy(anObjId)) + if(aPredicate->IsSatisfy(anObjId)) myExtractUnstructuredGrid->RegisterCell(i); } if(!myExtractUnstructuredGrid->IsCellsRegistered()) diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index 7e0f02a41..685120057 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -1351,7 +1351,8 @@ void SMESHGUI_FilterTable::SetCriterion (const int theRow, theCriterion.Type == SMESH::FT_BelongToGenSurface || theCriterion.Type == SMESH::FT_BelongToGeom || 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); if (!myAddWidgets.contains(anItem)) @@ -1534,6 +1535,7 @@ const char* SMESHGUI_FilterTable::getPrecision( const int aType ) case SMESH::FT_BelongToCylinder: case SMESH::FT_BelongToGenSurface: case SMESH::FT_LyingOnGeom: + case SMESH::FT_EqualNodes: retval = "len_tol_precision"; break; case SMESH::FT_Length: case SMESH::FT_Length2D: @@ -1729,15 +1731,19 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con aTable->blockSignals( isSignalsBlocked ); } - if ((aType == SMESH::NODE && aCriterionType == SMESH::FT_FreeNodes ) || - (aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders ) || - (aType == SMESH::FACE && (aCriterionType == SMESH::FT_BareBorderFace || - aCriterionType == SMESH::FT_OverConstrainedFace || - aCriterionType == SMESH::FT_FreeEdges || - aCriterionType == SMESH::FT_FreeFaces)) || - (aType == SMESH::VOLUME && (aCriterionType == SMESH::FT_BadOrientedVolume || + if ((aType == SMESH::NODE && (aCriterionType == SMESH::FT_FreeNodes || + aCriterionType == SMESH::FT_EqualNodes )) || + (aType == SMESH::EDGE && (aCriterionType == SMESH::FT_FreeBorders || + aCriterionType == SMESH::FT_EqualEdges )) || + (aType == SMESH::FACE && (aCriterionType == SMESH::FT_BareBorderFace || + aCriterionType == SMESH::FT_OverConstrainedFace || + 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_BareBorderVolume)) || + aCriterionType == SMESH::FT_BareBorderVolume || + aCriterionType == SMESH::FT_EqualVolumes )) || aCriterionType == SMESH::FT_LinearOrQuadratic || aCriterionType == SMESH::FT_GroupColor || aCriterionType == SMESH::FT_ElemGeomType || @@ -1980,6 +1986,7 @@ const QMap& SMESHGUI_FilterTable::getCriteria (const int theType) aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM"); aCriteria[ SMESH::FT_FreeNodes ] = tr("FREE_NODES"); aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR"); + aCriteria[ SMESH::FT_EqualNodes ] = tr("EQUAL_NODE"); } return aCriteria; } @@ -2000,6 +2007,7 @@ const QMap& SMESHGUI_FilterTable::getCriteria (const int theType) aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR"); aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR"); aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE"); + aCriteria[ SMESH::FT_EqualEdges ] = tr("EQUAL_EDGE"); } return aCriteria; } @@ -2031,6 +2039,7 @@ const QMap& SMESHGUI_FilterTable::getCriteria (const int theType) aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR"); aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE"); aCriteria[ SMESH::FT_CoplanarFaces ] = tr("COPLANAR_FACES"); + aCriteria[ SMESH::FT_EqualFaces ] = tr("EQUAL_FACE"); } return aCriteria; } @@ -2051,6 +2060,7 @@ const QMap& SMESHGUI_FilterTable::getCriteria (const int theType) aCriteria[ SMESH::FT_LinearOrQuadratic ] = tr("LINEAR"); aCriteria[ SMESH::FT_GroupColor ] = tr("GROUP_COLOR"); aCriteria[ SMESH::FT_ElemGeomType ] = tr("GEOM_TYPE"); + aCriteria[ SMESH::FT_EqualVolumes ] = tr("EQUAL_VOLUME"); } return aCriteria; } diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 1922e98af..9dcc32a52 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -411,6 +411,10 @@ STB_FIND_ELEM Find Element by Point + + EQUAL_NODE + Double nodes + MEN_EQUAL_NODE Double nodes @@ -423,6 +427,10 @@ TOP_EQUAL_NODE Double nodes + + EQUAL_EDGE + Double edges + MEN_EQUAL_EDGE Double edges @@ -435,6 +443,10 @@ TOP_EQUAL_EDGE Double edges + + EQUAL_FACE + Double faces + MEN_EQUAL_FACE Double faces @@ -447,6 +459,10 @@ TOP_EQUAL_FACE Double faces + + EQUAL_VOLUME + Double volumes + MEN_EQUAL_VOLUME Double volumes diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index b9e283308..50bd078cb 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -901,10 +901,11 @@ class smeshDC(SMESH._objref_SMESH_Gen): print "Error: The threshold value should be of SALOMEDS.Color type" return None pass - elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_BadOrientedVolume, FT_FreeNodes, - FT_FreeFaces, FT_LinearOrQuadratic, + elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_FreeNodes, FT_FreeFaces, + FT_LinearOrQuadratic, FT_BadOrientedVolume, 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 if aTreshold == 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 UnaryOp FT_LogicalNOT or FT_Undefined # @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 # # Example of Filters usage -- 2.39.2