]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
bug #274: now the imported polyline is projected always on the plane XY
authorasl <asl@opencascade.com>
Mon, 23 Dec 2013 09:10:58 +0000 (09:10 +0000)
committerasl <asl@opencascade.com>
Mon, 23 Dec 2013 09:10:58 +0000 (09:10 +0000)
src/HYDROData/HYDROData_PolylineXY.cxx

index 46e5205e0f1c764b730123f4abeacb7d64b20401..06ea1bbced9f51ecdc0b6ef79ab27c1bbaec59d9 100755 (executable)
@@ -9,6 +9,8 @@
 #include <BRep_Builder.hxx>
 #include <BRepBuilderAPI_MakeEdge.hxx>
 #include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepOffsetAPI_NormalProjection.hxx>
 
 #include <GeomAPI_ProjectPointOnCurve.hxx>
 #include <GeomAdaptor_Curve.hxx>
@@ -21,6 +23,7 @@
 
 #include <gp_Pnt.hxx>
 #include <gp_XY.hxx>
+#include <gp_Pln.hxx>
 
 #include <NCollection_Map.hxx>
 
@@ -45,6 +48,7 @@
 #include <TopExp_Explorer.hxx>
 #include <ShapeAnalysis_FreeBounds.hxx>
 #include <TopoDS.hxx>
+
 #include <QColor>
 #include <QPainterPath>
 #include <QVariant>
@@ -300,7 +304,17 @@ bool HYDROData_PolylineXY::ImportShape( const TopoDS_Shape& theShape )
         aShape = aMakeWire.Wire();
     }
 
-    setPolylineShape( aShape );
+    gp_Pln aPlane( gp_Pnt( 0, 0, 0 ), gp_Dir( 0, 0, 1 ) );
+    BRepBuilderAPI_MakeFace aMakeFace( aPlane );
+    aMakeFace.Build();
+    BRepOffsetAPI_NormalProjection aProj( aMakeFace.Face() );
+    aProj.Add( aShape );
+    aProj.Build();
+    TopoDS_Shape aResult;
+    if( aProj.IsDone() )
+      aResult = aProj.Shape();
+
+    setPolylineShape( aResult );
   }
 
   setEditable( anIsCanBeImported );