1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
15 #include <IFSelect_ContextModif.hxx>
16 #include <IGESData_GlobalSection.hxx>
17 #include <IGESData_IGESModel.hxx>
18 #include <IGESSelect_SetGlobalParameter.hxx>
19 #include <Interface_Check.hxx>
20 #include <Interface_CopyTool.hxx>
21 #include <Interface_FileParameter.hxx>
22 #include <Interface_ParamSet.hxx>
23 #include <Standard_Type.hxx>
24 #include <TCollection_AsciiString.hxx>
25 #include <TCollection_HAsciiString.hxx>
28 IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_SetGlobalParameter,IGESSelect_ModelModifier)
30 IGESSelect_SetGlobalParameter::IGESSelect_SetGlobalParameter
31 (const Standard_Integer numpar)
32 : IGESSelect_ModelModifier (Standard_False)
35 Standard_Integer IGESSelect_SetGlobalParameter::GlobalNumber () const
38 void IGESSelect_SetGlobalParameter::SetValue
39 (const Handle(TCollection_HAsciiString)& text)
42 Handle(TCollection_HAsciiString) IGESSelect_SetGlobalParameter::Value
47 void IGESSelect_SetGlobalParameter::Performing
48 (IFSelect_ContextModif& ctx,
49 const Handle(IGESData_IGESModel)& target,
50 Interface_CopyTool& ) const
52 if (theval.IsNull()) {
53 ctx.CCheck()->AddWarning("Set IGES Global Parameter, no value defined, ignored");
56 IGESData_GlobalSection GS = target->GlobalSection();
57 Handle(Interface_ParamSet) oldset = GS.Params();
58 if (thenum <= 0 || thenum > oldset->NbParams()) {
60 sprintf(mess,"Set IGES Global Parameter : Number %d incorrect",thenum);
61 ctx.CCheck()->AddFail(mess);
64 Interface_FileParameter& FP = oldset->ChangeParam (thenum);
65 FP.Init (theval->ToCString(),FP.ParamType());
66 Handle(Interface_Check) check = new Interface_Check;
67 GS.Init (oldset,check);
69 if (!check->HasFailed()) target->SetGlobalSection(GS);
72 TCollection_AsciiString IGESSelect_SetGlobalParameter::Label () const
75 if (theval.IsNull()) sprintf(mess,"Set IGES Global Parameter (undefined)");
76 else sprintf(mess,"Set IGES Global Parameter Number %d to %s",
77 thenum,theval->ToCString());
78 return TCollection_AsciiString (mess);