]> OCCT Git - occt-copy.git/commitdiff
0029269: Improvement for thread safety of the STEP translator CR0-740-Hybrid_29269_1
authorgka <gka@opencascade.com>
Wed, 2 Aug 2017 08:36:05 +0000 (11:36 +0300)
committerskl <skl@opencascade.com>
Thu, 1 Oct 2020 16:32:05 +0000 (19:32 +0300)
Modification for loading a few STEP files in the model.
Protected by Mutex
1. Loading STEP file in the model with using yacc and lex.
2. Message management
3. Registration in static structure Interface_GeneralLib, Interface_ReaderLib, Interface_Writer_Lib for each StepData_Procotol.

Modifications:
STEPControl_Controller, STEPCAFControl_Controller were created as not static objects when STEPControl_Reader or STEP_Control_Writes were initialized.
Parameters used for translation from Interface::Static were made not static. Map to keep parameters was added in the Interface::InterfaceModel. For STEP translation parameters were initialized during initializing STEPData_STEPModel. model.
Static variables were removed.
Redundant classes were removed from STEP translator.

# Conflicts:
# src/RWStepVisual/RWStepVisual_RWPresentationLayerAssignment.cxx
# src/StepAP214/StepAP214_Protocol.cxx
# src/StepData/StepData_StepReaderData.cxx
# src/StepToTopoDS/StepToTopoDS_TranslateEdgeLoop.cxx
# tests/de/step_1/R9

102 files changed:
src/APIHeaderSection/APIHeaderSection_MakeHeader.cxx
src/HeaderSection/HeaderSection.cxx
src/HeaderSection/HeaderSection_Protocol.cxx
src/HeaderSection/HeaderSection_Protocol.hxx
src/IFSelect/IFSelect_ModelCopier.cxx
src/IFSelect/IFSelect_WorkSession.cxx
src/IFSelect/IFSelect_WorkSession.hxx
src/Interface/Interface_CheckTool.cxx
src/Interface/Interface_CheckTool.hxx
src/Interface/Interface_InterfaceModel.cxx
src/Interface/Interface_InterfaceModel.hxx
src/Interface/Interface_Static.cxx
src/Interface/Interface_Static.hxx
src/Message/Message.cxx
src/Message/Message_Messenger.cxx
src/Message/Message_Msg.cxx
src/Message/Message_MsgFile.cxx
src/QABugs/QABugs_11.cxx
src/RWHeaderSection/RWHeaderSection.cxx
src/RWHeaderSection/RWHeaderSection_ReadWriteModule.cxx
src/RWStepAP214/RWStepAP214.cxx
src/RWStepAP214/RWStepAP214.hxx
src/RWStepAP214/RWStepAP214_ReadWriteModule.cxx
src/RWStepAP214/RWStepAP214_ReadWriteModule.hxx
src/STEPCAFControl/STEPCAFControl_Controller.cxx
src/STEPCAFControl/STEPCAFControl_Controller.hxx
src/STEPCAFControl/STEPCAFControl_Reader.cxx
src/STEPCAFControl/STEPCAFControl_Reader.hxx
src/STEPCAFControl/STEPCAFControl_Writer.cxx
src/STEPCAFControl/STEPCAFControl_Writer.hxx
src/STEPConstruct/STEPConstruct_ContextTool.cxx
src/STEPConstruct/STEPConstruct_ContextTool.hxx
src/STEPConstruct/STEPConstruct_Part.cxx
src/STEPConstruct/STEPConstruct_Part.hxx
src/STEPConstruct/STEPConstruct_Styles.cxx
src/STEPConstruct/STEPConstruct_Styles.hxx
src/STEPConstruct/STEPConstruct_UnitContext.cxx
src/STEPConstruct/STEPConstruct_UnitContext.hxx
src/STEPConstruct/STEPConstruct_ValidationProps.cxx
src/STEPControl/STEPControl_ActorRead.cxx
src/STEPControl/STEPControl_ActorRead.hxx
src/STEPControl/STEPControl_ActorWrite.cxx
src/STEPControl/STEPControl_ActorWrite.hxx
src/STEPControl/STEPControl_Controller.cxx
src/STEPControl/STEPControl_Controller.hxx
src/STEPControl/STEPControl_Reader.cxx
src/STEPControl/STEPControl_Reader.hxx
src/STEPControl/STEPControl_Writer.cxx
src/STEPControl/STEPControl_Writer.hxx
src/STEPEdit/FILES
src/STEPEdit/STEPEdit.cxx [deleted file]
src/STEPEdit/STEPEdit.hxx [deleted file]
src/StepAP214/FILES
src/StepAP214/StepAP214.cxx [deleted file]
src/StepAP214/StepAP214.hxx [deleted file]
src/StepAP214/StepAP214_Protocol.cxx
src/StepAP214/StepAP214_Protocol.hxx
src/StepData/StepData.cxx
src/StepData/StepData.hxx
src/StepData/StepData_FileProtocol.cxx [deleted file]
src/StepData/StepData_FileProtocol.hxx [deleted file]
src/StepData/StepData_Protocol.cxx
src/StepData/StepData_Protocol.hxx
src/StepData/StepData_StepModel.cxx
src/StepData/StepData_StepModel.hxx
src/StepData/StepData_StepReaderData.cxx
src/StepData/StepData_StepReaderTool.hxx
src/StepFile/StepFile_Read.cxx
src/StepSelect/StepSelect_StepType.cxx
src/StepSelect/StepSelect_WorkLibrary.cxx
src/StepToGeom/StepToGeom.cxx
src/StepToTopoDS/StepToTopoDS_Builder.cxx
src/StepToTopoDS/StepToTopoDS_TranslateCompositeCurve.cxx
src/StepToTopoDS/StepToTopoDS_TranslateCurveBoundedSurface.cxx
src/StepToTopoDS/StepToTopoDS_TranslateEdgeLoop.cxx
src/StepToTopoDS/StepToTopoDS_TranslateFace.cxx
src/TopoDSToStep/TopoDSToStep_MakeBrepWithVoids.cxx
src/TopoDSToStep/TopoDSToStep_MakeFacetedBrep.cxx
src/TopoDSToStep/TopoDSToStep_MakeFacetedBrepAndBrepWithVoids.cxx
src/TopoDSToStep/TopoDSToStep_MakeGeometricCurveSet.cxx
src/TopoDSToStep/TopoDSToStep_MakeManifoldSolidBrep.cxx
src/TopoDSToStep/TopoDSToStep_MakeShellBasedSurfaceModel.cxx
src/TopoDSToStep/TopoDSToStep_MakeStepEdge.cxx
src/TopoDSToStep/TopoDSToStep_MakeStepFace.cxx
src/TopoDSToStep/TopoDSToStep_MakeStepVertex.cxx
src/TopoDSToStep/TopoDSToStep_Tool.cxx
src/TopoDSToStep/TopoDSToStep_Tool.hxx
src/XDEDRAW/XDEDRAW.cxx
src/XDEDRAW/XDEDRAW_Common.cxx
src/XSAlgo/XSAlgo_AlgoContainer.cxx
src/XSAlgo/XSAlgo_AlgoContainer.hxx
src/XSControl/XSControl_Controller.cxx
src/XSControl/XSControl_Controller.hxx
src/XSControl/XSControl_Functions.cxx
src/XSControl/XSControl_Reader.cxx
src/XSControl/XSControl_Reader.hxx
src/XSControl/XSControl_TransferReader.cxx
src/XSControl/XSControl_WorkSession.cxx
src/XSControl/XSControl_WorkSession.hxx
src/XSDRAWIGES/XSDRAWIGES.cxx
src/XSDRAWSTEP/XSDRAWSTEP.cxx
tests/bugs/xde/bug23597

index 1ce12440d2316f7189a34ddeafe51b18f7574442..68fc1b022878856ac6a0efe22ff9286423ab7d04 100644 (file)
@@ -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)
-{
-  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;
+(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)
+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());
-      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());
 }
index c31429e501413d6e57b249e568292c42bb226449..fe89a9b711cc52b22f93ff77e5de93ee4560cca4 100644 (file)
 #include <HeaderSection_Protocol.hxx>
 #include <Interface_Statics.hxx>
 
-StaticHandle(HeaderSection_Protocol, proto);
+//StaticHandle(HeaderSection_Protocol, proto);
 
 Handle(HeaderSection_Protocol) HeaderSection::Protocol()
 
-       {
-               InitHandleVoid(HeaderSection_Protocol, proto);
-               return proto;
-       }
+{
+               //InitHandleVoid(HeaderSection_Protocol, proto);
+  return new HeaderSection_Protocol;
+}
 
index c43908ce37e054557ba8ad97f1ed70932953623b..dc5403b507685c7468fb5d0ffc1622c421bbe923 100644 (file)
@@ -21,7 +21,7 @@
 
 IMPLEMENT_STANDARD_RTTIEXT(HeaderSection_Protocol,StepData_Protocol)
 
-static Standard_CString schemaName = "header_section";
+//static Standard_CString schemaName = "header_section";
 
 HeaderSection_Protocol::HeaderSection_Protocol () { }
 
@@ -35,5 +35,5 @@ Handle(Standard_Type)& atype) const
        else    return 0;
 }
 
-Standard_CString HeaderSection_Protocol::SchemaName() const
-       {       return schemaName; }
+Standard_CString HeaderSection_Protocol::SchemaName(Standard_Integer /*theShematype*/)
+       {       return "header_section"; }
index 4ee81ac65dcb4dbe19a693a54ec54cf5330b1b00..1adf6a27232e353615cc5df974c96d32b40038ec 100644 (file)
@@ -42,7 +42,7 @@ public:
   //! Returns a Case Number for each of the HeaderSection Entities
   Standard_EXPORT virtual Standard_Integer TypeNumber (const Handle(Standard_Type)& atype) const Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Standard_CString SchemaName() const Standard_OVERRIDE;
+  Standard_EXPORT virtual Standard_CString SchemaName(Standard_Integer theShematype) Standard_OVERRIDE;
 
 
 
index 9293082671042d478c9d169687cda1fce426051c..f54474e49575882c807f38a2b82b15fa3293c429 100644 (file)
@@ -264,8 +264,8 @@ IFSelect_ModelCopier::IFSelect_ModelCopier ()    {  }
 {
   Interface_CheckIterator checks;
   checks.SetName ("X-STEP WorkSession : Send All");
-  Message::DefaultMessenger() <<
-    "** WorkSession : Sending all data"<<Message_EndLine;
+  //Message::DefaultMessenger() <<
+  //  "** WorkSession : Sending all data"<<Message_EndLine;
   Handle(Interface_InterfaceModel)  model = G.Model();
   if (model.IsNull() || protocol.IsNull() || WL.IsNull()) return checks;
 
index e7992db1ba837229ce037218d61b894303764bc1..9ebcffaa95c3918299813baa262db3a14ff9d72b 100644 (file)
@@ -71,7 +71,6 @@
 #include <Interface_ReportEntity.hxx>
 #include <Interface_ShareFlags.hxx>
 #include <Interface_ShareTool.hxx>
-#include <Interface_Static.hxx>
 #include <Message.hxx>
 #include <Message_Messenger.hxx>
 #include <OSD_Path.hxx>
@@ -212,7 +211,7 @@ IFSelect_ReturnStatus  IFSelect_WorkSession::ReadFile
 {
   if (thelibrary.IsNull()) return IFSelect_RetVoid;
   if (theprotocol.IsNull()) return IFSelect_RetVoid;
-  Handle(Interface_InterfaceModel) model;
+  Handle(Interface_InterfaceModel) model =myModel;
   IFSelect_ReturnStatus status = IFSelect_RetVoid;
   try {
     OCC_CATCH_SIGNALS
@@ -1076,30 +1075,6 @@ Standard_Integer IFSelect_WorkSession::NextIdentForLabel
 //  #################################################################
 //  ....                Parametres (Int et Text)                ....
 
-//=======================================================================
-//function : 
-//purpose  : 
-//=======================================================================
-
-Handle(Standard_Transient) IFSelect_WorkSession::NewParamFromStatic
-  (const Standard_CString statname, const Standard_CString name)
-{
-  Handle(Standard_Transient) param;
-  Handle(Interface_Static) stat = Interface_Static::Static(statname);
-  if (stat.IsNull()) return param;
-  if (stat->Type() == Interface_ParamInteger) {
-    Handle(IFSelect_IntParam) intpar = new IFSelect_IntParam;
-    intpar->SetStaticName (statname);
-    param = intpar;
-  } else {
-    param = stat->HStringValue();
-  }
-  if (param.IsNull()) return param;
-  if ( AddNamedItem (name, param) == 0 ) param.Nullify();
-  return param;
-}
-
-
 //=======================================================================
 //function : 
 //purpose  : 
@@ -1701,11 +1676,12 @@ Standard_Integer IFSelect_WorkSession::RunTransformer
 {
   Standard_Integer effect = 0;
   if (transf.IsNull() || !IsLoaded()) return effect;
+  
   Handle(Interface_InterfaceModel) newmod;    // Null au depart
   Interface_CheckIterator checks;
   checks.SetName("X-STEP WorkSession : RunTransformer");
   Standard_Boolean res = transf->Perform
-    (thegraph->Graph(),theprotocol,checks,newmod);
+    (thegraph->Graph(),theprotocol,checks,myModel);
 
   if (!checks.IsEmpty(Standard_False)) {
     Handle(Message_Messenger) sout = Message::DefaultMessenger();
@@ -3055,7 +3031,7 @@ Handle(IFSelect_Selection) IFSelect_WorkSession::GiveSelection
   }
 
   Handle(IFSelect_Selection) sel;
-  if (np >= 0)
+  if (np >= 0) 
   {
     nomsel[np] = 0;
   }
index bd9748939d52064d01e89c2e7ee3215c23f14b4a..975d94d752d74cafe151de1c37f4e7e2b7d21a35 100644 (file)
@@ -407,13 +407,6 @@ public:
   //! - other values are ignored
   Standard_EXPORT Standard_Integer NextIdentForLabel (const Standard_CString label, const Standard_Integer id, const Standard_Integer mode = 0) const;
   
-  //! Creates a parameter as being bound to a Static
-  //! If the Static is Integer, this creates an IntParam bound to
-  //! it by its name. Else this creates a String which is the value
-  //! of the Static.
-  //! Returns a null handle if <statname> is unknown as a Static
-  Standard_EXPORT Handle(Standard_Transient) NewParamFromStatic (const Standard_CString statname, const Standard_CString name = "");
-  
   //! Returns an IntParam, given its Ident in the Session
   //! Null result if <id> is not suitable for an IntParam
   //! (undefined, or defined for another kind of variable)
index 1a136dff11845172c297990ffb77e5f6952dc4e3..5298d693781b827a5082cd95d6a0edf6a3664d09 100644 (file)
 #endif
 #include <stdio.h>
 
-static int errh = 1;
 
-
-static void raisecheck (Standard_Failure& theException,Handle(Interface_Check)& ach)
+void Interface_CheckTool::raisecheck (Standard_Failure& theException,Handle(Interface_Check)& ach)
 {
   char mess[100];
   sprintf (mess,"** Exception Raised during Check : %s **",
@@ -75,6 +73,7 @@ Interface_CheckTool::Interface_CheckTool(const Handle(Interface_InterfaceModel)&
        theshare (model,protocol)
 {
   thestat = 0;
+  errh = 1;
 }
 
 
@@ -88,6 +87,7 @@ Interface_CheckTool::Interface_CheckTool(const Handle(Interface_InterfaceModel)&
 {
   thestat = 0;
   thegtool->Reservate(model->NbEntities());
+  errh = 1;
 }
 
 
@@ -99,6 +99,7 @@ Interface_CheckTool::Interface_CheckTool(const Handle(Interface_InterfaceModel)&
 Interface_CheckTool::Interface_CheckTool(const Interface_Graph& graph)
      : thegtool(graph.Model()->GTool()) , theshare (graph)
 {
+  errh = 1;
 }
 
 
@@ -110,6 +111,7 @@ Interface_CheckTool::Interface_CheckTool(const Interface_Graph& graph)
 Interface_CheckTool::Interface_CheckTool(const Handle(Interface_HGraph)& hgraph)
      : thegtool(hgraph->Graph().Model()->GTool()) , theshare (hgraph)
 {
+  errh = 1;
 }
 
 
@@ -126,10 +128,10 @@ void Interface_CheckTool::FillCheck(const Handle(Standard_Transient)& ent,
   Standard_Integer CN;
   if (thegtool->Select(ent,module,CN)) {
 //    Sans try/catch (fait par l appelant, evite try/catch en boucle)
-    if (!errh) {
-      module->CheckCase(CN,ent,sh,ach);
-      return;
-    }
+    //if (!errh) {
+    //  module->CheckCase(CN,ent,sh,ach);
+    //  return;
+    //}
 //    Avec try/catch
     try {
       OCC_CATCH_SIGNALS
@@ -200,7 +202,7 @@ Handle(Interface_Check) Interface_CheckTool::Check(const Standard_Integer num)
   Handle(Interface_InterfaceModel) model = theshare.Model();
   Handle(Standard_Transient) ent = model->Value(num);
   Handle(Interface_Check) ach = new Interface_Check(ent);  // non filtre par "Warning" : tel quel
-  errh = 1;
+  //errh = 1;
   FillCheck(ent,theshare,ach);
   return ach;
 }
@@ -221,13 +223,13 @@ void Interface_CheckTool::CheckSuccess (const Standard_Boolean reset)
     ("Interface Model : Global Check");
   Handle(Interface_InterfaceModel) model = theshare.Model();
   if (model->GlobalCheck()->NbFails() > 0) throw Interface_CheckFailure("Interface Model : Global Check");
-  Handle(Interface_Check) modchk = new Interface_Check;
-  model->VerifyCheck(modchk);
-  if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),modchk);
-  if (modchk->HasFailed())  throw Interface_CheckFailure("Interface Model : Verify Check");
-  if (thestat == 3) return;                    // tout teste et ca passe
+  //Handle(Interface_Check) modchk = new Interface_Check;
+  //model->VerifyCheck(modchk);
+  //if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),modchk);
+  //if (modchk->HasFailed())  throw Interface_CheckFailure("Interface Model : Verify Check");
+  //if (thestat == 3) return;                    // tout teste et ca passe
 
-  errh = 0;  // Pas de try/catch, car justement on raise
+  //errh = 0;  // Pas de try/catch, car justement on raise
   Standard_Integer nb = model->NbEntities();
   for (Standard_Integer i = 1; i <= nb; i ++) {
     if (model->IsErrorEntity(i)) throw Interface_CheckFailure("Interface Model : an Entity is recorded as Erroneous");
@@ -262,13 +264,13 @@ Interface_CheckIterator Interface_CheckTool::CompleteCheckList ()
   Interface_CheckIterator res;
   res.SetModel(model);
   Handle(Interface_Check) globch = model->GlobalCheck();    // GlobalCheck Statique
-  if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),globch);
-  model->VerifyCheck(globch);                       // GlobalCheck Dynamique
-  if (globch->HasFailed() || globch->HasWarnings()) res.Add(globch,0);
-  if (globch->HasFailed()) thestat |= 12;
+  //if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),globch);
+  //model->VerifyCheck(globch);                       // GlobalCheck Dynamique
+  //if (globch->HasFailed() || globch->HasWarnings()) res.Add(globch,0);
+  //if (globch->HasFailed()) thestat |= 12;
 
   Standard_Integer i=0,n0 = 1, nb = model->NbEntities();
-  errh = 0;
+  //errh = 0;
   while (n0 <= nb) {
     Handle(Interface_Check) ach = new Interface_Check;
     Handle(Standard_Transient) ent;
@@ -316,11 +318,11 @@ Interface_CheckIterator Interface_CheckTool::CheckList ()
   res.SetModel(model);
   Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
   Handle(Interface_Check) globch = model->GlobalCheck();
-  if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),globch);
-  model->VerifyCheck(globch);
-  if (globch->HasFailed()) {  thestat |= 12;  res.Add(globch,0);  }
+  //if (!model->Protocol().IsNull()) model->Protocol()->GlobalCheck (theshare.Graph(),globch);
+  //model->VerifyCheck(globch);
+  //if (globch->HasFailed()) {  thestat |= 12;  res.Add(globch,0);  }
 
-  errh = 0;
+  //errh = 0;
   while (n0 <= nb) {
     Handle(Interface_Check) ach = new Interface_Check; 
     Handle(Standard_Transient) ent;
@@ -368,7 +370,7 @@ Interface_CheckIterator Interface_CheckTool::AnalyseCheckList ()
   res.SetModel(model);
   Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
 
-  errh = 0;
+  //errh = 0;
   while (n0 <= nb) {
     Handle(Interface_Check) ach = new Interface_Check;
     try {
@@ -408,7 +410,7 @@ Interface_CheckIterator Interface_CheckTool::VerifyCheckList ()
   res.SetModel(model);
   Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
 
-  errh = 0;
+  //errh = 0;
   while (n0 <= nb) {
     Handle(Standard_Transient) ent;
     Handle(Interface_Check) ach = new Interface_Check;
@@ -452,7 +454,7 @@ Interface_CheckIterator Interface_CheckTool::WarningCheckList ()
   res.SetModel(model);
   Standard_Integer i=0, n0 = 1, nb = model->NbEntities();
 
-  errh = 0;
+  //errh = 0;
   while (n0 <= nb) {
     Handle(Interface_Check) ach = new Interface_Check;
     Handle(Standard_Transient) ent;
index 663f628f08c78725ce2547846a83f91900507be2..101f8c5f013fa7968471db77fe165fb6365aa263 100644 (file)
@@ -131,10 +131,12 @@ protected:
 private:
 
 
+  Standard_EXPORT void raisecheck(Standard_Failure& theException, Handle(Interface_Check)& ach);
 
   Handle(Interface_GTool) thegtool;
   Interface_ShareTool theshare;
   Standard_Integer thestat;
+  Standard_Integer errh;
 
 
 };
index edfc3c23e883dd52b1bdea60851869ef2c598bca..a4e52cfc2194a52994ae6e6d3a6142dfea260ca4 100644 (file)
@@ -1040,3 +1040,75 @@ Handle(TColStd_HSequenceOfHAsciiString) Interface_InterfaceModel::ListTemplates
   }
   return list;
 }
+
+//=======================================================================
+//function : GetParam
+//purpose  : 
+//=======================================================================
+Handle(Interface_Static) Interface_InterfaceModel::GetParam
+(const Standard_CString theParamName) const
+{
+  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);
+  }
+  if (aParam.IsNull())
+  {
+#ifdef OCCT_DEBUG
+    cout << "Warning: Incorrect parameter :" << name << endl;
+#endif
+  }
+  return aParam;
+}
+
+//=======================================================================
+//function : GetParam
+//purpose  : 
+//=======================================================================
+void Interface_InterfaceModel::AddParam
+(const Standard_CString theParamName, Handle(Interface_Static)& theParam)
+{
+  myParamMap.Bind(theParamName, theParam);
+}
+//=======================================================================
+//function : AllParameters
+//purpose  : 
+//=======================================================================
+const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& Interface_InterfaceModel::AllParameters()
+{
+  return myParamMap;
+}
+
+//=======================================================================
+//function : IVal
+//purpose  : 
+//=======================================================================
+Standard_Integer Interface_InterfaceModel::IVal(const Standard_CString theParamName) const
+{
+  Handle(Interface_Static) aParam = GetParam(theParamName);
+  return (aParam.IsNull() ? 0 : aParam->IntegerValue());
+}
+
+//=======================================================================
+//function : RVal
+//purpose  : 
+//=======================================================================
+Standard_Real Interface_InterfaceModel::RVal(const Standard_CString theParamName) const
+{
+  Handle(Interface_Static) aParam = GetParam(theParamName);
+  return (aParam.IsNull() ? 0.0 : aParam->RealValue());
+}
+
+//=======================================================================
+//function : CVal
+//purpose  : 
+//=======================================================================
+Standard_CString Interface_InterfaceModel::CVal(const Standard_CString theParamName) const
+{
+  Handle(Interface_Static) aParam = GetParam(theParamName);
+  return (aParam.IsNull() ? "" : aParam->CStringValue());
+}
index e290857698b7b022e62bf705b763f5725bc2dad9..dee096511193466f5be373080811ef87b98b0eb6 100644 (file)
@@ -27,6 +27,7 @@
 #include <Standard_Type.hxx>
 #include <Standard_CString.hxx>
 #include <Interface_DataState.hxx>
+#include <Interface_Static.hxx>
 #include <TColStd_HSequenceOfHAsciiString.hxx>
 class Interface_Check;
 class TCollection_HAsciiString;
@@ -398,17 +399,27 @@ public:
   //! Returns the complete list of names attached to template models
   Standard_EXPORT static Handle(TColStd_HSequenceOfHAsciiString) ListTemplates();
 
+  //! Returns parameter for translation by its name
+  Standard_EXPORT Handle(Interface_Static) GetParam(const Standard_CString theParamName) const;
 
+  Standard_EXPORT Standard_Integer IVal(const Standard_CString theParamName) const;
+  Standard_EXPORT Standard_Real RVal(const Standard_CString theParamName) const;
+  Standard_EXPORT Standard_CString CVal(const Standard_CString theParamName) const;
+
+  //! 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();
 
   DEFINE_STANDARD_RTTIEXT(Interface_InterfaceModel,Standard_Transient)
 
 protected:
 
-  
   //! Defines empty InterfaceModel, ready to be filled
   Standard_EXPORT Interface_InterfaceModel();
 
-
+  NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> myParamMap;
 
 private:
 
index bc9dd50117ac02982bb1d6f56a5ce92e6ba4a039..d5ca6ddad31ae3a4fa7e0d0b62cbadc2a81782af 100644 (file)
@@ -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)
@@ -129,8 +130,6 @@ Standard_Boolean  Interface_Static::UpdatedStatus () const
   return theupdate;
 }
 
-
-
 //  #######################################################################
 //  #########    DICTIONNAIRE DES STATICS (static sur Static)    ##########
 
@@ -153,7 +152,6 @@ Standard_Boolean  Interface_Static::Init
   return Standard_True;
 }
 
-
 Standard_Boolean  Interface_Static::Init
   (const Standard_CString family,  const Standard_CString name,
    const Standard_Character type, const Standard_CString init)
@@ -170,30 +168,7 @@ Standard_Boolean  Interface_Static::Init
     case '&' : {
       Handle(Interface_Static) unstat = Interface_Static::Static(name);
       if (unstat.IsNull()) return Standard_False;
-//    Editions : init donne un petit texte d edition, en 2 termes "cmd var" :
-//  imin <ival>  imax <ival>  rmin <rval>  rmax <rval>  unit <def>
-//  enum <from>  ematch <from>  eval <cval>
-      Standard_Integer i,iblc = 0;
-      for (i = 0; init[i] != '\0'; i ++) if (init[i] == ' ') iblc = i+1;
-//  Reconnaissance du sous-cas et aiguillage
-      if      (init[0] == 'i' && init[2] == 'i')
-       unstat->SetIntegerLimit (Standard_False,atoi(&init[iblc]));
-      else if (init[0] == 'i' && init[2] == 'a')
-       unstat->SetIntegerLimit (Standard_True ,atoi(&init[iblc]));
-      else if (init[0] == 'r' && init[2] == 'i')
-       unstat->SetRealLimit (Standard_False,Atof(&init[iblc]));
-      else if (init[0] == 'r' && init[2] == 'a')
-       unstat->SetRealLimit (Standard_True ,Atof(&init[iblc]));
-      else if (init[0] == 'u')
-       unstat->SetUnitDef (&init[iblc]);
-      else if (init[0] == 'e' && init[1] == 'm')
-       unstat->StartEnum (atoi(&init[iblc]),Standard_True);
-      else if (init[0] == 'e' && init[1] == 'n')
-       unstat->StartEnum (atoi(&init[iblc]),Standard_False);
-      else if (init[0] == 'e' && init[1] == 'v')
-       unstat->AddEnum (&init[iblc]);
-      else return Standard_False;
-      return Standard_True;
+      return Interface_Static::InitValues(unstat, init);
     }
     default  : return Standard_False;
   }
@@ -205,13 +180,44 @@ Standard_Boolean  Interface_Static::Init
   return Standard_True;
 }
 
+Standard_Boolean Interface_Static::InitValues(Handle(Interface_Static)& theStatic, const Standard_CString init)
+{
+  //  Editions : init donne un petit texte d edition, en 2 termes "cmd var" :
+  //  imin <ival>  imax <ival>  rmin <rval>  rmax <rval>  unit <def>
+  //  enum <from>  ematch <from>  eval <cval>
+  Standard_Integer i, iblc = 0;
+  for (i = 0; init[i] != '\0'; i++) if (init[i] == ' ') iblc = i + 1;
+  //  Reconnaissance du sous-cas et aiguillage
+  if (init[0] == 'i' && init[2] == 'i')
+    theStatic->SetIntegerLimit(Standard_False, atoi(&init[iblc]));
+  else if (init[0] == 'i' && init[2] == 'a')
+    theStatic->SetIntegerLimit(Standard_True, atoi(&init[iblc]));
+  else if (init[0] == 'r' && init[2] == 'i')
+    theStatic->SetRealLimit(Standard_False, Atof(&init[iblc]));
+  else if (init[0] == 'r' && init[2] == 'a')
+    theStatic->SetRealLimit(Standard_True, Atof(&init[iblc]));
+  else if (init[0] == 'u')
+    theStatic->SetUnitDef(&init[iblc]);
+  else if (init[0] == 'e' && init[1] == 'm')
+    theStatic->StartEnum(atoi(&init[iblc]), Standard_True);
+  else if (init[0] == 'e' && init[1] == 'n')
+    theStatic->StartEnum(atoi(&init[iblc]), Standard_False);
+  else if (init[0] == 'e' && init[1] == 'v')
+    theStatic->AddEnum(&init[iblc]);
+  else return Standard_False;
+  return Standard_True;
+}
 
 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);
+  }
 }
 
 
index 15f1f0403b3a2011ad23396321a249271b5b58eb..8b87ebfe39214c15bc4ae6b65d9f19925393db52 100644 (file)
@@ -130,6 +130,9 @@ public:
   //! Returns False if <type> does not match this list
   Standard_EXPORT static Standard_Boolean Init (const Standard_CString family, const Standard_CString name, const Standard_Character type, const Standard_CString init = "");
   
+  //! Edit current <theStatic> with some parameter <init>
+  Standard_EXPORT static Standard_Boolean InitValues(Handle(Interface_Static)& theStatic, const Standard_CString init);
+  
   //! Returns a Static from its name. Null Handle if not present
   Standard_EXPORT static Handle(Interface_Static) Static (const Standard_CString name);
   
@@ -235,7 +238,7 @@ public:
   //! Returns False if <name> is not present
   Standard_EXPORT static Standard_Boolean IsUpdated (const Standard_CString name);
   
-  //! Returns a list of names of statics :
+  //! Returns a list of names of statics:
   //! <mode> = 0 (D) : criter is for family
   //! <mode> = 1 : criter is regexp on names, takes final items
   //! (ignore wild cards)
@@ -250,7 +253,8 @@ public:
   //!
   //! This allows for instance to set new values after having loaded
   //! or reloaded a resource, then to update them as required
-  Standard_EXPORT static Handle(TColStd_HSequenceOfHAsciiString) Items (const Standard_Integer mode = 0, const Standard_CString criter = "");
+  Standard_EXPORT static Handle(TColStd_HSequenceOfHAsciiString) Items (const Standard_Integer mode = 0,
+                                                                        const Standard_CString criter = "");
   
   //! Initializes all standard static parameters, which can be used
   //! by every function. statics specific of a norm or a function
index b540ae5fb291a83a530de83e54e994db0e7cd51b..74c3f258e3adc135f36f268c0e4614e732382476 100644 (file)
@@ -18,6 +18,7 @@
 #include <Message.hxx>
 #include <Message_Messenger.hxx>
 #include <TCollection_AsciiString.hxx>
+#include <Standard_Mutex.hxx>
 
 #include <stdio.h>
 #include <string.h>
@@ -27,6 +28,8 @@
 //=======================================================================
 const Handle(Message_Messenger)& Message::DefaultMessenger ()
 {
+  static Standard_Mutex aMutex;
+  Standard_Mutex::Sentry aLock(aMutex);
   static Handle(Message_Messenger) aMessenger = new Message_Messenger;
   return aMessenger;
 }
index 1e44c8b22088a0df17d6cb11cda947fa5e0a4451..4f9f4d79cdf775b51f80cd2e4477a3b1ab7c57e5 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <Message_Printer.hxx>
 #include <Message_PrinterOStream.hxx>
+#include <Standard_Mutex.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(Message_Messenger,Standard_Transient)
 
@@ -87,6 +88,8 @@ Standard_Boolean Message_Messenger::RemovePrinter (const Handle(Message_Printer)
 
 Standard_Integer Message_Messenger::RemovePrinters (const Handle(Standard_Type)& theType)
 {
+  static Standard_Mutex aMutex;
+  Standard_Mutex::Sentry aLock(aMutex);
   // remove printers from the list
   Standard_Integer nb = 0;
   for (Message_SequenceOfPrinters::Iterator aPrinterIter (myPrinters); aPrinterIter.More();)
index bbb6f3885f60833b5dd28f0f2086244fc56b083d..9a821d642212896ff52f041e41e0a048fea0b146 100644 (file)
@@ -17,6 +17,7 @@
 #include <Message_MsgFile.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <stdio.h>
+#include <Standard_Mutex.hxx>
 
 typedef enum
 {
@@ -26,6 +27,9 @@ typedef enum
   Msg_IndefiniteType
 } FormatType;
 
+// mutex used to prevent concurrent access to message registry
+static Standard_Mutex theMutex;
+
 //=======================================================================
 //function : Message_Msg()
 //purpose  : Constructor
@@ -42,6 +46,7 @@ Message_Msg::Message_Msg ()
 
 Message_Msg::Message_Msg (const Message_Msg& theMsg)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   myMessageBody = theMsg.myMessageBody;
   myOriginal = theMsg.myOriginal;
   for ( Standard_Integer i = 1, n = theMsg.mySeqOfFormats.Length(); i <=n; i++ )
@@ -55,6 +60,7 @@ Message_Msg::Message_Msg (const Message_Msg& theMsg)
 
 Message_Msg::Message_Msg (const Standard_CString theMsgCode)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   TCollection_AsciiString aKey((char*)theMsgCode);
   Set ( Message_MsgFile::Msg(aKey) );
 }
@@ -66,6 +72,7 @@ Message_Msg::Message_Msg (const Standard_CString theMsgCode)
 
 Message_Msg::Message_Msg (const TCollection_ExtendedString& theMsgCode)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   Set ( Message_MsgFile::Msg(theMsgCode) );
 }
 
@@ -76,6 +83,7 @@ Message_Msg::Message_Msg (const TCollection_ExtendedString& theMsgCode)
 
 void Message_Msg::Set (const Standard_CString theMsg)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   TCollection_AsciiString aMsg((char*)theMsg);
   Set ( aMsg );
 }
@@ -87,6 +95,7 @@ void Message_Msg::Set (const Standard_CString theMsg)
 
 void Message_Msg::Set (const TCollection_ExtendedString& theMsg)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   myMessageBody = theMsg;
 
   const Standard_ExtString anExtString = myMessageBody.ToExtString();
@@ -157,6 +166,7 @@ void Message_Msg::Set (const TCollection_ExtendedString& theMsg)
 
 Message_Msg& Message_Msg::Arg (const Standard_CString theString)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   // get location and format
   TCollection_AsciiString aFormat;
   Standard_Integer aFirst = getFormat ( Msg_StringType, aFormat );
@@ -184,6 +194,7 @@ Message_Msg& Message_Msg::Arg (const Standard_CString theString)
 
 Message_Msg& Message_Msg::Arg (const TCollection_ExtendedString& theString)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   // get location and format
   TCollection_AsciiString aFormat;
   Standard_Integer aFirst = getFormat ( Msg_StringType, aFormat );
@@ -203,6 +214,7 @@ Message_Msg& Message_Msg::Arg (const TCollection_ExtendedString& theString)
 
 Message_Msg& Message_Msg::Arg (const Standard_Integer theValue)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   // get location and format
   TCollection_AsciiString aFormat;
   Standard_Integer aFirst = getFormat ( Msg_IntegerType, aFormat );
@@ -227,6 +239,7 @@ Message_Msg& Message_Msg::Arg (const Standard_Integer theValue)
 
 Message_Msg& Message_Msg::Arg (const Standard_Real theValue)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   // get location and format
   TCollection_AsciiString aFormat;
   Standard_Integer aFirst = getFormat ( Msg_RealType, aFormat );
@@ -251,6 +264,7 @@ Message_Msg& Message_Msg::Arg (const Standard_Real theValue)
 
 const TCollection_ExtendedString& Message_Msg::Get ()
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   // remove all non-initialised format specifications
   Standard_Integer i, anIncrement = 0;
   static const TCollection_ExtendedString anUnknown ("UNKNOWN");
@@ -279,6 +293,7 @@ const TCollection_ExtendedString& Message_Msg::Get ()
 Standard_Integer Message_Msg::getFormat (const Standard_Integer theType,
                                          TCollection_AsciiString &theFormat)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   for (Standard_Integer i = 1; i <= mySeqOfFormats.Length(); i += 3)
     if (mySeqOfFormats(i) == theType)
     {
@@ -307,6 +322,7 @@ void Message_Msg::replaceText (const Standard_Integer theFirst,
                                const Standard_Integer theNb,
                                const TCollection_ExtendedString &theStr)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   myMessageBody.Remove ( theFirst, theNb );
   myMessageBody.Insert ( theFirst, theStr );
   
index 2c5deba4f402914fac0be245fe3346f547e38862..f4abced5388d07b914cfd5f7f231e5ec00f74bd0 100644 (file)
@@ -215,6 +215,7 @@ static Standard_Integer GetFileSize (FILE *theFile)
 
 Standard_Boolean Message_MsgFile::LoadFile (const Standard_CString theFileName)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   if (theFileName == NULL || * theFileName == '\0') return Standard_False;
 
   //    Open the file
@@ -279,6 +280,7 @@ Standard_Boolean Message_MsgFile::LoadFromEnv (const Standard_CString theEnvName
                                                const Standard_CString theFileName,
                                                const Standard_CString theLangExt)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   TCollection_AsciiString aLangExt (theLangExt != NULL ? theLangExt : "");
   if (aLangExt.IsEmpty())
   {
@@ -322,6 +324,7 @@ Standard_Boolean Message_MsgFile::LoadFromEnv (const Standard_CString theEnvName
 Standard_Boolean Message_MsgFile::LoadFromString (const Standard_CString theContent,
                                                   const Standard_Integer theLength)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   Standard_Integer aStringSize = theLength >= 0 ? theLength : (Standard_Integer )strlen (theContent);
   NCollection_Buffer aBuffer (NCollection_BaseAllocator::CommonBaseAllocator());
   if (aStringSize <= 0 || !aBuffer.Allocate (aStringSize + 2))
@@ -345,10 +348,8 @@ Standard_Boolean Message_MsgFile::LoadFromString (const Standard_CString theCont
 Standard_Boolean Message_MsgFile::AddMsg (const TCollection_AsciiString& theKeyword,
                                          const TCollection_ExtendedString&  theMessage)
 {
-  Message_DataMapOfExtendedString& aDataMap = ::msgsDataMap();
-
-  Standard_Mutex::Sentry aSentry (theMutex);
-  aDataMap.Bind (theKeyword, theMessage);
+  Standard_Mutex::Sentry aSentry(theMutex);
+  Message_DataMapOfExtendedString& aDataMap = ::msgsDataMap();  aDataMap.Bind (theKeyword, theMessage);
   return Standard_True;
 }
 
@@ -370,7 +371,8 @@ const TCollection_ExtendedString &Message_MsgFile::Msg (const Standard_CString t
 
 Standard_Boolean Message_MsgFile::HasMsg (const TCollection_AsciiString& theKeyword)
 {
-  Standard_Mutex::Sentry aSentry (theMutex);
+  Standard_Mutex::Sentry aSentry(theMutex);
+  
   return ::msgsDataMap().IsBound (theKeyword);
 }
 
@@ -381,9 +383,9 @@ Standard_Boolean Message_MsgFile::HasMsg (const TCollection_AsciiString& theKeyw
 
 const TCollection_ExtendedString &Message_MsgFile::Msg (const TCollection_AsciiString& theKeyword)
 {
+  Standard_Mutex::Sentry aSentry(theMutex);
   // find message in the map
   Message_DataMapOfExtendedString& aDataMap = ::msgsDataMap();
-  Standard_Mutex::Sentry aSentry (theMutex);
 
   // if message is not found, generate error message and add it to the map to minimize overhead
   // on consequent calls with the same key
index 983cc5a45f57457937b9b17004e199f7dbf165ac..f6a59202c4b1110141ecb7337e4f7f924c0923c0 100644 (file)
@@ -58,7 +58,6 @@
 #include <OSD_ThreadPool.hxx>
 #include <STEPCAFControl_Writer.hxx>
 #include <STEPControl_StepModelType.hxx>
-#include <Interface_Static.hxx>
 #include <IFSelect_ReturnStatus.hxx>
 #include <Standard_Failure.hxx>
 #include <TColgp_HArray1OfPnt2d.hxx>
@@ -91,6 +90,7 @@
 #include <BRepFeat_SplitShape.hxx>
 #include <BRepAlgoAPI_Section.hxx>
 #include <TColStd_PackedMapOfInteger.hxx>
+#include <StepData_StepModel.hxx>
 
 #if ! defined(_WIN32)
 extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
@@ -2561,10 +2561,13 @@ static Standard_Integer OCC7141 (Draw_Interpretor& di, Standard_Integer argc, co
   shapeTool = XCAFDoc_DocumentTool::ShapeTool(document->Main());
   shapeTool->AddShape(AddTestStructure(nCount), Standard_True);
   STEPControl_StepModelType mode = STEPControl_AsIs;
-  if (!Interface_Static::SetIVal("write.step.assembly",1)) { //assembly mode
+  Handle(StepData_StepModel) aModel =writer.ChangeWriter().Model();
+  Handle(Interface_Static) aParam = aModel->GetParam("write.step.assembly");
+  if (aParam.IsNull()) { //assembly mode
     di << "Failed to set assembly mode for step data\n\n";
     return 0;
   }
+  aParam->SetIntegerValue(1);
   try {
     OCC_CATCH_SIGNALS
     if( writer.Transfer(document, mode)) {
index b1d2f27262bf5087f5d6438d970000507a7528fb..65f875ceb27364579020921e0fde3e814acfbe72 100644 (file)
 /// #include <EuclidStandard.hxx>
 static Handle(RWHeaderSection_ReadWriteModule) rwm;
 static Handle(RWHeaderSection_GeneralModule) rwg;
+static int THE_RWHeaderSection_init = 0;
+
 
 
 void RWHeaderSection::Init()
 {
-///   EuclidStandard::Init();
-  Handle(HeaderSection_Protocol) proto = HeaderSection::Protocol();
+  Handle(HeaderSection_Protocol) proto = new HeaderSection_Protocol;
   StepData::AddHeaderProtocol(proto);
   if (rwm.IsNull()) rwm = new RWHeaderSection_ReadWriteModule;
   if (rwg.IsNull()) rwg = new RWHeaderSection_GeneralModule;
index 1ef5efcf5b233790b9e3e25c55582517e10c2308..4c303ae5a552ae48b92a584d136306ebc0863672 100644 (file)
 IMPLEMENT_STANDARD_RTTIEXT(RWHeaderSection_ReadWriteModule,StepData_ReadWriteModule)
 
 // -- General Declarations (Recognize, StepType) ---
-static TCollection_AsciiString PasReco("");    // neutralise StartEntity de SW
-static TCollection_AsciiString Reco_FileName ("FILE_NAME");
-static TCollection_AsciiString Reco_FileDescription ("FILE_DESCRIPTION");
-static TCollection_AsciiString Reco_FileSchema ("FILE_SCHEMA");
+TCollection_AsciiString PasReco("");    // neutralise StartEntity de SW
+TCollection_AsciiString Reco_FileName ("FILE_NAME");
+TCollection_AsciiString Reco_FileDescription ("FILE_DESCRIPTION");
+TCollection_AsciiString Reco_FileSchema ("FILE_SCHEMA");
 
        // -- Definition of the libraries --
 
index 66933632837cb6536d1e4bb4c48d9dd07361f4b6..862f721e589db4a52af319b4b02d8b345956ad71 100644 (file)
 #include <RWStepAP214.hxx>
 #include <RWStepAP214_GeneralModule.hxx>
 #include <RWStepAP214_ReadWriteModule.hxx>
-#include <StepAP214.hxx>
-#include <StepAP214_Protocol.hxx>
 #include <StepData_WriterLib.hxx>
+#include <Standard_Mutex.hxx>
 
 static int THE_RWStepAP214_init = 0;
 
-void RWStepAP214::Init()
+void RWStepAP214::Init(const Handle(StepAP214_Protocol)& theProto)
 {
-  if (THE_RWStepAP214_init)
+  static Standard_Mutex aPars;
   {
-    return;
+
+    if (THE_RWStepAP214_init)
+    {
+      return;
+    }
+    THE_RWStepAP214_init = 1;
+    RWHeaderSection::Init();
+    Interface_GeneralLib::SetGlobal(new RWStepAP214_GeneralModule, theProto);
+    Interface_ReaderLib::SetGlobal(new RWStepAP214_ReadWriteModule, theProto);
+    StepData_WriterLib::SetGlobal(new RWStepAP214_ReadWriteModule, theProto);
   }
-  THE_RWStepAP214_init = 1;
-  RWHeaderSection::Init();
-  Handle(StepAP214_Protocol) proto = StepAP214::Protocol();
-  Interface_GeneralLib::SetGlobal (new RWStepAP214_GeneralModule,proto);
-  Interface_ReaderLib::SetGlobal  (new RWStepAP214_ReadWriteModule,proto);
-  StepData_WriterLib::SetGlobal   (new RWStepAP214_ReadWriteModule,proto);
 }
index af59444314edfe550b898e34064c2ae0b1077f3d..eece0e0769a1fd2c3cc59845dfce9cd4ac09b4ef 100644 (file)
@@ -20,6 +20,7 @@
 #include <Standard.hxx>
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
+#include <StepAP214_Protocol.hxx>
 
 class RWStepAP214_ReadWriteModule;
 class RWStepAP214_GeneralModule;
@@ -60,7 +61,7 @@ public:
 
   
   //! enforced the initialisation of the  libraries
-  Standard_EXPORT static void Init();
+  Standard_EXPORT static void Init(const Handle(StepAP214_Protocol)& theProto);
 
 
 
index 5e4749acea4fa9c44ddd8f1ce5f2baadb0946dac..adbbe5723cd7666b21f6ee5fb496299ce407f85c 100644 (file)
@@ -2062,8 +2062,8 @@ static TCollection_AsciiString Reco_SurfaceStyleRenderingWithProperties("SURFACE
 
 // -- Definition of the libraries --
 
-static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> typenums;
-static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> typeshor;
+//static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> typenums;
+//static NCollection_DataMap<TCollection_AsciiString, Standard_Integer> typeshor;
 
 RWStepAP214_ReadWriteModule::RWStepAP214_ReadWriteModule ()
 {
index 75c02ceb21b21c67517906099bff85c453157ea4..bba05e987f0fde4a5a8c8915a242b128c02fa1e4 100644 (file)
@@ -24,7 +24,8 @@
 #include <Standard_Integer.hxx>
 #include <TColStd_SequenceOfAsciiString.hxx>
 #include <Standard_Boolean.hxx>
-class TCollection_AsciiString;
+#include <NCollection_DataMap.hxx>
+#include <TCollection_AsciiString.hxx>
 class StepData_StepReaderData;
 class Interface_Check;
 class Standard_Transient;
@@ -76,7 +77,8 @@ protected:
 
 private:
 
-
+  NCollection_DataMap<TCollection_AsciiString, Standard_Integer> typenums;
+  NCollection_DataMap<TCollection_AsciiString, Standard_Integer> typeshor;
 
 
 };
index 5e43b80697796d15b50d525964aef7de1d10423a..b6500bb33bf79cc330bea1f983892d9c1c0938dd 100644 (file)
@@ -13,8 +13,6 @@
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-
-#include <Interface_Static.hxx>
 #include <Standard_Type.hxx>
 #include <STEPCAFControl_ActorWrite.hxx>
 #include <STEPCAFControl_Controller.hxx>
@@ -31,55 +29,3 @@ STEPCAFControl_Controller::STEPCAFControl_Controller ()
   Handle(STEPCAFControl_ActorWrite) ActWrite = new STEPCAFControl_ActorWrite;
   myAdaptorWrite = ActWrite;
 }
-
-//=======================================================================
-//function : Init
-//purpose  : 
-//=======================================================================
-
-Standard_Boolean STEPCAFControl_Controller::Init ()
-{
-  static Standard_Boolean inic = Standard_False;
-  if (inic) return Standard_True;
-  inic = Standard_True;
-  // self-registering
-  Handle(STEPCAFControl_Controller) STEPCTL = new STEPCAFControl_Controller;
-  // do XSAlgo::Init, cause it does not called before.
-  XSAlgo::Init();
-  // do something to avoid warnings...
-  STEPCTL->AutoRecord();
-
-  //-----------------------------------------------------------
-  // Few variables for advanced control of translation process
-  //-----------------------------------------------------------
-
-  // Indicates whether to write sub-shape names to 'Name' attributes of
-  // STEP Representation Items
-  Interface_Static::Init   ("stepcaf", "write.stepcaf.subshapes.name", 'e', "");
-  Interface_Static::Init   ("stepcaf", "write.stepcaf.subshapes.name", '&', "enum 0");
-  Interface_Static::Init   ("stepcaf", "write.stepcaf.subshapes.name", '&', "eval Off"); // 0
-  Interface_Static::Init   ("stepcaf", "write.stepcaf.subshapes.name", '&', "eval On");  // 1
-  Interface_Static::SetIVal("write.stepcaf.subshapes.name", 0); // Disabled by default
-
-  // Indicates whether to read sub-shape names from 'Name' attributes of
-  // STEP Representation Items
-  Interface_Static::Init   ("stepcaf", "read.stepcaf.subshapes.name", 'e', "");
-  Interface_Static::Init   ("stepcaf", "read.stepcaf.subshapes.name", '&', "enum 0");
-  Interface_Static::Init   ("stepcaf", "read.stepcaf.subshapes.name", '&', "eval Off"); // 0
-  Interface_Static::Init   ("stepcaf", "read.stepcaf.subshapes.name", '&', "eval On");  // 1
-  Interface_Static::SetIVal("read.stepcaf.subshapes.name", 0); // Disabled by default
-
-  // STEP file encoding for names translation
-  // Note: the numbers should be consistent with Resource_FormatType enumeration
-  Interface_Static::Init ("step", "read.stepcaf.codepage", 'e', "");
-  Interface_Static::Init ("step", "read.stepcaf.codepage", '&', "enum 0");
-  Interface_Static::Init ("step", "read.stepcaf.codepage", '&', "eval SJIS");         // Resource_FormatType_SJIS
-  Interface_Static::Init ("step", "read.stepcaf.codepage", '&', "eval EUC");          // Resource_FormatType_EUC
-  Interface_Static::Init ("step", "read.stepcaf.codepage", '&', "eval ANSI");         // Resource_FormatType_ANSI
-  Interface_Static::Init ("step", "read.stepcaf.codepage", '&', "eval GB");           // Resource_FormatType_GB
-  Interface_Static::Init ("step", "read.stepcaf.codepage", '&', "eval UTF8");         // Resource_FormatType_UTF8
-  Interface_Static::Init ("step", "read.stepcaf.codepage", '&', "eval SystemLocale"); // Resource_FormatType_SystemLocale
-  Interface_Static::SetCVal ("read.stepcaf.codepage", "UTF8");
-
-  return Standard_True;
-}
index bf5e782e6ac8da9285f3b05a26d77020620ae717..3c3e82600ea6fdfd9237041f42ba431e02df7049 100644 (file)
@@ -38,13 +38,6 @@ public:
   
   //! Initializes the use of STEP Norm (the first time)
   Standard_EXPORT STEPCAFControl_Controller();
-  
-  //! Standard Initialisation. It creates a Controller for STEP-XCAF
-  //! and records it to various names, available to select it later
-  //! Returns True when done, False if could not be done
-  Standard_EXPORT static Standard_Boolean Init();
-
-
 
 
   DEFINE_STANDARD_RTTIEXT(STEPCAFControl_Controller,STEPControl_Controller)
index 487c991812241c15210effa64c3b2ee05f75a2f3..9ccc41d3312789cc6e111686e484e603c632d13c 100644 (file)
@@ -22,7 +22,6 @@
 #include <Interface_InterfaceModel.hxx>
 #include <StepData_StepModel.hxx>
 #include <HeaderSection_FileSchema.hxx>
-#include <Interface_Static.hxx>
 #include <NCollection_DataMap.hxx>
 #include <OSD_Path.hxx>
 #include <Quantity_Color.hxx>
@@ -329,7 +328,7 @@ STEPCAFControl_Reader::STEPCAFControl_Reader()
   myMatMode(Standard_True),
   myViewMode(Standard_True)
 {
-  STEPCAFControl_Controller::Init();
+  Init(new XSControl_WorkSession, new STEPCAFControl_Controller);
   mySourceCodePage = (Resource_FormatType )Interface_Static::IVal ("read.stepcaf.codepage");
 }
 
@@ -339,8 +338,8 @@ STEPCAFControl_Reader::STEPCAFControl_Reader()
 //purpose  : 
 //=======================================================================
 
-STEPCAFControl_Reader::STEPCAFControl_Reader(const Handle(XSControl_WorkSession)& WS,
-  const Standard_Boolean scratch)
+STEPCAFControl_Reader::STEPCAFControl_Reader (const Handle(XSControl_WorkSession)& theWS,
+                                              const Standard_Boolean theScratch)
 : mySourceCodePage (Resource_FormatType_UTF8),
   myColorMode(Standard_True),
   myNameMode(Standard_True),
@@ -351,9 +350,27 @@ STEPCAFControl_Reader::STEPCAFControl_Reader(const Handle(XSControl_WorkSession)
   myMatMode(Standard_True),
   myViewMode(Standard_True)
 {
-  STEPCAFControl_Controller::Init();
   mySourceCodePage = (Resource_FormatType )Interface_Static::IVal ("read.stepcaf.codepage");
-  Init(WS, scratch);
+  Init(theWS, new STEPCAFControl_Controller, theScratch);
+}
+
+//=======================================================================
+//function : STEPCAFControl_Reader
+//purpose  : 
+//=======================================================================
+STEPCAFControl_Reader::STEPCAFControl_Reader(const Handle(XSControl_WorkSession)& theWS,
+                                             const Handle(XSControl_Controller)& theController,
+                                             const Standard_Boolean theScratch) :
+       myColorMode(Standard_True),
+       myNameMode(Standard_True),
+       myLayerMode(Standard_True),
+       myPropsMode(Standard_True),
+       mySHUOMode(Standard_False),
+       myGDTMode(Standard_True),
+       myMatMode(Standard_True),
+       myViewMode(Standard_True)
+{
+  Init(theWS, theController, theScratch);
 }
 
 
@@ -362,11 +379,14 @@ STEPCAFControl_Reader::STEPCAFControl_Reader(const Handle(XSControl_WorkSession)
 //purpose  : 
 //=======================================================================
 
-void STEPCAFControl_Reader::Init(const Handle(XSControl_WorkSession)& WS,
-  const Standard_Boolean scratch)
+void STEPCAFControl_Reader::Init (const Handle(XSControl_WorkSession)& theWS,
+                                  const Handle(XSControl_Controller)& theController,
+                                  const Standard_Boolean theScratch)
 {
-  // necessary only in Writer, to set good actor:  WS->SelectNorm ( "STEP" );
-  myReader.SetWS(WS, scratch);
+  myCAFController = Handle(STEPCAFControl_Controller)::DownCast(theController);
+  STEPControl_Reader aReader(theWS, theController, theScratch);
+  myReader = aReader;
+
   myFiles.Clear();
 }
 
@@ -840,8 +860,7 @@ Handle(STEPCAFControl_ExternFile) STEPCAFControl_Reader::ReadExternFile(const St
 
   // create new WorkSession and Reader
   Handle(XSControl_WorkSession) newWS = new XSControl_WorkSession;
-  newWS->SelectNorm("STEP");
-  STEPControl_Reader sr(newWS, Standard_False);
+  STEPControl_Reader sr ( newWS, myCAFController, Standard_False );
 
   // start to fill the resulting ExternFile structure
   Handle(STEPCAFControl_ExternFile) EF = new STEPCAFControl_ExternFile;
@@ -4495,7 +4514,7 @@ void STEPCAFControl_Reader::ExpandSubShapes(const Handle(XCAFDoc_ShapeTool)& Sha
   TColStd_MapOfTransient aRepItems;
 
   // Read translation control variables
-  Standard_Boolean doReadSNames = (Interface_Static::IVal("read.stepcaf.subshapes.name") > 0);
+  Standard_Boolean doReadSNames = (myReader.Model()->IVal("read.stepcaf.subshapes.name") > 0);
 
   if (!doReadSNames)
     return;
index b37c05d7c66df52dfc43e8a80bbdb10b1094cbb9..0f976aaec8538f9e10199d9edf3a2994c446e1ff 100644 (file)
@@ -21,6 +21,7 @@
 #include <IFSelect_ReturnStatus.hxx>
 #include <TDF_LabelSequence.hxx>
 #include <TopTools_MapOfShape.hxx>
+#include <STEPCAFControl_Controller.hxx>
 #include <STEPCAFControl_DataMapOfShapePD.hxx>
 #include <STEPCAFControl_DataMapOfPDExternFile.hxx>
 #include <XCAFDoc_DataMapOfShapeLabel.hxx>
@@ -69,12 +70,15 @@ public:
   
   //! Creates a reader tool and attaches it to an already existing Session
   //! Clears the session if it was not yet set for STEP
-  Standard_EXPORT STEPCAFControl_Reader(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
-  
-  //! Clears the internal data structures and attaches to a new session
+  Standard_EXPORT STEPCAFControl_Reader(const Handle(XSControl_WorkSession)& theWS,
+                                        const Standard_Boolean theScratch = Standard_True);
+
+  //! Creates a reader tool and attaches it to an already existing Session and controller
   //! Clears the session if it was not yet set for STEP
-  Standard_EXPORT void Init (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
-  
+  Standard_EXPORT STEPCAFControl_Reader(const Handle(XSControl_WorkSession)& theWS,
+                                        const Handle(XSControl_Controller)& theController,
+                                        const Standard_Boolean theScratch = Standard_True);
+
   //! Loads a file and returns the read status
   //! Provided for use like single-file reader
   Standard_EXPORT IFSelect_ReturnStatus ReadFile (const Standard_CString filename);
@@ -174,7 +178,12 @@ public:
 
 protected:
 
-  
+
+  //! Inits a reader with following session and controller
+  Standard_EXPORT void Init(const Handle(XSControl_WorkSession)& theWS,
+                            const Handle(XSControl_Controller)& theController,
+                            const Standard_Boolean theScratch = Standard_True);
+
   //! Translates STEP file already loaded into the reader
   //! into the document
   //! If num==0, translates all roots, else only root number num
@@ -293,6 +302,7 @@ private:
   Standard_Boolean myMatMode;
   Standard_Boolean myViewMode;
   NCollection_DataMap<Handle(Standard_Transient), TDF_Label> myGDTMap;
+  Handle(STEPCAFControl_Controller) myCAFController;
 
 };
 
index df1971dfc42b2a9baeabb68e5a09175a6903b815..27cbdece0d0eead38d6bbc443277578366e49b20 100644 (file)
@@ -280,9 +280,7 @@ STEPCAFControl_Writer::STEPCAFControl_Writer () :
        myGDTMode  ( Standard_True ),
        myMatMode  ( Standard_True )
 {
-  STEPCAFControl_Controller::Init();
-  Handle(XSControl_WorkSession) WS = new XSControl_WorkSession;
-  Init ( WS );
+  Init(new XSControl_WorkSession, new STEPCAFControl_Controller);
 }
 
 
@@ -291,8 +289,8 @@ STEPCAFControl_Writer::STEPCAFControl_Writer () :
 //purpose  :
 //=======================================================================
 
-STEPCAFControl_Writer::STEPCAFControl_Writer (const Handle(XSControl_WorkSession)& WS,
-                                              const Standard_Boolean scratch) :
+STEPCAFControl_Writer::STEPCAFControl_Writer(const Handle(XSControl_WorkSession)& theWS,
+  const Standard_Boolean theScratch) :
   myColorMode(Standard_True),
   myNameMode(Standard_True),
   myLayerMode(Standard_True),
@@ -301,21 +299,40 @@ STEPCAFControl_Writer::STEPCAFControl_Writer (const Handle(XSControl_WorkSession
   myGDTMode(Standard_True),
   myMatMode(Standard_True)
 {
-  STEPCAFControl_Controller::Init();
-  Init ( WS, scratch );
+  Init(theWS, new STEPCAFControl_Controller, theScratch);
 }
 
+//=======================================================================
+//function : STEPCAFControl_Reader
+//purpose  : 
+//=======================================================================
+STEPCAFControl_Writer::STEPCAFControl_Writer(const Handle(XSControl_WorkSession)& theWS,
+  const Handle(XSControl_Controller)& theController,
+  const Standard_Boolean theScratch) :
+  myColorMode(Standard_True),
+  myNameMode(Standard_True),
+  myLayerMode(Standard_True),
+  myPropsMode(Standard_True),
+  mySHUOMode(Standard_True),
+  myGDTMode(Standard_True),
+  myMatMode(Standard_True)
+{
+  Init(theWS, theController, theScratch);
+}
 
 //=======================================================================
 //function : Init
 //purpose  :
 //=======================================================================
 
-void STEPCAFControl_Writer::Init (const Handle(XSControl_WorkSession)& WS,
-                                 const Standard_Boolean scratch)
+void STEPCAFControl_Writer::Init(const Handle(XSControl_WorkSession)& theWS,
+  const Handle(XSControl_Controller)& theController,
+  const Standard_Boolean theScratch)
 {
-  WS->SelectNorm ( "STEP" );
-  myWriter.SetWS (WS,scratch);
+  myCAFController = Handle(STEPCAFControl_Controller)::DownCast(theController);
+  STEPControl_Writer aWriter(theWS, theController, theScratch);
+  myWriter = aWriter;
+
   myFiles.Clear();
   myLabEF.Clear();
   myLabels.Clear();
@@ -510,7 +527,15 @@ Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer,
     Handle(STEPCAFControl_ActorWrite)::DownCast ( writer.WS()->NormAdaptor()->ActorWrite() );
 
   // translate free top-level shapes of the DECAF document
-  Standard_Integer ap = Interface_Static::IVal ("write.step.schema");
+
+
+  Handle(StepData_StepModel) aModel = writer.Model();
+
+  if (Actor.IsNull())
+  {
+    return Standard_False;
+  }
+  Standard_Integer ap = aModel->IVal("write.step.schema");
   TDF_LabelSequence sublabels;
   for ( Standard_Integer i=1; i <= labels.Length(); i++ ) {
     TDF_Label L = labels.Value(i);
@@ -585,7 +610,7 @@ Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer,
       // translate main assembly structure
 /*
       if ( ap == 3 ) { // if AP203, switch to AP214
-       Interface_Static::SetCVal ("write.step.schema", "AP214DIS");
+        myCAFController->GetParam("write.step.schema")->SetCStringValue("AP214DIS");
        Handle(StepData_StepModel) model = 
          Handle(StepData_StepModel)::DownCast ( writer.WS()->Model() );
        if ( model->HasHeaderEntity(STANDARD_TYPE(HeaderSection_FileSchema)) ) {
@@ -600,11 +625,22 @@ Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer,
        }
       }
 */      
-      Standard_Integer assemblymode = Interface_Static::IVal ("write.step.assembly");
-      Interface_Static::SetCVal ("write.step.assembly", "On");
+      Handle(Interface_Static) aParameter = aModel->GetParam("write.step.assembly");
+      Standard_Integer assemblymode = 0;
+      if (!aParameter.IsNull())
+      {
+        assemblymode = aParameter->IntegerValue();
+        aParameter->SetCStringValue("On");
+      }
       writer.Transfer ( Sass, STEPControl_AsIs );
-      Interface_Static::SetIVal ("write.step.assembly", assemblymode);
-      Interface_Static::SetIVal ("write.step.schema", ap);
+      if (!aParameter.IsNull())
+        aParameter->SetIntegerValue(assemblymode);
+      Handle(Interface_Static) aParamWriteSch = aModel->GetParam("write.step.schema");
+      if (!aParamWriteSch.IsNull())
+        aParamWriteSch->SetIntegerValue(ap);
+
+
+
     }
   }
 
@@ -656,12 +692,14 @@ Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer,
 
   // write validation props
 //  if ( multi && ap ==3 ) {
-//      Interface_Static::SetCVal ("write.step.schema", "AP214DIS");
+//       myCAFController->GetParam("write.step.schema")->SetCStringValue("AP214DIS");
 //  }
   if ( GetPropsMode() ) 
     WriteValProps ( writer.WS(), sublabels, multi );
 
-  Interface_Static::SetIVal ("write.step.schema", ap);
+  Handle(Interface_Static) aParam = aModel->GetParam("write.step.schema");
+  if (!aParam.IsNull())
+    aParam->SetIntegerValue(ap);
 
   // refresh graph
   writer.WS()->ComputeGraph ( Standard_True );
@@ -670,7 +708,8 @@ Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer,
     *  Write names for the sub-shapes
     * ================================ */
 
-  if (Interface_Static::IVal("write.stepcaf.subshapes.name") != 0)
+  
+  if (aModel->IVal("write.stepcaf.subshapes.name") != 0)
   {
     const Handle(XSControl_TransferWriter) &TW = this->ChangeWriter().WS()->TransferWriter();
     const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
@@ -759,11 +798,17 @@ TopoDS_Shape STEPCAFControl_Writer::TransferExternFiles (const TDF_Label &L,
     EF->SetWS ( newWS );
     EF->SetName ( name );
     EF->SetLabel ( L );
-    Standard_Integer assemblymode = Interface_Static::IVal ("write.step.assembly");
-    Interface_Static::SetCVal ("write.step.assembly", "Off");
+    Handle(Interface_Static) aParameter = sw.Model()->GetParam("write.step.assembly");
+    Standard_Integer assemblymode = 0;
+    if (!aParameter.IsNull())
+    {
+      assemblymode = aParameter->IntegerValue();
+      aParameter->SetCStringValue("Off");
+    }
     const Standard_CString multi = 0;
     EF->SetTransferStatus ( Transfer ( sw, Lseq, mode, multi, Standard_True ) );
-    Interface_Static::SetIVal ("write.step.assembly", assemblymode);
+    if (!aParameter.IsNull())
+      aParameter->SetIntegerValue(assemblymode);
     myLabEF.Bind ( L, EF );
     myFiles.Bind ( name->ToCString(), EF );
 
@@ -812,7 +857,7 @@ Standard_Boolean STEPCAFControl_Writer::WriteExternRefs (const Handle(XSControl_
   const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter();
   const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess();
   STEPConstruct_ExternRefs EFTool ( WS );
-  Standard_Integer schema = Interface_Static::IVal("write.step.schema");
+  Standard_Integer schema = WS->Model()->GetParam("write.step.schema")->IntegerValue();
   for ( Standard_Integer k=1; k <= labels.Length(); k++ ) {
     TDF_Label lab = labels(k);
     if ( XCAFDoc_ShapeTool::IsAssembly ( lab ) ) continue; // skip assemblies
@@ -1269,7 +1314,7 @@ Standard_Boolean STEPCAFControl_Writer::WriteColors (const Handle(XSControl_Work
         std::cerr << "Error: Current Top-Level shape have MDGPR already " << std::endl;
 #endif
       }
-      Styles.CreateMDGPR ( Context, aMDGPR );
+      Styles.CreateMDGPR(Context, aMDGPR, WS->Model());
       if (!aMDGPR.IsNull())
         myMapCompMDGPR.Bind( aTopSh, aMDGPR );
     }
@@ -1289,7 +1334,8 @@ Standard_Boolean STEPCAFControl_Writer::WriteColors (const Handle(XSControl_Work
         // search for MDGPR of the component top-level shape
         if ( myMapCompMDGPR.IsBound( aTopSh )) {
           aMDGPR = Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation)::DownCast( myMapCompMDGPR.Find( aTopSh ) );
-        } else {
+        }
+        else {
           aMDGPR = new StepVisual_MechanicalDesignGeometricPresentationRepresentation;
           Handle(TCollection_HAsciiString) ReprName = new TCollection_HAsciiString ( "" );
           aMDGPR->SetName( ReprName );
@@ -1919,7 +1965,7 @@ static Standard_Boolean createSHUOStyledItem (const XCAFPrs_Style& style,
     std::cout << "Warning: " << __FILE__ << ": Create new MDGPR for SHUO instance"  << std::endl;
 #endif
     Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation) aMDGPR;
-    Styles.CreateMDGPR ( Context, aMDGPR );
+    Styles.CreateMDGPR(Context, aMDGPR, WS->Model());
     if (!aMDGPR.IsNull())
       myMapCompMDGPR.Bind( aTopSh, aMDGPR );
   }
@@ -4304,3 +4350,13 @@ Standard_Boolean STEPCAFControl_Writer::GetMaterialMode() const
 {
   return myMatMode;
 }
+
+//=======================================================================
+//function : GetParam
+//purpose  : 
+//=======================================================================
+//Handle(Interface_Static) STEPCAFControl_Writer::GetParam
+//(const Standard_CString theParamName)
+//{
+//  return myWriter.Model()->GetParam(theParamName);
+//}
index 67ff328a344e20b4692755c706aff0884af441a3..7b52fad81ddb3930c2651be6001d89ca57eb9332 100644 (file)
@@ -21,6 +21,7 @@
 #include <Standard_Handle.hxx>
 
 #include <STEPControl_Writer.hxx>
+#include <STEPCAFControl_Controller.hxx>
 #include <STEPCAFControl_DataMapOfLabelShape.hxx>
 #include <STEPCAFControl_DataMapOfLabelExternFile.hxx>
 #include <Standard_Boolean.hxx>
@@ -64,15 +65,18 @@ public:
   //! PropsMode to Standard_True.
   Standard_EXPORT STEPCAFControl_Writer();
   
-  //! Creates a reader tool and attaches it to an already existing Session
+  //! Creates a writer tool and attaches it to an already existing Session
   //! Clears the session if it was not yet set for STEP
   //! Clears the internal data structures
-  Standard_EXPORT STEPCAFControl_Writer(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
-  
-  //! Clears the internal data structures and attaches to a new session
+  Standard_EXPORT STEPCAFControl_Writer(const Handle(XSControl_WorkSession)& WS,
+                                        const Standard_Boolean scratch = Standard_True);
+
+  //! Creates a writer tool and attaches it to an already existing Session and controller
   //! Clears the session if it was not yet set for STEP
-  Standard_EXPORT void Init (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
-  
+  Standard_EXPORT STEPCAFControl_Writer(const Handle(XSControl_WorkSession)& theWS,
+                                        const Handle(XSControl_Controller)& theController,
+                                        const Standard_Boolean theScratch = Standard_True);
+
   //! Writes all the produced models into file
   //! In case of multimodel with extern references,
   //! filename will be a name of root file, all other files
@@ -149,18 +153,33 @@ public:
   Standard_EXPORT void SetMaterialMode (const Standard_Boolean matmode);
   
   Standard_EXPORT Standard_Boolean GetMaterialMode() const;
+  
+  //! Returns parameter for translation by its name
+  //Standard_EXPORT Handle(Interface_Static) GetParam(const Standard_CString theParamName);
 
 
 
 
 protected:
+
+  //! Inits a reader with following session and controller
+  Standard_EXPORT void Init(const Handle(XSControl_WorkSession)& theWS,
+                            const Handle(XSControl_Controller)& theController,
+                            const Standard_Boolean theScratch = Standard_True);
+
   //! Mehod to writing sequence of root assemblies or part of the file specified by use by one label 
-  Standard_EXPORT Standard_Boolean Transfer (const TDF_LabelSequence& L, const STEPControl_StepModelType mode = STEPControl_AsIs, const Standard_CString multi = 0);
+  Standard_EXPORT Standard_Boolean Transfer (const TDF_LabelSequence& L,
+                                             const STEPControl_StepModelType mode = STEPControl_AsIs,
+                                             const Standard_CString multi = 0);
   
   //! Transfers labels to a STEP model
   //! Returns True if translation is OK
   //! isExternFile setting from TransferExternFiles method
-  Standard_EXPORT Standard_Boolean Transfer (STEPControl_Writer& wr, const TDF_LabelSequence& labels, const STEPControl_StepModelType mode = STEPControl_AsIs, const Standard_CString multi = 0, const Standard_Boolean isExternFile = Standard_False) ;
+  Standard_EXPORT Standard_Boolean Transfer (STEPControl_Writer& wr,
+                                             const TDF_LabelSequence& labels,
+                                             const STEPControl_StepModelType mode = STEPControl_AsIs,
+                                             const Standard_CString multi = 0,
+                                             const Standard_Boolean isExternFile = Standard_False) ;
   
   //! Parses assembly structure of label L, writes all the simple
   //! shapes each to its own file named by name of its label plus
@@ -168,7 +187,9 @@ protected:
   //! Returns shape representing that assembly structure
   //! in the form of nested empty compounds (and a sequence of
   //! labels which are newly written nodes of this assembly)
-  Standard_EXPORT TopoDS_Shape TransferExternFiles (const TDF_Label& L, const STEPControl_StepModelType mode, TDF_LabelSequence& Lseq, const Standard_CString prefix = "");
+  Standard_EXPORT TopoDS_Shape TransferExternFiles (const TDF_Label& L,
+                                                    const STEPControl_StepModelType mode,
+                                                    TDF_LabelSequence& Lseq, const Standard_CString prefix = "");
   
   //! Write external references to STEP
   Standard_EXPORT Standard_Boolean WriteExternRefs (const Handle(XSControl_WorkSession)& WS, const TDF_LabelSequence& labels) const;
@@ -237,6 +258,7 @@ private:
   Handle(StepVisual_DraughtingModel) myGDTPresentationDM;
   Handle(StepVisual_HArray1OfPresentationStyleAssignment) myGDTPrsCurveStyle;
   Handle(StepRepr_ProductDefinitionShape) myGDTCommonPDS;
+  Handle(STEPCAFControl_Controller) myCAFController;
 
 };
 
index 0b93e40b9eee964e3f7dd45a29b73f30fbcc09f0..d368c66c160e2a9b943ad2e3dd564bb46fd8320b 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <GeomToStep_MakeAxis2Placement3d.hxx>
 #include <Interface_Macros.hxx>
-#include <Interface_Static.hxx>
 #include <StepAP203_CcDesignApproval.hxx>
 #include <StepAP203_CcDesignDateAndTimeAssignment.hxx>
 #include <StepAP203_CcDesignPersonAndOrganizationAssignment.hxx>
@@ -75,13 +74,14 @@ STEPConstruct_ContextTool::STEPConstruct_ContextTool (const Handle(StepData_Step
 //purpose  :
 //=======================================================================
 
-void STEPConstruct_ContextTool::SetModel (const Handle(StepData_StepModel)& aStepModel)
+void STEPConstruct_ContextTool::SetModel (const Handle(Interface_InterfaceModel)& aStepModel)
 {
+  myModel = aStepModel;
   theAPD.Nullify();  //thePRPC.Nullify();
 
-  Standard_Integer i, nb = aStepModel->NbEntities();
+  Standard_Integer i, nb = myModel->NbEntities();
   for(i = 1; i<=nb && theAPD.IsNull(); i ++) {
-    Handle(Standard_Transient) ent = aStepModel->Value(i);
+    Handle(Standard_Transient) ent = myModel->Value(i);
     if (ent->IsKind(STANDARD_TYPE(StepBasic_ApplicationProtocolDefinition))) {
       if (theAPD.IsNull())  theAPD  = GetCasted(StepBasic_ApplicationProtocolDefinition, ent);
     }
@@ -111,7 +111,8 @@ void STEPConstruct_ContextTool::AddAPD (const Standard_Boolean enforce)
   Standard_Boolean noapd = theAPD.IsNull();
   if (noapd || enforce) theAPD  = new StepBasic_ApplicationProtocolDefinition;
 
-  switch (Interface_Static::IVal("write.step.schema")) { //j4
+  Standard_Integer aShema = myModel->IVal("write.step.schema");
+  switch (aShema) { //j4
   default:
   case 1:
     theAPD->SetApplicationProtocolYear (1997);
@@ -147,7 +148,8 @@ void STEPConstruct_ContextTool::AddAPD (const Standard_Boolean enforce)
   if (theAPD->Application().IsNull())
     theAPD->SetApplication (new StepBasic_ApplicationContext);
   Handle(TCollection_HAsciiString) appl;
-  switch (Interface_Static::IVal("write.step.schema")) { //j4
+  switch (aShema) { //j4
   default:
   case 1:
   case 2: appl = new TCollection_HAsciiString ( "core data for automotive mechanical design processes" );
@@ -356,7 +358,7 @@ void STEPConstruct_ContextTool::AddPRPC (const Standard_Boolean enforce)
   Standard_Boolean noprpc = thePRPC.IsNull();
   if (noprpc || enforce) {
     //:i3 abv 1 Sep 98: ProSTEP TR9: generate PRODUCT_TYPE (derived) instead of PRPC
-    switch (Interface_Static::IVal("write.step.schema")) { //j4
+    switch (myModel->GetParam("write.step.schema")->IntegerValue()) { //j4
     default:
     case 1:
       thePRPC = new StepBasic_ProductType;
@@ -567,8 +569,10 @@ void STEPConstruct_ContextTool::SetIndex (const Standard_Integer ind)
 Handle(TCollection_HAsciiString) STEPConstruct_ContextTool::GetProductName () const
 {
   Handle(TCollection_HAsciiString) PdtName;
-  if (Interface_Static::IsSet("write.step.product.name"))
-    PdtName = new TCollection_HAsciiString(Interface_Static::CVal("write.step.product.name"));
+
+  TCollection_AsciiString aName = myModel->CVal("write.step.product.name");
+  if(!aName.IsEmpty())
+    PdtName = new TCollection_HAsciiString(aName);
   else PdtName = new TCollection_HAsciiString("Product");
 
   for ( Standard_Integer i=1; i <= myLevel.Length(); i++ ) {
@@ -596,7 +600,7 @@ Handle(TColStd_HSequenceOfTransient) STEPConstruct_ContextTool::GetRootsForPart
   if ( ! SDRTool.PRPC().IsNull() ) seq->Append ( SDRTool.PRPC() );
 
   // for AP203, add required product management data
-  if ( Interface_Static::IVal("write.step.schema") == 3 ) {
+  if (myModel->IVal("write.step.schema") == 3 ) {
     theAP203.Init ( SDRTool );
     seq->Append (theAP203.GetProductCategoryRelationship());
     seq->Append (theAP203.GetCreator());
@@ -624,9 +628,8 @@ 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 ( Interface_Static::IVal("write.step.schema") == 3 ) {
+  if (myModel->IVal("write.step.schema") == 3 ) {
     theAP203.Init ( assembly.GetNAUO() );
     seq->Append (theAP203.GetSecurity());
     seq->Append (theAP203.GetClassificationOfficer());
index ed024587acb25a8a349fe960caa76b00aa5342b7..ae5b724e06fd8e0dd1e1d3b74b342044a4316a74 100644 (file)
@@ -21,6 +21,7 @@
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
+#include <Interface_InterfaceModel.hxx>
 #include <TColStd_SequenceOfInteger.hxx>
 #include <STEPConstruct_AP203Context.hxx>
 #include <Standard_Boolean.hxx>
@@ -55,7 +56,7 @@ public:
   
   //! Initialize ApplicationProtocolDefinition by the first
   //! entity of that type found in the model
-  Standard_EXPORT void SetModel (const Handle(StepData_StepModel)& aStepModel);
+  Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& aStepModel);
   
   Standard_EXPORT Handle(StepBasic_ApplicationProtocolDefinition) GetAPD();
   
@@ -141,6 +142,7 @@ private:
   Handle(StepBasic_ApplicationProtocolDefinition) theAPD;
   STEPConstruct_AP203Context theAP203;
   Handle(StepGeom_Axis2Placement3d) myAxis;
+  Handle(Interface_InterfaceModel) myModel;
 
 
 };
index 18b9ee1a42d4487c0170084bf4f4b48384fad903..21508b0e8585c1137b8ac387de0001aebd3b0cc8 100644 (file)
@@ -16,7 +16,6 @@
 //:j4 gka 16.03.99 S4134
 //    abv 20.11.99 renamed from StepPDR_SDRtool
 
-#include <Interface_Static.hxx>
 #include <StepBasic_ApplicationContext.hxx>
 #include <StepBasic_DesignContext.hxx>
 #include <StepBasic_HArray1OfProduct.hxx>
@@ -59,12 +58,13 @@ STEPConstruct_Part::STEPConstruct_Part()
 //purpose  : 
 //=======================================================================
 
-void STEPConstruct_Part::MakeSDR(const Handle(StepShape_ShapeRepresentation)& SR,
-                                const Handle(TCollection_HAsciiString)& aName,
-                                const Handle(StepBasic_ApplicationContext)& AC)
+void STEPConstruct_Part::MakeSDR(const Handle(StepShape_ShapeRepresentation)& theShape,
+                                 const Handle(TCollection_HAsciiString)& theName,
+                                 const Handle(StepBasic_ApplicationContext)& theAppContext,
+                                 const Handle(Interface_InterfaceModel)& theModel)
 {
   // get current schema
-  Standard_Integer schema = Interface_Static::IVal("write.step.schema");
+  Standard_Integer schema = theModel->IVal("write.step.schema"); 
   
   // create PC
   Handle(StepBasic_ProductContext) PC;
@@ -82,14 +82,14 @@ void STEPConstruct_Part::MakeSDR(const Handle(StepShape_ShapeRepresentation)& SR
   Handle(TCollection_HAsciiString) PCname = new TCollection_HAsciiString("");
   Handle(TCollection_HAsciiString) PCdisciplineType = 
     new TCollection_HAsciiString("mechanical");
-  PC->Init(PCname, AC, PCdisciplineType);
+  PC->Init(PCname, theAppContext, PCdisciplineType);
   
   // create product
   Handle(StepBasic_Product) P = new StepBasic_Product;
   Handle(StepBasic_HArray1OfProductContext) PCs = new StepBasic_HArray1OfProductContext(1,1);  
   PCs->SetValue(1,PC);
   Handle(TCollection_HAsciiString) Pdescription = new TCollection_HAsciiString("");
-  P->Init(aName, aName, Pdescription, PCs);
+  P->Init(theName, theName, Pdescription, PCs);
 
   // create PDF
   Handle(StepBasic_ProductDefinitionFormation) PDF;
@@ -123,7 +123,7 @@ void STEPConstruct_Part::MakeSDR(const Handle(StepShape_ShapeRepresentation)& SR
           break;
   }
   Handle(TCollection_HAsciiString) PDClifeCycleStage = new TCollection_HAsciiString("design");
-  PDC->Init(PDCname, AC, PDClifeCycleStage);
+  PDC->Init(PDCname, theAppContext, PDClifeCycleStage);
 
   // create PD
   Handle(StepBasic_ProductDefinition) PD = new StepBasic_ProductDefinition;
@@ -143,11 +143,12 @@ void STEPConstruct_Part::MakeSDR(const Handle(StepShape_ShapeRepresentation)& SR
   mySDR  = new StepShape_ShapeDefinitionRepresentation;
   StepRepr_RepresentedDefinition RD;
   RD.SetValue ( PDS );
-  mySDR->Init(RD, SR);
+  mySDR->Init(RD, theShape);
 
   // and an associated PRPC
   Handle(TCollection_HAsciiString) PRPCName;
-  switch (Interface_Static::IVal("write.step.schema")) {
+  
+  switch (schema) {
   default:
   case 1: 
     myPRPC = new StepBasic_ProductType; 
index c6aafd1488a7a64c43c8b55dd84850add684850e..d5ae99eaa245e0f52293a29e33748c3dbebc7c3e 100644 (file)
@@ -21,6 +21,7 @@
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
+#include <Interface_InterfaceModel.hxx>
 #include <Standard_Boolean.hxx>
 class StepShape_ShapeDefinitionRepresentation;
 class StepBasic_ProductRelatedProductCategory;
@@ -48,7 +49,10 @@ public:
   
   Standard_EXPORT STEPConstruct_Part();
   
-  Standard_EXPORT void MakeSDR (const Handle(StepShape_ShapeRepresentation)& aShape, const Handle(TCollection_HAsciiString)& aName, const Handle(StepBasic_ApplicationContext)& AC);
+  Standard_EXPORT void MakeSDR (const Handle(StepShape_ShapeRepresentation)& theShape,
+                                const Handle(TCollection_HAsciiString)& theName,
+                                const Handle(StepBasic_ApplicationContext)& theAppContext,
+                                const Handle(Interface_InterfaceModel)& theModel );
   
   Standard_EXPORT void ReadSDR (const Handle(StepShape_ShapeDefinitionRepresentation)& aShape);
   
index bbc5473bee4dcfd872a2884556f70636e134d8fc..8316b1bc46338285531c1e1d6019d04a1f83d044 100644 (file)
@@ -20,7 +20,6 @@
 #include <Interface_EntityIterator.hxx>
 #include <Interface_Graph.hxx>
 #include <Interface_InterfaceModel.hxx>
-#include <Interface_Static.hxx>
 #include <Quantity_Color.hxx>
 #include <StepBasic_MeasureValueMember.hxx>
 #include <STEPConstruct.hxx>
@@ -216,8 +215,9 @@ Handle(StepVisual_StyledItem) STEPConstruct_Styles::AddStyle (const TopoDS_Shape
 //purpose  : 
 //=======================================================================
 
-Standard_Boolean STEPConstruct_Styles::CreateMDGPR (const Handle(StepRepr_RepresentationContext) &Context,
-                                                    Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation)& Repr)
+Standard_Boolean STEPConstruct_Styles::CreateMDGPR (const Handle(StepRepr_RepresentationContext)& theContext,
+                                                    Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation)& theMDGPR,
+                                                    const Handle(Interface_InterfaceModel) theModel)
 {
   if ( myStyles.Extent() <1 ) return Standard_False;
   
@@ -227,15 +227,16 @@ Standard_Boolean STEPConstruct_Styles::CreateMDGPR (const Handle(StepRepr_Repres
   for ( Standard_Integer i=1; i <= myStyles.Extent(); i++ ) 
     elems->SetValue ( i, Handle(StepRepr_RepresentationItem)::DownCast ( myStyles.FindKey(i) ) );
   // create new MDGPR
-  Repr = new StepVisual_MechanicalDesignGeometricPresentationRepresentation;
+  theMDGPR = new StepVisual_MechanicalDesignGeometricPresentationRepresentation;
   Handle(TCollection_HAsciiString) ReprName = new TCollection_HAsciiString ( "" );
-  Repr->Init ( ReprName, elems, Context );
+  theMDGPR->Init ( ReprName, elems, theContext );
 
   // record Repr in order to have it written to the file
 //   Model()->AddWithRefs ( Repr ); add into the model upper
 
   // for AP203, add subschema name
-  if ( Interface_Static::IVal("write.step.schema") ==3 ) {
+  if ( theModel->IVal("write.step.schema") == 3 ) {
     APIHeaderSection_MakeHeader mkHdr ( Handle(StepData_StepModel)::DownCast ( Model() ) );
     Handle(TCollection_HAsciiString) subSchema = 
       new TCollection_HAsciiString ( "SHAPE_APPEARANCE_LAYER_MIM" );
index 6a92031f81f979931363c4d17df641e431f2a0de..f0318ffce1e49cb1e5f0f3759738635f89cef841 100644 (file)
@@ -21,6 +21,7 @@
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
+#include <Interface_InterfaceModel.hxx>
 #include <TColStd_IndexedDataMapOfTransientTransient.hxx>
 #include <TColStd_IndexedMapOfTransient.hxx>
 #include <TColStd_SequenceOfTransient.hxx>
@@ -93,7 +94,9 @@ public:
   
   //! Create MDGPR, fill it with all the styles previously defined,
   //! and add it to the model
-  Standard_EXPORT Standard_Boolean CreateMDGPR (const Handle(StepRepr_RepresentationContext)& Context, Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation)& MDGPR);
+  Standard_EXPORT Standard_Boolean CreateMDGPR (const Handle(StepRepr_RepresentationContext)& theContext,
+                                                Handle(StepVisual_MechanicalDesignGeometricPresentationRepresentation)& theMDGPR,
+                                                const Handle(Interface_InterfaceModel) theModel);
   
   //! Create MDGPR, fill it with all the styles previously defined,
   //! and add it to the model
index 461b0b1e3f42464f1f8c05e1d2f2fe34956223ee..97f1c47a931687fb7ea90ec3cf09faf35d5e9b69 100644 (file)
@@ -17,7 +17,6 @@
 //abv 17.11.99: renamed from StepPDR_MakeUnitAndToleranceContext and merged with STEPControl_Unit
 //abv 30.02.00: ability to write file in units other than MM
 
-#include <Interface_Static.hxx>
 #include <StepBasic_ConversionBasedUnit.hxx>
 #include <StepBasic_ConversionBasedUnitAndAreaUnit.hxx>
 #include <StepBasic_ConversionBasedUnitAndLengthUnit.hxx>
@@ -68,7 +67,8 @@ STEPConstruct_UnitContext::STEPConstruct_UnitContext() : done(Standard_False)
 //purpose  : 
 //=======================================================================
 
-void STEPConstruct_UnitContext::Init(const Standard_Real Tol3d) 
+void STEPConstruct_UnitContext::Init(const Standard_Real Tol3d,
+                                     Handle(Interface_InterfaceModel)& theModel)
 {
   done = Standard_True;
 
@@ -85,18 +85,19 @@ void STEPConstruct_UnitContext::Init(const Standard_Real Tol3d)
   Standard_CString uName = 0;
   Standard_Boolean hasPref = Standard_True;
   StepBasic_SiPrefix siPref = StepBasic_spMilli;
-  switch ( Interface_Static::IVal ( "write.step.unit" ) ) {
-  case  1 : uName = "INCH";             break;
-  default :
-  case  2 :                             break;
-  case  4 : uName = "FOOT";             break;
-  case  5 : uName = "MILE";             break;
-  case  6 : hasPref = Standard_False;   break;
-  case  7 : siPref = StepBasic_spKilo;  break;
-  case  8 : uName = "MIL";              break;
-  case  9 : siPref = StepBasic_spMicro; break;
-  case 10 : siPref = StepBasic_spCenti; break;
-  case 11 : uName = "MICROINCH";        break;
+  Standard_Integer valunits = theModel->IVal("write.step.unit");
+  switch (valunits) {
+    case  1: uName = "INCH";             break;
+    default:
+    case  2:                             break;
+    case  4: uName = "FOOT";             break;
+    case  5: uName = "MILE";             break;
+    case  6: hasPref = Standard_False;   break;
+    case  7: siPref = StepBasic_spKilo;  break;
+    case  8: uName = "MIL";              break;
+    case  9: siPref = StepBasic_spMicro; break;
+    case 10: siPref = StepBasic_spCenti; break;
+    case 11: uName = "MICROINCH";        break;
   }
   
   Handle(StepBasic_SiUnitAndLengthUnit) siUnit =
@@ -106,7 +107,7 @@ void STEPConstruct_UnitContext::Init(const Standard_Real Tol3d)
   if ( uName ) { // for non-metric units, create conversion_based_unit
     Handle(StepBasic_MeasureValueMember) val = new StepBasic_MeasureValueMember;
     val->SetName("LENGTH_UNIT");
-    val->SetReal ( UnitsMethods::GetLengthFactorValue ( Interface_Static::IVal ( "write.step.unit" ) ) );
+    val->SetReal(UnitsMethods::GetLengthFactorValue(valunits));
 
     Handle(StepBasic_LengthMeasureWithUnit) measure = new StepBasic_LengthMeasureWithUnit;
     StepBasic_Unit Unit;
index 5b53280cd070cc5428af8caffd7b5bec415a2ba5..67550ed89d6491205f874534a3c73bd70711af3b 100644 (file)
@@ -21,6 +21,7 @@
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
+#include <Interface_InterfaceModel.hxx>
 #include <Standard_Boolean.hxx>
 #include <Standard_Real.hxx>
 #include <Standard_Integer.hxx>
@@ -47,7 +48,8 @@ public:
   
   //! Creates new context (units are MM and radians,
   //! uncertainty equal to Tol3d)
-  Standard_EXPORT void Init (const Standard_Real Tol3d);
+  Standard_EXPORT void Init (const Standard_Real Tol3d,
+                             Handle(Interface_InterfaceModel)& theModel);
   
   //! Returns True if Init was called successfully
   Standard_EXPORT Standard_Boolean IsDone() const;
index 0ad3cf5f82bf18d690a4fd447521977649cadaec..f8c551ce4e6f8390e06cb252c925f372e4e498ae 100644 (file)
@@ -19,7 +19,6 @@
 #include <gp_Pnt.hxx>
 #include <Interface_EntityIterator.hxx>
 #include <Interface_Macros.hxx>
-#include <Interface_Static.hxx>
 #include <Message.hxx>
 #include <Message_Messenger.hxx>
 #include <StepBasic_DerivedUnit.hxx>
@@ -343,29 +342,30 @@ Standard_Boolean STEPConstruct_ValidationProps::AddProp (const StepRepr_Characte
   Handle(TCollection_HAsciiString) PropDefDescr = new TCollection_HAsciiString ( Descr );
   Handle(StepRepr_PropertyDefinition) propdef = new StepRepr_PropertyDefinition;
   propdef->Init ( PropDefName, Standard_True, PropDefDescr, target );
-                 
+
   Handle(TCollection_HAsciiString) SRName = new TCollection_HAsciiString ( Descr );
   Handle(StepRepr_Representation) rep = new StepRepr_Representation;
   Handle(StepRepr_HArray1OfRepresentationItem) SRItems = new StepRepr_HArray1OfRepresentationItem ( 1, 1 );
   SRItems->SetValue ( 1, Prop );
   rep->Init ( SRName, SRItems, Context );
-         
+
   Handle(StepRepr_PropertyDefinitionRepresentation) PrDR = new StepRepr_PropertyDefinitionRepresentation;
   StepRepr_RepresentedDefinition RD;
   RD.SetValue ( propdef );
   PrDR->Init ( RD, rep );
-         
+
   // record SDR in order to have it written to the file
   Model()->AddWithRefs ( PrDR );
 
   // for AP203, add subschema name
-  if ( Interface_Static::IVal("write.step.schema") ==3 ) {
-    APIHeaderSection_MakeHeader mkHdr ( Handle(StepData_StepModel)::DownCast ( Model() ) );
-    Handle(TCollection_HAsciiString) subSchema = 
-      new TCollection_HAsciiString ( "GEOMETRIC_VALIDATION_PROPERTIES_MIM" );
-    mkHdr.AddSchemaIdentifier ( subSchema );
+
+  if (Model()->IVal("write.step.schema") == 3) {
+    APIHeaderSection_MakeHeader mkHdr(Handle(StepData_StepModel)::DownCast(Model()));
+    Handle(TCollection_HAsciiString) subSchema =
+      new TCollection_HAsciiString("GEOMETRIC_VALIDATION_PROPERTIES_MIM");
+    mkHdr.AddSchemaIdentifier(subSchema);
   }
-  
+
   return Standard_True;
 }
 
index 37463e7e1de8ccdf3511a7428f9b51224f5138c0..2b88c0917084c76fc04a591fd28951110aa0ee4f 100644 (file)
@@ -27,7 +27,6 @@
 #include <Interface_Graph.hxx>
 #include <Interface_InterfaceModel.hxx>
 #include <Interface_Macros.hxx>
-#include <Interface_Static.hxx>
 #include <Message_Messenger.hxx>
 #include <Message_ProgressSentry.hxx>
 #include <OSD_Timer.hxx>
 #include <TransferBRep_ShapeBinder.hxx>
 #include <UnitsMethods.hxx>
 #include <XSAlgo.hxx>
-#include <XSAlgo_AlgoContainer.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(STEPControl_ActorRead,Transfer_ActorOfTransientProcess)
 
@@ -200,7 +198,10 @@ namespace {
 // Purpose : Empty constructor
 // ============================================================================
 
-STEPControl_ActorRead::STEPControl_ActorRead() {}
+STEPControl_ActorRead::STEPControl_ActorRead()
+{
+  myXSAlgoContainer = new XSAlgo_AlgoContainer;
+}
 
 // ============================================================================
 // Method  : STEPControl_ActorRead::Recognize
@@ -216,7 +217,7 @@ Standard_Boolean  STEPControl_ActorRead::Recognize
 
   if (start->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence))) return Standard_True;
 
-  TCollection_AsciiString aProdMode = Interface_Static::CVal("read.step.product.mode");
+  TCollection_AsciiString aProdMode = myModel->CVal("read.step.product.mode");
   if(!aProdMode.IsEqual("ON"))
     if(start->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) return Standard_True;
 
@@ -275,7 +276,7 @@ Handle(Transfer_Binder)  STEPControl_ActorRead::Transfer
  const Handle(Transfer_TransientProcess)& TP)
 {  
   // [BEGIN] Get version of preprocessor (to detect I-Deas case) (ssv; 23.11.2010)
-  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast ( TP->Model() );
+  Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
   Interface_EntityIterator anEntIt = aStepModel->Header();
   for ( anEntIt.Start(); anEntIt.More(); anEntIt.Next() ) {
     DeclareAndCast( HeaderSection_FileName, aFileNameEntity, anEntIt.Value() );
@@ -393,16 +394,16 @@ static void getListSDR(const Handle(StepRepr_ShapeAspect)& sa,
 //purpose  : Find all SDRs related to given PDS
 //=======================================================================
 
-static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
-                   Handle(TColStd_HSequenceOfTransient)& listSDR,
-                   Handle(TColStd_HSequenceOfTransient)& listNAUO,
-                   Handle(TColStd_HSequenceOfTransient)& listSDRAspect,
-                   const Handle(Transfer_TransientProcess)& TP)
+void STEPControl_ActorRead::getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
+                                   Handle(TColStd_HSequenceOfTransient)& listSDR,
+                                   Handle(TColStd_HSequenceOfTransient)& listNAUO,
+                                   Handle(TColStd_HSequenceOfTransient)& listSDRAspect,
+                                   const Handle(Transfer_TransientProcess)& TP)
 {
   // Flag indicating preferred shape representation type, to be chosen if 
   // several different representations are attached to the same shape
   Standard_Integer delta = 100;
-  Standard_Integer ICS = Interface_Static::IVal("read.step.shape.repr");
+  Standard_Integer ICS = myModel->IVal("read.step.shape.repr");
   Standard_Integer nbSDR0 = listSDR->Length();
   
   // Iterate by entities referring PDS
@@ -502,12 +503,12 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
   // Flag indicating whether SDRs associated with the product`s main SDR
   // by SRRs (which correspond to hybrid model representation in AP203 since 1998) 
   // should be taken into account 
-  Standard_Integer readSRR = Interface_Static::IVal("read.step.shape.relationship");
+  Standard_Integer readSRR = myModel->IVal("read.step.shape.relationship");
   
   // Flag indicating whether SDRs associated with the product`s main SDR
   // by SAs (which correspond to hybrid model representation in AP203 before 1998) 
   // should be taken into account 
-  Standard_Integer readSA = Interface_Static::IVal("read.step.shape.aspect");
+  Standard_Integer readSA = myModel->IVal("read.step.shape.aspect");
   if ( ! readSA ) 
     listSDRAspect->Clear();  
     
@@ -521,7 +522,7 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
   // possibly attached directly to intermediate assemblies (1)
   // Special mode (4) is used to translate shape attached to this product only,
   // ignoring sub-assemblies if any
-  Standard_Integer readAssembly = Interface_Static::IVal("read.step.assembly.level");
+  Standard_Integer readAssembly = myModel->IVal("read.step.assembly.level");
   if ( readAssembly ==3 || ( readAssembly ==2 && listNAUO->Length() >0 ) ) 
     listSDR->Clear();
   else if ( readAssembly == 4 )
@@ -757,7 +758,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
     return shbinder;
   isBound = Standard_False;
   Standard_Integer nb = sr->NbItems();
-  // Used in XSAlgo::AlgoContainer()->ProcessShape (ssv; 13.11.2010)
+  // Used in myXSAlgoContainer->ProcessShape (ssv; 13.11.2010)
   Standard_Integer nbTPitems = TP->NbMapped();
   Handle(Message_Messenger) sout = TP->Messenger();
   #ifdef TRANSLOG
@@ -777,7 +778,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
   Message_ProgressSentry PS ( TP->GetProgress(), "Sub-assembly", 0, nb, 1 );
 
   // [BEGIN] Proceed with non-manifold topology (ssv; 12.11.2010)
-  Standard_Boolean isNMMode = Interface_Static::IVal("read.step.nonmanifold") != 0;
+  Standard_Boolean isNMMode = myModel->IVal("read.step.nonmanifold") != 0;
   Standard_Boolean isManifold = Standard_True;
   if ( isNMMode && sr->IsKind(STANDARD_TYPE(StepShape_NonManifoldSurfaceShapeRepresentation)) ) {
     isManifold = Standard_False;
@@ -789,7 +790,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
   } 
   // Special processing for I-DEAS STP case (ssv; 15.11.2010)
   else {
-    Standard_Integer isIDeasMode = Interface_Static::IVal("read.step.ideas");
+    Standard_Integer isIDeasMode = myModel->IVal("read.step.ideas");
     if (isNMMode && myNMTool.IsIDEASCase() && isIDeasMode) {
       isManifold = Standard_False;
       NM_DETECTED = Standard_True;
@@ -829,18 +830,18 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
       nsh ++;
     }
   }
-
+  
   // [BEGIN] Proceed with non-manifold topology (ssv; 12.11.2010)
   if (!isManifold) {
 
     Handle(Standard_Transient) info;
     // IMPORTANT: any fixing on non-manifold topology must be done after the shape is transferred from STEP
     TopoDS_Shape fixedResult = 
-      XSAlgo::AlgoContainer()->ProcessShape( comp, myPrecision, myMaxTol,
-                                             "read.step.resource.name", 
-                                             "read.step.sequence", info,
+      myXSAlgoContainer->ProcessShape( comp, myPrecision, myMaxTol,
+                                       "read.step.resource.name", 
+                                       "read.step.sequence", info,
                                              TP->GetProgress(), Standard_True);
-    XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
+    myXSAlgoContainer->MergeTransferInfo(TP, info, nbTPitems);
 
     if (fixedResult.ShapeType() == TopAbs_COMPOUND)
     {
@@ -896,14 +897,14 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
     for (; exp.More(); exp.Next())
     {
         TopoDS_Shape aSubShape = exp.Current();
-        if (aSubShape.ShapeType() == TopAbs_SHELL && aSubShape.Closed()) {
-            TopoDS_Solid nextSolid;
-            brepBuilder.MakeSolid(nextSolid);
-            brepBuilder.Add(nextSolid, aSubShape);
-            brepBuilder.Add(reconstComp, nextSolid);
-        }
-        else if (aSubShape.ShapeType() == TopAbs_SHELL)
-            brepBuilder.Add(reconstComp, aSubShape);
+      if ( aSubShape.ShapeType() == TopAbs_SHELL && aSubShape.Closed() ) {
+        TopoDS_Solid nextSolid;
+        brepBuilder.MakeSolid(nextSolid);
+        brepBuilder.Add(nextSolid, aSubShape);
+        brepBuilder.Add(reconstComp, nextSolid);
+      } 
+      else if (aSubShape.ShapeType() == TopAbs_SHELL)
+        brepBuilder.Add(reconstComp, aSubShape);
     }
     comp = reconstComp;
     // [END] Reconstruct Solids from Closed Shells (ssv; 15.11.2010)
@@ -1191,7 +1192,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
       TP->AddWarning ( start, "Entity with no unit context; default units taken" );
       ResetUnits();
     }
-    else PrepareUnits ( context, TP );
+    else PrepareUnits(context, TP);
   }
   myShapeBuilder.SetPrecision(myPrecision);
   myShapeBuilder.SetMaxTol(myMaxTol);
@@ -1247,12 +1248,11 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
     // Apply ShapeFix (on manifold shapes only. Non-manifold topology is processed separately: ssv; 13.11.2010)
     if (isManifold) {
       Handle(Standard_Transient) info;
-      mappedShape = 
-        XSAlgo::AlgoContainer()->ProcessShape( mappedShape, myPrecision, myMaxTol,
-                                               "read.step.resource.name", 
-                                               "read.step.sequence", info,
-                                               TP->GetProgress() );
-      XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
+      mappedShape = myXSAlgoContainer->ProcessShape( mappedShape, myPrecision, myMaxTol,
+                                                     "read.step.resource.name", 
+                                                     "read.step.sequence", info,
+                                                     TP->GetProgress() );
+      myXSAlgoContainer->MergeTransferInfo(TP, info, nbTPitems);
     }
   }
   found = !mappedShape.IsNull();
@@ -1378,15 +1378,15 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
       TopoDS_Shape S = sb->Result();
 
       Handle(Standard_Transient) info;
-      TopoDS_Shape shape = XSAlgo::AlgoContainer()->ProcessShape(S, myPrecision, myMaxTol,
-        "read.step.resource.name",
-        "read.step.sequence", info,
-        TP->GetProgress());
-      //      TopoDS_Shape shape = XSAlgo::AlgoContainer()->PerformFixShape( S, TP, myPrecision, myMaxTol );
+      TopoDS_Shape shape = myXSAlgoContainer->ProcessShape(S, myPrecision, myMaxTol,
+                                                           "read.step.resource.name",
+                                                           "read.step.sequence", info,
+                                                           TP->GetProgress());
+      //TopoDS_Shape shape = myXSAlgoContainer->PerformFixShape( S, TP, myPrecision, myMaxTol );
       if (shape != S)
         sb->SetResult(shape);
 
-      XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
+      myXSAlgoContainer->MergeTransferInfo(TP, info, nbTPitems);
     }
 
 
@@ -1413,13 +1413,13 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(const Handle(Standa
                                                              const Standard_Boolean isManifold)
 {
   if (start.IsNull()) return NullResult();
-  XSAlgo::AlgoContainer()->PrepareForTransfer();
+  myXSAlgoContainer->PrepareForTransfer();
 
   Handle(Message_Messenger) sout = TP->Messenger();
 #ifdef TRANSLOG
 //  POUR MISE AU POINT, a supprimer ensuite
   if (TP->TraceLevel() > 1) 
-    sout<<" -- Actor : Transfer Ent.n0 "<<TP->Model()->Number(start)<<"  Type "<<start->DynamicType()->Name()<<Message_EndLine;
+    sout<<" -- Actor : Transfer Ent.n0 "<<myModel->Number(start)<<"  Type "<<start->DynamicType()->Name()<<Message_EndLine;
 #endif
   
   Handle(TransferBRep_ShapeBinder) shbinder;
@@ -1428,7 +1428,7 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(const Handle(Standa
   // Product Definition Entities
   // They should be treated with Design Manager
    // case ShapeDefinitionRepresentation if ProductMode != ON
-  TCollection_AsciiString aProdMode = Interface_Static::CVal("read.step.product.mode");
+  TCollection_AsciiString aProdMode = myModel->CVal("read.step.product.mode");
   if(!aProdMode.IsEqual("ON") && 
      start->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) 
     shbinder = OldWay(start,TP);
@@ -1549,7 +1549,7 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
 
   if (!theGUAC.IsNull()) {
     stat1 = myUnit.ComputeFactors(theGUAC);
-    Standard_Integer anglemode = Interface_Static::IVal("step.angleunit.mode");
+    Standard_Integer anglemode = myModel->IVal("step.angleunit.mode");
     Standard_Real angleFactor = ( anglemode == 0 ? myUnit.PlaneAngleFactor() :
                                  anglemode == 1 ? 1. : M_PI/180. );
     UnitsMethods::InitializeFactors(myUnit.LengthFactor(),
@@ -1564,15 +1564,15 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
   }
 
 //  myPrecision = Precision::Confusion();
-  if (Interface_Static::IVal("read.precision.mode") == 1)  //:i1 gka S4136 05.04.99
-    myPrecision = Interface_Static::RVal("read.precision.val");
+  if (myModel->IVal("read.precision.mode") == 1)  //:i1 gka S4136 05.04.99
+    myPrecision = myModel->RVal("read.precision.val");
   else if (myUnit.HasUncertainty())
     myPrecision = myUnit.Uncertainty() * myUnit.LengthFactor();
   else {
     TP->AddWarning(theRepCont,"No Length Uncertainty, value of read.precision.val is taken");
-    myPrecision = Interface_Static::RVal("read.precision.val");
+    myPrecision = myModel->RVal("read.precision.val");
   }
-  myMaxTol = Max ( myPrecision, Interface_Static::RVal("read.maxprecision.val") );
+  myMaxTol = Max ( myPrecision, myModel->RVal("read.maxprecision.val") );
   // Assign uncertainty
 #ifdef TRANSLOG
   if (TP->TraceLevel() > 1) 
@@ -1585,11 +1585,11 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
 //purpose  : 
 //=======================================================================
 
-void  STEPControl_ActorRead::ResetUnits ()
+void STEPControl_ActorRead::ResetUnits ()
 {
   UnitsMethods::InitializeFactors ( 1, 1, 1 );
-  myPrecision = Interface_Static::RVal("read.precision.val");
-  myMaxTol = Max ( myPrecision, Interface_Static::RVal("read.maxprecision.val") );
+  myPrecision = myModel->RVal("read.precision.val");
+  myMaxTol = Max ( myPrecision, myModel->RVal("read.maxprecision.val"));
 }
 
 //=======================================================================
@@ -1796,3 +1796,13 @@ void STEPControl_ActorRead::computeIDEASClosings(const TopoDS_Compound& comp,
       shellClosingsMap.Add(shellA, closingShells);
   }
 }
+
+//=======================================================================
+// Method  : SetModel
+// Purpose :
+//=======================================================================
+void STEPControl_ActorRead::SetModel(Handle(Interface_InterfaceModel)& theModel)
+{
+  myModel = theModel;
+  myXSAlgoContainer->SetModel(theModel);
+}
index 1ea04b90494564eb9fff8b41daac0b89a457335d..07e082bda715e33883fe07ca4d727e6abcbbd8c4 100644 (file)
 #include <Transfer_ActorOfTransientProcess.hxx>
 #include <Standard_Boolean.hxx>
 #include <Standard_Integer.hxx>
+#include <StepRepr_ProductDefinitionShape.hxx>
 #include <TopTools_ListOfShape.hxx>
 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <XSAlgo_AlgoContainer.hxx>
 class StepRepr_Representation;
 class Standard_Transient;
 class Transfer_Binder;
@@ -75,6 +77,9 @@ public:
   //! reset units and tolerances context to default
   //! (mm, radians, read.precision.val, etc.)
   Standard_EXPORT void ResetUnits();
+
+  //! Sets step model for translations
+  Standard_EXPORT void SetModel(Handle(Interface_InterfaceModel)& theModel);
   
   //! Computes transformation defined by two axis placements (in MAPPED_ITEM
   //! or ITEM_DEFINED_TRANSFORMATION) taking into account their
@@ -130,10 +135,18 @@ private:
   
   Standard_EXPORT void computeIDEASClosings (const TopoDS_Compound& comp, TopTools_IndexedDataMapOfShapeListOfShape& shellClosingMap);
 
+  Standard_EXPORT void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
+                              Handle(TColStd_HSequenceOfTransient)& listSDR,
+                              Handle(TColStd_HSequenceOfTransient)& listNAUO,
+                              Handle(TColStd_HSequenceOfTransient)& listSDRAspect,
+                              const Handle(Transfer_TransientProcess)& TP);
+
   StepToTopoDS_NMTool myNMTool;
   Standard_Real myPrecision;
   Standard_Real myMaxTol;
   Handle(StepRepr_Representation) mySRContext;
+  Handle(XSAlgo_AlgoContainer) myXSAlgoContainer;
+  Handle(Interface_InterfaceModel) myModel;
 
 
 };
index 6a6ee5b3513934d776e39e41cc22eab49fad186e..d1fcabf80f344d40ea5ba65b3d0bd254c5b8e7ef 100644 (file)
@@ -28,7 +28,6 @@
 #include <gp_Ax2.hxx>
 #include <Interface_Macros.hxx>
 #include <Interface_MSG.hxx>
-#include <Interface_Static.hxx>
 #include <MoniTool_DataMapOfShapeTransient.hxx>
 #include <OSD_Timer.hxx>
 #include <ShapeAnalysis_ShapeTolerance.hxx>
@@ -44,7 +43,6 @@
 #include <STEPConstruct_UnitContext.hxx>
 #include <STEPControl_ActorWrite.hxx>
 #include <STEPControl_StepModelType.hxx>
-#include <StepData_StepModel.hxx>
 #include <StepGeom_Axis2Placement3d.hxx>
 #include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx>
 #include <StepGeom_Point.hxx>
 #include <TransferBRep_ShapeMapper.hxx>
 #include <UnitsMethods.hxx>
 #include <XSAlgo.hxx>
-#include <XSAlgo_AlgoContainer.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(STEPControl_ActorWrite,Transfer_ActorOfFinderProcess)
 
@@ -230,7 +227,8 @@ static Standard_Boolean IsManifoldShape(const TopoDS_Shape& theShape) {
 STEPControl_ActorWrite::STEPControl_ActorWrite ()
 : mygroup (0) , mytoler (-1.)
 {  
-  SetMode(STEPControl_ShellBasedSurfaceModel);  
+  SetMode(STEPControl_ShellBasedSurfaceModel);
+  myXSAlgoContainer = new XSAlgo_AlgoContainer;
 }
 
 //=======================================================================
@@ -344,9 +342,10 @@ STEPControl_StepModelType STEPControl_ActorWrite::Mode () const
 //purpose  : 
 //=======================================================================
 
-void STEPControl_ActorWrite::SetGroupMode (const Standard_Integer mode)
-{  
-  if (mode >= 0) mygroup = mode;  
+void STEPControl_ActorWrite::SetGroupMode (const Standard_CString theParameter)
+{
+  Standard_Integer aMode = myModel->IVal(theParameter);
+  if (aMode >= 0) mygroup = aMode;
 }
 
 //=======================================================================
@@ -448,7 +447,7 @@ Standard_Boolean  STEPControl_ActorWrite::Recognize (const Handle(Transfer_Finde
 Handle(Transfer_Binder) STEPControl_ActorWrite::Transfer (const Handle(Transfer_Finder)& start,
                                                           const Handle(Transfer_FinderProcess)& FP)
 {
-  XSAlgo::AlgoContainer()->PrepareForTransfer();
+  myXSAlgoContainer->PrepareForTransfer();
     
   Handle(TransferBRep_ShapeMapper) mapper = Handle(TransferBRep_ShapeMapper)::DownCast(start);
 
@@ -456,20 +455,19 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::Transfer (const Handle(Transfer_
   TopoDS_Shape shape = mapper->Value();
 
   // init context
-  Handle(StepData_StepModel) model = Handle(StepData_StepModel)::DownCast ( FP->Model() );
-  if ( ! model.IsNull() ) myContext.SetModel ( model ); //: abv 04.11.00: take APD from model
+  if ( ! myModel.IsNull() ) myContext.SetModel (myModel); //: abv 04.11.00: take APD from model
   myContext.AddAPD ( Standard_False ); // update APD
   myContext.SetLevel ( 1 ); // set assembly level to 1 (to ensure)
   
   //:S4136: init UnitsMethods to reset angle unit factors (see TopoDSToStep)
-  Standard_Real lFactor = UnitsMethods::GetLengthFactorValue ( Interface_Static::IVal ( "write.step.unit" ) );
+  Standard_Real lFactor = UnitsMethods::GetLengthFactorValue (myModel->IVal("write.step.unit"));
   lFactor /= UnitsMethods::GetCasCadeLengthUnit();
-  Standard_Integer anglemode = Interface_Static::IVal("step.angleunit.mode");
+  Standard_Integer anglemode = myModel->IVal("step.angleunit.mode");
   UnitsMethods::InitializeFactors ( lFactor, ( anglemode <= 1 ? 1. : M_PI/180. ), 1. );
 
   // create SDR
   STEPConstruct_Part SDRTool;
-  SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application() );
+  SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application(), myModel );
   Handle(StepShape_ShapeDefinitionRepresentation) sdr = SDRTool.SDRValue();
   // transfer shape
 
@@ -494,23 +492,23 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::Transfer (const Handle(Transfer_
 
 //==========================================
 
-static Standard_Real UsedTolerance (const Standard_Real mytoler, 
-                                   const TopoDS_Shape& theShape)
+Standard_Real STEPControl_ActorWrite::usedTolerance(const Standard_Real theToler,
+                                                    const TopoDS_Shape& theShape)
 {
 
   //    COMPUTING 3D TOLERANCE
   //    Either from Session, or Computed (Least,Average, or Greatest)
   //    Then given to TopoDSToStep_Tool
 
-  Standard_Real Tol = mytoler;
-  Standard_Integer tolmod = Interface_Static::IVal("write.precision.mode");
-  if (Tol <= 0 && tolmod == 2) Tol =
-    Interface_Static::RVal("write.precision.val");
+  Standard_Real Tol = theToler;
+  Standard_Integer tolmod = myModel->IVal("write.precision.mode");
+  if (Tol <= 0 && tolmod == 2)
+    Tol = myModel->RVal("write.precision.val");
   if (Tol <= 0) {
     ShapeAnalysis_ShapeTolerance stu;
-    Tol = stu.Tolerance (theShape,tolmod);
+    Tol = stu.Tolerance(theShape, tolmod);
     //  Par defaut, on prend une tolerance moyenne, on elimine les aberrations
-    Tol = Interface_MSG::Intervalled (Tol * 1.5);  // arrondi a 1 2 5 ...
+    Tol = Interface_MSG::Intervalled(Tol * 1.5);  // arrondi a 1 2 5 ...
   }
   if (Tol == 0) Tol = 1.e-07;  // minimum ...
 
@@ -528,7 +526,7 @@ Standard_Boolean STEPControl_ActorWrite::IsAssembly (TopoDS_Shape &S) const
 {
   if ( ! GroupMode() || S.ShapeType() != TopAbs_COMPOUND ) return Standard_False;
   // PTV 16.09.2002  OCC725 for storing compound of vertices
-  if (Interface_Static::IVal("write.step.vertex.mode") == 0) {//bug 23950
+  if (myModel->IVal("write.step.vertex.mode") == 0) {//bug 23950
     if (S.ShapeType() == TopAbs_COMPOUND ) {
       Standard_Boolean IsOnlyVertices = Standard_True;
       TopoDS_Iterator anItr( S );
@@ -587,7 +585,9 @@ static Standard_Boolean transferVertex (const Handle(Transfer_FinderProcess)& FP
 {
   Standard_Boolean IsDone = Standard_False;
   MoniTool_DataMapOfShapeTransient aMap;
-  TopoDSToStep_Tool    aTool(aMap, Standard_True);
+  TopoDSToStep_Tool aTool(aMap,
+                          Standard_True,
+                          FP->Model()->IVal("write.surfacecurve.mode"));
   TopoDSToStep_MakeStepVertex aMkVrtx ( TopoDS::Vertex(aShVrtx), aTool, FP );
   
   if (!aMkVrtx.IsDone())
@@ -643,7 +643,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran
     return TransferCompound(start, SDR0, FP);
 
   // [BEGIN] Separate manifold topology from non-manifold in group mode 0 (ssv; 18.11.2010)
-  Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
+  Standard_Boolean isNMMode = myModel->IVal("write.step.nonmanifold") != 0;
   Handle(Transfer_Binder) aNMBinder;
   if (isNMMode && !GroupMode() && theShape.ShapeType() == TopAbs_COMPOUND) {
     TopoDS_Compound aNMCompound;
@@ -736,7 +736,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran
         sdr = SDR0;
       else {
         STEPConstruct_Part SDRTool;
-        SDRTool.MakeSDR( 0, myContext.GetProductName(), myContext.GetAPD()->Application() );
+        SDRTool.MakeSDR( 0, myContext.GetProductName(), myContext.GetAPD()->Application(), myModel );
         sdr = SDRTool.SDRValue();
       }
 
@@ -763,7 +763,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran
   Handle(TopTools_HSequenceOfShape) RepItemSeq = new TopTools_HSequenceOfShape();
   
   Standard_Boolean isSeparateVertices = 
-    Interface_Static::IVal("write.step.vertex.mode") == 0;//bug 23950
+    myModel->IVal("write.step.vertex.mode") == 0;//bug 23950
   // PTV 16.09.2002 OCC725 separate shape from solo vertices.
   Standard_Boolean isOnlyVertices = Standard_False;
   if (theShape.ShapeType() == TopAbs_COMPOUND) {
@@ -859,7 +859,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran
   //    COMPUTING 3D TOLERANCE
   //    Either from Session, or Computed (Least,Average, or Greatest)
   //    Then given to TopoDSToStep_Tool
-  Standard_Real Tol = UsedTolerance (mytoler,theShape);
+  Standard_Real Tol = usedTolerance (mytoler,theShape);
   
   // Create a STEP-Entity for each TopoDS_Shape  
   // according to the current StepModelMode
@@ -894,13 +894,13 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran
 //    if ( DMT.IsDone() ) aShape = DMT.ModifiedShape ( aShape );
 ////    aShape = TopoDSToStep::DirectFaces(xShape);
     Handle(Standard_Transient) info;
-    Standard_Real maxTol = Interface_Static::RVal("read.maxprecision.val");
+    Standard_Real maxTol = myModel->RVal("read.maxprecision.val");
 
     TopoDS_Shape aShape;
-    aShape = XSAlgo::AlgoContainer()->ProcessShape(xShape, Tol, maxTol, 
-                                                  "write.step.resource.name", 
-                                                  "write.step.sequence", info,
-                                                  FP->GetProgress() );
+    aShape = myXSAlgoContainer->ProcessShape(xShape, Tol, maxTol,
+                                             "write.step.resource.name", 
+                                             "write.step.sequence", info,
+                                             FP->GetProgress() );
     if (!isManifold) {
       mergeInfoForNM(FP, info);
     }
@@ -1098,7 +1098,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran
 
     //:abv 24Jan99 CAX-IF TRJ3: Update FinderProcess map to take into account shape processing
 //    UpdateMap ( xShape, CSMT, DMT, FP );
-    XSAlgo::AlgoContainer()->MergeTransferInfo(FP, info);
+    myXSAlgoContainer->MergeTransferInfo(FP, info);
   }
   
   // - Make Shape Representation 
@@ -1173,7 +1173,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran
       GetCasted(StepRepr_RepresentationItem, ItemSeq->Value(rep));
     items->SetValue(rep,repit);
   }
-  Standard_Integer ap = Interface_Static::IVal("write.step.schema");
+  Standard_Integer ap = myModel->IVal("write.step.schema");
   Transfer_SequenceOfBinder aSeqBindRelation;
   if(ap == 3 && nbs > 1) {
     Standard_Integer j = 1;
@@ -1201,7 +1201,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran
       repr1->SetValue(2,items->Value(j));
       ShapeRepr1->SetItems(repr1);
       STEPConstruct_UnitContext mk1;
-      mk1.Init(Tol);
+      mk1.Init(Tol, myModel);
       ShapeRepr1->SetContextOfItems(mk1.Value());  // la tolerance, voir au debut
       ShapeRepr1->SetName (new TCollection_HAsciiString(""));
       
@@ -1234,7 +1234,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape (const Handle(Tran
 
   // init representation
   STEPConstruct_UnitContext mk;
-  mk.Init(Tol);
+  mk.Init(Tol, myModel);
   shapeRep->SetContextOfItems(mk.Value());  // la tolerance, voir au debut
   shapeRep->SetName (new TCollection_HAsciiString(""));
 
@@ -1278,7 +1278,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound (const Handle(T
   TopoDS_Shape theShape = mapper->Value();
 
   // Inspect non-manifold topology case (ssv; 10.11.2010)
-  Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
+  Standard_Boolean isNMMode = myModel->IVal("write.step.nonmanifold") != 0;
   Standard_Boolean isManifold;
   if (isNMMode)
     isManifold = IsManifoldShape(theShape);
@@ -1290,7 +1290,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound (const Handle(T
   // Prepare a collection for non-manifold group of shapes
   Handle(TopTools_HSequenceOfShape) NonManifoldGroup = new TopTools_HSequenceOfShape();
   Standard_Boolean isSeparateVertices = 
-    (Interface_Static::IVal("write.step.vertex.mode") == 0);//bug 23950
+    ( myModel->GetParam("write.step.vertex.mode")->IntegerValue() == 0);//bug 23950
   // PTV OCC725 17.09.2002 -- begin --
   Standard_Integer nbFreeVrtx = 0;
   TopoDS_Compound aCompOfVrtx;
@@ -1379,9 +1379,9 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound (const Handle(T
   for (Standard_Integer rep = 1; rep <= nsub; rep++)
     items->SetValue(rep,GetCasted(StepRepr_RepresentationItem, ItemSeq->Value(rep)));
   shapeRep->SetItems(items);
-  Standard_Real Tol = UsedTolerance (mytoler,theShape);
+  Standard_Real Tol = usedTolerance (mytoler,theShape);
   STEPConstruct_UnitContext mk;
-  mk.Init(Tol);
+  mk.Init(Tol, myModel);
   shapeRep->SetContextOfItems(mk.Value());  // la tolerance, voir au debut
   shapeRep->SetName (new TCollection_HAsciiString(""));
 
@@ -1433,7 +1433,7 @@ Handle(Transfer_Binder)  STEPControl_ActorWrite::TransferSubShape (const Handle(
     (resbind,STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation),sdr);
   if ( iasdr ) SDRTool.ReadSDR ( sdr ); 
   else { 
-    SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application() );
+    SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application(), myModel );
     sdr = SDRTool.SDRValue();
   }
 //  resultat = GetCasted(StepShape_ShapeRepresentation,sdr->UsedRepresentation());
@@ -1496,3 +1496,14 @@ Handle(Transfer_Binder)  STEPControl_ActorWrite::TransferSubShape (const Handle(
   
   return resprod;
 }
+
+//=======================================================================
+// Method  : SetModel
+// Purpose :
+//=======================================================================
+void STEPControl_ActorWrite::SetModel(Handle(Interface_InterfaceModel)& theModel)
+{
+  myModel = theModel;
+  myXSAlgoContainer->SetModel(theModel);
+  SetGroupMode("write.step.assembly");
+}
index afc1869a9e4b11ba61cda761245950814e83ab8f..3e60c69783dc9b616b286475ff25a72e1aa1a00a 100644 (file)
 
 #include <Standard_Integer.hxx>
 #include <Standard_Real.hxx>
-#include <STEPConstruct_ContextTool.hxx>
-#include <Transfer_ActorOfFinderProcess.hxx>
 #include <Standard_Boolean.hxx>
-#include <TopTools_HSequenceOfShape.hxx>
+#include <STEPConstruct_ContextTool.hxx>
 #include <STEPControl_StepModelType.hxx>
+#include <StepData_StepModel.hxx>
+#include <TopTools_HSequenceOfShape.hxx>
+#include <Transfer_ActorOfFinderProcess.hxx>
+#include <XSAlgo_AlgoContainer.hxx>
 class Transfer_Finder;
 class Transfer_Binder;
 class Transfer_FinderProcess;
@@ -63,7 +65,7 @@ public:
   
   Standard_EXPORT STEPControl_StepModelType Mode() const;
   
-  Standard_EXPORT void SetGroupMode (const Standard_Integer mode);
+  Standard_EXPORT void SetGroupMode (const Standard_CString theParameter);
   
   Standard_EXPORT Standard_Integer GroupMode() const;
   
@@ -76,6 +78,8 @@ public:
   //! NOTE: this method can modify shape
   Standard_EXPORT virtual Standard_Boolean IsAssembly (TopoDS_Shape& S) const;
 
+  //! Sets step model for translations
+  Standard_EXPORT void SetModel(Handle(Interface_InterfaceModel)& theModel);
 
 
 
@@ -94,14 +98,23 @@ private:
   //! Use this method to get the corresponding NMSSR (or
   //! to create a new one if doesn't exist yet)
   //! (ssv; 13.11.2010)
-  Standard_EXPORT Handle(StepShape_NonManifoldSurfaceShapeRepresentation) getNMSSRForGroup (const Handle(TopTools_HSequenceOfShape)& shapeGroup, const Handle(Transfer_FinderProcess)& FP, Standard_Boolean& isNMSSRCreated) const;
+  Standard_EXPORT Handle(StepShape_NonManifoldSurfaceShapeRepresentation) getNMSSRForGroup (const Handle(TopTools_HSequenceOfShape)& shapeGroup,
+                                                                                            const Handle(Transfer_FinderProcess)& FP,
+                                                                                            Standard_Boolean& isNMSSRCreated) const;
   
   //! bind already written shared faces to STEP entity for non-manifold
-  Standard_EXPORT void mergeInfoForNM(const Handle(Transfer_FinderProcess)& theFP, const Handle(Standard_Transient) &theInfo) const;
+  Standard_EXPORT void mergeInfoForNM(const Handle(Transfer_FinderProcess)& theFP,
+                                      const Handle(Standard_Transient) &theInfo) const;
+
+  //! 
+  Standard_EXPORT Standard_Real usedTolerance(const Standard_Real mytoler,
+                                              const TopoDS_Shape& theShape);
 
   Standard_Integer mygroup;
   Standard_Real mytoler;
   STEPConstruct_ContextTool myContext;
+  Handle(XSAlgo_AlgoContainer) myXSAlgoContainer;
+  Handle(Interface_InterfaceModel) myModel;
 
 
 };
index dc3ec175a019fba24fa6133d60fd4497499f7bc6..39542730857c519dc6236b01afe9e52af34bfd14 100644 (file)
 #include <APIHeaderSection_MakeHeader.hxx>
 #include <HeaderSection.hxx>
 #include <IFSelect_EditForm.hxx>
+#include <IFSelect_ParamEditor.hxx>
 #include <IFSelect_SelectModelRoots.hxx>
 #include <IFSelect_SelectSignature.hxx>
 #include <IFSelect_SignAncestor.hxx>
 #include <IFSelect_SignCounter.hxx>
+#include <IFSelect_SelectModelEntities.hxx>
 #include <Interface_InterfaceModel.hxx>
 #include <Interface_Macros.hxx>
-#include <Interface_Static.hxx>
 #include <RWHeaderSection.hxx>
 #include <RWStepAP214.hxx>
+#include <ShapeExtend.hxx>
+#include <ShapeProcess_OperLibrary.hxx>
 #include <Standard_Type.hxx>
 #include <Standard_Version.hxx>
+#include <Standard_Mutex.hxx>
+#include <StepAP214_Protocol.hxx>
 #include <STEPControl_ActorRead.hxx>
 #include <STEPControl_ActorWrite.hxx>
 #include <STEPControl_Controller.hxx>
-#include <StepData_FileProtocol.hxx>
+//#include <StepData_FileProtocol.hxx>
 #include <StepData_StepModel.hxx>
-#include <STEPEdit.hxx>
 #include <STEPEdit_EditContext.hxx>
 #include <STEPEdit_EditSDR.hxx>
 #include <StepSelect_StepType.hxx>
 #include <Transfer_FinderProcess.hxx>
 #include <XSAlgo.hxx>
 #include <XSControl_WorkSession.hxx>
+#include <XSAlgo_AlgoContainer.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(STEPControl_Controller,XSControl_Controller)
 
 //  Pour NewModel et Write : definition de produit (temporaire ...)
-STEPControl_Controller::STEPControl_Controller ()
-: XSControl_Controller ("STEP", "step")
+STEPControl_Controller::STEPControl_Controller()
+  : XSControl_Controller("STEP", "step")
 {
-  static Standard_Boolean init = Standard_False;
-  if (!init) {
-    RWHeaderSection::Init();  RWStepAP214::Init();
-
-    Interface_Static::Init ("step","write.step.product.name",'t',"Open CASCADE STEP translator " OCC_VERSION_STRING);
-    Interface_Static::Init ("step","write.step.assembly",'e',"");
-    Interface_Static::Init ("step","write.step.assembly",'&',"enum 0");
-    Interface_Static::Init ("step","write.step.assembly",'&',"eval Off");
-    Interface_Static::Init ("step","write.step.assembly",'&',"eval On");
-    Interface_Static::Init ("step","write.step.assembly",'&',"eval Auto");
-    Interface_Static::SetCVal("write.step.assembly","Auto"); 
-
-    Interface_Static::Init("step","step.angleunit.mode", 'e',"");
-    Interface_Static::Init("step","step.angleunit.mode", '&',"enum 0");
-    Interface_Static::Init("step","step.angleunit.mode", '&',"eval File");
-    Interface_Static::Init("step","step.angleunit.mode", '&',"eval Rad");
-    Interface_Static::Init("step","step.angleunit.mode", '&',"eval Deg");
-    Interface_Static::SetCVal("step.angleunit.mode","File"); 
-
-    Interface_Static::Init("step","write.step.schema", 'e',"");  
-    Interface_Static::Init("step","write.step.schema",'&',"enum 1");
-    Interface_Static::Init("step","write.step.schema",'&',"eval AP214CD");
-    Interface_Static::Init("step","write.step.schema",'&',"eval AP214DIS");
-    Interface_Static::Init("step","write.step.schema",'&',"eval AP203");
-    Interface_Static::Init("step","write.step.schema",'&',"eval AP214IS");
-    Interface_Static::Init("step","write.step.schema",'&',"eval AP242DIS");
-    Interface_Static::SetCVal("write.step.schema","AP214IS"); 
-
-    // Type of Product Definition for reading
-    // Note: the numbers should be consistent with function FindShapeReprType()
-    // in STEPControl_ActorRead.cxx
-    Interface_Static::Init("step","read.step.shape.repr",'e',"");
-    Interface_Static::Init("step","read.step.shape.repr",'&',"enum 1");
-    Interface_Static::Init("step","read.step.shape.repr",'&',"eval All");   // 1
-    Interface_Static::Init("step","read.step.shape.repr",'&',"eval ABSR");  // 2
-    Interface_Static::Init("step","read.step.shape.repr",'&',"eval MSSR");  // 3
-    Interface_Static::Init("step","read.step.shape.repr",'&',"eval GBSSR"); // 4
-    Interface_Static::Init("step","read.step.shape.repr",'&',"eval FBSR");  // 5
-    Interface_Static::Init("step","read.step.shape.repr",'&',"eval EBWSR"); // 6
-    Interface_Static::Init("step","read.step.shape.repr",'&',"eval GBWSR"); // 7
-    Interface_Static::SetCVal("read.step.shape.repr","All");
-
-    // Mode for reading shapes attached to main SDR by SRR
-    // (hybrid model representation in AP203 since 1998)
-    Interface_Static::Init("step","read.step.shape.relationship",'e',"");
-    Interface_Static::Init("step","read.step.shape.relationship",'&',"enum 0");
-    Interface_Static::Init("step","read.step.shape.relationship",'&',"eval OFF");
-    Interface_Static::Init("step","read.step.shape.relationship",'&',"eval ON");
-    Interface_Static::SetCVal("read.step.shape.relationship","ON");
-
-    // Mode for reading shapes attached to Product by ShapeAspect 
-    // (hybrid model representation in AP203 before 1998)
-    Interface_Static::Init("step","read.step.shape.aspect",'e',"");
-    Interface_Static::Init("step","read.step.shape.aspect",'&',"enum 0");
-    Interface_Static::Init("step","read.step.shape.aspect",'&',"eval OFF");
-    Interface_Static::Init("step","read.step.shape.aspect",'&',"eval ON");
-    Interface_Static::SetCVal("read.step.shape.aspect","ON");
-
-    // Mode for reading SDR and ShapeRepr if it is necessary
-    Interface_Static::Init("step","read.step.product.mode",'e',"");
-    Interface_Static::Init("step","read.step.product.mode",'&',"enum 0");
-    Interface_Static::Init("step","read.step.product.mode",'&',"eval OFF");
-    Interface_Static::Init("step","read.step.product.mode",'&',"eval ON");
-    Interface_Static::SetCVal("read.step.product.mode","ON");
-
-    // Order of reading ShapeDefinitionRepresentation in ProductDefinition
-    Interface_Static::Init("step","read.step.product.context",'e',"");
-    Interface_Static::Init("step","read.step.product.context",'&',"enum 1");
-    Interface_Static::Init("step","read.step.product.context",'&',"eval all");     // 1
-    Interface_Static::Init("step","read.step.product.context",'&',"eval design");  // 2
-    Interface_Static::Init("step","read.step.product.context",'&',"eval analysis");// 3
-    Interface_Static::SetCVal("read.step.product.context","all");
-
-    // What we try to read in ProductDefinition
-    Interface_Static::Init("step","read.step.assembly.level",'e',"");
-    Interface_Static::Init("step","read.step.assembly.level",'&',"enum 1");
-    Interface_Static::Init("step","read.step.assembly.level",'&',"eval all");      // 1
-    Interface_Static::Init("step","read.step.assembly.level",'&',"eval assembly"); // 2
-    Interface_Static::Init("step","read.step.assembly.level",'&',"eval structure");// 3
-    Interface_Static::Init("step","read.step.assembly.level",'&',"eval shape");    // 4
-    Interface_Static::SetCVal("read.step.assembly.level","all");
-
-    // unit: supposed to be cascade unit (target unit for reading)
-    Interface_Static::Init("step","write.step.unit", 'e',"");
-    Interface_Static::Init("step","write.step.unit",'&',"enum 1");
-    Interface_Static::Init("step","write.step.unit",'&',"eval INCH");  // 1
-    Interface_Static::Init("step","write.step.unit",'&',"eval MM");    // 2
-    Interface_Static::Init("step","write.step.unit",'&',"eval ??");    // 3
-    Interface_Static::Init("step","write.step.unit",'&',"eval FT");    // 4
-    Interface_Static::Init("step","write.step.unit",'&',"eval MI");    // 5
-    Interface_Static::Init("step","write.step.unit",'&',"eval M");     // 6
-    Interface_Static::Init("step","write.step.unit",'&',"eval KM");    // 7
-    Interface_Static::Init("step","write.step.unit",'&',"eval MIL");   // 8
-    Interface_Static::Init("step","write.step.unit",'&',"eval UM");    // 9
-    Interface_Static::Init("step","write.step.unit",'&',"eval CM");    //10
-    Interface_Static::Init("step","write.step.unit",'&',"eval UIN");   //11
-    Interface_Static::SetCVal ("write.step.unit","MM");
-
-    // Non-manifold topology reading: OFF by default (ssv; 26.11.2010)
-    Interface_Static::Init ("step","read.step.nonmanifold",'e',"");
-    Interface_Static::Init ("step","read.step.nonmanifold",'&',"enum 0");
-    Interface_Static::Init ("step","read.step.nonmanifold",'&',"eval Off");
-    Interface_Static::Init ("step","read.step.nonmanifold",'&',"eval On");
-    Interface_Static::SetIVal("read.step.nonmanifold",0); 
-
-    // Non-manifold topology writing: OFF by default (ssv; 26.11.2010)
-    Interface_Static::Init ("step","write.step.nonmanifold",'e',"");
-    Interface_Static::Init ("step","write.step.nonmanifold",'&',"enum 0");
-    Interface_Static::Init ("step","write.step.nonmanifold",'&',"eval Off");
-    Interface_Static::Init ("step","write.step.nonmanifold",'&',"eval On");
-    Interface_Static::SetIVal("write.step.nonmanifold",0); 
-
-    // I-Deas-like STEP processing: OFF by default (ssv; 22.11.2010)
-    Interface_Static::Init ("step","read.step.ideas",'e',"");
-    Interface_Static::Init ("step","read.step.ideas",'&',"enum 0");
-    Interface_Static::Init ("step","read.step.ideas",'&',"eval Off");
-    Interface_Static::Init ("step","read.step.ideas",'&',"eval On");
-    Interface_Static::SetIVal("read.step.ideas",0); 
-
-    //Parameter to write all free vertices in one SDR (name and style of vertex are lost) (default) 
-    //or each vertex in its own SDR (name and style of vertex are exported). (ika; 21.07.2014) 
-    Interface_Static::Init ("step","write.step.vertex.mode",'e',"");
-    Interface_Static::Init ("step","write.step.vertex.mode",'&',"enum 0");
-    Interface_Static::Init ("step","write.step.vertex.mode",'&',"eval One Compound");
-    Interface_Static::Init ("step","write.step.vertex.mode",'&',"eval Single Vertex");
-    Interface_Static::SetIVal("write.step.vertex.mode",0);
-  
-    // abv 15.11.00: ShapeProcessing
-    Interface_Static::Init ("XSTEP","write.step.resource.name",'t',"STEP");
-    Interface_Static::Init ("XSTEP","read.step.resource.name",'t',"STEP");
-    Interface_Static::Init ("XSTEP","write.step.sequence",'t',"ToSTEP");
-    Interface_Static::Init ("XSTEP","read.step.sequence",'t',"FromSTEP");
-
-    // ika 28.07.16: Paremeter to read all top level solids and shells,
-    // should be used only in case of invalid shape_representation without links to shapes.
-    Interface_Static::Init("step", "read.step.all.shapes", 'e', "");
-    Interface_Static::Init("step", "read.step.all.shapes", '&', "enum 0");
-    Interface_Static::Init("step", "read.step.all.shapes", '&', "eval Off");
-    Interface_Static::Init("step", "read.step.all.shapes", '&', "eval On");
-    Interface_Static::SetIVal("read.step.all.shapes", 0);
-
-    init = Standard_True;
+  myAdaptorProtocol = new StepAP214_Protocol();
+
+  static Standard_Mutex aPars;
+  {
+    Standard_Mutex::Sentry aLock(aPars);
+    //RWHeaderSection::Init();
+    RWStepAP214::Init(Handle(StepAP214_Protocol)::DownCast(myAdaptorProtocol));
+
+    // initialization of Standard Shape Healing
+    //ShapeExtend::Init();
+    //XSAlgo::Init();
+    // init Standard Shape Processing operators
+    ShapeProcess_OperLibrary::Init();
   }
 
   Handle(STEPControl_ActorWrite) ActWrite = new STEPControl_ActorWrite;
-  ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
   myAdaptorWrite = ActWrite;
 
   Handle(StepSelect_WorkLibrary) swl = new StepSelect_WorkLibrary;
   swl->SetDumpLabel(1);
   myAdaptorLibrary  = swl;
-  myAdaptorProtocol = STEPEdit::Protocol();
   myAdaptorRead     = new STEPControl_ActorRead;  // par ex pour Recognize
 
+  myStepType = new StepSelect_StepType;
+  myStepType->SetProtocol(myAdaptorProtocol);
+
   SetModeWrite (0,4);
   SetModeWriteHelp (0,"As Is");
   SetModeWriteHelp (1,"Faceted Brep");
   SetModeWriteHelp (2,"Shell Based");
   SetModeWriteHelp (3,"Manifold Solid");
   SetModeWriteHelp (4,"Wireframe");
-  TraceStatic ("read.surfacecurve.mode",5);
 
   //   ---  SELECTIONS, SIGNATURES, COMPTEURS, EDITEURS
 
   DeclareAndCast(IFSelect_Selection,xmr,SessionItem("xst-model-roots"));
   if (!xmr.IsNull()) {
-    Handle(IFSelect_Signature) sty = STEPEdit::SignType();
-    AddSessionItem (sty,"step-type");
-    Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(sty,Standard_False,Standard_True);
+    AddSessionItem (myStepType,"step-type");
+    Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(myStepType,Standard_False,Standard_True);
     AddSessionItem (tys,"step-types");
 
     //szv:mySignType = sty;
@@ -235,16 +110,32 @@ STEPControl_Controller::STEPControl_Controller ()
     AddSessionItem (new IFSelect_SignAncestor(),"xst-derived");
 
     Handle(STEPSelections_SelectDerived) stdvar = new STEPSelections_SelectDerived();
-    stdvar->SetProtocol(STEPEdit::Protocol());
+    stdvar->SetProtocol(myAdaptorProtocol);
     AddSessionItem (stdvar,"step-derived");
     
-    Handle(IFSelect_SelectSignature) selsdr = STEPEdit::NewSelectSDR();
+    //Creates a Selection for ShapeDefinitionRepresentation
+    Handle(IFSelect_SelectSignature) selsdr = new IFSelect_SelectSignature
+    (myStepType, "SHAPE_DEFINITION_REPRESENTATION");
     selsdr->SetInput (xmr);
     AddSessionItem (selsdr,"step-shape-def-repr");
 
-    AddSessionItem (STEPEdit::NewSelectPlacedItem(),"step-placed-items");
-    // input deja pret avec ModelAll
-    AddSessionItem (STEPEdit::NewSelectShapeRepr(),"step-shape-repr");
+    // Creates a Selection for Placed Items, i.e. MappedItem or
+    // ContextDependentShapeRepresentation, which itself refers to a
+    // RepresentationRelationship with possible subtypes (Shape...
+    // and/or ...WithTransformation)
+    Handle(IFSelect_SelectSignature) selrrs = new IFSelect_SelectSignature
+    (myStepType, "MAPPED_ITEM|CONTEXT_DEPENDENT_SHAPE_REPRESENTATION", Standard_False);
+    selrrs->SetInput(new IFSelect_SelectModelEntities);
+    AddSessionItem (selrrs,"step-placed-items");
+
+    // Creates a Selection for ShapeRepresentation and its sub - types,
+    // plus ContextDependentShapeRepresentation (which is not a
+    // sub-type of ShapeRepresentation)
+    Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
+    (myStepType, "SHAPE_REPRESENTATION", Standard_False);
+    // REPRESENTATION_RELATIONSHIP passe par CONTEXT_DEPENDENT_SHAPE_REPRESENTATION
+    sel->SetInput(new IFSelect_SelectModelEntities);
+    AddSessionItem (sel,"step-shape-repr");
   }
   
   //pdn
@@ -282,7 +173,8 @@ STEPControl_Controller::STEPControl_Controller ()
 
 Handle(Interface_InterfaceModel)  STEPControl_Controller::NewModel () const
 {
-  return STEPEdit::NewModel();
+  APIHeaderSection_MakeHeader head;
+  return head.NewModel(myAdaptorProtocol);
 }
 
 //  ####    PROVISOIRE ???   ####
@@ -294,26 +186,38 @@ IFSelect_ReturnStatus  STEPControl_Controller::TransferWriteShape
    const Standard_Integer modeshape) const
 {
   if (modeshape < 0 || modeshape > 4) return IFSelect_RetError;
+  if (model.IsNull()) return IFSelect_RetError;
   Handle(STEPControl_ActorWrite) ActWrite =
     Handle(STEPControl_ActorWrite)::DownCast(myAdaptorWrite);
 //    A PRESENT ON PASSE PAR LE PROFILE
-  if (!ActWrite.IsNull()) 
-    ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
+  if (!ActWrite.IsNull())
+  {
+    ActWrite->SetGroupMode("write.step.assembly");
+  }
 
   return XSControl_Controller::TransferWriteShape (shape,FP,model,modeshape);
 }
 
-Standard_Boolean STEPControl_Controller::Init ()
+Standard_Boolean STEPControl_Controller::Init(const Handle(XSControl_WorkSession)& theWS)
 {
-  static Standard_Boolean inic = Standard_False;
-  if (!inic) {
-    Handle(STEPControl_Controller) STEPCTL = new STEPControl_Controller;
-    STEPCTL->AutoRecord();  // avec les noms donnes a la construction
-    XSAlgo::Init();                                                                                                        
-    inic = Standard_True;
-  }
+  Handle(Interface_InterfaceModel) aModel = theWS->Model();
+  if (aModel.IsNull()) return Standard_False;
+
+  TraceNotStatic(aModel->GetParam("read.surfacecurve.mode"), 5);
+  TraceNotStatic(aModel->GetParam("read.precision.mode"), 5);
+  TraceNotStatic(aModel->GetParam("read.precision.val"), 5);
+  TraceNotStatic(aModel->GetParam("write.precision.mode"), 6);
+  TraceNotStatic(aModel->GetParam("write.precision.val"), 6);
+
+  DeclareAndCast(STEPControl_ActorRead, aReadActor, myAdaptorRead);
+  if (!aReadActor.IsNull()) aReadActor->SetModel(aModel);
+
+  DeclareAndCast(STEPControl_ActorWrite, aWriteActor, myAdaptorWrite);
+  if (!aWriteActor.IsNull()) aWriteActor->SetModel(aModel);
+
   return Standard_True;
 }
+
 //=======================================================================
 //function : Customise
 //purpose  : 
@@ -337,29 +241,48 @@ void STEPControl_Controller::Customise(Handle(XSControl_WorkSession)& WS)
   WS->AddNamedItem ("xst-transferrable-roots",st1);
 
   if (!slr.IsNull()) {
-    Handle(IFSelect_Signature) sty = STEPEdit::SignType();
-    WS->AddNamedItem ("step-type",sty);
+    WS->AddNamedItem ("step-type", myStepType);
     
-    Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(sty,Standard_False,Standard_True);
+    Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(myStepType,Standard_False,Standard_True);
     WS->AddNamedItem ("step-types",tys);
 
        //szv:mySignType = sty;
-    WS->SetSignType( sty );
+    WS->SetSignType(myStepType);
     
     //pdn S4133 18.02.99
     WS->AddNamedItem ("xst-derived",new IFSelect_SignAncestor());
     Handle(STEPSelections_SelectDerived) stdvar = new STEPSelections_SelectDerived();
-    stdvar->SetProtocol(STEPEdit::Protocol());
+
+    static Standard_Mutex aPars;
+    {
+      Standard_Mutex::Sentry aLock(aPars);
+      stdvar->SetProtocol(myAdaptorProtocol);
+    }
     WS->AddNamedItem ("step-derived",stdvar);
-    
-    Handle(IFSelect_SelectSignature) selsdr = STEPEdit::NewSelectSDR();
-    selsdr->SetInput (slr);
-    WS->AddNamedItem ("step-shape-def-repr",selsdr);
-    Handle(IFSelect_SelectSignature) selrrs = STEPEdit::NewSelectPlacedItem();
+
+    //Creates a Selection for ShapeDefinitionRepresentation
+    Handle(IFSelect_SelectSignature) selsdr = new IFSelect_SelectSignature
+    (myStepType, "SHAPE_DEFINITION_REPRESENTATION");
+    selsdr->SetInput(slr);
+    WS->AddNamedItem("step-shape-def-repr", selsdr);
+
+    // Creates a Selection for Placed Items, i.e. MappedItem or
+    // ContextDependentShapeRepresentation, which itself refers to a
+    // RepresentationRelationship with possible subtypes (Shape...
+    // and/or ...WithTransformation)
+    Handle(IFSelect_SelectSignature) selrrs = new IFSelect_SelectSignature
+    (myStepType, "MAPPED_ITEM|CONTEXT_DEPENDENT_SHAPE_REPRESENTATION", Standard_False);
+    selrrs->SetInput(new IFSelect_SelectModelEntities);
     WS->AddNamedItem ("step-placed-items",selrrs);
-    Handle(IFSelect_SelectSignature) selsr = STEPEdit::NewSelectShapeRepr();
-    // input deja pret avec ModelAll
-    WS->AddNamedItem ("step-shape-repr",selsr);
+
+    // Creates a Selection for ShapeRepresentation and its sub - types,
+    // plus ContextDependentShapeRepresentation (which is not a
+    // sub-type of ShapeRepresentation)
+    Handle(IFSelect_SelectSignature) sel = new IFSelect_SelectSignature
+    (myStepType, "SHAPE_REPRESENTATION", Standard_False);
+    // REPRESENTATION_RELATIONSHIP passe par CONTEXT_DEPENDENT_SHAPE_REPRESENTATION
+    sel->SetInput(new IFSelect_SelectModelEntities);
+    WS->AddNamedItem ("step-shape-repr", sel);
   }
   
   //pdn
index 454a35987f577f2f5821ff79fe1642ce1a5bb708..071b934250e6ba9e87fe5359d020cf3bfb364094 100644 (file)
@@ -24,6 +24,7 @@
 #include <IFSelect_ReturnStatus.hxx>
 #include <Standard_Integer.hxx>
 #include <Standard_Boolean.hxx>
+#include <StepSelect_StepType.hxx>
 class Interface_InterfaceModel;
 class Transfer_ActorOfTransientProcess;
 class XSControl_WorkSession;
@@ -59,10 +60,8 @@ public:
   //! modeshape : 1 Facetted BRep, 2 Shell, 3 Manifold Solid
   Standard_EXPORT virtual IFSelect_ReturnStatus TransferWriteShape (const TopoDS_Shape& shape, const Handle(Transfer_FinderProcess)& FP, const Handle(Interface_InterfaceModel)& model, const Standard_Integer modetrans = 0) const Standard_OVERRIDE;
   
-  //! Standard Initialisation. It creates a Controller for STEP
-  //! and records it to various names, available to select it later
-  //! Returns True when done, False if could not be done
-  Standard_EXPORT static Standard_Boolean Init();
+  //! Initialisation of additional parameters taken data from session model
+  Standard_EXPORT virtual Standard_Boolean Init(const Handle(XSControl_WorkSession)& theWS) Standard_OVERRIDE;
 
 
 
@@ -72,12 +71,8 @@ public:
 protected:
 
 
-
-
 private:
-
-
-
+  Handle(StepSelect_StepType) myStepType;
 
 };
 
index a4a1c635e594267db72c6f82a88102f3d9e2d57f..448918820501974ff5516cd164026ed3c078586d 100644 (file)
@@ -14,8 +14,8 @@
 
 #include <Interface_EntityIterator.hxx>
 #include <Interface_Graph.hxx>
+#include <Interface_Macros.hxx>
 #include <Interface_ShareFlags.hxx>
-#include <Interface_Static.hxx>
 #include <StepBasic_ApplicationContext.hxx>
 #include <StepBasic_ConversionBasedUnit.hxx>
 #include <StepBasic_DocumentProductEquivalence.hxx>
@@ -38,8 +38,8 @@
 #include <StepBasic_SolidAngleMeasureWithUnit.hxx>
 #include <StepBasic_SolidAngleUnit.hxx>
 #include <STEPConstruct_UnitContext.hxx>
-#include <STEPControl_Controller.hxx>
 #include <STEPControl_Reader.hxx>
+#include <STEPControl_ActorRead.hxx>
 #include <StepData_StepModel.hxx>
 #include <StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext.hxx>
 #include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx>
@@ -74,8 +74,7 @@
 //=======================================================================
 STEPControl_Reader::STEPControl_Reader ()
 {
-  STEPControl_Controller::Init();
-  SetNorm ("STEP");
+  initReader(new XSControl_WorkSession, new STEPControl_Controller);
 }
 
 //=======================================================================
@@ -83,12 +82,38 @@ STEPControl_Reader::STEPControl_Reader ()
 //purpose  : 
 //=======================================================================
 
-STEPControl_Reader::STEPControl_Reader
-  (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
+STEPControl_Reader::STEPControl_Reader(const Handle(XSControl_WorkSession)& theWS,
+                                       const Standard_Boolean scratch)
 {
-  STEPControl_Controller::Init();
-  SetWS (WS,scratch);
-  SetNorm ("STEP");
+  initReader(theWS, new STEPControl_Controller, scratch);
+}
+
+//=======================================================================
+//function : STEPControl_Reader
+//purpose  : 
+//=======================================================================
+
+STEPControl_Reader::STEPControl_Reader (const Handle(XSControl_WorkSession)& theWS,
+                                        const Handle(XSControl_Controller)& theController,
+                                        const Standard_Boolean scratch)
+{
+  initReader(theWS, theController, scratch);
+}
+
+//=======================================================================
+//function : initReader
+//purpose  : 
+//=======================================================================
+void STEPControl_Reader::initReader(const Handle(XSControl_WorkSession)& theWS,
+                                    const Handle(XSControl_Controller)& theController,
+                                    const Standard_Boolean scratch)
+{
+  myController = theController;
+  theWS->SetController(myController);
+  SetWS(theWS, scratch);
+  myController->Init(WS());
+
+  initTransferReader();
 }
 
 //=======================================================================
@@ -122,10 +147,11 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer()
   therootsta = Standard_True;
 
   //theroots.Clear();
-  Standard_Integer nb = Model()->NbEntities();
+  Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(Model());
+  Standard_Integer nb = aModel->NbEntities();
   for (Standard_Integer i = 1; i <= nb; i ++) {
-    Handle(Standard_Transient) ent = Model()->Value(i);
-    if (Interface_Static::IVal("read.step.all.shapes") == 1) {
+    Handle(Standard_Transient) ent = aModel->Value(i);
+    if (aModel->IVal("read.step.all.shapes") == 1) {
       // Special case to read invalid shape_representation without links to shapes.
       if (ent->IsKind(STANDARD_TYPE(StepShape_ManifoldSolidBrep))) {
         Interface_EntityIterator aShareds = WS()->Graph().Sharings(ent);
@@ -185,8 +211,8 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer()
       }
       // determinate roots used ProductDefinitionContext
       if(IsRoot) {
-        const char *str1 = Interface_Static::CVal("read.step.product.context");
-        Standard_Integer ICS = Interface_Static::IVal("read.step.product.context");
+        const char *str1 = aModel->CVal("read.step.product.context");
+        Standard_Integer ICS = aModel->IVal("read.step.product.context");
         if(ICS>1) {
           subs = graph.Shareds(PD);
           for(subs.Start(); subs.More(); subs.Next()) {
@@ -219,7 +245,7 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer()
         WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent);
       }
     }
-    TCollection_AsciiString aProdMode = Interface_Static::CVal("read.step.product.mode");
+    TCollection_AsciiString aProdMode = aModel->CVal("read.step.product.mode");
     if(!aProdMode.IsEqual("ON")) {
       if(ent->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) {
         Standard_Boolean IsRoot = Standard_True;
index 52fcfaade14b21824a34f150aec546888b512605..cf6472dd1f6ddc127d7a47bd8b29dda4e021e363 100644 (file)
@@ -24,6 +24,7 @@
 #include <XSControl_Reader.hxx>
 #include <Standard_Boolean.hxx>
 #include <Standard_Integer.hxx>
+#include <STEPControl_Controller.hxx>
 #include <TColStd_SequenceOfAsciiString.hxx>
 #include <TColStd_Array1OfAsciiString.hxx>
 #include <TColStd_Array1OfReal.hxx>
@@ -38,7 +39,7 @@ class StepRepr_RepresentationContext;
 //! As in XSControl_Reader, you specify the list using a selection.
 //! For the translation of iges files it is possible to use next sequence:
 //! To change translation parameters
-//! class Interface_Static should be used before beginning of
+//! class StepData_StepModel should be used before beginning of
 //! translation  (see STEP Parameters and General Parameters)
 //! Creation of reader - STEPControl_Reader reader;
 //! To load s file in a model use method reader.ReadFile("filename.stp")
@@ -76,10 +77,17 @@ public:
   
   //! Creates a reader object with an empty STEP model.
   Standard_EXPORT STEPControl_Reader();
-  
+
+  //! Creates a Reader for STEP from an already existing Session
+  //! Clears the session if it was not yet set for STEP
+  Standard_EXPORT STEPControl_Reader(const Handle(XSControl_WorkSession)& theWS,
+                                     const Standard_Boolean scratch = Standard_True);
+
   //! Creates a Reader for STEP from an already existing Session
   //! Clears the session if it was not yet set for STEP
-  Standard_EXPORT STEPControl_Reader(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
+  Standard_EXPORT STEPControl_Reader(const Handle(XSControl_WorkSession)& theWS,
+                                     const Handle(XSControl_Controller)& theController,
+                                     const Standard_Boolean scratch = Standard_True);
   
   //! Returns the model as a StepModel.
   //! It can then be consulted (header, product)
@@ -97,7 +105,9 @@ public:
   
   //! Returns sequence of all unit names for shape representations
   //! found in file
-  Standard_EXPORT void FileUnits (TColStd_SequenceOfAsciiString& theUnitLengthNames, TColStd_SequenceOfAsciiString& theUnitAngleNames, TColStd_SequenceOfAsciiString& theUnitSolidAngleNames);
+  Standard_EXPORT void FileUnits (TColStd_SequenceOfAsciiString& theUnitLengthNames,
+                                  TColStd_SequenceOfAsciiString& theUnitAngleNames,
+                                  TColStd_SequenceOfAsciiString& theUnitSolidAngleNames);
 
 
 
@@ -112,9 +122,16 @@ private:
 
   
   //! Returns  units for length , angle and solidangle for shape representations
-  Standard_EXPORT Standard_Boolean findUnits (const Handle(StepRepr_RepresentationContext)& theReprContext, TColStd_Array1OfAsciiString& theNameUnits, TColStd_Array1OfReal& theFactorUnits);
+  Standard_EXPORT Standard_Boolean findUnits (const Handle(StepRepr_RepresentationContext)& theReprContext,
+                                              TColStd_Array1OfAsciiString& theNameUnits,
+                                              TColStd_Array1OfReal& theFactorUnits);
 
+  //!
+  Standard_EXPORT void initReader(const Handle(XSControl_WorkSession)& theWS,
+                                  const Handle(XSControl_Controller)& theController,
+                                  const Standard_Boolean scratch = Standard_True);
 
+  Handle(XSControl_Controller) myController;
 
 
 };
index fd6e09a7445fb192bf06f4e674830b318510fdd6..d38680ba370bb0bf19339cbb88a48434bdcb2e2b 100644 (file)
@@ -16,7 +16,6 @@
 #include <Interface_Macros.hxx>
 #include <Message_ProgressIndicator.hxx>
 #include <STEPControl_ActorWrite.hxx>
-#include <STEPControl_Controller.hxx>
 #include <STEPControl_Writer.hxx>
 #include <StepData_StepModel.hxx>
 #include <TopExp_Explorer.hxx>
 //=======================================================================
 STEPControl_Writer::STEPControl_Writer ()
 {
-  STEPControl_Controller::Init();
-  SetWS (new XSControl_WorkSession);
+  initWriter(new XSControl_WorkSession, new STEPControl_Controller);
 }
 
-
 //=======================================================================
 //function : STEPControl_Writer
-
 //purpose  : 
 //=======================================================================
+STEPControl_Writer::STEPControl_Writer (const Handle(XSControl_WorkSession)& theWS,
+                                        const Standard_Boolean theScratch)
+{
+  initWriter(theWS, new STEPControl_Controller, theScratch);
+}
 
-STEPControl_Writer::STEPControl_Writer
-  (const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch)
+//=======================================================================
+//function : STEPControl_Writer
+//purpose  : 
+//=======================================================================
+STEPControl_Writer::STEPControl_Writer(const Handle(XSControl_WorkSession)& theWS,
+                                       const Handle(XSControl_Controller)& theController,
+                                       const Standard_Boolean theScratch)
 {
-  STEPControl_Controller::Init();
-  SetWS (WS,scratch);
+  initWriter(theWS, theController, theScratch);
 }
 
+//=======================================================================
+//function : initWriter
+//purpose  : 
+//=======================================================================
+void STEPControl_Writer::initWriter(const Handle(XSControl_WorkSession)& theWS,
+                                    const Handle(XSControl_Controller)& theController,
+                                    const Standard_Boolean scratch)
+{
+  myController = theController;
+  theWS->SetController(myController);
+  SetWS(theWS, scratch);
+  myController->Init(WS());
+}
 
 //=======================================================================
 //function : SetWS
-
 //purpose  : 
 //=======================================================================
 
@@ -62,7 +79,9 @@ void STEPControl_Writer::SetWS(const Handle(XSControl_WorkSession)& WS,
   thesession = WS;
   thesession->SelectNorm("STEP");
   thesession->InitTransferReader(0);
-  Handle(StepData_StepModel) model = Model (scratch);
+  Handle(StepData_StepModel) aModel = Model (scratch);
+  DeclareAndCast(STEPControl_ActorWrite, anActor, myController->ActorWrite());
+  if (!anActor.IsNull()) anActor->SetModel(aModel);
 }
 
 
@@ -99,8 +118,8 @@ Handle(StepData_StepModel) STEPControl_Writer::Model
 
 void STEPControl_Writer::SetTolerance (const Standard_Real Tol)
 {
-  DeclareAndCast(STEPControl_ActorWrite,act,WS()->NormAdaptor()->ActorWrite());
-  if (!act.IsNull()) act->SetTolerance (Tol);
+  DeclareAndCast(STEPControl_ActorWrite, anActor, myController->ActorWrite());
+  if (!anActor.IsNull()) anActor->SetTolerance (Tol);
 }
 
 
@@ -145,7 +164,7 @@ IFSelect_ReturnStatus STEPControl_Writer::Transfer
     progress->Show();
   }
 
-  return thesession->TransferWriteShape(sh,compgraph);
+  return thesession->TransferWriteShape(sh, compgraph);
 }
 
 
index f60d3b3cf34003a29593d232611c0923fef35549..4bd01126617a220dc0bd83ebc0bcf67aa27975d6 100644 (file)
 #include <Standard_DefineAlloc.hxx>
 #include <Standard_Handle.hxx>
 
+#include <IFSelect_ReturnStatus.hxx>
 #include <Standard_Boolean.hxx>
 #include <Standard_Real.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-#include <STEPControl_StepModelType.hxx>
 #include <Standard_CString.hxx>
 #include <Standard_Integer.hxx>
+#include <STEPControl_Controller.hxx>
+#include <STEPControl_StepModelType.hxx>
 class XSControl_WorkSession;
 class StepData_StepModel;
 class TopoDS_Shape;
@@ -48,8 +49,15 @@ public:
   Standard_EXPORT STEPControl_Writer();
   
   //! Creates a Writer from an already existing Session
-  //! If <scratch> is True (D), clears already recorded data
-  Standard_EXPORT STEPControl_Writer(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True);
+  //! If <theScratch> is True (D), clears already recorded data
+  Standard_EXPORT STEPControl_Writer(const Handle(XSControl_WorkSession)& WS,
+                                     const Standard_Boolean theScratch = Standard_True);
+
+  //! Creates a Writer for STEP from an already existing Session
+  //! If <theScratch> is True (D), clears already recorded data
+  Standard_EXPORT STEPControl_Writer(const Handle(XSControl_WorkSession)& theWS,
+                                     const Handle(XSControl_Controller)& theController,
+                                     const Standard_Boolean theScratch = Standard_True);
   
   //! Sets a length-measure value that
   //! will be written to uncertainty-measure-with-unit
@@ -115,7 +123,10 @@ public:
 
 protected:
 
-
+  //!
+  Standard_EXPORT void initWriter(const Handle(XSControl_WorkSession)& theWS,
+                                  const Handle(XSControl_Controller)& theController,
+                                  const Standard_Boolean scratch = Standard_True);
 
 
 
@@ -124,6 +135,7 @@ private:
 
 
   Handle(XSControl_WorkSession) thesession;
+  Handle(XSControl_Controller) myController;
 
 
 };
index 7e99a43fba838fea00bc53b9edbdea7189391928..fef053fb32b1c29c9562de2127f3aa9230bd11fe 100644 (file)
@@ -1,5 +1,3 @@
-STEPEdit.cxx
-STEPEdit.hxx
 STEPEdit_EditContext.cxx
 STEPEdit_EditContext.hxx
 STEPEdit_EditSDR.cxx
diff --git a/src/STEPEdit/STEPEdit.cxx b/src/STEPEdit/STEPEdit.cxx
deleted file mode 100644 (file)
index 42e1295..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <APIHeaderSection_MakeHeader.hxx>
-#include <IFSelect_SelectModelEntities.hxx>
-#include <IFSelect_SelectModelRoots.hxx>
-#include <IFSelect_SelectSignature.hxx>
-#include <IFSelect_Signature.hxx>
-#include <Interface_Protocol.hxx>
-#include <StepAP214.hxx>
-#include <StepAP214_Protocol.hxx>
-#include <StepData_StepModel.hxx>
-#include <STEPEdit.hxx>
-#include <StepSelect_StepType.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;
-}
diff --git a/src/STEPEdit/STEPEdit.hxx b/src/STEPEdit/STEPEdit.hxx
deleted file mode 100644 (file)
index 5e323a6..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-// Created on: 1998-07-29
-// Created by: Christian CAILLET
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _STEPEdit_HeaderFile
-#define _STEPEdit_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-class Interface_Protocol;
-class StepData_StepModel;
-class IFSelect_Signature;
-class IFSelect_SelectSignature;
-class STEPEdit_EditContext;
-class STEPEdit_EditSDR;
-
-
-//! Provides tools to exploit and edit a set of STEP data :
-//! editors, selections ..
-class STEPEdit 
-{
-public:
-
-  DEFINE_STANDARD_ALLOC
-
-  
-  //! Returns a Protocol fit for STEP (creates the first time)
-  Standard_EXPORT static Handle(Interface_Protocol) Protocol();
-  
-  //! Returns a new empty StepModel fit for STEP
-  //! i.e. with its header determined from Protocol
-  Standard_EXPORT static Handle(StepData_StepModel) NewModel();
-  
-  //! Returns a SignType fit for STEP (creates the first time)
-  Standard_EXPORT static Handle(IFSelect_Signature) SignType();
-  
-  //! Creates a Selection for ShapeDefinitionRepresentation
-  //! By default searches among root entities
-  Standard_EXPORT static Handle(IFSelect_SelectSignature) NewSelectSDR();
-  
-  //! 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
-  Standard_EXPORT static Handle(IFSelect_SelectSignature) NewSelectPlacedItem();
-  
-  //! 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
-  Standard_EXPORT static Handle(IFSelect_SelectSignature) NewSelectShapeRepr();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class STEPEdit_EditContext;
-friend class STEPEdit_EditSDR;
-
-};
-
-
-
-
-
-
-
-#endif // _STEPEdit_HeaderFile
index 5f43745447cf4acb214ca4876bfa14baa718d14d..f8fc60673406522abc2dc124bb5e5dc6f3ae57f0 100755 (executable)
@@ -1,5 +1,3 @@
-StepAP214.cxx
-StepAP214.hxx
 StepAP214_AppliedApprovalAssignment.cxx
 StepAP214_AppliedApprovalAssignment.hxx
 StepAP214_AppliedDateAndTimeAssignment.cxx
diff --git a/src/StepAP214/StepAP214.cxx b/src/StepAP214/StepAP214.cxx
deleted file mode 100644 (file)
index 77702ea..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <Interface_Statics.hxx>
-#include <StepAP214.hxx>
-#include <StepAP214_Protocol.hxx>
-
-StaticHandle(StepAP214_Protocol, proto);
-
-Handle(StepAP214_Protocol) StepAP214::Protocol()
-
-       {
-               InitHandleVoid(StepAP214_Protocol, proto);
-               return proto;
-       }
-
diff --git a/src/StepAP214/StepAP214.hxx b/src/StepAP214/StepAP214.hxx
deleted file mode 100644 (file)
index c603454..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-// Created on: 1995-12-01
-// Created by: EXPRESS->CDL V0.2 Translator
-// Copyright (c) 1995-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _StepAP214_HeaderFile
-#define _StepAP214_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-class StepAP214_Protocol;
-class StepAP214_AutoDesignDateAndPersonItem;
-class StepAP214_AutoDesignDateAndTimeItem;
-class StepAP214_AutoDesignDatedItem;
-class StepAP214_AutoDesignGeneralOrgItem;
-class StepAP214_AutoDesignOrganizationItem;
-class StepAP214_AutoDesignGroupedItem;
-class StepAP214_AutoDesignPresentedItemSelect;
-class StepAP214_AutoDesignReferencingItem;
-class StepAP214_DateAndTimeItem;
-class StepAP214_DateItem;
-class StepAP214_ApprovalItem;
-class StepAP214_OrganizationItem;
-class StepAP214_DocumentReferenceItem;
-class StepAP214_GroupItem;
-class StepAP214_PersonAndOrganizationItem;
-class StepAP214_PresentedItemSelect;
-class StepAP214_SecurityClassificationItem;
-class StepAP214_Protocol;
-class StepAP214_AutoDesignApprovalAssignment;
-class StepAP214_AutoDesignActualDateAndTimeAssignment;
-class StepAP214_AutoDesignNominalDateAndTimeAssignment;
-class StepAP214_AutoDesignActualDateAssignment;
-class StepAP214_AutoDesignNominalDateAssignment;
-class StepAP214_AutoDesignGroupAssignment;
-class StepAP214_AutoDesignOrganizationAssignment;
-class StepAP214_AutoDesignDateAndPersonAssignment;
-class StepAP214_AutoDesignPersonAndOrganizationAssignment;
-class StepAP214_AutoDesignPresentedItem;
-class StepAP214_AutoDesignSecurityClassificationAssignment;
-class StepAP214_AutoDesignDocumentReference;
-class StepAP214_AppliedApprovalAssignment;
-class StepAP214_AppliedDateAndTimeAssignment;
-class StepAP214_AppliedDateAssignment;
-class StepAP214_AppliedGroupAssignment;
-class StepAP214_AppliedOrganizationAssignment;
-class StepAP214_AppliedPersonAndOrganizationAssignment;
-class StepAP214_AppliedPresentedItem;
-class StepAP214_AppliedSecurityClassificationAssignment;
-class StepAP214_AppliedDocumentReference;
-class StepAP214_AppliedExternalIdentificationAssignment;
-class StepAP214_Class;
-class StepAP214_ExternalIdentificationItem;
-class StepAP214_ExternallyDefinedClass;
-class StepAP214_ExternallyDefinedGeneralProperty;
-class StepAP214_RepItemGroup;
-
-
-//! Complete AP214 CC1 , Revision 4
-//! Upgrading from Revision 2 to Revision 4 : 26 Mar 1997
-//! Splitting in sub-schemas : 5 Nov 1997
-class StepAP214 
-{
-public:
-
-  DEFINE_STANDARD_ALLOC
-
-  
-  //! creates a Protocol
-  Standard_EXPORT static Handle(StepAP214_Protocol) Protocol();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-friend class StepAP214_AutoDesignDateAndPersonItem;
-friend class StepAP214_AutoDesignDateAndTimeItem;
-friend class StepAP214_AutoDesignDatedItem;
-friend class StepAP214_AutoDesignGeneralOrgItem;
-friend class StepAP214_AutoDesignOrganizationItem;
-friend class StepAP214_AutoDesignGroupedItem;
-friend class StepAP214_AutoDesignPresentedItemSelect;
-friend class StepAP214_AutoDesignReferencingItem;
-friend class StepAP214_DateAndTimeItem;
-friend class StepAP214_DateItem;
-friend class StepAP214_ApprovalItem;
-friend class StepAP214_OrganizationItem;
-friend class StepAP214_DocumentReferenceItem;
-friend class StepAP214_GroupItem;
-friend class StepAP214_PersonAndOrganizationItem;
-friend class StepAP214_PresentedItemSelect;
-friend class StepAP214_SecurityClassificationItem;
-friend class StepAP214_Protocol;
-friend class StepAP214_AutoDesignApprovalAssignment;
-friend class StepAP214_AutoDesignActualDateAndTimeAssignment;
-friend class StepAP214_AutoDesignNominalDateAndTimeAssignment;
-friend class StepAP214_AutoDesignActualDateAssignment;
-friend class StepAP214_AutoDesignNominalDateAssignment;
-friend class StepAP214_AutoDesignGroupAssignment;
-friend class StepAP214_AutoDesignOrganizationAssignment;
-friend class StepAP214_AutoDesignDateAndPersonAssignment;
-friend class StepAP214_AutoDesignPersonAndOrganizationAssignment;
-friend class StepAP214_AutoDesignPresentedItem;
-friend class StepAP214_AutoDesignSecurityClassificationAssignment;
-friend class StepAP214_AutoDesignDocumentReference;
-friend class StepAP214_AppliedApprovalAssignment;
-friend class StepAP214_AppliedDateAndTimeAssignment;
-friend class StepAP214_AppliedDateAssignment;
-friend class StepAP214_AppliedGroupAssignment;
-friend class StepAP214_AppliedOrganizationAssignment;
-friend class StepAP214_AppliedPersonAndOrganizationAssignment;
-friend class StepAP214_AppliedPresentedItem;
-friend class StepAP214_AppliedSecurityClassificationAssignment;
-friend class StepAP214_AppliedDocumentReference;
-friend class StepAP214_AppliedExternalIdentificationAssignment;
-friend class StepAP214_Class;
-friend class StepAP214_ExternalIdentificationItem;
-friend class StepAP214_ExternallyDefinedClass;
-friend class StepAP214_ExternallyDefinedGeneralProperty;
-friend class StepAP214_RepItemGroup;
-
-};
-
-
-
-
-
-
-
-#endif // _StepAP214_HeaderFile
index e638995c6c4191a8ec26392ce0250d30aae55d9c..1db519f80eebb52bb08ab96182fdd8225295e294 100644 (file)
 
 IMPLEMENT_STANDARD_RTTIEXT(StepAP214_Protocol,StepData_Protocol)
 
-static Standard_CString schemaAP214CD  = "AUTOMOTIVE_DESIGN_CC2 { 1 2 10303 214 -1 1 5 4 }";
-static Standard_CString schemaAP214DIS = "AUTOMOTIVE_DESIGN { 1 2 10303 214 0 1 1 1 }";
-static Standard_CString schemaAP214IS  = "AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }";
-static Standard_CString schemaAP203    = "CONFIG_CONTROL_DESIGN";
-static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF. {1 0 10303 442 1 1 4 }";
+Standard_CString schemaAP214CD  = "AUTOMOTIVE_DESIGN_CC2 { 1 2 10303 214 -1 1 5 4 }";
+Standard_CString schemaAP214DIS = "AUTOMOTIVE_DESIGN { 1 2 10303 214 0 1 1 1 }";
+Standard_CString schemaAP214IS  = "AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }";
+Standard_CString schemaAP203    = "CONFIG_CONTROL_DESIGN";
+Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERING_MIM_LF. {1 0 10303 442 1 1 4 }";
 
 #include <HeaderSection_Protocol.hxx>
 
@@ -454,7 +454,6 @@ static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERI
 #include <StepShape_ExtrudedFaceSolid.hxx>
 #include <StepShape_RevolvedFaceSolid.hxx>
 #include <StepShape_SweptFaceSolid.hxx>
-#include <Interface_Static.hxx>
 #include <StepBasic_AreaUnit.hxx>
 #include <StepBasic_VolumeUnit.hxx>
 #include <StepBasic_SiUnitAndAreaUnit.hxx>
@@ -755,22 +754,15 @@ static Standard_CString schemaAP242DIS = "AP242_MANAGED_MODEL_BASED_3D_ENGINEERI
 #include <StepVisual_SurfaceStyleRendering.hxx>
 #include <StepVisual_SurfaceStyleRenderingWithProperties.hxx>
 
-static int THE_StepAP214_Protocol_init = 0;
-static Interface_DataMapOfTransientInteger types(800);
-
 //=======================================================================
 //function : StepAP214_Protocol
 //purpose  : 
 //=======================================================================
 
-StepAP214_Protocol::StepAP214_Protocol ()
+StepAP214_Protocol::StepAP214_Protocol () :
+  myShemaName(schemaAP214IS),
+  types(800)
 {
-  if (THE_StepAP214_Protocol_init)
-  {
-    return;
-  }
-  THE_StepAP214_Protocol_init = 1;
-
   types.Bind (STANDARD_TYPE(StepBasic_Address), 1);
   types.Bind (STANDARD_TYPE(StepShape_AdvancedBrepShapeRepresentation), 2);
   types.Bind (STANDARD_TYPE(StepShape_AdvancedFace), 3);
@@ -1490,19 +1482,22 @@ Handle(Standard_Type)& atype) const
 //purpose  : 
 //=======================================================================
 
-Standard_CString StepAP214_Protocol::SchemaName() const
-{      
-  switch (Interface_Static::IVal("write.step.schema")) { //:j4
-  default:
-  case 1 : return schemaAP214CD;  break; 
-  case 2 : return schemaAP214DIS; break; 
-  case 3 : return schemaAP203;    break;
-  case 4:  return schemaAP214IS; break;
-  case 5 : return schemaAP242DIS; break;
+Standard_CString StepAP214_Protocol::SchemaName(Standard_Integer theShematype)
+{
+  if (theShematype != 0)
+  {
+    switch (theShematype) { //:j4
+      default:
+      case 1: myShemaName = schemaAP214CD;  break;
+      case 2: myShemaName = schemaAP214DIS; break;
+      case 3: myShemaName = schemaAP203;    break;
+      case 4: myShemaName = schemaAP214IS;  break;
+      case 5: myShemaName = schemaAP242DIS; break;
+    }
   }
+  return myShemaName;
 }
 
-
 //=======================================================================
 //function : NbResources
 //purpose  : 
index ab13ff90e81faf23578469daee078617e0864bcf..3d491f1356b850d086d9f6785c99d6b8cfde10f8 100644 (file)
@@ -43,7 +43,7 @@ public:
   //! Returns a Case Number for each of the StepAP214 Entities
   Standard_EXPORT virtual Standard_Integer TypeNumber (const Handle(Standard_Type)& atype) const Standard_OVERRIDE;
   
-  Standard_EXPORT virtual Standard_CString SchemaName() const Standard_OVERRIDE;
+  Standard_EXPORT virtual Standard_CString SchemaName(Standard_Integer theShematype = 0) Standard_OVERRIDE;
   
   //! Returns count of Protocol used as Resources (level one)
   Standard_EXPORT virtual Standard_Integer NbResources() const Standard_OVERRIDE;
@@ -63,8 +63,8 @@ protected:
 
 private:
 
-
-
+  Standard_CString myShemaName;
+  Interface_DataMapOfTransientInteger types;
 
 };
 
index 79e848c48e21615ce6fc102116670d270c4dda46..b82c6c305d3fb92e7a2cf9d565239e6c195b208d 100644 (file)
 //    svv #2    23.02.00: porting on SIL
 
 #include <Interface_Macros.hxx>
-#include <Interface_Static.hxx>
 #include <Interface_Statics.hxx>
 #include <StepData.hxx>
 #include <StepData_DefaultGeneral.hxx>
-#include <StepData_FileProtocol.hxx>
 #include <StepData_Protocol.hxx>
 
 StaticHandle(StepData_Protocol,proto);
@@ -32,7 +30,6 @@ StaticHandleA(StepData_Protocol,theheader);
 {
 //  InitHandleVoid(StepData_Protocol,proto);
 //  InitHandleVoid(StepData_DefaultGeneral,stmod);
-//:S4136  Interface_Static::Init("step","step.readaccept.void",'i',"1");
 //  if (proto.IsNull()) proto = new StepData_Protocol;
 //  if (stmod.IsNull()) stmod = new StepData_DefaultGeneral;
 }
@@ -50,13 +47,13 @@ StaticHandleA(StepData_Protocol,theheader);
   InitHandle(StepData_Protocol,theheader);
   if (theheader.IsNull()) theheader = header;
   else {
-    DeclareAndCast(StepData_FileProtocol,headmult,theheader);
-    if (headmult.IsNull()) {
-      headmult = new StepData_FileProtocol;
-      headmult->Add(theheader);
-    }
-    headmult->Add(header);
-    theheader = headmult;
+    //DeclareAndCast(StepData_FileProtocol,headmult,theheader);
+   // if (headmult.IsNull()) {
+     // headmult = new StepData_FileProtocol;
+      //headmult->Add(theheader);
+    //}
+    //headmult->Add(header);
+    //theheader = headmult;
   }
 }
 
index 0fdb5211cacfccd24b0d235f5775c87698b284cf..32e013d68b0eaa743b616258ddb586750f7b94e6 100644 (file)
@@ -46,8 +46,8 @@ class StepData_FreeFormEntity;
 class StepData_Protocol;
 class StepData_GeneralModule;
 class StepData_FileRecognizer;
-class StepData_FileProtocol;
-class StepData_HeaderTool;
+//class StepData_FileProtocol;
+//class StepData_HeaderTool;
 class StepData_EnumTool;
 class StepData_DescrProtocol;
 class StepData_DescrGeneral;
@@ -127,12 +127,12 @@ friend class StepData_FreeFormEntity;
 friend class StepData_Protocol;
 friend class StepData_GeneralModule;
 friend class StepData_FileRecognizer;
-friend class StepData_FileProtocol;
-friend class StepData_HeaderTool;
+//friend class StepData_FileProtocol;
+//friend class StepData_HeaderTool;
 friend class StepData_EnumTool;
-friend class StepData_DescrProtocol;
-friend class StepData_DescrGeneral;
-friend class StepData_DescrReadWrite;
+//friend class StepData_DescrProtocol;
+//friend class StepData_DescrGeneral;
+//friend class StepData_DescrReadWrite;
 friend class StepData_StepReaderData;
 friend class StepData_StepReaderTool;
 friend class StepData_ReadWriteModule;
@@ -140,8 +140,8 @@ friend class StepData_StepWriter;
 friend class StepData_StepDumper;
 friend class StepData_WriterLib;
 friend class StepData_DefaultGeneral;
-friend class StepData_GlobalNodeOfWriterLib;
-friend class StepData_NodeOfWriterLib;
+//friend class StepData_GlobalNodeOfWriterLib;
+//friend class StepData_NodeOfWriterLib;
 
 };
 
diff --git a/src/StepData/StepData_FileProtocol.cxx b/src/StepData/StepData_FileProtocol.cxx
deleted file mode 100644 (file)
index 212ac03..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-
-#include <Interface_Check.hxx>
-#include <Interface_Graph.hxx>
-#include <Interface_Protocol.hxx>
-#include <Standard_Type.hxx>
-#include <StepData_FileProtocol.hxx>
-#include <StepData_Protocol.hxx>
-
-IMPLEMENT_STANDARD_RTTIEXT(StepData_FileProtocol,StepData_Protocol)
-
-//static TCollection_AsciiString  thename("");
-static Standard_CString  thename = "";
-
-//  Protocol fabrique a la demande avec d autres Protocoles
-
-
-    StepData_FileProtocol::StepData_FileProtocol ()    {  }
-
-    void StepData_FileProtocol::Add (const Handle(StepData_Protocol)& protocol)
-{
-  if (protocol.IsNull()) return;
-  Handle(Standard_Type) ptype = protocol->DynamicType();
-  Standard_Integer nb = thecomps.Length();
-  for (Standard_Integer i = 1; i <= nb; i ++) {
-    if (thecomps.Value(i)->IsInstance(ptype)) return;
-  }
-  thecomps.Append(protocol);
-}
-
-
-    Standard_Integer  StepData_FileProtocol::NbResources () const
-      {  return thecomps.Length();  }
-
-    Handle(Interface_Protocol) StepData_FileProtocol::Resource
-  (const Standard_Integer num) const
-      {  return Handle(Interface_Protocol)::DownCast(thecomps.Value(num));  }
-
-
-    Standard_Integer  StepData_FileProtocol::TypeNumber
-  (const Handle(Standard_Type)& /*atype*/) const
-      {  return 0;  }
-
-
-Standard_Boolean StepData_FileProtocol::GlobalCheck(const Interface_Graph& G,
-                                                    Handle(Interface_Check)& ach) const
-{
-  Standard_Boolean res = Standard_False;
-  Standard_Integer i,nb = NbResources();
-  for (i = 1; i <= nb; i ++) res |= Resource(i)->GlobalCheck (G,ach);
-  return res;
-}
-
-
-    Standard_CString StepData_FileProtocol::SchemaName () const
-      {  return thename;  }
diff --git a/src/StepData/StepData_FileProtocol.hxx b/src/StepData/StepData_FileProtocol.hxx
deleted file mode 100644 (file)
index 5f83066..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-// Created on: 1993-07-23
-// Created by: Christian CAILLET
-// Copyright (c) 1993-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#ifndef _StepData_FileProtocol_HeaderFile
-#define _StepData_FileProtocol_HeaderFile
-
-#include <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TColStd_SequenceOfTransient.hxx>
-#include <StepData_Protocol.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Type.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_CString.hxx>
-class StepData_Protocol;
-class Interface_Protocol;
-class Interface_Graph;
-class Interface_Check;
-
-
-class StepData_FileProtocol;
-DEFINE_STANDARD_HANDLE(StepData_FileProtocol, StepData_Protocol)
-
-//! A FileProtocol is defined as the addition of several already
-//! existing Protocols. It corresponds to the definition of a
-//! SchemaName with several Names, each one being attached to a
-//! specific Protocol. Thus, a File defined with a compound Schema
-//! is processed as any other one, once built the equivalent
-//! compound Protocol, a FileProtocol
-class StepData_FileProtocol : public StepData_Protocol
-{
-
-public:
-
-  
-  //! Creates an empty FileProtocol
-  Standard_EXPORT StepData_FileProtocol();
-  
-  //! Adds a Protocol to the definition list of the FileProtocol
-  //! But ensures that each class of Protocol is present only once
-  //! in this list
-  Standard_EXPORT void Add (const Handle(StepData_Protocol)& protocol);
-  
-  //! Gives the count of Protocols used as Resource (can be zero)
-  //! i.e. the count of Protocol recorded by calling the method Add
-  Standard_EXPORT virtual Standard_Integer NbResources() const Standard_OVERRIDE;
-  
-  //! Returns a Resource, given a rank. Here, rank of calling Add
-  Standard_EXPORT virtual Handle(Interface_Protocol) Resource (const Standard_Integer num) const Standard_OVERRIDE;
-  
-  //! Returns a Case Number, specific of each recognized Type
-  //! Here, NO Type at all is recognized properly : all Types are
-  //! recognized by the resources
-  Standard_EXPORT virtual Standard_Integer TypeNumber (const Handle(Standard_Type)& atype) const Standard_OVERRIDE;
-  
-  //! Calls GlobalCheck for each of its recorded ressources
-  Standard_EXPORT virtual Standard_Boolean GlobalCheck (const Interface_Graph& G, Handle(Interface_Check)& ach) const Standard_OVERRIDE;
-  
-  //! Returns the Schema Name attached to each class of Protocol
-  //! To be redefined by each sub-class
-  //! Here, SchemaName returns "" (empty String)
-  //! was C++ : return const
-  Standard_EXPORT virtual Standard_CString SchemaName() const Standard_OVERRIDE;
-
-
-
-
-  DEFINE_STANDARD_RTTIEXT(StepData_FileProtocol,StepData_Protocol)
-
-protected:
-
-
-
-
-private:
-
-
-  TColStd_SequenceOfTransient thecomps;
-
-
-};
-
-
-
-
-
-
-
-#endif // _StepData_FileProtocol_HeaderFile
index 614fde78a6675a55efa7ab1c18489be461cd6e7c..f5ce0382dade60c2148ad30f71c3d7258af081d7 100644 (file)
@@ -70,12 +70,11 @@ Standard_Integer  StepData_Protocol::TypeNumber
 }
 
 
-Standard_CString StepData_Protocol::SchemaName () const
+Standard_CString StepData_Protocol::SchemaName (Standard_Integer /*theShematype*/)
 {
   return thename;
 }
 
-
 Handle(Interface_InterfaceModel)  StepData_Protocol::NewModel () const 
 {
   return new StepData_StepModel;
index c6bba9699c67eeba6c281ecd222d4582dd6e9191..a0ada9297eaac5700a10932a529152c51bc1515d 100644 (file)
@@ -72,7 +72,7 @@ public:
   //! To be redefined by each sub-class
   //! Here, SchemaName returns "(DEFAULT)"
   //! was C++ : return const
-  Standard_EXPORT virtual Standard_CString SchemaName() const;
+  Standard_EXPORT virtual Standard_CString SchemaName(Standard_Integer theShematype = 0);
   
   //! Creates an empty Model for Step Norm
   Standard_EXPORT Handle(Interface_InterfaceModel) NewModel() const Standard_OVERRIDE;
index 69de9afc1f366a9cb423db02fdbb6b43b91c2c65..7a87021836bd6427efc6d368d92c0c0d6862b2e9 100644 (file)
 IMPLEMENT_STANDARD_RTTIEXT(StepData_StepModel,Interface_InterfaceModel)
 
 // Entete de fichier : liste d entites
-StepData_StepModel::StepData_StepModel ()  {  }
+StepData_StepModel::StepData_StepModel ()
+{
+  initParameters();
+}
 
+//=======================================================================
+//function : initParameters
+//purpose  : 
+//=======================================================================
+void StepData_StepModel::initParameters()
+{
+  //for each created item, value from static map should be
+  //checked, if static map is bound with this parameter than get value from static
+  Handle(Interface_Static) aStaticItem;
+  Handle(Interface_Static) anItem = new Interface_Static("step", "write.step.product.name", Interface_ParamText, "");
+  myParamMap.Bind("write.step.product.name", anItem);
+
+  anItem = new Interface_Static("step", "write.step.assembly", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 0");
+  Interface_Static::InitValues(anItem, "eval Off");
+  Interface_Static::InitValues(anItem, "eval On");
+  Interface_Static::InitValues(anItem, "eval Auto");
+  aStaticItem = Interface_Static::Static("write.step.assembly");
+  anItem->SetCStringValue(aStaticItem.IsNull() ? "Auto" : aStaticItem->CStringValue());
+  myParamMap.Bind("write.step.assembly", anItem);
+
+  anItem = new Interface_Static("step", "step.angleunit.mode", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 0");
+  Interface_Static::InitValues(anItem, "eval File");
+  Interface_Static::InitValues(anItem, "eval Rad");
+  Interface_Static::InitValues(anItem, "eval Deg");
+  aStaticItem = Interface_Static::Static("step.angleunit.mode");
+  anItem->SetCStringValue(aStaticItem.IsNull() ? "File" : aStaticItem->CStringValue());
+  myParamMap.Bind("step.angleunit.mode", anItem);
+
+  anItem = new Interface_Static("step", "write.step.schema", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 1");
+  Interface_Static::InitValues(anItem, "eval AP214CD");
+  Interface_Static::InitValues(anItem, "eval AP214DIS");
+  Interface_Static::InitValues(anItem, "eval AP203");
+  Interface_Static::InitValues(anItem, "eval AP214IS");
+  Interface_Static::InitValues(anItem, "eval AP242DIS");
+  aStaticItem = Interface_Static::Static("write.step.schema");
+  anItem->SetCStringValue(aStaticItem.IsNull() ? "AP214IS" : aStaticItem->CStringValue());
+  myParamMap.Bind("write.step.schema", anItem);
+
+  // Type of Product Definition for reading
+  // Note: the numbers should be consistent with function FindShapeReprType()
+  // in STEPControl_ActorRead.cxx
+  anItem = new Interface_Static("step", "read.step.shape.repr", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 1");
+  Interface_Static::InitValues(anItem, "eval All");   // 1
+  Interface_Static::InitValues(anItem, "eval ABSR");  // 2
+  Interface_Static::InitValues(anItem, "eval MSSR");  // 3
+  Interface_Static::InitValues(anItem, "eval GBSSR"); // 4
+  Interface_Static::InitValues(anItem, "eval FBSR");  // 5
+  Interface_Static::InitValues(anItem, "eval EBWSR"); // 6
+  Interface_Static::InitValues(anItem, "eval GBWSR"); // 7
+  aStaticItem = Interface_Static::Static("read.step.shape.repr");
+  anItem->SetCStringValue(aStaticItem.IsNull() ? "All" : aStaticItem->CStringValue());
+  myParamMap.Bind("read.step.shape.repr", anItem);
+
+  // Mode for reading shapes attached to main SDR by SRR
+  // (hybrid model representation in AP203 since 1998)
+  anItem = new Interface_Static("step", "read.step.shape.relationship", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 0");
+  Interface_Static::InitValues(anItem, "eval OFF");
+  Interface_Static::InitValues(anItem, "eval ON");
+  aStaticItem = Interface_Static::Static("read.step.shape.relationship");
+  anItem->SetCStringValue(aStaticItem.IsNull() ? "ON" : aStaticItem->CStringValue());
+  myParamMap.Bind("read.step.shape.relationship", anItem);
+
+  // Mode for reading shapes attached to Product by ShapeAspect 
+  // (hybrid model representation in AP203 before 1998)
+  anItem = new Interface_Static("step", "read.step.shape.aspect", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 0");
+  Interface_Static::InitValues(anItem, "eval OFF");
+  Interface_Static::InitValues(anItem, "eval ON");
+  aStaticItem = Interface_Static::Static("read.step.shape.aspect");
+  anItem->SetCStringValue(aStaticItem.IsNull() ? "ON" : aStaticItem->CStringValue());
+  myParamMap.Bind("read.step.shape.aspect", anItem);
+
+  // Mode for reading SDR and ShapeRepr if it is necessary
+  anItem = new Interface_Static("step", "read.step.product.mode", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 0");
+  Interface_Static::InitValues(anItem, "eval OFF");
+  Interface_Static::InitValues(anItem, "eval ON");
+  aStaticItem = Interface_Static::Static("read.step.product.mode");
+  anItem->SetCStringValue(aStaticItem.IsNull() ? "ON" : aStaticItem->CStringValue());
+  myParamMap.Bind("read.step.product.mode", anItem);
+
+  // Order of reading ShapeDefinitionRepresentation in ProductDefinition
+  anItem = new Interface_Static("step", "read.step.product.context", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 1");
+  Interface_Static::InitValues(anItem, "eval all");     // 1
+  Interface_Static::InitValues(anItem, "eval design");  // 2
+  Interface_Static::InitValues(anItem, "eval analysis");// 3
+  aStaticItem = Interface_Static::Static("read.step.product.context");
+  anItem->SetCStringValue(aStaticItem.IsNull() ? "all" : aStaticItem->CStringValue());
+  myParamMap.Bind("read.step.product.context", anItem);
+
+  // What we try to read in ProductDefinition
+  anItem = new Interface_Static("step", "read.step.assembly.level", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 1");
+  Interface_Static::InitValues(anItem, "eval all");      // 1
+  Interface_Static::InitValues(anItem, "eval assembly"); // 2
+  Interface_Static::InitValues(anItem, "eval structure");// 3
+  Interface_Static::InitValues(anItem, "eval shape");    // 4
+  aStaticItem = Interface_Static::Static("read.step.assembly.level");
+  anItem->SetCStringValue(aStaticItem.IsNull() ? "all" : aStaticItem->CStringValue());
+  myParamMap.Bind("read.step.assembly.level", anItem);
+
+  // unit: supposed to be cascade unit (target unit for reading)
+  anItem = new Interface_Static("step", "write.step.unit", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "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
+  aStaticItem = Interface_Static::Static("write.step.unit");
+  anItem->SetCStringValue(aStaticItem.IsNull() ? "MM" : aStaticItem->CStringValue());
+  myParamMap.Bind("write.step.unit", anItem);
+
+  // Non-manifold topology reading: OFF by default (ssv; 26.11.2010)
+  anItem = new Interface_Static("step", "read.step.nonmanifold", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 0");
+  Interface_Static::InitValues(anItem, "eval Off");
+  Interface_Static::InitValues(anItem, "eval On");
+  aStaticItem = Interface_Static::Static("read.step.nonmanifold");
+  anItem->SetIntegerValue(aStaticItem.IsNull() ? 0 : aStaticItem->IntegerValue());
+  myParamMap.Bind("read.step.nonmanifold", anItem);
+
+  // Non-manifold topology writing: OFF by default (ssv; 26.11.2010)
+  anItem = new Interface_Static("step", "write.step.nonmanifold", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 0");
+  Interface_Static::InitValues(anItem, "eval Off");
+  Interface_Static::InitValues(anItem, "eval On");
+  aStaticItem = Interface_Static::Static("write.step.nonmanifold");
+  anItem->SetIntegerValue(aStaticItem.IsNull() ? 0 : aStaticItem->IntegerValue());
+  myParamMap.Bind("write.step.nonmanifold", anItem);
+
+  // I-Deas-like STEP processing: OFF by default (ssv; 22.11.2010)
+  anItem = new Interface_Static("step", "read.step.ideas", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 0");
+  Interface_Static::InitValues(anItem, "eval Off");
+  Interface_Static::InitValues(anItem, "eval On");
+  aStaticItem = Interface_Static::Static("read.step.ideas");
+  anItem->SetIntegerValue(aStaticItem.IsNull() ? 0 : aStaticItem->IntegerValue());
+  myParamMap.Bind("read.step.ideas", anItem);
+
+  //Parameter to write all free vertices in one SDR (name and style of vertex are lost) (default) 
+  //or each vertex in its own SDR (name and style of vertex are exported). (ika; 21.07.2014)
+  anItem = new Interface_Static("step", "write.step.vertex.mode", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 0");
+  Interface_Static::InitValues(anItem, "eval One Compound");
+  Interface_Static::InitValues(anItem, "eval Single Vertex");
+  aStaticItem = Interface_Static::Static("write.step.vertex.mode");
+  anItem->SetIntegerValue(aStaticItem.IsNull() ? 0 : aStaticItem->IntegerValue());
+  myParamMap.Bind("write.step.vertex.mode", anItem);
+
+  // abv 15.11.00: ShapeProcessing
+  anItem = new Interface_Static("XSTEP", "write.step.resource.name", Interface_ParamText, "STEP");
+  myParamMap.Bind("write.step.resource.name", anItem);
+  anItem = new Interface_Static("XSTEP", "read.step.resource.name", Interface_ParamText, "STEP");
+  myParamMap.Bind("read.step.resource.name", anItem);
+  anItem = new Interface_Static("XSTEP", "write.step.sequence", Interface_ParamText, "ToSTEP");
+  myParamMap.Bind("write.step.sequence", anItem);
+  anItem = new Interface_Static("XSTEP", "read.step.sequence", Interface_ParamText, "FromSTEP");
+  myParamMap.Bind("read.step.sequence", anItem);
+
+  // ika 28.07.16: Paremeter to read all top level solids and shells,
+  // should be used only in case of invalid shape_representation without links to shapes.
+  anItem = new Interface_Static("step", "read.step.all.shapes", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 0");
+  Interface_Static::InitValues(anItem, "eval Off");
+  Interface_Static::InitValues(anItem, "eval On");
+  aStaticItem = Interface_Static::Static("read.step.all.shapes");
+  anItem->SetIntegerValue(aStaticItem.IsNull() ? 0 : aStaticItem->IntegerValue());
+  myParamMap.Bind("read.step.all.shapes", anItem);
+
+  //--------------------------------------------------------------------------------
+  //From Base Class
+  anItem = new Interface_Static("XSTEP", "read.precision.mode", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "ematch 0");
+  Interface_Static::InitValues(anItem, "eval File");
+  Interface_Static::InitValues(anItem, "eval User");
+  anItem->SetIntegerValue(0);
+  aStaticItem = Interface_Static::Static("read.precision.mode");
+  anItem->SetIntegerValue(aStaticItem.IsNull() ? 0 : aStaticItem->IntegerValue());
+  myParamMap.Bind("read.precision.mode", anItem);
+
+  anItem = new Interface_Static("XSTEP", "read.precision.val", Interface_ParamReal, "1.e-03");
+  myParamMap.Bind("read.precision.val", anItem);
+
+  anItem = new Interface_Static("XSTEP", "read.maxprecision.mode", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "ematch 0");
+  Interface_Static::InitValues(anItem, "eval Preferred");
+  Interface_Static::InitValues(anItem, "eval Forced");
+  aStaticItem = Interface_Static::Static("read.maxprecision.mode");
+  anItem->SetIntegerValue(aStaticItem.IsNull() ? 0 : aStaticItem->IntegerValue());
+  myParamMap.Bind("read.maxprecision.mode", anItem);
+
+  anItem = new Interface_Static("XSTEP", "read.maxprecision.val", Interface_ParamReal, "1.");
+  myParamMap.Bind("read.maxprecision.val", anItem);
+
+  //   encode regularity
+  //  negatif ou nul : ne rien faire. positif : on y va
+  anItem = new Interface_Static("XSTEP", "read.encoderegularity.angle", Interface_ParamReal, "0.01");
+  myParamMap.Bind("read.encoderegularity.angle", anItem);
+
+  //   compute surface curves
+  //  0 : par defaut. 2 : ne garder que le 2D. 3 : ne garder que le 3D
+  //gka S4054
+  anItem = new Interface_Static("XSTEP", "read.surfacecurve.mode", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "ematch -3");
+  Interface_Static::InitValues(anItem, "eval 3DUse_Forced");
+  Interface_Static::InitValues(anItem, "eval 2DUse_Forced");
+  Interface_Static::InitValues(anItem, "eval ?");
+  Interface_Static::InitValues(anItem, "eval Default");
+  Interface_Static::InitValues(anItem, "eval ?");
+  Interface_Static::InitValues(anItem, "eval 2DUse_Preferred");
+  Interface_Static::InitValues(anItem, "eval 3DUse_Preferred");
+  aStaticItem = Interface_Static::Static("read.surfacecurve.mode");
+  anItem->SetIntegerValue(aStaticItem.IsNull() ? 0 : aStaticItem->IntegerValue());
+  myParamMap.Bind("read.surfacecurve.mode", anItem);
+
+  //   write precision
+  anItem = new Interface_Static("XSTEP", "write.precision.mode", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "ematch -1");
+  Interface_Static::InitValues(anItem, "eval Min");
+  Interface_Static::InitValues(anItem, "eval Average");
+  Interface_Static::InitValues(anItem, "eval Max");
+  Interface_Static::InitValues(anItem, "eval User");
+  aStaticItem = Interface_Static::Static("write.precision.mode");
+  anItem->SetIntegerValue(aStaticItem.IsNull() ? 0 : aStaticItem->IntegerValue());
+  myParamMap.Bind("write.precision.mode", anItem);
+
+  anItem = new Interface_Static("XSTEP", "write.precision.val", Interface_ParamReal, "1.e-03");
+  myParamMap.Bind("write.precision.val", anItem);
+
+  // Write surface curves
+  // 0: write (defaut), 1: do not write, 2: write except for analytical surfaces
+  anItem = new Interface_Static("XSTEP", "write.surfacecurve.mode", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "ematch 0");
+  Interface_Static::InitValues(anItem, "eval Off");
+  Interface_Static::InitValues(anItem, "eval On");
+  //Interface_Static::InitValues(anItem,"eval NoAnalytic");
+  aStaticItem = Interface_Static::Static("write.surfacecurve.mode");
+  anItem->SetIntegerValue(aStaticItem.IsNull() ? 1 : aStaticItem->IntegerValue());
+  myParamMap.Bind("write.surfacecurve.mode", anItem);
+  //--------------------------------------------------------------------------------
+
+  //#74 rln 10.03.99 S4135: adding new parameter for handling use of BRepLib::SameParameter
+  anItem = new Interface_Static("XSTEP", "read.stdsameparameter.mode", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "ematch 0");
+  Interface_Static::InitValues(anItem, "eval Off");
+  Interface_Static::InitValues(anItem, "eval On");
+  aStaticItem = Interface_Static::Static("read.stdsameparameter.mode");
+  anItem->SetIntegerValue(aStaticItem.IsNull() ? 0 : aStaticItem->IntegerValue());
+  myParamMap.Bind("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::InitValues(anItem, "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
+  aStaticItem = Interface_Static::Static("xstep.cascade.unit");
+  anItem->SetCStringValue(aStaticItem.IsNull() ? "MM" : aStaticItem->CStringValue());
+  myParamMap.Bind("xstep.cascade.unit", anItem);
+
+  //-----------------------------------------------------------
+  // Few variables for advanced control of translation process
+  //-----------------------------------------------------------
+
+  // Indicates whether to write sub-shape names to 'Name' attributes of
+  // STEP Representation Items
+  anItem = new Interface_Static("stepcaf", "write.stepcaf.subshapes.name", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 0");
+  Interface_Static::InitValues(anItem, "eval Off"); // 0
+  Interface_Static::InitValues(anItem, "eval On");  // 1
+  aStaticItem = Interface_Static::Static("write.stepcaf.subshapes.name");
+  anItem->SetIntegerValue(aStaticItem.IsNull() ? 0 : aStaticItem->IntegerValue());
+  myParamMap.Bind("write.stepcaf.subshapes.name", anItem);
+
+  // Indicates whether to read sub-shape names from 'Name' attributes of
+  // STEP Representation Items
+  anItem = new Interface_Static("stepcaf", "read.stepcaf.subshapes.name", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 0");
+  Interface_Static::InitValues(anItem, "eval Off"); // 0
+  Interface_Static::InitValues(anItem, "eval On");  // 1
+  aStaticItem = Interface_Static::Static("read.stepcaf.subshapes.name");
+  anItem->SetIntegerValue(aStaticItem.IsNull() ? 0 : aStaticItem->IntegerValue());
+  myParamMap.Bind("read.stepcaf.subshapes.name", anItem);
+
+  // STEP file encoding for names translation
+  // Note: the numbers should be consistent with Resource_FormatType enumeration
+  anItem = new Interface_Static ("stepcaf", "read.stepcaf.codepage", Interface_ParamEnum, "");
+  Interface_Static::InitValues(anItem, "enum 0");
+  Interface_Static::InitValues(anItem, "eval SJIS");         // Resource_FormatType_SJIS
+  Interface_Static::InitValues(anItem, "eval EUC");          // Resource_FormatType_EUC
+  Interface_Static::InitValues(anItem, "eval ANSI");         // Resource_FormatType_ANSI
+  Interface_Static::InitValues(anItem, "eval GB");           // Resource_FormatType_GB
+  Interface_Static::InitValues(anItem, "eval UTF8");         // Resource_FormatType_UTF8
+  Interface_Static::InitValues(anItem, "eval SystemLocale"); // Resource_FormatType_SystemLocale
+  aStaticItem = Interface_Static::Static("read.stepcaf.codepage");
+  anItem->SetIntegerValue(aStaticItem.IsNull() ? 0 : aStaticItem->IntegerValue());
+  myParamMap.Bind("read.stepcaf.codepage", anItem);
+}
 
 Handle(Standard_Transient) StepData_StepModel::Entity
 (const Standard_Integer num) const
@@ -88,19 +410,19 @@ void StepData_StepModel::AddHeaderEntity
 {  theheader.Append(ent);  }
 
 
-void StepData_StepModel::VerifyCheck(Handle(Interface_Check)& ach) const
-{
-  Interface_GeneralLib lib(StepData::HeaderProtocol());
-  Handle(StepData_StepModel) me (this);
-  Handle(Interface_Protocol) aHP = StepData::HeaderProtocol();
-  Interface_ShareTool sh(me,aHP);
-  Handle(Interface_GeneralModule) module;  Standard_Integer CN;
-  for (Interface_EntityIterator iter = Header(); iter.More(); iter.Next()) {
-    Handle(Standard_Transient) head = iter.Value();
-    if (!lib.Select(head,module,CN)) continue;
-    module->CheckCase(CN,head,sh,ach);
-  }
-}
+//void StepData_StepModel::VerifyCheck(Handle(Interface_Check)& ach) const
+//{
+//  Interface_GeneralLib lib(StepData::HeaderProtocol());
+//  Handle(StepData_StepModel) me (this);
+//  Handle(Interface_Protocol) aHP = StepData::HeaderProtocol();
+//  Interface_ShareTool sh(me,aHP);
+//  Handle(Interface_GeneralModule) module;  Standard_Integer CN;
+//  for (Interface_EntityIterator iter = Header(); iter.More(); iter.Next()) {
+//    Handle(Standard_Transient) head = iter.Value();
+//    if (!lib.Select(head,module,CN)) continue;
+//    module->CheckCase(CN,head,sh,ach);
+//  }
+//}
 
 
 void StepData_StepModel::DumpHeader
index 3a54fa7b90ef3faede9982ca20560ec24d84c409..6a59f2e8c1c30d9f66a8dd49b14b938c1794af78 100644 (file)
@@ -23,6 +23,8 @@
 #include <Interface_EntityList.hxx>
 #include <TColStd_HArray1OfInteger.hxx>
 #include <Interface_InterfaceModel.hxx>
+#include <Interface_Protocol.hxx>
+#include <Interface_Static.hxx>
 #include <Standard_Integer.hxx>
 #include <Standard_Boolean.hxx>
 #include <Standard_Type.hxx>
@@ -49,7 +51,7 @@ public:
   
   //! Creates an empty STEP model with an empty header.
   Standard_EXPORT StepData_StepModel();
-  
+
   //! returns entity given its rank.
   //! Same as InterfaceEntity, but with a shorter name
   Standard_EXPORT Handle(Standard_Transient) Entity (const Standard_Integer num) const;
@@ -76,7 +78,7 @@ public:
   Standard_EXPORT void AddHeaderEntity (const Handle(Standard_Transient)& ent);
   
   //! Specific Check, checks Header Items with HeaderProtocol
-  Standard_EXPORT virtual void VerifyCheck (Handle(Interface_Check)& ach) const Standard_OVERRIDE;
+  //Standard_EXPORT virtual void VerifyCheck (Handle(Interface_Check)& ach) const Standard_OVERRIDE;
   
   //! Dumps the Header, with the Header Protocol of StepData.
   //! If the Header Protocol is not defined, for each Header Entity,
@@ -106,11 +108,12 @@ public:
 
 
 
-
   DEFINE_STANDARD_RTTIEXT(StepData_StepModel,Interface_InterfaceModel)
 
 protected:
 
+  //! Initialises all non-static parameters used in translations
+  Standard_EXPORT void initParameters();
 
 
 
index 69bcda5903547fe11f8d2ad543c57bebbfdb6398..84be38dabb655aea2e156848c392fbbfffa2dfde 100644 (file)
@@ -1034,14 +1034,14 @@ Standard_Boolean StepData_StepReaderData::ReadEntity(const Standard_Integer num,
     if (FP.ParamType() == Interface_ParamIdent) {
       warn = (acceptvoid > 0);
       if (nent > 0) {
-       Handle(Standard_Transient) entent = BoundEntity(nent);
+        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(STANDARD_TYPE(StepData_UndefinedEntity)))
             ent = entent;
         }
-       else ent = entent;
+        else ent = entent;
       }
       else errmess = new String("Parameter n0.%d (%s) : Unresolved reference");
     }
@@ -1082,15 +1082,15 @@ Standard_Boolean StepData_StepReaderData::ReadEntity(const Standard_Integer num,
     if (FP.ParamType() == Interface_ParamIdent) {
       warn = (acceptvoid > 0);
       if (nent > 0) {
-       Handle(Standard_Transient) entent = BoundEntity(nent);
+        Handle(Standard_Transient) entent = BoundEntity(nent);
         if (!sel.Matches(entent))
         {
           errmess = new String("Parameter n0.%d (%s) : Entity has illegal type");
-          //fot not suppported STEP entity
+          //for not suppported STEP entity
           if (!entent.IsNull() && entent->IsKind(STANDARD_TYPE(StepData_UndefinedEntity)))
             sel.SetValue(entent);
         }
-       else
+        else
           sel.SetValue(entent);
       }
       else
index fe22bb87140ca896346ae504f3c845e6cfef5090..5991388f08fc43d2466e7e62b73785dfb7f46136 100644 (file)
 #include <Interface_FileReaderTool.hxx>
 #include <Standard_Boolean.hxx>
 #include <Standard_Integer.hxx>
+#include <NCollection_List.hxx>
+#include <StepData_GeneralModule.hxx>
+#include <StepData_ReadWriteModule.hxx>
+
 class StepData_FileRecognizer;
 class StepData_StepReaderData;
 class StepData_Protocol;
@@ -100,7 +104,8 @@ protected:
 
 private:
 
-
+  NCollection_List<Handle(StepData_GeneralModule)> myglib;
+  NCollection_List<Handle(StepData_ReadWriteModule)> myrlib;
 
   Handle(StepData_FileRecognizer) thereco;
   Interface_GeneralLib theglib;
index ca16bd22fcd3433eb4910eab1664b481524fccf3..ec7fa89bb3b7ad9926a2bad3d4fd41ce4688ea22 100644 (file)
@@ -47,6 +47,7 @@ extern "C" void recfile_modeprint (int mode);  // controle trace recfile
 
 #include <Message_Messenger.hxx>
 #include <Message.hxx>
+#include <Standard_Mutex.hxx>
 
 #ifdef OCCT_DEBUG
 #define CHRONOMESURE
@@ -117,115 +118,120 @@ Standard_Integer StepFile_Read
   const Handle(StepData_FileRecognizer)& recodata)
 
 {
-  Handle(Message_Messenger) sout = Message::DefaultMessenger();
-  char *ficnom = nomfic ;  // because const (non reconnu par C)
-
-  checkread->Clear();
-  recfile_modeprint ( (modepr > 0 ? modepr-1 : 0) );
-  FILE* newin = stepread_setinput(ficnom);
-  if (!newin) return -1;
+  static Standard_Mutex aPars;
+  {
+    Standard_Mutex::Sentry aLock(aPars);
+      
+    Handle(Message_Messenger) sout = Message::DefaultMessenger();
+    char *ficnom = nomfic;  // because const (non reconnu par C)
+
+    checkread->Clear();
+    recfile_modeprint(( modepr > 0 ? modepr - 1 : 0 ));
+    FILE* newin = stepread_setinput(ficnom);
+    if (!newin) return -1;
 #ifdef CHRONOMESURE
-  Standard_Integer n ; 
-  OSD_Timer c ; 
-  c.Reset () ; 
-  c.Start();
-  sout << "      ...    Step File Reading : " << ficnom << "" << Message_EndLine;  
+    Standard_Integer n;
+    OSD_Timer c;
+    c.Reset();
+    c.Start();
+    sout << "      ...    Step File Reading : " << ficnom << "" << Message_EndLine;
 #endif
 
-  try {
-    OCC_CATCH_SIGNALS
-    if (stepread () != 0) {  lir_file_fin(3);  stepread_endinput (newin,ficnom);  return 1;  }
-  }
-  catch (Standard_Failure const& anException) {
+    try {
+      OCC_CATCH_SIGNALS
+        if (stepread() != 0) { lir_file_fin(3);  stepread_endinput(newin, ficnom);  return 1; }
+    }
+    catch (Standard_Failure const& anException) {
 #ifdef OCCT_DEBUG
-    sout << " ...  Exception Raised while reading Step File : " << ficnom << ":\n" << Message_EndLine;
-    sout << anException.GetMessageString();  
-    sout << "    ..." << Message_EndLine;
+      sout << " ...  Exception Raised while reading Step File : " << ficnom << ":\n" << Message_EndLine;
+      sout << anException.GetMessageString();
+      sout << "    ..." << Message_EndLine;
 #endif
-    (void)anException;
-    lir_file_fin(3);  
-    stepread_endinput (newin,ficnom);  
-    return 1;
-  }
-  // Continue reading of file despite of possible fails
-  //if (checkread->HasFailed()) {  lir_file_fin(3);  stepread_endinput (newin,ficnom);  return 1;  }
+      (void)anException;
+      lir_file_fin(3);
+      stepread_endinput(newin, ficnom);
+      return 1;
+    }
+    // Continue reading of file despite of possible fails
+    //if (checkread->HasFailed()) {  lir_file_fin(3);  stepread_endinput (newin,ficnom);  return 1;  }
 #ifdef CHRONOMESURE
-  sout << "      ...    STEP File   Read    ... " << Message_EndLine;  
-  c.Show(); 
+    sout << "      ...    STEP File   Read    ... " << Message_EndLine;
+    c.Show();
 #endif
 
 
-//  Creation du StepReaderData
-
-  LesTypes[rec_argNondef]    = Interface_ParamVoid ;
-  LesTypes[rec_argSub]       = Interface_ParamSub ;
-  LesTypes[rec_argIdent]     = Interface_ParamIdent ;
-  LesTypes[rec_argInteger]   = Interface_ParamInteger ;
-  LesTypes[rec_argFloat]     = Interface_ParamReal ;
-  LesTypes[rec_argEnum]      = Interface_ParamEnum ;
-  LesTypes[rec_argBinary]    = Interface_ParamBinary ;
-  LesTypes[rec_argText]      = Interface_ParamText ;
-  LesTypes[rec_argHexa]      = Interface_ParamHexa ;
-  LesTypes[rec_argMisc]      = Interface_ParamMisc ;
-
-  Standard_Integer nbhead, nbrec, nbpar;
-  lir_file_nbr (&nbhead,&nbrec,&nbpar);  // renvoi par lex/yacc
-  Handle(StepData_StepReaderData) undirec =
-    new StepData_StepReaderData(nbhead,nbrec,nbpar);  // creation tableau de records
-
-  for ( Standard_Integer nr = 1; nr <= nbrec; nr ++) {
-    int nbarg; char* ident; char* typrec = 0;
-    lir_file_rec (&ident, &typrec, &nbarg);
-    undirec->SetRecord (nr, ident, typrec, nbarg);
-
-    if (nbarg>0) {
-      int typa; char* val;
-      Interface_ParamType newtype;
-      while(lir_file_arg (&typa, &val) == 1) {
-        newtype = LesTypes[typa] ;
-        undirec->AddStepParam (nr, val, newtype);
+    //  Creation du StepReaderData
+
+    LesTypes[rec_argNondef] = Interface_ParamVoid;
+    LesTypes[rec_argSub] = Interface_ParamSub;
+    LesTypes[rec_argIdent] = Interface_ParamIdent;
+    LesTypes[rec_argInteger] = Interface_ParamInteger;
+    LesTypes[rec_argFloat] = Interface_ParamReal;
+    LesTypes[rec_argEnum] = Interface_ParamEnum;
+    LesTypes[rec_argBinary] = Interface_ParamBinary;
+    LesTypes[rec_argText] = Interface_ParamText;
+    LesTypes[rec_argHexa] = Interface_ParamHexa;
+    LesTypes[rec_argMisc] = Interface_ParamMisc;
+
+    Standard_Integer nbhead, nbrec, nbpar;
+    lir_file_nbr(&nbhead, &nbrec, &nbpar);  // renvoi par lex/yacc
+    Handle(StepData_StepReaderData) undirec =
+      new StepData_StepReaderData(nbhead, nbrec, nbpar);  // creation tableau de records
+
+    for (Standard_Integer nr = 1; nr <= nbrec; nr++) {
+      int nbarg; char* ident; char* typrec = 0;
+      lir_file_rec(&ident, &typrec, &nbarg);
+      undirec->SetRecord(nr, ident, typrec, nbarg);
+
+      if (nbarg > 0) {
+        int typa; char* val;
+        Interface_ParamType newtype;
+        while (lir_file_arg(&typa, &val) == 1) {
+          newtype = LesTypes[typa];
+          undirec->AddStepParam(nr, val, newtype);
+        }
       }
+      undirec->InitParams(nr);
+      lir_file_finrec();
     }
-    undirec->InitParams(nr);
-    lir_file_finrec();
-  }
-  lir_file_fin(1);
-//  on a undirec pret pour la suite
+    lir_file_fin(1);
+    //  on a undirec pret pour la suite
 
 #ifdef CHRONOMESURE
-  sout << "      ... Step File loaded  ... " << Message_EndLine; 
-  c.Show();
-  sout << "   "<< undirec->NbRecords () <<
-      " records (entities,sub-lists,scopes), "<< nbpar << " parameters\n" << Message_EndLine;
+    sout << "      ... Step File loaded  ... " << Message_EndLine;
+    c.Show();
+    sout << "   " << undirec->NbRecords() <<
+      " records (entities,sub-lists,scopes), " << nbpar << " parameters\n" << Message_EndLine;
 #endif
 
-//   Analyse : par StepReaderTool
+    //   Analyse : par StepReaderTool
 
-  StepData_StepReaderTool readtool (undirec,protocol);
-  readtool.SetErrorHandle (Standard_True);
+    StepData_StepReaderTool readtool(undirec, protocol);
+    readtool.SetErrorHandle(Standard_True);
 
-  readtool.PrepareHeader(recoheader);  // Header. reco nul -> pour Protocol
-  readtool.Prepare(recodata);          // Data.   reco nul -> pour Protocol
+    readtool.PrepareHeader(recoheader);  // Header. reco nul -> pour Protocol
+    readtool.Prepare(recodata);          // Data.   reco nul -> pour Protocol
 
 #ifdef CHRONOMESURE
-  sout << "      ... Parameters prepared ... "; 
-  c.Show(); 
+    sout << "      ... Parameters prepared ... ";
+    c.Show();
 #endif
 
-  readtool.LoadModel(stepmodel);
-  if (stepmodel->Protocol().IsNull()) stepmodel->SetProtocol (protocol);
-  lir_file_fin(2);
-  
-  readtool.Clear();
-  undirec.Nullify();
+    readtool.LoadModel(stepmodel);
+    if (stepmodel->Protocol().IsNull()) stepmodel->SetProtocol(protocol);
+    lir_file_fin(2);
+
+    readtool.Clear();
+    undirec.Nullify();
 #ifdef CHRONOMESURE
-  sout << "      ...   Objets analysed  ... " << Message_EndLine; 
-  c.Show();
-  n = stepmodel->NbEntities() ;
-  sout << "  STEP Loading done : " << n << " Entities" << Message_EndLine;
+    sout << "      ...   Objets analysed  ... " << Message_EndLine;
+    c.Show();
+    n = stepmodel->NbEntities();
+    sout << "  STEP Loading done : " << n << " Entities" << Message_EndLine;
 #endif
-  
-  stepread_endinput (newin,ficnom);  return 0 ;
+
+    stepread_endinput(newin, ficnom);  return 0;
+  }
 }
 
 void StepFile_Interrupt (char* mess)
index fd82fee091e64b7dbe37c4f19ffddf31c380636e..484e778567c96deae2705f9fa70f1a1204dcbacc 100644 (file)
@@ -48,7 +48,7 @@ static TCollection_AsciiString lastvalue;
 
     Standard_CString  StepSelect_StepType::Value
   (const Handle(Standard_Transient)& ent,
-   const Handle(Interface_InterfaceModel)& /*model*/) const
+   const Handle(Interface_InterfaceModel)& model) const
 {
   lastvalue.Clear();
   Handle(StepData_ReadWriteModule) module;
@@ -56,7 +56,8 @@ static TCollection_AsciiString lastvalue;
   Standard_Boolean ok = thelib.Select (ent,module,CN);
   if (!ok) {
     lastvalue.AssignCat ("..NOT FROM SCHEMA ");
-    lastvalue.AssignCat (theproto->SchemaName());
+    Standard_Integer aval = model->IVal("write.step.schema");
+    lastvalue.AssignCat (theproto->SchemaName(aval));
     lastvalue.AssignCat ("..");
   } else {
     Standard_Boolean plex = module->IsComplex(CN);
index 03f303c647a63d71881e03c794c11870ba71727b..2879362de1893cb6a122bb53c6d1e92c0492e5f3 100644 (file)
@@ -70,8 +70,16 @@ Standard_Integer  StepSelect_WorkLibrary::ReadFile
   long status = 1;
   DeclareAndCast(StepData_Protocol,stepro,protocol);
   if (stepro.IsNull()) return 1;
-  Handle(StepData_StepModel) stepmodel  = new StepData_StepModel;
-  model  = stepmodel;
+   //ISCAR
+   Handle(StepData_StepModel) stepmodel;
+  if(!model.IsNull())
+    stepmodel = Handle(StepData_StepModel)::DownCast(model);
+  if(stepmodel.IsNull())
+  {
+    stepmodel  = new StepData_StepModel;
+    model = stepmodel;
+  }
   StepFile_ReadTrace (0);
   char *pName=(char *)name;
   status = StepFile_Read (pName,stepmodel,stepro);
index 7b9c3777794a3abd96c33f74a46c1c2e909a48c3..714898c40c1306eabae05246b8d68ae1854834ef 100644 (file)
@@ -1508,7 +1508,8 @@ Handle(Geom_Surface) StepToGeom::MakeSurface (const Handle(StepGeom_Surface)& SS
           const BRepBuilderAPI_MakeFace aBFace(aBasisSurface, Precision::Confusion());
           if (aBFace.IsDone())
           {
-            const TopoDS_Shape aResult = ShapeAlgo::AlgoContainer()->C0ShapeToC1Shape(aBFace.Face(), Abs(anOffset));
+            Handle(ShapeAlgo_AlgoContainer) aContainer = new ShapeAlgo_AlgoContainer;
+            const TopoDS_Shape aResult = aContainer->C0ShapeToC1Shape(aBFace.Face(), Abs(anOffset));
             if (aResult.ShapeType() == TopAbs_FACE)
             {
               aBasisSurface = BRep_Tool::Surface(TopoDS::Face(aResult));
index 892c2dd7763e50c5ed066eb795aacb2546fbfd55..a45e0930885be14c19f1a400416545f1aeb5f54d 100644 (file)
@@ -30,7 +30,6 @@
 #include <Geom_Curve.hxx>
 #include <Geom_RectangularTrimmedSurface.hxx>
 #include <Geom_Surface.hxx>
-#include <Interface_Static.hxx>
 #include <Message_Messenger.hxx>
 #include <Message_ProgressSentry.hxx>
 #include <Precision.hxx>
 #include <TransferBRep.hxx>
 
 #include <stdio.h>
-static void ResetPreci (const TopoDS_Shape& S, Standard_Real maxtol)
+static void ResetPreci (const TopoDS_Shape& S,
+                        Standard_Real maxtol,
+                        const Handle(Interface_InterfaceModel)& theModel)
 {
   //:S4136
-  Standard_Integer modetol = Interface_Static::IVal("read.maxprecision.mode");
+  Standard_Integer modetol = theModel->IVal("read.maxprecision.mode");
   if (modetol) {
     ShapeFix_ShapeTolerance STU;
     STU.LimitTolerance (S,Precision::Confusion(),maxtol);
@@ -228,7 +229,7 @@ void StepToTopoDS_Builder::Init
     }
 
 //:S4136    ShapeFix::SameParameter (S,Standard_False);
-    ResetPreci (S, MaxTol());
+    ResetPreci (S, MaxTol(), TP->Model());
   }
   else {
     TP->AddWarning(aShell," OuterShell from ManifoldSolidBrep not mapped to TopoDS");
@@ -336,7 +337,7 @@ void StepToTopoDS_Builder::Init
   }
 
 //:S4136  ShapeFix::SameParameter (S,Standard_False);
-  ResetPreci (S, MaxTol());
+  ResetPreci (S, MaxTol(), TP->Model());
 }
 
 // ============================================================================
@@ -543,8 +544,8 @@ void StepToTopoDS_Builder::Init
   }
 
 //:S4136  ShapeFix::SameParameter (S,Standard_False);
-  ResetPreci (S, MaxTol());
-  ResetPreci (Shl, MaxTol()); //skl
+  ResetPreci (S, MaxTol(), TP->Model());
+  ResetPreci (Shl, MaxTol(), TP->Model()); //skl
 }
 
 // ============================================================================
@@ -604,7 +605,7 @@ void StepToTopoDS_Builder::Init (const Handle(StepShape_EdgeBasedWireframeModel)
   myError  = ( myResult.IsNull() ? StepToTopoDS_BuilderDone : StepToTopoDS_BuilderOther );
   done     = ! myResult.IsNull();
 
-  ResetPreci (myResult, MaxTol());
+  ResetPreci (myResult, MaxTol(), TP->Model());
 }
 
 // ============================================================================
@@ -666,7 +667,7 @@ void StepToTopoDS_Builder::Init (const Handle(StepShape_FaceBasedSurfaceModel)&
   myError  = ( myResult.IsNull() ? StepToTopoDS_BuilderDone : StepToTopoDS_BuilderOther );
   done     = ! myResult.IsNull();
 
-  ResetPreci (myResult, MaxTol());
+  ResetPreci (myResult, MaxTol(), TP->Model());
 }
 
 
index 774c0d289b5e70591c70d0eb754537bfdee79ded..7b27eca17ef86219eed3016be4daec62d16ea221 100644 (file)
@@ -22,7 +22,7 @@
 #include <Geom2d_Curve.hxx>
 #include <Geom_Curve.hxx>
 #include <Geom_Surface.hxx>
-#include <Interface_Static.hxx>
+#include <Interface_InterfaceModel.hxx>
 #include <Precision.hxx>
 #include <ShapeExtend_WireData.hxx>
 #include <ShapeFix_Wire.hxx>
@@ -94,9 +94,9 @@ Standard_Boolean StepToTopoDS_TranslateCompositeCurve::Init (const Handle(StepGe
 //=======================================================================
 
 Standard_Boolean StepToTopoDS_TranslateCompositeCurve::Init (const Handle(StepGeom_CompositeCurve) &CC,
-                                                            const Handle(Transfer_TransientProcess) &TP,
-                                                            const Handle(StepGeom_Surface) &S,
-                                                            const Handle(Geom_Surface) &Surf)
+                                                             const Handle(Transfer_TransientProcess) &TP,
+                                                             const Handle(StepGeom_Surface) &S,
+                                                             const Handle(Geom_Surface) &Surf)
 {
   myWire.Nullify();
   myInfiniteSegment = Standard_False;
@@ -106,7 +106,7 @@ Standard_Boolean StepToTopoDS_TranslateCompositeCurve::Init (const Handle(StepGe
   Standard_Boolean isClosed = Standard_False;
 
   if ( SurfMode ) {
-    Standard_Integer modepcurve = Interface_Static::IVal("read.surfacecurve.mode");
+    Standard_Integer modepcurve = TP->Model()->IVal("read.surfacecurve.mode");
     if ( modepcurve ==-3 ) SurfMode = Standard_False;
   }
   
index be35bdd2d79a4080ffcc4a21363825c562c10b96..7249f906ad62ca9386ec1b87fd458744f88df523 100644 (file)
@@ -79,8 +79,10 @@ Standard_Boolean StepToTopoDS_TranslateCurveBoundedSurface::Init (
   // abv 30.06.00: trj4_k1_geo-tu.stp #108: do as in TranslateFace
   // pdn to force bsplsurf to be periodic
   Handle(StepGeom_BSplineSurface) sgbss = Handle(StepGeom_BSplineSurface)::DownCast(S);
-  if (!sgbss.IsNull()) {
-    Handle(Geom_Surface) periodicSurf = ShapeAlgo::AlgoContainer()->ConvertToPeriodic(Surf);
+  if (!sgbss.IsNull())
+  {
+    Handle(ShapeAlgo_AlgoContainer) aContainer = new ShapeAlgo_AlgoContainer;
+    Handle(Geom_Surface) periodicSurf = aContainer->ConvertToPeriodic(Surf);
     if (!periodicSurf.IsNull()) {
       TP->AddWarning(S, "Surface forced to be periodic");
       Surf = periodicSurf;
index e7f0e6578fc13935331f16f880a915ea0ccfd5a9..b970e187aa8f5cef41117a8b590dcc98ef76c6db 100644 (file)
@@ -38,7 +38,6 @@
 #include <Geom_Surface.hxx>
 #include <gp_Pnt.hxx>
 #include <gp_Pnt2d.hxx>
-#include <Interface_Static.hxx>
 #include <Precision.hxx>
 #include <ShapeAlgo.hxx>
 #include <ShapeAlgo_AlgoContainer.hxx>
@@ -50,6 +49,7 @@
 #include <ShapeFix_EdgeProjAux.hxx>
 #include <Standard_ErrorHandler.hxx>
 #include <StdFail_NotDone.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepGeom_Curve.hxx>
 #include <StepGeom_Pcurve.hxx>
 #include <StepGeom_PcurveOrSurface.hxx>
@@ -174,7 +174,8 @@ static void CheckPCurves (TopoDS_Wire& aWire, const TopoDS_Face& aFace,
 
 
     // advanced check
-    XSAlgo::AlgoContainer()->CheckPCurve (myEdge, aFace, preci, sbwd->IsSeam(i));
+    Handle(XSAlgo_AlgoContainer) aContainer = new XSAlgo_AlgoContainer;
+    aContainer->CheckPCurve(myEdge, aFace, preci, sbwd->IsSeam(i));
   }
 }
 
@@ -225,7 +226,10 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
     done     = Standard_True;
     return;
   }
-  Standard_Integer modepcurve = Interface_Static::IVal("read.surfacecurve.mode");
+  Handle(StepData_StepModel) aModel =
+    Handle(StepData_StepModel)::DownCast(aTool.TransientProcess()->Model());
+
+  Standard_Integer modepcurve = aModel->IVal("read.surfacecurve.mode");
   //  0,1 : suivre le code,  2 : ne prendre que pcurve,  3 : ne prendre que C3D
 
   BRep_Builder B;
@@ -686,7 +690,8 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
   if (!aTool.ComputePCurve())
     for (TopoDS_Iterator EdgeIt(W);EdgeIt.More();EdgeIt.Next()) {
       TopoDS_Edge edge = TopoDS::Edge(EdgeIt.Value());
-      Handle(ShapeFix_EdgeProjAux) myEdgePro = ShapeAlgo::AlgoContainer()->ToolContainer()->EdgeProjAux();
+      Handle(ShapeAlgo_AlgoContainer) aContainer = new ShapeAlgo_AlgoContainer;
+      Handle(ShapeFix_EdgeProjAux) myEdgePro =aContainer->ToolContainer()->EdgeProjAux();
       myEdgePro->Init (Face, edge);
       myEdgePro->Compute(preci);
       if (myEdgePro->IsFirstDone() && myEdgePro->IsLastDone()) {
index a1f6731339f161a22093f9eaef60b17bcde4a014..d0bd2d870d6c86402a2bd9ad81dd7df6e70047d5 100644 (file)
@@ -184,8 +184,10 @@ void StepToTopoDS_TranslateFace::Init
   }
   // pdn to force bsplsurf to be periodic
   Handle(StepGeom_BSplineSurface) sgbss = Handle(StepGeom_BSplineSurface)::DownCast(StepSurf);
-  if (!sgbss.IsNull()) {
-    Handle(Geom_Surface) periodicSurf = ShapeAlgo::AlgoContainer()->ConvertToPeriodic(GeomSurf);
+  if (!sgbss.IsNull())
+  {
+    Handle(ShapeAlgo_AlgoContainer) aContainer = new ShapeAlgo_AlgoContainer;
+    Handle(Geom_Surface) periodicSurf = aContainer->ConvertToPeriodic(GeomSurf);
     if (!periodicSurf.IsNull()) {
       TP->AddWarning(StepSurf, "Surface forced to be periodic");
       GeomSurf = periodicSurf;
index 9b466aa2ef9ccd576ccea7ef305c5dc446f140af..4a9065d3766d14a620a14899205ba8dbebad0ca0 100644 (file)
@@ -18,6 +18,7 @@
 #include <BRepClass3d.hxx>
 #include <MoniTool_DataMapOfShapeTransient.hxx>
 #include <StdFail_NotDone.hxx>
+#include <Interface_InterfaceModel.hxx>
 #include <StepShape_BrepWithVoids.hxx>
 #include <StepShape_ClosedShell.hxx>
 #include <StepShape_HArray1OfOrientedClosedShell.hxx>
@@ -76,7 +77,7 @@ TopoDSToStep_MakeBrepWithVoids::
          CurrentShell.Reverse(); 
        //:d7 abv 16 Mar 98: try to treat 'open' shells as closed since flag 
        // IsClosed() is often incorrect (taken from MakeManifoldSolid(Solid))
-       aTool.Init(aMap, Standard_False);
+       aTool.Init(aMap, Standard_False, FP->Model()->IVal("write.surfacecurve.mode"));
        StepB.Init(CurrentShell, aTool, FP);
        TopoDSToStep::AddResult ( FP, aTool );
        if (StepB.IsDone()) {
index 0584d37f38cc596ff54a049e546b2e88e00fd1d3..8eb354ad228d5c91b46c576645156131e2e7394b 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <BRepClass3d.hxx>
 #include <StdFail_NotDone.hxx>
+#include <Interface_InterfaceModel.hxx>
 #include <StepShape_ClosedShell.hxx>
 #include <StepShape_FacetedBrep.hxx>
 #include <StepShape_TopologicalRepresentationItem.hxx>
@@ -41,8 +42,9 @@ TopoDSToStep_MakeFacetedBrep::
   if (aShell.Closed()) {
     Handle(StepShape_TopologicalRepresentationItem) aItem;
     MoniTool_DataMapOfShapeTransient aMap;
-    
-    TopoDSToStep_Tool    aTool(aMap, Standard_True);
+    TopoDSToStep_Tool aTool(aMap,
+                            Standard_True,
+                            FP->Model()->IVal("write.surfacecurve.mode"));
     TopoDSToStep_Builder StepB(aShell, aTool, FP);
     TopoDSToStep::AddResult ( FP, aTool );
 
@@ -89,8 +91,9 @@ TopoDSToStep_MakeFacetedBrep::
     if (aOuterShell.Closed()) {
       Handle(StepShape_TopologicalRepresentationItem) aItem;
       MoniTool_DataMapOfShapeTransient aMap;
-      
-      TopoDSToStep_Tool    aTool(aMap, Standard_True);
+      TopoDSToStep_Tool aTool(aMap,
+                              Standard_True,
+                              FP->Model()->IVal("write.surfacecurve.mode"));
       TopoDSToStep_Builder StepB(aOuterShell, aTool, FP);
       TopoDSToStep::AddResult ( FP, aTool );
       
index 29d859f1bf2cf8252c392f08bc6707b33cdb0f89..5bd750195020835b9c68347ab78510e1061670f2 100644 (file)
@@ -18,6 +18,7 @@
 #include <BRepClass3d.hxx>
 #include <MoniTool_DataMapOfShapeTransient.hxx>
 #include <StdFail_NotDone.hxx>
+#include <Interface_InterfaceModel.hxx>
 #include <StepShape_ClosedShell.hxx>
 #include <StepShape_FacetedBrepAndBrepWithVoids.hxx>
 #include <StepShape_HArray1OfOrientedClosedShell.hxx>
@@ -67,7 +68,7 @@ TopoDSToStep_MakeFacetedBrepAndBrepWithVoids::
        TopoDS_Shell CurrentShell = TopoDS::Shell(It.Value());
        if (It.Value().Closed()) {
 
-         aTool.Init(aMap, Standard_False);
+          aTool.Init(aMap, Standard_False, FP->Model()->IVal("write.surfacecurve.mode"));
          StepB.Init(CurrentShell, aTool, FP);
          TopoDSToStep::AddResult ( FP, aTool );
 
index c3aea8c8a208677cc928bf31c0fdf3491d62831a..341df91ce86aadadc017f05da524b24de988b14f 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <MoniTool_DataMapOfShapeTransient.hxx>
 #include <StdFail_NotDone.hxx>
+#include <Interface_InterfaceModel.hxx>
 #include <StepShape_GeometricCurveSet.hxx>
 #include <StepShape_GeometricSetSelect.hxx>
 #include <StepShape_HArray1OfGeometricSetSelect.hxx>
@@ -42,7 +43,9 @@ TopoDSToStep_MakeGeometricCurveSet::TopoDSToStep_MakeGeometricCurveSet(
   done = Standard_False;
   Handle(TColStd_HSequenceOfTransient)  itemList;
   MoniTool_DataMapOfShapeTransient      aMap;
-  TopoDSToStep_Tool                aTool (aMap, Standard_False);
+  TopoDSToStep_Tool aTool (aMap,
+                           Standard_False,
+                           FP->Model()->IVal("write.surfacecurve.mode"));
   TopoDSToStep_WireframeBuilder    wirefB (aShape, aTool, FP);
   TopoDSToStep::AddResult ( FP, aTool );
 
index a7843567d5852f3e851b225ddafab67504186cc7..ed0b8c31ec106d4a82a80c8d9fbb0443bcc8d46d 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <BRepClass3d.hxx>
 #include <StdFail_NotDone.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepShape_ClosedShell.hxx>
 #include <StepShape_HArray1OfFace.hxx>
 #include <StepShape_ManifoldSolidBrep.hxx>
@@ -37,7 +38,8 @@ static Handle(StepShape_ManifoldSolidBrep) MakeManifoldSolidBrep (const TopoDS_S
   Handle(StepShape_ManifoldSolidBrep) theManifoldSolidBrep;
 
   MoniTool_DataMapOfShapeTransient aMap;
-  TopoDSToStep_Tool aTool(aMap, Standard_False);
+  Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+  TopoDSToStep_Tool aTool(aMap, Standard_False, aModel->IVal("write.surfacecurve.mode"));
   
   TopoDSToStep_Builder StepB(aShell, aTool, FP);
 
index 9c4a20022ed1dd43ff9f37f109109e7408a9e232..696b231bd3183f1231302e3feb78d0421a5a0e93 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <MoniTool_DataMapOfShapeTransient.hxx>
 #include <StdFail_NotDone.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepShape_ClosedShell.hxx>
 #include <StepShape_ConnectedFaceSet.hxx>
 #include <StepShape_FaceSurface.hxx>
@@ -50,7 +51,10 @@ TopoDSToStep_MakeShellBasedSurfaceModel::
   done = Standard_False;
   MoniTool_DataMapOfShapeTransient aMap;
 
-  TopoDSToStep_Tool    aTool(aMap, Standard_False);
+  Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+  TopoDSToStep_Tool    aTool(aMap,
+                             Standard_False,
+                             aModel->IVal("write.surfacecurve.mode"));
   TopoDSToStep_Builder StepB(aFace, aTool, FP);
 
   TopoDSToStep::AddResult ( FP, aTool );
@@ -97,8 +101,11 @@ TopoDSToStep_MakeShellBasedSurfaceModel::
   Handle(StepShape_OpenShell)                     aOpenShell;
   Handle(StepShape_ClosedShell)                   aClosedShell;
   MoniTool_DataMapOfShapeTransient                aMap;
-  
-  TopoDSToStep_Tool    aTool(aMap, Standard_False);
+
+  Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+  TopoDSToStep_Tool    aTool(aMap,
+                             Standard_False,
+                             aModel->IVal("write.surfacecurve.mode"));
   TopoDSToStep_Builder StepB(aShell, aTool, FP);
   //TopoDSToStep::AddResult ( FP, aTool );
 
@@ -155,7 +162,11 @@ TopoDSToStep_MakeShellBasedSurfaceModel::
     if (It.Value().ShapeType() == TopAbs_SHELL) {
       aShell = TopoDS::Shell(It.Value());
 
-      TopoDSToStep_Tool    aTool(aMap, Standard_False);
+
+      Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+      TopoDSToStep_Tool    aTool(aMap,
+                                 Standard_False,
+                                 aModel->IVal("write.surfacecurve.mode"));
       TopoDSToStep_Builder StepB(aShell, aTool, FP);
       TopoDSToStep::AddResult ( FP, aTool );
 
index 75aa71b6e3282cf1e2ad3d92a7c0598e146bab7a..8a8d1ad885b0b0bed274f8f07eec8128a4ac33db 100644 (file)
@@ -30,8 +30,8 @@
 #include <GeomToStep_MakeCurve.hxx>
 #include <GeomToStep_MakeLine.hxx>
 #include <gp_Vec.hxx>
-#include <Interface_Static.hxx>
 #include <StdFail_NotDone.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepGeom_HArray1OfPcurveOrSurface.hxx>
 #include <StepGeom_Line.hxx>
 #include <StepGeom_SeamCurve.hxx>
@@ -88,7 +88,9 @@ void TopoDSToStep_MakeStepEdge::Init(const TopoDS_Edge& aEdge,
   aTool.SetCurrentEdge(aEdge);
 
   // [BEGIN] Processing non-manifold topology (ssv; 11.11.2010)
-  Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
+
+  Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+  Standard_Boolean isNMMode = aModel->IVal("write.step.nonmanifold") != 0;
   if (isNMMode) {
     Handle(StepShape_EdgeCurve) anEC;
     Handle(TransferBRep_ShapeMapper) aSTEPMapper = TransferBRep::ShapeMapper(FP, aEdge);
index 900e9b6ec719bceefeb1fc7c6593e6a93b32592a..6f2e146f281edc0743a9f74f369b62a60a4763dc 100644 (file)
 #include <Geom_TrimmedCurve.hxx>
 #include <GeomToStep_MakeCurve.hxx>
 #include <GeomToStep_MakeSurface.hxx>
-#include <Interface_Static.hxx>
 #include <Precision.hxx>
 #include <ShapeAlgo.hxx>
 #include <ShapeAlgo_AlgoContainer.hxx>
 #include <StdFail_NotDone.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepGeom_Curve.hxx>
 #include <StepGeom_DegenerateToroidalSurface.hxx>
 #include <StepGeom_GeometricRepresentationContextAndParametricRepresentationContext.hxx>
@@ -124,7 +124,8 @@ void TopoDSToStep_MakeStepFace::Init(const TopoDS_Face& aFace,
     new TransferBRep_ShapeMapper(aFace);  // on ne sait jamais
 
   // [BEGIN] Processing non-manifold topology (another approach) (ssv; 10.11.2010)
-  Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
+  Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+  Standard_Boolean isNMMode = aModel->IVal("write.step.nonmanifold") != 0;
   if (isNMMode) {
     Handle(StepShape_AdvancedFace) anAF;
     Handle(TransferBRep_ShapeMapper) aSTEPMapper = TransferBRep::ShapeMapper(FP, aFace);
@@ -220,16 +221,20 @@ void TopoDSToStep_MakeStepFace::Init(const TopoDS_Face& aFace,
       
       // create basis curve
       Standard_Real UF, VF, UL, VL;
-      ShapeAlgo::AlgoContainer()->GetFaceUVBounds ( aFace, UF, UL, VF, VL );
+      Handle(ShapeAlgo_AlgoContainer) aContainer = new ShapeAlgo_AlgoContainer;
+      aContainer->GetFaceUVBounds ( aFace, UF, UL, VF, VL );
       gp_Ax2 Ax2 ( pos.XYZ() + X.XYZ() * TS->MajorRadius(), X ^ dir, X );
       Handle(Geom_Curve) BasisCurve = new Geom_Circle ( Ax2, TS->MinorRadius() );
       
       // convert basis curve to bspline in order to avoid self-intersecting
       // surface of revolution (necessary e.g. for CATIA)
-      if ( VL - VF - 2 * M_PI < -Precision::PConfusion() ) 
-       BasisCurve = ShapeAlgo::AlgoContainer()->ConvertCurveToBSpline (BasisCurve, VF, VL, Precision::Approximation(),
-                                                                       GeomAbs_C1, 100, 9);
-//     BasisCurve = new Geom_TrimmedCurve ( BasisCurve, VF, VL );
+      if (VL - VF - 2 * M_PI < -Precision::PConfusion())
+      {
+        //Handle(ShapeAlgo_AlgoContainer) aContainer = new ShapeAlgo_AlgoContainer;
+        BasisCurve = aContainer->ConvertCurveToBSpline(BasisCurve, VF, VL, Precision::Approximation(),
+                                                         GeomAbs_C1, 100, 9);
+        //BasisCurve = new Geom_TrimmedCurve ( BasisCurve, VF, VL );
+      }
 
       // create surface of revolution
       gp_Ax1 Axis = Ax3.Axis();
index a7728906c2758334c3148ea3452867281db174c7..e34c4e716002475bdd80e34f799b100d2c70c9ed 100644 (file)
@@ -18,8 +18,8 @@
 #include <BRep_Tool.hxx>
 #include <GeomToStep_MakeCartesianPoint.hxx>
 #include <gp_Pnt.hxx>
-#include <Interface_Static.hxx>
 #include <StdFail_NotDone.hxx>
+#include <StepData_StepModel.hxx>
 #include <StepGeom_CartesianPoint.hxx>
 #include <StepShape_TopologicalRepresentationItem.hxx>
 #include <StepShape_VertexPoint.hxx>
@@ -62,7 +62,8 @@ void TopoDSToStep_MakeStepVertex::Init(const TopoDS_Vertex& aVertex,
   aTool.SetCurrentVertex(aVertex);
 
   // [BEGIN] Processing non-manifold topology (ssv; 11.11.2010)
-  Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
+  Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(FP->Model());
+  Standard_Boolean isNMMode = aModel->IVal("write.step.nonmanifold") != 0;
   if (isNMMode) {
     Handle(StepShape_VertexPoint) aVP;
     Handle(TransferBRep_ShapeMapper) aSTEPMapper = TransferBRep::ShapeMapper(FP, aVertex);
index 8dc10b703e15bca1c3584fece7e7d5d0ea060f9e..7cde448c4880f1bea5e21b5f460fd23bfacd42a4 100644 (file)
@@ -16,7 +16,6 @@
 
 
 #include <BRep_Tool.hxx>
-#include <Interface_Static.hxx>
 #include <StepShape_TopologicalRepresentationItem.hxx>
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Face.hxx>
@@ -31,9 +30,8 @@
 //purpose  : 
 //=======================================================================
 TopoDSToStep_Tool::TopoDSToStep_Tool()
-     :myLowestTol(0.),myReversedSurface (Standard_False)
+     :myLowestTol(0.),myReversedSurface (Standard_False),myPCurveMode(1)
 {
-  myPCurveMode = Interface_Static::IVal("write.surfacecurve.mode");
 }
 
 //=======================================================================
@@ -41,10 +39,12 @@ TopoDSToStep_Tool::TopoDSToStep_Tool()
 //purpose  : 
 //=======================================================================
 
-TopoDSToStep_Tool::TopoDSToStep_Tool(const MoniTool_DataMapOfShapeTransient& M, const Standard_Boolean FacetedContext)
+TopoDSToStep_Tool::TopoDSToStep_Tool(const MoniTool_DataMapOfShapeTransient& M,
+                                     const Standard_Boolean FacetedContext,
+                                     Standard_Integer theCurveMode)
      :myLowestTol(0.),myReversedSurface(Standard_False)
 {
-  Init ( M, FacetedContext );
+  Init ( M, FacetedContext, theCurveMode );
 }
 
 //=======================================================================
@@ -52,11 +52,13 @@ TopoDSToStep_Tool::TopoDSToStep_Tool(const MoniTool_DataMapOfShapeTransient& M,
 //purpose  : 
 //=======================================================================
 
-void TopoDSToStep_Tool::Init(const MoniTool_DataMapOfShapeTransient& M, const Standard_Boolean FacetedContext)
+void TopoDSToStep_Tool::Init(const MoniTool_DataMapOfShapeTransient& M,
+                             const Standard_Boolean FacetedContext,
+                             Standard_Integer theCurveMode)
 {
   myDataMap = M;
   myFacetedContext = FacetedContext;
-  myPCurveMode = Interface_Static::IVal("write.surfacecurve.mode");
+  myPCurveMode = theCurveMode;
 }
 
 //=======================================================================
index 1b8d82a65dca4e0fd1a7bccb22824cd34149ccc6..1b9314b9036deac832fabe7fb8c33abc206b75b8 100644 (file)
@@ -50,9 +50,13 @@ public:
   
   Standard_EXPORT TopoDSToStep_Tool();
   
-  Standard_EXPORT TopoDSToStep_Tool(const MoniTool_DataMapOfShapeTransient& M, const Standard_Boolean FacetedContext);
+  Standard_EXPORT TopoDSToStep_Tool(const MoniTool_DataMapOfShapeTransient& M,
+                                    const Standard_Boolean FacetedContext,
+                                    Standard_Integer theCurveMode);
   
-  Standard_EXPORT void Init (const MoniTool_DataMapOfShapeTransient& M, const Standard_Boolean FacetedContext);
+  Standard_EXPORT void Init (const MoniTool_DataMapOfShapeTransient& M,
+                             const Standard_Boolean FacetedContext,
+                             Standard_Integer theCurveMode);
   
   Standard_EXPORT Standard_Boolean IsBound (const TopoDS_Shape& S);
   
index 07b3afaf72540e287c6dbb2245b97e08a8c9cd00..704e115084d8f152ea41dfd7c92fb58f7ceda64f 100644 (file)
@@ -1402,6 +1402,43 @@ static Standard_Integer testDoc (Draw_Interpretor&,
   return 0;
 }
 
+static void initStatics()
+{
+  //Be carefull using this method and static map.
+  //For step files all this parameters initialises in the model.
+  //They are initialised here to avoid errors during using auxiliary
+  //functions to work with step files particulary function "param" in IFSelect_Functions.cxx.
+  //Do NOT USE Interface_Static methods for getting param values while reading step.
+  //If you need the parameters values use StepData_StepModel::GetParam method
+
+  // Indicates whether to write sub-shape names to 'Name' attributes of
+  // STEP Representation Items
+  Interface_Static::Init("stepcaf", "write.stepcaf.subshapes.name", 'e', "");
+  Interface_Static::Init("stepcaf", "write.stepcaf.subshapes.name", '&', "enum 0");
+  Interface_Static::Init("stepcaf", "write.stepcaf.subshapes.name", '&', "eval Off"); // 0
+  Interface_Static::Init("stepcaf", "write.stepcaf.subshapes.name", '&', "eval On");  // 1
+  Interface_Static::SetIVal("write.stepcaf.subshapes.name", 0); // Disabled by default
+
+  // Indicates whether to read sub-shape names from 'Name' attributes of
+  // STEP Representation Items
+  Interface_Static::Init("stepcaf", "read.stepcaf.subshapes.name", 'e', "");
+  Interface_Static::Init("stepcaf", "read.stepcaf.subshapes.name", '&', "enum 0");
+  Interface_Static::Init("stepcaf", "read.stepcaf.subshapes.name", '&', "eval Off"); // 0
+  Interface_Static::Init("stepcaf", "read.stepcaf.subshapes.name", '&', "eval On");  // 1
+  Interface_Static::SetIVal("read.stepcaf.subshapes.name", 0); // Disabled by default
+
+  // STEP file encoding for names translation
+  // Note: the numbers should be consistent with Resource_FormatType enumeration
+  Interface_Static::Init("step", "read.stepcaf.codepage", 'e', "");
+  Interface_Static::Init ("step", "read.stepcaf.codepage", '&', "enum 0");
+  Interface_Static::Init ("step", "read.stepcaf.codepage", '&', "eval SJIS");         // Resource_FormatType_SJIS
+  Interface_Static::Init ("step", "read.stepcaf.codepage", '&', "eval EUC");          // Resource_FormatType_EUC
+  Interface_Static::Init ("step", "read.stepcaf.codepage", '&', "eval ANSI");         // Resource_FormatType_ANSI
+  Interface_Static::Init ("step", "read.stepcaf.codepage", '&', "eval GB");           // Resource_FormatType_GB
+  Interface_Static::Init ("step", "read.stepcaf.codepage", '&', "eval UTF8");         // Resource_FormatType_UTF8
+  Interface_Static::Init ("step", "read.stepcaf.codepage", '&', "eval SystemLocale"); // Resource_FormatType_SystemLocale
+  Interface_Static::SetCVal ("read.stepcaf.codepage", "UTF8");
+}
 
 //=======================================================================
 //function : Init
@@ -1418,7 +1455,13 @@ void XDEDRAW::Init(Draw_Interpretor& di)
   initactor = Standard_True;
 
   // Load static variables for STEPCAF (ssv; 16.08.2012)
-  STEPCAFControl_Controller::Init();
+  static Standard_Boolean inic = Standard_False;
+  if (!inic) {
+    initStatics();
+    Handle(STEPCAFControl_Controller) STEPCTL = new STEPCAFControl_Controller;
+    XSDRAW::SetController(STEPCTL);
+    inic = Standard_True;
+  }
 
   // Initialize XCAF formats
   Handle(TDocStd_Application) anApp = DDocStd::GetApplication();
index 07d71d165c8c41269971e5d1181488caed6613f8..494654422c3230acc58c06556f58ec4468efd614 100644 (file)
@@ -308,7 +308,12 @@ static Standard_Integer WriteIges (Draw_Interpretor& di, Standard_Integer argc,
 static Standard_Integer ReadStep (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
 {
   DeclareAndCast(STEPControl_Controller,ctl,XSDRAW::Controller());
-  if (ctl.IsNull()) XSDRAW::SetNorm("STEP");
+  if (ctl.IsNull())
+  {
+    ctl = new STEPCAFControl_Controller;
+    XSDRAW::SetController(ctl);
+  }
+
 
   Standard_CString aDocName = NULL;
   TCollection_AsciiString aFilePath, aModeStr;
@@ -341,7 +346,7 @@ static Standard_Integer ReadStep (Draw_Interpretor& di, Standard_Integer argc, c
   else        di << " Model taken from the session : " << fnom.ToCString() << "\n";
   //  di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom<<"\n";
 
-  STEPCAFControl_Reader reader ( XSDRAW::Session(),modfic);
+  STEPCAFControl_Reader reader (XSDRAW::Session(), ctl, modfic);
   if (!aModeStr.IsEmpty())
   {
     Standard_Boolean mode = Standard_True;
@@ -426,9 +431,14 @@ static Standard_Integer WriteStep (Draw_Interpretor& di, Standard_Integer argc,
   Standard_CString multifile = 0;
   
   Standard_Integer k = 3;
-  DeclareAndCast(STEPControl_Controller,ctl,XSDRAW::Controller());
-  if (ctl.IsNull()) XSDRAW::SetNorm("STEP");
-  STEPCAFControl_Writer writer ( XSDRAW::Session(), Standard_True );
+
+  DeclareAndCast(STEPCAFControl_Controller, ctl, XSDRAW::Controller());
+  if (ctl.IsNull())
+  {
+    ctl = new STEPCAFControl_Controller;
+    XSDRAW::SetController(ctl);
+  }
+  STEPCAFControl_Writer writer ( XSDRAW::Session(), ctl, Standard_True );
    
   STEPControl_StepModelType mode = STEPControl_AsIs;
   if ( argc > k ) {
@@ -566,7 +576,6 @@ static Standard_Integer Expand (Draw_Interpretor& di, Standard_Integer argc, con
   return 0;
 }
 
-
 //=======================================================================
 //function : WriteVrml
 //purpose  : Write DECAF document to Vrml
index 20d1702650478b7b08b44702fcaaf2f4db87a009..1206816ae4fbf4733333c9244f1b2099a5a48c05 100644 (file)
@@ -29,8 +29,8 @@
 #include <Message_ProgressIndicator.hxx>
 #include <Resource_Manager.hxx>
 #include <ShapeAlgo.hxx>
-#include <ShapeAlgo_AlgoContainer.hxx>
-#include <ShapeAlgo_ToolContainer.hxx>
+//#include <ShapeAlgo_AlgoContainer.hxx>
+//#include <ShapeAlgo_ToolContainer.hxx>
 #include <ShapeAnalysis_Edge.hxx>
 #include <ShapeBuild_Edge.hxx>
 #include <ShapeBuild_ReShape.hxx>
@@ -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,7 @@ XSAlgo_AlgoContainer::XSAlgo_AlgoContainer()
 
 void XSAlgo_AlgoContainer::PrepareForTransfer() const
 {
-  UnitsMethods::SetCasCadeLengthUnit ( Interface_Static::IVal("xstep.cascade.unit") );
+  UnitsMethods::SetCasCadeLengthUnit(IVal("xstep.cascade.unit"));
 }
 
 //=======================================================================
@@ -105,7 +106,7 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
   Handle(ShapeProcess_ShapeContext) context = Handle(ShapeProcess_ShapeContext)::DownCast(info);
   if ( context.IsNull() )
   {
-    Standard_CString rscfile = Interface_Static::CVal(prscfile);
+    Standard_CString rscfile = CVal(prscfile); 
     if (!rscfile)
       rscfile = prscfile;
     context = new ShapeProcess_ShapeContext(shape, rscfile);
@@ -115,8 +116,7 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
   }
   context->SetNonManifold(NonManifold);
   info = context;
-  
-  Standard_CString seq = Interface_Static::CVal ( pseq );
+  Standard_CString seq = CVal(pseq);
   if ( ! seq ) seq = pseq;
   
   // if resource file is not loaded or does not define <seq>.exec.op, 
@@ -139,7 +139,7 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
       try {
         OCC_CATCH_SIGNALS
        Handle(ShapeExtend_MsgRegistrator) msg = new ShapeExtend_MsgRegistrator;
-       Handle(ShapeFix_Shape) sfs = ShapeAlgo::AlgoContainer()->ToolContainer()->FixShape();
+        Handle(ShapeFix_Shape) sfs = new ShapeFix_Shape;// ShapeAlgo::AlgoContainer()->ToolContainer()->FixShape();
        sfs->Init ( shape );
        sfs->SetMsgRegistrator ( msg );
        sfs->SetPrecision ( Prec );
@@ -360,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 = Interface_Static::IVal("read.stdsameparameter.mode");
+  
+  Standard_Integer SPmode = IVal("read.stdsameparameter.mode");
   if ( SPmode ) 
     B.SameParameter (edge, Standard_False );
 
@@ -569,3 +570,102 @@ void XSAlgo_AlgoContainer::MergeTransferInfo(const Handle(Transfer_FinderProcess
     }
   }
 }
+
+//=======================================================================
+// Method  : SetModel
+// Purpose :
+//=======================================================================
+void XSAlgo_AlgoContainer::SetModel(Handle(Interface_InterfaceModel)& theModel)
+{
+  myModel = theModel;
+  initParameters();
+}
+
+//=======================================================================
+// Method  : getParam
+// Purpose :
+//=======================================================================
+Handle(Interface_Static) XSAlgo_AlgoContainer::getParam
+(const Standard_CString theParamName) const
+{
+  Handle(Interface_Static) aParam;
+  if (!myModel.IsNull())
+    aParam = myModel->GetParam(theParamName);
+
+  if (aParam.IsNull())
+  {
+    static Standard_Mutex aPars;
+    {
+      Standard_Mutex::Sentry aLock(aPars);
+      aParam = Interface_Static::Static(theParamName);
+    }
+  }
+  return aParam;
+}
+
+
+//=======================================================================
+//function : IVal
+//purpose  : 
+//=======================================================================
+Standard_Integer XSAlgo_AlgoContainer::IVal(const Standard_CString theParamName) const
+{
+  Handle(Interface_Static) aParam = getParam(theParamName);
+  return (aParam.IsNull() ? 0 : aParam->IntegerValue());
+}
+
+//=======================================================================
+//function : RVal
+//purpose  : 
+//=======================================================================
+Standard_Real XSAlgo_AlgoContainer::RVal(const Standard_CString theParamName) const
+{
+  Handle(Interface_Static) aParam = getParam(theParamName);
+  return (aParam.IsNull() ? 0.0 : aParam->RealValue());
+}
+
+//=======================================================================
+//function : CVal
+//purpose  : 
+//=======================================================================
+Standard_CString XSAlgo_AlgoContainer::CVal(const Standard_CString theParamName) const
+{
+  Handle(Interface_Static) aParam = getParam(theParamName);
+  return (aParam.IsNull() ? "" : aParam->CStringValue());
+}
+
+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);
+}
index ec03dfb6ffc92696a882454978783658ebf06922..abbeb47e33d5818880e0566314d969794d20d52c 100644 (file)
@@ -19,6 +19,8 @@
 #include <Standard.hxx>
 #include <Standard_Type.hxx>
 
+#include <Interface_InterfaceModel.hxx>
+#include <Interface_Static.hxx>
 #include <Standard_Transient.hxx>
 #include <Standard_Real.hxx>
 #include <Standard_CString.hxx>
@@ -82,6 +84,9 @@ public:
   //! from item startTPitem
   Standard_EXPORT virtual void MergeTransferInfo (const Handle(Transfer_FinderProcess)& FP, const Handle(Standard_Transient)& info) const;
 
+  //! Sets the model for translations
+  Standard_EXPORT void SetModel(Handle(Interface_InterfaceModel)& theModel);
+
 
 
 
@@ -89,14 +94,23 @@ public:
 
 protected:
 
+  //! Returns a parameter for translations.
+  //! 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;
 
+  Standard_EXPORT Standard_Integer IVal(const Standard_CString theParamName) const;
+  Standard_EXPORT Standard_Real RVal(const Standard_CString theParamName) const;
+  Standard_EXPORT Standard_CString CVal(const Standard_CString theParamName) const;
 
+  void initParameters();
 
 private:
 
 
   Handle(XSAlgo_ToolContainer) myTC;
-
+  Handle(Interface_InterfaceModel) myModel;
 
 };
 
index e1dc727ba10ffbca919e48c8f07176bdf6cc91e7..aed1ba3dfc6b75b5224b2b1923b3a2c1c841b354 100644 (file)
@@ -61,6 +61,7 @@
 #include <XSControl_SignTransferStatus.hxx>
 #include <XSControl_TransferReader.hxx>
 #include <XSControl_WorkSession.hxx>
+#include <Standard_Mutex.hxx>
 
 IMPLEMENT_STANDARD_RTTIEXT(XSControl_Controller,Standard_Transient)
 
@@ -74,15 +75,23 @@ static NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>
 //purpose  : Constructor
 //=======================================================================
 
-XSControl_Controller::XSControl_Controller (const Standard_CString theLongName, const Standard_CString theShortName)
-: myShortName(theShortName), myLongName(theLongName)
+XSControl_Controller::XSControl_Controller(const Standard_CString theLongName, const Standard_CString theShortName)
+  : myShortName(theShortName), myLongName(theLongName)
 {
-  // Standard parameters
-  Interface_Static::Standards();
-  TraceStatic ("read.precision.mode" , 5);
-  TraceStatic ("read.precision.val"  , 5);
-  TraceStatic ("write.precision.mode" , 6);
-  TraceStatic ("write.precision.val"  , 6);
+  if (!myLongName.IsEqual("STEP") && !myShortName.IsEqual("step"))
+  {
+    // Standard parameters
+    Interface_Static::Standards();
+    TraceStatic("read.precision.mode", 5);
+    TraceStatic("read.precision.val", 5);
+    TraceStatic("write.precision.mode", 6);
+    TraceStatic("write.precision.val", 6);
+  }
+}
+
+Standard_Boolean XSControl_Controller::Init(const Handle(XSControl_WorkSession)& /*theWS*/)
+{
+  return Standard_True;
 }
 
 //=======================================================================
@@ -98,6 +107,18 @@ void XSControl_Controller::TraceStatic (const Standard_CString theName, const St
   myParamUses.Append(theUse);
 }
 
+//=======================================================================
+//function : TraceNotStatic
+//purpose  : 
+//=======================================================================
+
+void XSControl_Controller::TraceNotStatic(const Handle(Interface_Static)& theParam, const Standard_Integer theUse)
+{
+  if (theParam.IsNull()) return;
+  myParams.Append(theParam);
+  myParamUses.Append(theUse);
+}
+
 //=======================================================================
 //function : SetNames
 //purpose  : 
@@ -120,15 +141,19 @@ void XSControl_Controller::SetNames (const Standard_CString theLongName, const S
 
 void XSControl_Controller::Record (const Standard_CString theName) const
 {
-  if (listad.IsBound(theName)) {
-    Handle(Standard_Transient) thisadapt(this);
-    Handle(Standard_Transient) newadapt = listad.ChangeFind(theName);
-    if (newadapt->IsKind(thisadapt->DynamicType()))
-      return;
-    if (!(thisadapt->IsKind(newadapt->DynamicType())) && thisadapt != newadapt)
-      throw Standard_DomainError("XSControl_Controller : Record");
+  static Standard_Mutex aPars;
+  {
+    Standard_Mutex::Sentry aLock(aPars);
+    if (listad.IsBound(theName)) {
+      Handle(Standard_Transient) thisadapt(this);
+      Handle(Standard_Transient) newadapt = listad.ChangeFind(theName);
+      if (newadapt->IsKind(thisadapt->DynamicType()))
+        return;
+      if (!(thisadapt->IsKind(newadapt->DynamicType())) && thisadapt != newadapt)
+        throw Standard_DomainError("XSControl_Controller : Record");
+    }
+    listad.Bind(theName, this);
   }
-  listad.Bind(theName, this);
 }
 
 //=======================================================================
@@ -138,10 +163,14 @@ void XSControl_Controller::Record (const Standard_CString theName) const
 
 Handle(XSControl_Controller) XSControl_Controller::Recorded(const Standard_CString theName)
 {
-  Handle(Standard_Transient) recorded;
-  return (listad.Find(theName, recorded)?
-    Handle(XSControl_Controller)::DownCast(recorded) :
-    Handle(XSControl_Controller)());
+  static Standard_Mutex aPars;
+  {
+    Standard_Mutex::Sentry aLock(aPars);
+    Handle(Standard_Transient) recorded;
+    return (listad.Find(theName, recorded) ?
+      Handle(XSControl_Controller)::DownCast(recorded) :
+      Handle(XSControl_Controller)());
+  }
 }
 
 //    ####    DEFINITION    ####
@@ -476,9 +505,13 @@ void XSControl_Controller::Customise (Handle(XSControl_WorkSession)& WS)
   // Here for the specific manufacturers of controllers could create the
   // Parameters: So wait here
 
-  Handle(TColStd_HSequenceOfHAsciiString) listat = Interface_Static::Items();
-  Handle(IFSelect_ParamEditor) paramed = IFSelect_ParamEditor::StaticEditor (listat,"All Static Parameters");
-  WS->AddNamedItem ("xst-static-params-edit",paramed);
-  Handle(IFSelect_EditForm) paramform = paramed->Form(Standard_False);
-  WS->AddNamedItem ("xst-static-params",paramform);
+  //for step it is not needed
+  if (!myLongName.IsEqual("STEP") && !myShortName.IsEqual("step"))
+  {
+    Handle(TColStd_HSequenceOfHAsciiString) listat = Interface_Static::Items();
+    Handle(IFSelect_ParamEditor) paramed = IFSelect_ParamEditor::StaticEditor(listat, "All Static Parameters");
+    WS->AddNamedItem("xst-static-params-edit", paramed);
+    Handle(IFSelect_EditForm) paramform = paramed->Form(Standard_False);
+    WS->AddNamedItem("xst-static-params", paramform);
+  }
 }
index 87b7a4b923140cf1b15d15fa8706a0c59492eaa8..df057a542cc7da7fad58e1992ef392890ba21cc1 100644 (file)
@@ -20,6 +20,7 @@
 #include <Standard.hxx>
 #include <Standard_Type.hxx>
 
+#include <Interface_Static.hxx>
 #include <TCollection_AsciiString.hxx>
 #include <TColStd_SequenceOfTransient.hxx>
 #include <TColStd_HSequenceOfHAsciiString.hxx>
@@ -65,7 +66,10 @@ DEFINE_STANDARD_HANDLE(XSControl_Controller, Standard_Transient)
 class XSControl_Controller : public Standard_Transient
 {
  public:
-  
+
+   //! Initialisation of additional non-static parameters taken data from session model
+   Standard_EXPORT virtual Standard_Boolean Init(const Handle(XSControl_WorkSession)& /*theWS*/);
+
   //! Changes names
   //! if a name is empty, the formerly set one remains
   //! Remark : Does not call Record or AutoRecord
@@ -203,6 +207,9 @@ class XSControl_Controller : public Standard_Transient
   //! Records the name of a Static to be traced for a given use
   Standard_EXPORT void TraceStatic (const Standard_CString theName, const Standard_Integer theUse);
 
+  //! Records the non Static parameter to be traced for a given use
+  Standard_EXPORT void TraceNotStatic(const Handle(Interface_Static)& theParam, const Standard_Integer theUse);
+
   TCollection_AsciiString myShortName;
   TCollection_AsciiString myLongName;
   Handle(IFSelect_WorkLibrary) myAdaptorLibrary;
@@ -218,6 +225,7 @@ class XSControl_Controller : public Standard_Transient
   NCollection_Vector<Handle(Standard_Transient)> myParams;
   NCollection_Vector<Standard_Integer> myParamUses;
   Handle(Interface_HArray1OfHAsciiString) myModeWriteShapeN;
+  
 };
 
 #endif // _XSControl_Controller_HeaderFile
index d2558d5afe3916e3d30ccc0c8a6de95163fbb4c0..667c6ac592f9e0b8c49c9f6a70807ca89b56151b 100644 (file)
@@ -19,7 +19,6 @@
 #include <Interface_CheckIterator.hxx>
 #include <Interface_InterfaceModel.hxx>
 #include <Interface_Macros.hxx>
-#include <Interface_Static.hxx>
 #include <Message.hxx>
 #include <Message_Messenger.hxx>
 #include <TColStd_HSequenceOfHAsciiString.hxx>
@@ -81,12 +80,13 @@ static IFSelect_ReturnStatus XSControl_xnorm(const Handle(IFSelect_SessionPilot)
       <<  "  Short name (resource) : "<<control->Name(Standard_True)<<Message_EndLine;
   if (argc == 1) return IFSelect_RetVoid;
 
-  control = XSControl_Controller::Recorded(arg1);
+  control = WS->Recorded(arg1);
   if (control.IsNull()) {
     sout<<" No norm named : "<<arg1<<Message_EndLine;
     return IFSelect_RetError;
   }
 
   WS->SetController(control);
   sout<<"new norm : "<<control->Name()<<Message_EndLine;
   return IFSelect_RetDone;
index ea17e5cd614cec120926068cae98a7dfd013dbdc..84ac6998d99f15739b0528bc8443567be5352d64 100644 (file)
@@ -19,7 +19,6 @@
 #include <Interface_Check.hxx>
 #include <Interface_InterfaceModel.hxx>
 #include <Interface_ShareFlags.hxx>
-#include <Interface_Static.hxx>
 #include <Message_ProgressSentry.hxx>
 #include <ShapeExtend_Explorer.hxx>
 #include <Standard_Transient.hxx>
@@ -78,13 +77,21 @@ Standard_Boolean  XSControl_Reader::SetNorm (const Standard_CString norm)
 {
   if (thesession.IsNull()) SetWS (new XSControl_WorkSession);
   Standard_Boolean stat = thesession->SelectNorm (norm);
-  if (stat) {
-    thesession->InitTransferReader(0);
-    thesession->InitTransferReader(4);
-  }
+  if (stat) initTransferReader();
   return stat;
 }
 
+//=======================================================================
+//function : InitTransferReader
+//purpose  : 
+//=======================================================================
+void XSControl_Reader::initTransferReader()
+{
+  if (thesession.IsNull()) return;
+  thesession->InitTransferReader(0);
+  thesession->InitTransferReader(4);
+}
+
 
 //=======================================================================
 //function : SetWS
@@ -101,8 +108,7 @@ void XSControl_Reader::SetWS(const Handle(XSControl_WorkSession)& WS,
   if (thesession->NormAdaptor().IsNull()) return;
   Handle(Interface_InterfaceModel) model = thesession->Model ();
   if (scratch || model.IsNull())   model = thesession->NewModel ();
-  thesession->InitTransferReader(0);
-  thesession->InitTransferReader(4);
+  initTransferReader();
 }
 
 
index 2e21e0092706cc71fe7c09367b292c9b1a9e18bb..45c4fac185b87e2dd7e4f41e8361662dbc5d77cb 100644 (file)
@@ -253,6 +253,9 @@ protected:
   //! Returns a sequence of produced shapes
   Standard_EXPORT TopTools_SequenceOfShape& Shapes();
 
+  //! Sets a Transfer Reader
+  Standard_EXPORT void initTransferReader();
+
 
   Standard_Boolean therootsta;
   TColStd_SequenceOfTransient theroots;
index 0b23c92571ba41f70f5cd57c7bfe967765940564..00a226603f7d5b4b49b1732038cc6cd952b461da 100644 (file)
@@ -404,7 +404,16 @@ TopoDS_Shape XSControl_TransferReader::ShapeResult
   TopoDS_Shape sh = xu.BinderShape (mres->Binder());
 
 //   Ouh la vilaine verrue
-  Standard_Real tolang = Interface_Static::RVal("read.encoderegularity.angle");
+  Standard_Real tolang;
+  Handle(Interface_Static) aParam = myModel->GetParam("read.encoderegularity.angle");
+  if (aParam.IsNull())
+  {
+    tolang = Interface_Static::RVal("read.encoderegularity.angle");
+  }
+  else
+  {
+    tolang = aParam->RealValue();
+  }
   if (tolang <= 0 || sh.IsNull()) return sh;
   ShapeFix::EncodeRegularity (sh,tolang);
   return sh;
index 6cf05457de0ec98c5fd881365a869e4886d0706b..654283d417f56c28323b8884cb1d6e5e5d6710fb 100644 (file)
@@ -86,12 +86,19 @@ Standard_Boolean  XSControl_WorkSession::SelectNorm(const Standard_CString normn
 {
   // Old norm and results
   myTransferReader->Clear(-1);
-  //  ????  En toute rigueur, menage a faire dans XWS : virer les items
-  //        ( a la limite, pourquoi pas, refaire XWS en entier)
-
-  Handle(XSControl_Controller) newadapt = XSControl_Controller::Recorded (normname);
+  if (!myController.IsNull())
+  {
+    TCollection_AsciiString aN1 =myController->Name(Standard_False);
+    TCollection_AsciiString aN2 = myController->Name(Standard_True);
+    
+    if (aN1.IsEqual(normname) || aN2.IsEqual(normname))
+      return Standard_True;
+  }
+  Handle(XSControl_Controller) newadapt = (!myMapCtl.IsBound(normname) ? 
+    XSControl_Controller::Recorded(normname) : myMapCtl.Find(normname));
   if (newadapt.IsNull()) return Standard_False;
-  if (newadapt == myController) return Standard_True;
   SetController (newadapt);
   return Standard_True;
 }
@@ -105,6 +112,7 @@ Standard_Boolean  XSControl_WorkSession::SelectNorm(const Standard_CString normn
 void XSControl_WorkSession::SetController(const Handle(XSControl_Controller)& ctl)
 {
   myController = ctl;
+  SetModel(myController->NewModel());
 
   SetLibrary   ( myController->WorkLibrary() );
   SetProtocol  ( myController->Protocol() );
@@ -120,6 +128,21 @@ void XSControl_WorkSession::SetController(const Handle(XSControl_Controller)& ct
 
   myTransferReader->SetController (myController);
   myTransferWriter->SetController (myController);
+  if (!myMapCtl.IsBound(ctl->Name(Standard_True)))
+  {
+    myMapCtl.Bind(ctl->Name(Standard_True), ctl);
+    myMapCtl.Bind(ctl->Name(Standard_False), ctl);
+  }
+  else
+  {
+    Handle(XSControl_Controller) aController = myMapCtl.Find(ctl->Name(Standard_True));
+    if (!aController->DynamicType()->IsKind(ctl->DynamicType()))
+    {
+      myMapCtl.Bind(ctl->Name(Standard_True), ctl);
+      myMapCtl.Bind(ctl->Name(Standard_False), ctl);
+    }
+      
+  }
 }
 
 
index a1645382530078abdc91fb9620b7cbc53a443a53..d61a2cf9387532e4de996ac3d05510fda06a19ba 100644 (file)
@@ -23,7 +23,8 @@
 #include <IFSelect_WorkSession.hxx>
 #include <IFSelect_ReturnStatus.hxx>
 #include <XSControl_TransferWriter.hxx>
-class XSControl_Controller;
+#include <XSControl_Controller.hxx>
+//class XSControl_Controller;
 class XSControl_TransferReader;
 class XSControl_Vars;
 class Message_Messenger;
@@ -180,6 +181,13 @@ class XSControl_WorkSession : public IFSelect_WorkSession
   //! resulting entities (in the resulting file model) rather than
   //! with original objects (in fact, their mappers)
   Standard_EXPORT Interface_CheckIterator TransferWriteCheckList() const;
+
+  Standard_EXPORT Handle(XSControl_Controller) Recorded(const Standard_CString theNormName)
+  {
+    if(!myMapCtl.IsBound(theNormName))
+      return 0;
+    return myMapCtl.Find(theNormName);
+  }
   
   const Handle(XSControl_Vars) & Vars() const
   { return myVars; }
@@ -199,6 +207,7 @@ class XSControl_WorkSession : public IFSelect_WorkSession
   Handle(XSControl_TransferWriter) myTransferWriter;
   NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> myContext;
   Handle(XSControl_Vars) myVars;
+  NCollection_DataMap<TCollection_AsciiString, Handle(XSControl_Controller)> myMapCtl;
 };
 
 #endif // _XSControl_WorkSession_HeaderFile
index fdc0e829fa992119aa0a0ed3f76d2d52bc721cdb..251be98d27d46bbf0e219b0bc5477f6ca10182fc 100644 (file)
@@ -692,7 +692,8 @@ void  XSDRAWIGES::InitSelect ()
   Handle(IGESSelect_Activator)    igesact = new IGESSelect_Activator;
   IGESControl_Controller::Init();
 //  XSDRAW::SetNorm ("IGES");  trop tot
-  XSDRAW::SetController (XSControl_Controller::Recorded("iges"));
+  Handle(IGESControl_Controller) igesCtl = new IGESControl_Controller;
+  XSDRAW::SetController (igesCtl);
   
   atexit (cleanpilot);
 }
index e7662a8b9d1752a3bb1c9d2b1975475e0508515d..17ef24b76df39bdac5d0030e99bfcae02797fe6e 100644 (file)
 #include <IFSelect_SessionPilot.hxx>
 #include <Interface_InterfaceModel.hxx>
 #include <Interface_Macros.hxx>
-#include <Interface_Static.hxx>
 #include <Message.hxx>
 #include <Message_Messenger.hxx>
 #include <Message_ProgressSentry.hxx>
+#include <Standard_Version.hxx>
 #include <STEPControl_ActorWrite.hxx>
 #include <STEPControl_Controller.hxx>
 #include <STEPControl_Reader.hxx>
@@ -49,6 +49,8 @@
 #include <XSControl_WorkSession.hxx>
 #include <XSDRAW.hxx>
 #include <XSDRAWSTEP.hxx>
+#include <TopoDS_Compound.hxx>
+#include <BRep_Builder.hxx>
 
 #include <stdio.h>
 //  Pour le transfert (write)
@@ -61,6 +63,151 @@ static void cleanpilot ()
 }
 }
 
+static void initStatics()
+{
+  //Be carefull using this method and static map.
+  //For step files all this parameters initialises in the model.
+  //They are initialised here to avoid errors during using auxiliary
+  //functions to work with step files particulary function "param" in IFSelect_Functions.cxx.
+  //Do NOT USE Interface_Static methods for getting param values while reading step.
+  //If you need the parameters values use StepData_StepModel::GetParam method
+  Interface_Static::Init("step", "write.step.product.name", 't', "Open CASCADE STEP translator " OCC_VERSION_STRING);
+  Interface_Static::Init("step", "write.step.assembly", 'e', "");
+  Interface_Static::Init("step", "write.step.assembly", '&', "enum 0");
+  Interface_Static::Init("step", "write.step.assembly", '&', "eval Off");
+  Interface_Static::Init("step", "write.step.assembly", '&', "eval On");
+  Interface_Static::Init("step", "write.step.assembly", '&', "eval Auto");
+  Interface_Static::SetCVal("write.step.assembly", "Auto");
+
+  Interface_Static::Init("step", "step.angleunit.mode", 'e', "");
+  Interface_Static::Init("step", "step.angleunit.mode", '&', "enum 0");
+  Interface_Static::Init("step", "step.angleunit.mode", '&', "eval File");
+  Interface_Static::Init("step", "step.angleunit.mode", '&', "eval Rad");
+  Interface_Static::Init("step", "step.angleunit.mode", '&', "eval Deg");
+  Interface_Static::SetCVal("step.angleunit.mode", "File");
+
+  Interface_Static::Init("step", "write.step.schema", 'e', "");
+  Interface_Static::Init("step", "write.step.schema", '&', "enum 1");
+  Interface_Static::Init("step", "write.step.schema", '&', "eval AP214CD");
+  Interface_Static::Init("step", "write.step.schema", '&', "eval AP214DIS");
+  Interface_Static::Init("step", "write.step.schema", '&', "eval AP203");
+  Interface_Static::Init("step", "write.step.schema", '&', "eval AP214IS");
+  Interface_Static::Init("step", "write.step.schema", '&', "eval AP242DIS");
+  Interface_Static::SetCVal("write.step.schema", "AP214IS");
+
+  // Type of Product Definition for reading
+  // Note: the numbers should be consistent with function FindShapeReprType()
+  // in STEPControl_ActorRead.cxx
+  Interface_Static::Init("step", "read.step.shape.repr", 'e', "");
+  Interface_Static::Init("step", "read.step.shape.repr", '&', "enum 1");
+  Interface_Static::Init("step", "read.step.shape.repr", '&', "eval All");   // 1
+  Interface_Static::Init("step", "read.step.shape.repr", '&', "eval ABSR");  // 2
+  Interface_Static::Init("step", "read.step.shape.repr", '&', "eval MSSR");  // 3
+  Interface_Static::Init("step", "read.step.shape.repr", '&', "eval GBSSR"); // 4
+  Interface_Static::Init("step", "read.step.shape.repr", '&', "eval FBSR");  // 5
+  Interface_Static::Init("step", "read.step.shape.repr", '&', "eval EBWSR"); // 6
+  Interface_Static::Init("step", "read.step.shape.repr", '&', "eval GBWSR"); // 7
+  Interface_Static::SetCVal("read.step.shape.repr", "All");
+
+  // Mode for reading shapes attached to main SDR by SRR
+  // (hybrid model representation in AP203 since 1998)
+  Interface_Static::Init("step", "read.step.shape.relationship", 'e', "");
+  Interface_Static::Init("step", "read.step.shape.relationship", '&', "enum 0");
+  Interface_Static::Init("step", "read.step.shape.relationship", '&', "eval OFF");
+  Interface_Static::Init("step", "read.step.shape.relationship", '&', "eval ON");
+  Interface_Static::SetCVal("read.step.shape.relationship", "ON");
+
+  // Mode for reading shapes attached to Product by ShapeAspect 
+  // (hybrid model representation in AP203 before 1998)
+  Interface_Static::Init("step", "read.step.shape.aspect", 'e', "");
+  Interface_Static::Init("step", "read.step.shape.aspect", '&', "enum 0");
+  Interface_Static::Init("step", "read.step.shape.aspect", '&', "eval OFF");
+  Interface_Static::Init("step", "read.step.shape.aspect", '&', "eval ON");
+  Interface_Static::SetCVal("read.step.shape.aspect", "ON");
+
+  // Mode for reading SDR and ShapeRepr if it is necessary
+  Interface_Static::Init("step", "read.step.product.mode", 'e', "");
+  Interface_Static::Init("step", "read.step.product.mode", '&', "enum 0");
+  Interface_Static::Init("step", "read.step.product.mode", '&', "eval OFF");
+  Interface_Static::Init("step", "read.step.product.mode", '&', "eval ON");
+  Interface_Static::SetCVal("read.step.product.mode", "ON");
+
+  // Order of reading ShapeDefinitionRepresentation in ProductDefinition
+  Interface_Static::Init("step", "read.step.product.context", 'e', "");
+  Interface_Static::Init("step", "read.step.product.context", '&', "enum 1");
+  Interface_Static::Init("step", "read.step.product.context", '&', "eval all");     // 1
+  Interface_Static::Init("step", "read.step.product.context", '&', "eval design");  // 2
+  Interface_Static::Init("step", "read.step.product.context", '&', "eval analysis");// 3
+  Interface_Static::SetCVal("read.step.product.context", "all");
+
+  // What we try to read in ProductDefinition
+  Interface_Static::Init("step", "read.step.assembly.level", 'e', "");
+  Interface_Static::Init("step", "read.step.assembly.level", '&', "enum 1");
+  Interface_Static::Init("step", "read.step.assembly.level", '&', "eval all");      // 1
+  Interface_Static::Init("step", "read.step.assembly.level", '&', "eval assembly"); // 2
+  Interface_Static::Init("step", "read.step.assembly.level", '&', "eval structure");// 3
+  Interface_Static::Init("step", "read.step.assembly.level", '&', "eval shape");    // 4
+  Interface_Static::SetCVal("read.step.assembly.level", "all");
+
+  // unit: supposed to be cascade unit (target unit for reading)
+  Interface_Static::Init("step", "write.step.unit", 'e', "");
+  Interface_Static::Init("step", "write.step.unit", '&', "enum 1");
+  Interface_Static::Init("step", "write.step.unit", '&', "eval INCH");  // 1
+  Interface_Static::Init("step", "write.step.unit", '&', "eval MM");    // 2
+  Interface_Static::Init("step", "write.step.unit", '&', "eval ??");    // 3
+  Interface_Static::Init("step", "write.step.unit", '&', "eval FT");    // 4
+  Interface_Static::Init("step", "write.step.unit", '&', "eval MI");    // 5
+  Interface_Static::Init("step", "write.step.unit", '&', "eval M");     // 6
+  Interface_Static::Init("step", "write.step.unit", '&', "eval KM");    // 7
+  Interface_Static::Init("step", "write.step.unit", '&', "eval MIL");   // 8
+  Interface_Static::Init("step", "write.step.unit", '&', "eval UM");    // 9
+  Interface_Static::Init("step", "write.step.unit", '&', "eval CM");    //10
+  Interface_Static::Init("step", "write.step.unit", '&', "eval UIN");   //11
+  Interface_Static::SetCVal("write.step.unit", "MM");
+
+  // Non-manifold topology reading: OFF by default (ssv; 26.11.2010)
+  Interface_Static::Init("step", "read.step.nonmanifold", 'e', "");
+  Interface_Static::Init("step", "read.step.nonmanifold", '&', "enum 0");
+  Interface_Static::Init("step", "read.step.nonmanifold", '&', "eval Off");
+  Interface_Static::Init("step", "read.step.nonmanifold", '&', "eval On");
+  Interface_Static::SetIVal("read.step.nonmanifold", 0);
+
+  // Non-manifold topology writing: OFF by default (ssv; 26.11.2010)
+  Interface_Static::Init("step", "write.step.nonmanifold", 'e', "");
+  Interface_Static::Init("step", "write.step.nonmanifold", '&', "enum 0");
+  Interface_Static::Init("step", "write.step.nonmanifold", '&', "eval Off");
+  Interface_Static::Init("step", "write.step.nonmanifold", '&', "eval On");
+  Interface_Static::SetIVal("write.step.nonmanifold", 0);
+
+  // I-Deas-like STEP processing: OFF by default (ssv; 22.11.2010)
+  Interface_Static::Init("step", "read.step.ideas", 'e', "");
+  Interface_Static::Init("step", "read.step.ideas", '&', "enum 0");
+  Interface_Static::Init("step", "read.step.ideas", '&', "eval Off");
+  Interface_Static::Init("step", "read.step.ideas", '&', "eval On");
+  Interface_Static::SetIVal("read.step.ideas", 0);
+
+  //Parameter to write all free vertices in one SDR (name and style of vertex are lost) (default) 
+  //or each vertex in its own SDR (name and style of vertex are exported). (ika; 21.07.2014) 
+  Interface_Static::Init("step", "write.step.vertex.mode", 'e', "");
+  Interface_Static::Init("step", "write.step.vertex.mode", '&', "enum 0");
+  Interface_Static::Init("step", "write.step.vertex.mode", '&', "eval One Compound");
+  Interface_Static::Init("step", "write.step.vertex.mode", '&', "eval Single Vertex");
+  Interface_Static::SetIVal("write.step.vertex.mode", 0);
+
+  // abv 15.11.00: ShapeProcessing
+  Interface_Static::Init("XSTEP", "write.step.resource.name", 't', "STEP");
+  Interface_Static::Init("XSTEP", "read.step.resource.name", 't', "STEP");
+  Interface_Static::Init("XSTEP", "write.step.sequence", 't', "ToSTEP");
+  Interface_Static::Init("XSTEP", "read.step.sequence", 't', "FromSTEP");
+
+  // ika 28.07.16: Paremeter to read all top level solids and shells,
+  // should be used only in case of invalid shape_representation without links to shapes.
+  Interface_Static::Init("step", "read.step.all.shapes", 'e', "");
+  Interface_Static::Init("step", "read.step.all.shapes", '&', "enum 0");
+  Interface_Static::Init("step", "read.step.all.shapes", '&', "eval Off");
+  Interface_Static::Init("step", "read.step.all.shapes", '&', "eval On");
+  Interface_Static::SetIVal("read.step.all.shapes", 0);
+}
 
 //=======================================================================
 //function : Init
@@ -69,13 +216,18 @@ static void cleanpilot ()
 
 void XSDRAWSTEP::Init ()
 {
-  Handle(StepSelect_Activator)   stepact = new StepSelect_Activator;
-  if (STEPControl_Controller::Init()) // XSDRAW::SetNorm("STEP AP-214"); trop tot
-    XSDRAW::SetController(XSControl_Controller::Recorded("STEP"));
+  static Standard_Boolean inic = Standard_False;
+  if (!inic) {
+    initStatics();
+    Handle(STEPControl_Controller) aStepCtl = new STEPControl_Controller;
+    XSDRAW::SetController(aStepCtl);
+    inic = Standard_True;
+  }
   
   atexit (cleanpilot);
 }
 
+
 //  ########  COMMANDE stepread  : teste le Reader  #########
 
 //=======================================================================
@@ -91,15 +243,18 @@ static Standard_Integer stepread (Draw_Interpretor& di/*theCommands*/, Standard_
   }
   //  On admet le controller AP214 ou une variante
   DeclareAndCast(STEPControl_Controller,ctl,XSDRAW::Controller());
-  if (ctl.IsNull()) XSDRAW::SetNorm("STEP");
-
+  if (ctl.IsNull())
+  {
+    ctl = new STEPControl_Controller;
+    XSDRAW::SetController(ctl);
+  }
 
   // Progress indicator
   Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
   progress->SetScale ( 0, 100, 1 );
   progress->Show();
 
-  STEPControl_Reader sr (XSDRAW::Session(),Standard_False);
+  STEPControl_Reader sr (XSDRAW::Session(), ctl, Standard_False);
   TCollection_AsciiString fnom,rnom;
   Standard_Boolean modfic = XSDRAW::FileAndVar
     (argv[1],argv[2],"STEP",fnom,rnom);
@@ -272,27 +427,27 @@ static Standard_Integer stepread (Draw_Interpretor& di/*theCommands*/, Standard_
 //=======================================================================
 static Standard_Integer testread (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
 {
-  if (argc != 3)                                                                                      
-    {                                                                                             
-      di << "ERROR in " << argv[0] << "Wrong Number of Arguments.\n";                     
-      di << " Usage : " << argv[0] <<" file_name shape_name\n";                          
-      return 1;                                                                                 
-    }
+  if (argc != 3)
+  {
+    di << "ERROR in " << argv[0] << "Wrong Number of Arguments.\n";
+    di << " Usage : " << argv[0] << " file_name shape_name\n";
+    return 1;
+  }
   STEPControl_Reader Reader;
   Standard_CString filename = argv[1];
   IFSelect_ReturnStatus readstat = Reader.ReadFile(filename);
-  di<<"Status from reading STEP file "<<filename<<" : ";  
-  switch(readstat) {                                                              
-    case IFSelect_RetVoid  : { di<<"empty file\n"; return 1; }            
-    case IFSelect_RetDone  : { di<<"file read\n";    break; }             
-    case IFSelect_RetError : { di<<"file not found\n";   return 1; }      
-    case IFSelect_RetFail  : { di<<"error during read\n";  return 1; }    
-    default  :  { di<<"failure\n";   return 1; }                          
-  }  
+  di << "Status from reading STEP file " << filename << " : ";
+  switch (readstat) {
+  case IFSelect_RetVoid: { di << "empty file\n"; return 1; }
+  case IFSelect_RetDone: { di << "file read\n";    break; }
+  case IFSelect_RetError: { di << "file not found\n";   return 1; }
+  case IFSelect_RetFail: { di << "error during read\n";  return 1; }
+  default: { di << "failure\n";   return 1; }
+  }
   Reader.TransferRoots();
   TopoDS_Shape shape = Reader.OneShape();
-  DBRep::Set(argv[2],shape); 
-  di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
+  DBRep::Set(argv[2], shape);
+  di << "Count of shapes produced : " << Reader.NbShapes() << "\n";
   return 0;
 }
  
@@ -337,14 +492,13 @@ static Standard_Integer steptrans (Draw_Interpretor& di, Standard_Integer argc,
 
 static Standard_Integer stepwrite (Draw_Interpretor& di, Standard_Integer argc, const char** argv) 
 {
-//  On admet le controller AP214 ou une variante
-  DeclareAndCast(STEPControl_Controller,ctl,XSDRAW::Controller());
-  if (ctl.IsNull()) {
-    XSDRAW::SetNorm("STEP");
-    //sln 14.01.2002 OCC51: assign new value to ctl in order to avoid exception during using one in the function
-    ctl = Handle(STEPControl_Controller)::DownCast(XSDRAW::Controller());
+  //  On admet le controller AP214 ou une variante
+  DeclareAndCast(STEPControl_Controller, ctl, XSDRAW::Controller());
+  if (ctl.IsNull())
+  {
+    ctl = new STEPControl_Controller;
+    XSDRAW::SetController(ctl);
   }
-
   if (argc < 3) {
     di<<"Give mode[1-4] and Shape name + optional file. Mode possible\n";
     di<<"f ou 1 : FacettedBRep        s ou 2 : ShellBasedSurfaceModel\n"
@@ -366,16 +520,15 @@ static Standard_Integer stepwrite (Draw_Interpretor& di, Standard_Integer argc,
     default :  di<<"1st arg = mode, incorrect [give fsmw]\n"; return 1;
   }
 
-  //:k8 abv 6 Jan 98: using parameter for writing mode (assemblies/shapes)
-  Handle(STEPControl_ActorWrite) ActWrite = 
-    Handle(STEPControl_ActorWrite)::DownCast ( ctl->ActorWrite() );
-  if ( ! ActWrite.IsNull() ) 
-    ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
-
   TopoDS_Shape shape = DBRep::Get(argv[2]);
-  STEPControl_Writer sw (XSDRAW::Session(),Standard_False);
-  Handle(Interface_InterfaceModel) stepmodel = sw.Model();
+  STEPControl_Writer sw (XSDRAW::Session(), ctl, Standard_False);
+  Handle(StepData_StepModel) stepmodel = sw.Model();
   Standard_Integer nbavant = (stepmodel.IsNull() ? 0 : stepmodel->NbEntities());
+  //:k8 abv 6 Jan 98: using parameter for writing mode (assemblies/shapes)
+  Handle(STEPControl_ActorWrite) ActWrite =
+    Handle(STEPControl_ActorWrite)::DownCast(sw.WS()->NormAdaptor()->ActorWrite());
+  if (!ActWrite.IsNull())
+    ActWrite->SetGroupMode("write.step.assembly");
 
   Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
   progress->NewScope(90,"Translating");
index aef90adef9097d0e8676606b0a1149493b8f8e20..25a896041677aa601d1dbd00d3cf738cd638ed3e 100755 (executable)
@@ -13,10 +13,9 @@ if { [file exists ${filedir}/${TheFileName}.stp] } {
   puts "Error : There is old ${filedir}/${TheFileName}.stp file"
 }
 
-xnorm STEP
 restore [locate_data_file ${TheFileName}.brep] f
 param write.step.unit FT
-newmodel
+
 stepwrite a f ${filedir}/${TheFileName}.stp
 
 if { ![file exists ${filedir}/${TheFileName}.stp] } {