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 <IGESDimen_DimensionUnits.hxx> |
27 | #include <IGESDimen_ToolDimensionUnits.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 | IGESDimen_ToolDimensionUnits::IGESDimen_ToolDimensionUnits () { } |
38 | |
39 | |
40 | void IGESDimen_ToolDimensionUnits::ReadOwnParams |
41 | (const Handle(IGESDimen_DimensionUnits)& ent, |
42 | const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const |
43 | { |
44 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
45 | Standard_Integer tempNbProps; |
46 | Standard_Integer tempSecondDimenPos; |
47 | Standard_Integer tempUnitsIndic; |
48 | Standard_Integer tempCharSet; |
49 | Standard_Integer tempFracFlag; |
50 | Standard_Integer tempPrecision; |
51 | Handle(TCollection_HAsciiString) tempFormatString; |
52 | |
53 | if (PR.DefinedElseSkip()) |
54 | PR.ReadInteger(PR.Current(), "Number of Properties", tempNbProps); //szv#4:S4163:12Mar99 `st=` not needed |
55 | else |
56 | tempNbProps = 6; |
57 | |
58 | PR.ReadInteger(PR.Current(), "Secondary Dimension Position", |
59 | tempSecondDimenPos); //szv#4:S4163:12Mar99 `st=` not needed |
60 | PR.ReadInteger(PR.Current(), "Units Indicator", tempUnitsIndic); //szv#4:S4163:12Mar99 `st=` not needed |
61 | if (PR.DefinedElseSkip()) |
62 | PR.ReadInteger(PR.Current(), "Character Set", tempCharSet); //szv#4:S4163:12Mar99 `st=` not needed |
63 | else |
64 | tempCharSet = 1; |
65 | |
66 | PR.ReadText(PR.Current(), "Format String", tempFormatString); //szv#4:S4163:12Mar99 `st=` not needed |
67 | PR.ReadInteger(PR.Current(), "Fraction Flag", tempFracFlag); //szv#4:S4163:12Mar99 `st=` not needed |
68 | PR.ReadInteger(PR.Current(), "Precision", tempPrecision); //szv#4:S4163:12Mar99 `st=` not needed |
69 | |
70 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
71 | ent->Init |
72 | (tempNbProps, tempSecondDimenPos, tempUnitsIndic, tempCharSet, |
73 | tempFormatString, tempFracFlag, tempPrecision); |
74 | } |
75 | |
76 | void IGESDimen_ToolDimensionUnits::WriteOwnParams |
77 | (const Handle(IGESDimen_DimensionUnits)& ent, IGESData_IGESWriter& IW) const |
78 | { |
79 | IW.Send(ent->NbPropertyValues()); |
80 | IW.Send(ent->SecondaryDimenPosition()); |
81 | IW.Send(ent->UnitsIndicator()); |
82 | IW.Send(ent->CharacterSet()); |
83 | IW.Send(ent->FormatString()); |
84 | IW.Send(ent->FractionFlag()); |
85 | IW.Send(ent->PrecisionOrDenominator()); |
86 | } |
87 | |
88 | void IGESDimen_ToolDimensionUnits::OwnShared |
89 | (const Handle(IGESDimen_DimensionUnits)& /* ent */, Interface_EntityIterator& /* iter */) const |
90 | { |
91 | } |
92 | |
93 | void IGESDimen_ToolDimensionUnits::OwnCopy |
94 | (const Handle(IGESDimen_DimensionUnits)& another, |
95 | const Handle(IGESDimen_DimensionUnits)& ent, Interface_CopyTool& /* TC */) const |
96 | { |
97 | Standard_Integer tempNbProps = another->NbPropertyValues(); |
98 | Standard_Integer tempSecondDimenPos = another->SecondaryDimenPosition(); |
99 | Standard_Integer tempUnitsIndic = another->UnitsIndicator(); |
100 | Standard_Integer tempCharSet = another->CharacterSet(); |
101 | Handle(TCollection_HAsciiString) tempFormatString = |
102 | new TCollection_HAsciiString(another->FormatString()); |
103 | Standard_Integer tempFracFlag = another->FractionFlag(); |
104 | Standard_Integer tempPrecision = another->PrecisionOrDenominator(); |
105 | ent->Init (tempNbProps, tempSecondDimenPos, tempUnitsIndic, tempCharSet, |
106 | tempFormatString, tempFracFlag, tempPrecision); |
107 | } |
108 | |
109 | Standard_Boolean IGESDimen_ToolDimensionUnits::OwnCorrect |
110 | (const Handle(IGESDimen_DimensionUnits)& ent) const |
111 | { |
112 | Standard_Boolean res = (ent->NbPropertyValues() != 6); |
113 | if (res) ent->Init |
114 | (6,ent->SecondaryDimenPosition(),ent->UnitsIndicator(),ent->CharacterSet(), |
115 | ent->FormatString(),ent->FractionFlag(),ent->PrecisionOrDenominator()); |
116 | return res; // nbpropertyvalues = 6 |
117 | } |
118 | |
119 | IGESData_DirChecker IGESDimen_ToolDimensionUnits::DirChecker |
120 | (const Handle(IGESDimen_DimensionUnits)& /* ent */) const |
121 | { |
122 | IGESData_DirChecker DC(406, 28); |
123 | DC.Structure(IGESData_DefVoid); |
124 | DC.GraphicsIgnored(); |
125 | DC.LineFont(IGESData_DefVoid); |
126 | DC.LineWeight(IGESData_DefVoid); |
127 | DC.Color(IGESData_DefVoid); |
128 | DC.BlankStatusIgnored(); |
129 | DC.SubordinateStatusRequired(2); |
130 | DC.UseFlagRequired(2); |
131 | DC.HierarchyStatusIgnored(); |
132 | return DC; |
133 | } |
134 | |
135 | void IGESDimen_ToolDimensionUnits::OwnCheck |
136 | (const Handle(IGESDimen_DimensionUnits)& ent, |
137 | const Interface_ShareTool& , Handle(Interface_Check)& ach) const |
138 | { |
139 | if (ent->NbPropertyValues() != 6) |
140 | ach->AddFail("Number of properties != 6"); |
141 | if (ent->SecondaryDimenPosition() < 0 || ent->SecondaryDimenPosition() > 4) |
142 | ach->AddFail("Secondary Dimension Position != 0-4"); |
143 | if ( (ent->CharacterSet() != 1) && |
144 | ((ent->CharacterSet() < 1001) || (ent->CharacterSet() > 1003)) ) |
145 | ach->AddFail("Character Set != 1,1001-1003"); |
146 | if ((ent->FractionFlag() != 0) && (ent->FractionFlag() != 1)) |
147 | ach->AddFail("Fraction Flag != 0,1"); |
148 | } |
149 | |
150 | void IGESDimen_ToolDimensionUnits::OwnDump |
151 | (const Handle(IGESDimen_DimensionUnits)& ent, const IGESData_IGESDumper& /* dumper */, |
152 | const Handle(Message_Messenger)& S, const Standard_Integer /* level */) const |
153 | { |
154 | S << "IGESDimen_DimensionUnits" << endl; |
155 | S << "Number of property values : " << ent->NbPropertyValues() << endl; |
156 | S << "Secondary Dimension Position : " << ent->SecondaryDimenPosition() << endl; |
157 | S << "Units Indicator : " << ent->UnitsIndicator() << endl; |
158 | S << "Character Set : " << ent->CharacterSet() << endl; |
159 | S << "Format String : "; |
160 | IGESData_DumpString(S,ent->FormatString()); |
161 | S << endl; |
162 | S << "Fraction Flag : " << ent->FractionFlag(); |
163 | if (ent->FractionFlag() == 0) S << " Decimal , Precision : "; |
164 | else S << " Fraction , Denominator : "; |
165 | S << ent->PrecisionOrDenominator() << endl; |
166 | } |