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 <IGESData_DirChecker.hxx> |
20 | #include <IGESData_Dump.hxx> |
21 | #include <IGESData_IGESDumper.hxx> |
22 | #include <IGESData_IGESReaderData.hxx> |
23 | #include <IGESData_IGESWriter.hxx> |
7fd59977 |
24 | #include <IGESData_ParamCursor.hxx> |
42cf5bc1 |
25 | #include <IGESData_ParamReader.hxx> |
26 | #include <IGESGraph_NominalSize.hxx> |
27 | #include <IGESGraph_ToolNominalSize.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 | IGESGraph_ToolNominalSize::IGESGraph_ToolNominalSize () { } |
38 | |
39 | |
40 | void IGESGraph_ToolNominalSize::ReadOwnParams |
41 | (const Handle(IGESGraph_NominalSize)& ent, |
42 | const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const |
43 | { |
44 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
45 | |
46 | Standard_Integer nbPropertyValues; |
47 | Standard_Real nominalSizeValue; |
48 | Handle(TCollection_HAsciiString) nominalSizeName; |
49 | Handle(TCollection_HAsciiString) standardName; |
50 | |
51 | // Reading nbPropertyValues(Integer) |
52 | PR.ReadInteger(PR.Current(), "No. of property values", nbPropertyValues); //szv#4:S4163:12Mar99 `st=` not needed |
53 | if ( (nbPropertyValues != 2) && (nbPropertyValues != 3) ) |
54 | PR.AddFail("No. of Property values : Value is not 2/3"); |
55 | |
56 | // Reading nominalSizeValue(Real) |
57 | PR.ReadReal (PR.Current(), "Nominal size value", nominalSizeValue); //szv#4:S4163:12Mar99 `st=` not needed |
58 | |
59 | // Reading nominalSizeName(String) |
60 | PR.ReadText (PR.Current(), "Nominal size name", nominalSizeName); //szv#4:S4163:12Mar99 `st=` not needed |
61 | |
62 | if ( PR.NbParams() >= PR.CurrentNumber() ) |
63 | { |
64 | Standard_Integer num = PR.CurrentNumber(); |
65 | if ( PR.ParamType(num) == Interface_ParamText ) |
66 | // Reading standardName(String) |
67 | PR.ReadText (PR.Current(), "Name of relevant engg. standard", |
68 | standardName); //szv#4:S4163:12Mar99 `st=` not needed |
69 | } |
70 | |
71 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
72 | ent->Init |
73 | (nbPropertyValues, nominalSizeValue, nominalSizeName, standardName); |
74 | } |
75 | |
76 | void IGESGraph_ToolNominalSize::WriteOwnParams |
77 | (const Handle(IGESGraph_NominalSize)& ent, IGESData_IGESWriter& IW) const |
78 | { |
79 | IW.Send( ent->NbPropertyValues() ); |
80 | IW.Send( ent->NominalSizeValue() ); |
81 | IW.Send( ent->NominalSizeName() ); |
82 | |
83 | if (ent->HasStandardName() ) |
84 | IW.Send( ent->StandardName() ); // optionnal |
85 | } |
86 | |
87 | void IGESGraph_ToolNominalSize::OwnShared |
88 | (const Handle(IGESGraph_NominalSize)& /*ent*/, Interface_EntityIterator& /*iter*/) const |
89 | { |
90 | } |
91 | |
92 | void IGESGraph_ToolNominalSize::OwnCopy |
93 | (const Handle(IGESGraph_NominalSize)& another, |
94 | const Handle(IGESGraph_NominalSize)& ent, Interface_CopyTool& /*TC*/) const |
95 | { |
96 | Standard_Integer nbPropertyValues; |
97 | Standard_Real nominalSizeValue; |
98 | Handle(TCollection_HAsciiString) nominalSizeName; |
99 | Handle(TCollection_HAsciiString) standardName; |
100 | |
101 | nbPropertyValues = another->NbPropertyValues(); |
102 | nominalSizeValue = another->NominalSizeValue(); |
103 | nominalSizeName = new TCollection_HAsciiString(another->NominalSizeName()); |
104 | if (another->HasStandardName()) standardName = |
105 | new TCollection_HAsciiString(another->StandardName()); |
106 | |
107 | ent->Init(nbPropertyValues, nominalSizeValue, nominalSizeName, standardName); |
108 | } |
109 | |
110 | Standard_Boolean IGESGraph_ToolNominalSize::OwnCorrect |
111 | (const Handle(IGESGraph_NominalSize)& ent) const |
112 | { |
113 | Standard_Integer nbp = 2; |
114 | if (ent->HasStandardName()) nbp = 3; |
115 | Standard_Boolean res = ( ent->NbPropertyValues() != nbp); |
116 | if (res) ent->Init |
117 | (nbp,ent->NominalSizeValue(),ent->NominalSizeName(),ent->StandardName()); |
118 | return res; // nbpropertyvalues=2/3 selon standard |
119 | } |
120 | |
121 | IGESData_DirChecker IGESGraph_ToolNominalSize::DirChecker |
122 | (const Handle(IGESGraph_NominalSize)& /*ent*/) const |
123 | { |
124 | IGESData_DirChecker DC (406, 13); |
125 | DC.Structure(IGESData_DefVoid); |
126 | DC.LineFont(IGESData_DefVoid); |
127 | DC.LineWeight(IGESData_DefVoid); |
128 | DC.Color(IGESData_DefVoid); |
129 | DC.BlankStatusIgnored(); |
130 | DC.UseFlagIgnored(); |
131 | DC.HierarchyStatusIgnored(); |
132 | return DC; |
133 | } |
134 | |
135 | void IGESGraph_ToolNominalSize::OwnCheck |
136 | (const Handle(IGESGraph_NominalSize)& ent, |
137 | const Interface_ShareTool& , Handle(Interface_Check)& ach) const |
138 | { |
139 | Standard_Integer nbp = 2; |
140 | if (ent->HasStandardName()) nbp = 3; |
141 | if ( ent->NbPropertyValues() != nbp) ach->AddFail |
142 | ("No. of Property values : Value != 2/3 according Standard Name Status"); |
143 | } |
144 | |
145 | void IGESGraph_ToolNominalSize::OwnDump |
146 | (const Handle(IGESGraph_NominalSize)& ent, const IGESData_IGESDumper& /*dumper*/, |
0ebe5b0a |
147 | Standard_OStream& S, const Standard_Integer /*level*/) const |
7fd59977 |
148 | { |
0ebe5b0a |
149 | S << "IGESGraph_NominalSize\n" |
150 | << "No. of property values : " << ent->NbPropertyValues() << "\n" |
151 | << "Nominal size value : " << ent->NominalSizeValue() << "\n" |
152 | << "Nominal size name : "; |
7fd59977 |
153 | IGESData_DumpString(S,ent->NominalSizeName()); |
0ebe5b0a |
154 | S << "\n" |
155 | << "Name of relevant engineering standard : "; |
7fd59977 |
156 | IGESData_DumpString(S,ent->StandardName()); |
0ebe5b0a |
157 | S << std::endl; |
7fd59977 |
158 | } |