Salome HOME
copyrights are updated
[modules/hydro.git] / src / HYDROData / HYDROData_Channel.cxx
index 819e3030d2dd7df1223c628ddb4425aae9517c21..9a8fae8657a8a4250d6aa3263216fb65d23de6a4 100644 (file)
@@ -25,8 +25,8 @@
 #include "HYDROData_Projection.h"
 #include "HYDROData_ShapesGroup.h"
 #include "HYDROData_ShapesTool.h"
-#include "HYDROData_Pipes.h"
 #include "HYDROData_Stream.h"
+#include "HYDROData_Tool.h"
 
 #include <BRepBuilderAPI_MakeWire.hxx>
 
@@ -72,7 +72,7 @@ IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Channel,HYDROData_ArtificialObject)
 
 
 HYDROData_Channel::HYDROData_Channel()
-: HYDROData_ArtificialObject()
+: HYDROData_ArtificialObject( Geom_3d )
 {
 }
 
@@ -113,16 +113,6 @@ HYDROData_SequenceOfObjects HYDROData_Channel::GetAllReferenceObjects() const
   return aResSeq;
 }
 
-TopoDS_Shape HYDROData_Channel::GetTopShape() const
-{
-  return getTopShape();
-}
-
-TopoDS_Shape HYDROData_Channel::GetShape3D() const
-{
-  return getShape3D();
-}
-
 bool HYDROData_Channel::CreatePresentations( const Handle(HYDROData_Polyline3D)& theGuideLine,
                                              const Handle(HYDROData_Profile)&    theProfile,
                                              PrsDefinition&                      thePrs )
@@ -220,7 +210,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 );
@@ -352,26 +342,16 @@ bool HYDROData_Channel::IsHas2dPrs() const
   return true;
 }
 
-QColor HYDROData_Channel::DefaultFillingColor()
+QColor HYDROData_Channel::DefaultFillingColor() const
 {
   return QColor( Qt::blue );
 }
 
-QColor HYDROData_Channel::DefaultBorderColor()
+QColor HYDROData_Channel::DefaultBorderColor() const
 {
   return QColor( Qt::transparent );
 }
 
-QColor HYDROData_Channel::getDefaultFillingColor() const
-{
-  return DefaultFillingColor();
-}
-
-QColor HYDROData_Channel::getDefaultBorderColor() const
-{
-  return DefaultBorderColor();
-}
-
 bool HYDROData_Channel::SetGuideLine( const Handle(HYDROData_Polyline3D)& theGuideLine )
 {
   Handle(HYDROData_Polyline3D) aPrevGuideLine = GetGuideLine();
@@ -392,7 +372,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;
 }
@@ -412,7 +392,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 )
@@ -431,7 +411,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;
 }
@@ -451,11 +431,22 @@ 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
 {
-  return KIND_OBSTACLE_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);
+}