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_EditForm.hxx>
16 #include <Interface_InterfaceModel.hxx>
17 #include <Interface_TypedValue.hxx>
18 #include <Standard_Transient.hxx>
19 #include <Standard_Type.hxx>
20 #include <STEPConstruct_Part.hxx>
21 #include <StepData_StepModel.hxx>
22 #include <STEPEdit_EditSDR.hxx>
23 #include <StepShape_ShapeDefinitionRepresentation.hxx>
24 #include <TCollection_AsciiString.hxx>
25 #include <TCollection_HAsciiString.hxx>
27 IMPLEMENT_STANDARD_RTTIEXT(STEPEdit_EditSDR,IFSelect_Editor)
29 STEPEdit_EditSDR::STEPEdit_EditSDR ()
30 : IFSelect_Editor (11)
32 Handle(Interface_TypedValue) pdc_name = new Interface_TypedValue("PDC_Name");
33 SetValue (1,pdc_name,"PDC_Name");
34 Handle(Interface_TypedValue) pdc_lfs = new Interface_TypedValue("PDC_LifeCycleStage");
35 SetValue(2,pdc_lfs,"PDC_Stage");
36 Handle(Interface_TypedValue) pdc_descr = new Interface_TypedValue("PDC_Description");
37 SetValue(3,pdc_descr,"PDC_Descr");
39 Handle(Interface_TypedValue) pv_vid = new Interface_TypedValue("P_Version_Id");
40 SetValue(4,pv_vid,"PV_Id");
41 Handle(Interface_TypedValue) pv_descr = new Interface_TypedValue("P_Version_Description");
42 SetValue(5,pv_descr,"PV_Descr");
44 Handle(Interface_TypedValue) pid = new Interface_TypedValue("Product_Id");
45 SetValue(6,pid,"P_Id");
46 Handle(Interface_TypedValue) pname = new Interface_TypedValue("Product_Name");
47 SetValue(7,pname,"P_Name");
48 Handle(Interface_TypedValue) pdescr = new Interface_TypedValue("Product_Description");
49 SetValue(8,pdescr,"P_Descr");
51 Handle(Interface_TypedValue) pc_name = new Interface_TypedValue("P_Context_Name");
52 SetValue(9,pc_name,"PC_Name");
53 Handle(Interface_TypedValue) pc_disc = new Interface_TypedValue("P_Context_Discipline");
54 SetValue(10,pc_disc,"PC_Disc");
56 Handle(Interface_TypedValue) ac_ap = new Interface_TypedValue("Application");
57 SetValue(11,ac_ap,"Appli");
61 //Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDSname() const
62 //Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDSdescription() const
63 //Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDdescription() const
67 TCollection_AsciiString STEPEdit_EditSDR::Label () const
68 { return TCollection_AsciiString ("STEP : Product Data (SDR)"); }
70 Standard_Boolean STEPEdit_EditSDR::Recognize
71 (const Handle(IFSelect_EditForm)& /*form*/) const
73 // il faut 10 parametres
77 Handle(TCollection_HAsciiString) STEPEdit_EditSDR::StringValue
78 (const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer num) const
80 Handle(TCollection_HAsciiString) str;
82 case 1 : return new TCollection_HAsciiString("as proposed");
83 case 2 : return new TCollection_HAsciiString("First_Design");
84 case 3 : return new TCollection_HAsciiString("void");
85 case 4 : return new TCollection_HAsciiString("ID");
86 case 5 : return new TCollection_HAsciiString("void");
87 case 8 : return new TCollection_HAsciiString("void");
88 case 9 : return new TCollection_HAsciiString("Mechanical");
89 case 10 : return new TCollection_HAsciiString("Assembly");
90 case 11 : return new TCollection_HAsciiString("EUCLID");
96 Standard_Boolean STEPEdit_EditSDR::Load
97 (const Handle(IFSelect_EditForm)& form,
98 const Handle(Standard_Transient)& ent,
99 const Handle(Interface_InterfaceModel)& model) const
101 Handle(StepShape_ShapeDefinitionRepresentation) sdr =
102 Handle(StepShape_ShapeDefinitionRepresentation)::DownCast (ent);
103 Handle(StepData_StepModel) modl =
104 Handle(StepData_StepModel)::DownCast(model);
105 if (sdr.IsNull() || modl.IsNull()) return Standard_False;
107 STEPConstruct_Part ctx;
110 form->LoadValue (1, ctx.PDCname());
111 form->LoadValue (2, ctx.PDCstage());
112 form->LoadValue (3, ctx.PDdescription());
114 form->LoadValue (4, ctx.PDFid());
115 form->LoadValue (5, ctx.PDFdescription());
117 form->LoadValue (6, ctx.Pid());
118 form->LoadValue (7, ctx.Pname());
119 form->LoadValue (8, ctx.Pdescription());
121 form->LoadValue (9, ctx.PCname());
122 form->LoadValue (10, ctx.PCdisciplineType());
124 form->LoadValue (11, ctx.ACapplication());
126 return Standard_True;
129 Standard_Boolean STEPEdit_EditSDR::Apply
130 (const Handle(IFSelect_EditForm)& form,
131 const Handle(Standard_Transient)& ent,
132 const Handle(Interface_InterfaceModel)& model) const
134 Handle(StepShape_ShapeDefinitionRepresentation) sdr =
135 Handle(StepShape_ShapeDefinitionRepresentation)::DownCast (ent);
136 Handle(StepData_StepModel) modl =
137 Handle(StepData_StepModel)::DownCast(model);
138 if (sdr.IsNull() || modl.IsNull()) return Standard_False;
140 STEPConstruct_Part ctx;
143 if (form->IsModified(1)) ctx.SetPDCname (form->EditedValue(1));
144 if (form->IsModified(2)) ctx.SetPDCstage (form->EditedValue(2));
145 if (form->IsModified(3)) ctx.SetPDdescription (form->EditedValue(3));
147 if (form->IsModified(4)) ctx.SetPDFid (form->EditedValue(4));
148 if (form->IsModified(5)) ctx.SetPDFdescription (form->EditedValue(5));
150 if (form->IsModified(6)) ctx.SetPid (form->EditedValue(6));
151 if (form->IsModified(7)) ctx.SetPname (form->EditedValue(7));
152 if (form->IsModified(8)) ctx.SetPdescription (form->EditedValue(8));
154 if (form->IsModified(9)) ctx.SetPCname (form->EditedValue(9));
155 if (form->IsModified(10)) ctx.SetPCdisciplineType (form->EditedValue(10));
157 if (form->IsModified(11)) ctx.SetACapplication (form->EditedValue(11));
159 return Standard_True;