0032961: Coding - get rid of unused headers [IGESAppli to IGESToBRep]
[occt.git] / src / IGESAppli / IGESAppli_ToolFiniteElement.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 <IGESAppli_FiniteElement.hxx>
20 #include <IGESAppli_HArray1OfNode.hxx>
21 #include <IGESAppli_Node.hxx>
22 #include <IGESAppli_ToolFiniteElement.hxx>
23 #include <IGESData_DirChecker.hxx>
24 #include <IGESData_Dump.hxx>
25 #include <IGESData_IGESDumper.hxx>
26 #include <IGESData_IGESReaderData.hxx>
27 #include <IGESData_IGESWriter.hxx>
28 #include <IGESData_ParamReader.hxx>
29 #include <Interface_Check.hxx>
30 #include <Interface_CopyTool.hxx>
31 #include <Interface_EntityIterator.hxx>
32 #include <Interface_Macros.hxx>
33 #include <Interface_ShareTool.hxx>
34 #include <Standard_DomainError.hxx>
35 #include <TCollection_HAsciiString.hxx>
36
37 IGESAppli_ToolFiniteElement::IGESAppli_ToolFiniteElement ()    {  }
38
39
40 void  IGESAppli_ToolFiniteElement::ReadOwnParams
41   (const Handle(IGESAppli_FiniteElement)& ent,
42    const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
43 {
44   Standard_Integer tempTopology;
45   Handle(TCollection_HAsciiString) tempName;
46   Standard_Integer nbval = 0;
47   //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
48   Handle(IGESAppli_HArray1OfNode) tempData;
49
50   //szv#4:S4163:12Mar99 `st=` not needed
51   PR.ReadInteger(PR.Current(),"Topology type",tempTopology);
52   PR.ReadInteger(PR.Current(),"No. of nodes defining element",nbval);
53   tempData = new IGESAppli_HArray1OfNode(1,nbval);
54   for (Standard_Integer i = 1; i <= nbval; i ++)
55     {
56       Handle(IGESAppli_Node) tempNode;
57       //szv#4:S4163:12Mar99 moved in if
58       if (PR.ReadEntity (IR,PR.Current(),"Node defining element", STANDARD_TYPE(IGESAppli_Node),tempNode))
59         tempData->SetValue(i,tempNode);
60     }
61   PR.ReadText(PR.Current(),"Element type name",tempName); //szv#4:S4163:12Mar99 `st=` not needed
62
63   DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
64   ent->Init(tempTopology,tempData,tempName);
65 }
66
67 void  IGESAppli_ToolFiniteElement::WriteOwnParams
68   (const Handle(IGESAppli_FiniteElement)& ent, IGESData_IGESWriter& IW) const
69 {
70   Standard_Integer upper = ent->NbNodes();
71   IW.Send(ent->Topology());
72   IW.Send(upper);
73   for (Standard_Integer i= 1; i <= upper ; i ++)
74     IW.Send(ent->Node(i));
75   IW.Send(ent->Name());
76 }
77
78 void  IGESAppli_ToolFiniteElement::OwnShared
79   (const Handle(IGESAppli_FiniteElement)& ent, Interface_EntityIterator& iter) const
80 {
81   Standard_Integer upper = ent->NbNodes();
82   for (Standard_Integer i= 1; i <= upper ; i ++)
83     iter.GetOneItem(ent->Node(i));
84 }
85
86 void  IGESAppli_ToolFiniteElement::OwnCopy
87   (const Handle(IGESAppli_FiniteElement)& another,
88    const Handle(IGESAppli_FiniteElement)& ent, Interface_CopyTool& TC) const
89 {
90   Standard_Integer aTopology = another->Topology();
91   Handle(TCollection_HAsciiString) aName =
92     new TCollection_HAsciiString(another->Name());
93   Standard_Integer nbval = another->NbNodes();
94   Handle(IGESAppli_HArray1OfNode) aList = new
95     IGESAppli_HArray1OfNode(1,nbval);
96   for (Standard_Integer i=1;i <=nbval;i++)
97     {
98       DeclareAndCast(IGESAppli_Node,aEntity,TC.Transferred(another->Node(i)));
99       aList->SetValue(i,aEntity);
100     }
101   ent->Init(aTopology,aList,aName);
102 }
103
104 IGESData_DirChecker  IGESAppli_ToolFiniteElement::DirChecker
105   (const Handle(IGESAppli_FiniteElement)& /* ent */ ) const
106 {
107   IGESData_DirChecker DC(136,0);  //Form no = 0 & Type = 136
108   DC.Structure(IGESData_DefVoid);
109   DC.LineFont(IGESData_DefAny);
110   DC.LineWeight(IGESData_DefVoid);
111   DC.Color(IGESData_DefAny);
112   DC.BlankStatusIgnored();
113   DC.SubordinateStatusIgnored();
114   DC.UseFlagIgnored();
115   DC.HierarchyStatusIgnored();
116   return DC;
117 }
118
119 void  IGESAppli_ToolFiniteElement::OwnCheck
120   (const Handle(IGESAppli_FiniteElement)& /* ent */,
121    const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
122 {
123 }
124
125 void  IGESAppli_ToolFiniteElement::OwnDump
126   (const Handle(IGESAppli_FiniteElement)& ent, const IGESData_IGESDumper& dumper,
127    Standard_OStream& S, const Standard_Integer level) const
128 {
129   S << "IGESAppli_FiniteElement\n";
130
131   S << "Topology type : " << ent->Topology() << "\n";
132   S << "Nodes : ";
133   IGESData_DumpEntities(S,dumper ,level,1, ent->NbNodes(),ent->Node);
134   S << "\nElement Name : " << ent->Name()->String();
135   S << std::endl;
136 }