+
+ bool distributionVisibility = mgr->booleanValue("SMESH","distribution_visibility");
+ myScalarBarActor->SetDistributionVisibility(distributionVisibility);
+
+ int coloringType = mgr->integerValue("SMESH", "distribution_coloring_type", 0);
+ myScalarBarActor->SetDistributionColoringType(coloringType);
+
+ QColor distributionColor = mgr->colorValue("SMESH", "distribution_color",
+ QColor(255, 255, 255));
+ double rgb[3];
+ rgb[0]= distributionColor.red()/255.;
+ rgb[1]= distributionColor.green()/255.;
+ rgb[2]= distributionColor.blue()/255.;
+ myScalarBarActor->SetDistributionColor(rgb);
+
+
+}
+
+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; elemIds.reserve( elems.size() );
+ for ( SMESH_VisualObjDef::TEntityList::iterator e = elems.begin(); e != elems.end(); ++e)
+ elemIds.push_back( (*e)->GetID());
+ vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
+ double * range = lookupTable->GetRange();
+ bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
+ fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range, isLogarithmic);
+ myScalarBarActor->SetDistribution(nbEvents);
+ }
+}
+
+void SMESH_ActorDef::SetQuadratic2DRepresentation(EQuadratic2DRepresentation theMode)
+{
+ switch(theMode) {
+ case SMESH_Actor::eLines :
+ myHighlitableActor->SetQuadraticArcMode(false);
+ my2DActor->SetQuadraticArcMode(false);
+ my1DActor->SetQuadraticArcMode(false);
+ break;
+ case SMESH_Actor::eArcs :
+ myHighlitableActor->SetQuadraticArcMode(true);
+ if(GetRepresentation() != SMESH_Actor::ePoint) {
+ my2DActor->SetQuadraticArcMode(true);
+ my1DActor->SetQuadraticArcMode(true);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+
+SMESH_Actor::EQuadratic2DRepresentation SMESH_ActorDef::GetQuadratic2DRepresentation()
+{
+ if(myHighlitableActor->GetQuadraticArcMode())
+ return SMESH_Actor::eArcs;
+ else
+ return SMESH_Actor::eLines;
+}
+
+void SMESH_ActorDef::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
+{
+ SALOME_Actor::SetMarkerStd( theMarkerType, theMarkerScale );
+ myNodeActor->SetMarkerStd( theMarkerType, theMarkerScale );
+ myNodeExtActor->SetMarkerStd( theMarkerType, theMarkerScale );
+}
+
+void SMESH_ActorDef::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
+{
+ SALOME_Actor::SetMarkerTexture( theMarkerId, theMarkerTexture );
+ myNodeActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
+ myNodeExtActor->SetMarkerTexture( theMarkerId, theMarkerTexture );
+ myMarkerTexture = theMarkerTexture; // for deferred update of myHighlightActor
+}
+
+#ifndef DISABLE_PLOT2DVIEWER
+SPlot2d_Histogram* SMESH_ActorDef::UpdatePlot2Histogram()
+{
+ if(my2dHistogram)
+ my2dHistogram->clearAllPoints();
+
+ if(SMESH::Controls::NumericalFunctor* fun =
+ dynamic_cast<SMESH::Controls::NumericalFunctor*>(myFunctor.get()))
+ {
+
+ if(!my2dHistogram) {
+ my2dHistogram = new SPlot2d_Histogram();
+ Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(getIO()->getEntry(),"SMESH",getName());
+ my2dHistogram->setIO(anIO);
+ }
+
+ 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());
+
+ vtkLookupTable* lookupTable = static_cast<vtkLookupTable*>(myScalarBarActor->GetLookupTable());
+ double * range = lookupTable->GetRange();
+ bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
+ fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range, isLogarithmic);
+
+ for ( size_t i = 0; i < std::min( nbEvents.size(), funValues.size() -1 ); i++ )
+ my2dHistogram->addPoint(funValues[i] + (funValues[i+1] - funValues[i])/2.0, static_cast<double>(nbEvents[i]));
+
+ if(funValues.size() >= 2)
+ my2dHistogram->setWidth((funValues[1] - funValues[0]) * 0.8) ;
+
+ }
+
+ //Color of the histogram
+ if(myScalarBarActor->GetDistributionColoringType() == SMESH_MULTICOLOR_TYPE)
+ my2dHistogram->setAutoAssign(true);
+ else {
+ double rgb[3];
+ myScalarBarActor->GetDistributionColor(rgb);
+ QColor aColor = QColor( (int)( rgb[0]*255 ), (int)( rgb[1]*255 ), (int)( rgb[2]*255 ) );
+ my2dHistogram->setColor(aColor);
+
+ }
+
+ return my2dHistogram;