X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_SplitPolylinesOp.cxx;h=ff9f45c210f6a55387b94329ff61ae4d820d046d;hb=80b3ef265c1b8564a52097094156256956017ae1;hp=d6556fbafd290457137764ebfd5f4d8ef492d42c;hpb=8db2a634f4e26d4c58a13c3c09e319eab144e067;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx b/src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx index d6556fba..ff9f45c2 100644 --- a/src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx +++ b/src/HYDROGUI/HYDROGUI_SplitPolylinesOp.cxx @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include #include #include @@ -79,23 +81,34 @@ bool HYDROGUI_SplitPolylinesOp::processApply( int& theUpdateFlags, if ( !aPanel ) return false; - QString aName = aPanel->GetResultName(); + //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-2; //TODO HYDROData_PolylineOperator anOp; switch( aPanel->GetMode() ) { case HYDROGUI_SplitPolylinesDlg::ByPoint: - anOp.Split( doc(), aName.toLatin1().data(), aMainPolyline, aPoint ); + anOp.Split( doc(), aMainPolyline, aPoint, aTolerance ); break; case HYDROGUI_SplitPolylinesDlg::ByTool: - anOp.Split( doc(), aName.toLatin1().data(), aMainPolyline, aToolPolyline ); + { + bool isIntersected = false; + anOp.Split( doc(), aMainPolyline, aToolPolyline, aTolerance, isIntersected); + + if (!isIntersected) + { + const QString aTitle = tr("SPLIT_POLYLINE_BY_TOOL_WARNING_TITLE"); + const QString aMsg = tr("SPLIT_POLYLINE_BY_TOOL_WARNING_MSG"); + SUIT_MessageBox::warning(module()->getApp()->desktop(), aTitle, aMsg); + } break; + } case HYDROGUI_SplitPolylinesDlg::Split: - anOp.Split( doc(), aName.toLatin1().data(), aPolylinesList ); + anOp.Split( doc(), aPolylinesList, aTolerance ); break; }