Salome HOME
debug salome tests
[modules/hydro.git] / src / HYDROData / HYDROData_PolylineOperator.cxx
index 43fb6799520b45b8e48c4b31bbd961c3d72ccba0..c89d189fbdb99c3de39fd93c618b26b20570e45f 100644 (file)
@@ -53,7 +53,7 @@
 #include <TopTools_IndexedMapOfShape.hxx>
 #include <BRepLib_MakeWire.hxx>
 
-#define _DEVDEBUG_
+//#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 #include <BRepTools.hxx>
 #include <sstream>
@@ -218,7 +218,7 @@ bool HYDROData_PolylineOperator::split( const Handle( HYDROData_Document )& theD
   for (int aPSI = 0; aPSI < aPSCount; ++aPSI)
   {
     HYDROData_TopoCurve aCurve;
-    //DEBTRACE("Initialize curve " << aPSI);
+    DEBTRACE("Initialize curve " << aPSI);
     if (!aCurve.Initialize(aCurves[aPSI]))
     {
       continue;
@@ -238,11 +238,11 @@ bool HYDROData_PolylineOperator::split( const Handle( HYDROData_Document )& theD
       aSplitCurves.end();
     for (int iw=0; aCIt != aLastCIt; ++aCIt, iw++)
     {
-      /*std::stringstream brepName;
+      std::stringstream brepName;
       brepName << "theSplitWire_";
       brepName << iw;
       brepName << ".brep";
-      BRepTools::Write(aCIt->Wire() , brepName.str().c_str() );*/
+      BRepTools::Write(aCIt->Wire() , brepName.str().c_str() );
       aResult.push_back(aCIt->Wire());
     }
   }
@@ -310,7 +310,7 @@ bool HYDROData_PolylineOperator::CreatePolylines( const Handle( HYDROData_Docume
   const QColor& theColor = theOldPolyline->GetWireColor();
 
   int n = theShapes.size();
-  //DEBTRACE("theShapes.size() "<< n);
+  DEBTRACE("theShapes.size() "<< n);
   int anIndex = 1;
   for( int i=0; i<n; i++ )
   {
@@ -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;