0027349: XtControl_Reader is not thread-safe
[occt.git] / src / XSDRAWIGES / XSDRAWIGES.cxx
index 48f5df3..38a73fa 100644 (file)
@@ -59,6 +59,7 @@
 #include <Transfer_TransientProcess.hxx>
 #include <XSControl.hxx>
 #include <XSControl_WorkSession.hxx>
+#include <XSControl_TransferReader.hxx>
 #include <XSDRAW.hxx>
 #include <XSDRAW_Commands.hxx>
 #include <XSDRAWIGES.hxx>
@@ -150,15 +151,15 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
       di<<"  To modify : command  param read.iges.bspline.continuity\n";
       Handle(XSControl_WorkSession) thesession = Reader.WS();
       thesession->ClearContext();
-      XSDRAW::SetTransferProcess (thesession->MapReader());
+      XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
       progress->NewScope ( 80, "Translation" );
       progress->Show();
-      thesession->MapReader()->SetProgress ( progress );
+      thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
       
       if (modepri == 1) Reader.SetReadVisible (Standard_True);
       Reader.TransferRoots();
       
-      thesession->MapReader()->SetProgress ( 0 );
+      thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
       progress->EndScope();
       progress->Show();
       // result in only one shape for all the roots
@@ -251,15 +252,15 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
         di<<"  To modify : command  param read.iges.bspline.continuity\n";
         Handle(XSControl_WorkSession) thesession = Reader.WS();
         thesession->ClearContext();
-        XSDRAW::SetTransferProcess (thesession->MapReader());
+        XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
         progress->NewScope ( 80, "Translation" );
         progress->Show();
-        thesession->MapReader()->SetProgress ( progress );
+        thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
       
         Reader.SetReadVisible (Standard_True);
         Reader.TransferRoots();
       
-        thesession->MapReader()->SetProgress ( 0 );
+        thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
         progress->EndScope();
         progress->Show();
         
@@ -329,10 +330,10 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
          Standard_Integer nbt = 0;
          Handle(XSControl_WorkSession) thesession = Reader.WS();
        
-         XSDRAW::SetTransferProcess (thesession->MapReader());
+         XSDRAW::SetTransferProcess (thesession->TransferReader()->TransientProcess());
           progress->NewScope ( 80, "Translation" );
           progress->Show();
-          thesession->MapReader()->SetProgress ( progress );
+          thesession->TransferReader()->TransientProcess()->SetProgress ( progress );
 
           Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
          for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
@@ -350,7 +351,7 @@ static Standard_Integer igesbrep (Draw_Interpretor& di, Standard_Integer argc, c
               nbt++;
            }
          }
-         thesession->MapReader()->SetProgress ( 0 );
+         thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
           progress->EndScope();
           progress->Show();
          di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
@@ -520,7 +521,7 @@ static Standard_Integer XSDRAWIGES_tplosttrim (Draw_Interpretor& di, Standard_In
 //  Standard_Integer narg = pilot->NbWords();
   Standard_Integer narg = n;
 
-  Handle(Transfer_TransientProcess) TP = XSControl::Session(pilot)->MapReader();
+  const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
   TColStd_Array1OfAsciiString strarg(1, 3);
   TColStd_Array1OfAsciiString typarg(1, 3);
   strarg.SetValue(1,"xst-type(CurveOnSurface)");
@@ -602,20 +603,13 @@ static Standard_Integer XSDRAWIGES_TPSTAT(Draw_Interpretor& di,Standard_Integer
   Handle(IFSelect_SessionPilot) pilot = XSDRAW::Pilot();
   Standard_Integer argc = n;//= pilot->NbWords();
   const Standard_CString arg1 = a[1];//pilot->Arg(1);
-  //IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False);
-  Handle(Transfer_TransientProcess) TP= XSControl::Session(pilot)->MapReader();
-   IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False);
-  //read.SetTransientProcess(TP);
+  const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
+  IGESControl_Reader read; //(XSControl::Session(pilot),Standard_False);
 //        ****    tpent        ****
-//  if (TP.IsNull()) { di<<"No Transfer Read\n"; return IFSelect_RetError;}
   Handle(Interface_InterfaceModel) model = TP->Model();
-  //Handle(Interface_InterfaceModel) model = read.Model();
   if (model.IsNull()) {di<<"No Transfer Read\n"; return -1;}
- //DeclareAndCast(IGESData_IGESModel,modelig,model);
- // read.SetModel(modelig);
   Handle(XSControl_WorkSession) thesession = read.WS();
   thesession->SetMapReader(TP);
-  //read.SetModel(model);
   Standard_Integer mod1 = 0;
   if (argc > 1) {
     char a2 = arg1[1]; if (a2 == '\0') a2 = '!';