mirror of
https://github.com/Open-Cascade-SAS/OCCT.git
synced 2026-09-04 19:57:55 +08:00
0024023: Revamp the OCCT Handle -- StepToGeom
StepToGeom package refactored to avoid C-style casts of handles to derived types. Instead of 45 classes, each defining single static method, it now defines 45 static methods in the main package class. Results of conversion are returned in normal way rather than via function parameter. Conflicts: src/StepToGeom/StepToGeom_MakeSurfaceOfRevolution.cxx
This commit is contained in:
@@ -66,9 +66,7 @@
|
||||
#include <StepShape_OrientedClosedShell.hxx>
|
||||
#include <StepShape_Shell.hxx>
|
||||
#include <StepShape_ShellBasedSurfaceModel.hxx>
|
||||
#include <StepToGeom_MakeCartesianPoint.hxx>
|
||||
#include <StepToGeom_MakeCurve.hxx>
|
||||
#include <StepToGeom_MakeSurface.hxx>
|
||||
#include <StepToGeom.hxx>
|
||||
#include <StepToTopoDS_Builder.hxx>
|
||||
#include <StepToTopoDS_DataMapOfTRI.hxx>
|
||||
#include <StepToTopoDS_NMTool.hxx>
|
||||
@@ -708,8 +706,8 @@ static TopoDS_Face TranslateBoundedSurf (const Handle(StepGeom_Surface) &surf,
|
||||
{
|
||||
TopoDS_Face res;
|
||||
|
||||
Handle(Geom_Surface) theSurf;
|
||||
if (!StepToGeom_MakeSurface::Convert(surf,theSurf) || //:i6: protection
|
||||
Handle(Geom_Surface) theSurf = StepToGeom::MakeSurface (surf);
|
||||
if (theSurf.IsNull() || //:i6: protection
|
||||
!theSurf->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) return res;
|
||||
|
||||
BRepBuilderAPI_MakeFace myMkFace;
|
||||
@@ -800,7 +798,7 @@ void StepToTopoDS_Builder::Init
|
||||
Handle(Geom_Curve) aGeomCrv;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
StepToGeom_MakeCurve::Convert(aCrv,aGeomCrv);
|
||||
aGeomCrv = StepToGeom::MakeCurve (aCrv);
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
Handle(Message_Messenger) sout = TP->Messenger();
|
||||
@@ -816,8 +814,8 @@ void StepToTopoDS_Builder::Init
|
||||
// try point
|
||||
else if ( ent->IsKind(STANDARD_TYPE(StepGeom_CartesianPoint)) ) {
|
||||
Handle(StepGeom_CartesianPoint) aPnt = Handle(StepGeom_CartesianPoint)::DownCast ( ent );
|
||||
Handle(Geom_CartesianPoint) thePnt;
|
||||
if (StepToGeom_MakeCartesianPoint::Convert(aPnt,thePnt)) {
|
||||
Handle(Geom_CartesianPoint) thePnt = StepToGeom::MakeCartesianPoint (aPnt);
|
||||
if (! thePnt.IsNull()) {
|
||||
BRepBuilderAPI_MakeVertex myMkVtx(thePnt->Pnt());
|
||||
if ( myMkVtx.IsDone() ) res = myMkVtx.Vertex();
|
||||
}
|
||||
|
||||
@@ -28,10 +28,7 @@
|
||||
#include <StepRepr_MappedItem.hxx>
|
||||
#include <StepRepr_Representation.hxx>
|
||||
#include <StepRepr_RepresentationMap.hxx>
|
||||
#include <StepToGeom_MakeAxis2Placement.hxx>
|
||||
#include <StepToGeom_MakeCartesianPoint.hxx>
|
||||
#include <StepToGeom_MakeDirection.hxx>
|
||||
#include <StepToGeom_MakeTransformation3d.hxx>
|
||||
#include <StepToGeom.hxx>
|
||||
#include <StepToTopoDS_MakeTransformed.hxx>
|
||||
#include <TopLoc_Location.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
@@ -52,11 +49,11 @@ Standard_Boolean StepToTopoDS_MakeTransformed::Compute
|
||||
if (Origin.IsNull() || Target.IsNull()) return Standard_False;
|
||||
|
||||
// sln 23.10.2001 : If the directions have not been created do nothing.
|
||||
Handle(Geom_Axis2Placement) theOrig;
|
||||
if (!StepToGeom_MakeAxis2Placement::Convert(Origin,theOrig))
|
||||
Handle(Geom_Axis2Placement) theOrig = StepToGeom::MakeAxis2Placement (Origin);
|
||||
if (theOrig.IsNull())
|
||||
return Standard_False;
|
||||
Handle(Geom_Axis2Placement) theTarg;
|
||||
if (!StepToGeom_MakeAxis2Placement::Convert(Target,theTarg))
|
||||
Handle(Geom_Axis2Placement) theTarg = StepToGeom::MakeAxis2Placement (Target);
|
||||
if (theTarg.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
const gp_Ax3 ax3Orig(theOrig->Ax2());
|
||||
@@ -70,7 +67,7 @@ Standard_Boolean StepToTopoDS_MakeTransformed::Compute
|
||||
Standard_Boolean StepToTopoDS_MakeTransformed::Compute
|
||||
(const Handle(StepGeom_CartesianTransformationOperator3d)& Operator)
|
||||
{
|
||||
return StepToGeom_MakeTransformation3d::Convert(Operator,theTrsf);
|
||||
return StepToGeom::MakeTransformation3d (Operator, theTrsf);
|
||||
}
|
||||
|
||||
const gp_Trsf& StepToTopoDS_MakeTransformed::Transformation () const
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <StepGeom_PcurveOrSurface.hxx>
|
||||
#include <StepGeom_Surface.hxx>
|
||||
#include <StepGeom_SurfaceCurve.hxx>
|
||||
#include <StepToGeom_MakeCurve.hxx>
|
||||
#include <StepToGeom.hxx>
|
||||
#include <StepToTopoDS_TranslateCompositeCurve.hxx>
|
||||
#include <StepToTopoDS_TranslateEdge.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@@ -177,8 +177,8 @@ Standard_Boolean StepToTopoDS_TranslateCompositeCurve::Init (const Handle(StepGe
|
||||
if ( ! crv.IsNull() ) {
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
Handle(Geom_Curve) c3d;
|
||||
if (StepToGeom_MakeCurve::Convert(crv,c3d)) {
|
||||
Handle(Geom_Curve) c3d = StepToGeom::MakeCurve (crv);
|
||||
if (! c3d.IsNull()) {
|
||||
BRepBuilderAPI_MakeEdge MkEdge ( c3d, c3d->FirstParameter(), c3d->LastParameter() );
|
||||
if (MkEdge.IsDone())
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <StepGeom_BSplineSurface.hxx>
|
||||
#include <StepGeom_CurveBoundedSurface.hxx>
|
||||
#include <StepGeom_HArray1OfSurfaceBoundary.hxx>
|
||||
#include <StepToGeom_MakeSurface.hxx>
|
||||
#include <StepToGeom.hxx>
|
||||
#include <StepToTopoDS_TranslateCompositeCurve.hxx>
|
||||
#include <StepToTopoDS_TranslateCurveBoundedSurface.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
@@ -65,8 +65,9 @@ Standard_Boolean StepToTopoDS_TranslateCurveBoundedSurface::Init (
|
||||
|
||||
// translate basis surface
|
||||
Handle(StepGeom_Surface) S = CBS->BasisSurface();
|
||||
Handle(Geom_Surface) Surf;
|
||||
if ( !StepToGeom_MakeSurface::Convert(S,Surf) ) {
|
||||
Handle(Geom_Surface) Surf = StepToGeom::MakeSurface (S);
|
||||
if (Surf.IsNull())
|
||||
{
|
||||
TP->AddFail ( CBS, "Basis surface not translated" );
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
@@ -47,9 +47,7 @@
|
||||
#include <StepShape_OrientedEdge.hxx>
|
||||
#include <StepShape_Vertex.hxx>
|
||||
#include <StepShape_VertexPoint.hxx>
|
||||
#include <StepToGeom_MakeCartesianPoint.hxx>
|
||||
#include <StepToGeom_MakeCurve.hxx>
|
||||
#include <StepToGeom_MakeCurve2d.hxx>
|
||||
#include <StepToGeom.hxx>
|
||||
#include <StepToTopoDS.hxx>
|
||||
#include <StepToTopoDS_GeometricTool.hxx>
|
||||
#include <StepToTopoDS_NMTool.hxx>
|
||||
@@ -150,7 +148,8 @@ static Handle(Geom_Curve) MakeCurve
|
||||
{
|
||||
Handle(Geom_Curve) C2 = Handle(Geom_Curve)::DownCast (TP->FindTransient(C1));
|
||||
if (!C2.IsNull()) return C2;
|
||||
if (StepToGeom_MakeCurve::Convert(C1,C2))
|
||||
C2 = StepToGeom::MakeCurve (C1);
|
||||
if (! C2.IsNull())
|
||||
TP->BindTransient (C1,C2);
|
||||
return C2;
|
||||
}
|
||||
@@ -379,9 +378,8 @@ static void GetCartesianPoints ( const Handle(StepShape_EdgeCurve)& EC,
|
||||
const Handle(StepShape_VertexPoint) VP = Handle(StepShape_VertexPoint)::DownCast(V);
|
||||
if ( VP.IsNull() ) continue;
|
||||
const Handle(StepGeom_CartesianPoint) P = Handle(StepGeom_CartesianPoint)::DownCast(VP->VertexGeometry());
|
||||
Handle(Geom_CartesianPoint) CP;
|
||||
StepToGeom_MakeCartesianPoint::Convert(P,CP);
|
||||
( i==1 ? P1 : P2 ) = CP->Pnt();
|
||||
Handle(Geom_CartesianPoint) CP = StepToGeom::MakeCartesianPoint (P);
|
||||
( i==1 ? P1 : P2 ) = CP->Pnt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,7 +501,8 @@ Handle(Geom2d_Curve) StepToTopoDS_TranslateEdge::MakePCurve
|
||||
const Handle(StepRepr_DefinitionalRepresentation) DRI = PCU->ReferenceToCurve();
|
||||
if( DRI.IsNull()) return C2d;
|
||||
const Handle(StepGeom_Curve) StepCurve = Handle(StepGeom_Curve)::DownCast(DRI->ItemsValue(1));
|
||||
if (StepToGeom_MakeCurve2d::Convert(StepCurve,C2d)) {
|
||||
C2d = StepToGeom::MakeCurve2d (StepCurve);
|
||||
if (! C2d.IsNull()) {
|
||||
// -- if the surface is a RectangularTrimmedSurface,
|
||||
// -- send the BasisSurface.
|
||||
C2d = UnitsMethods::DegreeToRadian(C2d, ConvSurf);
|
||||
|
||||
@@ -63,8 +63,7 @@
|
||||
#include <StepShape_FaceBound.hxx>
|
||||
#include <StepShape_OrientedEdge.hxx>
|
||||
#include <StepShape_Vertex.hxx>
|
||||
#include <StepToGeom_MakeCurve.hxx>
|
||||
#include <StepToGeom_MakeCurve2d.hxx>
|
||||
#include <StepToGeom.hxx>
|
||||
#include <StepToTopoDS.hxx>
|
||||
#include <StepToTopoDS_GeometricTool.hxx>
|
||||
#include <StepToTopoDS_NMTool.hxx>
|
||||
@@ -320,7 +319,8 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
|
||||
OCC_CATCH_SIGNALS
|
||||
C1 = Handle(Geom_Curve)::DownCast (TP->FindTransient(C));
|
||||
if (C1.IsNull()) {
|
||||
if (StepToGeom_MakeCurve::Convert(C,C1))
|
||||
C1 = StepToGeom::MakeCurve (C);
|
||||
if (! C1.IsNull())
|
||||
TP->BindTransient (C,C1);
|
||||
else
|
||||
TP->AddWarning(C,"Could not convert a curve. Curve definition is incorrect");
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
#include <StepShape_OrientedEdge.hxx>
|
||||
#include <StepShape_PolyLoop.hxx>
|
||||
#include <StepShape_VertexLoop.hxx>
|
||||
#include <StepToGeom_MakeSurface.hxx>
|
||||
#include <StepToGeom.hxx>
|
||||
#include <StepToTopoDS.hxx>
|
||||
#include <StepToTopoDS_NMTool.hxx>
|
||||
#include <StepToTopoDS_Tool.hxx>
|
||||
@@ -154,8 +154,8 @@ void StepToTopoDS_TranslateFace::Init
|
||||
|
||||
if (StepSurf->IsKind(STANDARD_TYPE(StepGeom_OffsetSurface))) //:d4 abv 12 Mar 98
|
||||
TP->AddWarning(StepSurf," Type OffsetSurface is out of scope of AP 214");
|
||||
Handle(Geom_Surface) GeomSurf;
|
||||
if (!StepToGeom_MakeSurface::Convert(StepSurf,GeomSurf))
|
||||
Handle(Geom_Surface) GeomSurf = StepToGeom::MakeSurface (StepSurf);
|
||||
if (GeomSurf.IsNull())
|
||||
{
|
||||
TP->AddFail(StepSurf," Surface has not been created");
|
||||
myError = StepToTopoDS_TranslateFaceOther;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <StdFail_NotDone.hxx>
|
||||
#include <StepGeom_HArray1OfCartesianPoint.hxx>
|
||||
#include <StepShape_PolyLoop.hxx>
|
||||
#include <StepToGeom_MakeCartesianPoint.hxx>
|
||||
#include <StepToGeom.hxx>
|
||||
#include <StepToTopoDS_PointPair.hxx>
|
||||
#include <StepToTopoDS_Tool.hxx>
|
||||
#include <StepToTopoDS_TranslatePolyLoop.hxx>
|
||||
@@ -97,7 +97,7 @@ void StepToTopoDS_TranslatePolyLoop::Init(const Handle(StepShape_PolyLoop)& PL,
|
||||
Nb++;
|
||||
Poly->SetValue(Nb, PL->PolygonValue(1));
|
||||
P1 = Poly->Value(1);
|
||||
StepToGeom_MakeCartesianPoint::Convert(P1,GP1);
|
||||
GP1 = StepToGeom::MakeCartesianPoint (P1);
|
||||
if (aTool.IsVertexBound(P1)) {
|
||||
V1 = aTool.FindVertex(P1);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ void StepToTopoDS_TranslatePolyLoop::Init(const Handle(StepShape_PolyLoop)& PL,
|
||||
P2 = Poly->Value(i);
|
||||
if (P1 == P2) continue; // peut arriver (KK) CKY 9-DEC-1997
|
||||
StepToTopoDS_PointPair PP(P1, P2);
|
||||
StepToGeom_MakeCartesianPoint::Convert(P2,GP2);
|
||||
GP2 = StepToGeom::MakeCartesianPoint (P2);
|
||||
TopoDS_Shape aBoundEdge;
|
||||
Standard_Boolean isbound = aTool.IsEdgeBound(PP);
|
||||
if ( !isbound) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <StepGeom_Point.hxx>
|
||||
#include <StepShape_Vertex.hxx>
|
||||
#include <StepShape_VertexPoint.hxx>
|
||||
#include <StepToGeom_MakeCartesianPoint.hxx>
|
||||
#include <StepToGeom.hxx>
|
||||
#include <StepToTopoDS_NMTool.hxx>
|
||||
#include <StepToTopoDS_Tool.hxx>
|
||||
#include <StepToTopoDS_TranslateVertex.hxx>
|
||||
@@ -91,8 +91,7 @@ void StepToTopoDS_TranslateVertex::Init(const Handle(StepShape_Vertex)& aVertex,
|
||||
const Handle(StepShape_VertexPoint) VP = Handle(StepShape_VertexPoint)::DownCast(aVertex);
|
||||
const Handle(StepGeom_Point) P = VP->VertexGeometry();
|
||||
const Handle(StepGeom_CartesianPoint) P1 = Handle(StepGeom_CartesianPoint)::DownCast(P);
|
||||
Handle(Geom_CartesianPoint) P2;
|
||||
StepToGeom_MakeCartesianPoint::Convert(P1,P2);
|
||||
Handle(Geom_CartesianPoint) P2 = StepToGeom::MakeCartesianPoint (P1);
|
||||
BRep_Builder B;
|
||||
TopoDS_Vertex V;
|
||||
B.MakeVertex(V, P2->Pnt(), Precision::Confusion()); //:S4136: preci
|
||||
|
||||
Reference in New Issue
Block a user