Salome HOME
refs #430: incorrect coordinates in dump polyline
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Module.cxx
index 5e03c1293bc9f618117c01a2533da0bd0b0c711c..bd3b1a16fa0fe47439fc07b4111fd68ba84b5baf 100644 (file)
@@ -332,6 +332,18 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   bool anIsDummyObject3D = false;
   bool anIsGroup = false;
   bool anIsObjectCanBeColored = false;
+  bool isRoot = false;
+
+  SUIT_SelectionMgr* aSelectionMgr = getApp()->selectionMgr();
+  SUIT_DataOwnerPtrList anOwners;
+  aSelectionMgr->selected( anOwners );
+  if( anIsObjectBrowser && anOwners.size()==1 )
+  {
+    QString anEntry = anOwners[0]->keyString();
+    LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( getApp()->activeStudy() );
+    if( aStudy )
+      isRoot = aStudy->isComponent( anEntry );
+  }
 
   // Check the selected GEOM objects (take into account the Object Browser only)
   if ( anIsObjectBrowser ) {
@@ -668,6 +680,9 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
     theMenu->addSeparator();
     theMenu->addAction( action( CopyViewerPositionId ) );
   }
+
+  if( isRoot )
+    theMenu->addAction( action( EditLocalCSId ) );
 }
 
 void HYDROGUI_Module::update( const int flags )
@@ -1486,21 +1501,31 @@ void HYDROGUI_Module::restoreSelection( const QStringList& theEntryList )
 
 void HYDROGUI_Module::onMouseMove( SUIT_ViewWindow* theViewWindow, QMouseEvent* )
 {
-  double aX, aY, aZ;
+  double X, Y, Z;
   bool doShow = false;
   HYDROGUI_Displayer* aDisplayer = getDisplayer();
   if ( aDisplayer )
     aDisplayer->SaveCursorViewPosition( theViewWindow );
-    doShow = aDisplayer->GetCursorViewCoordinates( theViewWindow, aX, aY, aZ );
+    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() ) {
-      QString aXStr = HYDROGUI_Tool::GetCoordinateString( aX );
-      QString anYStr = HYDROGUI_Tool::GetCoordinateString( aY );
-      aDesktop->statusBar()->showMessage( tr("COORDINATES_INFO").arg( aXStr ).arg( anYStr ) );
+    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 );
     }
   }
 }