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 <IGESBasic_OrderedGroupWithoutBackP.hxx> |
20 | #include <IGESBasic_ToolOrderedGroupWithoutBackP.hxx> |
21 | #include <IGESData_DirChecker.hxx> |
7fd59977 |
22 | #include <IGESData_Dump.hxx> |
42cf5bc1 |
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_ParamCursor.hxx> |
29 | #include <IGESData_ParamReader.hxx> |
30 | #include <Interface_Check.hxx> |
31 | #include <Interface_CopyTool.hxx> |
32 | #include <Interface_EntityIterator.hxx> |
7fd59977 |
33 | #include <Interface_Macros.hxx> |
42cf5bc1 |
34 | #include <Interface_ShareTool.hxx> |
35 | #include <Message_Messenger.hxx> |
36 | #include <Standard_DomainError.hxx> |
7fd59977 |
37 | |
38 | IGESBasic_ToolOrderedGroupWithoutBackP::IGESBasic_ToolOrderedGroupWithoutBackP() |
39 | { } |
40 | |
41 | |
42 | void IGESBasic_ToolOrderedGroupWithoutBackP::ReadOwnParams |
43 | (const Handle(IGESBasic_OrderedGroupWithoutBackP)& ent, |
44 | const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const |
45 | { |
46 | //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed |
47 | Standard_Integer nbval = 0; |
48 | Handle(IGESData_HArray1OfIGESEntity) EntArray; |
49 | |
50 | if (PR.ReadInteger( PR.Current(), "Count of Entities", nbval)) { //szv#4:S4163:12Mar99 `st=` not needed |
51 | PR.ReadEnts (IR,PR.CurrentList(nbval),"Entities",EntArray); //szv#4:S4163:12Mar99 `st=` not needed |
52 | /* |
53 | EntArray = new IGESData_HArray1OfIGESEntity(1,nbval); |
54 | for (Standard_Integer i = 1;i <= nbval;i++) |
55 | { |
56 | Handle(IGESData_IGESEntity) anent; |
57 | st = PR.ReadEntity (IR,PR.Current(),"Element of the Group",anent,Standard_True); |
58 | if (st) EntArray->SetValue(i,anent); |
59 | } |
60 | */ |
61 | } |
62 | DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent); |
63 | ent->Init(EntArray); |
64 | } |
65 | |
66 | void IGESBasic_ToolOrderedGroupWithoutBackP::WriteOwnParams |
67 | (const Handle(IGESBasic_OrderedGroupWithoutBackP)& ent, IGESData_IGESWriter& IW) const |
68 | { |
69 | Standard_Integer upper = ent->NbEntities(); |
70 | IW.Send(ent->NbEntities()); |
71 | for (Standard_Integer i = 1; i <= upper; i ++) |
72 | IW.Send(ent->Entity(i)); |
73 | } |
74 | |
75 | void IGESBasic_ToolOrderedGroupWithoutBackP::OwnShared |
76 | (const Handle(IGESBasic_OrderedGroupWithoutBackP)& ent, Interface_EntityIterator& iter) const |
77 | { |
78 | Standard_Integer upper = ent->NbEntities(); |
79 | for (Standard_Integer i = 1; i <= upper; i ++) |
80 | iter.GetOneItem(ent->Entity(i)); |
81 | } |
82 | |
83 | void IGESBasic_ToolOrderedGroupWithoutBackP::OwnCopy |
84 | (const Handle(IGESBasic_OrderedGroupWithoutBackP)& another, |
85 | const Handle(IGESBasic_OrderedGroupWithoutBackP)& ent, Interface_CopyTool& TC) const |
86 | { |
87 | Standard_Integer lower,upper; |
88 | lower = 1; |
89 | upper = another->NbEntities(); |
90 | Handle(IGESData_HArray1OfIGESEntity) EntArray = new |
91 | IGESData_HArray1OfIGESEntity(lower,upper); |
92 | for (Standard_Integer i = lower;i <= upper;i++) |
93 | { |
94 | DeclareAndCast |
95 | (IGESData_IGESEntity,myentity,TC.Transferred(another->Entity(i))); |
96 | EntArray->SetValue(i,myentity); |
97 | } |
98 | ent->Init(EntArray); |
99 | } |
100 | |
101 | Standard_Boolean IGESBasic_ToolOrderedGroupWithoutBackP::OwnCorrect |
102 | (const Handle(IGESBasic_OrderedGroupWithoutBackP)& ent ) const |
103 | { |
104 | Standard_Integer ianul = 0; |
105 | Standard_Integer i, nbtrue = 0, nb = ent->NbEntities(); |
106 | for (i = 1; i <= nb; i ++) { |
107 | Handle(IGESData_IGESEntity) val = ent->Entity(i); |
108 | if (val.IsNull()) ianul ++; |
109 | else if (val->TypeNumber() == 0) ianul ++; |
110 | } |
111 | if (ianul == 0) return Standard_False; |
112 | Handle(IGESData_HArray1OfIGESEntity) EntArray; |
113 | if (ianul < nb) EntArray = new IGESData_HArray1OfIGESEntity(1,nb-ianul); |
114 | for (i = 1; i <= nb; i ++) { |
115 | Handle(IGESData_IGESEntity) val = ent->Entity(i); |
116 | if (val.IsNull()) continue; |
117 | else if (val->TypeNumber() == 0) continue; |
118 | nbtrue ++; |
119 | EntArray->SetValue (nbtrue,ent->Entity(i)); |
120 | } |
121 | ent->Init(EntArray); |
122 | return Standard_True; |
123 | } |
124 | |
125 | IGESData_DirChecker IGESBasic_ToolOrderedGroupWithoutBackP::DirChecker |
126 | (const Handle(IGESBasic_OrderedGroupWithoutBackP)& /* ent */) const |
127 | { |
128 | IGESData_DirChecker DC(402,15); //TypeNo. 402, Form no. 15 |
129 | DC.Structure(IGESData_DefVoid); |
130 | DC.GraphicsIgnored(); |
131 | DC.BlankStatusIgnored(); |
132 | DC.HierarchyStatusIgnored(); |
133 | return DC; |
134 | } |
135 | |
136 | void IGESBasic_ToolOrderedGroupWithoutBackP::OwnCheck |
137 | (const Handle(IGESBasic_OrderedGroupWithoutBackP)& ent, |
138 | const Interface_ShareTool& , Handle(Interface_Check)& ach) const |
139 | { |
140 | Standard_Boolean ianul = Standard_False; |
141 | Standard_Integer i, nb = ent->NbEntities(); |
142 | for (i = 1; i <= nb; i ++) { |
143 | Handle(IGESData_IGESEntity) val = ent->Entity(i); |
144 | if (val.IsNull()) ianul = Standard_True; |
145 | else if (val->TypeNumber() == 0) ianul = Standard_True; |
146 | if (ianul) { |
147 | ach->AddWarning ("At least one element is Null"); |
148 | break; |
149 | } |
150 | } |
151 | } |
152 | |
153 | void IGESBasic_ToolOrderedGroupWithoutBackP::OwnDump |
154 | (const Handle(IGESBasic_OrderedGroupWithoutBackP)& ent, const IGESData_IGESDumper& dumper, |
0ebe5b0a |
155 | Standard_OStream& S, const Standard_Integer level) const |
7fd59977 |
156 | { |
0ebe5b0a |
157 | S << "IGESBasic_OrderedGroupWithoutBackP\n" |
158 | << "Entries in the Group : "; |
7fd59977 |
159 | IGESData_DumpEntities(S,dumper ,level,1, ent->NbEntities(),ent->Entity); |
0ebe5b0a |
160 | S << std::endl; |
7fd59977 |
161 | } |
162 | |