diff --git a/samples/mfc/standard/Common/ImportExport/ImportExport.cpp b/samples/mfc/standard/Common/ImportExport/ImportExport.cpp index 3945746d61..4fc1a67f3f 100755 --- a/samples/mfc/standard/Common/ImportExport/ImportExport.cpp +++ b/samples/mfc/standard/Common/ImportExport/ImportExport.cpp @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -430,7 +431,7 @@ IFSelect_ReturnStatus CImportExport::ReadSTEP(const Standard_CString& aFileName, if (status != IFSelect_RetDone) return status; - aReader.WS()->MapReader()->SetTraceLevel(2); // increase default trace level + aReader.WS()->TransferReader()->TransientProcess()->SetTraceLevel(2); // increase default trace level Standard_Boolean failsonly = Standard_False; aReader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity); diff --git a/src/IFSelect/IFSelect_Activator.cxx b/src/IFSelect/IFSelect_Activator.cxx index d25787cd8b..67def97ab0 100644 --- a/src/IFSelect/IFSelect_Activator.cxx +++ b/src/IFSelect/IFSelect_Activator.cxx @@ -17,10 +17,7 @@ #include #include #include -#include -#include #include -#include #include #include #include @@ -32,8 +29,6 @@ static Handle(Dico_DictionaryOfInteger) thedico; // = new Dico_DictionaryOfInteg static TColStd_SequenceOfInteger thenums, themodes; static TColStd_SequenceOfTransient theacts; -static Handle(MoniTool_Profile) thealiases; - void IFSelect_Activator::Adding (const Handle(IFSelect_Activator)& actor, @@ -67,49 +62,6 @@ static Handle(MoniTool_Profile) thealiases; void IFSelect_Activator::Remove (const Standard_CString command) { thedico->RemoveItem(command); } -// ALIAS : gere avec un Profile -// Chaque commande est representee par une Option -// Au sein de laquelle chaque configuration nomme un cas, dont la valeur -// est le nom de son alias pour cette conf -// Et chaque conf porte un switch sur cette option avec pour valeur le propre -// nom de la conf - - void IFSelect_Activator::SetAlias - (const Standard_CString conf, - const Standard_CString command, const Standard_CString alias) -{ - if (thealiases.IsNull()) thealiases = new MoniTool_Profile; - Handle(MoniTool_Option) opt = thealiases->Option(command); - if (opt.IsNull()) { - opt = new MoniTool_Option(STANDARD_TYPE(TCollection_HAsciiString),command); - thealiases->AddOption (opt); - } - opt->Add (conf,new TCollection_HAsciiString(alias)); - - if (!thealiases->HasConf(conf)) thealiases->AddConf (conf); - thealiases->AddSwitch (conf,command,conf); -} - - void IFSelect_Activator::SetCurrentAlias (const Standard_CString conf) -{ - if (!thealiases.IsNull()) thealiases->SetCurrent (conf); -} - - TCollection_AsciiString IFSelect_Activator::Alias - (const Standard_CString command) -{ - TCollection_AsciiString str; - if (thealiases.IsNull()) return str; - Handle(Standard_Transient) aVal; - if (!thealiases->Value(command,aVal)) return str; - Handle(TCollection_HAsciiString) val = - Handle(TCollection_HAsciiString)::DownCast (aVal); - if (!val.IsNull()) - str.AssignCat (val->ToCString()); - return str; -} - - Standard_Boolean IFSelect_Activator::Select (const Standard_CString command, Standard_Integer& number, Handle(IFSelect_Activator)& actor) diff --git a/src/IFSelect/IFSelect_Activator.hxx b/src/IFSelect/IFSelect_Activator.hxx index f24a9278d2..890ab21049 100644 --- a/src/IFSelect/IFSelect_Activator.hxx +++ b/src/IFSelect/IFSelect_Activator.hxx @@ -81,21 +81,6 @@ public: //! Removes a Command, if it is recorded (else, does nothing) Standard_EXPORT static void Remove (const Standard_CString command); - //! Records, for a configuration named , that the command - //! may be aliased by another command - //! - //! To be used by call to Alias (no automatic redirection) - //! The configuration typically refers to a norm - Standard_EXPORT static void SetAlias (const Standard_CString conf, const Standard_CString command, const Standard_CString aliasname); - - //! Sets as current configuration for aliases - Standard_EXPORT static void SetCurrentAlias (const Standard_CString conf); - - //! Returns, in the current configuration, what alias has been - //! recorded for - //! The returned string is empty if no alias is recorded - Standard_EXPORT static TCollection_AsciiString Alias (const Standard_CString command); - //! Selects, for a Command given by its title, an actor with its //! command number. Returns True if found, False else Standard_EXPORT static Standard_Boolean Select (const Standard_CString command, Standard_Integer& number, Handle(IFSelect_Activator)& actor); diff --git a/src/IFSelect/IFSelect_Functions.cxx b/src/IFSelect/IFSelect_Functions.cxx index eedd148fde..f469f7cce4 100644 --- a/src/IFSelect/IFSelect_Functions.cxx +++ b/src/IFSelect/IFSelect_Functions.cxx @@ -161,17 +161,6 @@ static IFSelect_ReturnStatus fun3 return status; } -static IFSelect_ReturnStatus fun_whatfile - (const Handle(IFSelect_SessionPilot)& pilot) -{ - TCollection_AsciiString whatcom = IFSelect_Activator::Alias ("whatfile"); - if (whatcom.Length() > 0) return pilot->ExecuteAlias (whatcom); - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<<"Load File : "<Session()->LoadedFile()<HasModel()) { sout<<"No loaded model, abandon"<Model(); + const Handle(Interface_InterfaceModel) &model = WS->Model(); Standard_Integer i, cnt = 0; Standard_Boolean exact = Standard_False; sout<<" ** Search Entity Number for Label : "<NamedItem(arg1)); if (sp.IsNull()) { sout<<"Pas une SelectPointed:"<Model(); // pour Print + const Handle(Interface_InterfaceModel) &model = WS->Model(); // pour Print if (argc == 2) { // listage simple Standard_Integer nb = sp->NbItems(); sout<<" SelectPointed : "< Load Model",fun3); -// IFSelect_Act::AddFunc("load","file:string : Read File -> Load Model",fun3); IFSelect_Act::AddFunc("xread","file:string : Read File -> Load Model",fun3); - IFSelect_Act::AddFunc("whatfile"," -> analyses a file (specific per norm)",fun_whatfile); IFSelect_Act::AddFunc("writeall","file:string : Write all model (no split)",fun4); IFSelect_Act::AddFunc("writesel","file:string sel:Selection : Write Selected (no split)",fun5); IFSelect_Act::AddFunc("writeent","file:string n1ent n2ent...:integer : Write Entite(s) (no split)",fun6); diff --git a/src/IFSelect/IFSelect_WorkSession.cxx b/src/IFSelect/IFSelect_WorkSession.cxx index 2c6a6212dc..439d17768a 100644 --- a/src/IFSelect/IFSelect_WorkSession.cxx +++ b/src/IFSelect/IFSelect_WorkSession.cxx @@ -117,61 +117,16 @@ IFSelect_WorkSession::IFSelect_WorkSession () themodelstat = Standard_False; } - //======================================================================= //function : //purpose : //======================================================================= -void IFSelect_WorkSession::SetErrorHandle (const Standard_Boolean hand) +void IFSelect_WorkSession::SetErrorHandle (const Standard_Boolean toHandle) { - theerrhand = errhand = hand; + theerrhand = errhand = toHandle; } - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::ErrorHandle () const -{ - return theerrhand; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -const Handle(IFSelect_ShareOut)& IFSelect_WorkSession::ShareOut () const -{ - return theshareout; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::SetLibrary (const Handle(IFSelect_WorkLibrary)& lib) -{ - thelibrary = lib; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Handle(IFSelect_WorkLibrary) IFSelect_WorkSession::WorkLibrary () const -{ - return thelibrary; -} - + //======================================================================= //function : @@ -192,19 +147,7 @@ void IFSelect_WorkSession::SetProtocol //purpose : //======================================================================= -Handle(Interface_Protocol) IFSelect_WorkSession::Protocol () const -{ - return theprotocol; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::SetSignType - (const Handle(IFSelect_Signature)& signtype) +void IFSelect_WorkSession::SetSignType (const Handle(IFSelect_Signature)& signtype) { thegtool->SetSignType (signtype); if (signtype.IsNull()) thenames->RemoveItem ("xst-sign-type"); @@ -237,17 +180,6 @@ void IFSelect_WorkSession::SetShareOut } -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_Boolean IFSelect_WorkSession::HasModel () const -{ - return (!themodel.IsNull()); -} - - //======================================================================= //function : //purpose : @@ -257,14 +189,11 @@ void IFSelect_WorkSession::SetModel (const Handle(Interface_InterfaceModel)& model, const Standard_Boolean clearpointed) { - if (themodel != model) { + if (myModel != model) theloaded.Clear(); - //skl if (!themodel.IsNull()) themodel->Clear(); - } - themodel = model; + myModel = model; if (!thegtool.IsNull()) thegtool->ClearEntities(); //smh#14 FRA62479 -// themodel->SetProtocol(theprotocol); - themodel->SetGTool (thegtool); + myModel->SetGTool (thegtool); thegraph.Nullify(); ComputeGraph(); // fait qqchose si Protocol present. Sinon, ne fait rien @@ -277,39 +206,6 @@ void IFSelect_WorkSession::SetModel } -//======================================================================= -//function : -//purpose : -//======================================================================= -Handle(Interface_InterfaceModel) IFSelect_WorkSession::Model () const -{ - return themodel; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::SetLoadedFile (const Standard_CString filename) -{ - theloaded.Clear(); - theloaded.AssignCat (filename); -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -Standard_CString IFSelect_WorkSession::LoadedFile () const -{ - return theloaded.ToCString(); -} - - //======================================================================= //function : //purpose : @@ -351,8 +247,7 @@ IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile Standard_Integer IFSelect_WorkSession::NbStartingEntities () const { - if (themodel.IsNull()) return 0; - return themodel->NbEntities(); + return (myModel.IsNull()? 0 : myModel->NbEntities()); } @@ -361,13 +256,12 @@ Standard_Integer IFSelect_WorkSession::NbStartingEntities () const //purpose : //======================================================================= -Handle(Standard_Transient) IFSelect_WorkSession::StartingEntity - (const Standard_Integer num) const +Handle(Standard_Transient) IFSelect_WorkSession::StartingEntity (const Standard_Integer num) const { Handle(Standard_Transient) res; // Null par defaut - if (themodel.IsNull()) return res; - if (num < 1 || num > themodel->NbEntities()) return res; - return themodel->Value(num); + if (myModel.IsNull()) return res; + if (num < 1 || num > myModel->NbEntities()) return res; + return myModel->Value(num); } @@ -376,11 +270,9 @@ Handle(Standard_Transient) IFSelect_WorkSession::StartingEntity //purpose : //======================================================================= -Standard_Integer IFSelect_WorkSession::StartingNumber - (const Handle(Standard_Transient)& ent) const +Standard_Integer IFSelect_WorkSession::StartingNumber (const Handle(Standard_Transient)& ent) const { - if (themodel.IsNull()) return 0; - return themodel->Number(ent); + return (myModel.IsNull()? 0 : myModel->Number(ent)); } @@ -393,13 +285,13 @@ Standard_Integer IFSelect_WorkSession::NumberFromLabel (const Standard_CString val, const Standard_Integer afternum) const { Standard_Integer i, cnt = 0, num = atoi(val); - if (num > 0 || themodel.IsNull()) return num; // un n0 direct : gagne ! + if (num > 0 || myModel.IsNull()) return num; // un n0 direct : gagne ! // Sinon, on considere que c est un label; a traiter en CaseNonSensitive ... - if (num > themodel->NbEntities()) { num = 0; return num; } + if (num > myModel->NbEntities()) { num = 0; return num; } Standard_Boolean exact = Standard_False; Standard_Integer after = (afternum >= 0 ? afternum : -afternum); - for (i = themodel->NextNumberForLabel (val, after, exact) ; i != 0; - i = themodel->NextNumberForLabel (val, i, exact)) { + for (i = myModel->NextNumberForLabel (val, after, exact) ; i != 0; + i = myModel->NextNumberForLabel (val, i, exact)) { cnt ++; if (num <= 0) num = i; } @@ -415,14 +307,11 @@ Standard_Integer IFSelect_WorkSession::NumberFromLabel //purpose : //======================================================================= -Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityLabel - (const Handle(Standard_Transient)& ent) const +Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityLabel (const Handle(Standard_Transient)& ent) const { - Handle(TCollection_HAsciiString) name; - if (themodel.IsNull() || ent.IsNull()) return name; - if (!themodel->Contains(ent)) return name; - name = themodel->StringLabel(ent); - return name; + if (myModel.IsNull() || ent.IsNull()) return 0; + if (!myModel->Contains(ent)) return 0; + return myModel->StringLabel(ent); } @@ -431,11 +320,9 @@ Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityLabel //purpose : //======================================================================= -Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityName - (const Handle(Standard_Transient)& ent) const +Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityName (const Handle(Standard_Transient)& ent) const { - Handle(TCollection_HAsciiString) name; - if (themodel.IsNull() || ent.IsNull()) return name; + if (myModel.IsNull() || ent.IsNull()) return 0; Interface_ShareTool sht(thegraph->Graph()); Standard_Integer CN; @@ -450,12 +337,9 @@ Handle(TCollection_HAsciiString) IFSelect_WorkSession::EntityName //purpose : //======================================================================= -Standard_Integer IFSelect_WorkSession::CategoryNumber - (const Handle(Standard_Transient)& ent) const +Standard_Integer IFSelect_WorkSession::CategoryNumber (const Handle(Standard_Transient)& ent) const { - if (themodel.IsNull()) return -1; - Standard_Integer num = StartingNumber(ent); - return themodel->CategoryNumber(num); + return (myModel.IsNull()? -1 : myModel->CategoryNumber(StartingNumber(ent))); } @@ -464,11 +348,9 @@ Standard_Integer IFSelect_WorkSession::CategoryNumber //purpose : //======================================================================= -Standard_CString IFSelect_WorkSession::CategoryName - (const Handle(Standard_Transient)& ent) const +Standard_CString IFSelect_WorkSession::CategoryName (const Handle(Standard_Transient)& ent) const { - Standard_Integer cn = CategoryNumber (ent); - return Interface_Category::Name (cn); + return Interface_Category::Name (CategoryNumber (ent)); } @@ -477,11 +359,9 @@ Standard_CString IFSelect_WorkSession::CategoryName //purpose : //======================================================================= -Standard_CString IFSelect_WorkSession::ValidityName - (const Handle(Standard_Transient)& ent) const +Standard_CString IFSelect_WorkSession::ValidityName (const Handle(Standard_Transient)& ent) const { - if (StartingNumber(ent) == 0) return ""; - return IFSelect_SignValidity::CVal (ent,themodel); + return ((StartingNumber(ent) == 0)? "" : IFSelect_SignValidity::CVal (ent,myModel)); } @@ -495,8 +375,10 @@ void IFSelect_WorkSession::ClearData (const Standard_Integer mode) switch (mode) { case 1 : { theloaded.Clear(); - if (!themodel.IsNull()) themodel->Clear(); - themodel.Nullify(); + if (!myModel.IsNull()) { + myModel->Clear(); + myModel.Nullify(); + } ClearData(2); ClearData(4); thecheckrun.Clear(); break; @@ -547,17 +429,16 @@ Standard_Boolean IFSelect_WorkSession::ComputeGraph (const Standard_Boolean enforce) { if (theprotocol.IsNull()) return Standard_False; - if (themodel.IsNull()) return Standard_False; - //if (themodel->NbEntities() == 0) return Standard_False; + if (myModel.IsNull()) return Standard_False; if (enforce) thegraph.Nullify(); if (!thegraph.IsNull()) { - if (themodel->NbEntities() == thegraph->Graph().Size()) return Standard_True; + if (myModel->NbEntities() == thegraph->Graph().Size()) return Standard_True; thegraph.Nullify(); } - if (themodel->NbEntities() == 0) return Standard_False; + if (myModel->NbEntities() == 0) return Standard_False; // Il faut calculer le graphe pour de bon - thegraph = new Interface_HGraph (themodel,themodelstat); - Standard_Integer nb = themodel->NbEntities(); + thegraph = new Interface_HGraph (myModel,themodelstat); + Standard_Integer nb = myModel->NbEntities(); if(themodelstat) { Standard_Integer i; // svv #1 @@ -574,8 +455,8 @@ Standard_Boolean IFSelect_WorkSession::ComputeGraph Interface_Category categ(thegtool); Interface_ShareTool sht(thegraph); Standard_Integer i =1; - for ( ; i <= nb; i ++) themodel->SetCategoryNumber - (i,categ.CatNum(themodel->Value(i),sht)); + for ( ; i <= nb; i ++) + myModel->SetCategoryNumber(i,categ.CatNum(myModel->Value(i),sht)); } return Standard_True; @@ -646,10 +527,10 @@ Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::Sharings Standard_Boolean IFSelect_WorkSession::IsLoaded () const { if (theprotocol.IsNull()) return Standard_False; - if (themodel.IsNull()) return Standard_False; - if (themodel->NbEntities() == 0) return Standard_False; + if (myModel.IsNull()) return Standard_False; + if (myModel->NbEntities() == 0) return Standard_False; if (thegraph.IsNull()) return Standard_False; - if (themodel->NbEntities() == thegraph->Graph().Size()) return Standard_True; + if (myModel->NbEntities() == thegraph->Graph().Size()) return Standard_True; return Standard_False; } @@ -669,7 +550,7 @@ Standard_Boolean IFSelect_WorkSession::ComputeCheck Interface_Graph& CG = thegraph->CGraph(); Interface_CheckTool cht(thegraph); Interface_CheckIterator checklist = cht.VerifyCheckList(); - themodel->FillSemanticChecks(checklist,Standard_False); + myModel->FillSemanticChecks(checklist,Standard_False); if(themodelstat) { // Et on met a jour le Graphe (BitMap) ! Flag Incorrect (STX + SEM) @@ -683,7 +564,7 @@ Standard_Boolean IFSelect_WorkSession::ComputeCheck if (num > 0 && num <= nb) BM.SetTrue (num,Flag_Incorrect); } for (num = 1; num <= nb; num ++) - if (themodel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect); + if (myModel->IsErrorEntity (num)) BM.SetTrue (num,Flag_Incorrect); } return Standard_True; } @@ -720,17 +601,17 @@ Interface_CheckIterator IFSelect_WorkSession::CheckOne const Standard_Boolean complete) { Interface_CheckIterator checks; - checks.SetModel(themodel); + checks.SetModel(myModel); if (!IsLoaded()) { checks.CCheck(0)->AddFail("DATA NOT AVAILABLE FOR CHECK"); return checks; } Standard_Integer num = -1; - if (ent.IsNull() || ent == themodel) num = 0; - else num = themodel->Number(ent); + if (ent.IsNull() || ent == myModel) num = 0; + else num = myModel->Number(ent); - Handle(Interface_Check) ach = themodel->Check (num,Standard_True); - if (complete) ach->GetMessages (themodel->Check (num,Standard_False)); + Handle(Interface_Check) ach = myModel->Check (num,Standard_True); + if (complete) ach->GetMessages (myModel->Check (num,Standard_False)); if (num > 0) ach->SetEntity(ent); checks.Add (ach,num); checks.SetName ("Data Check (One Entity)"); @@ -738,17 +619,6 @@ Interface_CheckIterator IFSelect_WorkSession::CheckOne } -//======================================================================= -//function : -//purpose : -//======================================================================= - -Interface_CheckIterator IFSelect_WorkSession::LastRunCheckList () const -{ - return thecheckrun; -} - - // ##################################################################### // .... LES VARIABLES .... @@ -1346,9 +1216,9 @@ Handle(IFSelect_Signature) IFSelect_WorkSession::Signature Standard_CString IFSelect_WorkSession::SignValue (const Handle(IFSelect_Signature)& sign, const Handle(Standard_Transient)& ent) const { - if (sign.IsNull() || themodel.IsNull()) return ""; + if (sign.IsNull() || myModel.IsNull()) return ""; if (StartingNumber(ent) == 0) return ""; - return sign->Value (ent,themodel); + return sign->Value (ent,myModel); } // ######################################################################## @@ -1579,7 +1449,7 @@ Standard_Boolean IFSelect_WorkSession::ComputeCounterFromList if (counter.IsNull()) return Standard_False; if (clear) counter->Clear(); if (list.IsNull()) return ComputeCounter (counter,Standard_True); - counter->AddList (list,themodel); + counter->AddList (list,myModel); return Standard_True; } @@ -1646,19 +1516,7 @@ Standard_Integer IFSelect_WorkSession::DispatchRank //purpose : //======================================================================= -Handle(IFSelect_ModelCopier) IFSelect_WorkSession::ModelCopier () const -{ - return thecopier; -} - - -//======================================================================= -//function : -//purpose : -//======================================================================= - -void IFSelect_WorkSession::SetModelCopier - (const Handle(IFSelect_ModelCopier)& copier) +void IFSelect_WorkSession::SetModelCopier (const Handle(IFSelect_ModelCopier)& copier) { thecopier = copier; thecopier->SetShareOut(theshareout); @@ -1670,8 +1528,7 @@ void IFSelect_WorkSession::SetModelCopier //purpose : //======================================================================= -Standard_Integer IFSelect_WorkSession::NbFinalModifiers - (const Standard_Boolean formodel) const +Standard_Integer IFSelect_WorkSession::NbFinalModifiers (const Standard_Boolean formodel) const { return theshareout->NbModifiers(formodel); } @@ -1700,8 +1557,7 @@ Handle(TColStd_HSequenceOfInteger) IFSelect_WorkSession::FinalModifierIdents //purpose : //======================================================================= -Handle(IFSelect_GeneralModifier) IFSelect_WorkSession::GeneralModifier - (const Standard_Integer id) const +Handle(IFSelect_GeneralModifier) IFSelect_WorkSession::GeneralModifier (const Standard_Integer id) const { return GetCasted(IFSelect_GeneralModifier,Item(id)); } @@ -1712,8 +1568,7 @@ Handle(IFSelect_GeneralModifier) IFSelect_WorkSession::GeneralModifier //purpose : //======================================================================= -Handle(IFSelect_Modifier) IFSelect_WorkSession::ModelModifier - (const Standard_Integer id) const +Handle(IFSelect_Modifier) IFSelect_WorkSession::ModelModifier (const Standard_Integer id) const { return GetCasted(IFSelect_Modifier,Item(id)); } @@ -1724,8 +1579,7 @@ Handle(IFSelect_Modifier) IFSelect_WorkSession::ModelModifier //purpose : //======================================================================= -Standard_Integer IFSelect_WorkSession::ModifierRank - (const Handle(IFSelect_GeneralModifier)& modif) const +Standard_Integer IFSelect_WorkSession::ModifierRank (const Handle(IFSelect_GeneralModifier)& modif) const { if (ItemIdent(modif) == 0) return 0; return theshareout->ModifierRank(modif); @@ -1836,8 +1690,7 @@ Handle(Standard_Transient) IFSelect_WorkSession::UsesAppliedModifier //purpose : //======================================================================= -Handle(IFSelect_Transformer) IFSelect_WorkSession::Transformer - (const Standard_Integer id) const +Handle(IFSelect_Transformer) IFSelect_WorkSession::Transformer (const Standard_Integer id) const { return GetCasted(IFSelect_Transformer,Item(id)); } @@ -1862,7 +1715,7 @@ Standard_Integer IFSelect_WorkSession::RunTransformer if (!checks.IsEmpty(Standard_False)) { Handle(Message_Messenger) sout = Message::DefaultMessenger(); sout<<" ** RunTransformer has produced Check Messages : **"<Value(i))); sp->Update(transf); } - if (newmod == themodel) { + if (newmod == myModel) { effect = (res ? 2 : -2); if (!res) return effect; Handle(Interface_Protocol) newproto = theprotocol; @@ -1889,7 +1742,7 @@ Standard_Integer IFSelect_WorkSession::RunTransformer Handle(Interface_Protocol) newproto = theprotocol; if (transf->ChangeProtocol(newproto)) { effect = 5; theprotocol = newproto; thegtool->SetProtocol(newproto); } - theoldel = themodel; + theoldel = myModel; SetModel(newmod,Standard_False); } return effect; @@ -1955,9 +1808,9 @@ Standard_Boolean IFSelect_WorkSession::SetModelContent Interface_EntityIterator list = sel->UniqueResult(thegraph->Graph()); if (list.NbEntities() == 0) return Standard_False; - Handle(Interface_InterfaceModel) newmod = themodel->NewEmptyModel(); - Interface_CopyTool TC(themodel,theprotocol); - Standard_Integer i, nb = themodel->NbEntities(); + Handle(Interface_InterfaceModel) newmod = myModel->NewEmptyModel(); + Interface_CopyTool TC(myModel,theprotocol); + Standard_Integer i, nb = myModel->NbEntities(); if (keep) { for (list.Start(); list.More(); list.Next()) TC.TransferEntity (list.Value()); @@ -1965,18 +1818,18 @@ Standard_Boolean IFSelect_WorkSession::SetModelContent Standard_Integer* flags = new Standard_Integer[nb+1]; for (i = 0; i <= nb; i ++) flags[i] = 0; for (list.Start(); list.More(); list.Next()) { - Standard_Integer num = themodel->Number(list.Value()); + Standard_Integer num = myModel->Number(list.Value()); if (num <= nb) flags[num] = 1; } for (i = 1; i <= nb; i ++) { - if (flags[i] == 0) TC.TransferEntity (themodel->Value(i)); + if (flags[i] == 0) TC.TransferEntity (myModel->Value(i)); } delete [] flags; } TC.FillModel(newmod); if (newmod->NbEntities() == 0) return Standard_False; // Mettre a jour (ne pas oublier SelectPointed) - theoldel = themodel; + theoldel = myModel; SetModel(newmod,Standard_False); // MISE A JOUR des SelectPointed Handle(TColStd_HSequenceOfInteger) pts = @@ -2189,7 +2042,7 @@ void IFSelect_WorkSession::EvaluateFile () if (!checks.IsEmpty(Standard_False)) { Handle(Message_Messenger) sout = Message::DefaultMessenger(); sout<<" ** EvaluateFile has produced Check Messages : **"<SetRemaining (thegraph->CGraph()); thecheckrun = checks; @@ -2420,16 +2273,16 @@ Standard_Boolean IFSelect_WorkSession::SetRemaining return Standard_True; } else if (mode == IFSelect_RemainCompute) { Handle(Interface_InterfaceModel) newmod; - Interface_CopyTool TC(themodel,theprotocol); + Interface_CopyTool TC(myModel,theprotocol); thecopier->CopiedRemaining (thegraph->Graph(),thelibrary,TC,newmod); if (newmod.IsNull()) { sout<<" No Remaining Data recorded"<SetRemaining (thegraph->CGraph()); return Standard_False; } else { - theoldel = themodel; + theoldel = myModel; SetModel(newmod,Standard_False); // MISE A JOUR des SelectPointed Handle(TColStd_HSequenceOfInteger) list = @@ -2840,7 +2693,7 @@ static void IFSelect_QueryProp (Interface_IntList& list, void IFSelect_WorkSession::QueryCheckList (const Interface_CheckIterator& chl) { if (!IsLoaded()) return; - Standard_Integer i,nb = themodel->NbEntities(); + Standard_Integer i,nb = myModel->NbEntities(); thecheckana = TCollection_AsciiString (nb+1,' '); for (chl.Start(); chl.More(); chl.Next()) { Standard_Integer num = chl.Number(); @@ -2877,7 +2730,7 @@ Standard_Integer IFSelect_WorkSession::QueryCheckStatus (const Handle(Standard_Transient)& ent) const { if (!IsLoaded()) return -1; - Standard_Integer num = themodel->Number(ent); + Standard_Integer num = myModel->Number(ent); if (num == 0) return -1; if (thecheckana.Length() < num) return -1; Standard_Character val = thecheckana.Value (num); @@ -2937,8 +2790,8 @@ Standard_Integer IFSelect_WorkSession::QueryParent //======================================================================= void IFSelect_WorkSession::SetParams - (const TColStd_SequenceOfTransient& params, - const TColStd_SequenceOfInteger& uselist) + (const NCollection_Vector& params, + const NCollection_Vector& uselist) { Standard_Integer i, nbp = params.Length(), nbu = uselist.Length(); Handle(IFSelect_ParamEditor) editor = new IFSelect_ParamEditor @@ -3261,9 +3114,9 @@ Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveList // Le modele : son contenu list = new TColStd_HSequenceOfTransient(); - if (obj == themodel) { - Standard_Integer i, nb = themodel->NbEntities(); - for (i = 1; i <= nb; i ++) list->Append (themodel->Value(i)); + if (obj == myModel) { + Standard_Integer i, nb = myModel->NbEntities(); + for (i = 1; i <= nb; i ++) list->Append (myModel->Value(i)); } // Une entite du modele : cette entite @@ -3431,15 +3284,15 @@ void IFSelect_WorkSession::DumpModel if (level == 0) { S<<" ******** Short Dump of Header ********\n"; S << " *****************************************************************\n\n"; - themodel->DumpHeader(S); S<DumpHeader(S); S<NbEntities(); + Standard_Integer nbent = myModel->NbEntities(); Standard_Integer nbr = 0; Interface_ShareFlags shar(thegraph->Graph()); for (Standard_Integer i = 1; i <= nbent; i ++) { - if (!shar.IsShared(themodel->Value(i))) nbr ++; + if (!shar.IsShared(myModel->Value(i))) nbr ++; } S << " *****************************************************************\n"; S << " ******** Model : "<Entities(),1); + ListEntities (myModel->Entities(),1); } else if (level > 2) { IFSelect_PrintCount mode = IFSelect_ItemsByEntity; if (level == 5 || level == 8) mode = IFSelect_CountByItem; @@ -3482,7 +3335,7 @@ void IFSelect_WorkSession::DumpModel // Check List : si vide (pas demandee), naturellement passee try { OCC_CATCH_SIGNALS - C.Print(S,themodel, (level == 3)); + C.Print(S,myModel, (level == 3)); } catch (Standard_Failure) { Handle(Message_Messenger) sout = Message::DefaultMessenger(); @@ -3526,12 +3379,12 @@ void IFSelect_WorkSession::DumpEntity { if (!IsLoaded()) { S<< " *** Data for List not available ***"<Number(ent); + Standard_Integer num = myModel->Number(ent); if (num == 0) { S<<" *** Entity to Dump not in the Model ***"<DumpEntity (themodel,theprotocol,ent,S,level); + thelibrary->DumpEntity (myModel,theprotocol,ent,S,level); } // .... DumpEntity .... @@ -3563,17 +3416,17 @@ void IFSelect_WorkSession::PrintEntityStatus if (num == 0) { cout<<" -- PrintEntityStatus : unknown"<Print(ent,S); + myModel->Print(ent,S); Handle(TCollection_HAsciiString) hname = EntityName(ent); if (!hname.IsNull() && hname->Length() > 0) S<<" Name:"<ToCString(); S<DynamicType()->Name()<Value (ent,Model())<Value (ent,myModel)<Length(); if (nb == 0) S<<" Root"; else S<<" Super-entities:"<Print(list->Value(i),S); } + for (i = 1; i <= nb; i ++) { S<<" "; myModel->Print(list->Value(i),S); } S<Length(); if (nb == 0) S<<" No sub-entity"; else S<<" Sub-entities:"<Print(list->Value(i),S); } + for (i = 1; i <= nb; i ++) { S<<" "; myModel->Print(list->Value(i),S); } S<1 && mode != IFSelect_CountSummary); - counter->Analyse (chks,themodel,Standard_True,failsonly); - counter->PrintList (sout,themodel,mode); + counter->Analyse (chks,myModel,Standard_True,failsonly); + counter->PrintList (sout,myModel,mode); } } @@ -3631,7 +3484,7 @@ void IFSelect_WorkSession::PrintSignatureList { Handle(Message_Messenger) sout = Message::DefaultMessenger(); if (signlist.IsNull()) return; - signlist->PrintList (sout,themodel,mode); + signlist->PrintList (sout,myModel,mode); } // #### #### #### #### #### #### #### #### #### @@ -3854,23 +3707,18 @@ void IFSelect_WorkSession::ListEntities if (!titre && mode == 2) sout<<"("; titre = 1; Handle(Standard_Transient) ent = iter.Value(); - Standard_Integer num = themodel->Number(ent); + Standard_Integer num = myModel->Number(ent); if (mode == 1) { -// n0 id (root?) category validity tracetype + // n0 id (root?) category validity tracetype sout<Print(ent,sout,0); + myModel->Print(ent,sout,0); if (!tool.IsShared(ent)) sout << " #ROOT#"; else sout << " "; - Standard_Integer catnum = themodel->CategoryNumber(num); + Standard_Integer catnum = myModel->CategoryNumber(num); if (catnum > 0) sout<<" "<TypeName (ent, Standard_False); -// Handle(Interface_GeneralModule) tracemod; -// Standard_Integer CN; -// if (thegtool->Select(ent,tracemod,CN))tracemod->TraceType(ent,CN,sout); -// else sout << "(Not in Protocol) " << ent->DynamicType(); - sout << endl; + sout<<" Type:"<TypeName (ent, Standard_False)< 0) sout<<","; @@ -3879,10 +3727,10 @@ void IFSelect_WorkSession::ListEntities newcount ++; mods = 0; cnt ++; if (newcount >= 10) { sout << endl<<"["< 0) sout << " "; - themodel->Print(ent,sout,0); + myModel->Print(ent,sout,0); if (!tool.IsShared(ent)) { if(mods == 0) sout<<"("; sout<<"R"; mods++; } - if (themodel->IsUnknownEntity(num)) { sout<<(mods==0 ? '(' : ' ')<<"?"; mods ++; } - if (themodel->IsRedefinedContent(num)) { sout<<(mods==0 ? '(' : ' ')<<"*"; mods ++; } + if (myModel->IsUnknownEntity(num)) { sout<<(mods==0 ? '(' : ' ')<<"?"; mods ++; } + if (myModel->IsRedefinedContent(num)) { sout<<(mods==0 ? '(' : ' ')<<"*"; mods ++; } if (mods) { sout<<")"; newcount ++; } } } @@ -3895,13 +3743,3 @@ void IFSelect_WorkSession::ListEntities sout<<"\n Abandon"< #include #include +#include #include #include #include @@ -86,13 +87,15 @@ public: Standard_EXPORT IFSelect_WorkSession(); //! Changes the Error Handler status (by default, it is not set) - Standard_EXPORT void SetErrorHandle (const Standard_Boolean hand); + Standard_EXPORT void SetErrorHandle (const Standard_Boolean toHandle); //! Returns the Error Handler status - Standard_EXPORT Standard_Boolean ErrorHandle() const; + Standard_Boolean ErrorHandle() const + { return theerrhand; } //! Returns the ShareOut defined at creation time - Standard_EXPORT const Handle(IFSelect_ShareOut)& ShareOut() const; + const Handle(IFSelect_ShareOut) & ShareOut() const + { return theshareout; } //! Sets a new ShareOut. Fills Items which its content //! Warning : data from the former ShareOut are lost @@ -101,17 +104,21 @@ public: //! Set value of mode responsible for precence of selections after loading //! If mode set to true that different selections will be accessible after loading //! else selections will be not accessible after loading( for economy memory in applicatios) - Standard_EXPORT void SetModeStat (const Standard_Boolean theMode); + void SetModeStat (const Standard_Boolean theMode) + { themodelstat = theMode; } //! Return value of mode defining of filling selection during loading - Standard_EXPORT Standard_Boolean GetModeStat() const; + Standard_Boolean GetModeStat() const + { return themodelstat; } //! Sets a WorkLibrary, which will be used to Read and Write Files - Standard_EXPORT void SetLibrary (const Handle(IFSelect_WorkLibrary)& lib); + void SetLibrary (const Handle(IFSelect_WorkLibrary) &theLib) + { thelibrary = theLib; } //! Returns the WorkLibrary. Null Handle if not yet set //! should be C++ : return const & - Standard_EXPORT Handle(IFSelect_WorkLibrary) WorkLibrary() const; + const Handle(IFSelect_WorkLibrary) & WorkLibrary() const + { return thelibrary; } //! Sets a Protocol, which will be used to determine Graphs, to //! Read and to Write Files @@ -119,7 +126,8 @@ public: //! Returns the Protocol. Null Handle if not yet set //! should be C++ : return const & - Standard_EXPORT Handle(Interface_Protocol) Protocol() const; + const Handle(Interface_Protocol) & Protocol() const + { return theprotocol; } //! Sets a specific Signature to be the SignType, i.e. the //! Signature which will determine TypeName from the Model @@ -131,7 +139,8 @@ public: Standard_EXPORT Handle(IFSelect_Signature) SignType() const; //! Returns True is a Model has been set - Standard_EXPORT Standard_Boolean HasModel() const; + Standard_Boolean HasModel() const + { return (!myModel.IsNull()); } //! Sets a Model as input : this will be the Model from which the //! ShareOut will work @@ -143,15 +152,18 @@ public: //! Returns the Model of the Work Session (Null Handle if none) //! should be C++ : return const & - Standard_EXPORT Handle(Interface_InterfaceModel) Model() const; + const Handle(Interface_InterfaceModel) & Model () const + { return myModel; } //! Stores the filename used for read for setting the model //! It is cleared by SetModel and ClearData(1) - Standard_EXPORT void SetLoadedFile (const Standard_CString filename); + void SetLoadedFile (const Standard_CString theFileName) + { theloaded = theFileName; } //! Returns the filename used to load current model //! empty if unknown - Standard_EXPORT Standard_CString LoadedFile() const; + Standard_CString LoadedFile() const + { return theloaded.ToCString(); } //! Reads a file with the WorkLibrary (sets Model and LoadedFile) //! Returns a integer status which can be : @@ -273,7 +285,8 @@ public: //! Cleared by SetModel or ClearData(1) //! The field is protected, hence a specialized WorkSession may //! fill it - Standard_EXPORT Interface_CheckIterator LastRunCheckList() const; + Interface_CheckIterator LastRunCheckList() const + { return thecheckrun; } //! Returns the Maximum Value for an Item Identifier. It can be //! greater to the count of known Items, because some can have @@ -531,7 +544,8 @@ public: Standard_EXPORT Standard_Integer DispatchRank (const Handle(IFSelect_Dispatch)& disp) const; //! Gives access to the complete ModelCopier - Standard_EXPORT Handle(IFSelect_ModelCopier) ModelCopier() const; + const Handle(IFSelect_ModelCopier) & ModelCopier() const + { return thecopier; } //! Sets a new ModelCopier. Fills Items which its content Standard_EXPORT void SetModelCopier (const Handle(IFSelect_ModelCopier)& copier); @@ -968,7 +982,7 @@ public: //! xst-params-split 4 Split //! xst-param-read 5 Transfer on Reading //! xst-param-write 6 Transfer on Writing - Standard_EXPORT void SetParams (const TColStd_SequenceOfTransient& params, const TColStd_SequenceOfInteger& uselist); + Standard_EXPORT void SetParams (const NCollection_Vector& params, const NCollection_Vector& uselist); //! Traces the Statics attached to a given use number //! If is given positive (normal), the trace is embedded @@ -1073,28 +1087,22 @@ public: //! 2 gives a form suitable for givelist : (n1,n2,n3...) Standard_EXPORT void ListEntities (const Interface_EntityIterator& iter, const Standard_Integer mode) const; - - - DEFINE_STANDARD_RTTIEXT(IFSelect_WorkSession,MMgt_TShared) -protected: - + protected: Handle(Interface_HGraph) thegraph; Interface_CheckIterator thecheckrun; TColStd_IndexedDataMapOfTransientTransient theitems; Handle(Dico_DictionaryOfTransient) thenames; - -private: - + private: Standard_Boolean theerrhand; Handle(IFSelect_ShareOut) theshareout; Handle(IFSelect_WorkLibrary) thelibrary; Handle(Interface_Protocol) theprotocol; - Handle(Interface_InterfaceModel) themodel; + Handle(Interface_InterfaceModel) myModel; TCollection_AsciiString theloaded; Handle(Interface_GTool) thegtool; Standard_Boolean thecheckdone; @@ -1103,14 +1111,6 @@ private: Handle(IFSelect_ModelCopier) thecopier; Handle(Interface_InterfaceModel) theoldel; Standard_Boolean themodelstat; - - }; - - - - - - #endif // _IFSelect_WorkSession_HeaderFile diff --git a/src/IGESCAFControl/IGESCAFControl_Reader.cxx b/src/IGESCAFControl/IGESCAFControl_Reader.cxx index 90057515ae..9dfb65826b 100644 --- a/src/IGESCAFControl/IGESCAFControl_Reader.cxx +++ b/src/IGESCAFControl/IGESCAFControl_Reader.cxx @@ -44,33 +44,6 @@ #include #include -//======================================================================= -//function : IGESCAFControl_Reader -//purpose : -//======================================================================= -IGESCAFControl_Reader::IGESCAFControl_Reader () : - myColorMode( Standard_True ), - myNameMode ( Standard_True ), - myLayerMode( Standard_True ) -{ -} - - -//======================================================================= -//function : IGESCAFControl_Reader -//purpose : -//======================================================================= - -IGESCAFControl_Reader::IGESCAFControl_Reader (const Handle(XSControl_WorkSession)& WS, - const Standard_Boolean scratch) -{ - SetWS (WS,scratch); - myColorMode = Standard_True; - myNameMode = Standard_True; - myLayerMode = Standard_True; -} - - //======================================================================= //function : Transfer //purpose : basic working method @@ -198,10 +171,9 @@ Standard_Boolean IGESCAFControl_Reader::Transfer (Handle(TDocStd_Document) &doc) } // added by skl 13.10.2003 - Handle(Interface_InterfaceModel) Model = WS()->Model(); - //WS()->TransferReader()->SetTransientProcess(TransientProcess()); - Handle(XSControl_TransferReader) TR = WS()->TransferReader(); - Handle(Transfer_TransientProcess) TP = TR->TransientProcess(); + const Handle(Interface_InterfaceModel) &Model = WS()->Model(); + const Handle(XSControl_TransferReader) &TR = WS()->TransferReader(); + const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess(); Standard_Boolean IsCTool = Standard_True; Handle(XCAFDoc_ColorTool) CTool = XCAFDoc_DocumentTool::ColorTool(doc->Main()); if(CTool.IsNull()) IsCTool = Standard_False; @@ -347,19 +319,6 @@ Standard_Boolean IGESCAFControl_Reader::Transfer (Handle(TDocStd_Document) &doc) // end added by skl 13.10.2003 - // read colors -// if ( GetColorMode() ) -// ReadColors ( doc ); - - // read names -// if ( GetNameMode() ) -// ReadNames ( doc ); - - // read layers -// if ( GetLayerMode() ) -// ReadLayers ( doc ); - - return Standard_True; } @@ -375,290 +334,3 @@ Standard_Boolean IGESCAFControl_Reader::Perform (const Standard_CString filename if ( ReadFile ( filename ) != IFSelect_RetDone ) return Standard_False; return Transfer ( doc ); } - - -//======================================================================= -//function : Perform -//purpose : -//======================================================================= - -Standard_Boolean IGESCAFControl_Reader::Perform (const TCollection_AsciiString &filename, - Handle(TDocStd_Document) &doc) -{ - if ( ReadFile ( filename.ToCString() ) != IFSelect_RetDone ) return Standard_False; - return Transfer ( doc ); -} - - -//======================================================================= -//function : ReadColors -//purpose : -//======================================================================= - -Standard_Boolean IGESCAFControl_Reader::ReadColors (Handle(TDocStd_Document)& Doc) const -{ - - Handle(Interface_InterfaceModel) Model = WS()->Model(); - - //WS()->TransferReader()->SetTransientProcess(TransientProcess()); // !!!!!!!!! - - Handle(XSControl_TransferReader) TR = WS()->TransferReader(); - Handle(Transfer_TransientProcess) TP = /*TransientProcess();*/TR->TransientProcess(); - Handle(XCAFDoc_ColorTool) CTool = XCAFDoc_DocumentTool::ColorTool( Doc->Main() ); -/* - Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( Doc->Main() ); - if ( STool.IsNull() ) return Standard_False; - Handle(XCAFDoc_ShapeMapTool) SMTool = XCAFDoc_ShapeMapTool::Set(STool->Label()); - SMTool->ComputeMaps(); - - Standard_Integer nb = Model->NbEntities(); - for (Standard_Integer i = 1; i <= nb; i ++) { - Handle(IGESData_IGESEntity) ent = Handle(IGESData_IGESEntity)::DownCast ( Model->Value(i) ); - if ( ent.IsNull() ) continue; - if ( ent->DefColor() != IGESData_DefValue && - ent->DefColor() != IGESData_DefReference ) continue; // no color assigned - - // find tartet shape - Handle(Transfer_Binder) binder = TP->Find ( ent ); - if ( binder.IsNull() ) continue; - TopoDS_Shape S = TransferBRep::ShapeResult (binder); - if ( S.IsNull() ) continue; - - // decode color and set to document - Quantity_Color col; - if ( ent->DefColor() == IGESData_DefValue ) { - col = IGESCAFControl::DecodeColor ( ent->RankColor() ); - } - else { - Handle(IGESGraph_Color) color = Handle(IGESGraph_Color)::DownCast ( ent->Color() ); - if ( color.IsNull() ) { - cout << "Error: Unrecognized type of color definition" << endl; - continue; - } - - Standard_Real r, g, b; - color->RGBIntensity ( r, g, b ); - col.SetValues ( 0.01*r, 0.01*g, 0.01*b, Quantity_TOC_RGB ); - } - - TDF_Label L; - cout<<"i="<Search(S,L)) { - cout<<" find Instance"<SetColor(L, col, XCAFDoc_ColorGen); - } - if(L.IsNull()) { - cout<<"L1 is Null"<Search(S,L,Standard_False,Standard_False,Standard_True)) { - cout<<" add new label1 :"<SetColor(L, col, XCAFDoc_ColorGen); - } - } - if(L.IsNull()) { - //else { - cout<<" try to find splitting"<Search(it.Value(),L)) continue; //break-? - cout<<" find splitting"<SetColor(L, col, XCAFDoc_ColorGen); - } - if(L.IsNull()) { - for (TopoDS_Iterator it(S); it.More(); it.Next()) { - if(STool->Search(S,L,Standard_False,Standard_False,Standard_True)) { - cout<<" add new label2 :"<SetColor(L, col, XCAFDoc_ColorGen); - } - } - } - } -// cout<<"L.Dump():"<Search(S,L,Standard_False,Standard_False,Standard_True)) { -// cout<<" add new label2 :"<SetColor(L, col, XCAFDoc_ColorGen); -// } -// } - } -*/ - return Standard_True; -} - -//======================================================================= -//function : ReadNames -//purpose : -//======================================================================= - -Standard_Boolean IGESCAFControl_Reader::ReadNames (Handle(TDocStd_Document)& /*Doc*/) const -{ - Handle(Interface_InterfaceModel) Model = WS()->Model(); - - //WS()->TransferReader()->SetTransientProcess(TransientProcess()); // !!!!!!!!! - - Handle(XSControl_TransferReader) TR = WS()->TransferReader(); - Handle(Transfer_TransientProcess) TP = /*TransientProcess();*/TR->TransientProcess(); -/* - Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( Doc->Main() ); - if ( STool.IsNull() ) return Standard_False; - Handle(XCAFDoc_ShapeMapTool) SMTool = XCAFDoc_ShapeMapTool::Set(STool->Label()); - SMTool->ComputeMaps(); - - Standard_Integer nb = Model->NbEntities(); - for (Standard_Integer i = 1; i <= nb; i ++) { - Handle(IGESData_IGESEntity) ent = Handle(IGESData_IGESEntity)::DownCast ( Model->Value(i) ); - if ( ent.IsNull() || ! ent->HasName() ) continue; //not only Entity Label (f.18) but Name Property also - - // find target shape - Handle(Transfer_Binder) binder = TP->Find ( ent ); - if ( binder.IsNull() ) continue; - TopoDS_Shape S = TransferBRep::ShapeResult (binder); - if ( S.IsNull() ) continue; - - TDF_Label L; - //if ( ! STool->Search ( S, L, Standard_True, Standard_True, Standard_False ) ) continue; - if ( ! SMTool->Search ( S, L, Standard_True, Standard_True) ) continue; - - // set a name to the document - TCollection_AsciiString string = ent->NameValue()->String(); - string.LeftAdjust(); - string.RightAdjust(); - TCollection_ExtendedString str ( string ); - TDataStd_Name::Set ( L, str ); - } -*/ - return Standard_True; -} - -//======================================================================= -//function : ReadLayers -//purpose : -//======================================================================= - -Standard_Boolean IGESCAFControl_Reader::ReadLayers (Handle(TDocStd_Document)& /*Doc*/) const -{ - Handle(Interface_InterfaceModel) Model = WS()->Model(); - - //WS()->TransferReader()->SetTransientProcess(TransientProcess()); // !!!!!!!!! - - Handle(XSControl_TransferReader) TR = WS()->TransferReader(); - Handle(Transfer_TransientProcess) TP = /*TransientProcess();*/TR->TransientProcess(); -/* - Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( Doc->Main() ); - if ( STool.IsNull() ) return Standard_False; - Handle(XCAFDoc_ShapeMapTool) SMTool = XCAFDoc_ShapeMapTool::Set(STool->Label()); - SMTool->ComputeMaps(); - - Handle(XCAFDoc_LayerTool) LTool = XCAFDoc_DocumentTool::LayerTool( Doc->Main() ); - if ( LTool.IsNull() ) return Standard_False; - - Standard_Integer nb = Model->NbEntities(); - for (Standard_Integer i = 1; i <= nb; i ++) { - Handle(IGESData_IGESEntity) ent = Handle(IGESData_IGESEntity)::DownCast ( Model->Value(i) ); - - if ( ent.IsNull() ) continue; - - // find target shape - Handle(Transfer_Binder) binder = TP->Find ( ent ); - if ( binder.IsNull() ) continue; - TopoDS_Shape S = TransferBRep::ShapeResult (binder); - if ( S.IsNull() ) continue; - - TDF_Label L; - //if ( ! STool->Search ( S, L, Standard_True, Standard_True, Standard_False ) ) continue; - if( !SMTool->Search(S, L, Standard_True, Standard_True) ) continue; - - // set a layers to the document - IGESData_DefList aDeflist = ent->DefLevel(); - - switch (aDeflist) { - case IGESData_DefOne : { - TCollection_ExtendedString aLayerName ( ent->Level() ); - LTool->SetLayer( L, aLayerName ); -#ifdef OCCT_DEBUG -// cout << "Added layer " << aLayerName << endl; -#endif - break; - } - case IGESData_DefSeveral : { - Handle(IGESData_LevelListEntity) aLevelList = ent->LevelList(); - Standard_Integer layerNb = aLevelList->NbLevelNumbers(); - for ( Standard_Integer ilev = 1; ilev <= layerNb; ilev++ ) { - TCollection_ExtendedString aLayerName ( aLevelList->LevelNumber(ilev) ); - LTool->SetLayer( L, aLayerName ); -#ifdef OCCT_DEBUG -// cout << "Added layer " << aLayerName << endl; -#endif - } - break; - } - default : break; - } - - } -*/ - return Standard_True; -} - - -//======================================================================= -//function : SetColorMode -//purpose : -//======================================================================= - -void IGESCAFControl_Reader::SetColorMode (const Standard_Boolean colormode) -{ - myColorMode = colormode; -} - -//======================================================================= -//function : GetColorMode -//purpose : -//======================================================================= - -Standard_Boolean IGESCAFControl_Reader::GetColorMode () const -{ - return myColorMode; -} - -//======================================================================= -//function : SetNameMode -//purpose : -//======================================================================= - -void IGESCAFControl_Reader::SetNameMode (const Standard_Boolean namemode) -{ - myNameMode = namemode; -} - -//======================================================================= -//function : GetNameMode -//purpose : -//======================================================================= - -Standard_Boolean IGESCAFControl_Reader::GetNameMode () const -{ - return myNameMode; -} - -//======================================================================= -//function : SetLayerMode -//purpose : -//======================================================================= - -void IGESCAFControl_Reader::SetLayerMode (const Standard_Boolean layermode) -{ - myLayerMode = layermode; -} - -//======================================================================= -//function : GetLayerMode -//purpose : -//======================================================================= - -Standard_Boolean IGESCAFControl_Reader::GetLayerMode () const -{ - return myLayerMode; -} - diff --git a/src/IGESCAFControl/IGESCAFControl_Reader.hxx b/src/IGESCAFControl/IGESCAFControl_Reader.hxx index 4952ec95fc..38951a43b4 100644 --- a/src/IGESCAFControl/IGESCAFControl_Reader.hxx +++ b/src/IGESCAFControl/IGESCAFControl_Reader.hxx @@ -20,12 +20,10 @@ #include #include -#include #include -#include +#include class XSControl_WorkSession; class TDocStd_Document; -class TCollection_AsciiString; //! Provides a tool to read IGES file and put it into @@ -48,80 +46,63 @@ class TCollection_AsciiString; //! Standard_Boolean namemode = reader.GetNameMode(); class IGESCAFControl_Reader : public IGESControl_Reader { -public: + public: DEFINE_STANDARD_ALLOC - //! Creates a reader with an empty //! IGES model and sets ColorMode, LayerMode and NameMode to Standard_True. - Standard_EXPORT IGESCAFControl_Reader(); + IGESCAFControl_Reader() + : myColorMode( Standard_True ), + myNameMode ( Standard_True ), + myLayerMode( Standard_True ) + {} //! Creates a reader tool and attaches it to an already existing Session //! Clears the session if it was not yet set for IGES - Standard_EXPORT IGESCAFControl_Reader(const Handle(XSControl_WorkSession)& WS, const Standard_Boolean scratch = Standard_True); + IGESCAFControl_Reader(const Handle(XSControl_WorkSession)& theWS, const Standard_Boolean FromScratch = Standard_True) + : myColorMode( Standard_True ), + myNameMode ( Standard_True ), + myLayerMode( Standard_True ) + { SetWS (theWS,FromScratch); } //! Translates currently loaded IGES file into the document //! Returns True if succeeded, and False in case of fail - Standard_EXPORT Standard_Boolean Transfer (Handle(TDocStd_Document)& doc); + Standard_EXPORT Standard_Boolean Transfer (Handle(TDocStd_Document)& theDoc); - Standard_EXPORT Standard_Boolean Perform (const TCollection_AsciiString& filename, Handle(TDocStd_Document)& doc); + Standard_EXPORT Standard_Boolean Perform (const TCollection_AsciiString& theFileName, Handle(TDocStd_Document)& theDoc) + { return Perform (theFileName.ToCString(), theDoc); } //! Translate IGES file given by filename into the document //! Return True if succeeded, and False in case of fail - Standard_EXPORT Standard_Boolean Perform (const Standard_CString filename, Handle(TDocStd_Document)& doc); + Standard_EXPORT Standard_Boolean Perform (const Standard_CString theFileName, Handle(TDocStd_Document)& theDoc); //! Set ColorMode for indicate read Colors or not. - Standard_EXPORT void SetColorMode (const Standard_Boolean colormode); - - Standard_EXPORT Standard_Boolean GetColorMode() const; + void SetColorMode (const Standard_Boolean theMode) + { myColorMode = theMode; } + + Standard_Boolean GetColorMode() const + { return myColorMode; } //! Set NameMode for indicate read Name or not. - Standard_EXPORT void SetNameMode (const Standard_Boolean namemode); - - Standard_EXPORT Standard_Boolean GetNameMode() const; + void SetNameMode (const Standard_Boolean theMode) + { myNameMode = theMode; } + + Standard_Boolean GetNameMode() const + { return myNameMode; } //! Set LayerMode for indicate read Layers or not. - Standard_EXPORT void SetLayerMode (const Standard_Boolean layermode); - - Standard_EXPORT Standard_Boolean GetLayerMode() const; - - - - -protected: - - - //! Reads colors of IGES entities and sets - //! corresponding color assignments in the DECAF document - Standard_EXPORT Standard_Boolean ReadColors (Handle(TDocStd_Document)& doc) const; - - //! Reads Names of IGES entities and sets - //! corresponding name to label with shape in the DECAF document - Standard_EXPORT Standard_Boolean ReadNames (Handle(TDocStd_Document)& doc) const; - - //! Reads layers of parts defined in the IGES model and - //! set reference between shape and layers in the DECAF document - Standard_EXPORT Standard_Boolean ReadLayers (Handle(TDocStd_Document)& doc) const; - - - - -private: + void SetLayerMode (const Standard_Boolean theMode) + { myLayerMode = theMode; } + Standard_Boolean GetLayerMode() const + { return myLayerMode; } + private: Standard_Boolean myColorMode; Standard_Boolean myNameMode; Standard_Boolean myLayerMode; - - }; - - - - - - #endif // _IGESCAFControl_Reader_HeaderFile diff --git a/src/IGESControl/IGESControl_Controller.cxx b/src/IGESControl/IGESControl_Controller.cxx index d18f1436da..e9a04f2360 100644 --- a/src/IGESControl/IGESControl_Controller.cxx +++ b/src/IGESControl/IGESControl_Controller.cxx @@ -68,18 +68,14 @@ IMPLEMENT_STANDARD_RTTIEXT(IGESControl_Controller,XSControl_Controller) -//szv#4:S4163:12Mar99 never referenced -//static const Standard_CString thelong = "IGES"; -//static const Standard_CString theshort = "iges"; //======================================================================= //function : IGESControl_Controller //purpose : //======================================================================= + IGESControl_Controller::IGESControl_Controller (const Standard_Boolean mod) -//JR/Hp - : XSControl_Controller ((Standard_CString ) (mod ? "FNES" : "IGES") , (Standard_CString ) (mod ? "fnes" : "iges") ) , -// : XSControl_Controller ( (mod ? "FNES" : "iges") , (mod ? "fnes" : "iges") ) , - themode (mod) +: XSControl_Controller ((Standard_CString ) (mod ? "FNES" : "IGES") , (Standard_CString ) (mod ? "fnes" : "iges") ), + themode (mod) { static Standard_Boolean init = Standard_False; if (!init) { @@ -87,54 +83,48 @@ IGESControl_Controller::IGESControl_Controller (const Standard_Boolean mod) IGESAppli::Init(); init = Standard_True; } - AddSessionItem (new IGESSelect_RemoveCurves(Standard_True) ,"iges-remove-pcurves"); + AddSessionItem (new IGESSelect_RemoveCurves(Standard_True) ,"iges-remove-pcurves"); AddSessionItem (new IGESSelect_RemoveCurves(Standard_False),"iges-remove-curves-3d"); AddSessionItem (new IGESSelect_SetLabel (0,Standard_True) ,"iges-clear-label"); AddSessionItem (new IGESSelect_SetLabel (1,Standard_False),"iges-set-label-dnum"); - AddSessionItem (new IGESSelect_AutoCorrect,"iges-auto-correct","send"); - AddSessionItem (new IGESSelect_ComputeStatus,"iges-compute-status","send"); + AddSessionItem (new IGESSelect_AutoCorrect,"iges-auto-correct",Standard_True); + AddSessionItem (new IGESSelect_ComputeStatus,"iges-compute-status",Standard_True); + Handle(IGESSelect_FloatFormat) flf = new IGESSelect_FloatFormat; flf->SetDefault (12); - AddSessionItem (flf,"iges-float-digits-12","send"); + AddSessionItem (flf,"iges-float-digits-12",Standard_True); -// -- Sender Product Identification -- (pas un statique ...) + // -- Sender Product Identification -- (pas un statique ...) Handle(IGESSelect_SetGlobalParameter) set3 = new IGESSelect_SetGlobalParameter(3); -//#58 rln Handle(TCollection_HAsciiString) pa3 = new TCollection_HAsciiString("MDTV X-STEP"); - Handle(TCollection_HAsciiString) pa3 = - Interface_Static::Static("write.iges.header.product")->HStringValue(); + Handle(TCollection_HAsciiString) pa3 = Interface_Static::Static("write.iges.header.product")->HStringValue(); set3->SetValue(pa3); AddSessionItem (pa3, "iges-header-val-sender"); - AddSessionItem (set3,"iges-header-set-sender","send"); + AddSessionItem (set3,"iges-header-set-sender",Standard_True); - AddSessionItem (new IGESSelect_UpdateFileName,"iges-update-file-name","send"); + AddSessionItem (new IGESSelect_UpdateFileName,"iges-update-file-name",Standard_True); -// -- Receiver -- Acces par Static, ajustable + // -- Receiver -- Acces par Static, ajustable Handle(IGESSelect_SetGlobalParameter) set12 = new IGESSelect_SetGlobalParameter(12); -// Handle(TCollection_HAsciiString) pa12 = new TCollection_HAsciiString("Unknown"); - Handle(TCollection_HAsciiString) pa12 = - Interface_Static::Static("write.iges.header.receiver")->HStringValue(); + Handle(TCollection_HAsciiString) pa12 = Interface_Static::Static("write.iges.header.receiver")->HStringValue(); set12->SetValue(pa12); AddSessionItem (pa12, "iges-header-val-receiver"); - AddSessionItem (set12,"iges-header-set-receiver","send"); + AddSessionItem (set12,"iges-header-set-receiver",Standard_True); -// -- Auteur -- acces par Static (demarre par whoami), ajustable + // -- Auteur -- acces par Static (demarre par whoami), ajustable Handle(IGESSelect_SetGlobalParameter) set21 = new IGESSelect_SetGlobalParameter(21); -// Handle(TCollection_HAsciiString) pa21 = new TCollection_HAsciiString("Unknown"); - Handle(TCollection_HAsciiString) pa21 = - Interface_Static::Static("write.iges.header.author")->HStringValue(); + Handle(TCollection_HAsciiString) pa21 = Interface_Static::Static("write.iges.header.author")->HStringValue(); set21->SetValue(pa21); AddSessionItem (pa21, "iges-header-val-author"); - AddSessionItem (set21,"iges-header-set-author","send"); + AddSessionItem (set21,"iges-header-set-author",Standard_True); -// -- Compagnie (de l auteur) -- acces par Static, ajustable + // -- Compagnie (de l auteur) -- acces par Static, ajustable Handle(IGESSelect_SetGlobalParameter) set22 = new IGESSelect_SetGlobalParameter(22); -// Handle(TCollection_HAsciiString) pa22 = new TCollection_HAsciiString("MATRA-DATAVISION"); - Handle(TCollection_HAsciiString) pa22 = - Interface_Static::Static("write.iges.header.company")->HStringValue(); + Handle(TCollection_HAsciiString) pa22 = Interface_Static::Static("write.iges.header.company")->HStringValue(); set22->SetValue(pa22); AddSessionItem (pa22, "iges-header-val-company"); - AddSessionItem (set22,"iges-header-set-company","send"); + AddSessionItem (set22,"iges-header-set-company",Standard_True); + // -- STATICS TraceStatic ("read.iges.bspline.approxd1.mode",5); @@ -146,56 +136,55 @@ IGESControl_Controller::IGESControl_Controller (const Standard_Boolean mod) TraceStatic ("write.iges.unit",6); TraceStatic ("write.iges.brep.mode",6); - theAdaptorLibrary = new IGESSelect_WorkLibrary(themode); - theAdaptorProtocol = IGESSelect_WorkLibrary::DefineProtocol(); + myAdaptorLibrary = new IGESSelect_WorkLibrary(themode); + myAdaptorProtocol = IGESSelect_WorkLibrary::DefineProtocol(); Handle(IGESToBRep_Actor) anactiges = new IGESToBRep_Actor; anactiges->SetContinuity(0); - theAdaptorRead = anactiges; + myAdaptorRead = anactiges; + + myAdaptorWrite = new IGESControl_ActorWrite; - theAdaptorWrite = new IGESControl_ActorWrite; SetModeWrite (0,1); SetModeWriteHelp (0,"Faces"); SetModeWriteHelp (1,"BRep"); } + void IGESControl_Controller::Customise(Handle(XSControl_WorkSession)& WS) { XSControl_Controller::Customise(WS); + // --- SELECTIONS, SIGNATURES, COMPTEURS, EDITEURS + // -- BypassGroup / xst-model-roots -// --- SELECTIONS, SIGNATURES, COMPTEURS, EDITEURS -// -- BypassGroup / xst-model-roots - - - //DeclareAndCast(IFSelect_Selection,xma,SessionItem("xst-model-all")); + // Should be already set by the above call to Customise Handle(IFSelect_SelectModelEntities) xma; Handle(Standard_Transient) xma1 = WS->NamedItem("xst-model-all"); - if(xma1.IsNull()) xma = new IFSelect_SelectModelEntities; + if (xma1.IsNull()) xma = new IFSelect_SelectModelEntities; else { - xma =Handle(IFSelect_SelectModelEntities)::DownCast(xma1); + xma = Handle(IFSelect_SelectModelEntities)::DownCast(xma1); WS->AddNamedItem ("xst-model-all",xma); } - //DeclareAndCast(IFSelect_Selection,xmr,SessionItem("xst-model-roots")); - Handle(IFSelect_SelectModelRoots) xmr; + Handle(IFSelect_SelectModelRoots) xmr; Handle(Standard_Transient) xmr1 = WS->NamedItem("xst-model-roots"); - if(!xmr1.IsNull()) + if (!xmr1.IsNull()) xmr = Handle(IFSelect_SelectModelRoots)::DownCast(xmr1); else { xmr = new IFSelect_SelectModelRoots; WS->AddNamedItem ("xst-model-roots",xmr); } -// DeclareAndCast(IFSelect_Selection,xtr,SessionItem("xst-transferrable-roots")); + Handle(XSControl_SelectForTransfer) xtr; Handle(Standard_Transient) xtr1 = WS->NamedItem("xst-transferrable-roots"); - if(!xtr1.IsNull()) + if (!xtr1.IsNull()) xtr = Handle(XSControl_SelectForTransfer)::DownCast(xtr1); - //st1->SetInput (slr); else { - xtr= new XSControl_SelectForTransfer; + xtr = new XSControl_SelectForTransfer; xtr->SetReader (WS->TransferReader()); WS->AddNamedItem ("xst-transferrable-roots",xtr); } + if (!xmr.IsNull()) { Handle(IGESSelect_SelectVisibleStatus) visa = new IGESSelect_SelectVisibleStatus; visa->SetInput(xmr); @@ -300,10 +289,9 @@ void IGESControl_Controller::Customise(Handle(XSControl_WorkSession)& WS) Handle(IFSelect_EditForm) eddirpf = eddirp->Form(Standard_False); WS->AddNamedItem ("iges-dir-part",eddirpf); - theSignType = typnam; + //szv:mySignType = typnam; + WS->SetSignType( typnam ); } - - } @@ -312,9 +300,9 @@ void IGESControl_Controller::Customise(Handle(XSControl_WorkSession)& WS) //purpose : //======================================================================= - Handle(Interface_InterfaceModel) IGESControl_Controller::NewModel () const +Handle(Interface_InterfaceModel) IGESControl_Controller::NewModel () const { -// On prend un modele qu on prepare avec les statiques enregistres + // On prend un modele qu on prepare avec les statiques enregistres DeclareAndCast(IGESData_IGESModel,igm,Interface_InterfaceModel::Template("iges")); IGESData_GlobalSection GS = igm->GlobalSection(); @@ -332,21 +320,17 @@ void IGESControl_Controller::Customise(Handle(XSControl_WorkSession)& WS) //purpose : //======================================================================= - Handle(Transfer_ActorOfTransientProcess) IGESControl_Controller::ActorRead - (const Handle(Interface_InterfaceModel)& model) const +Handle(Transfer_ActorOfTransientProcess) IGESControl_Controller::ActorRead (const Handle(Interface_InterfaceModel)& model) const { - DeclareAndCast(IGESToBRep_Actor,anactiges,theAdaptorRead); - if (anactiges.IsNull()) return theAdaptorRead; - //sln 14.01.2002 OCC51 : verifying whether entry model is IGESDatat_IGESModel, - // if this condition is false new model is created - Handle(Interface_InterfaceModel) aModel; - if(model->IsKind(STANDARD_TYPE(IGESData_IGESModel))) - aModel = model; - else - aModel = NewModel(); - anactiges->SetModel(GetCasted(IGESData_IGESModel,aModel)); - anactiges->SetContinuity(Interface_Static::IVal("read.iges.bspline.continuity")); - return anactiges; + DeclareAndCast(IGESToBRep_Actor,anactiges,myAdaptorRead); + if (!anactiges.IsNull()) { + // sln 14.01.2002 OCC51 : verifying whether entry model is IGESDatat_IGESModel, + // if this condition is false new model is created + Handle(Interface_InterfaceModel) aModel = (model->IsKind(STANDARD_TYPE(IGESData_IGESModel))? model : NewModel()); + anactiges->SetModel(GetCasted(IGESData_IGESModel,aModel)); + anactiges->SetContinuity(Interface_Static::IVal("read.iges.bspline.continuity")); + } + return myAdaptorRead; } // #### TRANSFERT (ECRITURE SHAPE) #### @@ -357,10 +341,10 @@ void IGESControl_Controller::Customise(Handle(XSControl_WorkSession)& WS) //purpose : //======================================================================= - IFSelect_ReturnStatus IGESControl_Controller::TransferWriteShape (const TopoDS_Shape& shape, - const Handle(Transfer_FinderProcess)& FP, - const Handle(Interface_InterfaceModel)& model, - const Standard_Integer modetrans) const +IFSelect_ReturnStatus IGESControl_Controller::TransferWriteShape (const TopoDS_Shape& shape, + const Handle(Transfer_FinderProcess)& FP, + const Handle(Interface_InterfaceModel)& model, + const Standard_Integer modetrans) const { return XSControl_Controller::TransferWriteShape (shape,FP,model,modetrans); } @@ -370,7 +354,7 @@ void IGESControl_Controller::Customise(Handle(XSControl_WorkSession)& WS) //purpose : //======================================================================= - Standard_Boolean IGESControl_Controller::Init () +Standard_Boolean IGESControl_Controller::Init () { static Standard_Boolean inic = Standard_False; if (!inic) { diff --git a/src/IGESControl/IGESControl_Reader.cxx b/src/IGESControl/IGESControl_Reader.cxx index c5219ab75c..cc2237b94e 100644 --- a/src/IGESControl/IGESControl_Reader.cxx +++ b/src/IGESControl/IGESControl_Reader.cxx @@ -143,9 +143,9 @@ void IGESControl_Reader::PrintTransferInfo (const IFSelect_PrintFail failsonly, const IFSelect_PrintCount mode) const { Standard_Integer nbWarn = 0, nbFail= 0, nbEntities =0, nbRoots = 0, nbResults = 0; - Handle(Transfer_TransientProcess) TP = WS()->MapReader(); + const Handle(Transfer_TransientProcess) &TP = WS()->TransferReader()->TransientProcess(); Handle(Message_Messenger) TF = TP->Messenger(); - Handle(Interface_InterfaceModel) model = TP->Model(); + const Handle(Interface_InterfaceModel) &model = TP->Model(); if (! model.IsNull()) { nbEntities = model->NbEntities(); nbRoots = TP->NbRoots(); diff --git a/src/IGESControl/IGESControl_Writer.cxx b/src/IGESControl/IGESControl_Writer.cxx index 94fbf67c29..a5f4f65d91 100644 --- a/src/IGESControl/IGESControl_Writer.cxx +++ b/src/IGESControl/IGESControl_Writer.cxx @@ -47,64 +47,47 @@ #include #include #include -#include #include IGESControl_Writer::IGESControl_Writer () - : theTP (new Transfer_FinderProcess(10000)) , - thest (Standard_False) + : myTP (new Transfer_FinderProcess(10000)) , + myIsComputed (Standard_False) { // faudrait aussi (?) prendre les parametres par defaut ... ? IGESControl_Controller::Init(); - thedit.Init(IGESSelect_WorkLibrary::DefineProtocol()); - thedit.SetUnitName(Interface_Static::CVal ("write.iges.unit")); - thedit.ApplyUnit(); - thecr = Interface_Static::IVal ("write.iges.brep.mode"); - themod = thedit.Model(); + myEditor.Init(IGESSelect_WorkLibrary::DefineProtocol()); + myEditor.SetUnitName(Interface_Static::CVal ("write.iges.unit")); + myEditor.ApplyUnit(); + myWriteMode = Interface_Static::IVal ("write.iges.brep.mode"); + myModel = myEditor.Model(); } IGESControl_Writer::IGESControl_Writer (const Standard_CString unit, const Standard_Integer modecr) - : theTP (new Transfer_FinderProcess(10000)) , - thecr (modecr) , thest (Standard_False) + : myTP (new Transfer_FinderProcess(10000)) , + myWriteMode (modecr) , myIsComputed (Standard_False) { // faudrait aussi (?) prendre les parametres par defaut ... ? IGESControl_Controller::Init(); - thedit.Init(IGESSelect_WorkLibrary::DefineProtocol()); - thedit.SetUnitName(unit); - thedit.ApplyUnit(); - themod = thedit.Model(); + myEditor.Init(IGESSelect_WorkLibrary::DefineProtocol()); + myEditor.SetUnitName(unit); + myEditor.ApplyUnit(); + myModel = myEditor.Model(); } IGESControl_Writer::IGESControl_Writer (const Handle(IGESData_IGESModel)& model, const Standard_Integer modecr) - : theTP (new Transfer_FinderProcess(10000)) , - themod (model) , - thedit (model,IGESSelect_WorkLibrary::DefineProtocol()) , - thecr (modecr) , thest (Standard_False) { } - -Handle(IGESData_IGESModel) IGESControl_Writer::Model () const -{ - return themod; -} - -Handle(Transfer_FinderProcess) IGESControl_Writer::TransferProcess () const -{ - return theTP; -} - -void IGESControl_Writer::SetTransferProcess - (const Handle(Transfer_FinderProcess)& TP) -{ - theTP = TP; -} + : myTP (new Transfer_FinderProcess(10000)) , + myModel (model) , + myEditor (model,IGESSelect_WorkLibrary::DefineProtocol()) , + myWriteMode (modecr) , myIsComputed (Standard_False) { } Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape) { if (theShape.IsNull()) return Standard_False; // for progress indication - Handle(Message_ProgressIndicator) progress = theTP->GetProgress(); + Handle(Message_ProgressIndicator) progress = myTP->GetProgress(); if ( ! progress.IsNull() ) { Standard_Integer nbfaces=0; for( TopExp_Explorer exp(theShape,TopAbs_FACE); exp.More(); exp.Next() ) @@ -123,25 +106,23 @@ Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape) "write.iges.sequence", info, progress ); // modified by NIZHNY-EAP Tue Aug 29 11:17:01 2000 ___END___ - Handle(IGESData_IGESEntity) ent; - BRepToIGES_BREntity B0; B0.SetTransferProcess(theTP); B0.SetModel(themod); - BRepToIGESBRep_Entity B1; B1.SetTransferProcess(theTP); B1.SetModel(themod); - if (thecr) ent = B1.TransferShape(Shape); - else ent = B0.TransferShape(Shape); + BRepToIGES_BREntity B0; B0.SetTransferProcess(myTP); B0.SetModel(myModel); + BRepToIGESBRep_Entity B1; B1.SetTransferProcess(myTP); B1.SetModel(myModel); + Handle(IGESData_IGESEntity) ent = myWriteMode? B1.TransferShape(Shape) : B0.TransferShape(Shape); if(ent.IsNull()) return Standard_False; // modified by NIZHNY-EAP Tue Aug 29 11:37:18 2000 ___BEGIN___ - XSAlgo::AlgoContainer()->MergeTransferInfo(theTP, info); + XSAlgo::AlgoContainer()->MergeTransferInfo(myTP, info); // modified by NIZHNY-EAP Tue Aug 29 11:37:25 2000 ___END___ //22.10.98 gka BUC60080 - Standard_Integer oldnb = themod->NbEntities(); + Standard_Integer oldnb = myModel->NbEntities(); Standard_Boolean aent = AddEntity (ent); - Standard_Integer newnb = themod->NbEntities(); + Standard_Integer newnb = myModel->NbEntities(); - Standard_Real oldtol = themod->GlobalSection().Resolution(), newtol; + Standard_Real oldtol = myModel->GlobalSection().Resolution(), newtol; Standard_Integer tolmod = Interface_Static::IVal("write.precision.mode"); if (tolmod == 2) @@ -165,7 +146,7 @@ Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape) } } - IGESData_GlobalSection gs = themod->GlobalSection(); + IGESData_GlobalSection gs = myModel->GlobalSection(); gs.SetResolution (newtol / gs.UnitValue());//rln 28.12.98 CCI60005 //#34 22.10.98 rln BUC60081 @@ -182,7 +163,7 @@ Standard_Boolean IGESControl_Writer::AddShape (const TopoDS_Shape& theShape) aZmin / gs.UnitValue())); } - themod->SetGlobalSection(gs); + myModel->SetGlobalSection(gs); return aent; } @@ -199,11 +180,11 @@ Standard_Boolean IGESControl_Writer::AddGeom (const Handle(Standard_Transient)& // quid de Point; Geom2d ? // GeomToIGES_GeomPoint GP; - GeomToIGES_GeomCurve GC; GC.SetModel(themod); - GeomToIGES_GeomSurface GS; GS.SetModel(themod); + GeomToIGES_GeomCurve GC; GC.SetModel(myModel); + GeomToIGES_GeomSurface GS; GS.SetModel(myModel); //#34 22.10.98 rln BUC60081 - IGESData_GlobalSection gs = themod->GlobalSection(); + IGESData_GlobalSection gs = myModel->GlobalSection(); Bnd_Box box; if (!Curve.IsNull()) { @@ -224,24 +205,25 @@ Standard_Boolean IGESControl_Writer::AddGeom (const Handle(Standard_Transient)& gs.MaxMaxCoords (gp_XYZ (aXmin / gs.UnitValue(), aYmin / gs.UnitValue(), aZmin / gs.UnitValue())); - themod->SetGlobalSection(gs); + myModel->SetGlobalSection(gs); return AddEntity (ent); } Standard_Boolean IGESControl_Writer::AddEntity (const Handle(IGESData_IGESEntity)& ent) { if (ent.IsNull()) return Standard_False; - themod->AddWithRefs(ent,IGESSelect_WorkLibrary::DefineProtocol()); - thest = Standard_False; + myModel->AddWithRefs(ent,IGESSelect_WorkLibrary::DefineProtocol()); + myIsComputed = Standard_False; return Standard_True; } void IGESControl_Writer::ComputeModel () { - if (thest) return; - thedit.ComputeStatus(); - thedit.AutoCorrectModel(); - thest = Standard_True; + if (!myIsComputed) { + myEditor.ComputeStatus(); + myEditor.AutoCorrectModel(); + myIsComputed = Standard_True; + } } Standard_Boolean IGESControl_Writer::Write @@ -249,13 +231,13 @@ Standard_Boolean IGESControl_Writer::Write { if (!S) return Standard_False; ComputeModel(); - Standard_Integer nbEnt = themod->NbEntities(); + Standard_Integer nbEnt = myModel->NbEntities(); #ifdef OCCT_DEBUG cout<<" IGES Write : "< #include -#include #include #include #include #include +#include #include #include +#include static int init = 0; static Standard_CString unspec = "unspecified"; -static TColStd_SequenceOfAsciiString& thecats() +static Standard_Mutex gMapTypesMutex; +static volatile Standard_Boolean gMapTypesInit = Standard_False; + +static NCollection_Vector& theCats() { - static TColStd_SequenceOfAsciiString thecat; - return thecat; + static NCollection_Vector aCat; + return aCat; } - - - - Interface_Category::Interface_Category () - : thegtool (new Interface_GTool) { Init(); } - - Interface_Category::Interface_Category - (const Handle(Interface_Protocol)& protocol) - : thegtool (new Interface_GTool(protocol)) { Init(); } - - Interface_Category::Interface_Category - (const Handle(Interface_GTool)& gtool) - : thegtool (gtool) { Init(); } - - void Interface_Category::SetProtocol - (const Handle(Interface_Protocol)& protocol) - { thegtool->SetProtocol(protocol); } - - Standard_Integer Interface_Category::CatNum - (const Handle(Standard_Transient)& ent, const Interface_ShareTool& shares) +Standard_Integer Interface_Category::CatNum + (const Handle(Standard_Transient)& theEnt, + const Interface_ShareTool& theShares) { - if (ent.IsNull()) return 0; + if (theEnt.IsNull()) return 0; Standard_Integer CN; - Handle(Interface_GeneralModule) module; - if (!thegtool->Select (ent,module,CN)) return 0; - return module->CategoryNumber (CN,ent,shares); + Handle(Interface_GeneralModule) aModule; + if (!myGTool->Select (theEnt,aModule,CN)) return 0; + return aModule->CategoryNumber (CN,theEnt,theShares); } - void Interface_Category::ClearNums () - { thenum.Nullify(); } - - void Interface_Category::Compute - (const Handle(Interface_InterfaceModel)& model, - const Interface_ShareTool& shares) +void Interface_Category::Compute + (const Handle(Interface_InterfaceModel)& theModel, + const Interface_ShareTool& theShares) { ClearNums(); - if (model.IsNull()) return; - Standard_Integer CN, i, nb = model->NbEntities(); - thegtool->Reservate (nb); + if (theModel.IsNull()) return; + Standard_Integer CN, i, nb = theModel->NbEntities(); + myGTool->Reservate (nb); if (nb == 0) return; - thenum = new TColStd_HArray1OfInteger (1,nb); thenum->Init(0); + myNum = new TColStd_HArray1OfInteger (1,nb); myNum->Init(0); for (i = 1; i <= nb; i ++) { - Handle(Standard_Transient) ent = model->Value(i); - if (ent.IsNull()) continue; - Handle(Interface_GeneralModule) module; - if (!thegtool->Select (ent,module,CN)) continue; - thenum->SetValue (i,module->CategoryNumber (CN,ent,shares)); + Handle(Standard_Transient) anEnt = theModel->Value(i); + if (anEnt.IsNull()) continue; + Handle(Interface_GeneralModule) aModule; + if (!myGTool->Select (anEnt,aModule,CN)) continue; + myNum->SetValue (i,aModule->CategoryNumber (CN,anEnt,theShares)); } } -Standard_Integer Interface_Category::Num (const Standard_Integer nument) const +Standard_Integer Interface_Category::Num (const Standard_Integer theNumEnt) const { - if (thenum.IsNull()) return 0; - if (nument < 1 || nument > thenum->Length()) return 0; - return thenum->Value(nument); + if (myNum.IsNull()) return 0; + if (theNumEnt < 1 || theNumEnt > myNum->Length()) return 0; + return myNum->Value(theNumEnt); } +// List of Categories -// ########## LISTE DES CATEGORIES ########## - - Standard_Integer Interface_Category::AddCategory (const Standard_CString name) +Standard_Integer Interface_Category::AddCategory (const Standard_CString theName) { - Standard_Integer num = Interface_Category::Number (name); - if (num > 0) return num; - thecats().Append (TCollection_AsciiString(name)); - return thecats().Length()+1; + Standard_Integer aNum = Interface_Category::Number (theName); + if (aNum > 0) return aNum; + theCats().Append (TCollection_AsciiString(theName)); + return theCats().Length()+1; } - Standard_Integer Interface_Category::NbCategories () - { return thecats().Length(); } - - Standard_CString Interface_Category::Name (const Standard_Integer num) +Standard_Integer Interface_Category::NbCategories() { - if (num < 0) return ""; - if (num < 1 || num > thecats().Length()) return unspec; - return thecats().Value(num).ToCString(); + return theCats().Length(); } - - Standard_Integer Interface_Category::Number (const Standard_CString name) +Standard_CString Interface_Category::Name (const Standard_Integer theNum) { - Standard_Integer i, nb = thecats().Length(); + if (theNum < 0) return ""; + if (theNum < 1 || theNum > theCats().Length()) return unspec; + return theCats().ChangeValue(theNum).ToCString(); +} + +Standard_Integer Interface_Category::Number (const Standard_CString theName) +{ + Standard_Integer i, nb = theCats().Length(); for (i = 1; i <= nb; i ++) { - if (thecats().Value(i).IsEqual(name)) return i; + if (theCats().ChangeValue(i).IsEqual(theName)) return i; } return 0; } - - void Interface_Category::Init () +void Interface_Category::Init () { - if (init) return; init = 1; - init = Interface_Category::AddCategory ("Shape"); - init = Interface_Category::AddCategory ("Drawing"); - init = Interface_Category::AddCategory ("Structure"); - init = Interface_Category::AddCategory ("Description"); - init = Interface_Category::AddCategory ("Auxiliary"); - init = Interface_Category::AddCategory ("Professional"); - init = Interface_Category::AddCategory ("FEA"); - init = Interface_Category::AddCategory ("Kinematics"); - init = Interface_Category::AddCategory ("Piping"); + // On first call, initialize static map + if ( !gMapTypesInit ) + { + gMapTypesMutex.Lock(); + if ( !gMapTypesInit ) + { + if (init) return; init = 1; + init = Interface_Category::AddCategory ("Shape"); + init = Interface_Category::AddCategory ("Drawing"); + init = Interface_Category::AddCategory ("Structure"); + init = Interface_Category::AddCategory ("Description"); + init = Interface_Category::AddCategory ("Auxiliary"); + init = Interface_Category::AddCategory ("Professional"); + init = Interface_Category::AddCategory ("FEA"); + init = Interface_Category::AddCategory ("Kinematics"); + init = Interface_Category::AddCategory ("Piping"); + + gMapTypesInit = Standard_True; + } + gMapTypesMutex.Unlock(); + } } diff --git a/src/Interface/Interface_Category.hxx b/src/Interface/Interface_Category.hxx index e05869b6a7..e26a90bf2c 100644 --- a/src/Interface/Interface_Category.hxx +++ b/src/Interface/Interface_Category.hxx @@ -24,13 +24,13 @@ #include #include #include -class Interface_GTool; + +#include class Interface_Protocol; class Standard_Transient; class Interface_ShareTool; class Interface_InterfaceModel; - //! This class manages categories //! A category is defined by a name and a number, and can be //! seen as a way of rough classification, i.e. less precise than @@ -54,81 +54,69 @@ class Interface_InterfaceModel; //! then be done in a wider context (which must provide a Graph) class Interface_Category { -public: + public: DEFINE_STANDARD_ALLOC - //! Creates a Category, with no protocol yet - Standard_EXPORT Interface_Category(); - + Interface_Category() + : myGTool(new Interface_GTool) + { Init(); } + //! Creates a Category with a given protocol - Standard_EXPORT Interface_Category(const Handle(Interface_Protocol)& proto); - + Interface_Category(const Handle(Interface_Protocol)& theProtocol) + : myGTool(new Interface_GTool(theProtocol)) + { Init(); } + //! Creates a Category with a given GTool - Standard_EXPORT Interface_Category(const Handle(Interface_GTool)& gtool); - + Interface_Category(const Handle(Interface_GTool)& theGTool) + : myGTool(theGTool) + { Init(); } + //! Sets/Changes Protocol - Standard_EXPORT void SetProtocol (const Handle(Interface_Protocol)& proto); - + void SetProtocol (const Handle(Interface_Protocol)& theProtocol) + { myGTool->SetProtocol(theProtocol); } + //! Determines the Category Number for an entity in its context, //! by using general service CategoryNumber - Standard_EXPORT Standard_Integer CatNum (const Handle(Standard_Transient)& ent, const Interface_ShareTool& shares); - + Standard_EXPORT Standard_Integer CatNum (const Handle(Standard_Transient)& theEnt, const Interface_ShareTool& theShares); + //! Clears the recorded list of category numbers for a Model - Standard_EXPORT void ClearNums(); - + void ClearNums() + { myNum.Nullify(); } + //! Computes the Category Number for each entity and records it, //! in an array (ent.number -> category number) //! Hence, it can be queried by the method Num. //! The Model itself is not recorded, this method is intended to //! be used in a wider context (which detains also a Graph, etc) - Standard_EXPORT void Compute (const Handle(Interface_InterfaceModel)& model, const Interface_ShareTool& shares); - + Standard_EXPORT void Compute (const Handle(Interface_InterfaceModel)& theModel, const Interface_ShareTool& theShares); + //! Returns the category number recorded for an entity number //! Returns 0 if out of range - Standard_EXPORT Standard_Integer Num (const Standard_Integer nument) const; - + Standard_EXPORT Standard_Integer Num (const Standard_Integer theNumEnt) const; + //! Records a new Category defined by its names, produces a number //! New if not yet recorded - Standard_EXPORT static Standard_Integer AddCategory (const Standard_CString name); - + Standard_EXPORT static Standard_Integer AddCategory (const Standard_CString theName); + //! Returns the count of recorded categories Standard_EXPORT static Standard_Integer NbCategories(); - + //! Returns the name of a category, according to its number - Standard_EXPORT static Standard_CString Name (const Standard_Integer num); - + Standard_EXPORT static Standard_CString Name (const Standard_Integer theNum); + //! Returns the number of a category, according to its name - Standard_EXPORT static Standard_Integer Number (const Standard_CString name); - + Standard_EXPORT static Standard_Integer Number (const Standard_CString theName); + //! Default initialisation //! (protected against several calls : passes only once) Standard_EXPORT static void Init(); + private: - - -protected: - - - - - -private: - - - - Handle(Interface_GTool) thegtool; - Handle(TColStd_HArray1OfInteger) thenum; - - + Handle(Interface_GTool) myGTool; + Handle(TColStd_HArray1OfInteger) myNum; }; - - - - - - #endif // _Interface_Category_HeaderFile diff --git a/src/InterfaceGraphic/InterfaceGraphic.hxx b/src/InterfaceGraphic/InterfaceGraphic.hxx index 5379156ed8..236700eec2 100644 --- a/src/InterfaceGraphic/InterfaceGraphic.hxx +++ b/src/InterfaceGraphic/InterfaceGraphic.hxx @@ -43,6 +43,9 @@ #ifdef Status #undef Status #endif +#ifdef Opposite + #undef Opposite +#endif #endif diff --git a/src/MoniTool/FILES b/src/MoniTool/FILES index b0e766b701..8e1579ecf9 100755 --- a/src/MoniTool/FILES +++ b/src/MoniTool/FILES @@ -20,12 +20,6 @@ MoniTool_Macros.hxx MoniTool_MTHasher.cxx MoniTool_MTHasher.hxx MoniTool_MTHasher.lxx -MoniTool_Option.cxx -MoniTool_Option.hxx -MoniTool_OptValue.cxx -MoniTool_OptValue.hxx -MoniTool_Profile.cxx -MoniTool_Profile.hxx MoniTool_RealVal.cxx MoniTool_RealVal.hxx MoniTool_SequenceOfElement.hxx diff --git a/src/MoniTool/MoniTool_OptValue.cxx b/src/MoniTool/MoniTool_OptValue.cxx deleted file mode 100644 index df8b7bed6d..0000000000 --- a/src/MoniTool/MoniTool_OptValue.cxx +++ /dev/null @@ -1,64 +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 -#include -#include - -MoniTool_OptValue::MoniTool_OptValue (const Standard_CString opt) - : theopt (opt) -{ -// CKY: NO CALL TO A VIRTUAL METHOD WITHIN THE CONSTRUCTOR -// Explicite Load must be done after creation -} - - void MoniTool_OptValue::Clear () - { theval.Nullify(); } - - void MoniTool_OptValue::SetValue - (const Handle(MoniTool_Profile)& prof, - const Standard_CString opt, const Standard_Boolean fast) -{ - if (prof.IsNull()) return; - if (!opt || opt[0] == '\0') return; - Handle(Standard_Transient) val; - if (fast) prof->FastValue (opt,val); - else prof->Value (opt,val); - if (!val.IsNull()) theval = val; -} - - - Standard_Boolean MoniTool_OptValue::IsLoaded () const - { return (!theval.IsNull()); } - - Handle(MoniTool_Profile) MoniTool_OptValue::Prof () const -{ - Handle(MoniTool_Profile) prof; - return prof; -} - - void MoniTool_OptValue::Load (const Standard_Boolean fast) - { SetValue (Prof(),theopt.ToCString(),fast); } - - - void MoniTool_OptValue::Value (Handle(Standard_Transient)& val) const - { val = theval; } - -//======================================================================= -//function : ~MoniTool_OptValue -//purpose : -//======================================================================= - -MoniTool_OptValue::~MoniTool_OptValue() -{} diff --git a/src/MoniTool/MoniTool_OptValue.hxx b/src/MoniTool/MoniTool_OptValue.hxx deleted file mode 100644 index f1e075525f..0000000000 --- a/src/MoniTool/MoniTool_OptValue.hxx +++ /dev/null @@ -1,105 +0,0 @@ -// Created on: 1999-12-17 -// Created by: Christian CAILLET -// Copyright (c) 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 _MoniTool_OptValue_HeaderFile -#define _MoniTool_OptValue_HeaderFile - -#include -#include -#include - -#include -#include -#include -class Standard_Transient; -class MoniTool_Profile; - - -//! This class allows two kinds of use -//! -//! As an object, a OptValue can be put in any operator or -//! algorithm ... to use an Option of a Profile, by recording -//! its value, hence avoiding to query the Profile eachtime -//! -//! This object brings a value which can be set as coming from a -//! Profile, with a configuration name and for an Option name -//! This value is evaluated then returned immediately -//! -//! As a class, it can be redefined to work on a dedicated -//! Profile, provided by such or such specific way (as static -//! context for instance) -//! -//! To change configuration, etc... can be done by querying and -//! editing the Profile -class MoniTool_OptValue -{ -public: - - DEFINE_STANDARD_ALLOC - - - //! Creates an OptValue on a given Option - //! This allows to use "shortcut" method to set the value - //! - //! WARNING : loading is not done at creation time. It must be - //! done explicitly by call to Load - //! - //! The reason comes from C++ : the Profile being virtual, and - //! intended to be redefined in sub-classes, must not be used in - //! the constructor. A separate method, called on the object - //! already created with its true type, must be called after - Standard_EXPORT MoniTool_OptValue(const Standard_CString opt = ""); - - //! Clears the Value of the OptValue - Standard_EXPORT void Clear(); - - //! Sets the value as coming from the Profile, according to an - //! Option name. Access as Fast or regular - //! If no value is available, the former one remains : can be - //! cleared by call to Clear - Standard_EXPORT void SetValue (const Handle(MoniTool_Profile)& prof, const Standard_CString opt, const Standard_Boolean fast = Standard_True); - - //! Returns the Profile which can be used by Short Cut methods - //! Defaults returns a Null Handle, can be redefined - //! For instance, to return a static used as dictionary or context - Standard_EXPORT virtual Handle(MoniTool_Profile) Prof() const; - - //! Sets the value from the Profile returned by method Prof, - //! and Option Name given at creation time. - //! FastValue by default, else Value - //! - //! Does not check if already loaded : reloads anyway - //! IsLoaded allows to test - Standard_EXPORT void Load (const Standard_Boolean fast = Standard_True); - - //! Says if the OptValue is already loaded (i.e. Value defined) - Standard_EXPORT Standard_Boolean IsLoaded() const; - - //! Returns the Value set by, either SetConf or SetValue - //! Can be Null ... (if not set or not properly set) - //! - //! Returned as Argument, hence avoiding DownCast - //! Warning : type is not controlled - Standard_EXPORT void Value (Handle(Standard_Transient)& val) const; - - Standard_EXPORT virtual ~MoniTool_OptValue(); - -private: - TCollection_AsciiString theopt; - Handle(Standard_Transient) theval; -}; - -#endif // _MoniTool_OptValue_HeaderFile diff --git a/src/MoniTool/MoniTool_Option.cxx b/src/MoniTool/MoniTool_Option.cxx deleted file mode 100644 index 3bdbabdeb0..0000000000 --- a/src/MoniTool/MoniTool_Option.cxx +++ /dev/null @@ -1,151 +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 -#include -#include -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(MoniTool_Option,MMgt_TShared) - -MoniTool_Option::MoniTool_Option - (const Handle(Standard_Type)& atype, const Standard_CString aname) - : thename (aname) , thetype (atype) - { theitems = new Dico_DictionaryOfTransient(); } - - MoniTool_Option::MoniTool_Option - (const Handle(MoniTool_TypedValue)& aval, const Standard_CString aname) - : thename (aname) , - thetype (STANDARD_TYPE(TCollection_HAsciiString)) , - thevalue (aval) - { theitems = new Dico_DictionaryOfTransient(); - if (thename.Length() == 0) thename.AssignCat (aval->Name()); } - - MoniTool_Option::MoniTool_Option - (const Handle(MoniTool_Option)& other, const Standard_CString aname) - : thename (aname) , - thetype (other->Type()) , - thevalue (other->TypedValue()) , - theitems (other->Items()) -{ - if (thename.Length() == 0) thename.AssignCat (other->Name()); - thecase.Clear(); thecase.AssignCat (other->CaseName()); - other->Value(theval); -} - - Standard_Boolean MoniTool_Option::Add - (const Standard_CString name, const Handle(Standard_Transient)& val) -{ - if (val.IsNull()) return Standard_False; - if (!val->IsKind (thetype)) return Standard_False; - if (!thevalue.IsNull()) { - Handle(TCollection_HAsciiString) str = Handle(TCollection_HAsciiString)::DownCast(val); - if (str.IsNull()) return Standard_False; - if (!thevalue->Satisfies(str)) return Standard_False; - } - theitems->SetItem (name,val); - thecase.Clear(); thecase.AssignCat (name); // switch mis a jour par defaut - theval = val; - return Standard_True; -} - - Standard_Boolean MoniTool_Option::AddBasic - (const Standard_CString name, const Standard_CString val) -{ - if (thevalue.IsNull()) return Standard_False; - Handle(TCollection_HAsciiString) str; - if (val && val[0] != '\0') str = new TCollection_HAsciiString (val); - else str = new TCollection_HAsciiString (name); - return Add (name,str); -} - - - void MoniTool_Option::Duplicate () -{ - Handle(Dico_DictionaryOfTransient) items = new Dico_DictionaryOfTransient(); - Dico_IteratorOfDictionaryOfTransient iter(theitems); - for (; iter.More(); iter.Next()) - items->SetItem (iter.Name().ToCString(),iter.Value()); - theitems = items; -} - - const TCollection_AsciiString& MoniTool_Option::Name () const - { return thename; } - - Handle(Standard_Type) MoniTool_Option::Type () const - { return thetype; } - - Handle(MoniTool_TypedValue) MoniTool_Option::TypedValue () const - { return thevalue; } - - Handle(Dico_DictionaryOfTransient) MoniTool_Option::Items () const - { return theitems; } - - Standard_Boolean MoniTool_Option::Item - (const Standard_CString name, Handle(Standard_Transient)& val) const -{ - Handle(Standard_Transient) v; - if (!theitems->GetItem (name,v)) return Standard_False; - val = v; - return Standard_True; -} - - - Handle(TColStd_HSequenceOfAsciiString) MoniTool_Option::ItemList () const -{ - Handle(TColStd_HSequenceOfAsciiString) list = new TColStd_HSequenceOfAsciiString(); - Dico_IteratorOfDictionaryOfTransient iter(theitems); - for (; iter.More(); iter.Next()) list->Append (iter.Name()); - return list; -} - - Handle(TColStd_HSequenceOfAsciiString) MoniTool_Option::Aliases - (const Standard_CString name, const Standard_Boolean exact) const -{ - Handle(TColStd_HSequenceOfAsciiString) list = new TColStd_HSequenceOfAsciiString(); - Handle(Standard_Transient) v; - if (!theitems->GetItem (name,v, exact)) return list; - - Dico_IteratorOfDictionaryOfTransient iter(theitems); - for (; iter.More(); iter.Next()) { - if (iter.Value() != v) continue; - TCollection_AsciiString itname = iter.Name(); - if (!itname.IsEqual(name)) list->Append (itname); - } - return list; -} - -// #### SWITCH ACTIONS #### - - Standard_Boolean MoniTool_Option::Switch (const Standard_CString name) -{ - Handle(Standard_Transient) val; - if (!theitems->GetItem (name,val)) return Standard_False; - thecase.Clear(); thecase.AssignCat (name); - theval = val; - return Standard_True; -} - - const TCollection_AsciiString& MoniTool_Option::CaseName () const - { return thecase; } - - Handle(Standard_Transient) MoniTool_Option::CaseValue () const - { return theval; } - - void MoniTool_Option::Value (Handle(Standard_Transient)& val) const - { if (!theval.IsNull()) val = theval; } diff --git a/src/MoniTool/MoniTool_Option.hxx b/src/MoniTool/MoniTool_Option.hxx deleted file mode 100644 index 12afd24c28..0000000000 --- a/src/MoniTool/MoniTool_Option.hxx +++ /dev/null @@ -1,177 +0,0 @@ -// Created on: 1998-12-14 -// 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 _MoniTool_Option_HeaderFile -#define _MoniTool_Option_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -#include -class MoniTool_TypedValue; -class Dico_DictionaryOfTransient; -class Standard_Transient; -class TCollection_AsciiString; - - -class MoniTool_Option; -DEFINE_STANDARD_HANDLE(MoniTool_Option, MMgt_TShared) - -//! An Option gives a way of recording an enumerated list of -//! instances of a given class, each instance being identified -//! by a case name. -//! -//! Also, an Option allows to manage basic types through a Typed -//! Value (which also applies to Static Parameter). It may record -//! an enumerated list of values for a TypedValue or Static -//! Parameter, each of them is recorded as a string (HAsciiString) -//! -//! An Option is defined by the type of the class to be optioned, -//! or (mutually exclusive) the TypedValue/Static of which values -//! are to be optioned, a specific name, a list of named values. -//! It brings a current case with its name and value -//! It may also have a default case (the first recorded one if not -//! precised) -//! -//! An Option may be created from another one, by sharing its Type -//! and its list of Items (one per case), with the same name or -//! another one. It may then be duplicated to break this sharing. -class MoniTool_Option : public MMgt_TShared -{ - -public: - - - //! Creates an Option from scratch, with a Type and a Name - Standard_EXPORT MoniTool_Option(const Handle(Standard_Type)& atype, const Standard_CString aname); - - //! Creates an Option for a TypedValue (for basic, non-cdl-typed, - //! value : integer, real, string ...) - //! If is not given, the name of the TypedValue is taken - //! Remark that Type is then enforced to TCollection_HAsciiString - Standard_EXPORT MoniTool_Option(const Handle(MoniTool_TypedValue)& aval, const Standard_CString aname = ""); - - //! Creates an Option from another one, the name can be redefined - //! The Type remains the same. The list of Items, too, it can also - //! be later duplicated by call to Duplicate - Standard_EXPORT MoniTool_Option(const Handle(MoniTool_Option)& other, const Standard_CString aname = ""); - - //! Adds an item : value and name (replaces it if name is already - //! recorded) - //! Returns True when done, False if is not Kind of the - //! definition Type - //! For a TypedValue, val must be a HAsciiString, its content must - //! satisfy the definition of the TypedValue - Standard_EXPORT Standard_Boolean Add (const Standard_CString name, const Handle(Standard_Transient)& val); - - //! Short-cut to add an item for a TypedValue (basic type) : name - //! is the name of the case, val is its value as a CString - //! If val is not provided, val = name is assumed - //! Returns True when done, False if this Option is not for a - //! TypedValue or if the new value does not satisfy the definition - //! of the TypedValue - Standard_EXPORT Standard_Boolean AddBasic (const Standard_CString name, const Standard_CString val = ""); - - //! Duplicates the list of items - //! It starts with the same definitions as before Duplicate, but - //! it is not longer shared with other options - Standard_EXPORT void Duplicate(); - - //! Returns the Name of the Option - Standard_EXPORT const TCollection_AsciiString& Name() const; - - //! Returns the Type of the Option - Standard_EXPORT Handle(Standard_Type) Type() const; - - //! Returns the TypedValue of the Option, or a Null Handle - Standard_EXPORT Handle(MoniTool_TypedValue) TypedValue() const; - - //! Gives the value bound with a name, in val - //! Returns True if is found, False else - //! This way of returning a Transient, bound with the Type Control - //! avoids DownCast and ensures the value is directly usable - Standard_EXPORT Standard_Boolean Item (const Standard_CString name, Handle(Standard_Transient)& val) const; - - //! Returns the list of available item names - Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) ItemList() const; - - //! Returns the list of cases, other than , which bring the - //! same value as - //! Empty list (not a Null Handle) if no alias, or unknown - //! if is True (D), exact name is required, no completion - //! if is False and is not complete, but addresses - //! only one item, completion is done and the list includes the - //! complete name - Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) Aliases (const Standard_CString name, const Standard_Boolean exact = Standard_True) const; - - //! Commands the Option to switch on an item name - //! Returns True when done, False if is not recorded - //! (in that case, former switch remains unchanged) - //! If no switch has been called, it is active on the last added - //! items - Standard_EXPORT Standard_Boolean Switch (const Standard_CString name); - - //! Returns the Name of the currently switched item (Case) - Standard_EXPORT const TCollection_AsciiString& CaseName() const; - - //! Returns the Value of the currently switch item - //! To be down-casted as needed before use - Standard_EXPORT Handle(Standard_Transient) CaseValue() const; - - //! Returns the Value of the currently switch item - //! This way of returning a Transient, bound with the Type Control - //! avoids DownCast and ensures the value is directly usable - //! For a TypedValue, returns the corresponding HAsciiString - Standard_EXPORT void Value (Handle(Standard_Transient)& val) const; - - - - - DEFINE_STANDARD_RTTIEXT(MoniTool_Option,MMgt_TShared) - -protected: - - - - -private: - - - //! Returns the list of items, to be shared (to copy an option) - Standard_EXPORT Handle(Dico_DictionaryOfTransient) Items() const; - - TCollection_AsciiString thename; - Handle(Standard_Type) thetype; - Handle(MoniTool_TypedValue) thevalue; - Handle(Dico_DictionaryOfTransient) theitems; - TCollection_AsciiString thecase; - Handle(Standard_Transient) theval; - - -}; - - - - - - - -#endif // _MoniTool_Option_HeaderFile diff --git a/src/MoniTool/MoniTool_Profile.cxx b/src/MoniTool/MoniTool_Profile.cxx deleted file mode 100644 index 2071be16f0..0000000000 --- a/src/MoniTool/MoniTool_Profile.cxx +++ /dev/null @@ -1,338 +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 -#include -#include -#include -#include -#include -#include -#include -#include - -IMPLEMENT_STANDARD_RTTIEXT(MoniTool_Profile,MMgt_TShared) - -static Standard_Boolean IsCurrent (const Standard_CString name) -{ return (name[0] == '.' && name[1] == '\0'); } - - MoniTool_Profile::MoniTool_Profile () -{ - theopts = new Dico_DictionaryOfTransient; - theconfs = new Dico_DictionaryOfTransient; -// Current - Handle(Dico_DictionaryOfTransient) conf = new Dico_DictionaryOfTransient; - theconfs->SetItem (".",conf); - thecurname.AssignCat("."); - thecurconf = conf; -} - - void MoniTool_Profile::AddOption - (const Handle(MoniTool_Option)& option, - const Standard_CString name) -{ - if (option.IsNull()) return; - if (name[0] == '\0') theopts->SetItem (option->Name().ToCString(),option); - else theopts->SetItem (name,option); -} - - Handle(MoniTool_Option) MoniTool_Profile::Option - (const Standard_CString name) const -{ - Handle(MoniTool_Option) opt; - if (!theopts->GetItem (name,opt,Standard_True)) opt.Nullify(); - return opt; -} - - Handle(TColStd_HSequenceOfAsciiString) MoniTool_Profile::OptionList () const -{ - Handle(TColStd_HSequenceOfAsciiString) list = new TColStd_HSequenceOfAsciiString(); - Dico_IteratorOfDictionaryOfTransient iter(theopts); - for (; iter.More(); iter.Next()) list->Append (iter.Name()); - return list; -} - - Handle(TColStd_HSequenceOfAsciiString) MoniTool_Profile::TypedValueList () const -{ - Handle(TColStd_HSequenceOfAsciiString) list = new TColStd_HSequenceOfAsciiString(); - Dico_IteratorOfDictionaryOfTransient iter(theopts); - for (; iter.More(); iter.Next()) { - Handle(MoniTool_Option) opt = Handle(MoniTool_Option)::DownCast(iter.Value()); - if (!opt->TypedValue().IsNull()) list->Append (iter.Name()); - } - return list; -} - - void MoniTool_Profile::NewConf (const Standard_CString name) -{ - if (IsCurrent (name)) return; - Handle(Dico_DictionaryOfTransient) conf = new Dico_DictionaryOfTransient; - theconfs->SetItem (name,conf); -// thecurname.Clear(); thecurname.AssignCat (name); -// thecurconf = conf; -} - - void MoniTool_Profile::AddConf (const Standard_CString name) -{ - if (IsCurrent (name)) return; - Handle(Dico_DictionaryOfTransient) conf; - if (theconfs->GetItem (name,conf,Standard_False)) return; - conf = new Dico_DictionaryOfTransient; - theconfs->SetItem (name,conf); -// thecurname.Clear(); thecurname.AssignCat (name); -// thecurconf = conf; -} - - Standard_Boolean MoniTool_Profile::HasConf (const Standard_CString name) const - { return theconfs->HasItem (name,Standard_False); } - - Handle(TColStd_HSequenceOfAsciiString) MoniTool_Profile::ConfList () const -{ - Handle(TColStd_HSequenceOfAsciiString) list = new TColStd_HSequenceOfAsciiString(); - Dico_IteratorOfDictionaryOfTransient iter(theconfs); - for (; iter.More(); iter.Next()) list->Append (iter.Name()); - return list; -} - - Handle(Dico_DictionaryOfTransient) MoniTool_Profile::Conf - (const Standard_CString name) const -{ - Handle(Dico_DictionaryOfTransient) conf; - if (!theconfs->GetItem (name,conf,Standard_False)) conf.Nullify(); - return conf; -} - - - Standard_Boolean MoniTool_Profile::ClearConf - (const Standard_CString confname) -{ - Handle(Dico_DictionaryOfTransient) conf; - if (!theconfs->GetItem (confname,conf,Standard_False)) return Standard_False; - conf->Clear(); - return Standard_True; -} - - Standard_Boolean MoniTool_Profile::AddFromOtherConf - (const Standard_CString confname, const Standard_CString otherconf) -{ - Handle(Dico_DictionaryOfTransient) conf, other; - if (!theconfs->GetItem (confname,conf,Standard_False)) return Standard_False; - if (!theconfs->GetItem (otherconf,other,Standard_False)) return Standard_False; - if (conf == other) return Standard_True; - Dico_IteratorOfDictionaryOfTransient iter(other); - for (; iter.More(); iter.Next()) conf->SetItem (iter.Name(),iter.Value()); - return Standard_True; -} - - Standard_Boolean MoniTool_Profile::SetFromCurrent - (const Standard_CString confname) -{ - Handle(Dico_DictionaryOfTransient) conf; - if (!theconfs->GetItem (confname,conf,Standard_False)) return Standard_False; - Dico_IteratorOfDictionaryOfTransient iter(theopts); - for (; iter.More(); iter.Next()) { - TCollection_AsciiString name = iter.Name(); - TCollection_AsciiString cn = CaseName (name.ToCString()); - AddSwitch (name.ToCString(), cn.ToCString() ); - } - return Standard_True; -} - - - Standard_Boolean MoniTool_Profile::AddSwitch - (const Standard_CString confname, - const Standard_CString optname, - const Standard_CString casename) -{ - Handle(Dico_DictionaryOfTransient) conf = Conf (confname); - Handle(MoniTool_Option) opt = Option (optname); - if (conf.IsNull() || opt.IsNull()) return Standard_False; - Handle(TCollection_HAsciiString) sw = new TCollection_HAsciiString(casename); - if (casename[0] == '\0') sw = new TCollection_HAsciiString (opt->CaseName()); - Handle(Standard_Transient) val; - if (!opt->Item (sw->ToCString(),val)) return Standard_False; - conf->SetItem (optname,sw); - return Standard_True; -} - - Standard_Boolean MoniTool_Profile::RemoveSwitch - (const Standard_CString confname, - const Standard_CString optname) -{ - Handle(Dico_DictionaryOfTransient) conf = Conf (confname); - Handle(MoniTool_Option) opt = Option (optname); - if (conf.IsNull() || opt.IsNull()) return Standard_False; - conf->RemoveItem (optname,Standard_False,Standard_False); - return Standard_True; -} - - - void MoniTool_Profile::SwitchList - (const Standard_CString confname, - Handle(TColStd_HSequenceOfAsciiString)& optlist, - Handle(TColStd_HSequenceOfAsciiString)& caselist) const -{ - optlist = new TColStd_HSequenceOfAsciiString(); - caselist = new TColStd_HSequenceOfAsciiString(); - Handle(Dico_DictionaryOfTransient) conf = Conf (confname); - if (conf.IsNull()) return; - Dico_IteratorOfDictionaryOfTransient iter (conf); - for (; iter.More(); iter.Next()) { - TCollection_AsciiString optname = iter.Name(); - Handle(TCollection_HAsciiString) cn = - Handle(TCollection_HAsciiString)::DownCast(iter.Value()); - TCollection_AsciiString casename(cn->ToCString()); - optlist->Append(optname); - caselist->Append(casename); - } -} - - - Standard_Boolean MoniTool_Profile::SetCurrent - (const Standard_CString confname) -{ - if (!AddFromOtherConf (".",confname)) return Standard_False; - thecurname.Clear(); thecurname.AssignCat (confname); - return Standard_True; -} - - void MoniTool_Profile::RecordCurrent () -{ - Dico_IteratorOfDictionaryOfTransient iter(theconfs); - for (; iter.More(); iter.Next()) { - Handle(MoniTool_Option) opt = Option (iter.Name().ToCString()); - Handle(TCollection_HAsciiString) val = - Handle(TCollection_HAsciiString)::DownCast (iter.Value()); - if (!val.IsNull()) opt->Switch (val->ToCString()); - } -} - - const TCollection_AsciiString& MoniTool_Profile::Current () const - { return thecurname; } - - TCollection_AsciiString MoniTool_Profile::CaseName - (const Standard_CString optname, const Standard_Boolean proper) const -{ - TCollection_AsciiString cn; - Handle(TCollection_HAsciiString) sw; - if (thecurconf->GetItem (optname,sw,Standard_True)) { - cn.AssignCat (sw->ToCString()); - return cn; - } - if (proper) return cn; - Handle(MoniTool_Option) opt = Option (optname); - if (opt.IsNull()) return cn; - return opt->CaseName(); -} - - Handle(Standard_Transient) MoniTool_Profile::CaseValue - (const Standard_CString optname) const -{ - Handle(Standard_Transient) val; - Handle(MoniTool_Option) opt = Option (optname); - if (opt.IsNull()) return val; - - Handle(TCollection_HAsciiString) sw; - if (!thecurconf->GetItem (optname,sw,Standard_True)) sw.Nullify(); - - if (sw.IsNull()) return opt->CaseValue(); - if (!opt->Item (sw->ToCString(),val)) val.Nullify(); - return val; -} - - - Standard_Boolean MoniTool_Profile::Value - (const Standard_CString optname, - Handle(Standard_Transient)& val) const -{ - Handle(MoniTool_Option) opt = Option (optname); - if (opt.IsNull()) return Standard_False; - - Handle(TCollection_HAsciiString) sw; - if (!thecurconf->GetItem (optname,sw,Standard_True)) sw.Nullify(); - - if (sw.IsNull()) { opt->Value(val); return Standard_True; } - return opt->Item (sw->ToCString(),val); -} - - - void MoniTool_Profile::SetTypedValues - (const Standard_Boolean proper, const Standard_CString name) const -{ - Dico_IteratorOfDictionaryOfTransient iter(theopts,name); - for (; iter.More(); iter.Next()) { - Handle(MoniTool_Option) opt = Handle(MoniTool_Option)::DownCast(iter.Value()); - Handle(MoniTool_TypedValue) tv = opt->TypedValue(); - if (tv.IsNull()) continue; - -// On recherche la valeur: en conf courante, sinon dans l option (cf proper) - - Handle(TCollection_HAsciiString) sw, val; - if (!thecurconf->GetItem (name,sw,Standard_True)) sw.Nullify(); - Handle(Standard_Transient) aVal; - if (!sw.IsNull()) { - if (!opt->Item (sw->ToCString(),aVal)) - aVal.Nullify(); - } - if (aVal.IsNull() && !proper) - opt->Value(aVal); - val = Handle(TCollection_HAsciiString)::DownCast (aVal); - -// On applique - if (!val.IsNull()) tv->SetHStringValue (val); - - } -} - - void MoniTool_Profile::SetFast (const Standard_CString confname) -{ - Standard_Boolean cur = (confname[0] == '\0'); - thefastval = new Dico_DictionaryOfTransient; - Dico_IteratorOfDictionaryOfTransient iter(theopts); - for (; iter.More(); iter.Next()) { - Handle(MoniTool_Option) opt = Handle(MoniTool_Option)::DownCast(iter.Value()); - if (opt.IsNull()) continue; - Standard_Boolean iaopt = Standard_True; - TCollection_AsciiString optnam = iter.Name(); - Standard_CString optname = optnam.ToCString(); - Handle(Standard_Transient) val; - - if (cur) { - Handle(TCollection_HAsciiString) sw; - if (!thecurconf->GetItem (optname,sw,Standard_True)) sw.Nullify(); - - if (sw.IsNull()) opt->Value(val); - else iaopt = opt->Item (sw->ToCString(),val); - } - else iaopt = opt->Item (confname,val); - -// Now, recording - if (iaopt) thefastval->SetItem (optname,val); - } -} - - - void MoniTool_Profile::ClearFast () - { thefastval.Nullify(); } - - - Standard_Boolean MoniTool_Profile::FastValue - (const Standard_CString optname, - Handle(Standard_Transient)& val) const -{ - if (!thefastval.IsNull()) { - if (thefastval->GetItem (optname,val,Standard_True)) return Standard_True; - } - return Value (optname,val); -} diff --git a/src/MoniTool/MoniTool_Profile.hxx b/src/MoniTool/MoniTool_Profile.hxx deleted file mode 100644 index 66a4a80100..0000000000 --- a/src/MoniTool/MoniTool_Profile.hxx +++ /dev/null @@ -1,237 +0,0 @@ -// Created on: 1998-12-14 -// 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 _MoniTool_Profile_HeaderFile -#define _MoniTool_Profile_HeaderFile - -#include -#include - -#include -#include -#include -#include -#include -class Dico_DictionaryOfTransient; -class MoniTool_Option; -class TCollection_AsciiString; -class Standard_Transient; - - -class MoniTool_Profile; -DEFINE_STANDARD_HANDLE(MoniTool_Profile, MMgt_TShared) - -//! A Profile gives access to a set of options : -//! - it defines and gives access to options, by names specific -//! to this Profile, defaulted to basic names of the Options -//! - it records one or more Configurations, each of one is -//! identified by a name, and commands for each option a switch -//! value -//! - a Configuration may be partial, i.e. concern only a subset -//! of the complete list of options -//! - Values are accessed through a Current Configuration, which -//! name is fixed as ".", which can cumulate several -//! configurations (especially when they are partial) -//! -//! It may also bring a "fast" access to values, which has been -//! formerly computed from current configuration or another given -//! one. But its up-to-date status regarding existing -//! configurations is not checked : it may be recomputed or -//! cleared at any time. If not set, the current configuration -//! is then taken -class MoniTool_Profile : public MMgt_TShared -{ - -public: - - - //! Creates an empty Profile, with an empty Current Configuration - //! (named ".") - Standard_EXPORT MoniTool_Profile(); - - //! Adds an Option, with a Name, by default takes the Name of the - //! Option - Standard_EXPORT void AddOption (const Handle(MoniTool_Option)& option, const Standard_CString name = ""); - - //! Returns an Option from its Name. Null Handle if unknown - Standard_EXPORT Handle(MoniTool_Option) Option (const Standard_CString name) const; - - //! Returns the list of Option Names - Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) OptionList() const; - - //! Returns the list of Option Names which are defined on a - //! TypedValue/Static, i.e. for Basic Type - Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) TypedValueList() const; - - //! Adds a new Configuration, yet empty, then filled by AddSwitch - //! If already existed, it is replaced from scratch - //! While AddConf creates new Conf only if it does not yet exist - //! - //! Remark : the Current Configuration "." may not be changed - Standard_EXPORT void NewConf (const Standard_CString confname); - - //! Adds a new Configuration, yet empty, then filled by AddSwitch - //! If already existed, it is kept as it is - //! While NewConf restrts from scratch anyway - //! - //! Remark : the Current Configuration "." may not be changed - Standard_EXPORT void AddConf (const Standard_CString confname); - - //! Tells if is known as a Configuration - Standard_EXPORT Standard_Boolean HasConf (const Standard_CString confname) const; - - //! Returns the list of Configuration Names, including Current "." - Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) ConfList() const; - - //! Clears a configuration (does not remove it) - //! A cleared configuration has no effect, it can be reloaded - Standard_EXPORT Standard_Boolean ClearConf (const Standard_CString confname); - - //! Adds the definitions from the configuration to - //! those of - //! Returns True if done, False if confname or otherconf are unknown - Standard_EXPORT Standard_Boolean AddFromOtherConf (const Standard_CString confname, const Standard_CString otherconf); - - //! Sets the definitions of a configuration from the actual state - //! (current configuration plus current state of options for those - //! which are not recorded in current conf) - Standard_EXPORT Standard_Boolean SetFromCurrent (const Standard_CString confname); - - //! Adds to the Configuration , for the option - //! the command to switch it to - //! If is not given, records the actual current - //! CaseName of this Option - //! Returns True if done, False if or is - //! unknown, or not allowed for - Standard_EXPORT Standard_Boolean AddSwitch (const Standard_CString confname, const Standard_CString optname, const Standard_CString casename = ""); - - //! Removes from the Configuration , the switch for the - //! option . Hence, it will consider the basic default - //! switch for this option - //! Returns True if done or switch was not recorded, False if - //! or is unknown - Standard_EXPORT Standard_Boolean RemoveSwitch (const Standard_CString confname, const Standard_CString optname); - - //! Returns the list of switches properly concerned by a config : - //! two lists in parallel, lists the names of options - //! and for each one, gives the case for this config - Standard_EXPORT void SwitchList (const Standard_CString confname, Handle(TColStd_HSequenceOfAsciiString)& optlist, Handle(TColStd_HSequenceOfAsciiString)& caselist) const; - - //! Copies (Cumulates) the definition of to current - //! Records the current name as the last current setting - //! - //! Returns True if done, False (and does nothing> if - //! is not recorded as a Configuration - //! If no SetCurrent has been called, the last added one is taken - //! - //! Remark : SetCurrent is for the Profile : the individual - //! options are not switched themselves, they are only queried - //! To switch the options themselves, see below RecordCurrent - //! - //! Remark : for Options which are listed in the Profile but not - //! in the current Configuration, their current switch is taken - Standard_EXPORT Standard_Boolean SetCurrent (const Standard_CString confname); - - //! Records the switches of current configuration in the options - //! themselves - Standard_EXPORT void RecordCurrent(); - - //! Returns the name of last current configuration - Standard_EXPORT const TCollection_AsciiString& Current() const; - - //! Returns the selected case name of option in current - //! configuration - //! Empty String if unknown - //! - //! If is False (D), if is not recorded in the - //! current configuration, the own current name of the option - //! itself is taken - //! Else, an empty string is returned - Standard_EXPORT TCollection_AsciiString CaseName (const Standard_CString optname, const Standard_Boolean proper = Standard_False) const; - - //! Returns the Value of the switch selected for option - //! in current configuration - //! Null Handle if unknown - //! To be down-casted as needed before use - Standard_EXPORT Handle(Standard_Transient) CaseValue (const Standard_CString optname) const; - - //! Returns the Value of the switch selected for option - //! in current configuration - //! Returns True if done, False + Null Handle if unknown - //! This way of returning a Transient, bound with the Type Control - //! avoids DownCast and ensures the value is directly usable - Standard_EXPORT Standard_Boolean Value (const Standard_CString optname, Handle(Standard_Transient)& val) const; - - //! For the Options which are defined with a TypedValue/Static, - //! takes the value defined in current configuration, and sets - //! the TypedValue with it - //! - //! If is False (D), takes the current value, whatever - //! it is properly recorded in current configuration or not - //! If is True, sets the value only if it is properly - //! recorded in the current configuration - //! - //! By default, considers all the Options with a TypedValue - //! If is given, considers the Options of which the name - //! begins by - Standard_EXPORT void SetTypedValues (const Standard_Boolean proper = Standard_False, const Standard_CString name = "") const; - - //! Recomputes fast access from the definition of a configuration - //! By default, the current one - //! Else, a configuration identified by its name - Standard_EXPORT void SetFast (const Standard_CString confname = ""); - - //! Clears definitions of fast access - Standard_EXPORT void ClearFast(); - - //! Gets the value corresponding to Option , as fast - //! If not defined as fast, check "normal" access by calling Value - //! Returns True if OK (either Fast or normal), False if not found - //! (if not found, is returned Null Handle) - Standard_EXPORT Standard_Boolean FastValue (const Standard_CString optname, Handle(Standard_Transient)& val) const; - - - - - DEFINE_STANDARD_RTTIEXT(MoniTool_Profile,MMgt_TShared) - -protected: - - - - -private: - - - //! Internal - Standard_EXPORT Handle(Dico_DictionaryOfTransient) Conf (const Standard_CString confname) const; - - Handle(Dico_DictionaryOfTransient) theopts; - Handle(Dico_DictionaryOfTransient) theconfs; - TCollection_AsciiString thecurname; - Handle(Dico_DictionaryOfTransient) thecurconf; - Handle(Dico_DictionaryOfTransient) thefastval; - - -}; - - - - - - - -#endif // _MoniTool_Profile_HeaderFile diff --git a/src/QABugs/QABugs_11.cxx b/src/QABugs/QABugs_11.cxx index e3f18eeedb..5c7404a66b 100644 --- a/src/QABugs/QABugs_11.cxx +++ b/src/QABugs/QABugs_11.cxx @@ -4675,15 +4675,15 @@ static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer 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 @@ -4776,15 +4776,15 @@ static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer 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(); @@ -4854,10 +4854,10 @@ static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer 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()) { @@ -4875,7 +4875,7 @@ static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer nbt++; } } - thesession->MapReader()->SetProgress ( 0 ); + thesession->TransferReader()->TransientProcess()->SetProgress ( 0 ); progress->EndScope(); progress->Show(); di<<"Nb Shapes successfully produced : "<TransferReader(); - Handle(Transfer_TransientProcess) TP = TR->TransientProcess(); + const Handle(XSControl_TransferReader) &TR = Reader.WS()->TransferReader(); + const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess(); TP->Clear(); TR->Clear(2); Reader.WS()->Model()->Clear(); diff --git a/src/STEPCAFControl/STEPCAFControl_Controller.cxx b/src/STEPCAFControl/STEPCAFControl_Controller.cxx index d930938bd4..1b5d41463a 100644 --- a/src/STEPCAFControl/STEPCAFControl_Controller.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Controller.cxx @@ -29,7 +29,7 @@ IMPLEMENT_STANDARD_RTTIEXT(STEPCAFControl_Controller,STEPControl_Controller) STEPCAFControl_Controller::STEPCAFControl_Controller () { Handle(STEPCAFControl_ActorWrite) ActWrite = new STEPCAFControl_ActorWrite; - theAdaptorWrite = ActWrite; + myAdaptorWrite = ActWrite; } //======================================================================= diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index 9c1f24a8ca..6f16ac824f 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -531,7 +531,7 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader, STEPCAFControl_DataMapOfShapePD ShapePDMap; STEPCAFControl_DataMapOfPDExternFile PDFileMap; Handle(Interface_InterfaceModel) Model = reader.Model(); - Handle(Transfer_TransientProcess) TP = reader.WS()->TransferReader()->TransientProcess(); + const Handle(Transfer_TransientProcess) &TP = reader.WS()->TransferReader()->TransientProcess(); Standard_Integer nb = Model->NbEntities(); Handle(TColStd_HSequenceOfTransient) SeqPDS = new TColStd_HSequenceOfTransient; @@ -936,8 +936,6 @@ Standard_Boolean STEPCAFControl_Reader::ReadColors (const Handle(XSControl_WorkS // search for SR along model if (aSR.IsNull()) break; - Handle(XSControl_TransferReader) TR = WS->TransferReader(); - Handle(Transfer_TransientProcess) TP = TR->TransientProcess(); Interface_EntityIterator subs = WS->HGraph()->Graph().Sharings( aSR ); Handle(StepShape_ShapeDefinitionRepresentation) aSDR; for (subs.Start(); subs.More(); subs.Next()) { @@ -1134,9 +1132,9 @@ Standard_Boolean STEPCAFControl_Reader::ReadNames (const Handle(XSControl_WorkSe const XCAFDoc_DataMapOfShapeLabel &ShapeLabelMap) const { // get starting data - Handle(Interface_InterfaceModel) Model = WS->Model(); - Handle(XSControl_TransferReader) TR = WS->TransferReader(); - Handle(Transfer_TransientProcess) TP = TR->TransientProcess(); + const Handle(Interface_InterfaceModel) &Model = WS->Model(); + const Handle(XSControl_TransferReader) &TR = WS->TransferReader(); + const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess(); Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( Doc->Main() ); if ( STool.IsNull() ) return Standard_False; STEPConstruct_Tool Tool ( WS ); @@ -1243,9 +1241,8 @@ Standard_Boolean STEPCAFControl_Reader::ReadValProps (const Handle(XSControl_Wor const XCAFDoc_DataMapOfShapeLabel &ShapeLabelMap) const { // get starting data - Handle(Interface_InterfaceModel) Model = WS->Model(); - Handle(XSControl_TransferReader) TR = WS->TransferReader(); - Handle(Transfer_TransientProcess) TP = TR->TransientProcess(); + const Handle(XSControl_TransferReader) &TR = WS->TransferReader(); + const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess(); Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( Doc->Main() ); if ( STool.IsNull() ) return Standard_False; @@ -1374,9 +1371,9 @@ Standard_Boolean STEPCAFControl_Reader::ReadValProps (const Handle(XSControl_Wor Standard_Boolean STEPCAFControl_Reader::ReadLayers (const Handle(XSControl_WorkSession) &WS, Handle(TDocStd_Document)& Doc) const { - Handle(Interface_InterfaceModel) Model = WS->Model(); - Handle(XSControl_TransferReader) TR = WS->TransferReader(); - Handle(Transfer_TransientProcess) TP = TR->TransientProcess(); + const Handle(Interface_InterfaceModel) &Model = WS->Model(); + const Handle(XSControl_TransferReader) &TR = WS->TransferReader(); + const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess(); Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( Doc->Main() ); if ( STool.IsNull() ) return Standard_False; Handle(XCAFDoc_LayerTool) LTool = XCAFDoc_DocumentTool::LayerTool( Doc->Main() ); @@ -2063,8 +2060,8 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat, { Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool( theDoc->Main() ); Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() ); - Handle(XSControl_TransferReader) aTR = theWS->TransferReader(); - Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess(); + const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader(); + const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess(); const Interface_Graph& aGraph = aTP->Graph(); Handle(XCAFDoc_Datum) aDat; TDF_Label aShL; @@ -2296,8 +2293,8 @@ static Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt { Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool( theDoc->Main() ); Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() ); - Handle(XSControl_TransferReader) aTR = theWS->TransferReader(); - Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess(); + const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader(); + const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess(); const Interface_Graph& aGraph = aTP->Graph(); Interface_EntityIterator anIter = aGraph.Shareds(theEnt); @@ -2453,8 +2450,8 @@ static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt, Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool( theDoc->Main() ); Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() ); - Handle(XSControl_TransferReader) aTR = theWS->TransferReader(); - Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess(); + const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader(); + const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess(); const Interface_Graph& aGraph = aTP->Graph(); Standard_Boolean isAllAround = Standard_False; Standard_Boolean isAllOver = Standard_False; @@ -2881,8 +2878,8 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt, { Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool( theDoc->Main() ); Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() ); - Handle(XSControl_TransferReader) aTR = theWS->TransferReader(); - Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess(); + const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader(); + const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess(); const Interface_Graph& aGraph = aTP->Graph(); Handle(XCAFDimTolObjects_DimensionObject) aDimObj; if(!theEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalSize)) && @@ -3376,8 +3373,8 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt, { Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool( theDoc->Main() ); Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() ); - Handle(XSControl_TransferReader) aTR = theWS->TransferReader(); - Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess(); + const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader(); + const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess(); const Interface_Graph& aGraph = aTP->Graph(); Handle(XCAFDoc_GeomTolerance) aGTol; if(!theTolL.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGTol)) @@ -3529,15 +3526,13 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt, Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSession)& theWS, Handle(TDocStd_Document)& theDoc) const { - Handle(Interface_InterfaceModel) aModel = theWS->Model(); + const Handle(Interface_InterfaceModel) &aModel = theWS->Model(); Handle(StepData_StepModel) aSM = Handle(StepData_StepModel)::DownCast(aModel); Interface_EntityIterator anI = aSM->Header(); Handle(HeaderSection_FileSchema) aH; for(anI.Start(); anI.More() && aH.IsNull();anI.Next()) aH = Handle(HeaderSection_FileSchema)::DownCast(anI.Value()); Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool( theDoc->Main() ); - Handle(XSControl_TransferReader) aTR = theWS->TransferReader(); - Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess(); Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool( theDoc->Main() ); if ( aDGTTool.IsNull() ) return Standard_False; @@ -3611,10 +3606,9 @@ Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_Wor Handle(TDocStd_Document)& Doc, const Handle(TColStd_HSequenceOfTransient) &SeqPDS) const { - Handle(Interface_InterfaceModel) Model = WS->Model(); + const Handle(XSControl_TransferReader) &TR = WS->TransferReader(); + const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess(); Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( Doc->Main() ); - Handle(XSControl_TransferReader) TR = WS->TransferReader(); - Handle(Transfer_TransientProcess) TP = TR->TransientProcess(); Handle(XCAFDoc_MaterialTool) MatTool = XCAFDoc_DocumentTool::MaterialTool( Doc->Main() ); if(MatTool.IsNull()) return Standard_False; diff --git a/src/STEPCAFControl/STEPCAFControl_Writer.cxx b/src/STEPCAFControl/STEPCAFControl_Writer.cxx index 09aa5f3162..fc4ceb2405 100644 --- a/src/STEPCAFControl/STEPCAFControl_Writer.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Writer.cxx @@ -637,11 +637,10 @@ Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer, WriteMaterials(writer.WS(),sublabels); // register all MDGPRs in model + const Handle(Interface_InterfaceModel) &Model = writer.WS()->Model(); MoniTool_DataMapIteratorOfDataMapOfShapeTransient anItr(myMapCompMDGPR); - for (; anItr.More(); anItr.Next()) { - Handle(Interface_InterfaceModel) Model = writer.WS()->Model(); + for (; anItr.More(); anItr.Next()) Model->AddWithRefs( anItr.Value() ); - } } if ( multi ) { // external refs @@ -666,8 +665,8 @@ Standard_Boolean STEPCAFControl_Writer::Transfer (STEPControl_Writer &writer, if ( Interface_Static::IVal("write.stepcaf.subshapes.name") ) { - Handle(XSControl_TransferWriter) TW = this->ChangeWriter().WS()->TransferWriter(); - Handle(Transfer_FinderProcess) FP = TW->FinderProcess(); + const Handle(XSControl_TransferWriter) &TW = this->ChangeWriter().WS()->TransferWriter(); + const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess(); for ( int i = 1; i <= labels.Length(); i++ ) { @@ -803,8 +802,8 @@ Standard_Boolean STEPCAFControl_Writer::WriteExternRefs (const Handle(XSControl_ { if ( labels.Length() <=0 ) return Standard_False; - Handle(XSControl_TransferWriter) TW = WS->TransferWriter(); - Handle(Transfer_FinderProcess) FP = TW->FinderProcess(); + 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"); for ( Standard_Integer k=1; k <= labels.Length(); k++ ) { @@ -1255,8 +1254,8 @@ Standard_Boolean STEPCAFControl_Writer::WriteColors (const Handle(XSControl_Work } else { // create SDR and add to model. - Handle(XSControl_TransferWriter) TW = WS->TransferWriter(); - Handle(Transfer_FinderProcess) FP = TW->FinderProcess(); + const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter(); + const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess(); Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, S ); Handle(StepShape_ContextDependentShapeRepresentation) CDSR; if ( FP->FindTypedTransient(mapper, @@ -1330,11 +1329,8 @@ Standard_Boolean STEPCAFControl_Writer::WriteNames (const Handle(XSControl_WorkS if ( labels.Length() <=0 ) return Standard_False; // get working data - Handle(Interface_InterfaceModel) Model = WS->Model(); - Handle(XSControl_TransferWriter) TW = WS->TransferWriter(); - Handle(Transfer_FinderProcess) FP = TW->FinderProcess(); -// Handle(XCAFDoc_ShapeTool) STool = XCAFDoc_DocumentTool::ShapeTool( labels(1) ); -// if ( STool.IsNull() ) return Standard_False; + const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter(); + const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess(); // Iterate on requested shapes for ( Standard_Integer i=1; i <= labels.Length(); i++ ) { @@ -1547,9 +1543,9 @@ Standard_Boolean STEPCAFControl_Writer::WriteLayers (const Handle(XSControl_Work if ( labels.Length() <=0 ) return Standard_False; // get working data - Handle(Interface_InterfaceModel) Model = WS->Model(); - Handle(XSControl_TransferWriter) TW = WS->TransferWriter(); - Handle(Transfer_FinderProcess) FP = TW->FinderProcess(); + const Handle(Interface_InterfaceModel) &Model = WS->Model(); + const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter(); + const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess(); Handle(XCAFDoc_LayerTool) LTool = XCAFDoc_DocumentTool::LayerTool( labels(1) ); if (LTool.IsNull() ) return Standard_False; @@ -1682,8 +1678,8 @@ static Standard_Boolean getProDefinitionOfNAUO(const Handle(XSControl_WorkSessio if ( theShape.IsNull() ) return Standard_False; // get CDSR - Handle(XSControl_TransferWriter) TW = WS->TransferWriter(); - Handle(Transfer_FinderProcess) FP = TW->FinderProcess(); + const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter(); + const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess(); Handle(StepShape_ContextDependentShapeRepresentation) CDSR; Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, theShape ); if (!FP->FindTypedTransient(mapper, @@ -1852,8 +1848,8 @@ static Standard_Boolean createSHUOStyledItem (const XCAFPrs_Style& style, Handle(StepVisual_StyledItem) override; //null styled item // find the repr item of the shape - Handle(XSControl_TransferWriter) TW = WS->TransferWriter(); - Handle(Transfer_FinderProcess) FP = TW->FinderProcess(); + const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter(); + const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess(); Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper ( FP, Sh ); Handle(StepShape_ContextDependentShapeRepresentation) CDSR; FP->FindTypedTransient(mapper, @@ -1963,20 +1959,15 @@ Standard_Boolean STEPCAFControl_Writer::WriteSHUOs (const Handle(XSControl_WorkS if ( labels.Length() <=0 ) return Standard_False; // get working data - Handle(Interface_InterfaceModel) Model = WS->Model(); - Handle(XSControl_TransferWriter) TW = WS->TransferWriter(); - Handle(Transfer_FinderProcess) FP = TW->FinderProcess(); Handle(XCAFDoc_ColorTool) CTool = XCAFDoc_DocumentTool::ColorTool( labels(1) ); if (CTool.IsNull() ) return Standard_False; // map of transfered SHUO TColStd_MapOfTransient aMapOfMainSHUO; -// TColStd_IndexedDataMapOfTransientTransient aIndxMapOfSHUOEnt; // Iterate on requested shapes for ( Standard_Integer i=1; i <= labels.Length(); i++ ) { TDF_Label L = labels.Value(i); if ( ! myLabels.IsBound ( L ) ) continue; // not recorded as translated, skip -// TopoDS_Shape S = myLabels.Find ( L ); if ( XCAFDoc_ShapeTool::IsAssembly ( L ) ) { TDF_LabelSequence seq; XCAFDoc_ShapeTool::GetComponents ( L, seq ); @@ -2250,9 +2241,9 @@ static Handle(StepRepr_ShapeAspect) WriteShapeAspect (const Handle(XSControl_Wor Handle(StepAP242_GeometricItemSpecificUsage)& theGISU) { // Get working data - Handle(Interface_InterfaceModel) Model = WS->Model(); - Handle(XSControl_TransferWriter) TW = WS->TransferWriter(); - Handle(Transfer_FinderProcess) FP = TW->FinderProcess(); + const Handle(Interface_InterfaceModel) &Model = WS->Model(); + const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter(); + const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess(); const Handle(Interface_HGraph) aHGraph = WS->HGraph(); if (aHGraph.IsNull()) return NULL; @@ -2328,7 +2319,7 @@ static void WritePresentation(const Handle(XSControl_WorkSession) &WS, if (thePresentation.IsNull()) return; // Get working data - Handle(Interface_InterfaceModel) aModel = WS->Model(); + const Handle(Interface_InterfaceModel) &aModel = WS->Model(); // Presentation Handle(StepVisual_TessellatedGeometricSet) aGeomSet = STEPCAFControl_GDTProperty::GetTessellation(thePresentation); @@ -2399,9 +2390,9 @@ static Handle(StepDimTol_Datum) WriteDatumAP242(const Handle(XSControl_WorkSessi const Handle(StepDimTol_Datum) theWrittenDatum) { // Get working data - Handle(Interface_InterfaceModel) Model = WS->Model(); - Handle(XSControl_TransferWriter) TW = WS->TransferWriter(); - Handle(Transfer_FinderProcess) FP = TW->FinderProcess(); + const Handle(Interface_InterfaceModel) &Model = WS->Model(); + const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter(); + const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess(); const Handle(Interface_HGraph) aHGraph = WS->HGraph(); if (aHGraph.IsNull()) return NULL; @@ -2600,7 +2591,7 @@ static void WriteDimValues(const Handle(XSControl_WorkSession) &WS, const StepShape_DimensionalCharacteristic theDimension) { // Get working data - Handle(Interface_InterfaceModel) aModel = WS->Model(); + const Handle(Interface_InterfaceModel) &aModel = WS->Model(); XCAFDimTolObjects_DimensionModifiersSequence aModifiers = theObject->GetModifiers(); Handle(Standard_Transient) aDim = theDimension.Value(); Standard_Boolean isAngle = aDim->IsKind(STANDARD_TYPE(StepShape_AngularLocation)) || @@ -2806,7 +2797,7 @@ static Handle(StepDimTol_HArray1OfDatumSystemOrReference) WriteDatumSystem(const const Handle(StepRepr_RepresentationContext)& theRC) { // Get working data - Handle(Interface_InterfaceModel) Model = WS->Model(); + const Handle(Interface_InterfaceModel) &Model = WS->Model(); const Handle(Interface_HGraph) aHGraph = WS->HGraph(); if (aHGraph.IsNull()) return NULL; @@ -2979,7 +2970,7 @@ static void WriteToleranceZone (const Handle(XSControl_WorkSession) &WS, const Handle(StepRepr_RepresentationContext)& theRC) { // Get working data - Handle(Interface_InterfaceModel) Model = WS->Model(); + const Handle(Interface_InterfaceModel) &Model = WS->Model(); if (theEntity.IsNull() || theObject.IsNull()) return; @@ -3029,7 +3020,7 @@ static void WriteGeomTolerance (const Handle(XSControl_WorkSession) &WS, const Handle(StepRepr_RepresentationContext)& theRC) { // Get working data - Handle(Interface_InterfaceModel) Model = WS->Model(); + const Handle(Interface_InterfaceModel) &Model = WS->Model(); Handle(XCAFDoc_GeomTolerance) aGTAttr; if (!theGeomTolL.FindAttribute(XCAFDoc_GeomTolerance::GetID(), aGTAttr)) return; @@ -3209,9 +3200,9 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTs (const Handle(XSControl_WorkSe if ( labels.Length() <=0 ) return Standard_False; // get working data - Handle(Interface_InterfaceModel) Model = WS->Model(); - Handle(XSControl_TransferWriter) TW = WS->TransferWriter(); - Handle(Transfer_FinderProcess) FP = TW->FinderProcess(); + const Handle(Interface_InterfaceModel) &Model = WS->Model(); + const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter(); + const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess(); const Handle(Interface_HGraph) aHGraph = WS->HGraph(); if(aHGraph.IsNull()) @@ -3565,9 +3556,7 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W const TDF_LabelSequence &labels ) const { // Get working data - Handle(Interface_InterfaceModel) aModel = WS->Model(); - Handle(XSControl_TransferWriter) TW = WS->TransferWriter(); - Handle(Transfer_FinderProcess) FP = TW->FinderProcess(); + const Handle(Interface_InterfaceModel) &aModel = WS->Model(); const Handle(Interface_HGraph) aHGraph = WS->HGraph(); if(aHGraph.IsNull()) @@ -3833,9 +3822,9 @@ Standard_Boolean STEPCAFControl_Writer::WriteMaterials (const Handle(XSControl_W if ( labels.Length() <=0 ) return Standard_False; // get working data - Handle(Interface_InterfaceModel) Model = WS->Model(); - Handle(XSControl_TransferWriter) TW = WS->TransferWriter(); - Handle(Transfer_FinderProcess) FP = TW->FinderProcess(); + const Handle(Interface_InterfaceModel) &Model = WS->Model(); + const Handle(XSControl_TransferWriter) &TW = WS->TransferWriter(); + const Handle(Transfer_FinderProcess) &FP = TW->FinderProcess(); const Handle(Interface_HGraph) aHGraph = WS->HGraph(); if(aHGraph.IsNull()) diff --git a/src/STEPConstruct/STEPConstruct_Tool.cxx b/src/STEPConstruct/STEPConstruct_Tool.cxx index 41c3bc135a..06f9bfcefc 100644 --- a/src/STEPConstruct/STEPConstruct_Tool.cxx +++ b/src/STEPConstruct/STEPConstruct_Tool.cxx @@ -58,13 +58,12 @@ Standard_Boolean STEPConstruct_Tool::SetWS (const Handle(XSControl_WorkSession) myHGraph = myWS->HGraph(); // collect data on reading process - Handle(XSControl_TransferReader) TR = WS->TransferReader(); + const Handle(XSControl_TransferReader) &TR = WS->TransferReader(); if ( ! TR.IsNull() ) myTransientProcess = TR->TransientProcess(); // collect data on writing process - Handle(XSControl_TransferWriter) TW = myWS->TransferWriter(); + const Handle(XSControl_TransferWriter) &TW = myWS->TransferWriter(); if ( ! TW.IsNull() ) myFinderProcess = TW->FinderProcess(); return ! myTransientProcess.IsNull() && ! myFinderProcess.IsNull(); } - diff --git a/src/STEPControl/STEPControl_Controller.cxx b/src/STEPControl/STEPControl_Controller.cxx index b349335c12..4b3cbed3fb 100644 --- a/src/STEPControl/STEPControl_Controller.cxx +++ b/src/STEPControl/STEPControl_Controller.cxx @@ -25,8 +25,6 @@ #include #include #include -#include -#include #include #include #include @@ -56,10 +54,9 @@ IMPLEMENT_STANDARD_RTTIEXT(STEPControl_Controller,XSControl_Controller) -//#include // Pour NewModel et Write : definition de produit (temporaire ...) STEPControl_Controller::STEPControl_Controller () - : XSControl_Controller ("STEP", "step") +: XSControl_Controller ("STEP", "step") { static Standard_Boolean init = Standard_False; if (!init) { @@ -199,14 +196,13 @@ STEPControl_Controller::STEPControl_Controller () Handle(STEPControl_ActorWrite) ActWrite = new STEPControl_ActorWrite; ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly")); - theAdaptorWrite = ActWrite; + myAdaptorWrite = ActWrite; Handle(StepSelect_WorkLibrary) swl = new StepSelect_WorkLibrary; swl->SetDumpLabel(1); - theAdaptorLibrary = swl; - theAdaptorProtocol = STEPEdit::Protocol(); -// theAdaptorProtocol = StepAP214::Protocol(); - theAdaptorRead = new STEPControl_ActorRead; // par ex pour Recognize + myAdaptorLibrary = swl; + myAdaptorProtocol = STEPEdit::Protocol(); + myAdaptorRead = new STEPControl_ActorRead; // par ex pour Recognize SetModeWrite (0,4); SetModeWriteHelp (0,"As Is"); @@ -216,21 +212,20 @@ STEPControl_Controller::STEPControl_Controller () SetModeWriteHelp (4,"Wireframe"); TraceStatic ("read.surfacecurve.mode",5); -// --- SELECTIONS, SIGNATURES, COMPTEURS, EDITEURS + // --- 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); + Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(sty,Standard_False,Standard_True); AddSessionItem (tys,"step-types"); - theSignType = sty; + //szv:mySignType = sty; //pdn S4133 18.02.99 - Handle(IFSelect_SignAncestor)sta = new IFSelect_SignAncestor(); - AddSessionItem (sta,"xst-derived"); + AddSessionItem (new IFSelect_SignAncestor(),"xst-derived"); + Handle(STEPSelections_SelectDerived) stdvar = new STEPSelections_SelectDerived(); stdvar->SetProtocol(STEPEdit::Protocol()); AddSessionItem (stdvar,"step-derived"); @@ -238,12 +233,10 @@ STEPControl_Controller::STEPControl_Controller () Handle(IFSelect_SelectSignature) selsdr = STEPEdit::NewSelectSDR(); selsdr->SetInput (xmr); AddSessionItem (selsdr,"step-shape-def-repr"); - Handle(IFSelect_SelectSignature) selrrs = STEPEdit::NewSelectPlacedItem(); -// selrrs->SetInput (xmr); deja prete avec ModelAll - AddSessionItem (selrrs,"step-placed-items"); - Handle(IFSelect_SelectSignature) selsr = STEPEdit::NewSelectShapeRepr(); -// input deja pret avec ModelAll - AddSessionItem (selsr,"step-shape-repr"); + + AddSessionItem (STEPEdit::NewSelectPlacedItem(),"step-placed-items"); + // input deja pret avec ModelAll + AddSessionItem (STEPEdit::NewSelectShapeRepr(),"step-shape-repr"); } //pdn @@ -277,33 +270,6 @@ STEPControl_Controller::STEPControl_Controller () Handle(IFSelect_EditForm) edsdrf = new IFSelect_EditForm (edsdr,Standard_False,Standard_True,"STEP Product Data (SDR)"); AddSessionItem (edsdr,"step-SDR-edit"); AddSessionItem (edsdrf,"step-SDR-data"); - -// #### PROFILE #### - -// ActorRead : on ajoute le cas Shape possible, a part du default -// ainsi, on l a tjrs sous la main - Handle(MoniTool_Option) optacrd = Profile()->Option("tr-read"); - optacrd->Add ("shape",theAdaptorRead); - -// ActorWrite : on ajoute les cas possibles (NB : shape == default) -// On garde a part les cas shape compound (= shape traitee globale ou en -// assembly), peuvent etre utiles. Tandis que les autres cas sont -// susceptibles d etre remplaces si on fait du Model-Editor - Handle(MoniTool_Option) optacwr = Profile()->Option("tr-write"); - Handle(STEPControl_ActorWrite) ActWSh = new STEPControl_ActorWrite; - ActWSh->SetGroupMode(0); - optacwr->Add ("shape",ActWSh); - Handle(STEPControl_ActorWrite) ActWA1 = new STEPControl_ActorWrite; - ActWA1->SetGroupMode(1); - optacwr->Add ("compound",ActWA1); - optacwr->Add ("assembly",ActWA1); - optacwr->Add ("SRWT",ActWA1); - - Profile()->AddConf ("Shape"); - Profile()->AddSwitch ("Shape","tr-write","shape"); - - Profile()->AddConf ("Assembly"); - Profile()->AddSwitch ("Assembly","tr-write","SRWT"); } Handle(Interface_InterfaceModel) STEPControl_Controller::NewModel () const @@ -311,12 +277,6 @@ Handle(Interface_InterfaceModel) STEPControl_Controller::NewModel () const return STEPEdit::NewModel(); } -Handle(Transfer_ActorOfTransientProcess) STEPControl_Controller::ActorRead - (const Handle(Interface_InterfaceModel)& ) const -{ - return theAdaptorRead; -} // new Cc1ToTopoDSAct_Actor ?? - // #### PROVISOIRE ??? #### IFSelect_ReturnStatus STEPControl_Controller::TransferWriteShape @@ -327,7 +287,7 @@ IFSelect_ReturnStatus STEPControl_Controller::TransferWriteShape { if (modeshape < 0 || modeshape > 4) return IFSelect_RetError; Handle(STEPControl_ActorWrite) ActWrite = - Handle(STEPControl_ActorWrite)::DownCast(theAdaptorWrite); + Handle(STEPControl_ActorWrite)::DownCast(myAdaptorWrite); // A PRESENT ON PASSE PAR LE PROFILE if (!ActWrite.IsNull()) ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly")); @@ -351,9 +311,10 @@ Standard_Boolean STEPControl_Controller::Init () //purpose : //======================================================================= - void STEPControl_Controller::Customise(Handle(XSControl_WorkSession)& WS) +void STEPControl_Controller::Customise(Handle(XSControl_WorkSession)& WS) { XSControl_Controller::Customise(WS); + Handle(IFSelect_SelectModelRoots) slr; Handle(Standard_Transient) slr1 = WS->NamedItem("xst-model-roots"); if(!slr1.IsNull()) @@ -362,27 +323,23 @@ Standard_Boolean STEPControl_Controller::Init () slr = new IFSelect_SelectModelRoots; WS->AddNamedItem ("xst-model-roots",slr); } - - + Handle(STEPSelections_SelectForTransfer) st1= new STEPSelections_SelectForTransfer; st1->SetReader (WS->TransferReader()); WS->AddNamedItem ("xst-transferrable-roots",st1); - - - //DeclareAndCast(IFSelect_Selection,xmr,SessionItem("xst-model-roots")); + if (!slr.IsNull()) { Handle(IFSelect_Signature) sty = STEPEdit::SignType(); WS->AddNamedItem ("step-type",sty); - Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter - (sty,Standard_False,Standard_True); + Handle(IFSelect_SignCounter) tys = new IFSelect_SignCounter(sty,Standard_False,Standard_True); WS->AddNamedItem ("step-types",tys); - theSignType = sty; + //szv:mySignType = sty; + WS->SetSignType( sty ); //pdn S4133 18.02.99 - Handle(IFSelect_SignAncestor)sta = new IFSelect_SignAncestor(); - WS->AddNamedItem ("xst-derived",sta); + WS->AddNamedItem ("xst-derived",new IFSelect_SignAncestor()); Handle(STEPSelections_SelectDerived) stdvar = new STEPSelections_SelectDerived(); stdvar->SetProtocol(STEPEdit::Protocol()); WS->AddNamedItem ("step-derived",stdvar); @@ -391,10 +348,9 @@ Standard_Boolean STEPControl_Controller::Init () selsdr->SetInput (slr); WS->AddNamedItem ("step-shape-def-repr",selsdr); Handle(IFSelect_SelectSignature) selrrs = STEPEdit::NewSelectPlacedItem(); -// selrrs->SetInput (slr); deja prete avec ModelAll WS->AddNamedItem ("step-placed-items",selrrs); Handle(IFSelect_SelectSignature) selsr = STEPEdit::NewSelectShapeRepr(); -// input deja pret avec ModelAll + // input deja pret avec ModelAll WS->AddNamedItem ("step-shape-repr",selsr); } diff --git a/src/STEPControl/STEPControl_Controller.hxx b/src/STEPControl/STEPControl_Controller.hxx index 973d7c7aef..454a35987f 100644 --- a/src/STEPControl/STEPControl_Controller.hxx +++ b/src/STEPControl/STEPControl_Controller.hxx @@ -49,10 +49,6 @@ public: //! It is taken from STEP Template Model Standard_EXPORT Handle(Interface_InterfaceModel) NewModel() const Standard_OVERRIDE; - //! Returns a new Actor for Read attached to the pair (norm,appli) - //! It is a PmsToTopoDSAct_Actor - Standard_EXPORT Handle(Transfer_ActorOfTransientProcess) ActorRead (const Handle(Interface_InterfaceModel)& model) const Standard_OVERRIDE; - Standard_EXPORT virtual void Customise (Handle(XSControl_WorkSession)& WS) Standard_OVERRIDE; //! Takes one Shape and transfers it to the InterfaceModel diff --git a/src/STEPControl/STEPControl_Reader.cxx b/src/STEPControl/STEPControl_Reader.cxx index eb7d5e6eed..c2d3032267 100644 --- a/src/STEPControl/STEPControl_Reader.cxx +++ b/src/STEPControl/STEPControl_Reader.cxx @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -198,7 +197,7 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer() //} if (IsRoot) { theroots.Append(ent); - WS()->MapReader()->RootsForTransfer()->Append(ent); + WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent); } } TCollection_AsciiString aProdMode = Interface_Static::CVal("read.step.product.mode"); @@ -232,7 +231,7 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer() } if(IsRoot) { theroots.Append(ent); - WS()->MapReader()->RootsForTransfer()->Append(ent); + WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent); } } if(ent->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation))) { @@ -285,7 +284,7 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer() } if(IsRoot) { theroots.Append(ent); - WS()->MapReader()->RootsForTransfer()->Append(ent); + WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent); } } } @@ -390,7 +389,7 @@ void STEPControl_Reader::FileUnits( TColStd_SequenceOfAsciiString& theUnitLength //for case when units was not found through PDF or SDR if(theUnitLengthNames.IsEmpty()) { - Handle(Interface_InterfaceModel) aModel = WS()->Model(); + const Handle(Interface_InterfaceModel) &aModel = WS()->Model(); if(aModel.IsNull()) return; Standard_Integer nb = aModel->NbEntities(); diff --git a/src/STEPControl/STEPControl_Writer.cxx b/src/STEPControl/STEPControl_Writer.cxx index ecc6ad9566..fd6e09a744 100644 --- a/src/STEPControl/STEPControl_Writer.cxx +++ b/src/STEPControl/STEPControl_Writer.cxx @@ -134,11 +134,10 @@ IFSelect_ReturnStatus STEPControl_Writer::Transfer default : break; } if (mws < 0) return IFSelect_RetError; // cas non reconnu - thesession->SetModeWriteShape (mws); + thesession->TransferWriter()->SetTransferMode (mws); // for progress indicator. - Handle(Message_ProgressIndicator) progress = - WS()->TransferWriter()->FinderProcess()->GetProgress(); + Handle(Message_ProgressIndicator) progress = WS()->TransferWriter()->FinderProcess()->GetProgress(); if ( ! progress.IsNull() ) { Standard_Integer nbfaces=0; for( TopExp_Explorer exp(sh, TopAbs_FACE); exp.More(); exp.Next()) nbfaces++; diff --git a/src/XSControl/XSControl_Controller.cxx b/src/XSControl/XSControl_Controller.cxx index cc9e0b516f..0eae54e9f1 100644 --- a/src/XSControl/XSControl_Controller.cxx +++ b/src/XSControl/XSControl_Controller.cxx @@ -44,8 +44,6 @@ #include #include #include -#include -#include #include #include #include @@ -71,283 +69,182 @@ IMPLEMENT_STANDARD_RTTIEXT(XSControl_Controller,MMgt_TShared) // ParamEditor // Transferts -static Handle(Dico_DictionaryOfTransient)& listadapt() +static const Handle(Dico_DictionaryOfTransient)& listadapt() { static Handle(Dico_DictionaryOfTransient) listad; if (listad.IsNull()) listad = new Dico_DictionaryOfTransient; return listad; } -static TColStd_IndexedMapOfTransient& mapadapt() +//======================================================================= +//function : XSControl_Controller +//purpose : Constructor +//======================================================================= + +XSControl_Controller::XSControl_Controller (const Standard_CString theLongName, const Standard_CString theShortName) +: myShortName(theShortName), myLongName(theLongName) { - static TColStd_IndexedMapOfTransient mapad; - return mapad; -} - - - XSControl_Controller::XSControl_Controller - (const Standard_CString longname, const Standard_CString shortname) - : theShortName (shortname) , theLongName (longname) -{ - theAdaptorApplied.Clear(); - theAdaptorHooks = new TColStd_HSequenceOfHAsciiString(); - - // Parametres Standard - + // Standard parameters Interface_Static::Standards(); -// TraceStatic ("read.stdsameparameter.mode",5); TraceStatic ("read.precision.mode" , 5); TraceStatic ("read.precision.val" , 5); TraceStatic ("write.precision.mode" , 6); TraceStatic ("write.precision.val" , 6); - - // Initialisation du Profile - - theProfile = new MoniTool_Profile; - -/* essai option sur parametre - Handle(MoniTool_Option) optrdprec = new MoniTool_Option - (Interface_Static::Static ("read.precision.mode"),"readprecision.mode"); - optrdprec->AddBasic("default","File"); - optrdprec->AddBasic("Session"); - optrdprec->Switch ("default"); - theProfile->AddOption (optrdprec); -*/ - -// Handle(MoniTool_Option) optproto = new MoniTool_Option -// (STANDARD_TYPE(Interface_Protocol),"protocol"); -// theProfile->AddOption (optproto); - - Handle(MoniTool_Option) optsign = new MoniTool_Option - (STANDARD_TYPE(IFSelect_Signature),"sign-type"); - optsign->Add ("default",theSignType); - theProfile->AddOption (optsign); - -// Handle(MoniTool_Option) optwlib = new MoniTool_Option -// (STANDARD_TYPE(IFSelect_WorkLibrary),"access"); -// theProfile->AddOption (optwlib); - - Handle(MoniTool_Option) optactrd = new MoniTool_Option - (STANDARD_TYPE(Transfer_ActorOfTransientProcess),"tr-read"); - theProfile->AddOption (optactrd); - - Handle(MoniTool_Option) optactwr = new MoniTool_Option - (STANDARD_TYPE(Transfer_ActorOfFinderProcess),"tr-write"); - theProfile->AddOption (optactwr); - -// Definition de la config de base : suite a la customisation } - void XSControl_Controller::SetNames - (const Standard_CString longname, const Standard_CString shortname) +//======================================================================= +//function : TraceStatic +//purpose : +//======================================================================= + +void XSControl_Controller::TraceStatic (const Standard_CString theName, const Standard_Integer theUse) { - if (longname && longname[0] != '\0') { - theLongName.Clear(); theLongName.AssignCat (longname); + Handle(Interface_Static) val = Interface_Static::Static(theName); + if (val.IsNull()) return; + myParams.Append (val); + myParamUses.Append(theUse); +} + +//======================================================================= +//function : SetNames +//purpose : +//======================================================================= + +void XSControl_Controller::SetNames (const Standard_CString theLongName, const Standard_CString theShortName) +{ + if (theLongName && theLongName[0] != '\0') { + myLongName.Clear(); myLongName.AssignCat (theLongName); } - if (shortname && shortname[0] != '\0') { - theShortName.Clear(); theShortName.AssignCat (shortname); + if (theShortName && theShortName[0] != '\0') { + myShortName.Clear(); myShortName.AssignCat(theShortName); } } - void XSControl_Controller::AutoRecord () const -{ - Record (Name(Standard_True)); - Record (Name(Standard_False)); -} +//======================================================================= +//function : Record +//purpose : +//======================================================================= - void XSControl_Controller::Record (const Standard_CString name) const +void XSControl_Controller::Record (const Standard_CString theName) const { - Standard_Boolean deja; - Handle(Standard_Transient)& newadapt = listadapt()->NewItem (name,deja); - if (deja) { + Standard_Boolean isAlreadyRegistered = Standard_False; + Handle(Standard_Transient)& newadapt = listadapt()->NewItem(theName,isAlreadyRegistered); + if (isAlreadyRegistered) { Handle(Standard_Transient) thisadapt (this); - if (newadapt->IsKind(thisadapt->DynamicType())) - { - } - else if (thisadapt->IsKind(newadapt->DynamicType())) - { - newadapt = this; - if (mapadapt().FindIndex(newadapt) == 0) mapadapt().Add(newadapt); - } - else - if (thisadapt != newadapt) Standard_DomainError::Raise - ("XSControl_Controller : Record"); - } - else { - newadapt = this; - if (mapadapt().FindIndex(newadapt) == 0) mapadapt().Add(newadapt); + if (newadapt->IsKind(thisadapt->DynamicType())) + return; + if (!(thisadapt->IsKind(newadapt->DynamicType())) && thisadapt != newadapt) + Standard_DomainError::Raise("XSControl_Controller : Record"); } + newadapt = this; } - Handle(XSControl_Controller) XSControl_Controller::Recorded - (const Standard_CString name) +//======================================================================= +//function : Recorded +//purpose : +//======================================================================= + +Handle(XSControl_Controller) XSControl_Controller::Recorded (const Standard_CString theName) { Handle(Standard_Transient) recorded; - if (!listadapt()->GetItem (name,recorded)) recorded.Nullify(); - return Handle(XSControl_Controller)::DownCast (recorded); + return (listadapt()->GetItem(theName,recorded)? + Handle(XSControl_Controller)::DownCast(recorded) : + Handle(XSControl_Controller)()); } - Handle(TColStd_HSequenceOfHAsciiString) XSControl_Controller::ListRecorded - (const Standard_Integer mode) -{ - Handle(TColStd_HSequenceOfHAsciiString) list = new TColStd_HSequenceOfHAsciiString(); - if (mode == 0) { - Dico_IteratorOfDictionaryOfTransient iter (listadapt()); - for (; iter.More(); iter.Next()) { - Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString - (iter.Name()); - list->Append(name); - } - } else { - Standard_Integer i, nb = mapadapt().Extent(); - for (i = 1; i <= nb; i ++) { - DeclareAndCast(XSControl_Controller,ctl,mapadapt().FindKey(i)); - if (ctl.IsNull()) continue; - Handle(TCollection_HAsciiString) name = new TCollection_HAsciiString - (ctl->Name( (mode < 0) )); - list->Append(name); - } - } - return list; -} - - Standard_CString XSControl_Controller::Name (const Standard_Boolean rsc) const - { return (rsc ? theShortName.ToCString() : theLongName.ToCString()); } - -// #### PROFILE #### - - Handle(MoniTool_Profile) XSControl_Controller::Profile () const - { return theProfile; } - - void XSControl_Controller::DefineProfile - (const Standard_CString confname) -{ - if (!theProfile->HasConf(confname)) theProfile->AddConf (confname); - theProfile->SetFromCurrent (confname); -} - - Standard_Boolean XSControl_Controller::SetProfile - (const Standard_CString confname) -{ - if (!theProfile->SetCurrent (confname)) return Standard_False; - - Handle(Standard_Transient) anItem; -// theProfile->Value("protocol",theAdaptorProtocol); - if (theProfile->Value("sign-type",anItem)) - theSignType = Handle(IFSelect_Signature)::DownCast (anItem); -// theProfile->Value("access",theAdaptorLibrary); - if (theProfile->Value("tr-read",anItem)) - theAdaptorRead = Handle(Transfer_ActorOfTransientProcess)::DownCast (anItem); - if (theProfile->Value("tr-write",anItem)) - theAdaptorWrite = Handle(Transfer_ActorOfFinderProcess)::DownCast (anItem); - - return SettingProfile (confname); -} - - Standard_Boolean XSControl_Controller::SettingProfile - (const Standard_CString ) - { return Standard_True; } - - Standard_Boolean XSControl_Controller::ApplyProfile - (const Handle(XSControl_WorkSession)& WS, const Standard_CString confname) -{ - if (!SetProfile (confname)) return Standard_False; - -// Typed Values : toutes - - theProfile->SetTypedValues(); - -// SignType - Handle(Standard_Transient) signtype; - theProfile->Value ("sign-type",signtype); - WS->SetSignType (Handle(IFSelect_Signature)::DownCast (signtype)); - -// ActorRead - - Handle(Standard_Transient) actrd; - theProfile->Value ("tr-read",actrd); - WS->TransferReader()->SetActor (Handle(Transfer_ActorOfTransientProcess)::DownCast (actrd)); - -// ActorWrite : dans le Controller meme - - Handle(Standard_Transient) actwr; - theProfile->Value ("tr-write",actwr); - theAdaptorWrite = Handle (Transfer_ActorOfFinderProcess)::DownCast (actwr); - - return ApplyingProfile (WS,confname); -} - - Standard_Boolean XSControl_Controller::ApplyingProfile - (const Handle(XSControl_WorkSession)& , const Standard_CString ) - { return Standard_True; } - // #### DEFINITION #### - Handle(Interface_Protocol) XSControl_Controller::Protocol () const - { return theAdaptorProtocol; } +//======================================================================= +//function : ActorRead +//purpose : +//======================================================================= - Handle(IFSelect_Signature) XSControl_Controller::SignType () const - { return theSignType; } +Handle(Transfer_ActorOfTransientProcess) XSControl_Controller::ActorRead (const Handle(Interface_InterfaceModel)&) const +{ + return myAdaptorRead; +} - Handle(IFSelect_WorkLibrary) XSControl_Controller::WorkLibrary () const - { return theAdaptorLibrary; } +//======================================================================= +//function : ActorWrite +//purpose : +//======================================================================= - Handle(Transfer_ActorOfFinderProcess) XSControl_Controller::ActorWrite () const - { return theAdaptorWrite; } - - void XSControl_Controller::UpdateStatics - (const Standard_Integer, const Standard_CString ) const - { } // a redefinir si besoin +Handle(Transfer_ActorOfFinderProcess) XSControl_Controller::ActorWrite () const +{ + return myAdaptorWrite; +} // ########################### // Help du Transfer : controle de valeur + help - void XSControl_Controller::SetModeWrite - (const Standard_Integer modemin, const Standard_Integer modemax, - const Standard_Boolean ) +//======================================================================= +//function : SetModeWrite +//purpose : +//======================================================================= + +void XSControl_Controller::SetModeWrite + (const Standard_Integer modemin, const Standard_Integer modemax, const Standard_Boolean ) { - if (modemin > modemax) { theModeWriteShapeN.Nullify(); return; } - theModeWriteShapeN = new Interface_HArray1OfHAsciiString (modemin,modemax); + if (modemin > modemax) { myModeWriteShapeN.Nullify(); return; } + myModeWriteShapeN = new Interface_HArray1OfHAsciiString (modemin,modemax); } - void XSControl_Controller::SetModeWriteHelp - (const Standard_Integer modetrans, const Standard_CString help, - const Standard_Boolean ) +//======================================================================= +//function : SetModeWriteHelp +//purpose : +//======================================================================= + +void XSControl_Controller::SetModeWriteHelp + (const Standard_Integer modetrans, const Standard_CString help, const Standard_Boolean ) { - if (theModeWriteShapeN.IsNull()) return; - if (modetrans < theModeWriteShapeN->Lower() || - modetrans > theModeWriteShapeN->Upper()) return; + if (myModeWriteShapeN.IsNull()) return; + if (modetrans < myModeWriteShapeN->Lower() || + modetrans > myModeWriteShapeN->Upper()) return; Handle(TCollection_HAsciiString) hl = new TCollection_HAsciiString (help); - theModeWriteShapeN->SetValue (modetrans,hl); + myModeWriteShapeN->SetValue (modetrans,hl); } - Standard_Boolean XSControl_Controller::ModeWriteBounds - (Standard_Integer& modemin, Standard_Integer& modemax, - const Standard_Boolean ) const +//======================================================================= +//function : ModeWriteBounds +//purpose : +//======================================================================= + +Standard_Boolean XSControl_Controller::ModeWriteBounds + (Standard_Integer& modemin, Standard_Integer& modemax, const Standard_Boolean ) const { modemin = modemax = 0; - if (theModeWriteShapeN.IsNull()) return Standard_False; - modemin = theModeWriteShapeN->Lower(); - modemax = theModeWriteShapeN->Upper(); + if (myModeWriteShapeN.IsNull()) return Standard_False; + modemin = myModeWriteShapeN->Lower(); + modemax = myModeWriteShapeN->Upper(); return Standard_True; } - Standard_Boolean XSControl_Controller::IsModeWrite +//======================================================================= +//function : IsModeWrite +//purpose : +//======================================================================= + +Standard_Boolean XSControl_Controller::IsModeWrite (const Standard_Integer modetrans, const Standard_Boolean ) const { - if (theModeWriteShapeN.IsNull()) return Standard_True; - if (modetrans < theModeWriteShapeN->Lower()) return Standard_False; - if (modetrans > theModeWriteShapeN->Upper()) return Standard_False; + if (myModeWriteShapeN.IsNull()) return Standard_True; + if (modetrans < myModeWriteShapeN->Lower()) return Standard_False; + if (modetrans > myModeWriteShapeN->Upper()) return Standard_False; return Standard_True; } - Standard_CString XSControl_Controller::ModeWriteHelp +//======================================================================= +//function : ModeWriteHelp +//purpose : +//======================================================================= + +Standard_CString XSControl_Controller::ModeWriteHelp (const Standard_Integer modetrans, const Standard_Boolean ) const { - if (theModeWriteShapeN.IsNull()) return ""; - if (modetrans < theModeWriteShapeN->Lower()) return ""; - if (modetrans > theModeWriteShapeN->Upper()) return ""; - Handle(TCollection_HAsciiString) str = theModeWriteShapeN->Value(modetrans); + if (myModeWriteShapeN.IsNull()) return ""; + if (modetrans < myModeWriteShapeN->Lower()) return ""; + if (modetrans > myModeWriteShapeN->Upper()) return ""; + Handle(TCollection_HAsciiString) str = myModeWriteShapeN->Value(modetrans); if (str.IsNull()) return ""; return str->ToCString(); } @@ -357,41 +254,49 @@ static TColStd_IndexedMapOfTransient& mapadapt() // Transfer : on fait ce qu il faut par defaut (avec ActorWrite) // peut etre redefini ... - Standard_Boolean XSControl_Controller::RecognizeWriteTransient +//======================================================================= +//function : RecognizeWriteTransient +//purpose : +//======================================================================= + +Standard_Boolean XSControl_Controller::RecognizeWriteTransient (const Handle(Standard_Transient)& obj, const Standard_Integer modetrans) const { - if (theAdaptorWrite.IsNull()) return Standard_False; - theAdaptorWrite->ModeTrans() = modetrans; - return theAdaptorWrite->Recognize (new Transfer_TransientMapper(obj)); + if (myAdaptorWrite.IsNull()) return Standard_False; + myAdaptorWrite->ModeTrans() = modetrans; + return myAdaptorWrite->Recognize (new Transfer_TransientMapper(obj)); } -// Fonction interne +//======================================================================= +//function : TransferFinder +//purpose : internal function +//======================================================================= static IFSelect_ReturnStatus TransferFinder - (const Handle(Transfer_ActorOfFinderProcess)& actor, - const Handle(Transfer_Finder)& mapper, - const Handle(Transfer_FinderProcess)& FP, - const Handle(Interface_InterfaceModel)& model, - const Standard_Integer modetrans) + (const Handle(Transfer_ActorOfFinderProcess)& theActor, + const Handle(Transfer_Finder)& theMapper, + const Handle(Transfer_FinderProcess)& theFP, + const Handle(Interface_InterfaceModel)& theModel, + const Standard_Integer theModeTrans) { - if (actor.IsNull()) return IFSelect_RetError; - if (model.IsNull()) return IFSelect_RetError; - actor->ModeTrans() = modetrans; - FP->SetModel (model); - FP->SetActor (actor); - FP->Transfer (mapper); + if (theActor.IsNull()) return IFSelect_RetError; + if (theModel.IsNull()) return IFSelect_RetError; + theActor->ModeTrans() = theModeTrans; + theFP->SetModel (theModel); + theFP->SetActor (theActor); + theFP->Transfer (theMapper); IFSelect_ReturnStatus stat = IFSelect_RetFail; - Handle(Transfer_Binder) binder = FP->Find (mapper); + Handle(Transfer_Binder) binder = theFP->Find (theMapper); Handle(Transfer_SimpleBinderOfTransient) bindtr; while (!binder.IsNull()) { bindtr = Handle(Transfer_SimpleBinderOfTransient)::DownCast (binder); if (!bindtr.IsNull()) { Handle(Standard_Transient) ent = bindtr->Result(); if (!ent.IsNull()) { - stat = IFSelect_RetDone; - model->AddWithRefs (ent); + stat = IFSelect_RetDone; + theModel->AddWithRefs (ent); } } binder = binder->NextResult(); @@ -399,28 +304,42 @@ static IFSelect_ReturnStatus TransferFinder return stat; } +//======================================================================= +//function : TransferWriteTransient +//purpose : +//======================================================================= - IFSelect_ReturnStatus XSControl_Controller::TransferWriteTransient - (const Handle(Standard_Transient)& obj, - const Handle(Transfer_FinderProcess)& FP, - const Handle(Interface_InterfaceModel)& model, - const Standard_Integer modetrans) const +IFSelect_ReturnStatus XSControl_Controller::TransferWriteTransient + (const Handle(Standard_Transient)& theObj, + const Handle(Transfer_FinderProcess)& theFP, + const Handle(Interface_InterfaceModel)& theModel, + const Standard_Integer theModeTrans) const { - if (obj.IsNull()) return IFSelect_RetVoid; + if (theObj.IsNull()) return IFSelect_RetVoid; return TransferFinder - (theAdaptorWrite,new Transfer_TransientMapper(obj), FP,model,modetrans); + (myAdaptorWrite,new Transfer_TransientMapper(theObj),theFP,theModel,theModeTrans); } - Standard_Boolean XSControl_Controller::RecognizeWriteShape +//======================================================================= +//function : RecognizeWriteShape +//purpose : +//======================================================================= + +Standard_Boolean XSControl_Controller::RecognizeWriteShape (const TopoDS_Shape& shape, const Standard_Integer modetrans) const { - if (theAdaptorWrite.IsNull()) return Standard_False; - theAdaptorWrite->ModeTrans() = modetrans; - return theAdaptorWrite->Recognize (new TransferBRep_ShapeMapper(shape)); + if (myAdaptorWrite.IsNull()) return Standard_False; + myAdaptorWrite->ModeTrans() = modetrans; + return myAdaptorWrite->Recognize (new TransferBRep_ShapeMapper(shape)); } - IFSelect_ReturnStatus XSControl_Controller::TransferWriteShape +//======================================================================= +//function : TransferWriteShape +//purpose : +//======================================================================= + +IFSelect_ReturnStatus XSControl_Controller::TransferWriteShape (const TopoDS_Shape& shape, const Handle(Transfer_FinderProcess)& FP, const Handle(Interface_InterfaceModel)& model, @@ -429,249 +348,147 @@ static IFSelect_ReturnStatus TransferFinder if (shape.IsNull()) return IFSelect_RetVoid; IFSelect_ReturnStatus theReturnStat = TransferFinder - (theAdaptorWrite,new TransferBRep_ShapeMapper(shape), FP,model,modetrans); + (myAdaptorWrite,new TransferBRep_ShapeMapper(shape),FP,model,modetrans); return theReturnStat; } -// ########################### -// File Cluster : quand un ensemble de donnees n est pas envoye d un coup mais -// en plusieurs petits paquets ... -// D abord, on detecte la chose et on prepare un contexte de resolution -// specifique du cas a traiter. Null Handle si rien a faire (par defaut) -// Ensuite on resoud -// Les formules par defaut ne font rien (redefinissables) - - Handle(Standard_Transient) XSControl_Controller::ClusterContext - (const Handle(XSControl_WorkSession)& ) const - { Handle(Standard_Transient) nulctx; return nulctx; } - - Interface_CheckIterator XSControl_Controller::ResolveCluster - (const Handle(XSControl_WorkSession)& , const Handle(Standard_Transient)& ) const - { Interface_CheckIterator nulist; return nulist; } - - -// ########################### -// ControlItems : si ActorWrite etc... ne suffisent meme plus, on peut en -// rajouter, Controller ne fait alors que les accueillir - - void XSControl_Controller::AddControlItem - (const Handle(Standard_Transient)& item, const Standard_CString name) -{ - if (item.IsNull() || name[0] == '\0') return; - if (theItems.IsNull()) theItems = new Dico_DictionaryOfTransient; - theItems->SetItem (name,item); -} - - Handle(Standard_Transient) XSControl_Controller::ControlItem - (const Standard_CString name) const -{ - Handle(Standard_Transient) item; - if (theItems.IsNull()) return item; - theItems->GetItem (name,item); - return item; -} - // ########################### // Cutomisation ! On enregistre des Items pour une WorkSession // (annule et remplace) // Ensuite, on les remet en place a la demande - void XSControl_Controller::TraceStatic - (const Standard_CString name, const Standard_Integer use) +//======================================================================= +//function : AddSessionItem +//purpose : +//======================================================================= + +void XSControl_Controller::AddSessionItem + (const Handle(Standard_Transient)& theItem, const Standard_CString theName, const Standard_Boolean toApply) { - Handle(Interface_Static) val = Interface_Static::Static(name); - if (val.IsNull()) return; - theParams.Append (val); - theParamUses.Append(use); + if (theItem.IsNull() || theName[0] == '\0') return; + if (myAdaptorSession.IsNull()) + myAdaptorSession = new Dico_DictionaryOfTransient; + myAdaptorSession->SetItem (theName,theItem); + if (toApply && theItem->IsKind(STANDARD_TYPE(IFSelect_GeneralModifier))) + myAdaptorApplied.Append(theItem); } - void XSControl_Controller::AddSessionItem - (const Handle(Standard_Transient)& item, const Standard_CString name, - const Standard_CString setapplied) -{ - if (item.IsNull() || name[0] == '\0') return; - if (theAdaptorSession.IsNull()) theAdaptorSession = - new Dico_DictionaryOfTransient; - theAdaptorSession->SetItem (name,item); - if (!setapplied || setapplied[0] == '\0') return; - if (item->IsKind(STANDARD_TYPE(IFSelect_GeneralModifier))) { -// cout<<" -- Xstep Controller : SetApplied n0."<Append (hook); - } -} +//======================================================================= +//function : SessionItem +//purpose : +//======================================================================= - Handle(Standard_Transient) XSControl_Controller::SessionItem - (const Standard_CString name) const +Handle(Standard_Transient) XSControl_Controller::SessionItem (const Standard_CString theName) const { Handle(Standard_Transient) item; - if (theAdaptorSession.IsNull()) return item; - theAdaptorSession->GetItem (name,item); + if (!myAdaptorSession.IsNull()) + myAdaptorSession->GetItem (theName,item); return item; } - Standard_Boolean XSControl_Controller::IsApplied - (const Handle(Standard_Transient)& item) const +//======================================================================= +//function : Customise +//purpose : +//======================================================================= + +void XSControl_Controller::Customise (Handle(XSControl_WorkSession)& WS) { - if (item.IsNull()) return Standard_False; - for (Standard_Integer i = theAdaptorApplied.Length(); i >= 1; i --) - if (item == theAdaptorApplied.Value(i)) return Standard_True; - return Standard_False; -} + WS->SetParams (myParams,myParamUses); - void XSControl_Controller::Customise - ( Handle(XSControl_WorkSession)& WS) -{ - WS->SetParams (theParams,theParamUses); + // General + if (!myAdaptorSession.IsNull()) { + Dico_IteratorOfDictionaryOfTransient iter(myAdaptorSession); + for (iter.Start(); iter.More(); iter.Next()) + WS->AddNamedItem (iter.Name().ToCString(), iter.Value()); + } + if (WS->NamedItem("xst-model-all").IsNull()) { -// General - if(!theAdaptorSession.IsNull()) { - Dico_IteratorOfDictionaryOfTransient iter(theAdaptorSession); - for (iter.Start(); iter.More(); iter.Next()) { - WS->AddNamedItem (iter.Name().ToCString() , iter.Value()); + Handle(IFSelect_SelectModelEntities) sle = new IFSelect_SelectModelEntities; + WS->AddNamedItem ("xst-model-all",sle); + + Handle(IFSelect_SelectModelRoots) slr = new IFSelect_SelectModelRoots; + WS->AddNamedItem ("xst-model-roots",slr); + + if(strcasecmp(WS->SelectedNorm(),"STEP")) { + Handle(XSControl_SelectForTransfer) st1 = new XSControl_SelectForTransfer; + st1->SetInput (slr); + st1->SetReader (WS->TransferReader()); + WS->AddNamedItem ("xst-transferrable-roots",st1); } - } - Customising(WS); -// Applied Modifiers - Standard_Integer i, nb = theAdaptorApplied.Length(); - for (i = 1; i <= nb; i ++) { - Handle(Standard_Transient) anitem = theAdaptorApplied.Value(i); - Handle(TCollection_HAsciiString) name = WS->Name(anitem); -// Handle(Message_Messenger) sout = Message::DefaultMessenger(); -// sout<<" -- Customise applied n0."<DynamicType()->Name(); -// if (name.IsNull()) sout<<" no name"<ToCString()<SetAppliedModifier - (GetCasted(IFSelect_GeneralModifier,theAdaptorApplied.Value(i)), - WS->ShareOut() ); + + Handle(XSControl_SelectForTransfer) st2 = new XSControl_SelectForTransfer; + st2->SetInput (sle); + st2->SetReader (WS->TransferReader()); + WS->AddNamedItem ("xst-transferrable-all",st2); + + Handle(XSControl_SignTransferStatus) strs = new XSControl_SignTransferStatus; + strs->SetReader (WS->TransferReader()); + WS->AddNamedItem ("xst-transfer-status",strs); + + Handle(XSControl_ConnectedShapes) scs = new XSControl_ConnectedShapes; + scs->SetReader (WS->TransferReader()); + WS->AddNamedItem ("xst-connected-faces",scs); + + Handle(IFSelect_SignType) stp = new IFSelect_SignType (Standard_False); + WS->AddNamedItem ("xst-long-type",stp); + + Handle(IFSelect_SignType) stc = new IFSelect_SignType (Standard_True); + WS->AddNamedItem ("xst-type",stc); + + WS->AddNamedItem ("xst-ancestor-type",new IFSelect_SignAncestor); + WS->AddNamedItem ("xst-types",new IFSelect_SignCounter(stp,Standard_False,Standard_True)); + WS->AddNamedItem ("xst-category",new IFSelect_SignCategory); + WS->AddNamedItem ("xst-validity",new IFSelect_SignValidity); + + Handle(IFSelect_DispPerOne) dispone = new IFSelect_DispPerOne; + dispone->SetFinalSelection(slr); + WS->AddNamedItem ("xst-disp-one",dispone); + + Handle(IFSelect_DispPerCount) dispcount = new IFSelect_DispPerCount; + Handle(IFSelect_IntParam) intcount = new IFSelect_IntParam; + intcount->SetValue(5); + dispcount->SetCount(intcount); + dispcount->SetFinalSelection(slr); + WS->AddNamedItem ("xst-disp-count",dispcount); + + Handle(IFSelect_DispPerFiles) dispfiles = new IFSelect_DispPerFiles; + Handle(IFSelect_IntParam) intfiles = new IFSelect_IntParam; + intfiles->SetValue(10); + dispfiles->SetCount(intfiles); + dispfiles->SetFinalSelection(slr); + WS->AddNamedItem ("xst-disp-files",dispfiles); + + Handle(IFSelect_DispPerSignature) dispsign = new IFSelect_DispPerSignature; + dispsign->SetSignCounter(new IFSelect_SignCounter(Handle(IFSelect_Signature)(stc))); + dispsign->SetFinalSelection(slr); + WS->AddNamedItem ("xst-disp-sign",dispsign); + + // Not used directly but useful anyway + WS->AddNamedItem ("xst-pointed",new IFSelect_SelectPointed); + WS->AddNamedItem ("xst-sharing",new IFSelect_SelectSharing); + WS->AddNamedItem ("xst-shared",new IFSelect_SelectShared); + WS->AddNamedItem ("xst-nb-selected",new IFSelect_GraphCounter); + + //szv:mySignType = stp; + WS->SetSignType( stp ); } -// Editeurs de Parametres -// Ici car les constructeurs specifiques des controlleurs ont pu creer des -// Parametres : attendre donc ici + // Applied Modifiers + Standard_Integer i, nb = myAdaptorApplied.Length(); + for (i = 1; i <= nb; i ++) { + const Handle(Standard_Transient) &anitem = myAdaptorApplied.Value(i); + Handle(TCollection_HAsciiString) name = WS->Name(anitem); + WS->SetAppliedModifier(GetCasted(IFSelect_GeneralModifier,anitem),WS->ShareOut()); + } + + // Editors of Parameters + // 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"); + 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); - -// Norm Specific - //Customising (WS); - -// Loading Options of the Profile - -// Available Signatures - Handle(MoniTool_Option) optsign = theProfile->Option ("sign-type"); -// Handle(TColStd_HSequenceOfHAsciiString) signs = -// WS->ItemNames (STANDARD_TYPE(IFSelect_Signature)); -// Standard_Integer isign, nbsign = (signs.IsNull() ? 0 : signs->Length()); -// for (isign = 1; isign <= nbsign; isign ++) { -// Handle(TCollection_HAsciiString) signame = signs->Value(isign); -// Handle(Standard_Transient) asign = WS->NamedItem (signame); -// optsign->Add (signame->ToCString(),asign); -// } - optsign->Add ("default",theSignType); // defaut specifique - optsign->Switch ("default"); // garder courante la definition par defaut ! - -// Actor Read - Handle(MoniTool_Option) optacrd = theProfile->Option ("tr-read"); - optacrd->Add ("default",theAdaptorRead); - optacrd->Switch ("default"); - -// Actor Write - Handle(MoniTool_Option) optacwr = theProfile->Option ("tr-write"); - optacwr->Add ("default",theAdaptorWrite); - optacwr->Switch ("default"); - -// Basic configuration - - theProfile->AddConf ("Base"); - theProfile->AddSwitch ("Base","sign-type","default"); - theProfile->AddSwitch ("Base","tr-read","default"); - theProfile->AddSwitch ("Base","tr-write","default"); - theProfile->SetCurrent ("Base"); -} - - void XSControl_Controller::Customising - ( Handle(XSControl_WorkSession)& WS) -{ - //ndle(IFSelect_SelectModelRoots) slr = new IFSelect_SelectModelRoots; - ///WS->AddNamedItem ("xst-model-roots",slr); - if(!WS->NamedItem("xst-model-all").IsNull()) return; - Handle(IFSelect_SelectModelEntities) sle = new IFSelect_SelectModelEntities; - WS->AddNamedItem ("xst-model-all",sle); - Handle(IFSelect_SelectModelRoots) slr; - slr = new IFSelect_SelectModelRoots; - WS->AddNamedItem ("xst-model-roots",slr); - if(strcasecmp(WS->SelectedNorm(),"STEP")) { - Handle(XSControl_SelectForTransfer) st1 = new XSControl_SelectForTransfer; - st1->SetInput (slr); - st1->SetReader (WS->TransferReader()); - WS->AddNamedItem ("xst-transferrable-roots",st1); - - } - //else slr = Handle(IFSelect_SelectModelRoots)::DownCast(WS->NamedItem("xst-model-roots")); - Handle(XSControl_SelectForTransfer) st2 = new XSControl_SelectForTransfer; - st2->SetInput (sle); - st2->SetReader (WS->TransferReader()); - WS->AddNamedItem ("xst-transferrable-all",st2); - - Handle(XSControl_SignTransferStatus) strs = new XSControl_SignTransferStatus; - strs->SetReader (WS->TransferReader()); - WS->AddNamedItem ("xst-transfer-status",strs); - - Handle(XSControl_ConnectedShapes) scs = new XSControl_ConnectedShapes; - scs->SetReader (WS->TransferReader()); - WS->AddNamedItem ("xst-connected-faces",scs); - - Handle(IFSelect_SignType) stp = new IFSelect_SignType (Standard_False); - WS->AddNamedItem ("xst-long-type",stp); - Handle(IFSelect_SignType) stc = new IFSelect_SignType (Standard_True); - WS->AddNamedItem ("xst-type",stc); - Handle(IFSelect_SignAncestor) sta = new IFSelect_SignAncestor; - WS->AddNamedItem ("xst-ancestor-type",sta); - Handle(IFSelect_SignCounter) tc1 = - new IFSelect_SignCounter(stp,Standard_False,Standard_True); - WS->AddNamedItem ("xst-types",tc1); - Handle(IFSelect_SignCategory) sca = new IFSelect_SignCategory; - WS->AddNamedItem ("xst-category",sca); - Handle(IFSelect_SignValidity) sva = new IFSelect_SignValidity; - WS->AddNamedItem ("xst-validity",sva); - - Handle(IFSelect_DispPerOne) dispone = new IFSelect_DispPerOne; - dispone->SetFinalSelection(slr); - WS->AddNamedItem ("xst-disp-one",dispone); - Handle(IFSelect_DispPerCount) dispcount = new IFSelect_DispPerCount; - Handle(IFSelect_IntParam) intcount = new IFSelect_IntParam; - intcount->SetValue(5); - dispcount->SetCount(intcount); - dispcount->SetFinalSelection(slr); - WS->AddNamedItem ("xst-disp-count",dispcount); - Handle(IFSelect_DispPerFiles) dispfiles = new IFSelect_DispPerFiles; - Handle(IFSelect_IntParam) intfiles = new IFSelect_IntParam; - intfiles->SetValue(10); - dispfiles->SetCount(intfiles); - dispfiles->SetFinalSelection(slr); - WS->AddNamedItem ("xst-disp-files",dispfiles); - Handle(IFSelect_DispPerSignature) dispsign = new IFSelect_DispPerSignature; - dispsign->SetSignCounter(new IFSelect_SignCounter(Handle(IFSelect_Signature)(stc))); - dispsign->SetFinalSelection(slr); - WS->AddNamedItem ("xst-disp-sign",dispsign); - -// Pas utilisables directement mais bien utiles quand meme - WS->AddNamedItem ("xst-pointed",new IFSelect_SelectPointed); - WS->AddNamedItem ("xst-sharing",new IFSelect_SelectSharing); - WS->AddNamedItem ("xst-shared",new IFSelect_SelectShared); - WS->AddNamedItem ("xst-nb-selected",new IFSelect_GraphCounter); - theSignType = stp; - // au moins cela -} - Handle(Dico_DictionaryOfTransient) XSControl_Controller::AdaptorSession() const -{ - return theAdaptorSession; } diff --git a/src/XSControl/XSControl_Controller.hxx b/src/XSControl/XSControl_Controller.hxx index ba6a7aaffe..1c10778dda 100644 --- a/src/XSControl/XSControl_Controller.hxx +++ b/src/XSControl/XSControl_Controller.hxx @@ -26,11 +26,8 @@ #include #include #include -#include -#include -#include +#include #include -class MoniTool_Profile; class IFSelect_WorkLibrary; class Interface_Protocol; class IFSelect_Signature; @@ -59,10 +56,6 @@ DEFINE_STANDARD_HANDLE(XSControl_Controller, MMgt_TShared) //! IGES-5.1) and an application data model (CasCade Shapes for //! instance). //! -//! A Controller brings a Profile, this allows to have several -//! variants on the same basic definition, for instance keep the -//! norm definition but give several transfer actors, etc -//! //! Finally, Controller can be gathered in a general dictionary then //! retreived later by a general call (method Recorded) //! @@ -70,18 +63,20 @@ DEFINE_STANDARD_HANDLE(XSControl_Controller, MMgt_TShared) //! link between the norm and the application class XSControl_Controller : public MMgt_TShared { - -public: - + public: //! Changes names //! if a name is empty, the formerly set one remains //! Remark : Does not call Record or AutoRecord - Standard_EXPORT void SetNames (const Standard_CString longname, const Standard_CString shortname); + Standard_EXPORT void SetNames (const Standard_CString theLongName, const Standard_CString theShortName); //! Records is a general dictionary under Short and Long //! Names (see method Name) - Standard_EXPORT void AutoRecord() const; + void AutoRecord() const + { + Record (Name(Standard_True)); + Record (Name(Standard_False)); + } //! Records in a general dictionary under a name //! Error if already used for another one @@ -91,60 +86,24 @@ public: //! Returns a Null Handle if is unknown Standard_EXPORT static Handle(XSControl_Controller) Recorded (const Standard_CString name); - //! Returns the list of names of recorded norms, according to mode - //! = 0 (D) : all the recorded names - //! < 0 : for each distinct norm, its resource (short) name - //! > 0 : for each distinct norm, its complete (long) name - Standard_EXPORT static Handle(TColStd_HSequenceOfHAsciiString) ListRecorded (const Standard_Integer mode = 0); - //! Returns a name, as given when initializing : //! rsc = False (D) : True Name attached to the Norm (long name) //! rsc = True : Name of the ressource set (i.e. short name) - Standard_EXPORT Standard_CString Name (const Standard_Boolean rsc = Standard_False) const; - - //! Returns the Profile - //! It starts with a first configuration Base (empty) and the - //! following options : - //! protocol for the Protocol - //! sign-type for the SignType (Default Signature for Type) - //! access for the WorkLibrary - //! tr-read for ActorRead (import processor) - //! tr-write for ActorWrite (export processor) - Standard_EXPORT Handle(MoniTool_Profile) Profile() const; - - //! Considers the current state of the Controller as defining a - //! configuration, newly created or already existing - Standard_EXPORT void DefineProfile (const Standard_CString confname); - - //! Sets the Controller in a given Configuration of its Profile - //! Calls SettingProfile (which can be redefined) - //! - //! Returns True if done, False if unknown - Standard_EXPORT Standard_Boolean SetProfile (const Standard_CString confname); - - //! This method is called by SetProfile, it can be redefined - //! for specific sub-class of Controller - //! The default does nothing - Standard_EXPORT virtual Standard_Boolean SettingProfile (const Standard_CString confname); - - //! Applies a Configuration of the Profile to the WorkSession - //! I.E. calls SetProfile then fills WorkSession with definitions - Standard_EXPORT Standard_Boolean ApplyProfile (const Handle(XSControl_WorkSession)& WS, const Standard_CString confname); - - //! Called by ApplyProfile, can be redefined for specific - //! sub-class of Controller - //! The default does nothing - Standard_EXPORT virtual Standard_Boolean ApplyingProfile (const Handle(XSControl_WorkSession)& WS, const Standard_CString confname); + Standard_CString Name (const Standard_Boolean rsc = Standard_False) const + { return (rsc ? myShortName.ToCString() : myLongName.ToCString()); } //! Returns the Protocol attached to the Norm (from field) - Standard_EXPORT Handle(Interface_Protocol) Protocol() const; + const Handle(Interface_Protocol) & Protocol () const + { return myAdaptorProtocol; } //! Returns the SignType attached to the norm (from field) - Standard_EXPORT Handle(IFSelect_Signature) SignType() const; + //szv:const Handle(IFSelect_Signature) & SignType1() const + //szv:{ return mySignType; } //! Returns the WorkLibrary attached to the Norm. Remark that it //! has to be in phase with the Protocol (read from field) - Standard_EXPORT Handle(IFSelect_WorkLibrary) WorkLibrary() const; + const Handle(IFSelect_WorkLibrary) & WorkLibrary() const + { return myAdaptorLibrary; } //! Creates a new empty Model ready to receive data of the Norm //! Used to write data from Imagine to an interface file @@ -153,22 +112,12 @@ public: //! Returns the Actor for Read attached to the pair (norm,appli) //! It can be adapted for data of the input Model, as required //! Can be read from field then adapted with Model as required - Standard_EXPORT virtual Handle(Transfer_ActorOfTransientProcess) ActorRead (const Handle(Interface_InterfaceModel)& model) const = 0; + Standard_EXPORT virtual Handle(Transfer_ActorOfTransientProcess) ActorRead (const Handle(Interface_InterfaceModel)& model) const; //! Returns the Actor for Write attached to the pair (norm,appli) //! Read from field. Can be redefined Standard_EXPORT virtual Handle(Transfer_ActorOfFinderProcess) ActorWrite() const; - //! Updates static values - //! precises the kind of updating : (see Items from Static) - //! -1 : a precise static item : criter = its name - //! 0 : all items of a family : criter = the family name - //! 1 : all items which match regexp name : criter = regexp name - //! By default (criter empty) should consider all relevant statics - //! If is defined, can consider only this static item - //! The provided default method does nothing, to be redefined - Standard_EXPORT virtual void UpdateStatics (const Standard_Integer mode, const Standard_CString criter = "") const; - //! Sets mininum and maximum values for modetrans (write) //! Erases formerly recorded bounds and values //! Actually only for shape @@ -219,120 +168,55 @@ public: //! Returned value is a status, as follows : //! Done OK , Void : No Result , Fail : Fail (e.g. exception) //! Error : bad conditions , bad model or null model - //! Resolution of file clusters - //! According to each norm, there can (or not) be files of which - //! definition is not complete but refers to other files : this defines - //! a file cluster. - //! It can then be resolved by two calls : - //! - ClusterContext prepares the resolution, specific of each case - //! - ResolveCluster performs the resolution, its result consists in - //! having all data gathered in one final model 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; - //! Prepares and returns a context to resolve a cluster - //! All data to be used are detained by the WorkSession - //! The definition of this context is free and proper to each case - //! remark that it is aimed to be used in ResolveCluster - //! - //! The context must be prepared, but resolution must not have - //! began - //! - //! If no cluster has to be resolved, should return a null handle - //! This is the default case, which can be redefined - Standard_EXPORT virtual Handle(Standard_Transient) ClusterContext (const Handle(XSControl_WorkSession)& WS) const; - - //! Performs the resolution itself, from the starting data and - //! the cluster context - //! - //! Can fill a CheckList as necessary (especially when one or - //! more references remain unresolved) - //! - //! Default does nothing and returns an empty CheckList - Standard_EXPORT virtual Interface_CheckIterator ResolveCluster (const Handle(XSControl_WorkSession)& WS, const Handle(Standard_Transient)& context) const; - - //! Adds an item in the control list - //! A control item of a controller is accessed by its name which - //! is specific of a kind of item (i.e. a kind of functionnality) - //! Adds or replaces if is already recorded - Standard_EXPORT void AddControlItem (const Handle(Standard_Transient)& item, const Standard_CString name); - - //! Returns a control item from its name, Null if unknown - //! To be used then, it just remains to be down-casted - Standard_EXPORT Handle(Standard_Transient) ControlItem (const Standard_CString name) const; - - //! Records the name of a Static to be traced for a given use - Standard_EXPORT void TraceStatic (const Standard_CString name, const Standard_Integer use); - - //! Records a Session Item, to be added for customisation of the - //! Work Session. It must have a specific name. + //! Records a Session Item, to be added for customisation of the Work Session. + //! It must have a specific name. //! is used if is a GeneralModifier, to decide - //! to which hook list it will be applied, if not empty (else, - //! not applied to any hook list) - //! ACTUAL : only one hook list is managed : "send" - //! Remark : this method is to be called at Create time, the - //! recorded items will be used by Customise + //! If set to true, will be applied to the hook list "send". + //! Else, it is not applied to any hook list. + //! Remark : this method is to be called at Create time, + //! the recorded items will be used by Customise //! Warning : if conflicts, the last recorded item is kept - Standard_EXPORT void AddSessionItem (const Handle(Standard_Transient)& item, const Standard_CString name, const Standard_CString setapplied = ""); + Standard_EXPORT void AddSessionItem (const Handle(Standard_Transient)& theItem, const Standard_CString theName, const Standard_Boolean toApply = Standard_False); //! Returns an item given its name to record in a Session //! If is unknown, returns a Null Handle - Standard_EXPORT Handle(Standard_Transient) SessionItem (const Standard_CString name) const; + Standard_EXPORT Handle(Standard_Transient) SessionItem (const Standard_CString theName) const; - //! Returns True if is recorded as - Standard_EXPORT Standard_Boolean IsApplied (const Handle(Standard_Transient)& item) const; - - //! Customises a WorkSession, by adding to it the recorded items - //! (by AddSessionItem), then by calling a specific method - //! Customising, set by default to do nothing + //! Customises a WorkSession, by adding to it the recorded items (by AddSessionItem) Standard_EXPORT virtual void Customise (Handle(XSControl_WorkSession)& WS); - //! Specific customisation method, which can be redefined - //! Default does nothing - Standard_EXPORT void Customising (Handle(XSControl_WorkSession)& WS); - - Standard_EXPORT Handle(Dico_DictionaryOfTransient) AdaptorSession() const; - - - + const Handle(Dico_DictionaryOfTransient) & AdaptorSession() const + { return myAdaptorSession; } DEFINE_STANDARD_RTTIEXT(XSControl_Controller,MMgt_TShared) -protected: - + protected: //! Initializing with names - //! is for the complete, official, long name - //! is for the short name used for resources - Standard_EXPORT XSControl_Controller(const Standard_CString longname, const Standard_CString shortname); + //! is for the complete, official, long name + //! is for the short name used for resources + Standard_EXPORT XSControl_Controller(const Standard_CString theLongName, const Standard_CString theShortName); - TCollection_AsciiString theShortName; - TCollection_AsciiString theLongName; - Handle(IFSelect_WorkLibrary) theAdaptorLibrary; - Handle(Interface_Protocol) theAdaptorProtocol; - Handle(IFSelect_Signature) theSignType; - Handle(Transfer_ActorOfTransientProcess) theAdaptorRead; - Handle(Transfer_ActorOfFinderProcess) theAdaptorWrite; - Handle(Dico_DictionaryOfTransient) theAdaptorSession; + //! 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); + TCollection_AsciiString myShortName; + TCollection_AsciiString myLongName; + Handle(IFSelect_WorkLibrary) myAdaptorLibrary; + Handle(Interface_Protocol) myAdaptorProtocol; + //szv:Handle(IFSelect_Signature) mySignType; + Handle(Transfer_ActorOfTransientProcess) myAdaptorRead; + Handle(Transfer_ActorOfFinderProcess) myAdaptorWrite; + Handle(Dico_DictionaryOfTransient) myAdaptorSession; -private: - - - Handle(MoniTool_Profile) theProfile; - Handle(Dico_DictionaryOfTransient) theItems; - TColStd_SequenceOfTransient theAdaptorApplied; - Handle(TColStd_HSequenceOfHAsciiString) theAdaptorHooks; - TColStd_SequenceOfTransient theParams; - TColStd_SequenceOfInteger theParamUses; - Handle(Interface_HArray1OfHAsciiString) theModeWriteShapeN; - + private: + TColStd_SequenceOfTransient myAdaptorApplied; + NCollection_Vector myParams; + NCollection_Vector myParamUses; + Handle(Interface_HArray1OfHAsciiString) myModeWriteShapeN; }; - - - - - - #endif // _XSControl_Controller_HeaderFile diff --git a/src/XSControl/XSControl_FuncShape.cxx b/src/XSControl/XSControl_FuncShape.cxx index 46b585ad89..9b1b913b26 100644 --- a/src/XSControl/XSControl_FuncShape.cxx +++ b/src/XSControl/XSControl_FuncShape.cxx @@ -74,7 +74,7 @@ static IFSelect_ReturnStatus XSControl_tpdraw const Standard_CString arg1 = pilot->Arg(1); const Standard_CString arg2 = pilot->Arg(2); const Standard_CString arg3 = pilot->Arg(3); - Handle(Transfer_TransientProcess) TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); + const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); Handle(Message_Messenger) sout = Message::DefaultMessenger(); if (TP.IsNull()) { sout<<"No Transfer Read"<NbWords(); const Standard_CString arg1 = pilot->Arg(1); - Handle(Transfer_TransientProcess) TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); + const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); Handle(Message_Messenger) sout = Message::DefaultMessenger(); if (TP.IsNull()) { sout<<"No Transfer Read"<Word(0).Location(1,'o',1,5) > 0); Standard_Boolean cassave = (pilot->Word(0).Location(1,'s',1,5) > 0); char nomsh[100], noms[100]; - Handle(XSControl_TransferReader) TR = XSControl::Session(pilot)->TransferReader(); + const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader(); Handle(Message_Messenger) sout = Message::DefaultMessenger(); if (TR.IsNull()) { sout<<" manque init"<Model(); + const Handle(Interface_InterfaceModel) &mdl = TR->Model(); if (mdl.IsNull()) { sout<<" modele absent"< 1 ? IFSelect_Functions::GiveEntityNumber(XSControl::Session(pilot),arg1) : 0); @@ -299,7 +299,7 @@ static IFSelect_ReturnStatus XSControl_traccess BRep_Builder B; B.MakeCompound(C); - Handle(TopTools_HSequenceOfShape) list = TR->ShapeResultList(Standard_True); + const Handle(TopTools_HSequenceOfShape) &list = TR->ShapeResultList(Standard_True); Standard_Integer i, nb = list->Length(); sout<<" TOUS RESULTATS par ShapeResultList, soit "<TransferReader(); + const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader(); if (TR.IsNull()) { } // sout<<"No read transfer (import) recorded"<MapWriter(); - if (FP.IsNull()) { } //sout<<"No write transfer (export) recorded"<TransferWriter()->FinderProcess(); + if (FP.IsNull()) { } else { yena = Standard_True; Handle(Transfer_Finder) fnd = TransferBRep::ShapeMapper (FP,Shape); @@ -528,7 +528,7 @@ static IFSelect_ReturnStatus XSControl_trconnexentities Standard_Integer argc = pilot->NbWords(); const Standard_CString arg1 = pilot->Arg(1); // **** connected entities (last transfer) **** - Handle(XSControl_TransferReader) TR = XSControl::Session(pilot)->TransferReader(); + const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader(); Handle(Transfer_TransientProcess) TP; if (!TR.IsNull()) TP = TR->TransientProcess(); Handle(Message_Messenger) sout = Message::DefaultMessenger(); @@ -546,7 +546,7 @@ static IFSelect_ReturnStatus XSControl_trconnexentities XSControl_ConnectedShapes::AdjacentEntities (Shape,TP,TopAbs_FACE); Standard_Integer i, nb = list->Length(); sout<Model(); + const Handle(Interface_InterfaceModel) &model = XSControl::Session(pilot)->Model(); sout<<"("; for (i = 1; i <= nb; i ++) { if (i > 1) sout<<","; @@ -618,7 +618,7 @@ static IFSelect_ReturnStatus XSControl_trimport // Starting Transfer WS->InitTransferReader (0); - Handle(XSControl_TransferReader) TR = WS->TransferReader(); + const Handle(XSControl_TransferReader) &TR = WS->TransferReader(); if (TR.IsNull()) { sout<<" init not done or failed"<BeginTransfer(); @@ -761,7 +761,7 @@ Standard_Integer XSControl_FuncShape::MoreShapes Handle(Message_Messenger) sout = Message::DefaultMessenger(); if (list.IsNull()) list = new TopTools_HSequenceOfShape(); if (name[0] == '*' && (name[1] == '\0' || (name[1] == '*' && name[2] == '\0'))) { - Handle(Transfer_TransientProcess) TP = session->TransferReader()->TransientProcess(); + const Handle(Transfer_TransientProcess) &TP = session->TransferReader()->TransientProcess(); if (TP.IsNull()) { sout<<"last transfer : unknown"< #include #include -#include -#include -#include -#include -#include #include #include #include @@ -44,10 +39,6 @@ #include #include -//#include -//#include -//#include -//#include // ####################################################################### // ## ## // ## ## @@ -83,7 +74,7 @@ static IFSelect_ReturnStatus XSControl_xnorm(const Handle(IFSelect_SessionPilot) Handle(XSControl_Controller) control = WS->NormAdaptor(); Handle(Message_Messenger) sout = Message::DefaultMessenger(); if (argc == 1) - sout<<"Current Norm. xnorm newnorm [profile] to change , xnorm ? for the list"<Name(Standard_True)<Length(); - sout<<"Short Proper Names (complete names) : "<Value(i)->ToCString(); - sout<Length(); - sout<<"Long Proper Names (resource names) : "<Value(i)->ToCString(); - sout<Length(); - sout<<"All Norm Names (short, long and aliases) "<Value(i)->ToCString(); - sout<SetController(control); - sout<<"new norm : "<Name()< 2) { - const Standard_CString arg2 = pilot->Arg(2); - if (!control->Profile()->SetCurrent (arg2)) - sout<<"profile could not be set to "<Profile()->Current()<SelectedNorm(Standard_True)); - return IFSelect_RetDone; - } -} - - -//======================================================================= -//function : xprofile -//======================================================================= -static IFSelect_ReturnStatus XSControl_xprofile(const Handle(IFSelect_SessionPilot)& pilot) -{ - Standard_Integer argc = pilot->NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - // **** xprofile **** - Handle(XSControl_WorkSession) WS = XSControl::Session(pilot); - Handle(XSControl_Controller) control = WS->NormAdaptor(); - if (control.IsNull()) return IFSelect_RetFail; - Handle(MoniTool_Profile) prof = control->Profile(); - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<<"Current Profile : "<Current().ToCString()<ConfList(); - Standard_Integer i, nb = confs->Length(); - sout<<"List of Available Profile Configurations : "<Value(i).ToCString()<ApplyProfile(WS,".")) { - sout<<"Applying current profile has failed"<ApplyProfile(WS,arg1)) { - sout<<"Setting "<Arg(2); - - // List the definition of a profile - if (arg2[0] == '?') { - Handle(TColStd_HSequenceOfAsciiString) opts, cases; - prof->SwitchList (arg1,opts,cases); - Standard_Integer i,nb = opts->Length(); - sout<<"Option -- Case -- ("<Value(i).ToCString()<<" "<Value(i).ToCString()<ClearConf(arg1)) { - sout<<"Clearing profile "<HasConf (arg1)) prof->AddConf (arg1); - if (!prof->AddFromOtherConf (arg1,arg2)) { - sout<<"Merging profile "<Arg(2); - const Standard_CString arg3 = pilot->Arg(3); - - // Removing a switch - if (arg2[0] == '-' && arg2[1] == '\0') { - if (!prof->RemoveSwitch (arg1,arg3)) { - sout<<"Removing switch on option "<AddSwitch (arg1,arg2,arg3)) { - sout<<"Setting profile "<NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - const Standard_CString arg2 = pilot->Arg(2); - const Standard_CString arg3 = pilot->Arg(3); - // **** xoption **** - Handle(XSControl_WorkSession) WS = XSControl::Session(pilot); - Handle(XSControl_Controller) control = WS->NormAdaptor(); - if (control.IsNull()) return IFSelect_RetFail; - Handle(MoniTool_Profile) prof = control->Profile(); - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<<"Current Profile : "<Current().ToCString()<OptionList(); - Standard_Integer iopt, nbopt = optlist->Length(); - sout<<"Total : "<Value(iopt); - Handle(MoniTool_Option) opt = prof->Option (optname.ToCString()); - sout<CaseName()<Option (arg1); - if (opt.IsNull()) { sout<<"Not a recorded Option : "<ItemList(); - Standard_Integer icase, nbcase = caselist->Length(); - Handle(MoniTool_TypedValue) tv = opt->TypedValue(); - if (tv.IsNull()) sout<<"Option : "<Type()->Name(); - else sout<<"Option : "<Name()<Definition(); - - sout<CaseName()<<" Total : "<Value(icase); - sout<Aliases(acase.ToCString()); - Standard_Integer ial, nbal = (aliases.IsNull() ? 0 : aliases->Length()); - if (nbal > 0) sout<<" - Alias:"; - for (ial = 1; ial <= nbal; ial ++) sout<<" "<Value(ial); - if (!tv.IsNull()) { - // TypedValue : on peut afficher la valeur - Handle(Standard_Transient) str; - opt->Item (acase.ToCString(),str); - if (!str.IsNull()) sout<<" - Value:"<< Handle(TCollection_HAsciiString)::DownCast(str)->ToCString(); - } - - sout<= 3 && arg1[0] == '+' && arg1[1] == '\0') { - Standard_CString parname = pilot->Arg(argc-1); - Handle(Interface_Static) param = Interface_Static::Static(parname); - if (param.IsNull()) { sout<<"No static parameter is named "<AddOption (opt); - return IFSelect_RetDone; - } - - // xoption optname + case [val] - if (argc >= 4 && arg2[0] == '+' && arg2[1] == '\0') { - Handle(MoniTool_Option) opt = prof->Option (arg1); - if (opt.IsNull()) { sout<<"Not a recorded Option : "<TypedValue(); - if (tv.IsNull()) { sout<<"Option not for a Parameter : "<Arg(argc-1); - if (!opt->AddBasic (arg3,valname)) { - sout<<"Option "<Option (arg1); - if (opt.IsNull()) { sout<<"Not a recorded Option : "<Switch (arg2)) { - sout<<"Option : "<SetController(control); + sout<<"new norm : "<Name()<Word(0).Value(2) == 'w') modew = Standard_True; - Handle(Transfer_FinderProcess) FP = XSControl::Session(pilot)->MapWriter(); - Handle(Transfer_TransientProcess) TP = XSControl::Session(pilot)->MapReader(); + const Standard_Boolean modew = (pilot->Word(0).Value(2) == 'w'); + const Handle(Transfer_FinderProcess) &FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess(); + const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); Handle(Message_Messenger) sout = Message::DefaultMessenger(); - if ( modew) { if(!FP.IsNull()) FP->Clear(); else sout<<"No Transfer Write"<Clear(); else sout<<"No Transfer Read"<Clear(); else sout<<"No Transfer Write"<Clear(); else sout<<"No Transfer Read"<NbWords(); const Standard_CString arg1 = pilot->Arg(1); //const Standard_CString arg2 = pilot->Arg(2); - Handle(Transfer_TransientProcess) TP= XSControl::Session(pilot)->MapReader(); + const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); Handle(Message_Messenger) sout = Message::DefaultMessenger(); if (TP.IsNull()) { sout<<"No Transfer Read"<NbWords(); const Standard_CString arg1 = pilot->Arg(1); - Handle(Transfer_TransientProcess) TP= XSControl::Session(pilot)->MapReader(); + const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); // **** tpent **** Handle(Message_Messenger) sout = Message::DefaultMessenger(); if (TP.IsNull()) { sout<<"No Transfer Read"<NbWords(); - const Standard_CString arg1 = pilot->Arg(1); - Handle(XSControl_WorkSession) WS = XSControl::Session(pilot); - Handle(Transfer_TransientProcess) TP = WS->MapReader(); - - Handle(Message_Messenger) sout = Message::DefaultMessenger(); - // tpatr tout court : liste tous les attributs - // tpatr nomatr : sur cet attribut, liste les valeurs par entite - - if (argc < 2) { - Handle(Dico_DictionaryOfInteger) list = TP->Attributes(); - for (Dico_IteratorOfDictionaryOfInteger iter(list); iter.More(); iter.Next()) { - TCollection_AsciiString name = iter.Name(); - Standard_Integer nbatr = iter.Value(); - Interface_ParamType aty = TP->AttributeType (name.ToCString()); - sout<<"Name : "<NextItemWithAttribute(arg1,0); num > 0; - num = TP->NextItemWithAttribute(arg1,num)) { - nb ++; - sout<<"Item "<Model()->Print(TP->Mapped(num),sout); - Handle(Transfer_Binder) bnd = TP->MapItem (num); - Interface_ParamType aty = bnd->AttributeType(arg1); - switch (aty) { - case Interface_ParamInteger : sout<<" Integer="<IntegerAttribute(arg1); break; - case Interface_ParamReal : sout<<" Real="<RealAttribute(arg1); break; - case Interface_ParamIdent : sout<<" Object,Type:"<Attribute(arg1)->DynamicType()->Name(); break; - case Interface_ParamText : sout<<" String="<StringAttribute(arg1); - default : sout<<"(none)"; break; - } - sout<NbWords(); const Standard_CString arg1 = pilot->Arg(1); - Handle(Transfer_TransientProcess) TP = XSControl::Session(pilot)->MapReader(); + const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess(); // **** trecord : TransferReader **** Standard_Boolean tous = (argc == 1); Standard_Integer num = -1; - Handle(Interface_InterfaceModel) mdl = XSControl::Session(pilot)->Model(); - Handle(XSControl_TransferReader) TR = XSControl::Session(pilot)->TransferReader(); + const Handle(Interface_InterfaceModel) &mdl = XSControl::Session(pilot)->Model(); + const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader(); Handle(Standard_Transient) ent; Handle(Message_Messenger) sout = Message::DefaultMessenger(); if (mdl.IsNull() || TR.IsNull() || TP.IsNull()) @@ -625,7 +296,7 @@ static IFSelect_ReturnStatus XSControl_trstat(const Handle(IFSelect_SessionPilot const Standard_CString arg1 = pilot->Arg(1); Handle(Message_Messenger) sout = Message::DefaultMessenger(); // **** trstat : TransferReader **** - Handle(XSControl_TransferReader) TR = XSControl::Session(pilot)->TransferReader(); + const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader(); if (TR.IsNull()) { sout<<" init not done"<Model(); if (mdl.IsNull()) { sout<<" No model"<TransferReader(); + Handle(XSControl_TransferReader) TR = XSControl::Session(pilot)->TransferReader(); Standard_Boolean init = TR.IsNull(); if (pilot->NbWords() > 1) { if (pilot->Arg(1)[0] == 'i') init = Standard_True; } if (init) { XSControl::Session(pilot)->InitTransferReader (0); - TR = XSControl::Session(pilot)->TransferReader(); + TR = XSControl::Session(pilot)->TransferReader(); if (TR.IsNull()) { Handle(Message_Messenger) sout = Message::DefaultMessenger(); sout<<" init not done or failed"<Arg(1); // **** tread : TransferReader **** Handle(Message_Messenger) sout = Message::DefaultMessenger(); - Handle(XSControl_TransferReader) TR = XSControl::Session(pilot)->TransferReader(); + const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader(); if (TR.IsNull()) { sout<<" init not done"<Model(); + const Handle(Interface_InterfaceModel) &mdl = TR->Model(); if (mdl.IsNull()) { sout<<" No model"<Session()->NamedItem("xst-model-roots")); @@ -712,11 +383,10 @@ static IFSelect_ReturnStatus XSControl_tread(const Handle(IFSelect_SessionPilot) static IFSelect_ReturnStatus XSControl_trtp(const Handle(IFSelect_SessionPilot)& pilot) { // **** TReader -> TProcess **** - Handle(XSControl_TransferReader) TR = XSControl::Session(pilot)->TransferReader(); + const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader(); Handle(Message_Messenger) sout = Message::DefaultMessenger(); if (TR.IsNull()) sout<<" No TransferReader"<TransientProcess().IsNull()) sout<<" Transfer Reader without Process"<TransientProcess()); return IFSelect_RetDone; } return IFSelect_RetVoid; } @@ -768,7 +438,7 @@ static IFSelect_ReturnStatus XSControl_twstat(const Handle(IFSelect_SessionPilot //Standard_Integer argc = pilot->NbWords(); //const Standard_CString arg1 = pilot->Arg(1); //const Standard_CString arg2 = pilot->Arg(2); - Handle(Transfer_FinderProcess) FP = XSControl::Session(pilot)->MapWriter(); + const Handle(Transfer_FinderProcess) &FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess(); // **** twstat **** // Pour Write Handle(Message_Messenger) sout = Message::DefaultMessenger(); @@ -807,8 +477,6 @@ void XSControl_Functions::Init () IFSelect_Act::AddFunc ("xinit","[norm:string to change norme] reinitialises according to the norm",XSControl_xinit); IFSelect_Act::AddFunc ("xnorm","displays current norm +norm : changes it",XSControl_xnorm); - IFSelect_Act::AddFunc ("xprofile","displays current profile +prof : changes it",XSControl_xprofile); - IFSelect_Act::AddFunc ("xoption","lists options +opt : lists cases +case : changes current case",XSControl_xoption); IFSelect_Act::AddFunc ("newmodel","produces a new empty model, for the session",XSControl_newmodel); @@ -823,7 +491,6 @@ void XSControl_Functions::Init () IFSelect_Act::AddFunc ("tproot","[num:integer] Statistics on a ROOT of transfert (READ)" ,XSControl_tpitem); IFSelect_Act::AddFunc ("twitem","[num:integer] Statistics on an ITEM of transfer (WRITE)" ,XSControl_tpitem); IFSelect_Act::AddFunc ("twroot","[num:integer] Statistics on a ROOT of transfer (WRITE)",XSControl_tpitem); - IFSelect_Act::AddFunc ("tpatr","[name] List all Attributes, or values for a Name",XSControl_tpatr); IFSelect_Act::AddFunc ("trecord","record : all root results; or num : for entity n0.num",XSControl_trecord); IFSelect_Act::AddFunc ("trstat","general statistics; or num : stats on entity n0 num",XSControl_trstat); diff --git a/src/XSControl/XSControl_Functions.hxx b/src/XSControl/XSControl_Functions.hxx index 8b0e3e1933..f2d1f074f9 100644 --- a/src/XSControl/XSControl_Functions.hxx +++ b/src/XSControl/XSControl_Functions.hxx @@ -18,10 +18,6 @@ #define _XSControl_Functions_HeaderFile #include -#include -#include - - //! Functions from XSControl gives access to actions which can be //! commanded with the resources provided by XSControl: especially @@ -30,35 +26,10 @@ //! It works by adding functions by method Init class XSControl_Functions { -public: + public: - DEFINE_STANDARD_ALLOC - - //! Defines and loads all functions for XSControl (as ActFunc) Standard_EXPORT static void Init(); - - - - -protected: - - - - - -private: - - - - - }; - - - - - - #endif // _XSControl_Functions_HeaderFile diff --git a/src/XSControl/XSControl_Reader.cxx b/src/XSControl/XSControl_Reader.cxx index fc5da79fc4..ea17e5cd61 100644 --- a/src/XSControl/XSControl_Reader.cxx +++ b/src/XSControl/XSControl_Reader.cxx @@ -237,7 +237,7 @@ Standard_Boolean XSControl_Reader::TransferEntity (const Handle(Standard_Transient)& start) { if (start.IsNull()) return Standard_False; - Handle(XSControl_TransferReader) TR = thesession->TransferReader(); + const Handle(XSControl_TransferReader) &TR = thesession->TransferReader(); TR->BeginTransfer(); if (TR->TransferOne (start) == 0) return Standard_False; TopoDS_Shape sh = TR->ShapeResult(start); @@ -260,7 +260,7 @@ Standard_Integer XSControl_Reader::TransferList if (list.IsNull()) return 0; Standard_Integer nbt = 0; Standard_Integer i, nb = list->Length(); - Handle(XSControl_TransferReader) TR = thesession->TransferReader(); + const Handle(XSControl_TransferReader) &TR = thesession->TransferReader(); TR->BeginTransfer(); ClearShapes(); ShapeExtend_Explorer STU; @@ -286,12 +286,12 @@ Standard_Integer XSControl_Reader::TransferRoots () NbRootsForTransfer(); Standard_Integer nbt = 0; Standard_Integer i, nb = theroots.Length(); - Handle(XSControl_TransferReader) TR = thesession->TransferReader(); + const Handle(XSControl_TransferReader) &TR = thesession->TransferReader(); TR->BeginTransfer(); ClearShapes(); ShapeExtend_Explorer STU; - Handle(Transfer_TransientProcess) proc = thesession->MapReader(); + const Handle(Transfer_TransientProcess) &proc = thesession->TransferReader()->TransientProcess(); Message_ProgressSentry PS ( proc->GetProgress(), "Root", 0, nb, 1 ); for (i = 1; i <= nb && PS.More(); i ++,PS.Next()) { Handle(Standard_Transient) start = theroots.Value(i); @@ -415,7 +415,7 @@ void XSControl_Reader::GetStatsTransfer (const Handle(TColStd_HSequenceOfTransie Standard_Integer& nbWithResult, Standard_Integer& nbWithFail) const { - Handle(Transfer_TransientProcess) TP = thesession->MapReader(); + const Handle(Transfer_TransientProcess) &TP = thesession->TransferReader()->TransientProcess(); Transfer_IteratorOfProcessForTransient itrp(Standard_True); itrp = TP->CompleteResult(Standard_True); if(!list.IsNull()) itrp.Filter (list); diff --git a/src/XSControl/XSControl_TransferReader.cxx b/src/XSControl/XSControl_TransferReader.cxx index b612cb6d92..36b0cfedca 100644 --- a/src/XSControl/XSControl_TransferReader.cxx +++ b/src/XSControl/XSControl_TransferReader.cxx @@ -57,17 +57,6 @@ #include IMPLEMENT_STANDARD_RTTIEXT(XSControl_TransferReader,MMgt_TShared) -// Precision : -// Pour les regularites -//======================================================================= -//function : XSControl_TransferReader -//purpose : -//======================================================================= -XSControl_TransferReader::XSControl_TransferReader () -{ -} - - //======================================================================= //function : SetController //purpose : @@ -75,24 +64,12 @@ XSControl_TransferReader::XSControl_TransferReader () void XSControl_TransferReader::SetController(const Handle(XSControl_Controller)& control) { - theController = control; - theActor.Nullify(); + myController = control; + myActor.Nullify(); Clear(-1); } -//======================================================================= -//function : SetActor -//purpose : -//======================================================================= - -void XSControl_TransferReader::SetActor - (const Handle(Transfer_ActorOfTransientProcess)& actor) -{ - theActor = actor; -} - - //======================================================================= //function : Actor //purpose : @@ -100,9 +77,9 @@ void XSControl_TransferReader::SetActor Handle(Transfer_ActorOfTransientProcess) XSControl_TransferReader::Actor () { - if ( theActor.IsNull() && !theController.IsNull() && !theModel.IsNull()) - theActor = theController->ActorRead(theModel); - return theActor; + if ( myActor.IsNull() && !myController.IsNull() && !myModel.IsNull()) + myActor = myController->ActorRead(myModel); + return myActor; } @@ -113,8 +90,8 @@ Handle(Transfer_ActorOfTransientProcess) XSControl_TransferReader::Actor () void XSControl_TransferReader::SetModel(const Handle(Interface_InterfaceModel)& model) { - theModel = model; - if (!theTransfer.IsNull()) theTransfer->SetModel(model); + myModel = model; + if (!myTP.IsNull()) myTP->SetModel(model); } @@ -127,25 +104,14 @@ void XSControl_TransferReader::SetGraph(const Handle(Interface_HGraph)& graph) { if (graph.IsNull()) { - theModel.Nullify(); + myModel.Nullify(); } else - theModel = graph->Graph().Model(); + myModel = graph->Graph().Model(); - theGraph = graph; + myGraph = graph; - if (!theTransfer.IsNull()) theTransfer->SetGraph(graph); -} - - -//======================================================================= -//function : Model -//purpose : -//======================================================================= - -Handle(Interface_InterfaceModel) XSControl_TransferReader::Model () const -{ - return theModel; + if (!myTP.IsNull()) myTP->SetGraph(graph); } @@ -157,8 +123,8 @@ Handle(Interface_InterfaceModel) XSControl_TransferReader::Model () const void XSControl_TransferReader::SetContext(const Standard_CString name, const Handle(Standard_Transient)& ctx) { - if (theContext.IsNull()) theContext = new Dico_DictionaryOfTransient; - theContext->SetItem (name,ctx); + if (myContext.IsNull()) myContext = new Dico_DictionaryOfTransient; + myContext->SetItem (name,ctx); } @@ -171,8 +137,8 @@ Standard_Boolean XSControl_TransferReader::GetContext (const Standard_CString name, const Handle(Standard_Type)& type, Handle(Standard_Transient)& ctx) const { - if (theContext.IsNull()) return Standard_False; - if (!theContext->GetItem (name,ctx)) ctx.Nullify(); + if (myContext.IsNull()) return Standard_False; + if (!myContext->GetItem (name,ctx)) ctx.Nullify(); if (ctx.IsNull()) return Standard_False; if (type.IsNull()) return Standard_True; if (!ctx->IsKind(type)) ctx.Nullify(); @@ -180,40 +146,6 @@ Standard_Boolean XSControl_TransferReader::GetContext } -//======================================================================= -//function : Context -//purpose : -//======================================================================= - -Handle(Dico_DictionaryOfTransient)& XSControl_TransferReader::Context () -{ - return theContext; -} - - -//======================================================================= -//function : SetFileName -//purpose : -//======================================================================= - -void XSControl_TransferReader::SetFileName (const Standard_CString name) -{ - theFilename.Clear(); - theFilename.AssignCat(name); -} - - -//======================================================================= -//function : FileName -//purpose : -//======================================================================= - -Standard_CString XSControl_TransferReader::FileName () const -{ - return theFilename.ToCString(); -} - - //======================================================================= //function : Clear //purpose : @@ -222,42 +154,19 @@ Standard_CString XSControl_TransferReader::FileName () const void XSControl_TransferReader::Clear (const Standard_Integer mode) { if (mode & 1) { - theResults.Clear(); - theShapeResult.Nullify(); + myResults.Clear(); + myShapeResult.Nullify(); } if (mode & 2) { - theModel.Nullify(); - theGraph.Nullify(); - theTransfer.Nullify(); - theActor.Nullify(); - theFilename.Clear(); + myModel.Nullify(); + myGraph.Nullify(); + myTP.Nullify(); + myActor.Nullify(); + myFileName.Clear(); } } -//======================================================================= -//function : TransientProcess -//purpose : -//======================================================================= - -Handle(Transfer_TransientProcess) XSControl_TransferReader::TransientProcess () const -{ - return theTransfer; -} - - -//======================================================================= -//function : SetTransientProcess -//purpose : -//======================================================================= - -void XSControl_TransferReader::SetTransientProcess - (const Handle(Transfer_TransientProcess)& TP) -{ - theTransfer = TP; -} - - // ######################################################## // ########### RESULTATS ############ @@ -270,13 +179,13 @@ void XSControl_TransferReader::SetTransientProcess Standard_Boolean XSControl_TransferReader::RecordResult (const Handle(Standard_Transient)& ent) { - if (theModel.IsNull() || theTransfer.IsNull()) return Standard_False; - Standard_Integer num = theModel->Number(ent); + if (myModel.IsNull() || myTP.IsNull()) return Standard_False; + Standard_Integer num = myModel->Number(ent); if (num == 0) return Standard_False; - Handle(TCollection_HAsciiString) lab = theModel->StringLabel(ent); + Handle(TCollection_HAsciiString) lab = myModel->StringLabel(ent); Handle(Transfer_ResultFromModel) res = new Transfer_ResultFromModel; - res->Fill (theTransfer,ent); + res->Fill (myTP,ent); // Cas du resultat Shape : pour resultat principal, faire HShape ... Handle(Transfer_Binder) binder = res->MainResult()->Binder(); @@ -288,8 +197,8 @@ Standard_Boolean XSControl_TransferReader::RecordResult res->MainResult()->SetBinder (trb); } - res->SetFileName(theFilename.ToCString()); - theResults.Bind(num,res); + res->SetFileName(myFileName.ToCString()); + myResults.Bind(num,res); return Standard_True; } @@ -302,11 +211,11 @@ Standard_Boolean XSControl_TransferReader::RecordResult Standard_Boolean XSControl_TransferReader::IsRecorded (const Handle(Standard_Transient)& ent) const { - if (theModel.IsNull()) return Standard_False; - Standard_Integer num = theModel->Number(ent); + if (myModel.IsNull()) return Standard_False; + Standard_Integer num = myModel->Number(ent); if (num == 0) return Standard_False; - if(!theResults.IsBound(num)) return Standard_False; - return (theResults.Find(num)->DynamicType() == STANDARD_TYPE(Transfer_ResultFromModel) ); + if(!myResults.IsBound(num)) return Standard_False; + return (myResults.Find(num)->DynamicType() == STANDARD_TYPE(Transfer_ResultFromModel) ); } @@ -318,11 +227,11 @@ Standard_Boolean XSControl_TransferReader::IsRecorded Standard_Boolean XSControl_TransferReader::HasResult (const Handle(Standard_Transient)& ent) const { - if (theModel.IsNull()) return Standard_False; - Standard_Integer num = theModel->Number(ent); + if (myModel.IsNull()) return Standard_False; + Standard_Integer num = myModel->Number(ent); if (num == 0) return Standard_False; - if(!theResults.IsBound(num)) return Standard_False; - DeclareAndCast(Transfer_ResultFromModel,fr,theResults.Find(num)); + if(!myResults.IsBound(num)) return Standard_False; + DeclareAndCast(Transfer_ResultFromModel,fr,myResults.Find(num)); if (fr.IsNull()) return Standard_False; return fr->HasResult(); } @@ -336,11 +245,11 @@ Standard_Boolean XSControl_TransferReader::HasResult Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::RecordedList () const { Handle(TColStd_HSequenceOfTransient) li = new TColStd_HSequenceOfTransient(); - if (theModel.IsNull()) return li; - Standard_Integer i, nb = theModel->NbEntities(); + if (myModel.IsNull()) return li; + Standard_Integer i, nb = myModel->NbEntities(); for (i = 1; i <= nb; i ++) { - if(theResults.IsBound(i)) - if(!theResults.Find(i).IsNull()) li->Append (theModel->Value(i)); + if(myResults.IsBound(i)) + if(!myResults.Find(i).IsNull()) li->Append (myModel->Value(i)); } return li; } @@ -353,10 +262,10 @@ Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::RecordedList () c Standard_Boolean XSControl_TransferReader::Skip(const Handle(Standard_Transient)& ent) { - if (theModel.IsNull() || theTransfer.IsNull()) return Standard_False; - Standard_Integer num = theModel->Number(ent); + if (myModel.IsNull() || myTP.IsNull()) return Standard_False; + Standard_Integer num = myModel->Number(ent); if (num == 0) return Standard_False; - theResults.Bind(num,ent); + myResults.Bind(num,ent); return Standard_True; } @@ -369,11 +278,11 @@ Standard_Boolean XSControl_TransferReader::Skip(const Handle(Standard_Transient) Standard_Boolean XSControl_TransferReader::IsSkipped (const Handle(Standard_Transient)& ent) const { - if (theModel.IsNull()) return Standard_False; - Standard_Integer num = theModel->Number(ent); + if (myModel.IsNull()) return Standard_False; + Standard_Integer num = myModel->Number(ent); if (num == 0) return Standard_False; - if(!theResults.IsBound(num)) return Standard_False; - return (theResults.Find(num)->DynamicType() != STANDARD_TYPE(Transfer_ResultFromModel) ); + if(!myResults.IsBound(num)) return Standard_False; + return (myResults.Find(num)->DynamicType() != STANDARD_TYPE(Transfer_ResultFromModel) ); } @@ -385,11 +294,11 @@ Standard_Boolean XSControl_TransferReader::IsSkipped Standard_Boolean XSControl_TransferReader::IsMarked (const Handle(Standard_Transient)& ent) const { - if (theModel.IsNull()) return Standard_False; - Standard_Integer num = theModel->Number(ent); + if (myModel.IsNull()) return Standard_False; + Standard_Integer num = myModel->Number(ent); if (num == 0) return Standard_False; - if(!theResults.IsBound(num)) return Standard_False; - if (theResults.Find(num).IsNull()) return Standard_False; + if(!myResults.IsBound(num)) return Standard_False; + if (myResults.Find(num).IsNull()) return Standard_False; return Standard_True; } @@ -406,11 +315,11 @@ Handle(Transfer_ResultFromModel) XSControl_TransferReader::FinalResult (const Handle(Standard_Transient)& ent) const { Handle(Transfer_ResultFromModel) res; - if (theModel.IsNull()) return res; - Standard_Integer num = theModel->Number(ent); + if (myModel.IsNull()) return res; + Standard_Integer num = myModel->Number(ent); if (num == 0) return res; - if(!theResults.IsBound(num)) return res; - res = GetCasted(Transfer_ResultFromModel,theResults.Find(num)); + if(!myResults.IsBound(num)) return res; + res = GetCasted(Transfer_ResultFromModel,myResults.Find(num)); return res; } @@ -452,9 +361,9 @@ Handle(Transfer_ResultFromModel) XSControl_TransferReader::ResultFromNumber (const Standard_Integer num) const { Handle(Transfer_ResultFromModel) res; - if ( num<1 || num>theModel->NbEntities() ) return res; - if(!theResults.IsBound(num)) return res; - res = GetCasted(Transfer_ResultFromModel,theResults.Find(num)); + if ( num<1 || num>myModel->NbEntities() ) return res; + if(!myResults.IsBound(num)) return res; + res = GetCasted(Transfer_ResultFromModel,myResults.Find(num)); return res; } @@ -511,14 +420,14 @@ TopoDS_Shape XSControl_TransferReader::ShapeResult Standard_Boolean XSControl_TransferReader::ClearResult (const Handle(Standard_Transient)& ent, const Standard_Integer mode) { - if (theModel.IsNull()) return Standard_False; - Standard_Integer num = theModel->Number(ent); + if (myModel.IsNull()) return Standard_False; + Standard_Integer num = myModel->Number(ent); if (num == 0) return Standard_False; - if(!theResults.IsBound(num)) return Standard_False; + if(!myResults.IsBound(num)) return Standard_False; if (mode < 0) - theResults.ChangeFind(num).Nullify(); + myResults.ChangeFind(num).Nullify(); else { - DeclareAndCast(Transfer_ResultFromModel,resu,theResults.Find(num)); + DeclareAndCast(Transfer_ResultFromModel,resu,myResults.Find(num)); if (resu.IsNull()) return Standard_False; resu->Strip (mode); } @@ -551,29 +460,29 @@ Handle(Standard_Transient) XSControl_TransferReader::EntityFromResult if (mode == 0 || mode == 1) { // on regarde dans le TransientProcess (Roots ou tous Mappeds) - if (!theTransfer.IsNull()) { - nb = (mode == 0 ? theTransfer->NbRoots() : theTransfer->NbMapped()); + if (!myTP.IsNull()) { + nb = (mode == 0 ? myTP->NbRoots() : myTP->NbMapped()); for (j = 1; j <= nb; j ++) { - i = (mode == 0 ? theModel->Number (theTransfer->Root(j)) : j); + i = (mode == 0 ? myModel->Number (myTP->Root(j)) : j); if (i == 0) continue; - abinder = theTransfer->MapItem(i); + abinder = myTP->MapItem(i); if (abinder.IsNull()) continue; if (!binder.IsNull()) { - if (binder == abinder) return theTransfer->Mapped(i); + if (binder == abinder) return myTP->Mapped(i); continue; } DeclareAndCast(Transfer_SimpleBinderOfTransient,trb,abinder); if (trb.IsNull()) continue; - if (trb->Result() == res) return theTransfer->Mapped(i); + if (trb->Result() == res) return myTP->Mapped(i); } } return nulh; // Null } - // Recherche dans theResults (racines) + // Recherche dans myResults (racines) // 2 : Main only 3 : Main + one sub; 4 : all if (mode >= 2) { - nb = theModel->NbEntities(); + nb = myModel->NbEntities(); for (i = 1; i <= nb; i ++) { Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i); if (rec.IsNull()) return nulh; @@ -611,13 +520,13 @@ Handle(Standard_Transient) XSControl_TransferReader::EntityFromShapeResult XSControl_Utils xu; if (mode == 0 || mode == 1 || mode == -1) { // on regarde dans le TransientProcess - if (!theTransfer.IsNull()) { - nb = (mode == 0 ? theTransfer->NbRoots() : theTransfer->NbMapped()); + if (!myTP.IsNull()) { + nb = (mode == 0 ? myTP->NbRoots() : myTP->NbMapped()); for (j = 1; j <= nb; j ++) { - i = (mode == 0 ? theModel->Number (theTransfer->Root(j)) : j); + i = (mode == 0 ? myModel->Number (myTP->Root(j)) : j); if (i == 0) continue; - Handle(Standard_Transient) ent = theTransfer->Mapped(i); - TopoDS_Shape sh = TransferBRep::ShapeResult (theTransfer,ent); + Handle(Standard_Transient) ent = myTP->Mapped(i); + TopoDS_Shape sh = TransferBRep::ShapeResult (myTP,ent); if (!sh.IsNull()) { if (sh == res) return ent; // priorites moindre : Same (tjrs) ou Partner (mode < 0) @@ -632,10 +541,10 @@ Handle(Standard_Transient) XSControl_TransferReader::EntityFromShapeResult return nulh; } - // Recherche dans theResults (racines) + // Recherche dans myResults (racines) // 2 : Main only 3 : Main + one sub; 4 : all if (mode >= 2) { - nb = theModel->NbEntities(); + nb = myModel->NbEntities(); for (i = 1; i <= nb; i ++) { Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i); if (rec.IsNull()) continue; @@ -679,24 +588,24 @@ Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::EntitiesFromShape XSControl_Utils xu; if (mode == 0 || mode == 1) { // on regarde dans le TransientProcess - if (!theTransfer.IsNull()) { - nb = (mode == 0 ? theTransfer->NbRoots() : theTransfer->NbMapped()); + if (!myTP.IsNull()) { + nb = (mode == 0 ? myTP->NbRoots() : myTP->NbMapped()); for (j = 1; j <= nb; j ++) { - i = (mode == 0 ? theModel->Number (theTransfer->Root(j)) : j); + i = (mode == 0 ? myModel->Number (myTP->Root(j)) : j); if (i == 0) continue; - TopoDS_Shape sh = xu.BinderShape (theTransfer->MapItem(i)); + TopoDS_Shape sh = xu.BinderShape (myTP->MapItem(i)); if (!sh.IsNull() && shapes.Contains(sh)) { - lt->Append (theTransfer->Mapped(i)); + lt->Append (myTP->Mapped(i)); j=nb; //skl (for looking for entities in checkbrep) } } } } - // Recherche dans theResults (racines) + // Recherche dans myResults (racines) // 2 : Main only 3 : Main + one sub; 4 : all if (mode >= 2) { - nb = theModel->NbEntities(); + nb = myModel->NbEntities(); for (i = 1; i <= nb; i ++) { Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i); if (rec.IsNull()) continue; @@ -729,10 +638,10 @@ Interface_CheckIterator XSControl_TransferReader::CheckList (const Handle(Standard_Transient)& ent, const Standard_Integer level) const { Interface_CheckIterator chl; - if (theModel.IsNull() || ent.IsNull()) return chl; + if (myModel.IsNull() || ent.IsNull()) return chl; // Check-List COMPLETE ... tout le Modele - if (ent == theModel) { - Standard_Integer i,nb = theModel->NbEntities(); + if (ent == myModel) { + Standard_Integer i,nb = myModel->NbEntities(); for (i = 1; i <= nb; i ++) { Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i); if (!rec.IsNull()) { @@ -756,14 +665,14 @@ Interface_CheckIterator XSControl_TransferReader::CheckList // sinon, Check-List sur une entite : Last ou FinalResult else if (level < 0) { - if (theTransfer.IsNull()) return chl; - chl.Add (theTransfer->Check(ent),theModel->Number(ent)); + if (myTP.IsNull()) return chl; + chl.Add (myTP->Check(ent),myModel->Number(ent)); } else { Handle(Transfer_ResultFromModel) rec = FinalResult (ent); if (rec.IsNull()) return chl; chl = rec->CheckList(Standard_False,level); // manque level ... } - if (ent == theModel) chl.SetName ("XSControl : CheckList complete Model"); + if (ent == myModel) chl.SetName ("XSControl : CheckList complete Model"); else if (level < 0) chl.SetName ("XSControl : CheckList Last"); else if (level == 0) chl.SetName ("XSControl : CheckList Final Main"); else if (level == 1) chl.SetName ("XSControl : CheckList Final Main+Subs"); @@ -801,8 +710,8 @@ Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::CheckedList Handle(TColStd_HSequenceOfTransient) res = new TColStd_HSequenceOfTransient(); if (ent.IsNull()) return res; - if (ent == theModel) { - Standard_Integer i,nb = theModel->NbEntities(); + if (ent == myModel) { + Standard_Integer i,nb = myModel->NbEntities(); for (i = 1; i <= nb; i ++) { Handle(Transfer_ResultFromModel) rec = ResultFromNumber (i); if (!rec.IsNull()) res->Append (rec->CheckedList(withcheck,level)); @@ -834,19 +743,19 @@ Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::CheckedList Standard_Boolean XSControl_TransferReader::BeginTransfer () { - if (theModel.IsNull()) return Standard_False; + if (myModel.IsNull()) return Standard_False; if (Actor().IsNull()) return Standard_False; - theShapeResult.Nullify(); + myShapeResult.Nullify(); - if (theTransfer.IsNull()) theTransfer = new Transfer_TransientProcess - (theModel->NbEntities()); + if (myTP.IsNull()) myTP = new Transfer_TransientProcess + (myModel->NbEntities()); Handle(Transfer_ActorOfTransientProcess) actor; - theTransfer->SetActor (actor); // -> RAZ + myTP->SetActor (actor); // -> RAZ actor = Actor(); - theTransfer->SetActor (actor); // Set proprement dit - theTransfer->SetErrorHandle (Standard_True); - theTransfer->Context() = theContext; + myTP->SetActor (actor); // Set proprement dit + myTP->SetErrorHandle (Standard_True); + myTP->Context() = myContext; return Standard_True; } @@ -859,8 +768,8 @@ Standard_Boolean XSControl_TransferReader::BeginTransfer () Standard_Boolean XSControl_TransferReader::Recognize (const Handle(Standard_Transient)& ent) { - if (theActor.IsNull()) return Standard_False; - return theActor->Recognize (ent); + if (myActor.IsNull()) return Standard_False; + return myActor->Recognize (ent); } @@ -872,30 +781,30 @@ Standard_Boolean XSControl_TransferReader::Recognize Standard_Integer XSControl_TransferReader::TransferOne (const Handle(Standard_Transient)& ent, const Standard_Boolean rec) { - if (theActor.IsNull() || theModel.IsNull()) return 0; + if (myActor.IsNull() || myModel.IsNull()) return 0; - if (theTransfer.IsNull()) { if (!BeginTransfer()) return 0; } + if (myTP.IsNull()) { if (!BeginTransfer()) return 0; } - Handle(Message_Messenger) sout = theTransfer->Messenger(); - Standard_Integer level = theTransfer->TraceLevel(); + Handle(Message_Messenger) sout = myTP->Messenger(); + Standard_Integer level = myTP->TraceLevel(); - Transfer_TransferOutput TP (theTransfer,theModel); - if (theGraph.IsNull()) theTransfer->SetModel(theModel); - else theTransfer->SetGraph(theGraph); + Transfer_TransferOutput TP (myTP,myModel); + if (myGraph.IsNull()) myTP->SetModel(myModel); + else myTP->SetGraph(myGraph); // pour le log-file if (level > 1) { - Standard_Integer num = theModel->Number(ent); - Handle(TCollection_HAsciiString) lab = theModel->StringLabel(ent); + Standard_Integer num = myModel->Number(ent); + Handle(TCollection_HAsciiString) lab = myModel->StringLabel(ent); sout<<"\n*******************************************************************\n"; sout << "****** Transferring one Entity ******"<ToCString() << Interface_MSG::Blanks(14 - lab->Length())<<"******\n"; - sout << "****** Type : "<TypeName(ent,Standard_False) - << Interface_MSG::Blanks((Standard_Integer) (44 - strlen(theModel->TypeName(ent,Standard_False)))) + sout << "****** Type : "<TypeName(ent,Standard_False) + << Interface_MSG::Blanks((Standard_Integer) (44 - strlen(myModel->TypeName(ent,Standard_False)))) << "******"; sout<<"\n*******************************************************************\n"; } @@ -904,10 +813,10 @@ Standard_Integer XSControl_TransferReader::TransferOne Standard_Integer res = 0; Handle(Standard_Transient) obj = ent; TP.Transfer (obj); - theTransfer->SetRoot (obj); + myTP->SetRoot (obj); // Resultat ... - Handle(Transfer_Binder) binder = theTransfer->Find (obj); + Handle(Transfer_Binder) binder = myTP->Find (obj); if (binder.IsNull()) return res; if (rec) RecordResult (obj); @@ -926,16 +835,16 @@ Standard_Integer XSControl_TransferReader::TransferOne Standard_Integer XSControl_TransferReader::TransferList (const Handle(TColStd_HSequenceOfTransient)& list, const Standard_Boolean rec) { - if (theActor.IsNull() || theModel.IsNull()) return 0; + if (myActor.IsNull() || myModel.IsNull()) return 0; - if (theTransfer.IsNull()) { if (!BeginTransfer()) return 0; } + if (myTP.IsNull()) { if (!BeginTransfer()) return 0; } - Handle(Message_Messenger) sout = theTransfer->Messenger(); - Standard_Integer level = theTransfer->TraceLevel(); + Handle(Message_Messenger) sout = myTP->Messenger(); + Standard_Integer level = myTP->TraceLevel(); - Transfer_TransferOutput TP (theTransfer,theModel); - if (theGraph.IsNull()) theTransfer->SetModel(theModel); - else theTransfer->SetGraph(theGraph); + Transfer_TransferOutput TP (myTP,myModel); + if (myGraph.IsNull()) myTP->SetModel(myModel); + else myTP->SetGraph(myGraph); Standard_Integer i,nb = list->Length(); @@ -947,7 +856,7 @@ Standard_Integer XSControl_TransferReader::TransferList Handle(IFSelect_SignatureList) sl = new IFSelect_SignatureList; for (i = 1; i <= nb; i ++) - sl->Add (list->Value(i), theModel->TypeName(list->Value(i),Standard_False)); + sl->Add (list->Value(i), myModel->TypeName(list->Value(i),Standard_False)); sl->SetName ("Entities to Transfer"); sl->PrintCount (sout); sout<<"\n*******************************************************************\n"; @@ -961,10 +870,10 @@ Standard_Integer XSControl_TransferReader::TransferList for (i = 1; i <= nb; i ++) { obj = list->Value(i); TP.Transfer (obj); - theTransfer->SetRoot (obj); + myTP->SetRoot (obj); // Resultat ... - Handle(Transfer_Binder) binder = theTransfer->Find (obj); + Handle(Transfer_Binder) binder = myTP->Find (obj); if (binder.IsNull()) continue; if (rec) RecordResult (obj); @@ -985,14 +894,14 @@ Standard_Integer XSControl_TransferReader::TransferList Standard_Integer XSControl_TransferReader::TransferRoots(const Interface_Graph& G) { - if (theModel != G.Model()) return -1; + if (myModel != G.Model()) return -1; if (!BeginTransfer()) return -1; - Handle(Message_Messenger) sout = theTransfer->Messenger(); - Standard_Integer level = theTransfer->TraceLevel(); + Handle(Message_Messenger) sout = myTP->Messenger(); + Standard_Integer level = myTP->TraceLevel(); - Transfer_TransferOutput TP (theTransfer,theModel); - if (theGraph.IsNull()) theTransfer->SetModel(theModel); - else theTransfer->SetGraph(theGraph); + Transfer_TransferOutput TP (myTP,myModel); + if (myGraph.IsNull()) myTP->SetModel(myModel); + else myTP->SetGraph(myGraph); // Pour le log-file if (level > 0) { @@ -1003,7 +912,7 @@ Standard_Integer XSControl_TransferReader::TransferRoots(const Interface_Graph& sout<<"\n*******************************************************************\n"; Handle(IFSelect_SignatureList) sl = new IFSelect_SignatureList; for (roots.Start(); roots.More(); roots.Next()) - sl->Add (roots.Value(),theModel->TypeName(roots.Value(),Standard_False)); + sl->Add (roots.Value(),myModel->TypeName(roots.Value(),Standard_False)); sl->SetName ("Entities to Transfer"); sl->PrintCount (sout); sout<<"\n*******************************************************************\n"; @@ -1012,19 +921,19 @@ Standard_Integer XSControl_TransferReader::TransferRoots(const Interface_Graph& TP.TransferRoots (G); // Les entites transferees sont notees "asmain" - Standard_Integer i,n = theTransfer->NbMapped(); + Standard_Integer i,n = myTP->NbMapped(); for (i = 1; i <= n; i ++) { - Handle(Standard_Transient) ent = theTransfer->Mapped(i); - Handle(Transfer_Binder) bnd = theTransfer->MapItem(i); + Handle(Standard_Transient) ent = myTP->Mapped(i); + Handle(Transfer_Binder) bnd = myTP->MapItem(i); if (bnd.IsNull()) continue; if (!bnd->HasResult()) continue; RecordResult (ent); } // Resultat ... on note soigneuseument les Shapes - theShapeResult = TransferBRep::Shapes (theTransfer,Standard_True); + myShapeResult = TransferBRep::Shapes (myTP,Standard_True); // ???? Et ici, il faut alimenter Imagine ... - return theShapeResult->Length(); + return myShapeResult->Length(); } @@ -1036,10 +945,10 @@ Standard_Integer XSControl_TransferReader::TransferRoots(const Interface_Graph& void XSControl_TransferReader::TransferClear(const Handle(Standard_Transient)& ent, const Standard_Integer level) { - if (theTransfer.IsNull()) return; - if (ent == theModel) { theTransfer->Clear(); return; } + if (myTP.IsNull()) return; + if (ent == myModel) { myTP->Clear(); return; } - theTransfer->RemoveResult (ent,level); + myTP->RemoveResult (ent,level); ClearResult (ent,-1); } @@ -1053,7 +962,7 @@ void XSControl_TransferReader::TransferClear(const Handle(Standard_Transient)& e void XSControl_TransferReader::PrintStats (const Standard_Integer what, const Standard_Integer mode) const { - Handle(Message_Messenger) sout = theTransfer->Messenger(); + Handle(Message_Messenger) sout = myTP->Messenger(); // A ameliorer ... ! sout<<"\n*******************************************************************\n"; sout << "****** Statistics on Transfer (Read) ******"< 10) { sout<<" *** Not yet implemented"<Length(); Handle(IFSelect_SignatureList) counter; @@ -1076,17 +985,17 @@ void XSControl_TransferReader::PrintStats sout<<"**** Nb Recorded : "<Value(i); - if (mode == 0) { sout<<" "<Number(ent); continue; } + if (mode == 0) { sout<<" "<Number(ent); continue; } if (mode == 1 || mode == 2) { sout<<"[ "<Print (ent,sout); - sout<<" Type:"<TypeName(ent,Standard_False); + myModel->Print (ent,sout); + sout<<" Type:"<TypeName(ent,Standard_False); } if (mode >= 3 && mode <= 6) { - counter->Add (ent,theModel->TypeName(ent,Standard_False)); + counter->Add (ent,myModel->TypeName(ent,Standard_False)); } } - if (!counter.IsNull()) counter->PrintList(sout,theModel,pcm); + if (!counter.IsNull()) counter->PrintList(sout,myModel,pcm); sout<CheckList (Standard_False); + if (!myTP.IsNull()) chl = myTP->CheckList (Standard_False); return chl; } @@ -1118,15 +1027,15 @@ Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::LastTransferList (const Standard_Boolean roots) const { Handle(TColStd_HSequenceOfTransient) li = new TColStd_HSequenceOfTransient(); - if (theTransfer.IsNull()) return li; + if (myTP.IsNull()) return li; Standard_Integer i,j,nb = - (roots ? theTransfer->NbRoots() : theTransfer->NbMapped()); + (roots ? myTP->NbRoots() : myTP->NbMapped()); for (j = 1; j <= nb; j ++) { - i = (roots ? theModel->Number (theTransfer->Root(j)) : j); - Handle(Transfer_Binder) bnd = theTransfer->MapItem(i); + i = (roots ? myModel->Number (myTP->Root(j)) : j); + Handle(Transfer_Binder) bnd = myTP->MapItem(i); if (bnd.IsNull()) continue; if (!bnd->HasResult()) continue; - li->Append (theTransfer->Mapped(i)); + li->Append (myTP->Mapped(i)); } return li; } @@ -1137,26 +1046,25 @@ Handle(TColStd_HSequenceOfTransient) XSControl_TransferReader::LastTransferList //purpose : //======================================================================= -Handle(TopTools_HSequenceOfShape) XSControl_TransferReader::ShapeResultList +const Handle(TopTools_HSequenceOfShape) & XSControl_TransferReader::ShapeResultList (const Standard_Boolean rec) { if (!rec) { - if (theShapeResult.IsNull()) theShapeResult = - TransferBRep::Shapes (theTransfer,Standard_True); - if (theShapeResult.IsNull()) theShapeResult = new TopTools_HSequenceOfShape(); + if (myShapeResult.IsNull()) myShapeResult = TransferBRep::Shapes (myTP,Standard_True); + if (myShapeResult.IsNull()) myShapeResult = new TopTools_HSequenceOfShape(); } else { - if (theShapeResult.IsNull()) theShapeResult = new TopTools_HSequenceOfShape(); - if (theModel.IsNull()) return theShapeResult; + if (myShapeResult.IsNull()) myShapeResult = new TopTools_HSequenceOfShape(); + if (myModel.IsNull()) return myShapeResult; Handle(TColStd_HSequenceOfTransient) li = RecordedList(); - theShapeResult = new TopTools_HSequenceOfShape(); - Standard_Integer i, nb = theModel->NbEntities(); + myShapeResult = new TopTools_HSequenceOfShape(); + Standard_Integer i, nb = myModel->NbEntities(); TopoDS_Shape sh; for (i = 1; i <= nb; i ++) { - sh = ShapeResult (theModel->Value(i)); - if (!sh.IsNull()) theShapeResult->Append(sh); + sh = ShapeResult (myModel->Value(i)); + if (!sh.IsNull()) myShapeResult->Append(sh); } } - return theShapeResult; + return myShapeResult; } diff --git a/src/XSControl/XSControl_TransferReader.hxx b/src/XSControl/XSControl_TransferReader.hxx index 23a4f2b7f2..0ff7c7ff71 100644 --- a/src/XSControl/XSControl_TransferReader.hxx +++ b/src/XSControl/XSControl_TransferReader.hxx @@ -24,10 +24,6 @@ #include #include #include -#include -#include -#include -#include #include #include class XSControl_Controller; @@ -66,20 +62,20 @@ DEFINE_STANDARD_HANDLE(XSControl_TransferReader, MMgt_TShared) //! Transient or Shapes class XSControl_TransferReader : public MMgt_TShared { + public: -public: - - //! Creates a TransferReader, empty - Standard_EXPORT XSControl_TransferReader(); + XSControl_TransferReader() + {} //! Sets a Controller. It is required to generate the Actor. //! Elsewhere, the Actor must be provided directly - Standard_EXPORT void SetController (const Handle(XSControl_Controller)& control); + Standard_EXPORT void SetController (const Handle(XSControl_Controller)& theControl); //! Sets the Actor directly : this value will be used if the //! Controller is not set - Standard_EXPORT void SetActor (const Handle(Transfer_ActorOfTransientProcess)& actor); + void SetActor (const Handle(Transfer_ActorOfTransientProcess)& theActor) + { myActor = theActor; } //! Returns the Actor, determined by the Controller, or if this //! one is unknown, directly set. @@ -88,64 +84,70 @@ public: //! Sets an InterfaceModel. This causes former results, computed //! from another one, to be lost (see also Clear) - Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& model); + Standard_EXPORT void SetModel (const Handle(Interface_InterfaceModel)& theModel); //! Sets a Graph and its InterfaceModel (calls SetModel) - Standard_EXPORT void SetGraph (const Handle(Interface_HGraph)& graph); + Standard_EXPORT void SetGraph (const Handle(Interface_HGraph)& theGraph); //! Returns the currently set InterfaceModel - Standard_EXPORT Handle(Interface_InterfaceModel) Model() const; + const Handle(Interface_InterfaceModel) & Model() const + { return myModel; } //! Sets a Context : according to receiving appli, to be //! interpreted by the Actor - Standard_EXPORT void SetContext (const Standard_CString name, const Handle(Standard_Transient)& ctx); + Standard_EXPORT void SetContext (const Standard_CString theName, const Handle(Standard_Transient)& theCtx); //! Returns the Context attached to a name, if set and if it is //! Kind of the type, else a Null Handle //! Returns True if OK, False if no Context - Standard_EXPORT Standard_Boolean GetContext (const Standard_CString name, const Handle(Standard_Type)& type, Handle(Standard_Transient)& ctx) const; + Standard_EXPORT Standard_Boolean GetContext (const Standard_CString theName, const Handle(Standard_Type)& theType, Handle(Standard_Transient)& theCtx) const; //! Returns (modifiable) the whole definition of Context //! Rather for internal use (ex.: preparing and setting in once) - Standard_EXPORT Handle(Dico_DictionaryOfTransient)& Context(); + Handle(Dico_DictionaryOfTransient)& Context() + { return myContext; } //! Sets a new value for (loaded) file name - Standard_EXPORT void SetFileName (const Standard_CString name); - + void SetFileName (const Standard_CString theName) + { myFileName = theName; } + //! Returns actual value of file name - Standard_EXPORT Standard_CString FileName() const; + Standard_CString FileName() const + { return myFileName.ToCString(); } //! Clears data, according mode : //! -1 all //! 0 nothing done //! +1 final results //! +2 working data (model, context, transfer process) - Standard_EXPORT void Clear (const Standard_Integer mode); + Standard_EXPORT void Clear (const Standard_Integer theMode); //! Returns the currently used TransientProcess //! It is computed from the model by TransferReadRoots, or by //! BeginTransferRead - Standard_EXPORT Handle(Transfer_TransientProcess) TransientProcess() const; + const Handle(Transfer_TransientProcess) & TransientProcess () const + { return myTP; } //! Forces the TransientProcess //! Remark : it also changes the Model and the Actor, from those //! recorded in the new TransientProcess - Standard_EXPORT void SetTransientProcess (const Handle(Transfer_TransientProcess)& TP); + void SetTransientProcess (const Handle(Transfer_TransientProcess)& theTP) + { myTP = theTP; } //! Records a final result of transferring an entity //! This result is recorded as a ResultFromModel, taken from //! the TransientProcess //! Returns True if a result is available, False else - Standard_EXPORT Standard_Boolean RecordResult (const Handle(Standard_Transient)& ent); + Standard_EXPORT Standard_Boolean RecordResult (const Handle(Standard_Transient)& theEnt); //! Returns True if a final result is recorded for an entity //! Remark that it can bring no effective result if transfer has //! completely failed (FinalResult brings only fail messages ...) - Standard_EXPORT Standard_Boolean IsRecorded (const Handle(Standard_Transient)& ent) const; + Standard_EXPORT Standard_Boolean IsRecorded (const Handle(Standard_Transient)& theEnt) const; //! Returns True if a final result is recorded AND BRINGS AN //! EFFECTIVE RESULT (else, it brings only fail messages) - Standard_EXPORT Standard_Boolean HasResult (const Handle(Standard_Transient)& ent) const; + Standard_EXPORT Standard_Boolean HasResult (const Handle(Standard_Transient)& theEnt) const; //! Returns the list of entities to which a final result is //! attached (i.e. processed by RecordResult) @@ -155,38 +157,38 @@ public: //! result at all is available (typically : case not implemented) //! It is not an error, but it gives a specific status : Skipped //! Returns True if done, False if is not in starting model - Standard_EXPORT Standard_Boolean Skip (const Handle(Standard_Transient)& ent); + Standard_EXPORT Standard_Boolean Skip (const Handle(Standard_Transient)& theEnt); //! Returns True if an entity is noted as skipped - Standard_EXPORT Standard_Boolean IsSkipped (const Handle(Standard_Transient)& ent) const; + Standard_EXPORT Standard_Boolean IsSkipped (const Handle(Standard_Transient)& theEnt) const; //! Returns True if an entity has been asked for transfert, hence //! it is marked, as : Recorded (a computation has ran, with or //! without an effective result), or Skipped (case ignored) - Standard_EXPORT Standard_Boolean IsMarked (const Handle(Standard_Transient)& ent) const; + Standard_EXPORT Standard_Boolean IsMarked (const Handle(Standard_Transient)& theEnt) const; //! Returns the final result recorded for an entity, as such - Standard_EXPORT Handle(Transfer_ResultFromModel) FinalResult (const Handle(Standard_Transient)& ent) const; + Standard_EXPORT Handle(Transfer_ResultFromModel) FinalResult (const Handle(Standard_Transient)& theEnt) const; //! Returns the label attached to an entity recorded for final, //! or an empty string if not recorded - Standard_EXPORT Standard_CString FinalEntityLabel (const Handle(Standard_Transient)& ent) const; + Standard_EXPORT Standard_CString FinalEntityLabel (const Handle(Standard_Transient)& theEnt) const; //! Returns the number attached to the entity recorded for final, //! or zero if not recorded (looks in the ResultFromModel) - Standard_EXPORT Standard_Integer FinalEntityNumber (const Handle(Standard_Transient)& ent) const; + Standard_EXPORT Standard_Integer FinalEntityNumber (const Handle(Standard_Transient)& theEnt) const; //! Returns the final result recorded for a NUMBER of entity //! (internal use). Null if out of range - Standard_EXPORT Handle(Transfer_ResultFromModel) ResultFromNumber (const Standard_Integer num) const; + Standard_EXPORT Handle(Transfer_ResultFromModel) ResultFromNumber (const Standard_Integer theNum) const; //! Returns the resulting object as a Transient //! Null Handle if no result or result not transient - Standard_EXPORT Handle(Standard_Transient) TransientResult (const Handle(Standard_Transient)& ent) const; + Standard_EXPORT Handle(Standard_Transient) TransientResult (const Handle(Standard_Transient)& theEnt) const; //! Returns the resulting object as a Shape //! Null Shape if no result or result not a shape - Standard_EXPORT TopoDS_Shape ShapeResult (const Handle(Standard_Transient)& ent) const; + Standard_EXPORT TopoDS_Shape ShapeResult (const Handle(Standard_Transient)& theEnt) const; //! Clears recorded result for an entity, according mode //! = -1 : true, complete, clearing (erasing result) @@ -195,7 +197,7 @@ public: //! 10 for all but final result, //! 11 for all : just label, status and filename are kept //! Returns True when done, False if nothing was to clear - Standard_EXPORT Standard_Boolean ClearResult (const Handle(Standard_Transient)& ent, const Standard_Integer mode); + Standard_EXPORT Standard_Boolean ClearResult (const Handle(Standard_Transient)& theEnt, const Standard_Integer theMode); //! Returns an entity from which a given result was produced. //! If = 0 (D), searches in last root transfers @@ -205,16 +207,16 @@ public: //! can be, either a transient object (result itself) or //! a binder. For a binder of shape, calls EntityFromShapeResult //! Returns a Null Handle if not recorded - Standard_EXPORT Handle(Standard_Transient) EntityFromResult (const Handle(Standard_Transient)& res, const Standard_Integer mode = 0) const; + Standard_EXPORT Handle(Standard_Transient) EntityFromResult (const Handle(Standard_Transient)& theRes, const Standard_Integer theMode = 0) const; //! Returns an entity from which a given shape result was produced //! Returns a Null Handle if not recorded or not a Shape - Standard_EXPORT Handle(Standard_Transient) EntityFromShapeResult (const TopoDS_Shape& res, const Standard_Integer mode = 0) const; + Standard_EXPORT Handle(Standard_Transient) EntityFromShapeResult (const TopoDS_Shape& theRes, const Standard_Integer theMode = 0) const; //! Returns the list of entities from which some shapes were //! produced : it corresponds to a loop on EntityFromShapeResult, //! but is optimised - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) EntitiesFromShapeList (const Handle(TopTools_HSequenceOfShape)& res, const Standard_Integer mode = 0) const; + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) EntitiesFromShapeList (const Handle(TopTools_HSequenceOfShape)& theRes, const Standard_Integer theMode = 0) const; //! Returns the CheckList resulting from transferring , i.e. //! stored in its recorded form ResultFromModel @@ -228,13 +230,13 @@ public: //! : 0 for only (D) //! 1 for and its immediate subtransfers, if any //! 2 for and subtransferts at all levels - Standard_EXPORT Interface_CheckIterator CheckList (const Handle(Standard_Transient)& ent, const Standard_Integer level = 0) const; + Standard_EXPORT Interface_CheckIterator CheckList (const Handle(Standard_Transient)& theEnt, const Standard_Integer theLevel = 0) const; //! Returns True if an entity (with a final result) has checks : //! - failsonly = False : any kind of check message //! - failsonly = True : fails only //! Returns False if is not recorded - Standard_EXPORT Standard_Boolean HasChecks (const Handle(Standard_Transient)& ent, const Standard_Boolean failsonly) const; + Standard_EXPORT Standard_Boolean HasChecks (const Handle(Standard_Transient)& theEnt, const Standard_Boolean FailsOnly) const; //! Returns the list of starting entities to which a given check //! status is attached, IN FINAL RESULTS @@ -249,7 +251,7 @@ public: //! = 2 , entities with fail //! : if True, only entities with an attached result //! Remark : result True and check=0 will give an empty list - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) CheckedList (const Handle(Standard_Transient)& ent, const Interface_CheckStatus withcheck = Interface_CheckAny, const Standard_Boolean result = Standard_True) const; + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) CheckedList (const Handle(Standard_Transient)& theEnt, const Interface_CheckStatus WithCheck = Interface_CheckAny, const Standard_Boolean theResult = Standard_True) const; //! Defines a new TransferProcess for reading transfer //! Returns True if done, False if data are not properly defined @@ -258,34 +260,34 @@ public: //! Tells if an entity is recognized as a valid candidate for //! Transfer. Calls method Recognize from the Actor (if known) - Standard_EXPORT Standard_Boolean Recognize (const Handle(Standard_Transient)& ent); + Standard_EXPORT Standard_Boolean Recognize (const Handle(Standard_Transient)& theEnt); //! Commands the transfer on reading for an entity to data for //! Imagine, using the selected Actor for Read //! Returns count of transferred entities, ok or with fails (0/1) //! If is True (D), the result is recorded by RecordResult - Standard_EXPORT Standard_Integer TransferOne (const Handle(Standard_Transient)& ent, const Standard_Boolean rec = Standard_True); + Standard_EXPORT Standard_Integer TransferOne (const Handle(Standard_Transient)& theEnt, const Standard_Boolean theRec = Standard_True); //! Commands the transfer on reading for a list of entities to //! data for Imagine, using the selected Actor for Read //! Returns count of transferred entities, ok or with fails (0/1) //! If is True (D), the results are recorded by RecordResult - Standard_EXPORT Standard_Integer TransferList (const Handle(TColStd_HSequenceOfTransient)& list, const Standard_Boolean rec = Standard_True); + Standard_EXPORT Standard_Integer TransferList (const Handle(TColStd_HSequenceOfTransient)& theList, const Standard_Boolean theRec = Standard_True); //! Transfers the content of the current Interface Model to //! data handled by Imagine, starting from its Roots (determined //! by the Graph ), using the selected Actor for Read //! Returns the count of performed root transfers (i.e. 0 if none) //! or -1 if no actor is defined - Standard_EXPORT Standard_Integer TransferRoots (const Interface_Graph& G); + Standard_EXPORT Standard_Integer TransferRoots (const Interface_Graph &theGraph); //! Clears the results attached to an entity //! if equates the starting model, clears all results - Standard_EXPORT void TransferClear (const Handle(Standard_Transient)& ent, const Standard_Integer level = 0); + Standard_EXPORT void TransferClear (const Handle(Standard_Transient)& theEnt, const Standard_Integer theLevel = 0); //! Prints statistics on current Trace File, according and //! . See PrintStatsProcess for details - Standard_EXPORT void PrintStats (const Standard_Integer what, const Standard_Integer mode = 0) const; + Standard_EXPORT void PrintStats (const Standard_Integer theWhat, const Standard_Integer theMode = 0) const; //! Returns the CheckList resulting from last TransferRead //! i.e. from TransientProcess itself, recorded from last Clear @@ -295,14 +297,14 @@ public: //! i.e. from TransientProcess itself, recorded from last Clear //! If is True , considers only roots of transfer //! If is False, considers all entities bound with result - Standard_EXPORT Handle(TColStd_HSequenceOfTransient) LastTransferList (const Standard_Boolean roots) const; + Standard_EXPORT Handle(TColStd_HSequenceOfTransient) LastTransferList (const Standard_Boolean theRoots) const; //! Returns a list of result Shapes //! If is True , sees RecordedList //! If is False, sees LastTransferList (last ROOT transfers) //! For each one, if it is a Shape, it is cumulated to the list //! If no Shape is found, returns an empty Sequence - Standard_EXPORT Handle(TopTools_HSequenceOfShape) ShapeResultList (const Standard_Boolean rec); + Standard_EXPORT const Handle(TopTools_HSequenceOfShape) & ShapeResultList (const Standard_Boolean theRec); //! This routines prints statistics about a TransientProcess //! It can be called, by a TransferReader, or isolately @@ -334,42 +336,25 @@ public: //! 2 : ShortByItem (count + 5 first numbers) //! 3 : ListByItem (count + entity numbers) //! 4 : EntitiesByItem (count + entity numbers and labels) - Standard_EXPORT static void PrintStatsProcess (const Handle(Transfer_TransientProcess)& TP, const Standard_Integer what, const Standard_Integer mode = 0); + Standard_EXPORT static void PrintStatsProcess (const Handle(Transfer_TransientProcess)& theTP, const Standard_Integer theWhat, const Standard_Integer theMode = 0); //! Works as PrintStatsProcess, but displays data only on the //! entities which are in (filter) - Standard_EXPORT static void PrintStatsOnList (const Handle(Transfer_TransientProcess)& TP, const Handle(TColStd_HSequenceOfTransient)& list, const Standard_Integer what, const Standard_Integer mode = 0); - - - + Standard_EXPORT static void PrintStatsOnList (const Handle(Transfer_TransientProcess)& theTP, const Handle(TColStd_HSequenceOfTransient)& theList, const Standard_Integer theWhat, const Standard_Integer theMode = 0); DEFINE_STANDARD_RTTIEXT(XSControl_TransferReader,MMgt_TShared) -protected: - - - - -private: - - - Handle(XSControl_Controller) theController; - TCollection_AsciiString theFilename; - Handle(Interface_InterfaceModel) theModel; - Handle(Interface_HGraph) theGraph; - Handle(Dico_DictionaryOfTransient) theContext; - Handle(Transfer_ActorOfTransientProcess) theActor; - Handle(Transfer_TransientProcess) theTransfer; - TColStd_DataMapOfIntegerTransient theResults; - Handle(TopTools_HSequenceOfShape) theShapeResult; - + private: + Handle(XSControl_Controller) myController; + TCollection_AsciiString myFileName; + Handle(Interface_InterfaceModel) myModel; + Handle(Interface_HGraph) myGraph; + Handle(Dico_DictionaryOfTransient) myContext; + Handle(Transfer_ActorOfTransientProcess) myActor; + Handle(Transfer_TransientProcess) myTP; + TColStd_DataMapOfIntegerTransient myResults; + Handle(TopTools_HSequenceOfShape) myShapeResult; }; - - - - - - #endif // _XSControl_TransferReader_HeaderFile diff --git a/src/XSControl/XSControl_TransferWriter.cxx b/src/XSControl/XSControl_TransferWriter.cxx index 7ab1bba2d9..46b0edb677 100644 --- a/src/XSControl/XSControl_TransferWriter.cxx +++ b/src/XSControl/XSControl_TransferWriter.cxx @@ -32,47 +32,33 @@ IMPLEMENT_STANDARD_RTTIEXT(XSControl_TransferWriter,MMgt_TShared) -XSControl_TransferWriter::XSControl_TransferWriter () -{ theTransferWrite = new Transfer_FinderProcess; theTransferMode = 0; } - Handle(Transfer_FinderProcess) XSControl_TransferWriter::FinderProcess () const - { return theTransferWrite; } +//======================================================================= +//function : Clear +//purpose : +//======================================================================= - void XSControl_TransferWriter::SetFinderProcess (const Handle(Transfer_FinderProcess)& FP) - { theTransferWrite = FP; } - - Handle(XSControl_Controller) XSControl_TransferWriter::Controller () const - { return theController; } - - void XSControl_TransferWriter::SetController (const Handle(XSControl_Controller)& ctl) +void XSControl_TransferWriter::Clear (const Standard_Integer mode) { - theController = ctl; - Clear(-1); + if (mode < 0 || myTransferWriter.IsNull()) + myTransferWriter = new Transfer_FinderProcess; + else myTransferWriter->Clear(); } - void XSControl_TransferWriter::Clear (const Standard_Integer mode) +//======================================================================= +//function : PrintStats +//purpose : +//======================================================================= + +void XSControl_TransferWriter::PrintStats (const Standard_Integer , const Standard_Integer ) const { - if (mode < 0 || theTransferWrite.IsNull()) - theTransferWrite = new Transfer_FinderProcess; - else theTransferWrite->Clear(); -} - - Standard_Integer XSControl_TransferWriter::TransferMode () const - { return theTransferMode; } - - void XSControl_TransferWriter::SetTransferMode (const Standard_Integer mod) - { theTransferMode = mod; } - - void XSControl_TransferWriter::PrintStats - (const Standard_Integer , const Standard_Integer ) const -{ - Handle(Message_Messenger) sout = theTransferWrite->Messenger(); + Handle(Message_Messenger) sout = myTransferWriter->Messenger(); // A ameliorer ... ! sout<<"\n*******************************************************************\n"; sout << "****** Statistics on Transfer (Write) ******"<RecognizeWriteTransient (obj,theTransferMode); + return myController->RecognizeWriteTransient (obj,myTransferMode); } - IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteTransient +//======================================================================= +//function : TransferWriteTransient +//purpose : +//======================================================================= + +IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteTransient (const Handle(Interface_InterfaceModel)& model, const Handle(Standard_Transient)& obj) { IFSelect_ReturnStatus status = IFSelect_RetVoid; - if (theController.IsNull()) return IFSelect_RetError; + if (myController.IsNull()) return IFSelect_RetError; if (model.IsNull()) return IFSelect_RetVoid; - if (theTransferWrite.IsNull()) theTransferWrite = new Transfer_FinderProcess; + if (myTransferWriter.IsNull()) myTransferWriter = new Transfer_FinderProcess; Handle(Transfer_ActorOfFinderProcess) nulact; - theTransferWrite->SetActor (nulact); + myTransferWriter->SetActor (nulact); Handle(Standard_Transient) resultat; - Handle(Message_Messenger) sout = theTransferWrite->Messenger(); + Handle(Message_Messenger) sout = myTransferWriter->Messenger(); try { OCC_CATCH_SIGNALS - PrintStats(theTransferMode); + PrintStats(myTransferMode); sout << "****** Transferring Transient, CDL Type = "; sout<DynamicType()->Name()<<" ******"<TransferWriteTransient - (obj,theTransferWrite,model,theTransferMode); + status = myController->TransferWriteTransient + (obj,myTransferWriter,model,myTransferMode); } catch(Standard_Failure) { sout<<"**** **** TransferWriteShape, EXCEPTION : "; @@ -120,37 +115,44 @@ XSControl_TransferWriter::XSControl_TransferWriter () return status; } +//======================================================================= +//function : RecognizeShape +//purpose : +//======================================================================= - Standard_Boolean XSControl_TransferWriter::RecognizeShape - (const TopoDS_Shape& shape) +Standard_Boolean XSControl_TransferWriter::RecognizeShape (const TopoDS_Shape& shape) { - if (theController.IsNull()) return Standard_False; + if (myController.IsNull()) return Standard_False; if (shape.IsNull()) return Standard_False; - return theController->RecognizeWriteShape (shape,theTransferMode); + return myController->RecognizeWriteShape (shape,myTransferMode); } +//======================================================================= +//function : TransferWriteShape +//purpose : +//======================================================================= - IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteShape +IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteShape (const Handle(Interface_InterfaceModel)& model, const TopoDS_Shape& shape) { IFSelect_ReturnStatus status = IFSelect_RetVoid; - if (theController.IsNull()) return IFSelect_RetError; + if (myController.IsNull()) return IFSelect_RetError; if (model.IsNull()) return IFSelect_RetVoid; - if (theTransferWrite.IsNull()) theTransferWrite = new Transfer_FinderProcess; + if (myTransferWriter.IsNull()) myTransferWriter = new Transfer_FinderProcess; // effacer l actor : Controller s en charge Handle(Transfer_ActorOfFinderProcess) nulact; - theTransferWrite->SetActor (nulact); + myTransferWriter->SetActor (nulact); Handle(Standard_Transient) resultat; - Handle(Message_Messenger) sout = theTransferWrite->Messenger(); + Handle(Message_Messenger) sout = myTransferWriter->Messenger(); try { OCC_CATCH_SIGNALS - PrintStats(theTransferMode); + PrintStats(myTransferMode); sout << "****** Transferring Shape, ShapeType = " << shape.ShapeType(); sout<<" ******"<TransferWriteShape - (shape,theTransferWrite,model,theTransferMode); + status = myController->TransferWriteShape + (shape,myTransferWriter,model,myTransferMode); } catch(Standard_Failure) { sout<<"**** **** TransferWriteShape, EXCEPTION : "; @@ -161,35 +163,42 @@ XSControl_TransferWriter::XSControl_TransferWriter () return status; } +//======================================================================= +//function : CheckList +//purpose : +//======================================================================= - Interface_CheckIterator XSControl_TransferWriter::CheckList () const +Interface_CheckIterator XSControl_TransferWriter::CheckList () const { Interface_CheckIterator chl; - if (theTransferWrite.IsNull()) return chl; - Standard_Integer i, nb = theTransferWrite->NbMapped(); + if (myTransferWriter.IsNull()) return chl; + Standard_Integer i, nb = myTransferWriter->NbMapped(); for (i = 1; i <= nb; i ++) { - DeclareAndCast(Transfer_SimpleBinderOfTransient,tb,theTransferWrite->MapItem -(i)); + DeclareAndCast(Transfer_SimpleBinderOfTransient,tb,myTransferWriter->MapItem(i)); if (tb.IsNull()) continue; Handle(Interface_Check) ach = tb->Check(); if (ach->NbFails() == 0 || ach->NbWarnings() == 0) continue; - DeclareAndCast(Transfer_TransientMapper,tm,theTransferWrite->Mapped(i)); - if (tm.IsNull()) ach->GetEntity (theTransferWrite->Mapped(i)); + DeclareAndCast(Transfer_TransientMapper,tm,myTransferWriter->Mapped(i)); + if (tm.IsNull()) ach->GetEntity (myTransferWriter->Mapped(i)); else ach->GetEntity (tm->Value()); chl.Add(ach); } return chl; } - Interface_CheckIterator XSControl_TransferWriter::ResultCheckList +//======================================================================= +//function : ResultCheckList +//purpose : +//======================================================================= + +Interface_CheckIterator XSControl_TransferWriter::ResultCheckList (const Handle(Interface_InterfaceModel)& model) const { Interface_CheckIterator chl; - if (theTransferWrite.IsNull()) return chl; - Standard_Integer i, nb = theTransferWrite->NbMapped(); + if (myTransferWriter.IsNull()) return chl; + Standard_Integer i, nb = myTransferWriter->NbMapped(); for (i = 1; i <= nb; i ++) { - DeclareAndCast(Transfer_SimpleBinderOfTransient,tb,theTransferWrite->MapItem -(i)); + DeclareAndCast(Transfer_SimpleBinderOfTransient,tb,myTransferWriter->MapItem(i)); if (tb.IsNull()) continue; const Handle(Interface_Check) ach = tb->Check(); if (ach->NbFails() == 0 || ach->NbWarnings() == 0) continue; @@ -199,8 +208,3 @@ XSControl_TransferWriter::XSControl_TransferWriter () } return chl; } - - void XSControl_TransferWriter::PrintStatsProcess - (const Handle(Transfer_FinderProcess)& , - const Standard_Integer , const Standard_Integer ) -{ } diff --git a/src/XSControl/XSControl_TransferWriter.hxx b/src/XSControl/XSControl_TransferWriter.hxx index bf6002d644..4561e4c1f3 100644 --- a/src/XSControl/XSControl_TransferWriter.hxx +++ b/src/XSControl/XSControl_TransferWriter.hxx @@ -20,12 +20,10 @@ #include #include -#include #include -#include #include +#include class XSControl_Controller; -class Transfer_FinderProcess; class Standard_Transient; class Interface_InterfaceModel; class TopoDS_Shape; @@ -43,67 +41,77 @@ DEFINE_STANDARD_HANDLE(XSControl_TransferWriter, MMgt_TShared) //! checks class XSControl_TransferWriter : public MMgt_TShared { - -public: - + public: //! Creates a TransferWriter, empty, ready to run //! with an empty FinderProcess (but no controller, etc) - Standard_EXPORT XSControl_TransferWriter(); + XSControl_TransferWriter() + : myTransferWriter(new Transfer_FinderProcess), + myTransferMode(0) + {} //! Returns the FinderProcess itself - Standard_EXPORT Handle(Transfer_FinderProcess) FinderProcess() const; + const Handle(Transfer_FinderProcess) & FinderProcess() const + { return myTransferWriter; } //! Sets a new FinderProcess and forgets the former one - Standard_EXPORT void SetFinderProcess (const Handle(Transfer_FinderProcess)& FP); - + void SetFinderProcess (const Handle(Transfer_FinderProcess)& theFP) + { myTransferWriter = theFP; } + //! Returns the currently used Controller - Standard_EXPORT Handle(XSControl_Controller) Controller() const; + const Handle(XSControl_Controller) & Controller() const + { return myController; } //! Sets a new Controller, also sets a new FinderProcess - Standard_EXPORT void SetController (const Handle(XSControl_Controller)& ctl); + Standard_EXPORT void SetController (const Handle(XSControl_Controller)& theCtl) + { + myController = theCtl; + Clear(-1); + } //! Clears recorded data according a mode //! 0 clears FinderProcess (results, checks) //! -1 create a new FinderProcess - Standard_EXPORT void Clear (const Standard_Integer mode); + Standard_EXPORT void Clear (const Standard_Integer theMode); //! Returns the current Transfer Mode (an Integer) //! It will be interpreted by the Controller to run Transfers //! This call form could be later replaced by more specific ones //! (parameters suited for each norm / transfer case) - Standard_EXPORT Standard_Integer TransferMode() const; - + Standard_Integer TransferMode() const + { return myTransferMode; } + //! Changes the Transfer Mode - Standard_EXPORT void SetTransferMode (const Standard_Integer mode); - + void SetTransferMode (const Standard_Integer theMode) + { myTransferMode = theMode; } + //! Prints statistics on current Trace File, according what,mode //! See PrintStatsProcess for details - Standard_EXPORT void PrintStats (const Standard_Integer what, const Standard_Integer mode = 0) const; + Standard_EXPORT void PrintStats (const Standard_Integer theWhat, const Standard_Integer theMode = 0) const; //! Tells if a transient object (from an application) is a valid //! candidate for a transfer to a model //! Asks the Controller (RecognizeWriteTransient) //! If is a HShape, calls RecognizeShape - Standard_EXPORT Standard_Boolean RecognizeTransient (const Handle(Standard_Transient)& obj); + Standard_EXPORT Standard_Boolean RecognizeTransient (const Handle(Standard_Transient)& theObj); //! Transfers a Transient object (from an application) to a model //! of current norm, according to the last call to SetTransferMode //! Works by calling the Controller //! Returns status : =0 if OK, >0 if error during transfer, <0 if //! transfer badly initialised - Standard_EXPORT IFSelect_ReturnStatus TransferWriteTransient (const Handle(Interface_InterfaceModel)& model, const Handle(Standard_Transient)& obj); + Standard_EXPORT IFSelect_ReturnStatus TransferWriteTransient (const Handle(Interface_InterfaceModel)& theModel, const Handle(Standard_Transient)& theObj); //! Tells if a Shape is valid for a transfer to a model //! Asks the Controller (RecognizeWriteShape) - Standard_EXPORT Standard_Boolean RecognizeShape (const TopoDS_Shape& shape); + Standard_EXPORT Standard_Boolean RecognizeShape (const TopoDS_Shape& theShape); //! Transfers a Shape from CasCade to a model of current norm, //! according to the last call to SetTransferMode //! Works by calling the Controller //! Returns status : =0 if OK, >0 if error during transfer, <0 if //! transfer badly initialised - Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape (const Handle(Interface_InterfaceModel)& model, const TopoDS_Shape& shape); + Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape (const Handle(Interface_InterfaceModel)& theModel, const TopoDS_Shape& theShape); //! Returns the check-list of last transfer (write), i.e. the //! check-list currently recorded in the FinderProcess @@ -112,35 +120,15 @@ public: //! Returns the check-list of last transfer (write), but tries //! to bind to each check, the resulting entity in the model //! instead of keeping the original Mapper, whenever known - Standard_EXPORT Interface_CheckIterator ResultCheckList (const Handle(Interface_InterfaceModel)& model) const; - - //! Forecast to print statitics about a FinderProcess - Standard_EXPORT static void PrintStatsProcess (const Handle(Transfer_FinderProcess)& TP, const Standard_Integer what, const Standard_Integer mode = 0); - - - + Standard_EXPORT Interface_CheckIterator ResultCheckList (const Handle(Interface_InterfaceModel)& theModel) const; DEFINE_STANDARD_RTTIEXT(XSControl_TransferWriter,MMgt_TShared) -protected: - - - - -private: - - - Handle(XSControl_Controller) theController; - Handle(Transfer_FinderProcess) theTransferWrite; - Standard_Integer theTransferMode; - + private: + Handle(XSControl_Controller) myController; + Handle(Transfer_FinderProcess) myTransferWriter; + Standard_Integer myTransferMode; }; - - - - - - #endif // _XSControl_TransferWriter_HeaderFile diff --git a/src/XSControl/XSControl_WorkSession.cxx b/src/XSControl/XSControl_WorkSession.cxx index 86d95adbe4..4aaedfde40 100644 --- a/src/XSControl/XSControl_WorkSession.cxx +++ b/src/XSControl/XSControl_WorkSession.cxx @@ -24,11 +24,8 @@ #include #include #include -#include #include #include -#include -#include #include #include #include @@ -41,23 +38,21 @@ #include #include #include -#include #include #include IMPLEMENT_STANDARD_RTTIEXT(XSControl_WorkSession,IFSelect_WorkSession) -// tpent //======================================================================= //function : XSControl_WorkSession //purpose : //======================================================================= + XSControl_WorkSession::XSControl_WorkSession () +: myTransferReader(new XSControl_TransferReader), + myTransferWriter(new XSControl_TransferWriter), + myVars(new XSControl_Vars) { - theModeWriteShape = 0; - theTransferRead = new XSControl_TransferReader; - theTransferWrite = new XSControl_TransferWriter; - theVars = new XSControl_Vars; } @@ -76,11 +71,11 @@ void XSControl_WorkSession::ClearData (const Standard_Integer mode) // 7 : Management, y compris tous transferts (forces/calcules), views if (mode == 5 || mode == 7) { - theTransferRead->Clear(-1); - theTransferWrite->Clear(-1); + myTransferReader->Clear(-1); + myTransferWriter->Clear(-1); } - if (mode == 6 && !theTransferRead.IsNull()) theTransferRead->Clear(1); - theTransferRead->SetGraph (HGraph()); + if (mode == 6 && !myTransferReader.IsNull()) myTransferReader->Clear(1); + myTransferReader->SetGraph (HGraph()); } @@ -89,69 +84,44 @@ void XSControl_WorkSession::ClearData (const Standard_Integer mode) //purpose : //======================================================================= -Standard_Boolean XSControl_WorkSession::SelectNorm(const Standard_CString normname, - const Standard_CString profile) +Standard_Boolean XSControl_WorkSession::SelectNorm(const Standard_CString normname) { - // RAZ ancienne norme et resultats - theTransferRead->Clear(-1); + // 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); + Handle(XSControl_Controller) newadapt = XSControl_Controller::Recorded (normname); if (newadapt.IsNull()) return Standard_False; - if (newadapt == theController) return Standard_True; + if (newadapt == myController) return Standard_True; SetController (newadapt); - if (profile && profile[0] != '\0') newadapt->Profile()->SetCurrent(profile); - -// cout<<"##########################\n" -// <<"## Select Norm : "<Profile()->SetCurrent(profile); -} - - //======================================================================= //function : SetController //purpose : //======================================================================= -void XSControl_WorkSession::SetController(const Handle(XSControl_Controller)& ctl) +void XSControl_WorkSession::SetController(const Handle(XSControl_Controller)& ctl) { - theController = ctl; + myController = ctl; - SetLibrary ( theController->WorkLibrary() ); - SetProtocol ( theController->Protocol() ); - ClearItems(); ClearFinalModifiers(); - ClearShareOut(Standard_False); ClearFile(); - Handle(XSControl_WorkSession) aWorkSession = this; - theController->Customise (aWorkSession); - SetSignType ( theController->SignType() ); - theTransferRead->SetController (theController); - theTransferWrite->SetController (theController); + SetLibrary ( myController->WorkLibrary() ); + SetProtocol ( myController->Protocol() ); - AdaptNorm (); -} + ClearItems(); + ClearFinalModifiers(); + ClearShareOut(Standard_False); + ClearFile(); + // Set worksession parameters from teh controller + Handle(XSControl_WorkSession) aWorkSession(this); + myController->Customise (aWorkSession); -//======================================================================= -//function : AdaptNorm -//purpose : -//======================================================================= - -void XSControl_WorkSession::AdaptNorm () -{ + myTransferReader->SetController (myController); + myTransferWriter->SetController (myController); } @@ -163,21 +133,9 @@ void XSControl_WorkSession::AdaptNorm () Standard_CString XSControl_WorkSession::SelectedNorm(const Standard_Boolean rsc) const { //JR/Hp : - Standard_CString astr = (Standard_CString ) (theController.IsNull() ? "" : theController->Name(rsc)); + Standard_CString astr = (Standard_CString ) (myController.IsNull() ? "" : myController->Name(rsc)); return astr ; } -// { return (theController.IsNull() ? "" : theController->Name(rsc)); } - - -//======================================================================= -//function : NormAdaptor -//purpose : -//======================================================================= - -Handle(XSControl_Controller) XSControl_WorkSession::NormAdaptor () const -{ - return theController; -} // ########################################## @@ -185,17 +143,6 @@ Handle(XSControl_Controller) XSControl_WorkSession::NormAdaptor () const // ########################################## -//======================================================================= -//function : Context -//purpose : -//======================================================================= - -Handle(Dico_DictionaryOfTransient) XSControl_WorkSession::Context () const -{ - return theContext; -} - - //======================================================================= //function : SetAllContext //purpose : @@ -203,8 +150,8 @@ Handle(Dico_DictionaryOfTransient) XSControl_WorkSession::Context () const void XSControl_WorkSession::SetAllContext(const Handle(Dico_DictionaryOfTransient)& context) { - theContext = context; - theTransferRead->Context() = context; + myContext = context; + myTransferReader->Context() = context; } @@ -215,8 +162,8 @@ void XSControl_WorkSession::SetAllContext(const Handle(Dico_DictionaryOfTransien void XSControl_WorkSession::ClearContext () { - Handle(Dico_DictionaryOfTransient) nulctx; - SetAllContext(nulctx); + myContext.Nullify(); + myTransferReader->Context().Nullify(); } @@ -234,8 +181,8 @@ Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Inte const Standard_Boolean wri, const Handle(Message_Messenger)& S) const { - Handle(Transfer_FinderProcess) FP = MapWriter(); - Handle(Transfer_TransientProcess) TP = MapReader(); + const Handle(Transfer_FinderProcess) &FP = myTransferWriter->FinderProcess(); + Handle(Transfer_TransientProcess) TP = myTransferReader->TransientProcess(); Handle(Transfer_Binder) binder; Handle(Transfer_Finder) finder; @@ -266,7 +213,7 @@ Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Inte FP->StartTrace (binder,finder,0,0); // pb sout/S if (!ent.IsNull()) { S<<" ** Resultat Transient, type "<DynamicType()->Name(); - Handle(Interface_InterfaceModel) model = Model(); + const Handle(Interface_InterfaceModel) &model = Model(); if (!model.IsNull()) { S<<" In output Model, Entity "; model->Print(ent,S); } S<Clear(-1); // full clear - if (theTransferRead.IsNull()) SetTransferReader (new XSControl_TransferReader); - else SetTransferReader (theTransferRead); + if (mode == 0 || mode == 5) myTransferReader->Clear(-1); // full clear + if (myTransferReader.IsNull()) SetTransferReader (new XSControl_TransferReader); + else SetTransferReader (myTransferReader); // mode = 0 fait par SetTransferReader suite a Nullify if (mode == 1) { - if (!theTransferRead.IsNull()) theTransferRead->Clear(-1); + if (!myTransferReader.IsNull()) myTransferReader->Clear(-1); else SetTransferReader (new XSControl_TransferReader); } if (mode == 2) { - Handle(Transfer_TransientProcess) TP = theTransferRead->TransientProcess(); + Handle(Transfer_TransientProcess) TP = myTransferReader->TransientProcess(); if (TP.IsNull()) { TP = new Transfer_TransientProcess; - theTransferRead->SetTransientProcess(TP); + myTransferReader->SetTransientProcess(TP); TP->SetGraph (HGraph()); } - Handle(TColStd_HSequenceOfTransient) lis = theTransferRead->RecordedList(); + Handle(TColStd_HSequenceOfTransient) lis = myTransferReader->RecordedList(); Standard_Integer i, nb = lis->Length(); for (i = 1; i <= nb; i ++) TP->SetRoot(lis->Value(i)); } if (mode == 3) { - Handle(Transfer_TransientProcess) TP = theTransferRead->TransientProcess(); + Handle(Transfer_TransientProcess) TP = myTransferReader->TransientProcess(); if (TP.IsNull()) return; Standard_Integer i, nb = TP->NbRoots(); - for (i = 1; i <= nb; i ++) theTransferRead->RecordResult(TP->Root(i)); + for (i = 1; i <= nb; i ++) myTransferReader->RecordResult(TP->Root(i)); } - if (mode == 4 || mode == 5) theTransferRead->BeginTransfer(); + if (mode == 4 || mode == 5) myTransferReader->BeginTransfer(); } @@ -364,10 +311,10 @@ void XSControl_WorkSession::InitTransferReader(const Standard_Integer mode) void XSControl_WorkSession::SetTransferReader(const Handle(XSControl_TransferReader)& TR) { - if (theTransferRead != TR) //i1 pdn 03.04.99 BUC60301 - theTransferRead = TR; + if (myTransferReader != TR) //i1 pdn 03.04.99 BUC60301 + myTransferReader = TR; if (TR.IsNull()) return; - TR->SetController (theController); + TR->SetController (myController); TR->SetGraph (HGraph()); if (!TR->TransientProcess().IsNull()) return; Handle(Transfer_TransientProcess) TP = new Transfer_TransientProcess @@ -378,44 +325,21 @@ void XSControl_WorkSession::SetTransferReader(const Handle(XSControl_TransferRea } -//======================================================================= -//function : TransferReader -//purpose : -//======================================================================= - -Handle(XSControl_TransferReader) XSControl_WorkSession::TransferReader () const -{ - return theTransferRead; -} - - -//======================================================================= -//function : MapReader -//purpose : -//======================================================================= - -Handle(Transfer_TransientProcess) XSControl_WorkSession::MapReader () const -{ - return theTransferRead->TransientProcess(); -} - - //======================================================================= //function : SetMapReader //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; if (TP->Model().IsNull()) TP->SetModel (Model()); TP->SetGraph (HGraph()); if (TP->Model() != Model()) return Standard_False; // TR ne doit pas bouger, c est un "crochet" pour signatures, selections ... // En revanche, mieux vaut le RAZ // Handle(XSControl_TransferReader) TR = new XSControl_TransferReader; - Handle(XSControl_TransferReader) TR = theTransferRead; + Handle(XSControl_TransferReader) TR = myTransferReader; TR->Clear(-1); SetTransferReader (TR); // avec le meme mais le reinitialise @@ -438,12 +362,12 @@ Handle(Standard_Transient) XSControl_WorkSession::Result Handle(Transfer_Binder) binder; Handle(Transfer_ResultFromModel) resu; - if (ouca != 1) resu = theTransferRead->FinalResult(ent); + if (ouca != 1) resu = myTransferReader->FinalResult(ent); if (mode == 20) return resu; if (!resu.IsNull()) binder = resu->MainResult()->Binder(); if (binder.IsNull() && ouca > 0) - binder = theTransferRead->TransientProcess()->Find(ent); + binder = myTransferReader->TransientProcess()->Find(ent); if (kica == 1) return binder; DeclareAndCast(Transfer_SimpleBinderOfTransient,trb,binder); @@ -461,15 +385,14 @@ Handle(Standard_Transient) XSControl_WorkSession::Result //purpose : //======================================================================= -Standard_Integer XSControl_WorkSession::TransferReadOne - (const Handle(Standard_Transient)& ent) +Standard_Integer XSControl_WorkSession::TransferReadOne (const Handle(Standard_Transient)& ent) { Handle(Interface_InterfaceModel) model = Model(); if (ent == model) return TransferReadRoots(); Handle(TColStd_HSequenceOfTransient) list = GiveList(ent); - if (list->Length() == 1) return theTransferRead->TransferOne(list->Value(1)); - else return theTransferRead->TransferList (list); + if (list->Length() == 1) return myTransferReader->TransferOne(list->Value(1)); + else return myTransferReader->TransferList (list); } @@ -478,9 +401,9 @@ Standard_Integer XSControl_WorkSession::TransferReadOne //purpose : //======================================================================= -Standard_Integer XSControl_WorkSession::TransferReadRoots () +Standard_Integer XSControl_WorkSession::TransferReadRoots () { - return theTransferRead->TransferRoots(Graph()); + return myTransferReader->TransferRoots(Graph()); } @@ -496,92 +419,33 @@ Standard_Integer XSControl_WorkSession::TransferReadRoots () Handle(Interface_InterfaceModel) XSControl_WorkSession::NewModel () { Handle(Interface_InterfaceModel) newmod; - if (theController.IsNull()) return newmod; - newmod = theController->NewModel(); + if (myController.IsNull()) return newmod; + newmod = myController->NewModel(); SetModel(newmod); - if(!MapReader().IsNull()) - MapReader()->Clear(); + if(!myTransferReader->TransientProcess().IsNull()) + myTransferReader->TransientProcess()->Clear(); //clear all contains of WS - theTransferRead->Clear(3); - theTransferWrite->Clear(-1); + myTransferReader->Clear(3); + myTransferWriter->Clear(-1); return newmod; } -//======================================================================= -//function : TransferWriter -//purpose : -//======================================================================= - -Handle(XSControl_TransferWriter) XSControl_WorkSession::TransferWriter () const -{ - return theTransferWrite; -} - - -//======================================================================= -//function : MapWriter -//purpose : -//======================================================================= - -Handle(Transfer_FinderProcess) XSControl_WorkSession::MapWriter () const -{ - return theTransferWrite->FinderProcess(); -} - - -//======================================================================= -//function : SetMapWriter -//purpose : -//======================================================================= - -Standard_Boolean XSControl_WorkSession::SetMapWriter - (const Handle(Transfer_FinderProcess)& FP) -{ - if ( FP.IsNull()) return Standard_False; - theTransferWrite->SetFinderProcess (FP); - return Standard_True; -} - - -//======================================================================= -//function : SetModeWriteShape -//purpose : -//======================================================================= - -void XSControl_WorkSession::SetModeWriteShape(const Standard_Integer mode) -{ - theTransferWrite->SetTransferMode(mode); -} - - -//======================================================================= -//function : ModeWriteShape -//purpose : -//======================================================================= - -Standard_Integer XSControl_WorkSession::ModeWriteShape () const -{ - return theTransferWrite->TransferMode(); -} - - //======================================================================= //function : TransferWriteShape //purpose : //======================================================================= -IFSelect_ReturnStatus XSControl_WorkSession::TransferWriteShape - (const TopoDS_Shape& shape, const Standard_Boolean compgraph) +IFSelect_ReturnStatus XSControl_WorkSession::TransferWriteShape (const TopoDS_Shape& shape, const Standard_Boolean compgraph) { IFSelect_ReturnStatus status; - if (theController.IsNull()) return IFSelect_RetError; - Handle(Interface_InterfaceModel) model = Model(); + if (myController.IsNull()) return IFSelect_RetError; + const Handle(Interface_InterfaceModel) &model = Model(); if (model.IsNull()) return IFSelect_RetVoid; - status = theTransferWrite->TransferWriteShape (model,shape); + status = myTransferWriter->TransferWriteShape (model,shape); // qui s occupe de tout, try/catch inclus //skl insert param compgraph for XDE writing 10.12.2003 @@ -598,29 +462,7 @@ IFSelect_ReturnStatus XSControl_WorkSession::TransferWriteShape Interface_CheckIterator XSControl_WorkSession::TransferWriteCheckList () const { - return theTransferWrite->ResultCheckList (Model()); -} - - -//======================================================================= -//function : Vars -//purpose : -//======================================================================= - -Handle(XSControl_Vars) XSControl_WorkSession::Vars () const -{ - return theVars; -} - - -//======================================================================= -//function : SetVars -//purpose : -//======================================================================= - -void XSControl_WorkSession::SetVars (const Handle(XSControl_Vars)& newvars) -{ - theVars = newvars; + return myTransferWriter->ResultCheckList (Model()); } @@ -631,7 +473,7 @@ void XSControl_WorkSession::SetVars (const Handle(XSControl_Vars)& newvars) void XSControl_WorkSession::ClearBinders() { - Handle(Transfer_FinderProcess) FP = theTransferWrite->FinderProcess(); + const Handle(Transfer_FinderProcess) &FP = myTransferWriter->FinderProcess(); //Due to big number of chains of binders it is necessary to //collect head binders of each chain in the sequence TColStd_SequenceOfTransient aSeqBnd; @@ -665,16 +507,3 @@ void XSControl_WorkSession::ClearBinders() } } - - -//======================================================================= -//function : Destroy -//purpose : -//======================================================================= - -void XSControl_WorkSession::Destroy() -{ - ClearBinders(); -} - - diff --git a/src/XSControl/XSControl_WorkSession.hxx b/src/XSControl/XSControl_WorkSession.hxx index 819536a891..905710fc01 100644 --- a/src/XSControl/XSControl_WorkSession.hxx +++ b/src/XSControl/XSControl_WorkSession.hxx @@ -20,14 +20,11 @@ #include #include -#include #include -#include -#include #include +#include class XSControl_Controller; class XSControl_TransferReader; -class XSControl_TransferWriter; class Dico_DictionaryOfTransient; class XSControl_Vars; class Message_Messenger; @@ -52,58 +49,48 @@ DEFINE_STANDARD_HANDLE(XSControl_WorkSession, IFSelect_WorkSession) //! Each item is accessed by a Name class XSControl_WorkSession : public IFSelect_WorkSession { - -public: - + public: Standard_EXPORT XSControl_WorkSession(); + ~XSControl_WorkSession() + { ClearBinders(); } + //! In addition to basic ClearData, clears Transfer and Management //! for interactive use, for mode = 0,1,2 and over 4 //! Plus : mode = 5 to clear Transfers (both ways) only //! mode = 6 to clear enforced results //! mode = 7 to clear transfers, results - Standard_EXPORT virtual void ClearData (const Standard_Integer mode) Standard_OVERRIDE; + Standard_EXPORT virtual void ClearData (const Standard_Integer theMode) Standard_OVERRIDE; //! Selects a Norm defined by its name. //! A Norm is described and handled by a Controller //! Returns True if done, False if is unknown //! - //! A Profile may be set too. If no Profile is provided, the - //! current Profile for this Norm is taken - //! If the asked Profile is not defined for this Norm, it remains - //! in current Profile, returned value is True - Standard_EXPORT Standard_Boolean SelectNorm (const Standard_CString normname, const Standard_CString profile = ""); - - //! Sets a Profile as current for the current Norm - //! Returns True if done, False if is unknown for this norm - //! - //! For more infos on Profile, query the Profile of the Controller - Standard_EXPORT Standard_Boolean SelectProfile (const Standard_CString profile); + //! The current Profile for this Norm is taken. + Standard_EXPORT Standard_Boolean SelectNorm (const Standard_CString theNormName); //! Selects a Norm defined by its Controller itself - Standard_EXPORT void SetController (const Handle(XSControl_Controller)& ctl); - - //! This method is called once a new norm has been successfully - //! selected. It can be redefined, default does nothing - Standard_EXPORT virtual void AdaptNorm(); + Standard_EXPORT void SetController (const Handle(XSControl_Controller)& theCtl); //! Returns the name of the last Selected Norm. If none is //! defined, returns an empty string //! By default, returns the complete name of the norm //! If is True, returns the short name used for resource - Standard_EXPORT Standard_CString SelectedNorm (const Standard_Boolean rsc = Standard_False) const; + Standard_EXPORT Standard_CString SelectedNorm (const Standard_Boolean theRsc = Standard_False) const; //! Returns the norm controller itself - Standard_EXPORT Handle(XSControl_Controller) NormAdaptor() const; + const Handle(XSControl_Controller) & NormAdaptor() const + { return myController; } //! Returns the current Context List, Null if not defined //! The Context is given to the TransientProcess for TransferRead - Standard_EXPORT Handle(Dico_DictionaryOfTransient) Context() const; + const Handle(Dico_DictionaryOfTransient) & Context() const + { return myContext; } //! Sets the current Context List, as a whole //! Sets it to the TransferReader - Standard_EXPORT void SetAllContext (const Handle(Dico_DictionaryOfTransient)& context); + Standard_EXPORT void SetAllContext (const Handle(Dico_DictionaryOfTransient)& theContext); //! Clears the whole current Context (nullifies it) Standard_EXPORT void ClearContext(); @@ -112,7 +99,7 @@ public: //! the Mapped n0 , from MapWriter if is True, or //! from MapReader if is False //! Returns True when done, False else (i.e. num out of range) - Standard_EXPORT Standard_Boolean PrintTransferStatus (const Standard_Integer num, const Standard_Boolean wri, const Handle(Message_Messenger)& S) const; + Standard_EXPORT Standard_Boolean PrintTransferStatus (const Standard_Integer theNum, const Standard_Boolean theWri, const Handle(Message_Messenger)& theS) const; //! Sets a Transfer Reader, by internal ways, according mode : //! 0 recreates it clear, 1 clears it (does not recreate) @@ -120,22 +107,20 @@ public: //! 3 aligns final Results from Roots of TransientProcess //! 4 begins a new transfer (by BeginTransfer) //! 5 recreates TransferReader then begins a new transfer - Standard_EXPORT void InitTransferReader (const Standard_Integer mode); + Standard_EXPORT void InitTransferReader (const Standard_Integer theMode); //! Sets a Transfer Reader, which manages transfers on reading - Standard_EXPORT void SetTransferReader (const Handle(XSControl_TransferReader)& TR); + Standard_EXPORT void SetTransferReader (const Handle(XSControl_TransferReader)& theTR); //! Returns the Transfer Reader, Null if not set - Standard_EXPORT Handle(XSControl_TransferReader) TransferReader() const; - - //! Returns the TransientProcess(internal data for TransferReader) - Standard_EXPORT Handle(Transfer_TransientProcess) MapReader() const; + const Handle(XSControl_TransferReader) & TransferReader () const + { return myTransferReader; } //! Changes the Map Reader, i.e. considers that the new one //! defines the relevant read results (forgets the former ones) //! Returns True when done, False in case of bad definition, i.e. //! if Model from TP differs from that of Session - Standard_EXPORT Standard_Boolean SetMapReader (const Handle(Transfer_TransientProcess)& TP); + Standard_EXPORT Standard_Boolean SetMapReader (const Handle(Transfer_TransientProcess)& theTP); //! Returns the result attached to a starting entity //! If = 0, returns Final Result @@ -146,7 +131,7 @@ public: //! = 10,11,12 idem but returns the Binder itself //! (if it is not, e.g. Shape, returns the Binder) //! = 20, returns the ResultFromModel - Standard_EXPORT Handle(Standard_Transient) Result (const Handle(Standard_Transient)& ent, const Standard_Integer mode) 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 //! I.E. calls the TransferReader after having analysed @@ -156,7 +141,7 @@ public: //! - a HSequenceOfTransient : this list //! - the Model : in this specific case, all the roots, //! with no cumulation of former transfers (TransferReadRoots) - Standard_EXPORT Standard_Integer TransferReadOne (const Handle(Standard_Transient)& ents); + Standard_EXPORT Standard_Integer TransferReadOne (const Handle(Standard_Transient)& theEnts); //! Commands the transfer of all the root entities of the model //! i.e. calls TransferRoot from the TransferReader with the Graph @@ -169,29 +154,24 @@ public: Standard_EXPORT Handle(Interface_InterfaceModel) NewModel(); //! Returns the Transfer Reader, Null if not set - Standard_EXPORT Handle(XSControl_TransferWriter) TransferWriter() const; - - //! Returns the FinderProcess (internal data for TransferWriter) - Standard_EXPORT Handle(Transfer_FinderProcess) MapWriter() const; + const Handle(XSControl_TransferWriter) & TransferWriter() const + { return myTransferWriter; } //! Changes the Map Reader, i.e. considers that the new one //! defines the relevant read results (forgets the former ones) //! Returns True when done, False if is Null - Standard_EXPORT Standard_Boolean SetMapWriter (const Handle(Transfer_FinderProcess)& FP); - - //! Sets a mode to transfer Shapes from CasCade to entities of the - //! current norm, which interprets it (see various Controllers) - //! This call form could be later replaced by a more general one - Standard_EXPORT void SetModeWriteShape (const Standard_Integer mode); - - //! Records the current Mode to Write Shapes - Standard_EXPORT Standard_Integer ModeWriteShape() const; + 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, //! according to the last call to SetModeWriteShape //! Returns status :Done if OK, Fail if error during transfer, //! Error if transfer badly initialised - Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape (const TopoDS_Shape& shape, const Standard_Boolean compgraph = Standard_True); + Standard_EXPORT IFSelect_ReturnStatus TransferWriteShape (const TopoDS_Shape& theShape, const Standard_Boolean theCompGraph = Standard_True); //! Returns the check-list of last transfer (write) //! It is recorded in the FinderProcess, but it must be bound with @@ -199,45 +179,24 @@ public: //! with original objects (in fact, their mappers) Standard_EXPORT Interface_CheckIterator TransferWriteCheckList() const; - Standard_EXPORT Handle(XSControl_Vars) Vars() const; + const Handle(XSControl_Vars) & Vars() const + { return myVars; } - Standard_EXPORT void SetVars (const Handle(XSControl_Vars)& newvars); + void SetVars (const Handle(XSControl_Vars)& theVars) + { myVars = theVars; } + + DEFINE_STANDARD_RTTIEXT(XSControl_WorkSession,IFSelect_WorkSession) + + private: //! Clears binders Standard_EXPORT void ClearBinders(); - - Standard_EXPORT void Destroy(); -~XSControl_WorkSession() -{ - Destroy(); -} - - - - DEFINE_STANDARD_RTTIEXT(XSControl_WorkSession,IFSelect_WorkSession) - -protected: - - - - -private: - - - Handle(XSControl_Controller) theController; - Handle(XSControl_TransferReader) theTransferRead; - Handle(XSControl_TransferWriter) theTransferWrite; - Handle(Dico_DictionaryOfTransient) theContext; - Standard_Integer theModeWriteShape; - Handle(XSControl_Vars) theVars; - + Handle(XSControl_Controller) myController; + Handle(XSControl_TransferReader) myTransferReader; + Handle(XSControl_TransferWriter) myTransferWriter; + Handle(Dico_DictionaryOfTransient) myContext; + Handle(XSControl_Vars) myVars; }; - - - - - - #endif // _XSControl_WorkSession_HeaderFile diff --git a/src/XSControl/XSControl_Writer.cxx b/src/XSControl/XSControl_Writer.cxx index 300c317041..e96bd09898 100644 --- a/src/XSControl/XSControl_Writer.cxx +++ b/src/XSControl/XSControl_Writer.cxx @@ -68,7 +68,7 @@ XSControl_Writer::XSControl_Writer () IFSelect_ReturnStatus XSControl_Writer::TransferShape (const TopoDS_Shape& sh, const Standard_Integer mode) { - thesession->SetModeWriteShape (mode); + thesession->TransferWriter()->SetTransferMode (mode); return thesession->TransferWriteShape (sh); } diff --git a/src/XSDRAW/XSDRAW.cxx b/src/XSDRAW/XSDRAW.cxx index bc4305c19a..580d08a80e 100644 --- a/src/XSDRAW/XSDRAW.cxx +++ b/src/XSDRAW/XSDRAW.cxx @@ -157,11 +157,9 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands) { return Session()->NormAdaptor(); } Standard_Boolean XSDRAW::SetNorm - (const Standard_CString norm, const Standard_CString profile) + (const Standard_CString norm) { - Standard_Boolean stat = Session()->SelectNorm (norm,profile); - if (stat) IFSelect_Activator::SetCurrentAlias (Session()->SelectedNorm(Standard_True)); - return stat; + return Session()->SelectNorm (norm); } Handle(Interface_Protocol) XSDRAW::Protocol () diff --git a/src/XSDRAW/XSDRAW.hxx b/src/XSDRAW/XSDRAW.hxx index b1bc8e4d44..f309f6a487 100644 --- a/src/XSDRAW/XSDRAW.hxx +++ b/src/XSDRAW/XSDRAW.hxx @@ -18,13 +18,9 @@ #define _XSDRAW_HeaderFile #include -#include #include -#include -#include #include -#include #include #include class IFSelect_SessionPilot; @@ -49,11 +45,8 @@ class XSDRAW_Vars; //! FinderProcess class XSDRAW { -public: + public: - DEFINE_STANDARD_ALLOC - - //! Takes variables to/from the DRAW session //! Implements ProgressIndicator for DRAW //! Changes the name under which a command of xstep is known by @@ -119,9 +112,7 @@ public: //! Sets a norm by its name (controller recorded as ) //! Returns True if done, False if this norm is unknown - //! If is given, also sets the norm to - //! (if is undefined for , it is ignored) - Standard_EXPORT static Standard_Boolean SetNorm (const Standard_CString normname, const Standard_CString profile = ""); + Standard_EXPORT static Standard_Boolean SetNorm (const Standard_CString normname); //! Returns the actually defined Protocol Standard_EXPORT static Handle(Interface_Protocol) Protocol(); @@ -213,30 +204,6 @@ public: //! completed (Append without Clear) by the Shapes found //! Returns 0 if no Shape could be found Standard_EXPORT static Standard_Integer MoreShapes (Handle(TopTools_HSequenceOfShape)& list, const Standard_CString name); - - - - -protected: - - - - - -private: - - - - -friend class XSDRAW_Functions; -friend class XSDRAW_Vars; - }; - - - - - - #endif // _XSDRAW_HeaderFile diff --git a/src/XSDRAW/XSDRAW_Functions.hxx b/src/XSDRAW/XSDRAW_Functions.hxx index 1ecea78e94..fc436da559 100644 --- a/src/XSDRAW/XSDRAW_Functions.hxx +++ b/src/XSDRAW/XSDRAW_Functions.hxx @@ -18,10 +18,6 @@ #define _XSDRAW_Functions_HeaderFile #include -#include -#include - - //! Defines additionnal commands for XSDRAW to : //! - control of initialisation (xinit, xnorm, newmodel) @@ -35,35 +31,10 @@ //! basic features from user callable forms class XSDRAW_Functions { -public: - - DEFINE_STANDARD_ALLOC - + public: //! Defines and loads all basic functions for XSDRAW (as ActFunc) Standard_EXPORT static void Init(); - - - - -protected: - - - - - -private: - - - - - }; - - - - - - #endif // _XSDRAW_Functions_HeaderFile diff --git a/src/XSDRAWIGES/XSDRAWIGES.cxx b/src/XSDRAWIGES/XSDRAWIGES.cxx index 48f5df3eaa..38a73fa693 100644 --- a/src/XSDRAWIGES/XSDRAWIGES.cxx +++ b/src/XSDRAWIGES/XSDRAWIGES.cxx @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -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 : "<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 = '!'; diff --git a/src/XSDRAWSTEP/XSDRAWSTEP.cxx b/src/XSDRAWSTEP/XSDRAWSTEP.cxx index 5fc4be0af7..07d260b934 100644 --- a/src/XSDRAWSTEP/XSDRAWSTEP.cxx +++ b/src/XSDRAWSTEP/XSDRAWSTEP.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -178,7 +179,7 @@ static Standard_Integer stepread (Draw_Interpretor& di/*theCommands*/, Standard_ progress->NewScope ( 80, "Translation" ); progress->Show(); - sr.WS()->MapReader()->SetProgress ( progress ); + sr.WS()->TransferReader()->TransientProcess()->SetProgress ( progress ); if (!sr.TransferRoot (num)) di<<"Transfer root n0 "<MapReader()->SetProgress ( 0 ); + sr.WS()->TransferReader()->TransientProcess()->SetProgress ( 0 ); progress->EndScope(); progress->Show(); } @@ -240,7 +241,7 @@ static Standard_Integer stepread (Draw_Interpretor& di/*theCommands*/, Standard_ progress->NewScope ( 80, "Translation" ); progress->Show(); - sr.WS()->MapReader()->SetProgress ( progress ); + sr.WS()->TransferReader()->TransientProcess()->SetProgress ( progress ); Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 ); for (ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) { @@ -256,7 +257,7 @@ static Standard_Integer stepread (Draw_Interpretor& di/*theCommands*/, Standard_ DBRep::Set (shname,sh); } } - sr.WS()->MapReader()->SetProgress ( 0 ); + sr.WS()->TransferReader()->TransientProcess()->SetProgress ( 0 ); progress->EndScope(); progress->Show(); }