Salome HOME
Merge commit '0d956a814' into pre/IMPS_2016
[modules/hydro.git] / src / HYDROData / HYDROData_PolylineOperator.cxx
index 43fb6799520b45b8e48c4b31bbd961c3d72ccba0..07387a6e9d0cf085fba22e6aca6e2ee26cee61fc 100644 (file)
@@ -487,13 +487,22 @@ bool HYDROData_PolylineOperator::Extract( const Handle(HYDROData_Document)& theD
       LSE.Append(E);
     }
 
-    BRepLib_MakeWire WM;
-    WM.Add(LSE);
-    TopoDS_Shape aShapeW;
-    if (WM.IsDone())
-      aShapeW = WM.Wire();
-    else
-      continue;
+
+    TopoDS_Shape aShapeOut;
+    if (LSE.Extent() == 1)
+    {
+      aShapeOut = LSE.First();
+    }
+    else if (LSE.Extent() > 1)
+    {
+      BRepLib_MakeWire WM;
+      WM.Add(LSE);
+      if (WM.IsDone())
+        aShapeOut = WM.Wire();
+      else
+        continue;
+    }
+    else continue;
 
     Handle( HYDROData_PolylineXY ) aPolyline = 
       Handle( HYDROData_PolylineXY )::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) );
@@ -501,7 +510,7 @@ bool HYDROData_PolylineOperator::Extract( const Handle(HYDROData_Document)& theD
     if( aPolyline.IsNull() )
       return false;
 
-    aPolyline->SetShape( aShapeW );
+    aPolyline->SetShape( aShapeOut );
 
     int anIndex = 0;
     QString aName = K;