0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / STEPConstruct / STEPConstruct_AP203Context.cxx
CommitLineData
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
72STEPConstruct_AP203Context::STEPConstruct_AP203Context ()
73{
74 InitRoles();
75}
76
77//=======================================================================
78//function : DefaultApproval
79//purpose :
80//=======================================================================
81
82Handle(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
101void STEPConstruct_AP203Context::SetDefaultApproval (const Handle(StepBasic_Approval) &app)
102{
103 defApproval = app;
104}
105
106//=======================================================================
107//function : DefaultDateAndTime
108//purpose :
109//=======================================================================
110
111Handle(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
149void STEPConstruct_AP203Context::SetDefaultDateAndTime (const Handle(StepBasic_DateAndTime) &dt)
150{
151 defDateAndTime = dt;
152}
153
154//=======================================================================
155//function : DefaultPersonAndOrganization
156//purpose :
157//=======================================================================
158
159Handle(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;
61aef3ce 182 TCollection_AsciiString user (sys.UserName());
183#if !defined(_WIN32) && !defined(__ANDROID__)
184 if ( !user.IsEmpty() ) {
185 struct passwd *pwd = getpwnam ( user.ToCString() );
186 if ( pwd ) user = pwd->pw_gecos;
7fd59977 187 }
61aef3ce 188 else user = "Unknown";
7fd59977 189#endif
7fd59977 190 Handle(TCollection_HAsciiString) fname = new TCollection_HAsciiString ("");
191 Handle(TCollection_HAsciiString) lname = new TCollection_HAsciiString ("");
192 Handle(Interface_HArray1OfHAsciiString) mname;
193 TColStd_SequenceOfAsciiString names;
194 Standard_Integer i; // svv Jan11 2000 : porting on DEC
195 for ( i=1; ; i++ ) {
196 TCollection_AsciiString token = user.Token ( " \t", i );
197 if ( ! token.Length() ) break;
198 names.Append ( token );
199 }
200 if ( names.Length() >0 ) fname->AssignCat ( names.Value(1).ToCString() );
201 if ( names.Length() >1 ) lname->AssignCat ( names.Value(names.Length()).ToCString() );
202 if ( names.Length() >2 ) {
203 mname = new Interface_HArray1OfHAsciiString ( 1, names.Length()-2 );
204 for ( i=2; i < names.Length(); i++ )
205 mname->SetValue ( i-1, new TCollection_HAsciiString ( names.Value(i) ) );
206 }
207
208 // create a person
209 Handle(StepBasic_Person) aPerson = new StepBasic_Person;
210 Handle(TCollection_HAsciiString) uid = new TCollection_HAsciiString ( orgId );
211 uid->AssignCat ( "," );
68299304 212 uid->AssignCat (sys.UserName().ToCString());
7fd59977 213 Handle(Interface_HArray1OfHAsciiString) suffix, prefix;
214 aPerson->Init ( uid, Standard_True, lname, Standard_True, fname, ( ! mname.IsNull() ),
215 mname, Standard_False, suffix, Standard_False, prefix );
216
217 defPersonAndOrganization = new StepBasic_PersonAndOrganization;
218 defPersonAndOrganization->Init ( aPerson, aOrg );
219 }
220 return defPersonAndOrganization;
221}
222
223//=======================================================================
224//function : SetDefaultPersonAndOrganization
225//purpose :
226//=======================================================================
227
228void STEPConstruct_AP203Context::SetDefaultPersonAndOrganization (const Handle(StepBasic_PersonAndOrganization) &po)
229{
230 defPersonAndOrganization = po;
231}
232
233//=======================================================================
234//function : DefaultSecurityClassificationLevel
235//purpose :
236//=======================================================================
237
238Handle(StepBasic_SecurityClassificationLevel) STEPConstruct_AP203Context::DefaultSecurityClassificationLevel ()
239{
240 if ( defSecurityClassificationLevel.IsNull() ) {
241 defSecurityClassificationLevel = new StepBasic_SecurityClassificationLevel;
242 Handle(TCollection_HAsciiString) levName = new TCollection_HAsciiString ( "unclassified" );
243 defSecurityClassificationLevel->Init ( levName );
244 }
245 return defSecurityClassificationLevel;
246}
247
248//=======================================================================
249//function : SetDefaultSecurityClassificationLevel
250//purpose :
251//=======================================================================
252
253void STEPConstruct_AP203Context::SetDefaultSecurityClassificationLevel (const Handle(StepBasic_SecurityClassificationLevel) &scl)
254{
255 defSecurityClassificationLevel = scl;
256}
257
258//=======================================================================
259//function : RoleCreator
260//purpose :
261//=======================================================================
262
263Handle(StepBasic_PersonAndOrganizationRole) STEPConstruct_AP203Context::RoleCreator () const
264{
265 return roleCreator;
266}
267
268//=======================================================================
269//function : RoleDesignOwner
270//purpose :
271//=======================================================================
272
273Handle(StepBasic_PersonAndOrganizationRole) STEPConstruct_AP203Context::RoleDesignOwner () const
274{
275 return roleDesignOwner;
276}
277
278//=======================================================================
279//function : RoleDesignSupplier
280//purpose :
281//=======================================================================
282
283Handle(StepBasic_PersonAndOrganizationRole) STEPConstruct_AP203Context::RoleDesignSupplier () const
284{
285 return roleDesignSupplier;
286}
287
288//=======================================================================
289//function : RoleClassificationOfficer
290//purpose :
291//=======================================================================
292
293Handle(StepBasic_PersonAndOrganizationRole) STEPConstruct_AP203Context::RoleClassificationOfficer () const
294{
295 return roleClassificationOfficer;
296}
297
298//=======================================================================
299//function : RoleCreationDate
300//purpose :
301//=======================================================================
302
303Handle(StepBasic_DateTimeRole) STEPConstruct_AP203Context::RoleCreationDate () const
304{
305 return roleCreationDate;
306}
307
308//=======================================================================
309//function : RoleClassificationDate
310//purpose :
311//=======================================================================
312
313Handle(StepBasic_DateTimeRole) STEPConstruct_AP203Context::RoleClassificationDate () const
314{
315 return roleClassificationDate;
316}
317
318//=======================================================================
319//function : RoleApprover
320//purpose :
321//=======================================================================
322
323Handle(StepBasic_ApprovalRole) STEPConstruct_AP203Context::RoleApprover () const
324{
325 return roleApprover;
326}
327
328//=======================================================================
329//function : Init
330//purpose :
331//=======================================================================
332
333void STEPConstruct_AP203Context::Init (const Handle(StepShape_ShapeDefinitionRepresentation) &sdr)
334{
335 Clear();
336 STEPConstruct_Part SDRTool;
337 SDRTool.ReadSDR ( sdr );
338 InitPart ( SDRTool );
339}
340
341//=======================================================================
342//function : Init
343//purpose :
344//=======================================================================
345
346void STEPConstruct_AP203Context::Init (const STEPConstruct_Part &SDRTool)
347{
348 Clear();
349 InitPart ( SDRTool );
350}
351
352//=======================================================================
353//function : Init
354//purpose :
355//=======================================================================
356
357//void STEPConstruct_AP203Context::Init (const STEPConstruct_Part &SDRTool, const Handle(Interface_Model) &Model) {}
358
359//=======================================================================
360//function : Init
361//purpose :
362//=======================================================================
363
364void STEPConstruct_AP203Context::Init (const Handle(StepRepr_NextAssemblyUsageOccurrence) &NAUO)
365{
366 Clear();
367 InitAssembly ( NAUO );
368}
369
370//=======================================================================
371//function : GetCreator
372//purpose :
373//=======================================================================
374
375Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) STEPConstruct_AP203Context::GetCreator () const
376{
377 return myCreator;
378}
379
380//=======================================================================
381//function : GetDesignOwner
382//purpose :
383//=======================================================================
384
385Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) STEPConstruct_AP203Context::GetDesignOwner () const
386{
387 return myDesignOwner;
388}
389
390//=======================================================================
391//function : GetDesignSupplier
392//purpose :
393//=======================================================================
394
395Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) STEPConstruct_AP203Context::GetDesignSupplier () const
396{
397 return myDesignSupplier;
398}
399
400//=======================================================================
401//function : GetClassificationOfficer
402//purpose :
403//=======================================================================
404
405Handle(StepAP203_CcDesignPersonAndOrganizationAssignment) STEPConstruct_AP203Context::GetClassificationOfficer () const
406{
407 return myClassificationOfficer;
408}
409
410//=======================================================================
411//function : GetSecurity
412//purpose :
413//=======================================================================
414
415Handle(StepAP203_CcDesignSecurityClassification) STEPConstruct_AP203Context::GetSecurity () const
416{
417 return mySecurity;
418}
419
420//=======================================================================
421//function : GetCreationDate
422//purpose :
423//=======================================================================
424
425Handle(StepAP203_CcDesignDateAndTimeAssignment) STEPConstruct_AP203Context::GetCreationDate () const
426{
427 return myCreationDate;
428}
429
430//=======================================================================
431//function : GetClassificationDate
432//purpose :
433//=======================================================================
434
435Handle(StepAP203_CcDesignDateAndTimeAssignment) STEPConstruct_AP203Context::GetClassificationDate () const
436{
437 return myClassificationDate;
438}
439
440//=======================================================================
441//function : GetApproval
442//purpose :
443//=======================================================================
444
445Handle(StepAP203_CcDesignApproval) STEPConstruct_AP203Context::GetApproval () const
446{
447 return myApproval;
448}
449
450//=======================================================================
451//function : GetApprover
452//purpose :
453//=======================================================================
454
455Handle(StepBasic_ApprovalPersonOrganization) STEPConstruct_AP203Context::GetApprover () const
456{
457 return myApprover;
458}
459
460//=======================================================================
461//function : GetApprovalDateTime
462//purpose :
463//=======================================================================
464
465Handle(StepBasic_ApprovalDateTime) STEPConstruct_AP203Context::GetApprovalDateTime () const
466{
467 return myApprovalDateTime;
468}
469
470//=======================================================================
471//function : GetProductCategoryRelationship
472//purpose :
473//=======================================================================
474
475Handle(StepBasic_ProductCategoryRelationship) STEPConstruct_AP203Context::GetProductCategoryRelationship () const
476{
477 return myProductCategoryRelationship;
478}
479
480//=======================================================================
481//function : Clear
482//purpose :
483//=======================================================================
484
485void STEPConstruct_AP203Context::Clear ()
486{
487 myCreator.Nullify();
488 myDesignOwner.Nullify();
489 myDesignSupplier.Nullify();
490 myClassificationOfficer.Nullify();
491 mySecurity.Nullify();
492 myCreationDate.Nullify();
493 myClassificationDate.Nullify();
494 myApproval.Nullify();
495
496// myApprover.Nullify();
497// myApprovalDateTime.Nullify();
498
499 myProductCategoryRelationship.Nullify();
500}
501
502//=======================================================================
503//function : InitRoles
504//purpose :
505//=======================================================================
506
507void STEPConstruct_AP203Context::InitRoles ()
508{
509 roleCreator = new StepBasic_PersonAndOrganizationRole;
510 roleDesignOwner = new StepBasic_PersonAndOrganizationRole;
511 roleDesignSupplier = new StepBasic_PersonAndOrganizationRole;
512 roleClassificationOfficer = new StepBasic_PersonAndOrganizationRole;
513 roleCreationDate = new StepBasic_DateTimeRole;
514 roleClassificationDate = new StepBasic_DateTimeRole;
515 roleApprover = new StepBasic_ApprovalRole;
516
517 roleCreator->Init ( new TCollection_HAsciiString ( "creator" ) );
518 roleDesignOwner->Init ( new TCollection_HAsciiString ( "design_owner" ) );
519 roleDesignSupplier->Init ( new TCollection_HAsciiString ( "design_supplier" ) );
520 roleClassificationOfficer->Init ( new TCollection_HAsciiString ( "classification_officer" ) );
521 roleCreationDate->Init ( new TCollection_HAsciiString ( "creation_date" ) );
522 roleClassificationDate->Init ( new TCollection_HAsciiString ( "classification_date" ) );
523 roleApprover->Init ( new TCollection_HAsciiString ( "approver" ) );
524}
525
526//=======================================================================
527//function : InitPart
528//purpose :
529//=======================================================================
530
531void STEPConstruct_AP203Context::InitPart (const STEPConstruct_Part &SDRTool)
532{
533 if ( myCreator.IsNull() ) {
534 myCreator = new StepAP203_CcDesignPersonAndOrganizationAssignment;
535 Handle(StepAP203_HArray1OfPersonOrganizationItem) items =
536 new StepAP203_HArray1OfPersonOrganizationItem (1, 2);
537 items->ChangeValue(1).SetValue ( SDRTool.PDF() );
538 items->ChangeValue(2).SetValue ( SDRTool.PD() );
539 myCreator->Init ( DefaultPersonAndOrganization(), RoleCreator(), items );
540 }
541
542 if ( myDesignOwner.IsNull() ) {
543 myDesignOwner = new StepAP203_CcDesignPersonAndOrganizationAssignment;
544 Handle(StepAP203_HArray1OfPersonOrganizationItem) items =
545 new StepAP203_HArray1OfPersonOrganizationItem (1, 1);
546 items->ChangeValue(1).SetValue ( SDRTool.Product() );
547 myDesignOwner->Init ( DefaultPersonAndOrganization(), RoleDesignOwner(), items );
548 }
549
550 if ( myDesignSupplier.IsNull() ) {
551 myDesignSupplier = new StepAP203_CcDesignPersonAndOrganizationAssignment;
552 Handle(StepAP203_HArray1OfPersonOrganizationItem) items =
553 new StepAP203_HArray1OfPersonOrganizationItem (1, 1);
554 items->ChangeValue(1).SetValue ( SDRTool.PDF() );
555 myDesignSupplier->Init ( DefaultPersonAndOrganization(), RoleDesignSupplier(), items );
556 }
557
558 if ( myCreationDate.IsNull() ) {
559 myCreationDate = new StepAP203_CcDesignDateAndTimeAssignment;
560 Handle(StepAP203_HArray1OfDateTimeItem) items =
561 new StepAP203_HArray1OfDateTimeItem (1, 1);
562 items->ChangeValue(1).SetValue ( SDRTool.PD() );
563 myCreationDate->Init ( DefaultDateAndTime(), RoleCreationDate(), items );
564 }
565
566 if ( mySecurity.IsNull() ) {
567
568 Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString ( "" );
569 Handle(TCollection_HAsciiString) aPurpose = new TCollection_HAsciiString ( "" );
570 Handle(StepBasic_SecurityClassification) sc = new StepBasic_SecurityClassification;
571 sc->Init ( aName, aPurpose, DefaultSecurityClassificationLevel() );
572
573 mySecurity = new StepAP203_CcDesignSecurityClassification;
574 Handle(StepAP203_HArray1OfClassifiedItem) items =
575 new StepAP203_HArray1OfClassifiedItem (1, 1);
576 items->ChangeValue(1).SetValue ( SDRTool.PDF() );
577 mySecurity->Init ( sc, items );
578 }
579 InitSecurityRequisites();
580
581 if ( myApproval.IsNull() ) {
582 myApproval = new StepAP203_CcDesignApproval;
583 Handle(StepAP203_HArray1OfApprovedItem) items =
584 new StepAP203_HArray1OfApprovedItem (1, 3);
585 items->ChangeValue(1).SetValue ( SDRTool.PDF() );
586 items->ChangeValue(2).SetValue ( SDRTool.PD() );
587 items->ChangeValue(3).SetValue ( mySecurity->AssignedSecurityClassification() );
588 myApproval->Init ( DefaultApproval(), items );
589 }
590 InitApprovalRequisites();
591
592 if ( myProductCategoryRelationship.IsNull() ) {
593 Handle(StepBasic_ProductCategory) PC = new StepBasic_ProductCategory;
594 Handle(TCollection_HAsciiString) PCName = new TCollection_HAsciiString ( "part" );
595 PC->Init ( PCName, Standard_False, 0 );
596
597 myProductCategoryRelationship = new StepBasic_ProductCategoryRelationship;
598 Handle(TCollection_HAsciiString) PCRName = new TCollection_HAsciiString ( "" );
599 Handle(TCollection_HAsciiString) PCRDescr = new TCollection_HAsciiString ( "" );
600 myProductCategoryRelationship->Init ( PCRName, Standard_True, PCRDescr, PC, SDRTool.PRPC() );
601 }
602}
603
604//=======================================================================
605//function : InitAssembly
606//purpose :
607//=======================================================================
608
609void STEPConstruct_AP203Context::InitAssembly (const Handle(StepRepr_NextAssemblyUsageOccurrence) &NAUO)
610{
611 if ( mySecurity.IsNull() ) {
612
613 Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString ( "" );
614 Handle(TCollection_HAsciiString) aPurpose = new TCollection_HAsciiString ( "" );
615 Handle(StepBasic_SecurityClassification) sc = new StepBasic_SecurityClassification;
616 sc->Init ( aName, aPurpose, DefaultSecurityClassificationLevel() );
617
618 mySecurity = new StepAP203_CcDesignSecurityClassification;
619 Handle(StepAP203_HArray1OfClassifiedItem) items =
620 new StepAP203_HArray1OfClassifiedItem (1, 1);
621 items->ChangeValue(1).SetValue ( NAUO );
622 mySecurity->Init ( sc, items );
623 }
624 InitSecurityRequisites();
625
626 if ( myApproval.IsNull() ) {
627 myApproval = new StepAP203_CcDesignApproval;
628 Handle(StepAP203_HArray1OfApprovedItem) items =
629 new StepAP203_HArray1OfApprovedItem (1, 1);
630 items->ChangeValue(1).SetValue ( mySecurity->AssignedSecurityClassification() );
631 myApproval->Init ( DefaultApproval(), items );
632 }
633 InitApprovalRequisites();
634}
635
636//=======================================================================
637//function : InitSecurityRequisites
638//purpose :
639//=======================================================================
640
641void STEPConstruct_AP203Context::InitSecurityRequisites ()
642{
643 if ( myClassificationOfficer.IsNull() ||
644 myClassificationOfficer->Items()->Value(1).Value() != mySecurity->AssignedSecurityClassification() ) {
645 myClassificationOfficer = new StepAP203_CcDesignPersonAndOrganizationAssignment;
646 Handle(StepAP203_HArray1OfPersonOrganizationItem) items =
647 new StepAP203_HArray1OfPersonOrganizationItem (1, 1);
648 items->ChangeValue(1).SetValue ( mySecurity->AssignedSecurityClassification() );
649 myClassificationOfficer->Init ( DefaultPersonAndOrganization(), RoleClassificationOfficer(), items );
650 }
651
652 if ( myClassificationDate.IsNull() ||
653 myClassificationDate->Items()->Value(1).Value() != mySecurity->AssignedSecurityClassification() ) {
654 myClassificationDate = new StepAP203_CcDesignDateAndTimeAssignment;
655 Handle(StepAP203_HArray1OfDateTimeItem) items =
656 new StepAP203_HArray1OfDateTimeItem (1, 1);
657 items->ChangeValue(1).SetValue ( mySecurity->AssignedSecurityClassification() );
658 myClassificationDate->Init ( DefaultDateAndTime(), RoleClassificationDate(), items );
659 }
660}
661
662//=======================================================================
663//function : InitApprovalRequisites
664//purpose :
665//=======================================================================
666
667void STEPConstruct_AP203Context::InitApprovalRequisites ()
668{
669 if ( myApprover.IsNull() ||
670 myApprover->AuthorizedApproval() != myApproval->AssignedApproval() ) {
671 myApprover = new StepBasic_ApprovalPersonOrganization;
672 StepBasic_PersonOrganizationSelect po;
673 po.SetValue ( DefaultPersonAndOrganization() );
674 myApprover->Init ( po, myApproval->AssignedApproval(), RoleApprover() );
675 }
676
677 if ( myApprovalDateTime.IsNull() ||
678 myApprovalDateTime->DatedApproval() != myApproval->AssignedApproval() ) {
679 myApprovalDateTime = new StepBasic_ApprovalDateTime;
680 StepBasic_DateTimeSelect dt;
681 dt.SetValue ( DefaultDateAndTime() );
682 myApprovalDateTime->Init ( dt, myApproval->AssignedApproval() );
683 }
684}