Salome HOME
merge BR_v14_rc
[modules/hydro.git] / src / HYDROData / HYDROData_Channel.cxx
index 3ac722fbfa3be33792efb4322131ddcf7fe812c3..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 )
 {
 }
 
@@ -126,11 +127,6 @@ TopoDS_Shape HYDROData_Channel::GetShape3D() const
   return getShape3D();
 }
 
-//TopoDS_Wire HYDROData_Channel::GetLeftBank() const
-//{
-//
-//}
-
 bool HYDROData_Channel::CreatePresentations( const Handle(HYDROData_Polyline3D)& theGuideLine,
                                              const Handle(HYDROData_Profile)&    theProfile,
                                              PrsDefinition&                      thePrs )
@@ -234,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 );
@@ -323,11 +319,6 @@ void HYDROData_Channel::Update()
   SetShape3D( aResultPrs.myPrs3D );
   SetTopShape( aResultPrs.myPrs2D );
 
-//  TopoDS_Wire aPrevLeftBank = GetLeftBank();
-//  if ( ! aPrevLeftBank.IsNull() )
-//    ClearReferenceObjects( DataTag_LeftBank );
-//  SetReferenceObject( aResultPrs.myLeftBank, DataTag_LeftBank );
-
   // Create groups for channel
   TopTools_SequenceOfShape aLeftBankEdges;
   HYDROData_ShapesTool::ExploreShapeToShapes( aResultPrs.myLeftBank, TopAbs_EDGE, aLeftBankEdges );
@@ -411,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;
 }
@@ -431,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 )
@@ -450,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;
 }
@@ -470,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);
+}