1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
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
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.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
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>
25 #include <IGESData_LevelListEntity.hxx>
26 #include <IGESData_ParamCursor.hxx>
27 #include <IGESData_ParamReader.hxx>
28 #include <Interface_Check.hxx>
29 #include <Interface_CopyTool.hxx>
30 #include <Interface_EntityIterator.hxx>
31 #include <Interface_ShareTool.hxx>
32 #include <Message_Messenger.hxx>
33 #include <Standard_DomainError.hxx>
35 IGESAppli_ToolRegionRestriction::IGESAppli_ToolRegionRestriction () { }
38 void IGESAppli_ToolRegionRestriction::ReadOwnParams
39 (const Handle(IGESAppli_RegionRestriction)& ent,
40 const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const
42 Standard_Integer tempNbPropertyValues;
43 Standard_Integer tempElectViasRestrict;
44 Standard_Integer tempElectCompRestrict;
45 Standard_Integer tempElectCktRestrict;
47 PR.ReadInteger(PR.Current(),"No. of Property values",tempNbPropertyValues);
48 PR.ReadInteger(PR.Current(),"Electrical vias restriction",tempElectViasRestrict);
49 PR.ReadInteger(PR.Current(),"Electrical components restriction", tempElectCompRestrict);
50 PR.ReadInteger(PR.Current(), " Electrical circuitary restriction",tempElectCktRestrict);
52 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
53 ent->Init(tempNbPropertyValues,tempElectViasRestrict,tempElectCompRestrict, tempElectCktRestrict);
56 void IGESAppli_ToolRegionRestriction::WriteOwnParams
57 (const Handle(IGESAppli_RegionRestriction)& ent, IGESData_IGESWriter& IW) const
59 IW.Send(ent->NbPropertyValues());
60 IW.Send(ent->ElectricalViasRestriction());
61 IW.Send(ent->ElectricalComponentRestriction());
62 IW.Send(ent->ElectricalCktRestriction());
65 void IGESAppli_ToolRegionRestriction::OwnShared
66 (const Handle(IGESAppli_RegionRestriction)& /*ent*/, Interface_EntityIterator& /*iter*/) const
70 void IGESAppli_ToolRegionRestriction::OwnCopy
71 (const Handle(IGESAppli_RegionRestriction)& another,
72 const Handle(IGESAppli_RegionRestriction)& ent, Interface_CopyTool& /*TC*/) const
75 (3,another->ElectricalViasRestriction(),
76 another->ElectricalComponentRestriction(),
77 another->ElectricalCktRestriction()); // nbprops = 3
80 Standard_Boolean IGESAppli_ToolRegionRestriction::OwnCorrect
81 (const Handle(IGESAppli_RegionRestriction)& ent) const
83 Standard_Boolean res = (ent->NbPropertyValues() != 3);
85 (3,ent->ElectricalViasRestriction(),ent->ElectricalComponentRestriction(),
86 ent->ElectricalCktRestriction()); // nbprops = 3
87 if (ent->SubordinateStatus() != 0) {
88 Handle(IGESData_LevelListEntity) nulevel;
89 ent->InitLevel(nulevel,0);
92 return res; // + RAZ level selon subordibate
95 IGESData_DirChecker IGESAppli_ToolRegionRestriction::DirChecker
96 (const Handle(IGESAppli_RegionRestriction)& /*ent*/ ) const
98 IGESData_DirChecker DC(406,2); //Form no = 2 & Type = 406
99 DC.Structure(IGESData_DefVoid);
100 DC.GraphicsIgnored();
101 DC.BlankStatusIgnored();
103 DC.HierarchyStatusIgnored();
107 void IGESAppli_ToolRegionRestriction::OwnCheck
108 (const Handle(IGESAppli_RegionRestriction)& ent,
109 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
111 if (ent->SubordinateStatus() != 0)
112 if (ent->DefLevel() != IGESData_DefOne &&
113 ent->DefLevel() != IGESData_DefSeveral)
114 ach->AddFail("Level type: Not value/reference");
115 if (ent->NbPropertyValues() != 3)
116 ach->AddFail("Number of Property Values != 3");
117 if (ent->ElectricalViasRestriction() < 0 || ent->ElectricalViasRestriction() > 2)
118 ach->AddFail("Incorrect value for Electrical Vias Restriction");
119 if (ent->ElectricalComponentRestriction() < 0 || ent->ElectricalComponentRestriction() > 2)
120 ach->AddFail("Incorrect value for Electrical Component Restriction");
121 if (ent->ElectricalCktRestriction() < 0 || ent->ElectricalCktRestriction() > 2)
122 ach->AddFail("Incorrect value for Electrical Circuit Restriction");
124 //level ignored if this property is subordinate -- queried
127 void IGESAppli_ToolRegionRestriction::OwnDump
128 (const Handle(IGESAppli_RegionRestriction)& ent, const IGESData_IGESDumper& /*dumper*/,
129 Standard_OStream& S, const Standard_Integer /*level*/) const
131 S << "IGESAppli_RegionRestriction\n"
132 << "Number of property values : " << ent->NbPropertyValues() << "\n"
133 << "Electrical vias restriction : "
134 << ent->ElectricalViasRestriction() << "\n"
135 << "Electrical components restriction : "
136 << ent->ElectricalComponentRestriction() << "\n"
137 << "Electrical circuitary restriction : "
138 << ent->ElectricalCktRestriction() << std::endl;