Salome HOME
middle z for 3D guideline
[modules/hydro.git] / src / HYDROData / HYDROData_Polyline3D.cxx
index 67098e95e274235ccb83efbfa17e14121e35af3c..0ae2a44f78e3e65e919c0955940336a2db242c4d 100644 (file)
@@ -28,6 +28,9 @@
 
 #include <BRep_Tool.hxx>
 
+#include <Bnd_Box.hxx>
+#include <BRepBndLib.hxx>
+
 #include <Geom_BSplineCurve.hxx>
 
 #include <gp_Pnt2d.hxx>
@@ -207,6 +210,12 @@ void HYDROData_Polyline3D::Update()
   TopoDS_Wire aResWire = HYDROData_PolylineXY::BuildWire( aSectionType, anIsSectionClosed, aResPoints );
   SetTopShape( aResWire );
   SetShape3D( aResWire );
+
+  double Xmin=0, Xmax=0, Ymin=0, Ymax=0, Zmin=-9999, Zmax=-9999;
+  Bnd_Box B;
+  BRepBndLib::Add(aResWire, B);
+  B.Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
+  SetMiddleZ((Zmin+Zmax)/2.);
 } 
 
 QColor HYDROData_Polyline3D::DefaultFillingColor()