Salome HOME
#refs 522 (very draft) //import only
[modules/hydro.git] / src / HYDROData / HYDROData_Stream.cxx
index 8e3cb8eed347522748e753b58bb417ed690b817d..6ffdd0ee43ec1d1110e89b351d5c97bcb11b6e30 100644 (file)
@@ -1184,3 +1184,32 @@ bool HYDROData_Stream::Interpolate( HYDROData_IProfilesInterpolator* theInterpol
 
   return isOK;
 }
+
+void HYDROData_Stream::CopyTo( const Handle(HYDROData_Entity)& theDestination ) const
+{
+  // Get the document
+  Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( myLab );
+  if ( aDocument.IsNull() ) {
+    return;
+  }
+
+  // Call base method
+  HYDROData_Entity::CopyTo( theDestination );
+
+  Handle(HYDROData_Stream) aStreamCopy = 
+    Handle(HYDROData_Stream)::DownCast( theDestination );
+
+  // Copy bottom polyline if exists
+  if ( !aStreamCopy.IsNull() ) {
+    const Handle(HYDROData_Polyline3D) aBottom = GetBottomPolyline();
+    if ( !aBottom.IsNull() ) {
+      aStreamCopy->ClearReferenceObjects( DataTag_BottomPolyline );
+      aStreamCopy->GenerateBottomPolyline();
+      const Handle(HYDROData_Polyline3D) aBottomCopy = aStreamCopy->GetBottomPolyline();
+      if ( !aBottomCopy.IsNull() && !aBottomCopy->GetPolylineXY().IsNull() ) {
+        aBottomCopy->GetPolylineXY()->Update();
+        aBottomCopy->Update();
+      }
+    }
+  }
+}
\ No newline at end of file