1 // Created on: 1993-06-21
2 // Created by: Martine LANGLOIS
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
18 #include <Geom2d_BezierCurve.hxx>
19 #include <Geom2d_BoundedCurve.hxx>
20 #include <Geom2d_BSplineCurve.hxx>
21 #include <Geom2dConvert.hxx>
22 #include <Geom_BezierCurve.hxx>
23 #include <Geom_BoundedCurve.hxx>
24 #include <Geom_BSplineCurve.hxx>
25 #include <GeomConvert.hxx>
26 #include <GeomToStep_MakeBoundedCurve.hxx>
27 #include <GeomToStep_MakeBSplineCurveWithKnots.hxx>
28 #include <GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve.hxx>
29 #include <StdFail_NotDone.hxx>
30 #include <StepGeom_BoundedCurve.hxx>
31 #include <StepGeom_BSplineCurveWithKnots.hxx>
32 #include <StepGeom_BSplineCurveWithKnotsAndRationalBSplineCurve.hxx>
34 //=============================================================================
35 // Creation d' une BoundedCurve de prostep a partir d' une BoundedCurve de Geom
36 //=============================================================================
37 GeomToStep_MakeBoundedCurve::GeomToStep_MakeBoundedCurve ( const Handle(Geom_BoundedCurve)& C)
41 if (C->IsKind(STANDARD_TYPE(Geom_BSplineCurve))) {
42 Handle(Geom_BSplineCurve) Bspli = Handle(Geom_BSplineCurve)::DownCast(C);
44 if (C->IsPeriodic()) {
45 Handle(Geom_BSplineCurve) newBspli =
46 Handle(Geom_BSplineCurve)::DownCast(Bspli->Copy());
47 newBspli->SetNotPeriodic();
50 if ( Bspli->IsRational() ) {
51 GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve MkRatBSplineC(Bspli);
52 theBoundedCurve = MkRatBSplineC.Value();
55 GeomToStep_MakeBSplineCurveWithKnots MkBSplineC(Bspli);
56 theBoundedCurve = MkBSplineC.Value();
59 else if (C->IsKind(STANDARD_TYPE(Geom_BezierCurve))) {
60 Handle(Geom_BezierCurve) Cur = Handle(Geom_BezierCurve)::DownCast(C);
61 Handle(Geom_BSplineCurve) Bspli = GeomConvert::CurveToBSplineCurve(Cur);
62 if ( Bspli->IsRational() ) {
63 GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve MkRatBSplineC(Bspli);
64 theBoundedCurve = MkRatBSplineC.Value();
67 GeomToStep_MakeBSplineCurveWithKnots MkBSplineC(Bspli);
68 theBoundedCurve = MkBSplineC.Value();
73 cout<<"MakeBoundedCurve, type : "<<C->DynamicType()->Name()<<" not processed"<<endl;
75 done = Standard_False;
79 //=============================================================================
80 // Creation d' une BoundedCurve de prostep a partir d' une BoundedCurve de
82 //=============================================================================
84 GeomToStep_MakeBoundedCurve::GeomToStep_MakeBoundedCurve ( const Handle(Geom2d_BoundedCurve)& C)
87 if (C->IsKind(STANDARD_TYPE(Geom2d_BSplineCurve)))
89 Handle(Geom2d_BSplineCurve) Bspli =
90 Handle(Geom2d_BSplineCurve)::DownCast(C);
92 if (C->IsPeriodic()) {
93 Handle(Geom2d_BSplineCurve) newBspli =
94 Handle(Geom2d_BSplineCurve)::DownCast(Bspli->Copy());
95 newBspli->SetNotPeriodic();
98 if ( Bspli->IsRational() ) {
99 GeomToStep_MakeBSplineCurveWithKnotsAndRationalBSplineCurve MkRatBSplineC(Bspli);
100 theBoundedCurve = MkRatBSplineC.Value();
103 GeomToStep_MakeBSplineCurveWithKnots MkBSplineC(Bspli);
104 theBoundedCurve = MkBSplineC.Value();
107 else if (C->IsKind(STANDARD_TYPE(Geom2d_BezierCurve))) {
108 Handle(Geom2d_BezierCurve) Cur = Handle(Geom2d_BezierCurve)::DownCast(C);
109 Handle(Geom2d_BSplineCurve) Bspli =
110 Geom2dConvert::CurveToBSplineCurve(Cur);
111 GeomToStep_MakeBSplineCurveWithKnots MkBSplineC(Bspli);
112 theBoundedCurve = MkBSplineC.Value();
115 done = Standard_False;
119 //=============================================================================
120 // renvoi des valeurs
121 //=============================================================================
123 const Handle(StepGeom_BoundedCurve) &
124 GeomToStep_MakeBoundedCurve::Value() const
126 StdFail_NotDone_Raise_if(!done, "");
127 return theBoundedCurve;