Salome HOME
refs #548: Names of axes intersect each other.
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_SplitPolylinesOp.cxx
index afb40918ae12b7abb5dd77a85f50c5cd1a569e74..bab464a82a4bd0a52192f7620a5fbbcf6daa91e4 100644 (file)
@@ -22,6 +22,7 @@
 #include <HYDROGUI_UpdateFlags.h>
 #include <HYDROGUI_Shape.h>
 #include <HYDROData_PolylineOperator.h>
+#include <HYDROData_Document.h>
 #include <LightApp_Application.h>
 #include <OCCViewer_ViewModel.h>
 #include <OCCViewer_ViewManager.h>
@@ -78,22 +79,24 @@ bool HYDROGUI_SplitPolylinesOp::processApply( int& theUpdateFlags,
   if ( !aPanel )
     return false;
 
+  //TODO: QString aName = aPanel->GetResultName();
   Handle( HYDROData_PolylineXY ) aMainPolyline = aPanel->GetMainPolyline();
   Handle( HYDROData_PolylineXY ) aToolPolyline = aPanel->GetToolPolyline();
   HYDROData_SequenceOfObjects aPolylinesList = aPanel->GetPolylines();
   gp_Pnt2d aPoint = aPanel->GetPoint();
+  double aTolerance = 1E-7; //TODO
 
   HYDROData_PolylineOperator anOp;
   switch( aPanel->GetMode() )
   {
   case HYDROGUI_SplitPolylinesDlg::ByPoint:
-    anOp.Split( aMainPolyline, aPoint );
+    anOp.Split( doc(), aMainPolyline, aPoint, aTolerance );
     break;
   case HYDROGUI_SplitPolylinesDlg::ByTool:
-    anOp.Split( aMainPolyline, aToolPolyline );
+    anOp.Split( doc(), aMainPolyline, aToolPolyline, aTolerance );
     break;
   case HYDROGUI_SplitPolylinesDlg::Split:
-    anOp.Split( aPolylinesList );
+    anOp.Split( doc(), aPolylinesList, aTolerance );
     break;
   }
   
@@ -152,14 +155,17 @@ void HYDROGUI_SplitPolylinesOp::OnUpdatePreview()
       {
         gp_Pnt2d aPnt = aPanel->GetPoint();
         TopoDS_Vertex aVertex = BRepLib_MakeVertex( gp_Pnt( aPnt.X(), aPnt.Y(), 0.0 ) );
-        aBB.Add( aCmp, aPanel->GetMainPolyline()->GetShape() );
+        if( !aPanel->GetMainPolyline().IsNull() )
+          aBB.Add( aCmp, aPanel->GetMainPolyline()->GetShape() );
         aBB.Add( aCmp, aVertex );
         break;
       }
     case HYDROGUI_SplitPolylinesDlg::ByTool:
       {
-        aBB.Add( aCmp, aPanel->GetMainPolyline()->GetShape() );
-        aBB.Add( aCmp, aPanel->GetToolPolyline()->GetShape() );
+        if( !aPanel->GetMainPolyline().IsNull() )
+          aBB.Add( aCmp, aPanel->GetMainPolyline()->GetShape() );
+        if( !aPanel->GetToolPolyline().IsNull() )
+          aBB.Add( aCmp, aPanel->GetToolPolyline()->GetShape() );
         break;
       }
     case HYDROGUI_SplitPolylinesDlg::Split: