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 #include <IGESSolid_ToolSolidAssembly.ixx>
20 #include <IGESData_ParamCursor.hxx>
21 #include <IGESData_IGESEntity.hxx>
22 #include <IGESGeom_TransformationMatrix.hxx>
23 #include <IGESData_HArray1OfIGESEntity.hxx>
24 #include <IGESGeom_HArray1OfTransformationMatrix.hxx>
25 #include <IGESData_Dump.hxx>
26 #include <Interface_Macros.hxx>
29 IGESSolid_ToolSolidAssembly::IGESSolid_ToolSolidAssembly () { }
32 void IGESSolid_ToolSolidAssembly::ReadOwnParams
33 (const Handle(IGESSolid_SolidAssembly)& ent,
34 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
36 //Standard_Boolean st; //szv#4:S4163:12Mar99 moved down
37 Standard_Integer nbitems; //szv#4:S4163:12Mar99 `i` moved in for
38 //Handle(IGESData_IGESEntity) anent; //szv#4:S4163:12Mar99 moved down
39 //Handle(IGESGeom_TransformationMatrix) amatr; //szv#4:S4163:12Mar99 moved down
40 Handle(IGESData_HArray1OfIGESEntity) tempItems;
41 Handle(IGESGeom_HArray1OfTransformationMatrix) tempMatrices;
43 Standard_Boolean st = PR.ReadInteger(PR.Current(), "Number of Items", nbitems);
44 if (st && nbitems > 0)
46 tempItems = new IGESData_HArray1OfIGESEntity(1, nbitems);
47 tempMatrices = new IGESGeom_HArray1OfTransformationMatrix(1, nbitems);
49 Handle(IGESData_IGESEntity) anent;
50 Standard_Integer i; // svv Jan 10 2000 : porting on DEC
51 for (i = 1; i <= nbitems; i++)
53 //st = PR.ReadEntity(IR,PR.Current(), "Solid assembly items", anent); //szv#4:S4163:12Mar99 moved in if
54 if (PR.ReadEntity(IR,PR.Current(), "Solid assembly items", anent))
55 tempItems->SetValue(i, anent);
58 Handle(IGESGeom_TransformationMatrix) amatr;
59 for (i = 1; i <= nbitems; i++)
61 //st = PR.ReadEntity(IR,PR.Current(), "Matrices",
62 //STANDARD_TYPE(IGESGeom_TransformationMatrix),
63 //amatr, Standard_True); //szv#4:S4163:12Mar99 moved in if
64 if (PR.ReadEntity(IR,PR.Current(), "Matrices",
65 STANDARD_TYPE(IGESGeom_TransformationMatrix), amatr, Standard_True))
66 tempMatrices->SetValue(i, amatr);
69 else PR.AddFail("Number of Items : Not Positive");
71 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
72 ent->Init (tempItems, tempMatrices);
75 void IGESSolid_ToolSolidAssembly::WriteOwnParams
76 (const Handle(IGESSolid_SolidAssembly)& ent, IGESData_IGESWriter& IW) const
78 Standard_Integer nbitems = ent->NbItems();
82 for (i = 1; i <= nbitems; i ++)
83 IW.Send(ent->Item(i));
84 for (i = 1; i <= nbitems; i ++)
85 IW.Send(ent->TransfMatrix(i));
88 void IGESSolid_ToolSolidAssembly::OwnShared
89 (const Handle(IGESSolid_SolidAssembly)& ent, Interface_EntityIterator& iter) const
91 Standard_Integer nbitems = ent->NbItems();
93 for (i = 1; i <= nbitems; i ++) iter.GetOneItem(ent->Item(i));
94 for (i = 1; i <= nbitems; i ++) iter.GetOneItem(ent->TransfMatrix(i));
97 void IGESSolid_ToolSolidAssembly::OwnCopy
98 (const Handle(IGESSolid_SolidAssembly)& another,
99 const Handle(IGESSolid_SolidAssembly)& ent, Interface_CopyTool& TC) const
101 Standard_Integer nbitems, i;
102 Handle(IGESData_IGESEntity) anent;
104 nbitems = another->NbItems();
105 Handle(IGESData_HArray1OfIGESEntity) tempItems = new
106 IGESData_HArray1OfIGESEntity(1, nbitems);
107 Handle(IGESGeom_HArray1OfTransformationMatrix) tempMatrices = new
108 IGESGeom_HArray1OfTransformationMatrix(1, nbitems);
110 for (i=1; i<=nbitems; i++)
112 DeclareAndCast(IGESData_IGESEntity, localent,
113 TC.Transferred(another->Item(i)));
114 tempItems->SetValue(i, localent);
116 for (i=1; i<=nbitems; i++)
118 DeclareAndCast(IGESGeom_TransformationMatrix, newlocalent,
119 TC.Transferred(another->TransfMatrix(i)));
120 tempMatrices->SetValue(i, newlocalent);
123 ent->Init(tempItems, tempMatrices);
126 IGESData_DirChecker IGESSolid_ToolSolidAssembly::DirChecker
127 (const Handle(IGESSolid_SolidAssembly)& /* ent */ ) const
129 IGESData_DirChecker DC(184, 0,1);
131 DC.Structure (IGESData_DefVoid);
132 DC.LineFont (IGESData_DefAny);
133 DC.Color (IGESData_DefAny);
135 DC.UseFlagRequired (2);
136 DC.GraphicsIgnored (1);
140 void IGESSolid_ToolSolidAssembly::OwnCheck
141 (const Handle(IGESSolid_SolidAssembly)& /* ent */,
142 const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
146 void IGESSolid_ToolSolidAssembly::OwnDump
147 (const Handle(IGESSolid_SolidAssembly)& ent, const IGESData_IGESDumper& dumper,
148 const Handle(Message_Messenger)& S, const Standard_Integer level) const
150 // Standard_Integer upper = ent->NbItems();
152 S << "IGESSolid_SolidAssembly" << endl;
155 IGESData_DumpEntities(S,dumper ,level,1, ent->NbItems(),ent->Item);
158 IGESData_DumpEntities(S,dumper ,level,1, ent->NbItems(),ent->TransfMatrix);