0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / IGESAppli / IGESAppli_ToolReferenceDesignator.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_ReferenceDesignator.hxx>
20 #include <IGESAppli_ToolReferenceDesignator.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_ToolReferenceDesignator::IGESAppli_ToolReferenceDesignator ()    {  }
39
40
41 void  IGESAppli_ToolReferenceDesignator::ReadOwnParams
42   (const Handle(IGESAppli_ReferenceDesignator)& ent,
43    const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const
44 {
45   Standard_Integer tempNbPropertyValues;
46   Handle(TCollection_HAsciiString) tempReferenceDesignator;
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(),"ReferenceDesignator",tempReferenceDesignator);
52
53   DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
54   ent->Init(tempNbPropertyValues,tempReferenceDesignator);
55 }
56
57 void  IGESAppli_ToolReferenceDesignator::WriteOwnParams
58   (const Handle(IGESAppli_ReferenceDesignator)& ent, IGESData_IGESWriter& IW) const
59 {
60   IW.Send(ent->NbPropertyValues());
61   IW.Send(ent->RefDesignatorText());
62 }
63
64 void  IGESAppli_ToolReferenceDesignator::OwnShared
65   (const Handle(IGESAppli_ReferenceDesignator)& /* ent */, Interface_EntityIterator& /* iter */) const
66 {
67 }
68
69 void  IGESAppli_ToolReferenceDesignator::OwnCopy
70   (const Handle(IGESAppli_ReferenceDesignator)& another,
71    const Handle(IGESAppli_ReferenceDesignator)& ent, Interface_CopyTool& /* TC */) const
72 {
73   Standard_Integer aNbPropertyValues;
74   Handle(TCollection_HAsciiString) aReferenceDesignator =
75     new TCollection_HAsciiString(another->RefDesignatorText());
76   aNbPropertyValues = another->NbPropertyValues();
77   ent->Init(aNbPropertyValues,aReferenceDesignator);
78 }
79
80 Standard_Boolean  IGESAppli_ToolReferenceDesignator::OwnCorrect
81   (const Handle(IGESAppli_ReferenceDesignator)& ent) const
82 {
83   Standard_Boolean res = (ent->NbPropertyValues() != 1);
84   if (res) ent->Init(1,ent->RefDesignatorText());
85 //         nbpropertyvalues=1
86   if (ent->SubordinateStatus() != 0) {
87     Handle(IGESData_LevelListEntity) nulevel;
88     ent->InitLevel(nulevel,0);
89     res = Standard_True;
90   }
91   return res;    // + RAZ level selon subordibate
92 }
93
94 IGESData_DirChecker  IGESAppli_ToolReferenceDesignator::DirChecker
95   (const Handle(IGESAppli_ReferenceDesignator)& /* ent */ ) const
96 {
97   //UNFINISHED
98   IGESData_DirChecker DC(406,7);  //Form no = 7 & Type = 406
99   DC.Structure(IGESData_DefVoid);
100   DC.GraphicsIgnored();
101   DC.BlankStatusIgnored();
102   DC.UseFlagIgnored();
103   DC.HierarchyStatusIgnored();
104   return DC;
105 }
106
107 void  IGESAppli_ToolReferenceDesignator::OwnCheck
108   (const Handle(IGESAppli_ReferenceDesignator)& ent,
109    const Interface_ShareTool& , Handle(Interface_Check)& ach) const
110 {
111   if (ent->SubordinateStatus() != 0)
112     //the level is ignored if this property is subordinate
113     if (ent->DefLevel() != IGESData_DefOne &&
114         ent->DefLevel() != IGESData_DefSeveral)
115       ach->AddFail("Level type: Not value/reference");
116   if (ent->NbPropertyValues() != 1)
117     ach->AddFail("Number of Property Values != 1");
118   //UNFINISHED
119   //the level is ignored if this property is subordinate -- queried
120 }
121
122 void  IGESAppli_ToolReferenceDesignator::OwnDump
123   (const Handle(IGESAppli_ReferenceDesignator)& ent, const IGESData_IGESDumper& /* dumper */,
124    Standard_OStream& S, const Standard_Integer /* level */) const
125 {
126   S << "IGESAppli_ReferenceDesignator\n";
127   S << "Number of Property Values : " << ent->NbPropertyValues() << "\n";
128   S << "ReferenceDesignator : ";
129   IGESData_DumpString(S,ent->RefDesignatorText());
130   S << std::endl;
131 }