Salome HOME
Refs #279 - Copy for the view position coordinates
[modules/hydro.git] / src / HYDROData / HYDROData_Stream.cxx
index b9605be3b0074cee90ec60837dc18b35b9391eac..9aa3d2354deeac809724251d2732cfea92240dea 100644 (file)
@@ -6,6 +6,7 @@
 #include "HYDROData_Profile.h"
 #include "HYDROData_ShapesGroup.h"
 #include "HYDROData_ShapesTool.h"
+#include "HYDROData_IAltitudeObject.h"
 
 #include <TDataStd_RealArray.hxx>
 
@@ -142,6 +143,12 @@ Handle(Geom_BSplineCurve) HYDROData_Stream::buildInterpolationCurve(
 }
 
 void HYDROData_Stream::Update()
+{
+  updateProfilesOrder();
+  UpdatePrs();
+}
+
+void HYDROData_Stream::UpdatePrs()
 {
   HYDROData_NaturalObject::Update();
 
@@ -286,6 +293,14 @@ void HYDROData_Stream::Update()
 
   // Create the stream groups
   createGroupObjects();
+
+  // This peace of code is for testing of functionality of altitude,
+  // will be removed by adv when testing will be finished
+  Handle(HYDROData_IAltitudeObject) anAltObj = GetAltitudeObject();
+  gp_XY aTestPnt( 5, 0 );
+  anAltObj->GetAltitudeForPoint( aTestPnt );
+  // End of test code
+
 }
 
 QColor HYDROData_Stream::DefaultFillingColor()
@@ -312,6 +327,51 @@ bool HYDROData_Stream::IsValidAsAxis( const Handle(HYDROData_PolylineXY)& theHyd
   return true;
 }
 
+TopoDS_Shape getShapeFromGroup( const HYDROData_SequenceOfObjects& theGroups,
+                                const int                          theGroupId )
+{
+  TopoDS_Shape aResShape;
+  if ( theGroups.Length() != 4 )
+    return aResShape;
+
+  Handle(HYDROData_ShapesGroup) aGroup =
+    Handle(HYDROData_ShapesGroup)::DownCast( theGroups.Value( theGroupId ) );
+  if ( aGroup.IsNull() )
+    return aResShape;
+
+  TopTools_SequenceOfShape aGroupShapes;
+  aGroup->GetShapes( aGroupShapes );
+
+  if ( !aGroupShapes.IsEmpty() )
+    aResShape = aGroupShapes.First();
+
+  return aResShape;
+}
+
+TopoDS_Shape HYDROData_Stream::GetLeftShape() const
+{
+  HYDROData_SequenceOfObjects aGroups = GetGroups();
+  return getShapeFromGroup( aGroups, 1 );
+}
+
+TopoDS_Shape HYDROData_Stream::GetRightShape() const
+{
+  HYDROData_SequenceOfObjects aGroups = GetGroups();
+  return getShapeFromGroup( aGroups, 2 );
+}
+
+TopoDS_Shape HYDROData_Stream::GetInletShape() const
+{
+  HYDROData_SequenceOfObjects aGroups = GetGroups();
+  return getShapeFromGroup( aGroups, 3 );
+}
+
+TopoDS_Shape HYDROData_Stream::GetOutletShape() const
+{
+  HYDROData_SequenceOfObjects aGroups = GetGroups();
+  return getShapeFromGroup( aGroups, 4 );
+}
+
 QColor HYDROData_Stream::getDefaultFillingColor() const
 {
   return DefaultFillingColor();