mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
56
src/STEPEdit/STEPEdit.cdl
Executable file
56
src/STEPEdit/STEPEdit.cdl
Executable file
@@ -0,0 +1,56 @@
|
||||
-- File: STEPEdit.cdl
|
||||
-- Created: Wed Jul 29 11:56:51 1998
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
|
||||
package STEPEdit
|
||||
|
||||
---Purpose : Provides tools to exploit and edit a set of STEP data :
|
||||
-- editors, selections ..
|
||||
|
||||
uses Standard, TCollection,
|
||||
Interface, IFSelect, StepData
|
||||
|
||||
is
|
||||
|
||||
class EditContext;
|
||||
-- This class is for global context : ApplicationContext,
|
||||
-- ProductRelatedProductCategory
|
||||
|
||||
class EditSDR;
|
||||
-- This class allows to edit product data for a SDR
|
||||
|
||||
|
||||
-- Some useful operators
|
||||
-- They are not classes, they are just based on general tools
|
||||
|
||||
Protocol returns Protocol from Interface;
|
||||
---Purpose : Returns a Protocol fit for STEP (creates the first time)
|
||||
|
||||
NewModel returns StepModel from StepData;
|
||||
---Purpose : Returns a new empty StepModel fit for STEP
|
||||
-- i.e. with its header determined from Protocol
|
||||
|
||||
SignType returns Signature from IFSelect;
|
||||
---Purpose : Returns a SignType fit for STEP (creates the first time)
|
||||
|
||||
NewSelectSDR returns SelectSignature from IFSelect;
|
||||
---Purpose : Creates a Selection for ShapeDefinitionRepresentation
|
||||
-- By default searches among root entities
|
||||
|
||||
NewSelectPlacedItem returns SelectSignature from IFSelect;
|
||||
---Purpose : Creates a Selection for Placed Items, i.e. MappedItem or
|
||||
-- ContextDependentShapeRepresentation, which itself refers to a
|
||||
-- RepresentationRelationship with possible subtypes (Shape...
|
||||
-- and/or ...WithTransformation)
|
||||
-- By default in the whole StepModel
|
||||
|
||||
NewSelectShapeRepr returns SelectSignature from IFSelect;
|
||||
---Purpose : Creates a Selection for ShapeRepresentation and its sub-types,
|
||||
-- plus ContextDependentShapeRepresentation (which is not a
|
||||
-- sub-type of ShapeRepresentation)
|
||||
-- By default in the whole StepModel
|
||||
|
||||
end STEPEdit;
|
65
src/STEPEdit/STEPEdit.cxx
Executable file
65
src/STEPEdit/STEPEdit.cxx
Executable file
@@ -0,0 +1,65 @@
|
||||
#include <STEPEdit.ixx>
|
||||
//#include <StepData_FileProtocol.hxx>
|
||||
#include <StepAP214.hxx>
|
||||
//#include <HeaderSection.hxx>
|
||||
|
||||
#include <APIHeaderSection_MakeHeader.hxx>
|
||||
|
||||
#include <StepSelect_StepType.hxx>
|
||||
#include <IFSelect_SelectSignature.hxx>
|
||||
#include <IFSelect_SelectModelEntities.hxx>
|
||||
#include <IFSelect_SelectModelRoots.hxx>
|
||||
|
||||
|
||||
Handle(Interface_Protocol) STEPEdit::Protocol ()
|
||||
{
|
||||
/*
|
||||
static Handle(StepData_FileProtocol) proto;
|
||||
if (!proto.IsNull()) return proto;
|
||||
proto = new StepData_FileProtocol;
|
||||
proto->Add (StepAP214::Protocol());
|
||||
proto->Add (HeaderSection::Protocol());
|
||||
return proto;
|
||||
*/
|
||||
return StepAP214::Protocol();
|
||||
}
|
||||
|
||||
Handle(StepData_StepModel) STEPEdit::NewModel ()
|
||||
{
|
||||
APIHeaderSection_MakeHeader head;
|
||||
return head.NewModel(STEPEdit::Protocol());
|
||||
}
|
||||
|
||||
Handle(IFSelect_Signature) STEPEdit::SignType ()
|
||||
{
|
||||
static Handle(StepSelect_StepType) sty;
|
||||
if (!sty.IsNull()) return sty;
|
||||
sty = new StepSelect_StepType;
|
||||
sty->SetProtocol (STEPEdit::Protocol());
|
||||
return sty;
|
||||
}
|
||||
|
||||
Handle(IFSelect_SelectSignature) STEPEdit::NewSelectSDR ()
|
||||
{
|
||||
Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
|
||||
(STEPEdit::SignType(),"SHAPE_DEFINITION_REPRESENTATION");
|
||||
sel->SetInput (new IFSelect_SelectModelRoots);
|
||||
return sel;
|
||||
}
|
||||
|
||||
Handle(IFSelect_SelectSignature) STEPEdit::NewSelectPlacedItem ()
|
||||
{
|
||||
Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
|
||||
(STEPEdit::SignType(),"MAPPED_ITEM|CONTEXT_DEPENDENT_SHAPE_REPRESENTATION",Standard_False);
|
||||
sel->SetInput (new IFSelect_SelectModelEntities);
|
||||
return sel;
|
||||
}
|
||||
|
||||
Handle(IFSelect_SelectSignature) STEPEdit::NewSelectShapeRepr ()
|
||||
{
|
||||
Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
|
||||
(STEPEdit::SignType(),"SHAPE_REPRESENTATION",Standard_False);
|
||||
// REPRESENTATION_RELATIONSHIP passe par CONTEXT_DEPENDENT_SHAPE_REPRESENTATION
|
||||
sel->SetInput (new IFSelect_SelectModelEntities);
|
||||
return sel;
|
||||
}
|
35
src/STEPEdit/STEPEdit_EditContext.cdl
Executable file
35
src/STEPEdit/STEPEdit_EditContext.cdl
Executable file
@@ -0,0 +1,35 @@
|
||||
-- File: STEPEdit_EditContext.cdl
|
||||
-- Created: Wed Jul 29 13:44:27 1998
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
|
||||
class EditContext from STEPEdit inherits Editor from IFSelect
|
||||
|
||||
---Purpose : EditContext is an Editor fit for
|
||||
-- Product Definition Context (one per Model) , i.e. :
|
||||
-- - ProductDefinition
|
||||
-- - ApplicationProtocolDefinition
|
||||
-- - ProductRelatedProductCategory
|
||||
|
||||
uses Transient, AsciiString, HAsciiString, InterfaceModel, EditForm
|
||||
|
||||
is
|
||||
|
||||
Create returns EditContext;
|
||||
|
||||
Label (me) returns AsciiString;
|
||||
|
||||
Recognize (me; form : EditForm) returns Boolean;
|
||||
|
||||
StringValue (me; form : EditForm; num : Integer)
|
||||
returns HAsciiString from TCollection;
|
||||
|
||||
Apply (me; form : EditForm; ent : Transient; model : InterfaceModel)
|
||||
returns Boolean;
|
||||
|
||||
Load (me; form : EditForm; ent : Transient; model : InterfaceModel)
|
||||
returns Boolean;
|
||||
|
||||
end EditContext;
|
108
src/STEPEdit/STEPEdit_EditContext.cxx
Executable file
108
src/STEPEdit/STEPEdit_EditContext.cxx
Executable file
@@ -0,0 +1,108 @@
|
||||
#include <STEPEdit_EditContext.ixx>
|
||||
#include <Interface_TypedValue.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
#include <StepData_StepModel.hxx>
|
||||
#include <STEPConstruct_ContextTool.hxx>
|
||||
|
||||
|
||||
STEPEdit_EditContext::STEPEdit_EditContext ()
|
||||
: IFSelect_Editor (5)
|
||||
{
|
||||
Handle(Interface_TypedValue) ac_val = new Interface_TypedValue("Application Context",Interface_ParamIdent);
|
||||
SetValue(1,ac_val,"AC",IFSelect_EditRead);
|
||||
|
||||
Handle(Interface_TypedValue) ac_status = new Interface_TypedValue("AppliContext_Status");
|
||||
SetValue(2,ac_status,"AC_Status");
|
||||
Handle(Interface_TypedValue) ac_sche = new Interface_TypedValue("AppliContext_Schema");
|
||||
SetValue(3,ac_sche,"AC_Schema");
|
||||
Handle(Interface_TypedValue) ac_year = new Interface_TypedValue("AppliContext_Year",Interface_ParamInteger);
|
||||
SetValue(4,ac_year,"AC_Year");
|
||||
Handle(Interface_TypedValue) ac_name = new Interface_TypedValue("AppliContext_Name");
|
||||
SetValue(5,ac_name,"AC_Name");
|
||||
|
||||
// Handle(Interface_TypedValue) prpc_val = new Interface_TypedValue("Product Related Product Category",Interface_ParamIdent);
|
||||
// SetValue(6,ac_val,"PRPC",IFSelect_EditRead);
|
||||
|
||||
// Handle(Interface_TypedValue) prpc_name = new Interface_TypedValue("PRPC_Name");
|
||||
// SetValue(7,prpc_name,"PRPC_Name");
|
||||
// Handle(Interface_TypedValue) prpc_descr = new Interface_TypedValue("PRPC_Description");
|
||||
// SetValue(8,prpc_descr,"PRPC_Descr");
|
||||
}
|
||||
|
||||
TCollection_AsciiString STEPEdit_EditContext::Label () const
|
||||
{ return TCollection_AsciiString ("STEP : Product Definition Context"); }
|
||||
|
||||
Standard_Boolean STEPEdit_EditContext::Recognize
|
||||
(const Handle(IFSelect_EditForm)& form) const
|
||||
{
|
||||
// il faut 17 parametres
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) STEPEdit_EditContext::StringValue
|
||||
(const Handle(IFSelect_EditForm)& form, const Standard_Integer num) const
|
||||
{
|
||||
Handle(TCollection_HAsciiString) str;
|
||||
switch (num) {
|
||||
case 2 : return new TCollection_HAsciiString("DIS");
|
||||
case 3 : return new TCollection_HAsciiString("automotive_design");
|
||||
case 4 : return new TCollection_HAsciiString("1998");
|
||||
case 5 : return new TCollection_HAsciiString("EUCLID");
|
||||
case 7 : return new TCollection_HAsciiString("Undefined Category");
|
||||
case 8 : return new TCollection_HAsciiString("Undefined Description");
|
||||
default : break;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
Standard_Boolean STEPEdit_EditContext::Load
|
||||
(const Handle(IFSelect_EditForm)& form,
|
||||
const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
Handle(StepData_StepModel) modl =
|
||||
Handle(StepData_StepModel)::DownCast(model);
|
||||
if (modl.IsNull()) return Standard_False;
|
||||
|
||||
STEPConstruct_ContextTool ctx (modl);
|
||||
|
||||
form->LoadValue (1, modl->StringLabel(ctx.GetAPD()) );
|
||||
|
||||
form->LoadValue (2, ctx.GetACstatus());
|
||||
form->LoadValue (3, ctx.GetACschemaName());
|
||||
form->LoadValue (4, new TCollection_HAsciiString(ctx.GetACyear()) );
|
||||
form->LoadValue (5, ctx.GetACname());
|
||||
|
||||
// form->LoadValue (6, modl->StringLabel(ctx.GetPRPC()) );
|
||||
|
||||
// form->LoadValue (7, ctx.GetPRPCName());
|
||||
// form->LoadValue (8, ctx.GetPRPCDescription());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean STEPEdit_EditContext::Apply
|
||||
(const Handle(IFSelect_EditForm)& form,
|
||||
const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
Handle(StepData_StepModel) modl =
|
||||
Handle(StepData_StepModel)::DownCast(model);
|
||||
if (modl.IsNull()) return Standard_False;
|
||||
|
||||
STEPConstruct_ContextTool ctx (modl);
|
||||
|
||||
ctx.AddAPD(); // on ne sait jamais
|
||||
// ctx.AddPRPC();
|
||||
|
||||
if (form->IsModified(2)) ctx.SetACstatus (form->EditedValue(2));
|
||||
if (form->IsModified(3)) ctx.SetACschemaName (form->EditedValue(3));
|
||||
if (form->IsModified(4)) ctx.SetACyear(form->EditedValue(4)->IntegerValue());
|
||||
if (form->IsModified(5)) ctx.SetACname (form->EditedValue(5));
|
||||
|
||||
// if (form->IsModified(7)) ctx.SetPRPCName (form->EditedValue(7));
|
||||
// if (form->IsModified(8)) ctx.SetPRPCDescription (form->EditedValue(8));
|
||||
|
||||
return Standard_True;
|
||||
}
|
32
src/STEPEdit/STEPEdit_EditSDR.cdl
Executable file
32
src/STEPEdit/STEPEdit_EditSDR.cdl
Executable file
@@ -0,0 +1,32 @@
|
||||
-- File: STEPEdit_EditSDR.cdl
|
||||
-- Created: Wed Jul 29 14:47:07 1998
|
||||
-- Author: Administrateur Atelier XSTEP
|
||||
-- <xstep@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
|
||||
class EditSDR from STEPEdit inherits Editor from IFSelect
|
||||
|
||||
---Purpose : EditSDR is an Editor fit for a Shape Definition Representation
|
||||
-- which designates a Product Definition
|
||||
|
||||
uses Transient, AsciiString, HAsciiString, InterfaceModel, EditForm
|
||||
|
||||
is
|
||||
|
||||
Create returns EditSDR;
|
||||
|
||||
Label (me) returns AsciiString;
|
||||
|
||||
Recognize (me; form : EditForm) returns Boolean;
|
||||
|
||||
StringValue (me; form : EditForm; num : Integer)
|
||||
returns HAsciiString from TCollection;
|
||||
|
||||
Apply (me; form : EditForm; ent : Transient; model : InterfaceModel)
|
||||
returns Boolean;
|
||||
|
||||
Load (me; form : EditForm; ent : Transient; model : InterfaceModel)
|
||||
returns Boolean;
|
||||
|
||||
end EditSDR;
|
141
src/STEPEdit/STEPEdit_EditSDR.cxx
Executable file
141
src/STEPEdit/STEPEdit_EditSDR.cxx
Executable file
@@ -0,0 +1,141 @@
|
||||
#include <STEPEdit_EditSDR.ixx>
|
||||
#include <Interface_TypedValue.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
|
||||
#include <StepData_StepModel.hxx>
|
||||
#include <StepShape_ShapeDefinitionRepresentation.hxx>
|
||||
#include <STEPConstruct_Part.hxx>
|
||||
|
||||
|
||||
STEPEdit_EditSDR::STEPEdit_EditSDR ()
|
||||
: IFSelect_Editor (11)
|
||||
{
|
||||
Handle(Interface_TypedValue) pdc_name = new Interface_TypedValue("PDC_Name");
|
||||
SetValue (1,pdc_name,"PDC_Name");
|
||||
Handle(Interface_TypedValue) pdc_lfs = new Interface_TypedValue("PDC_LifeCycleStage");
|
||||
SetValue(2,pdc_lfs,"PDC_Stage");
|
||||
Handle(Interface_TypedValue) pdc_descr = new Interface_TypedValue("PDC_Description");
|
||||
SetValue(3,pdc_descr,"PDC_Descr");
|
||||
|
||||
Handle(Interface_TypedValue) pv_vid = new Interface_TypedValue("P_Version_Id");
|
||||
SetValue(4,pv_vid,"PV_Id");
|
||||
Handle(Interface_TypedValue) pv_descr = new Interface_TypedValue("P_Version_Description");
|
||||
SetValue(5,pv_descr,"PV_Descr");
|
||||
|
||||
Handle(Interface_TypedValue) pid = new Interface_TypedValue("Product_Id");
|
||||
SetValue(6,pid,"P_Id");
|
||||
Handle(Interface_TypedValue) pname = new Interface_TypedValue("Product_Name");
|
||||
SetValue(7,pname,"P_Name");
|
||||
Handle(Interface_TypedValue) pdescr = new Interface_TypedValue("Product_Description");
|
||||
SetValue(8,pdescr,"P_Descr");
|
||||
|
||||
Handle(Interface_TypedValue) pc_name = new Interface_TypedValue("P_Context_Name");
|
||||
SetValue(9,pc_name,"PC_Name");
|
||||
Handle(Interface_TypedValue) pc_disc = new Interface_TypedValue("P_Context_Discipline");
|
||||
SetValue(10,pc_disc,"PC_Disc");
|
||||
|
||||
Handle(Interface_TypedValue) ac_ap = new Interface_TypedValue("Application");
|
||||
SetValue(11,ac_ap,"Appli");
|
||||
|
||||
|
||||
// ?? :
|
||||
//Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDSname() const
|
||||
//Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDSdescription() const
|
||||
//Handle(TCollection_HAsciiString) StepPDR_SDRtool::PDdescription() const
|
||||
|
||||
}
|
||||
|
||||
TCollection_AsciiString STEPEdit_EditSDR::Label () const
|
||||
{ return TCollection_AsciiString ("STEP : Product Data (SDR)"); }
|
||||
|
||||
Standard_Boolean STEPEdit_EditSDR::Recognize
|
||||
(const Handle(IFSelect_EditForm)& form) const
|
||||
{
|
||||
// il faut 10 parametres
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) STEPEdit_EditSDR::StringValue
|
||||
(const Handle(IFSelect_EditForm)& form, const Standard_Integer num) const
|
||||
{
|
||||
Handle(TCollection_HAsciiString) str;
|
||||
switch (num) {
|
||||
case 1 : return new TCollection_HAsciiString("as proposed");
|
||||
case 2 : return new TCollection_HAsciiString("First_Design");
|
||||
case 3 : return new TCollection_HAsciiString("void");
|
||||
case 4 : return new TCollection_HAsciiString("ID");
|
||||
case 5 : return new TCollection_HAsciiString("void");
|
||||
case 8 : return new TCollection_HAsciiString("void");
|
||||
case 9 : return new TCollection_HAsciiString("Mechanical");
|
||||
case 10 : return new TCollection_HAsciiString("Assembly");
|
||||
case 11 : return new TCollection_HAsciiString("EUCLID");
|
||||
default : break;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
Standard_Boolean STEPEdit_EditSDR::Load
|
||||
(const Handle(IFSelect_EditForm)& form,
|
||||
const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
Handle(StepShape_ShapeDefinitionRepresentation) sdr =
|
||||
Handle(StepShape_ShapeDefinitionRepresentation)::DownCast (ent);
|
||||
Handle(StepData_StepModel) modl =
|
||||
Handle(StepData_StepModel)::DownCast(model);
|
||||
if (sdr.IsNull() || modl.IsNull()) return Standard_False;
|
||||
|
||||
STEPConstruct_Part ctx;
|
||||
ctx.ReadSDR (sdr);
|
||||
|
||||
form->LoadValue (1, ctx.PDCname());
|
||||
form->LoadValue (2, ctx.PDCstage());
|
||||
form->LoadValue (3, ctx.PDdescription());
|
||||
|
||||
form->LoadValue (4, ctx.PDFid());
|
||||
form->LoadValue (5, ctx.PDFdescription());
|
||||
|
||||
form->LoadValue (6, ctx.Pid());
|
||||
form->LoadValue (7, ctx.Pname());
|
||||
form->LoadValue (8, ctx.Pdescription());
|
||||
|
||||
form->LoadValue (9, ctx.PCname());
|
||||
form->LoadValue (10, ctx.PCdisciplineType());
|
||||
|
||||
form->LoadValue (11, ctx.ACapplication());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean STEPEdit_EditSDR::Apply
|
||||
(const Handle(IFSelect_EditForm)& form,
|
||||
const Handle(Standard_Transient)& ent,
|
||||
const Handle(Interface_InterfaceModel)& model) const
|
||||
{
|
||||
Handle(StepShape_ShapeDefinitionRepresentation) sdr =
|
||||
Handle(StepShape_ShapeDefinitionRepresentation)::DownCast (ent);
|
||||
Handle(StepData_StepModel) modl =
|
||||
Handle(StepData_StepModel)::DownCast(model);
|
||||
if (sdr.IsNull() || modl.IsNull()) return Standard_False;
|
||||
|
||||
STEPConstruct_Part ctx;
|
||||
ctx.ReadSDR (sdr);
|
||||
|
||||
if (form->IsModified(1)) ctx.SetPDCname (form->EditedValue(1));
|
||||
if (form->IsModified(2)) ctx.SetPDCstage (form->EditedValue(2));
|
||||
if (form->IsModified(3)) ctx.SetPDdescription (form->EditedValue(3));
|
||||
|
||||
if (form->IsModified(4)) ctx.SetPDFid (form->EditedValue(4));
|
||||
if (form->IsModified(5)) ctx.SetPDFdescription (form->EditedValue(5));
|
||||
|
||||
if (form->IsModified(6)) ctx.SetPid (form->EditedValue(6));
|
||||
if (form->IsModified(7)) ctx.SetPname (form->EditedValue(7));
|
||||
if (form->IsModified(8)) ctx.SetPdescription (form->EditedValue(8));
|
||||
|
||||
if (form->IsModified(9)) ctx.SetPCname (form->EditedValue(9));
|
||||
if (form->IsModified(10)) ctx.SetPCdisciplineType (form->EditedValue(10));
|
||||
|
||||
if (form->IsModified(11)) ctx.SetACapplication (form->EditedValue(11));
|
||||
|
||||
return Standard_True;
|
||||
}
|
Reference in New Issue
Block a user