#include "HYDROGUI_OCCDisplayer.h"
#include "HYDROGUI_OCCSelector.h"
#include "HYDROGUI_Operations.h"
+#include "HYDROGUI_Operation.h"
#include "HYDROGUI_PrsImage.h"
#include "HYDROGUI_Tool.h"
#include "HYDROGUI_Tool2.h"
void HYDROGUI_Module::studyClosed(SUIT_Study* theStudy)
{
DEBTRACE("HYDROGUI_Module::studyClosed");
+ HYDROGUI_Operation::myIsClear = false; // force clear of Zlayers on next study
Handle(HYDROData_Document) aDoc = HYDROData_Document::Document();
if (!aDoc.IsNull())
aDoc->Close();
HYDROGUI_OCCDisplayer::HYDROGUI_OCCDisplayer( HYDROGUI_Module* theModule )
: HYDROGUI_AbstractDisplayer( theModule )
{
+ DEBTRACE("HYDROGUI_OCCDisplayer");
myToUpdateColorScale = false;
}
int HYDROGUI_OCCDisplayer::AddPreviewZLayer( OCCViewer_ViewManager* theMgr )
{
+ DEBTRACE("AddPreviewZLayer");
int aLayer = -1;
OCCViewer_Viewer* aViewer = theMgr->getOCCViewer();
if ( !aViewer )
}
void HYDROGUI_OCCDisplayer::RemoveZLayer( OCCViewer_ViewManager* theMgr,
- const int theLayer )
+ const int theLayer,
+ bool isClearAll)
{
+ DEBTRACE("RemoveZLayer " << theLayer << " " << isClearAll);
if ( theLayer < 0 )
return;
+ if ( !theMgr )
+ return;
+
OCCViewer_Viewer* aViewer = theMgr->getOCCViewer();
if ( !aViewer )
return;
aViewer->getViewer3d()->GetAllZLayers( anExistingZLayers );
int aNbLayers = anExistingZLayers.Length();
- if ( theLayer < aNbLayers )
- aViewer->getViewer3d()->RemoveZLayer( theLayer );
+ if (isClearAll)
+ {
+ for ( int i = 1; i <= aNbLayers; i++ )
+ {
+ int val = anExistingZLayers.Value( i );
+ if (val > 0)
+ aViewer->getViewer3d()->RemoveZLayer( val, true );
+ }
+ }
+ else
+ if ( theLayer < aNbLayers )
+ aViewer->getViewer3d()->RemoveZLayer( theLayer );
}
void HYDROGUI_OCCDisplayer::EraseAll( const size_t theViewerId )
* \param theLayer a layer index
*/
void RemoveZLayer( OCCViewer_ViewManager* theMgr,
- const int theLayer );
+ const int theLayer,
+ bool isClearAll = false);
void SetToUpdateColorScale();
//#define _DEVDEBUG_
#include "HYDRO_trace.hxx"
+bool HYDROGUI_Operation::myIsClear = false;
+
HYDROGUI_Operation::HYDROGUI_Operation( HYDROGUI_Module* theModule )
: LightApp_Operation(),
myModule( theModule ),
myPreviewZLayer( -1 ),
myIsApplyAndClose( true )
{
+ DEBTRACE("HYDROGUI_Operation");
connect( this, SIGNAL( helpContextModule( const QString&, const QString&,
const QString& ) ),
theModule->application(), SLOT( onHelpContextModule( const QString&,
HYDROGUI_Operation::~HYDROGUI_Operation()
{
+ DEBTRACE("~HYDROGUI_Operation");
}
void HYDROGUI_Operation::setName( const QString& theName )
// module()->getOCCDisplayer()->RemoveZLayer( myPreviewManager, getPreviewZLayer() );
myPreviewManager = theManager;
+ // the manager can be null on abort Operation and we need to clear ZLayers on first call, when on new document (second study without SALOME restart)
+ OCCViewer_ViewManager* aViewManager = myPreviewManager;
+ if ( !aViewManager )
+ aViewManager = dynamic_cast<OCCViewer_ViewManager*>( module()->getApp()->getViewManager( OCCViewer_Viewer::Type(), true ) );
+ DEBTRACE("aViewManager, myPreviewManager " << aViewManager << " " << myPreviewManager);
+ if (!myIsClear)
+ {
+ module()->getOCCDisplayer()->RemoveZLayer(aViewManager, 0, true);
+ myIsClear = true;
+ }
if ( myPreviewManager )
setPreviewZLayer( module()->getOCCDisplayer()->AddPreviewZLayer( myPreviewManager ) );
}
HYDROGUI_Operation( HYDROGUI_Module* theModule );
virtual ~HYDROGUI_Operation();
+ static bool myIsClear;
+
public:
void setName( const QString& theName );
#include <TColStd_SequenceOfInteger.hxx>
#include <Graphic3d_ZLayerId.hxx>
+//#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
void SetZLayerForPrs( const Handle(PrsMgr_Presentation)& thePrs, int theLayerId );
void SetPrsZLayer( const Handle(PrsMgr_PresentableObject)& thePresentableObject,
int CreateTopZLayer( const Handle(V3d_Viewer)& theViewer3d )
{
+ DEBTRACE("CreateTopZLayer");
int aTopZLayer = Graphic3d_ZLayerId_Top;
if ( theViewer3d && !theViewer3d->AddZLayer( aTopZLayer ) ) {
aTopZLayer = Graphic3d_ZLayerId_Top;
}
-
+ DEBTRACE(" aTopZLayer: " << aTopZLayer);
return aTopZLayer;
}