X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMImpl%2FGEOMImpl_IBasicOperations.cxx;h=66dca2b25043c4beb4b70166bf60d1ddf0c9a190;hb=d3582bad2ba00bbf625d06e8cfbff999d7c38880;hp=cb81f958f70ce6cc3eb20189729b77e72f043b7d;hpb=6e2763b42437045fd4b18aa3a6197865020de84b;p=modules%2Fgeom.git diff --git a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx index cb81f958f..66dca2b25 100644 --- a/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IBasicOperations.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2021 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 @@ -24,15 +24,11 @@ #include -#include - #include "utilities.h" -#include #include #include #include -#include #include #include @@ -60,8 +56,8 @@ * constructor: */ //============================================================================= -GEOMImpl_IBasicOperations::GEOMImpl_IBasicOperations(GEOM_Engine* theEngine, int theDocID) -: GEOM_IOperations(theEngine, theDocID) +GEOMImpl_IBasicOperations::GEOMImpl_IBasicOperations(GEOM_Engine* theEngine) +: GEOM_IOperations(theEngine) { MESSAGE("GEOMImpl_IBasicOperations::GEOMImpl_IBasicOperations"); } @@ -88,7 +84,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointXYZ SetErrorCode(KO); //Add a new Point object - Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT); + Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GEOM_POINT); //Add a new Point function with XYZ parameters Handle(GEOM_Function) aFunction = @@ -112,9 +108,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointXYZ return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -139,7 +134,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference if (theReference.IsNull()) return NULL; //Add a new Point object - Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT); + Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GEOM_POINT); //Add a new Point function for creation a point relativley another point Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_XYZ_REF); @@ -165,9 +160,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -186,10 +180,11 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointWithReference //============================================================================= Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom (Handle(GEOM_Object) theGeomObj, - double theParam1, - double theParam2, - double theParam3, + double theParam1, + double theParam2, + double theParam3, const PointLocation theLocation, + const bool takeOrientationIntoAccount, Handle(GEOM_Object) theRefPoint) { SetErrorCode(KO); @@ -197,7 +192,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom if (theGeomObj.IsNull()) return NULL; //Add a new Point object - Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT); + Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GEOM_POINT); //Add a new Point function for creation a point relativley another point int fType = POINT_CURVE_PAR; @@ -226,6 +221,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom case PointOn_CurveByParam: aPI.SetCurve(aRefFunction); aPI.SetParameter(theParam1); + aPI.SetTakeOrientationIntoAccount(takeOrientationIntoAccount); break; case PointOn_CurveByLength: aPI.SetCurve(aRefFunction); @@ -266,9 +262,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -277,7 +272,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom { case PointOn_CurveByParam: GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve(" - << theGeomObj << ", " << theParam1 << ")"; + << theGeomObj << ", " << theParam1 << ", " + << takeOrientationIntoAccount << ")"; break; case PointOn_CurveByLength: GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByLength(" @@ -315,9 +311,12 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom */ //============================================================================= Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve - (Handle(GEOM_Object) theCurve, double theParameter) + (Handle(GEOM_Object) theCurve, + double theParameter, + bool takeOrientationIntoAccount) { - return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam); + return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam, + takeOrientationIntoAccount); } //============================================================================= @@ -344,7 +343,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByLength double theLength, Handle(GEOM_Object) theStartPoint) { - return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength, theStartPoint); + return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength, + false, theStartPoint); } //============================================================================= @@ -397,7 +397,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnLinesIntersection if (theLine1.IsNull() || theLine2.IsNull()) return NULL; //Add a new Point object - Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GetDocID(), GEOM_POINT); + Handle(GEOM_Object) aPoint = GetEngine()->AddObject(GEOM_POINT); //Add a new Point function for creation a point relativley another point Handle(GEOM_Function) aFunction = aPoint->AddFunction(GEOMImpl_PointDriver::GetID(), POINT_LINES_INTERSECTION); @@ -422,9 +422,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnLinesIntersection return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -449,7 +448,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentOnCurve if (theCurve.IsNull()) return NULL; //Add a new Vector object - Handle(GEOM_Object) aVec = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR); + Handle(GEOM_Object) aVec = GetEngine()->AddObject(GEOM_VECTOR); //Add a new Point function for creation a point relativley another point Handle(GEOM_Function) aFunction = aVec->AddFunction(GEOMImpl_VectorDriver::GetID(), VECTOR_TANGENT_CURVE_PAR); @@ -473,9 +472,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentOnCurve return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -498,7 +496,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorDXDYDZ SetErrorCode(KO); //Add a new Vector object - Handle(GEOM_Object) aVector = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR); + Handle(GEOM_Object) aVector = GetEngine()->AddObject(GEOM_VECTOR); //Add a new Vector function with DXDYDZ parameters Handle(GEOM_Function) aFunction = @@ -522,9 +520,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorDXDYDZ return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -549,7 +546,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorTwoPnt if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL; //Add a new Vector object - Handle(GEOM_Object) aVector = GetEngine()->AddObject(GetDocID(), GEOM_VECTOR); + Handle(GEOM_Object) aVector = GetEngine()->AddObject(GEOM_VECTOR); //Add a new Vector function Handle(GEOM_Function) aFunction = @@ -575,9 +572,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeVectorTwoPnt return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -603,7 +599,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLine if (thePnt.IsNull() || theDir.IsNull()) return NULL; //Add a new Line object - Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE); + Handle(GEOM_Object) aLine = GetEngine()->AddObject(GEOM_LINE); //Add a new Line function Handle(GEOM_Function) aFunction = @@ -629,9 +625,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLine return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -656,7 +651,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt if (thePnt1.IsNull() || thePnt2.IsNull()) return NULL; //Add a new Line object - Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE); + Handle(GEOM_Object) aLine = GetEngine()->AddObject(GEOM_LINE); //Add a new Line function Handle(GEOM_Function) aFunction = @@ -682,9 +677,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoPnt return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -709,7 +703,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoFaces if (theFace1.IsNull() || theFace2.IsNull()) return NULL; //Add a new Line object - Handle(GEOM_Object) aLine = GetEngine()->AddObject(GetDocID(), GEOM_LINE); + Handle(GEOM_Object) aLine = GetEngine()->AddObject(GEOM_LINE); //Add a new Line function Handle(GEOM_Function) aFunction = @@ -735,9 +729,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeLineTwoFaces return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -763,7 +756,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneThreePnt if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL; //Add a new Plane object - Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE); + Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GEOM_PLANE); //Add a new Plane function Handle(GEOM_Function) aFunction = @@ -792,9 +785,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneThreePnt return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -820,7 +812,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlanePntVec if (thePnt.IsNull() || theVec.IsNull()) return NULL; //Add a new Plane object - Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE); + Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GEOM_PLANE); //Add a new Plane function Handle(GEOM_Function) aFunction = @@ -847,9 +839,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlanePntVec return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -874,7 +865,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace if (theFace.IsNull()) return NULL; //Add a new Plane object - Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE); + Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GEOM_PLANE); //Add a new Plane function Handle(GEOM_Function) aFunction = @@ -899,9 +890,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneFace return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -927,7 +917,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlane2Vec if (theVec1.IsNull() || theVec2.IsNull()) return NULL; //Add a new Plane object - Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE); + Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GEOM_PLANE); //Add a new Plane function Handle(GEOM_Function) aFunction = @@ -954,9 +944,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlane2Vec return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -979,7 +968,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneLCS SetErrorCode(KO); //Add a new Plane object - Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE); + Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GEOM_PLANE); //Add a new Plane function Handle(GEOM_Function) aFunction = @@ -1006,9 +995,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneLCS return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -1034,7 +1022,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker SetErrorCode(KO); //Add a new Marker object - Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GetDocID(), GEOM_MARKER); + Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GEOM_MARKER); //Add a new Marker function Handle(GEOM_Function) aFunction = @@ -1058,9 +1046,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarker return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -1085,7 +1072,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarkerFromShape SetErrorCode(KO); //Add a new Marker object - Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GetDocID(), GEOM_MARKER); + Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GEOM_MARKER); //Add a new Marker function Handle(GEOM_Function) aFunction = @@ -1110,9 +1097,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarkerFromShape return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -1136,7 +1122,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarkerPntTwoVec SetErrorCode(KO); //Add a new Marker object - Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GetDocID(), GEOM_MARKER); + Handle(GEOM_Object) aMarker = GetEngine()->AddObject(GEOM_MARKER); //Add a new Marker function Handle(GEOM_Function) aFunction = @@ -1165,9 +1151,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeMarkerPntTwoVec return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; } @@ -1195,7 +1180,7 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Hand if (theFace.IsNull()) return NULL; //Add a new Plane object - Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE); + Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GEOM_PLANE); //Add a new Plane function Handle(GEOM_Function) aFunction = @@ -1222,9 +1207,8 @@ Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakeTangentPlaneOnFace(const Hand return NULL; } } - catch (Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - SetErrorCode(aFail->GetMessageString()); + catch (Standard_Failure& aFail) { + SetErrorCode(aFail.GetMessageString()); return NULL; }