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_LevelFunction.hxx> |
20 | #include <IGESAppli_ToolLevelFunction.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> |
33 | #include <Message_Messenger.hxx> |
34 | #include <Standard_DomainError.hxx> |
35 | #include <TCollection_HAsciiString.hxx> |
7fd59977 |
36 | |
37 | IGESAppli_ToolLevelFunction::IGESAppli_ToolLevelFunction () { } |
38 | |
39 | |
40 | void IGESAppli_ToolLevelFunction::ReadOwnParams |
41 | (const Handle(IGESAppli_LevelFunction)& ent, |
42 | const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const |
43 | { |
44 | Standard_Integer tempNbPropertyValues; |
45 | Standard_Integer tempFuncDescripCode; |
46 | Handle(TCollection_HAsciiString) tempFuncDescrip; |
47 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
48 | |
49 | //szv#4:S4163:12Mar99 `st=` not needed |
50 | PR.ReadInteger(PR.Current(),"No. of Property values", tempNbPropertyValues); |
51 | |
52 | if (PR.DefinedElseSkip()) |
53 | PR.ReadInteger(PR.Current(),"Function description code",tempFuncDescripCode); |
54 | else |
55 | tempFuncDescripCode = 0; |
56 | |
57 | if (PR.DefinedElseSkip()) |
58 | PR.ReadText(PR.Current(),"Function description",tempFuncDescrip); |
59 | |
60 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
61 | ent->Init (tempNbPropertyValues,tempFuncDescripCode,tempFuncDescrip); |
62 | } |
63 | |
64 | void IGESAppli_ToolLevelFunction::WriteOwnParams |
65 | (const Handle(IGESAppli_LevelFunction)& ent, IGESData_IGESWriter& IW) const |
66 | { |
67 | IW.Send(ent->NbPropertyValues()); |
68 | IW.Send(ent->FuncDescriptionCode()); |
69 | if (ent->FuncDescription().IsNull()) IW.SendVoid(); |
70 | else IW.Send(ent->FuncDescription()); |
71 | } |
72 | |
73 | void IGESAppli_ToolLevelFunction::OwnShared |
74 | (const Handle(IGESAppli_LevelFunction)& /* ent */, Interface_EntityIterator& /* iter */) const |
75 | { |
76 | } |
77 | |
78 | void IGESAppli_ToolLevelFunction::OwnCopy |
79 | (const Handle(IGESAppli_LevelFunction)& another, |
80 | const Handle(IGESAppli_LevelFunction)& ent, Interface_CopyTool& /* TC */) const |
81 | { |
82 | Standard_Integer aNbPropertyValues, code; |
83 | Handle(TCollection_HAsciiString) descrip; |
84 | if (!another->FuncDescription().IsNull()) descrip = |
85 | new TCollection_HAsciiString(another->FuncDescription()); |
86 | code = another->FuncDescriptionCode(); |
87 | aNbPropertyValues = another->NbPropertyValues(); |
88 | |
89 | ent->Init(aNbPropertyValues,code,descrip); |
90 | } |
91 | |
92 | Standard_Boolean IGESAppli_ToolLevelFunction::OwnCorrect |
93 | (const Handle(IGESAppli_LevelFunction)& ent) const |
94 | { |
95 | Standard_Boolean res = (ent->NbPropertyValues() != 2); |
96 | if (res) ent->Init(2,ent->FuncDescriptionCode(),ent->FuncDescription()); |
97 | return res; // nbpropertyvalues = 2 |
98 | } |
99 | |
100 | IGESData_DirChecker IGESAppli_ToolLevelFunction::DirChecker |
101 | (const Handle(IGESAppli_LevelFunction)& /* ent */ ) const |
102 | { |
103 | IGESData_DirChecker DC(406,3); //Form no = 3 & Type = 406 |
104 | DC.Structure(IGESData_DefVoid); |
105 | DC.GraphicsIgnored(); |
106 | DC.BlankStatusIgnored(); |
107 | DC.UseFlagIgnored(); |
108 | DC.HierarchyStatusIgnored(); |
109 | DC.SubordinateStatusRequired(00); |
110 | return DC; |
111 | } |
112 | |
113 | void IGESAppli_ToolLevelFunction::OwnCheck |
114 | (const Handle(IGESAppli_LevelFunction)& ent, |
115 | const Interface_ShareTool& , Handle(Interface_Check)& ach) const |
116 | { |
117 | if (ent->NbPropertyValues() != 2) |
118 | ach->AddFail("Number of Property Values != 2"); |
119 | } |
120 | |
121 | void IGESAppli_ToolLevelFunction::OwnDump |
122 | (const Handle(IGESAppli_LevelFunction)& ent, const IGESData_IGESDumper& /* dumper */, |
0ebe5b0a |
123 | Standard_OStream& S, const Standard_Integer /* level */) const |
7fd59977 |
124 | { |
0ebe5b0a |
125 | S << "IGESAppli_LevelFunction\n"; |
7fd59977 |
126 | |
0ebe5b0a |
127 | S << "Number of property values : " << ent->NbPropertyValues() << "\n"; |
128 | S << "Function Description code : " << ent->FuncDescriptionCode() << "\n"; |
7fd59977 |
129 | S << "Function Description : "; |
130 | IGESData_DumpString(S,ent->FuncDescription()); |
0ebe5b0a |
131 | S << "\n"; |
7fd59977 |
132 | } |