// Created on: 1993-07-02 // Created by: Martine LANGLOIS // Copyright (c) 1993-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. //:n7 abv 16.02.99: S4132: adding translation of curve_replica //:o2 abv 17.02.99: S4132: adding translation of offset_curve_3d //:o5 abv 17.02.99: bm4_sd_seal_c.stp #58720: translate surface_curve (3d only) //:p0 abv 19.02.99: management of 'done' flag improved #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //============================================================================= // Creation d' une Curve de Geom a partir d' une Curve de Step //============================================================================= Standard_Boolean StepToGeom_MakeCurve::Convert (const Handle(StepGeom_Curve)& SC, Handle(Geom_Curve)& CC) { if (SC.IsNull()){ return Standard_False; } if (SC->IsKind(STANDARD_TYPE(StepGeom_Line))) { const Handle(StepGeom_Line) L = Handle(StepGeom_Line)::DownCast(SC); return StepToGeom_MakeLine::Convert(L,*((Handle(Geom_Line)*)&CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_TrimmedCurve))) { const Handle(StepGeom_TrimmedCurve) TC = Handle(StepGeom_TrimmedCurve)::DownCast(SC); return StepToGeom_MakeTrimmedCurve::Convert(TC,*((Handle(Geom_TrimmedCurve)*)&CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_Conic))) { const Handle(StepGeom_Conic) CO = Handle(StepGeom_Conic)::DownCast(SC); return StepToGeom_MakeConic::Convert(CO,*((Handle(Geom_Conic)*)&CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_BoundedCurve))) { const Handle(StepGeom_BoundedCurve) BC = Handle(StepGeom_BoundedCurve)::DownCast(SC); return StepToGeom_MakeBoundedCurve::Convert(BC,*((Handle(Geom_BoundedCurve)*)&CC)); } if (SC->IsKind(STANDARD_TYPE(StepGeom_CurveReplica))) { //:n7 abv 16 Feb 99 const Handle(StepGeom_CurveReplica) CR = Handle(StepGeom_CurveReplica)::DownCast(SC); const Handle(StepGeom_Curve) PC = CR->ParentCurve(); const Handle(StepGeom_CartesianTransformationOperator3d) T = Handle(StepGeom_CartesianTransformationOperator3d)::DownCast(CR->Transformation()); // protect against cyclic references and wrong type of cartop if ( !T.IsNull() && PC != SC ) { Handle(Geom_Curve) C1; if (StepToGeom_MakeCurve::Convert(PC,C1)) { gp_Trsf T1; if (StepToGeom_MakeTransformation3d::Convert(T,T1)) { C1->Transform ( T1 ); CC = C1; return Standard_True; } } } } else if (SC->IsKind(STANDARD_TYPE(StepGeom_OffsetCurve3d))) { //:o2 abv 17 Feb 99 const Handle(StepGeom_OffsetCurve3d) OC = Handle(StepGeom_OffsetCurve3d)::DownCast(SC); const Handle(StepGeom_Curve) BC = OC->BasisCurve(); if ( BC != SC ) { // protect against loop Handle(Geom_Curve) C1; if (StepToGeom_MakeCurve::Convert(BC,C1)) { Handle(Geom_Direction) RD; if (StepToGeom_MakeDirection::Convert(OC->RefDirection(),RD)) { CC = new Geom_OffsetCurve ( C1, -OC->Distance(), RD->Dir() ); return Standard_True; } } } } else if (SC->IsKind(STANDARD_TYPE(StepGeom_SurfaceCurve))) { //:o5 abv 17 Feb 99 const Handle(StepGeom_SurfaceCurve) SurfC = Handle(StepGeom_SurfaceCurve)::DownCast(SC); return StepToGeom_MakeCurve::Convert(SurfC->Curve3d(),CC); } return Standard_False; }