]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Fix for improvement 0019927 (EDF770 SMESH: Analyzing the Mesh Quality: Orphan nodes).
authormzn <mzn@opencascade.com>
Fri, 26 Dec 2008 10:56:27 +0000 (10:56 +0000)
committermzn <mzn@opencascade.com>
Fri, 26 Dec 2008 10:56:27 +0000 (10:56 +0000)
src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_Actor.h
src/OBJECT/SMESH_ActorDef.h
src/OBJECT/SMESH_DeviceActor.cxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_FilterDlg.cxx
src/SMESHGUI/SMESH_images.ts
src/SMESHGUI/SMESH_msg_en.ts
src/SMESH_SWIG/smeshDC.py

index 8e35958a12f22320c53ee7a1d49949cd082a350a..9d78a40674110f2deefeac4dc62a8fd9a4db0234 100644 (file)
@@ -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);
index 638e9c9d514e68a85eb3e3ba72d7b9a9293c8566..acabe3eb20fb78d1cfdfce2a674451590dcc8cf0 100644 (file)
@@ -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;
 
index a087e08d3f063820308523088f1b38deaf9fd472..6fc67894a4110a46eb86cc9e00376d7d2f1df9d7 100644 (file)
@@ -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;
index cf7971f91130a31625afbba45acb7e230a9b07ec..cc0ca91dc0bc8d7e34f871f95f90ee42f2e50554 100644 (file)
@@ -545,6 +545,19 @@ SMESH_DeviceActor
     SetUnstructuredGrid(aDataSet);
     aDataSet->Delete();
   }
+  else if(FreeNodes* aFreeNodes = dynamic_cast<FreeNodes*>(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());
+  }
 }
 
 
index 6397948a909f49ad4cd3f0864f391eadd46d1601..cfe0e5d54d888ecd1a2f7934ddfef15bb46a4656 100644 (file)
            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
index 1ad06d9d0e88262278db9448f28a4594bd002919..c1d72028377dfa489ace5186ebc056979dc69fee 100755 (executable)
@@ -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<int, QString>& 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;
   }
index 1171832c01652012e0a931293ce9619003c3102c..e17d097ce976875f7b1915b52373a7cca7fce51f 100644 (file)
             <source>ICON_FREE_EDGE</source>
             <translation>mesh_free_edges.png</translation>
         </message>
-        <message>
+       <message>
             <source>ICON_FREE_EDGE_2D</source>
             <translation>mesh_free_edges_2d.png</translation>
         </message>
+       <message>
+            <source>ICON_FREE_NODE</source>
+            <translation>mesh_free_nodes.png</translation>
+        </message>
         <message>
             <source>ICON_HYPO</source>
             <translation>mesh_hypo_length.png</translation>
index 1d4854fa56661f9db2c6d99fd70a608731d51daa..31bd404cec2c30697d38c008162cc945e1c2cf25 100644 (file)
             <source>MEN_FREE_EDGE</source>
             <translation>Free Edges</translation>
         </message>
+       <message>
+            <source>MEN_FREE_NODE</source>
+            <translation>Free Nodes</translation>
+        </message>
         <message>
             <source>MEN_GLOBAL_HYPO</source>
             <translation>Global Hypothesis</translation>
@@ -2060,6 +2064,12 @@ Consider saving your work before application crash</translation>
             <source>STB_FREE_EDGE</source>
             <translation>Free Edges</translation>
         </message>
+       <message>
+            <source>STB_FREE_NODE</source>
+            <translation>Free Nodes</translation>
+        </message>
+       
+
         <message>
             <source>STB_GLOBAL_HYPO</source>
             <translation>Global Hypothesis</translation>
@@ -2532,6 +2542,12 @@ Consider saving your work before application crash</translation>
             <source>TOP_FREE_EDGE</source>
             <translation>Free Edges</translation>
         </message>
+       <message>
+            <source>TOP_FREE_NODE</source>
+            <translation>Free Nodes</translation>
+        </message>
+       
+
         <message>
             <source>TOP_GLOBAL_HYPO</source>
             <translation>Global Hypothesis</translation>
@@ -3734,6 +3750,12 @@ Please enter correct value and try again</translation>
             <source>FREE_EDGES</source>
             <translation>Free edges</translation>
         </message>
+       <message>
+            <source>FREE_NODES</source>
+            <translation>Free nodes</translation>
+        </message>
+       
+
         <message>
             <source>ID</source>
             <translation>ID</translation>
index f5d53e574c316a41c5f757767d0d7bed2b6aced0..b22ea3674f7b76de0156f472732d809c1cc8e203 100644 (file)
@@ -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)