#include <VrmlData_ShapeNode.hxx>
#include <XSControl_WorkSession.hxx>
+#include <XSControl_TransferReader.hxx>
#include <STEPConstruct_Styles.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <STEPConstruct.hxx>
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);
#include <IFSelect_Activator.hxx>
#include <IFSelect_SessionPilot.hxx>
#include <Interface_Macros.hxx>
-#include <MoniTool_Option.hxx>
-#include <MoniTool_Profile.hxx>
#include <Standard_DomainError.hxx>
-#include <Standard_Type.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TColStd_SequenceOfInteger.hxx>
static TColStd_SequenceOfInteger thenums, themodes;
static TColStd_SequenceOfTransient theacts;
-static Handle(MoniTool_Profile) thealiases;
-
void IFSelect_Activator::Adding
(const Handle(IFSelect_Activator)& actor,
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)
//! Removes a Command, if it is recorded (else, does nothing)
Standard_EXPORT static void Remove (const Standard_CString command);
- //! Records, for a configuration named <conf>, that the command
- //! <command> may be aliased by another command <alias>
- //!
- //! 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 <conf> 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 <command>
- //! 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);
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 : "<<pilot->Session()->LoadedFile()<<endl;
- sout<<"No specific whatfile available"<<endl;
- return IFSelect_RetVoid;
-}
-
static IFSelect_ReturnStatus fun4
(const Handle(IFSelect_SessionPilot)& pilot)
{
Handle(Message_Messenger) sout = Message::DefaultMessenger();
if (argc < 2) { sout<<"Give label to search"<<endl; return IFSelect_RetError; }
if (!WS->HasModel()) { sout<<"No loaded model, abandon"<<endl; return IFSelect_RetError; }
- Handle(Interface_InterfaceModel) model = WS->Model();
+ const Handle(Interface_InterfaceModel) &model = WS->Model();
Standard_Integer i, cnt = 0;
Standard_Boolean exact = Standard_False;
sout<<" ** Search Entity Number for Label : "<<arg1<<endl;
}
DeclareAndCast(IFSelect_SelectPointed,sp,WS->NamedItem(arg1));
if (sp.IsNull()) { sout<<"Pas une SelectPointed:"<<arg1<<endl; return IFSelect_RetError; }
- Handle(Interface_InterfaceModel) model = WS->Model(); // pour Print
+ const Handle(Interface_InterfaceModel) &model = WS->Model(); // pour Print
if (argc == 2) { // listage simple
Standard_Integer nb = sp->NbItems();
sout<<" SelectPointed : "<<arg1<<" : "<<nb<<" Items :"<<endl;
IFSelect_Act::AddFunc("xstatus","Lists XSTEP Status : Version, System Name ...",funstatus);
IFSelect_Act::AddFunc("handler","Toggle status catch Handler Error of the session",fun1);
IFSelect_Act::AddFunc("xload","file:string : Read File -> 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);
themodelstat = Standard_False;
}
-
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-void IFSelect_WorkSession::SetErrorHandle (const Standard_Boolean hand)
-{
- theerrhand = errhand = hand;
-}
-
-
//=======================================================================
//function :
//purpose :
//=======================================================================
-Standard_Boolean IFSelect_WorkSession::ErrorHandle () const
+void IFSelect_WorkSession::SetErrorHandle (const Standard_Boolean toHandle)
{
- return theerrhand;
+ theerrhand = errhand = toHandle;
}
-
-
-//=======================================================================
-//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 :
//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");
}
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Standard_Boolean IFSelect_WorkSession::HasModel () const
-{
- return (!themodel.IsNull());
-}
-
-
//=======================================================================
//function :
//purpose :
(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
}
-//=======================================================================
-//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 :
Standard_Integer IFSelect_WorkSession::NbStartingEntities () const
{
- if (themodel.IsNull()) return 0;
- return themodel->NbEntities();
+ return (myModel.IsNull()? 0 : myModel->NbEntities());
}
//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);
}
//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));
}
(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;
}
//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);
}
//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;
//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)));
}
//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));
}
//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));
}
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;
(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
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;
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;
}
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)
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;
}
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)");
}
-//=======================================================================
-//function :
-//purpose :
-//=======================================================================
-
-Interface_CheckIterator IFSelect_WorkSession::LastRunCheckList () const
-{
- return thecheckrun;
-}
-
-
// #####################################################################
// .... LES VARIABLES ....
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);
}
// ########################################################################
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;
}
//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);
//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);
}
//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));
}
//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));
}
//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);
//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));
}
if (!checks.IsEmpty(Standard_False)) {
Handle(Message_Messenger) sout = Message::DefaultMessenger();
sout<<" ** RunTransformer has produced Check Messages : **"<<endl;
- checks.Print (sout,themodel,Standard_False);
+ checks.Print (sout,myModel,Standard_False);
}
thecheckdone = Standard_False;
thecheckrun = checks;
DeclareAndCast(IFSelect_SelectPointed,sp,Item(list->Value(i)));
sp->Update(transf);
}
- if (newmod == themodel) {
+ if (newmod == myModel) {
effect = (res ? 2 : -2);
if (!res) return effect;
Handle(Interface_Protocol) newproto = theprotocol;
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;
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());
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 =
if (!checks.IsEmpty(Standard_False)) {
Handle(Message_Messenger) sout = Message::DefaultMessenger();
sout<<" ** EvaluateFile has produced Check Messages : **"<<endl;
- checks.Print (sout,themodel,Standard_False);
+ checks.Print (sout,myModel,Standard_False);
}
thecopier->SetRemaining (thegraph->CGraph());
thecheckrun = checks;
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"<<endl; return Standard_False;
- } else if (newmod == themodel) {
+ } else if (newmod == myModel) {
sout<<" Remaining causes all original data to be kept"<<endl;
thecopier->SetRemaining (thegraph->CGraph());
return Standard_False;
} else {
- theoldel = themodel;
+ theoldel = myModel;
SetModel(newmod,Standard_False);
// MISE A JOUR des SelectPointed
Handle(TColStd_HSequenceOfInteger) 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();
(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);
//=======================================================================
void IFSelect_WorkSession::SetParams
- (const TColStd_SequenceOfTransient& params,
- const TColStd_SequenceOfInteger& uselist)
+ (const NCollection_Vector<Handle(Standard_Transient)>& params,
+ const NCollection_Vector<Standard_Integer>& uselist)
{
Standard_Integer i, nbp = params.Length(), nbu = uselist.Length();
Handle(IFSelect_ParamEditor) editor = new IFSelect_ParamEditor
// 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
if (level == 0) {
S<<" ******** Short Dump of Header ********\n";
S << " *****************************************************************\n\n";
- themodel->DumpHeader(S); S<<endl;
+ myModel->DumpHeader(S); S<<endl;
}
- Standard_Integer nbent = themodel->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 : "<<nbent<<" Entities, of which "<<nbr<<" Root(s)\n";
ListEntities (shar.RootEntities(),1);
} else if (level == 2) {
S<<" ******** Complete List ******** ";
- ListEntities (themodel->Entities(),1);
+ ListEntities (myModel->Entities(),1);
} else if (level > 2) {
IFSelect_PrintCount mode = IFSelect_ItemsByEntity;
if (level == 5 || level == 8) mode = IFSelect_CountByItem;
// 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();
{
if (!IsLoaded())
{ S<< " *** Data for List not available ***"<<endl; return; }
- Standard_Integer num = themodel->Number(ent);
+ Standard_Integer num = myModel->Number(ent);
if (num == 0) { S<<" *** Entity to Dump not in the Model ***"<<endl; return; }
if (thelibrary.IsNull()) { S<<" *** WorkLibrary not defined ***"<<endl; return; }
S << " ******** Dumping Entity n0 "<<num
<<" level:"<<level<<" ********"<<endl;
- thelibrary->DumpEntity (themodel,theprotocol,ent,S,level);
+ thelibrary->DumpEntity (myModel,theprotocol,ent,S,level);
}
// .... DumpEntity ....
if (num == 0) { cout<<" -- PrintEntityStatus : unknown"<<endl; return; }
S <<" Ent. n0/id: ";
- Model()->Print(ent,S);
+ myModel->Print(ent,S);
Handle(TCollection_HAsciiString) hname = EntityName(ent);
if (!hname.IsNull() && hname->Length() > 0) S<<" Name:"<<hname->ToCString();
S<<endl;
Handle(IFSelect_Signature) signtype = SignType();
if (signtype.IsNull()) S<<" Type(CDL):"<<ent->DynamicType()->Name()<<endl;
- else S <<" Type:"<<signtype->Value (ent,Model())<<endl;
+ else S <<" Type:"<<signtype->Value (ent,myModel)<<endl;
S <<" Category : " <<CategoryName (ent)
<<" Validity : " <<ValidityName (ent) << endl;
Interface_CheckIterator chl = CheckOne (ent);
- chl.Print (S,Model(),Standard_False,Standard_False);
+ chl.Print (S,myModel,Standard_False,Standard_False);
Handle(TColStd_HSequenceOfTransient) list = Sharings(ent);
if (list.IsNull()) S<<" Root"<<endl;
nb = list->Length();
if (nb == 0) S<<" Root";
else S<<" Super-entities:"<<nb<<" : (n0/id):";
- for (i = 1; i <= nb; i ++) { S<<" "; Model()->Print(list->Value(i),S); }
+ for (i = 1; i <= nb; i ++) { S<<" "; myModel->Print(list->Value(i),S); }
S<<endl;
}
list = Shareds (ent);
nb = list->Length();
if (nb == 0) S<<" No sub-entity";
else S<<" Sub-entities:"<<nb<<" , i.e. (n0/id):";
- for (i = 1; i <= nb; i ++) { S<<" "; Model()->Print(list->Value(i),S); }
+ for (i = 1; i <= nb; i ++) { S<<" "; myModel->Print(list->Value(i),S); }
S<<endl;
}
}
{
// mode : 0 comptage 1 n0s entites 2 n0s+id ents
Handle(Message_Messenger) sout = Message::DefaultMessenger();
- if (mode == IFSelect_ItemsByEntity) checklist.Print (sout,themodel,failsonly);
+ if (mode == IFSelect_ItemsByEntity) checklist.Print (sout,myModel,failsonly);
else {
Interface_CheckIterator chks = checklist;
Handle(IFSelect_CheckCounter) counter =
new IFSelect_CheckCounter (mode>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);
}
}
{
Handle(Message_Messenger) sout = Message::DefaultMessenger();
if (signlist.IsNull()) return;
- signlist->PrintList (sout,themodel,mode);
+ signlist->PrintList (sout,myModel,mode);
}
// #### #### #### #### #### #### #### #### ####
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<<Interface_MSG::Blanks (num,6);
- themodel->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<<" "<<Interface_Category::Name (catnum);
sout << " (" << ValidityName (ent) << ") ";
- sout<<" Type:"<<themodel->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:"<<myModel->TypeName (ent, Standard_False)<<endl;
} else if (mode == 2) {
newcount ++;
if (newcount > 0) sout<<",";
newcount ++; mods = 0; cnt ++;
if (newcount >= 10) { sout << endl<<"["<<cnt<<"]:"; newcount = 1; }
if (newcount > 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 ++; }
}
}
sout<<"\n Abandon"<<endl;
}
}
-
-void IFSelect_WorkSession::SetModeStat( Standard_Boolean theStatMode)
-{
- themodelstat = theStatMode;
-}
-
-Standard_Boolean IFSelect_WorkSession::GetModeStat() const
-{
- return themodelstat;
-}
#include <Interface_CheckIterator.hxx>
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
#include <MMgt_TShared.hxx>
+#include <NCollection_Vector.hxx>
#include <Standard_CString.hxx>
#include <IFSelect_ReturnStatus.hxx>
#include <Standard_Integer.hxx>
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
//! 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
//! 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
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
//! 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 :
//! 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
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);
//! 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<Handle(Standard_Transient)>& params, const NCollection_Vector<Standard_Integer>& uselist);
//! Traces the Statics attached to a given use number
//! If <use> is given positive (normal), the trace is embedded
//! 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;
Handle(IFSelect_ModelCopier) thecopier;
Handle(Interface_InterfaceModel) theoldel;
Standard_Boolean themodelstat;
-
-
};
-
-
-
-
-
-
#endif // _IFSelect_WorkSession_HeaderFile
#include <XSControl_TransferReader.hxx>
#include <XSControl_WorkSession.hxx>
-//=======================================================================
-//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
}
// 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;
// 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;
}
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="<<i<<endl;
- if(SMTool->Search(S,L)) {
- cout<<" find Instance"<<endl;
- CTool->SetColor(L, col, XCAFDoc_ColorGen);
- }
- if(L.IsNull()) {
- cout<<"L1 is Null"<<endl;
- if(STool->Search(S,L,Standard_False,Standard_False,Standard_True)) {
- cout<<" add new label1 :"<<L<<endl;
- CTool->SetColor(L, col, XCAFDoc_ColorGen);
- }
- }
- if(L.IsNull()) {
- //else {
- cout<<" try to find splitting"<<endl;
- // may be S is compound of shapes resulting from splitting
- for (TopoDS_Iterator it(S); it.More(); it.Next()) {
- //TDF_Label L1;
- if(!SMTool->Search(it.Value(),L)) continue; //break-?
- cout<<" find splitting"<<endl;
- CTool->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 :"<<L<<endl;
- CTool->SetColor(L, col, XCAFDoc_ColorGen);
- }
- }
- }
- }
-// cout<<"L.Dump():"<<L<<endl;
-// if(L.IsNull()) {
-// cout<<"L2 is Null"<<endl;
-// if(STool->Search(S,L,Standard_False,Standard_False,Standard_True)) {
-// cout<<" add new label2 :"<<L<<endl;
-// CTool->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;
-}
-
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-#include <Standard_Boolean.hxx>
#include <IGESControl_Reader.hxx>
-#include <Standard_CString.hxx>
+#include <TCollection_AsciiString.hxx>
class XSControl_WorkSession;
class TDocStd_Document;
-class TCollection_AsciiString;
//! Provides a tool to read IGES file and put it into
//! 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;
-
- //! Set LayerMode for indicate read Layers or not.
- Standard_EXPORT void SetLayerMode (const Standard_Boolean layermode);
-
- Standard_EXPORT Standard_Boolean GetLayerMode() const;
+ void SetNameMode (const Standard_Boolean theMode)
+ { myNameMode = theMode; }
-
-
-
-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;
+ Standard_Boolean GetNameMode() const
+ { return myNameMode; }
- //! 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:
+ //! Set LayerMode for indicate read Layers or not.
+ 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
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) {
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);
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);
Handle(IFSelect_EditForm) eddirpf = eddirp->Form(Standard_False);
WS->AddNamedItem ("iges-dir-part",eddirpf);
- theSignType = typnam;
+ //szv:mySignType = typnam;
+ WS->SetSignType( typnam );
}
-
-
}
//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();
//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) ####
//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);
}
//purpose :
//=======================================================================
- Standard_Boolean IGESControl_Controller::Init ()
+Standard_Boolean IGESControl_Controller::Init ()
{
static Standard_Boolean inic = Standard_False;
if (!inic) {
(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();
#include <Transfer_FinderProcess.hxx>
#include <XSAlgo.hxx>
#include <XSAlgo_AlgoContainer.hxx>
-#include <XSControl_TransferWriter.hxx>
#include <errno.h>
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() )
"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)
}
}
- 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
aZmin / gs.UnitValue()));
}
- themod->SetGlobalSection(gs);
+ myModel->SetGlobalSection(gs);
return aent;
}
// 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()) {
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
{
if (!S) return Standard_False;
ComputeModel();
- Standard_Integer nbEnt = themod->NbEntities();
+ Standard_Integer nbEnt = myModel->NbEntities();
#ifdef OCCT_DEBUG
cout<<" IGES Write : "<<nbEnt<<" ent.s"<< flush;
#endif
if(!nbEnt)
return Standard_False;
- IGESData_IGESWriter IW (themod);
+ IGESData_IGESWriter IW (myModel);
// ne pas oublier le mode fnes ... a transmettre a IW
IW.SendModel (IGESSelect_WorkLibrary::DefineProtocol());
#ifdef OCCT_DEBUG
return res;
}
-
-void IGESControl_Writer::PrintStatsTransfer
- (const Standard_Integer what, const Standard_Integer mode) const
-{
- XSControl_TransferWriter::PrintStatsProcess (theTP,what,mode);
-}
public:
DEFINE_STANDARD_ALLOC
-
//! Creates a writer object with the
//! default unit (millimeters) and write mode (Face).
Standard_EXPORT IGESControl_Writer(const Handle(IGESData_IGESModel)& model, const Standard_Integer modecr = 0);
//! Returns the IGES model to be written in output.
- Standard_EXPORT Handle(IGESData_IGESModel) Model() const;
-
- Standard_EXPORT Handle(Transfer_FinderProcess) TransferProcess() const;
-
+ const Handle(IGESData_IGESModel) & Model() const
+ { return myModel; }
+
+ const Handle(Transfer_FinderProcess) & TransferProcess() const
+ { return myTP; }
+
//! Returns/Sets the TransferProcess : it contains final results
//! and if some, check messages
- Standard_EXPORT void SetTransferProcess (const Handle(Transfer_FinderProcess)& TP);
+ void SetTransferProcess (const Handle(Transfer_FinderProcess)& TP)
+ { myTP = TP; }
//! Translates a Shape to IGES Entities and adds them to the model
//! Returns True if done, False if Shape not suitable for IGES or null
//! False if an error occurred (for instance,
//! if the processor could not create the file).
Standard_EXPORT Standard_Boolean Write (const Standard_CString file, const Standard_Boolean fnes = Standard_False);
-
- //! Prints Statistics about Transfer
- Standard_EXPORT void PrintStatsTransfer (const Standard_Integer what, const Standard_Integer mode = 0) const;
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
- Handle(Transfer_FinderProcess) theTP;
- Handle(IGESData_IGESModel) themod;
- IGESData_BasicEditor thedit;
- Standard_Integer thecr;
- Standard_Boolean thest;
+ private:
+ Handle(Transfer_FinderProcess) myTP;
+ Handle(IGESData_IGESModel) myModel;
+ IGESData_BasicEditor myEditor;
+ Standard_Integer myWriteMode;
+ Standard_Boolean myIsComputed;
};
-
-
-
-
-
-
#endif // _IGESControl_Writer_HeaderFile
#include <Interface_Category.hxx>
#include <Interface_GeneralModule.hxx>
-#include <Interface_GTool.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Interface_Protocol.hxx>
#include <Interface_ShareTool.hxx>
#include <Standard_Transient.hxx>
+#include <Standard_Mutex.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_SequenceOfAsciiString.hxx>
+#include <NCollection_Vector.hxx>
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<TCollection_AsciiString>& theCats()
{
- static TColStd_SequenceOfAsciiString thecat;
- return thecat;
+ static NCollection_Vector<TCollection_AsciiString> 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_CString Interface_Category::Name (const Standard_Integer theNum)
+{
+ 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 name)
+Standard_Integer Interface_Category::Number (const Standard_CString theName)
{
- Standard_Integer i, nb = thecats().Length();
+ 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();
+ }
}
#include <TColStd_HArray1OfInteger.hxx>
#include <Standard_Integer.hxx>
#include <Standard_CString.hxx>
-class Interface_GTool;
+
+#include <Interface_GTool.hxx>
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
//! 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
#ifdef Status
#undef Status
#endif
+#ifdef Opposite
+ #undef Opposite
+#endif
#endif
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
+++ /dev/null
-// 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 <MoniTool_OptValue.hxx>
-#include <MoniTool_Profile.hxx>
-#include <Standard_Transient.hxx>
-
-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()
-{}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Boolean.hxx>
-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
+++ /dev/null
-// 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 <Dico_DictionaryOfTransient.hxx>
-#include <Dico_IteratorOfDictionaryOfTransient.hxx>
-#include <MoniTool_Option.hxx>
-#include <MoniTool_TypedValue.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-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; }
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <Standard_Type.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Boolean.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
-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 <name> 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 <val> 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 <name> 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 <name>, which bring the
- //! same value as <name>
- //! Empty list (not a Null Handle) if no alias, or <name> unknown
- //! if <exact> is True (D), exact name is required, no completion
- //! if <exact> is False and <name> 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 <name> 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
+++ /dev/null
-// 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 <Dico_DictionaryOfTransient.hxx>
-#include <Dico_IteratorOfDictionaryOfTransient.hxx>
-#include <MoniTool_Option.hxx>
-#include <MoniTool_Profile.hxx>
-#include <MoniTool_TypedValue.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-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);
-}
+++ /dev/null
-// 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 <Standard.hxx>
-#include <Standard_Type.hxx>
-
-#include <TCollection_AsciiString.hxx>
-#include <MMgt_TShared.hxx>
-#include <Standard_CString.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <Standard_Boolean.hxx>
-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 <confname> 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 <confname> 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 <confname> 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 <otherconf> to
- //! those of <confname>
- //! 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 <confname>, for the option <optname>
- //! the command to switch it to <casename>
- //! If <casename> is not given, records the actual current
- //! CaseName of this Option
- //! Returns True if done, False if <confname> or <optname> is
- //! unknown, or <casename> not allowed for <optname>
- Standard_EXPORT Standard_Boolean AddSwitch (const Standard_CString confname, const Standard_CString optname, const Standard_CString casename = "");
-
- //! Removes from the Configuration <confname>, the switch for the
- //! option <optname>. Hence, it will consider the basic default
- //! switch for this option
- //! Returns True if done or switch was not recorded, False if
- //! <confname> or <optname> 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, <optlist> lists the names of options
- //! and for each one, <caselist> 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 <confname> to current
- //! Records the current name as the last current setting
- //!
- //! Returns True if done, False (and does nothing> if <confname>
- //! 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 <optname> in current
- //! configuration
- //! Empty String if <optname> unknown
- //!
- //! If <proper> is False (D), if <optname> 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 <optname>
- //! in current configuration
- //! Null Handle if <optname> 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 <optname>
- //! in current configuration
- //! Returns True if done, False + Null Handle if <optname> 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 <proper> is False (D), takes the current value, whatever
- //! it is properly recorded in current configuration or not
- //! If <proper> 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 <name> is given, considers the Options of which the name
- //! begins by <name>
- 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 <optname>, 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, <val> 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
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
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();
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()) {
nbt++;
}
}
- thesession->MapReader()->SetProgress ( 0 );
+ thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
// *New*
//In order to clear memory after IGES reading you could add the following code
- Handle(XSControl_TransferReader) TR = Reader.WS()->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();
STEPCAFControl_Controller::STEPCAFControl_Controller ()
{
Handle(STEPCAFControl_ActorWrite) ActWrite = new STEPCAFControl_ActorWrite;
- theAdaptorWrite = ActWrite;
+ myAdaptorWrite = ActWrite;
}
//=======================================================================
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;
// 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()) {
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 );
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;
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() );
{
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;
{
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);
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;
{
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)) &&
{
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))
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;
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;
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
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++ )
{
{
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++ ) {
}
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,
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++ ) {
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;
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,
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,
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 );
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;
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);
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;
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)) ||
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;
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;
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;
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())
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())
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())
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();
}
-
#include <Interface_InterfaceModel.hxx>
#include <Interface_Macros.hxx>
#include <Interface_Static.hxx>
-#include <MoniTool_Option.hxx>
-#include <MoniTool_Profile.hxx>
#include <RWHeaderSection.hxx>
#include <RWStepAP214.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(STEPControl_Controller,XSControl_Controller)
-//#include <StepAP214.hxx>
// 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) {
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");
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");
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
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
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
{
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"));
//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())
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);
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);
}
//! 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
#include <StepBasic_SolidAngleMeasureWithUnit.hxx>
#include <StepBasic_SolidAngleUnit.hxx>
#include <STEPConstruct_UnitContext.hxx>
-#include <STEPControl_ActorRead.hxx>
#include <STEPControl_Controller.hxx>
#include <STEPControl_Reader.hxx>
#include <StepData_StepModel.hxx>
//}
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");
}
if(IsRoot) {
theroots.Append(ent);
- WS()->MapReader()->RootsForTransfer()->Append(ent);
+ WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent);
}
}
if(ent->IsKind(STANDARD_TYPE(StepShape_ShapeRepresentation))) {
}
if(IsRoot) {
theroots.Append(ent);
- WS()->MapReader()->RootsForTransfer()->Append(ent);
+ WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent);
}
}
}
//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();
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++;
#include <Interface_Static.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
-#include <MoniTool_Option.hxx>
-#include <MoniTool_Profile.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
// 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()
-{
- static TColStd_IndexedMapOfTransient mapad;
- return mapad;
-}
+//=======================================================================
+//function : XSControl_Controller
+//purpose : Constructor
+//=======================================================================
-
- XSControl_Controller::XSControl_Controller
- (const Standard_CString longname, const Standard_CString shortname)
- : theShortName (shortname) , theLongName (longname)
+XSControl_Controller::XSControl_Controller (const Standard_CString theLongName, const Standard_CString theShortName)
+: myShortName(theShortName), myLongName(theLongName)
{
- 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);
+//=======================================================================
+//function : TraceStatic
+//purpose :
+//=======================================================================
-// Definition de la config de base : suite a la customisation
+void XSControl_Controller::TraceStatic (const Standard_CString theName, const Standard_Integer theUse)
+{
+ Handle(Interface_Static) val = Interface_Static::Static(theName);
+ if (val.IsNull()) return;
+ myParams.Append (val);
+ myParamUses.Append(theUse);
}
- void XSControl_Controller::SetNames
- (const Standard_CString longname, const Standard_CString shortname)
+//=======================================================================
+//function : SetNames
+//purpose :
+//=======================================================================
+
+void XSControl_Controller::SetNames (const Standard_CString theLongName, const Standard_CString theShortName)
{
- if (longname && longname[0] != '\0') {
- theLongName.Clear(); theLongName.AssignCat (longname);
+ 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)
-{
- Handle(Standard_Transient) recorded;
- if (!listadapt()->GetItem (name,recorded)) recorded.Nullify();
- return Handle(XSControl_Controller)::DownCast (recorded);
-}
+//=======================================================================
+//function : Recorded
+//purpose :
+//=======================================================================
- Handle(TColStd_HSequenceOfHAsciiString) XSControl_Controller::ListRecorded
- (const Standard_Integer mode)
+Handle(XSControl_Controller) XSControl_Controller::Recorded (const Standard_CString theName)
{
- 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;
+ Handle(Standard_Transient) recorded;
+ return (listadapt()->GetItem(theName,recorded)?
+ Handle(XSControl_Controller)::DownCast(recorded) :
+ Handle(XSControl_Controller)());
}
- Standard_CString XSControl_Controller::Name (const Standard_Boolean rsc) const
- { return (rsc ? theShortName.ToCString() : theLongName.ToCString()); }
-
-// #### PROFILE ####
+// #### DEFINITION ####
- Handle(MoniTool_Profile) XSControl_Controller::Profile () const
- { return theProfile; }
+//=======================================================================
+//function : ActorRead
+//purpose :
+//=======================================================================
- void XSControl_Controller::DefineProfile
- (const Standard_CString confname)
+Handle(Transfer_ActorOfTransientProcess) XSControl_Controller::ActorRead (const Handle(Interface_InterfaceModel)&) const
{
- if (!theProfile->HasConf(confname)) theProfile->AddConf (confname);
- theProfile->SetFromCurrent (confname);
+ return myAdaptorRead;
}
- 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);
-}
+//=======================================================================
+//function : ActorWrite
+//purpose :
+//=======================================================================
- 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)
+Handle(Transfer_ActorOfFinderProcess) XSControl_Controller::ActorWrite () const
{
- 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);
+ return myAdaptorWrite;
}
- 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; }
-
- Handle(IFSelect_Signature) XSControl_Controller::SignType () const
- { return theSignType; }
-
- Handle(IFSelect_WorkLibrary) XSControl_Controller::WorkLibrary () const
- { return theAdaptorLibrary; }
-
- Handle(Transfer_ActorOfFinderProcess) XSControl_Controller::ActorWrite () const
- { return theAdaptorWrite; }
-
- void XSControl_Controller::UpdateStatics
- (const Standard_Integer, const Standard_CString ) const
- { } // a redefinir si besoin
-
// ###########################
// 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();
}
// 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();
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,
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; }
-
+// Cutomisation ! On enregistre des Items pour une WorkSession
+// (annule et remplace)
+// Ensuite, on les remet en place a la demande
-// ###########################
-// ControlItems : si ActorWrite etc... ne suffisent meme plus, on peut en
-// rajouter, Controller ne fait alors que les accueillir
+//=======================================================================
+//function : AddSessionItem
+//purpose :
+//=======================================================================
- void XSControl_Controller::AddControlItem
- (const Handle(Standard_Transient)& item, const Standard_CString name)
+void XSControl_Controller::AddSessionItem
+ (const Handle(Standard_Transient)& theItem, const Standard_CString theName, const Standard_Boolean toApply)
{
- if (item.IsNull() || name[0] == '\0') return;
- if (theItems.IsNull()) theItems = new Dico_DictionaryOfTransient;
- theItems->SetItem (name,item);
+ 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);
}
- Handle(Standard_Transient) XSControl_Controller::ControlItem
- (const Standard_CString name) const
+//=======================================================================
+//function : SessionItem
+//purpose :
+//=======================================================================
+
+Handle(Standard_Transient) XSControl_Controller::SessionItem (const Standard_CString theName) const
{
Handle(Standard_Transient) item;
- if (theItems.IsNull()) return item;
- theItems->GetItem (name,item);
+ if (!myAdaptorSession.IsNull())
+ myAdaptorSession->GetItem (theName,item);
return item;
}
-// ###########################
-// Cutomisation ! On enregistre des Items pour une WorkSession
-// (annule et remplace)
-// Ensuite, on les remet en place a la demande
+//=======================================================================
+//function : Customise
+//purpose :
+//=======================================================================
- void XSControl_Controller::TraceStatic
- (const Standard_CString name, const Standard_Integer use)
+void XSControl_Controller::Customise (Handle(XSControl_WorkSession)& WS)
{
- Handle(Interface_Static) val = Interface_Static::Static(name);
- if (val.IsNull()) return;
- theParams.Append (val);
- theParamUses.Append(use);
-}
+ WS->SetParams (myParams,myParamUses);
- 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."<<theAdaptorApplied.Length()+1
-// <<" Name:"<<name<<endl;
- theAdaptorApplied.Append(item);
- Handle(TCollection_HAsciiString) hook = new TCollection_HAsciiString(setapplied);
- theAdaptorHooks->Append (hook);
+ // General
+ if (!myAdaptorSession.IsNull()) {
+ Dico_IteratorOfDictionaryOfTransient iter(myAdaptorSession);
+ for (iter.Start(); iter.More(); iter.Next())
+ WS->AddNamedItem (iter.Name().ToCString(), iter.Value());
}
-}
- Handle(Standard_Transient) XSControl_Controller::SessionItem
- (const Standard_CString name) const
-{
- Handle(Standard_Transient) item;
- if (theAdaptorSession.IsNull()) return item;
- theAdaptorSession->GetItem (name,item);
- return item;
-}
-
- Standard_Boolean XSControl_Controller::IsApplied
- (const Handle(Standard_Transient)& item) const
-{
- 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;
-}
+ if (WS->NamedItem("xst-model-all").IsNull()) {
- void XSControl_Controller::Customise
- ( Handle(XSControl_WorkSession)& WS)
-{
- WS->SetParams (theParams,theParamUses);
+ 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);
-// General
- if(!theAdaptorSession.IsNull()) {
- Dico_IteratorOfDictionaryOfTransient iter(theAdaptorSession);
- for (iter.Start(); iter.More(); iter.Next()) {
- WS->AddNamedItem (iter.Name().ToCString() , iter.Value());
+ 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);
}
+
+ 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 );
}
- Customising(WS);
-// Applied Modifiers
- Standard_Integer i, nb = theAdaptorApplied.Length();
+
+ // Applied Modifiers
+ Standard_Integer i, nb = myAdaptorApplied.Length();
for (i = 1; i <= nb; i ++) {
- Handle(Standard_Transient) anitem = theAdaptorApplied.Value(i);
+ const Handle(Standard_Transient) &anitem = myAdaptorApplied.Value(i);
Handle(TCollection_HAsciiString) name = WS->Name(anitem);
-// Handle(Message_Messenger) sout = Message::DefaultMessenger();
-// sout<<" -- Customise applied n0."<<i<<" type:"<<anitem->DynamicType()->Name();
-// if (name.IsNull()) sout<<" no name"<<endl;
-// else sout<<" name:"<<name->ToCString()<<endl;
- WS->SetAppliedModifier
- (GetCasted(IFSelect_GeneralModifier,theAdaptorApplied.Value(i)),
- WS->ShareOut() );
+ WS->SetAppliedModifier(GetCasted(IFSelect_GeneralModifier,anitem),WS->ShareOut());
}
-// Editeurs de Parametres
-// Ici car les constructeurs specifiques des controlleurs ont pu creer des
-// Parametres : attendre donc ici
+ // 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;
}
#include <TColStd_SequenceOfInteger.hxx>
#include <Interface_HArray1OfHAsciiString.hxx>
#include <MMgt_TShared.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Integer.hxx>
-#include <Standard_Boolean.hxx>
+#include <NCollection_Vector.hxx>
#include <IFSelect_ReturnStatus.hxx>
-class MoniTool_Profile;
class IFSelect_WorkLibrary;
class Interface_Protocol;
class IFSelect_Signature;
//! 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)
//!
//! 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 <me> 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 <me> in a general dictionary under a name
//! Error if <name> already used for another one
//! Returns a Null Handle if <name> 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 <confname> 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
//! 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
- //! <mode> 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 <name> 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
//! 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 <name> 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 <name> 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.
//! <setapplied> is used if <item> 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, <item> 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 <name> 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 <name> is unknown, returns a Null Handle
- Standard_EXPORT Handle(Standard_Transient) SessionItem (const Standard_CString name) const;
-
- //! Returns True if <item> is recorded as <setapplied = True>
- Standard_EXPORT Standard_Boolean IsApplied (const Handle(Standard_Transient)& item) const;
+ Standard_EXPORT Handle(Standard_Transient) SessionItem (const Standard_CString theName) 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
- //! <longname> is for the complete, official, long name
- //! <shortname> is for the short name used for resources
- Standard_EXPORT XSControl_Controller(const Standard_CString longname, const Standard_CString shortname);
-
- 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;
-
-
-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;
-
+ //! <theLongName> is for the complete, official, long name
+ //! <theShortName> is for the short name used for resources
+ Standard_EXPORT XSControl_Controller(const Standard_CString theLongName, const Standard_CString theShortName);
+ //! 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:
+
+ TColStd_SequenceOfTransient myAdaptorApplied;
+ NCollection_Vector<Handle(Standard_Transient)> myParams;
+ NCollection_Vector<Standard_Integer> myParamUses;
+ Handle(Interface_HArray1OfHAsciiString) myModeWriteShapeN;
};
-
-
-
-
-
-
#endif // _XSControl_Controller_HeaderFile
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"<<endl; return IFSelect_RetError;}
// **** tpdraw ****
{
Standard_Integer argc = pilot->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"<<endl; return IFSelect_RetError;}
// **** tpcompound ****
Standard_Boolean cascomp = (pilot->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"<<endl; return IFSelect_RetError; }
- Handle(Interface_InterfaceModel) mdl = TR->Model();
+ const Handle(Interface_InterfaceModel) &mdl = TR->Model();
if (mdl.IsNull()) { sout<<" modele absent"<<endl; return IFSelect_RetError; }
Standard_Integer num = (argc > 1 ? IFSelect_Functions::GiveEntityNumber(XSControl::Session(pilot),arg1) : 0);
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 "<<nb<<endl;
for (i = 1; i <= nb; i ++) {
}
// IMPORT
- Handle(XSControl_TransferReader) TR = XSControl::Session(pilot)->TransferReader();
+ const Handle(XSControl_TransferReader) &TR = XSControl::Session(pilot)->TransferReader();
if (TR.IsNull()) { } // sout<<"No read transfer (import) recorded"<<endl;
else {
yena = Standard_True;
}
// ET EN EXPORT ?
- Handle(Transfer_FinderProcess) FP = XSControl::Session(pilot)->MapWriter();
- if (FP.IsNull()) { } //sout<<"No write transfer (export) recorded"<<endl;
+ const Handle(Transfer_FinderProcess) &FP = XSControl::Session(pilot)->TransferWriter()->FinderProcess();
+ if (FP.IsNull()) { }
else {
yena = Standard_True;
Handle(Transfer_Finder) fnd = TransferBRep::ShapeMapper (FP,Shape);
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();
XSControl_ConnectedShapes::AdjacentEntities (Shape,TP,TopAbs_FACE);
Standard_Integer i, nb = list->Length();
sout<<nb<<" Entities produced Connected Shapes :"<<endl;
- Handle(Interface_InterfaceModel) model = XSControl::Session(pilot)->Model();
+ const Handle(Interface_InterfaceModel) &model = XSControl::Session(pilot)->Model();
sout<<"(";
for (i = 1; i <= nb; i ++) {
if (i > 1) sout<<",";
// 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"<<endl; return IFSelect_RetError; }
TR->BeginTransfer();
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"<<endl;return 0; }
Handle(TopTools_HSequenceOfShape) li = TransferBRep::Shapes(TP,(name[1] == '\0'));
if (li.IsNull()) return 0;
#include <Interface_Static.hxx>
#include <Message.hxx>
#include <Message_Messenger.hxx>
-#include <MoniTool_Option.hxx>
-#include <MoniTool_Profile.hxx>
-#include <MoniTool_TypedValue.hxx>
-#include <TCollection_HAsciiString.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <Transfer_Binder.hxx>
#include <XSControl_TransferWriter.hxx>
#include <XSControl_WorkSession.hxx>
-//#include <TransferBRep_ShapeBinder.hxx>
-//#include <TransferBRep_ShapeListBinder.hxx>
-//#include <TransferBRep_ShapeMapper.hxx>
-//#include <TransferBRep_OrientedShapeMapper.hxx>
// #######################################################################
// ## ##
// ## ##
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"<<endl;
+ sout<<"Current Norm. xnorm newnorm to change"<<endl;
else sout<<"Current Norm :"<<endl;
if (control.IsNull()) sout<<"no norm currently defined"<<endl;
else
<< " Short name (resource) : "<<control->Name(Standard_True)<<endl;
if (argc == 1) return IFSelect_RetVoid;
- if (arg1[0] == '?') {
- sout<<"List of available norms"<<endl;
- Standard_Integer i,nb;
- Handle(TColStd_HSequenceOfHAsciiString) norms = XSControl_Controller::ListRecorded(-1);
- nb = norms->Length();
- sout<<"Short Proper Names (complete names) : "<<nb<<" :";
- for (i = 1; i <= nb; i ++) sout<<" "<<norms->Value(i)->ToCString();
- sout<<endl;
- norms = XSControl_Controller::ListRecorded(1);
- nb = norms->Length();
- sout<<"Long Proper Names (resource names) : "<<nb<<" :";
- for (i = 1; i <= nb; i ++) sout<<" "<<norms->Value(i)->ToCString();
- sout<<endl;
- norms = XSControl_Controller::ListRecorded(0);
- nb = norms->Length();
- sout<<"All Norm Names (short, long and aliases) "<<nb<<" :";
- for (i = 1; i <= nb; i ++) sout<<" "<<norms->Value(i)->ToCString();
- sout<<endl;
- sout<<"To change, xnorm newnorm"<<endl;
- return IFSelect_RetVoid;
- }
-
control = XSControl_Controller::Recorded(arg1);
- if (control.IsNull()) { sout<<" No norm named : "<<arg1<<endl; return IFSelect_RetError; }
- else {
- WS->SetController(control);
- sout<<"new norm : "<<control->Name()<<endl;
- if (argc > 2) {
- const Standard_CString arg2 = pilot->Arg(2);
- if (!control->Profile()->SetCurrent (arg2))
- sout<<"profile could not be set to "<<arg2<<endl;
- }
- sout<<"current profile : "<<control->Profile()->Current()<<endl;
-
- IFSelect_Activator::SetCurrentAlias (WS->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 : "<<prof->Current().ToCString()<<endl;
-
- if (argc < 2) {
- sout<<"xprofile ? for list of profile confs"<<endl
- << "xprofile . to apply the current profile (after editing)"<<endl
- << "xprofile profname to select one and apply it"<<endl
- << "xprofile profname . to record current profile as profname"<<endl
- <<" (in followings, profname may be replaced by . for current profile)"<<endl
- << "xprofile profname ? to list its definition"<<endl
- << "xprofile profname - to clear it completely"<<endl
- << "xprofile profname optname casename to edit an option of it"<<endl
- << "xprofile profname - optname to clear an option from it"<<endl;
- return IFSelect_RetVoid;
- }
-
- if (argc == 2) {
- if (arg1[0] == '?') {
- Handle(TColStd_HSequenceOfAsciiString) confs = prof->ConfList();
- Standard_Integer i, nb = confs->Length();
- sout<<"List of Available Profile Configurations : "<<nb<<" Items"<<endl;
- for (i = 1; i <= nb; i ++) sout<<confs->Value(i).ToCString()<<endl;
- return IFSelect_RetVoid;
- } else if (arg1[0] == '.' && arg1[1] == '\0') {
- if (!control->ApplyProfile(WS,".")) {
- sout<<"Applying current profile has failed"<<endl;
- return IFSelect_RetFail;
- }
- return IFSelect_RetDone;
- } else {
-
- // Select a Profile
- if (!control->ApplyProfile(WS,arg1)) {
- sout<<"Setting "<<arg1<<" as current has failed"<<endl;
- return IFSelect_RetFail;
- }
- sout<<"Setting "<<arg1<<" as current"<<endl;
- return IFSelect_RetDone;
- }
- }
-
- if (argc == 3) {
- const Standard_CString arg2 = pilot->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 -- ("<<nb<<" switches on configuration "<<arg1<<")"<<endl;
- for (i = 1; i <= nb; i ++) {
- sout<<opts->Value(i).ToCString()<<" "<<cases->Value(i).ToCString()<<endl;
- }
- return IFSelect_RetVoid;
-
- // Clear a profile
- } else if (arg2[0] == '-' && arg2[1] == '\0') {
- if (!prof->ClearConf(arg1)) {
- sout<<"Clearing profile "<<arg2<<" has failed"<<endl;
- return IFSelect_RetFail;
- }
- return IFSelect_RetDone;
-
- // Merge Profile arg2 to arg1
- } else {
- if (!prof->HasConf (arg1)) prof->AddConf (arg1);
- if (!prof->AddFromOtherConf (arg1,arg2)) {
- sout<<"Merging profile "<<arg2<<" to "<<arg1<<" has failed"<<endl;
- return IFSelect_RetFail;
- }
- return IFSelect_RetDone;
- }
- }
-
- // Editing / Adding a switch in a profile
- if (argc == 4) {
- const Standard_CString arg2 = pilot->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 "<<arg3<<" in profile "<<arg1<<" has failed"<<endl;
- return IFSelect_RetFail;
- }
- sout<<"Edition of profile "<<arg1<<" done. To apply it : xprofile "<<arg1<<endl;
- return IFSelect_RetDone;
-
- // Setting a switch
- } else {
- if (!prof->AddSwitch (arg1,arg2,arg3)) {
- sout<<"Setting profile "<<arg1<<" for option "<<arg2<<" to case "<<arg3<<" has failed"<<endl;
- return IFSelect_RetFail;
- }
- sout<<"Edition of profile "<<arg1<<" done. To apply it : xprofile "<<arg1<<endl;
- return IFSelect_RetDone;
- }
- }
-
- return IFSelect_RetVoid;
-}
-
-
-//=======================================================================
-//function : xoption
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_xoption(const Handle(IFSelect_SessionPilot)& pilot)
-{
- Standard_Integer argc = pilot->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 : "<<prof->Current().ToCString()<<endl;
-
- if (argc < 2) {
- sout<<"xoption anopt : query an option"<<endl
- << "xoption anopt newcase : switch (basic definition)"
- <<" (but is superseded by current configuration)"<<endl
- <<"xoption + optname [param] : create an option on a parameter"<<endl
- <<" (param absent is taken param=optname)"
- <<"xoption anopt + casename [value] : add a case for a parameter"<<endl
- <<" (value absent is taken value=casename)"<<endl;
-
- Handle(TColStd_HSequenceOfAsciiString) optlist = prof->OptionList();
- Standard_Integer iopt, nbopt = optlist->Length();
- sout<<"Total : "<<nbopt<<" Options"<<endl;
- for (iopt = 1; iopt <= nbopt; iopt ++) {
- TCollection_AsciiString optname = optlist->Value(iopt);
- Handle(MoniTool_Option) opt = prof->Option (optname.ToCString());
- sout<<optname.ToCString()<<" : "<<opt->CaseName()<<endl;
- }
- return IFSelect_RetVoid;
- }
-
- // xoption optname : description
-
- if (argc == 2) {
- Handle(MoniTool_Option) opt = prof->Option (arg1);
- if (opt.IsNull()) { sout<<"Not a recorded Option : "<<arg1<<endl; return IFSelect_RetError; }
-
- // On va lister les valeurs admises
- Handle(TColStd_HSequenceOfAsciiString) caselist = opt->ItemList();
- Standard_Integer icase, nbcase = caselist->Length();
- Handle(MoniTool_TypedValue) tv = opt->TypedValue();
- if (tv.IsNull()) sout<<"Option : "<<arg1<<" Type : "<<opt->Type()->Name();
- else sout<<"Option : "<<arg1<<" TypedValue. Name : "<<tv->Name()<<endl<<" Definition : "<<tv->Definition();
-
- sout<<endl<<" Current Case (basic) : "<<opt->CaseName()<<" Total : "<<nbcase<<" Cases :"<<endl;
- for (icase = 1; icase <= nbcase; icase ++) {
- const TCollection_AsciiString& acase = caselist->Value(icase);
- sout<<acase.ToCString();
-
- // Aliases ?
- Handle(TColStd_HSequenceOfAsciiString) aliases = opt->Aliases(acase.ToCString());
- Standard_Integer ial, nbal = (aliases.IsNull() ? 0 : aliases->Length());
- if (nbal > 0) sout<<" - Alias:";
- for (ial = 1; ial <= nbal; ial ++) sout<<" "<<aliases->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<<endl;
- }
- return IFSelect_RetVoid;
- }
-
- // xoption + optname [paramname]
- if (argc >= 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 "<<parname<<endl;
- return IFSelect_RetError; }
- const Handle(MoniTool_TypedValue)& aparam = param; // to avoid ambiguity
- Handle(MoniTool_Option) opt = new MoniTool_Option(aparam,arg2);
- prof->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 : "<<arg1<<endl; return IFSelect_RetError; }
- Handle(MoniTool_TypedValue) tv = opt->TypedValue();
- if (tv.IsNull()) { sout<<"Option not for a Parameter : "<<arg1<<endl; return IFSelect_RetError; }
- Standard_CString valname = pilot->Arg(argc-1);
- if (!opt->AddBasic (arg3,valname)) {
- sout<<"Option "<<arg1<<" : not an allowed value : "<<valname<<endl;
- return IFSelect_RetError;
- }
- return IFSelect_RetDone;
+ if (control.IsNull()) {
+ sout<<" No norm named : "<<arg1<<endl;
+ return IFSelect_RetError;
}
- // xoption optname newcase : edition
- if (argc == 3) {
- Handle(MoniTool_Option) opt = prof->Option (arg1);
- if (opt.IsNull()) { sout<<"Not a recorded Option : "<<arg1<<endl; return IFSelect_RetError; }
- if (!opt->Switch (arg2)) {
- sout<<"Option : "<<arg1<<" , Not a suitable case : "<<arg2<<endl;
- return IFSelect_RetFail;
- }
- sout<<"Option : "<<arg1<<" switched to case : "<<arg2<<endl;
- return IFSelect_RetDone;
- }
-
-
- return IFSelect_RetVoid;
+ WS->SetController(control);
+ sout<<"new norm : "<<control->Name()<<endl;
+ return IFSelect_RetDone;
}
static IFSelect_ReturnStatus XSControl_tpclear(const Handle(IFSelect_SessionPilot)& pilot)
{
// **** tpclear/twclear ****
- Standard_Boolean modew = Standard_False;
- if (pilot->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"<<endl; }
- else { if(!TP.IsNull()) TP->Clear(); else sout<<"No Transfer Read"<<endl; }
+ if (modew) { if(!FP.IsNull()) FP->Clear(); else sout<<"No Transfer Write"<<endl; }
+ else { if(!TP.IsNull()) TP->Clear(); else sout<<"No Transfer Read"<<endl; }
return IFSelect_RetDone;
}
Standard_Integer argc = pilot->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"<<endl; return IFSelect_RetError;}
// **** tpstat ****
{
Standard_Integer argc = pilot->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"<<endl; return IFSelect_RetError;}
}
-//=======================================================================
-//function : tpatr
-//=======================================================================
-static IFSelect_ReturnStatus XSControl_tpatr(const Handle(IFSelect_SessionPilot)& /*pilot*/)
-{
-/*skl
- Standard_Integer argc = pilot->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 : "<<name<<" Count="<<nbatr<<" Type : ";
- switch (aty) {
- case Interface_ParamInteger : sout<<"Integer"; break;
- case Interface_ParamReal : sout<<"Real"; break;
- case Interface_ParamIdent : sout<<"Object"; break;
- case Interface_ParamText : sout<<"String"; break;
- default : sout<<"(Mixed)";
- }
- sout<<endl;
- }
- }
-
- else {
-
- Standard_Integer num , nb = 0;
- sout<<"Attribute Name : "<<arg1<<endl;
- for (num = TP->NextItemWithAttribute(arg1,0); num > 0;
- num = TP->NextItemWithAttribute(arg1,num)) {
- nb ++;
- sout<<"Item "<<num<<" , Entity ";
- WS->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="<<bnd->IntegerAttribute(arg1); break;
- case Interface_ParamReal : sout<<" Real="<<bnd->RealAttribute(arg1); break;
- case Interface_ParamIdent : sout<<" Object,Type:"<<bnd->Attribute(arg1)->DynamicType()->Name(); break;
- case Interface_ParamText : sout<<" String="<<bnd->StringAttribute(arg1);
- default : sout<<"(none)"; break;
- }
- sout<<endl;
- }
- sout<<"Attribute Name : "<<arg1<<" on "<<nb<<" Items"<<endl;
- }
-skl*/
-
- return IFSelect_RetVoid;
-}
-
-
//=======================================================================
//function : trecord
//=======================================================================
{
Standard_Integer argc = pilot->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())
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"<<endl; return IFSelect_RetError; }
Handle(Interface_InterfaceModel) mdl = TR->Model();
if (mdl.IsNull()) { sout<<" No model"<<endl; return IFSelect_RetError; }
static IFSelect_ReturnStatus XSControl_trbegin(const Handle(IFSelect_SessionPilot)& pilot)
{
// **** trbegin : TransferReader ****
- Handle(XSControl_TransferReader) TR = XSControl::Session(pilot)->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"<<endl;
//const Standard_CString arg1 = pilot->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"<<endl; return IFSelect_RetError; }
- Handle(Interface_InterfaceModel) mdl = TR->Model();
+ const Handle(Interface_InterfaceModel) &mdl = TR->Model();
if (mdl.IsNull()) { sout<<" No model"<<endl; return IFSelect_RetError; }
if (argc < 2) {
// DeclareAndCast(IFSelect_Selection,sel,pilot->Session()->NamedItem("xst-model-roots"));
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"<<endl;
else if (TR->TransientProcess().IsNull()) sout<<" Transfer Reader without Process"<<endl;
- ////else { XSDRAW::SetTransferProcess(TR->TransientProcess()); return IFSelect_RetDone; }
return IFSelect_RetVoid;
}
//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();
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);
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);
#define _XSControl_Functions_HeaderFile
#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-
//! Functions from XSControl gives access to actions which can be
//! commanded with the resources provided by XSControl: especially
//! It works by adding functions by method Init
class XSControl_Functions
{
-public:
-
- DEFINE_STANDARD_ALLOC
+ public:
-
//! Defines and loads all functions for XSControl (as ActFunc)
Standard_EXPORT static void Init();
-
-
-
-
-protected:
-
-
-
-
-
-private:
-
-
-
-
-
};
-
-
-
-
-
-
#endif // _XSControl_Functions_HeaderFile
(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);
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;
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);
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);
#include <stdio.h>
IMPLEMENT_STANDARD_RTTIEXT(XSControl_TransferReader,MMgt_TShared)
-// Precision :
-// Pour les regularites
-//=======================================================================
-//function : XSControl_TransferReader
-//purpose :
-//=======================================================================
-XSControl_TransferReader::XSControl_TransferReader ()
-{
-}
-
-
//=======================================================================
//function : SetController
//purpose :
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 :
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;
}
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);
}
{
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);
}
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);
}
(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();
}
-//=======================================================================
-//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 :
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 ############
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();
res->MainResult()->SetBinder (trb);
}
- res->SetFileName(theFilename.ToCString());
- theResults.Bind(num,res);
+ res->SetFileName(myFileName.ToCString());
+ myResults.Bind(num,res);
return Standard_True;
}
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) );
}
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();
}
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;
}
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;
}
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) );
}
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;
}
(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;
}
(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;
}
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);
}
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;
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)
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;
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;
(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()) {
// 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");
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));
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;
}
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);
}
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 ******"<<endl;
if (!lab.IsNull())
sout<<"****** N0 in file : "<<Interface_MSG::Blanks(num,5)<<num
<<" Ident : "<<lab->ToCString()
<< Interface_MSG::Blanks(14 - lab->Length())<<"******\n";
- sout << "****** Type : "<<theModel->TypeName(ent,Standard_False)
- << Interface_MSG::Blanks((Standard_Integer) (44 - strlen(theModel->TypeName(ent,Standard_False))))
+ sout << "****** Type : "<<myModel->TypeName(ent,Standard_False)
+ << Interface_MSG::Blanks((Standard_Integer) (44 - strlen(myModel->TypeName(ent,Standard_False))))
<< "******";
sout<<"\n*******************************************************************\n";
}
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);
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();
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";
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);
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) {
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";
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();
}
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);
}
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) ******"<<endl;
if (what > 10) { sout<<" *** Not yet implemented"<<endl; return; }
if (what < 10) {
sout << "****** Data recorded on Last Transfer ******"<<endl;
- PrintStatsProcess (theTransfer,what,mode);
+ PrintStatsProcess (myTP,what,mode);
}
// reste what = 10 : on liste les racines des final results
sout << "****** Final Results ******"<<endl;
- if (theModel.IsNull()) { sout<<"**** Model unknown"<<endl; return; }
+ if (myModel.IsNull()) { sout<<"**** Model unknown"<<endl; return; }
Handle(TColStd_HSequenceOfTransient) list = RecordedList();
Standard_Integer i, nb = list->Length();
Handle(IFSelect_SignatureList) counter;
sout<<"**** Nb Recorded : "<<nb<<" : entities n0s : ";
for (i = 1; i <= nb; i ++) {
Handle(Standard_Transient) ent = list->Value(i);
- if (mode == 0) { sout<<" "<<theModel->Number(ent); continue; }
+ if (mode == 0) { sout<<" "<<myModel->Number(ent); continue; }
if (mode == 1 || mode == 2) {
sout<<"[ "<<Interface_MSG::Blanks (i,6)<<" ]:";
- theModel->Print (ent,sout);
- sout<<" Type:"<<theModel->TypeName(ent,Standard_False);
+ myModel->Print (ent,sout);
+ sout<<" Type:"<<myModel->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<<endl;
}
Interface_CheckIterator XSControl_TransferReader::LastCheckList () const
{
Interface_CheckIterator chl;
- if (!theTransfer.IsNull()) chl = theTransfer->CheckList (Standard_False);
+ if (!myTP.IsNull()) chl = myTP->CheckList (Standard_False);
return chl;
}
(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;
}
//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;
}
#include <TColStd_DataMapOfIntegerTransient.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#include <MMgt_TShared.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_Type.hxx>
-#include <Standard_Integer.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <Interface_CheckStatus.hxx>
class XSControl_Controller;
//! 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.
//! 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)
//! 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 <ent> 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
//! <mode> = -1 : true, complete, clearing (erasing result)
//! 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 <mode> = 0 (D), searches in last root transfers
//! <res> can be, either a transient object (result itself) or
//! a binder. For a binder of shape, calls EntityFromShapeResult
//! Returns a Null Handle if <res> 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 <res> 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 <ent>, i.e.
//! stored in its recorded form ResultFromModel
//! <level> : 0 for <ent> only (D)
//! 1 for <ent> and its immediate subtransfers, if any
//! 2 for <ent> 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 <ent> 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
//! <check> = 2 , entities with fail
//! <result> : 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
//! 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 <rec> 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 <rec> 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 <G>), 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 <ents> 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 <what> and
//! <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;
//! Returns the CheckList resulting from last TransferRead
//! i.e. from TransientProcess itself, recorded from last Clear
//! i.e. from TransientProcess itself, recorded from last Clear
//! If <roots> is True , considers only roots of transfer
//! If <roots> 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 <rec> is True , sees RecordedList
//! If <rec> 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
//! 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 <list> (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
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)
-{
- theController = ctl;
- Clear(-1);
-}
-
- void XSControl_TransferWriter::Clear (const Standard_Integer mode)
+void XSControl_TransferWriter::Clear (const Standard_Integer mode)
{
- if (mode < 0 || theTransferWrite.IsNull())
- theTransferWrite = new Transfer_FinderProcess;
- else theTransferWrite->Clear();
+ if (mode < 0 || myTransferWriter.IsNull())
+ myTransferWriter = new Transfer_FinderProcess;
+ else myTransferWriter->Clear();
}
- Standard_Integer XSControl_TransferWriter::TransferMode () const
- { return theTransferMode; }
+//=======================================================================
+//function : PrintStats
+//purpose :
+//=======================================================================
- void XSControl_TransferWriter::SetTransferMode (const Standard_Integer mod)
- { theTransferMode = mod; }
-
- void XSControl_TransferWriter::PrintStats
- (const Standard_Integer , const Standard_Integer ) const
+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) ******"<<endl;
sout<<"\n*******************************************************************\n";
- sout << "****** Transfer Mode = "<<theTransferMode;
- Standard_CString modehelp = theController->ModeWriteHelp (theTransferMode);
+ sout << "****** Transfer Mode = "<<myTransferMode;
+ Standard_CString modehelp = myController->ModeWriteHelp (myTransferMode);
if (modehelp && modehelp[0] != 0) sout<<" I.E. "<<modehelp;
sout<<" ******"<<endl;
}
// ########## LES ACTIONS ##########
- Standard_Boolean XSControl_TransferWriter::RecognizeTransient
- (const Handle(Standard_Transient)& obj)
+//=======================================================================
+//function : RecognizeTransient
+//purpose :
+//=======================================================================
+
+Standard_Boolean XSControl_TransferWriter::RecognizeTransient (const Handle(Standard_Transient)& obj)
{
- if (theController.IsNull()) return Standard_False;
+ if (myController.IsNull()) return Standard_False;
XSControl_Utils xu;
TopoDS_Shape sh = xu.BinderShape (obj);
if (!sh.IsNull()) return RecognizeShape (sh);
- return theController->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<<obj->DynamicType()->Name()<<" ******"<<endl;
- status = theController->TransferWriteTransient
- (obj,theTransferWrite,model,theTransferMode);
+ status = myController->TransferWriteTransient
+ (obj,myTransferWriter,model,myTransferMode);
}
catch(Standard_Failure) {
sout<<"**** **** TransferWriteShape, EXCEPTION : ";
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<<" ******"<<endl;
- status = theController->TransferWriteShape
- (shape,theTransferWrite,model,theTransferMode);
+ status = myController->TransferWriteShape
+ (shape,myTransferWriter,model,myTransferMode);
}
catch(Standard_Failure) {
sout<<"**** **** TransferWriteShape, EXCEPTION : ";
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;
}
return chl;
}
-
- void XSControl_TransferWriter::PrintStatsProcess
- (const Handle(Transfer_FinderProcess)& ,
- const Standard_Integer , const Standard_Integer )
-{ }
#include <Standard.hxx>
#include <Standard_Type.hxx>
-#include <Standard_Integer.hxx>
#include <MMgt_TShared.hxx>
-#include <Standard_Boolean.hxx>
#include <IFSelect_ReturnStatus.hxx>
+#include <Transfer_FinderProcess.hxx>
class XSControl_Controller;
-class Transfer_FinderProcess;
class Standard_Transient;
class Interface_InterfaceModel;
class TopoDS_Shape;
//! 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 <obj> 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
//! 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
#include <Interface_IntVal.hxx>
#include <Interface_Macros.hxx>
#include <Message_Messenger.hxx>
-#include <MoniTool_Profile.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
-#include <Standard_Transient.hxx>
-#include <Standard_Type.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_Binder.hxx>
#include <TransferBRep.hxx>
#include <XSControl_Controller.hxx>
#include <XSControl_TransferReader.hxx>
-#include <XSControl_TransferWriter.hxx>
#include <XSControl_Vars.hxx>
#include <XSControl_WorkSession.hxx>
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;
}
// 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());
}
//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 : "<<normname<<"\n"
-// <<"##########################"<<endl;
return Standard_True;
}
-//=======================================================================
-//function : SelectProfile
-//purpose :
-//=======================================================================
-
-Standard_Boolean XSControl_WorkSession::SelectProfile(const Standard_CString profile)
-{
- return theController->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;
-
- 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);
-
- AdaptNorm ();
-}
+ myController = ctl;
+ SetLibrary ( myController->WorkLibrary() );
+ SetProtocol ( myController->Protocol() );
-//=======================================================================
-//function : AdaptNorm
-//purpose :
-//=======================================================================
+ ClearItems();
+ ClearFinalModifiers();
+ ClearShareOut(Standard_False);
+ ClearFile();
-void XSControl_WorkSession::AdaptNorm ()
-{
+ // Set worksession parameters from teh controller
+ Handle(XSControl_WorkSession) aWorkSession(this);
+ myController->Customise (aWorkSession);
+
+ myTransferReader->SetController (myController);
+ myTransferWriter->SetController (myController);
}
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;
-}
// ##########################################
// ##########################################
-//=======================================================================
-//function : Context
-//purpose :
-//=======================================================================
-
-Handle(Dico_DictionaryOfTransient) XSControl_WorkSession::Context () const
-{
- return theContext;
-}
-
-
//=======================================================================
//function : SetAllContext
//purpose :
void XSControl_WorkSession::SetAllContext(const Handle(Dico_DictionaryOfTransient)& context)
{
- theContext = context;
- theTransferRead->Context() = context;
+ myContext = context;
+ myTransferReader->Context() = context;
}
void XSControl_WorkSession::ClearContext ()
{
- Handle(Dico_DictionaryOfTransient) nulctx;
- SetAllContext(nulctx);
+ myContext.Nullify();
+ myTransferReader->Context().Nullify();
}
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;
FP->StartTrace (binder,finder,0,0); // pb sout/S
if (!ent.IsNull()) {
S<<" ** Resultat Transient, type "<<ent->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<<endl;
void XSControl_WorkSession::InitTransferReader(const Standard_Integer mode)
{
- if (mode == 0 || mode == 5) theTransferRead->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();
}
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
}
-//=======================================================================
-//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
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);
//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);
}
//purpose :
//=======================================================================
-Standard_Integer XSControl_WorkSession::TransferReadRoots ()
+Standard_Integer XSControl_WorkSession::TransferReadRoots ()
{
- return theTransferRead->TransferRoots(Graph());
+ return myTransferReader->TransferRoots(Graph());
}
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
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());
}
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;
}
}
-
-
-//=======================================================================
-//function : Destroy
-//purpose :
-//=======================================================================
-
-void XSControl_WorkSession::Destroy()
-{
- ClearBinders();
-}
-
-
#include <Standard.hxx>
#include <Standard_Type.hxx>
-#include <Standard_Integer.hxx>
#include <IFSelect_WorkSession.hxx>
-#include <Standard_Boolean.hxx>
-#include <Standard_CString.hxx>
#include <IFSelect_ReturnStatus.hxx>
+#include <XSControl_TransferWriter.hxx>
class XSControl_Controller;
class XSControl_TransferReader;
-class XSControl_TransferWriter;
class Dico_DictionaryOfTransient;
class XSControl_Vars;
class Message_Messenger;
//! 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 <normname> 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 <profile> 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 <rsc> 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();
//! the Mapped n0 <num>, from MapWriter if <wri> is True, or
//! from MapReader if <wri> 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)
//! 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 <mode> = 0, returns Final Result
//! <mode> = 10,11,12 idem but returns the Binder itself
//! (if it is not, e.g. Shape, returns the Binder)
//! <mode> = 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 <ents>
//! - <ents> a HSequenceOfTransient : this list
//! - <ents> 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
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 <FP> 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
//! with original objects (in fact, their mappers)
Standard_EXPORT Interface_CheckIterator TransferWriteCheckList() const;
- Standard_EXPORT Handle(XSControl_Vars) Vars() const;
-
- Standard_EXPORT void SetVars (const Handle(XSControl_Vars)& newvars);
+ const Handle(XSControl_Vars) & Vars() const
+ { return myVars; }
- //! Clears binders
- Standard_EXPORT void ClearBinders();
+ void SetVars (const Handle(XSControl_Vars)& theVars)
+ { myVars = theVars; }
- 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;
-
+ private:
+
+ //! Clears binders
+ Standard_EXPORT void ClearBinders();
+ Handle(XSControl_Controller) myController;
+ Handle(XSControl_TransferReader) myTransferReader;
+ Handle(XSControl_TransferWriter) myTransferWriter;
+ Handle(Dico_DictionaryOfTransient) myContext;
+ Handle(XSControl_Vars) myVars;
};
-
-
-
-
-
-
#endif // _XSControl_WorkSession_HeaderFile
IFSelect_ReturnStatus XSControl_Writer::TransferShape
(const TopoDS_Shape& sh, const Standard_Integer mode)
{
- thesession->SetModeWriteShape (mode);
+ thesession->TransferWriter()->SetTransferMode (mode);
return thesession->TransferWriteShape (sh);
}
{ 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 ()
#define _XSDRAW_HeaderFile
#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
-#include <Standard_CString.hxx>
-#include <Standard_Boolean.hxx>
#include <Draw_Interpretor.hxx>
-#include <Standard_Integer.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TopTools_HSequenceOfShape.hxx>
class IFSelect_SessionPilot;
//! 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
//! Sets a norm by its name (controller recorded as <normname> )
//! Returns True if done, False if this norm is unknown
- //! If <profile> is given, also sets the norm to <profile>
- //! (if <profile> is undefined for <normname>, 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();
//! 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
#define _XSDRAW_Functions_HeaderFile
#include <Standard.hxx>
-#include <Standard_DefineAlloc.hxx>
-#include <Standard_Handle.hxx>
-
-
//! Defines additionnal commands for XSDRAW to :
//! - control of initialisation (xinit, xnorm, newmodel)
//! 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
#include <Transfer_TransientProcess.hxx>
#include <XSControl.hxx>
#include <XSControl_WorkSession.hxx>
+#include <XSControl_TransferReader.hxx>
#include <XSDRAW.hxx>
#include <XSDRAW_Commands.hxx>
#include <XSDRAWIGES.hxx>
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
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();
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()) {
nbt++;
}
}
- thesession->MapReader()->SetProgress ( 0 );
+ thesession->TransferReader()->TransientProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
// Standard_Integer narg = pilot->NbWords();
Standard_Integer narg = n;
- Handle(Transfer_TransientProcess) TP = XSControl::Session(pilot)->MapReader();
+ const Handle(Transfer_TransientProcess) &TP = XSControl::Session(pilot)->TransferReader()->TransientProcess();
TColStd_Array1OfAsciiString strarg(1, 3);
TColStd_Array1OfAsciiString typarg(1, 3);
strarg.SetValue(1,"xst-type(CurveOnSurface)");
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 = '!';
#include <Transfer_TransientProcess.hxx>
#include <TransferBRep_ShapeMapper.hxx>
#include <XSControl_Controller.hxx>
+#include <XSControl_TransferReader.hxx>
#include <XSControl_TransferWriter.hxx>
#include <XSControl_WorkSession.hxx>
#include <XSDRAW.hxx>
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 "<<num<<" : no result\n";
else {
DBRep::Set (shname,sh);
}
- sr.WS()->MapReader()->SetProgress ( 0 );
+ sr.WS()->TransferReader()->TransientProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
}
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()) {
DBRep::Set (shname,sh);
}
}
- sr.WS()->MapReader()->SetProgress ( 0 );
+ sr.WS()->TransferReader()->TransientProcess()->SetProgress ( 0 );
progress->EndScope();
progress->Show();
}