1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0022807: Loading of STEP entities in model during reading of STEP file requires redundant memory

This commit is contained in:
GKA
2011-12-16 08:41:10 +00:00
committed by bugmaster
parent 251450e53f
commit bc650d4170
25 changed files with 745 additions and 942 deletions

View File

@@ -40,19 +40,6 @@
#include <ShapeFix.hxx>
#include <stdio.h>
/*
#ifdef DEB
static void monDBPE
(const Handle(Message_Messenger)& S, const Handle(Standard_Transient)& ent, const Handle(Standard_Transient)& context)
{
if (ent.IsNull()) { S<<"(null)"; return; }
DeclareAndCast(Interface_InterfaceModel,model,context);
if (model.IsNull()) { S<<ent->DynamicType()->Name(); return; }
model->Print (ent,S);
S<<" "<<model->TypeName(ent,Standard_False);
}
#endif
*/
//=======================================================================
//function : XSControl_TransferReader
@@ -121,9 +108,15 @@ void XSControl_TransferReader::SetModel(const Handle(Interface_InterfaceModel)&
void XSControl_TransferReader::SetGraph(const Handle(Interface_HGraph)& graph)
{
if (graph.IsNull()) return;
if (graph.IsNull())
{
theModel.Nullify();
}
else
theModel = graph->Graph().Model();
theGraph = graph;
theModel = graph->Graph().Model();
if (!theTransfer.IsNull()) theTransfer->SetGraph(graph);
}
@@ -221,7 +214,7 @@ void XSControl_TransferReader::Clear (const Standard_Integer mode)
theTransfer.Nullify();
theActor.Nullify();
theFilename.Clear();
} // theContext.Nullify();
}
}
@@ -868,9 +861,7 @@ Standard_Integer XSControl_TransferReader::TransferOne
Handle(Message_Messenger) sout = theTransfer->Messenger();
Standard_Integer level = theTransfer->TraceLevel();
//BRepBuilderAPI::Precision (Interface_Static::RVal("read.precision.val")); //szv#11:CASCADE30:01Feb00
//Interface_Static::SetRVal("lastpreci",0.0);
Transfer_TransferOutput TP (theTransfer,theModel);
if (theGraph.IsNull()) theTransfer->SetModel(theModel);
@@ -925,8 +916,6 @@ Standard_Integer XSControl_TransferReader::TransferList
Handle(Message_Messenger) sout = theTransfer->Messenger();
Standard_Integer level = theTransfer->TraceLevel();
//BRepBuilderAPI::Precision (Interface_Static::RVal("read.precision.val")); //szv#11:CASCADE30:01Feb00
//Interface_Static::SetRVal("lastpreci",0.0);
Transfer_TransferOutput TP (theTransfer,theModel);
if (theGraph.IsNull()) theTransfer->SetModel(theModel);
else theTransfer->SetGraph(theGraph);
@@ -984,8 +973,6 @@ Standard_Integer XSControl_TransferReader::TransferRoots(const Interface_Graph&
Handle(Message_Messenger) sout = theTransfer->Messenger();
Standard_Integer level = theTransfer->TraceLevel();
//BRepBuilderAPI::Precision (Interface_Static::RVal("read.precision.val")); //szv#11:CASCADE30:01Feb00
//Interface_Static::SetRVal("lastpreci",0.0);
Transfer_TransferOutput TP (theTransfer,theModel);
if (theGraph.IsNull()) theTransfer->SetModel(theModel);
else theTransfer->SetGraph(theGraph);
@@ -1035,15 +1022,9 @@ void XSControl_TransferReader::TransferClear(const Handle(Standard_Transient)& e
if (theTransfer.IsNull()) return;
if (ent == theModel) { theTransfer->Clear(); return; }
//// if (level > 0) list = TransferredList (list);
// Standard_Integer i, nb = list->Length();
// theTransfer->ComputeScopes();
// for (i = 1; i <= nb; i ++) {
// Handle(Standard_Transient) ent = list->Value(i);
// theTransfer->Unbind (ent);
theTransfer->RemoveResult (ent,level);
ClearResult (ent,-1);
// }
}

View File

@@ -282,32 +282,7 @@ Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Inte
binder = TP->MapItem (ne);
S<<endl;
TP->StartTrace (binder,ent,0,0);
/*skl
if (!binder.IsNull()) {
// infos complementaires : cas et attributs
Standard_Integer icas, nbcas = binder->NbCases();
if (nbcas > 0) S<<"Recorded Cases : "<<nbcas<<" :";
for (icas = 1; icas <= nbcas; icas ++) S<<" "<<binder->CaseName(icas);
if (nbcas > 0) S<<endl;
Standard_Integer nbatr = 0;
Handle(Dico_DictionaryOfTransient) atrs = binder->AttrList();
Dico_IteratorOfDictionaryOfTransient iatr (atrs);
for (; iatr.More(); iatr.Next()) {
Handle(Standard_Transient) atr = iatr.Value();
if (atr.IsNull()) continue;
if (nbatr == 0) S<<"-- List of Attributes"<<endl;
nbatr ++;
S<<iatr.Name()<<" : ";
DeclareAndCast(Interface_IntVal,intatr,atr);
if (!intatr.IsNull()) S<<"Integer="<<intatr->Value();
DeclareAndCast(Geom2d_Point,realtr,atr);
if (!realtr.IsNull()) S<<"Real="<<realtr->X();
if (intatr.IsNull() && realtr.IsNull()) S<<"Type:"<<atr->DynamicType()->Name();
S<<endl;
}
if (nbatr > 0) S<<"-- Total of Attributes : "<<nbatr<<endl;
}
skl*/
}
// *** CHECK (commun READ+WRITE) ***
@@ -471,8 +446,6 @@ Handle(Standard_Transient) XSControl_WorkSession::Result
Standard_Integer XSControl_WorkSession::TransferReadOne
(const Handle(Standard_Transient)& ent)
{
//Standard_OStream& sout = Interface_TraceFile::Def();
//Standard_Integer level = Interface_TraceFile::DefLevel();
Handle(Interface_InterfaceModel) model = Model();
if (ent == model) return TransferReadRoots();
@@ -507,8 +480,14 @@ Handle(Interface_InterfaceModel) XSControl_WorkSession::NewModel ()
Handle(Interface_InterfaceModel) newmod;
if (theController.IsNull()) return newmod;
newmod = theController->NewModel();
SetModel(newmod);
if(!MapReader().IsNull())
MapReader()->Clear();
//clear all contains of WS
theTransferRead->Clear(3);
theTransferWrite->Clear(-1);
return newmod;
}