#include <SVTK_ViewModel.h>
#include <SVTK_Selector.h>
+#include <OCCViewer_ViewPort3d.h>
+
+#include <GEOMUtils.hxx>
+
#include <QAction>
#include <QApplication>
#include <QGraphicsSceneMouseEvent>
#include <QMenu>
+#include <QMouseEvent>
+#include <QStatusBar>
static int ViewManagerId = 0;
HYDROGUI_Tool::setOCCActionShown( this, OCCViewer_ViewWindow::MaximizedId, false );
+ ViewManagerList anOCCViewManagers;
+ anApp->viewManagers( OCCViewer_Viewer::Type(), anOCCViewManagers );
+ foreach ( const SUIT_ViewManager* aViewManager, anOCCViewManagers ) {
+ connect( aViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
+ this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
+ foreach( SUIT_ViewWindow* aViewWindow, aViewManager->getViews() ) {
+ OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( aViewWindow );
+ if ( aViewFrame && aViewFrame->getViewPort() ) {
+ aViewFrame->getViewPort()->installEventFilter( this );
+ }
+ }
+ }
+
return aRes;
}
getApp()->removeViewManager( aViewManager );
myViewManagerMap.clear();
+ ViewManagerList anOCCViewManagers;
+ getApp()->viewManagers( OCCViewer_Viewer::Type(), anOCCViewManagers );
+ foreach ( const SUIT_ViewManager* aViewManager, anOCCViewManagers ) {
+ disconnect( aViewManager, SIGNAL( mouseMove( SUIT_ViewWindow*, QMouseEvent* ) ),
+ this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
+ }
+
myObjectStateMap.clear();
myShapesMap.clear();
myVTKPrsMap.clear();
theObj->removeEventFilter( this );
}
}
+ else if ( theObj->inherits( "OCCViewer_ViewPort" ) )
+ {
+ 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( 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
aViewFrame->onTopView();
HYDROGUI_Tool::setOCCActionShown( aViewFrame, OCCViewer_ViewWindow::MaximizedId, false );
+
+ OCCViewer_ViewPort3d* aViewPort = aViewFrame->getViewPort();
+ if ( aViewPort ) {
+ aViewPort->installEventFilter( this );
+ }
}
}
}
aSelectionMgr->setSelected( aList );
}
}
+
+void HYDROGUI_Module::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* 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;
+ }
+
+ gp_Pnt aPnt = GEOMUtils::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 ) );
+ }
+}
\ No newline at end of file