]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Merge branch 'BR_H2018_3' into BR_2018_V8_5
authorPaul RASCLE <paul.rascle@edf.fr>
Wed, 10 Apr 2019 14:01:10 +0000 (16:01 +0200)
committerPaul RASCLE <paul.rascle@edf.fr>
Wed, 10 Apr 2019 14:01:10 +0000 (16:01 +0200)
src/HYDROData/HYDROData_Channel.cxx
src/HYDROData/HYDROData_DTM.cxx
src/HYDROData/HYDROData_Entity.cxx
src/HYDROData/HYDROData_Profile.cxx
src/HYDROData/HYDROData_Stream.cxx
src/HYDROData/HYDROData_Stream.h
src/HYDROPy/HYDROData_Channel.sip
src/HYDROPy/HYDROData_Stream.sip

index 1a08a52d628a515bc0150585f20937dffd3126ac..0f31fc1f1ac737f96bbd000251424402e7e918d7 100644 (file)
@@ -88,7 +88,7 @@ HYDROData_Channel::~HYDROData_Channel()
 }
 
 QStringList HYDROData_Channel::DumpToPython( const QString& thePyScriptPath,
-                                             MapOfTreatedObjects& theTreatedObjects ) const
+  MapOfTreatedObjects& theTreatedObjects ) const
 {
   QStringList aResList = dumpObjectCreation( theTreatedObjects );
   QString aName = GetObjPyName();
@@ -96,8 +96,25 @@ QStringList HYDROData_Channel::DumpToPython( const QString& thePyScriptPath,
   Handle(HYDROData_Polyline3D) aRefGideLine = GetGuideLine();
   setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aRefGideLine, "SetGuideLine" );
 
-  Handle(HYDROData_Profile) aRefProfile = GetProfile();
-  setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aRefProfile, "SetProfile" );
+  bool mode = GetProfileMode();
+  QString aMode = mode ? "True" : "False" ;
+  aResList << QString( "%1.SetProfileMode( %2 )" ).arg( aName ).arg( aMode );
+
+  if (mode)
+  {
+    Handle(HYDROData_Profile) aRefProfile = GetProfile();
+    setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aRefProfile, "SetProfile" );
+  }
+  else
+  {
+    QString aLC = QString::number( GetLCValue(), 'f', 3 );
+    QString aDeltaZ = QString::number( GetDeltaZValue(), 'f', 3 );
+    QString aCoteZ = QString::number( GetCoteZValue(), 'f', 3 );
+
+    aResList << QString( "%1.SetLCValue( %2 )" ).arg( aName ).arg( aLC );
+    aResList << QString( "%1.SetDeltaZValue( %2 )" ).arg( aName ).arg( aDeltaZ );
+    aResList << QString( "%1.SetCoteZValue( %2 )" ).arg( aName ).arg( aCoteZ );
+  }
 
   aResList << QString( "%1.SetEquiDistance( %2 )" ).arg( aName ).arg( GetEquiDistance() );
 
@@ -106,6 +123,7 @@ QStringList HYDROData_Channel::DumpToPython( const QString& thePyScriptPath,
   aResList << QString( "" );
 
   return aResList;
+
 }
 
 HYDROData_SequenceOfObjects HYDROData_Channel::GetAllReferenceObjects() const
@@ -179,7 +197,7 @@ bool HYDROData_Channel::internalCreatePresentations( bool mode,
   if (mode)
   {
     if (!ReverseXCoord)
-      aProfileWire = TopoDS::Wire( theProfile->GetShape3D(true, false) ); //temp force rebuild
+      aProfileWire = TopoDS::Wire( theProfile->GetShape3D(false, false) ); //temp force rebuild
     else
       aProfileWire = TopoDS::Wire( theProfile->GetShape3D(true, true));
   }
index ec4537bbfb6f28359997262732b5f7572683913a..7349737fd0a534fd77182d3018106c2925c31996 100644 (file)
@@ -864,7 +864,8 @@ void HYDROData_DTM::ProfileDiscretization( const Handle(HYDROData_Profile)& theP
     }
     double xmin, ymin, xmax, ymax;
     intersect_bndbox.Get(xmin, ymin, xmax, ymax);
-    if (Abs(xmax-xmin)>PREC)
+    //if (Abs(xmax-xmin)>PREC)
+    if (intersection_nb >= 1)
     {
       double u_mid, u_wid;
       if( !CalcMidWidth( intersect_bndbox, u_mid, u_wid ) )
index 7084a5be8aab1ff44167dd7d9505b9df658ae4f2..387cd70a7ccb609e44647eaca195b23fbd9e77c8 100644 (file)
@@ -965,7 +965,7 @@ int HYDROData_Entity::GetInteger( int theTag, int theDefValue ) const
   Handle(TDataStd_Integer) anAttr;
   TDF_Label aLabel = myLab.FindChild( theTag );
   if( !aLabel.FindAttribute( TDataStd_Integer::GetID(), anAttr ) )
-    return 0;
+    return theDefValue;
 
   return anAttr->Get();
 }
index f8f8ba20a94879b282f2963f9ce9fb39424c34cf..059f299a3cd2dbc7a25fec168deeba27d82af49b 100644 (file)
@@ -796,7 +796,7 @@ HYDROData_Profile::ProfilePoint HYDROData_Profile::GetBottomPoint(bool IsConvert
      gp_Lin aMidLin( aMiddlePoint2d, gp::DZ() );
      TopoDS_Edge aMidEdge = BRepLib_MakeEdge( aMidLin );
 
-     const TopoDS_Wire& aProf = TopoDS::Wire( GetShape3D() );
+    TopoDS_Shape aProf = TopoDS::Wire( GetShape3D() );
      if (aProf.IsNull())
        return aMiddlePoint;
      TopoDS_Iterator anIt( aProf );
index 8b458e2a608d075efa342e498e8dc916408e5b10..e75dc36897878f078e09ed44db9b59fc5793e0f1 100644 (file)
@@ -119,6 +119,10 @@ QStringList HYDROData_Stream::DumpToPython( const QString&       thePyScriptPath
   QStringList aResList = dumpObjectCreation( theTreatedObjects );
   QString aName = GetObjPyName();
 
+  int interpMethod = GetInterpolationMethod();
+  QString anInterpMethod = QString::number( interpMethod );
+  aResList << QString( "%1.SetInterpolationMethod( %2 )" ).arg( aName ).arg( anInterpMethod );
+
   Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis();
   setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aHydAxis, "SetHydraulicAxis" );
 
@@ -135,10 +139,25 @@ QStringList HYDROData_Stream::DumpToPython( const QString&       thePyScriptPath
     setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aBottomPolyline, "SetBottomPolyline" );
   }
 
-  QString aDDZs = QString::number( GetDDZ(), 'f', 3 );
-  QString aSSteps = QString::number( GetSpatialStep(), 'f', 3 );
-  aResList << QString( "%1.SetDDZ( %2 )" ).arg( aName ).arg( aDDZs );
-  aResList << QString( "%1.SetSpatialStep( %2 )" ).arg( aName ).arg( aSSteps );
+  if (interpMethod==0)
+  {
+    QString aDDZs = QString::number( GetDDZ(), 'f', 3 );
+    QString aSSteps = QString::number( GetSpatialStep(), 'f', 3 );
+    aResList << QString( "%1.SetDDZ( %2 )" ).arg( aName ).arg( aDDZs );
+    aResList << QString( "%1.SetSpatialStep( %2 )" ).arg( aName ).arg( aSSteps );
+  }
+  else if (interpMethod==1)
+  {
+    Handle(HYDROData_PolylineXY) aLeftBank = GetLeftBank();
+    setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aLeftBank, "SetLeftBank" );
+    Handle(HYDROData_PolylineXY) aRightBank = GetRightBank();
+    setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aRightBank, "SetRightBank" );
+
+    QString aHaxStep = QString::number( GetHaxStep(), 'f', 3 );
+    QString aNbProfilePoints = QString::number( GetNbProfilePoints() );
+    aResList << QString( "%1.SetHaxStep( %2 )" ).arg( aName ).arg( aHaxStep );
+    aResList << QString( "%1.SetNbProfilePoints( %2 )" ).arg( aName ).arg( aNbProfilePoints );
+  }
 
   aResList << QString( "" );
   aResList << QString( "%1.Update()" ).arg( aName );
index 4d57079ab7871faa6ec3b5a059bd8fa0e939a83b..fb65c98394ad67afce3c45280d64a7aff39b94e3 100644 (file)
@@ -187,13 +187,13 @@ public:
    */
   HYDRODATA_EXPORT virtual void RemoveHydraulicAxis();
 
-  HYDRODATA_EXPORT Handle(HYDROData_PolylineXY) GetLeftBank() const;
+  HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetLeftBank() const;
 
-  HYDRODATA_EXPORT void SetLeftBank( const Handle(HYDROData_PolylineXY)& theBank );
+  HYDRODATA_EXPORT virtual void SetLeftBank( const Handle(HYDROData_PolylineXY)& theBank );
 
-  HYDRODATA_EXPORT Handle(HYDROData_PolylineXY) GetRightBank() const;
+  HYDRODATA_EXPORT virtual Handle(HYDROData_PolylineXY) GetRightBank() const;
 
-  HYDRODATA_EXPORT void SetRightBank( const Handle(HYDROData_PolylineXY)& theBank );
+  HYDRODATA_EXPORT virtual void SetRightBank( const Handle(HYDROData_PolylineXY)& theBank );
   /**
    * Returns true if profile has the intersection with the given hydraulic axis.
    * Returns the parameter of inresection point on axis if axis is presented by one curve,
@@ -274,7 +274,7 @@ public:
   HYDRODATA_EXPORT void   SetDDZ( double theDDZ );
   
   HYDRODATA_EXPORT int    GetInterpolationMethod() const;
-  HYDRODATA_EXPORT void   SetInterpolationMethod( int theDDZ );
+  HYDRODATA_EXPORT void   SetInterpolationMethod( int theMode );
 
   HYDRODATA_EXPORT double GetSpatialStep() const;
   HYDRODATA_EXPORT void   SetSpatialStep( double theSpatialStep );
index f1ef457ad7c53d671555f6108ba9be2d45425a1b..4d4e4449641229491a64b3746a66440f1ac4e0f5 100644 (file)
@@ -138,6 +138,18 @@ public:
 
   void SetEquiDistance( double );
   double GetEquiDistance() const;
+
+  void SetLCValue( double );
+  double GetLCValue() const;
+  
+  void SetDeltaZValue( double );
+  double GetDeltaZValue() const;
+  
+  void SetCoteZValue( double );
+  double GetCoteZValue() const;
+
+  void SetProfileMode( bool );
+  bool GetProfileMode() const; 
   
 protected:
 
index cb233c5c8f03c41143c9cc5766f7dbae654ecdca..b4b78c40a93e1d6e18809b714086de3fb2ab2ff7 100644 (file)
@@ -176,6 +176,72 @@ public:
     }
   %End
 
+  /**
+   * Sets the left bank object for stream. (LISM method only)
+   */
+  void SetLeftBank( HYDROData_PolylineXY theBank )
+  [void ( const opencascade::handle<HYDROData_PolylineXY>& )];
+  %MethodCode
+    Handle(HYDROData_PolylineXY) aRef =
+      Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
+    if ( !aRef.IsNull() )
+    {
+      Py_BEGIN_ALLOW_THREADS
+      sipSelfWasArg ? sipCpp->HYDROData_Stream::SetLeftBank( aRef ):
+                      sipCpp->SetLeftBank( aRef );
+      Py_END_ALLOW_THREADS
+    }
+  %End
+
+  /**
+   * Returns the left bank object of stream. (LISM method only)
+   */
+  HYDROData_PolylineXY GetLeftBank() const
+  [opencascade::handle<HYDROData_PolylineXY> ()];
+  %MethodCode
+    Handle(HYDROData_PolylineXY) aRef;
+
+    Py_BEGIN_ALLOW_THREADS
+    aRef = sipSelfWasArg ? sipCpp->HYDROData_Stream::GetLeftBank() :
+                           sipCpp->GetLeftBank();
+    Py_END_ALLOW_THREADS
+
+    sipRes = (HYDROData_PolylineXY*)createPointer( aRef );
+  %End
+
+  /**
+   * Sets the right bank object for stream. (LISM method only)
+   */
+  void SetRightBank( HYDROData_PolylineXY theBank )
+  [void ( const opencascade::handle<HYDROData_PolylineXY>& )];
+  %MethodCode
+    Handle(HYDROData_PolylineXY) aRef =
+      Handle(HYDROData_PolylineXY)::DownCast( createHandle( a0 ) );
+    if ( !aRef.IsNull() )
+    {
+      Py_BEGIN_ALLOW_THREADS
+      sipSelfWasArg ? sipCpp->HYDROData_Stream::SetRightBank( aRef ):
+                      sipCpp->SetRightBank( aRef );
+      Py_END_ALLOW_THREADS
+    }
+  %End
+
+  /**
+   * Returns the right bank object of stream. (LISM method only)
+   */
+  HYDROData_PolylineXY GetRightBank() const
+  [opencascade::handle<HYDROData_PolylineXY> ()];
+  %MethodCode
+    Handle(HYDROData_PolylineXY) aRef;
+
+    Py_BEGIN_ALLOW_THREADS
+    aRef = sipSelfWasArg ? sipCpp->HYDROData_Stream::GetRightBank() :
+                           sipCpp->GetRightBank();
+    Py_END_ALLOW_THREADS
+
+    sipRes = (HYDROData_PolylineXY*)createPointer( aRef );
+  %End
+
   /**
    * Add interpolated profiles into the stream.
    * \param theInterpolator the interpolator
@@ -184,15 +250,30 @@ public:
   virtual bool Interpolate( HYDROData_IProfilesInterpolator* theInterpolator );
 
   /**
-   * Set vertical slicing step for profiles interpolation.
+   * Set vertical slicing step for profiles interpolation. (DTM method only)
    */
   void   SetDDZ( double theDDZ );
 
   /**
-   * Set horizontal step for profiles interpolation.
+   * Set horizontal step for profiles interpolation. (DTM method only)
    */
   void   SetSpatialStep( double theSpatialStep );
 
+  /**
+   * Set interpolation method (DTM or LISM).
+   */
+  void   SetInterpolationMethod( int theMode );
+
+  /**
+   * Set horizontal step on hydr. axis for profiles interpolation. (LISM method)
+   */
+  void   SetHaxStep( double theHaxStep );
+
+  /**
+   * Set number of points on profiles to insert (LISM method)
+   */
+  void   SetNbProfilePoints( int theNbPoints );
+
 protected:
   /**
    * Creates new object in the internal data structure. Use higher level objects