#include "SVTK_ViewManager.h"
#include "SVTK_ViewWindow.h"
-#include "SVTK_RenderWindow.h"
-#include "SVTK_RenderWindowInteractor.h"
using namespace std;
SVTK_ViewModel.cxx \
SVTK_Renderer.cxx \
SVTK_ViewWindow.cxx \
- SVTK_RenderWindow.cxx \
+ SVTK_RenderWindow.cxx\
SVTK_InteractorStyle.cxx \
SVTK_RenderWindowInteractor.cxx \
SVTK_SpaceMouse.cxx \
LIB_MOC = SVTK_RenderWindowInteractor.h \
SVTK_InteractorStyle.h \
- SVTK_RenderWindow.h \
SVTK_View.h \
SVTK_ViewWindow.h \
SVTK_ViewModel.h \
#include "VTKViewer_Utilities.h"
#include "VTKViewer_RectPicker.h"
-#include "SVTK_RenderWindow.h"
-#include "SVTK_ViewWindow.h"
#include "SVTK_Selection.h"
#include "SVTK_Event.h"
#include "SVTK_Selector.h"
#include <vtkRendererCollection.h>
#include <qapplication.h>
+#include <qpixmap.h>
//VRV: porting on Qt 3.0.5
#if QT_VERSION >= 0x030005
#include <qpainter.h>
::eventFilter(QObject* object, QEvent* event)
{
if (!myRenderWidget) return false;
- if ( (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::KeyPress) && object != myRenderWidget)
+ if ( (event->type() == QEvent::MouseButtonPress ||
+ event->type() == QEvent::KeyPress) &&
+ object != myRenderWidget)
{
qApp->removeEventFilter(this);
startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
}
vtkInteractorStyle::ProcessEvents( object, event, clientData, callData );
}
+
+#include "SVTK_RenderWindow.h"
-#include "SVTK_RenderWindow.h"
-#include "SVTK_Trihedron.h"
-#include "SVTK_CubeAxesActor2D.h"
-#include "SALOME_Actor.h"
+// 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 "VTKViewer_Transform.h"
-#include "VTKViewer_Utilities.h"
+#include "SVTK_RenderWindow.h"
#include "SVTK_Renderer.h"
+#include "SVTK_Selector.h"
-#include "QtxAction.h"
+#include <vtkObjectFactory.h>
-#include "SUIT_Session.h"
-#include "SUIT_ToolButton.h"
-#include "SUIT_MessageBox.h"
+//----------------------------------------------------------------------------
+vtkStandardNewMacro(SVTK_RenderWindow);
-#include "SUIT_Tools.h"
-#include "SUIT_ResourceMgr.h"
-#include <vtkRenderWindow.h>
+//----------------------------------------------------------------------------
+SVTK_RenderWindow
+::SVTK_RenderWindow():
+ myRenderWidget(NULL)
+{
+}
+
+SVTK_RenderWindow
+::~SVTK_RenderWindow()
+{}
-#if QT_VERSION > 300
-#include <qcursor.h>
-#endif
//----------------------------------------------------------------------------
+SVTK_Renderer*
SVTK_RenderWindow
-::SVTK_RenderWindow(QWidget* parent, const char* name) :
- QMainWindow(parent, name,
- Qt::WStyle_NoBorder |
- Qt::WDestructiveClose |
- Qt::WResizeNoErase |
- Qt::WRepaintNoErase),
- myRenderWindow(vtkRenderWindow::New())
+::GetRenderer()
{
- myRenderWindow->Delete();
+ return myRenderer.GetPointer();
+}
-#ifndef WNT
- myRenderWindow->SetDisplayId((void*)x11Display());
-#endif
- myRenderWindow->SetWindowId((void*)winId());
- myRenderWindow->DoubleBufferOn();
- setMouseTracking(true);
+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
-::~SVTK_RenderWindow()
-{}
+::SetSelector(SVTK_Selector* theSelector)
+{
+ mySelector = theSelector;
+}
-vtkRenderWindow*
+//----------------------------------------------------------------------------
+SVTK_RenderWindow::TRenderWidget*
SVTK_RenderWindow
-::getRenderWindow()
-{
- return myRenderWindow.GetPointer();
+::GetRenderWidget()
+{
+ return myRenderWidget;
+}
+
+void
+SVTK_RenderWindow
+::GetRenderWidget(TRenderWidget* theWidget)
+{
+ myRenderWidget = theWidget;
}
#ifndef SVTK_RenderWindow_h
#define SVTK_RenderWindow_h
-#include <vtkSmartPointer.h>
+#include "SVTK.h"
-#include <qmainwindow.h>
-#include <qimage.h>
+#include <vtkSmartPointer.h>
-#include "SVTK.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();
-class vtkRenderer;
-class vtkRenderWindow;
+ SVTK_RenderWindow();
+ virtual ~SVTK_RenderWindow();
-class SVTK_EXPORT SVTK_RenderWindow : public QMainWindow
-{
- Q_OBJECT;
+ SVTK_Renderer* GetRenderer();
+ void SetRenderer(SVTK_Renderer* theRenderer);
- public:
- SVTK_RenderWindow( QWidget*, const char* );
- virtual ~SVTK_RenderWindow() ;
+ SVTK_Selector* GetSelector();
+ void SetSelector(SVTK_Selector* theSelector);
- vtkRenderWindow* getRenderWindow();
+ typedef QWidget TRenderWidget;
+ TRenderWidget* GetRenderWidget();
+ void GetRenderWidget(TRenderWidget* theWidget);
protected:
- vtkSmartPointer<vtkRenderWindow> myRenderWindow;
+ vtkSmartPointer<SVTK_Selector> mySelector;
+ vtkSmartPointer<SVTK_Renderer> myRenderer;
+ TRenderWidget* myRenderWidget;
};
+
#endif
int aWidth = aSize[0];
int aHeight = aSize[1];
- //myInteractor->SetSize(width(),height());
myInteractor->UpdateSize(width(),height());
- myInteractor->ConfigureEvent();
-
- if( aWidth != width() || aHeight != height() )
- {
- vtkRendererCollection * aRenderers = GetRenderWindow()->GetRenderers();
- aRenderers->InitTraversal();
- double aCoeff = 1.0;
- if(vtkRenderer *aRenderer = aRenderers->GetNextItem())
- {
- vtkCamera *aCamera = aRenderer->GetActiveCamera();
- double aScale = aCamera->GetParallelScale();
- if((aWidth - width())*(aHeight - height()) > 0)
- aCoeff = sqrt(double(aWidth)/double(width())*double(height())/double(aHeight));
- else
- aCoeff = double(aWidth)/double(width());
- aCamera->SetParallelScale(aScale*aCoeff);
+
+ if(true || aWidth && aHeight){
+ if( aWidth != width() || aHeight != height() ) {
+ vtkRendererCollection * aRenderers = GetRenderWindow()->GetRenderers();
+ aRenderers->InitTraversal();
+ double aCoeff = 1.0;
+ if(vtkRenderer *aRenderer = aRenderers->GetNextItem()) {
+ vtkCamera *aCamera = aRenderer->GetActiveCamera();
+ double aScale = aCamera->GetParallelScale();
+ if((aWidth - width())*(aHeight - height()) > 0)
+ aCoeff = sqrt(double(aWidth)/double(width())*double(height())/double(aHeight));
+ else
+ aCoeff = double(aWidth)/double(width());
+ aCamera->SetParallelScale(aScale*aCoeff);
+ }
}
}
#include "SVTK.h"
#include "SVTK_Selection.h"
-#include "SVTK_RenderWindow.h"
#include "SALOME_InteractiveObject.hxx"
#include <vtkGenericRenderWindowInteractor.h>
#include <qvaluestack.h>
+#include <qwidget.h>
class QTimer;
+// 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_Renderer.h"
#include "SVTK_Trihedron.h"
#ifndef VTK_IMPLEMENT_MESA_CXX
#include <vtkOpenGLRenderer.h>
-#define RENDERER_SUPERCLASS vtkOpenGLRenderer
+#define SVTK_RENDERER_SUPERCLASS vtkOpenGLRenderer
#else
#include <vtkMesaRenderer.h>
-#define RENDERER_SUPERCLASS vtkMesaRenderer
+#define SVTK_RENDERER_SUPERCLASS vtkMesaRenderer
#endif
class vtkCallbackCommand;
class SVTK_CubeAxesActor2D;
class VTKViewer_Actor;
-class SVTK_EXPORT SVTK_Renderer : public RENDERER_SUPERCLASS
+class SVTK_EXPORT SVTK_Renderer : public SVTK_RENDERER_SUPERCLASS
{
protected:
SVTK_Renderer();
void* calldata);
public:
- vtkTypeMacro(SVTK_Renderer,RENDERER_SUPERCLASS);
+ vtkTypeMacro(SVTK_Renderer,SVTK_RENDERER_SUPERCLASS);
static SVTK_Renderer* New();
VTKViewer_Trihedron* GetTrihedron();
#include "SVTK_Event.h"
#include "SVTK_Renderer.h"
#include "SVTK_ViewModel.h"
+#include "SVTK_RenderWindow.h"
#include "SVTK_InteractorStyle.h"
#include "SVTK_RenderWindowInteractor.h"
const char* theName,
SUIT_ResourceMgr* theResourceMgr) :
SVTK_ActionHolder(theParent,theName,theResourceMgr),
- myRenderWindow(vtkRenderWindow::New())
+ myRenderWindow(SVTK_RenderWindow::New())
{
myRenderWindow->Delete();
protected:
SVTK_RenderWindowInteractor* myInteractor;
- vtkSmartPointer<vtkRenderWindow> myRenderWindow;
+ vtkSmartPointer<SVTK_RenderWindow> myRenderWindow;
};