0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / IGESAppli / IGESAppli_ToolPinNumber.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_PinNumber.hxx>
20 #include <IGESAppli_ToolPinNumber.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_LevelListEntity.hxx>
27 #include <IGESData_ParamCursor.hxx>
28 #include <IGESData_ParamReader.hxx>
29 #include <Interface_Check.hxx>
30 #include <Interface_CopyTool.hxx>
31 #include <Interface_EntityIterator.hxx>
32 #include <Interface_Macros.hxx>
33 #include <Interface_ShareTool.hxx>
34 #include <Message_Messenger.hxx>
35 #include <Standard_DomainError.hxx>
36 #include <TCollection_HAsciiString.hxx>
37
38 IGESAppli_ToolPinNumber::IGESAppli_ToolPinNumber ()    {  }
39
40
41 void  IGESAppli_ToolPinNumber::ReadOwnParams
42   (const Handle(IGESAppli_PinNumber)& ent,
43    const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
44 {
45   Standard_Integer tempNbPropertyValues;
46   Handle(TCollection_HAsciiString) tempPinNumber;
47   //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
48
49   //szv#4:S4163:12Mar99 `st=` not needed
50   PR.ReadInteger(PR.Current(),"Number of property values",tempNbPropertyValues);
51   PR.ReadText(PR.Current(),"PinNumber",tempPinNumber);
52
53   DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
54   ent->Init(tempNbPropertyValues,tempPinNumber);
55 }
56
57 void  IGESAppli_ToolPinNumber::WriteOwnParams
58   (const Handle(IGESAppli_PinNumber)& ent, IGESData_IGESWriter& IW) const
59 {
60   IW.Send(ent->NbPropertyValues());
61   IW.Send(ent->PinNumberVal());
62 }
63
64 void  IGESAppli_ToolPinNumber::OwnShared
65   (const Handle(IGESAppli_PinNumber)& /* ent */, Interface_EntityIterator& /* iter */) const
66 {
67 }
68
69 void  IGESAppli_ToolPinNumber::OwnCopy
70   (const Handle(IGESAppli_PinNumber)& another,
71    const Handle(IGESAppli_PinNumber)& ent, Interface_CopyTool& /* TC */) const
72 {
73   Standard_Integer aNbPropertyValues;
74   Handle(TCollection_HAsciiString) aPinNumber =
75     new TCollection_HAsciiString(another->PinNumberVal());
76   aNbPropertyValues = another->NbPropertyValues();
77   ent->Init(aNbPropertyValues,aPinNumber);
78 }
79
80 Standard_Boolean  IGESAppli_ToolPinNumber::OwnCorrect
81   (const Handle(IGESAppli_PinNumber)& ent) const
82 {
83   Standard_Boolean res = (ent->SubordinateStatus() != 0);
84   if (res) {
85     Handle(IGESData_LevelListEntity) nulevel;
86     ent->InitLevel(nulevel,0);
87   }
88   return res;    // RAZ level selon subordibate
89 }
90
91 IGESData_DirChecker  IGESAppli_ToolPinNumber::DirChecker
92   (const Handle(IGESAppli_PinNumber)& /* ent */ ) const
93 {
94   IGESData_DirChecker DC(406,8);  //Form no = 8 & Type = 406
95   DC.Structure(IGESData_DefVoid);
96   DC.GraphicsIgnored();
97   DC.BlankStatusIgnored();
98   DC.UseFlagIgnored();
99   DC.HierarchyStatusIgnored();
100   return DC;
101 }
102
103 void  IGESAppli_ToolPinNumber::OwnCheck
104   (const Handle(IGESAppli_PinNumber)& ent,
105    const Interface_ShareTool& , Handle(Interface_Check)& ach) const
106 {
107   if (ent->SubordinateStatus() != 0)
108     if (ent->DefLevel() != IGESData_DefOne &&
109         ent->DefLevel() != IGESData_DefSeveral)
110       ach->AddFail("Level type: Incorrect");
111   if (ent->NbPropertyValues() != 1)
112     ach->AddFail("Number of Property Values != 1");
113   //UNFINISHED
114   //Level to be ignored if the property is subordinate -- queried
115 }
116
117 void  IGESAppli_ToolPinNumber::OwnDump
118   (const Handle(IGESAppli_PinNumber)& ent, const IGESData_IGESDumper& /* dumper */,
119    Standard_OStream& S, const Standard_Integer /* level */) const
120 {
121   S << "IGESAppli_PinNumber\n";
122   S << "Number of Property Values : " << ent->NbPropertyValues() << "\n";
123   S << "PinNumber : ";
124   IGESData_DumpString(S,ent->PinNumberVal());
125   S << std::endl;
126 }