Add some wxLogTrace to the oce loader

This commit is contained in:
Marek Roszko 2021-10-07 22:48:19 -04:00
parent 4377f8019d
commit 8c8d66a181
1 changed files with 22 additions and 0 deletions

View File

@ -30,6 +30,7 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include <wx/filename.h> #include <wx/filename.h>
#include <wx/log.h>
#include <wx/stdpaths.h> #include <wx/stdpaths.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/utils.h> #include <wx/utils.h>
@ -424,6 +425,8 @@ bool readIGES( Handle( TDocStd_Document ) & m_doc, const char* fname )
bool readSTEP( Handle(TDocStd_Document)& m_doc, const char* fname ) bool readSTEP( Handle(TDocStd_Document)& m_doc, const char* fname )
{ {
wxLogTrace( MASK_OCE, "Reading step file %s", fname );
STEPCAFControl_Reader reader; STEPCAFControl_Reader reader;
IFSelect_ReturnStatus stat = reader.ReadFile( fname ); IFSelect_ReturnStatus stat = reader.ReadFile( fname );
@ -624,6 +627,7 @@ bool processShell( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
TopoDS_Iterator it; TopoDS_Iterator it;
bool ret = false; bool ret = false;
wxLogTrace( MASK_OCE, "Processing shell" );
for( it.Initialize( shape, false, false ); it.More(); it.Next() ) for( it.Initialize( shape, false, false ); it.More(); it.Next() )
{ {
const TopoDS_Face& face = TopoDS::Face( it.Value() ); const TopoDS_Face& face = TopoDS::Face( it.Value() );
@ -645,6 +649,8 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
Quantity_Color col; Quantity_Color col;
Quantity_Color* lcolor = nullptr; Quantity_Color* lcolor = nullptr;
wxLogTrace( MASK_OCE, "Processing solid" );
// Search the whole model first to make sure something exists (may or may not have color) // Search the whole model first to make sure something exists (may or may not have color)
if( !data.m_assy->Search( shape, label ) ) if( !data.m_assy->Search( shape, label ) )
{ {
@ -710,14 +716,20 @@ bool processSolid( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
if( !loc.IsIdentity() ) if( !loc.IsIdentity() )
{ {
wxLogTrace( MASK_OCE, "Solid has location" );
gp_Trsf T = loc.Transformation(); gp_Trsf T = loc.Transformation();
gp_XYZ coord = T.TranslationPart(); gp_XYZ coord = T.TranslationPart();
childNode.SetTranslation( SGPOINT( coord.X(), coord.Y(), coord.Z() ) ); childNode.SetTranslation( SGPOINT( coord.X(), coord.Y(), coord.Z() ) );
wxLogTrace( MASK_OCE, "Translation %f, %f, %f", coord.X(), coord.Y(), coord.Z() );
gp_XYZ axis; gp_XYZ axis;
Standard_Real angle; Standard_Real angle;
if( T.GetRotation( axis, angle ) ) if( T.GetRotation( axis, angle ) )
{
childNode.SetRotation( SGVECTOR( axis.X(), axis.Y(), axis.Z() ), angle ); childNode.SetRotation( SGVECTOR( axis.X(), axis.Y(), axis.Z() ), angle );
wxLogTrace( MASK_OCE, "Rotation %f, %f, %f, angle %f", axis.X(), axis.Y(), axis.Z(),
angle );
}
} }
std::vector< SGNODE* >* component = nullptr; std::vector< SGNODE* >* component = nullptr;
@ -762,16 +774,24 @@ bool processComp( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
const TopLoc_Location& loc = shape.Location(); const TopLoc_Location& loc = shape.Location();
bool ret = false; bool ret = false;
wxLogTrace( MASK_OCE, "Processing component" );
if( !loc.IsIdentity() ) if( !loc.IsIdentity() )
{ {
wxLogTrace( MASK_OCE, "Component has location" );
gp_Trsf T = loc.Transformation(); gp_Trsf T = loc.Transformation();
gp_XYZ coord = T.TranslationPart(); gp_XYZ coord = T.TranslationPart();
childNode.SetTranslation( SGPOINT( coord.X(), coord.Y(), coord.Z() ) ); childNode.SetTranslation( SGPOINT( coord.X(), coord.Y(), coord.Z() ) );
wxLogTrace( MASK_OCE, "Translation %f, %f, %f", coord.X(), coord.Y(), coord.Z() );
gp_XYZ axis; gp_XYZ axis;
Standard_Real angle; Standard_Real angle;
if( T.GetRotation( axis, angle ) ) if( T.GetRotation( axis, angle ) )
{
childNode.SetRotation( SGVECTOR( axis.X(), axis.Y(), axis.Z() ), angle ); childNode.SetRotation( SGVECTOR( axis.X(), axis.Y(), axis.Z() ), angle );
wxLogTrace( MASK_OCE, "Rotation %f, %f, %f, angle %f", axis.X(), axis.Y(), axis.Z(),
angle );
}
} }
for( it.Initialize( shape, false, false ); it.More(); it.Next() ) for( it.Initialize( shape, false, false ); it.More(); it.Next() )
@ -828,6 +848,8 @@ bool processNode( const TopoDS_Shape& shape, DATA& data, SGNODE* parent,
bool ret = false; bool ret = false;
data.hasSolid = false; data.hasSolid = false;
wxLogTrace( MASK_OCE, "Processing node" );
switch( stype ) switch( stype )
{ {
case TopAbs_COMPOUND: case TopAbs_COMPOUND: