mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
21
src/APIHeaderSection/APIHeaderSection.cdl
Executable file
21
src/APIHeaderSection/APIHeaderSection.cdl
Executable file
@@ -0,0 +1,21 @@
|
||||
-- File: APIHeaderSection.cdl
|
||||
-- Created: Wed Sep 21 15:47:30 1994
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@anion>
|
||||
---Copyright: Matra Datavision 1994
|
||||
|
||||
|
||||
package APIHeaderSection
|
||||
|
||||
---Purpose : This package gives the means to access to the Header of a
|
||||
-- Step Model
|
||||
|
||||
uses Standard, TCollection, Interface, IFSelect, StepData, HeaderSection
|
||||
|
||||
is
|
||||
|
||||
class MakeHeader; -- which provide basic access services to Step Header
|
||||
|
||||
class EditHeader; -- to edit a Step Header
|
||||
|
||||
end APIHeaderSection;
|
29
src/APIHeaderSection/APIHeaderSection_EditHeader.cdl
Executable file
29
src/APIHeaderSection/APIHeaderSection_EditHeader.cdl
Executable file
@@ -0,0 +1,29 @@
|
||||
-- File: APIHeaderSection_EditHeader.cdl
|
||||
-- Created: Wed Jul 8 16:19:47 1998
|
||||
-- Author: Christian CAILLET
|
||||
-- <cky@heliox.paris1.matra-dtv.fr>
|
||||
---Copyright: Matra Datavision 1998
|
||||
|
||||
|
||||
class EditHeader from APIHeaderSection inherits Editor from IFSelect
|
||||
|
||||
uses Transient, AsciiString, HAsciiString, InterfaceModel, EditForm
|
||||
|
||||
is
|
||||
|
||||
Create returns EditHeader;
|
||||
|
||||
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 EditHeader;
|
149
src/APIHeaderSection/APIHeaderSection_EditHeader.cxx
Executable file
149
src/APIHeaderSection/APIHeaderSection_EditHeader.cxx
Executable file
@@ -0,0 +1,149 @@
|
||||
#include <APIHeaderSection_EditHeader.ixx>
|
||||
#include <Interface_TypedValue.hxx>
|
||||
|
||||
#include <APIHeaderSection_MakeHeader.hxx>
|
||||
|
||||
static Standard_Boolean IsTimeStamp
|
||||
(const Handle(TCollection_HAsciiString)& val)
|
||||
{
|
||||
if (val.IsNull()) return Standard_False;
|
||||
if (val->Length() != 19) return Standard_False;
|
||||
// On y va
|
||||
char dizmois = val->Value(6);
|
||||
char dizjour = val->Value(9);
|
||||
char dizheur = val->Value(12);
|
||||
for (Standard_Integer i = 1; i <= 19; i ++) {
|
||||
char uncar = val->Value(i);
|
||||
switch (i) {
|
||||
case 1 : if (uncar != '1' && uncar != '2') return Standard_False; break;
|
||||
case 2 :
|
||||
case 3 :
|
||||
case 4 : if (uncar < '0' || uncar > '9') return Standard_False; break;
|
||||
case 5 : if (uncar != '-') return Standard_False;
|
||||
case 6 : if (uncar != '0' && uncar != '1') return Standard_False; break;
|
||||
case 7 : if (uncar < '0' || uncar > '9') return Standard_False; break;
|
||||
if (dizmois == '1' && (uncar < '0' || uncar > '2')) return Standard_False;
|
||||
break;
|
||||
case 8 : if (uncar != '-') return Standard_False;
|
||||
case 9 : if (uncar < '0' || uncar > '3') return Standard_False; break;
|
||||
case 10 : if (uncar < '0' || uncar > '9') return Standard_False;
|
||||
if (dizjour == '3' && (uncar != '0' && uncar != '1')) return Standard_False;
|
||||
break;
|
||||
case 11 : if (uncar != 'T') return Standard_False;
|
||||
case 12 : if (uncar < '0' || uncar > '2') return Standard_False; break;
|
||||
case 13 : if (uncar < '0' || uncar > '9') return Standard_False;
|
||||
if (dizheur == '2' && (uncar < '0' || uncar > '3')) return Standard_False; break;
|
||||
break;
|
||||
case 14 : if (uncar != ':') return Standard_False;
|
||||
case 15 : if (uncar < '0' || uncar > '5') return Standard_False; break;
|
||||
case 16 : if (uncar < '0' || uncar > '9') return Standard_False; break;
|
||||
case 17 : if (uncar != ':') return Standard_False;
|
||||
case 18 : if (uncar < '0' || uncar > '5') return Standard_False; break;
|
||||
case 19 : if (uncar < '0' || uncar > '9') return Standard_False; break;
|
||||
default : break;
|
||||
}
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
|
||||
APIHeaderSection_EditHeader::APIHeaderSection_EditHeader ()
|
||||
: IFSelect_Editor (10)
|
||||
{
|
||||
// Definition
|
||||
Handle(Interface_TypedValue) fn_name = new Interface_TypedValue("fn_name");
|
||||
SetValue (1,fn_name,"name");
|
||||
Handle(Interface_TypedValue) fn_time = new Interface_TypedValue("fn_time_stamp");
|
||||
fn_time->SetSatisfies (IsTimeStamp,"IsTimeStamp");
|
||||
SetValue (2,fn_time,"time");
|
||||
Handle(Interface_TypedValue) fn_author = new Interface_TypedValue("fn_author");
|
||||
SetValue (3,fn_author,"author"); // 1 seul (1er de liste)
|
||||
Handle(Interface_TypedValue) fn_org = new Interface_TypedValue("fn_organization");
|
||||
SetValue (4,fn_org,"org"); // 1 seul (1er de liste)
|
||||
Handle(Interface_TypedValue) fn_preproc = new Interface_TypedValue("fn_preprocessor_version");
|
||||
SetValue (5,fn_preproc,"preproc");
|
||||
Handle(Interface_TypedValue) fn_orig = new Interface_TypedValue("fn_originating_system");
|
||||
SetValue (6,fn_orig,"orig");
|
||||
Handle(Interface_TypedValue) fn_autorize = new Interface_TypedValue("fn_authorization");
|
||||
SetValue (7,fn_autorize,"autorize");
|
||||
|
||||
Handle(Interface_TypedValue) fs_schema = new Interface_TypedValue("fs_schema_identifiers");
|
||||
SetValue (8,fs_schema,"schema"); // 1 seul (1er de liste)
|
||||
|
||||
Handle(Interface_TypedValue) fd_descr = new Interface_TypedValue("fd_description");
|
||||
SetValue (9,fd_descr,"descr"); // 1 seul (1er de liste)
|
||||
|
||||
Handle(Interface_TypedValue) fd_level = new Interface_TypedValue("fd_implementation_level");
|
||||
SetValue (10,fd_level,"level");
|
||||
|
||||
}
|
||||
|
||||
TCollection_AsciiString APIHeaderSection_EditHeader::Label () const
|
||||
{ return TCollection_AsciiString ("Step Header"); }
|
||||
|
||||
Standard_Boolean APIHeaderSection_EditHeader::Recognize
|
||||
(const Handle(IFSelect_EditForm)& form) const
|
||||
{ return Standard_True; } // ??
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_EditHeader::StringValue
|
||||
(const Handle(IFSelect_EditForm)& form, const Standard_Integer num) const
|
||||
{
|
||||
// Default Values
|
||||
return TypedValue(num)->HStringValue();
|
||||
}
|
||||
|
||||
Standard_Boolean APIHeaderSection_EditHeader::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;
|
||||
|
||||
APIHeaderSection_MakeHeader mkh (modl);
|
||||
|
||||
form->LoadValue (1 ,mkh.Name ());
|
||||
form->LoadValue (2 ,mkh.TimeStamp ());
|
||||
form->LoadValue (3 ,mkh.AuthorValue (1));
|
||||
form->LoadValue (4 ,mkh.OrganizationValue (1));
|
||||
form->LoadValue (5 ,mkh.PreprocessorVersion ());
|
||||
form->LoadValue (6 ,mkh.OriginatingSystem ());
|
||||
form->LoadValue (7 ,mkh.Authorisation ());
|
||||
|
||||
form->LoadValue (8 ,mkh.SchemaIdentifiersValue (1));
|
||||
|
||||
form->LoadValue (9 ,mkh.DescriptionValue (1));
|
||||
form->LoadValue (10,mkh.ImplementationLevel ());
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
Standard_Boolean APIHeaderSection_EditHeader::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;
|
||||
|
||||
APIHeaderSection_MakeHeader mkh (modl);
|
||||
|
||||
if (form->IsModified(1)) mkh.SetName (form->EditedValue(1));
|
||||
if (form->IsModified(2)) mkh.SetTimeStamp (form->EditedValue(2));
|
||||
if (form->IsModified(3)) mkh.SetAuthorValue (1,form->EditedValue(3));
|
||||
if (form->IsModified(4)) mkh.SetOrganizationValue (1,form->EditedValue(4));
|
||||
if (form->IsModified(5)) mkh.SetPreprocessorVersion (form->EditedValue(5));
|
||||
if (form->IsModified(6)) mkh.SetOriginatingSystem (form->EditedValue(6));
|
||||
if (form->IsModified(7)) mkh.SetAuthorisation (form->EditedValue(7));
|
||||
|
||||
if (form->IsModified(8)) mkh.SetSchemaIdentifiersValue (1,form->EditedValue(8));
|
||||
|
||||
if (form->IsModified(9)) mkh.SetDescriptionValue (1,form->EditedValue(9));
|
||||
if (form->IsModified(10)) mkh.SetImplementationLevel (form->EditedValue(10));
|
||||
|
||||
mkh.Apply( Handle(StepData_StepModel)::DownCast(model) );
|
||||
|
||||
return Standard_True;
|
||||
}
|
160
src/APIHeaderSection/APIHeaderSection_MakeHeader.cdl
Executable file
160
src/APIHeaderSection/APIHeaderSection_MakeHeader.cdl
Executable file
@@ -0,0 +1,160 @@
|
||||
-- File: APIHeaderSection_MakeHeader.cdl
|
||||
-- Created: Thu Aug 12 10:43:48 1993
|
||||
-- Author: Frederic MAUPAS
|
||||
-- <fma@sdsun2>
|
||||
---Copyright: Matra Datavision 1993
|
||||
|
||||
|
||||
class MakeHeader from APIHeaderSection
|
||||
|
||||
---Purpose : This class allows to consult and prepare/edit data stored in
|
||||
-- a Step Model Header
|
||||
|
||||
uses
|
||||
|
||||
StepModel from StepData,
|
||||
Protocol from Interface,
|
||||
FileName from HeaderSection,
|
||||
FileSchema from HeaderSection,
|
||||
FileDescription from HeaderSection,
|
||||
Integer from Standard,
|
||||
Boolean from Standard,
|
||||
HAsciiString from TCollection,
|
||||
HArray1OfHAsciiString from Interface
|
||||
|
||||
-- raises NotDone from StdFail
|
||||
|
||||
is
|
||||
|
||||
Create(shapetype : Integer = 0) returns MakeHeader;
|
||||
---Purpose : Prepares a new MakeHeader from scratch
|
||||
|
||||
Create(model : StepModel) returns MakeHeader;
|
||||
---Purpose : Prepares a MakeHeader from the content of a StepModel
|
||||
-- See IsDone to know if the Header is well defined
|
||||
|
||||
Init (me : in out; nameval : CString);
|
||||
---Purpose : Cancels the former definition and gives a FileName
|
||||
-- To be used when a Model has no well defined Header
|
||||
|
||||
IsDone(me) returns Boolean;
|
||||
---Purpose : Returns True if all data have been defined (see also
|
||||
-- HasFn, HasFs, HasFd)
|
||||
|
||||
Apply (me; model : mutable StepModel);
|
||||
---Purpose : Creates an empty header for a new
|
||||
-- STEP model and allows the header fields to be completed.
|
||||
|
||||
|
||||
NewModel (me; protocol : Protocol from Interface) returns StepModel;
|
||||
---Purpose : Builds a Header, creates a new StepModel, then applies the
|
||||
-- Header to the StepModel
|
||||
-- The Schema Name is taken from the Protocol (if it inherits
|
||||
-- from StepData, else it is left in blanks)
|
||||
|
||||
--- Specific Methods for FileName Entity
|
||||
|
||||
HasFn (me) returns Boolean;
|
||||
---Purpose: Checks whether there is a
|
||||
-- file_name entity. Returns True if there is one.
|
||||
|
||||
FnValue (me) returns FileName from HeaderSection;
|
||||
---Purpose: Returns the file_name entity.
|
||||
-- Returns an empty entity if the file_name entity is not initialized.
|
||||
|
||||
SetName(me : in out; aName : HAsciiString);
|
||||
|
||||
Name (me) returns HAsciiString;
|
||||
---Purpose: Returns the name attribute for the file_name entity.
|
||||
SetTimeStamp(me : in out; aTimeStamp : HAsciiString);
|
||||
TimeStamp (me) returns HAsciiString;
|
||||
--- Purpose: Returns the value of the time_stamp attribute for the file_name entity.
|
||||
SetAuthor(me : in out; aAuthor : HArray1OfHAsciiString);
|
||||
SetAuthorValue(me : in out; num : Integer; aAuthor : HAsciiString);
|
||||
Author (me) returns HArray1OfHAsciiString;
|
||||
AuthorValue (me; num : Integer) returns HAsciiString;
|
||||
---Purpose: Returns the value of the name attribute for the file_name entity.
|
||||
|
||||
NbAuthor (me) returns Integer;
|
||||
---Purpose: Returns the number of values for the author attribute in the file_name entity.
|
||||
|
||||
SetOrganization(me : in out;
|
||||
aOrganization : HArray1OfHAsciiString);
|
||||
SetOrganizationValue(me : in out; num : Integer;
|
||||
aOrganization : HAsciiString);
|
||||
Organization (me) returns HArray1OfHAsciiString;
|
||||
OrganizationValue (me; num : Integer) returns HAsciiString;
|
||||
--- Purpose: Returns the value of attribute
|
||||
-- organization for the file_name entity.
|
||||
|
||||
NbOrganization (me) returns Integer;
|
||||
--- Purpose: Returns the number of values for
|
||||
-- the organization attribute in the file_name entity.
|
||||
|
||||
SetPreprocessorVersion(me : in out;
|
||||
aPreprocessorVersion : HAsciiString);
|
||||
PreprocessorVersion (me) returns HAsciiString;
|
||||
---Purpose: Returns the name of the preprocessor_version for the file_name entity.
|
||||
|
||||
SetOriginatingSystem(me : in out; aOriginatingSystem : HAsciiString);
|
||||
OriginatingSystem (me) returns HAsciiString;
|
||||
SetAuthorisation(me : in out; aAuthorisation : HAsciiString);
|
||||
Authorisation (me) returns HAsciiString;
|
||||
---Purpose: Returns the value of the authorization attribute for the file_name entity.
|
||||
|
||||
HasFs (me) returns Boolean;
|
||||
---Purpose: Checks whether there is a file_schema entity. Returns True if there is one.
|
||||
|
||||
FsValue (me) returns FileSchema from HeaderSection;
|
||||
---Purpose: Returns the file_schema entity. Returns an empty entity if the file_schema entity is not initialized.
|
||||
|
||||
SetSchemaIdentifiers(me : in out; aSchemaIdentifiers :
|
||||
mutable HArray1OfHAsciiString);
|
||||
SetSchemaIdentifiersValue(me : in out; num : Integer;
|
||||
aSchemaIdentifier : HAsciiString);
|
||||
SchemaIdentifiers (me) returns HArray1OfHAsciiString;
|
||||
SchemaIdentifiersValue (me; num : Integer) returns HAsciiString;
|
||||
--- Purpose: Returns the value of the schema_identifier attribute for the file_schema entity.
|
||||
|
||||
NbSchemaIdentifiers (me) returns Integer;
|
||||
---Purpose: Returns the number of values for the schema_identifier attribute in the file_schema entity.
|
||||
|
||||
AddSchemaIdentifier (me: in out; aSchemaIdentifier : HAsciiString);
|
||||
---Purpose: Add a subname of schema (if not yet in the list)
|
||||
|
||||
--- Specific Methods for FileDescription Entity
|
||||
|
||||
HasFd (me) returns Boolean;
|
||||
--- Purpose: Checks whether there is a file_description entity. Returns True if there is one.
|
||||
|
||||
FdValue (me) returns FileDescription from HeaderSection;
|
||||
---Purpose: Returns the file_description
|
||||
-- entity. Returns an empty entity if the file_description entity is not initialized.
|
||||
|
||||
SetDescription(me : in out;
|
||||
aDescription : HArray1OfHAsciiString);
|
||||
SetDescriptionValue(me : in out; num : Integer;
|
||||
aDescription : HAsciiString);
|
||||
Description (me) returns HArray1OfHAsciiString;
|
||||
DescriptionValue (me; num : Integer) returns HAsciiString;
|
||||
--- Purpose: Returns the value of the
|
||||
-- description attribute for the file_description entity.
|
||||
|
||||
NbDescription (me) returns Integer;
|
||||
--- Purpose: Returns the number of values for
|
||||
-- the file_description entity in the STEP file header.
|
||||
|
||||
SetImplementationLevel(me : in out;
|
||||
aImplementationLevel : HAsciiString);
|
||||
ImplementationLevel (me) returns HAsciiString;
|
||||
---Purpose: Returns the value of the
|
||||
-- implementation_level attribute for the file_description entity.
|
||||
|
||||
fields
|
||||
|
||||
done : Boolean;
|
||||
fn : FileName;
|
||||
fs : FileSchema;
|
||||
fd : FileDescription;
|
||||
|
||||
end MakeHeader;
|
443
src/APIHeaderSection/APIHeaderSection_MakeHeader.cxx
Executable file
443
src/APIHeaderSection/APIHeaderSection_MakeHeader.cxx
Executable file
@@ -0,0 +1,443 @@
|
||||
// File: APIHeaderSection_MakeHeader.cxx
|
||||
// Created: Thu Aug 12 10:53:02 1993
|
||||
// Author: Frederic MAUPAS
|
||||
// <fma@meteox>
|
||||
//#58 rln 28.12.98 STEP header fields (NOTE: more parameterization is necessary)
|
||||
//pdn 11.01.99 including <stdio.h> for compilation on NT
|
||||
|
||||
#include <stdio.h>
|
||||
#include <APIHeaderSection_MakeHeader.ixx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
|
||||
#include <HeaderSection_FileSchema.hxx>
|
||||
#include <HeaderSection_FileName.hxx>
|
||||
#include <HeaderSection_FileDescription.hxx>
|
||||
|
||||
#include <StepData_Protocol.hxx>
|
||||
|
||||
#include <Interface_HArray1OfHAsciiString.hxx>
|
||||
|
||||
#include <Interface_MSG.hxx>
|
||||
#include <Interface_Version.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
|
||||
// IL S AGIT ICI DU HEADER GENERIQUE pour tout schema STEP ...
|
||||
|
||||
|
||||
static Handle(TCollection_HAsciiString) nulstr;
|
||||
static Handle(Interface_HArray1OfHAsciiString) nularr;
|
||||
|
||||
APIHeaderSection_MakeHeader::APIHeaderSection_MakeHeader
|
||||
(const Handle(StepData_StepModel)& model)
|
||||
{
|
||||
done = Standard_True;
|
||||
if (model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileName))) {
|
||||
fn = GetCasted(HeaderSection_FileName,
|
||||
model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileName)));
|
||||
}
|
||||
else done = Standard_False;
|
||||
if (model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileSchema))) {
|
||||
fs = GetCasted(HeaderSection_FileSchema,
|
||||
model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileSchema)));
|
||||
}
|
||||
else done = Standard_False;
|
||||
if (model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileDescription))) {
|
||||
fd = GetCasted(HeaderSection_FileDescription,
|
||||
model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileDescription)));
|
||||
}
|
||||
else done = Standard_False;
|
||||
}
|
||||
|
||||
APIHeaderSection_MakeHeader::APIHeaderSection_MakeHeader
|
||||
(const Standard_Integer shapetype)
|
||||
{
|
||||
switch(shapetype) {
|
||||
case 1 : Init ("Open CASCADE Facetted BRep Model"); break;
|
||||
case 2 : Init ("Open CASCADE Face Based Surface Model"); break;
|
||||
case 3 : Init ("Open CASCADE Shell Based Surface Model"); break;
|
||||
case 4 : Init ("Open CASCADE Manifold Solid Brep Model"); break;
|
||||
default: Init ("Open CASCADE Shape Model"); break;
|
||||
}
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::Init (const Standard_CString nameval)
|
||||
{
|
||||
done = Standard_True;
|
||||
|
||||
// - File Name
|
||||
char timestamp[50];
|
||||
|
||||
if (fn.IsNull()) fn = new HeaderSection_FileName;
|
||||
Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString(nameval);
|
||||
fn->SetName(name);
|
||||
Interface_MSG::TDate (timestamp,0,0,0,0,0,1,"C:%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d"); // maintenant
|
||||
Handle(TCollection_HAsciiString) tst =
|
||||
new TCollection_HAsciiString(timestamp);
|
||||
fn->SetTimeStamp(tst);
|
||||
Handle(Interface_HArray1OfHAsciiString) authors =
|
||||
new Interface_HArray1OfHAsciiString(1,1);
|
||||
Handle(TCollection_HAsciiString) a1 =
|
||||
new TCollection_HAsciiString("Author");
|
||||
authors->SetValue(1,a1);
|
||||
fn->SetAuthor(authors);
|
||||
Handle(Interface_HArray1OfHAsciiString) org =
|
||||
new Interface_HArray1OfHAsciiString(1,1);
|
||||
Handle(TCollection_HAsciiString) org1 =
|
||||
new TCollection_HAsciiString("Open CASCADE");
|
||||
org->SetValue(1,org1);
|
||||
fn->SetOrganization(org);
|
||||
|
||||
char procver[80];
|
||||
sprintf (procver, XSTEP_PROCESSOR_VERSION, "STEP");
|
||||
Handle(TCollection_HAsciiString) pv = new TCollection_HAsciiString (procver);
|
||||
//Handle(TCollection_HAsciiString) pv =
|
||||
//new TCollection_HAsciiString(XSTEP_VERSION);
|
||||
fn->SetPreprocessorVersion(pv);
|
||||
|
||||
Handle(TCollection_HAsciiString) sys =
|
||||
new TCollection_HAsciiString(XSTEP_SYSTEM_VERSION);//#58 rln
|
||||
fn->SetOriginatingSystem(sys);
|
||||
Handle(TCollection_HAsciiString) auth =
|
||||
new TCollection_HAsciiString("Unknown");
|
||||
fn->SetAuthorisation(auth);
|
||||
|
||||
// - File Description
|
||||
|
||||
if (fd.IsNull()) fd = new HeaderSection_FileDescription;
|
||||
Handle(Interface_HArray1OfHAsciiString) descr =
|
||||
new Interface_HArray1OfHAsciiString(1,1);
|
||||
Handle(TCollection_HAsciiString) descr1 =
|
||||
new TCollection_HAsciiString("Open CASCADE Model");
|
||||
descr->SetValue(1,descr1);
|
||||
fd->SetDescription(descr);
|
||||
Handle(TCollection_HAsciiString) il =
|
||||
new TCollection_HAsciiString("2;1");
|
||||
fd->SetImplementationLevel(il);
|
||||
|
||||
// - File Schema
|
||||
|
||||
if (fs.IsNull()) fs = new HeaderSection_FileSchema;
|
||||
Handle(Interface_HArray1OfHAsciiString) schid =
|
||||
new Interface_HArray1OfHAsciiString(1,1);
|
||||
Handle(TCollection_HAsciiString) schid1 =
|
||||
new TCollection_HAsciiString("");
|
||||
schid->SetValue(1,schid1);
|
||||
fs->SetSchemaIdentifiers(schid);
|
||||
|
||||
}
|
||||
|
||||
Standard_Boolean APIHeaderSection_MakeHeader::IsDone() const
|
||||
{
|
||||
return done;
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::Apply
|
||||
(const Handle(StepData_StepModel)& model) const
|
||||
{
|
||||
Interface_EntityIterator header = model->Header();
|
||||
if (HasFd() && !model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileDescription)))
|
||||
header.AddItem(fd);
|
||||
if (HasFn() && !model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileName)))
|
||||
header.AddItem(fn);
|
||||
if (HasFs() && !model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileSchema))) {
|
||||
|
||||
// Schema defini ? Sinon le prendre depuis le protocole
|
||||
Handle(TCollection_HAsciiString) sch;
|
||||
Handle(Interface_HArray1OfHAsciiString) schid = fs->SchemaIdentifiers();
|
||||
if (!schid.IsNull()) sch = schid->Value(1);
|
||||
else {
|
||||
schid = new Interface_HArray1OfHAsciiString(1,1);
|
||||
fs->SetSchemaIdentifiers(schid);
|
||||
}
|
||||
if (!sch.IsNull()) { if (sch->Length() < 2) sch.Nullify(); } // non defini
|
||||
if (sch.IsNull()) {
|
||||
Handle(StepData_Protocol) stepro = Handle(StepData_Protocol)::DownCast
|
||||
( model->Protocol());
|
||||
if (!stepro.IsNull()) sch = new TCollection_HAsciiString
|
||||
(stepro->SchemaName());
|
||||
if (!sch.IsNull()) schid->SetValue (1,sch);
|
||||
}
|
||||
header.AddItem(fs);
|
||||
}
|
||||
model->ClearHeader();
|
||||
for (header.Start(); header.More(); header.Next())
|
||||
model->AddHeaderEntity(header.Value());
|
||||
}
|
||||
|
||||
|
||||
// ========
|
||||
// FileName
|
||||
// ========
|
||||
|
||||
Handle(StepData_StepModel) APIHeaderSection_MakeHeader::NewModel
|
||||
(const Handle(Interface_Protocol)& protocol) const
|
||||
{
|
||||
Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
|
||||
stepmodel->SetProtocol (protocol);
|
||||
|
||||
// - Make Header information
|
||||
|
||||
Apply(stepmodel);
|
||||
return stepmodel;
|
||||
}
|
||||
|
||||
// ######## Individual Queries / Actions ########
|
||||
|
||||
// ========
|
||||
// FileName
|
||||
// ========
|
||||
|
||||
Standard_Boolean APIHeaderSection_MakeHeader::HasFn() const
|
||||
{ return (!fn.IsNull()); }
|
||||
|
||||
Handle(HeaderSection_FileName) APIHeaderSection_MakeHeader::FnValue() const
|
||||
{
|
||||
return fn;
|
||||
}
|
||||
|
||||
/*
|
||||
void APIHeaderSection_MakeHeader::SetNameFromShapeType(const Standard_Integer shapetype)
|
||||
{
|
||||
Handle(TCollection_HAsciiString) name;
|
||||
switch(shapetype)
|
||||
{
|
||||
case 1: // face_based_surface_model
|
||||
name = new TCollection_HAsciiString
|
||||
("Euclid Face Based Surface Model");
|
||||
break;
|
||||
case 2: // manifold_solid_brep
|
||||
name = new TCollection_HAsciiString
|
||||
("Euclid Manifold Solid Brep Model");
|
||||
break;
|
||||
case 3: // facetted_brep
|
||||
name = new TCollection_HAsciiString
|
||||
("Euclid Facetted Brep Model");
|
||||
break;
|
||||
default : // others ?
|
||||
name = new TCollection_HAsciiString
|
||||
("Euclid Shape Model");
|
||||
break;
|
||||
}
|
||||
SetName(aName);
|
||||
}
|
||||
*/
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetName(const Handle(TCollection_HAsciiString)& aName)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetName(aName);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::Name() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->Name());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetTimeStamp(const Handle(TCollection_HAsciiString)& aTimeStamp)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetTimeStamp(aTimeStamp);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::TimeStamp() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->TimeStamp());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetAuthor(const Handle(Interface_HArray1OfHAsciiString)& aAuthor)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetAuthor(aAuthor);
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetAuthorValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aAuthor)
|
||||
{
|
||||
if (fn.IsNull()) return;
|
||||
Handle(Interface_HArray1OfHAsciiString) li = fn->Author();
|
||||
if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aAuthor);
|
||||
}
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::Author() const
|
||||
{
|
||||
return (fn.IsNull() ? nularr : fn->Author());
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::AuthorValue(const Standard_Integer num) const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->AuthorValue(num));
|
||||
}
|
||||
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbAuthor () const
|
||||
{
|
||||
return (fn.IsNull() ? 0 : fn->NbAuthor());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetOrganization(const Handle(Interface_HArray1OfHAsciiString)& aOrganization)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetOrganization(aOrganization);
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetOrganizationValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aOrgan)
|
||||
{
|
||||
if (fn.IsNull()) return;
|
||||
Handle(Interface_HArray1OfHAsciiString) li = fn->Organization();
|
||||
if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aOrgan);
|
||||
}
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::Organization() const
|
||||
{
|
||||
return (fn.IsNull() ? nularr : fn->Organization());
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::OrganizationValue(const Standard_Integer num) const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->OrganizationValue(num));
|
||||
}
|
||||
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbOrganization () const
|
||||
{
|
||||
return (fn.IsNull() ? 0 : fn->NbOrganization());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetPreprocessorVersion(const Handle(TCollection_HAsciiString)& aPreprocessorVersion)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetPreprocessorVersion(aPreprocessorVersion);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::PreprocessorVersion() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->PreprocessorVersion());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetOriginatingSystem(const Handle(TCollection_HAsciiString)& aOriginatingSystem)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetOriginatingSystem(aOriginatingSystem);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::OriginatingSystem() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->OriginatingSystem());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetAuthorisation(const Handle(TCollection_HAsciiString)& aAuthorisation)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetAuthorisation(aAuthorisation);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::Authorisation() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->Authorisation());
|
||||
}
|
||||
|
||||
// ===========
|
||||
// File Schema
|
||||
// ===========
|
||||
|
||||
Standard_Boolean APIHeaderSection_MakeHeader::HasFs() const
|
||||
{ return (!fs.IsNull()); }
|
||||
|
||||
Handle(HeaderSection_FileSchema) APIHeaderSection_MakeHeader::FsValue() const
|
||||
{
|
||||
return fs;
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetSchemaIdentifiers(const Handle(Interface_HArray1OfHAsciiString)& aSchemaIdentifiers)
|
||||
{
|
||||
if (!fs.IsNull()) fs->SetSchemaIdentifiers(aSchemaIdentifiers);
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetSchemaIdentifiersValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aSchem)
|
||||
{
|
||||
if (fs.IsNull()) return;
|
||||
Handle(Interface_HArray1OfHAsciiString) li = fs->SchemaIdentifiers();
|
||||
if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aSchem);
|
||||
}
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::SchemaIdentifiers() const
|
||||
{
|
||||
return (fs.IsNull() ? nularr : fs->SchemaIdentifiers());
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::SchemaIdentifiersValue(const Standard_Integer num) const
|
||||
{
|
||||
return (fs.IsNull() ? nulstr : fs->SchemaIdentifiersValue(num));
|
||||
}
|
||||
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbSchemaIdentifiers () const
|
||||
{
|
||||
return (fs.IsNull() ? 0 : fs->NbSchemaIdentifiers());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddSchemaIdentifier
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void APIHeaderSection_MakeHeader::AddSchemaIdentifier(const Handle(TCollection_HAsciiString)& aSchem)
|
||||
{
|
||||
if ( fs.IsNull() ) fs = new HeaderSection_FileSchema;
|
||||
Handle(Interface_HArray1OfHAsciiString) idents = fs->SchemaIdentifiers();
|
||||
|
||||
// check that requested subschema is already in the list
|
||||
Standard_Integer i;
|
||||
for ( i=1; ! idents.IsNull() && i <= idents->Length(); i++ ) {
|
||||
if ( aSchem->IsSameString ( idents->Value(i) ) ) return;
|
||||
}
|
||||
|
||||
// add a subshema
|
||||
Handle(Interface_HArray1OfHAsciiString) ids =
|
||||
new Interface_HArray1OfHAsciiString ( 1, ( idents.IsNull() ? 1 : idents->Length() + 1 ) );
|
||||
for ( i=1; ! idents.IsNull() && i <= idents->Length(); i++ ) {
|
||||
ids->SetValue ( i, idents->Value(i) );
|
||||
}
|
||||
ids->SetValue ( i, aSchem );
|
||||
|
||||
fs->SetSchemaIdentifiers ( ids );
|
||||
}
|
||||
|
||||
// ================
|
||||
// File Description
|
||||
// ================
|
||||
|
||||
Standard_Boolean APIHeaderSection_MakeHeader::HasFd() const
|
||||
{ return (!fd.IsNull()); }
|
||||
|
||||
Handle(HeaderSection_FileDescription) APIHeaderSection_MakeHeader::FdValue() const
|
||||
{
|
||||
return fd;
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetDescription(const Handle(Interface_HArray1OfHAsciiString)& aDescription)
|
||||
{
|
||||
if (!fs.IsNull()) fd->SetDescription(aDescription);
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetDescriptionValue(const Standard_Integer num, const Handle(TCollection_HAsciiString)& aDescr)
|
||||
{
|
||||
if (fd.IsNull()) return;
|
||||
Handle(Interface_HArray1OfHAsciiString) li = fd->Description();
|
||||
if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num,aDescr);
|
||||
}
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::Description() const
|
||||
{
|
||||
return (fd.IsNull() ? nularr : fd->Description());
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::DescriptionValue(const Standard_Integer num) const
|
||||
{
|
||||
return (fd.IsNull() ? nulstr : fd->DescriptionValue(num));
|
||||
}
|
||||
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbDescription () const
|
||||
{
|
||||
return (fd.IsNull() ? 0 : fd->NbDescription());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetImplementationLevel(const Handle(TCollection_HAsciiString)& aImplementationLevel)
|
||||
{
|
||||
if (!fd.IsNull()) fd->SetImplementationLevel(aImplementationLevel);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::ImplementationLevel() const
|
||||
{
|
||||
return (fd.IsNull() ? nulstr : fd->ImplementationLevel());
|
||||
}
|
Reference in New Issue
Block a user