SequenceOfHAsciiString from TColStd,
GraphNode from XCAFDoc,
AttributeSequence from TDF,
- DataMapOfShapeLabel from XCAFDoc
-
+ DataMapOfShapeLabel from XCAFDoc,
+ OStream from Standard
is
GetID (myclass)
---C++: return const &
BaseLabel(me) returns Label from TDF;
---Purpose: returns the label under which shapes are stored
- Dump(me; deep : Boolean from Standard = Standard_False);
+ Dump(me; theDumpLog: out OStream from Standard; deep : Boolean from Standard = Standard_False);
- DumpShape(myclass; L: Label from TDF;
+ DumpShape(myclass; theDumpLog: out OStream from Standard;
+ L: Label from TDF;
level :Integer from Standard = 0;
deep : Boolean from Standard = Standard_False);
- ---Purpose: Print in cout type of shape found on <L> label
+ ---Purpose: Print to ostream <theDumpLog> type of shape found on <L> label
-- and the entry of <L>, with <level> tabs before.
-- If <deep>, print also TShape and Location addresses
//purpose : recursive part of Dump()
//=======================================================================
-static void DumpAssembly(const TDF_Label L,
+static void DumpAssembly(Standard_OStream& theDumpLog,
+ const TDF_Label L,
const Standard_Integer level,
const Standard_Boolean deep)
{
for (Standard_Integer i=0; i<level; i++)
- cout<<"\t";
+ theDumpLog<<"\t";
TCollection_AsciiString Entry;
TDF_Tool::Entry(L, Entry);
- cout<<"ASSEMBLY "<<Entry;
+ theDumpLog<<"ASSEMBLY "<<Entry;
Handle(TDataStd_Name) Name;
if (L.FindAttribute(TDataStd_Name::GetID(), Name))
- cout<<" "<<Name->Get();
+ theDumpLog<<" "<<Name->Get();
if (deep) {
TopoDS_Shape S;
XCAFDoc_ShapeTool::GetShape(L, S);
- cout<<"("<<*(void**)&S.TShape();
+ theDumpLog<<"("<<*(void**)&S.TShape();
if (! S.Location().IsIdentity())
- cout<<", "<< *(void**)&S.Location();
- cout<<") ";
+ theDumpLog<<", "<< *(void**)&S.Location();
+ theDumpLog<<") ";
}
- cout<<endl;
+ theDumpLog<<endl;
Handle(TDataStd_TreeNode) Node;
TDF_ChildIDIterator NodeIterator(L, XCAFDoc::ShapeRefGUID());
Node = Handle(TDataStd_TreeNode)::DownCast(NodeIterator.Value());
if (Node->HasFather()) {
if (Node->Father()->Label().HasChild())
- DumpAssembly(Node->Father()->Label(), level+1, deep);
+ DumpAssembly(theDumpLog, Node->Father()->Label(), level+1, deep);
else {
- XCAFDoc_ShapeTool::DumpShape(Node->Father()->Label(), level+1, deep);
- cout<<endl;
+ XCAFDoc_ShapeTool::DumpShape(theDumpLog, Node->Father()->Label(), level+1, deep);
+ theDumpLog<<endl;
}
}
}
//purpose :
//=======================================================================
-void XCAFDoc_ShapeTool::Dump(const Standard_Boolean deep) const
+void XCAFDoc_ShapeTool::Dump(Standard_OStream& theDumpLog, const Standard_Boolean deep) const
{
Standard_Integer level = 0;
// TopTools_SequenceOfShape SeqShapes;
TDF_LabelSequence SeqLabels;
GetShapes( SeqLabels);
- if (SeqLabels.Length()>0) cout<<endl;
+ if (SeqLabels.Length()>0) theDumpLog<<endl;
Standard_Integer i;
for (i=1; i<=SeqLabels.Length(); i++) {
- DumpAssembly(SeqLabels.Value(i), level, deep);
+ DumpAssembly(theDumpLog, SeqLabels.Value(i), level, deep);
}
SeqLabels.Clear();
GetFreeShapes(SeqLabels);
- cout<<endl<<"Free Shapes: "<<SeqLabels.Length()<<endl;
+ theDumpLog<<endl<<"Free Shapes: "<<SeqLabels.Length()<<endl;
for (i = 1; i<=SeqLabels.Length(); i++) {
- DumpShape(SeqLabels.Value(i), level, deep);
- cout<<endl;
+ DumpShape(theDumpLog, SeqLabels.Value(i), level, deep);
+ theDumpLog<<endl;
}
}
//purpose :
//=======================================================================
-void XCAFDoc_ShapeTool::DumpShape(const TDF_Label& L,const Standard_Integer level,const Standard_Boolean deep)
+void XCAFDoc_ShapeTool::DumpShape(Standard_OStream& theDumpLog, const TDF_Label& L,const Standard_Integer level,const Standard_Boolean deep)
{
TopoDS_Shape S;
if(! XCAFDoc_ShapeTool::GetShape(L, S) ) return;
for (Standard_Integer i=0; i<level; i++)
- cout<<"\t";
+ theDumpLog<<"\t";
- if (S.ShapeType() == TopAbs_COMPOUND) cout<<"ASSEMBLY";
- else TopAbs::Print(S.ShapeType(), cout);
+ if (S.ShapeType() == TopAbs_COMPOUND) theDumpLog<<"ASSEMBLY";
+ else TopAbs::Print(S.ShapeType(), theDumpLog);
TCollection_AsciiString Entry;
TDF_Tool::Entry(L, Entry);
- cout<<" "<<Entry;
+ theDumpLog<<" "<<Entry;
//cout<<endl;
Handle(TDataStd_Name) Name;
if (L.FindAttribute(TDataStd_Name::GetID(),Name))
- cout<<" "<<Name->Get();
+ theDumpLog<<" "<<Name->Get();
if (deep) {
- cout<<"("<<*(void**)&S.TShape();
+ theDumpLog<<"("<<*(void**)&S.TShape();
if (! S.Location().IsIdentity())
- cout<<", "<< *(void**)&S.Location();
- cout<<") ";
+ theDumpLog<<", "<< *(void**)&S.Location();
+ theDumpLog<<") ";
}
}