0024428: Implementation of LGPL license
[occt.git] / src / IGESDimen / IGESDimen_Protocol.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
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #include <IGESDimen_Protocol.ixx>
15
16 #include <IGESDimen_GeneralNote.hxx>
17 #include <IGESDimen_AngularDimension.hxx>
18 #include <IGESDimen_GeneralSymbol.hxx>
19 #include <IGESDimen_BasicDimension.hxx>
20 #include <IGESDimen_LeaderArrow.hxx>
21 #include <IGESDimen_CenterLine.hxx>
22 #include <IGESDimen_LinearDimension.hxx>
23 #include <IGESDimen_CurveDimension.hxx>
24 #include <IGESDimen_NewDimensionedGeometry.hxx>
25 #include <IGESDimen_DiameterDimension.hxx>
26 #include <IGESDimen_NewGeneralNote.hxx>
27 #include <IGESDimen_DimensionDisplayData.hxx>
28 #include <IGESDimen_OrdinateDimension.hxx>
29 #include <IGESDimen_DimensionTolerance.hxx>
30 #include <IGESDimen_PointDimension.hxx>
31 #include <IGESDimen_DimensionUnits.hxx>
32 #include <IGESDimen_RadiusDimension.hxx>
33 #include <IGESDimen_DimensionedGeometry.hxx>
34 #include <IGESDimen_Section.hxx>
35 #include <IGESDimen_SectionedArea.hxx>
36 #include <IGESDimen_FlagNote.hxx>
37 #include <IGESDimen_WitnessLine.hxx>
38 #include <IGESDimen_GeneralLabel.hxx>
39
40 #include <IGESGeom.hxx>
41 #include <IGESGraph.hxx>
42 #include <IGESGeom_Protocol.hxx>
43 #include <IGESGraph_Protocol.hxx>
44
45 static int deja = 0;
46 static Handle(Standard_Type) atype01,atype02,atype03,atype04,atype05,atype06,
47   atype07,atype08,atype09,atype10,atype11,atype12,atype13,atype14,atype15,
48   atype16,atype17,atype18,atype19,atype20,atype21,atype22,atype23;
49
50     IGESDimen_Protocol::IGESDimen_Protocol ()
51 {
52   if (deja) return;  deja = 1;
53   atype01 = STANDARD_TYPE(IGESDimen_AngularDimension);
54   atype02 = STANDARD_TYPE(IGESDimen_BasicDimension);
55   atype03 = STANDARD_TYPE(IGESDimen_CenterLine);
56   atype04 = STANDARD_TYPE(IGESDimen_CurveDimension);
57   atype05 = STANDARD_TYPE(IGESDimen_DiameterDimension);
58   atype06 = STANDARD_TYPE(IGESDimen_DimensionDisplayData);
59   atype07 = STANDARD_TYPE(IGESDimen_DimensionTolerance);
60   atype08 = STANDARD_TYPE(IGESDimen_DimensionUnits);
61   atype09 = STANDARD_TYPE(IGESDimen_DimensionedGeometry);
62   atype10 = STANDARD_TYPE(IGESDimen_FlagNote);
63   atype11 = STANDARD_TYPE(IGESDimen_GeneralLabel);
64   atype12 = STANDARD_TYPE(IGESDimen_GeneralNote);
65   atype13 = STANDARD_TYPE(IGESDimen_GeneralSymbol);
66   atype14 = STANDARD_TYPE(IGESDimen_LeaderArrow);
67   atype15 = STANDARD_TYPE(IGESDimen_LinearDimension);
68   atype16 = STANDARD_TYPE(IGESDimen_NewDimensionedGeometry);
69   atype17 = STANDARD_TYPE(IGESDimen_NewGeneralNote);
70   atype18 = STANDARD_TYPE(IGESDimen_OrdinateDimension);
71   atype10 = STANDARD_TYPE(IGESDimen_PointDimension);
72   atype20 = STANDARD_TYPE(IGESDimen_RadiusDimension);
73   atype21 = STANDARD_TYPE(IGESDimen_Section);
74   atype22 = STANDARD_TYPE(IGESDimen_SectionedArea);
75   atype23 = STANDARD_TYPE(IGESDimen_WitnessLine);
76 }
77
78     Standard_Integer IGESDimen_Protocol::NbResources () const
79       {  return 2;  }
80
81     Handle(Interface_Protocol) IGESDimen_Protocol::Resource
82   (const Standard_Integer num) const
83 {
84   Handle(Interface_Protocol) res;
85   if (num == 1) res = IGESGraph::Protocol();
86   if (num == 2) res = IGESGeom::Protocol();
87   return res;
88 }
89
90     Standard_Integer IGESDimen_Protocol::TypeNumber
91   (const Handle(Standard_Type)& atype) const
92 {
93   if      (atype == atype01) return  1;
94   else if (atype == atype02) return  2;
95   else if (atype == atype03) return  3;
96   else if (atype == atype04) return  4;
97   else if (atype == atype05) return  5;
98   else if (atype == atype06) return  6;
99   else if (atype == atype07) return  7;
100   else if (atype == atype08) return  8;
101   else if (atype == atype09) return  9;
102   else if (atype == atype10) return 10;
103   else if (atype == atype11) return 11;
104   else if (atype == atype12) return 12;
105   else if (atype == atype13) return 13;
106   else if (atype == atype14) return 14;
107   else if (atype == atype15) return 15;
108   else if (atype == atype16) return 16;
109   else if (atype == atype17) return 17;
110   else if (atype == atype18) return 18;
111   else if (atype == atype19) return 19;
112   else if (atype == atype20) return 20;
113   else if (atype == atype21) return 21;
114   else if (atype == atype22) return 22;
115   else if (atype == atype23) return 23;
116   return 0;
117 }