0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / IGESAppli / IGESAppli_ToolPWBArtworkStackup.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18
19 #include <IGESAppli_PWBArtworkStackup.hxx>
20 #include <IGESAppli_ToolPWBArtworkStackup.hxx>
21 #include <IGESData_DirChecker.hxx>
22 #include <IGESData_Dump.hxx>
23 #include <IGESData_IGESDumper.hxx>
24 #include <IGESData_IGESReaderData.hxx>
25 #include <IGESData_IGESWriter.hxx>
26 #include <IGESData_ParamCursor.hxx>
27 #include <IGESData_ParamReader.hxx>
28 #include <Interface_Check.hxx>
29 #include <Interface_CopyTool.hxx>
30 #include <Interface_EntityIterator.hxx>
31 #include <Interface_Macros.hxx>
32 #include <Interface_ShareTool.hxx>
33 #include <Message_Messenger.hxx>
34 #include <Standard_DomainError.hxx>
35 #include <TCollection_HAsciiString.hxx>
36 #include <TColStd_HArray1OfInteger.hxx>
37
38 IGESAppli_ToolPWBArtworkStackup::IGESAppli_ToolPWBArtworkStackup ()    {  }
39
40
41 void  IGESAppli_ToolPWBArtworkStackup::ReadOwnParams
42   (const Handle(IGESAppli_PWBArtworkStackup)& ent,
43    const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
44 {
45   //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
46   Standard_Integer num;
47   Standard_Integer tempNbPropertyValues;
48   Handle(TCollection_HAsciiString) tempArtworkStackupIdent;
49   Handle(TColStd_HArray1OfInteger) tempLevelNumbers;
50   //szv#4:S4163:12Mar99 `st=` not needed
51   PR.ReadInteger(PR.Current(), "Number of property values", tempNbPropertyValues);
52   PR.ReadText(PR.Current(), "Artwork Stackup Identification", tempArtworkStackupIdent);
53   if (!PR.ReadInteger(PR.Current(), "Number of level numbers", num)) num = 0;
54   if (num > 0) tempLevelNumbers = new TColStd_HArray1OfInteger(1, num);
55   else  PR.AddFail("Number of level numbers: Not Positive");
56   if (!tempLevelNumbers.IsNull())
57     PR.ReadInts(PR.CurrentList(num), "Level Numbers", tempLevelNumbers);
58
59   DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
60   ent->Init (tempNbPropertyValues, tempArtworkStackupIdent, tempLevelNumbers);
61 }
62
63 void  IGESAppli_ToolPWBArtworkStackup::WriteOwnParams
64   (const Handle(IGESAppli_PWBArtworkStackup)& ent, IGESData_IGESWriter& IW) const
65 {
66   Standard_Integer i, num;
67   IW.Send(ent->NbPropertyValues());
68   IW.Send(ent->Identification());
69   IW.Send(ent->NbLevelNumbers());
70   for ( num = ent->NbLevelNumbers(), i = 1; i <= num; i++ )
71     IW.Send(ent->LevelNumber(i));
72 }
73
74 void  IGESAppli_ToolPWBArtworkStackup::OwnShared
75   (const Handle(IGESAppli_PWBArtworkStackup)& /* ent */, Interface_EntityIterator& /* iter */) const
76 {
77 }
78
79 void  IGESAppli_ToolPWBArtworkStackup::OwnCopy
80   (const Handle(IGESAppli_PWBArtworkStackup)& another,
81    const Handle(IGESAppli_PWBArtworkStackup)& ent, Interface_CopyTool& /* TC */) const
82 {
83   Standard_Integer num = another->NbLevelNumbers();
84   Standard_Integer tempNbPropertyValues = another->NbPropertyValues();
85   Handle(TCollection_HAsciiString) tempArtworkStackupIdent =
86     new TCollection_HAsciiString(another->Identification());
87   Handle(TColStd_HArray1OfInteger) tempLevelNumbers =
88     new TColStd_HArray1OfInteger(1, num);
89   for ( Standard_Integer i = 1; i <= num; i++ )
90     tempLevelNumbers->SetValue(i, another->LevelNumber(i));
91   ent->Init(tempNbPropertyValues, tempArtworkStackupIdent, tempLevelNumbers);
92 }
93
94 IGESData_DirChecker  IGESAppli_ToolPWBArtworkStackup::DirChecker
95   (const Handle(IGESAppli_PWBArtworkStackup)& /* ent */ ) const
96 {
97   IGESData_DirChecker DC(406, 25);
98   DC.Structure(IGESData_DefVoid);
99   DC.GraphicsIgnored();
100   DC.LineFont(IGESData_DefVoid);
101   DC.LineWeight(IGESData_DefVoid);
102   DC.Color(IGESData_DefVoid);
103   DC.BlankStatusIgnored();
104   DC.UseFlagIgnored();
105   DC.HierarchyStatusIgnored();
106   return DC;
107 }
108
109 void  IGESAppli_ToolPWBArtworkStackup::OwnCheck
110   (const Handle(IGESAppli_PWBArtworkStackup)& /* ent */,
111    const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
112 {
113 }
114
115 void  IGESAppli_ToolPWBArtworkStackup::OwnDump
116   (const Handle(IGESAppli_PWBArtworkStackup)& ent, const IGESData_IGESDumper& /* dumper */,
117    Standard_OStream& S, const Standard_Integer level) const
118 {
119   S << "IGESAppli_PWBArtworkStackup\n";
120   S << "Number of property values : " << ent->NbPropertyValues() << "\n";
121   S << "Artwork Stackup Identification : ";
122   IGESData_DumpString(S,ent->Identification());
123   S << "\n";
124   S << "Level Numbers : ";
125   IGESData_DumpVals(S,level,1, ent->NbLevelNumbers(),ent->LevelNumber);
126   S << std::endl;
127 }