973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | #include <GeomToStep_MakeParabola.ixx> |
15 | |
16 | #include <StepGeom_Parabola.hxx> |
c04c30b3 |
17 | #include <StepGeom_Axis2Placement2d.hxx> |
18 | #include <StepGeom_Axis2Placement3d.hxx> |
7fd59977 |
19 | #include <gp_Parab.hxx> |
20 | #include <gp_Parab2d.hxx> |
21 | #include <Geom_Parabola.hxx> |
22 | #include <GeomToStep_MakeAxis2Placement2d.hxx> |
23 | #include <GeomToStep_MakeAxis2Placement3d.hxx> |
24 | #include <StdFail_NotDone.hxx> |
25 | #include <TCollection_HAsciiString.hxx> |
26 | #include <UnitsMethods.hxx> |
27 | |
28 | |
29 | //============================================================================= |
30 | // Creation d'une Parabola de prostep a partir d'une Parabola de |
31 | // Geom2d |
32 | //============================================================================= |
33 | |
b311480e |
34 | GeomToStep_MakeParabola::GeomToStep_MakeParabola(const Handle(Geom2d_Parabola)& C) |
7fd59977 |
35 | { |
36 | gp_Parab2d gpPar; |
37 | gpPar = C->Parab2d(); |
38 | |
39 | Handle(StepGeom_Parabola) PStep = new StepGeom_Parabola; |
40 | StepGeom_Axis2Placement Ax2; |
41 | Handle(StepGeom_Axis2Placement2d) Ax2Step; |
42 | Standard_Real focal; |
43 | |
44 | GeomToStep_MakeAxis2Placement2d MkAxis2(gpPar.Axis()); |
45 | Ax2Step = MkAxis2.Value(); |
46 | focal = gpPar.Focal(); |
47 | Ax2.SetValue(Ax2Step); |
48 | Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); |
49 | PStep->Init(name, Ax2, focal); |
50 | theParabola = PStep; |
51 | done = Standard_True; |
52 | } |
53 | |
54 | //============================================================================= |
55 | // Creation d'une Parabola de prostep a partir d'une Parabola de |
56 | // Geom |
57 | //============================================================================= |
58 | |
59 | GeomToStep_MakeParabola::GeomToStep_MakeParabola(const Handle(Geom_Parabola)& C) |
60 | { |
61 | gp_Parab gpPar; |
62 | gpPar = C->Parab(); |
63 | |
64 | Handle(StepGeom_Parabola) PStep = new StepGeom_Parabola; |
65 | StepGeom_Axis2Placement Ax2; |
66 | Handle(StepGeom_Axis2Placement3d) Ax2Step; |
67 | Standard_Real focal; |
68 | |
69 | GeomToStep_MakeAxis2Placement3d MkAxis2(gpPar.Position()); |
70 | Ax2Step = MkAxis2.Value(); |
71 | focal = gpPar.Focal(); |
72 | Ax2.SetValue(Ax2Step); |
73 | Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(""); |
74 | PStep->Init(name, Ax2, focal / UnitsMethods::LengthFactor()); |
75 | theParabola = PStep; |
76 | done = Standard_True; |
77 | } |
78 | |
79 | //============================================================================= |
80 | // return the result |
81 | //============================================================================= |
82 | |
83 | const Handle(StepGeom_Parabola)& GeomToStep_MakeParabola::Value() const |
84 | { |
11bf7051 |
85 | StdFail_NotDone_Raise_if(!done, ""); |
7fd59977 |
86 | return theParabola; |
87 | } |
88 | |