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 (theDependentValues) not resolved. Queried to mdtv |
20 | |
42cf5bc1 |
21 | #include <IGESBasic_HArray1OfHArray1OfReal.hxx> |
22 | #include <IGESDefs_TabularData.hxx> |
7fd59977 |
23 | #include <Standard_DimensionMismatch.hxx> |
42cf5bc1 |
24 | #include <Standard_OutOfRange.hxx> |
25 | #include <Standard_Type.hxx> |
7fd59977 |
26 | #include <TColStd_HArray1OfReal.hxx> |
27 | |
92efcf78 |
28 | IMPLEMENT_STANDARD_RTTIEXT(IGESDefs_TabularData,IGESData_IGESEntity) |
29 | |
b311480e |
30 | IGESDefs_TabularData::IGESDefs_TabularData () { } |
7fd59977 |
31 | |
32 | |
33 | void IGESDefs_TabularData::Init |
34 | (const Standard_Integer nbProps, |
35 | const Standard_Integer propType, |
36 | /* const Standard_Integer nbDeps, */ |
37 | /* const Standard_Integer nbIndeps, */ |
38 | const Handle(TColStd_HArray1OfInteger)& typesInd, |
39 | const Handle(TColStd_HArray1OfInteger)& nbValuesInd, |
40 | const Handle(IGESBasic_HArray1OfHArray1OfReal)& valuesInd, |
41 | const Handle(IGESBasic_HArray1OfHArray1OfReal)& valuesDep) |
42 | { |
43 | Standard_Integer num = typesInd->Length(); |
44 | if (typesInd->Lower() != 1 || |
45 | nbValuesInd->Lower() != 1 || nbValuesInd->Length() != num || |
46 | valuesInd->Lower() != 1 || valuesInd->Length() != num || |
47 | valuesDep->Lower() != 1 ) |
9775fa61 |
48 | throw Standard_DimensionMismatch("IGESDefs_TabularData : Init"); |
7fd59977 |
49 | theNbPropertyValues = nbProps; |
50 | thePropertyType = propType; |
51 | /* theNbDependents = nbDeps; */ |
52 | /* theNbIndependents = nbIndeps; */ |
53 | theTypeOfIndependentVariables = typesInd; |
54 | theNbValues = nbValuesInd; |
55 | theIndependentValues = valuesInd; |
56 | theDependentValues = valuesDep; |
57 | InitTypeAndForm(406,11); |
58 | } |
59 | |
60 | Standard_Integer IGESDefs_TabularData::NbPropertyValues () const |
61 | { |
62 | return theNbPropertyValues; |
63 | } |
64 | |
65 | Standard_Integer IGESDefs_TabularData::ComputedNbPropertyValues () const |
66 | { |
67 | return theNbPropertyValues; // pas malin ... a ameliorer |
68 | } |
69 | |
70 | Standard_Boolean IGESDefs_TabularData::OwnCorrect () |
71 | { |
72 | Standard_Integer newnb = ComputedNbPropertyValues(); |
73 | if (newnb == theNbPropertyValues) return Standard_False; |
74 | theNbPropertyValues = newnb; |
75 | return Standard_True; |
76 | } |
77 | |
78 | |
79 | Standard_Integer IGESDefs_TabularData::PropertyType () const |
80 | { |
81 | return thePropertyType; |
82 | } |
83 | |
84 | Standard_Integer IGESDefs_TabularData::NbDependents () const |
85 | { |
86 | return theDependentValues->Length(); |
87 | } |
88 | |
89 | Standard_Integer IGESDefs_TabularData::NbIndependents () const |
90 | { |
91 | return theTypeOfIndependentVariables->Length(); |
92 | } |
93 | |
94 | Standard_Integer IGESDefs_TabularData::TypeOfIndependents |
95 | (const Standard_Integer num) const |
96 | { |
97 | return theTypeOfIndependentVariables->Value(num); |
98 | } |
99 | |
100 | Standard_Integer IGESDefs_TabularData::NbValues (const Standard_Integer num) const |
101 | { |
102 | return theNbValues->Value(num); |
103 | } |
104 | |
105 | Standard_Real IGESDefs_TabularData::IndependentValue |
106 | (const Standard_Integer variablenum, const Standard_Integer valuenum) const |
107 | { |
108 | return (theIndependentValues->Value(variablenum))->Value(valuenum); |
109 | } |
110 | |
111 | Handle(TColStd_HArray1OfReal) IGESDefs_TabularData::DependentValues |
112 | (const Standard_Integer num) const |
113 | { |
114 | return theDependentValues->Value(num); |
115 | } |
116 | |
117 | // UNFINISHED |
118 | // Array limits not sure. |
35e08fe8 |
119 | Standard_Real IGESDefs_TabularData::DependentValue (const Standard_Integer /*variablenum*/, |
120 | const Standard_Integer /*valuenum*/) const |
7fd59977 |
121 | { |
122 | Standard_Real val = 0.; |
123 | #if 0 |
124 | Standard_Integer sum = 0; |
125 | for (Standard_Integer i = 1; i < variablenum; i++) |
126 | { |
127 | sum += theNbValues->Value(i); |
128 | } |
129 | sum += valuenum; |
130 | val = theDependentValues->Value(sum); |
131 | #endif |
132 | return val; |
133 | } |