From: gdd Date: Thu, 6 Jan 2011 14:43:29 +0000 (+0000) Subject: RNC: Corrected some Bugs related to the feature EDF 1542 X-Git-Tag: Start_BR_19998_21191~89 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bbebe02fd03147c221bd3ac78c76c0a5a92a5f46;p=modules%2Fgeom.git RNC: Corrected some Bugs related to the feature EDF 1542 --- diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.cxx b/src/GEOMImpl/GEOMImpl_PointDriver.cxx index 49b709f5e..4ea8d4981 100644 --- a/src/GEOMImpl/GEOMImpl_PointDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PointDriver.cxx @@ -31,15 +31,14 @@ #include #include #include +#include #include #include -//#include #include #include #include #include #include -//#include #include #include @@ -48,9 +47,7 @@ #include #include -#include - -#include +#include //======================================================================= //function : GetID @@ -161,24 +158,28 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const Standard_Real theLength = aPI.GetLength(); Standard_Integer theDirection = aPI.GetFlag(); TopoDS_Shape aRefShape = aRefCurve->GetValue(); + Standard_Real UFirst = 0; + Standard_Real ULast = 0; if (aRefShape.ShapeType() != TopAbs_EDGE) { Standard_TypeMismatch::Raise ("Point On Curve creation aborted : curve shape is not an edge"); } - Standard_Real UFirst = 0; - Standard_Real ULast = 0; + Standard_Real theCurveLength = IntTools::Length(TopoDS::Edge(aRefShape)); + if (theLength > theCurveLength) { + Standard_ConstructionError::Raise + ("Point On Curve creation aborted : given length is greater than edges length"); + } Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), UFirst, ULast); Handle(Geom_Curve) ReOrientedCurve = EdgeCurve; - if ( theDirection == 2 ) - ReOrientedCurve = EdgeCurve->Reversed(); - else if ( theDirection == 0 ) - ReOrientedCurve = EdgeCurve; - GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve); - Standard_Real theCurveLength = GCPnts_AbscissaPoint::Length(AdapCurve); - if (theLength > theCurveLength) { - Standard_ConstructionError::Raise - ("Point On Curve creation aborted : given length is greater than edges length"); + if ( theDirection == 2 ) { + ReOrientedCurve = EdgeCurve -> Reversed(); + UFirst=ULast; + } + else if ( theDirection != 0 ){ + Standard_TypeMismatch::Raise + ("Point On Curve creation aborted : direction parameter must be 0 or 2"); } + GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve); GCPnts_AbscissaPoint anAbsPnt(AdapCurve, theLength, UFirst); Standard_Real aParam = anAbsPnt.Parameter(); aPnt = AdapCurve.Value(aParam);