0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / IGESSelect / IGESSelect_SplineToBSpline.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <IGESData_IGESEntity.hxx>
16 #include <IGESSelect_SplineToBSpline.hxx>
17 #include <Interface_Check.hxx>
18 #include <Interface_CheckIterator.hxx>
19 #include <Interface_CopyControl.hxx>
20 #include <Interface_Graph.hxx>
21 #include <Interface_InterfaceModel.hxx>
22 #include <Interface_Macros.hxx>
23 #include <Interface_Protocol.hxx>
24 #include <Standard_Transient.hxx>
25 #include <Standard_Type.hxx>
26 #include <TCollection_AsciiString.hxx>
27
28 IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SplineToBSpline,IFSelect_Transformer)
29
30 IGESSelect_SplineToBSpline::IGESSelect_SplineToBSpline
31   (const Standard_Boolean tryC2)
32 {
33   thetryc2 = tryC2;  thefound = Standard_False;
34 }
35
36 Standard_Boolean  IGESSelect_SplineToBSpline::OptionTryC2 () const
37 {
38   return thetryc2;
39 }
40
41
42 Standard_Boolean  IGESSelect_SplineToBSpline::Perform
43   (const Interface_Graph& G, const Handle(Interface_Protocol)&,
44    Interface_CheckIterator& checks,
45    Handle(Interface_InterfaceModel)& newmod)
46 {
47   Standard_Integer nbe = G.Size();
48   thefound = Standard_False;
49   themap.Nullify();
50   for (Standard_Integer i = 1; i <= nbe; i ++) {
51     DeclareAndCast(IGESData_IGESEntity,ent,G.Entity(i));
52     if (ent.IsNull()) continue;
53     Standard_Integer it = ent->TypeNumber();
54     if (it == 112 || it == 126) {
55       thefound = Standard_True;
56 #ifdef OCCT_DEBUG
57       std::cout<<"IGESSelect_SplineToBSpline : n0."<<i
58         << (it == 112 ? ", Curve" : ", Surface")<<" to convert"<<std::endl;
59 #endif
60     }
61   }
62   newmod.Nullify();
63   if (!thefound) return Standard_True;
64
65 //  Il faudrait convertir ...
66   checks.CCheck(0)->AddFail("IGESSelect_SplineToBSpline : not yet implemented");
67   return Standard_False;
68 }
69
70
71 Standard_Boolean  IGESSelect_SplineToBSpline::Updated
72   (const Handle(Standard_Transient)& entfrom,
73    Handle(Standard_Transient)& entto) const
74 {
75   if (!thefound) {
76     entto = entfrom;
77     return Standard_True;
78   }
79   if (themap.IsNull()) return Standard_False;
80   return themap->Search(entfrom,entto);
81 }
82
83
84 TCollection_AsciiString  IGESSelect_SplineToBSpline::Label () const
85 {
86   if (thetryc2) return TCollection_AsciiString
87     ("Convert Spline Forms to BSpline, trying to recover C1-C2 continuity");
88   else return TCollection_AsciiString ("Convert Spline Forms to BSpline");
89 }