Integration of OCCT 6.5.0 from SVN
[occt.git] / src / IGESAppli / IGESAppli_ToolNodalConstraint.cxx
CommitLineData
7fd59977 1//--------------------------------------------------------------------
2//
3// File Name : IGESAppli_NodalConstraint.cxx
4// Date :
5// Author : CKY / Contract Toubro-Larsen
6// Copyright : MATRA-DATAVISION 1993
7//
8//--------------------------------------------------------------------
9
10#include <IGESAppli_ToolNodalConstraint.ixx>
11#include <IGESData_ParamCursor.hxx>
12#include <IGESDefs_HArray1OfTabularData.hxx>
13#include <IGESAppli_Node.hxx>
14#include <IGESDefs_TabularData.hxx>
15#include <IGESData_Dump.hxx>
16#include <Interface_Macros.hxx>
17
18
19IGESAppli_ToolNodalConstraint::IGESAppli_ToolNodalConstraint () { }
20
21
22void IGESAppli_ToolNodalConstraint::ReadOwnParams
23 (const Handle(IGESAppli_NodalConstraint)& ent,
24 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
25{
26 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
27 Standard_Integer num, i;
28 Standard_Integer tempType;
29 Handle(IGESAppli_Node) tempNode;
30 Handle(IGESDefs_HArray1OfTabularData) tempTabularDataProps;
31 if (!PR.ReadInteger(PR.Current(), "Number of cases", num)) num = 0;
32 if (num > 0) tempTabularDataProps = new IGESDefs_HArray1OfTabularData(1, num);
33 else PR.AddFail("Number of cases: Not Positive");
34 //szv#4:S4163:12Mar99 `st=` not needed
35 PR.ReadInteger(PR.Current(), "Type of Constraint", tempType);
36 PR.ReadEntity(IR, PR.Current(), "Node", STANDARD_TYPE(IGESAppli_Node), tempNode);
37
38 if (!tempTabularDataProps.IsNull())
39 for ( i = 1; i <= num; i++ )
40 {
41 Handle(IGESDefs_TabularData) tempEntity;
42 //szv#4:S4163:12Mar99 moved in if
43 if (PR.ReadEntity(IR, PR.Current(), "Tabular Data Property",
44 STANDARD_TYPE(IGESDefs_TabularData), tempEntity))
45 tempTabularDataProps->SetValue(i, tempEntity);
46 }
47 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
48 ent->Init (tempType, tempNode, tempTabularDataProps);
49}
50
51void IGESAppli_ToolNodalConstraint::WriteOwnParams
52 (const Handle(IGESAppli_NodalConstraint)& ent, IGESData_IGESWriter& IW) const
53{
54 Standard_Integer i, num;
55 IW.Send(ent->NbCases());
56 IW.Send(ent->Type());
57 IW.Send(ent->NodeEntity());
58 for ( num = ent->NbCases(), i = 1; i <= num; i++ )
59 IW.Send(ent->TabularData(i));
60}
61
62void IGESAppli_ToolNodalConstraint::OwnShared
63 (const Handle(IGESAppli_NodalConstraint)& ent, Interface_EntityIterator& iter) const
64{
65 Standard_Integer i, num;
66 iter.GetOneItem(ent->NodeEntity());
67 for ( num = ent->NbCases(), i = 1; i <= num; i++ )
68 iter.GetOneItem(ent->TabularData(i));
69}
70
71void IGESAppli_ToolNodalConstraint::OwnCopy
72 (const Handle(IGESAppli_NodalConstraint)& another,
73 const Handle(IGESAppli_NodalConstraint)& ent, Interface_CopyTool& TC) const
74{
75 Standard_Integer num = another->NbCases();
76 Standard_Integer tempType = another->Type();
77 DeclareAndCast(IGESAppli_Node, tempNode,
78 TC.Transferred(another->NodeEntity()));
79 Handle(IGESDefs_HArray1OfTabularData) tempTabularDataProps =
80 new IGESDefs_HArray1OfTabularData(1, num);
81 for ( Standard_Integer i = 1; i <= num; i++ )
82 {
83 DeclareAndCast(IGESDefs_TabularData, new_item,
84 TC.Transferred(another->TabularData(i)));
85 tempTabularDataProps->SetValue(i, new_item);
86 }
87 ent->Init(tempType, tempNode, tempTabularDataProps);
88}
89
90IGESData_DirChecker IGESAppli_ToolNodalConstraint::DirChecker
91 (const Handle(IGESAppli_NodalConstraint)& /* ent */ ) const
92{
93 IGESData_DirChecker DC(418, 0);
94 DC.Structure(IGESData_DefVoid);
95 DC.GraphicsIgnored();
96 DC.LineFont(IGESData_DefVoid);
97 DC.LineWeight(IGESData_DefVoid);
98 DC.Color(IGESData_DefVoid);
99 DC.HierarchyStatusIgnored();
100 return DC;
101}
102
103void IGESAppli_ToolNodalConstraint::OwnCheck
104 (const Handle(IGESAppli_NodalConstraint)& ent,
105 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
106{
107 if ((ent->Type() != 1) && (ent->Type() != 2))
108 ach->AddFail("Type of Constraint != 1,2");
109}
110
111void IGESAppli_ToolNodalConstraint::OwnDump
112 (const Handle(IGESAppli_NodalConstraint)& ent, const IGESData_IGESDumper& dumper,
113 const Handle(Message_Messenger)& S, const Standard_Integer level) const
114{
115 Standard_Integer sublevel = (level > 4) ? 1 : 0;
116 S << "IGESAppli_NodalConstraint" << endl;
117 S << "Type of Constraint : " << ent->Type() << endl;
118 S << "Node : ";
119 dumper.Dump(ent->NodeEntity(),S, sublevel);
120 S << endl;
121 S << "Tabular Data Properties : ";
122 IGESData_DumpEntities(S,dumper ,level,1, ent->NbCases(),ent->TabularData);
123 S << endl;
124}