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 | // |
973c2be1 |
5 | // This library is free software; you can redistribute it and / or modify it |
6 | // under the terms of the GNU Lesser General Public version 2.1 as published |
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 <IGESSelect_SplineToBSpline.ixx> |
15 | #include <IGESData_IGESEntity.hxx> |
16 | #include <Interface_Macros.hxx> |
17 | #include <Interface_Check.hxx> |
18 | |
19 | |
20 | |
21 | IGESSelect_SplineToBSpline::IGESSelect_SplineToBSpline |
22 | (const Standard_Boolean tryC2) |
23 | { |
24 | thetryc2 = tryC2; thefound = Standard_False; |
25 | } |
26 | |
27 | Standard_Boolean IGESSelect_SplineToBSpline::OptionTryC2 () const |
28 | { |
29 | return thetryc2; |
30 | } |
31 | |
32 | |
33 | Standard_Boolean IGESSelect_SplineToBSpline::Perform |
34 | (const Interface_Graph& G, const Handle(Interface_Protocol)&, |
35 | Interface_CheckIterator& checks, |
36 | Handle(Interface_InterfaceModel)& newmod) |
37 | { |
38 | Standard_Integer nbe = G.Size(); |
39 | thefound = Standard_False; |
40 | themap.Nullify(); |
41 | for (Standard_Integer i = 1; i <= nbe; i ++) { |
42 | DeclareAndCast(IGESData_IGESEntity,ent,G.Entity(i)); |
43 | if (ent.IsNull()) continue; |
44 | Standard_Integer it = ent->TypeNumber(); |
45 | if (it == 112 || it == 126) { |
46 | thefound = Standard_True; |
47 | #ifdef DEB |
48 | cout<<"IGESSelect_SplineToBSpline : n0."<<i |
49 | << (it == 112 ? ", Curve" : ", Surface")<<" to convert"<<endl; |
50 | #endif |
51 | } |
52 | } |
53 | newmod.Nullify(); |
54 | if (!thefound) return Standard_True; |
55 | |
56 | // Il faudrait convertir ... |
57 | checks.CCheck(0)->AddFail("IGESSelect_SplineToBSpline : not yet implemented"); |
58 | return Standard_False; |
59 | } |
60 | |
61 | |
62 | Standard_Boolean IGESSelect_SplineToBSpline::Updated |
63 | (const Handle(Standard_Transient)& entfrom, |
64 | Handle(Standard_Transient)& entto) const |
65 | { |
66 | if (!thefound) { |
67 | entto = entfrom; |
68 | return Standard_True; |
69 | } |
70 | if (themap.IsNull()) return Standard_False; |
71 | return themap->Search(entfrom,entto); |
72 | } |
73 | |
74 | |
75 | TCollection_AsciiString IGESSelect_SplineToBSpline::Label () const |
76 | { |
77 | if (thetryc2) return TCollection_AsciiString |
78 | ("Convert Spline Forms to BSpline, trying to recover C1-C2 continuity"); |
79 | else return TCollection_AsciiString ("Convert Spline Forms to BSpline"); |
80 | } |