0027104: DownCast() cannot return null for mismatched handle
[occt.git] / src / IGESAppli / IGESAppli_NodalDisplAndRot.cxx
CommitLineData
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
42cf5bc1 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>
7fd59977 27#include <TColgp_HArray1OfXYZ.hxx>
28
92efcf78 29IMPLEMENT_STANDARD_RTTIEXT(IGESAppli_NodalDisplAndRot,IGESData_IGESEntity)
30
b311480e 31IGESAppli_NodalDisplAndRot::IGESAppli_NodalDisplAndRot () { }
7fd59977 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 Standard_DimensionMismatch::Raise
49 ("IGESAppli_NodalDisplAndRot : Init(Lengths of arrays inconsistent)");
50
51 for (Standard_Integer i= 1; i <= allNodes->Length(); i++)
52 {
53 Handle(TColgp_HArray1OfXYZ) temp1 = allTransParams->Value(i);
54 Handle(TColgp_HArray1OfXYZ) temp2 = allRotParams->Value(i);
55 if ((temp1->Lower() != 1 || temp1->Length() != allNotes->Length()) ||
56 (temp2->Lower() != 1 || temp2->Length() != allNotes->Length()) )
57 Standard_DimensionMismatch::Raise
58 ("IGESAppli_NodalDisplAndRot: Init(No. of Param per Node != Nbcases)");
59 }
60
61 theNotes = allNotes;
62 theNodes = allNodes;
63 theNodeIdentifiers = allIdentifiers;
64 theTransParam = allTransParams;
65 theRotParam = allRotParams;
66 InitTypeAndForm(138,0);
67}
68
69 Standard_Integer IGESAppli_NodalDisplAndRot::NbCases () const
70{
71 return theNotes->Length();
72}
73
74 Standard_Integer IGESAppli_NodalDisplAndRot::NbNodes () const
75{
76 return theNodes->Length();
77}
78
79 Handle(IGESDimen_GeneralNote) IGESAppli_NodalDisplAndRot::Note
80 (const Standard_Integer Index) const
81{
82 return theNotes->Value(Index);
83}
84
85 Standard_Integer IGESAppli_NodalDisplAndRot::NodeIdentifier
86 (const Standard_Integer Index) const
87{
88 return theNodeIdentifiers->Value(Index);
89}
90
91 Handle(IGESAppli_Node) IGESAppli_NodalDisplAndRot::Node
92 (const Standard_Integer Index) const
93{
94 return theNodes->Value(Index);
95}
96
97 gp_XYZ IGESAppli_NodalDisplAndRot::TranslationParameter
98 (const Standard_Integer NodeNum, const Standard_Integer CaseNum) const
99{
100 return theTransParam->Value(NodeNum)->Value(CaseNum);
101}
102
103 gp_XYZ IGESAppli_NodalDisplAndRot::RotationalParameter
104 (const Standard_Integer NodeNum, const Standard_Integer CaseNum) const
105{
106 return theRotParam->Value(NodeNum)->Value(CaseNum);
107}
108