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