From: eap Date: Fri, 19 Nov 2010 16:24:47 +0000 (+0000) Subject: 0020948: EDF 1468 SMESH: Histogram of the quality controls X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ebe0faaad03be57f910e7f98c10a8c587e550889;p=modules%2Fsmesh.git 0020948: EDF 1468 SMESH: Histogram of the quality controls + virtual void SMESH_Actor::UpdateDistribution() = 0; 0020944: EDF 1464 SMESH: detection of over-constrained elements + class OverConstrainedVolume: public Predicate + class OverConstrainedFace: public Predicate --- diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index b8d11ee95..99eeb5d3d 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -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(myFunctor.get())) + { + int nbIntervals = myScalarBarActor->GetMaximumNumberOfColors(); + std::vector nbEvents; + std::vector funValues; + SMESH_VisualObjDef::TEntityList elems; + if ( ! dynamic_cast(myVisualObj.get())) + dynamic_cast(myVisualObj.get())->GetEntities( fun->GetType(), elems ); + std::vector 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) { diff --git a/src/OBJECT/SMESH_Actor.h b/src/OBJECT/SMESH_Actor.h index c44189e8b..744571e41 100644 --- a/src/OBJECT/SMESH_Actor.h +++ b/src/OBJECT/SMESH_Actor.h @@ -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; }; diff --git a/src/OBJECT/SMESH_ActorDef.h b/src/OBJECT/SMESH_ActorDef.h index c06d3281c..53001f4ef 100644 --- a/src/OBJECT/SMESH_ActorDef.h +++ b/src/OBJECT/SMESH_ActorDef.h @@ -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);