const gp_Pnt2d& thePoint,
double theTolerance ) const
{
+ if (thePolyline.IsNull())
+ {
+ return false;
+ }
+
std::vector<gp_Pnt2d> aPointsList( 1 );
aPointsList[0] = thePoint;
std::vector<TopoDS_Wire> aCurves;
bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_Document )& theDoc,
const Handle( HYDROData_PolylineXY )& thePolyline,
const Handle( HYDROData_PolylineXY )& theTool,
- double theTolerance ) const
+ double theTolerance,
+ bool& theIsIntersected) const
{
+ if (thePolyline.IsNull() || theTool.IsNull())
+ {
+ return false;
+ }
+
HYDROData_SequenceOfObjects aSeq;
aSeq.Append( theTool );
- return split( theDoc, thePolyline, aSeq, theTolerance, -1 );
+ return split( theDoc, thePolyline, aSeq, theTolerance, -1, theIsIntersected);
}
bool HYDROData_PolylineOperator::Split( const Handle( HYDROData_Document )& theDoc,
for( int i=f; i<=l; i++ )
{
Handle( HYDROData_PolylineXY ) aPolyline = Handle( HYDROData_PolylineXY )::DownCast( thePolylines.Value( i ) );
- if( !split( theDoc, aPolyline, thePolylines, theTolerance, i ) )
+ bool isIntersected;
+ if( !split( theDoc, aPolyline, thePolylines, theTolerance, i, isIntersected) )
return false;
}
return true;
const Handle( HYDROData_PolylineXY )& thePolyline,
const HYDROData_SequenceOfObjects& theTools,
double theTolerance,
- int theIgnoreIndex ) const
+ int theIgnoreIndex,
+ bool& theIsIntersected) const
{
+ theIsIntersected = false;
+
+ if (thePolyline.IsNull())
+ {
+ return false;
+ }
+
std::vector<TopoDS_Wire> aCurves;
GetWires(thePolyline, aCurves);
std::vector<TopoDS_Wire> aToolCurves;
{
Handle( HYDROData_PolylineXY ) aToolPolyline =
Handle( HYDROData_PolylineXY )::DownCast( theTools.Value( i ) );
- std::vector<TopoDS_Wire> aTCurves;
- GetWires(aToolPolyline, aTCurves);
- append( aToolCurves, aTCurves);
+ if (!aToolPolyline.IsNull())
+ {
+ std::vector<TopoDS_Wire> aTCurves;
+ GetWires(aToolPolyline, aTCurves);
+ append( aToolCurves, aTCurves);
+ }
}
+ if (aToolCurves.empty())
+ {
+ return false;
+ }
+
const int aPSCount = aCurves.size();
const int aTSCount = aToolCurves.size();
std::vector<TopoDS_Shape> aResult;
}
std::deque<HYDROData_TopoCurve> aSplittedCurves;
- aCurve.Cut(aParams, aSplittedCurves);
+ theIsIntersected |= aCurve.Cut(aParams, aSplittedCurves);
std::deque<HYDROData_TopoCurve>::const_iterator aCIt =
aSplittedCurves.begin();
std::deque<HYDROData_TopoCurve>::const_iterator aLastCIt =