From: mzn Date: Fri, 26 Dec 2008 10:56:27 +0000 (+0000) Subject: Fix for improvement 0019927 (EDF770 SMESH: Analyzing the Mesh Quality: Orphan nodes). X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=503b60803adbec4216b3e2d10e6c636c30f312a5;p=modules%2Fsmesh.git Fix for improvement 0019927 (EDF770 SMESH: Analyzing the Mesh Quality: Orphan nodes). --- diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 8e35958a1..9d78a4067 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -197,7 +197,7 @@ SMESH_ActorDef::SMESH_ActorDef() my1DProp->DeepCopy(myEdgeProp); my1DProp->SetLineWidth(aLineWidth + aLineWidthInc); my1DProp->SetPointSize(aPointSize); - + my1DExtProp = vtkProperty::New(); my1DExtProp->DeepCopy(myEdgeProp); anRGB[0] = 1 - anRGB[0]; @@ -236,7 +236,26 @@ SMESH_ActorDef::SMESH_ActorDef() myNodeActor->SetRepresentation(SMESH_DeviceActor::ePoint); aFilter = myNodeActor->GetExtractUnstructuredGrid(); aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints); - + + myNodeExtProp = vtkProperty::New(); + myNodeExtProp->DeepCopy(myNodeProp); + anRGB[0] = 1 - anRGB[0]; + anRGB[1] = 1 - anRGB[1]; + anRGB[2] = 1 - anRGB[2]; + myNodeExtProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); + myNodeExtProp->SetPointSize(aPointSize); + + myNodeExtActor = SMESH_DeviceActor::New(); + myNodeExtActor->SetUserMatrix(aMatrix); + myNodeExtActor->SetStoreClippingMapping(true); + myNodeExtActor->PickableOff(); + myNodeExtActor->SetHighlited(true); + myNodeExtActor->SetVisibility(false); + myNodeExtActor->SetProperty(myNodeExtProp); + myNodeExtActor->SetRepresentation(SMESH_DeviceActor::ePoint); + aFilter = myNodeExtActor->GetExtractUnstructuredGrid(); + aFilter->SetModeOfExtraction(VTKViewer_ExtractUnstructuredGrid::ePoints); + aFilter->RegisterCellsWithType(VTK_VERTEX); //Definition of Pickable and Highlitable engines //---------------------------------------------- @@ -394,7 +413,8 @@ SMESH_ActorDef::~SMESH_ActorDef() myPreselectProp->Delete(); myNodeProp->Delete(); - + myNodeExtProp->Delete(); + my1DProp->Delete(); my1DActor->Delete(); @@ -407,6 +427,8 @@ SMESH_ActorDef::~SMESH_ActorDef() myNodeActor->Delete(); myBaseActor->Delete(); + myNodeExtActor->Delete(); + myHighlitableActor->Delete(); //Deleting of pints numbering pipeline @@ -582,6 +604,10 @@ SetControlMode(eControl theMode, aFunctor.reset(new SMESH::Controls::FreeEdges()); myControlActor = my2DActor; break; + case eFreeNodes: + aFunctor.reset(new SMESH::Controls::FreeNodes()); + myControlActor = myNodeActor; + break; case eMultiConnection: aFunctor.reset(new SMESH::Controls::MultiConnection()); myControlActor = my1DActor; @@ -663,6 +689,9 @@ SetControlMode(eControl theMode, if(aNbCells){ myControlMode = theMode; switch(myControlMode){ + case eFreeNodes: + myNodeExtActor->SetExtControlMode(aFunctor); + break; case eFreeEdges: case eFreeBorders: my1DExtActor->SetExtControlMode(aFunctor); @@ -710,6 +739,8 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){ theRenderer->AddActor(myNodeActor); theRenderer->AddActor(myBaseActor); + + theRenderer->AddActor(myNodeExtActor); my3DActor->AddToRender(theRenderer); my2DActor->AddToRender(theRenderer); @@ -718,7 +749,7 @@ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){ theRenderer->AddActor(my1DExtActor); theRenderer->AddActor(myHighlitableActor); - + theRenderer->AddActor2D(myScalarBarActor); myPtsSelectVisiblePoints->SetRenderer(theRenderer); @@ -734,6 +765,8 @@ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){ theRenderer->RemoveActor(myNodeActor); theRenderer->RemoveActor(myBaseActor); + theRenderer->RemoveActor(myNodeExtActor); + theRenderer->RemoveActor(myHighlitableActor); theRenderer->RemoveActor(my1DActor); @@ -762,8 +795,10 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj, myNodeActor->Init(myVisualObj,myImplicitBoolean); myBaseActor->Init(myVisualObj,myImplicitBoolean); - + myHighlitableActor->Init(myVisualObj,myImplicitBoolean); + + myNodeExtActor->Init(myVisualObj,myImplicitBoolean); my1DActor->Init(myVisualObj,myImplicitBoolean); my1DExtActor->Init(myVisualObj,myImplicitBoolean); @@ -826,9 +861,11 @@ void SMESH_ActorDef::SetTransform(VTKViewer_Transform* theTransform){ myNodeActor->SetTransform(theTransform); myBaseActor->SetTransform(theTransform); - + myHighlitableActor->SetTransform(theTransform); + myNodeExtActor->SetTransform(theTransform); + my1DActor->SetTransform(theTransform); my1DExtActor->SetTransform(theTransform); @@ -952,6 +989,8 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){ myNodeActor->VisibilityOff(); myBaseActor->VisibilityOff(); + myNodeExtActor->VisibilityOff(); + my1DActor->VisibilityOff(); my1DExtActor->VisibilityOff(); @@ -965,9 +1004,12 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){ if(GetVisibility()){ if(theIsUpdateRepersentation) SetRepresentation(GetRepresentation()); - + if(myControlMode != eNone){ switch(myControlMode){ + case eFreeNodes: + myNodeExtActor->VisibilityOn(); + break; case eFreeEdges: case eFreeBorders: my1DExtActor->VisibilityOn(); @@ -1118,6 +1160,7 @@ void SMESH_ActorDef::SetRepresentation(int theMode){ myPickableActor = myBaseActor; myNodeActor->SetVisibility(false); + myNodeExtActor->SetVisibility(false); vtkProperty *aProp = NULL, *aBackProp = NULL; SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1); switch(myRepresentation){ @@ -1356,6 +1399,7 @@ void SMESH_ActorDef::GetEdgeColor(vtkFloatingPointType& r,vtkFloatingPointType& void SMESH_ActorDef::SetNodeColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ myNodeProp->SetColor(r,g,b); + myNodeExtProp->SetColor(1.0-r,1.0-g,1.0-b); Modified(); } @@ -1399,6 +1443,7 @@ void SMESH_ActorDef::SetLineWidth(vtkFloatingPointType theVal){ void SMESH_ActorDef::SetNodeSize(vtkFloatingPointType theVal){ myNodeProp->SetPointSize(theVal); + myNodeExtProp->SetPointSize(theVal); myHighlightProp->SetPointSize(theVal); myPreselectProp->SetPointSize(theVal); @@ -1432,6 +1477,8 @@ SetImplicitFunctionUsed(bool theIsImplicitFunctionUsed) myBaseActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); myHighlitableActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); + + myNodeExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); my1DActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); my1DExtActor->SetImplicitFunctionUsed(theIsImplicitFunctionUsed); diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h index 638e9c9d5..acabe3eb2 100644 --- a/src/OBJECT/SMESH_Actor.h +++ b/src/OBJECT/SMESH_Actor.h @@ -96,9 +96,9 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor virtual void SetFacesOriented(bool theIsFacesOriented) = 0; virtual bool GetFacesOriented() = 0; - enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eMultiConnection, - eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew, - eAspectRatio3D, eMultiConnection2D, eVolume3D}; + enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eFreeNodes, + eMultiConnection, eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, + eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D}; virtual void SetControlMode(eControl theMode) = 0; virtual eControl GetControlMode() = 0; diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index a087e08d3..6fc67894a 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -220,6 +220,9 @@ class SMESH_ActorDef : public SMESH_Actor SMESH_DeviceActor* my3DActor; SMESH_DeviceActor* myControlActor; + vtkProperty* myNodeExtProp; + SMESH_DeviceActor* myNodeExtActor; + vtkProperty* my1DProp; SMESH_DeviceActor* my1DActor; vtkProperty* my1DExtProp; diff --git a/src/OBJECT/SMESH_DeviceActor.cxx b/src/OBJECT/SMESH_DeviceActor.cxx index cf7971f91..cc0ca91dc 100644 --- a/src/OBJECT/SMESH_DeviceActor.cxx +++ b/src/OBJECT/SMESH_DeviceActor.cxx @@ -545,6 +545,19 @@ SMESH_DeviceActor SetUnstructuredGrid(aDataSet); aDataSet->Delete(); } + else if(FreeNodes* aFreeNodes = 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->GetNodeObjId(i); + if(aFreeNodes->IsSatisfy(anObjId)) + myExtractUnstructuredGrid->RegisterCell(i); + } + if(!myExtractUnstructuredGrid->IsCellsRegistered()) + myExtractUnstructuredGrid->RegisterCell(-1); + SetUnstructuredGrid(myVisualObj->GetUnstructuredGrid()); + } } diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 6397948a9..cfe0e5d54 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -771,6 +771,10 @@ aTitle = QObject::tr( "MULTI_BORDERS" ); aControl = SMESH_Actor::eMultiConnection; break; + case 6005: + aTitle = QObject::tr( "FREE_NODES" ); + aControl = SMESH_Actor::eFreeNodes; + break; case 6019: aTitle = QObject::tr( "MULTI2D_BORDERS" ); aControl = SMESH_Actor::eMultiConnection2D; @@ -2425,6 +2429,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) case 6002: case 6003: case 6004: + case 6005: case 6009: if ( vtkwnd ) { @@ -2651,6 +2656,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createSMESHAction( 6002, "FREE_EDGE", "ICON_FREE_EDGE", 0, true ); createSMESHAction( 6003, "FREE_BORDER", "ICON_FREE_EDGE_2D", 0, true ); createSMESHAction( 6004, "CONNECTION", "ICON_CONNECTION", 0, true ); + createSMESHAction( 6005, "FREE_NODE", "ICON_FREE_NODE", 0, true ); createSMESHAction( 6011, "AREA", "ICON_AREA", 0, true ); createSMESHAction( 6012, "TAPER", "ICON_TAPER", 0, true ); createSMESHAction( 6013, "ASPECT", "ICON_ASPECT", 0, true ); @@ -2794,6 +2800,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createMenu( 6001, ctrlId, -1 ); createMenu( 6004, ctrlId, -1 ); createMenu( separator(), ctrlId, -1 ); + createMenu( 6005, ctrlId, -1 ); createMenu( 6002, ctrlId, -1 ); createMenu( 6018, ctrlId, -1 ); createMenu( 6019, ctrlId, -1 ); @@ -2885,6 +2892,7 @@ void SMESHGUI::initialize( CAM_Application* app ) createTool( 6003, ctrlTb ); createTool( 6004, ctrlTb ); createTool( separator(), ctrlTb ); + createTool( 6005, ctrlTb ); createTool( 6002, ctrlTb ); createTool( 6018, ctrlTb ); createTool( 6019, ctrlTb ); @@ -3139,6 +3147,7 @@ void SMESHGUI::initialize( CAM_Application* app ) // Controls //------------------------------------------------- QString + aMeshInVtkHasNodes = aMeshInVTK + "&&" + hasNodes, aMeshInVtkHasEdges = aMeshInVTK + "&&" + hasEdges, aMeshInVtkHasFaces = aMeshInVTK + "&&" + hasFaces, aMeshInVtkHasVolumes = aMeshInVTK + "&&" + hasVolumes; @@ -3164,8 +3173,12 @@ void SMESHGUI::initialize( CAM_Application* app ) popupMgr()->insert( separator(), anId, -1 ); + popupMgr()->insert( action( 6005 ), anId, -1 ); // FREE_NODE + popupMgr()->setRule( action( 6005 ), aMeshInVtkHasNodes, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6005 ), "controlMode = 'eFreeNodes'", QtxPopupMgr::ToggleRule ); + popupMgr()->insert( action( 6002 ), anId, -1 ); // FREE_EDGE - popupMgr()->setRule( action( 6002 ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); + popupMgr()->setRule( action( 6002 ), aMeshInVtkHasEdges, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( 6002 ), "controlMode = 'eFreeEdges'", QtxPopupMgr::ToggleRule ); popupMgr()->insert( action( 6018 ), anId, -1 ); // LENGTH_2D diff --git a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx index 1ad06d9d0..c1d720283 100755 --- a/src/SMESHGUI/SMESHGUI_FilterDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterDlg.cxx @@ -1071,6 +1071,7 @@ void SMESHGUI_FilterTable::SetCriterion (const int theRow, theCriterion.Type != SMESH::FT_LyingOnGeom && theCriterion.Type != SMESH::FT_FreeBorders && theCriterion.Type != SMESH::FT_FreeEdges && + theCriterion.Type != SMESH::FT_FreeNodes && theCriterion.Type != SMESH::FT_BadOrientedVolume) aTable->item( theRow, 2 )->setText(QString("%1").arg(theCriterion.Threshold, 0, 'g', 15)); else @@ -1299,7 +1300,8 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con int aCriterionType = GetCriterionType(row); - if (aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders || + if ( aType == SMESH::NODE && aCriterionType == SMESH::FT_FreeNodes || + aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders || aType == SMESH::FACE && aCriterionType == SMESH::FT_FreeEdges || aType == SMESH::VOLUME && aCriterionType == SMESH::FT_BadOrientedVolume) { @@ -1527,6 +1529,7 @@ const QMap& SMESHGUI_FilterTable::getCriteria (const int theType) aCriteria[ SMESH::FT_BelongToCylinder ] = tr("BELONG_TO_CYLINDER"); aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE"); aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM"); + aCriteria[ SMESH::FT_FreeNodes ] = tr("FREE_NODES"); } return aCriteria; } diff --git a/src/SMESHGUI/SMESH_images.ts b/src/SMESHGUI/SMESH_images.ts index 1171832c0..e17d097ce 100644 --- a/src/SMESHGUI/SMESH_images.ts +++ b/src/SMESHGUI/SMESH_images.ts @@ -218,10 +218,14 @@ ICON_FREE_EDGE mesh_free_edges.png - + ICON_FREE_EDGE_2D mesh_free_edges_2d.png + + ICON_FREE_NODE + mesh_free_nodes.png + ICON_HYPO mesh_hypo_length.png diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 1d4854fa5..31bd404ce 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -306,6 +306,10 @@ MEN_FREE_EDGE Free Edges + + MEN_FREE_NODE + Free Nodes + MEN_GLOBAL_HYPO Global Hypothesis @@ -2060,6 +2064,12 @@ Consider saving your work before application crash STB_FREE_EDGE Free Edges + + STB_FREE_NODE + Free Nodes + + + STB_GLOBAL_HYPO Global Hypothesis @@ -2532,6 +2542,12 @@ Consider saving your work before application crash TOP_FREE_EDGE Free Edges + + TOP_FREE_NODE + Free Nodes + + + TOP_GLOBAL_HYPO Global Hypothesis @@ -3734,6 +3750,12 @@ Please enter correct value and try again FREE_EDGES Free edges + + FREE_NODES + Free nodes + + + ID ID diff --git a/src/SMESH_SWIG/smeshDC.py b/src/SMESH_SWIG/smeshDC.py index f5d53e574..b22ea3674 100644 --- a/src/SMESH_SWIG/smeshDC.py +++ b/src/SMESH_SWIG/smeshDC.py @@ -475,7 +475,7 @@ class smeshDC(SMESH._objref_SMESH_Gen): else: print "Error: The treshold should be a string." return None - elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_BadOrientedVolume]: + elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_BadOrientedVolume, FT_FreeNodes]: # At this point the treshold is unnecessary if aTreshold == FT_LogicalNOT: aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT)