X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FOBJECT%2FSMESH_ActorUtils.cxx;h=36e40e6797c1f80099959964e9e1cb9fd03d6461;hb=1758d524e70758cc1aacc20c2a3394208d7ff93d;hp=899e413ec23266f1896593cd895ae906e5ebde98;hpb=ddc98ff4c07102d02c70572766261560a0a34e95;p=modules%2Fsmesh.git diff --git a/src/OBJECT/SMESH_ActorUtils.cxx b/src/OBJECT/SMESH_ActorUtils.cxx index 899e413ec..36e40e679 100644 --- a/src/OBJECT/SMESH_ActorUtils.cxx +++ b/src/OBJECT/SMESH_ActorUtils.cxx @@ -21,10 +21,19 @@ // #include "SMESH_ActorUtils.h" +#include "SMESH_Actor.h" #include "SUIT_Tools.h" #include "SUIT_Session.h" #include "SUIT_ResourceMgr.h" +#include "SalomeApp_Application.h" + +#ifndef DISABLE_PLOT2DVIEWER +#include +#include +#include +#endif + #include "utilities.h" @@ -126,4 +135,49 @@ namespace SMESH g = ig / 255.; b = ib / 255.; } + +#ifndef DISABLE_PLOT2DVIEWER + //======================================================================= + /** + Get histogram from the input actor + Repaint/Remove the histogram in/from each opened Plot2D Viewer + */ + //======================================================================= + void ProcessIn2DViewers( SMESH_Actor *theActor, Viewer2dActionType aType ) { + SalomeApp_Application* anApp = dynamic_cast(SUIT_Session::session()->activeApplication()); + + if(!anApp || !theActor) + return; + + SPlot2d_Histogram* aHistogram = 0; + + if(theActor->GetPlot2Histogram()) + if(aType == UpdateIn2dViewer) + aHistogram = theActor->UpdatePlot2Histogram(); + else + aHistogram = theActor->GetPlot2Histogram(); + else + return; + + ViewManagerList aViewManagerList; + anApp->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList); + + aType = aHistogram->getPointList().empty() ? RemoveFrom2dViewer : aType; + + SUIT_ViewManager* aViewManager; + foreach( aViewManager, aViewManagerList ) { + if (Plot2d_ViewManager* aManager = dynamic_cast(aViewManager)) { + if (SPlot2d_Viewer* aViewer = dynamic_cast(aManager->getViewModel())) { + if (Plot2d_ViewFrame* aViewFrame = aViewer->getActiveViewFrame()) { + if(aType == UpdateIn2dViewer ) + aViewFrame->displayObject(aHistogram, true); + else if (aType == RemoveFrom2dViewer) + aViewFrame->eraseObject(aHistogram, true); + } + } + } + } + } +#endif //DISABLE_PLOT2DVIEWER + }