Salome HOME
merge BR_v14_rc
[modules/hydro.git] / src / HYDROData / HYDROData_Channel.cxx
index 77e27791f228814c84a78f646a24dd58b026149f..a2e8453750cabad42d08be0af5be9692c63c6601 100644 (file)
@@ -27,6 +27,7 @@
 #include "HYDROData_ShapesTool.h"
 #include "HYDROData_Pipes.h"
 #include "HYDROData_Stream.h"
+#include "HYDROData_Tool.h"
 
 #include <BRepBuilderAPI_MakeWire.hxx>
 
@@ -75,7 +76,7 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Channel,HYDROData_ArtificialObject)
 
 
 HYDROData_Channel::HYDROData_Channel()
-: HYDROData_ArtificialObject()
+: HYDROData_ArtificialObject( Geom_3d )
 {
 }
 
@@ -142,8 +143,14 @@ bool HYDROData_Channel::CreatePresentations( const Handle(HYDROData_Polyline3D)&
   }
 
 #ifdef DEB_CHANNEL
-  BRepTools::Write( aPathWire, "guideline.brep" );
-  BRepTools::Write( aProfileWire, "profile.brep" );
+  std::string brepName = "guideline_";
+  brepName += theGuideLine->GetName().toStdString();
+  brepName += ".brep";
+  BRepTools::Write( aPathWire, brepName.c_str() );
+  brepName = "profile_";
+  brepName += theGuideLine->GetName().toStdString();
+  brepName += ".brep";
+  BRepTools::Write( aProfileWire, brepName.c_str() );
 #endif
 
   // Pre-processing
@@ -223,7 +230,7 @@ bool HYDROData_Channel::CreatePresentations( const Handle(HYDROData_Polyline3D)&
   }
 
   // Get the profile middle point ( 3D )
-  gp_Pnt aMiddlePoint( theProfile->GetMiddlePoint() );
+  gp_Pnt aMiddlePoint( theProfile->GetMiddlePoint( true ) );
 
   // Translate the profile to each point on the guide line ( 3D )
   Handle(TColgp_HArray1OfPnt) anArrayOfFPnt = new TColgp_HArray1OfPnt(1, aNbPoints );
@@ -395,7 +402,7 @@ bool HYDROData_Channel::SetGuideLine( const Handle(HYDROData_Polyline3D)& theGui
   SetReferenceObject( theGuideLine, DataTag_GuideLine );
 
   // Indicate model of the need to update the chanel presentation
-  SetToUpdate( true );
+  Changed( Geom_3d );
 
   return true;
 }
@@ -415,7 +422,7 @@ void HYDROData_Channel::RemoveGuideLine()
   ClearReferenceObjects( DataTag_GuideLine );
 
   // Indicate model of the need to update the chanel presentation
-  SetToUpdate( true );
+  Changed( Geom_3d );
 }
 
 bool HYDROData_Channel::SetProfile( const Handle(HYDROData_Profile)& theProfile )
@@ -434,7 +441,7 @@ bool HYDROData_Channel::SetProfile( const Handle(HYDROData_Profile)& theProfile
   SetReferenceObject( theProfile, DataTag_Profile );
 
   // Indicate model of the need to update the chanel presentation
-  SetToUpdate( true );
+  Changed( Geom_3d );
 
   return true;
 }
@@ -454,12 +461,24 @@ void HYDROData_Channel::RemoveProfile()
   ClearReferenceObjects( DataTag_Profile );
 
   // Indicate model of the need to update the chanel presentation
-  SetToUpdate( true );
+  Changed( Geom_3d );
 }
 
 ObjectKind HYDROData_Channel::getAltitudeObjectType() const
 {
   DEBTRACE("HYDROData_Channel::getAltitudeObjectType");
   return KIND_CHANNEL_ALTITUDE;
+  //return KIND_STREAM_ALTITUDE;
 }
 
+TopoDS_Shape HYDROData_Channel::GetLeftShape() const
+{
+  HYDROData_SequenceOfObjects aGroups = GetGroups();
+  return HYDROData_Tool::getFirstShapeFromGroup( aGroups, 1);
+}
+
+TopoDS_Shape HYDROData_Channel::GetRightShape() const
+{
+  HYDROData_SequenceOfObjects aGroups = GetGroups();
+  return HYDROData_Tool::getFirstShapeFromGroup( aGroups, 2);
+}