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_ParamReader.hxx>
27 #include <Interface_Check.hxx>
28 #include <Interface_CopyTool.hxx>
29 #include <Interface_EntityIterator.hxx>
30 #include <Interface_ShareTool.hxx>
32 IGESAppli_ToolRegionRestriction::IGESAppli_ToolRegionRestriction () { }
35 void IGESAppli_ToolRegionRestriction::ReadOwnParams
36 (const Handle(IGESAppli_RegionRestriction)& ent,
37 const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const
39 Standard_Integer tempNbPropertyValues;
40 Standard_Integer tempElectViasRestrict;
41 Standard_Integer tempElectCompRestrict;
42 Standard_Integer tempElectCktRestrict;
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);
49 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
50 ent->Init(tempNbPropertyValues,tempElectViasRestrict,tempElectCompRestrict, tempElectCktRestrict);
53 void IGESAppli_ToolRegionRestriction::WriteOwnParams
54 (const Handle(IGESAppli_RegionRestriction)& ent, IGESData_IGESWriter& IW) const
56 IW.Send(ent->NbPropertyValues());
57 IW.Send(ent->ElectricalViasRestriction());
58 IW.Send(ent->ElectricalComponentRestriction());
59 IW.Send(ent->ElectricalCktRestriction());
62 void IGESAppli_ToolRegionRestriction::OwnShared
63 (const Handle(IGESAppli_RegionRestriction)& /*ent*/, Interface_EntityIterator& /*iter*/) const
67 void IGESAppli_ToolRegionRestriction::OwnCopy
68 (const Handle(IGESAppli_RegionRestriction)& another,
69 const Handle(IGESAppli_RegionRestriction)& ent, Interface_CopyTool& /*TC*/) const
72 (3,another->ElectricalViasRestriction(),
73 another->ElectricalComponentRestriction(),
74 another->ElectricalCktRestriction()); // nbprops = 3
77 Standard_Boolean IGESAppli_ToolRegionRestriction::OwnCorrect
78 (const Handle(IGESAppli_RegionRestriction)& ent) const
80 Standard_Boolean res = (ent->NbPropertyValues() != 3);
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);
89 return res; // + RAZ level selon subordibate
92 IGESData_DirChecker IGESAppli_ToolRegionRestriction::DirChecker
93 (const Handle(IGESAppli_RegionRestriction)& /*ent*/ ) const
95 IGESData_DirChecker DC(406,2); //Form no = 2 & Type = 406
96 DC.Structure(IGESData_DefVoid);
98 DC.BlankStatusIgnored();
100 DC.HierarchyStatusIgnored();
104 void IGESAppli_ToolRegionRestriction::OwnCheck
105 (const Handle(IGESAppli_RegionRestriction)& ent,
106 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
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");
121 //level ignored if this property is subordinate -- queried
124 void IGESAppli_ToolRegionRestriction::OwnDump
125 (const Handle(IGESAppli_RegionRestriction)& ent, const IGESData_IGESDumper& /*dumper*/,
126 Standard_OStream& S, const Standard_Integer /*level*/) const
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;