]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To introduce segmentation functionality
authorapo <apo@opencascade.com>
Mon, 12 Sep 2005 05:02:18 +0000 (05:02 +0000)
committerapo <apo@opencascade.com>
Mon, 12 Sep 2005 05:02:18 +0000 (05:02 +0000)
src/Makefile.in
src/VISUGUI/VISUM_images.po
src/VISUGUI/VISUM_msg_en.po
src/VISUGUI/VisuGUI_Module.cxx
src/VVTK/Makefile.in
src/VVTK/VVTK_Renderer.cxx [new file with mode: 0644]
src/VVTK/VVTK_Renderer.h [new file with mode: 0644]
src/VVTK/VVTK_View.cxx
src/VVTK/VVTK_View.h
src/VVTK/VVTK_ViewWindow.cxx
src/VVTK/VVTK_ViewWindow.h

index c9211e433daddb6fef81cf578523ca9d04340960..7e207ca1a222ef1782939377e7a21fa0e7191d1f 100644 (file)
@@ -32,6 +32,6 @@ VPATH=.:@srcdir@
 
 @COMMENCE@
 
-SUBDIRS = CONVERTOR PIPELINE OBJECT ENGINE VVTK GUITOOLS VISU_I VISUGUI VISU_SWIG
+SUBDIRS = CONVERTOR PIPELINE OBJECT VVTK GUITOOLS VISU_I VISUGUI VISU_SWIG ENGINE
 
 @MODULE@
index 647fb7212abb0b492e69933cf8ef408c69db7714..e07995e91628c853cbe3c5d87f2e7b2075f49c68 100644 (file)
@@ -33,11 +33,17 @@ msgstr ""
 "Content-Type: text/plain; charset=iso-8859-1\n"
 
 
+msgid "ICON_GAUSS_NEW_VIEWER"
+msgstr "Visu_points.png"
+
 msgid "ICON_VVTK_INTERACTOR_STYLE_SWITCH"
 msgstr "Visu_vvtk_switch.png"
 
 msgid "ICON_VVTK_SELECTION_MODE_SWITCH"
 msgstr "Visu_points.png"
 
+msgid "ICON_VVTK_PLANE_SEGMENTATION_SWITCH"
+msgstr "Visu_PlaneSegmentation.png"
+
 msgid "ICON_LOAD_TEXTURE"
 msgstr "Visu_load_texture.png"
index f1d7688733817a90cb688c219b4c31c626a52fa8..73c4800afd3967e6749e86acb7405668159af0b7 100644 (file)
@@ -102,18 +102,24 @@ msgstr "Gauss Points Properties"
 msgid "VVTK_ViewManager::VTK_VIEW_TITLE"
 msgstr "VISU scene:%1 - viewer:%2"
 
-msgid "VVTK_ViewWindow::MNU_VVTK_INTERACTOR_STYLE_SWITCH"
+msgid "VVTK_MainWindowBase::MNU_VVTK_INTERACTOR_STYLE_SWITCH"
 msgstr "Interaction Style Switch"
 
-msgid "VVTK_ViewWindow::DSC_VVTK_INTERACTOR_STYLE_SWITCH"
+msgid "VVTK_MainWindowBase::DSC_VVTK_INTERACTOR_STYLE_SWITCH"
 msgstr "Interaction Style Switch"
 
-msgid "VVTK_ViewWindow::MNU_VVTK_SELECTION_MODE_SWITCH"
+msgid "VVTK_MainWindowBase::MNU_VVTK_SELECTION_MODE_SWITCH"
 msgstr "Selection Mode Switch"
 
-msgid "VVTK_ViewWindow::DSC_VVTK_SELECTION_MODE_SWITCH"
+msgid "VVTK_MainWindowBase::DSC_VVTK_SELECTION_MODE_SWITCH"
 msgstr "Selection Mode Switch"
 
+msgid "VVTK_MainWindow::MNU_VVTK_PLANE_SEGMENTATION_SWITCH"
+msgstr "Plane Segmentation Switch"
+
+msgid "VVTK_MainWindow::DSC_VVTK_PLANE_SEGMENTATION_SWITCH"
+msgstr "Plane Segmentation Switch"
+
 msgid "VisuGUI_GaussPointsDlg::&Cancel"
 msgstr ""
 
index 89cdc342b1b3a6e8236faca81f0aac424baa4174..7c990d61f900c8bb5e3e66cc240632f0d6bbb508 100644 (file)
@@ -165,10 +165,20 @@ VisuGUI_Module
 {
   VisuGUI::initialize( theApp );
 
-  // create actions and add menus
-  createAction( GAUSS_NEW_VIEWER, tr("MEN_GAUSS_NEW_VIEWER"), QIconSet(),
-                tr("MEN_GAUSS_NEW_VIEWER"), "", 0, this, false,
-                this, SLOT(onCreateViewManager()));
+  SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+
+  QPixmap aPixmap;
+  aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_NEW_VIEWER"));
+  createAction( GAUSS_NEW_VIEWER, 
+               tr("MEN_GAUSS_NEW_VIEWER"), 
+               aPixmap,
+                tr("MEN_GAUSS_NEW_VIEWER"), 
+               tr("MEN_GAUSS_NEW_VIEWER"),
+               ALT+Key_S, 
+               this, 
+               false,
+                this, 
+               SLOT(onCreateViewManager()));
   int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
   int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
   int gaussMenu = createMenu( action( GAUSS_NEW_VIEWER ), newWinMenu, -1 );
index 0f36b64c42b68c14976804d7214c1b4faa8037a0..6ebf0a3de667acaec95472439c99cfa754aa5156 100755 (executable)
@@ -26,6 +26,7 @@ LIB_SRC=      VVTK_ViewManager.cxx \
                VVTK_ViewModel.cxx \
                VVTK_InteractorStyle.cxx \
                VVTK_ViewWindow.cxx \
+               VVTK_Renderer.cxx \
                VVTK_View.cxx 
 
 LIB_MOC =      VVTK_ViewWindow.h \
diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx
new file mode 100644 (file)
index 0000000..09e7f95
--- /dev/null
@@ -0,0 +1,193 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  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_Renderer.h"
+
+#include "VISU_GaussPtsAct.h"
+
+#include <vtkObjectFactory.h>
+#include <vtkImplicitPlaneWidget.h>
+#include <vtkProperty.h>
+
+#include <vtkRenderWindowInteractor.h>
+#include <vtkCallbackCommand.h>
+#include <vtkCommand.h>
+#include <vtkPlane.h>
+
+#include "utilities.h"
+
+#ifdef _DEBUG_
+static int MYDEBUG = 1;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VVTK_Renderer1);
+
+//----------------------------------------------------------------------------
+VVTK_Renderer1
+::VVTK_Renderer1():
+  myImplicitPlaneWidget(vtkImplicitPlaneWidget::New())
+{
+  if(MYDEBUG) INFOS("VVTK_Renderer1() - "<<this);
+
+  myImplicitPlaneWidget->SetPlaceFactor(1.0);
+  myImplicitPlaneWidget->SetOutlineTranslation(false);
+  vtkProperty* aSelectedPlaneProperty = myImplicitPlaneWidget->GetSelectedPlaneProperty();
+  vtkProperty* aPlaneProperty = myImplicitPlaneWidget->GetPlaneProperty();
+  aPlaneProperty->SetOpacity(aSelectedPlaneProperty->GetOpacity()*1.5);
+
+  myImplicitPlaneWidget->Delete();
+}
+
+VVTK_Renderer1
+::~VVTK_Renderer1()
+{
+  if(MYDEBUG) INFOS("~VVTK_Renderer1() - "<<this);
+  myImplicitPlaneWidget->SetInteractor(NULL);
+}
+
+//----------------------------------------------------------------------------
+void 
+VVTK_Renderer1
+::SetInteractor(vtkRenderWindowInteractor* theInteractor)
+{
+  SVTK_Renderer::SetInteractor(theInteractor);
+  myImplicitPlaneWidget->SetInteractor(theInteractor);
+}
+
+//----------------------------------------------------------------------------
+vtkImplicitPlaneWidget*
+VVTK_Renderer1
+::GetImplicitPlaneWidget()
+{
+  return myImplicitPlaneWidget.GetPointer();
+}
+
+//----------------------------------------------------------------------------
+bool
+VVTK_Renderer1
+::OnAdjustActors()
+{
+  if(SVTK_Renderer::OnAdjustActors()){
+    myImplicitPlaneWidget->PlaceWidget(myBndBox);
+    myImplicitPlaneWidget->SetOrigin((myBndBox[1] + myBndBox[0]) / 2.0,
+                                    (myBndBox[3] + myBndBox[2]) / 2.0,
+                                    (myBndBox[5] + myBndBox[4]) / 2.0);
+    myImplicitPlaneWidget->SetHandleSize(myImplicitPlaneWidget->GetHandleSize());
+    return true;
+  }
+  return false;
+}
+
+
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(VVTK_Renderer2);
+
+//----------------------------------------------------------------------------
+VVTK_Renderer2
+::VVTK_Renderer2():
+  myEventCallbackCommand(vtkCallbackCommand::New()),
+  myFunction(vtkPlane::New())
+{
+  if(MYDEBUG) INFOS("VVTK_Renderer2() - "<<this);
+  myEventCallbackCommand->Delete();
+  myFunction->Delete();
+
+  myPriority = 0.0;
+  myEventCallbackCommand->SetClientData(this); 
+  myEventCallbackCommand->SetCallback(VVTK_Renderer2::ProcessEvents);
+}
+
+VVTK_Renderer2
+::~VVTK_Renderer2()
+{
+  if(MYDEBUG) INFOS("~VVTK_Renderer2() - "<<this);
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer2
+::SetRenderer1(VVTK_Renderer1* theRenderer)
+{
+  myRenderer1 = theRenderer;
+  myImplicitPlaneWidget1 = myRenderer1->GetImplicitPlaneWidget();
+  myImplicitPlaneWidget1->AddObserver(vtkCommand::EndInteractionEvent, 
+                                     myEventCallbackCommand.GetPointer(), 
+                                     myPriority);
+
+}
+
+void 
+VVTK_Renderer2
+::ProcessEvents(vtkObject* vtkNotUsed(theObject), 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* vtkNotUsed(theCallData))
+{
+  VVTK_Renderer2* self = reinterpret_cast<VVTK_Renderer2*>(theClientData);
+
+  switch(theEvent){
+  case vtkCommand::EndInteractionEvent:
+    self->OnEndInteractionEvent();
+    break;
+  }
+}
+
+void
+VVTK_Renderer2
+::OnEndInteractionEvent()
+{
+  myImplicitPlaneWidget1->GetPlane(myFunction.GetPointer());
+  myInteractor->Render();
+}
+
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer2
+::AddActor(VTKViewer_Actor* theActor)
+{
+  SVTK_Renderer::AddActor(theActor);
+  if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(theActor))
+    if(VISU::TActorFactory* aFactory = anActor->GetFactory())
+      aFactory->AddClippingPlane(anActor,myFunction.GetPointer());
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer2
+::RemoveActor(VTKViewer_Actor* theActor)
+{
+  SVTK_Renderer::RemoveActor(theActor);
+  if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(theActor))
+    if(VISU::TActorFactory* aFactory = anActor->GetFactory())
+      aFactory->RemoveAllClippingPlanes(anActor);
+}
diff --git a/src/VVTK/VVTK_Renderer.h b/src/VVTK/VVTK_Renderer.h
new file mode 100644 (file)
index 0000000..1925182
--- /dev/null
@@ -0,0 +1,110 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  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 : SALOME
+//  $Header$
+
+#ifndef VVTK_Renderer_h
+#define VVTK_Renderer_h
+
+#include "VVTK.h"
+
+#include "SVTK_Renderer.h"
+
+class vtkImplicitPlaneWidget;
+class vtkPlane;
+
+//----------------------------------------------------------------------------
+class VVTK_EXPORT VVTK_Renderer1 : public SVTK_Renderer
+{
+ public:
+  vtkTypeMacro(VVTK_Renderer1,SVTK_Renderer);
+  static VVTK_Renderer1* New();
+
+  virtual
+  void 
+  SetInteractor(vtkRenderWindowInteractor* theInteractor);
+
+  vtkImplicitPlaneWidget*
+  GetImplicitPlaneWidget();
+
+ protected:
+  VVTK_Renderer1();
+  ~VVTK_Renderer1();
+
+  virtual
+  bool
+  OnAdjustActors();
+
+  vtkSmartPointer<vtkImplicitPlaneWidget> myImplicitPlaneWidget;
+};
+
+
+//----------------------------------------------------------------------------
+class VVTK_EXPORT VVTK_Renderer2 : public SVTK_Renderer
+{
+ public:
+  vtkTypeMacro(VVTK_Renderer2,SVTK_Renderer);
+  static VVTK_Renderer2* New();
+
+  virtual
+  void 
+  AddActor(VTKViewer_Actor* theActor);
+
+  virtual
+  void 
+  RemoveActor(VTKViewer_Actor* theActor);
+
+  void
+  SetRenderer1(VVTK_Renderer1* theRenderer);
+
+  void
+  OnEndInteractionEvent();
+
+ protected:
+  VVTK_Renderer2();
+  ~VVTK_Renderer2();
+
+  // Main process VTK event method
+  static
+  void
+  ProcessEvents(vtkObject* theObject, 
+               unsigned long theEvent,
+               void* theClientData, 
+               void* theCallData);
+
+  // Used to process VTK events
+  vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
+
+  // Priority at which events are processed
+  float myPriority;
+
+  vtkSmartPointer<vtkImplicitPlaneWidget> myImplicitPlaneWidget1;
+  vtkSmartPointer<VVTK_Renderer1> myRenderer1;
+  vtkSmartPointer<vtkPlane> myFunction;
+};
+
+
+#endif
index 29c4bb2f5c8eb9778a37b97795515208b5bb1d68..a38065d8da15d7939e239dcb89469543743ac6dd 100644 (file)
 #include "VVTK_InteractorStyle.h"
 
 #include "SVTK_RenderWindowInteractor.h"
-#include "SVTK_Renderer.h"
+#include "VVTK_Renderer.h"
 
 #include "SUIT_ResourceMgr.h"
 #include "QtxAction.h"
 
 #include <qtoolbar.h>
+#include <vtkImplicitPlaneWidget.h>
 
 //----------------------------------------------------------------------------
-VVTK_MainWindow
-::VVTK_MainWindow(QWidget* theParent, 
-                 const char* theName,
-                 SUIT_ResourceMgr* theResourceMgr):
+VVTK_MainWindowBase
+::VVTK_MainWindowBase(QWidget* theParent, 
+                     const char* theName,
+                     SUIT_ResourceMgr* theResourceMgr):
   SVTK_MainWindow(theParent,theName,theResourceMgr),
   myInteractorStyle(VVTK_InteractorStyle::New())
 {
@@ -64,10 +65,10 @@ VVTK_MainWindow
                           this, 
                           "VVTK/SVTK StyleSwitch", 
                           true);
-  anAction->toggle();
   anAction->setToggleAction(true);
+  anAction->toggle();
   anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH"));
-  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onInteractorStyleSwitch(bool)));
+  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnInteractorStyleSwitch(bool)));
   anAction->addTo( myPtsToolBar );
   
   aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH"));
@@ -80,29 +81,92 @@ VVTK_MainWindow
                           true);
   anAction->setToggleAction(true);
   anAction->setStatusTip(tr("DSC_VVTK_SELECTION_MODE_SWITCH"));
-  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onSelectionModeSwitch(bool)));
+  connect(anAction, SIGNAL(toggled(bool)), this, SLOT(OnSelectionModeSwitch(bool)));
   anAction->addTo( myPtsToolBar );
 }
 
 void
-VVTK_MainWindow
-::Initialize()
+VVTK_MainWindowBase
+::Initialize(SVTK_Renderer *theRenderer)
 {
-  SVTK_MainWindow::Initialize();
-
-  // important! : the default interactor style which is pushed is VVTK
-  // see onInteractorStyleSwitch() for details
+  SVTK_MainWindow::Initialize(theRenderer);
   PushInteractorStyle(myInteractorStyle.GetPointer());
 }
 
-VVTK_MainWindow
-::~VVTK_MainWindow()
+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);
+}
+
+
+//----------------------------------------------------------------------------
+VVTK_MainWindow1
+::VVTK_MainWindow1(QWidget* theParent, 
+                 const char* theName,
+                 SUIT_ResourceMgr* theResourceMgr):
+  VVTK_MainWindowBase(theParent,theName,theResourceMgr)
+{
+  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 );
+}
+
+void
+VVTK_MainWindow1
+::Initialize()
+{
+  myRenderer = VVTK_Renderer1::New();
+  VVTK_MainWindowBase::Initialize(myRenderer.GetPointer());
+  myRenderer->Delete();
+}
+
+VVTK_MainWindow1
+::~VVTK_MainWindow1()
+{}
+
+
+//----------------------------------------------------------------------------
+VVTK_Renderer1* 
+VVTK_MainWindow1
+::GetRenderer1()
+{
+  return myRenderer.GetPointer();
+}
+
 //----------------------------------------------------------------------------
 QSize
-VVTK_MainWindow
+VVTK_MainWindow1
 ::sizeHint() const
 {
   QWidget* aParent = parentWidget();
@@ -113,66 +177,44 @@ VVTK_MainWindow
   return QSize(aWidth,aHeight);
 }
 
-
 //----------------------------------------------------------------------------
 void
-VVTK_MainWindow
-::onInteractorStyleSwitch(bool theIsVVTKStyle)
+VVTK_MainWindow1
+::OnPlaneSegmentationSwitch(bool theIsPlaneSegmentationOn)
 {
-  // default interactor style which is pushed in this view window constructor
-  // is VVTK.  If it is a current interactor style -- push SVTK "above" it.
-  // if SVTK is a current one - pop it (remove from stack), below it there MUST BE
-  // (logically) a VVTK interactor style.
-  if ( theIsVVTKStyle )
-    this->PopInteractorStyle();
-  else
-    this->PushInteractorStyle(myInteractorStyle.GetPointer());
+  myRenderer->GetImplicitPlaneWidget()->SetEnabled(theIsPlaneSegmentationOn);
 }
 
-//----------------------------------------------------------------------------
-void
-VVTK_MainWindow
-::onSelectionModeSwitch(bool theIsSelectionOn)
-{
-  SetSelectionMode(theIsSelectionOn? NodeSelection: ActorSelection);
-}
 
 
 //----------------------------------------------------------------------------
-VVTK_SMainWindow
-::VVTK_SMainWindow(QWidget* theParent, 
+VVTK_MainWindow2
+::VVTK_MainWindow2(QWidget* theParent, 
                   const char* theName,
-                  SUIT_ResourceMgr* theResourceMgr):
-  VVTK_MainWindow(theParent,theName,theResourceMgr)
+                  SUIT_ResourceMgr* theResourceMgr,
+                  VVTK_MainWindow1* theMainWindow):
+  VVTK_MainWindowBase(theParent,theName,theResourceMgr),
+  myMainWindow(theMainWindow)
 {}
 
 void
-VVTK_SMainWindow
+VVTK_MainWindow2
 ::Initialize()
 {
-  SetInteractor(new SVTK_RenderWindowInteractor(this,"SVTK_RenderWindowInteractor"));
-
-  SVTK_Renderer* aRenderer = SVTK_Renderer::New();
-  GetInteractor()->SetRenderer(aRenderer);
-  aRenderer->Delete();
+  myRenderer = VVTK_Renderer2::New();
+  VVTK_MainWindowBase::Initialize(myRenderer.GetPointer());
+  myRenderer->Delete();
 
-  SVTK_InteractorStyle* aStyle = SVTK_InteractorStyle::New();
-  GetInteractor()->PushInteractorStyle(aStyle);
-  aStyle->Delete();
-
-  // important! : the default interactor style which is pushed is VVTK
-  // see onInteractorStyleSwitch() for details
-  PushInteractorStyle(myInteractorStyle.GetPointer());
+  myRenderer->SetRenderer1(myMainWindow->GetRenderer1());
 }
 
-VVTK_SMainWindow
-::~VVTK_SMainWindow()
+VVTK_MainWindow2
+::~VVTK_MainWindow2()
 {}
 
-
 //----------------------------------------------------------------------------
 QSize
-VVTK_SMainWindow
+VVTK_MainWindow2
 ::sizeHint() const
 {
   QWidget* aParent = parentWidget();
index 6620677062a956a0c1f75f577cd25cc4b689988c..af8544ea41767a100b6e167a42e5d2d35a64d7a8 100644 (file)
@@ -8,57 +8,91 @@
 #include "VVTK.h"
 #include "SVTK_View.h"
 
+class VVTK_Renderer1;
+class VVTK_Renderer2;
 
 //----------------------------------------------------------------------------
-class VVTK_EXPORT VVTK_MainWindow: public SVTK_MainWindow
+class VVTK_EXPORT VVTK_MainWindowBase: public SVTK_MainWindow
 {
   Q_OBJECT;
 
 public:
-  VVTK_MainWindow(QWidget* theParent, 
-                 const char* theName,
-                 SUIT_ResourceMgr* theResourceMgr);
+  VVTK_MainWindowBase(QWidget* theParent, 
+                     const char* theName,
+                     SUIT_ResourceMgr* theResourceMgr);
+  virtual
+  void
+  Initialize(SVTK_Renderer *theRenderer);
+
+  virtual
+  ~VVTK_MainWindowBase();
+
+ public slots:
+  void OnInteractorStyleSwitch(bool theIsGaussStyleOn); 
+  void OnSelectionModeSwitch(bool theIsSelectionOn); 
+
+ protected:
+  QToolBar* myPtsToolBar;
+  vtkSmartPointer<vtkInteractorStyle> myInteractorStyle;
+};
+
+
+//----------------------------------------------------------------------------
+class VVTK_EXPORT VVTK_MainWindow1: public VVTK_MainWindowBase
+{
+  Q_OBJECT;
+
+public:
+  VVTK_MainWindow1(QWidget* theParent, 
+                  const char* theName,
+                  SUIT_ResourceMgr* theResourceMgr);
   virtual
   void
   Initialize();
 
   virtual
-  ~VVTK_MainWindow();
+  ~VVTK_MainWindow1();
+
+  VVTK_Renderer1* 
+  GetRenderer1();
 
   virtual
   QSize
   sizeHint() const;
 
  public slots:
-  void onInteractorStyleSwitch(bool theIsVVTKStyle); 
-  void onSelectionModeSwitch(bool theIsSelectionOn); 
+  void OnPlaneSegmentationSwitch(bool theIsPlaneSegmentationOn); 
 
  protected:
-  QToolBar* myPtsToolBar;
-  vtkSmartPointer<SVTK_InteractorStyle> myInteractorStyle;
+  vtkSmartPointer<VVTK_Renderer1> myRenderer;
 };
 
 
 //----------------------------------------------------------------------------
-class VVTK_EXPORT VVTK_SMainWindow: public VVTK_MainWindow
+class VVTK_EXPORT VVTK_MainWindow2: public VVTK_MainWindowBase
 {
   Q_OBJECT;
 
 public:
-  VVTK_SMainWindow(QWidget* theParent, 
-                 const char* theName,
-                 SUIT_ResourceMgr* theResourceMgr);
+  VVTK_MainWindow2(QWidget* theParent, 
+                  const char* theName,
+                  SUIT_ResourceMgr* theResourceMgr,
+                  VVTK_MainWindow1* theMainWindow);
 
   virtual
   void
   Initialize();
 
   virtual
-  ~VVTK_SMainWindow();
+  ~VVTK_MainWindow2();
 
   virtual
   QSize
   sizeHint() const;
+
+ protected:
+  VVTK_MainWindow1* myMainWindow;
+  vtkSmartPointer<VVTK_Renderer2> myRenderer;
 };
 
 
index c2f457bb13a60a9dcd1c916939387776b860feca..b443a75c095add1342b2d002ecb4d67256418135 100755 (executable)
@@ -1,7 +1,37 @@
+//  SALOME VTKViewer : build VTK viewer into Salome desktop
+//
+//  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 : SALOME
+//  $Header$
+
 #include "VVTK_ViewWindow.h"
 #include "VVTK_ViewModel.h"
 #include "VVTK_View.h"
 
+#include "VISU_GaussPtsAct.h"
+
 #include "SUIT_Session.h"
 
 #include <qsplitter.h>
 //----------------------------------------------------------------------------
 VVTK_ViewWindow
 ::VVTK_ViewWindow(SUIT_Desktop* theDesktop):
-  SVTK_ViewWindow(theDesktop)
+  SVTK_ViewWindow(theDesktop),
+  myMainWindow1(NULL),
+  myMainWindow2(NULL),
+  myView2(NULL)
 {}
 
 //----------------------------------------------------------------------------
@@ -26,20 +59,22 @@ VVTK_ViewWindow
     aLayout->setAutoAdd(true);
     QSplitter* aSplitter = new QSplitter(Qt::Vertical,aWidget);
 
-    myMainWindow = new VVTK_MainWindow(aSplitter,
-                                      "VVTK_MainWindow",
-                                      aResourceMgr);
+    myMainWindow1 = new VVTK_MainWindow1(aSplitter,
+                                        "VVTK_MainWindow",
+                                        aResourceMgr);
+    myMainWindow = myMainWindow1;
     myMainWindow->Initialize();
-
+    
     myView = new SVTK_View(myMainWindow);
     SVTK_ViewWindow::Initialize(myView,theModel);
 
-    mySMainWindow = new VVTK_SMainWindow(aSplitter,
-                                               "VVTK_SegmantationWindow",
-                                               aResourceMgr);
-    mySMainWindow->Initialize();
+    myMainWindow2 = new VVTK_MainWindow2(aSplitter,
+                                        "VVTK_SegmantationWindow",
+                                        aResourceMgr,
+                                        myMainWindow1);
+    myMainWindow2->Initialize();
 
-    mySView = new SVTK_View(mySMainWindow);
+    myView2 = new SVTK_View(myMainWindow2);
   }
 }
 
@@ -47,3 +82,45 @@ VVTK_ViewWindow
 VVTK_ViewWindow
 ::~VVTK_ViewWindow()
 {}
+
+
+//----------------------------------------------------------------------------
+void
+VVTK_ViewWindow
+::AddActor(VTKViewer_Actor* theActor, 
+          bool theIsUpdate)
+{
+  SVTK_ViewWindow::AddActor(theActor,theIsUpdate);
+  if(VISU_Actor* anAct = dynamic_cast<VISU_Actor*>(theActor))
+    if(VISU::TActorFactory* aFactory = anAct->GetFactory())
+      if(VISU_Actor* anActor = aFactory->CreateActor())
+       myMainWindow2->AddActor(anActor,theIsUpdate);
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_ViewWindow
+::RemoveActor(VTKViewer_Actor* theActor, 
+             bool theIsUpdate)
+{
+  SVTK_ViewWindow::RemoveActor(theActor,theIsUpdate);
+  myMainWindow2->RemoveActor(theActor,theIsUpdate);
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_ViewWindow
+::onResetView()
+{
+  myMainWindow1->onResetView();
+  myMainWindow2->onResetView();
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_ViewWindow
+::onFitAll()
+{
+  myMainWindow1->onFitAll();
+  myMainWindow2->onFitAll();
+}
index edb1fba63cb3187e3abdace6338df677a26b6c8b..0aacd4c9d5f94d459668adcbec91ab1e309ec782 100755 (executable)
@@ -8,8 +8,8 @@
 #include "VVTK.h"
 #include "SVTK_ViewWindow.h"
 
-class VVTK_SMainWindow;
-class VVTK_MainWindow;
+class VVTK_MainWindow1;
+class VVTK_MainWindow2;
 class SVTK_View;
 
 class VVTK_EXPORT VVTK_ViewWindow : public SVTK_ViewWindow
@@ -22,13 +22,33 @@ public:
   virtual
   ~VVTK_ViewWindow();
 
+  virtual
+  void
+  AddActor(VTKViewer_Actor* theActor,
+          bool theIsUpdate = false);
+
+  virtual
+  void
+  RemoveActor(VTKViewer_Actor* theActor,
+             bool theIsUpdate = false);
+
   virtual
   void
   Initialize(SVTK_ViewModelBase* theModel);
 
+public slots:
+  virtual
+  void
+  onResetView();     
+
+  virtual
+  void 
+  onFitAll();
+
 protected:
-  VVTK_SMainWindow* mySMainWindow;
-  SVTK_View* mySView;
+  VVTK_MainWindow1* myMainWindow1;
+  VVTK_MainWindow2* myMainWindow2;
+  SVTK_View* myView2;
 };
 
 #ifdef WIN32