]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
3D presentation for lin.interp. stream
authorisn <isn@opencascade.com>
Mon, 1 Apr 2019 17:02:43 +0000 (20:02 +0300)
committerisn <isn@opencascade.com>
Mon, 1 Apr 2019 17:03:06 +0000 (20:03 +0300)
src/HYDROData/HYDROData_StreamLinearInterpolation.cxx

index b731c0881ae7388b4ed24c3786be68133ca87d82..6c7016187bf3c1ea3c83ed625a3bcc6bbdc68f7f 100644 (file)
@@ -54,6 +54,9 @@
 #include <Geom_Plane.hxx>
 #include <TopoDS_Wire.hxx>
 #include <BRepLib.hxx>
+#include <BRepLib_MakePolygon.hxx>
+#include <TopoDS_Compound.hxx>
+#include <BRep_Builder.hxx>
 
 static std::vector<gp_Pnt2d> GetProfileUZPoints(const Handle(HYDROData_Profile)& theProfile)
 {
@@ -487,6 +490,14 @@ void HYDROData_StreamLinearInterpolation::Perform(const HYDROData_SequenceOfObje
     InsertPoints(profilesPoints[i], nbPointsToInsert);
   }
 
+  TopoDS_Compound cmp2d;
+  if ( buildPresentationShapes)
+  {
+    BRep_Builder().MakeCompound(cmp2d);
+    BRep_Builder().Add(cmp2d, prsDef.myLeftBank);
+    BRep_Builder().Add(cmp2d, prsDef.myRightBank);
+  }
+
   for (int i=0;i<profilesPoints.size()-1;i++)
   {
     const std::vector<gp_Pnt2d>& prof1 = profilesPoints[i];
@@ -543,8 +554,26 @@ void HYDROData_StreamLinearInterpolation::Perform(const HYDROData_SequenceOfObje
         HYDROData_Bathymetry::AltitudePoint AP(profile_points3d(k).X(), profile_points3d(k).Y(), profile_points3d(k).Z());
         outBathypoints.push_back(AP);
       }
+      if (buildPresentationShapes)
+      {
+        if (m==0 || i == profilesPoints.size()-2 && param == indToParam.rbegin()->second) //if last prof1/prof2 segment => take a last profile too
+        {
+          BRepLib_MakePolygon PM;
+          for (int k=1;k<=profile_points3d.Length();k++)
+            PM.Add(gp_Pnt(profile_points3d(k)));
+          if (PM.IsDone())
+          {
+            const TopoDS_Wire& resW = PM.Wire();
+            BRep_Builder().Add(cmp2d, resW);
+          }
+        }
+      }
     }
   }
+  if (buildPresentationShapes)
+  {
+    prsDef.myPrs3D = cmp2d;
+  }
   //outBathy->SetAltitudePoints(bathypoints);
 }