Warnings on vc14 were eliminated
[occt.git] / src / IGESAppli / IGESAppli_ToolPWBDrilledHole.cxx
1 // Created by: CKY / Contract Toubro-Larsen
2 // Copyright (c) 1993-1999 Matra Datavision
3 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 //--------------------------------------------------------------------
17 //--------------------------------------------------------------------
18
19 #include <IGESAppli_PWBDrilledHole.hxx>
20 #include <IGESAppli_ToolPWBDrilledHole.hxx>
21 #include <IGESData_DirChecker.hxx>
22 #include <IGESData_IGESDumper.hxx>
23 #include <IGESData_IGESReaderData.hxx>
24 #include <IGESData_IGESWriter.hxx>
25 #include <IGESData_ParamCursor.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>
31 #include <Message_Messenger.hxx>
32 #include <Standard_DomainError.hxx>
33
34 IGESAppli_ToolPWBDrilledHole::IGESAppli_ToolPWBDrilledHole ()    {  }
35
36
37 void  IGESAppli_ToolPWBDrilledHole::ReadOwnParams
38   (const Handle(IGESAppli_PWBDrilledHole)& ent,
39    const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR)  const
40 {
41   //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
42   Standard_Integer tempNbPropertyValues;
43   Standard_Real tempDrillDiameter;
44   Standard_Real tempFinishDiameter;
45   Standard_Integer tempFunctionCode;
46
47   //szv#4:S4163:12Mar99 `st=` not needed
48   if (PR.DefinedElseSkip())
49     PR.ReadInteger(PR.Current(), "Number of property values", tempNbPropertyValues);
50   else
51     tempNbPropertyValues = 3;
52
53   PR.ReadReal(PR.Current(), "Drill Diameter Size", tempDrillDiameter);
54   PR.ReadReal(PR.Current(), "Finish Diameter Size", tempFinishDiameter);
55   PR.ReadInteger(PR.Current(), "Drilled Hole Function Code", tempFunctionCode);
56   DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
57   ent->Init(tempNbPropertyValues, tempDrillDiameter, tempFinishDiameter, tempFunctionCode);
58 }
59
60 void  IGESAppli_ToolPWBDrilledHole::WriteOwnParams
61   (const Handle(IGESAppli_PWBDrilledHole)& ent, IGESData_IGESWriter& IW) const
62 {
63   IW.Send(ent->NbPropertyValues());
64   IW.Send(ent->DrillDiameterSize());
65   IW.Send(ent->FinishDiameterSize());
66   IW.Send(ent->FunctionCode());
67 }
68
69 void  IGESAppli_ToolPWBDrilledHole::OwnShared
70   (const Handle(IGESAppli_PWBDrilledHole)& /*ent*/, Interface_EntityIterator& /*iter*/) const
71 {
72 }
73
74 void  IGESAppli_ToolPWBDrilledHole::OwnCopy
75   (const Handle(IGESAppli_PWBDrilledHole)& another,
76    const Handle(IGESAppli_PWBDrilledHole)& ent, Interface_CopyTool& /*TC*/) const
77 {
78   ent->Init (3,another->DrillDiameterSize(),another->FinishDiameterSize(),
79              another->FunctionCode());
80 }
81
82 Standard_Boolean  IGESAppli_ToolPWBDrilledHole::OwnCorrect
83   (const Handle(IGESAppli_PWBDrilledHole)& ent) const
84 {
85   Standard_Boolean res = (ent->NbPropertyValues() != 3);
86   if (res) ent->Init
87     (3,ent->DrillDiameterSize(),ent->FinishDiameterSize(),ent->FunctionCode());
88 //     nbpropertyvalues=3
89   return res;
90 }
91
92 IGESData_DirChecker  IGESAppli_ToolPWBDrilledHole::DirChecker
93   (const Handle(IGESAppli_PWBDrilledHole)& /*ent*/) const
94 {
95   IGESData_DirChecker DC(406, 26);
96   DC.Structure(IGESData_DefVoid);
97   DC.GraphicsIgnored();
98   DC.LineFont(IGESData_DefVoid);
99   DC.LineWeight(IGESData_DefVoid);
100   DC.Color(IGESData_DefVoid);
101   DC.BlankStatusIgnored();
102   DC.UseFlagIgnored();
103   DC.HierarchyStatusIgnored();
104   return DC;
105 }
106
107 void  IGESAppli_ToolPWBDrilledHole::OwnCheck
108   (const Handle(IGESAppli_PWBDrilledHole)& ent,
109    const Interface_ShareTool& , Handle(Interface_Check)& ach) const
110 {
111   if (ent->NbPropertyValues() != 3)
112     ach->AddFail("Number of property values != 3");
113   if ( (ent->FunctionCode() < 1) ||
114       ((ent->FunctionCode() > 5) && (ent->FunctionCode() < 5001)) ||
115       (ent->FunctionCode() > 9999))
116     ach->AddFail("Drilled Hole Function Code != 1-5,5001-9999");
117 }
118
119 void  IGESAppli_ToolPWBDrilledHole::OwnDump
120   (const Handle(IGESAppli_PWBDrilledHole)& ent, const IGESData_IGESDumper& /*dumper*/,
121    const Handle(Message_Messenger)& S, const Standard_Integer /*level*/) const
122 {
123   S << "IGESAppli_PWBDrilledHole" << endl;
124   S << "Number of property values : " << ent->NbPropertyValues() << endl;
125   S << "Drill Diameter Size  : " << ent->DrillDiameterSize() << endl;
126   S << "Finish Diameter Size : " << ent->FinishDiameterSize() << endl;
127   S << "Drilled Hole Function Code : " << ent->FunctionCode() << endl;
128 }