b311480e |
1 | // Created on: 1999-11-19 |
2 | // Created by: Andrey BETENEV |
3 | // Copyright (c) 1999-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
42cf5bc1 |
17 | |
18 | #include <StepAP203_CcDesignApproval.hxx> |
19 | #include <StepAP203_CcDesignDateAndTimeAssignment.hxx> |
20 | #include <StepAP203_CcDesignPersonAndOrganizationAssignment.hxx> |
21 | #include <StepAP203_CcDesignSecurityClassification.hxx> |
22 | #include <StepBasic_Approval.hxx> |
23 | #include <StepBasic_ApprovalDateTime.hxx> |
24 | #include <StepBasic_ApprovalPersonOrganization.hxx> |
25 | #include <StepBasic_ApprovalRole.hxx> |
26 | #include <StepBasic_DateAndTime.hxx> |
27 | #include <StepBasic_DateTimeRole.hxx> |
28 | #include <StepBasic_PersonAndOrganization.hxx> |
29 | #include <StepBasic_PersonAndOrganizationRole.hxx> |
30 | #include <StepBasic_ProductCategoryRelationship.hxx> |
31 | #include <StepBasic_SecurityClassificationLevel.hxx> |
32 | #include <STEPConstruct_AP203Context.hxx> |
33 | #include <STEPConstruct_Part.hxx> |
34 | #include <StepRepr_NextAssemblyUsageOccurrence.hxx> |
35 | #include <StepShape_ShapeDefinitionRepresentation.hxx> |
7fd59977 |
36 | |
fe9b8ff2 |
37 | #include <OSD_Host.hxx> |
7fd59977 |
38 | #include <OSD_Process.hxx> |
39 | #include <Quantity_Date.hxx> |
40 | |
41 | #include <TCollection_HAsciiString.hxx> |
42 | #include <TColStd_SequenceOfAsciiString.hxx> |
43 | #include <Interface_HArray1OfHAsciiString.hxx> |
44 | |
45 | #include <StepBasic_CalendarDate.hxx> |
46 | #include <StepBasic_LocalTime.hxx> |
47 | #include <StepBasic_ApprovalStatus.hxx> |
48 | #include <StepBasic_CoordinatedUniversalTimeOffset.hxx> |
49 | #include <StepBasic_AheadOrBehind.hxx> |
50 | #include <StepBasic_Person.hxx> |
51 | #include <StepBasic_Organization.hxx> |
52 | #include <StepBasic_SecurityClassification.hxx> |
c04c30b3 |
53 | #include <StepBasic_Product.hxx> |
54 | #include <StepBasic_ProductDefinition.hxx> |
55 | #include <StepBasic_ProductDefinitionFormation.hxx> |
56 | #include <StepBasic_ProductRelatedProductCategory.hxx> |
7fd59977 |
57 | #include <StepAP203_HArray1OfPersonOrganizationItem.hxx> |
58 | #include <StepAP203_HArray1OfClassifiedItem.hxx> |
59 | #include <StepAP203_HArray1OfDateTimeItem.hxx> |
60 | #include <StepAP203_HArray1OfApprovedItem.hxx> |
61 | #include <StepBasic_ProductCategory.hxx> |
62 | |
fe9b8ff2 |
63 | #ifndef _WIN32 |
64 | # include <pwd.h> |
65 | #endif |
66 | |
7fd59977 |
67 | //======================================================================= |
68 | //function : STEPConstruct_AP203Context |
69 | //purpose : |
70 | //======================================================================= |
71 | |
72 | STEPConstruct_AP203Context::STEPConstruct_AP203Context () |
73 | { |
74 | InitRoles(); |
75 | } |
76 | |
77 | //======================================================================= |
78 | //function : DefaultApproval |
79 | //purpose : |
80 | //======================================================================= |
81 | |
82 | Handle(StepBasic_Approval) STEPConstruct_AP203Context::DefaultApproval () |
83 | { |
84 | if ( defApproval.IsNull() ) { |
85 | Handle(StepBasic_ApprovalStatus) aStatus = new StepBasic_ApprovalStatus; |
86 | Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString ("not_yet_approved"); |
87 | aStatus->Init ( aName ); |
88 | |
89 | Handle(TCollection_HAsciiString) aLevel = new TCollection_HAsciiString (""); |
90 | defApproval = new StepBasic_Approval; |
91 | defApproval->Init ( aStatus, aLevel ); |
92 | } |
93 | return defApproval; |
94 | } |
95 | |
96 | //======================================================================= |
97 | //function : SetDefaultApproval |
98 | //purpose : |
99 | //======================================================================= |
100 | |
101 | void STEPConstruct_AP203Context::SetDefaultApproval (const Handle(StepBasic_Approval) &app) |
102 | { |
103 | defApproval = app; |
104 | } |
105 | |
106 | //======================================================================= |
107 | //function : DefaultDateAndTime |
108 | //purpose : |
109 | //======================================================================= |
110 | |
111 | Handle(StepBasic_DateAndTime) STEPConstruct_AP203Context::DefaultDateAndTime () |
112 | { |
113 | if ( defDateAndTime.IsNull() ) { |
114 | OSD_Process sys; |
115 | Quantity_Date date = sys.SystemDate (); |
116 | |
117 | Handle(StepBasic_CalendarDate) aDate = new StepBasic_CalendarDate; |
118 | aDate->Init ( date.Year(), date.Day(), date.Month() ); |
119 | |
120 | Handle(StepBasic_CoordinatedUniversalTimeOffset) zone = |
121 | new StepBasic_CoordinatedUniversalTimeOffset; |
9bfa28a7 |
122 | #if defined(_MSC_VER) && _MSC_VER >= 1600 |
123 | long shift = 0; |
124 | _get_timezone (&shift); |
125 | #else |
7fd59977 |
126 | Standard_Integer shift = Standard_Integer(timezone); |
9bfa28a7 |
127 | #endif |
7fd59977 |
128 | Standard_Integer shifth = abs ( shift ) / 3600; |
129 | Standard_Integer shiftm = ( abs ( shift ) - shifth * 3600 ) / 60; |
130 | StepBasic_AheadOrBehind sense = ( shift >0 ? StepBasic_aobBehind : |
131 | shift <0 ? StepBasic_aobAhead : |
132 | StepBasic_aobExact ); |
133 | zone->Init ( shifth, ( shiftm != 0 ), shiftm, sense ); |
134 | |
135 | Handle(StepBasic_LocalTime) aTime = new StepBasic_LocalTime; |
136 | aTime->Init ( date.Hour(), Standard_True, date.Minute(), Standard_False, 0., zone ); |
137 | |
138 | defDateAndTime = new StepBasic_DateAndTime; |
139 | defDateAndTime->Init ( aDate, aTime ); |
140 | } |
141 | return defDateAndTime; |
142 | } |
143 | |
144 | //======================================================================= |
145 | //function : SetDefaultDateAndTime |
146 | //purpose : |
147 | //======================================================================= |
148 | |
149 | void STEPConstruct_AP203Context::SetDefaultDateAndTime (const Handle(StepBasic_DateAndTime) &dt) |
150 | { |
151 | defDateAndTime = dt; |
152 | } |
153 | |
154 | //======================================================================= |
155 | //function : DefaultPersonAndOrganization |
156 | //purpose : |
157 | //======================================================================= |
158 | |
159 | Handle(StepBasic_PersonAndOrganization) STEPConstruct_AP203Context::DefaultPersonAndOrganization () |
160 | { |
161 | if ( defPersonAndOrganization.IsNull() ) { |
162 | // get IP address as a unique id of organization |
fe9b8ff2 |
163 | Handle(TCollection_HAsciiString) orgId = new TCollection_HAsciiString ( "IP" ); |
164 | OSD_Host aHost; |
165 | TCollection_AsciiString anIP = aHost.InternetAddress(); |
166 | // cut off last number |
167 | Standard_Integer aLastDotIndex = anIP.SearchFromEnd ("."); |
168 | if (aLastDotIndex >0) |
169 | { |
170 | anIP.Trunc (aLastDotIndex - 1); |
171 | orgId->AssignCat (anIP.ToCString()); |
7fd59977 |
172 | } |
173 | |
174 | // create organization |
175 | Handle(StepBasic_Organization) aOrg = new StepBasic_Organization; |
176 | Handle(TCollection_HAsciiString) oName = new TCollection_HAsciiString ( "Unspecified" ); |
177 | Handle(TCollection_HAsciiString) oDescr = new TCollection_HAsciiString ( "" ); |
178 | aOrg->Init ( Standard_True, orgId, oName, oDescr ); |
179 | |
180 | // construct person`s name |
181 | OSD_Process sys; |
182 | Standard_CString usr = sys.UserName().ToCString(); |
9bf6baed |
183 | #if !defined(_WIN32) && !defined(__ANDROID__) |
7fd59977 |
184 | if ( usr ) { |
185 | struct passwd *pwd = getpwnam ( usr ); |
186 | if ( pwd ) usr = pwd->pw_gecos; |
187 | } |
188 | else usr = "Unknown"; |
189 | #endif |
190 | TCollection_AsciiString user ( usr ); |
191 | Handle(TCollection_HAsciiString) fname = new TCollection_HAsciiString (""); |
192 | Handle(TCollection_HAsciiString) lname = new TCollection_HAsciiString (""); |
193 | Handle(Interface_HArray1OfHAsciiString) mname; |
194 | TColStd_SequenceOfAsciiString names; |
195 | Standard_Integer i; // svv Jan11 2000 : porting on DEC |
196 | for ( i=1; ; i++ ) { |
197 | TCollection_AsciiString token = user.Token ( " \t", i ); |
198 | if ( ! token.Length() ) break; |
199 | names.Append ( token ); |
200 | } |
201 | if ( names.Length() >0 ) fname->AssignCat ( names.Value(1).ToCString() ); |
202 | if ( names.Length() >1 ) lname->AssignCat ( names.Value(names.Length()).ToCString() ); |
203 | if ( names.Length() >2 ) { |
204 | mname = new Interface_HArray1OfHAsciiString ( 1, names.Length()-2 ); |
205 | for ( i=2; i < names.Length(); i++ ) |
206 | mname->SetValue ( i-1, new TCollection_HAsciiString ( names.Value(i) ) ); |
207 | } |
208 | |
209 | // create a person |
210 | Handle(StepBasic_Person) aPerson = new StepBasic_Person; |
211 | Handle(TCollection_HAsciiString) uid = new TCollection_HAsciiString ( orgId ); |
212 | uid->AssignCat ( "," ); |
68299304 |
213 | uid->AssignCat (sys.UserName().ToCString()); |
7fd59977 |
214 | Handle(Interface_HArray1OfHAsciiString) suffix, prefix; |
215 | aPerson->Init ( uid, Standard_True, lname, Standard_True, fname, ( ! mname.IsNull() ), |
216 | mname, Standard_False, suffix, Standard_False, prefix ); |
217 | |
218 | defPersonAndOrganization = new StepBasic_PersonAndOrganization; |
219 | defPersonAndOrganization->Init ( aPerson, aOrg ); |
220 | } |
221 | return defPersonAndOrganization; |
222 | } |
223 | |
224 | //======================================================================= |
225 | //function : SetDefaultPersonAndOrganization |
226 | //purpose : |
227 | //======================================================================= |
228 | |
229 | void STEPConstruct_AP203Context::SetDefaultPersonAndOrganization (const Handle(StepBasic_PersonAndOrganization) &po) |
230 | { |
231 | defPersonAndOrganization = po; |
232 | } |
233 | |
234 | //======================================================================= |
235 | //function : DefaultSecurityClassificationLevel |
236 | //purpose : |
237 | //======================================================================= |
238 | |
239 | Handle(StepBasic_SecurityClassificationLevel) STEPConstruct_AP203Context::DefaultSecurityClassificationLevel () |
240 | { |
241 | if ( defSecurityClassificationLevel.IsNull() ) { |
242 | defSecurityClassificationLevel = new StepBasic_SecurityClassificationLevel; |
243 | Handle(TCollection_HAsciiString) levName = new TCollection_HAsciiString ( "unclassified" ); |
244 | defSecurityClassificationLevel->Init ( levName ); |
245 | } |
246 | return defSecurityClassificationLevel; |
247 | } |
248 | |
249 | //======================================================================= |
250 | //function : SetDefaultSecurityClassificationLevel |
251 | //purpose : |
252 | //======================================================================= |
253 | |
254 | void STEPConstruct_AP203Context::SetDefaultSecurityClassificationLevel (const Handle(StepBasic_SecurityClassificationLevel) &scl) |
255 | { |
256 | defSecurityClassificationLevel = scl; |
257 | } |
258 | |
259 | //======================================================================= |
260 | //function : RoleCreator |
261 | //purpose : |
262 | //======================================================================= |
263 | |
264 | Handle(StepBasic_PersonAndOrganizationRole) STEPConstruct_AP203Context::RoleCreator () const |
265 | { |
266 | return roleCreator; |
267 | } |
268 | |
269 | //======================================================================= |
270 | //function : RoleDesignOwner |
271 | //purpose : |
272 | //======================================================================= |
273 | |
274 | Handle(StepBasic_PersonAndOrganizationRole) STEPConstruct_AP203Context::RoleDesignOwner () const |
275 | { |
276 | return roleDesignOwner; |
277 | } |
278 | |
279 | //======================================================================= |
280 | //function : RoleDesignSupplier |
281 | //purpose : |
282 | //======================================================================= |
283 | |
284 | Handle(StepBasic_PersonAndOrganizationRole) STEPConstruct_AP203Context::RoleDesignSupplier () const |
285 | { |
286 | return roleDesignSupplier; |
287 | } |
288 | |
289 | //======================================================================= |
290 | //function : RoleClassificationOfficer |
291 | //purpose : |
292 | //======================================================================= |
293 | |
294 | Handle(StepBasic_PersonAndOrganizationRole) STEPConstruct_AP203Context::RoleClassificationOfficer () const |
295 | { |
296 | return roleClassificationOfficer; |
297 | } |
298 | |
299 | //======================================================================= |
300 | //function : RoleCreationDate |
301 | //purpose : |
302 | //======================================================================= |
303 | |
304 | Handle(StepBasic_DateTimeRole) STEPConstruct_AP203Context::RoleCreationDate () const |
305 | { |
306 | return roleCreationDate; |
307 | } |
308 | |
309 | //======================================================================= |
310 | //function : RoleClassificationDate |
311 | //purpose : |
312 | //======================================================================= |
313 | |
314 | Handle(StepBasic_DateTimeRole) STEPConstruct_AP203Context::RoleClassificationDate () const |
315 | { |
316 | return roleClassificationDate; |
317 | } |
318 | |
319 | //======================================================================= |
320 | //function : RoleApprover |
321 | //purpose : |
322 | //======================================================================= |
323 | |
324 | Handle(StepBasic_ApprovalRole) STEPConstruct_AP203Context::RoleApprover () const |
325 | { |
326 | return roleApprover; |
327 | } |
328 | |
329 | //======================================================================= |
330 | //function : Init |
331 | //purpose : |
332 | //======================================================================= |
333 | |
334 | void STEPConstruct_AP203Context::Init (const Handle(StepShape_ShapeDefinitionRepresentation) &sdr) |
335 | { |
336 | Clear(); |
337 | STEPConstruct_Part SDRTool; |
338 | SDRTool.ReadSDR ( sdr ); |
339 | InitPart ( SDRTool ); |
340 | } |
341 | |
342 | //======================================================================= |
343 | //function : Init |
344 | //purpose : |
345 | //======================================================================= |
346 | |
347 | void STEPConstruct_AP203Context::Init (const STEPConstruct_Part &SDRTool) |
348 | { |
349 | Clear(); |
350 | InitPart ( SDRTool ); |
351 | } |
352 | |
353 | //======================================================================= |
354 | //function : Init |
355 | //purpose : |
356 | //======================================================================= |
357 | |
358 | //void STEPConstruct_AP203Context::Init (const STEPConstruct_Part &SDRTool, const Handle(Interface_Model) &Model) {} |
359 | |
360 | //======================================================================= |
361 | //function : Init |
362 | //purpose : |
363 | //======================================================================= |
364 | |
365 | void STEPConstruct_AP203Context::Init (const Handle(StepRepr_NextAssemblyUsageOccurrence) &NAUO) |
366 | { |
367 | Clear(); |
368 | InitAssembly ( NAUO ); |
369 | } |
370 | |
371 | //======================================================================= |
372 | //function : GetCreator |
373 | //purpose : |
374 | //======================================================================= |
375 | |
376 | Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) STEPConstruct_AP203Context::GetCreator () const |
377 | { |
378 | return myCreator; |
379 | } |
380 | |
381 | //======================================================================= |
382 | //function : GetDesignOwner |
383 | //purpose : |
384 | //======================================================================= |
385 | |
386 | Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) STEPConstruct_AP203Context::GetDesignOwner () const |
387 | { |
388 | return myDesignOwner; |
389 | } |
390 | |
391 | //======================================================================= |
392 | //function : GetDesignSupplier |
393 | //purpose : |
394 | //======================================================================= |
395 | |
396 | Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) STEPConstruct_AP203Context::GetDesignSupplier () const |
397 | { |
398 | return myDesignSupplier; |
399 | } |
400 | |
401 | //======================================================================= |
402 | //function : GetClassificationOfficer |
403 | //purpose : |
404 | //======================================================================= |
405 | |
406 | Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) STEPConstruct_AP203Context::GetClassificationOfficer () const |
407 | { |
408 | return myClassificationOfficer; |
409 | } |
410 | |
411 | //======================================================================= |
412 | //function : GetSecurity |
413 | //purpose : |
414 | //======================================================================= |
415 | |
416 | Handle(StepAP203_CcDesignSecurityClassification) STEPConstruct_AP203Context::GetSecurity () const |
417 | { |
418 | return mySecurity; |
419 | } |
420 | |
421 | //======================================================================= |
422 | //function : GetCreationDate |
423 | //purpose : |
424 | //======================================================================= |
425 | |
426 | Handle(StepAP203_CcDesignDateAndTimeAssignment) STEPConstruct_AP203Context::GetCreationDate () const |
427 | { |
428 | return myCreationDate; |
429 | } |
430 | |
431 | //======================================================================= |
432 | //function : GetClassificationDate |
433 | //purpose : |
434 | //======================================================================= |
435 | |
436 | Handle(StepAP203_CcDesignDateAndTimeAssignment) STEPConstruct_AP203Context::GetClassificationDate () const |
437 | { |
438 | return myClassificationDate; |
439 | } |
440 | |
441 | //======================================================================= |
442 | //function : GetApproval |
443 | //purpose : |
444 | //======================================================================= |
445 | |
446 | Handle(StepAP203_CcDesignApproval) STEPConstruct_AP203Context::GetApproval () const |
447 | { |
448 | return myApproval; |
449 | } |
450 | |
451 | //======================================================================= |
452 | //function : GetApprover |
453 | //purpose : |
454 | //======================================================================= |
455 | |
456 | Handle(StepBasic_ApprovalPersonOrganization) STEPConstruct_AP203Context::GetApprover () const |
457 | { |
458 | return myApprover; |
459 | } |
460 | |
461 | //======================================================================= |
462 | //function : GetApprovalDateTime |
463 | //purpose : |
464 | //======================================================================= |
465 | |
466 | Handle(StepBasic_ApprovalDateTime) STEPConstruct_AP203Context::GetApprovalDateTime () const |
467 | { |
468 | return myApprovalDateTime; |
469 | } |
470 | |
471 | //======================================================================= |
472 | //function : GetProductCategoryRelationship |
473 | //purpose : |
474 | //======================================================================= |
475 | |
476 | Handle(StepBasic_ProductCategoryRelationship) STEPConstruct_AP203Context::GetProductCategoryRelationship () const |
477 | { |
478 | return myProductCategoryRelationship; |
479 | } |
480 | |
481 | //======================================================================= |
482 | //function : Clear |
483 | //purpose : |
484 | //======================================================================= |
485 | |
486 | void STEPConstruct_AP203Context::Clear () |
487 | { |
488 | myCreator.Nullify(); |
489 | myDesignOwner.Nullify(); |
490 | myDesignSupplier.Nullify(); |
491 | myClassificationOfficer.Nullify(); |
492 | mySecurity.Nullify(); |
493 | myCreationDate.Nullify(); |
494 | myClassificationDate.Nullify(); |
495 | myApproval.Nullify(); |
496 | |
497 | // myApprover.Nullify(); |
498 | // myApprovalDateTime.Nullify(); |
499 | |
500 | myProductCategoryRelationship.Nullify(); |
501 | } |
502 | |
503 | //======================================================================= |
504 | //function : InitRoles |
505 | //purpose : |
506 | //======================================================================= |
507 | |
508 | void STEPConstruct_AP203Context::InitRoles () |
509 | { |
510 | roleCreator = new StepBasic_PersonAndOrganizationRole; |
511 | roleDesignOwner = new StepBasic_PersonAndOrganizationRole; |
512 | roleDesignSupplier = new StepBasic_PersonAndOrganizationRole; |
513 | roleClassificationOfficer = new StepBasic_PersonAndOrganizationRole; |
514 | roleCreationDate = new StepBasic_DateTimeRole; |
515 | roleClassificationDate = new StepBasic_DateTimeRole; |
516 | roleApprover = new StepBasic_ApprovalRole; |
517 | |
518 | roleCreator->Init ( new TCollection_HAsciiString ( "creator" ) ); |
519 | roleDesignOwner->Init ( new TCollection_HAsciiString ( "design_owner" ) ); |
520 | roleDesignSupplier->Init ( new TCollection_HAsciiString ( "design_supplier" ) ); |
521 | roleClassificationOfficer->Init ( new TCollection_HAsciiString ( "classification_officer" ) ); |
522 | roleCreationDate->Init ( new TCollection_HAsciiString ( "creation_date" ) ); |
523 | roleClassificationDate->Init ( new TCollection_HAsciiString ( "classification_date" ) ); |
524 | roleApprover->Init ( new TCollection_HAsciiString ( "approver" ) ); |
525 | } |
526 | |
527 | //======================================================================= |
528 | //function : InitPart |
529 | //purpose : |
530 | //======================================================================= |
531 | |
532 | void STEPConstruct_AP203Context::InitPart (const STEPConstruct_Part &SDRTool) |
533 | { |
534 | if ( myCreator.IsNull() ) { |
535 | myCreator = new StepAP203_CcDesignPersonAndOrganizationAssignment; |
536 | Handle(StepAP203_HArray1OfPersonOrganizationItem) items = |
537 | new StepAP203_HArray1OfPersonOrganizationItem (1, 2); |
538 | items->ChangeValue(1).SetValue ( SDRTool.PDF() ); |
539 | items->ChangeValue(2).SetValue ( SDRTool.PD() ); |
540 | myCreator->Init ( DefaultPersonAndOrganization(), RoleCreator(), items ); |
541 | } |
542 | |
543 | if ( myDesignOwner.IsNull() ) { |
544 | myDesignOwner = new StepAP203_CcDesignPersonAndOrganizationAssignment; |
545 | Handle(StepAP203_HArray1OfPersonOrganizationItem) items = |
546 | new StepAP203_HArray1OfPersonOrganizationItem (1, 1); |
547 | items->ChangeValue(1).SetValue ( SDRTool.Product() ); |
548 | myDesignOwner->Init ( DefaultPersonAndOrganization(), RoleDesignOwner(), items ); |
549 | } |
550 | |
551 | if ( myDesignSupplier.IsNull() ) { |
552 | myDesignSupplier = new StepAP203_CcDesignPersonAndOrganizationAssignment; |
553 | Handle(StepAP203_HArray1OfPersonOrganizationItem) items = |
554 | new StepAP203_HArray1OfPersonOrganizationItem (1, 1); |
555 | items->ChangeValue(1).SetValue ( SDRTool.PDF() ); |
556 | myDesignSupplier->Init ( DefaultPersonAndOrganization(), RoleDesignSupplier(), items ); |
557 | } |
558 | |
559 | if ( myCreationDate.IsNull() ) { |
560 | myCreationDate = new StepAP203_CcDesignDateAndTimeAssignment; |
561 | Handle(StepAP203_HArray1OfDateTimeItem) items = |
562 | new StepAP203_HArray1OfDateTimeItem (1, 1); |
563 | items->ChangeValue(1).SetValue ( SDRTool.PD() ); |
564 | myCreationDate->Init ( DefaultDateAndTime(), RoleCreationDate(), items ); |
565 | } |
566 | |
567 | if ( mySecurity.IsNull() ) { |
568 | |
569 | Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString ( "" ); |
570 | Handle(TCollection_HAsciiString) aPurpose = new TCollection_HAsciiString ( "" ); |
571 | Handle(StepBasic_SecurityClassification) sc = new StepBasic_SecurityClassification; |
572 | sc->Init ( aName, aPurpose, DefaultSecurityClassificationLevel() ); |
573 | |
574 | mySecurity = new StepAP203_CcDesignSecurityClassification; |
575 | Handle(StepAP203_HArray1OfClassifiedItem) items = |
576 | new StepAP203_HArray1OfClassifiedItem (1, 1); |
577 | items->ChangeValue(1).SetValue ( SDRTool.PDF() ); |
578 | mySecurity->Init ( sc, items ); |
579 | } |
580 | InitSecurityRequisites(); |
581 | |
582 | if ( myApproval.IsNull() ) { |
583 | myApproval = new StepAP203_CcDesignApproval; |
584 | Handle(StepAP203_HArray1OfApprovedItem) items = |
585 | new StepAP203_HArray1OfApprovedItem (1, 3); |
586 | items->ChangeValue(1).SetValue ( SDRTool.PDF() ); |
587 | items->ChangeValue(2).SetValue ( SDRTool.PD() ); |
588 | items->ChangeValue(3).SetValue ( mySecurity->AssignedSecurityClassification() ); |
589 | myApproval->Init ( DefaultApproval(), items ); |
590 | } |
591 | InitApprovalRequisites(); |
592 | |
593 | if ( myProductCategoryRelationship.IsNull() ) { |
594 | Handle(StepBasic_ProductCategory) PC = new StepBasic_ProductCategory; |
595 | Handle(TCollection_HAsciiString) PCName = new TCollection_HAsciiString ( "part" ); |
596 | PC->Init ( PCName, Standard_False, 0 ); |
597 | |
598 | myProductCategoryRelationship = new StepBasic_ProductCategoryRelationship; |
599 | Handle(TCollection_HAsciiString) PCRName = new TCollection_HAsciiString ( "" ); |
600 | Handle(TCollection_HAsciiString) PCRDescr = new TCollection_HAsciiString ( "" ); |
601 | myProductCategoryRelationship->Init ( PCRName, Standard_True, PCRDescr, PC, SDRTool.PRPC() ); |
602 | } |
603 | } |
604 | |
605 | //======================================================================= |
606 | //function : InitAssembly |
607 | //purpose : |
608 | //======================================================================= |
609 | |
610 | void STEPConstruct_AP203Context::InitAssembly (const Handle(StepRepr_NextAssemblyUsageOccurrence) &NAUO) |
611 | { |
612 | if ( mySecurity.IsNull() ) { |
613 | |
614 | Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString ( "" ); |
615 | Handle(TCollection_HAsciiString) aPurpose = new TCollection_HAsciiString ( "" ); |
616 | Handle(StepBasic_SecurityClassification) sc = new StepBasic_SecurityClassification; |
617 | sc->Init ( aName, aPurpose, DefaultSecurityClassificationLevel() ); |
618 | |
619 | mySecurity = new StepAP203_CcDesignSecurityClassification; |
620 | Handle(StepAP203_HArray1OfClassifiedItem) items = |
621 | new StepAP203_HArray1OfClassifiedItem (1, 1); |
622 | items->ChangeValue(1).SetValue ( NAUO ); |
623 | mySecurity->Init ( sc, items ); |
624 | } |
625 | InitSecurityRequisites(); |
626 | |
627 | if ( myApproval.IsNull() ) { |
628 | myApproval = new StepAP203_CcDesignApproval; |
629 | Handle(StepAP203_HArray1OfApprovedItem) items = |
630 | new StepAP203_HArray1OfApprovedItem (1, 1); |
631 | items->ChangeValue(1).SetValue ( mySecurity->AssignedSecurityClassification() ); |
632 | myApproval->Init ( DefaultApproval(), items ); |
633 | } |
634 | InitApprovalRequisites(); |
635 | } |
636 | |
637 | //======================================================================= |
638 | //function : InitSecurityRequisites |
639 | //purpose : |
640 | //======================================================================= |
641 | |
642 | void STEPConstruct_AP203Context::InitSecurityRequisites () |
643 | { |
644 | if ( myClassificationOfficer.IsNull() || |
645 | myClassificationOfficer->Items()->Value(1).Value() != mySecurity->AssignedSecurityClassification() ) { |
646 | myClassificationOfficer = new StepAP203_CcDesignPersonAndOrganizationAssignment; |
647 | Handle(StepAP203_HArray1OfPersonOrganizationItem) items = |
648 | new StepAP203_HArray1OfPersonOrganizationItem (1, 1); |
649 | items->ChangeValue(1).SetValue ( mySecurity->AssignedSecurityClassification() ); |
650 | myClassificationOfficer->Init ( DefaultPersonAndOrganization(), RoleClassificationOfficer(), items ); |
651 | } |
652 | |
653 | if ( myClassificationDate.IsNull() || |
654 | myClassificationDate->Items()->Value(1).Value() != mySecurity->AssignedSecurityClassification() ) { |
655 | myClassificationDate = new StepAP203_CcDesignDateAndTimeAssignment; |
656 | Handle(StepAP203_HArray1OfDateTimeItem) items = |
657 | new StepAP203_HArray1OfDateTimeItem (1, 1); |
658 | items->ChangeValue(1).SetValue ( mySecurity->AssignedSecurityClassification() ); |
659 | myClassificationDate->Init ( DefaultDateAndTime(), RoleClassificationDate(), items ); |
660 | } |
661 | } |
662 | |
663 | //======================================================================= |
664 | //function : InitApprovalRequisites |
665 | //purpose : |
666 | //======================================================================= |
667 | |
668 | void STEPConstruct_AP203Context::InitApprovalRequisites () |
669 | { |
670 | if ( myApprover.IsNull() || |
671 | myApprover->AuthorizedApproval() != myApproval->AssignedApproval() ) { |
672 | myApprover = new StepBasic_ApprovalPersonOrganization; |
673 | StepBasic_PersonOrganizationSelect po; |
674 | po.SetValue ( DefaultPersonAndOrganization() ); |
675 | myApprover->Init ( po, myApproval->AssignedApproval(), RoleApprover() ); |
676 | } |
677 | |
678 | if ( myApprovalDateTime.IsNull() || |
679 | myApprovalDateTime->DatedApproval() != myApproval->AssignedApproval() ) { |
680 | myApprovalDateTime = new StepBasic_ApprovalDateTime; |
681 | StepBasic_DateTimeSelect dt; |
682 | dt.SetValue ( DefaultDateAndTime() ); |
683 | myApprovalDateTime->Init ( dt, myApproval->AssignedApproval() ); |
684 | } |
685 | } |