+
+void HYDROGUI_Module::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* )
+{
+ double X, Y, Z;
+ bool doShow = false;
+ HYDROGUI_Displayer* aDisplayer = getDisplayer();
+ if ( aDisplayer )
+ aDisplayer->SaveCursorViewPosition( theViewWindow );
+ doShow = aDisplayer->GetCursorViewCoordinates( theViewWindow, X, Y, Z );
+
+ if ( doShow )
+ {
+ // Show the coordinates in the status bar
+ SUIT_Desktop* aDesktop = getApp()->desktop();
+ if ( aDesktop && aDesktop->statusBar() )
+ {
+ gp_Pnt aWPnt( X, Y, Z );
+ int aStudyId = application()->activeStudy()->id();
+ HYDROData_Document::Document( aStudyId )->Transform( aWPnt, false );
+ double WX = aWPnt.X(), WY = aWPnt.Y();
+
+ QString aXStr = HYDROGUI_Tool::GetCoordinateString( X, true );
+ QString anYStr = HYDROGUI_Tool::GetCoordinateString( Y, true );
+ QString aWXStr = HYDROGUI_Tool::GetCoordinateString( WX, true );
+ QString aWYStr = HYDROGUI_Tool::GetCoordinateString( WY, true );
+ QString aMsg = tr( "COORDINATES_INFO" );
+ aMsg = aMsg.arg( aXStr ).arg( anYStr ).arg( aWXStr ).arg( aWYStr );
+ aDesktop->statusBar()->showMessage( aMsg );
+ }
+ }
+}
+
+/**
+ * Returns stack of active operations;
+ */
+QStack<HYDROGUI_Operation*>& HYDROGUI_Module::getActiveOperations()
+{
+ return myActiveOperationMap;
+}
+
+/**
+ * Returns the module active operation. If the active operation is show/hide,
+ * the method returns the previous operation if it is.
+ */
+HYDROGUI_Operation* HYDROGUI_Module::activeOperation()
+{
+ HYDROGUI_Operation* anOp = !myActiveOperationMap.empty() ? myActiveOperationMap.top() : 0;
+
+ if ( dynamic_cast<HYDROGUI_ShowHideOp*>( anOp ) )
+ {
+ QVectorIterator<HYDROGUI_Operation*> aVIt( myActiveOperationMap );
+ aVIt.toBack();
+ aVIt.previous(); // skip the top show/hide operation
+ anOp = aVIt.hasPrevious() ? aVIt.previous() : 0;
+ }
+
+ return anOp;
+}
+
+/*!
+ * \brief Virtual public slot
+ *
+ * This method is called after the object inserted into data view to update their visibility state
+ * This is default implementation
+ */
+void HYDROGUI_Module::onObjectClicked( SUIT_DataObject* theObject, int theColumn )
+{
+ if ( !isActiveModule() )
+ return;
+
+ HYDROGUI_DataObject* hydroObject = dynamic_cast<HYDROGUI_DataObject*>( theObject );
+
+ // change visibility of object
+ if ( !hydroObject || theColumn != SUIT_DataObject::VisibilityId )
+ return;
+
+ SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( getApp()->objectBrowser()->model() );
+
+ QString id = theObject->text( theObject->customData( Qtx::IdType ).toInt() );
+ Qtx::VisibilityState visState = treeModel->visibilityState( id );
+ if ( visState == Qtx::UnpresentableState )
+ return;
+
+ visState = visState == Qtx::ShownState ? Qtx::HiddenState : Qtx::ShownState;
+ treeModel->setVisibilityState( id, visState );
+
+ bool vis = visState == Qtx::ShownState;
+ if ( vis == isObjectVisible( HYDROGUI_Tool::GetActiveViewId( this ), hydroObject->modelObject() ) )
+ return;
+
+ setObjectVisible( HYDROGUI_Tool::GetActiveViewId( this ), hydroObject->modelObject(), vis );
+
+ update( UF_OCCViewer | ( visState == Qtx::ShownState ? UF_FitAll : 0 ) );
+}