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 | //-------------------------------------------------------------------- |
7fd59977 |
18 | // UNFINISHED |
19 | // The last field (ent->DependentValues()) not resolved. Queried to mdtv |
20 | |
7fd59977 |
21 | #include <IGESBasic_HArray1OfHArray1OfReal.hxx> |
42cf5bc1 |
22 | #include <IGESData_DirChecker.hxx> |
7fd59977 |
23 | #include <IGESData_Dump.hxx> |
42cf5bc1 |
24 | #include <IGESData_IGESDumper.hxx> |
25 | #include <IGESData_IGESReaderData.hxx> |
26 | #include <IGESData_IGESWriter.hxx> |
27 | #include <IGESData_ParamCursor.hxx> |
28 | #include <IGESData_ParamReader.hxx> |
29 | #include <IGESDefs_TabularData.hxx> |
30 | #include <IGESDefs_ToolTabularData.hxx> |
31 | #include <Interface_Check.hxx> |
32 | #include <Interface_CopyTool.hxx> |
33 | #include <Interface_EntityIterator.hxx> |
7fd59977 |
34 | #include <Interface_Macros.hxx> |
42cf5bc1 |
35 | #include <Interface_ShareTool.hxx> |
36 | #include <Message_Messenger.hxx> |
37 | #include <Standard_DomainError.hxx> |
38 | #include <TColStd_HArray1OfInteger.hxx> |
7fd59977 |
39 | #include <TColStd_HArray1OfReal.hxx> |
40 | |
7fd59977 |
41 | IGESDefs_ToolTabularData::IGESDefs_ToolTabularData () { } |
42 | |
43 | |
44 | void IGESDefs_ToolTabularData::ReadOwnParams |
45 | (const Handle(IGESDefs_TabularData)& ent, |
46 | const Handle(IGESData_IGESReaderData)& /* IR */, IGESData_ParamReader& PR) const |
47 | { |
48 | Standard_Integer nbProps; |
49 | Standard_Integer propType; |
50 | Standard_Integer nbDeps; |
51 | Standard_Integer nbIndeps; |
52 | Handle(TColStd_HArray1OfInteger) typesInd; |
53 | Handle(TColStd_HArray1OfInteger) nbValuesInd; |
54 | Handle(IGESBasic_HArray1OfHArray1OfReal) valuesInd; |
55 | Handle(IGESBasic_HArray1OfHArray1OfReal) valuesDep; |
56 | //Standard_Boolean st; //szv#4:S4163:12Mar99 moved down |
57 | Standard_Integer i; |
58 | |
59 | PR.ReadInteger(PR.Current(), "Number of Property values", nbProps); //szv#4:S4163:12Mar99 `st=` not needed |
60 | |
61 | PR.ReadInteger(PR.Current(), "Property type", propType); //szv#4:S4163:12Mar99 `st=` not needed |
62 | |
63 | Standard_Boolean st = PR.ReadInteger(PR.Current(), "No. of dependent variables", nbDeps); |
64 | if (st && nbDeps > 0) |
65 | valuesDep = new IGESBasic_HArray1OfHArray1OfReal(1, nbDeps); |
66 | |
67 | st = PR.ReadInteger(PR.Current(), "No. of Independent variables", nbIndeps); |
68 | if (st && nbIndeps > 0) |
69 | { |
70 | valuesInd = new IGESBasic_HArray1OfHArray1OfReal(1, nbIndeps); |
71 | typesInd = new TColStd_HArray1OfInteger(1, nbIndeps); |
72 | nbValuesInd = new TColStd_HArray1OfInteger(1, nbIndeps); |
73 | } |
74 | |
75 | PR.ReadInts(PR.CurrentList(nbIndeps), |
76 | "Type of independent variables", typesInd); //szv#4:S4163:12Mar99 `st=` not needed |
77 | |
78 | PR.ReadInts(PR.CurrentList(nbIndeps), |
79 | "No. of values of independent variables", nbValuesInd); //szv#4:S4163:12Mar99 `st=` not needed |
80 | |
81 | for (i=1; i<=nbIndeps; i++) |
82 | { |
83 | Handle(TColStd_HArray1OfReal) tarr; |
84 | Standard_Integer nb = nbValuesInd->Value(i), j; |
85 | if (nb > 0 ) |
86 | { |
87 | tarr = new TColStd_HArray1OfReal(1, nb); |
88 | for (j=1; j<= nb; j++) |
89 | { |
90 | Standard_Real treal; |
91 | PR.ReadReal(PR.Current(), "Value of independent variable", |
92 | treal); //szv#4:S4163:12Mar99 `st=` not needed |
93 | tarr->SetValue(j, treal); |
94 | } |
95 | } |
96 | valuesInd->SetValue(i, tarr); |
97 | } |
98 | // ?? for (i=1; i<=nbDeps; i++) { } |
99 | // Dependents : definition pas limpide, on accumule tout sur un seul |
100 | // HArray1OfReal, mis en 1re position du HArray1OfHArray1OfReal |
101 | // On y met tous les flottants qui restent |
102 | Standard_Integer curnum = PR.CurrentNumber(); |
103 | Standard_Integer nbpars = PR.NbParams(); |
104 | Standard_Integer nbd = 0; |
105 | for (i = curnum; i <= nbpars; i ++) { |
106 | if (PR.ParamType(i) != Interface_ParamReal) break; |
107 | nbd = i - curnum + 1; |
108 | } |
109 | Handle(TColStd_HArray1OfReal) somedeps; |
110 | if (nbd > 0) somedeps = new TColStd_HArray1OfReal(1,nbd); |
111 | for (i = 1; i <= nbd; i ++) { |
112 | Standard_Real treal; |
113 | PR.ReadReal(PR.Current(), "Value of dependent variable", treal); //szv#4:S4163:12Mar99 `st=` not needed |
114 | somedeps->SetValue(i, treal); |
115 | } |
116 | if (nbDeps > 0) valuesDep->SetValue(1,somedeps); |
117 | else PR.AddWarning("Some Real remain while no dependent vakue is defined"); |
118 | |
119 | nbProps = PR.CurrentNumber() - 2; |
120 | /* for (;;) { |
121 | curnum = PR.CurrentNumber(); |
122 | if (curnum > PR.NbParams()) break; |
123 | if (PR.ParamType(curnum) != Interface_ParamReal) break; |
124 | PR.SetCurrentNumber (curnum+1); |
125 | } */ |
126 | PR.AddWarning("Don't know exactly how to read dependant values ..."); |
127 | // ?? a eclaircir |
128 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
129 | ent->Init (nbProps, propType, typesInd, nbValuesInd, valuesInd, valuesDep); |
130 | } |
131 | |
132 | void IGESDefs_ToolTabularData::WriteOwnParams |
133 | (const Handle(IGESDefs_TabularData)& ent, IGESData_IGESWriter& IW) const |
134 | { |
135 | Standard_Integer i, nbIndeps = ent->NbIndependents(); |
136 | Standard_Integer j, nbDeps = ent->NbDependents(); |
137 | IW.Send(ent->NbPropertyValues()); |
138 | IW.Send(ent->PropertyType()); |
139 | IW.Send(nbDeps); |
140 | IW.Send(nbIndeps); |
141 | for (i=1; i<=nbIndeps; i++) |
142 | IW.Send(ent->TypeOfIndependents(i)); |
143 | for (i=1; i<=nbIndeps; i++) |
144 | IW.Send(ent->NbValues(i)); |
145 | for (i=1; i<=nbIndeps; i++) |
146 | for (j=1; j<=ent->NbValues(i); j++) |
147 | IW.Send(ent->IndependentValue(i,j)); |
148 | // UNFINISHED |
149 | if (nbDeps == 0) return; |
150 | Handle(TColStd_HArray1OfReal) deps = ent->DependentValues(1); |
151 | for (i = 1; i <= deps->Length(); i ++) IW.Send(deps->Value(i)); |
152 | /* |
153 | for (i=1; i<=nbDeps; i++) |
154 | for (j=1; j<= .. ->Value(i); j++) |
155 | IW.Send(ent->DependentValue(i,j)); |
156 | */ |
157 | } |
158 | |
159 | void IGESDefs_ToolTabularData::OwnShared |
160 | (const Handle(IGESDefs_TabularData)& /* ent */, Interface_EntityIterator& /* iter */) const |
161 | { |
162 | } |
163 | |
164 | void IGESDefs_ToolTabularData::OwnCopy |
165 | (const Handle(IGESDefs_TabularData)& another, |
166 | const Handle(IGESDefs_TabularData)& ent, Interface_CopyTool& /* TC */) const |
167 | { |
168 | Standard_Integer nbProps = another->NbPropertyValues(); |
169 | Standard_Integer propType = another->PropertyType(); |
170 | Standard_Integer nbDeps = another->NbDependents(); |
171 | Standard_Integer nbIndeps = another->NbIndependents(); |
172 | Handle(TColStd_HArray1OfInteger) typesInd = new |
173 | TColStd_HArray1OfInteger(1, nbIndeps); |
174 | Handle(TColStd_HArray1OfInteger) nbValuesInd = new |
175 | TColStd_HArray1OfInteger(1, nbIndeps); |
176 | Handle(IGESBasic_HArray1OfHArray1OfReal) valuesInd = new |
177 | IGESBasic_HArray1OfHArray1OfReal(1, nbIndeps); |
178 | Handle(IGESBasic_HArray1OfHArray1OfReal) valuesDep = new |
179 | IGESBasic_HArray1OfHArray1OfReal(1, nbDeps); |
180 | Standard_Integer i; |
181 | for (i=1; i<=nbIndeps; i++) |
182 | { |
183 | Standard_Integer j, nval; |
184 | typesInd->SetValue(i, another->TypeOfIndependents(i)); |
185 | nval = another->NbValues(i); |
186 | nbValuesInd->SetValue(i, nval); |
187 | Handle(TColStd_HArray1OfReal) tmparr = new |
188 | TColStd_HArray1OfReal(1, nval); |
189 | for (j=1; j<=nval; j++) |
190 | tmparr->SetValue(j, another->IndependentValue(i, j)); |
191 | valuesInd->SetValue(i, tmparr); |
192 | } |
193 | // UNFINISHED |
194 | /* |
195 | for (i=1; i<=nbDeps; i++) |
196 | { |
197 | } |
198 | */ |
199 | ent->Init(nbProps, propType, typesInd, nbValuesInd, |
200 | valuesInd, valuesDep); |
201 | } |
202 | |
203 | IGESData_DirChecker IGESDefs_ToolTabularData::DirChecker |
204 | (const Handle(IGESDefs_TabularData)& /* ent */ ) const |
205 | { |
206 | IGESData_DirChecker DC(406, 11); |
207 | DC.Structure (IGESData_DefVoid); |
208 | DC.LineFont (IGESData_DefVoid); |
209 | DC.LineWeight (IGESData_DefVoid); |
210 | DC.Color (IGESData_DefVoid); |
211 | |
212 | DC.BlankStatusIgnored (); |
213 | DC.UseFlagIgnored (); |
214 | DC.HierarchyStatusIgnored (); |
215 | return DC; |
216 | } |
217 | |
218 | void IGESDefs_ToolTabularData::OwnCheck |
219 | (const Handle(IGESDefs_TabularData)& /* ent */, |
220 | const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const |
221 | { |
222 | } |
223 | |
224 | void IGESDefs_ToolTabularData::OwnDump |
225 | (const Handle(IGESDefs_TabularData)& ent, const IGESData_IGESDumper& /* dumper */, |
226 | const Handle(Message_Messenger)& S, const Standard_Integer level) const |
227 | { |
228 | Standard_Integer nbIndeps = ent->NbIndependents(); //szv#4:S4163:12Mar99 i unused |
229 | Standard_Integer nbDeps = ent->NbDependents(); |
230 | |
231 | S << "IGESDefs_TabularData" << endl; |
232 | S << "No. of property values : " << ent->NbPropertyValues() << endl; |
233 | S << "Property type : " << ent->PropertyType() << endl; |
234 | S << "No. of Dependent variables : " << nbDeps << endl; |
235 | S << "No. of Independent variables : " << nbIndeps << endl; |
236 | S << "Type of independent variables : "; |
237 | IGESData_DumpVals(S ,level,1, nbIndeps,ent->TypeOfIndependents); |
238 | S << endl << "Number of values of independent variables : "; |
239 | IGESData_DumpVals(S ,level,1, nbIndeps,ent->NbValues); |
240 | // ?? JAGGED ?? |
241 | S << endl << "Values of the independent variable : "; |
242 | if (level < 5) S << " [ask level > 4]"; |
243 | else { |
244 | for (Standard_Integer ind = 1; ind <= nbIndeps; ind ++) { |
245 | S << endl << "[" << ind << "]:"; |
246 | Standard_Integer nbi = ent->NbValues(ind); |
247 | for (Standard_Integer iv = 1; iv <= nbi; iv ++) |
248 | S << " " << ent->IndependentValue(ind,iv); |
249 | } |
250 | } |
251 | // IGESData_DumpVals(S ,level,1, nbIndeps,ent->IndependentValue); |
252 | S << endl << "Values of the dependent variable : "; |
253 | // IGESData_DumpVals(S ,level,1, nbDeps,ent->DependentValue); |
254 | S << " TO BE DONE"; |
255 | S << endl; |
256 | } |