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 <IGESBasic_GroupWithoutBackP.hxx>
20 #include <IGESBasic_ToolGroupWithoutBackP.hxx>
21 #include <IGESData_DirChecker.hxx>
22 #include <IGESData_Dump.hxx>
23 #include <IGESData_HArray1OfIGESEntity.hxx>
24 #include <IGESData_IGESDumper.hxx>
25 #include <IGESData_IGESEntity.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 <Message_Messenger.hxx>
35 #include <Message_Msg.hxx>
36 #include <Standard_DomainError.hxx>
39 IGESBasic_ToolGroupWithoutBackP::IGESBasic_ToolGroupWithoutBackP () { }
42 void IGESBasic_ToolGroupWithoutBackP::ReadOwnParams
43 (const Handle(IGESBasic_GroupWithoutBackP)& ent,
44 const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
47 // Building of messages
48 //========================================
49 // Message_Msg Msg202("XSTEP_202");
50 // Message_Msg Msg203("XSTEP_203");
51 //========================================
53 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
54 Standard_Integer nbval = 0;
55 Handle(IGESData_HArray1OfIGESEntity) EntArray;
57 //st = PR.ReadInteger( PR.Current(), Msg202, nbval); //szv#4:S4163:12Mar99 not needed
58 //st = PR.ReadInteger( PR.Current(), "Count of Entities", nbval);
59 if (PR.ReadInteger( PR.Current(), nbval)) { //szv#4:S4163:12Mar99 `st=` not needed
60 Message_Msg Msg203("XSTEP_203");
62 PR.ReadEnts (IR,PR.CurrentList(nbval),Msg203,EntArray); //szv#4:S4163:12Mar99 `st=` not needed
63 //st = PR.ReadEnts (IR,PR.CurrentList(nbval),"Entities",EntArray);
66 Message_Msg Msg202("XSTEP_202");
70 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
74 void IGESBasic_ToolGroupWithoutBackP::WriteOwnParams
75 (const Handle(IGESBasic_GroupWithoutBackP)& ent, IGESData_IGESWriter& IW) const
77 Standard_Integer upper = ent->NbEntities();
79 for (Standard_Integer i = 1; i <= upper;i++)
80 IW.Send(ent->Entity(i));
83 void IGESBasic_ToolGroupWithoutBackP::OwnShared
84 (const Handle(IGESBasic_GroupWithoutBackP)& ent, Interface_EntityIterator& iter) const
86 Standard_Integer upper = ent->NbEntities();
87 for (Standard_Integer i = 1; i <= upper; i ++)
88 iter.GetOneItem(ent->Entity(i));
91 void IGESBasic_ToolGroupWithoutBackP::OwnCopy
92 (const Handle(IGESBasic_GroupWithoutBackP)& another,
93 const Handle(IGESBasic_GroupWithoutBackP)& ent, Interface_CopyTool& TC) const
95 Standard_Integer lower,upper;
97 upper = another->NbEntities();
98 Handle(IGESData_HArray1OfIGESEntity) EntArray = new
99 IGESData_HArray1OfIGESEntity(lower,upper);
100 for (Standard_Integer i = lower;i <= upper;i++)
103 (IGESData_IGESEntity,myentity,TC.Transferred(another->Entity(i)));
104 EntArray->SetValue(i,myentity);
109 Standard_Boolean IGESBasic_ToolGroupWithoutBackP::OwnCorrect
110 (const Handle(IGESBasic_GroupWithoutBackP)& ent ) const
112 Standard_Integer ianul = 0;
113 Standard_Integer i, nbtrue = 0, nb = ent->NbEntities();
114 for (i = 1; i <= nb; i ++) {
115 Handle(IGESData_IGESEntity) val = ent->Entity(i);
116 if (val.IsNull()) ianul ++;
117 else if (val->TypeNumber() == 0) ianul ++;
119 if (ianul == 0) return Standard_False;
120 Handle(IGESData_HArray1OfIGESEntity) EntArray;
121 if (ianul < nb) EntArray = new IGESData_HArray1OfIGESEntity(1,nb-ianul);
122 for (i = 1; i <= nb; i ++) {
123 Handle(IGESData_IGESEntity) val = ent->Entity(i);
124 if (val.IsNull()) continue;
125 else if (val->TypeNumber() == 0) continue;
127 EntArray->SetValue (nbtrue,ent->Entity(i));
130 return Standard_True;
133 IGESData_DirChecker IGESBasic_ToolGroupWithoutBackP::DirChecker
134 (const Handle(IGESBasic_GroupWithoutBackP)& /* ent */ ) const
136 IGESData_DirChecker DC(402,7); //TypeNo. 402, Form no. 7
137 DC.Structure(IGESData_DefVoid);
138 DC.GraphicsIgnored();
139 DC.BlankStatusIgnored();
140 DC.HierarchyStatusIgnored();
144 void IGESBasic_ToolGroupWithoutBackP::OwnCheck
145 (const Handle(IGESBasic_GroupWithoutBackP)& ent,
146 const Interface_ShareTool& , Handle(Interface_Check)& /* ach */) const
148 Standard_Boolean ianul = Standard_False;
149 Standard_Integer i, nb = ent->NbEntities();
150 for (i = 1; i <= nb; i ++) {
151 Handle(IGESData_IGESEntity) val = ent->Entity(i);
152 if (val.IsNull()) ianul = Standard_True;
153 else if (val->TypeNumber() == 0) ianul = Standard_True;
160 void IGESBasic_ToolGroupWithoutBackP::OwnDump
161 (const Handle(IGESBasic_GroupWithoutBackP)& ent, const IGESData_IGESDumper& dumper,
162 Standard_OStream& S, const Standard_Integer level) const
164 S << "IGESBasic_GroupWithoutBackP\n"
165 << "Entries in the Group : ";
166 IGESData_DumpEntities(S,dumper ,level,1, ent->NbEntities(),ent->Entity);