]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs# 1917 + protection against null shapes wires in GetMiddlePoint()
authorisn <isn@opencascade.com>
Wed, 27 Mar 2019 15:20:03 +0000 (18:20 +0300)
committerisn <isn@opencascade.com>
Wed, 27 Mar 2019 15:20:58 +0000 (18:20 +0300)
src/HYDROData/HYDROData_Profile.cxx
src/HYDROGUI/HYDROGUI_ChannelDlg.cxx
src/HYDROGUI/HYDROGUI_ChannelDlg.h
src/HYDROGUI/HYDROGUI_ChannelOp.cxx

index 3ec51658388f91e87bb42227d60c85d7de49d490..f8f8ba20a94879b282f2963f9ce9fb39424c34cf 100644 (file)
@@ -796,7 +796,10 @@ HYDROData_Profile::ProfilePoint HYDROData_Profile::GetBottomPoint(bool IsConvert
      gp_Lin aMidLin( aMiddlePoint2d, gp::DZ() );
      TopoDS_Edge aMidEdge = BRepLib_MakeEdge( aMidLin );
 
-     TopoDS_Iterator anIt( TopoDS::Wire( GetShape3D() )  );
+     const TopoDS_Wire& aProf = TopoDS::Wire( GetShape3D() );
+     if (aProf.IsNull())
+       return aMiddlePoint;
+     TopoDS_Iterator anIt( aProf );
      for ( ; anIt.More(); anIt.Next()) {
        const TopoDS_Edge& anEdge = TopoDS::Edge( anIt.Value() );
 
index cf10670196a538306eaedc2d2ff4bac04e95d0dc..597417043f8ffe0601089a3ae57df32efe61e61f 100644 (file)
@@ -82,7 +82,7 @@ HYDROGUI_ChannelDlg::HYDROGUI_ChannelDlg( HYDROGUI_Module* theModule, const QStr
   myProfileLabel = new QLabel( tr( "CHANNEL_PROFILE" ), aParamGroup);
 
   myProfileModeButton = new QRadioButton( tr( "VIA_PROFILE" ), myObjectNameGroup );
-  QRadioButton* ProfileModeButton2 = new QRadioButton( tr( "PREDEF" ), myObjectNameGroup );
+  myProfileModeButton2 = new QRadioButton( tr( "PREDEF" ), myObjectNameGroup );
 
   QGridLayout* aParamsLayout = new QGridLayout( aParamGroup );
   aParamsLayout->setMargin( 5 );
@@ -91,7 +91,7 @@ HYDROGUI_ChannelDlg::HYDROGUI_ChannelDlg( HYDROGUI_Module* theModule, const QStr
   aParamsLayout->addWidget( myGuideLines, 0, 1 );
     
   aParamsLayout->addWidget( myProfileModeButton, 1, 0 );
-  aParamsLayout->addWidget( ProfileModeButton2, 1, 1 );
+  aParamsLayout->addWidget( myProfileModeButton2, 1, 1 );
 
   aParamsLayout->addWidget( myProfileLabel, 2, 0 );
   aParamsLayout->addWidget( myProfiles, 2, 1 );
@@ -256,6 +256,12 @@ bool HYDROGUI_ChannelDlg::getProfileMode()
   return myProfileModeButton->isChecked();
 }
 
+void HYDROGUI_ChannelDlg::setProfileMode(bool mode)
+{
+  myProfileModeButton->setChecked(mode);
+  myProfileModeButton2->setChecked(!mode);
+}
+
 double HYDROGUI_ChannelDlg::getEquiDistance() const
 {
   return myEquiDistance->value();
index 5af01f6aee65fb5e46193c4e2b5c2147ef414f21..5974271777901e51f3e877d8cc7aaffeded67de0 100644 (file)
@@ -58,6 +58,8 @@ public:
   void                       setInvertDirection( bool isChecked );
 
   bool                       getProfileMode();
+  void                       setProfileMode(bool);
+
   
   double                     getLCValue() const;
   void                       setLCValue( double );
@@ -96,6 +98,8 @@ protected:
   QtxDoubleSpinBox*          myCoteZVal;
 
   QRadioButton*              myProfileModeButton;
+  QRadioButton*              myProfileModeButton2;
+
 };
 
 #endif
index 2a1ede2301d9fec763fdfda2f07b3ac07de2323c..60059a2b8d2a517561f37473b2bc523980d63f57 100644 (file)
@@ -68,6 +68,8 @@ void HYDROGUI_ChannelOp::startOperation()
     myEditedObject.Nullify();
 
   QString aSelectedGuideLine, aSelectedProfile;
+  bool profile_mode = true;
+
 
   QString anObjectName = HYDROGUI_Tool::GenerateObjectName( module(), tr( "DEFAULT_CHANNEL_NAME" ) );
   if ( myIsEdit )
@@ -86,6 +88,8 @@ void HYDROGUI_ChannelOp::startOperation()
       Handle(HYDROData_Profile) aRefProfile = myEditedObject->GetProfile();
       if ( !aRefProfile.IsNull() )
         aSelectedProfile = aRefProfile->GetName();
+
+      profile_mode = myEditedObject->GetProfileMode();
     }
   }
 
@@ -120,7 +124,15 @@ void HYDROGUI_ChannelOp::startOperation()
   aPanel->setProfileName( aSelectedProfile );
 
   if( !myEditedObject.IsNull() )
+  {
     aPanel->setEquiDistance( myEditedObject->GetEquiDistance() );
+    if (!profile_mode) //predef
+    {
+      aPanel->setLCValue( myEditedObject->GetLCValue() );
+      aPanel->setCoteZValue( myEditedObject->GetCoteZValue() );
+      aPanel->setDeltaZValue( myEditedObject->GetDeltaZValue() );
+    }
+  }
   else
     aPanel->setEquiDistance( 1.0 );
 
@@ -137,6 +149,7 @@ void HYDROGUI_ChannelOp::startOperation()
     aPanel->setInvertDirection( false );
 
   aPanel->blockSignals( false );
+  aPanel->setProfileMode(profile_mode);
 
   onCreatePreview();
 }