::~VVTK_MainWindow()
{}
-VVTK_InteractorStyle*
-VVTK_MainWindow
-::GetVInteractorStyle()
-{
- return myInteractorStyle.GetPointer();
-}
-
//----------------------------------------------------------------------------
void
SUIT_ResourceMgr* theResourceMgr):
VVTK_MainWindow(theParent,theName,theResourceMgr),
myStyleSwitchAction(NULL),
- mySplitter(theParent)
+ mySplitter(theParent),
+ myPickingDlg(NULL)
{
myPtsToolBar = new QToolBar(this);
myPtsToolBar->setCloseMode(QDockWindow::Undocked);
myPickingDlg = new VVTK_PickingDlg( this, "PickingDlg" );
myPickingDlg->SetAction( anAction );
+ myInteractorStyle->SetPickingSettings(myPickingDlg->GetPickingSettings());
aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_PLANE_SEGMENTATION_SWITCH"));
anAction = new QtxAction(tr("MNU_VVTK_PLANE_SEGMENTATION_SWITCH"),
myRenderer = theRenderer;
VVTK_MainWindow::Initialize(theInteractor);
mySegmentationCursorDlg->SetWidget( theRenderer->GetImplicitFunctionWidget() );
- GetVInteractorStyle()->SetPickingSettings( GetPickingSettings() );
}
VVTK_MainWindow1
VVTK_MainWindow2*
VVTK_MainWindow1
::CreateMainWindow2(QWidget* theParent,
- const char* theName,
- SUIT_ResourceMgr* theResourceMgr)
+ const char* theName,
+ SUIT_ResourceMgr* theResourceMgr,
+ VISU_PickingSettings* thePickingSettings)
{
VVTK_MainWindow2* aMainWindow2 = new VVTK_MainWindow2(theParent,
theName,
theResourceMgr,
- this,
- myStyleSwitchAction,
- myPickingDlg);
- aMainWindow2->GetVInteractorStyle()->SetPickingSettings(GetPickingSettings());
+ thePickingSettings,
+ myStyleSwitchAction);
return aMainWindow2;
}
//----------------------------------------------------------------------------
-void
-VVTK_MainWindow1
-::AddActor(VTKViewer_Actor* theActor,
- bool theIsUpdate)
-{
- if(VISU_GaussPtsAct1* anActor1 = dynamic_cast<VISU_GaussPtsAct1*>(theActor))
- mySegmentationCursorDlg->AddActor( anActor1 );
-
- if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor))
- myPickingDlg->AddActor( anActor );
-
- SVTK_MainWindow::AddActor( theActor, theIsUpdate );
-}
-
-//----------------------------------------------------------------------------
-void
-VVTK_MainWindow1
-::RemoveActor(VTKViewer_Actor* theActor,
- bool theIsUpdate)
-{
- if(VISU_GaussPtsAct1* anActor1 = dynamic_cast<VISU_GaussPtsAct1*>(theActor))
- mySegmentationCursorDlg->RemoveActor( anActor1 );
-
- if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor))
- myPickingDlg->RemoveActor( anActor );
-
- SVTK_MainWindow::RemoveActor( theActor, theIsUpdate );
-}
-
-//----------------------------------------------------------------------------
-VVTK_Renderer1*
+VISU_ImplicitFunctionWidget*
VVTK_MainWindow1
-::GetRenderer1()
+::GetImplicitFunctionWidget()
{
- return myRenderer;
+ return myRenderer->GetImplicitFunctionWidget();
}
-VISU_ImplicitFunctionWidget*
+VISU_OutsideCursorSettings*
VVTK_MainWindow1
-::GetImplicitFunctionWidget()
+::GetOutsideCursorSettings()
{
- return myRenderer->GetImplicitFunctionWidget();
+ return mySegmentationCursorDlg->GetOutsideCursorSettings();
}
VISU_PickingSettings*
::VVTK_MainWindow2(QWidget* theParent,
const char* theName,
SUIT_ResourceMgr* theResourceMgr,
- VVTK_MainWindow1* theMainWindow,
- QtxAction* theStyleSwitchAction,
- VVTK_PickingDlg* thePickingDlg):
- VVTK_MainWindow(theParent,theName,theResourceMgr),
- myMainWindow(theMainWindow),
- myPickingDlg(thePickingDlg)
+ VISU_PickingSettings* thePickingSettings,
+ QtxAction* theStyleSwitchAction):
+ VVTK_MainWindow(theParent,theName,theResourceMgr)
{
- connect(theStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool)));
-}
+ myInteractorStyle->SetPickingSettings(thePickingSettings);
-void
-VVTK_MainWindow2
-::Initialize(SVTK_RenderWindowInteractor* theInteractor,
- VVTK_Renderer2* theRenderer)
-{
- myRenderer = theRenderer;
- VVTK_MainWindow::Initialize(theInteractor);
-
- myRenderer->SetRenderer1(myMainWindow->GetRenderer1());
+ connect(theStyleSwitchAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool)));
}
VVTK_MainWindow2
::~VVTK_MainWindow2()
{}
-//----------------------------------------------------------------------------
-void
-VVTK_MainWindow2
-::AddActor(VTKViewer_Actor* theActor,
- bool theIsUpdate)
-{
- if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor))
- myPickingDlg->AddActor( anActor );
-
- SVTK_MainWindow::AddActor( theActor, theIsUpdate );
-}
-
-//----------------------------------------------------------------------------
-void
-VVTK_MainWindow2
-::RemoveActor(VTKViewer_Actor* theActor,
- bool theIsUpdate)
-{
- if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor))
- myPickingDlg->RemoveActor( anActor );
-
- SVTK_MainWindow::RemoveActor( theActor, theIsUpdate );
-}
-
//----------------------------------------------------------------------------
QSize
VVTK_MainWindow2
class VISU_ImplicitFunctionWidget;
class VVTK_SegmentationCursorDlg;
+class VISU_OutsideCursorSettings;
class VISU_PickingSettings;
class VVTK_InteractorStyle;
class VVTK_PickingDlg;
virtual
~VVTK_MainWindow();
- VVTK_InteractorStyle*
- GetVInteractorStyle();
-
public slots:
virtual
void
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();
+ SUIT_ResourceMgr* theResourceMgr,
+ VISU_PickingSettings* thePickingSettings);
VISU_ImplicitFunctionWidget*
GetImplicitFunctionWidget();
+ VISU_OutsideCursorSettings*
+ GetOutsideCursorSettings();
+
VISU_PickingSettings*
GetPickingSettings();
QToolBar* myPtsToolBar;
QSplitter* mySplitter;
- VVTK_PickingDlg* myPickingDlg;
VVTK_SegmentationCursorDlg* mySegmentationCursorDlg;
+ VVTK_PickingDlg* myPickingDlg;
};
VVTK_MainWindow2(QWidget* theParent,
const char* theName,
SUIT_ResourceMgr* theResourceMgr,
- VVTK_MainWindow1* theMainWindow,
- QtxAction* theStyleSwitchAction,
- VVTK_PickingDlg* thePickingDlg);
+ VISU_PickingSettings* thePickingSettings,
+ QtxAction* theStyleSwitchAction);
public:
- virtual
- void
- Initialize(SVTK_RenderWindowInteractor* theInteractor,
- VVTK_Renderer2* theRenderer);
-
virtual
~VVTK_MainWindow2();
- virtual
- void
- AddActor(VTKViewer_Actor* theActor,
- bool theIsUpdate = false);
-
- virtual
- void
- RemoveActor(VTKViewer_Actor* theActor,
- bool theIsUpdate = false);
-
virtual
QSize
sizeHint() const;
-
- protected:
- VVTK_MainWindow1* myMainWindow;
- VVTK_Renderer2* myRenderer;
-
- VVTK_PickingDlg* myPickingDlg;
};
//----------------------------------------------------------------------------
VVTK_Renderer
::VVTK_Renderer():
- myFPSActor(VISU_FPSActor::New())
+ myFPSActor(VISU_FPSActor::New()),
+ myPickingSettings(NULL)
{
if(MYDEBUG) INFOS("VVTK_Renderer() - "<<this);
if(MYDEBUG) INFOS("~VVTK_Renderer() - "<<this);
}
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer
+::AddActor(VTKViewer_Actor* theActor)
+{
+ if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+ anActor->SetPickingSettings(myPickingSettings);
+ Superclass::AddActor(anActor);
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer
+::RemoveActor(VTKViewer_Actor* theActor)
+{
+ using namespace VISU;
+ if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
+ anActor->SetPickingSettings(NULL);
+ Superclass::RemoveActor(theActor);
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer
+::SetPickingSettings(VISU_PickingSettings* thePickingSettings)
+{
+ myPickingSettings = thePickingSettings;
+}
+
//----------------------------------------------------------------------------
vtkStandardNewMacro(VVTK_Renderer1);
//----------------------------------------------------------------------------
VVTK_Renderer1
::VVTK_Renderer1():
- myImplicitFunctionWidget(VISU_ImplicitFunctionWidget::New())
+ myImplicitFunctionWidget(VISU_ImplicitFunctionWidget::New()),
+ myOutsideCursorSettings(NULL)
{
if(MYDEBUG) INFOS("VVTK_Renderer1() - "<<this);
{
if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
anActor->SetImplicitFunctionWidget(GetImplicitFunctionWidget());
- SVTK_Renderer::AddActor(anActor);
+ anActor->SetOutsideCursorSettings(myOutsideCursorSettings);
+ Superclass::AddActor(anActor);
}
}
using namespace VISU;
if(VISU_GaussPtsAct1* anActor = dynamic_cast<VISU_GaussPtsAct1*>(theActor)){
anActor->SetImplicitFunctionWidget(NULL);
- SVTK_Renderer::RemoveActor(theActor);
+ anActor->SetOutsideCursorSettings(NULL);
+ Superclass::RemoveActor(theActor);
}
}
+
//----------------------------------------------------------------------------
void
VVTK_Renderer1
myImplicitFunctionWidget->SetInteractor(theInteractor);
}
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer1
+::SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings)
+{
+ myOutsideCursorSettings = theOutsideCursorSettings;
+}
+
//----------------------------------------------------------------------------
VISU_ImplicitFunctionWidget*
VVTK_Renderer1
//----------------------------------------------------------------------------
void
VVTK_Renderer2
-::SetRenderer1(VVTK_Renderer1* theRenderer)
+::SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget)
{
- myRenderer1 = theRenderer;
- myWidget = myRenderer1->GetImplicitFunctionWidget();
- myWidget->AddObserver(vtkCommand::EndInteractionEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
- myWidget->AddObserver(vtkCommand::EnableEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
- myWidget->AddObserver(vtkCommand::DisableEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
+ theWidget->AddObserver(vtkCommand::EndInteractionEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
+ theWidget->AddObserver(vtkCommand::EnableEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
+ theWidget->AddObserver(vtkCommand::DisableEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
+ myWidget = theWidget;
}
void
if(VISU::TGaussPtsActorFactory* aFactory = anActor->GetGaussPtsFactory()){
if(VISU_GaussPtsAct2* anActor2 = aFactory->CloneActor(anActor)){
anActor2->SetImplicitFunctionWidget(myWidget);
- SVTK_Renderer::AddActor(anActor2);
+ Superclass::AddActor(anActor2);
}
}
}
using namespace VISU;
if(VISU_GaussPtsAct2* anActor = dynamic_cast<VISU_GaussPtsAct2*>(theActor)){
anActor->SetImplicitFunctionWidget(NULL);
- SVTK_Renderer::RemoveActor(theActor);
+ Superclass::RemoveActor(theActor);
}
}
#include "SVTK_Renderer.h"
class VISU_ImplicitFunctionWidget;
+class VISU_OutsideCursorSettings;
+class VISU_PickingSettings;
class VISU_FPSActor;
class vtkImplicitFunction;
vtkTypeMacro(VVTK_Renderer,SVTK_Renderer);
static VVTK_Renderer* New();
+ virtual
+ void
+ AddActor(VTKViewer_Actor* theActor);
+
+ virtual
+ void
+ RemoveActor(VTKViewer_Actor* theActor);
+
+ void
+ SetPickingSettings(VISU_PickingSettings* thePickingSettings);
+
protected:
VVTK_Renderer();
~VVTK_Renderer();
+ VISU_PickingSettings* myPickingSettings;
vtkSmartPointer<VISU_FPSActor> myFPSActor;
};
class VVTK_EXPORT VVTK_Renderer1 : public VVTK_Renderer
{
public:
- vtkTypeMacro(VVTK_Renderer1,SVTK_Renderer);
+ vtkTypeMacro(VVTK_Renderer1,VVTK_Renderer);
static VVTK_Renderer1* New();
virtual
void
SetInteractor(vtkRenderWindowInteractor* theInteractor);
+ void
+ SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings);
+
VISU_ImplicitFunctionWidget*
GetImplicitFunctionWidget();
OnAdjustActors();
vtkSmartPointer<VISU_ImplicitFunctionWidget> myImplicitFunctionWidget;
+ VISU_OutsideCursorSettings* myOutsideCursorSettings;
vtkSmartPointer<VISU_FPSActor> myTextActor;
};
class VVTK_EXPORT VVTK_Renderer2 : public VVTK_Renderer
{
public:
- vtkTypeMacro(VVTK_Renderer2,SVTK_Renderer);
+ vtkTypeMacro(VVTK_Renderer2,VVTK_Renderer);
static VVTK_Renderer2* New();
virtual
RemoveActor(VTKViewer_Actor* theActor);
void
- SetRenderer1(VVTK_Renderer1* theRenderer);
+ SetImplicitFunctionWidget(VISU_ImplicitFunctionWidget* theWidget);
void
OnEndInteractionEvent();
float myPriority;
VISU_ImplicitFunctionWidget* myWidget;
- VVTK_Renderer1* myRenderer1;
};
ApplyOutsideCursor();
}
+VISU_OutsideCursorSettings* VVTK_SegmentationCursorDlg::GetOutsideCursorSettings()
+{
+ return myOutsideCursorSettings.GetPointer();
+}
+
vtkImageData* VVTK_SegmentationCursorDlg::MakeImageData( const QString& theMainTexture,
const QString& theAlphaTexture )
{
void UpdateOutsideCursor();
+ VISU_OutsideCursorSettings* GetOutsideCursorSettings();
+
protected:
void ApplySegmentationCursor();
void ApplyOutsideCursor();
QSplitter* aSplitter = new QSplitter(Qt::Vertical,aWidget);
aSplitter->setChildrenCollapsible(true);
+ VISU_ImplicitFunctionWidget* anImplicitFunctionWidget = NULL;
+ VISU_OutsideCursorSettings* anOutsideCursorSettings = NULL;
+ VISU_PickingSettings* aPickingSettings = NULL;
SVTK_Selector* aSelector = SVTK_Selector::New();
{
myMainWindow1 = new VVTK_MainWindow1(aSplitter,
"VVTK_MainWindow",
aResourceMgr);
+ anOutsideCursorSettings = myMainWindow1->GetOutsideCursorSettings();
+ aPickingSettings = myMainWindow1->GetPickingSettings();
+
SVTK_RenderWindowInteractor* anIteractor =
new SVTK_RenderWindowInteractor(myMainWindow1,"SVTK_RenderWindowInteractor1");
VVTK_Renderer1* aRenderer = VVTK_Renderer1::New();
-
+ anImplicitFunctionWidget = aRenderer->GetImplicitFunctionWidget();
+ aRenderer->SetOutsideCursorSettings(anOutsideCursorSettings);
+ aRenderer->SetPickingSettings(aPickingSettings);
+
SVTK_GenericRenderWindowInteractor* aDevice =
SVTK_GenericRenderWindowInteractor::New();
aDevice->SetRenderWidget(anIteractor);
{
myMainWindow2 = myMainWindow1->CreateMainWindow2(aSplitter,
"VVTK_SegmantationWindow",
- aResourceMgr);
+ aResourceMgr,
+ aPickingSettings);
SVTK_RenderWindowInteractor* anIteractor =
new SVTK_RenderWindowInteractor(myMainWindow2,"SVTK_RenderWindowInteractor1");
VVTK_Renderer2* aRenderer = VVTK_Renderer2::New();
+ aRenderer->SetImplicitFunctionWidget(anImplicitFunctionWidget);
+ aRenderer->SetPickingSettings(aPickingSettings);
SVTK_GenericRenderWindowInteractor* aDevice =
SVTK_GenericRenderWindowInteractor::New();
aDevice->Delete();
aRenderer->Delete();
- myMainWindow2->Initialize(anIteractor,aRenderer);
+ myMainWindow2->Initialize(anIteractor);
myView2 = new SVTK_View(myMainWindow2);
SVTK_ViewWindow::Initialize(myView2,theModel);