0024023: Revamp the OCCT Handle -- ambiguity
[occt.git] / src / IGESAppli / IGESAppli_ToolRegionRestriction.cxx
CommitLineData
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
19#include <IGESAppli_ToolRegionRestriction.ixx>
20#include <IGESData_ParamCursor.hxx>
21#include <IGESData_LevelListEntity.hxx>
22
23
24IGESAppli_ToolRegionRestriction::IGESAppli_ToolRegionRestriction () { }
25
26
27void IGESAppli_ToolRegionRestriction::ReadOwnParams
28 (const Handle(IGESAppli_RegionRestriction)& ent,
29 const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const
30{
31 Standard_Integer tempNbPropertyValues;
32 Standard_Integer tempElectViasRestrict;
33 Standard_Integer tempElectCompRestrict;
34 Standard_Integer tempElectCktRestrict;
35
36 PR.ReadInteger(PR.Current(),"No. of Property values",tempNbPropertyValues);
37 PR.ReadInteger(PR.Current(),"Electrical vias restriction",tempElectViasRestrict);
38 PR.ReadInteger(PR.Current(),"Electrical components restriction", tempElectCompRestrict);
39 PR.ReadInteger(PR.Current(), " Electrical circuitary restriction",tempElectCktRestrict);
40
41 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
42 ent->Init(tempNbPropertyValues,tempElectViasRestrict,tempElectCompRestrict, tempElectCktRestrict);
43}
44
45void IGESAppli_ToolRegionRestriction::WriteOwnParams
46 (const Handle(IGESAppli_RegionRestriction)& ent, IGESData_IGESWriter& IW) const
47{
48 IW.Send(ent->NbPropertyValues());
49 IW.Send(ent->ElectricalViasRestriction());
50 IW.Send(ent->ElectricalComponentRestriction());
51 IW.Send(ent->ElectricalCktRestriction());
52}
53
54void IGESAppli_ToolRegionRestriction::OwnShared
55 (const Handle(IGESAppli_RegionRestriction)& /*ent*/, Interface_EntityIterator& /*iter*/) const
56{
57}
58
59void IGESAppli_ToolRegionRestriction::OwnCopy
60 (const Handle(IGESAppli_RegionRestriction)& another,
61 const Handle(IGESAppli_RegionRestriction)& ent, Interface_CopyTool& /*TC*/) const
62{
63 ent->Init
64 (3,another->ElectricalViasRestriction(),
65 another->ElectricalComponentRestriction(),
66 another->ElectricalCktRestriction()); // nbprops = 3
67}
68
69Standard_Boolean IGESAppli_ToolRegionRestriction::OwnCorrect
70 (const Handle(IGESAppli_RegionRestriction)& ent) const
71{
72 Standard_Boolean res = (ent->NbPropertyValues() != 3);
73 if (res) ent->Init
74 (3,ent->ElectricalViasRestriction(),ent->ElectricalComponentRestriction(),
75 ent->ElectricalCktRestriction()); // nbprops = 3
76 if (ent->SubordinateStatus() != 0) {
77 Handle(IGESData_LevelListEntity) nulevel;
78 ent->InitLevel(nulevel,0);
79 res = Standard_True;
80 }
81 return res; // + RAZ level selon subordibate
82}
83
84IGESData_DirChecker IGESAppli_ToolRegionRestriction::DirChecker
85 (const Handle(IGESAppli_RegionRestriction)& /*ent*/ ) const
86{
87 IGESData_DirChecker DC(406,2); //Form no = 2 & Type = 406
88 DC.Structure(IGESData_DefVoid);
89 DC.GraphicsIgnored();
90 DC.BlankStatusIgnored();
91 DC.UseFlagIgnored();
92 DC.HierarchyStatusIgnored();
93 return DC;
94}
95
96void IGESAppli_ToolRegionRestriction::OwnCheck
97 (const Handle(IGESAppli_RegionRestriction)& ent,
98 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
99{
100 if (ent->SubordinateStatus() != 0)
101 if (ent->DefLevel() != IGESData_DefOne &&
102 ent->DefLevel() != IGESData_DefSeveral)
103 ach->AddFail("Level type: Not value/reference");
104 if (ent->NbPropertyValues() != 3)
105 ach->AddFail("Number of Property Values != 3");
106 if (ent->ElectricalViasRestriction() < 0 || ent->ElectricalViasRestriction() > 2)
107 ach->AddFail("Incorrect value for Electrical Vias Restriction");
108 if (ent->ElectricalComponentRestriction() < 0 || ent->ElectricalComponentRestriction() > 2)
109 ach->AddFail("Incorrect value for Electrical Component Restriction");
110 if (ent->ElectricalCktRestriction() < 0 || ent->ElectricalCktRestriction() > 2)
111 ach->AddFail("Incorrect value for Electrical Circuit Restriction");
112 //UNFINISHED
113 //level ignored if this property is subordinate -- queried
114}
115
116void IGESAppli_ToolRegionRestriction::OwnDump
117 (const Handle(IGESAppli_RegionRestriction)& ent, const IGESData_IGESDumper& /*dumper*/,
118 const Handle(Message_Messenger)& S, const Standard_Integer /*level*/) const
119{
120 S << "IGESAppli_RegionRestriction" << endl;
121 S << "Number of property values : " << ent->NbPropertyValues() << endl;
122 S << "Electrical vias restriction : "
123 << ent->ElectricalViasRestriction() << endl;
124 S << "Electrical components restriction : "
125 << ent->ElectricalComponentRestriction() << endl;
126 S << "Electrical circuitary restriction : "
127 << ent->ElectricalCktRestriction() << endl;
128}