Warnings on vc14 were eliminated
[occt.git] / src / STEPEdit / STEPEdit_EditSDR.cxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 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
973c2be1 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.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
7fd59977 14
42cf5bc1 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>
7fd59977 21#include <StepData_StepModel.hxx>
42cf5bc1 22#include <STEPEdit_EditSDR.hxx>
7fd59977 23#include <StepShape_ShapeDefinitionRepresentation.hxx>
42cf5bc1 24#include <TCollection_AsciiString.hxx>
25#include <TCollection_HAsciiString.hxx>
7fd59977 26
92efcf78 27IMPLEMENT_STANDARD_RTTIEXT(STEPEdit_EditSDR,IFSelect_Editor)
28
7fd59977 29STEPEdit_EditSDR::STEPEdit_EditSDR ()
30: IFSelect_Editor (11)
31{
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");
38
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");
43
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");
50
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");
55
56 Handle(Interface_TypedValue) ac_ap = new Interface_TypedValue("Application");
57 SetValue(11,ac_ap,"Appli");
58
59
60// ?? :
61//Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDSname() const
62//Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDSdescription() const
63//Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDdescription() const
64
65}
66
67TCollection_AsciiString STEPEdit_EditSDR::Label () const
68{ return TCollection_AsciiString ("STEP : Product Data (SDR)"); }
69
70Standard_Boolean STEPEdit_EditSDR::Recognize
35e08fe8 71(const Handle(IFSelect_EditForm)& /*form*/) const
7fd59977 72{
73// il faut 10 parametres
74 return Standard_True;
75}
76
77Handle(TCollection_HAsciiString) STEPEdit_EditSDR::StringValue
35e08fe8 78(const Handle(IFSelect_EditForm)& /*form*/, const Standard_Integer num) const
7fd59977 79{
80 Handle(TCollection_HAsciiString) str;
81 switch (num) {
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");
91 default : break;
92 }
93 return str;
94}
95
96Standard_Boolean STEPEdit_EditSDR::Load
97(const Handle(IFSelect_EditForm)& form,
98 const Handle(Standard_Transient)& ent,
99 const Handle(Interface_InterfaceModel)& model) const
100{
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;
106
107 STEPConstruct_Part ctx;
108 ctx.ReadSDR (sdr);
109
110 form->LoadValue (1, ctx.PDCname());
111 form->LoadValue (2, ctx.PDCstage());
112 form->LoadValue (3, ctx.PDdescription());
113
114 form->LoadValue (4, ctx.PDFid());
115 form->LoadValue (5, ctx.PDFdescription());
116
117 form->LoadValue (6, ctx.Pid());
118 form->LoadValue (7, ctx.Pname());
119 form->LoadValue (8, ctx.Pdescription());
120
121 form->LoadValue (9, ctx.PCname());
122 form->LoadValue (10, ctx.PCdisciplineType());
123
124 form->LoadValue (11, ctx.ACapplication());
125
126 return Standard_True;
127}
128
129Standard_Boolean STEPEdit_EditSDR::Apply
130(const Handle(IFSelect_EditForm)& form,
131 const Handle(Standard_Transient)& ent,
132 const Handle(Interface_InterfaceModel)& model) const
133{
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;
139
140 STEPConstruct_Part ctx;
141 ctx.ReadSDR (sdr);
142
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));
146
147 if (form->IsModified(4)) ctx.SetPDFid (form->EditedValue(4));
148 if (form->IsModified(5)) ctx.SetPDFdescription (form->EditedValue(5));
149
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));
153
154 if (form->IsModified(9)) ctx.SetPCname (form->EditedValue(9));
155 if (form->IsModified(10)) ctx.SetPCdisciplineType (form->EditedValue(10));
156
157 if (form->IsModified(11)) ctx.SetACapplication (form->EditedValue(11));
158
159 return Standard_True;
160}