Salome HOME
patch for install error on Linux
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Polyline.cxx
index 7225e2e690591fd4a35a81ea4140d84fd5203024..90e3e42e26a6340e81b11163af2280beb5730de6 100644 (file)
@@ -87,10 +87,20 @@ void HYDROGUI_Polyline::Compute(const Handle(PrsMgr_PresentationManager3d)& aPre
   Handle(Graphic3d_AspectLine3d) anAspect = new Graphic3d_AspectLine3d( aColor, aType, anWidth );
 
   TopExp_Explorer Exp1 ( myshape, TopAbs_EDGE );
+  Bnd_Box BB;
+  BRepBndLib::AddClose(myshape, BB);
+  double xmin, xmax, ymin, ymax, zmin, zmax;
+  double devCoeff = 0.05;
+  if (!BB.IsVoid())
+  {
+    BB.Get(xmin, ymin, zmin, xmax, ymax, zmax); //ignore Z coord
+    double minSide = Min(Abs(xmax - xmin), Abs(ymax - ymin));
+    devCoeff = minSide > 50 ? 0.05 : minSide / 3000;
+  }
   for ( ; Exp1.More(); Exp1.Next() )
   {
     TopoDS_Edge anEdge = TopoDS::Edge( Exp1.Current() );
-    Handle( Graphic3d_ArrayOfPolylines ) anArray = BuildEdgePresentation( anEdge, 0.1 );
+    Handle( Graphic3d_ArrayOfPolylines ) anArray = BuildEdgePresentation( anEdge, devCoeff );
     if( !anArray.IsNull() )
     {
       aGroup->SetPrimitivesAspect( anAspect );