]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
First step to customize segmentation window
authorapo <apo@opencascade.com>
Fri, 9 Sep 2005 08:07:19 +0000 (08:07 +0000)
committerapo <apo@opencascade.com>
Fri, 9 Sep 2005 08:07:19 +0000 (08:07 +0000)
src/VVTK/VVTK_View.cxx
src/VVTK/VVTK_View.h
src/VVTK/VVTK_ViewWindow.cxx
src/VVTK/VVTK_ViewWindow.h

index effb4637030be127da95a4a18d3be5d8da8c142c..29c4bb2f5c8eb9778a37b97795515208b5bb1d68 100644 (file)
@@ -29,6 +29,9 @@
 #include "VVTK_View.h"
 #include "VVTK_InteractorStyle.h"
 
+#include "SVTK_RenderWindowInteractor.h"
+#include "SVTK_Renderer.h"
+
 #include "SUIT_ResourceMgr.h"
 #include "QtxAction.h"
 
 VVTK_MainWindow
 ::VVTK_MainWindow(QWidget* theParent, 
                  const char* theName,
-                 SUIT_ResourceMgr* theResourceMgr,
-                 bool theIsBase):
+                 SUIT_ResourceMgr* theResourceMgr):
   SVTK_MainWindow(theParent,theName,theResourceMgr),
-  myInteractorStyle(VVTK_InteractorStyle::New()),
-  myIsBase(theIsBase)
+  myInteractorStyle(VVTK_InteractorStyle::New())
 {
   myInteractorStyle->Delete();
 
   this->moveDockWindow(myToolBar,Qt::DockLeft);
 
-  myToolBar2 = new QToolBar(this);
-  myToolBar2->setCloseMode(QDockWindow::Undocked);
-  myToolBar2->setLabel(tr("LBL_TOOLBAR_LABEL"));
-  this->moveDockWindow(myToolBar2,Qt::DockLeft);
+  myPtsToolBar = new QToolBar(this);
+  myPtsToolBar->setCloseMode(QDockWindow::Undocked);
+  myPtsToolBar->setLabel(tr("LBL_TOOLBAR_LABEL"));
+  this->moveDockWindow(myPtsToolBar,Qt::DockLeft);
 
   QPixmap aPixmap;
   QtxAction* anAction;
@@ -67,7 +68,7 @@ VVTK_MainWindow
   anAction->setToggleAction(true);
   anAction->setStatusTip(tr("DSC_VVTK_INTERACTOR_STYLE_SWITCH"));
   connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onInteractorStyleSwitch(bool)));
-  anAction->addTo( myToolBar2 );
+  anAction->addTo( myPtsToolBar );
   
   aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_SELECTION_MODE_SWITCH"));
   anAction = new QtxAction(tr("MNU_VVTK_SELECTION_MODE_SWITCH"), 
@@ -80,7 +81,7 @@ VVTK_MainWindow
   anAction->setToggleAction(true);
   anAction->setStatusTip(tr("DSC_VVTK_SELECTION_MODE_SWITCH"));
   connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onSelectionModeSwitch(bool)));
-  anAction->addTo( myToolBar2 );
+  anAction->addTo( myPtsToolBar );
 }
 
 void
@@ -105,12 +106,10 @@ VVTK_MainWindow
 ::sizeHint() const
 {
   QWidget* aParent = parentWidget();
-  float aCoeff = 2.0/3.0;
-  if(!myIsBase)
-    aCoeff = 1.0/3.0;
-
+  static float aCoeff = 2.0/3.0;
   int aWidth = int(aCoeff*aParent->width());
   int aHeight = int(aCoeff*aParent->height());
+
   return QSize(aWidth,aHeight);
 }
 
@@ -137,3 +136,49 @@ VVTK_MainWindow
 {
   SetSelectionMode(theIsSelectionOn? NodeSelection: ActorSelection);
 }
+
+
+//----------------------------------------------------------------------------
+VVTK_SMainWindow
+::VVTK_SMainWindow(QWidget* theParent, 
+                  const char* theName,
+                  SUIT_ResourceMgr* theResourceMgr):
+  VVTK_MainWindow(theParent,theName,theResourceMgr)
+{}
+
+void
+VVTK_SMainWindow
+::Initialize()
+{
+  SetInteractor(new SVTK_RenderWindowInteractor(this,"SVTK_RenderWindowInteractor"));
+
+  SVTK_Renderer* aRenderer = SVTK_Renderer::New();
+  GetInteractor()->SetRenderer(aRenderer);
+  aRenderer->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());
+}
+
+VVTK_SMainWindow
+::~VVTK_SMainWindow()
+{}
+
+
+//----------------------------------------------------------------------------
+QSize
+VVTK_SMainWindow
+::sizeHint() const
+{
+  QWidget* aParent = parentWidget();
+  static float aCoeff = 1.0/3.0;
+  int aWidth = int(aCoeff*aParent->width());
+  int aHeight = int(aCoeff*aParent->height());
+
+  return QSize(aWidth,aHeight);
+}
index 88f5285f517187bd8a9082b2edc50a988e0cf27e..6620677062a956a0c1f75f577cd25cc4b689988c 100644 (file)
@@ -17,9 +17,7 @@ class VVTK_EXPORT VVTK_MainWindow: public SVTK_MainWindow
 public:
   VVTK_MainWindow(QWidget* theParent, 
                  const char* theName,
-                 SUIT_ResourceMgr* theResourceMgr,
-                 bool theIsBase);
-
+                 SUIT_ResourceMgr* theResourceMgr);
   virtual
   void
   Initialize();
@@ -36,12 +34,34 @@ public:
   void onSelectionModeSwitch(bool theIsSelectionOn); 
 
  protected:
-  bool myIsBase;
-  QToolBar* myToolBar2;
+  QToolBar* myPtsToolBar;
   vtkSmartPointer<SVTK_InteractorStyle> myInteractorStyle;
 };
 
 
+//----------------------------------------------------------------------------
+class VVTK_EXPORT VVTK_SMainWindow: public VVTK_MainWindow
+{
+  Q_OBJECT;
+
+public:
+  VVTK_SMainWindow(QWidget* theParent, 
+                 const char* theName,
+                 SUIT_ResourceMgr* theResourceMgr);
+
+  virtual
+  void
+  Initialize();
+
+  virtual
+  ~VVTK_SMainWindow();
+
+  virtual
+  QSize
+  sizeHint() const;
+};
+
+
 #ifdef WIN32
 #pragma warning( default:4251 )
 #endif
index 78ae831076730965bfc6d95d9ba65cc93b45a7c1..c2f457bb13a60a9dcd1c916939387776b860feca 100755 (executable)
@@ -26,25 +26,20 @@ VVTK_ViewWindow
     aLayout->setAutoAdd(true);
     QSplitter* aSplitter = new QSplitter(Qt::Vertical,aWidget);
 
-    myVMainWindow[0] = new VVTK_MainWindow(aSplitter,
-                                          "SVTK_MainWindow",
-                                          aResourceMgr,
-                                          true);
-    myVMainWindow[0]->Initialize();
+    myMainWindow = new VVTK_MainWindow(aSplitter,
+                                      "VVTK_MainWindow",
+                                      aResourceMgr);
+    myMainWindow->Initialize();
 
-    myVView[0] = new SVTK_View(myVMainWindow[0]);
-
-    myVMainWindow[1] = new VVTK_MainWindow(aSplitter,
-                                          "SVTK_MainWindow",
-                                          aResourceMgr,
-                                          false);
-    myVMainWindow[1]->Initialize();
+    myView = new SVTK_View(myMainWindow);
+    SVTK_ViewWindow::Initialize(myView,theModel);
 
-    myVView[1] = new SVTK_View(myVMainWindow[0]);
+    mySMainWindow = new VVTK_SMainWindow(aSplitter,
+                                               "VVTK_SegmantationWindow",
+                                               aResourceMgr);
+    mySMainWindow->Initialize();
 
-    myView = myVView[0];
-    myMainWindow = myVMainWindow[0];
-    SVTK_ViewWindow::Initialize(myView,theModel);
+    mySView = new SVTK_View(mySMainWindow);
   }
 }
 
index e7892cc4ba9339f29163ac52a3308729e54b5cb5..edb1fba63cb3187e3abdace6338df677a26b6c8b 100755 (executable)
@@ -8,6 +8,7 @@
 #include "VVTK.h"
 #include "SVTK_ViewWindow.h"
 
+class VVTK_SMainWindow;
 class VVTK_MainWindow;
 class SVTK_View;
 
@@ -26,8 +27,8 @@ public:
   Initialize(SVTK_ViewModelBase* theModel);
 
 protected:
-  VVTK_MainWindow* myVMainWindow[2];
-  SVTK_View* myVView[2];
+  VVTK_SMainWindow* mySMainWindow;
+  SVTK_View* mySView;
 };
 
 #ifdef WIN32