]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #492: implement dump to Python
authormzn <mzn@opencascade.com>
Wed, 1 Apr 2015 08:41:51 +0000 (11:41 +0300)
committermzn <mzn@opencascade.com>
Wed, 1 Apr 2015 08:41:51 +0000 (11:41 +0300)
src/HYDROData/HYDROData_Stream.cxx
src/HYDROData/HYDROData_Stream.h
src/HYDROPy/HYDROData_Stream.sip

index 33de721c8aa96391b7a28711c81311c0ea71f950..bf9480c9d0655c6f214d6d3a1539d3c8f4130e4e 100644 (file)
@@ -122,10 +122,10 @@ QStringList HYDROData_Stream::DumpToPython( MapOfTreatedObjects& theTreatedObjec
     setPythonReferenceObject( theTreatedObjects, aResList, aProfile, "AddProfile" );
   }
 
-  // Create bottom polyline if exists
+  // Set bottom polyline if exists
   const Handle(HYDROData_Polyline3D) aBottomPolyline = GetBottomPolyline();
   if ( !aBottomPolyline.IsNull() ) {
-    aResList << QString( "%1.GenerateBottomPolyline();" ).arg( aName );
+    setPythonReferenceObject( theTreatedObjects, aResList, aBottomPolyline, "SetBottomPolyline" );
   }
 
   aResList << QString( "" );
@@ -1123,6 +1123,17 @@ Handle(HYDROData_Polyline3D) HYDROData_Stream::GetBottomPolyline() const
            GetReferenceObject( DataTag_BottomPolyline ) );
 }
 
+bool HYDROData_Stream::SetBottomPolyline( const Handle(HYDROData_Polyline3D)& theBottom )
+{
+  if ( theBottom.IsNull() ) {
+    return false;
+  }
+
+  SetReferenceObject( theBottom, DataTag_BottomPolyline );
+
+  return true;
+}
+
 bool HYDROData_Stream::Interpolate( HYDROData_IProfilesInterpolator* theInterpolator )
 {
   // Get the document
index b80d588a24c8ff41d0eefbf69cdd0045aaaa607e..2af9abae1f332d1e3ba35d344997da3b71a17cbd 100644 (file)
@@ -244,6 +244,13 @@ public:
    * Returns reference bottom polyline object of stream.
    */
   HYDRODATA_EXPORT virtual Handle(HYDROData_Polyline3D) GetBottomPolyline() const;
+  
+  /**
+   * Sets reference bottom polyline object for stream.
+   * \param theBottom the polyline 3D
+   * \return true in case of success
+   */
+  HYDRODATA_EXPORT virtual bool SetBottomPolyline( const Handle(HYDROData_Polyline3D)& theBottom );
 
   /**
    * Add interpolated profiles into the stream.
index 1b64e7c8bb997fd9a63095a19684a4333d0b0dd7..8b17eff4253652e4cf7264bed98e5a6bf1122f09 100644 (file)
@@ -168,6 +168,23 @@ public:
     sipRes = (HYDROData_Polyline3D*)createPointer( aRef );
   %End
   
+  /**
+   * Sets reference bottom polyline object for stream.
+   */
+  bool SetBottomPolyline( HYDROData_Polyline3D theBottom )
+  [bool ( const Handle_HYDROData_Polyline3D& )];
+  %MethodCode
+    Handle(HYDROData_Polyline3D) aRef =
+      Handle(HYDROData_Polyline3D)::DownCast( createHandle( a0 ) );
+    if ( !aRef.IsNull() )
+    {
+      Py_BEGIN_ALLOW_THREADS
+      sipRes = sipSelfWasArg ? sipCpp->HYDROData_Stream::SetBottomPolyline( aRef ):
+                               sipCpp->SetBottomPolyline( aRef );
+      Py_END_ALLOW_THREADS
+    }
+  %End
+
 protected:
   /**
    * Creates new object in the internal data structure. Use higher level objects