Salome HOME
Profile object creation.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Module.cxx
index 8c413c578dadaab5aca8693882eff4d684580e52..36b56ec1efd0c3c04888c8acfbbea805c2481bc8 100644 (file)
@@ -153,6 +153,8 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
   connect( anApp, SIGNAL( operationFinished( const QString&, const QString&, const QStringList& ) ), 
            this, SLOT( onExternalOperationFinished( const QString&, const QString&, const QStringList& ) ) );
 
+  HYDROGUI_Tool::setOCCActionShown( this, OCCViewer_ViewWindow::MaximizedId, false );
+
   return aRes;
 }
 
@@ -179,6 +181,8 @@ bool HYDROGUI_Module::deactivateModule( SUIT_Study* theStudy )
   disconnect( getApp(), SIGNAL( operationFinished( const QString&, const QString&, const QStringList& ) ), 
               this, SLOT( onExternalOperationFinished( const QString&, const QString&, const QStringList& ) ) );
 
+  HYDROGUI_Tool::setOCCActionShown( this, OCCViewer_ViewWindow::MaximizedId, true );
+
   return LightApp_Module::deactivateModule( theStudy );
 }
 
@@ -225,6 +229,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   bool anIsMustBeUpdatedImage = false;
   bool anIsPolyline = false;
   bool anIsProfile = false;
+  bool anAllAreProfiles = false;
   bool anIsBathymetry = false;
   bool anIsCalculation = false;
   bool anIsImmersibleZone = false;
@@ -242,6 +247,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
 
   // check the selected data model objects
   HYDROData_SequenceOfObjects aSeq = HYDROGUI_Tool::GetSelectedObjects( this );
+  int aNbOfSelectedProfiles = 0;
   for( Standard_Integer anIndex = 1, aLength = aSeq.Length(); anIndex <= aLength; anIndex++ )
   {
     Handle(HYDROData_Entity) anObject = aSeq.Value( anIndex );
@@ -282,8 +288,10 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       }
       else if( anObject->GetKind() == KIND_POLYLINEXY )
         anIsPolyline = true;
-      else if( anObject->GetKind() == KIND_PROFILE )
+      else if( anObject->GetKind() == KIND_PROFILE ) {
         anIsProfile = true;
+        aNbOfSelectedProfiles++;
+      }
       else if( anObject->GetKind() == KIND_CALCULATION )
         anIsCalculation = true;
       else if( anObject->GetKind() == KIND_IMMERSIBLE_ZONE )
@@ -303,6 +311,10 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
     anIsGeomObject = HYDROData_Tool::IsGeometryObject( anObject );
   }
 
+  // Check if all selected objects are profiles
+  anAllAreProfiles = ( aNbOfSelectedProfiles > 0 ) &&
+                     ( aNbOfSelectedProfiles == aSeq.Length() );
+
   // check the selected partitions
   if( !anIsSelectedDataObjects && anIsObjectBrowser )
   {
@@ -320,6 +332,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
         case KIND_PROFILE:
           theMenu->addAction( action( CreateProfileId ) );
           theMenu->addAction( action( ImportProfilesId ) );
+          theMenu->addAction( action( AllGeoreferencementId ) );
           break;
         case KIND_VISUAL_STATE:
           theMenu->addAction( action( SaveVisualStateId ) );
@@ -390,6 +403,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       else if( anIsProfile )
       {
         theMenu->addAction( action( EditProfileId ) );
+        theMenu->addAction( action( SelectedGeoreferencementId ) );
         theMenu->addSeparator();
       }
       else if( anIsCalculation )
@@ -418,6 +432,11 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       }
     }
 
+    if ( anAllAreProfiles ) {
+      theMenu->addAction( action( SelectedGeoreferencementId ) );
+      theMenu->addSeparator();
+    }
+
     theMenu->addAction( action( DeleteId ) );
     theMenu->addSeparator();
 
@@ -972,6 +991,8 @@ void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theViewWindow )
     if( OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( theViewWindow ) )
     {
       aViewFrame->onTopView();
+
+      HYDROGUI_Tool::setOCCActionShown( aViewFrame, OCCViewer_ViewWindow::MaximizedId, false );
     }
   }
 }