1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
19 // The last field (theDependentValues) not resolved. Queried to mdtv
21 #include <IGESBasic_HArray1OfHArray1OfReal.hxx>
22 #include <IGESDefs_TabularData.hxx>
23 #include <Standard_DimensionMismatch.hxx>
24 #include <Standard_OutOfRange.hxx>
25 #include <Standard_Type.hxx>
26 #include <TColStd_HArray1OfReal.hxx>
28 IMPLEMENT_STANDARD_RTTIEXT(IGESDefs_TabularData,IGESData_IGESEntity)
30 IGESDefs_TabularData::IGESDefs_TabularData () { }
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)
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 )
48 throw Standard_DimensionMismatch("IGESDefs_TabularData : Init");
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);
60 Standard_Integer IGESDefs_TabularData::NbPropertyValues () const
62 return theNbPropertyValues;
65 Standard_Integer IGESDefs_TabularData::ComputedNbPropertyValues () const
67 return theNbPropertyValues; // pas malin ... a ameliorer
70 Standard_Boolean IGESDefs_TabularData::OwnCorrect ()
72 Standard_Integer newnb = ComputedNbPropertyValues();
73 if (newnb == theNbPropertyValues) return Standard_False;
74 theNbPropertyValues = newnb;
79 Standard_Integer IGESDefs_TabularData::PropertyType () const
81 return thePropertyType;
84 Standard_Integer IGESDefs_TabularData::NbDependents () const
86 return theDependentValues->Length();
89 Standard_Integer IGESDefs_TabularData::NbIndependents () const
91 return theTypeOfIndependentVariables->Length();
94 Standard_Integer IGESDefs_TabularData::TypeOfIndependents
95 (const Standard_Integer num) const
97 return theTypeOfIndependentVariables->Value(num);
100 Standard_Integer IGESDefs_TabularData::NbValues (const Standard_Integer num) const
102 return theNbValues->Value(num);
105 Standard_Real IGESDefs_TabularData::IndependentValue
106 (const Standard_Integer variablenum, const Standard_Integer valuenum) const
108 return (theIndependentValues->Value(variablenum))->Value(valuenum);
111 Handle(TColStd_HArray1OfReal) IGESDefs_TabularData::DependentValues
112 (const Standard_Integer num) const
114 return theDependentValues->Value(num);
118 // Array limits not sure.
119 Standard_Real IGESDefs_TabularData::DependentValue (const Standard_Integer /*variablenum*/,
120 const Standard_Integer /*valuenum*/) const
122 Standard_Real val = 0.;
124 Standard_Integer sum = 0;
125 for (Standard_Integer i = 1; i < variablenum; i++)
127 sum += theNbValues->Value(i);
130 val = theDependentValues->Value(sum);