# VSR: this is the original packages list
# SUBDIRS += VTKViewer
# VSR: already migrated to Qt4 packages
- SUBDIRS +=
+ SUBDIRS += VTKViewer
if ENABLE_SALOMEOBJECT
# VSR: this is the original packages list
# SUBDIRS += SVTK
--- /dev/null
+TEMPLATE = lib
+TARGET = VTKViewer
+DESTDIR = ../../lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../obj/$$TARGET
+
+VTKHOME = $$(VTKHOME)
+VTK_INCLUDES = $${VTKHOME}/include/vtk
+
+VTK_LIBS = -L$${VTKHOME}/lib/vtk -L$${VTKHOME}/lib/vtk/python -lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid -lvtkParallel -lvtkWidgets -lGL -L/usr/X11R6/lib -lGLU -L/usr/X11R6/lib -lX11 -lXt
+
+CASROOT = $$(CASROOT)
+CAS_CPPFLAGS = $${CASROOT}/inc
+
+CAS_KERNEL = -L$${CASROOT}/Linux/lib -lTKernel
+
+INCLUDEPATH += ../../include $${VTK_INCLUDES} $${CAS_CPPFLAGS} ../Qtx ../SUIT
+LIBS += -L../../lib -lqtx -lsuit $${VTK_LIBS} $${CAS_KERNEL}
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+DEFINES += VTKVIEWER_EXPORTS OCC_VERSION_MAJOR=6 OCC_VERSION_MINOR=1 OCC_VERSION_MAINTENANCE=1 LIN LINTEL CSFDB No_exception HAVE_CONFIG_H HAVE_LIMITS_H HAVE_WOK_CONFIG_H OCC_CONVERT_SIGNALS
+
+HEADERS = VTKViewer.h
+HEADERS += VTKViewer_CellLocationsArray.h
+HEADERS += VTKViewer_Actor.h
+HEADERS += VTKViewer_ExtractUnstructuredGrid.h
+HEADERS += VTKViewer_ConvexTool.h
+HEADERS += VTKViewer_Filter.h
+HEADERS += VTKViewer_GeometryFilter.h
+HEADERS += VTKViewer_AppendFilter.h
+HEADERS += VTKViewer_Algorithm.h
+HEADERS += VTKViewer_InteractorStyle.h
+HEADERS += VTKViewer_RenderWindow.h
+HEADERS += VTKViewer_RenderWindowInteractor.h
+HEADERS += VTKViewer_ShrinkFilter.h
+HEADERS += VTKViewer_TransformFilter.h
+HEADERS += VTKViewer_Transform.h
+HEADERS += VTKViewer_Trihedron.h
+HEADERS += VTKViewer_Utilities.h
+HEADERS += VTKViewer_ViewManager.h
+HEADERS += VTKViewer_ViewModel.h
+HEADERS += VTKViewer_ViewWindow.h
+HEADERS += VTKViewer_Functor.h
+
+SOURCES = VTKViewer_CellLocationsArray.cxx
+SOURCES += VTKViewer_Actor.cxx
+SOURCES += VTKViewer_ExtractUnstructuredGrid.cxx
+SOURCES += VTKViewer_Filter.cxx
+SOURCES += VTKViewer_GeometryFilter.cxx
+SOURCES += VTKViewer_AppendFilter.cxx
+SOURCES += VTKViewer_InteractorStyle.cxx
+SOURCES += VTKViewer_RenderWindow.cxx
+SOURCES += VTKViewer_RenderWindowInteractor.cxx
+SOURCES += VTKViewer_ShrinkFilter.cxx
+SOURCES += VTKViewer_Transform.cxx
+SOURCES += VTKViewer_TransformFilter.cxx
+SOURCES += VTKViewer_Trihedron.cxx
+SOURCES += VTKViewer_Utilities.cxx
+SOURCES += VTKViewer_ViewManager.cxx
+SOURCES += VTKViewer_ViewModel.cxx
+SOURCES += VTKViewer_ConvexTool.cxx
+SOURCES += VTKViewer_ViewWindow.cxx
+
+TRANSLATIONS = resources/VTKViewer_images.ts \
+ resources/VTKViewer_msg_en.ts
+
+ICONS = resources/*.png
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+resources.files = $$ICONS resources/*.qm
+resources.path = ../../resources
+
+INSTALLS += includes resources
#include <vtkSmartPointer.h>
#include <vtkProperty.h>
-#include <qapplication.h>
-#include <qpainter.h>
+#include <QApplication>
+#include <QRubberBand>
#include <algorithm>
myPreSelectionActor->GetProperty()->SetLineWidth(5);
myPreSelectionActor->GetProperty()->SetPointSize(5);
+ myRectBand = 0;
+
OnSelectionModeChanged();
}
VTKViewer_InteractorStyle::~VTKViewer_InteractorStyle()
{
m_ViewWnd->RemoveActor(myPreSelectionActor);
+ endDrawRect();
}
/*! Loads cursors for viewer operations - zoom, pan, etc...*/
void VTKViewer_InteractorStyle::loadCursors()
{
- myDefCursor = QCursor(ArrowCursor);
- myHandCursor = QCursor(PointingHandCursor);
- myPanCursor = QCursor(SizeAllCursor);
+ myDefCursor = QCursor(Qt::ArrowCursor);
+ myHandCursor = QCursor(Qt::PointingHandCursor);
+ myPanCursor = QCursor(Qt::SizeAllCursor);
myZoomCursor = QCursor(QPixmap(imageZoomCursor));
myRotateCursor = QCursor(QPixmap(imageRotateCursor));
mySpinCursor = QCursor(QPixmap(imageRotateCursor)); // temporarly !!!!!!
- myGlobalPanCursor = QCursor(CrossCursor);
+ myGlobalPanCursor = QCursor(Qt::CrossCursor);
myCursorState = false;
}
}
}
+/*!
+ Draws rectangle by starting and current points
+*/
+void VTKViewer_InteractorStyle::drawRect()
+{
+ if ( !myRectBand )
+ myRectBand = new QRubberBand( QRubberBand::Rectangle, myGUIWindow );
+ myRectBand->hide();
+
+ QRect aRect(myPoint, myOtherPoint);
+ myRectBand->setGeometry( aRect );
+ myRectBand->setVisible( aRect.isValid() );
+}
+
+/*!
+ \brief Delete rubber band on the end on the dragging operation.
+*/
+void VTKViewer_InteractorStyle::endDrawRect()
+{
+ delete myRectBand;
+ myRectBand = 0;
+}
/*! called when viewer operation started (!put necessary initialization here!)*/
void VTKViewer_InteractorStyle::onStartOperation()
case VTK_INTERACTOR_STYLE_CAMERA_SELECT:
case VTK_INTERACTOR_STYLE_CAMERA_FIT:
{
- QPainter p(myGUIWindow);
- p.setPen(Qt::lightGray);
- p.setRasterOp(Qt::XorROP);
- p.drawRect(QRect(myPoint, myOtherPoint));
+ drawRect();
break;
}
case VTK_INTERACTOR_STYLE_CAMERA_ZOOM:
}
case VTK_INTERACTOR_STYLE_CAMERA_FIT:
{
- QPainter p(myGUIWindow);
- p.setPen(Qt::lightGray);
- p.setRasterOp(Qt::XorROP);
- p.drawRect(QRect(myPoint, myOtherPoint));
myOtherPoint = mousePos;
- p.drawRect(QRect(myPoint, myOtherPoint));
+ drawRect();
break;
}
}
class vtkCell;
class vtkRenderWindowInteractor;
-#include <qobject.h>
-#include <qcursor.h>
+#include <QObject>
+#include <QCursor>
+
+class QRubberBand;
#include <map>
virtual void onCursorMove(QPoint mousePos);
virtual void setCursor(const int operation);
+ void drawRect();
+ void endDrawRect();
protected:
QCursor myDefCursor;
std::map<int, Handle(VTKViewer_Filter) > myFilters;
+ QRubberBand* myRectBand; //!< selection rectangle rubber band
+
/** @name members from old version*/
//@{
double DeltaElevation;
//
#include "VTKViewer_RenderWindow.h"
-#include <qcolordialog.h>
-#include <qpopupmenu.h>
-#include <qcursor.h>
+#include <QColorDialog>
+#include <QX11Info>
+#include <QContextMenuEvent>
#include <stdlib.h>
#include <math.h>
*\param name - render window name.
*/
VTKViewer_RenderWindow::VTKViewer_RenderWindow(QWidget* parent, const char* name) :
-QWidget(parent, name,
- Qt::WStyle_NoBorder | Qt::WDestructiveClose |
- Qt::WResizeNoErase | Qt::WRepaintNoErase)
+QWidget(parent, Qt::FramelessWindowHint )
{
+ setObjectName( name );
+ setAttribute( Qt::WA_DeleteOnClose );
+
myRW = vtkRenderWindow::New();
#ifndef WIN32
- myRW->SetDisplayId((void*)x11Display());
+ myRW->SetDisplayId((void*)(QX11Info::display()));
#endif
myRW->SetWindowId((void*)winId());
myRW->DoubleBufferOn();
#include <vtkRenderWindow.h>
-#include <qwidget.h>
+#include <QWidget>
class VTKVIEWER_EXPORT VTKViewer_RenderWindow : public QWidget
{
#include <vtkProperty.h>
// QT Includes
-#include <qkeycode.h>
+#include <QTimer>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QContextMenuEvent>
/*! Create new instance of VTKViewer_RenderWindowInteractor*/
VTKViewer_RenderWindowInteractor* VTKViewer_RenderWindowInteractor::New()
///
/// Start a one-shot timer for 10ms.
///
- mTimer->start(10, TRUE) ;
+ mTimer->setSingleShot(TRUE) ;
+ mTimer->start(10) ;
return 1 ;
}
if( ! this->Enabled ) {
return ;
}
- myInteractorStyle->OnLeftButtonDown((event->state() & ControlButton),
- (event->state() & ShiftButton),
+ myInteractorStyle->OnLeftButtonDown((event->modifiers() & Qt::ControlModifier),
+ (event->modifiers() & Qt::ShiftModifier),
event->x(), event->y());
}
if( ! this->Enabled ) {
return ;
}
- myInteractorStyle->OnLeftButtonUp( (event->state() & ControlButton),
- (event->state() & ShiftButton),
+ myInteractorStyle->OnLeftButtonUp( (event->modifiers() & Qt::ControlModifier),
+ (event->modifiers() & Qt::ShiftModifier),
event->x(), event->y() ) ;
}
if( ! this->Enabled ) {
return ;
}
- myInteractorStyle->OnMiddleButtonDown((event->state() & ControlButton),
- (event->state() & ShiftButton),
+ myInteractorStyle->OnMiddleButtonDown((event->modifiers() & Qt::ControlModifier),
+ (event->modifiers() & Qt::ShiftModifier),
event->x(), event->y() ) ;
}
if( ! this->Enabled ) {
return ;
}
- myInteractorStyle->OnMiddleButtonUp( (event->state() & ControlButton),
- (event->state() & ShiftButton),
+ myInteractorStyle->OnMiddleButtonUp( (event->modifiers() & Qt::ControlModifier),
+ (event->modifiers() & Qt::ShiftModifier),
event->x(), event->y() ) ;
}
if( ! this->Enabled ) {
return ;
}
- myInteractorStyle->OnRightButtonDown( (event->state() & ControlButton),
- (event->state() & ShiftButton),
+ myInteractorStyle->OnRightButtonDown( (event->modifiers() & Qt::ControlModifier),
+ (event->modifiers() & Qt::ShiftModifier),
event->x(), event->y() ) ;
}
return ;
}
bool isOperation = myInteractorStyle->CurrentState() != VTK_INTERACTOR_STYLE_CAMERA_NONE;
- myInteractorStyle->OnRightButtonUp( (event->state() & ControlButton),
- (event->state() & ShiftButton),
+ myInteractorStyle->OnRightButtonUp( (event->modifiers() & Qt::ControlModifier),
+ (event->modifiers() & Qt::ShiftModifier),
event->x(), event->y() );
if ( !isOperation )
{
QContextMenuEvent aEvent( QContextMenuEvent::Mouse,
- event->pos(), event->globalPos(),
- event->state() );
+ event->pos(), event->globalPos() );
emit contextMenuRequested( &aEvent );
}
}
#include "VTKViewer.h"
#include "VTKViewer_Actor.h"
-#include <qtimer.h>
-#include <qobject.h>
+#include <QObject>
+
+class QTimer;
+class QMouseEvent;
+class QKeyEvent;
+class QContextMenuEvent;
// Open CASCADE Includes
#include <TColStd_MapOfInteger.hxx>
#include "SUIT_Desktop.h"
#include "SUIT_Session.h"
-#include <qpainter.h>
-#include <qapplication.h>
-#include <qcolordialog.h>
-#include <qpalette.h>
-#include <qpopupmenu.h>
+#include <QColorDialog>
+#include <QMenu>
+#include <QMouseEvent>
+#include <QToolBar>
bool _InitializeVtkWarningsCall()
{
}
/*!Insert context into popup menu.*/
-void VTKViewer_Viewer::contextMenuPopup(QPopupMenu* thePopup)
+void VTKViewer_Viewer::contextMenuPopup(QMenu* thePopup)
{
- thePopup->insertItem( tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
- thePopup->insertItem( tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );
+ thePopup->addAction( tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
+ thePopup->addAction( tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );
- thePopup->insertSeparator();
+ thePopup->addSeparator();
VTKViewer_ViewWindow* aView = (VTKViewer_ViewWindow*)(myViewManager->getActiveView());
if ( aView && !aView->getToolBar()->isVisible() )
- thePopup->insertItem( tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
+ thePopup->addAction( tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
}
/*!On mouse press event.*/
return;
switch(event->button()) {
- case LeftButton:
+ case Qt::LeftButton:
rwi->LeftButtonPressed(event) ;
break ;
- case MidButton:
+ case Qt::MidButton:
rwi->MiddleButtonPressed(event) ;
break ;
- case RightButton:
+ case Qt::RightButton:
rwi->RightButtonPressed(event) ;
break;
default:
return;
switch(event->button()) {
- case LeftButton:
+ case Qt::LeftButton:
rwi->LeftButtonReleased(event) ;
break ;
- case MidButton:
+ case Qt::MidButton:
rwi->MiddleButtonReleased(event) ;
break ;
- case RightButton:
+ case Qt::RightButton:
rwi->RightButtonReleased(event) ;
break;
default:
#include "VTKViewer.h"
#include "SUIT_ViewModel.h"
-#include <qcolor.h>
+#include <QColor>
+
+class QMouseEvent;
class SUIT_ViewWindow;
class SUIT_Desktop;
virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
virtual void setViewManager(SUIT_ViewManager* theViewManager);
- virtual void contextMenuPopup( QPopupMenu* );
+ virtual void contextMenuPopup( QMenu* );
/*!Gets type of viewer.*/
virtual QString getType() const { return Type(); }
#include "SUIT_Tools.h"
#include "SUIT_ResourceMgr.h"
-#include <qapplication.h>
-#include <qimage.h>
+#include <QImage>
+#include <QToolBar>
#include <vtkRenderer.h>
#include <vtkCamera.h>
myRenderWindow = new VTKViewer_RenderWindow( this, "RenderWindow" );
setCentralWidget(myRenderWindow);
- myRenderWindow->setFocusPolicy( StrongFocus );
+ myRenderWindow->setFocusPolicy( Qt::StrongFocus );
myRenderWindow->setFocus();
myRenderWindow->getRenderWindow()->AddRenderer( myRenderer );
setCentralWidget( myRenderWindow );
myToolBar = new QToolBar(this);
- myToolBar->setCloseMode(QDockWindow::Undocked);
- myToolBar->setLabel(tr("LBL_TOOLBAR_LABEL"));
+ //myToolBar->setCloseMode(QDockWindow::Undocked);
+ myToolBar->setWindowTitle(tr("LBL_TOOLBAR_LABEL"));
createActions();
createToolBar();
myRenderer->GetBackground( backint );
return QColor(int(backint[0]*255), int(backint[1]*255), int(backint[2]*255));
}
- return SUIT_ViewWindow::backgroundColor();
+ return palette().color( backgroundRole() );//SUIT_ViewWindow::backgroundColor();
}
/*!Repaint window. If \a theUpdateTrihedron is true - recalculate trihedron.*/
QImage VTKViewer_ViewWindow::dumpView()
{
QPixmap px = QPixmap::grabWindow( myRenderWindow->winId() );
- return px.convertToImage();
+ return px.toImage();
}
/*! The method returns the visual parameters of this view as a formated string
*/
void VTKViewer_ViewWindow::setVisualParameters( const QString& parameters )
{
- QStringList paramsLst = QStringList::split( '*', parameters, true );
+ QStringList paramsLst = parameters.split( '*' );
if ( paramsLst.size() == 13 ) {
double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];
pos[0] = paramsLst[0].toDouble();
SUBDIRS += PyConsole
SUBDIRS += Prs
SUBDIRS += OBJECT
+SUBDIRS += VTKViewer
SUBDIRS += OCCViewer
SUBDIRS += Event