X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMImpl%2FGEOMImpl_PointDriver.cxx;h=e7c2516e3948f0699f0bc8fb54853eca5186a430;hb=66a2554913f5c53b13a4e811160becede9b11132;hp=8b861355641a2ba02407ee0a87dcbdbc5f2d97d7;hpb=ade417c569fc552473b95f31f9624449dce21b8a;p=modules%2Fgeom.git diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.cxx b/src/GEOMImpl/GEOMImpl_PointDriver.cxx index 8b8613556..e7c2516e3 100644 --- a/src/GEOMImpl/GEOMImpl_PointDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PointDriver.cxx @@ -22,6 +22,8 @@ #include +#include + #include #include #include @@ -57,6 +59,7 @@ #include #include +#include //======================================================================= //function : GetID @@ -301,13 +304,31 @@ Standard_Integer GEOMImpl_PointDriver::Execute(Handle(TFunction_Logbook)& log) c 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();