X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSVTK%2FSVTK_RenderWindowInteractor.cxx;h=c6278f7c2665cbe197a689dd12bafa7907d2a69f;hb=refs%2Fheads%2Fngr%2Fpython3_dev_pv5.4;hp=a80733492639df46b8de5244c69ff91eb1a4bfe7;hpb=00fccccb22ad6dde8640fa5347c4b0d8127b7cfc;p=modules%2Fgui.git diff --git a/src/SVTK/SVTK_RenderWindowInteractor.cxx b/src/SVTK/SVTK_RenderWindowInteractor.cxx index a80733492..c6278f7c2 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_RenderWindowInteractor.cxx @@ -1,1011 +1,909 @@ -// SALOME VTKViewer : build VTK viewer into Salome desktop +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 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, or (at your option) any later version. // -// 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 +// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File : VTKViewer_RenderWindowInteractor.cxx -// Author : Nicolas REJNERI -// Module : SALOME -// $Header$ + +// SALOME VTKViewer : build VTK viewer into Salome desktop +// File : +// Author : #include "SVTK_RenderWindowInteractor.h" #include "SVTK_InteractorStyle.h" -#include "SVTK_RenderWindow.h" -#include "SVTK_ViewWindow.h" - -#include "VTKViewer_Algorithm.h" +#include "SVTK_Renderer.h" #include "SVTK_Functor.h" -#include "SVTK_Actor.h" +#include "SALOME_Actor.h" -#include -#include -#include -#include +// QT Includes +// Put Qt includes before the X11 includes which #define the symbol None +// (see SVTK_SpaceMouse.h) to avoid the compilation error. +#if !defined(WIN32) && !defined(__APPLE__) +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#include +#endif +#include +#endif +#include + +#include "SVTK_SpaceMouse.h" +#include "SVTK_Event.h" + +#include "VTKViewer_Algorithm.h" // VTK Includes #include -#include -#include -#include #include #include +#include +#include +#include +#include +#include -// QT Includes -#include +static bool GENERATE_SUIT_EVENTS = true; +static bool FOCUS_UNDER_MOUSE = false; -#include +// workaround about the bug in vtkImplicitPlaneWidget class +// that eats mouse button release event +// causing clipping plane preview in SMESH sticking up +#define Fix_Of_vtkImplicitPlaneWidget_bug -#include "utilities.h" +/*! + Constructor +*/ +QVTK_RenderWindowInteractor +::QVTK_RenderWindowInteractor(QWidget* theParent, + const char* theName): + QWidget(theParent), + myRenderWindow(vtkRenderWindow::New()) +{ + setAttribute( Qt::WA_PaintOnScreen ); + setAttribute( Qt::WA_NoSystemBackground ); -using namespace std; + setObjectName(theName); -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif + setMouseTracking(true); + myRenderWindow->Delete(); + myRenderWindow->DoubleBufferOn(); -SVTK_RenderWindowInteractor* -SVTK_RenderWindowInteractor -::New() -{ - vtkObject *ret = vtkObjectFactory::CreateInstance("SVTK_RenderWindowInteractor") ; - if( ret ) { - return dynamic_cast(ret) ; - } - return new SVTK_RenderWindowInteractor; +#if !defined WIN32 && !defined __APPLE__ + myRenderWindow->SetDisplayId((void*)QX11Info::display()); +#endif + myRenderWindow->SetWindowId((void*)winId()); } -SVTK_RenderWindowInteractor -::SVTK_RenderWindowInteractor() +/*! + To initialize by vtkGenericRenderWindowInteractor instance +*/ +void +QVTK_RenderWindowInteractor +::Initialize(vtkGenericRenderWindowInteractor* theDevice) { - this->Enabled = 0 ; - this->mTimer = new QTimer( this ) ; - myDisplayMode = 0; - myGUIWindow = 0; - - myBasicPicker = vtkPicker::New(); - myCellPicker = vtkCellPicker::New(); - myPointPicker = vtkPointPicker::New(); - - myCellActor = SVTK_Actor::New(); - myCellActor->PickableOff(); - myCellActor->GetProperty()->SetColor(1,1,0); - myCellActor->GetProperty()->SetLineWidth(5); - myCellActor->GetProperty()->SetRepresentationToSurface(); + if ( GetDevice() ) + myDevice->SetRenderWindow( NULL ); - myEdgeActor = SVTK_Actor::New(); - myEdgeActor->PickableOff(); - myEdgeActor->GetProperty()->SetColor(1,0,0); - myEdgeActor->GetProperty()->SetLineWidth(5); - myEdgeActor->GetProperty()->SetRepresentationToWireframe(); + myDevice = theDevice; - myPointActor = SVTK_Actor::New(); - myPointActor->PickableOff(); - myPointActor->GetProperty()->SetColor(1,1,0); - myPointActor->GetProperty()->SetPointSize(5); - myPointActor->GetProperty()->SetRepresentationToPoints(); - - connect(mTimer, SIGNAL(timeout()), this, SLOT(TimerFunc())) ; + if ( theDevice ) + theDevice->SetRenderWindow( getRenderWindow() ); } - -SVTK_RenderWindowInteractor -::~SVTK_RenderWindowInteractor() +/*! + Destructor +*/ +QVTK_RenderWindowInteractor +::~QVTK_RenderWindowInteractor() { - if(MYDEBUG) INFOS("SVTK_RenderWindowInteractor::~SVTK_RenderWindowInteractor()"); - - delete mTimer ; - - myViewWindow->RemoveActor(myCellActor); - myViewWindow->RemoveActor(myEdgeActor); - myViewWindow->RemoveActor(myPointActor); - - myCellActor->Delete(); - myEdgeActor->Delete(); - myPointActor->Delete(); - - myBasicPicker->Delete(); - myCellPicker->Delete(); - myPointPicker->Delete(); +#if !defined WIN32 && !defined __APPLE__ +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance(); + if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() ) + aSpaceMouse->close( QX11Info::display() ); +#else + SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance(); + if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() ) + aSpaceMouse->close( QX11Info::connection() ); +#endif +#endif } -// -// We never allow the SVTK_RenderWindowInteractor to control -// the event loop. The application always has the control. -// -void -SVTK_RenderWindowInteractor -::Initialize() -{ - // - // We cannot do much unless there is a render window - // associated with this interactor. - // - if( ! RenderWindow ) { - vtkErrorMacro(<< "SVTK_RenderWindowInteractor::Initialize(): No render window attached!") ; - return ; - } - - // - // We cannot hand a render window which is not a VTKViewer_RenderWindow. - // One way to force this is to use dynamic_cast and hope that - // it works. If the dynamic_cast does not work, we flag an error - // and get the hell out. - // - vtkRenderWindow *aRenderWindow = dynamic_cast(RenderWindow) ; - if( !aRenderWindow ) { - vtkErrorMacro(<< "SVTK_RenderWindowInteractor::Initialize() can only handle VTKViewer_RenderWindow.") ; - return ; - } - - // - // If the render window has zero size, then set it to a default - // value of 300x300. - // - int* aSize = aRenderWindow->GetSize(); - this->Size[0] = ((aSize[0] > 0) ? aSize[0] : 300); - this->Size[1] = ((aSize[1] > 0) ? aSize[1] : 300); - - this->SetPicker(myBasicPicker); - - SetSelectionTolerance(); - // - // Enable the interactor. - // - this->Enable() ; - - // - // Start the rendering of the window. - // - aRenderWindow->Start() ; - - // - // The interactor has been initialized. - // - this->Initialized = 1 ; - - return ; +/*! + \return corresponding render window interactor +*/ +vtkGenericRenderWindowInteractor* +QVTK_RenderWindowInteractor +::GetDevice() +{ + return myDevice.GetPointer(); } - -//---------------------------------------------------------------------------- -void -SVTK_RenderWindowInteractor -::setGUIWindow(QWidget* theWindow) +/*! + \return corresponding render window +*/ +vtkRenderWindow* +QVTK_RenderWindowInteractor +::getRenderWindow() { - myGUIWindow = theWindow; + return myRenderWindow.GetPointer(); } -//---------------------------------------------------------------------------- +/*! + Just to simplify usage of its device (vtkGenericRenderWindowInteractor) +*/ void -SVTK_RenderWindowInteractor -::setViewWindow(SVTK_ViewWindow* theViewWindow) +QVTK_RenderWindowInteractor +::InvokeEvent(unsigned long theEvent, void* theCallData) { - myViewWindow = theViewWindow; - - myViewWindow->InsertActor(myCellActor); - myViewWindow->InsertActor(myEdgeActor); - myViewWindow->InsertActor(myPointActor); + GetDevice()->InvokeEvent(theEvent,theCallData); } -//---------------------------------------------------------------------------- -void -SVTK_RenderWindowInteractor -::MoveInternalActors() +/*! + Get paint engine for the scene +*/ +QPaintEngine* QVTK_RenderWindowInteractor::paintEngine() const { - myViewWindow->MoveActor(myCellActor); - myViewWindow->MoveActor(myEdgeActor); - myViewWindow->MoveActor(myPointActor); + return 0; } -//---------------------------------------------------------------------------- +/*! + Need for initial contents display on Win32 +*/ void -SVTK_RenderWindowInteractor -::SetInteractorStyle(vtkInteractorObserver *theInteractor) +QVTK_RenderWindowInteractor +::show() { - myInteractorStyle = dynamic_cast(theInteractor); - vtkRenderWindowInteractor::SetInteractorStyle(theInteractor); + QWidget::show(); + update(); // needed for initial contents display on Win32 } - +/*! + To implement final initialization, just before the widget is displayed +*/ void -SVTK_RenderWindowInteractor -::SetSelectionMode(Selection_Mode theMode) +QVTK_RenderWindowInteractor +::polish() { - myCellActor->SetVisibility(false); - myEdgeActor->SetVisibility(false); - myPointActor->SetVisibility(false); - - switch(theMode){ - case ActorSelection: - this->SetPicker(myBasicPicker); - break; - case NodeSelection: - this->SetPicker(myPointPicker); - break; - case CellSelection: - case EdgeSelection: - case FaceSelection: - case VolumeSelection: - case EdgeOfCellSelection: - this->SetPicker(myCellPicker); - break; + // Final initialization just before the widget is displayed + GetDevice()->SetSize(width(),height()); + if(!GetDevice()->GetInitialized() && GetDevice()->GetRenderWindow()){ + GetDevice()->Initialize(); + GetDevice()->ConfigureEvent(); } - - myInteractorStyle->OnSelectionModeChanged(); } +/*! + To adjust widget and vtkRenderWindow size +*/ void -SVTK_RenderWindowInteractor -::SetSelectionProp(const double& theRed, - const double& theGreen, - const double& theBlue, - const int& theWidth) +QVTK_RenderWindowInteractor +::resize(int w, int h) { - myCellActor->GetProperty()->SetColor(theRed, theGreen, theBlue); - myCellActor->GetProperty()->SetLineWidth(theWidth); - - myPointActor->GetProperty()->SetColor(theRed, theGreen, theBlue); - myPointActor->GetProperty()->SetPointSize(theWidth); + GetDevice()->UpdateSize(w,h); } +/*! + Custom paint event handler +*/ void -SVTK_RenderWindowInteractor -::SetSelectionTolerance(const double& theTolNodes, - const double& theTolItems) +QVTK_RenderWindowInteractor +::paintEvent( QPaintEvent* theEvent ) { - myTolNodes = theTolNodes; - myTolItems = theTolItems; - - myBasicPicker->SetTolerance(myTolItems); - myCellPicker->SetTolerance(myTolItems); - myPointPicker->SetTolerance(myTolNodes); - + GetDevice()->CreateTimer(VTKI_TIMER_FIRST); } -// ================================== -void -SVTK_RenderWindowInteractor -::Start() -{ - // - // We do not allow this interactor to control the - // event loop. Only the QtApplication objects are - // allowed to do that. - // - vtkErrorMacro(<<"SVTK_RenderWindowInteractor::Start() not allowed to start event loop.") ; - return ; -} +/*! + Custom resize event handler +*/ void -SVTK_RenderWindowInteractor -::UpdateSize(int w, int h) +QVTK_RenderWindowInteractor +::resizeEvent( QResizeEvent* theEvent ) { - // if the size changed send this on to the RenderWindow - if ((w != this->Size[0])||(h != this->Size[1])) { - this->Size[0] = w; - this->Size[1] = h; - this->RenderWindow->SetSize(w,h); + int* aSize = getRenderWindow()->GetSize(); + int aWidth = aSize[0]; + int aHeight = aSize[1]; + + GetDevice()->UpdateSize(width(),height()); + + if(isVisible() && 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); + } + } } -} -int -SVTK_RenderWindowInteractor -::CreateTimer(int vtkNotUsed(timertype)) -{ - // - // Start a one-shot timer for 10ms. - // - mTimer->start(10, TRUE) ; - return 1 ; + update(); } -int -SVTK_RenderWindowInteractor -::DestroyTimer(void) -{ - // - // :TRICKY: Tue May 2 00:17:32 2000 Pagey - // - // QTimer will automatically expire after 10ms. So - // we do not need to do anything here. In fact, we - // should not even Stop() the QTimer here because doing - // this will skip some of the processing that the TimerFunc() - // does and will result in undesirable effects. For - // example, this will result in vtkLODActor to leave - // the models in low-res mode after the mouse stops - // moving. - // - return 1 ; -} + +/*! + Custom context menu event handler +*/ void -SVTK_RenderWindowInteractor -::TimerFunc() -{ - if( ! this->Enabled ) { - return ; +QVTK_RenderWindowInteractor +::contextMenuEvent( QContextMenuEvent* event ) +{} + +/*! + Custom mouse move event handler +*/ +void +QVTK_RenderWindowInteractor +::mouseMoveEvent( QMouseEvent* event ) +{ + GetDevice()->SetEventInformationFlipY(event->x(), + event->y(), + event->modifiers() & Qt::ControlModifier, + event->modifiers() & Qt::ShiftModifier); + GetDevice()->MouseMoveEvent(); +} + + +/*! + Custom mouse press event handler +*/ +void +QVTK_RenderWindowInteractor +::mousePressEvent( QMouseEvent* event ) +{ + GetDevice()->SetEventInformationFlipY(event->x(), + event->y(), + event->modifiers() & Qt::ControlModifier, + event->modifiers() & Qt::ShiftModifier); + if( event->button() & Qt::LeftButton ) + GetDevice()->LeftButtonPressEvent(); + else if( event->button() & Qt::MidButton ) + GetDevice()->MiddleButtonPressEvent(); + else if( event->button() & Qt::RightButton ) + GetDevice()->RightButtonPressEvent(); +} + + +/*! + Custom mouse release event handler +*/ +void +QVTK_RenderWindowInteractor +::mouseReleaseEvent( QMouseEvent *event ) +{ + GetDevice()->SetEventInformationFlipY(event->x(), + event->y(), + event->modifiers() & Qt::ControlModifier, + event->modifiers() & Qt::ShiftModifier); + + if( event->button() & Qt::LeftButton ) + GetDevice()->LeftButtonReleaseEvent(); + else if( event->button() & Qt::MidButton ) + GetDevice()->MiddleButtonReleaseEvent(); + else if( event->button() & Qt::RightButton ) { +#if defined(Fix_Of_vtkImplicitPlaneWidget_bug) + GetDevice()->SetEventInformationFlipY( -99999, -99999, + event->modifiers() & Qt::ControlModifier, + event->modifiers() & Qt::ShiftModifier); + bool blocked = blockSignals( true ); + GetDevice()->LeftButtonPressEvent(); + GetDevice()->LeftButtonReleaseEvent(); + blockSignals( blocked ); + GetDevice()->SetEventInformationFlipY(event->x(), + event->y(), + event->modifiers() & Qt::ControlModifier, + event->modifiers() & Qt::ShiftModifier); +#endif + GetDevice()->RightButtonReleaseEvent(); } +} - myInteractorStyle->OnTimer(); - emit RenderWindowModified(); -} +/*! + Custom mouse double click event handler +*/ +void +QVTK_RenderWindowInteractor +::mouseDoubleClickEvent( QMouseEvent* event ) +{} + +/*! + Custom mouse wheel event handler +*/ void -SVTK_RenderWindowInteractor -::MouseMove(const QMouseEvent *event) +QVTK_RenderWindowInteractor +::wheelEvent( QWheelEvent* event ) { - if( ! this->Enabled ) { - return ; - } - myInteractorStyle->OnMouseMove(0, 0, event->x(), event->y()/*this->Size[1] - event->y() - 1*/) ; - if (myInteractorStyle->needsRedrawing() ) - emit RenderWindowModified() ; + activateWindow(); + setFocus(); + GetDevice()->SetEventInformationFlipY(event->x(), + event->y(), + event->modifiers() & Qt::ControlModifier, + event->modifiers() & Qt::ShiftModifier); + if ( event->delta()>0) + GetDevice()->MouseWheelForwardEvent(); + else + GetDevice()->MouseWheelBackwardEvent(); } + +/*! + Custom key press event handler +*/ void -SVTK_RenderWindowInteractor -::LeftButtonPressed(const QMouseEvent *event) +QVTK_RenderWindowInteractor +::keyPressEvent( QKeyEvent* event ) { - if( ! this->Enabled ) { - return ; - } - myInteractorStyle->OnLeftButtonDown((event->state() & ControlButton), - (event->state() & ShiftButton), - event->x(), event->y()); + GetDevice()->SetKeyEventInformation(event->modifiers() & Qt::ControlModifier, + event->modifiers() & Qt::ShiftModifier, + event->key()); + GetDevice()->KeyPressEvent(); + GetDevice()->CharEvent(); } +/*! + Custom key release event handler +*/ void -SVTK_RenderWindowInteractor -::LeftButtonReleased(const QMouseEvent *event) { - if( ! this->Enabled ) { - return ; - } - myInteractorStyle->OnLeftButtonUp( (event->state() & ControlButton), - (event->state() & ShiftButton), - event->x(), event->y() ) ; -} - -void -SVTK_RenderWindowInteractor -::MiddleButtonPressed(const QMouseEvent *event) +QVTK_RenderWindowInteractor +::keyReleaseEvent( QKeyEvent * event ) { - if( ! this->Enabled ) { - return ; - } - myInteractorStyle->OnMiddleButtonDown((event->state() & ControlButton), - (event->state() & ShiftButton), - event->x(), event->y() ) ; + GetDevice()->SetKeyEventInformation(event->modifiers() & Qt::ControlModifier, + event->modifiers() & Qt::ShiftModifier, + event->key()); + GetDevice()->KeyReleaseEvent(); } -void -SVTK_RenderWindowInteractor -::MiddleButtonReleased(const QMouseEvent *event) + +/*! + Custom enter event handler +*/ +void +QVTK_RenderWindowInteractor +::enterEvent( QEvent* event ) { - if( ! this->Enabled ) { - return ; + if(FOCUS_UNDER_MOUSE){ + activateWindow(); + setFocus(); } - myInteractorStyle->OnMiddleButtonUp( (event->state() & ControlButton), - (event->state() & ShiftButton), - event->x(), event->y() ) ; + GetDevice()->EnterEvent(); } -void -SVTK_RenderWindowInteractor -::RightButtonPressed(const QMouseEvent *event) +/*! + Custom leave event handler +*/ +void +QVTK_RenderWindowInteractor +::leaveEvent( QEvent * ) { - if( ! this->Enabled ) { - return ; - } - myInteractorStyle->OnRightButtonDown( (event->state() & ControlButton), - (event->state() & ShiftButton), - event->x(), event->y() ) ; + GetDevice()->LeaveEvent(); } -void -SVTK_RenderWindowInteractor -::RightButtonReleased(const QMouseEvent *event) +/*! + Reimplemented from QWidget in order to set window - receiver + of space mouse events. +*/ +void +QVTK_RenderWindowInteractor +::focusInEvent( QFocusEvent* event ) { - if( ! this->Enabled ) { - return ; - } - myInteractorStyle->OnRightButtonUp( (event->state() & ControlButton), - (event->state() & ShiftButton), - event->x(), event->y() ) ; + QWidget::focusInEvent( event ); - if(myInteractorStyle->GetState() == VTK_INTERACTOR_STYLE_CAMERA_NONE && !( event->state() & KeyButtonMask )){ - QContextMenuEvent aEvent( QContextMenuEvent::Mouse, - event->pos(), event->globalPos(), - event->state() ); - emit contextMenuRequested( &aEvent ); +#if !defined WIN32 && !defined __APPLE__ + // register set space mouse events receiver +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance(); + if ( aSpaceMouse ) + { + if ( !aSpaceMouse->isSpaceMouseOn() ) + // initialize 3D space mouse driver + aSpaceMouse->initialize( QX11Info::display(), winId() ); + else + aSpaceMouse->setWindow( QX11Info::display(), winId() ); } +#else + SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance(); + if ( aSpaceMouse ) + { + if ( !aSpaceMouse->isSpaceMouseOn() ) + // initialize 3D space mouse driver + aSpaceMouse->initialize( QX11Info::connection(), winId() ); + else + aSpaceMouse->setWindow( QX11Info::connection(), winId() ); + } +#endif +#endif } -void -SVTK_RenderWindowInteractor -::ButtonPressed(const QMouseEvent *event) +/*! + Reimplemented from QWidget in order to set window - receiver + of space mouse events. +*/ +void +QVTK_RenderWindowInteractor +::focusOutEvent ( QFocusEvent* event ) { - return ; -} + QWidget::focusOutEvent( event ); -void -SVTK_RenderWindowInteractor -::ButtonReleased(const QMouseEvent *event) -{ - return ; +#if !defined WIN32 && !defined __APPLE__ +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + // unregister set space mouse events receiver + SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance(); + if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() ) + aSpaceMouse->setWindow( QX11Info::display(), 0 ); +#else + SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance(); + if ( aSpaceMouse && aSpaceMouse->isSpaceMouseOn() ) + aSpaceMouse->setWindow( QX11Info::connection(), 0 ); +#endif +#endif } +// TODO (QT5 PORTING) Below is a temporary solution, to allow compiling with Qt 5 +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#if defined(WIN32) -int -SVTK_RenderWindowInteractor -::GetDisplayMode() +/*! + To handle native Win32 events (from such devices as SpaceMouse) +*/ +bool QVTK_RenderWindowInteractor::winEvent( MSG* msg, long* result ) { - return myDisplayMode; + // TODO: Implement event handling for SpaceMouse + return QWidget::winEvent( msg, result); } -void -SVTK_RenderWindowInteractor -::SetDisplayMode(int theMode) +#elif !defined(__APPLE__) +/*! + To handle native X11 events (from such devices as SpaceMouse) +*/ +bool +QVTK_RenderWindowInteractor +::x11Event( XEvent *xEvent ) { - if(theMode == 0) - ChangeRepresentationToWireframe(); - else - ChangeRepresentationToSurface(); - myDisplayMode = theMode; -} - + // handle 3d space mouse events + if ( SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance() ) + { + if ( aSpaceMouse->isSpaceMouseOn() && xEvent->type == ClientMessage ) + { + SVTK_SpaceMouse::MoveEvent anEvent; + int type = aSpaceMouse->translateEvent( QX11Info::display(), xEvent, &anEvent, 1.0, 1.0 ); + switch ( type ) + { + case SVTK_SpaceMouse::SpaceMouseMove: + GetDevice()->InvokeEvent( SVTK::SpaceMouseMoveEvent, anEvent.data ); + break; + case SVTK_SpaceMouse::SpaceButtonPress: + GetDevice()->InvokeEvent( SVTK::SpaceMouseButtonEvent, &anEvent.button ); + break; + case SVTK_SpaceMouse::SpaceButtonRelease: + break; + } + return true; // stop handling the event + } + } -void -SVTK_RenderWindowInteractor -::SetDisplayMode(const Handle(SALOME_InteractiveObject)& theIObject, - int theMode) -{ - using namespace VTK; - ForEachIf(GetRenderer()->GetActors(), - TIsSameIObject(theIObject), - TSetFunction - (&SALOME_Actor::setDisplayMode,theMode)); + return QWidget::x11Event( xEvent ); } +#endif -void -SVTK_RenderWindowInteractor -::ChangeRepresentationToWireframe() +#else // QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + +bool QVTK_RenderWindowInteractor +::nativeEvent(const QByteArray& eventType, void* message, long* result) { - ChangeRepresentationToWireframe(GetRenderer()->GetActors()); +#if defined(WIN32) + // TODO: WIN32-related implementation +#elif !defined(__APPLE__) + if ( eventType == "xcb_generic_event_t" ) + { + xcb_generic_event_t* ev = static_cast(message); +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + // TODO: this code is never called + if ( SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance() ) +#else + if ( SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance() ) +#endif + { + if ( aSpaceMouse->isSpaceMouseOn() && ev->response_type == XCB_CLIENT_MESSAGE ) + { + SVTK_SpaceMouse::MoveEvent anEvent; +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + // TODO: this code is never called + int type = aSpaceMouse->translateEvent( QX11Info::display(), xEvent, &anEvent, 1.0, 1.0 ); +#else + int type = aSpaceMouse->translateEvent( QX11Info::connection(), (xcb_client_message_event_t*)ev, &anEvent, 1.0, 1.0 ); +#endif + switch ( type ) + { + case SVTK_SpaceMouse::SpaceMouseMove: + GetDevice()->InvokeEvent( SVTK::SpaceMouseMoveEvent, anEvent.data ); + break; + case SVTK_SpaceMouse::SpaceButtonPress: + GetDevice()->InvokeEvent( SVTK::SpaceMouseButtonEvent, &anEvent.button ); + break; + case SVTK_SpaceMouse::SpaceButtonRelease: + break; + } + return true; // stop handling the event + } + } + } +#endif + return QWidget::nativeEvent( eventType, message, result ); } - -void +#endif +/*! + Constructor +*/ SVTK_RenderWindowInteractor -::ChangeRepresentationToSurface() +::SVTK_RenderWindowInteractor(QWidget* theParent, + const char* theName): + QVTK_RenderWindowInteractor(theParent,theName), + myEventCallbackCommand(vtkCallbackCommand::New()) { - ChangeRepresentationToSurface(GetRenderer()->GetActors()); -} + myEventCallbackCommand->Delete(); + myEventCallbackCommand->SetClientData(this); + myPriority = 0.0; -void -SVTK_RenderWindowInteractor -::ChangeRepresentationToWireframe(vtkActorCollection* theCollection) -{ - using namespace VTK; - ForEach(theCollection, - TSetFunction - (&SALOME_Actor::setDisplayMode,0)); - emit RenderWindowModified(); + myEventCallbackCommand->SetCallback(SVTK_RenderWindowInteractor::ProcessEvents); } +/*! + To initialize properly the class +*/ void SVTK_RenderWindowInteractor -::ChangeRepresentationToSurface(vtkActorCollection* theCollection) +::Initialize(vtkGenericRenderWindowInteractor* theDevice, + SVTK_Renderer* theRenderer, + SVTK_Selector* theSelector) { - using namespace VTK; - ForEach(theCollection, - TSetFunction - (&SALOME_Actor::setDisplayMode,1)); - emit RenderWindowModified(); + QVTK_RenderWindowInteractor::Initialize(theDevice); + SetRenderer(theRenderer); + SetSelector(theSelector); } - -vtkRenderer* +/*! + Destructor +*/ SVTK_RenderWindowInteractor -::GetRenderer() +::~SVTK_RenderWindowInteractor() { - vtkRendererCollection * theRenderers = this->RenderWindow->GetRenderers(); - theRenderers->InitTraversal(); - return theRenderers->GetNextItem(); -} - - -struct TErase{ - VTK::TSetFunction mySetFunction; - TErase(): - mySetFunction(&vtkActor::SetVisibility,false) - {} - void operator()(SALOME_Actor* theActor){ - theActor->SetVisibility(false); - // Erase dependent actors - vtkActorCollection* aCollection = vtkActorCollection::New(); - theActor->GetChildActors(aCollection); - VTK::ForEach(aCollection,mySetFunction); - aCollection->Delete(); + // Sequence of the destruction call are fixed and should be changed. + // vtkRenderWindow instance should be destroyed after all vtkRenderer's + GetDevice()->SetInteractorStyle(NULL); + while(!myInteractorStyles.empty()){ + const PInteractorStyle& aStyle = myInteractorStyles.top(); + aStyle->SetInteractor(NULL); + myInteractorStyles.pop(); } -}; -void -SVTK_RenderWindowInteractor -::EraseAll() -{ - using namespace VTK; - ForEach(GetRenderer()->GetActors(), - TErase()); + SetRenderer(NULL); - emit RenderWindowModified() ; + GetDevice()->SetRenderWindow(NULL); } -void +/*! + To get corresponding SVTK_Renderer instance +*/ +SVTK_Renderer* SVTK_RenderWindowInteractor -::DisplayAll() -{ - vtkActorCollection* aCollection = GetRenderer()->GetActors(); - using namespace VTK; - ForEach(aCollection,TSetVisibility(true)); - - emit RenderWindowModified() ; +::GetRenderer() +{ + return myRenderer.GetPointer(); } - -void +/*! + To get corresponding SVTK_Renderer device (just to simplify collobaration with SVTK_Renderer) +*/ +vtkRenderer* SVTK_RenderWindowInteractor -::Erase(SALOME_Actor* theActor, bool update) +::getRenderer() { - TErase()(theActor); - - if(update) - emit RenderWindowModified(); + return GetRenderer()->GetDevice(); } - +/*! + Changes renderer + \param theRenderer - new renderer +*/ void SVTK_RenderWindowInteractor -::Erase(const Handle(SALOME_InteractiveObject)& theIObject, - bool update) +::SetRenderer(SVTK_Renderer* theRenderer) { - using namespace VTK; - ForEachIf(GetRenderer()->GetActors(), - TIsSameIObject(theIObject), - TErase()); + if(theRenderer == myRenderer.GetPointer()) + return; - if(update) - emit RenderWindowModified(); -} + if(GetRenderer()) + myRenderWindow->RemoveRenderer(getRenderer()); + myRenderer = theRenderer; -struct TRemoveAction{ - vtkRenderer* myRen; - TRemoveAction(vtkRenderer* theRen): myRen(theRen){} - void operator()(SALOME_Actor* theActor){ - myRen->RemoveActor(theActor); - } -}; + if(GetRenderer()) + myRenderWindow->AddRenderer(getRenderer()); +} + +/*! + Changes interactor style + \param theStyle - new interactor style +*/ void SVTK_RenderWindowInteractor -::Remove(const Handle(SALOME_InteractiveObject)& theIObject, - bool update) +::InitInteractorStyle(vtkInteractorStyle* theStyle) { - vtkRenderer* aRen = GetRenderer(); - - using namespace VTK; - ForEachIf(aRen->GetActors(), - TIsSameIObject(theIObject), - TRemoveAction(aRen)); + GetDevice()->SetInteractorStyle(theStyle); } +/*! + To change current interactor style by pushing the new one into the container +*/ void SVTK_RenderWindowInteractor -::Remove( SALOME_Actor* SActor, bool updateViewer ) +::PushInteractorStyle(vtkInteractorStyle* theStyle) { - if ( SActor != 0 ) - { - GetRenderer()->RemoveProp( SActor ); - if ( updateViewer ) - emit RenderWindowModified(); - } + myInteractorStyles.push(PInteractorStyle(theStyle)); + InitInteractorStyle(theStyle); } +/*! + To restore previous interactor style +*/ void SVTK_RenderWindowInteractor -::RemoveAll( const bool updateViewer ) +::PopInteractorStyle() { - vtkRenderer* aRenderer = GetRenderer(); - vtkActorCollection* anActors = aRenderer->GetActors(); - if ( anActors ) - { - anActors->InitTraversal(); - while ( vtkActor *anAct = anActors->GetNextActor() ) - { - if ( anAct->IsA( "SALOME_Actor" ) ) - { - SALOME_Actor* aSAct = (SALOME_Actor*)anAct; - if ( aSAct->hasIO() && aSAct->getIO()->hasEntry() ) - aRenderer->RemoveActor( anAct ); - } - } - - if ( updateViewer ) - emit RenderWindowModified(); - } + if(GetInteractorStyle()) + myInteractorStyles.pop(); + + if(GetInteractorStyle()) + InitInteractorStyle(GetInteractorStyle()); } - -float +/*! + To get current interactor style +*/ +vtkInteractorStyle* SVTK_RenderWindowInteractor -::GetTransparency(const Handle(SALOME_InteractiveObject)& theIObject) +::GetInteractorStyle() { - using namespace VTK; - SALOME_Actor* anActor = - Find(GetRenderer()->GetActors(), - TIsSameIObject(theIObject)); - if(anActor) - return 1.0 - anActor->GetOpacity(); - return -1.0; + return myInteractorStyles.empty() ? 0 : myInteractorStyles.top().GetPointer(); } -void +/*! + To get current selector +*/ +SVTK_Selector* SVTK_RenderWindowInteractor -::SetTransparency(const Handle(SALOME_InteractiveObject)& theIObject, - float theTrans) -{ - float anOpacity = 1.0 - theTrans; - using namespace VTK; - ForEachIf(GetRenderer()->GetActors(), - TIsSameIObject(theIObject), - TSetFunction - (&SALOME_Actor::SetOpacity,anOpacity)); +::GetSelector() +{ + return mySelector.GetPointer(); } +/*! + Changes selector + \param theSelector - new selector +*/ void SVTK_RenderWindowInteractor -::Display(SALOME_Actor* theActor, bool update) -{ - GetRenderer()->AddActor(theActor); - theActor->SetVisibility(true); +::SetSelector(SVTK_Selector* theSelector) +{ + if(mySelector.GetPointer()) + mySelector->RemoveObserver(myEventCallbackCommand.GetPointer()); - if(update) - emit RenderWindowModified(); -} + mySelector = theSelector; + if(mySelector.GetPointer()) + mySelector->AddObserver(vtkCommand::EndPickEvent, + myEventCallbackCommand.GetPointer(), + myPriority); +} -void +/*! + Main process VTK event method +*/ +void SVTK_RenderWindowInteractor -::Display(const Handle(SALOME_InteractiveObject)& theIObject, bool update) +::ProcessEvents(vtkObject* vtkNotUsed(theObject), + unsigned long theEvent, + void* theClientData, + void* vtkNotUsed(theCallData)) { - using namespace VTK; - ForEachIf(GetRenderer()->GetActors(), - TIsSameIObject(theIObject), - TSetVisibility(true)); + SVTK_RenderWindowInteractor* self = reinterpret_cast(theClientData); - if(update) - emit RenderWindowModified() ; + switch(theEvent){ + case vtkCommand::EndPickEvent: + self->onEmitSelectionChanged(); + break; + } } - +/*! + To change selection mode (just to simplify collobaration with SVTK_Selector) +*/ void SVTK_RenderWindowInteractor -::KeyPressed(QKeyEvent *event) -{} - - -struct THighlightAction{ - bool myIsHighlight; - SVTK_InteractorStyle* myInteractorStyle; - THighlightAction(SVTK_InteractorStyle* theInteractorStyle, - bool theIsHighlight): - myInteractorStyle(theInteractorStyle), - myIsHighlight(theIsHighlight) - {} - void operator()(SALOME_Actor* theActor){ - if(theActor->GetMapper()){ - if(theActor->hasHighlight()) - theActor->highlight(myIsHighlight); - else{ - if(theActor->GetVisibility() && myIsHighlight) - myInteractorStyle->HighlightProp(theActor); - else if(!myIsHighlight) - myInteractorStyle->HighlightProp(NULL); - } - } - } -}; +::SetSelectionMode(Selection_Mode theMode) +{ + mySelector->SetSelectionMode(theMode); +} -bool +/*! + To get current selection mode (just to simplify collobaration with SVTK_Selector) +*/ +Selection_Mode SVTK_RenderWindowInteractor -::highlight( const Handle(SALOME_InteractiveObject)& theIObject, - bool hilight, - bool update) +::SelectionMode() const { - using namespace VTK; - ForEachIf(GetRenderer()->GetActors(), - TIsSameIObject(theIObject), - THighlightAction(myInteractorStyle,hilight)); - - if(update) - emit RenderWindowModified(); - - return false; + return mySelector->SelectionMode(); } -struct TUpdateAction{ - void operator()(vtkActor* theActor){ - theActor->ApplyProperties(); - } -}; - +/*! + Emits signal selectionChanged() +*/ void SVTK_RenderWindowInteractor -::Update() +::onEmitSelectionChanged() { - vtkRenderer* aRen = GetRenderer(); - - using namespace VTK; - ForEach(aRen->GetActors(),TUpdateAction()); - - aRen->ResetCamera(); - - emit RenderWindowModified(); + return emit selectionChanged(); } +/*! + Custom mouse move event handler +*/ void SVTK_RenderWindowInteractor -::unHighlightSubSelection() +::mouseMoveEvent( QMouseEvent* event ) { - myPointActor->SetVisibility(false); - myEdgeActor->SetVisibility(false); - myCellActor->SetVisibility(false); + QVTK_RenderWindowInteractor::mouseMoveEvent(event); + + if(GENERATE_SUIT_EVENTS) + emit MouseMove( event ); } -bool +/*! + Custom mouse press event handler +*/ +void SVTK_RenderWindowInteractor -::unHighlightAll() +::mousePressEvent( QMouseEvent* event ) { - unHighlightSubSelection(); - - using namespace VTK; - ForEach(GetRenderer()->GetActors(), - THighlightAction(myInteractorStyle,false)); + QVTK_RenderWindowInteractor::mousePressEvent(event); - emit RenderWindowModified() ; - - return false; + if(GENERATE_SUIT_EVENTS) + emit MouseButtonPressed( event ); } -//----------------- -// Color methods -//----------------- +/*! + Custom mouse release event handler +*/ void SVTK_RenderWindowInteractor -::SetColor(const Handle(SALOME_InteractiveObject)& theIObject,QColor theColor) +::mouseReleaseEvent( QMouseEvent *event ) { - float aColor[3] = {theColor.red()/255., theColor.green()/255., theColor.blue()/255.}; - using namespace VTK; - ForEachIf(GetRenderer()->GetActors(), - TIsSameIObject(theIObject), - TSetFunction - (&SALOME_Actor::SetColor,aColor)); -} + SVTK_InteractorStyle* style = 0; + bool aRightBtn = event->button() == Qt::RightButton; + bool isOperation = false; + bool isPolygonalSelection = false; + if( aRightBtn && GetInteractorStyle()) { + style = dynamic_cast( GetInteractorStyle() ); + if ( style ) + isOperation = style->CurrentState() != VTK_INTERACTOR_STYLE_CAMERA_NONE; + } + QVTK_RenderWindowInteractor::mouseReleaseEvent(event); -QColor -SVTK_RenderWindowInteractor -::GetColor(const Handle(SALOME_InteractiveObject)& theIObject) -{ - using namespace VTK; - SALOME_Actor* anActor = - Find(GetRenderer()->GetActors(), - TIsSameIObject(theIObject)); - if(anActor){ - float r,g,b; - anActor->GetColor(r,g,b); - return QColor(int(r*255),int(g*255),int(b*255)); + if ( style ) { + isPolygonalSelection = style->GetPolygonState() == Finished; + style->SetPolygonState( Disable ); + } + + if ( aRightBtn && !isOperation && !isPolygonalSelection && + !( event->modifiers() & Qt::ControlModifier ) && + !( event->modifiers() & Qt::ShiftModifier ) ) { + QContextMenuEvent aEvent( QContextMenuEvent::Mouse, + event->pos(), event->globalPos() ); + emit contextMenuRequested( &aEvent ); } - return QColor(0,0,0); + if(GENERATE_SUIT_EVENTS) + emit MouseButtonReleased( event ); } -bool +/*! + Custom mouse double click event handler +*/ +void SVTK_RenderWindowInteractor -::isInViewer(const Handle(SALOME_InteractiveObject)& theIObject) +::mouseDoubleClickEvent( QMouseEvent* event ) { - using namespace VTK; - SALOME_Actor* anActor = - Find(GetRenderer()->GetActors(), - TIsSameIObject(theIObject)); - return anActor != NULL; -} + if( GetInteractorStyle() && event->button() == Qt::LeftButton ) { + SVTK_InteractorStyle* style = dynamic_cast( GetInteractorStyle() ); + if ( style ) + style->OnMouseButtonDoubleClick(); + } + QVTK_RenderWindowInteractor::mouseDoubleClickEvent(event); -bool -SVTK_RenderWindowInteractor -::isVisible(const Handle(SALOME_InteractiveObject)& theIObject) -{ - using namespace VTK; - SALOME_Actor* anActor = - Find(GetRenderer()->GetActors(), - TIsSameIObject(theIObject)); - return anActor != NULL && anActor->GetVisibility(); + if(GENERATE_SUIT_EVENTS) + emit MouseDoubleClicked( event ); } +/*! + Custom mouse wheel event handler +*/ void SVTK_RenderWindowInteractor -::rename(const Handle(SALOME_InteractiveObject)& theIObject, QString theName) +::wheelEvent( QWheelEvent* event ) { - using namespace VTK; - ForEachIf(GetRenderer()->GetActors(), - TIsSameIObject(theIObject), - TSetFunction - (&SALOME_Actor::setName,theName.latin1())); -} + QVTK_RenderWindowInteractor::wheelEvent(event); + if(event->delta() > 0) + GetDevice()->InvokeEvent(SVTK::ZoomInEvent,NULL); + else + GetDevice()->InvokeEvent(SVTK::ZoomOutEvent,NULL); -//---------------------------------------------------------------------------- -bool -SVTK_RenderWindowInteractor -::highlight(const TColStd_IndexedMapOfInteger& theMapIndex, - SALOME_Actor* theMapActor, - SVTK_Actor* theActor, - TUpdateActor theFun, - bool hilight, - bool update) -{ - if(theMapIndex.Extent() == 0) return false; - - if (hilight) { - setActorData(theMapIndex,theMapActor,theActor,theFun); - theActor->SetVisibility(true); - } - else { - theActor->SetVisibility(false); - } - - if(update){ - this->RenderWindow->Render(); - emit RenderWindowModified() ; - } - - return false; + if(GENERATE_SUIT_EVENTS) + emit WheelMoved( event ); } - + +/*! + Custom key press event handler +*/ void SVTK_RenderWindowInteractor -::setActorData(const TColStd_IndexedMapOfInteger& theMapIndex, - SALOME_Actor* theMapActor, - SVTK_Actor *theActor, - TUpdateActor theFun) +::keyPressEvent( QKeyEvent* event ) { - (*theFun)(theMapIndex,theMapActor,theActor); - float aPos[3]; - theMapActor->GetPosition(aPos); - theActor->SetPosition(aPos); -} - + QVTK_RenderWindowInteractor::keyPressEvent(event); -//---------------------------------------------------------------------------- -static void CellsUpdateActor(const TColStd_IndexedMapOfInteger& theMapIndex, - SALOME_Actor* theMapActor, - SVTK_Actor* theActor) -{ - theActor->MapCells(theMapActor,theMapIndex); -} - -bool -SVTK_RenderWindowInteractor -::highlightCell(const TColStd_IndexedMapOfInteger& theMapIndex, - SALOME_Actor* theMapActor, - bool hilight, - bool update) -{ - return highlight(theMapIndex,theMapActor,myCellActor,&CellsUpdateActor,hilight,update); + if(GENERATE_SUIT_EVENTS) + emit KeyPressed( event ); } - -void -SVTK_RenderWindowInteractor -::setCellData(const int& theIndex, - SALOME_Actor* theMapActor, - SVTK_Actor* theActor) -{ - TColStd_IndexedMapOfInteger MapIndex; - MapIndex.Add(theIndex); - theActor->MapCells(theMapActor,MapIndex); -} - -//---------------------------------------------------------------------------- -static void PointsUpdateActor(const TColStd_IndexedMapOfInteger& theMapIndex, - SALOME_Actor* theMapActor, - SVTK_Actor* theActor) -{ - theActor->MapPoints(theMapActor,theMapIndex); -} - -bool -SVTK_RenderWindowInteractor -::highlightPoint(const TColStd_IndexedMapOfInteger& theMapIndex, - SALOME_Actor* theMapActor, - bool hilight, - bool update) -{ - return highlight(theMapIndex,theMapActor,myPointActor,&PointsUpdateActor,hilight,update); -} - +/*! + Custom key release event handler +*/ void SVTK_RenderWindowInteractor -::setPointData(const int& theIndex, - SALOME_Actor* theMapActor, - SVTK_Actor* theActor) +::keyReleaseEvent( QKeyEvent * event ) { - TColStd_IndexedMapOfInteger MapIndex; - MapIndex.Add(theIndex); - theActor->MapPoints(theMapActor,MapIndex); -} + QVTK_RenderWindowInteractor::keyReleaseEvent(event); - -//---------------------------------------------------------------------------- -static void EdgesUpdateActor(const TColStd_IndexedMapOfInteger& theMapIndex, - SALOME_Actor* theMapActor, - SVTK_Actor* theActor) -{ - theActor->MapEdge(theMapActor,theMapIndex); -} - -bool -SVTK_RenderWindowInteractor -::highlightEdge(const TColStd_IndexedMapOfInteger& theMapIndex, - SALOME_Actor* theMapActor, - bool hilight, - bool update) -{ - return highlight(theMapIndex,theMapActor,myEdgeActor,&EdgesUpdateActor,hilight,update); -} - -void -SVTK_RenderWindowInteractor -::setEdgeData(const int& theCellIndex, - SALOME_Actor* theMapActor, - const int& theEdgeIndex, - SVTK_Actor* theActor ) -{ - TColStd_IndexedMapOfInteger MapIndex; - MapIndex.Add(theCellIndex); - MapIndex.Add(theEdgeIndex); - theActor->MapEdge(theMapActor,MapIndex); + if(GENERATE_SUIT_EVENTS) + emit KeyReleased( event ); } +