]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Context menu item & river object filter were added.
authorstv <stv@opencascade.com>
Mon, 30 Mar 2015 10:12:08 +0000 (13:12 +0300)
committerstv <stv@opencascade.com>
Mon, 30 Mar 2015 10:12:08 +0000 (13:12 +0300)
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_RiverBottomDlg.cxx
src/HYDROGUI/HYDROGUI_RiverBottomDlg.h

index d08d53b5aaa3f980bf9f84d5def5df83aec0635d..85ac5a680af6b18190de351ec2df411681aefc7b 100644 (file)
 #include "HYDROGUI_ImportGeomObjectOp.h"
 #include "HYDROGUI_ShowHideOp.h"
 
+#include <HYDROData_Tool.h>
 #include <HYDROData_Image.h>
+#include <HYDROData_Stream.h>
 #include <HYDROData_Profile.h>
 #include <HYDROData_Lambert93.h>
-#include <HYDROData_Tool.h>
+#include <HYDROData_Polyline3D.h>
 
 #include <HYDROData_OperationsFactory.h>
 
@@ -339,6 +341,7 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
   bool anIsGroup = false;
   bool anIsObjectCanBeColored = false;
   bool isRoot = false;
+  bool isStreamHasBottom = false;
 
   SUIT_SelectionMgr* aSelectionMgr = getApp()->selectionMgr();
   SUIT_DataOwnerPtrList anOwners;
@@ -450,7 +453,13 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       else if( anObjectKind == KIND_OBSTACLE )
         anIsObstacle = true;
       else if( anObjectKind == KIND_STREAM )
+      {
         anIsStream = true;
+        Handle(HYDROData_Stream) aStream = 
+          Handle(HYDROData_Stream)::DownCast( anObject );
+        if ( !aStream.IsNull() )
+            isStreamHasBottom = !aStream->GetBottomPolyline().IsNull();
+      }
       else if( anObjectKind == KIND_CHANNEL )
         anIsChannel = true;
       else if( anObjectKind == KIND_DIGUE )
@@ -599,6 +608,11 @@ void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
       else if( anIsStream )
       {
         theMenu->addAction( action( EditStreamId ) );
+        if ( action( RiverBottom ) )
+        {
+            theMenu->addAction( action( RiverBottom ) );
+            action( RiverBottom )->setEnabled( !isStreamHasBottom );
+        }
         theMenu->addSeparator();
       }
       else if( anIsChannel )
index 7e93c158fec7a212c76ddda5902e27b659671d32..7319277994df9a0c02820da290d561bce43963d1 100644 (file)
 #include "HYDROGUI_Tool.h"
 #include "HYDROGUI_ObjComboBox.h"
 
+#include <HYDROData_Stream.h>
+#include <HYDROData_Polyline3D.h>
+
 #include <QLabel>
 #include <QLayout>
 #include <QComboBox>
 #include <QGroupBox>
 
 HYDROGUI_RiverBottomDlg::HYDROGUI_RiverBottomDlg( HYDROGUI_Module* theModule, const QString& theTitle )
-    : HYDROGUI_InputPanel( theModule, theTitle )
+    : HYDROGUI_InputPanel( theModule, theTitle ),
+    HYDROGUI_ObjComboBoxFilter()
 {
     // Channel name
     QGroupBox* group = new QGroupBox( mainFrame() );
     QBoxLayout* base = new QVBoxLayout( group );
 
     base->addWidget( myRivers = new HYDROGUI_ObjComboBox( theModule, tr( "RIVER_OBJECT" ), KIND_STREAM, group ) );
+    myRivers->setObjectFilter( this );
 
     addWidget( group );
 
@@ -73,6 +78,12 @@ void HYDROGUI_RiverBottomDlg::setRiverName( const QString& theName )
     myRivers->setSectedObject( theName );
 }
 
+bool HYDROGUI_RiverBottomDlg::isOk( const Handle(HYDROData_Entity)& theEntity ) const
+{
+    Handle(HYDROData_Stream) aStream = Handle(HYDROData_Stream)::DownCast(theEntity);
+    return !aStream.IsNull() && aStream->GetBottomPolyline().IsNull();
+}
+
 void HYDROGUI_RiverBottomDlg::onRiverChanged( const QString& )
 {
     updateState();
index d0af44202849f5ba5596db2e337814f30caa4a59..f958af96d4ae8dc0a37111d396f3090540c3e697 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-#ifndef HYDROGUI_RIVERBOTTOMDlg_H
-#define HYDROGUI_RIVERBOTTOMDlg_H
+#ifndef HYDROGUI_RIVERBOTTOMDLG_H
+#define HYDROGUI_RIVERBOTTOMDLG_H
 
 #include "HYDROGUI_InputPanel.h"
 
+#include "HYDROGUI_ObjComboBox.h"
+
 class QComboBox;
-class HYDROGUI_ObjComboBox;
 
-class HYDROGUI_RiverBottomDlg : public HYDROGUI_InputPanel
+class HYDROGUI_RiverBottomDlg : public HYDROGUI_InputPanel, public HYDROGUI_ObjComboBoxFilter
 {
   Q_OBJECT
 
@@ -41,6 +42,8 @@ public:
   QString                    getRiverName() const;
   void                       setRiverName( const QString& );
 
+  virtual bool               isOk( const Handle(HYDROData_Entity)& ) const;
+
 private slots:
   void                       onRiverChanged( const QString& );