X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_PolylineXY.cxx;h=18dc1e4c663e2bed89a8a823d1af7ee06fb35f1e;hb=424f8230c9003d00fb27499b2441c4b3a2a28292;hp=a8cb4c0f7c3e837ac5e3e2f5eeed23579e76f7d7;hpb=1c6465288cda49e75392724ddc01aba7cfe4ef68;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_PolylineXY.cxx b/src/HYDROData/HYDROData_PolylineXY.cxx index a8cb4c0f..18dc1e4c 100755 --- a/src/HYDROData/HYDROData_PolylineXY.cxx +++ b/src/HYDROData/HYDROData_PolylineXY.cxx @@ -40,6 +40,8 @@ #define PYTHON_POLYLINEXY_ID "KIND_POLYLINEXY" +const double LOCAL_SELECTION_TOLERANCE = 0.0001; + IMPLEMENT_STANDARD_HANDLE(HYDROData_PolylineXY, HYDROData_IPolyline) IMPLEMENT_STANDARD_RTTIEXT(HYDROData_PolylineXY, HYDROData_IPolyline) @@ -138,13 +140,16 @@ TopoDS_Wire HYDROData_PolylineXY::BuildWire( const SectionType& gp_Pnt aPnt1( aFirstPoint.X(), aFirstPoint.Y(), aFirstPoint.Z() ); gp_Pnt aPnt2( aLastPoint.X(), aLastPoint.Y(), aLastPoint.Z() ); + if ( aPnt1.IsEqual( aPnt2, LOCAL_SELECTION_TOLERANCE ) ) + continue; + TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aPnt1, aPnt2 ).Edge(); aMakeWire.Add( anEdge ); } } else //if( theType == PolylineSection::SECTION_SPLINE ) { - HYDROData_BSplineOperation aBSpline( thePoints, theIsClosed ); + HYDROData_BSplineOperation aBSpline( thePoints, theIsClosed, LOCAL_SELECTION_TOLERANCE ); TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aBSpline.Curve() ).Edge(); aMakeWire.Add( anEdge ); @@ -183,7 +188,7 @@ void HYDROData_PolylineXY::BuildPainterPath( QPainterPath& } else { - HYDROData_BSplineOperation aBSpline( thePoints, theIsClosed ); + HYDROData_BSplineOperation aBSpline( thePoints, theIsClosed, LOCAL_SELECTION_TOLERANCE ); aBSpline.ComputePath( thePath ); } } @@ -296,6 +301,9 @@ double HYDROData_PolylineXY::GetDistance( const int theSectionIndex, const Point& aSectPoint = aSectPointsList.Value( i ); aResDistance += gp_Pnt2d( aPrevPoint ).Distance( aSectPoint ); aPrevPoint = aSectPoint; + + if ( thePointIndex == i - 1 ) + break; } } else @@ -315,7 +323,7 @@ double HYDROData_PolylineXY::GetDistance( const int theSectionIndex, aPointToTest = aPoint; } - HYDROData_BSplineOperation aBSpline( aPoints, anIsSectionClosed ); + HYDROData_BSplineOperation aBSpline( aPoints, anIsSectionClosed, LOCAL_SELECTION_TOLERANCE ); Quantity_Parameter aFirstParam = aBSpline.Curve()->FirstParameter(); Quantity_Parameter aSecondParam = aBSpline.Curve()->LastParameter();