SALOME_Actor.h \
SVTK_RectPicker.h \
SVTK_DeviceActor.h \
+ SVTK_DialogBase.h \
SVTK_FontWidget.h \
SVTK_CubeAxesActor2D.h \
SVTK_Functor.h \
SVTK_Event.h \
SVTK_ViewModelBase.h
-PO_FILES = SVTK_msg_en.po
+PO_FILES = \
+ SVTK_msg_en.po \
+ SVTK_images.po
# Libraries targets
LIB = libSVTK.la
SVTK_DeviceActor.cxx \
SVTK_CubeAxesActor2D.cxx \
SVTK_NonIsometricDlg.cxx \
+ SVTK_UpdateRateDlg.cxx \
SVTK_CubeAxesDlg.cxx \
+ SVTK_DialogBase.cxx \
SVTK_FontWidget.cxx \
SVTK_Trihedron.cxx \
SVTK_MainWindow.cxx \
SVTK_GenericRenderWindowInteractor.h \
SVTK_RenderWindowInteractor.h \
SVTK_NonIsometricDlg.h \
+ SVTK_UpdateRateDlg.h \
SVTK_CubeAxesDlg.h \
SVTK_FontWidget.h \
+ SVTK_DialogBase.h \
SVTK_ViewModelBase.h \
SVTK_ViewManager.h \
SVTK_ViewWindow.h \
$(QT_INCLUDES) \
$(OCC_INCLUDES) \
$(VTK_INCLUDES) \
+ $(QWT_INCLUDES) \
$(BOOST_CPPFLAGS)
LDFLAGS+= \
$(QT_MT_LIBS) \
$(OCC_LIBS) \
+ $(QWT_LIBS) \
$(VTK_LIBS)
LIBS+= -lqtx -lsuit -lstd -lCAM -lSalomeObject -lSalomePrs -lVTKViewer
//
// See http://www.salome-platform.org/
//
-#ifdef WNT\r
-#ifdef SVTK_EXPORTS\r
-#define SVTK_EXPORT __declspec(dllexport)\r
-#else\r
-#define SVTK_EXPORT __declspec(dllimport)\r
-#endif\r
-#else\r
-#define SVTK_EXPORT\r
-#endif\r
-\r
-#if defined WNT\r
-#pragma warning ( disable: 4251 )\r
-#pragma warning ( disable: 4786 )\r
-#endif\r
+#ifndef SVTK_H
+#define SVTK_H
+
+#include "VTKViewer.h"
+
+#ifdef WNT
+# ifdef SVTK_EXPORTS
+# define SVTK_EXPORT __declspec(dllexport)
+# else
+# define SVTK_EXPORT __declspec(dllimport)
+# endif
+#else
+# define SVTK_EXPORT
+#endif
+
+#if defined WNT
+#pragma warning ( disable: 4251 )
+#pragma warning ( disable: 4786 )
+#endif
+
+#endif
// name : SVTK_CubeAxesDlg::SVTK_CubeAxesDlg
// Purpose : Constructor
//=======================================================================
-SVTK_CubeAxesDlg::SVTK_CubeAxesDlg(SVTK_MainWindow* theParent,
- const char* theName,
- QtxAction* theAction):
- QDialog(theParent,
- theName,
- false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
- myMainWindow(theParent),
- myAction(theAction)
+SVTK_CubeAxesDlg::SVTK_CubeAxesDlg(QtxAction* theAction,
+ SVTK_MainWindow* theParent,
+ const char* theName):
+ SVTK_DialogBase(theAction,
+ theParent,
+ theName),
+ myMainWindow(theParent)
{
setCaption(tr("CAPTION"));
QVBoxLayout* aLay = new QVBoxLayout(this, 5, 5);
aLay->addWidget(createMainFrame(this));
aLay->addWidget(createButtonFrame(this));
+
+ connect(theParent, SIGNAL(Show( QShowEvent * )), this, SLOT(onParentShow()));
+ connect(theParent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide()));
}
//=======================================================================
void SVTK_CubeAxesDlg::onClose()
{
reject();
-
- myAction->setOn( false );
-}
-
-void SVTK_CubeAxesDlg::done( int r )
-{
- myAction->setOn( false );
- QDialog::done( r );
}
#ifndef SVTK_CubeAxesDlg_H
#define SVTK_CubeAxesDlg_H
-#include <qdialog.h>
+#include "SVTK_DialogBase.h"
+
#include <qframe.h>
class QWidget;
* Class : SVTK_CubeAxesDlg
* Description : Dialog for specifynig cube axes properties
*/
-class SVTK_CubeAxesDlg : public QDialog
+class SVTK_CubeAxesDlg : public SVTK_DialogBase
{
Q_OBJECT
public:
- SVTK_CubeAxesDlg(SVTK_MainWindow* theParent,
- const char* theName,
- QtxAction* theAction);
+ SVTK_CubeAxesDlg(QtxAction* theAction,
+ SVTK_MainWindow* theParent,
+ const char* theName);
virtual ~SVTK_CubeAxesDlg();
void Update();
bool onApply();
void onClose();
- virtual void done( int );
-
private:
QWidget* createButtonFrame( QWidget* );
QWidget* createMainFrame ( QWidget* );
private:
SVTK_MainWindow *myMainWindow;
SVTK_CubeAxesActor2D* myActor;
- QtxAction* myAction;
QTabWidget* myTabWg;
QCheckBox* myIsVisible;
--- /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 : SALOME
+// $Header$
+
+#include "SVTK_DialogBase.h"
+
+#include "QtxAction.h"
+
+/*!
+ Constructor
+*/
+SVTK_DialogBase
+::SVTK_DialogBase(QtxAction* theAction,
+ QWidget* theParent,
+ const char* theName,
+ bool theModal,
+ WFlags theWFalgs):
+ QDialog(theParent,
+ theName,
+ theModal,
+ theWFalgs | WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+ myAction(theAction)
+{
+ connect(theParent, SIGNAL(Show( QShowEvent * )), this, SLOT(onParentShow()));
+ connect(theParent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide()));
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+SVTK_DialogBase
+::~SVTK_DialogBase()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+void
+SVTK_DialogBase
+::onParentShow()
+{
+ if(myAction->isOn())
+ show();
+ else
+ hide();
+}
+
+void
+SVTK_DialogBase
+::onParentHide()
+{
+ hide();
+}
+
+void
+SVTK_DialogBase
+::done( int r )
+{
+ myAction->setOn( false );
+ QDialog::done( r );
+}
--- /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 : SALOME
+// $Header$
+
+#ifndef SVTK_DIALOGBASE_H
+#define SVTK_DIALOGBASE_H
+
+#include "SVTK.h"
+
+#include <qdialog.h>
+
+class QtxAction;
+
+class SVTK_EXPORT SVTK_DialogBase : public QDialog
+{
+ Q_OBJECT;
+
+public:
+ SVTK_DialogBase(QtxAction* theAction,
+ QWidget* theParent,
+ const char* theName = "",
+ bool theModal = FALSE,
+ WFlags theWFalgs = 0);
+
+ ~SVTK_DialogBase();
+
+protected slots:
+ void onParentShow();
+ void onParentHide();
+ virtual void done( int );
+
+protected:
+ QtxAction* myAction;
+};
+
+#endif // SVTK_DIALOGBASE_H
SVTK_InteractorStyle
::onStartOperation()
{
- if (!GetRenderWidget()) return;
- // VSV: LOD actor activisation
- // this->Interactor->GetRenderWindow()->SetDesiredUpdateRate(this->Interactor->GetDesiredUpdateRate());
+ if (!GetRenderWidget())
+ return;
+
+ vtkRenderWindowInteractor *aRWI = this->Interactor;
+ vtkRenderWindow *aRenWin = aRWI->GetRenderWindow();
+ aRenWin->SetDesiredUpdateRate(aRWI->GetDesiredUpdateRate());
+
switch (State) {
case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
case VTK_INTERACTOR_STYLE_CAMERA_FIT:
if (!GetRenderWidget())
return;
- // VSV: LOD actor activisation
- // rwi->GetRenderWindow()->SetDesiredUpdateRate(rwi->GetStillUpdateRate());
+ vtkRenderWindowInteractor *aRWI = this->Interactor;
+ vtkRenderWindow *aRenWin = aRWI->GetRenderWindow();
+ aRenWin->SetDesiredUpdateRate(aRWI->GetStillUpdateRate());
SVTK_SelectionEvent* aSelectionEvent = GetSelectionEventFlipY();
#include "SUIT_Tools.h"
#include "SUIT_ResourceMgr.h"
#include "SVTK_NonIsometricDlg.h"
+#include "SVTK_UpdateRateDlg.h"
#include "SVTK_CubeAxesDlg.h"
#include "SVTK_MainWindow.h"
myInteractor->setFocusPolicy(StrongFocus);
myInteractor->setFocus();
setFocusProxy(myInteractor);
+
+ myUpdateRateDlg = new SVTK_UpdateRateDlg(myActionsMap[UpdateRate],this,"SVTK_UpdateRateDlg");
+ myNonIsometricDlg = new SVTK_NonIsometricDlg(myActionsMap[NonIsometric],this,"SVTK_NonIsometricDlg");
+ myCubeAxesDlg = new SVTK_CubeAxesDlg(myActionsMap[GraduatedAxes],this,"SVTK_CubeAxesDlg");
}
connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onNonIsometric(bool)));
myActionsMap[ NonIsometric ] = anAction;
- myNonIsometricDlg = new SVTK_NonIsometricDlg(this,"SVTK_NonIsometricDlg",anAction);
-
// onGraduatedAxes: Manage graduated axes params
anAction = new QtxAction(tr("MNU_SVTK_GRADUATED_AXES"),
theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_GRADUATED_AXES" ) ),
connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onGraduatedAxes(bool)));
myActionsMap[ GraduatedAxes ] = anAction;
- myCubeAxesDlg = new SVTK_CubeAxesDlg(this,"SVTK_CubeAxesDlg",anAction);
+ // onGraduatedAxes: Manage graduated axes params
+ anAction = new QtxAction(tr("MNU_SVTK_UPDATE_RATE"),
+ theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_UPDATE_RATE" ) ),
+ tr( "MNU_SVTK_UPDATE_RATE" ), 0, this);
+ anAction->setStatusTip(tr("DSC_SVTK_UPDATE_RATE"));
+ anAction->setToggleAction(true);
+ connect(anAction, SIGNAL(toggled(bool)), this, SLOT(onUpdateRate(bool)));
+ myActionsMap[ UpdateRate ] = anAction;
}
#if defined(WIN32) && !defined(_DEBUG)
myActionsMap[ResetId]->addTo(myToolBar);
+ myActionsMap[UpdateRate]->addTo(myToolBar);
myActionsMap[NonIsometric]->addTo(myToolBar);
myActionsMap[GraduatedAxes]->addTo(myToolBar);
}
+//----------------------------------------------------------------------------
+void
+SVTK_MainWindow
+::showEvent( QShowEvent * theEvent )
+{
+ emit Show( theEvent );
+}
+
+void
+SVTK_MainWindow
+::hideEvent( QHideEvent * theEvent )
+{
+ emit Hide( theEvent );
+}
+
+
//----------------------------------------------------------------------------
void
SVTK_MainWindow
}
//----------------------------------------------------------------------------
+void
+SVTK_MainWindow
+::onUpdateRate(bool theIsActivate)
+{
+ if(theIsActivate){
+ myUpdateRateDlg->Update();
+ myUpdateRateDlg->show();
+ }else
+ myUpdateRateDlg->hide();
+}
+
void
SVTK_MainWindow
::onNonIsometric(bool theIsActivate)
class SVTK_RenderWindowInteractor;
class SVTK_NonIsometricDlg;
+class SVTK_UpdateRateDlg;
class SVTK_CubeAxesActor2D;
class SVTK_CubeAxesDlg;
//----------------------------------------------------------------------------
QToolBar* getToolBar();
+ signals:
+ void Show( QShowEvent * );
+ void Hide( QHideEvent * );
+
public slots:
+ virtual void showEvent( QShowEvent * );
+ virtual void hideEvent( QHideEvent * );
+
void activateZoom();
void activateWindowFit();
void activateRotation();
void onViewTrihedron();
void onViewCubeAxes();
+ void onUpdateRate(bool theIsActivate);
void onNonIsometric(bool theIsActivate);
void onGraduatedAxes(bool theIsActivate);
enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, RotationId,
FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId,
- ViewTrihedronId, NonIsometric, GraduatedAxes};
+ ViewTrihedronId, NonIsometric, GraduatedAxes, UpdateRate};
typedef QMap<int, QtxAction*> TActionsMap;
SUIT_ViewWindow* myViewWindow;
SVTK_NonIsometricDlg* myNonIsometricDlg;
+ SVTK_UpdateRateDlg* myUpdateRateDlg;
SVTK_CubeAxesDlg* myCubeAxesDlg;
vtkSmartPointer<vtkObject> myEventDispatcher;
Constructor
*/
SVTK_NonIsometricDlg
-::SVTK_NonIsometricDlg(SVTK_MainWindow* theParent,
- const char* theName,
- QtxAction* theAction):
- QDialog(theParent,
- theName,
- false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
- m_MainWindow(theParent),
- m_Action(theAction)
+::SVTK_NonIsometricDlg(QtxAction* theAction,
+ SVTK_MainWindow* theParent,
+ const char* theName):
+ SVTK_DialogBase(theAction,
+ theParent,
+ theName),
+ m_MainWindow(theParent)
{
setCaption(tr("DLG_TITLE"));
setSizeGripEnabled(TRUE);
::onClickClose()
{
reject();
-
- m_Action->setOn( false );
-}
-
-void
-SVTK_NonIsometricDlg
-::done( int r )
-{
- m_Action->setOn( false );
- QDialog::done( r );
}
#ifndef SVTK_NONISOMETRICDLG_H
#define SVTK_NONISOMETRICDLG_H
-#include <qdialog.h>
+#include "SVTK_DialogBase.h"
class SVTK_MainWindow;
class QPushButton;
-class SVTK_NonIsometricDlg : public QDialog
+class SVTK_NonIsometricDlg : public SVTK_DialogBase
{
Q_OBJECT;
public:
- SVTK_NonIsometricDlg(SVTK_MainWindow* theParent,
- const char* theName,
- QtxAction* theAction);
+ SVTK_NonIsometricDlg(QtxAction* theAction,
+ SVTK_MainWindow* theParent,
+ const char* theName);
~SVTK_NonIsometricDlg();
protected:
SVTK_MainWindow *m_MainWindow;
- QtxAction* m_Action;
QtxDblSpinBox* m_sbXcoeff;
QtxDblSpinBox* m_sbYcoeff;
void onClickReset();
void onClickOk();
void onClickClose();
-
- virtual void done( int );
};
#endif // SVTK_NONISOMETRICDLG_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 : SALOME
+// $Header$
+
+#include "SVTK_UpdateRateDlg.h"
+
+#include "SVTK_MainWindow.h"
+#include "SVTK_RenderWindowInteractor.h"
+#include "VTKViewer_Algorithm.h"
+#include "SALOME_Actor.h"
+
+#include "QtxDblSpinBox.h"
+#include "QtxAction.h"
+
+#include <sstream>
+
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+
+#include <vtkGenericRenderWindowInteractor.h>
+#include <vtkCallbackCommand.h>
+#include <vtkRenderWindow.h>
+#include <vtkRenderer.h>
+#include <vtkMapper.h>
+#include <vtkDataSet.h>
+
+static vtkFloatingPointType OFF_UPDATE_RATE = 0.00001;
+static vtkFloatingPointType FLOAT_TOLERANCE = 1.0 / VTK_LARGE_FLOAT;
+
+using namespace std;
+
+namespace
+{
+ //----------------------------------------------------------------------------
+ inline
+ QString
+ GetUpdateRate(SVTK_RenderWindowInteractor* theRWInteractor)
+ {
+ if(vtkRenderer *aRenderer = theRWInteractor->getRenderer()){
+ vtkFloatingPointType aLastRenderTimeInSeconds = aRenderer->GetLastRenderTimeInSeconds();
+ if(aLastRenderTimeInSeconds > FLOAT_TOLERANCE){
+ std::ostringstream aStr;
+ vtkFloatingPointType aFPS = 1.0 / aLastRenderTimeInSeconds;
+ aStr<<aFPS;
+ return QString(aStr.str().c_str());
+ }
+ }
+ return "Inf";
+ }
+
+
+ //----------------------------------------------------------------------------
+ struct TRenderTimeMultiplier
+ {
+ vtkFloatingPointType myVTKMultiplier;
+ vtkFloatingPointType mySALOMEMultiplier;
+
+ TRenderTimeMultiplier():
+ myVTKMultiplier(0.0),
+ mySALOMEMultiplier(0.0)
+ {}
+
+ void
+ operator()(vtkActor* theActor)
+ {
+ if(theActor->GetVisibility()){
+ myVTKMultiplier += theActor->GetAllocatedRenderTime();
+ if(dynamic_cast<SALOME_Actor*>(theActor))
+ mySALOMEMultiplier += theActor->GetAllocatedRenderTime();
+ }
+ }
+ };
+
+
+ //----------------------------------------------------------------------------
+ inline
+ vtkFloatingPointType
+ AdjustUpdateRate(SVTK_RenderWindowInteractor* theRWInteractor,
+ vtkFloatingPointType theUpdateRate)
+ {
+ if(vtkRenderer *aRenderer = theRWInteractor->getRenderer()){
+ if(vtkActorCollection *anActorCollection = aRenderer->GetActors()){
+ TRenderTimeMultiplier aMultiplier;
+ using namespace VTK;
+ aMultiplier = ForEach<vtkActor>(anActorCollection,
+ aMultiplier);
+ if(aMultiplier.mySALOMEMultiplier > FLOAT_TOLERANCE)
+ theUpdateRate *= aMultiplier.mySALOMEMultiplier / aMultiplier.myVTKMultiplier;
+ }
+ }
+ return theUpdateRate;
+ }
+
+
+ //----------------------------------------------------------------------------
+ struct TCellsCounter
+ {
+ vtkIdType myCounter;
+ TCellsCounter():
+ myCounter(0)
+ {}
+
+ void
+ operator()(SALOME_Actor* theActor)
+ {
+ if(theActor->GetVisibility()){
+ if(vtkMapper *aMapper = theActor->GetMapper()){
+ if(vtkDataSet *aDataSet = aMapper->GetInput()){
+ myCounter += aDataSet->GetNumberOfCells();
+ }
+ }
+ }
+ }
+ };
+
+
+ //----------------------------------------------------------------------------
+ inline
+ QString
+ GetNumberOfCells(SVTK_RenderWindowInteractor* theRWInteractor)
+ {
+ if(vtkRenderer *aRenderer = theRWInteractor->getRenderer()){
+ if(vtkActorCollection *anActorCollection = aRenderer->GetActors()){
+ TCellsCounter aCounter;
+ using namespace VTK;
+ aCounter = ForEach<SALOME_Actor>(anActorCollection,
+ aCounter);
+ return QString::number(aCounter.myCounter);
+ }
+ }
+
+ return QString::number(0);
+ }
+}
+
+/*!
+ Constructor
+*/
+SVTK_UpdateRateDlg
+::SVTK_UpdateRateDlg(QtxAction* theAction,
+ SVTK_MainWindow* theParent,
+ const char* theName):
+ SVTK_DialogBase(theAction,
+ theParent,
+ theName),
+ myPriority(0.0),
+ myEventCallbackCommand(vtkCallbackCommand::New()),
+ myRWInteractor(theParent->GetInteractor()),
+ myAction(theAction)
+{
+ vtkRenderWindowInteractor* aRWI = myRWInteractor->GetDevice();
+ bool anIsEnabledUpdateRate = false;
+
+ setCaption(tr("DLG_TITLE"));
+ QVBoxLayout* aVBoxLayout = new QVBoxLayout(this, 5, 5);
+ {
+ QGroupBox* aGroupBox = new QGroupBox(tr("INPUT_FRAME_TITLE"), this);
+ aGroupBox->setColumnLayout(0, Qt::Vertical );
+ aGroupBox->layout()->setSpacing( 6 );
+ aGroupBox->layout()->setMargin( 11 );
+
+ aGroupBox->setCheckable(true);
+ aGroupBox->setChecked(anIsEnabledUpdateRate);
+ myIsEnableUpdateRateGroupBox = aGroupBox;
+
+ QGridLayout* aGridLayout = new QGridLayout(aGroupBox->layout());
+ {
+ QLabel* aLabel = new QLabel(tr("DESIRED"), aGroupBox);
+ aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+ aGridLayout->addWidget(aLabel, 0, 0);
+
+ QtxDblSpinBox* aDblSpinBox = new QtxDblSpinBox(OFF_UPDATE_RATE, VTK_LARGE_FLOAT, 2, aGroupBox);
+ aDblSpinBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ aGridLayout->addWidget(aDblSpinBox, 0, 1);
+
+ aDblSpinBox->setValue(aRWI->GetDesiredUpdateRate());
+ aDblSpinBox->setEnabled(anIsEnabledUpdateRate);
+ connect(aGroupBox, SIGNAL(toggled(bool)), aDblSpinBox, SLOT(setEnabled(bool)));
+ myDesiredUpdateRateSblSpinBox = aDblSpinBox;
+ }
+ {
+ QLabel* aLabel = new QLabel(tr("STILL"), aGroupBox);
+ aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+ aGridLayout->addWidget(aLabel, 1, 0);
+
+ QtxDblSpinBox* aDblSpinBox = new QtxDblSpinBox(OFF_UPDATE_RATE, VTK_LARGE_FLOAT, 2, aGroupBox);
+ aDblSpinBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ aGridLayout->addWidget(aDblSpinBox, 1, 1);
+
+ aDblSpinBox->setValue(aRWI->GetStillUpdateRate());
+ aDblSpinBox->setEnabled(anIsEnabledUpdateRate);
+ connect(aGroupBox, SIGNAL(toggled(bool)), aDblSpinBox, SLOT(setEnabled(bool)));
+ myStillUpdateRateSblSpinBox = aDblSpinBox;
+ }
+ aVBoxLayout->addWidget(aGroupBox);
+ }
+ {
+ QGroupBox* aGroupBox = new QGroupBox(tr("INFORMATION_FRAME_TITLE"), this);
+ aGroupBox->setColumnLayout(0, Qt::Vertical );
+ aGroupBox->layout()->setSpacing( 6 );
+ aGroupBox->layout()->setMargin( 11 );
+
+ QGridLayout* aGridLayout = new QGridLayout(aGroupBox->layout());
+ {
+ QLabel* aLabel = new QLabel(tr("CURRENT_FPS"), aGroupBox);
+ aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+ aGridLayout->addWidget(aLabel, 0, 0);
+
+ QLineEdit* aLineEdit = new QLineEdit( aGroupBox );
+ aLineEdit->setReadOnly( TRUE );
+ aGridLayout->addWidget(aLineEdit, 0, 1);
+
+ myCurrentUpdateRateLineEdit = aLineEdit;
+ myCurrentUpdateRateLineEdit->setText( GetUpdateRate(myRWInteractor) );
+ }
+ {
+ QLabel* aLabel = new QLabel(tr("NUMBER_CELLS"), aGroupBox);
+ aLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
+ aGridLayout->addWidget(aLabel, 1, 0);
+
+ QLineEdit* aLineEdit = new QLineEdit( aGroupBox );
+ aLineEdit->setReadOnly( TRUE );
+ aGridLayout->addWidget(aLineEdit, 1, 1);
+
+ myNumberOfCellsLineEdit = aLineEdit;
+ myNumberOfCellsLineEdit->setText( GetNumberOfCells(myRWInteractor) );
+ }
+ aVBoxLayout->addWidget(aGroupBox);
+ }
+ {
+ QGroupBox* aGroupBox = new QGroupBox(this);
+ QHBoxLayout* aHBoxLayout = new QHBoxLayout(aGroupBox);
+ aHBoxLayout->setMargin(11);
+ aHBoxLayout->setSpacing(6);
+ {
+ QPushButton* aPushButton = new QPushButton(tr("OK"), aGroupBox);
+ aPushButton->setDefault(TRUE);
+ aPushButton->setAutoDefault(TRUE);
+ aHBoxLayout->addWidget(aPushButton);
+ connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickOk()));
+ }
+ {
+ QPushButton* aPushButton = new QPushButton(tr("Apply"), aGroupBox);
+ aPushButton->setDefault(TRUE);
+ aPushButton->setAutoDefault(TRUE);
+ aHBoxLayout->addWidget(aPushButton);
+ connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickApply()));
+ }
+ aHBoxLayout->addStretch();
+ {
+ QPushButton* aPushButton = new QPushButton(tr("Close"), aGroupBox);
+ aPushButton->setDefault(TRUE);
+ aPushButton->setAutoDefault(TRUE);
+ aHBoxLayout->addWidget(aPushButton);
+ connect(aPushButton, SIGNAL(clicked()), this, SLOT(onClickClose()));
+ }
+ aVBoxLayout->addWidget(aGroupBox);
+ }
+
+ if(!anIsEnabledUpdateRate){
+ aRWI->SetDesiredUpdateRate(OFF_UPDATE_RATE);
+ aRWI->SetStillUpdateRate(OFF_UPDATE_RATE);
+ }
+
+ myEventCallbackCommand->Delete();
+ myEventCallbackCommand->SetClientData(this);
+ myEventCallbackCommand->SetCallback(SVTK_UpdateRateDlg::ProcessEvents);
+ vtkRenderer *aRenderer = myRWInteractor->getRenderer();
+ aRenderer->AddObserver(vtkCommand::EndEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+SVTK_UpdateRateDlg
+::~SVTK_UpdateRateDlg()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+void
+SVTK_UpdateRateDlg
+::ProcessEvents(vtkObject* vtkNotUsed(theObject),
+ unsigned long theEvent,
+ void* theClientData,
+ void* vtkNotUsed(theCallData))
+{
+ SVTK_UpdateRateDlg* self = reinterpret_cast<SVTK_UpdateRateDlg*>(theClientData);
+
+ if(theEvent == vtkCommand::EndEvent){
+ self->myCurrentUpdateRateLineEdit->setText( GetUpdateRate(self->myRWInteractor) );
+ self->myNumberOfCellsLineEdit->setText( GetNumberOfCells(self->myRWInteractor) );
+ }
+}
+
+void
+SVTK_UpdateRateDlg
+::Update()
+{
+ vtkRenderWindowInteractor* aRWI = myRWInteractor->GetDevice();
+
+ vtkFloatingPointType anUpdateRate;
+ if(myIsEnableUpdateRateGroupBox->isChecked()){
+ anUpdateRate = AdjustUpdateRate(myRWInteractor,myDesiredUpdateRateSblSpinBox->value());
+ aRWI->SetDesiredUpdateRate(anUpdateRate);
+ anUpdateRate = AdjustUpdateRate(myRWInteractor,myStillUpdateRateSblSpinBox->value());
+ aRWI->SetStillUpdateRate(anUpdateRate);
+ }else{
+ aRWI->SetDesiredUpdateRate(OFF_UPDATE_RATE);
+ aRWI->SetStillUpdateRate(OFF_UPDATE_RATE);
+ }
+
+ myRWInteractor->getRenderWindow()->Render();
+}
+
+void
+SVTK_UpdateRateDlg
+::onClickOk()
+{
+ Update();
+ onClickClose();
+}
+
+void
+SVTK_UpdateRateDlg
+::onClickApply()
+{
+ Update();
+}
+
+void
+SVTK_UpdateRateDlg
+::onClickClose()
+{
+ reject();
+}
--- /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 : SALOME
+// $Header$
+
+#ifndef SVTK_UPDATERATEDLG_H
+#define SVTK_UPDATERATEDLG_H
+
+#include "SVTK_DialogBase.h"
+
+#include <vtkSmartPointer.h>
+
+class SVTK_MainWindow;
+class SVTK_RenderWindowInteractor;
+
+class QtxDblSpinBox;
+class QtxAction;
+
+class QGroupBox;
+class QLineEdit;
+
+class vtkCallbackCommand;
+class vtkObject;
+
+
+class SVTK_UpdateRateDlg : public SVTK_DialogBase
+{
+ Q_OBJECT;
+
+public:
+ SVTK_UpdateRateDlg(QtxAction* theAction,
+ SVTK_MainWindow* theParent,
+ const char* theName);
+
+ ~SVTK_UpdateRateDlg();
+
+ void Update();
+
+protected:
+ SVTK_RenderWindowInteractor* myRWInteractor;
+ QtxDblSpinBox* myDesiredUpdateRateSblSpinBox;
+ QtxDblSpinBox* myStillUpdateRateSblSpinBox;
+ QGroupBox* myIsEnableUpdateRateGroupBox;
+
+ QLineEdit* myCurrentUpdateRateLineEdit;
+ QLineEdit* myNumberOfCellsLineEdit;
+
+ QtxAction* myAction;
+
+ //----------------------------------------------------------------------------
+ // Priority at which events are processed
+ vtkFloatingPointType myPriority;
+
+ // Used to process events
+ vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
+
+ // Description:
+ // Main process event method
+ static void ProcessEvents(vtkObject* object,
+ unsigned long event,
+ void* clientdata,
+ void* calldata);
+
+protected slots:
+ void onClickOk();
+ void onClickApply();
+ void onClickClose();
+};
+
+#endif // SVTK_UPDATERATEDLG_H
--- /dev/null
+# VISU VISUGUI : GUI of VISU component
+#
+# 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 :
+# Module :
+
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
+"PO-Revision-Date: 2005-05-10 15:20+0400\n"
+"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
+"Content-Type: text/plain; charset=iso-8859-1\n"
+
+
+msgid "ICON_SVTK_SCALING"
+msgstr "view_scaling.png"
+
+msgid "ICON_GRADUATED_AXES"
+msgstr "view_graduated_axes.png"
+
+msgid "ICON_UPDATE_RATE"
+msgstr "view_update_rate.png"
msgid "DSC_SHOW_TRIHEDRON"
msgstr "Show/Hide trihedron in the current view"
+
+msgid "SVTK_NonIsometricDlg::MEN_SCALING"
+msgstr "Scaling"
+
+msgid "SVTK_NonIsometricDlg::O&K"
+msgstr ""
+
+msgid "SVTK_NonIsometricDlg::&Apply"
+msgstr ""
+
+msgid "SVTK_NonIsometricDlg::&Cancel"
+msgstr ""
+
+msgid "SVTK_NonIsometricDlg::&Reset"
+msgstr ""
+
+msgid "SVTK_NonIsometricDlg::DLG_TITLE"
+msgstr "Scaling"
+
+msgid "SVTK_NonIsometricDlg::LBL_X"
+msgstr "X :"
+
+msgid "SVTK_NonIsometricDlg::LBL_Y"
+msgstr "Y :"
+
+msgid "SVTK_NonIsometricDlg::LBL_Z"
+msgstr "Z :"
+
+msgid "SVTK_MainWindow::MNU_SVTK_SCALING"
+msgstr "Scaling"
+
+msgid "SVTK_MainWindow::DSC_SVTK_SCALING"
+msgstr "Scaling"
+
+msgid "SVTK_FontWidget::ARIAL"
+msgstr "Arial"
+
+msgid "SVTK_FontWidget::COURIER"
+msgstr "Courier"
+
+msgid "SVTK_FontWidget::TIMES"
+msgstr "Times"
+
+msgid "SVTK_FontWidget::BOLD"
+msgstr "Bold"
+
+msgid "SVTK_FontWidget::ITALIC"
+msgstr "Italic"
+
+msgid "SVTK_FontWidget::SHADOW"
+msgstr "Shadow"
+
+msgid "SVTK_CubeAxesDlg::CAPTION"
+msgstr "Graduated axes"
+
+msgid "SVTK_CubeAxesDlg::X_AXIS"
+msgstr "X axis"
+
+msgid "SVTK_CubeAxesDlg::Y_AXIS"
+msgstr "Y axis"
+
+msgid "SVTK_CubeAxesDlg::Z_AXIS"
+msgstr "Z axis"
+
+msgid "SVTK_CubeAxesDlg::IS_VISIBLE"
+msgstr "Is visible"
+
+msgid "SVTK_AxisWidget::AXIS_NAME"
+msgstr "Axis name"
+
+msgid "SVTK_AxisWidget::IS_VISIBLE"
+msgstr "Is visible"
+
+msgid "SVTK_AxisWidget::NAME"
+msgstr "Name"
+
+msgid "SVTK_AxisWidget::FONT"
+msgstr "Font"
+
+msgid "SVTK_AxisWidget::LABELS"
+msgstr "Labels"
+
+msgid "SVTK_AxisWidget::NUMBER"
+msgstr "Number"
+
+msgid "SVTK_AxisWidget::OFFSET"
+msgstr "Offset"
+
+msgid "SVTK_AxisWidget::TICK_MARKS"
+msgstr "Tick marks"
+
+msgid "SVTK_AxisWidget::LENGTH"
+msgstr "Length"
+
+msgid "SVTK_MainWindow::MNU_SVTK_GRADUATED_AXES"
+msgstr "Graduated axes"
+
+msgid "SVTK_MainWindow::DSC_SVTK_GRADUATED_AXES"
+msgstr "Graduated axes"
+
+msgid "SVTK_MainWindow::MNU_SVTK_UPDATE_RATE"
+msgstr "Update rate"
+
+msgid "SVTK_MainWindow::DSC_SVTK_UPDATE_RATE"
+msgstr "Update rate"
+
+msgid "SVTK_UpdateRateDlg::DLG_TITLE"
+msgstr "Update Rate"
+
+msgid "SVTK_UpdateRateDlg::INPUT_FRAME_TITLE"
+msgstr "Enable"
+
+msgid "SVTK_UpdateRateDlg::DESIRED"
+msgstr "Desired Update Rate, FPS"
+
+msgid "SVTK_UpdateRateDlg::STILL"
+msgstr "Still Update Rate, FPS"
+
+msgid "SVTK_UpdateRateDlg::INFORMATION_FRAME_TITLE"
+msgstr "Rendering Metrics"
+
+msgid "SVTK_UpdateRateDlg::CURRENT_FPS"
+msgstr "Current Update Rate, FPS"
+
+msgid "SVTK_UpdateRateDlg::NUMBER_CELLS"
+msgstr "Number of Cells, -"
+
PO_FILES = \
VTKViewer_images.po \
- VTKViewer_msg_en.po \
- VTKViewerM_images.po \
- VTKViewerM_msg_en.po
-
+ VTKViewer_msg_en.po
+
# Libraries targets
LIB = libVTKViewer.la
VTKViewer_Actor
::Render(vtkRenderer *ren, vtkMapper* m)
{
+ static vtkFloatingPointType PERCENTS_OF_DETAILS = 0.50;
+ SetNumberOfCloudPoints(vtkIdType(GetInput()->GetNumberOfPoints()*PERCENTS_OF_DETAILS));
+
if(myIsResolveCoincidentTopology){
int aResolveCoincidentTopology = vtkMapper::GetResolveCoincidentTopology();
vtkFloatingPointType aFactor, aUnit;
+++ /dev/null
-# VISU VISUGUI : GUI of VISU component
-#
-# 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 :
-# Module :
-
-msgid ""
-msgstr ""
-"Project-Id-Version: PROJECT VERSION\n"
-"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
-"PO-Revision-Date: 2005-05-10 15:20+0400\n"
-"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-
-
-msgid "ICON_SVTK_SCALING"
-msgstr "view_scaling.png"
-
-msgid "ICON_GRADUATED_AXES"
-msgstr "view_graduated_axes.png"
+++ /dev/null
-msgid ""
-msgstr ""
-"Project-Id-Version: PROJECT VERSION\n"
-"POT-Creation-Date: 2002-02-22 16:56:46 CET\n"
-"PO-Revision-Date: 2005-06-27 12:38+0400\n"
-"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-
-#: SVTK_NonIsometricDlg.cxx
-
-msgid "SVTK_NonIsometricDlg::MEN_SCALING"
-msgstr "Scaling"
-
-msgid "SVTK_NonIsometricDlg::O&K"
-msgstr ""
-
-msgid "SVTK_NonIsometricDlg::&Apply"
-msgstr ""
-
-msgid "SVTK_NonIsometricDlg::&Cancel"
-msgstr ""
-
-msgid "SVTK_NonIsometricDlg::&Reset"
-msgstr ""
-
-msgid "SVTK_NonIsometricDlg::DLG_TITLE"
-msgstr "Scaling"
-
-msgid "SVTK_NonIsometricDlg::LBL_X"
-msgstr "X :"
-
-msgid "SVTK_NonIsometricDlg::LBL_Y"
-msgstr "Y :"
-
-msgid "SVTK_NonIsometricDlg::LBL_Z"
-msgstr "Z :"
-
-msgid "SVTK_MainWindow::MNU_SVTK_SCALING"
-msgstr "Scaling"
-
-msgid "SVTK_MainWindow::DSC_SVTK_SCALING"
-msgstr "Scaling"
-
-msgid "SVTK_FontWidget::ARIAL"
-msgstr "Arial"
-
-msgid "SVTK_FontWidget::COURIER"
-msgstr "Courier"
-
-msgid "SVTK_FontWidget::TIMES"
-msgstr "Times"
-
-msgid "SVTK_FontWidget::BOLD"
-msgstr "Bold"
-
-msgid "SVTK_FontWidget::ITALIC"
-msgstr "Italic"
-
-msgid "SVTK_FontWidget::SHADOW"
-msgstr "Shadow"
-
-msgid "SVTK_CubeAxesDlg::CAPTION"
-msgstr "Graduated axes"
-
-msgid "SVTK_CubeAxesDlg::X_AXIS"
-msgstr "X axis"
-
-msgid "SVTK_CubeAxesDlg::Y_AXIS"
-msgstr "Y axis"
-
-msgid "SVTK_CubeAxesDlg::Z_AXIS"
-msgstr "Z axis"
-
-msgid "SVTK_CubeAxesDlg::IS_VISIBLE"
-msgstr "Is visible"
-
-msgid "SVTK_AxisWidget::AXIS_NAME"
-msgstr "Axis name"
-
-msgid "SVTK_AxisWidget::IS_VISIBLE"
-msgstr "Is visible"
-
-msgid "SVTK_AxisWidget::NAME"
-msgstr "Name"
-
-msgid "SVTK_AxisWidget::FONT"
-msgstr "Font"
-
-msgid "SVTK_AxisWidget::LABELS"
-msgstr "Labels"
-
-msgid "SVTK_AxisWidget::NUMBER"
-msgstr "Number"
-
-msgid "SVTK_AxisWidget::OFFSET"
-msgstr "Offset"
-
-msgid "SVTK_AxisWidget::TICK_MARKS"
-msgstr "Tick marks"
-
-msgid "SVTK_AxisWidget::LENGTH"
-msgstr "Length"
-
-msgid "SVTK_MainWindow::MNU_SVTK_GRADUATED_AXES"
-msgstr "Graduated axes"
-
-msgid "SVTK_MainWindow::DSC_SVTK_GRADUATED_AXES"
-msgstr "Graduated axes"
\ No newline at end of file