SVTK_ViewModel.h \
SVTK_ViewWindow.h \
SVTK_Renderer.h \
- SVTK_RenderWindow.h \
SVTK_InteractorStyle.h \
SVTK_RenderWindowInteractor.h \
SVTK_Selector.h \
SVTK_ViewModel.cxx \
SVTK_Renderer.cxx \
SVTK_ViewWindow.cxx \
- SVTK_RenderWindow.cxx\
SVTK_InteractorStyle.cxx \
SVTK_RenderWindowInteractor.cxx \
SVTK_SpaceMouse.cxx \
}
vtkInteractorStyle::ProcessEvents( object, event, clientData, callData );
}
-
-#include "SVTK_RenderWindow.h"
+++ /dev/null
-// 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 "SVTK_RenderWindow.h"
-
-#include "SVTK_Renderer.h"
-#include "SVTK_Selector.h"
-
-#include <vtkObjectFactory.h>
-
-//----------------------------------------------------------------------------
-vtkStandardNewMacro(SVTK_RenderWindow);
-
-
-//----------------------------------------------------------------------------
-SVTK_RenderWindow
-::SVTK_RenderWindow():
- myRenderWidget(NULL)
-{
-}
-
-SVTK_RenderWindow
-::~SVTK_RenderWindow()
-{}
-
-
-//----------------------------------------------------------------------------
-SVTK_Renderer*
-SVTK_RenderWindow
-::GetRenderer()
-{
- return myRenderer.GetPointer();
-}
-
-void
-SVTK_RenderWindow
-::SetRenderer(SVTK_Renderer* theRenderer)
-{
- this->RemoveRenderer(GetRenderer());
- myRenderer = theRenderer;
- this->AddRenderer(GetRenderer());
-}
-
-
-//----------------------------------------------------------------------------
-SVTK_Selector*
-SVTK_RenderWindow
-::GetSelector()
-{
- return mySelector.GetPointer();
-}
-
-void
-SVTK_RenderWindow
-::SetSelector(SVTK_Selector* theSelector)
-{
- mySelector = theSelector;
-}
-
-
-//----------------------------------------------------------------------------
-SVTK_RenderWindow::TRenderWidget*
-SVTK_RenderWindow
-::GetRenderWidget()
-{
- return myRenderWidget;
-}
-
-void
-SVTK_RenderWindow
-::GetRenderWidget(TRenderWidget* theWidget)
-{
- myRenderWidget = theWidget;
-}
+++ /dev/null
-// 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 : VTKViewer_RenderWindow.h
-// Author : Nicolas REJNERI
-// Module : SALOME
-// $Header$
-
-#ifndef SVTK_RenderWindow_h
-#define SVTK_RenderWindow_h
-
-#include "SVTK.h"
-
-#include <vtkSmartPointer.h>
-
-#ifndef VTK_IMPLEMENT_MESA_CXX
-#include <vtkXOpenGLRenderWindow.h>
-#define SVTK_RENDER_WINDOW_SUPERCLASS vtkXOpenGLRenderWindow
-#else
-#include <vtkXMesaRenderWindow.h>
-#define SVTK_RENDER_WINDOW_SUPERCLASS vtkXMesaRenderWindow
-#endif
-
-class QWidget;
-class SVTK_Renderer;
-class SVTK_Selector;
-
-class SVTK_EXPORT SVTK_RenderWindow: public SVTK_RENDER_WINDOW_SUPERCLASS
-{
- public:
- vtkTypeMacro(SVTK_RenderWindow,SVTK_RENDER_WINDOW_SUPERCLASS);
- static SVTK_RenderWindow* New();
-
- SVTK_RenderWindow();
- virtual ~SVTK_RenderWindow();
-
- SVTK_Renderer* GetRenderer();
- void SetRenderer(SVTK_Renderer* theRenderer);
-
- SVTK_Selector* GetSelector();
- void SetSelector(SVTK_Selector* theSelector);
-
- typedef QWidget TRenderWidget;
- TRenderWidget* GetRenderWidget();
- void GetRenderWidget(TRenderWidget* theWidget);
-
- protected:
- vtkSmartPointer<SVTK_Selector> mySelector;
- vtkSmartPointer<SVTK_Renderer> myRenderer;
- TRenderWidget* myRenderWidget;
-};
-
-
-#endif
#include "SVTK_RenderWindowInteractor.h"
#include "SVTK_InteractorStyle.h"
-#include "VTKViewer_Algorithm.h"
+#include "SVTK_Renderer.h"
#include "SVTK_Functor.h"
#include "SALOME_Actor.h"
+
#include "SVTK_SpaceMouse.h"
#include "SVTK_Event.h"
+#include "VTKViewer_Algorithm.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
::SVTK_RenderWindowInteractor(QWidget* theParent,
const char* theName):
QVTK_RenderWindowInteractor(theParent,theName),
- myEventCallbackCommand(vtkCallbackCommand::New())
+ myEventCallbackCommand(vtkCallbackCommand::New()),
+ myRenderWindow(vtkRenderWindow::New())
{
myEventCallbackCommand->Delete();
myEventCallbackCommand->SetCallback(SVTK_RenderWindowInteractor::ProcessEvents);
+ myRenderWindow->Delete();
+ GetDevice()->SetRenderWindow(getRenderWindow());
+
SetSelector(SVTK_Selector::New());
- GetSelector()->Delete();
+ mySelector->Delete();
}
SVTK_RenderWindowInteractor
::~SVTK_RenderWindowInteractor()
{}
-
-//----------------------------------------------------------------------------
-SVTK_Selector*
+vtkRenderWindow*
SVTK_RenderWindowInteractor
-::GetSelector()
-{
- return mySelector.GetPointer();
+::getRenderWindow()
+{
+ return myRenderWindow.GetPointer();
}
-void
+//----------------------------------------------------------------------------
+SVTK_Renderer*
SVTK_RenderWindowInteractor
-::SetSelector(SVTK_Selector* theSelector)
-{
- if(mySelector.GetPointer())
- mySelector->RemoveObserver(myEventCallbackCommand.GetPointer());
-
- mySelector = theSelector;
-
- if(mySelector.GetPointer())
- mySelector->AddObserver(vtkCommand::EndPickEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
+::GetRenderer()
+{
+ return myRenderer.GetPointer();
}
-
-//----------------------------------------------------------------------------
-void
+vtkRenderer*
SVTK_RenderWindowInteractor
-::ProcessEvents(vtkObject* vtkNotUsed(theObject),
- unsigned long theEvent,
- void* theClientData,
- void* vtkNotUsed(theCallData))
+::getRenderer()
{
- SVTK_RenderWindowInteractor* self = reinterpret_cast<SVTK_RenderWindowInteractor*>(theClientData);
+ return GetRenderer();
+}
- switch(theEvent){
- case vtkCommand::EndPickEvent:
- self->onEmitSelectionChanged();
- break;
- }
+void
+SVTK_RenderWindowInteractor
+::SetRenderer(SVTK_Renderer* theRenderer)
+{
+ myRenderWindow->RemoveRenderer(GetRenderer());
+ myRenderer = theRenderer;
+ myRenderWindow->AddRenderer(GetRenderer());
}
}
+//----------------------------------------------------------------------------
+SVTK_Selector*
+SVTK_RenderWindowInteractor
+::GetSelector()
+{
+ return mySelector.GetPointer();
+}
+
+
+void
+SVTK_RenderWindowInteractor
+::SetSelector(SVTK_Selector* theSelector)
+{
+ if(mySelector.GetPointer())
+ mySelector->RemoveObserver(myEventCallbackCommand.GetPointer());
+
+ mySelector = theSelector;
+
+ if(mySelector.GetPointer())
+ mySelector->AddObserver(vtkCommand::EndPickEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
+}
+
+
+//----------------------------------------------------------------------------
+void
+SVTK_RenderWindowInteractor
+::ProcessEvents(vtkObject* vtkNotUsed(theObject),
+ unsigned long theEvent,
+ void* theClientData,
+ void* vtkNotUsed(theCallData))
+{
+ SVTK_RenderWindowInteractor* self = reinterpret_cast<SVTK_RenderWindowInteractor*>(theClientData);
+
+ switch(theEvent){
+ case vtkCommand::EndPickEvent:
+ self->onEmitSelectionChanged();
+ break;
+ }
+}
+
+
//----------------------------------------------------------------
void
SVTK_RenderWindowInteractor
class SALOME_Actor;
class SVTK_Selector;
+class SVTK_Renderer;
class SVTK_InteractorStyle;
// ------------------------------------------------------------
~SVTK_RenderWindowInteractor();
- SVTK_Selector* GetSelector();
- void SetSelector(SVTK_Selector* theSelector);
+ vtkRenderWindow*
+ getRenderWindow();
+
+ //----------------------------------------------------------------------------
+ void
+ SetRenderer(SVTK_Renderer *theRenderer);
+
+ SVTK_Renderer*
+ GetRenderer();
- SVTK_InteractorStyle* GetInteractorStyle();
- void PushInteractorStyle(SVTK_InteractorStyle* theStyle);
- void PopInteractorStyle();
+ vtkRenderer*
+ getRenderer();
- Selection_Mode SelectionMode() const;
- void SetSelectionMode(Selection_Mode theMode);
+ //----------------------------------------------------------------------------
+ SVTK_InteractorStyle*
+ GetInteractorStyle();
+
+ void
+ PushInteractorStyle(SVTK_InteractorStyle* theStyle);
+
+ void
+ PopInteractorStyle();
+
+ //----------------------------------------------------------------------------
+ SVTK_Selector*
+ GetSelector();
+
+ void
+ SetSelector(SVTK_Selector* theSelector);
+
+ Selection_Mode
+ SelectionMode() const;
+
+ void
+ SetSelectionMode(Selection_Mode theMode);
public:
void
vtkSmartPointer<SVTK_Selector> mySelector;
+ vtkSmartPointer<SVTK_Renderer> myRenderer;
+ vtkSmartPointer<vtkRenderWindow> myRenderWindow;
+
typedef vtkSmartPointer<SVTK_InteractorStyle> PInteractorStyle;
QValueStack<PInteractorStyle> myInteractorStyles;
};
+
#endif
#include "SVTK_Event.h"
#include "SVTK_Renderer.h"
#include "SVTK_ViewModel.h"
-#include "SVTK_RenderWindow.h"
#include "SVTK_InteractorStyle.h"
#include "SVTK_RenderWindowInteractor.h"
createToolBar();
}
+void
+SVTK_MainWindow
+::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();
+}
+
+
//----------------------------------------------------------------------------
SVTK_MainWindow
::~SVTK_MainWindow()
return GetInteractor()->GetDevice();
}
+vtkRenderWindow*
+SVTK_MainWindow
+::getRenderWindow()
+{
+ return GetInteractor()->getRenderWindow();
+}
+
//----------------------------------------------------------------------------
void
SVTK_MainWindow
SVTK_MainWindow
::InvokeEvent(unsigned long theEvent, void* theCallData)
{
- myInteractor->InvokeEvent(theEvent,theCallData);
+ GetInteractor()->InvokeEvent(theEvent,theCallData);
}
//----------------------------------------------------------------------------
SVTK_MainWindow
::GetInteractorStyle()
{
- return myInteractor->GetInteractorStyle();
+ return GetInteractor()->GetInteractorStyle();
}
void
SVTK_MainWindow
::PushInteractorStyle(SVTK_InteractorStyle* theStyle)
{
- myInteractor->PushInteractorStyle(theStyle);
+ GetInteractor()->PushInteractorStyle(theStyle);
}
void
SVTK_MainWindow
::PopInteractorStyle()
{
- myInteractor->PopInteractorStyle();
+ GetInteractor()->PopInteractorStyle();
}
//----------------------------------------------------------------------------
SVTK_MainWindow
::GetSelector()
{
- return myInteractor->GetSelector();
+ return GetInteractor()->GetSelector();
}
void
SVTK_MainWindow
::SetSelector(SVTK_Selector* theSelector)
{
- myInteractor->SetSelector(theSelector);
+ GetInteractor()->SetSelector(theSelector);
}
Selection_Mode
//----------------------------------------------------------------------------
void
SVTK_MainWindow
-::SetRenderWindow(SVTK_RenderWindow *theRenderWindow)
-{
- myRenderWindow = theRenderWindow;
-}
-
-SVTK_RenderWindow*
-SVTK_MainWindow
-::GetRenderWindow()
+::SetRenderer(SVTK_Renderer* theRenderer)
{
- return myRenderWindow.GetPointer();
+ GetInteractor()->SetRenderer(theRenderer);
}
-vtkRenderWindow*
-SVTK_MainWindow
-::getRenderWindow()
-{
- return myRenderWindow.GetPointer();
-}
-
-
-//----------------------------------------------------------------------------
SVTK_Renderer*
SVTK_MainWindow
::GetRenderer()
{
- return GetRenderWindow()->GetRenderer();
+ return GetInteractor()->GetRenderer();
}
vtkRenderer*
SVTK_MainWindow
::getRenderer()
{
- return GetRenderWindow()->GetRenderer();
+ return GetInteractor()->getRenderer();
}
//----------------------------------------------------------------------------
SVTK_MainWindow
::dumpView()
{
- QPixmap px = QPixmap::grabWindow( winId() );
+ QPixmap px = QPixmap::grabWindow( GetInteractor()->winId() );
return px.convertToImage();
}
QObject(theMainWindow),
myMainWindow(theMainWindow)
{
- SVTK_RenderWindow* aRenderWindow = SVTK_RenderWindow::New();
- theMainWindow->SetRenderWindow(aRenderWindow);
- aRenderWindow->Delete();
-
- aRenderWindow->SetRenderer(SVTK_Renderer::New());
-
- SVTK_RenderWindowInteractor* anInteractor =
- new SVTK_RenderWindowInteractor(theMainWindow,"SVTK_RenderWindowInteractor");
- anInteractor->SetRenderWindow(aRenderWindow);
-
- theMainWindow->SetInteractor(anInteractor);
-
- anInteractor->PushInteractorStyle(SVTK_InteractorStyle::New());
+ SVTK_RenderWindowInteractor* anInteractor = theMainWindow->GetInteractor();
connect(anInteractor,SIGNAL(KeyPressed(QKeyEvent*)),
this,SIGNAL(KeyPressed(QKeyEvent*)) );
const char* theName,
SUIT_ResourceMgr* theResourceMgr);
+ virtual
+ void
+ Initialize();
+
virtual
~SVTK_MainWindow();
vtkRenderWindowInteractor*
getInteractor();
+ vtkRenderWindow*
+ getRenderWindow();
+
void
Repaint();
//----------------------------------------------------------------------------
void
- SetRenderWindow(SVTK_RenderWindow *theRenderWindow);
+ SetRenderer(SVTK_Renderer* theRenderer);
- SVTK_RenderWindow*
- GetRenderWindow();
-
- vtkRenderWindow*
- getRenderWindow();
-
- //----------------------------------------------------------------------------
SVTK_Renderer*
GetRenderer();
QToolBar* myToolBar;
SVTK_RenderWindowInteractor* myInteractor;
- vtkSmartPointer<SVTK_RenderWindow> myRenderWindow;
};
SUIT_ViewWindow(theDesktop)
{}
-//----------------------------------------------------------------------------
void
SVTK_ViewWindow
::Initialize(SVTK_ViewModelBase* theModel)
{
if(SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr()){
myMainWindow = new SVTK_MainWindow(this,"SVTK_MainWindow",aResourceMgr);
+ myMainWindow->Initialize();
+
setCentralWidget(myMainWindow);
myView = new SVTK_View(myMainWindow);
}
}
-
void
SVTK_ViewWindow
::Initialize(SVTK_View* theView,
theModel,SLOT(onSelectionChanged()));
}
-//----------------------------------------------------------------------------
SVTK_ViewWindow
::~SVTK_ViewWindow()
{}
-//----------------------------------------------------------------------------
-//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
SVTK_View*
SVTK_ViewWindow