Implement some diagnostics

This commit is contained in:
jriegel 2014-04-14 18:11:27 +02:00 committed by Stefan Tröger
parent 6344c42525
commit 43eab0c491
2 changed files with 8 additions and 13 deletions

View File

@ -92,10 +92,10 @@ ImportOCAFAssembly::~ImportOCAFAssembly()
void ImportOCAFAssembly::loadShapes() void ImportOCAFAssembly::loadShapes()
{ {
myRefShapes.clear(); myRefShapes.clear();
loadShapes(pDoc->Main(), TopLoc_Location(), default_name, "", false); loadShapes(pDoc->Main(), TopLoc_Location(), default_name, "", false,0);
} }
void ImportOCAFAssembly::loadShapes(const TDF_Label& label, const TopLoc_Location& loc, const std::string& defaultname, const std::string& assembly, bool isRef) void ImportOCAFAssembly::loadShapes(const TDF_Label& label, const TopLoc_Location& loc, const std::string& defaultname, const std::string& assembly, bool isRef, int dep)
{ {
int hash = 0; int hash = 0;
TopoDS_Shape aShape; TopoDS_Shape aShape;
@ -137,7 +137,7 @@ void ImportOCAFAssembly::loadShapes(const TDF_Label& label, const TopLoc_Locatio
} }
#ifdef FC_DEBUG #ifdef FC_DEBUG
Base::Console().Message("H:%d, N:%s, T:%d, A:%d, S:%d, C:%d, SS:%d, F:%d, R:%d, C:%d, SS:%d\n", Base::Console().Message("H:%-9d \tN:%-30s \tT:%d \tA:%d \tS:%d \tC:%d \tSS:%d \tF:%d \tR:%d \tC:%d \tSS:%d\t-- %d \n",
hash, hash,
part_name.c_str(), part_name.c_str(),
aShapeTool->IsTopLevel(label), aShapeTool->IsTopLevel(label),
@ -148,7 +148,8 @@ void ImportOCAFAssembly::loadShapes(const TDF_Label& label, const TopLoc_Locatio
aShapeTool->IsFree(label), aShapeTool->IsFree(label),
aShapeTool->IsReference(label), aShapeTool->IsReference(label),
aShapeTool->IsComponent(label), aShapeTool->IsComponent(label),
aShapeTool->IsSubShape(label) aShapeTool->IsSubShape(label),
dep
); );
#endif #endif
@ -159,7 +160,7 @@ void ImportOCAFAssembly::loadShapes(const TDF_Label& label, const TopLoc_Locatio
TDF_Label ref; TDF_Label ref;
if (aShapeTool->IsReference(label) && aShapeTool->GetReferredShape(label, ref)) { if (aShapeTool->IsReference(label) && aShapeTool->GetReferredShape(label, ref)) {
loadShapes(ref, part_loc, part_name, asm_name, true); loadShapes(ref, part_loc, part_name, asm_name, true,dep + 1);
} }
if (isRef || myRefShapes.find(hash) == myRefShapes.end()) { if (isRef || myRefShapes.find(hash) == myRefShapes.end()) {
@ -177,7 +178,7 @@ void ImportOCAFAssembly::loadShapes(const TDF_Label& label, const TopLoc_Locatio
} }
else { else {
for (TDF_ChildIterator it(label); it.More(); it.Next()) { for (TDF_ChildIterator it(label); it.More(); it.Next()) {
loadShapes(it.Value(), part_loc, part_name, asm_name, isRef); loadShapes(it.Value(), part_loc, part_name, asm_name, isRef, dep+1);
} }
} }
} }
@ -257,12 +258,6 @@ void ImportOCAFAssembly::createShape(const TopoDS_Shape& aShape, const TopLoc_Lo
if (found_face_color) { if (found_face_color) {
applyColors(part, faceColors); applyColors(part, faceColors);
#if 0//TODO
Gui::ViewProvider* vp = Gui::Application::Instance->getViewProvider(part);
if (vp && vp->isDerivedFrom(PartGui::ViewProviderPartExt::getClassTypeId())) {
static_cast<PartGui::ViewProviderPartExt*>(vp)->DiffuseColor.setValues(faceColors);
}
#endif
} }
} }

View File

@ -57,7 +57,7 @@ public:
void loadShapes(); void loadShapes();
private: private:
void loadShapes(const TDF_Label& label, const TopLoc_Location&, const std::string& partname, const std::string& assembly, bool isRef); void loadShapes(const TDF_Label& label, const TopLoc_Location&, const std::string& partname, const std::string& assembly, bool isRef, int dep);
void createShape(const TDF_Label& label, const TopLoc_Location&, const std::string&); void createShape(const TDF_Label& label, const TopLoc_Location&, const std::string&);
void createShape(const TopoDS_Shape& label, const TopLoc_Location&, const std::string&); void createShape(const TopoDS_Shape& label, const TopLoc_Location&, const std::string&);
virtual void applyColors(Part::Feature*, const std::vector<App::Color>&){} virtual void applyColors(Part::Feature*, const std::vector<App::Color>&){}