From: apo Date: Mon, 3 Oct 2005 06:29:59 +0000 (+0000) Subject: Correct naming of files for VVTK_MainWindow class implementation X-Git-Tag: BR-D5-38-2003_D2005-12-10~93 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ccca9c348f9533863f5c62c4a8145c07b7266512;p=modules%2Fvisu.git Correct naming of files for VVTK_MainWindow class implementation --- diff --git a/src/VVTK/Makefile.in b/src/VVTK/Makefile.in index 45d817ff..0e1e27d5 100755 --- a/src/VVTK/Makefile.in +++ b/src/VVTK/Makefile.in @@ -19,7 +19,7 @@ EXPORT_HEADERS = \ VVTK_InteractorStyle.h \ VVTK_SegmentationCursorDlg.h \ VVTK_ViewWindow.h \ - VVTK_View.h + VVTK_MainWindow.h # Libraries targets LIB = libVVTK.la @@ -31,14 +31,14 @@ LIB_SRC = \ VVTK_SegmentationCursorDlg.cxx \ VVTK_ViewWindow.cxx \ VVTK_Renderer.cxx \ - VVTK_View.cxx + VVTK_MainWindow.cxx LIB_MOC = \ VVTK_ViewWindow.h \ VVTK_ViewModel.h \ VVTK_ViewManager.h \ VVTK_SegmentationCursorDlg.h \ - VVTK_View.h + VVTK_MainWindow.h CPPFLAGS += \ $(QT_INCLUDES) \ diff --git a/src/VVTK/VVTK_MainWindow.cxx b/src/VVTK/VVTK_MainWindow.cxx new file mode 100644 index 00000000..6591795f --- /dev/null +++ b/src/VVTK/VVTK_MainWindow.cxx @@ -0,0 +1,304 @@ +// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : +// Author : +// Module : +// $Header$ + +#include "VVTK_MainWindow.h" +#include "VVTK_InteractorStyle.h" +#include "VISU_ImplicitFunctionWidget.h" +#include "VISU_GaussPtsAct.h" + +#include "SVTK_RenderWindowInteractor.h" +#include "VVTK_Renderer.h" +#include "VVTK_SegmentationCursorDlg.h" + +#include "SUIT_ResourceMgr.h" +#include "SUIT_Accel.h" +#include "QtxAction.h" + +#include +#include + +//---------------------------------------------------------------------------- +VVTK_MainWindow +::VVTK_MainWindow(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr): + SVTK_MainWindow(theParent,theName,theResourceMgr), + myInteractorStyle(VVTK_InteractorStyle::New()) +{ + myInteractorStyle->Delete(); + + moveDockWindow(myToolBar,Qt::DockLeft); + myActionsMap[NonIsometric]->removeFrom(myToolBar); +} + +void +VVTK_MainWindow +::Initialize(SVTK_RenderWindowInteractor* theInteractor) +{ + SVTK_MainWindow::Initialize(theInteractor); + PushInteractorStyle(myInteractorStyle.GetPointer()); +} + +VVTK_MainWindow +::~VVTK_MainWindow() +{} + + +//---------------------------------------------------------------------------- +void +VVTK_MainWindow +::OnInteractorStyleSwitch(bool theIsGaussStyleOn) +{ + if ( theIsGaussStyleOn ) + this->PushInteractorStyle(myInteractorStyle.GetPointer()); + else + this->PopInteractorStyle(); +} + +//---------------------------------------------------------------------------- +void +VVTK_MainWindow +::OnSelectionModeSwitch(bool theIsSelectionOn) +{ + SetSelectionMode(theIsSelectionOn? NodeSelection: ActorSelection); +} + +//---------------------------------------------------------------------------- +int +convertAction( const int accelAction ); + +void +VVTK_MainWindow +::action( const int accelAction ) +{ + if ( accelAction == SUIT_Accel::ZoomFit ) + onFitAll(); + else { + int anEvent = convertAction( accelAction ); + InvokeEvent( anEvent, 0 ); + } +} + + +//---------------------------------------------------------------------------- +VVTK_MainWindow1 +::VVTK_MainWindow1(QSplitter* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr): + VVTK_MainWindow(theParent,theName,theResourceMgr), + myStyleSwitchAction(NULL), + mySplitter(theParent) +{ + myPtsToolBar = new QToolBar(this); + myPtsToolBar->setCloseMode(QDockWindow::Undocked); + myPtsToolBar->setLabel(tr("LBL_TOOLBAR_LABEL")); + moveDockWindow(myPtsToolBar,Qt::DockLeft); + + QPixmap aPixmap; + QtxAction* anAction; + + aPixmap = theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_INTERACTOR_STYLE_SWITCH" ) ); + anAction = new QtxAction(tr("MNU_VVTK_INTERACTOR_STYLE_SWITCH"), + aPixmap, + tr( "MNU_VVTK_INTERACTOR_STYLE_SWITCH" ), + 0, + this, + "VVTK/SVTK StyleSwitch", + true); + anAction->setToggleAction(true); + anAction->toggle(); + anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH")); + connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool))); + anAction->addTo( myPtsToolBar ); + myStyleSwitchAction = anAction; + + aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH")); + anAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"), + aPixmap, + tr( "MNU_VVTK_SELECTION_MODE_SWITCH" ), + 0, + this, + "VVTK/SVTK SelectionSwitch", + true); + anAction->setToggleAction(true); + anAction->setStatusTip(tr("DSC_VVTK_SELECTION_MODE_SWITCH")); + connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnSelectionModeSwitch(bool))); + anAction->addTo( myPtsToolBar ); + + aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_PLANE_SEGMENTATION_SWITCH")); + anAction = new QtxAction(tr("MNU_VVTK_PLANE_SEGMENTATION_SWITCH"), + aPixmap, + tr( "MNU_VVTK_PLANE_SEGMENTATION_SWITCH" ), + 0, + this, + "VVTK/SVTK PlaneSegmentationSwitch", + true); + anAction->setToggleAction(true); + anAction->setStatusTip(tr("DSC_VVTK_PLANE_SEGMENTATION_SWITCH")); + connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnPlaneSegmentationSwitch(bool))); + anAction->addTo( myPtsToolBar ); + + mySegmentationCursorDlg = new VVTK_SegmentationCursorDlg( this, "SegmentationCursorDlg" ); + mySegmentationCursorDlg->SetAction( anAction ); +} + +void +VVTK_MainWindow1 +::Initialize(SVTK_RenderWindowInteractor* theInteractor, + VVTK_Renderer1* theRenderer) +{ + myRenderer = theRenderer; + VVTK_MainWindow::Initialize(theInteractor); + mySegmentationCursorDlg->SetWidget( theRenderer->GetImplicitFunctionWidget() ); +} + +VVTK_MainWindow1 +::~VVTK_MainWindow1() +{} + + +//---------------------------------------------------------------------------- +VVTK_MainWindow2* +VVTK_MainWindow1 +::CreateMainWindow2(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr) +{ + return new VVTK_MainWindow2(theParent, + theName, + theResourceMgr, + this, + myStyleSwitchAction); +} + + +//---------------------------------------------------------------------------- +void +VVTK_MainWindow1 +::AddActor(VTKViewer_Actor* theActor, + bool theIsUpdate) +{ + if(VISU_GaussPtsAct1* anActor = dynamic_cast(theActor)) + mySegmentationCursorDlg->AddActor( anActor ); + + SVTK_MainWindow::AddActor( theActor, theIsUpdate ); +} + +//---------------------------------------------------------------------------- +void +VVTK_MainWindow1 +::RemoveActor(VTKViewer_Actor* theActor, + bool theIsUpdate) +{ + if(VISU_GaussPtsAct1* anActor = dynamic_cast(theActor)) + mySegmentationCursorDlg->RemoveActor( anActor ); + + SVTK_MainWindow::RemoveActor( theActor, theIsUpdate ); +} + +//---------------------------------------------------------------------------- +VVTK_Renderer1* +VVTK_MainWindow1 +::GetRenderer1() +{ + return myRenderer; +} + +//---------------------------------------------------------------------------- +QSize +VVTK_MainWindow1 +::sizeHint() const +{ + QWidget* aParent = parentWidget(); + static float aCoeff = 1.0/2.0; + int aWidth = int(aCoeff*aParent->width()); + int aHeight = int(aCoeff*aParent->height()); + + return QSize(aWidth,aHeight); +} + +//---------------------------------------------------------------------------- +void +VVTK_MainWindow1 +::OnPlaneSegmentationSwitch(bool theIsPlaneSegmentationOn) +{ + myRenderer->GetImplicitFunctionWidget()->SetEnabled(theIsPlaneSegmentationOn); + mySplitter->setCollapsible(this,!theIsPlaneSegmentationOn); + + if( theIsPlaneSegmentationOn ) + { + mySegmentationCursorDlg->UpdateSegmentation(); + mySegmentationCursorDlg->UpdateOutsideCursor(); + mySegmentationCursorDlg->show(); + } + else + mySegmentationCursorDlg->hide(); +} + + + +//---------------------------------------------------------------------------- +VVTK_MainWindow2 +::VVTK_MainWindow2(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr, + VVTK_MainWindow1* theMainWindow, + QtxAction* theStyleSwitchAction): + VVTK_MainWindow(theParent,theName,theResourceMgr), + myMainWindow(theMainWindow) +{ + connect(theStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool))); +} + +void +VVTK_MainWindow2 +::Initialize(SVTK_RenderWindowInteractor* theInteractor, + VVTK_Renderer2* theRenderer) +{ + myRenderer = theRenderer; + VVTK_MainWindow::Initialize(theInteractor); + + myRenderer->SetRenderer1(myMainWindow->GetRenderer1()); +} + +VVTK_MainWindow2 +::~VVTK_MainWindow2() +{} + +//---------------------------------------------------------------------------- +QSize +VVTK_MainWindow2 +::sizeHint() const +{ + QWidget* aParent = parentWidget(); + static float aCoeff = 1.0/2.0; + int aWidth = int(aCoeff*aParent->width()); + int aHeight = int(aCoeff*aParent->height()); + + return QSize(aWidth,aHeight); +} diff --git a/src/VVTK/VVTK_MainWindow.h b/src/VVTK/VVTK_MainWindow.h new file mode 100644 index 00000000..bc9e4009 --- /dev/null +++ b/src/VVTK/VVTK_MainWindow.h @@ -0,0 +1,136 @@ +#ifndef VVTK_MAINWINDOW_H +#define VVTK_MAINWINDOW_H + +#ifdef WIN32 +#pragma warning( disable:4251 ) +#endif + +#include "VVTK.h" +#include "SVTK_MainWindow.h" + +class QSplitter; + +class VVTK_SegmentationCursorDlg; +class VVTK_MainWindow2; +class VVTK_Renderer1; +class VVTK_Renderer2; + +//---------------------------------------------------------------------------- +class VVTK_EXPORT VVTK_MainWindow: public SVTK_MainWindow +{ + Q_OBJECT; + +public: + VVTK_MainWindow(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr); + virtual + void + Initialize(SVTK_RenderWindowInteractor* theInteractor); + + virtual + ~VVTK_MainWindow(); + + public slots: + void OnInteractorStyleSwitch(bool theIsGaussStyleOn); + void OnSelectionModeSwitch(bool theIsSelectionOn); + + virtual + void + action( const int ); + + protected: + vtkSmartPointer myInteractorStyle; +}; + + +//---------------------------------------------------------------------------- +class VVTK_EXPORT VVTK_MainWindow1: public VVTK_MainWindow +{ + Q_OBJECT; + +public: + VVTK_MainWindow1(QSplitter* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr); + virtual + void + Initialize(SVTK_RenderWindowInteractor* theInteractor, + VVTK_Renderer1* theRenderer); + + + virtual + ~VVTK_MainWindow1(); + + VVTK_MainWindow2* + CreateMainWindow2(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr); + + virtual + void + AddActor(VTKViewer_Actor* theActor, + bool theIsUpdate = false); + + virtual + void + RemoveActor(VTKViewer_Actor* theActor, + bool theIsUpdate = false); + + VVTK_Renderer1* + GetRenderer1(); + + virtual + QSize + sizeHint() const; + + public slots: + void OnPlaneSegmentationSwitch(bool theIsPlaneSegmentationOn); + + protected: + VVTK_Renderer1* myRenderer; + + QtxAction* myStyleSwitchAction; + QToolBar* myPtsToolBar; + QSplitter* mySplitter; + + VVTK_SegmentationCursorDlg* mySegmentationCursorDlg; +}; + + +//---------------------------------------------------------------------------- +class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindow +{ + Q_OBJECT; + + friend class VVTK_MainWindow1; + + VVTK_MainWindow2(QWidget* theParent, + const char* theName, + SUIT_ResourceMgr* theResourceMgr, + VVTK_MainWindow1* theMainWindow, + QtxAction* theStyleSwitchAction); +public: + virtual + void + Initialize(SVTK_RenderWindowInteractor* theInteractor, + VVTK_Renderer2* theRenderer); + + virtual + ~VVTK_MainWindow2(); + + virtual + QSize + sizeHint() const; + + protected: + VVTK_MainWindow1* myMainWindow; + VVTK_Renderer2* myRenderer; +}; + + +#ifdef WIN32 +#pragma warning( default:4251 ) +#endif + +#endif diff --git a/src/VVTK/VVTK_View.cxx b/src/VVTK/VVTK_View.cxx deleted file mode 100644 index c184e254..00000000 --- a/src/VVTK/VVTK_View.cxx +++ /dev/null @@ -1,288 +0,0 @@ -// SALOME OBJECT : implementation of interactive object visualization for OCC and VTK viewers -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : -// Author : -// Module : -// $Header$ - -#include "VVTK_View.h" -#include "VVTK_InteractorStyle.h" -#include "VISU_ImplicitFunctionWidget.h" -#include "VISU_GaussPtsAct.h" - -#include "SVTK_RenderWindowInteractor.h" -#include "VVTK_Renderer.h" -#include "VVTK_SegmentationCursorDlg.h" - -#include "SUIT_ResourceMgr.h" -#include "SUIT_Accel.h" -#include "QtxAction.h" - -#include -#include - -//---------------------------------------------------------------------------- -VVTK_MainWindowBase -::VVTK_MainWindowBase(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr): - SVTK_MainWindow(theParent,theName,theResourceMgr), - myInteractorStyle(VVTK_InteractorStyle::New()) -{ - myInteractorStyle->Delete(); - - moveDockWindow(myToolBar,Qt::DockLeft); - myActionsMap[NonIsometric]->removeFrom(myToolBar); - - myPtsToolBar = new QToolBar(this); - myPtsToolBar->setCloseMode(QDockWindow::Undocked); - myPtsToolBar->setLabel(tr("LBL_TOOLBAR_LABEL")); - moveDockWindow(myPtsToolBar,Qt::DockLeft); - - QPixmap aPixmap; - QtxAction* anAction; - aPixmap = theResourceMgr->loadPixmap( "VISU", tr( "ICON_VVTK_INTERACTOR_STYLE_SWITCH" ) ); - anAction = new QtxAction(tr("MNU_VVTK_INTERACTOR_STYLE_SWITCH"), - aPixmap, - tr( "MNU_VVTK_INTERACTOR_STYLE_SWITCH" ), - 0, - this, - "VVTK/SVTK StyleSwitch", - true); - anAction->setToggleAction(true); - anAction->toggle(); - anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH")); - connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool))); - anAction->addTo( myPtsToolBar ); - - aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH")); - anAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"), - aPixmap, - tr( "MNU_VVTK_SELECTION_MODE_SWITCH" ), - 0, - this, - "VVTK/SVTK SelectionSwitch", - true); - anAction->setToggleAction(true); - anAction->setStatusTip(tr("DSC_VVTK_SELECTION_MODE_SWITCH")); - connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnSelectionModeSwitch(bool))); - anAction->addTo( myPtsToolBar ); -} - -void -VVTK_MainWindowBase -::Initialize(SVTK_RenderWindowInteractor* theInteractor) -{ - SVTK_MainWindow::Initialize(theInteractor); - PushInteractorStyle(myInteractorStyle.GetPointer()); -} - -VVTK_MainWindowBase -::~VVTK_MainWindowBase() -{} - - -//---------------------------------------------------------------------------- -void -VVTK_MainWindowBase -::OnInteractorStyleSwitch(bool theIsGaussStyleOn) -{ - if ( theIsGaussStyleOn ) - this->PushInteractorStyle(myInteractorStyle.GetPointer()); - else - this->PopInteractorStyle(); -} - -//---------------------------------------------------------------------------- -void -VVTK_MainWindowBase -::OnSelectionModeSwitch(bool theIsSelectionOn) -{ - SetSelectionMode(theIsSelectionOn? NodeSelection: ActorSelection); -} - -//---------------------------------------------------------------------------- -int -convertAction( const int accelAction ); - -void -VVTK_MainWindowBase -::action( const int accelAction ) -{ - if ( accelAction == SUIT_Accel::ZoomFit ) - onFitAll(); - else { - int anEvent = convertAction( accelAction ); - InvokeEvent( anEvent, 0 ); - } -} - - -//---------------------------------------------------------------------------- -VVTK_MainWindow1 -::VVTK_MainWindow1(QSplitter* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr): - VVTK_MainWindowBase(theParent,theName,theResourceMgr), - mySplitter(theParent) -{ - QPixmap aPixmap; - QtxAction* anAction; - - aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_PLANE_SEGMENTATION_SWITCH")); - anAction = new QtxAction(tr("MNU_VVTK_PLANE_SEGMENTATION_SWITCH"), - aPixmap, - tr( "MNU_VVTK_PLANE_SEGMENTATION_SWITCH" ), - 0, - this, - "VVTK/SVTK PlaneSegmentationSwitch", - true); - anAction->setToggleAction(true); - anAction->setStatusTip(tr("DSC_VVTK_PLANE_SEGMENTATION_SWITCH")); - connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnPlaneSegmentationSwitch(bool))); - anAction->addTo( myPtsToolBar ); - - mySegmentationCursorDlg = new VVTK_SegmentationCursorDlg( this, "SegmentationCursorDlg" ); - mySegmentationCursorDlg->SetAction( anAction ); -} - -void -VVTK_MainWindow1 -::Initialize(SVTK_RenderWindowInteractor* theInteractor, - VVTK_Renderer1* theRenderer) -{ - myRenderer = theRenderer; - VVTK_MainWindowBase::Initialize(theInteractor); - mySegmentationCursorDlg->SetWidget( theRenderer->GetImplicitFunctionWidget() ); -} - -VVTK_MainWindow1 -::~VVTK_MainWindow1() -{} - - -//---------------------------------------------------------------------------- -void -VVTK_MainWindow1 -::AddActor(VTKViewer_Actor* theActor, - bool theIsUpdate) -{ - VISU_GaussPtsAct* anActor = dynamic_cast(theActor); - if( anActor ) - mySegmentationCursorDlg->AddActor( anActor ); - - SVTK_MainWindow::AddActor( theActor, theIsUpdate ); -} - -//---------------------------------------------------------------------------- -void -VVTK_MainWindow1 -::RemoveActor(VTKViewer_Actor* theActor, - bool theIsUpdate) -{ - VISU_GaussPtsAct* anActor = dynamic_cast(theActor); - if( anActor ) - mySegmentationCursorDlg->RemoveActor( anActor ); - - SVTK_MainWindow::RemoveActor( theActor, theIsUpdate ); -} - -//---------------------------------------------------------------------------- -VVTK_Renderer1* -VVTK_MainWindow1 -::GetRenderer1() -{ - return myRenderer; -} - -//---------------------------------------------------------------------------- -QSize -VVTK_MainWindow1 -::sizeHint() const -{ - QWidget* aParent = parentWidget(); - static float aCoeff = 1.0/2.0; - int aWidth = int(aCoeff*aParent->width()); - int aHeight = int(aCoeff*aParent->height()); - - return QSize(aWidth,aHeight); -} - -//---------------------------------------------------------------------------- -void -VVTK_MainWindow1 -::OnPlaneSegmentationSwitch(bool theIsPlaneSegmentationOn) -{ - myRenderer->GetImplicitFunctionWidget()->SetEnabled(theIsPlaneSegmentationOn); - mySplitter->setCollapsible(this,!theIsPlaneSegmentationOn); - - if( theIsPlaneSegmentationOn ) - { - mySegmentationCursorDlg->UpdateSegmentation(); - mySegmentationCursorDlg->UpdateOutsideCursor(); - mySegmentationCursorDlg->show(); - } - else - mySegmentationCursorDlg->hide(); -} - - - -//---------------------------------------------------------------------------- -VVTK_MainWindow2 -::VVTK_MainWindow2(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - VVTK_MainWindow1* theMainWindow): - VVTK_MainWindowBase(theParent,theName,theResourceMgr), - myMainWindow(theMainWindow) -{} - -void -VVTK_MainWindow2 -::Initialize(SVTK_RenderWindowInteractor* theInteractor, - VVTK_Renderer2* theRenderer) -{ - myRenderer = theRenderer; - VVTK_MainWindowBase::Initialize(theInteractor); - - myRenderer->SetRenderer1(myMainWindow->GetRenderer1()); -} - -VVTK_MainWindow2 -::~VVTK_MainWindow2() -{} - -//---------------------------------------------------------------------------- -QSize -VVTK_MainWindow2 -::sizeHint() const -{ - QWidget* aParent = parentWidget(); - static float aCoeff = 1.0/2.0; - int aWidth = int(aCoeff*aParent->width()); - int aHeight = int(aCoeff*aParent->height()); - - return QSize(aWidth,aHeight); -} diff --git a/src/VVTK/VVTK_View.h b/src/VVTK/VVTK_View.h deleted file mode 100644 index 1be8c53d..00000000 --- a/src/VVTK/VVTK_View.h +++ /dev/null @@ -1,125 +0,0 @@ -#ifndef VVTK_VIEW_H -#define VVTK_VIEW_H - -#ifdef WIN32 -#pragma warning( disable:4251 ) -#endif - -#include "VVTK.h" -#include "SVTK_MainWindow.h" - -class VVTK_Renderer1; -class VVTK_Renderer2; -class QSplitter; - -class VVTK_SegmentationCursorDlg; - -//---------------------------------------------------------------------------- -class VVTK_EXPORT VVTK_MainWindowBase: public SVTK_MainWindow -{ - Q_OBJECT; - -public: - VVTK_MainWindowBase(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr); - virtual - void - Initialize(SVTK_RenderWindowInteractor* theInteractor); - - virtual - ~VVTK_MainWindowBase(); - - public slots: - void OnInteractorStyleSwitch(bool theIsGaussStyleOn); - void OnSelectionModeSwitch(bool theIsSelectionOn); - - virtual - void - action( const int ); - - protected: - QToolBar* myPtsToolBar; - vtkSmartPointer myInteractorStyle; -}; - - -//---------------------------------------------------------------------------- -class VVTK_EXPORT VVTK_MainWindow1: public VVTK_MainWindowBase -{ - Q_OBJECT; - -public: - VVTK_MainWindow1(QSplitter* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr); - virtual - void - Initialize(SVTK_RenderWindowInteractor* theInteractor, - VVTK_Renderer1* theRenderer); - - virtual - ~VVTK_MainWindow1(); - - virtual - void - AddActor(VTKViewer_Actor* theActor, - bool theIsUpdate = false); - - virtual - void - RemoveActor(VTKViewer_Actor* theActor, - bool theIsUpdate = false); - - VVTK_Renderer1* - GetRenderer1(); - - virtual - QSize - sizeHint() const; - - public slots: - void OnPlaneSegmentationSwitch(bool theIsPlaneSegmentationOn); - - protected: - VVTK_Renderer1* myRenderer; - QSplitter* mySplitter; - - VVTK_SegmentationCursorDlg* mySegmentationCursorDlg; -}; - - -//---------------------------------------------------------------------------- -class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindowBase -{ - Q_OBJECT; - -public: - VVTK_MainWindow2(QWidget* theParent, - const char* theName, - SUIT_ResourceMgr* theResourceMgr, - VVTK_MainWindow1* theMainWindow); - - virtual - void - Initialize(SVTK_RenderWindowInteractor* theInteractor, - VVTK_Renderer2* theRenderer); - - virtual - ~VVTK_MainWindow2(); - - virtual - QSize - sizeHint() const; - - protected: - VVTK_MainWindow1* myMainWindow; - VVTK_Renderer2* myRenderer; -}; - - -#ifdef WIN32 -#pragma warning( default:4251 ) -#endif - -#endif diff --git a/src/VVTK/VVTK_ViewWindow.cxx b/src/VVTK/VVTK_ViewWindow.cxx index 4ec356c8..9d29b8a7 100755 --- a/src/VVTK/VVTK_ViewWindow.cxx +++ b/src/VVTK/VVTK_ViewWindow.cxx @@ -28,7 +28,7 @@ #include "VVTK_ViewWindow.h" #include "VVTK_ViewModel.h" -#include "VVTK_View.h" +#include "VVTK_MainWindow.h" #include "SVTK_View.h" #include "SUIT_Session.h" @@ -95,10 +95,9 @@ VVTK_ViewWindow myView1 = new SVTK_View(myMainWindow1); } { - myMainWindow2 = new VVTK_MainWindow2(aSplitter, - "VVTK_SegmantationWindow", - aResourceMgr, - myMainWindow1); + myMainWindow2 = myMainWindow1->CreateMainWindow2(aSplitter, + "VVTK_SegmantationWindow", + aResourceMgr); SVTK_RenderWindowInteractor* anIteractor = new SVTK_RenderWindowInteractor(myMainWindow2,"SVTK_RenderWindowInteractor1"); @@ -125,6 +124,9 @@ VVTK_ViewWindow aSelector->Delete(); SVTK_ViewWindow::Initialize(myView1,theModel); + connect(myView2,SIGNAL(selectionChanged()), + theModel,SLOT(onSelectionChanged())); + myMainWindow = myMainWindow1; myView = myView1; }