#include <SVTK_ViewManager.h>
#include <SVTK_ViewModel.h>
+#include <SVTK_ViewWindow.h>
#include <SVTK_Selector.h>
+#include <SVTK_RenderWindowInteractor.h>
#include <OCCViewer_ViewPort3d.h>
}
}
}
+ else if ( theObj->inherits( "SVTK_ViewWindow" ) )
+ {
+ if( aType == QEvent::Leave )
+ {
+ SUIT_Desktop* aDesktop = getApp()->desktop();
+ if ( aDesktop && aDesktop->statusBar() ) {
+ aDesktop->statusBar()->clearMessage();
+ }
+ }
+ }
return LightApp_Module::eventFilter( theObj, theEvent );
}
connect( theViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
}
+ else if( theViewManager->getType() == SVTK_Viewer::Type() )
+ {
+ connect( theViewManager, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
+ this, SLOT( onViewCreated( SUIT_ViewWindow* ) ) );
+ connect( theViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
+ this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
+ }
createSelector( theViewManager ); // replace the default selector
}
}
}
+ else if( theViewWindow && theViewWindow->inherits( "SVTK_ViewWindow" ) )
+ {
+ if( SVTK_ViewWindow* aViewFrame = dynamic_cast<SVTK_ViewWindow*>( theViewWindow ) )
+ {
+ aViewFrame->installEventFilter( this );
+ }
+ }
}
void HYDROGUI_Module::onViewPortMouseEvent( QGraphicsSceneMouseEvent* theEvent )
{
OCCViewer_ViewWindow* anOCCViewWindow =
dynamic_cast<OCCViewer_ViewWindow*>(theViewWindow);
- if ( !anOCCViewWindow ) {
- return;
- }
-
- // Get the selected point coordinates
- OCCViewer_ViewPort3d* aViewPort = anOCCViewWindow->getViewPort();
- if ( !aViewPort ) {
- return;
- }
+ if ( anOCCViewWindow ) {
+ // Get the selected point coordinates
+ OCCViewer_ViewPort3d* aViewPort = anOCCViewWindow->getViewPort();
+ if ( !aViewPort ) {
+ return;
+ }
- gp_Pnt aPnt = CurveCreator_Utils::ConvertClickToPoint( theEvent->x(), theEvent->y(),
- aViewPort->getView() );
- // Show the coordinates in the status bar
- SUIT_Desktop* aDesktop = getApp()->desktop();
- if ( aDesktop && aDesktop->statusBar() ) {
- QString aX = HYDROGUI_Tool::GetCoordinateString( aPnt.X() );
- QString anY = HYDROGUI_Tool::GetCoordinateString( aPnt.Y() );
- aDesktop->statusBar()->showMessage( tr("COORDINATES_INFO").arg( aX ).arg( anY ) );
+ gp_Pnt aPnt = CurveCreator_Utils::ConvertClickToPoint( theEvent->x(), theEvent->y(),
+ aViewPort->getView() );
+ // Show the coordinates in the status bar
+ SUIT_Desktop* aDesktop = getApp()->desktop();
+ if ( aDesktop && aDesktop->statusBar() ) {
+ QString aX = HYDROGUI_Tool::GetCoordinateString( aPnt.X() );
+ QString anY = HYDROGUI_Tool::GetCoordinateString( aPnt.Y() );
+ aDesktop->statusBar()->showMessage( tr("COORDINATES_INFO").arg( aX ).arg( anY ) );
+ }
+ }
+ else
+ {
+ SVTK_ViewWindow* aViewWindow =
+ dynamic_cast<SVTK_ViewWindow*>(theViewWindow);
+ if ( aViewWindow ) {
+ // Get the selected point coordinates
+ double aCoords[3];
+ SVTK_RenderWindowInteractor* anInteractor = aViewWindow->GetInteractor();
+ if ( anInteractor )
+ {
+ //TODO: Use a WorldPicker to get current coords
+ //anInteractorStyle->ComputeDisplayToWorld( theEvent->x(), theEvent->y(), 0, aCoords );
+ aCoords[0] = theEvent->x();
+ aCoords[1] = theEvent->y();
+ // Show the coordinates in the status bar
+ SUIT_Desktop* aDesktop = getApp()->desktop();
+ if ( aDesktop && aDesktop->statusBar() ) {
+ QString aX = HYDROGUI_Tool::GetCoordinateString( aCoords[0] );
+ QString anY = HYDROGUI_Tool::GetCoordinateString( aCoords[1] );
+ aDesktop->statusBar()->showMessage( tr("COORDINATES_INFO").arg( aX ).arg( anY ) );
+ }
+ }
+ }
}
}
\ No newline at end of file