1 // Copyright (c) 1999-2012 OPEN CASCADE SAS
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
18 #include <STEPEdit_EditSDR.ixx>
19 #include <Interface_TypedValue.hxx>
20 #include <TCollection_HAsciiString.hxx>
22 #include <StepData_StepModel.hxx>
23 #include <StepShape_ShapeDefinitionRepresentation.hxx>
24 #include <STEPConstruct_Part.hxx>
27 STEPEdit_EditSDR::STEPEdit_EditSDR ()
28 : IFSelect_Editor (11)
30 Handle(Interface_TypedValue) pdc_name = new Interface_TypedValue("PDC_Name");
31 SetValue (1,pdc_name,"PDC_Name");
32 Handle(Interface_TypedValue) pdc_lfs = new Interface_TypedValue("PDC_LifeCycleStage");
33 SetValue(2,pdc_lfs,"PDC_Stage");
34 Handle(Interface_TypedValue) pdc_descr = new Interface_TypedValue("PDC_Description");
35 SetValue(3,pdc_descr,"PDC_Descr");
37 Handle(Interface_TypedValue) pv_vid = new Interface_TypedValue("P_Version_Id");
38 SetValue(4,pv_vid,"PV_Id");
39 Handle(Interface_TypedValue) pv_descr = new Interface_TypedValue("P_Version_Description");
40 SetValue(5,pv_descr,"PV_Descr");
42 Handle(Interface_TypedValue) pid = new Interface_TypedValue("Product_Id");
43 SetValue(6,pid,"P_Id");
44 Handle(Interface_TypedValue) pname = new Interface_TypedValue("Product_Name");
45 SetValue(7,pname,"P_Name");
46 Handle(Interface_TypedValue) pdescr = new Interface_TypedValue("Product_Description");
47 SetValue(8,pdescr,"P_Descr");
49 Handle(Interface_TypedValue) pc_name = new Interface_TypedValue("P_Context_Name");
50 SetValue(9,pc_name,"PC_Name");
51 Handle(Interface_TypedValue) pc_disc = new Interface_TypedValue("P_Context_Discipline");
52 SetValue(10,pc_disc,"PC_Disc");
54 Handle(Interface_TypedValue) ac_ap = new Interface_TypedValue("Application");
55 SetValue(11,ac_ap,"Appli");
59 //Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDSname() const
60 //Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDSdescription() const
61 //Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDdescription() const
65 TCollection_AsciiString STEPEdit_EditSDR::Label () const
66 { return TCollection_AsciiString ("STEP : Product Data (SDR)"); }
68 Standard_Boolean STEPEdit_EditSDR::Recognize
69 (const Handle(IFSelect_EditForm)& /*form*/) const
71 // il faut 10 parametres
75 Handle(TCollection_HAsciiString) STEPEdit_EditSDR::StringValue
76 (const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer num) const
78 Handle(TCollection_HAsciiString) str;
80 case 1 : return new TCollection_HAsciiString("as proposed");
81 case 2 : return new TCollection_HAsciiString("First_Design");
82 case 3 : return new TCollection_HAsciiString("void");
83 case 4 : return new TCollection_HAsciiString("ID");
84 case 5 : return new TCollection_HAsciiString("void");
85 case 8 : return new TCollection_HAsciiString("void");
86 case 9 : return new TCollection_HAsciiString("Mechanical");
87 case 10 : return new TCollection_HAsciiString("Assembly");
88 case 11 : return new TCollection_HAsciiString("EUCLID");
94 Standard_Boolean STEPEdit_EditSDR::Load
95 (const Handle(IFSelect_EditForm)& form,
96 const Handle(Standard_Transient)& ent,
97 const Handle(Interface_InterfaceModel)& model) const
99 Handle(StepShape_ShapeDefinitionRepresentation) sdr =
100 Handle(StepShape_ShapeDefinitionRepresentation)::DownCast (ent);
101 Handle(StepData_StepModel) modl =
102 Handle(StepData_StepModel)::DownCast(model);
103 if (sdr.IsNull() || modl.IsNull()) return Standard_False;
105 STEPConstruct_Part ctx;
108 form->LoadValue (1, ctx.PDCname());
109 form->LoadValue (2, ctx.PDCstage());
110 form->LoadValue (3, ctx.PDdescription());
112 form->LoadValue (4, ctx.PDFid());
113 form->LoadValue (5, ctx.PDFdescription());
115 form->LoadValue (6, ctx.Pid());
116 form->LoadValue (7, ctx.Pname());
117 form->LoadValue (8, ctx.Pdescription());
119 form->LoadValue (9, ctx.PCname());
120 form->LoadValue (10, ctx.PCdisciplineType());
122 form->LoadValue (11, ctx.ACapplication());
124 return Standard_True;
127 Standard_Boolean STEPEdit_EditSDR::Apply
128 (const Handle(IFSelect_EditForm)& form,
129 const Handle(Standard_Transient)& ent,
130 const Handle(Interface_InterfaceModel)& model) const
132 Handle(StepShape_ShapeDefinitionRepresentation) sdr =
133 Handle(StepShape_ShapeDefinitionRepresentation)::DownCast (ent);
134 Handle(StepData_StepModel) modl =
135 Handle(StepData_StepModel)::DownCast(model);
136 if (sdr.IsNull() || modl.IsNull()) return Standard_False;
138 STEPConstruct_Part ctx;
141 if (form->IsModified(1)) ctx.SetPDCname (form->EditedValue(1));
142 if (form->IsModified(2)) ctx.SetPDCstage (form->EditedValue(2));
143 if (form->IsModified(3)) ctx.SetPDdescription (form->EditedValue(3));
145 if (form->IsModified(4)) ctx.SetPDFid (form->EditedValue(4));
146 if (form->IsModified(5)) ctx.SetPDFdescription (form->EditedValue(5));
148 if (form->IsModified(6)) ctx.SetPid (form->EditedValue(6));
149 if (form->IsModified(7)) ctx.SetPname (form->EditedValue(7));
150 if (form->IsModified(8)) ctx.SetPdescription (form->EditedValue(8));
152 if (form->IsModified(9)) ctx.SetPCname (form->EditedValue(9));
153 if (form->IsModified(10)) ctx.SetPCdisciplineType (form->EditedValue(10));
155 if (form->IsModified(11)) ctx.SetACapplication (form->EditedValue(11));
157 return Standard_True;