1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
//--------------------------------------------------------------------
//
// File Name : IGESDraw_ViewsVisible.cxx
// Date :
// Author : CKY / Contract Toubro-Larsen
// Copyright : MATRA-DATAVISION 1993
//
//--------------------------------------------------------------------
#include <IGESDraw_ToolViewsVisible.ixx>
#include <IGESData_ParamCursor.hxx>
#include <IGESData_ViewKindEntity.hxx>
#include <IGESData_IGESEntity.hxx>
#include <IGESDraw_HArray1OfViewKindEntity.hxx>
#include <IGESData_HArray1OfIGESEntity.hxx>
#include <IGESData_Dump.hxx>
#include <Interface_Macros.hxx>
#include <stdio.h>
IGESDraw_ToolViewsVisible::IGESDraw_ToolViewsVisible () { }
void IGESDraw_ToolViewsVisible::ReadOwnParams
(const Handle(IGESDraw_ViewsVisible)& ent,
const Handle(IGESData_IGESReaderData)& IR, IGESData_ParamReader& PR) const
{
//Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
Standard_Integer tempNbViewsVisible, tempNbDisplayedEntities;
Handle(IGESDraw_HArray1OfViewKindEntity) tempViewEntities;
Handle(IGESData_HArray1OfIGESEntity) tempDisplayEntity;
//st = PR.ReadInteger(PR.Current(), "Number Of Views Visible",
//tempNbViewsVisible); //szv#4:S4163:12Mar99 moved in if
if (PR.ReadInteger(PR.Current(), "Number Of Views Visible", tempNbViewsVisible)) {
// Initialise HArray1 only if there is no error reading its Length
if (tempNbViewsVisible <= 0)
PR.AddFail("Number Of Views Visible : Not Positive");
else tempViewEntities = new IGESDraw_HArray1OfViewKindEntity (1, tempNbViewsVisible);
}
if (PR.DefinedElseSkip())
PR.ReadInteger(PR.Current(), "Number of Entities Displayed",
tempNbDisplayedEntities); //szv#4:S4163:12Mar99 `st=` not needed
else {
tempNbDisplayedEntities = 0;
PR.AddWarning("Number of Entities Displayed : undefined, set to Zero");
}
// Initialise HArray1 only if there is no error reading its Length
if (tempNbDisplayedEntities < 0)
PR.AddFail ("Number Of Entities Displayed : Less than Zero");
// else if (tempNbDisplayedEntities > 0) {
if (! tempViewEntities.IsNull()) {
// Read the HArray1 only if its Length was read without any Error
Standard_Integer I;
for (I = 1; I <= tempNbViewsVisible; I++) {
Handle(IGESData_ViewKindEntity) tempViewEntity1;
//st = PR.ReadEntity(IR, PR.Current(), "View Entity",
//STANDARD_TYPE(IGESData_ViewKindEntity), tempViewEntity1); //szv#4:S4163:12Mar99 moved in if
if (PR.ReadEntity(IR, PR.Current(), "View Entity",
STANDARD_TYPE(IGESData_ViewKindEntity), tempViewEntity1))
tempViewEntities->SetValue(I, tempViewEntity1);
}
}
// Read the HArray1 only if its Length was read without any Error
if (tempNbDisplayedEntities > 0) {
PR.ReadEnts (IR,PR.CurrentList(tempNbDisplayedEntities),
"Displayed Entities",tempDisplayEntity); //szv#4:S4163:12Mar99 `st=` not needed
/*
tempDisplayEntity =
new IGESData_HArray1OfIGESEntity (1, tempNbDisplayedEntities);
Handle(IGESData_IGESEntity) tempEntity2;
Standard_Integer I;
for (I = 1; I <= tempNbDisplayedEntities; I++) {
st = PR.ReadEntity(IR, PR.Current(), "Displayed Entity",
tempEntity2);
if (st) tempDisplayEntity->SetValue(I, tempEntity2);
}
*/
}
DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
ent->Init(tempViewEntities, tempDisplayEntity);
}
void IGESDraw_ToolViewsVisible::WriteOwnParams
(const Handle(IGESDraw_ViewsVisible)& ent, IGESData_IGESWriter& IW) const
{
IW.Send(ent->NbViews());
IW.Send(ent->NbDisplayedEntities());
Standard_Integer I;
Standard_Integer up = ent->NbViews();
for (I = 1; I <= up; I++)
IW.Send(ent->ViewItem(I));
up = ent->NbDisplayedEntities();
for (I = 1; I <= up; I++)
IW.Send(ent->DisplayedEntity(I));
}
void IGESDraw_ToolViewsVisible::OwnShared
(const Handle(IGESDraw_ViewsVisible)& ent, Interface_EntityIterator& iter) const
{
Standard_Integer I,up;
up = ent->NbViews();
for (I = 1; I <= up; I++)
iter.GetOneItem(ent->ViewItem(I));
// Displayed -> Implied
}
void IGESDraw_ToolViewsVisible::OwnImplied
(const Handle(IGESDraw_ViewsVisible)& ent, Interface_EntityIterator& iter) const
{
Standard_Integer I,up;
up = ent->NbDisplayedEntities();
for (I = 1; I <= up; I++)
iter.GetOneItem(ent->DisplayedEntity(I));
}
void IGESDraw_ToolViewsVisible::OwnCopy
(const Handle(IGESDraw_ViewsVisible)& another,
const Handle(IGESDraw_ViewsVisible)& ent, Interface_CopyTool& TC) const
{
Handle(IGESDraw_HArray1OfViewKindEntity) tempViewEntities =
new IGESDraw_HArray1OfViewKindEntity(1, another->NbViews());
Standard_Integer I, up;
up = another->NbViews();
for (I = 1; I <= up; I++) {
DeclareAndCast(IGESData_ViewKindEntity, tempView,
TC.Transferred(another->ViewItem(I)));
tempViewEntities->SetValue(I, tempView);
}
// Displayed -> Implied : mettre une liste vide par defaut
Handle(IGESData_HArray1OfIGESEntity) tempDisplayEntities;
ent->Init(tempViewEntities, tempDisplayEntities);
}
void IGESDraw_ToolViewsVisible::OwnRenew
(const Handle(IGESDraw_ViewsVisible)& another,
const Handle(IGESDraw_ViewsVisible)& ent, const Interface_CopyTool& TC) const
{
Interface_EntityIterator newdisp;
Standard_Integer I, up;
up = another->NbDisplayedEntities();
if (up == 0) return;
Handle(IGESData_HArray1OfIGESEntity) tempDisplayEntities;
Handle(IGESData_IGESEntity) anew;
for (I = 1; I <= up; I++) {
if (TC.Search (another->DisplayedEntity(I),anew)) newdisp.GetOneItem(anew);
}
up = newdisp.NbEntities(); I = 0;
if (up > 0) tempDisplayEntities = new IGESData_HArray1OfIGESEntity(1,up);
for (newdisp.Start(); newdisp.More(); newdisp.Next()) {
I ++;
DeclareAndCast(IGESData_IGESEntity, tempEntity,newdisp.Value());
tempDisplayEntities->SetValue(I, tempEntity);
}
ent->InitImplied (tempDisplayEntities);
}
IGESData_DirChecker IGESDraw_ToolViewsVisible::DirChecker
(const Handle(IGESDraw_ViewsVisible)& /*ent*/) const
{
IGESData_DirChecker DC(402, 3);
DC.Structure(IGESData_DefVoid);
DC.LineFont(IGESData_DefVoid);
DC.LineWeight(IGESData_DefVoid);
DC.Color(IGESData_DefVoid);
DC.BlankStatusIgnored();
DC.SubordinateStatusRequired(0);
DC.UseFlagRequired(1);
DC.HierarchyStatusIgnored();
return DC;
}
void IGESDraw_ToolViewsVisible::OwnCheck
(const Handle(IGESDraw_ViewsVisible)& ent,
const Interface_ShareTool& , Handle(Interface_Check)& ach) const
{
Standard_Integer res = 0;
Standard_Integer nb = ent->NbDisplayedEntities();
Handle(IGESData_ViewKindEntity) entcomp = ent;
for (Standard_Integer i = 1; i <= nb; i ++) {
Handle(IGESData_IGESEntity) displayed = ent->DisplayedEntity(i);
if (entcomp != displayed->View()) res ++;
}
if (!res) return;
char mess[80];
sprintf(mess,"Mismatch for %d Entities displayed",res);
ach->AddFail(mess,"Mismatch for %d Entities displayed");
}
void IGESDraw_ToolViewsVisible::OwnWhenDelete
(const Handle(IGESDraw_ViewsVisible)& ent) const
{
Handle(IGESData_HArray1OfIGESEntity) tempDisplayEntities;
ent->InitImplied (tempDisplayEntities);
}
void IGESDraw_ToolViewsVisible::OwnDump
(const Handle(IGESDraw_ViewsVisible)& ent, const IGESData_IGESDumper& dumper,
const Handle(Message_Messenger)& S, const Standard_Integer level) const
{
S << "IGESDraw_ViewsVisible" << endl;
S << "Views Visible : ";
IGESData_DumpEntities(S,dumper ,level,1, ent->NbViews(),ent->ViewItem);
S << endl;
S << "Entities Displayed : ";
IGESData_DumpEntities
(S,dumper ,level,1, ent->NbDisplayedEntities(),ent->DisplayedEntity);
S << endl;
}
Standard_Boolean IGESDraw_ToolViewsVisible::OwnCorrect
(const Handle(IGESDraw_ViewsVisible)& ent) const
{
// Les entites affichees doivent referencer <ent>. Elles ont priorite.
Standard_Boolean res = Standard_False;
Standard_Integer nb = ent->NbDisplayedEntities();
Handle(IGESData_ViewKindEntity) entcomp = ent;
for (Standard_Integer i = 1; i <= nb; i ++) {
Handle(IGESData_IGESEntity) displayed = ent->DisplayedEntity(i);
if (entcomp != displayed->View()) res = Standard_True;
}
if (!res) return res;
Handle(IGESData_HArray1OfIGESEntity) nulDisplayEntities;
ent->InitImplied (nulDisplayEntities);
return res;
}
|