::SetRenderer1(VVTK_Renderer1* theRenderer)
{
myRenderer1 = theRenderer;
- myImplicitFunctionWidget1 = myRenderer1->GetImplicitFunctionWidget();
- myImplicitFunctionWidget1->AddObserver(vtkCommand::EndInteractionEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
- myImplicitFunctionWidget1->AddObserver(vtkCommand::EnableEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
- myImplicitFunctionWidget1->AddObserver(vtkCommand::DisableEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
- myImplicitFunction = myImplicitFunctionWidget1->ImplicitFunction();
+ VISU_ImplicitFunctionWidget* aWidget = myRenderer1->GetImplicitFunctionWidget();
+ aWidget->AddObserver(vtkCommand::EndInteractionEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
+ aWidget->AddObserver(vtkCommand::EnableEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
+ aWidget->AddObserver(vtkCommand::DisableEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
+ myImplicitFunction = aWidget->ImplicitFunction();
}
void
void
VVTK_MainWindowBase
-::Initialize(SVTK_Renderer *theRenderer)
+::Initialize(SVTK_RenderWindowInteractor* theInteractor)
{
- SVTK_MainWindow::Initialize(theRenderer);
+ SVTK_MainWindow::Initialize(theInteractor);
PushInteractorStyle(myInteractorStyle.GetPointer());
}
void
VVTK_MainWindow1
-::Initialize()
+::Initialize(SVTK_RenderWindowInteractor* theInteractor,
+ VVTK_Renderer1* theRenderer)
{
- myRenderer = VVTK_Renderer1::New();
- VVTK_MainWindowBase::Initialize(myRenderer);
- mySegmentationCursorDlg->SetWidget( myRenderer->GetImplicitFunctionWidget() );
- myRenderer->Delete();
+ myRenderer = theRenderer;
+ VVTK_MainWindowBase::Initialize(theInteractor);
+ mySegmentationCursorDlg->SetWidget( theRenderer->GetImplicitFunctionWidget() );
}
VVTK_MainWindow1
::sizeHint() const
{
QWidget* aParent = parentWidget();
- static float aCoeff = 2.0/3.0;
+ static float aCoeff = 1.0/2.0;
int aWidth = int(aCoeff*aParent->width());
int aHeight = int(aCoeff*aParent->height());
void
VVTK_MainWindow2
-::Initialize()
+::Initialize(SVTK_RenderWindowInteractor* theInteractor,
+ VVTK_Renderer2* theRenderer)
{
- myRenderer = VVTK_Renderer2::New();
- VVTK_MainWindowBase::Initialize(myRenderer);
- myRenderer->Delete();
+ myRenderer = theRenderer;
+ VVTK_MainWindowBase::Initialize(theInteractor);
myRenderer->SetRenderer1(myMainWindow->GetRenderer1());
}
::sizeHint() const
{
QWidget* aParent = parentWidget();
- static float aCoeff = 1.0/3.0;
+ static float aCoeff = 1.0/2.0;
int aWidth = int(aCoeff*aParent->width());
int aHeight = int(aCoeff*aParent->height());
#include "SUIT_Session.h"
+#include "VVTK_Renderer.h"
+#include "SVTK_InteractorStyle.h"
+#include "SVTK_RenderWindowInteractor.h"
+#include "SVTK_GenericRenderWindowInteractor.h"
+
#include <qsplitter.h>
#include <qlayout.h>
QSplitter* aSplitter = new QSplitter(Qt::Vertical,aWidget);
aSplitter->setChildrenCollapsible(true);
- myMainWindow1 = new VVTK_MainWindow1(aSplitter,
- "VVTK_MainWindow",
- aResourceMgr);
- myMainWindow = myMainWindow1;
- myMainWindow->Initialize();
+ SVTK_Selector* aSelector = SVTK_Selector::New();
+ {
+ myMainWindow1 = new VVTK_MainWindow1(aSplitter,
+ "VVTK_MainWindow",
+ aResourceMgr);
+
+ SVTK_RenderWindowInteractor* anIteractor =
+ new SVTK_RenderWindowInteractor(myMainWindow1,"SVTK_RenderWindowInteractor1");
+
+ VVTK_Renderer1* aRenderer = VVTK_Renderer1::New();
+
+ SVTK_GenericRenderWindowInteractor* aDevice =
+ SVTK_GenericRenderWindowInteractor::New();
+ aDevice->SetRenderWidget(anIteractor);
+ aDevice->SetSelector(aSelector);
+
+ anIteractor->Initialize(aDevice,aRenderer,aSelector);
+
+ SVTK_InteractorStyle* aStyle = SVTK_InteractorStyle::New();
+ anIteractor->PushInteractorStyle(aStyle);
+ aStyle->Delete();
+
+ aDevice->Delete();
+ aRenderer->Delete();
+
+ myMainWindow1->Initialize(anIteractor,aRenderer);
+
+ myView1 = new SVTK_View(myMainWindow1);
+ }
+ {
+ myMainWindow2 = new VVTK_MainWindow2(aSplitter,
+ "VVTK_SegmantationWindow",
+ aResourceMgr,
+ myMainWindow1);
+ SVTK_RenderWindowInteractor* anIteractor =
+ new SVTK_RenderWindowInteractor(myMainWindow2,"SVTK_RenderWindowInteractor1");
+
+ VVTK_Renderer2* aRenderer = VVTK_Renderer2::New();
+
+ SVTK_GenericRenderWindowInteractor* aDevice =
+ SVTK_GenericRenderWindowInteractor::New();
+ aDevice->SetRenderWidget(anIteractor);
+ aDevice->SetSelector(aSelector);
- myView = new SVTK_View(myMainWindow);
- SVTK_ViewWindow::Initialize(myView,theModel);
+ anIteractor->Initialize(aDevice,aRenderer,aSelector);
- myMainWindow2 = new VVTK_MainWindow2(aSplitter,
- "VVTK_SegmantationWindow",
- aResourceMgr,
- myMainWindow1);
- myMainWindow2->Initialize();
+ SVTK_InteractorStyle* aStyle = SVTK_InteractorStyle::New();
+ anIteractor->PushInteractorStyle(aStyle);
+ aStyle->Delete();
- myView2 = new SVTK_View(myMainWindow2);
+ aDevice->Delete();
+ aRenderer->Delete();
+
+ myMainWindow2->Initialize(anIteractor,aRenderer);
+
+ myView2 = new SVTK_View(myMainWindow2);
+ }
+ aSelector->Delete();
+
+ SVTK_ViewWindow::Initialize(myView1,theModel);
+ myMainWindow = myMainWindow1;
+ myView = myView1;
}
}
::AddActor(VTKViewer_Actor* theActor,
bool theIsUpdate)
{
- SVTK_ViewWindow::AddActor(theActor,theIsUpdate);
+ myMainWindow1->AddActor(theActor,theIsUpdate);
if(VISU_Actor* anAct = dynamic_cast<VISU_Actor*>(theActor))
if(VISU::TActorFactory* aFactory = anAct->GetFactory())
if(VISU_Actor* anActor = aFactory->CloneActor(anAct))
::RemoveActor(VTKViewer_Actor* theActor,
bool theIsUpdate)
{
- SVTK_ViewWindow::RemoveActor(theActor,theIsUpdate);
+ myMainWindow1->RemoveActor(theActor,theIsUpdate);
myMainWindow2->RemoveActor(theActor,theIsUpdate);
}
VVTK_ViewWindow
::Repaint(bool theUpdateTrihedron)
{
- myMainWindow->Repaint(theUpdateTrihedron);
+ myMainWindow1->Repaint(theUpdateTrihedron);
myMainWindow2->Repaint(theUpdateTrihedron);
}
+//----------------------------------------------------------------
+void
+VVTK_ViewWindow
+::onSelectionChanged()
+{
+ myView1->onSelectionChanged();
+ myView2->onSelectionChanged();
+}
+
//----------------------------------------------------------------------------
void
VVTK_ViewWindow