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 | |
19 | #include <IGESAppli_ToolReferenceDesignator.ixx> |
20 | #include <IGESData_ParamCursor.hxx> |
21 | #include <TCollection_HAsciiString.hxx> |
22 | #include <IGESData_LevelListEntity.hxx> |
23 | #include <Interface_Macros.hxx> |
24 | #include <IGESData_Dump.hxx> |
25 | |
26 | |
27 | IGESAppli_ToolReferenceDesignator::IGESAppli_ToolReferenceDesignator () { } |
28 | |
29 | |
30 | void IGESAppli_ToolReferenceDesignator::ReadOwnParams |
31 | (const Handle(IGESAppli_ReferenceDesignator)& ent, |
32 | const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const |
33 | { |
34 | Standard_Integer tempNbPropertyValues; |
35 | Handle(TCollection_HAsciiString) tempReferenceDesignator; |
36 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
37 | |
38 | //szv#4:S4163:12Mar99 `st=` not needed |
39 | PR.ReadInteger(PR.Current(),"Number of property values",tempNbPropertyValues); |
40 | PR.ReadText(PR.Current(),"ReferenceDesignator",tempReferenceDesignator); |
41 | |
42 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
43 | ent->Init(tempNbPropertyValues,tempReferenceDesignator); |
44 | } |
45 | |
46 | void IGESAppli_ToolReferenceDesignator::WriteOwnParams |
47 | (const Handle(IGESAppli_ReferenceDesignator)& ent, IGESData_IGESWriter& IW) const |
48 | { |
49 | IW.Send(ent->NbPropertyValues()); |
50 | IW.Send(ent->RefDesignatorText()); |
51 | } |
52 | |
53 | void IGESAppli_ToolReferenceDesignator::OwnShared |
54 | (const Handle(IGESAppli_ReferenceDesignator)& /* ent */, Interface_EntityIterator& /* iter */) const |
55 | { |
56 | } |
57 | |
58 | void IGESAppli_ToolReferenceDesignator::OwnCopy |
59 | (const Handle(IGESAppli_ReferenceDesignator)& another, |
60 | const Handle(IGESAppli_ReferenceDesignator)& ent, Interface_CopyTool& /* TC */) const |
61 | { |
62 | Standard_Integer aNbPropertyValues; |
63 | Handle(TCollection_HAsciiString) aReferenceDesignator = |
64 | new TCollection_HAsciiString(another->RefDesignatorText()); |
65 | aNbPropertyValues = another->NbPropertyValues(); |
66 | ent->Init(aNbPropertyValues,aReferenceDesignator); |
67 | } |
68 | |
69 | Standard_Boolean IGESAppli_ToolReferenceDesignator::OwnCorrect |
70 | (const Handle(IGESAppli_ReferenceDesignator)& ent) const |
71 | { |
72 | Standard_Boolean res = (ent->NbPropertyValues() != 1); |
73 | if (res) ent->Init(1,ent->RefDesignatorText()); |
74 | // nbpropertyvalues=1 |
75 | if (ent->SubordinateStatus() != 0) { |
76 | Handle(IGESData_LevelListEntity) nulevel; |
77 | ent->InitLevel(nulevel,0); |
78 | res = Standard_True; |
79 | } |
80 | return res; // + RAZ level selon subordibate |
81 | } |
82 | |
83 | IGESData_DirChecker IGESAppli_ToolReferenceDesignator::DirChecker |
84 | (const Handle(IGESAppli_ReferenceDesignator)& /* ent */ ) const |
85 | { |
86 | //UNFINISHED |
87 | IGESData_DirChecker DC(406,7); //Form no = 7 & Type = 406 |
88 | DC.Structure(IGESData_DefVoid); |
89 | DC.GraphicsIgnored(); |
90 | DC.BlankStatusIgnored(); |
91 | DC.UseFlagIgnored(); |
92 | DC.HierarchyStatusIgnored(); |
93 | return DC; |
94 | } |
95 | |
96 | void IGESAppli_ToolReferenceDesignator::OwnCheck |
97 | (const Handle(IGESAppli_ReferenceDesignator)& ent, |
98 | const Interface_ShareTool& , Handle(Interface_Check)& ach) const |
99 | { |
100 | if (ent->SubordinateStatus() != 0) |
101 | //the level is ignored if this property is subordinate |
102 | if (ent->DefLevel() != IGESData_DefOne && |
103 | ent->DefLevel() != IGESData_DefSeveral) |
104 | ach->AddFail("Level type: Not value/reference"); |
105 | if (ent->NbPropertyValues() != 1) |
106 | ach->AddFail("Number of Property Values != 1"); |
107 | //UNFINISHED |
108 | //the level is ignored if this property is subordinate -- queried |
109 | } |
110 | |
111 | void IGESAppli_ToolReferenceDesignator::OwnDump |
112 | (const Handle(IGESAppli_ReferenceDesignator)& ent, const IGESData_IGESDumper& /* dumper */, |
113 | const Handle(Message_Messenger)& S, const Standard_Integer /* level */) const |
114 | { |
115 | S << "IGESAppli_ReferenceDesignator" << endl; |
116 | S << "Number of Property Values : " << ent->NbPropertyValues() << endl; |
117 | S << "ReferenceDesignator : "; |
118 | IGESData_DumpString(S,ent->RefDesignatorText()); |
119 | S << endl; |
120 | } |