1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

Compare commits

...

1 Commits

Author SHA1 Message Date
dpasukhi
4bb4ce5860 0033309: Data Exchange, XS - Update WorkSession to keep reference work sessions
Updated WorkSession to keep reference WS information
2023-01-06 16:33:09 +00:00
4 changed files with 247 additions and 279 deletions

View File

@@ -862,6 +862,8 @@ Handle(STEPCAFControl_ExternFile) STEPCAFControl_Reader::ReadExternFile (const S
EF->SetWS(newWS); EF->SetWS(newWS);
EF->SetName(new TCollection_HAsciiString(file)); EF->SetName(new TCollection_HAsciiString(file));
myReader.WS()->AppendReferenceWS(file, newWS);
// read file // read file
EF->SetLoadStatus(sr.ReadFile(fullname)); EF->SetLoadStatus(sr.ReadFile(fullname));

View File

@@ -800,6 +800,7 @@ TopoDS_Shape STEPCAFControl_Writer::TransferExternFiles (const TDF_Label &L,
EF->SetWS ( newWS ); EF->SetWS ( newWS );
EF->SetName ( name ); EF->SetName ( name );
EF->SetLabel ( L ); EF->SetLabel ( L );
Writer().WS()->AppendReferenceWS(name->String(), newWS);
Standard_Integer assemblymode = Interface_Static::IVal ("write.step.assembly"); Standard_Integer assemblymode = Interface_Static::IVal ("write.step.assembly");
Interface_Static::SetCVal ("write.step.assembly", "Off"); Interface_Static::SetCVal ("write.step.assembly", "Off");
const Standard_CString multi = 0; const Standard_CString multi = 0;

View File

@@ -11,11 +11,9 @@
// Alternatively, this file may be used under the terms of Open CASCADE // Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement. // commercial license or contractual agreement.
//:i1 pdn 03.04.99 BUC60301 #include <XSControl_WorkSession.hxx>
#include <Geom2d_Point.hxx>
#include <Interface_Check.hxx> #include <Interface_Check.hxx>
#include <Interface_HGraph.hxx>
#include <Interface_InterfaceModel.hxx> #include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx> #include <Interface_Macros.hxx>
#include <Message_Messenger.hxx> #include <Message_Messenger.hxx>
@@ -27,8 +25,7 @@
#include <Transfer_TransientProcess.hxx> #include <Transfer_TransientProcess.hxx>
#include <XSControl_Controller.hxx> #include <XSControl_Controller.hxx>
#include <XSControl_TransferReader.hxx> #include <XSControl_TransferReader.hxx>
#include <XSControl_Vars.hxx> #include <XSControl_TransferWriter.hxx>
#include <XSControl_WorkSession.hxx>
IMPLEMENT_STANDARD_RTTIEXT(XSControl_WorkSession, IFSelect_WorkSession) IMPLEMENT_STANDARD_RTTIEXT(XSControl_WorkSession, IFSelect_WorkSession)
@@ -36,20 +33,24 @@ IMPLEMENT_STANDARD_RTTIEXT(XSControl_WorkSession,IFSelect_WorkSession)
//function : XSControl_WorkSession //function : XSControl_WorkSession
//purpose : //purpose :
//======================================================================= //=======================================================================
XSControl_WorkSession::XSControl_WorkSession() :
myTransferReader(new XSControl_TransferReader),
myTransferWriter(new XSControl_TransferWriter)
{}
XSControl_WorkSession::XSControl_WorkSession () //=======================================================================
: myTransferReader(new XSControl_TransferReader), //function : XSControl_WorkSession
myTransferWriter(new XSControl_TransferWriter), //purpose :
myVars(new XSControl_Vars) //=======================================================================
XSControl_WorkSession::~XSControl_WorkSession()
{ {
clearBinders();
} }
//======================================================================= //=======================================================================
//function : ClearData //function : ClearData
//purpose : //purpose :
//======================================================================= //=======================================================================
void XSControl_WorkSession::ClearData(const Standard_Integer mode) void XSControl_WorkSession::ClearData(const Standard_Integer mode)
{ {
// 1-2-3-4 : standard IFSelect // 1-2-3-4 : standard IFSelect
@@ -59,7 +60,8 @@ void XSControl_WorkSession::ClearData (const Standard_Integer mode)
// 6 : Resultats forces seuls // 6 : Resultats forces seuls
// 7 : Management, y compris tous transferts (forces/calcules), views // 7 : Management, y compris tous transferts (forces/calcules), views
if (mode == 5 || mode == 7) { if (mode == 5 || mode == 7)
{
myTransferReader->Clear(-1); myTransferReader->Clear(-1);
myTransferWriter->Clear(-1); myTransferWriter->Clear(-1);
} }
@@ -67,12 +69,10 @@ void XSControl_WorkSession::ClearData (const Standard_Integer mode)
myTransferReader->SetGraph(HGraph()); myTransferReader->SetGraph(HGraph());
} }
//======================================================================= //=======================================================================
//function : SelectNorm //function : SelectNorm
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean XSControl_WorkSession::SelectNorm(const Standard_CString normname) Standard_Boolean XSControl_WorkSession::SelectNorm(const Standard_CString normname)
{ {
// Old norm and results // Old norm and results
@@ -87,12 +87,10 @@ Standard_Boolean XSControl_WorkSession::SelectNorm(const Standard_CString normn
return Standard_True; return Standard_True;
} }
//======================================================================= //=======================================================================
//function : SetController //function : SetController
//purpose : //purpose :
//======================================================================= //=======================================================================
void XSControl_WorkSession::SetController(const Handle(XSControl_Controller)& ctl) void XSControl_WorkSession::SetController(const Handle(XSControl_Controller)& ctl)
{ {
myController = ctl; myController = ctl;
@@ -113,12 +111,10 @@ void XSControl_WorkSession::SetController(const Handle(XSControl_Controller)& ct
myTransferWriter->SetController(myController); myTransferWriter->SetController(myController);
} }
//======================================================================= //=======================================================================
//function : SelectedNorm //function : SelectedNorm
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_CString XSControl_WorkSession::SelectedNorm(const Standard_Boolean rsc) const Standard_CString XSControl_WorkSession::SelectedNorm(const Standard_Boolean rsc) const
{ {
//JR/Hp : //JR/Hp :
@@ -126,46 +122,20 @@ Standard_CString XSControl_WorkSession::SelectedNorm(const Standard_Boolean rsc)
return astr; return astr;
} }
// ##########################################
// ############ Contexte de Transfert ######
// ##########################################
//======================================================================= //=======================================================================
//function : SetAllContext //function : SelectedNorm
//purpose : //purpose :
//======================================================================= //=======================================================================
void XSControl_WorkSession::AppendReferenceWS(const TCollection_AsciiString& theName,
void XSControl_WorkSession::SetAllContext(const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& context) const Handle(XSControl_WorkSession)& theWS)
{ {
myContext = context; myReferenceWS.Bind(theName, theWS);
myTransferReader->Context() = context;
} }
//=======================================================================
//function : ClearContext
//purpose :
//=======================================================================
void XSControl_WorkSession::ClearContext ()
{
myContext.Clear();
myTransferReader->Context().Clear();
}
// ##########################################
// ############ RESULTATS FORCES ######
// ##########################################
//======================================================================= //=======================================================================
//function : PrintTransferStatus //function : PrintTransferStatus
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Integer num, Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Integer num,
const Standard_Boolean wri, const Standard_Boolean wri,
Standard_OStream& S) const Standard_OStream& S) const
@@ -178,17 +148,21 @@ Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Inte
Handle(Standard_Transient) ent; Handle(Standard_Transient) ent;
// *** WRITE *** // *** WRITE ***
if (wri) { if (wri)
{
if (FP.IsNull()) return Standard_False; if (FP.IsNull()) return Standard_False;
if (num == 0) return Standard_False; if (num == 0) return Standard_False;
Standard_Integer ne = 0, nr = 0, max = FP->NbMapped(), maxr = FP->NbRoots(); Standard_Integer ne = 0, nr = 0, max = FP->NbMapped(), maxr = FP->NbRoots();
if (num > 0) { if (num > 0)
{
if (num > max) return Standard_False; if (num > max) return Standard_False;
ne = num; ne = num;
finder = FP->Mapped(ne); finder = FP->Mapped(ne);
nr = FP->RootIndex(finder); nr = FP->RootIndex(finder);
} else if (num < 0) { }
else if (num < 0)
{
nr = -num; nr = -num;
if (nr > maxr) return Standard_False; if (nr > maxr) return Standard_False;
finder = FP->Root(nr); finder = FP->Root(nr);
@@ -204,17 +178,21 @@ Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Inte
ent = FP->FindTransient(finder); ent = FP->FindTransient(finder);
S << " -> Type " << finder->DynamicType()->Name() << std::endl; S << " -> Type " << finder->DynamicType()->Name() << std::endl;
FP->StartTrace(binder, finder, 0, 0); // pb sout/S FP->StartTrace(binder, finder, 0, 0); // pb sout/S
if (!ent.IsNull()) { if (!ent.IsNull())
{
S << " ** Resultat Transient, type " << ent->DynamicType()->Name(); S << " ** Resultat Transient, type " << ent->DynamicType()->Name();
const Handle(Interface_InterfaceModel)& model = Model(); const Handle(Interface_InterfaceModel)& model = Model();
if (!model.IsNull()) if (!model.IsNull())
{ S<<" In output Model, Entity "; model->Print(ent, S); } {
S << " In output Model, Entity "; model->Print(ent, S);
}
S << std::endl; S << std::endl;
} }
} }
// *** READ *** // *** READ ***
else { else
{
if (TP.IsNull()) return Standard_False; if (TP.IsNull()) return Standard_False;
Handle(Interface_InterfaceModel) model = TP->Model(); Handle(Interface_InterfaceModel) model = TP->Model();
if (model.IsNull()) std::cout << "No Model" << std::endl; if (model.IsNull()) std::cout << "No Model" << std::endl;
@@ -222,12 +200,15 @@ Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Inte
if (num == 0) return Standard_False; if (num == 0) return Standard_False;
Standard_Integer ne = 0, nr = 0, max = TP->NbMapped(), maxr = TP->NbRoots(); Standard_Integer ne = 0, nr = 0, max = TP->NbMapped(), maxr = TP->NbRoots();
if (num > 0) { if (num > 0)
{
if (num > max) return Standard_False; if (num > max) return Standard_False;
ne = num; ne = num;
ent = TP->Mapped(ne); ent = TP->Mapped(ne);
nr = TP->RootIndex(finder); nr = TP->RootIndex(finder);
} else if (num < 0) { }
else if (num < 0)
{
nr = -num; nr = -num;
if (nr > maxr) return Standard_False; if (nr > maxr) return Standard_False;
ent = TP->Root(nr); ent = TP->Root(nr);
@@ -248,14 +229,17 @@ Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Inte
} }
// *** CHECK (commun READ+WRITE) *** // *** CHECK (commun READ+WRITE) ***
if (!binder.IsNull()) { if (!binder.IsNull())
{
const Handle(Interface_Check) ch = binder->Check(); const Handle(Interface_Check) ch = binder->Check();
Standard_Integer i, nbw = ch->NbWarnings(), nbf = ch->NbFails(); Standard_Integer i, nbw = ch->NbWarnings(), nbf = ch->NbFails();
if (nbw > 0) { if (nbw > 0)
{
S << " - Warnings : " << nbw << " :\n"; S << " - Warnings : " << nbw << " :\n";
for (i = 1; i <= nbw; i++) S << ch->CWarning(i) << std::endl; for (i = 1; i <= nbw; i++) S << ch->CWarning(i) << std::endl;
} }
if (nbf > 0) { if (nbf > 0)
{
S << " - Fails : " << nbf << " :\n"; S << " - Fails : " << nbf << " :\n";
for (i = 1; i <= nbf; i++) S << ch->CFail(i) << std::endl; for (i = 1; i <= nbf; i++) S << ch->CFail(i) << std::endl;
} }
@@ -263,12 +247,10 @@ Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Inte
return Standard_True; return Standard_True;
} }
//======================================================================= //=======================================================================
//function : InitTransferReader //function : InitTransferReader
//purpose : //purpose :
//======================================================================= //=======================================================================
void XSControl_WorkSession::InitTransferReader(const Standard_Integer mode) void XSControl_WorkSession::InitTransferReader(const Standard_Integer mode)
{ {
if (mode == 0 || mode == 5) myTransferReader->Clear(-1); // full clear if (mode == 0 || mode == 5) myTransferReader->Clear(-1); // full clear
@@ -276,13 +258,16 @@ void XSControl_WorkSession::InitTransferReader(const Standard_Integer mode)
else SetTransferReader(myTransferReader); else SetTransferReader(myTransferReader);
// mode = 0 fait par SetTransferReader suite a Nullify // mode = 0 fait par SetTransferReader suite a Nullify
if (mode == 1) { if (mode == 1)
{
if (!myTransferReader.IsNull()) myTransferReader->Clear(-1); if (!myTransferReader.IsNull()) myTransferReader->Clear(-1);
else SetTransferReader(new XSControl_TransferReader); else SetTransferReader(new XSControl_TransferReader);
} }
if (mode == 2) { if (mode == 2)
{
Handle(Transfer_TransientProcess) TP = myTransferReader->TransientProcess(); Handle(Transfer_TransientProcess) TP = myTransferReader->TransientProcess();
if (TP.IsNull()) { if (TP.IsNull())
{
TP = new Transfer_TransientProcess; TP = new Transfer_TransientProcess;
myTransferReader->SetTransientProcess(TP); myTransferReader->SetTransientProcess(TP);
TP->SetGraph(HGraph()); TP->SetGraph(HGraph());
@@ -291,7 +276,8 @@ void XSControl_WorkSession::InitTransferReader(const Standard_Integer mode)
Standard_Integer i, nb = lis->Length(); Standard_Integer i, nb = lis->Length();
for (i = 1; i <= nb; i++) TP->SetRoot(lis->Value(i)); for (i = 1; i <= nb; i++) TP->SetRoot(lis->Value(i));
} }
if (mode == 3) { if (mode == 3)
{
Handle(Transfer_TransientProcess) TP = myTransferReader->TransientProcess(); Handle(Transfer_TransientProcess) TP = myTransferReader->TransientProcess();
if (TP.IsNull()) return; if (TP.IsNull()) return;
Standard_Integer i, nb = TP->NbRoots(); Standard_Integer i, nb = TP->NbRoots();
@@ -300,12 +286,10 @@ void XSControl_WorkSession::InitTransferReader(const Standard_Integer mode)
if (mode == 4 || mode == 5) myTransferReader->BeginTransfer(); if (mode == 4 || mode == 5) myTransferReader->BeginTransfer();
} }
//======================================================================= //=======================================================================
//function : SetTransferReader //function : SetTransferReader
//purpose : //purpose :
//======================================================================= //=======================================================================
void XSControl_WorkSession::SetTransferReader(const Handle(XSControl_TransferReader)& TR) void XSControl_WorkSession::SetTransferReader(const Handle(XSControl_TransferReader)& TR)
{ {
if (myTransferReader != TR) //i1 pdn 03.04.99 BUC60301 if (myTransferReader != TR) //i1 pdn 03.04.99 BUC60301
@@ -325,7 +309,6 @@ void XSControl_WorkSession::SetTransferReader(const Handle(XSControl_TransferRea
//function : MapReader //function : MapReader
//purpose : //purpose :
//======================================================================= //=======================================================================
Handle(Transfer_TransientProcess) XSControl_WorkSession::MapReader() const Handle(Transfer_TransientProcess) XSControl_WorkSession::MapReader() const
{ {
return myTransferReader->TransientProcess(); return myTransferReader->TransientProcess();
@@ -335,7 +318,6 @@ Handle(Transfer_TransientProcess) XSControl_WorkSession::MapReader() const
//function : SetMapReader //function : SetMapReader
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean XSControl_WorkSession::SetMapReader(const Handle(Transfer_TransientProcess)& TP) Standard_Boolean XSControl_WorkSession::SetMapReader(const Handle(Transfer_TransientProcess)& TP)
{ {
if (TP.IsNull()) return Standard_False; if (TP.IsNull()) return Standard_False;
@@ -353,14 +335,12 @@ Standard_Boolean XSControl_WorkSession::SetMapReader (const Handle(Transfer_Tran
return Standard_True; return Standard_True;
} }
//======================================================================= //=======================================================================
//function : Result //function : Result
//purpose : //purpose :
//======================================================================= //=======================================================================
Handle(Standard_Transient) XSControl_WorkSession::Result(const Handle(Standard_Transient)& ent,
Handle(Standard_Transient) XSControl_WorkSession::Result const Standard_Integer mode) const
(const Handle(Standard_Transient)& ent, const Standard_Integer mode) const
{ {
Standard_Integer ouca = (mode % 10); Standard_Integer ouca = (mode % 10);
Standard_Integer kica = (mode / 10); Standard_Integer kica = (mode / 10);
@@ -381,16 +361,10 @@ Handle(Standard_Transient) XSControl_WorkSession::Result
return binder; return binder;
} }
// ##########################################
// ############ TRANSFERT #############
// ##########################################
//======================================================================= //=======================================================================
//function : TransferReadOne //function : TransferReadOne
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer XSControl_WorkSession::TransferReadOne(const Handle(Standard_Transient)& ent, Standard_Integer XSControl_WorkSession::TransferReadOne(const Handle(Standard_Transient)& ent,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
{ {
@@ -404,27 +378,19 @@ Standard_Integer XSControl_WorkSession::TransferReadOne (const Handle(Standard_T
return myTransferReader->TransferList(list, Standard_True, theProgress); return myTransferReader->TransferList(list, Standard_True, theProgress);
} }
//======================================================================= //=======================================================================
//function : TransferReadRoots //function : TransferReadRoots
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer XSControl_WorkSession::TransferReadRoots(const Message_ProgressRange& theProgress) Standard_Integer XSControl_WorkSession::TransferReadRoots(const Message_ProgressRange& theProgress)
{ {
return myTransferReader->TransferRoots(Graph(), theProgress); return myTransferReader->TransferRoots(Graph(), theProgress);
} }
// ##########################################
// ############ TRANSFERT WRITE
// ##########################################
//======================================================================= //=======================================================================
//function : NewModel //function : NewModel
//purpose : //purpose :
//======================================================================= //=======================================================================
Handle(Interface_InterfaceModel) XSControl_WorkSession::NewModel() Handle(Interface_InterfaceModel) XSControl_WorkSession::NewModel()
{ {
Handle(Interface_InterfaceModel) newmod; Handle(Interface_InterfaceModel) newmod;
@@ -441,12 +407,30 @@ Handle(Interface_InterfaceModel) XSControl_WorkSession::NewModel ()
return newmod; return newmod;
} }
//=======================================================================
//function : TransferWriter
//purpose :
//=======================================================================
const Handle(XSControl_TransferWriter)& XSControl_WorkSession::TransferWriter() const
{
return myTransferWriter;
}
//=======================================================================
//function : SetMapWriter
//purpose :
//=======================================================================
Standard_Boolean XSControl_WorkSession::SetMapWriter(const Handle(Transfer_FinderProcess)& theFP)
{
if (theFP.IsNull()) return Standard_False;
myTransferWriter->SetFinderProcess(theFP);
return Standard_True;
}
//======================================================================= //=======================================================================
//function : TransferWriteShape //function : TransferWriteShape
//purpose : //purpose :
//======================================================================= //=======================================================================
IFSelect_ReturnStatus XSControl_WorkSession::TransferWriteShape(const TopoDS_Shape& shape, IFSelect_ReturnStatus XSControl_WorkSession::TransferWriteShape(const TopoDS_Shape& shape,
const Standard_Boolean compgraph, const Standard_Boolean compgraph,
const Message_ProgressRange& theProgress) const Message_ProgressRange& theProgress)
@@ -470,24 +454,20 @@ IFSelect_ReturnStatus XSControl_WorkSession::TransferWriteShape (const TopoDS_Sh
return status; return status;
} }
//======================================================================= //=======================================================================
//function : TransferWriteCheckList //function : TransferWriteCheckList
//purpose : //purpose :
//======================================================================= //=======================================================================
Interface_CheckIterator XSControl_WorkSession::TransferWriteCheckList() const Interface_CheckIterator XSControl_WorkSession::TransferWriteCheckList() const
{ {
return myTransferWriter->ResultCheckList(Model()); return myTransferWriter->ResultCheckList(Model());
} }
//======================================================================= //=======================================================================
//function : ClearBinders //function : clearBinders
//purpose : //purpose :
//======================================================================= //=======================================================================
void XSControl_WorkSession::clearBinders()
void XSControl_WorkSession::ClearBinders()
{ {
const Handle(Transfer_FinderProcess)& FP = myTransferWriter->FinderProcess(); const Handle(Transfer_FinderProcess)& FP = myTransferWriter->FinderProcess();
//Due to big number of chains of binders it is necessary to //Due to big number of chains of binders it is necessary to
@@ -495,7 +475,8 @@ void XSControl_WorkSession::ClearBinders()
TColStd_SequenceOfTransient aSeqBnd; TColStd_SequenceOfTransient aSeqBnd;
TColStd_SequenceOfTransient aSeqShapes; TColStd_SequenceOfTransient aSeqShapes;
Standard_Integer i = 1; Standard_Integer i = 1;
for( ; i <= FP->NbMapped();i++) { for (; i <= FP->NbMapped(); i++)
{
Handle(Transfer_Binder) bnd = FP->MapItem(i); Handle(Transfer_Binder) bnd = FP->MapItem(i);
if (!bnd.IsNull()) if (!bnd.IsNull())
aSeqBnd.Append(bnd); aSeqBnd.Append(bnd);
@@ -508,18 +489,18 @@ void XSControl_WorkSession::ClearBinders()
ClearData(5); ClearData(5);
//removing each chain of binders //removing each chain of binders
while(aSeqBnd.Length() >0) { while (aSeqBnd.Length() > 0)
{
Handle(Transfer_Binder) aBnd = Handle(Transfer_Binder)::DownCast(aSeqBnd.Value(1)); Handle(Transfer_Binder) aBnd = Handle(Transfer_Binder)::DownCast(aSeqBnd.Value(1));
Handle(Standard_Transient) ash = aSeqShapes.Value(1); Handle(Standard_Transient) ash = aSeqShapes.Value(1);
aSeqBnd.Remove(1); aSeqBnd.Remove(1);
aSeqShapes.Remove(1); aSeqShapes.Remove(1);
ash.Nullify(); ash.Nullify();
while(!aBnd.IsNull()) { while (!aBnd.IsNull())
{
Handle(Transfer_Binder) aBndNext = aBnd->NextResult(); Handle(Transfer_Binder) aBndNext = aBnd->NextResult();
aBnd.Nullify(); aBnd.Nullify();
aBnd = aBndNext; aBnd = aBndNext;
} }
} }
} }

View File

@@ -22,7 +22,7 @@
#include <IFSelect_WorkSession.hxx> #include <IFSelect_WorkSession.hxx>
#include <IFSelect_ReturnStatus.hxx> #include <IFSelect_ReturnStatus.hxx>
#include <XSControl_TransferWriter.hxx>
class XSControl_Controller; class XSControl_Controller;
class XSControl_TransferReader; class XSControl_TransferReader;
class XSControl_Vars; class XSControl_Vars;
@@ -32,10 +32,11 @@ class Transfer_FinderProcess;
class TopoDS_Shape; class TopoDS_Shape;
class Interface_CheckIterator; class Interface_CheckIterator;
class XSControl_WorkSession; class XSControl_WorkSession;
DEFINE_STANDARD_HANDLE(XSControl_WorkSession, IFSelect_WorkSession) DEFINE_STANDARD_HANDLE(XSControl_WorkSession, IFSelect_WorkSession)
typedef NCollection_DataMap<TCollection_AsciiString, Handle(XSControl_WorkSession)> XSControl_WorkSessionMap;
//! This WorkSession completes the basic one, by adding : //! This WorkSession completes the basic one, by adding :
//! - use of Controller, with norm selection... //! - use of Controller, with norm selection...
//! - management of transfers (both ways) with auxiliary classes //! - management of transfers (both ways) with auxiliary classes
@@ -50,8 +51,7 @@ class XSControl_WorkSession : public IFSelect_WorkSession
Standard_EXPORT XSControl_WorkSession(); Standard_EXPORT XSControl_WorkSession();
~XSControl_WorkSession() Standard_EXPORT ~XSControl_WorkSession();
{ ClearBinders(); }
//! In addition to basic ClearData, clears Transfer and Management //! In addition to basic ClearData, clears Transfer and Management
//! for interactive use, for mode = 0,1,2 and over 4 //! for interactive use, for mode = 0,1,2 and over 4
@@ -77,26 +77,22 @@ class XSControl_WorkSession : public IFSelect_WorkSession
Standard_EXPORT Standard_CString SelectedNorm(const Standard_Boolean theRsc = Standard_False) const; Standard_EXPORT Standard_CString SelectedNorm(const Standard_Boolean theRsc = Standard_False) const;
//! Returns the norm controller itself //! Returns the norm controller itself
const Handle(XSControl_Controller) & NormAdaptor() const const Handle(XSControl_Controller)& NormAdaptor() const { return myController; }
{ return myController; }
//! Returns the current Context List, Null if not defined //! Returns the current reference WS List, empty if not defined
//! The Context is given to the TransientProcess for TransferRead const XSControl_WorkSessionMap& ReferenceWS() const { return myReferenceWS; }
const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> & Context() const
{ return myContext; }
//! Sets the current Context List, as a whole //! Appends new refrence Work Session
//! Sets it to the TransferReader Standard_EXPORT void AppendReferenceWS(const TCollection_AsciiString& theName,
Standard_EXPORT void SetAllContext (const NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)>& theContext); const Handle(XSControl_WorkSession)& theWS);
//! Clears the whole current Context (nullifies it)
Standard_EXPORT void ClearContext();
//! Prints the transfer status of a transferred item, as being //! Prints the transfer status of a transferred item, as being
//! the Mapped n0 <num>, from MapWriter if <wri> is True, or //! the Mapped n0 <num>, from MapWriter if <wri> is True, or
//! from MapReader if <wri> is False //! from MapReader if <wri> is False
//! Returns True when done, False else (i.e. num out of range) //! Returns True when done, False else (i.e. num out of range)
Standard_EXPORT Standard_Boolean PrintTransferStatus (const Standard_Integer theNum, const Standard_Boolean theWri, Standard_OStream& theS) const; Standard_EXPORT Standard_Boolean PrintTransferStatus(const Standard_Integer theNum,
const Standard_Boolean theWri,
Standard_OStream& theS) const;
//! Sets a Transfer Reader, by internal ways, according mode : //! Sets a Transfer Reader, by internal ways, according mode :
//! 0 recreates it clear, 1 clears it (does not recreate) //! 0 recreates it clear, 1 clears it (does not recreate)
@@ -110,8 +106,7 @@ class XSControl_WorkSession : public IFSelect_WorkSession
Standard_EXPORT void SetTransferReader(const Handle(XSControl_TransferReader)& theTR); Standard_EXPORT void SetTransferReader(const Handle(XSControl_TransferReader)& theTR);
//! Returns the Transfer Reader, Null if not set //! Returns the Transfer Reader, Null if not set
const Handle(XSControl_TransferReader) & TransferReader () const const Handle(XSControl_TransferReader)& TransferReader() const { return myTransferReader; }
{ return myTransferReader; }
//! Returns the TransientProcess(internal data for TransferReader) //! Returns the TransientProcess(internal data for TransferReader)
Standard_EXPORT Handle(Transfer_TransientProcess) MapReader() const; Standard_EXPORT Handle(Transfer_TransientProcess) MapReader() const;
@@ -131,7 +126,8 @@ class XSControl_WorkSession : public IFSelect_WorkSession
//! <mode> = 10,11,12 idem but returns the Binder itself //! <mode> = 10,11,12 idem but returns the Binder itself
//! (if it is not, e.g. Shape, returns the Binder) //! (if it is not, e.g. Shape, returns the Binder)
//! <mode> = 20, returns the ResultFromModel //! <mode> = 20, returns the ResultFromModel
Standard_EXPORT Handle(Standard_Transient) Result (const Handle(Standard_Transient)& theEnt, const Standard_Integer theMode) const; Standard_EXPORT Handle(Standard_Transient) Result(const Handle(Standard_Transient)& theEnt,
const Standard_Integer theMode) const;
//! Commands the transfer of, either one entity, or a list //! Commands the transfer of, either one entity, or a list
//! I.E. calls the TransferReader after having analysed <ents> //! I.E. calls the TransferReader after having analysed <ents>
@@ -155,25 +151,18 @@ class XSControl_WorkSession : public IFSelect_WorkSession
Standard_EXPORT Handle(Interface_InterfaceModel) NewModel(); Standard_EXPORT Handle(Interface_InterfaceModel) NewModel();
//! Returns the Transfer Reader, Null if not set //! Returns the Transfer Reader, Null if not set
const Handle(XSControl_TransferWriter) & TransferWriter() const Standard_EXPORT const Handle(XSControl_TransferWriter)& TransferWriter() const;
{ return myTransferWriter; }
//! Changes the Map Reader, i.e. considers that the new one //! Changes the Map Reader, i.e. considers that the new one
//! defines the relevant read results (forgets the former ones) //! defines the relevant read results (forgets the former ones)
//! Returns True when done, False if <FP> is Null //! Returns True when done, False if <FP> is Null
Standard_Boolean SetMapWriter (const Handle(Transfer_FinderProcess)& theFP) Standard_EXPORT Standard_Boolean SetMapWriter(const Handle(Transfer_FinderProcess)& theFP);
{
if (theFP.IsNull()) return Standard_False;
myTransferWriter->SetFinderProcess(theFP);
return Standard_True;
}
//! Transfers a Shape from CasCade to a model of current norm, //! Transfers a Shape from CasCade to a model of current norm,
//! according to the last call to SetModeWriteShape //! according to the last call to SetModeWriteShape
//! Returns status :Done if OK, Fail if error during transfer, //! Returns status :Done if OK, Fail if error during transfer,
//! Error if transfer badly initialised //! Error if transfer badly initialised
Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape(const TopoDS_Shape& theShape,
(const TopoDS_Shape& theShape,
const Standard_Boolean theCompGraph = Standard_True, const Standard_Boolean theCompGraph = Standard_True,
const Message_ProgressRange& theProgress = Message_ProgressRange()); const Message_ProgressRange& theProgress = Message_ProgressRange());
@@ -183,24 +172,19 @@ class XSControl_WorkSession : public IFSelect_WorkSession
//! with original objects (in fact, their mappers) //! with original objects (in fact, their mappers)
Standard_EXPORT Interface_CheckIterator TransferWriteCheckList() const; Standard_EXPORT Interface_CheckIterator TransferWriteCheckList() const;
const Handle(XSControl_Vars) & Vars() const
{ return myVars; }
void SetVars (const Handle(XSControl_Vars)& theVars)
{ myVars = theVars; }
DEFINE_STANDARD_RTTIEXT(XSControl_WorkSession, IFSelect_WorkSession) DEFINE_STANDARD_RTTIEXT(XSControl_WorkSession, IFSelect_WorkSession)
private: protected:
//! Clears binders //! Clears binders
Standard_EXPORT void ClearBinders(); void clearBinders();
private:
Handle(XSControl_Controller) myController; Handle(XSControl_Controller) myController;
Handle(XSControl_TransferReader) myTransferReader; Handle(XSControl_TransferReader) myTransferReader;
Handle(XSControl_TransferWriter) myTransferWriter; Handle(XSControl_TransferWriter) myTransferWriter;
NCollection_DataMap<TCollection_AsciiString, Handle(Standard_Transient)> myContext; XSControl_WorkSessionMap myReferenceWS;
Handle(XSControl_Vars) myVars;
}; };
#endif // _XSControl_WorkSession_HeaderFile #endif // _XSControl_WorkSession_HeaderFile