From: vsr Date: Thu, 28 Sep 2017 13:01:08 +0000 (+0300) Subject: 0023450: Fields are not displayed in GEOM X-Git-Tag: V8_4_0b1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fe6034b2c8f67624c6f0d934519fb3deb612c1ab;p=modules%2Fgui.git 0023450: Fields are not displayed in GEOM - Make color scale a property of the OCC view model --- diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index adb29592d..9de784810 100644 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -125,6 +125,11 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron) // display isoline on planar faces (box for ex.) myAISContext->IsoOnPlane( true ); + + // create color scale + myColorScale = new AIS_ColorScale(); + myColorScale->SetZLayer( Graphic3d_ZLayerId_TopOSD ); + myColorScale->SetTransformPersistence( Graphic3d_TransformPers::FromDeprecatedParams( Graphic3d_TMF_2d, gp_Pnt(-1, -1, 0) ) ); /* create trihedron */ if ( DisplayTrihedron ) @@ -1229,6 +1234,28 @@ void OCCViewer_Viewer::setTransparency( const Handle(AIS_InteractiveObject)& obj myV3dViewer->Update(); } +bool OCCViewer_Viewer::isColorScaleVisible() const +{ + return !myColorScale.IsNull() && !myAISContext.IsNull() && myAISContext->IsDisplayed( myColorScale ); +} + +void OCCViewer_Viewer::setColorScaleShown( const bool on ) +{ + if ( myColorScale.IsNull() ) + return; + if ( on ) + { + if ( !myAISContext->IsDisplayed( myColorScale ) ) + myAISContext->Display( myColorScale, Standard_True ); + myAISContext->Redisplay( myColorScale, Standard_True, Standard_True ); + } + else + { + if ( myAISContext->IsDisplayed( myColorScale ) ) + myAISContext->Erase( myColorScale, Standard_True ); + } +} + /*! Changes visibility of trihedron to opposite */ diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h index 329bb05bd..6e80da203 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ b/src/OCCViewer/OCCViewer_ViewModel.h @@ -34,6 +34,7 @@ #include "SUIT_ViewModel.h" #include +#include #include #include #include @@ -111,6 +112,9 @@ public: Qtx::BackgroundData background(int theViewId) const; void setBackground( int theViewId, const Qtx::BackgroundData& ); + bool isColorScaleVisible() const; + virtual void setColorScaleShown( const bool ); + //! returns true if 3d Trihedron in viewer was created bool trihedronActivated() const { return !myTrihedron.IsNull(); } @@ -138,6 +142,7 @@ public: public: Handle(V3d_Viewer) getViewer3d() const { return myV3dViewer;} Handle(AIS_InteractiveContext) getAISContext() const { return myAISContext; } + Handle(AIS_ColorScale) getColorScale() const { return myColorScale; } Handle(AIS_Trihedron) getTrihedron() const { return myTrihedron; } int getTopLayerId(); @@ -240,7 +245,7 @@ protected slots: protected: Handle(V3d_Viewer) myV3dViewer; - + Handle(AIS_ColorScale) myColorScale; Handle(AIS_Trihedron) myTrihedron; Handle(AIS_InteractiveContext) myAISContext;