Salome HOME
patch for install error on Linux
[modules/hydro.git] / src / HYDROData / HYDROData_Stream.cxx
index 6fbe09f427b49dfd6f0b40f0ff61d6affdb08254..022cc30664aecc4bf3708c748afc7dab995dd0f0 100644 (file)
@@ -167,7 +167,8 @@ Handle(Geom_BSplineCurve) HYDROData_Stream::buildInterpolationCurve(
 
 void HYDROData_Stream::Update()
 {
-  updateProfilesOrder();
+  if (!GetHydraulicAxis().IsNull())
+    updateProfilesOrder();
 
   // Update bottom polyline if exists
   const Handle(HYDROData_Polyline3D) aBottomPolyline = GetBottomPolyline();
@@ -184,6 +185,8 @@ void HYDROData_Stream::Update()
   Handle_HYDROData_DTM dtm = DTM();
   dtm->Update();
   UpdatePrs( dtm );
+
+  HYDROData_NaturalObject::Update();
 }
 
 bool HYDROData_Stream::IsHas2dPrs() const
@@ -336,6 +339,7 @@ double HYDROData_Stream::GetDDZ() const
 void HYDROData_Stream::SetDDZ( double theDDZ )
 {
   DTM()->SetDDZ( theDDZ );
+  Changed( Geom_3d );
 }
   
 double HYDROData_Stream::GetSpatialStep() const
@@ -346,6 +350,7 @@ double HYDROData_Stream::GetSpatialStep() const
 void HYDROData_Stream::SetSpatialStep( double theSpatialStep )
 {
   DTM()->SetSpatialStep( theSpatialStep );
+  Changed( Geom_3d );
 }
 
 bool HYDROData_Stream::SetHydraulicAxis( const Handle(HYDROData_PolylineXY)& theAxis )
@@ -513,13 +518,12 @@ bool HYDROData_Stream::AddProfile( const Handle(HYDROData_Profile)& theProfile )
   if ( theProfile.IsNull() )
     return false;
 
-  Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis();
-  if ( aHydAxis.IsNull() )
-    return false;
// Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis();
// if ( aHydAxis.IsNull() )
//   return false;
 
   TopoDS_Face aPlane;
-  if(!BuildFace(aHydAxis, aPlane))
-    return false;
+  BuildRefFace( aPlane );
 
   Standard_Real aPar(.0);
   if ( HasReference( theProfile, DataTag_Profile ) || !HasIntersection( theProfile, aPlane, aPar ) )
@@ -640,13 +644,13 @@ void HYDROData_Stream::RemoveProfiles()
 void HYDROData_Stream::insertProfileInToOrder( const Handle(HYDROData_Profile)& theProfile,
                                                const int                        theBeforeIndex )
 {
-  Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis();
-  if ( theProfile.IsNull() || aHydAxis.IsNull() )
+  //Handle(HYDROData_PolylineXY) aHydAxis = GetHydraulicAxis();
+  if ( theProfile.IsNull() )
     return; 
 
-  TopoDS_Wire aHydraulicWire = TopoDS::Wire( aHydAxis->GetShape() );
+  //TopoDS_Wire aHydraulicWire = TopoDS::Wire( aHydAxis->GetShape() );
   TopoDS_Wire aProfileWire = TopoDS::Wire( theProfile->GetTopShape() );
-  if ( aHydraulicWire.IsNull() || aProfileWire.IsNull() )
+  if ( aProfileWire.IsNull() )
     return;
 
   if ( theBeforeIndex == -1 )
@@ -655,25 +659,9 @@ void HYDROData_Stream::insertProfileInToOrder( const Handle(HYDROData_Profile)&
     InsertReferenceObject( theProfile, DataTag_Profile, theBeforeIndex );
 }
 
-bool HYDROData_Stream::BuildFace( const Handle(HYDROData_PolylineXY)& theHydAxis,
-                                  TopoDS_Face&                        thePlane )
+void HYDROData_Stream::BuildRefFace( TopoDS_Face& thePlane )
 {
-  //if ( !IsValidAsAxis( theHydAxis ) )
-   // return false;
-
-  //TopoDS_Wire aHydraulicWire = TopoDS::Wire( theHydAxis->GetShape() );
-  //
-  //gp_Ax2 aX2(gp::XOY());
-  //gp_Ax3 aX3(aX2);
-  //gp_Pln aPln(aX3);   
-  //Bnd_Box B;
-  //BRepBndLib::Add(aHydraulicWire,B);
-  //Standard_Real axmin,aymin,azmin,axmax,aymax,azmax;
-  //B.Get(axmin,aymin,azmin,axmax,aymax,azmax);
-  //BRepBuilderAPI_MakeFace aMkr(aPln, axmin-500., axmax+500., aymin-500., aymax+500.); // to be tuned later according max/ Profile deviation
-  //if(!aMkr.IsDone() || aMkr.Shape().IsNull()) return false;
   thePlane = BRepBuilderAPI_MakeFace(gp_Pln(gp_Pnt(0,0,0),gp_Dir(0,0,1))).Face();
-  return true;
 }
 
 void HYDROData_Stream::updateProfilesOrder()
@@ -690,8 +678,7 @@ void HYDROData_Stream::updateProfilesOrder()
     return; 
 
   TopoDS_Face aPlane;
-  if ( !BuildFace( aHydAxis, aPlane ) )
-    return;
+  BuildRefFace( aPlane );
 
   Standard_Real aPar( .0 );
 
@@ -1104,6 +1091,6 @@ void HYDROData_Stream::CreatePresentations( const Handle(TColgp_HArray1OfPnt)
 
   thePrs.myPrs3D = newCmp;
 
-  HYDROData_DTM::Get2dFaceFrom3dPres( newCmp, TopoDS::Face(thePrs.myPrs2D) );
+  HYDROData_DTM::Get2dFaceFrom3dPres( newCmp, TopoDS::Face(thePrs.myPrs2D) ); //__TODO
 
 }
\ No newline at end of file