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