X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMImpl%2FGEOMImpl_PointDriver.cxx;h=b85cd1c7310b3726904df4e4e0693fb747b83e2f;hb=c1d63ef1f803d255b61ee99fb618bf471add07f4;hp=c0c72508ae9df5fcba6830948d32cedf0e9e7d2e;hpb=7d880c6a8262b6d670ed70ee2b9ec25c199a46d4;p=modules%2Fgeom.git diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.cxx b/src/GEOMImpl/GEOMImpl_PointDriver.cxx index c0c72508a..b85cd1c73 100644 --- a/src/GEOMImpl/GEOMImpl_PointDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PointDriver.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2023 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -22,6 +22,8 @@ #include +#include + #include #include #include @@ -57,6 +59,7 @@ #include #include +#include //======================================================================= //function : GetID @@ -110,7 +113,7 @@ static Standard_Boolean getExtremaSolution //function : Execute //purpose : //======================================================================= -Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const +Standard_Integer GEOMImpl_PointDriver::Execute(Handle(TFunction_Logbook)& log) const { if (Label().IsNull()) return 0; Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); @@ -145,7 +148,14 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const Standard_Real aFP, aLP, aP; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), aFP, aLP); if ( !aCurve.IsNull() ) { - aP = aFP + (aLP - aFP) * aPI.GetParameter(); + if (aPI.GetTakeOrientationIntoAccount() && + aRefShape.Orientation() == TopAbs_REVERSED) { + aP = 1. - aPI.GetParameter(); + } else { + aP = aPI.GetParameter(); + } + + aP = aFP + (aLP - aFP) * aP; aPnt = aCurve->Value(aP); } else { @@ -294,13 +304,31 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const else if (aType == POINT_FACE_ANY) { Handle(GEOM_Function) aRefFunc = aPI.GetSurface(); TopoDS_Shape aRefShape = aRefFunc->GetValue(); + int aNbPnts = aPI.GetNumberOfPoints(); + if (aNbPnts < 1) { + Standard_TypeMismatch::Raise + ("Point On Surface creation aborted : number of points is zero or negative"); + } if (aRefShape.ShapeType() != TopAbs_FACE) { Standard_TypeMismatch::Raise ("Point On Surface creation aborted : surface shape is not a face"); } TopoDS_Face F = TopoDS::Face(aRefShape); - gp_Pnt2d aP2d; - GEOMAlgo_AlgoTools::PntInFace(F, aPnt, aP2d); + if (aNbPnts == 1) + { + gp_Pnt2d aP2d; + GEOMAlgo_AlgoTools::PntInFace(F, aPnt, aP2d); + } + else + { +#if OCC_VERSION_LARGE < 0x07050304 + Standard_NotImplemented::Raise("Point cloud creation aborted. Improper OCCT version: please, use OCCT 7.5.3p4 or newer."); +#else + if (GEOMAlgo_AlgoTools::PointCloudInFace(F, aNbPnts, aCompound) < 0) + Standard_ConstructionError::Raise("Point cloud creation aborted : algorithm failed"); + retCompound = true; +#endif + } } else if (aType == POINT_LINES_INTERSECTION) { Handle(GEOM_Function) aRef1 = aPI.GetLine1(); @@ -355,7 +383,7 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const //aShape.Infinite(Standard_True); // VSR: 05/04/2010: Fix 20668 (Fit All for points & lines) aFunction->SetValue(aShape); - log.SetTouched(Label()); + log->SetTouched(Label()); return 1; } @@ -393,6 +421,7 @@ GetCreationInformation(std::string& theOperationName, case POINT_CURVE_PAR: AddParam( theParams, "Edge", aCI.GetCurve() ); AddParam( theParams, "Parameter", aCI.GetParameter() ); + AddParam( theParams, "Use Orientation", aCI.GetTakeOrientationIntoAccount() ); break; case POINT_CURVE_COORD: AddParam( theParams, "X", aCI.GetX() ); @@ -430,5 +459,4 @@ GetCreationInformation(std::string& theOperationName, return true; } -IMPLEMENT_STANDARD_HANDLE (GEOMImpl_PointDriver,GEOM_BaseDriver); -IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PointDriver,GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PointDriver,GEOM_BaseDriver)