mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Fixes made for ISCAR delivery 20.10.2017
This commit is contained in:
@@ -37,100 +37,100 @@ static Handle(TCollection_HAsciiString) nulstr;
|
||||
static Handle(Interface_HArray1OfHAsciiString) nularr;
|
||||
|
||||
APIHeaderSection_MakeHeader::APIHeaderSection_MakeHeader
|
||||
(const Handle(StepData_StepModel)& model)
|
||||
(const Handle(StepData_StepModel)& model)
|
||||
{
|
||||
done = Standard_True;
|
||||
if (model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileName))) {
|
||||
if (model->HasHeaderEntity(STANDARD_TYPE(HeaderSection_FileName))) {
|
||||
fn = GetCasted(HeaderSection_FileName,
|
||||
model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileName)));
|
||||
model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileName)));
|
||||
}
|
||||
else done = Standard_False;
|
||||
if (model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileSchema))) {
|
||||
if (model->HasHeaderEntity(STANDARD_TYPE(HeaderSection_FileSchema))) {
|
||||
fs = GetCasted(HeaderSection_FileSchema,
|
||||
model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileSchema)));
|
||||
model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileSchema)));
|
||||
}
|
||||
else done = Standard_False;
|
||||
if (model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileDescription))) {
|
||||
if (model->HasHeaderEntity(STANDARD_TYPE(HeaderSection_FileDescription))) {
|
||||
fd = GetCasted(HeaderSection_FileDescription,
|
||||
model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileDescription)));
|
||||
model->HeaderEntity(STANDARD_TYPE(HeaderSection_FileDescription)));
|
||||
}
|
||||
else done = Standard_False;
|
||||
}
|
||||
|
||||
APIHeaderSection_MakeHeader::APIHeaderSection_MakeHeader
|
||||
(const Standard_Integer shapetype)
|
||||
(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;
|
||||
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)
|
||||
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"); // actually
|
||||
Handle(TCollection_HAsciiString) tst =
|
||||
Interface_MSG::TDate(timestamp, 0, 0, 0, 0, 0, 1, "C:%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d"); // actually
|
||||
Handle(TCollection_HAsciiString) tst =
|
||||
new TCollection_HAsciiString(timestamp);
|
||||
fn->SetTimeStamp(tst);
|
||||
Handle(Interface_HArray1OfHAsciiString) authors =
|
||||
new Interface_HArray1OfHAsciiString(1,1);
|
||||
Handle(TCollection_HAsciiString) a1 =
|
||||
Handle(Interface_HArray1OfHAsciiString) authors =
|
||||
new Interface_HArray1OfHAsciiString(1, 1);
|
||||
Handle(TCollection_HAsciiString) a1 =
|
||||
new TCollection_HAsciiString("Author");
|
||||
authors->SetValue(1,a1);
|
||||
authors->SetValue(1, a1);
|
||||
fn->SetAuthor(authors);
|
||||
Handle(Interface_HArray1OfHAsciiString) org =
|
||||
new Interface_HArray1OfHAsciiString(1,1);
|
||||
Handle(TCollection_HAsciiString) org1 =
|
||||
Handle(Interface_HArray1OfHAsciiString) org =
|
||||
new Interface_HArray1OfHAsciiString(1, 1);
|
||||
Handle(TCollection_HAsciiString) org1 =
|
||||
new TCollection_HAsciiString("Open CASCADE");
|
||||
org->SetValue(1,org1);
|
||||
org->SetValue(1, org1);
|
||||
fn->SetOrganization(org);
|
||||
|
||||
|
||||
char procver[80];
|
||||
sprintf (procver, XSTEP_PROCESSOR_VERSION, "STEP");
|
||||
Handle(TCollection_HAsciiString) pv = new TCollection_HAsciiString (procver);
|
||||
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 =
|
||||
|
||||
Handle(TCollection_HAsciiString) sys =
|
||||
new TCollection_HAsciiString(XSTEP_SYSTEM_VERSION);//#58 rln
|
||||
fn->SetOriginatingSystem(sys);
|
||||
Handle(TCollection_HAsciiString) auth =
|
||||
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 Interface_HArray1OfHAsciiString(1, 1);
|
||||
Handle(TCollection_HAsciiString) descr1 =
|
||||
new TCollection_HAsciiString("Open CASCADE Model");
|
||||
descr->SetValue(1,descr1);
|
||||
descr->SetValue(1, descr1);
|
||||
fd->SetDescription(descr);
|
||||
Handle(TCollection_HAsciiString) il =
|
||||
Handle(TCollection_HAsciiString) il =
|
||||
new TCollection_HAsciiString("2;1");
|
||||
fd->SetImplementationLevel(il);
|
||||
|
||||
// - File Schema
|
||||
|
||||
if (fs.IsNull()) fs = new HeaderSection_FileSchema;
|
||||
if (fs.IsNull()) fs = new HeaderSection_FileSchema;
|
||||
Handle(Interface_HArray1OfHAsciiString) schid =
|
||||
new Interface_HArray1OfHAsciiString(1,1);
|
||||
Handle(TCollection_HAsciiString) schid1 =
|
||||
new Interface_HArray1OfHAsciiString(1, 1);
|
||||
Handle(TCollection_HAsciiString) schid1 =
|
||||
new TCollection_HAsciiString("");
|
||||
schid->SetValue(1,schid1);
|
||||
schid->SetValue(1, schid1);
|
||||
fs->SetSchemaIdentifiers(schid);
|
||||
|
||||
}
|
||||
@@ -141,30 +141,31 @@ Standard_Boolean APIHeaderSection_MakeHeader::IsDone() const
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::Apply
|
||||
(const Handle(StepData_StepModel)& model) const
|
||||
(const Handle(StepData_StepModel)& model) const
|
||||
{
|
||||
Interface_EntityIterator header = model->Header();
|
||||
if (HasFd() && !model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileDescription)))
|
||||
if (HasFd() && !model->HasHeaderEntity(STANDARD_TYPE(HeaderSection_FileDescription)))
|
||||
header.AddItem(fd);
|
||||
if (HasFn() && !model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileName)))
|
||||
if (HasFn() && !model->HasHeaderEntity(STANDARD_TYPE(HeaderSection_FileName)))
|
||||
header.AddItem(fn);
|
||||
if (HasFs() && !model->HasHeaderEntity (STANDARD_TYPE(HeaderSection_FileSchema))) {
|
||||
if (HasFs() && !model->HasHeaderEntity(STANDARD_TYPE(HeaderSection_FileSchema))) {
|
||||
|
||||
// Schema defined? If not take it from the protocole
|
||||
// Schema defined? If not take it from the 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);
|
||||
schid = new Interface_HArray1OfHAsciiString(1, 1);
|
||||
fs->SetSchemaIdentifiers(schid);
|
||||
}
|
||||
if (!sch.IsNull()) { if (sch->Length() < 2) sch.Nullify(); } // not defined
|
||||
if (sch.IsNull()) {
|
||||
Handle(StepData_Protocol) stepro = Handle(StepData_Protocol)::DownCast
|
||||
( model->Protocol());
|
||||
if (!stepro.IsNull()) sch = new TCollection_HAsciiString
|
||||
(stepro->SchemaName(model->GetParam("write.step.schema")->IntegerValue()));
|
||||
if (!sch.IsNull()) schid->SetValue (1,sch);
|
||||
(model->Protocol());
|
||||
Handle(Interface_Static) aParam = model->GetParam("write.step.schema");
|
||||
if (!aParam.IsNull() && !stepro.IsNull())
|
||||
sch = new TCollection_HAsciiString(stepro->SchemaName(aParam->IntegerValue()));
|
||||
if (!sch.IsNull()) schid->SetValue(1, sch);
|
||||
}
|
||||
header.AddItem(fs);
|
||||
}
|
||||
@@ -179,12 +180,12 @@ void APIHeaderSection_MakeHeader::Apply
|
||||
// ========
|
||||
|
||||
Handle(StepData_StepModel) APIHeaderSection_MakeHeader::NewModel
|
||||
(const Handle(Interface_Protocol)& protocol) const
|
||||
(const Handle(Interface_Protocol)& protocol) const
|
||||
{
|
||||
Handle(StepData_StepModel) stepmodel = new StepData_StepModel;
|
||||
stepmodel->SetProtocol (protocol);
|
||||
stepmodel->SetProtocol(protocol);
|
||||
|
||||
// - Make Header information
|
||||
// - Make Header information
|
||||
|
||||
Apply(stepmodel);
|
||||
return stepmodel;
|
||||
@@ -197,7 +198,9 @@ Handle(StepData_StepModel) APIHeaderSection_MakeHeader::NewModel
|
||||
// ========
|
||||
|
||||
Standard_Boolean APIHeaderSection_MakeHeader::HasFn() const
|
||||
{ return (!fn.IsNull()); }
|
||||
{
|
||||
return (!fn.IsNull());
|
||||
}
|
||||
|
||||
Handle(HeaderSection_FileName) APIHeaderSection_MakeHeader::FnValue() const
|
||||
{
|
||||
@@ -208,23 +211,23 @@ Handle(HeaderSection_FileName) APIHeaderSection_MakeHeader::FnValue() const
|
||||
void APIHeaderSection_MakeHeader::SetNameFromShapeType(const Standard_Integer shapetype)
|
||||
{
|
||||
Handle(TCollection_HAsciiString) name;
|
||||
switch(shapetype)
|
||||
switch(shapetype)
|
||||
{
|
||||
case 1: // face_based_surface_model
|
||||
name = new TCollection_HAsciiString
|
||||
("Euclid Face Based Surface Model");
|
||||
("Euclid Face Based Surface Model");
|
||||
break;
|
||||
case 2: // manifold_solid_brep
|
||||
name = new TCollection_HAsciiString
|
||||
("Euclid Manifold Solid Brep Model");
|
||||
name = new TCollection_HAsciiString
|
||||
("Euclid Manifold Solid Brep Model");
|
||||
break;
|
||||
case 3: // facetted_brep
|
||||
name = new TCollection_HAsciiString
|
||||
("Euclid Facetted Brep Model");
|
||||
("Euclid Facetted Brep Model");
|
||||
break;
|
||||
default : // others ?
|
||||
name = new TCollection_HAsciiString
|
||||
("Euclid Shape Model");
|
||||
("Euclid Shape Model");
|
||||
break;
|
||||
}
|
||||
SetName(aName);
|
||||
@@ -233,106 +236,106 @@ void APIHeaderSection_MakeHeader::SetNameFromShapeType(const Standard_Integer sh
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetName(const Handle(TCollection_HAsciiString)& aName)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetName(aName);
|
||||
if (!fn.IsNull()) fn->SetName(aName);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::Name() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->Name());
|
||||
return (fn.IsNull() ? nulstr : fn->Name());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetTimeStamp(const Handle(TCollection_HAsciiString)& aTimeStamp)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetTimeStamp(aTimeStamp);
|
||||
if (!fn.IsNull()) fn->SetTimeStamp(aTimeStamp);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::TimeStamp() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->TimeStamp());
|
||||
return (fn.IsNull() ? nulstr : fn->TimeStamp());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetAuthor(const Handle(Interface_HArray1OfHAsciiString)& aAuthor)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetAuthor(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);
|
||||
if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num, aAuthor);
|
||||
}
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::Author() const
|
||||
{
|
||||
return (fn.IsNull() ? nularr : fn->Author());
|
||||
return (fn.IsNull() ? nularr : fn->Author());
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::AuthorValue(const Standard_Integer num) const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->AuthorValue(num));
|
||||
return (fn.IsNull() ? nulstr : fn->AuthorValue(num));
|
||||
}
|
||||
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbAuthor () const
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbAuthor() const
|
||||
{
|
||||
return (fn.IsNull() ? 0 : fn->NbAuthor());
|
||||
return (fn.IsNull() ? 0 : fn->NbAuthor());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetOrganization(const Handle(Interface_HArray1OfHAsciiString)& aOrganization)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetOrganization(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);
|
||||
if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num, aOrgan);
|
||||
}
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::Organization() const
|
||||
{
|
||||
return (fn.IsNull() ? nularr : fn->Organization());
|
||||
return (fn.IsNull() ? nularr : fn->Organization());
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::OrganizationValue(const Standard_Integer num) const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->OrganizationValue(num));
|
||||
return (fn.IsNull() ? nulstr : fn->OrganizationValue(num));
|
||||
}
|
||||
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbOrganization () const
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbOrganization() const
|
||||
{
|
||||
return (fn.IsNull() ? 0 : fn->NbOrganization());
|
||||
return (fn.IsNull() ? 0 : fn->NbOrganization());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetPreprocessorVersion(const Handle(TCollection_HAsciiString)& aPreprocessorVersion)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetPreprocessorVersion(aPreprocessorVersion);
|
||||
if (!fn.IsNull()) fn->SetPreprocessorVersion(aPreprocessorVersion);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::PreprocessorVersion() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->PreprocessorVersion());
|
||||
return (fn.IsNull() ? nulstr : fn->PreprocessorVersion());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetOriginatingSystem(const Handle(TCollection_HAsciiString)& aOriginatingSystem)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetOriginatingSystem(aOriginatingSystem);
|
||||
if (!fn.IsNull()) fn->SetOriginatingSystem(aOriginatingSystem);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::OriginatingSystem() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->OriginatingSystem());
|
||||
return (fn.IsNull() ? nulstr : fn->OriginatingSystem());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetAuthorisation(const Handle(TCollection_HAsciiString)& aAuthorisation)
|
||||
{
|
||||
if (!fn.IsNull()) fn->SetAuthorisation(aAuthorisation);
|
||||
if (!fn.IsNull()) fn->SetAuthorisation(aAuthorisation);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::Authorisation() const
|
||||
{
|
||||
return (fn.IsNull() ? nulstr : fn->Authorisation());
|
||||
return (fn.IsNull() ? nulstr : fn->Authorisation());
|
||||
}
|
||||
|
||||
// ===========
|
||||
@@ -340,7 +343,9 @@ Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::Authorisation() co
|
||||
// ===========
|
||||
|
||||
Standard_Boolean APIHeaderSection_MakeHeader::HasFs() const
|
||||
{ return (!fs.IsNull()); }
|
||||
{
|
||||
return (!fs.IsNull());
|
||||
}
|
||||
|
||||
Handle(HeaderSection_FileSchema) APIHeaderSection_MakeHeader::FsValue() const
|
||||
{
|
||||
@@ -349,29 +354,29 @@ Handle(HeaderSection_FileSchema) APIHeaderSection_MakeHeader::FsValue() const
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetSchemaIdentifiers(const Handle(Interface_HArray1OfHAsciiString)& aSchemaIdentifiers)
|
||||
{
|
||||
if (!fs.IsNull()) fs->SetSchemaIdentifiers(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);
|
||||
if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num, aSchem);
|
||||
}
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::SchemaIdentifiers() const
|
||||
{
|
||||
return (fs.IsNull() ? nularr : fs->SchemaIdentifiers());
|
||||
return (fs.IsNull() ? nularr : fs->SchemaIdentifiers());
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::SchemaIdentifiersValue(const Standard_Integer num) const
|
||||
{
|
||||
return (fs.IsNull() ? nulstr : fs->SchemaIdentifiersValue(num));
|
||||
return (fs.IsNull() ? nulstr : fs->SchemaIdentifiersValue(num));
|
||||
}
|
||||
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbSchemaIdentifiers () const
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbSchemaIdentifiers() const
|
||||
{
|
||||
return (fs.IsNull() ? 0 : fs->NbSchemaIdentifiers());
|
||||
return (fs.IsNull() ? 0 : fs->NbSchemaIdentifiers());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -381,24 +386,24 @@ Standard_Integer APIHeaderSection_MakeHeader::NbSchemaIdentifiers () const
|
||||
|
||||
void APIHeaderSection_MakeHeader::AddSchemaIdentifier(const Handle(TCollection_HAsciiString)& aSchem)
|
||||
{
|
||||
if ( fs.IsNull() ) fs = new HeaderSection_FileSchema;
|
||||
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;
|
||||
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) );
|
||||
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 );
|
||||
ids->SetValue(i, aSchem);
|
||||
|
||||
fs->SetSchemaIdentifiers(ids);
|
||||
}
|
||||
|
||||
// ================
|
||||
@@ -406,7 +411,9 @@ void APIHeaderSection_MakeHeader::AddSchemaIdentifier(const Handle(TCollection_H
|
||||
// ================
|
||||
|
||||
Standard_Boolean APIHeaderSection_MakeHeader::HasFd() const
|
||||
{ return (!fd.IsNull()); }
|
||||
{
|
||||
return (!fd.IsNull());
|
||||
}
|
||||
|
||||
Handle(HeaderSection_FileDescription) APIHeaderSection_MakeHeader::FdValue() const
|
||||
{
|
||||
@@ -415,37 +422,37 @@ Handle(HeaderSection_FileDescription) APIHeaderSection_MakeHeader::FdValue() con
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetDescription(const Handle(Interface_HArray1OfHAsciiString)& aDescription)
|
||||
{
|
||||
if (!fs.IsNull()) fd->SetDescription(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);
|
||||
if (num >= li->Lower() && num <= li->Upper()) li->SetValue(num, aDescr);
|
||||
}
|
||||
|
||||
Handle(Interface_HArray1OfHAsciiString) APIHeaderSection_MakeHeader::Description() const
|
||||
{
|
||||
return (fd.IsNull() ? nularr : fd->Description());
|
||||
return (fd.IsNull() ? nularr : fd->Description());
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::DescriptionValue(const Standard_Integer num) const
|
||||
{
|
||||
return (fd.IsNull() ? nulstr : fd->DescriptionValue(num));
|
||||
return (fd.IsNull() ? nulstr : fd->DescriptionValue(num));
|
||||
}
|
||||
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbDescription () const
|
||||
Standard_Integer APIHeaderSection_MakeHeader::NbDescription() const
|
||||
{
|
||||
return (fd.IsNull() ? 0 : fd->NbDescription());
|
||||
return (fd.IsNull() ? 0 : fd->NbDescription());
|
||||
}
|
||||
|
||||
void APIHeaderSection_MakeHeader::SetImplementationLevel(const Handle(TCollection_HAsciiString)& aImplementationLevel)
|
||||
{
|
||||
if (!fd.IsNull()) fd->SetImplementationLevel(aImplementationLevel);
|
||||
if (!fd.IsNull()) fd->SetImplementationLevel(aImplementationLevel);
|
||||
}
|
||||
|
||||
Handle(TCollection_HAsciiString) APIHeaderSection_MakeHeader::ImplementationLevel() const
|
||||
{
|
||||
return (fd.IsNull() ? nulstr : fd->ImplementationLevel());
|
||||
return (fd.IsNull() ? nulstr : fd->ImplementationLevel());
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@
|
||||
|
||||
Interface_FileReaderTool::Interface_FileReaderTool ()
|
||||
{
|
||||
//themessenger = Message::DefaultMessenger();
|
||||
themessenger = Message::DefaultMessenger();
|
||||
theerrhand = Standard_True;
|
||||
thetrace = 0;
|
||||
thenbrep0 = thenbreps = 0;
|
||||
|
@@ -1048,18 +1048,33 @@ Handle(TColStd_HSequenceOfHAsciiString) Interface_InterfaceModel::ListTemplates
|
||||
Handle(Interface_Static) Interface_InterfaceModel::GetParam
|
||||
(const Standard_CString theParamName)
|
||||
{
|
||||
if (IsEqual(theParamName, "write.step.schema"))
|
||||
/*if (IsEqual(theParamName, "write.step.schema"))
|
||||
{
|
||||
Handle(Standard_Transient) result;
|
||||
myParamMap.Find(theParamName, result);
|
||||
Standard_Integer anInt = Handle(Interface_Static)::DownCast(result)->IntegerValue();
|
||||
|
||||
}*/
|
||||
Handle(Interface_Static) aParam;
|
||||
if (myParamMap.IsBound(theParamName))
|
||||
{
|
||||
Handle(Standard_Transient) result;
|
||||
myParamMap.Find(theParamName, result);
|
||||
if (!result.IsNull())
|
||||
aParam = Handle(Interface_Static)::DownCast(result);
|
||||
}
|
||||
Handle(Standard_Transient) result;
|
||||
myParamMap.Find(theParamName, result);
|
||||
return Handle(Interface_Static)::DownCast(result);
|
||||
return aParam;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetParam
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void Interface_InterfaceModel::AddParam
|
||||
(const Standard_CString theParamName, Handle(Interface_Static)& theParam)
|
||||
{
|
||||
myParamMap.Bind(theParamName, theParam);
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AllParameters
|
||||
//purpose :
|
||||
|
@@ -402,6 +402,9 @@ public:
|
||||
//! Returns parameter for translation by its name
|
||||
Standard_EXPORT Handle(Interface_Static) GetParam(const Standard_CString theParamName);
|
||||
|
||||
//! Adds parameters in the mopdel
|
||||
Standard_EXPORT void AddParam(const Standard_CString theParamName, Handle(Interface_Static)& theParam);
|
||||
|
||||
//! Returns all available parameters for translation
|
||||
Standard_EXPORT const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& AllParameters();
|
||||
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include <Standard_Transient.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <Standard_Mutex.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Interface_Static,Interface_TypedValue)
|
||||
@@ -210,9 +211,13 @@ Standard_Boolean Interface_Static::InitValues(Handle(Interface_Static)& theStati
|
||||
Handle(Interface_Static) Interface_Static::Static
|
||||
(const Standard_CString name)
|
||||
{
|
||||
Handle(Standard_Transient) result;
|
||||
MoniTool_TypedValue::Stats().Find(name, result);
|
||||
return Handle(Interface_Static)::DownCast(result);
|
||||
static Standard_Mutex aPars;
|
||||
{
|
||||
Standard_Mutex::Sentry aLock(aPars);
|
||||
Handle(Standard_Transient) result;
|
||||
MoniTool_TypedValue::Stats().Find(name, result);
|
||||
return Handle(Interface_Static)::DownCast(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -110,8 +110,10 @@ void STEPConstruct_ContextTool::AddAPD (const Standard_Boolean enforce)
|
||||
{
|
||||
Standard_Boolean noapd = theAPD.IsNull();
|
||||
if (noapd || enforce) theAPD = new StepBasic_ApplicationProtocolDefinition;
|
||||
Handle(Interface_Static) aParam = (myModel->GetParam("write.step.schema"));
|
||||
Standard_Integer aShema = aParam.IsNull() ? 4 : aParam->IntegerValue();
|
||||
|
||||
switch (myModel->GetParam("write.step.schema")->IntegerValue()) { //j4
|
||||
switch (aShema) { //j4
|
||||
default:
|
||||
case 1:
|
||||
theAPD->SetApplicationProtocolYear (1997);
|
||||
@@ -147,7 +149,8 @@ void STEPConstruct_ContextTool::AddAPD (const Standard_Boolean enforce)
|
||||
if (theAPD->Application().IsNull())
|
||||
theAPD->SetApplication (new StepBasic_ApplicationContext);
|
||||
Handle(TCollection_HAsciiString) appl;
|
||||
switch (myModel->GetParam("write.step.schema")->IntegerValue()) { //j4
|
||||
|
||||
switch (aShema) { //j4
|
||||
default:
|
||||
case 1:
|
||||
case 2: appl = new TCollection_HAsciiString ( "core data for automotive mechanical design processes" );
|
||||
@@ -597,7 +600,9 @@ Handle(TColStd_HSequenceOfTransient) STEPConstruct_ContextTool::GetRootsForPart
|
||||
if ( ! SDRTool.PRPC().IsNull() ) seq->Append ( SDRTool.PRPC() );
|
||||
|
||||
// for AP203, add required product management data
|
||||
if (myModel->GetParam("write.step.schema")->IntegerValue() == 3 ) {
|
||||
Handle(Interface_Static) aParam = myModel->GetParam("write.step.schema");
|
||||
Standard_Integer aShema = aParam.IsNull() ? 4 : aParam->IntegerValue();
|
||||
if (aShema == 3 ) {
|
||||
theAP203.Init ( SDRTool );
|
||||
seq->Append (theAP203.GetProductCategoryRelationship());
|
||||
seq->Append (theAP203.GetCreator());
|
||||
@@ -625,7 +630,7 @@ Handle(TColStd_HSequenceOfTransient) STEPConstruct_ContextTool::GetRootsForAssem
|
||||
Handle(TColStd_HSequenceOfTransient) seq = new TColStd_HSequenceOfTransient;
|
||||
|
||||
seq->Append ( assembly.ItemValue() );
|
||||
|
||||
|
||||
// for AP203, write required product management data
|
||||
if ( myModel->GetParam("write.step.schema")->IntegerValue() == 3 ) {
|
||||
theAP203.Init ( assembly.GetNAUO() );
|
||||
|
@@ -73,7 +73,7 @@ STEPControl_Controller::STEPControl_Controller()
|
||||
|
||||
// initialization of Standard Shape Healing
|
||||
ShapeExtend::Init();
|
||||
|
||||
XSAlgo::Init();
|
||||
// init Standard Shape Processing operators
|
||||
ShapeProcess_OperLibrary::Init();
|
||||
}
|
||||
|
@@ -21,6 +21,8 @@
|
||||
#include <StepData_SelectNamed.hxx>
|
||||
#include <StepData_SelectReal.hxx>
|
||||
#include <StepData_SelectType.hxx>
|
||||
#include <StepData_UndefinedEntity.hxx>
|
||||
|
||||
|
||||
Standard_Boolean StepData_SelectType::Matches
|
||||
(const Handle(Standard_Transient)& ent) const
|
||||
@@ -35,6 +37,8 @@ Standard_Boolean StepData_SelectType::Matches
|
||||
void StepData_SelectType::SetValue (const Handle(Standard_Transient)& ent)
|
||||
{
|
||||
if (ent.IsNull()) thevalue.Nullify();
|
||||
else if (ent->IsKind(STANDARD_TYPE(StepData_UndefinedEntity)))
|
||||
thevalue = ent;
|
||||
else if (!Matches(ent))
|
||||
throw Standard_TypeMismatch("StepData : SelectType, SetValue");
|
||||
else thevalue = ent;
|
||||
|
@@ -45,6 +45,7 @@
|
||||
#include <TColStd_HSequenceOfReal.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
#include <TColStd_SequenceOfInteger.hxx>
|
||||
#include <StepData_UndefinedEntity.hxx>
|
||||
|
||||
#include <stdio.h>
|
||||
IMPLEMENT_STANDARD_RTTIEXT(StepData_StepReaderData,Interface_FileReaderData)
|
||||
@@ -1052,8 +1053,12 @@ Standard_Boolean StepData_StepReaderData::ReadEntity(const Standard_Integer num,
|
||||
warn = (acceptvoid > 0);
|
||||
if (nent > 0) {
|
||||
Handle(Standard_Transient) entent = BoundEntity(nent);
|
||||
if (entent.IsNull() || !entent->IsKind(atype))
|
||||
errmess = new String("Parameter n0.%d (%s) : Entity has illegal type");
|
||||
if (entent.IsNull() || !entent->IsKind(atype))
|
||||
{
|
||||
errmess = new String("Parameter n0.%d (%s) : Entity has illegal type");
|
||||
if (entent->IsKind(STANDARD_TYPE(StepData_UndefinedEntity)))
|
||||
ent = entent;
|
||||
}
|
||||
else ent = entent;
|
||||
}
|
||||
else errmess = new String("Parameter n0.%d (%s) : Unresolved reference");
|
||||
@@ -1096,8 +1101,13 @@ Standard_Boolean StepData_StepReaderData::ReadEntity(const Standard_Integer num,
|
||||
warn = (acceptvoid > 0);
|
||||
if (nent > 0) {
|
||||
Handle(Standard_Transient) entent = BoundEntity(nent);
|
||||
if (!sel.Matches(entent))
|
||||
errmess = new String("Parameter n0.%d (%s) : Entity has illegal type");
|
||||
if (!sel.Matches(entent))
|
||||
{
|
||||
errmess = new String("Parameter n0.%d (%s) : Entity has illegal type");
|
||||
//fot not suppported STEP entity
|
||||
if (entent->IsKind(STANDARD_TYPE(StepData_UndefinedEntity)))
|
||||
sel.SetValue(entent);
|
||||
}
|
||||
else
|
||||
sel.SetValue(entent);
|
||||
}
|
||||
|
@@ -64,6 +64,7 @@
|
||||
#include <XSAlgo_AlgoContainer.hxx>
|
||||
#include <XSAlgo_ToolContainer.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <Standard_Mutex.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(XSAlgo_AlgoContainer,Standard_Transient)
|
||||
|
||||
@@ -83,7 +84,8 @@ XSAlgo_AlgoContainer::XSAlgo_AlgoContainer()
|
||||
|
||||
void XSAlgo_AlgoContainer::PrepareForTransfer() const
|
||||
{
|
||||
UnitsMethods::SetCasCadeLengthUnit(getParam("xstep.cascade.unit")->IntegerValue());
|
||||
Handle(Interface_Static) aParam = getParam("xstep.cascade.unit");
|
||||
UnitsMethods::SetCasCadeLengthUnit(aParam.IsNull() ? 2 : aParam->IntegerValue());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -358,7 +360,8 @@ Standard_Boolean XSAlgo_AlgoContainer::CheckPCurve (const TopoDS_Edge& E,
|
||||
B.Range(edge,face,w1,w2);
|
||||
B.SameRange(edge, Standard_False );
|
||||
//:S4136
|
||||
Standard_Integer SPmode = getParam("read.stdsameparameter.mode")->IntegerValue();
|
||||
Handle(Interface_Static) aParam = getParam("read.stdsameparameter.mode");
|
||||
Standard_Integer SPmode = aParam.IsNull() ? 0 : aParam->IntegerValue();
|
||||
if ( SPmode )
|
||||
B.SameParameter (edge, Standard_False );
|
||||
|
||||
@@ -575,6 +578,7 @@ void XSAlgo_AlgoContainer::MergeTransferInfo(const Handle(Transfer_FinderProcess
|
||||
void XSAlgo_AlgoContainer::SetModel(Handle(Interface_InterfaceModel)& theModel)
|
||||
{
|
||||
myModel = theModel;
|
||||
initParameters();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -589,7 +593,48 @@ Handle(Interface_Static) XSAlgo_AlgoContainer::getParam
|
||||
aParam = myModel->GetParam(theParamName);
|
||||
|
||||
if (aParam.IsNull())
|
||||
aParam = Interface_Static::Static(theParamName);
|
||||
|
||||
{
|
||||
static Standard_Mutex aPars;
|
||||
{
|
||||
Standard_Mutex::Sentry aLock(aPars);
|
||||
aParam = Interface_Static::Static(theParamName);
|
||||
}
|
||||
}
|
||||
return aParam;
|
||||
}
|
||||
|
||||
void XSAlgo_AlgoContainer::initParameters()
|
||||
{
|
||||
if (myModel.IsNull())
|
||||
return;
|
||||
|
||||
Handle(Interface_Static) anItem = new Interface_Static("XSTEP", "read.stdsameparameter.mode", Interface_ParamEnum, "");
|
||||
Interface_Static::InitValues(anItem, "enum 0");
|
||||
Interface_Static::InitValues(anItem, "eval Off");
|
||||
Interface_Static::InitValues(anItem, "eval On");
|
||||
|
||||
anItem->SetCStringValue("Off");
|
||||
myModel->AddParam("read.stdsameparameter.mode", anItem);
|
||||
|
||||
// unit: supposed to be cascade unit (target unit for reading)
|
||||
anItem = new Interface_Static("XSTEP", "xstep.cascade.unit", Interface_ParamEnum, "");
|
||||
Interface_Static::Init("XSTEP", "xstep.cascade.unit", 'e', "");
|
||||
Interface_Static::InitValues(anItem, "enum 1");
|
||||
|
||||
|
||||
Interface_Static::Init("XSTEP", "xstep.cascade.unit", '&', "enum 1");
|
||||
Interface_Static::InitValues(anItem, "eval INCH"); // 1
|
||||
Interface_Static::InitValues(anItem, "eval MM"); // 2
|
||||
Interface_Static::InitValues(anItem, "eval ??"); // 3
|
||||
Interface_Static::InitValues(anItem, "eval FT"); // 4
|
||||
Interface_Static::InitValues(anItem, "eval MI"); // 5
|
||||
Interface_Static::InitValues(anItem, "eval M"); // 6
|
||||
Interface_Static::InitValues(anItem, "eval KM"); // 7
|
||||
Interface_Static::InitValues(anItem, "eval MIL"); // 8
|
||||
Interface_Static::InitValues(anItem, "eval UM"); // 9
|
||||
Interface_Static::InitValues(anItem, "eval CM"); //10
|
||||
Interface_Static::InitValues(anItem, "eval UIN"); //11
|
||||
anItem->SetCStringValue("MM");
|
||||
myModel->AddParam("xstep.cascade.unit", anItem);
|
||||
|
||||
}
|
||||
|
@@ -94,14 +94,14 @@ protected:
|
||||
//! First tries get it from non-static model,
|
||||
//! if failure get it from static map
|
||||
Standard_EXPORT Handle(Interface_Static) getParam(const Standard_CString theParamName) const;
|
||||
|
||||
void initParameters();
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Handle(XSAlgo_ToolContainer) myTC;
|
||||
Handle(Interface_InterfaceModel) myModel;
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user