-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include <QMenu>
#include <QColorDialog>
#include <QToolBar>
+#include <QTimer>
#include <vtkCamera.h>
#include <vtkRenderer.h>
// VSR: Uncomment below line to allow texture background support in VTK viewer
#define VTK_ENABLE_TEXTURED_BACKGROUND
-
-// in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study.
-// SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from
-// SALOMEDS::StudyManager - no linkage with SalomeApp.
-
-// Temporarily commented to avoid awful dependecy on SALOMEDS
-// TODO: better mechanism of storing display/erse status in a study
-// should be provided...
-//static _PTR(Study) getStudyDS()
-//{
-// SALOMEDSClient_Study* aStudy = NULL;
-// _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() );
- // get id of SUIT_Study, if it's a SalomeApp_Study, it will return
- // id of its underlying SALOMEDS::Study
-// SUIT_Application* app = SUIT_Session::session()->activeApplication();
-// if ( !app ) return _PTR(Study)(aStudy);
-// SUIT_Study* stud = app->activeStudy();
-// if ( !stud ) return _PTR(Study)(aStudy);
-// const int id = stud->id(); // virtual method, must return SALOMEDS_Study id
- // get SALOMEDS_Study with this id from StudyMgr
-// return aMgr->GetStudyByID( id );
-//}
-
/*!
Constructor
*/
mySpaceBtn[1] = 2;
mySpaceBtn[2] = 9;
myDefaultBackground = Qtx::BackgroundData( Qt::black );
+ myQuadBufferSupport = false;
}
/*!
this, SLOT(onActorAdded(VTKViewer_Actor*)));
connect(aViewWindow, SIGNAL( actorRemoved(VTKViewer_Actor*) ),
this, SLOT(onActorRemoved(VTKViewer_Actor*)));
-
+
return aViewWindow;
}
if (SUIT_ViewManager* aViewManager = getViewManager()) {
QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
- for ( uint i = 0; i < aViews.count(); i++ )
+ for ( int i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
aView->SetTrihedronSize( theSize, theRelative );
if (SUIT_ViewManager* aViewManager = getViewManager()) {
QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
- for ( uint i = 0; i < aViews.count(); i++ )
+ for ( int i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
aView->SetStaticTrihedronVisible( theIsVisible );
myProjMode = theMode;
if (SUIT_ViewManager* aViewManager = getViewManager()) {
QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
- for ( uint i = 0; i < aViews.count(); i++ )
+ for ( int i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
aView->SetProjectionMode( theMode );
if (SUIT_ViewManager* aViewManager = getViewManager()) {
QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
- for ( uint i = 0; i < aViews.count(); i++ )
+ for ( int i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
aView->SetStereoType( theType );
if (SUIT_ViewManager* aViewManager = getViewManager()) {
QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
- for ( uint i = 0; i < aViews.count(); i++ )
+ for ( int i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
aView->SetAnaglyphFilter( theFilter );
if (SUIT_ViewManager* aViewManager = getViewManager()) {
QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
- for ( uint i = 0; i < aViews.count(); i++ )
+ for ( int i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
aView->SetQuadBufferSupport( theEnable );
if (SUIT_ViewManager* aViewManager = getViewManager()) {
QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
- for ( uint i = 0; i < aViews.count(); i++ )
+ for ( int i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
aView->SetInteractionStyle( theStyle );
if (SUIT_ViewManager* aViewManager = getViewManager()) {
QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
- for ( uint i = 0; i < aViews.count(); i++ )
+ for ( int i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
aView->SetZoomingStyle( theStyle );
if (SUIT_ViewManager* aViewManager = getViewManager()) {
QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
- for ( uint i = 0; i < aViews.count(); i++ )
+ for ( int i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
aView->SetPreSelectionMode( theMode );
if (SUIT_ViewManager* aViewManager = getViewManager()) {
QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
- for ( uint i = 0; i < aViews.count(); i++ )
+ for ( int i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
aView->SetIncrementalSpeed( theValue, theMode );
if (SUIT_ViewManager* aViewManager = getViewManager()) {
QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
- for ( uint i = 0; i < aViews.count(); i++ )
+ for ( int i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
aView->SetSpacemouseButtons( theBtn1, theBtn2, theBtn3 );
connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)),
this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
+
+ connect(theViewManager, SIGNAL(viewCreated(SUIT_ViewWindow*)),
+ this, SLOT(onViewCreated(SUIT_ViewWindow*)));
}
/*!
if(TViewWindow* aView = dynamic_cast<TViewWindow*>(myViewManager->getActiveView())){
//Support of several toolbars in the popup menu
- QList<QToolBar*> lst = qFindChildren<QToolBar*>( aView );
+ QList<QToolBar*> lst = aView->findChildren<QToolBar*>();
QList<QToolBar*>::const_iterator it = lst.begin(), last = lst.end();
for( ; it!=last; it++ )
thePopup->addAction( (*it)->toggleViewAction() );
/*!
SLOT: called on mouse button press, empty implementation
*/
-void SVTK_Viewer::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event)
+void SVTK_Viewer::onMousePress(SUIT_ViewWindow* /*vw*/, QMouseEvent* /*event*/)
{}
/*!
SLOT: called on mouse move, empty implementation
*/
-void SVTK_Viewer::onMouseMove(SUIT_ViewWindow* vw, QMouseEvent* event)
+void SVTK_Viewer::onMouseMove(SUIT_ViewWindow* /*vw*/, QMouseEvent* /*event*/)
{}
/*!
SLOT: called on mouse button release, empty implementation
*/
-void SVTK_Viewer::onMouseRelease(SUIT_ViewWindow* vw, QMouseEvent* event)
+void SVTK_Viewer::onMouseRelease(SUIT_ViewWindow* /*vw*/, QMouseEvent* /*event*/)
{}
/*!
if (SUIT_ViewManager* aViewManager = getViewManager()) {
QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
- for ( uint i = 0; i < aViews.count(); i++ )
+ for ( int i = 0; i < aViews.count(); i++ )
{
if ( TViewWindow* aView = dynamic_cast<TViewWindow*>(aViews.at( i )) )
aView->SetSelectionEnabled( isEnabled );
if(aPrs->IsNull())
return;
if(vtkActorCollection* anActorCollection = aPrs->GetObjects()){
- // get SALOMEDS Study
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- // _PTR(Study) aStudy(getStudyDS());
anActorCollection->InitTraversal();
while(vtkActor* anActor = anActorCollection->GetNextActor()){
if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
// TODO: better mechanism of storing display/erse status in a study
// should be provided...
//Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
- //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
- // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),true,this);
+ //if(!anObj.IsNull() && anObj->hasEntry()){
+ // ToolsGUI::SetVisibility(anObj->getEntry(),true,this);
//}
// just display the object
QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
if(aPrs->IsNull())
return;
if(vtkActorCollection* anActorCollection = aPrs->GetObjects()){
- // get SALOMEDS Study
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erase status in a study
- // should be provided...
- //_PTR(Study) aStudy(getStudyDS());
anActorCollection->InitTraversal();
while(vtkActor* anActor = anActorCollection->GetNextActor())
if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
// TODO: better mechanism of storing display/erase status in a study
// should be provided...
//Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
- //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
- // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
+ //if(!anObj.IsNull() && anObj->hasEntry()){
+ // ToolsGUI::SetVisibility(anObj->getEntry(),false,this);
//}
// just display the object
QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
*/
void SVTK_Viewer::EraseAll( SALOME_Displayer* d, const bool forced )
{
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- //_PTR(Study) aStudy(getStudyDS());
QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i)))
// TODO: better mechanism of storing display/erse status in a study
// should be provided...
//Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
- //if(!anObj.IsNull() && anObj->hasEntry() && aStudy)
- // ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
+ //if(!anObj.IsNull() && anObj->hasEntry())
+ // ToolsGUI::SetVisibility(anObj->getEntry(),false,this);
if(forced){
if(SVTK_Renderer* aRnd = aView->GetRenderer())
aRnd->RemoveActor(anAct);
{
emit actorRemoved((SVTK_ViewWindow*)sender(), theActor);
}
+
+void SVTK_Viewer::onViewCreated( SUIT_ViewWindow* view) {
+#ifdef VGL_WORKAROUND
+ if ( SVTK_ViewWindow* svw = dynamic_cast<SVTK_ViewWindow*>( view ) )
+ QTimer::singleShot(500, [svw] () { svw->Repaint(); } );
+#endif
+}