0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / IGESAppli / IGESAppli_ToolPartNumber.cxx
CommitLineData
b311480e 1// Created by: CKY / Contract Toubro-Larsen
2// Copyright (c) 1993-1999 Matra Datavision
973c2be1 3// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
7fd59977 6//
d5f74e42 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
973c2be1 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.
7fd59977 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
16//--------------------------------------------------------------------
7fd59977 17//--------------------------------------------------------------------
18
42cf5bc1 19#include <IGESAppli_PartNumber.hxx>
20#include <IGESAppli_ToolPartNumber.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>
7fd59977 26#include <IGESData_ParamCursor.hxx>
42cf5bc1 27#include <IGESData_ParamReader.hxx>
28#include <Interface_Check.hxx>
29#include <Interface_CopyTool.hxx>
30#include <Interface_EntityIterator.hxx>
7fd59977 31#include <Interface_Macros.hxx>
42cf5bc1 32#include <Interface_ShareTool.hxx>
42cf5bc1 33#include <Standard_DomainError.hxx>
34#include <TCollection_HAsciiString.hxx>
7fd59977 35
36IGESAppli_ToolPartNumber::IGESAppli_ToolPartNumber () { }
37
38
39void IGESAppli_ToolPartNumber::ReadOwnParams
40 (const Handle(IGESAppli_PartNumber)& ent,
41 const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
42{
43 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
44 Standard_Integer tempNbPropertyValues;
45 Handle(TCollection_HAsciiString) tempGenericNumber;
46 Handle(TCollection_HAsciiString) tempMilitaryNumber;
47 Handle(TCollection_HAsciiString) tempVendorNumber;
48 Handle(TCollection_HAsciiString) tempInternalNumber;
49
50 //szv#4:S4163:12Mar99 `st=` not needed
51 if (PR.DefinedElseSkip())
52 PR.ReadInteger(PR.Current(), "Number of property values", tempNbPropertyValues);
53 else
54 tempNbPropertyValues = 4;
55
56 PR.ReadText(PR.Current(), "Generic Number or Name", tempGenericNumber);
57 PR.ReadText(PR.Current(), "Military Number or Name", tempMilitaryNumber);
58 PR.ReadText(PR.Current(), "Vendor Number or Name", tempVendorNumber);
59 PR.ReadText(PR.Current(), "Internal Number or Name", tempInternalNumber);
60 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
61 ent->Init(tempNbPropertyValues, tempGenericNumber,
62 tempMilitaryNumber, tempVendorNumber, tempInternalNumber);
63}
64
65void IGESAppli_ToolPartNumber::WriteOwnParams
66 (const Handle(IGESAppli_PartNumber)& ent, IGESData_IGESWriter& IW) const
67{
68 IW.Send(ent->NbPropertyValues());
69 IW.Send(ent->GenericNumber());
70 IW.Send(ent->MilitaryNumber());
71 IW.Send(ent->VendorNumber());
72 IW.Send(ent->InternalNumber());
73}
74
75void IGESAppli_ToolPartNumber::OwnShared
76 (const Handle(IGESAppli_PartNumber)& /* ent */, Interface_EntityIterator& /* iter */) const
77{
78}
79
80void IGESAppli_ToolPartNumber::OwnCopy
81 (const Handle(IGESAppli_PartNumber)& another,
82 const Handle(IGESAppli_PartNumber)& ent, Interface_CopyTool& /* TC */) const
83{
84 Standard_Integer tempNbPropertyValues = another->NbPropertyValues();
85 Handle(TCollection_HAsciiString) tempGenericNumber =
86 new TCollection_HAsciiString(another->GenericNumber());
87 Handle(TCollection_HAsciiString) tempMilitaryNumber =
88 new TCollection_HAsciiString(another->MilitaryNumber());
89 Handle(TCollection_HAsciiString) tempVendorNumber =
90 new TCollection_HAsciiString(another->VendorNumber());
91 Handle(TCollection_HAsciiString) tempInternalNumber =
92 new TCollection_HAsciiString(another->InternalNumber());
93 ent->Init(tempNbPropertyValues, tempGenericNumber, tempMilitaryNumber,
94 tempVendorNumber, tempInternalNumber);
95}
96
97Standard_Boolean IGESAppli_ToolPartNumber::OwnCorrect
98 (const Handle(IGESAppli_PartNumber)& ent) const
99{
100 Standard_Boolean res = (ent->NbPropertyValues() != 4);
101 if (res) ent->Init
102 (4,ent->GenericNumber(),ent->MilitaryNumber(),ent->VendorNumber(),
103 ent->InternalNumber()); // nbpropertyvalues= 4
104 return res;
105}
106
107IGESData_DirChecker IGESAppli_ToolPartNumber::DirChecker
108 (const Handle(IGESAppli_PartNumber)& /* ent */ ) const
109{
110 IGESData_DirChecker DC(406, 9);
111 DC.Structure(IGESData_DefVoid);
112 DC.GraphicsIgnored();
113 DC.LineFont(IGESData_DefVoid);
114 DC.LineWeight(IGESData_DefVoid);
115 DC.Color(IGESData_DefVoid);
116 DC.BlankStatusIgnored();
117 DC.UseFlagIgnored();
118 DC.HierarchyStatusIgnored();
119 return DC;
120}
121
122void IGESAppli_ToolPartNumber::OwnCheck
123 (const Handle(IGESAppli_PartNumber)& ent,
124 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
125{
126 if (ent->NbPropertyValues() != 4)
127 ach->AddFail("Number of property values != 4");
128}
129
130void IGESAppli_ToolPartNumber::OwnDump
131 (const Handle(IGESAppli_PartNumber)& ent, const IGESData_IGESDumper& /* dumper */,
0ebe5b0a 132 Standard_OStream& S, const Standard_Integer /* level */) const
7fd59977 133{
134 //Standard_Integer sublevel = (level > 4) ? 1 : 0; //szv#4:S4163:12Mar99 unused
0ebe5b0a 135 S << "IGESAppli_PartNumber\n";
136 S << "Number of property values : " << ent->NbPropertyValues() << "\n";
7fd59977 137 S << "Generic Number or Name : ";
138 IGESData_DumpString(S,ent->GenericNumber());
0ebe5b0a 139 S << "\n";
7fd59977 140 S << "Military Number or Name : ";
141 IGESData_DumpString(S,ent->MilitaryNumber());
0ebe5b0a 142 S << "\n";
7fd59977 143 S << "Vendor Number or Name : ";
144 IGESData_DumpString(S,ent->VendorNumber());
0ebe5b0a 145 S << "\n";
7fd59977 146 S << "Internal Number or Name : ";
147 IGESData_DumpString(S,ent->InternalNumber());
0ebe5b0a 148 S << std::endl;
7fd59977 149}