]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
0020948: EDF 1468 SMESH: Histogram of the quality controls
authoreap <eap@opencascade.com>
Fri, 19 Nov 2010 16:24:47 +0000 (16:24 +0000)
committereap <eap@opencascade.com>
Fri, 19 Nov 2010 16:24:47 +0000 (16:24 +0000)
+  virtual void SMESH_Actor::UpdateDistribution() = 0;

0020944: EDF 1464 SMESH: detection of over-constrained elements
+    class  OverConstrainedVolume: public Predicate
+    class  OverConstrainedFace: public Predicate

src/OBJECT/SMESH_Actor.cxx
src/OBJECT/SMESH_Actor.h
src/OBJECT/SMESH_ActorDef.h

index b8d11ee955446350706fc5fc5dc4ca051a1f3736..99eeb5d3db495b240f674d8391375acd30d6cc02 100644 (file)
@@ -779,6 +779,10 @@ SetControlMode(eControl theMode,
       myFunctor.reset(new SMESH::Controls::BareBorderFace());
       myControlActor = my2DActor;
       break;
+    case eOverConstrainedFace:
+      myFunctor.reset(new SMESH::Controls::OverConstrainedFace());
+      myControlActor = my2DActor;
+      break;
     case eMultiConnection:
       myFunctor.reset(new SMESH::Controls::MultiConnection());
       myControlActor = my1DActor;
@@ -849,6 +853,12 @@ SetControlMode(eControl theMode,
       myControlActor = my3DActor;
       break;
     }
+    case eOverConstrainedVolume:
+    {
+      myFunctor.reset(new SMESH::Controls::OverConstrainedVolume());
+      myControlActor = my3DActor;
+      break;
+    }
     case eMinimumAngle:
     {
       SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle();
@@ -890,20 +900,22 @@ SetControlMode(eControl theMode,
         my1DExtActor->SetExtControlMode(myFunctor);
         break;
       case eFreeFaces:
-        my2DExtActor->SetExtControlMode(myFunctor);
-        break;
       case eBareBorderFace:
+      case eOverConstrainedFace:
         my2DExtActor->SetExtControlMode(myFunctor);
         break;
       case eBareBorderVolume:
+      case eOverConstrainedVolume:
         my3DExtActor->SetExtControlMode(myFunctor);
         break;
       case eLength2D:
       case eMultiConnection2D:
         my1DExtActor->SetExtControlMode(myFunctor,myScalarBarActor,myLookupTable);
+        UpdateDistribution();
         break;
       default:
         myControlActor->SetControlMode(myFunctor,myScalarBarActor,myLookupTable);
+        UpdateDistribution();
       }
     }
 
@@ -1268,9 +1280,11 @@ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
         break;
       case eFreeFaces:
       case eBareBorderFace:
+      case eOverConstrainedFace:
         my2DExtActor->VisibilityOn();
         break;
       case eBareBorderVolume:
+      case eOverConstrainedVolume:
         my3DExtActor->VisibilityOn();
         break;
       case eLength2D:
@@ -1998,7 +2012,7 @@ void SMESH_ActorDef::UpdateScalarBar()
   myScalarBarActor->SetDistributionColoringType(coloringType);
   
   QColor distributionColor = mgr->colorValue("SMESH", "distribution_color",
-                                            QColor(255, 255, 255));
+                                             QColor(255, 255, 255));
   double rgb[3];
   rgb[0]= distributionColor.red()/255.;
   rgb[1]= distributionColor.green()/255.;
@@ -2008,6 +2022,25 @@ void SMESH_ActorDef::UpdateScalarBar()
   
 }
 
+void SMESH_ActorDef::UpdateDistribution()
+{
+  if(SMESH::Controls::NumericalFunctor* fun =
+     dynamic_cast<SMESH::Controls::NumericalFunctor*>(myFunctor.get()))
+  {
+    int nbIntervals = myScalarBarActor->GetMaximumNumberOfColors();
+    std::vector<int> nbEvents;
+    std::vector<double> funValues;
+    SMESH_VisualObjDef::TEntityList elems;
+    if ( ! dynamic_cast<SMESH_MeshObj*>(myVisualObj.get()))
+      dynamic_cast<SMESH_VisualObjDef*>(myVisualObj.get())->GetEntities( fun->GetType(), elems );
+    std::vector<int> elemIds;
+    for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e)
+      elemIds.push_back( (*e)->GetID());
+    fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds);
+    myScalarBarActor->SetDistribution(nbEvents);
+  }
+}
+
 void SMESH_ActorDef::SetQuadratic2DRepresentation(EQuadratic2DRepresentation theMode)
 {
   switch(theMode) {
index c44189e8b0eae9f178978f1319800f0cdb9175b3..744571e41360280a92dbb6cfd3a50821ad74b496 100644 (file)
@@ -123,7 +123,8 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
   enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eFreeNodes,
                 eFreeFaces, eMultiConnection, eArea, eTaper, eAspectRatio,
                 eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D,
-                eMaxElementLength2D, eMaxElementLength3D, eBareBorderFace, eBareBorderVolume};
+                eMaxElementLength2D, eMaxElementLength3D, eBareBorderFace, eBareBorderVolume,
+                eOverConstrainedFace, eOverConstrainedVolume};
   virtual void SetControlMode(eControl theMode) = 0;
   virtual eControl GetControlMode() = 0;
   virtual SMESH::Controls::FunctorPtr GetFunctor() = 0;
@@ -141,6 +142,7 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
   virtual long GetControlsPrecision() const = 0;
 
   virtual void UpdateScalarBar() = 0;
+  virtual void UpdateDistribution() = 0;
 };
 
 
index c06d3281ce0cead91082064d871322d5ef11ff50..53001f4efbf9f7c62519b1036095426900b62c45 100644 (file)
@@ -196,6 +196,7 @@ class SMESH_ActorDef : public SMESH_Actor
   virtual long GetControlsPrecision() const { return myControlsPrecision; }
 
   virtual void UpdateScalarBar();
+  virtual void UpdateDistribution();
 
 
   virtual void SetQuadratic2DRepresentation(EQuadratic2DRepresentation);