1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0024023: Revamp the OCCT Handle -- ambiguity

Code corrected to avoid ambiguous situations due to changed implementation of Handle (overloaded methods accepting handles of different types).
In Adaptor3d_CurveOnSurface added method Load() with two parameters, allowing to avoid ambiguity of cast of handles when calling separate methods Load() for curve and surface, replacing by single call.
In DrawTrSurf and IGESData_IGESWriter, template variants of methods Set() and Send(), respectively, are added to avoid ambiguity when these methods are called with handles to derived types (using SFINAE).
In NCollection_DefineHSequence, method Append() accepting handle to another HSequence is made template, to be available only if argument has compatible type.
This commit is contained in:
abv
2015-07-02 17:06:37 +03:00
parent a1eb3afd0d
commit 543a996496
69 changed files with 270 additions and 198 deletions

View File

@@ -130,7 +130,7 @@ void ShapeUpgrade_ConvertCurve2dToBezier::Compute()
Handle(Geom2d_BSplineCurve) aBSpline2d;
Standard_Real Shift = 0.;
if(myCurve->IsKind(STANDARD_TYPE(Geom2d_Conic))) {
Handle(Geom2d_TrimmedCurve) tcurve = new Geom2d_TrimmedCurve(myCurve,First,Last); //protection agains parabols ets
Handle(Geom2d_Curve) tcurve = new Geom2d_TrimmedCurve(myCurve,First,Last); //protection agains parabols ets
Geom2dConvert_ApproxCurve approx (tcurve, Precision::Approximation(),
GeomAbs_C1, 100, 6 );
if ( approx.HasResult() )

View File

@@ -113,7 +113,7 @@ void ShapeUpgrade_ConvertCurve3dToBezier::Compute()
Handle(Geom_BSplineCurve) aBSpline;
Standard_Real Shift = 0.;
if(myCurve->IsKind(STANDARD_TYPE(Geom_Conic))) {
Handle(Geom_TrimmedCurve) tcurve = new Geom_TrimmedCurve(myCurve,First,Last); //protection agains parabols ets
Handle(Geom_Curve) tcurve = new Geom_TrimmedCurve(myCurve,First,Last); //protection agains parabols ets
GeomConvert_ApproxCurve approx (tcurve, Precision::Approximation(),
GeomAbs_C1, 100, 6 );
if ( approx.HasResult() )

View File

@@ -15,8 +15,8 @@
#include <ShapeUpgrade_FixSmallBezierCurves.ixx>
#include <TopoDS_Edge.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
#include <Geom_BSplineCurve.hxx>
#include <Geom2d_BSplineCurve.hxx>
#include <gp_Pnt.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <TopExp.hxx>
@@ -57,7 +57,7 @@ Standard_Boolean ShapeUpgrade_FixSmallBezierCurves::Approx(Handle(Geom_Curve)& C
First = f;
if(Last > l)
Last =l;
Handle(Geom_TrimmedCurve) trc = new Geom_TrimmedCurve(c3d,First,Last);
Handle(Geom_Curve) trc = new Geom_TrimmedCurve(c3d,First,Last);
GeomAbs_Shape aCont = (GeomAbs_Shape)trc->Continuity();
if(aCont == GeomAbs_C3 || aCont == GeomAbs_CN)
aCont = GeomAbs_C2;
@@ -95,7 +95,7 @@ Standard_Boolean ShapeUpgrade_FixSmallBezierCurves::Approx(Handle(Geom_Curve)& C
First = f;
if(Last > l)
Last =l;
Handle(Geom2d_TrimmedCurve) trc2d = new Geom2d_TrimmedCurve(c2d,First,Last);
Handle(Geom2d_Curve) trc2d = new Geom2d_TrimmedCurve(c2d,First,Last);
GeomAbs_Shape aCont = (GeomAbs_Shape)trc2d->Continuity();
try {
OCC_CATCH_SIGNALS
@@ -132,7 +132,7 @@ Standard_Boolean ShapeUpgrade_FixSmallBezierCurves::Approx(Handle(Geom_Curve)& C
First = f;
if(Last > l)
Last =l;
Handle(Geom2d_TrimmedCurve) trc2d = new Geom2d_TrimmedCurve(c2,First,Last);
Handle(Geom2d_Curve) trc2d = new Geom2d_TrimmedCurve(c2,First,Last);
GeomAbs_Shape aCont = trc2d->Continuity();
Geom2dConvert_ApproxCurve AproxCurve2d(trc2d,prec,aCont,1,9);
try {

View File

@@ -414,8 +414,8 @@ void ShapeUpgrade_WireDivide::Perform ()
else if(myEdgeDivide->HasCurve2d() && !Surf.IsNull()) {
Handle(Geom2d_Curve) c2d;
sae.PCurve ( E, myFace, c2d, af, al, Standard_False);
Handle(GeomAdaptor_HSurface) AdS = new GeomAdaptor_HSurface(Surf);
Handle(Geom2dAdaptor_HCurve) AC2d = new Geom2dAdaptor_HCurve(c2d,af,al);
Handle(Adaptor3d_HSurface) AdS = new GeomAdaptor_HSurface(Surf);
Handle(Adaptor2d_HCurve2d) AC2d = new Geom2dAdaptor_HCurve(c2d,af,al);
AdCS.Load(AC2d);
AdCS.Load(AdS);
}