0031501: Foundation Classes, Message_Printer - remove theToPutEndl argument -- prepar...
[occt.git] / src / IGESAppli / IGESAppli_NodalDisplAndRot.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18
19 #include <gp_XYZ.hxx>
20 #include <IGESAppli_NodalDisplAndRot.hxx>
21 #include <IGESAppli_Node.hxx>
22 #include <IGESBasic_HArray1OfHArray1OfXYZ.hxx>
23 #include <IGESDimen_GeneralNote.hxx>
24 #include <Standard_DimensionMismatch.hxx>
25 #include <Standard_OutOfRange.hxx>
26 #include <Standard_Type.hxx>
27 #include <TColgp_HArray1OfXYZ.hxx>
28
29 IMPLEMENT_STANDARD_RTTIEXT(IGESAppli_NodalDisplAndRot,IGESData_IGESEntity)
30
31 IGESAppli_NodalDisplAndRot::IGESAppli_NodalDisplAndRot ()    {  }
32
33
34     void  IGESAppli_NodalDisplAndRot::Init
35   (const Handle(IGESDimen_HArray1OfGeneralNote)& allNotes,
36    const Handle(TColStd_HArray1OfInteger)& allIdentifiers,
37    const Handle(IGESAppli_HArray1OfNode)&  allNodes,
38    const Handle(IGESBasic_HArray1OfHArray1OfXYZ)& allRotParams,
39    const Handle(IGESBasic_HArray1OfHArray1OfXYZ)& allTransParams)
40 {
41   if ( allNodes->Lower() != 1 ||
42       (allIdentifiers->Lower()   != 1 ||
43        allIdentifiers->Length()  != allNodes->Length()) ||
44       (allTransParams->Lower()   != 1 ||
45        allTransParams->Length()  != allNodes->Length()) ||
46       (allRotParams->Lower()     != 1 ||
47        allRotParams->Length()    != allNodes->Length()) )
48     throw Standard_DimensionMismatch("IGESAppli_NodalDisplAndRot : Init(Lengths of arrays inconsistent)");
49
50   for (Standard_Integer i= 1; i <= allNodes->Length(); i++)
51     {
52       Handle(TColgp_HArray1OfXYZ) temp1 = allTransParams->Value(i);
53       Handle(TColgp_HArray1OfXYZ) temp2 = allRotParams->Value(i);
54       if ((temp1->Lower() != 1 || temp1->Length() != allNotes->Length()) ||
55           (temp2->Lower() != 1 || temp2->Length() != allNotes->Length()) )
56         throw Standard_DimensionMismatch("IGESAppli_NodalDisplAndRot: Init(No. of Param per Node != Nbcases)");
57     }
58
59   theNotes           = allNotes;
60   theNodes           = allNodes;
61   theNodeIdentifiers = allIdentifiers;
62   theTransParam      = allTransParams;
63   theRotParam        = allRotParams;
64   InitTypeAndForm(138,0);
65 }
66
67     Standard_Integer  IGESAppli_NodalDisplAndRot::NbCases () const
68 {
69   return theNotes->Length();
70 }
71
72     Standard_Integer  IGESAppli_NodalDisplAndRot::NbNodes () const
73 {
74   return theNodes->Length();
75 }
76
77     Handle(IGESDimen_GeneralNote)  IGESAppli_NodalDisplAndRot::Note
78   (const Standard_Integer Index) const
79 {
80   return theNotes->Value(Index);
81 }
82
83     Standard_Integer  IGESAppli_NodalDisplAndRot::NodeIdentifier
84   (const Standard_Integer Index) const
85 {
86   return theNodeIdentifiers->Value(Index);
87 }
88
89     Handle(IGESAppli_Node)  IGESAppli_NodalDisplAndRot::Node
90   (const Standard_Integer Index) const
91 {
92   return theNodes->Value(Index);
93 }
94
95     gp_XYZ  IGESAppli_NodalDisplAndRot::TranslationParameter
96   (const Standard_Integer NodeNum, const Standard_Integer CaseNum) const
97 {
98   return theTransParam->Value(NodeNum)->Value(CaseNum);
99 }
100
101     gp_XYZ  IGESAppli_NodalDisplAndRot::RotationalParameter
102   (const Standard_Integer NodeNum, const Standard_Integer CaseNum) const
103 {
104   return theRotParam->Value(NodeNum)->Value(CaseNum);
105 }
106