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 <IGESData_DirChecker.hxx>
20 #include <IGESData_Dump.hxx>
21 #include <IGESData_IGESDumper.hxx>
22 #include <IGESData_IGESReaderData.hxx>
23 #include <IGESData_IGESWriter.hxx>
24 #include <IGESData_ParamCursor.hxx>
25 #include <IGESData_ParamReader.hxx>
26 #include <IGESGraph_NominalSize.hxx>
27 #include <IGESGraph_ToolNominalSize.hxx>
28 #include <Interface_Check.hxx>
29 #include <Interface_CopyTool.hxx>
30 #include <Interface_EntityIterator.hxx>
31 #include <Interface_Macros.hxx>
32 #include <Interface_ShareTool.hxx>
33 #include <Message_Messenger.hxx>
34 #include <Standard_DomainError.hxx>
35 #include <TCollection_HAsciiString.hxx>
37 IGESGraph_ToolNominalSize::IGESGraph_ToolNominalSize () { }
40 void IGESGraph_ToolNominalSize::ReadOwnParams
41 (const Handle(IGESGraph_NominalSize)& ent,
42 const Handle(IGESData_IGESReaderData)& /*IR*/, IGESData_ParamReader& PR) const
44 //Standard_Boolean st; //szv#4:S4163:12Mar99 not needed
46 Standard_Integer nbPropertyValues;
47 Standard_Real nominalSizeValue;
48 Handle(TCollection_HAsciiString) nominalSizeName;
49 Handle(TCollection_HAsciiString) standardName;
51 // Reading nbPropertyValues(Integer)
52 PR.ReadInteger(PR.Current(), "No. of property values", nbPropertyValues); //szv#4:S4163:12Mar99 `st=` not needed
53 if ( (nbPropertyValues != 2) && (nbPropertyValues != 3) )
54 PR.AddFail("No. of Property values : Value is not 2/3");
56 // Reading nominalSizeValue(Real)
57 PR.ReadReal (PR.Current(), "Nominal size value", nominalSizeValue); //szv#4:S4163:12Mar99 `st=` not needed
59 // Reading nominalSizeName(String)
60 PR.ReadText (PR.Current(), "Nominal size name", nominalSizeName); //szv#4:S4163:12Mar99 `st=` not needed
62 if ( PR.NbParams() >= PR.CurrentNumber() )
64 Standard_Integer num = PR.CurrentNumber();
65 if ( PR.ParamType(num) == Interface_ParamText )
66 // Reading standardName(String)
67 PR.ReadText (PR.Current(), "Name of relevant engg. standard",
68 standardName); //szv#4:S4163:12Mar99 `st=` not needed
71 DirChecker(ent).CheckTypeAndForm(PR.CCheck(),ent);
73 (nbPropertyValues, nominalSizeValue, nominalSizeName, standardName);
76 void IGESGraph_ToolNominalSize::WriteOwnParams
77 (const Handle(IGESGraph_NominalSize)& ent, IGESData_IGESWriter& IW) const
79 IW.Send( ent->NbPropertyValues() );
80 IW.Send( ent->NominalSizeValue() );
81 IW.Send( ent->NominalSizeName() );
83 if (ent->HasStandardName() )
84 IW.Send( ent->StandardName() ); // optionnal
87 void IGESGraph_ToolNominalSize::OwnShared
88 (const Handle(IGESGraph_NominalSize)& /*ent*/, Interface_EntityIterator& /*iter*/) const
92 void IGESGraph_ToolNominalSize::OwnCopy
93 (const Handle(IGESGraph_NominalSize)& another,
94 const Handle(IGESGraph_NominalSize)& ent, Interface_CopyTool& /*TC*/) const
96 Standard_Integer nbPropertyValues;
97 Standard_Real nominalSizeValue;
98 Handle(TCollection_HAsciiString) nominalSizeName;
99 Handle(TCollection_HAsciiString) standardName;
101 nbPropertyValues = another->NbPropertyValues();
102 nominalSizeValue = another->NominalSizeValue();
103 nominalSizeName = new TCollection_HAsciiString(another->NominalSizeName());
104 if (another->HasStandardName()) standardName =
105 new TCollection_HAsciiString(another->StandardName());
107 ent->Init(nbPropertyValues, nominalSizeValue, nominalSizeName, standardName);
110 Standard_Boolean IGESGraph_ToolNominalSize::OwnCorrect
111 (const Handle(IGESGraph_NominalSize)& ent) const
113 Standard_Integer nbp = 2;
114 if (ent->HasStandardName()) nbp = 3;
115 Standard_Boolean res = ( ent->NbPropertyValues() != nbp);
117 (nbp,ent->NominalSizeValue(),ent->NominalSizeName(),ent->StandardName());
118 return res; // nbpropertyvalues=2/3 selon standard
121 IGESData_DirChecker IGESGraph_ToolNominalSize::DirChecker
122 (const Handle(IGESGraph_NominalSize)& /*ent*/) const
124 IGESData_DirChecker DC (406, 13);
125 DC.Structure(IGESData_DefVoid);
126 DC.LineFont(IGESData_DefVoid);
127 DC.LineWeight(IGESData_DefVoid);
128 DC.Color(IGESData_DefVoid);
129 DC.BlankStatusIgnored();
131 DC.HierarchyStatusIgnored();
135 void IGESGraph_ToolNominalSize::OwnCheck
136 (const Handle(IGESGraph_NominalSize)& ent,
137 const Interface_ShareTool& , Handle(Interface_Check)& ach) const
139 Standard_Integer nbp = 2;
140 if (ent->HasStandardName()) nbp = 3;
141 if ( ent->NbPropertyValues() != nbp) ach->AddFail
142 ("No. of Property values : Value != 2/3 according Standard Name Status");
145 void IGESGraph_ToolNominalSize::OwnDump
146 (const Handle(IGESGraph_NominalSize)& ent, const IGESData_IGESDumper& /*dumper*/,
147 const Handle(Message_Messenger)& S, const Standard_Integer /*level*/) const
149 S << "IGESGraph_NominalSize" << endl;
151 S << "No. of property values : " << ent->NbPropertyValues() << endl;
152 S << "Nominal size value : " << ent->NominalSizeValue() << endl;
153 S << "Nominal size name : ";
154 IGESData_DumpString(S,ent->NominalSizeName());
156 S << "Name of relevant engineering standard : ";
157 IGESData_DumpString(S,ent->StandardName());