Remove debug macro before integration

This commit is contained in:
Anthony Geay 2023-04-17 09:30:20 +02:00
parent a8fd1e6ddd
commit a5a74af8ac
6 changed files with 0 additions and 844 deletions

View File

@ -52,13 +52,6 @@
#include <Basics_OCCTVersion.hxx> #include <Basics_OCCTVersion.hxx>
//---------------------------------------------------------
#define USE_DEBUG
//#define MB_IGNORE_QT
#define MBCLASSNAME "GEOMGUI_OCCSelector"
#include "MBDebug.h"
//---------------------------------------------------------
//================================================================ //================================================================
// Function : GEOMGUI_OCCSelector // Function : GEOMGUI_OCCSelector
// Purpose : // Purpose :
@ -66,7 +59,6 @@
GEOMGUI_OCCSelector::GEOMGUI_OCCSelector( OCCViewer_Viewer* viewer, SUIT_SelectionMgr* mgr ) GEOMGUI_OCCSelector::GEOMGUI_OCCSelector( OCCViewer_Viewer* viewer, SUIT_SelectionMgr* mgr )
: LightApp_OCCSelector( viewer, mgr ) : LightApp_OCCSelector( viewer, mgr )
{ {
DBG_FUN();
} }
//================================================================ //================================================================
@ -75,7 +67,6 @@ GEOMGUI_OCCSelector::GEOMGUI_OCCSelector( OCCViewer_Viewer* viewer, SUIT_Selecti
//================================================================ //================================================================
GEOMGUI_OCCSelector::~GEOMGUI_OCCSelector() GEOMGUI_OCCSelector::~GEOMGUI_OCCSelector()
{ {
DBG_FUN();
} }
//================================================================ //================================================================
@ -84,7 +75,6 @@ GEOMGUI_OCCSelector::~GEOMGUI_OCCSelector()
//================================================================ //================================================================
void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
{ {
DBG_FUN();
OCCViewer_Viewer* vw = viewer(); OCCViewer_Viewer* vw = viewer();
if (!vw) if (!vw)
return; return;
@ -187,7 +177,6 @@ static void getEntityOwners( const Handle(AIS_InteractiveObject)& theObj,
//================================================================ //================================================================
void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList )
{ {
DBG_FUN();
OCCViewer_Viewer* vw = viewer(); OCCViewer_Viewer* vw = viewer();
if ( !vw || !vw->isSelectionEnabled()) if ( !vw || !vw->isSelectionEnabled())
return; return;

View File

@ -74,13 +74,6 @@
// VTK Includes // VTK Includes
#include <vtkActorCollection.h> #include <vtkActorCollection.h>
//---------------------------------------------------------
#define USE_DEBUG
//#define MB_IGNORE_QT
#define MBCLASSNAME "GEOMGUI_Selection"
#include "MBDebug.h"
//---------------------------------------------------------
#define OCC_DISPLAY_MODE_TO_STRING( str, dm ) { \ #define OCC_DISPLAY_MODE_TO_STRING( str, dm ) { \
if ( dm == AIS_WireFrame ) \ if ( dm == AIS_WireFrame ) \
str = QString( "Wireframe" ); \ str = QString( "Wireframe" ); \
@ -120,18 +113,14 @@
GEOMGUI_Selection::GEOMGUI_Selection() GEOMGUI_Selection::GEOMGUI_Selection()
: LightApp_Selection() : LightApp_Selection()
{ {
DBG_FUN();
} }
GEOMGUI_Selection::~GEOMGUI_Selection() GEOMGUI_Selection::~GEOMGUI_Selection()
{ {
DBG_FUN();
} }
void GEOMGUI_Selection::init( const QString& context, LightApp_SelectionMgr* selMgr ) void GEOMGUI_Selection::init( const QString& context, LightApp_SelectionMgr* selMgr )
{ {
DBG_FUN();
ARG(context);
LightApp_Selection::init( context, selMgr ); LightApp_Selection::init( context, selMgr );
myObjects.resize( count() ); myObjects.resize( count() );
@ -155,8 +144,6 @@ void GEOMGUI_Selection::init( const QString& context, LightApp_SelectionMgr* sel
//QVariant GEOMGUI_Selection::contextParameter( const QString& p ) const //QVariant GEOMGUI_Selection::contextParameter( const QString& p ) const
QVariant GEOMGUI_Selection::parameter( const QString& p ) const QVariant GEOMGUI_Selection::parameter( const QString& p ) const
{ {
DBG_FUN();
ARG(p);
QVariant v; QVariant v;
if ( p == "isOCC" ) if ( p == "isOCC" )
v = activeViewType() == OCCViewer_Viewer::Type(); v = activeViewType() == OCCViewer_Viewer::Type();
@ -176,9 +163,6 @@ QVariant GEOMGUI_Selection::parameter( const QString& p ) const
//QVariant GEOMGUI_Selection::objectParameter( const int idx, const QString& p ) const //QVariant GEOMGUI_Selection::objectParameter( const int idx, const QString& p ) const
QVariant GEOMGUI_Selection::parameter( const int idx, const QString& p ) const QVariant GEOMGUI_Selection::parameter( const int idx, const QString& p ) const
{ {
DBG_FUN();
ARG(idx);
ARG(p);
QVariant v; QVariant v;
if ( p == "type" ) if ( p == "type" )
v = typeName( idx ); v = typeName( idx );
@ -233,7 +217,6 @@ QVariant GEOMGUI_Selection::parameter( const int idx, const QString& p ) const
// the method to skip temporary objects from selection (called from LightApp) // the method to skip temporary objects from selection (called from LightApp)
bool GEOMGUI_Selection::processOwner( const LightApp_DataOwner* theOwner ) bool GEOMGUI_Selection::processOwner( const LightApp_DataOwner* theOwner )
{ {
DBG_FUN();
if ( theOwner->entry().contains( GEOMGUI_AnnotationMgr::GetEntrySeparator() ) ) { if ( theOwner->entry().contains( GEOMGUI_AnnotationMgr::GetEntrySeparator() ) ) {
myAnnotationEntries.append( theOwner->entry() ); myAnnotationEntries.append( theOwner->entry() );
} }

View File

@ -157,14 +157,6 @@
#include <Image_SupportedFormats.hxx> #include <Image_SupportedFormats.hxx>
#endif #endif
//---------------------------------------------------------
#define USE_DEBUG
//#define MB_IGNORE_QT
#define MBCLASSNAME "GEOM_Displayer"
#include "MBDebug.h"
#include "MBOCC.h"
//---------------------------------------------------------
// If the next macro is defined, autocolor feature works for all sub-shapes; // If the next macro is defined, autocolor feature works for all sub-shapes;
// if it is undefined, autocolor feature works for groups only // if it is undefined, autocolor feature works for groups only
#define GENERAL_AUTOCOLOR #define GENERAL_AUTOCOLOR
@ -395,8 +387,6 @@ bool GEOM_Displayer::isCompoundOfVertices( const TopoDS_Shape& theShape )
//================================================================ //================================================================
SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode ) SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode )
{ {
DBG_FUN();
ARG(theMode);
SUIT_SelectionFilter* aFilter; SUIT_SelectionFilter* aFilter;
int aTopAbsMode = getTopAbsMode( theMode ); int aTopAbsMode = getTopAbsMode( theMode );
@ -433,7 +423,6 @@ SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode )
//================================================================ //================================================================
SUIT_SelectionFilter* GEOM_Displayer::getComplexFilter( const QList<int>* aSubShapes) SUIT_SelectionFilter* GEOM_Displayer::getComplexFilter( const QList<int>* aSubShapes)
{ {
DBG_FUN();
GEOM_CompoundFilter* aFilter = 0; GEOM_CompoundFilter* aFilter = 0;
if(aSubShapes != NULL ) { if(aSubShapes != NULL ) {
@ -511,7 +500,6 @@ static std::string getName( GEOM::GEOM_BaseObject_ptr object )
GEOM_Displayer::GEOM_Displayer() GEOM_Displayer::GEOM_Displayer()
: myUpdateColorScale(true), myIsRedisplayed( false ) : myUpdateColorScale(true), myIsRedisplayed( false )
{ {
DBG_FUN();
SUIT_Session* session = SUIT_Session::session(); SUIT_Session* session = SUIT_Session::session();
myApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() ); myApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
@ -569,7 +557,6 @@ GEOM_Displayer::GEOM_Displayer()
//================================================================= //=================================================================
GEOM_Displayer::~GEOM_Displayer() GEOM_Displayer::~GEOM_Displayer()
{ {
DBG_FUN();
} }
//================================================================= //=================================================================
@ -582,7 +569,6 @@ void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO,
const bool updateViewer, const bool updateViewer,
SALOME_View* theViewFrame ) SALOME_View* theViewFrame )
{ {
DBG_FUN();
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
if ( vf ) if ( vf )
{ {
@ -611,7 +597,6 @@ void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO,
//================================================================= //=================================================================
void GEOM_Displayer::Display( GEOM::GEOM_BaseObject_ptr theObj, const bool updateViewer ) void GEOM_Displayer::Display( GEOM::GEOM_BaseObject_ptr theObj, const bool updateViewer )
{ {
DBG_FUN();
if ( theObj->_is_nil() ) if ( theObj->_is_nil() )
return; return;
@ -633,7 +618,6 @@ void GEOM_Displayer::Erase( const Handle(SALOME_InteractiveObject)& theIO,
const bool updateViewer, const bool updateViewer,
SALOME_View* theViewFrame ) SALOME_View* theViewFrame )
{ {
DBG_FUN();
if ( theIO.IsNull() ) if ( theIO.IsNull() )
return; return;
@ -663,7 +647,6 @@ void GEOM_Displayer::Erase( GEOM::GEOM_BaseObject_ptr theObj,
const bool updateViewer, const bool updateViewer,
SALOME_View* theViewFrame) SALOME_View* theViewFrame)
{ {
DBG_FUN();
std::string entry = getEntry( theObj ); std::string entry = getEntry( theObj );
if ( entry != "" ) if ( entry != "" )
{ {
@ -683,7 +666,6 @@ void GEOM_Displayer::Redisplay( const Handle(SALOME_InteractiveObject)& theIO,
const bool updateViewer, const bool updateViewer,
const bool checkActiveViewer ) const bool checkActiveViewer )
{ {
DBG_FUN();
bool aRedisplayed = myIsRedisplayed; bool aRedisplayed = myIsRedisplayed;
myIsRedisplayed = true; myIsRedisplayed = true;
// Remove the object permanently (<forced> == true) // Remove the object permanently (<forced> == true)
@ -729,7 +711,6 @@ void GEOM_Displayer::Redisplay( const Handle(SALOME_InteractiveObject)& theIO,
const bool theUpdateViewer, const bool theUpdateViewer,
SALOME_View* theViewFrame ) SALOME_View* theViewFrame )
{ {
DBG_FUN();
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
if ( !vf ) if ( !vf )
{ {
@ -763,7 +744,6 @@ void GEOM_Displayer::Redisplay( const Handle(SALOME_InteractiveObject)& theIO,
//================================================================= //=================================================================
void GEOM_Displayer::Display( const SALOME_ListIO& theIOList, const bool updateViewer ) void GEOM_Displayer::Display( const SALOME_ListIO& theIOList, const bool updateViewer )
{ {
DBG_FUN();
SALOME_ListIteratorOfListIO Iter( theIOList ); SALOME_ListIteratorOfListIO Iter( theIOList );
for ( ; Iter.More(); Iter.Next() ) { for ( ; Iter.More(); Iter.Next() ) {
Display( Iter.Value(), false ); Display( Iter.Value(), false );
@ -774,8 +754,6 @@ void GEOM_Displayer::Display( const SALOME_ListIO& theIOList, const bool updateV
void GEOM_Displayer::UpdateVisibility( SALOME_View* v, const SALOME_Prs* p, bool on ) void GEOM_Displayer::UpdateVisibility( SALOME_View* v, const SALOME_Prs* p, bool on )
{ {
DBG_FUN();
ARG(on);
SalomeApp_Study* aStudy = getStudy(); SalomeApp_Study* aStudy = getStudy();
int vId = -1; int vId = -1;
if ( v ) vId = getViewManagerId( v ); if ( v ) vId = getViewManagerId( v );
@ -811,7 +789,6 @@ QColor GEOM_Displayer::colorFromResources( const QString& property, const QColor
void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShape, bool create ) void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShape, bool create )
{ {
DBG_FUN();
// check that shape is not null // check that shape is not null
if ( AISShape.IsNull() ) return; if ( AISShape.IsNull() ) return;
@ -1092,7 +1069,6 @@ void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShap
void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create ) void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create )
{ {
DBG_FUN();
// check that actor is not null // check that actor is not null
if ( !actor ) return; if ( !actor ) return;
@ -1273,7 +1249,6 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
SALOME_OCCPrs* thePrs, SALOME_OCCPrs* thePrs,
const gp_Ax3& theShapeLCS ) const gp_Ax3& theShapeLCS )
{ {
DBG_FUN();
SalomeApp_Study* aStudy = getStudy(); SalomeApp_Study* aStudy = getStudy();
if ( !aStudy ) if ( !aStudy )
{ {
@ -1453,7 +1428,6 @@ void GEOM_Displayer::Erase( const SALOME_ListIO& theIOList,
const bool forced, const bool forced,
const bool updateViewer ) const bool updateViewer )
{ {
DBG_FUN();
SALOME_ListIteratorOfListIO Iter( theIOList ); SALOME_ListIteratorOfListIO Iter( theIOList );
for ( ; Iter.More(); Iter.Next() ) for ( ; Iter.More(); Iter.Next() )
Erase( Iter.Value(), forced, false ); Erase( Iter.Value(), forced, false );
@ -1472,7 +1446,6 @@ void GEOM_Displayer::Redisplay( const SALOME_ListIO& theIOList,
const bool updateViewer, const bool updateViewer,
const bool checkActiveViewer ) const bool checkActiveViewer )
{ {
DBG_FUN();
SALOME_ListIteratorOfListIO Iter( theIOList ); SALOME_ListIteratorOfListIO Iter( theIOList );
for ( ; Iter.More(); Iter.Next() ) for ( ; Iter.More(); Iter.Next() )
Redisplay( Iter.Value(), false, checkActiveViewer ); Redisplay( Iter.Value(), false, checkActiveViewer );
@ -1491,7 +1464,6 @@ void GEOM_Displayer::Redisplay( const SALOME_ListIO& theIOList,
const bool theUpdateViewer, const bool theUpdateViewer,
SALOME_View* theViewFrame ) SALOME_View* theViewFrame )
{ {
DBG_FUN();
SALOME_ListIteratorOfListIO anIter( theIOList ); SALOME_ListIteratorOfListIO anIter( theIOList );
for ( ; anIter.More(); anIter.Next() ) for ( ; anIter.More(); anIter.Next() )
{ {
@ -1513,7 +1485,6 @@ void GEOM_Displayer::Redisplay( const SALOME_ListIO& theIOList,
//================================================================= //=================================================================
void GEOM_Displayer::Update( SALOME_OCCPrs* prs ) void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
{ {
DBG_FUN();
SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( prs ); SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( prs );
SalomeApp_Study* study = getStudy(); SalomeApp_Study* study = getStudy();
@ -1649,7 +1620,6 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
//================================================================= //=================================================================
void GEOM_Displayer::Update( SALOME_VTKPrs* prs ) void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
{ {
DBG_FUN();
SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs ); SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
SalomeApp_Study* study = getStudy(); SalomeApp_Study* study = getStudy();
@ -1754,7 +1724,6 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
//================================================================= //=================================================================
void GEOM_Displayer::Update( SALOME_PV3DPrs* prs ) void GEOM_Displayer::Update( SALOME_PV3DPrs* prs )
{ {
DBG_FUN();
SPV3D_Prs* pv3dPrs = dynamic_cast<SPV3D_Prs*>( prs ); SPV3D_Prs* pv3dPrs = dynamic_cast<SPV3D_Prs*>( prs );
SalomeApp_Study* study = getStudy(); SalomeApp_Study* study = getStudy();
@ -1792,7 +1761,6 @@ void GEOM_Displayer::Update( SALOME_PV3DPrs* prs )
//================================================================= //=================================================================
SALOME_Prs* GEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj ) SALOME_Prs* GEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj )
{ {
DBG_FUN();
if ( theObj->_is_nil() ) if ( theObj->_is_nil() )
return 0; return 0;
@ -1822,7 +1790,6 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj )
//================================================================= //=================================================================
SALOME_Prs* GEOM_Displayer::BuildPrs( const TopoDS_Shape& theShape ) SALOME_Prs* GEOM_Displayer::BuildPrs( const TopoDS_Shape& theShape )
{ {
DBG_FUN();
myViewFrame = GetActiveView(); myViewFrame = GetActiveView();
if ( theShape.IsNull() || myViewFrame == 0 ) if ( theShape.IsNull() || myViewFrame == 0 )
return 0; return 0;
@ -1851,8 +1818,6 @@ SALOME_Prs* GEOM_Displayer::BuildPrs( const TopoDS_Shape& theShape )
SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry, SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry,
SALOME_View* theViewFrame ) SALOME_View* theViewFrame )
{ {
DBG_FUN();
ARG(entry);
SALOME_Prs* prs = 0; SALOME_Prs* prs = 0;
internalReset(); internalReset();
@ -1933,9 +1898,6 @@ SALOME_Prs* GEOM_Displayer::buildSubshapePresentation(const TopoDS_Shape& aShape
const QString& entry, const QString& entry,
SALOME_View* theViewFrame) SALOME_View* theViewFrame)
{ {
DBG_FUN();
ARG(aShape);
ARG(entry);
SALOME_Prs* prs = 0; SALOME_Prs* prs = 0;
internalReset(); internalReset();
@ -1971,7 +1933,6 @@ SALOME_Prs* GEOM_Displayer::buildSubshapePresentation(const TopoDS_Shape& aShape
//================================================================= //=================================================================
void GEOM_Displayer::internalReset() void GEOM_Displayer::internalReset()
{ {
DBG_FUN();
myIO.Nullify(); myIO.Nullify();
myShape.Nullify(); myShape.Nullify();
@ -1992,7 +1953,6 @@ void GEOM_Displayer::internalReset()
//================================================================= //=================================================================
void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& theIO, const std::list<int> modes ) void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& theIO, const std::list<int> modes )
{ {
DBG_FUN();
SUIT_Session* session = SUIT_Session::session(); SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() ); SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( !app ) if ( !app )
@ -2022,7 +1982,6 @@ void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& the
//================================================================= //=================================================================
void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& theIO, const int theMode ) void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& theIO, const int theMode )
{ {
DBG_FUN();
std::list<int> modes; std::list<int> modes;
modes.push_back( theMode ); modes.push_back( theMode );
LocalSelection( theIO, modes ); LocalSelection( theIO, modes );
@ -2037,9 +1996,6 @@ void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& the
//================================================================= //=================================================================
void GEOM_Displayer::GlobalSelection( const int theMode, const bool update ) void GEOM_Displayer::GlobalSelection( const int theMode, const bool update )
{ {
DBG_FUN();
ARG(theMode);
ARG(update);
TColStd_MapOfInteger aModes; TColStd_MapOfInteger aModes;
aModes.Add( theMode ); aModes.Add( theMode );
GlobalSelection( aModes, update ); GlobalSelection( aModes, update );
@ -2055,7 +2011,6 @@ void GEOM_Displayer::GlobalSelection( const int theMode, const bool update )
void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes, void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
const bool update, const QList<int>* theSubShapes ) const bool update, const QList<int>* theSubShapes )
{ {
DBG_FUN();
SUIT_Session* session = SUIT_Session::session(); SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() ); SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( !app ) if ( !app )
@ -2147,7 +2102,6 @@ void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
//================================================================= //=================================================================
void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const std::list<int> modes ) void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const std::list<int> modes )
{ {
DBG_FUN();
SALOME_ListIteratorOfListIO Iter( theIOList ); SALOME_ListIteratorOfListIO Iter( theIOList );
for ( ; Iter.More(); Iter.Next() ) for ( ; Iter.More(); Iter.Next() )
LocalSelection( Iter.Value(), modes ); LocalSelection( Iter.Value(), modes );
@ -2162,8 +2116,6 @@ void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const std::
//================================================================= //=================================================================
void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const int theMode ) void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const int theMode )
{ {
DBG_FUN();
ARG(theMode);
std::list<int> modes; std::list<int> modes;
modes.push_back( theMode ); modes.push_back( theMode );
LocalSelection( theIOList, modes ); LocalSelection( theIOList, modes );
@ -2178,7 +2130,6 @@ void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const int t
//================================================================= //=================================================================
void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCPrs* ) void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCPrs* )
{ {
DBG_FUN();
SOCC_Viewer* vf = dynamic_cast<SOCC_Viewer*>( v ); SOCC_Viewer* vf = dynamic_cast<SOCC_Viewer*>( v );
if ( vf ) if ( vf )
{ {
@ -2193,7 +2144,6 @@ void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCPrs* )
void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p ) void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p )
{ {
DBG_FUN();
UpdateColorScale(); UpdateColorScale();
// visualize annotations for displayed presentation // visualize annotations for displayed presentation
@ -2211,14 +2161,12 @@ void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p )
void GEOM_Displayer::BeforeErase( SALOME_View* v, const SALOME_OCCPrs* p ) void GEOM_Displayer::BeforeErase( SALOME_View* v, const SALOME_OCCPrs* p )
{ {
DBG_FUN();
LightApp_Displayer::BeforeErase( v, p ); LightApp_Displayer::BeforeErase( v, p );
releaseTextures( p ); releaseTextures( p );
} }
void GEOM_Displayer::AfterErase( SALOME_View* v, const SALOME_OCCPrs* p ) void GEOM_Displayer::AfterErase( SALOME_View* v, const SALOME_OCCPrs* p )
{ {
DBG_FUN();
LightApp_Displayer::AfterErase( v, p ); LightApp_Displayer::AfterErase( v, p );
UpdateColorScale(); UpdateColorScale();
@ -2241,8 +2189,6 @@ void GEOM_Displayer::AfterErase( SALOME_View* v, const SALOME_OCCPrs* p )
//================================================================= //=================================================================
void GEOM_Displayer::SetColor( const int color ) void GEOM_Displayer::SetColor( const int color )
{ {
DBG_FUN();
ARG2(color,unsigned long);
if ( color == -1 ) if ( color == -1 )
UnsetColor(); UnsetColor();
else else
@ -2279,7 +2225,6 @@ void GEOM_Displayer::UnsetColor()
//================================================================= //=================================================================
double GEOM_Displayer::SetTransparency( const double transparency ) double GEOM_Displayer::SetTransparency( const double transparency )
{ {
DBG_FUN();
double prevTransparency = myTransparency; double prevTransparency = myTransparency;
myTransparency = transparency; myTransparency = transparency;
return prevTransparency; return prevTransparency;
@ -2446,7 +2391,6 @@ bool GEOM_Displayer::ToActivate() const
//================================================================= //=================================================================
void GEOM_Displayer::clearTemporary( LightApp_SelectionMgr* theSelMgr ) void GEOM_Displayer::clearTemporary( LightApp_SelectionMgr* theSelMgr )
{ {
DBG_FUN();
SALOME_ListIO selected, toSelect; SALOME_ListIO selected, toSelect;
theSelMgr->selectedObjects( selected ); theSelMgr->selectedObjects( selected );
@ -2461,14 +2405,11 @@ void GEOM_Displayer::clearTemporary( LightApp_SelectionMgr* theSelMgr )
void GEOM_Displayer::SetName( const char* theName ) void GEOM_Displayer::SetName( const char* theName )
{ {
DBG_FUN();
ARG(theName);
myName = theName; myName = theName;
} }
void GEOM_Displayer::UnsetName() void GEOM_Displayer::UnsetName()
{ {
DBG_FUN();
myName = ""; myName = "";
} }
@ -2484,8 +2425,6 @@ void GEOM_Displayer::setIO( const Handle(SALOME_InteractiveObject)& theIO )
void GEOM_Displayer::setShape( const TopoDS_Shape& theShape ) void GEOM_Displayer::setShape( const TopoDS_Shape& theShape )
{ {
DBG_FUN();
ARG(theShape);
myShape = theShape; myShape = theShape;
} }
@ -2496,7 +2435,6 @@ void GEOM_Displayer::setFieldStepInfo( const GEOM::field_data_type theFieldDataT
const double theFieldStepRangeMin, const double theFieldStepRangeMin,
const double theFieldStepRangeMax ) const double theFieldStepRangeMax )
{ {
DBG_FUN();
myFieldDataType = theFieldDataType; myFieldDataType = theFieldDataType;
myFieldDimension = theFieldDimension; myFieldDimension = theFieldDimension;
myFieldStepData = theFieldStepData; myFieldStepData = theFieldStepData;
@ -2507,7 +2445,6 @@ void GEOM_Displayer::setFieldStepInfo( const GEOM::field_data_type theFieldDataT
bool GEOM_Displayer::canBeDisplayed( const QString& entry, const QString& viewer_type ) const bool GEOM_Displayer::canBeDisplayed( const QString& entry, const QString& viewer_type ) const
{ {
MSGEL(".....GEOM_Displayer: [" << entry.toStdString() << "] can be displayed in \"" << viewer_type.toStdString() << "\"?");
_PTR(SObject) anObj = getStudy()->studyDS()->FindObjectID( (const char*)entry.toUtf8() ); _PTR(SObject) anObj = getStudy()->studyDS()->FindObjectID( (const char*)entry.toUtf8() );
//if ( ! GeometryGUI::IsInGeomComponent( anObj )) return false; //if ( ! GeometryGUI::IsInGeomComponent( anObj )) return false;
CORBA::Object_var anOrbObj = GeometryGUI::ClientSObjectToObject(anObj); CORBA::Object_var anOrbObj = GeometryGUI::ClientSObjectToObject(anObj);
@ -2518,14 +2455,11 @@ bool GEOM_Displayer::canBeDisplayed( const QString& entry, const QString& viewer
bool isGeomObj = (!CORBA::is_nil( aGeomObj ) || !CORBA::is_nil( aFieldStepObj ) || !CORBA::is_nil( aCompObj )); bool isGeomObj = (!CORBA::is_nil( aGeomObj ) || !CORBA::is_nil( aFieldStepObj ) || !CORBA::is_nil( aCompObj ));
bool ret = ( isGeomObj ) && bool ret = ( isGeomObj ) &&
(viewer_type == SOCC_Viewer::Type() || viewer_type == SVTK_Viewer::Type() || viewer_type == SPV3D_ViewModel::Type()); (viewer_type == SOCC_Viewer::Type() || viewer_type == SVTK_Viewer::Type() || viewer_type == SPV3D_ViewModel::Type());
MSGEL("..... --> isCorbaObj=" << YesNo(isCorbaObj) << ", isGeomObj=" << YesNo(isGeomObj) << ", canBeDisp=" << YesNo(ret));
return ret; return ret;
} }
int GEOM_Displayer::SetDisplayMode( const int theMode ) int GEOM_Displayer::SetDisplayMode( const int theMode )
{ {
DBG_FUN();
ARG(theMode);
int aPrevMode = myDisplayMode; int aPrevMode = myDisplayMode;
if ( theMode != -1 ) { if ( theMode != -1 ) {
myDisplayMode = theMode; myDisplayMode = theMode;
@ -2544,7 +2478,6 @@ int GEOM_Displayer::GetDisplayMode() const
int GEOM_Displayer::UnsetDisplayMode() int GEOM_Displayer::UnsetDisplayMode()
{ {
DBG_FUN();
int aPrevMode = myDisplayMode; int aPrevMode = myDisplayMode;
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
myDisplayMode = resMgr->integerValue( "Geometry", "display_mode", 0 ); myDisplayMode = resMgr->integerValue( "Geometry", "display_mode", 0 );
@ -2880,7 +2813,6 @@ SALOMEDS::Color GEOM_Displayer::getColor(GEOM::GEOM_Object_var theGeomObject, bo
void GEOM_Displayer::EraseWithChildren(const Handle(SALOME_InteractiveObject)& theIO, void GEOM_Displayer::EraseWithChildren(const Handle(SALOME_InteractiveObject)& theIO,
const bool eraseOnlyChildren) const bool eraseOnlyChildren)
{ {
DBG_FUN();
LightApp_DataObject* parent = getStudy()->findObjectByEntry(theIO->getEntry()); LightApp_DataObject* parent = getStudy()->findObjectByEntry(theIO->getEntry());
if( !parent) if( !parent)
@ -3114,7 +3046,6 @@ QList<QVariant> GEOM_Displayer::groupFieldData( const QList<QVariant>& theFieldS
void GEOM_Displayer::UpdateColorScale() void GEOM_Displayer::UpdateColorScale()
{ {
DBG_FUN();
if ( !myUpdateColorScale ) if ( !myUpdateColorScale )
return; return;
@ -3194,7 +3125,6 @@ void GEOM_Displayer::UpdateColorScale()
bool GEOM_Displayer::SetUpdateColorScale( bool toUpdate ) // IPAL54049 bool GEOM_Displayer::SetUpdateColorScale( bool toUpdate ) // IPAL54049
{ {
DBG_FUN();
bool previous = myUpdateColorScale; bool previous = myUpdateColorScale;
myUpdateColorScale = toUpdate; myUpdateColorScale = toUpdate;
if ( myUpdateColorScale && !previous ) if ( myUpdateColorScale && !previous )

View File

@ -136,16 +136,8 @@
#include "GEOM_version.h" #include "GEOM_version.h"
#include "GEOMImpl_Types.hxx" // dangerous hxx (defines short-name macros) - include after all #include "GEOMImpl_Types.hxx" // dangerous hxx (defines short-name macros) - include after all
//---------------------------------------------------------
#define USE_DEBUG
//#define MB_IGNORE_QT
#define MBCLASSNAME "GeometryGUI"
#include "MBDebug.h"
//---------------------------------------------------------
extern "C" { extern "C" {
Standard_EXPORT CAM_Module* createModule() { Standard_EXPORT CAM_Module* createModule() {
DBG_FUNC();
return new GeometryGUI(); return new GeometryGUI();
} }
@ -158,7 +150,6 @@ GEOM::GEOM_Gen_var GeometryGUI::myComponentGeom = GEOM::GEOM_Gen::_nil();
GEOM::GEOM_Gen_var GeometryGUI::GetGeomGen() GEOM::GEOM_Gen_var GeometryGUI::GetGeomGen()
{ {
DBG_FUNC();
// Bug 12290: exception in Mesh GUI on GEOMBase::GetShape() if Geometry GUI hasn't been loaded // Bug 12290: exception in Mesh GUI on GEOMBase::GetShape() if Geometry GUI hasn't been loaded
if (CORBA::is_nil(myComponentGeom)) if (CORBA::is_nil(myComponentGeom))
InitGeomGen(); InitGeomGen();
@ -167,7 +158,6 @@ GEOM::GEOM_Gen_var GeometryGUI::GetGeomGen()
bool GeometryGUI::InitGeomGen() bool GeometryGUI::InitGeomGen()
{ {
DBG_FUNC();
GeometryGUI aGG; GeometryGUI aGG;
if ( CORBA::is_nil( myComponentGeom ) ) return false; if ( CORBA::is_nil( myComponentGeom ) ) return false;
return true; return true;
@ -233,7 +223,6 @@ void GeometryGUI::Modified (bool theIsUpdateActions)
//======================================================================= //=======================================================================
GeometryGUI::GeometryGUI() : SalomeApp_Module( "GEOM" ) GeometryGUI::GeometryGUI() : SalomeApp_Module( "GEOM" )
{ {
DBG_FUN();
if ( CORBA::is_nil( myComponentGeom ) ) if ( CORBA::is_nil( myComponentGeom ) )
{ {
SALOME_NamingService_Abstract *ns = SalomeApp_Application::namingService(); SALOME_NamingService_Abstract *ns = SalomeApp_Application::namingService();
@ -265,7 +254,6 @@ GeometryGUI::GeometryGUI() : SalomeApp_Module( "GEOM" )
//======================================================================= //=======================================================================
GeometryGUI::~GeometryGUI() GeometryGUI::~GeometryGUI()
{ {
DBG_FUN();
while (!myOCCSelectors.isEmpty()) while (!myOCCSelectors.isEmpty())
delete myOCCSelectors.takeFirst(); delete myOCCSelectors.takeFirst();
@ -282,8 +270,6 @@ GeometryGUI::~GeometryGUI()
typedef GEOMGUI* (*LibraryGUI)( GeometryGUI* ); typedef GEOMGUI* (*LibraryGUI)( GeometryGUI* );
GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName ) GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName )
{ {
DBG_FUN();
ARG(libraryName);
if ( !myGUIMap.contains( libraryName ) ) { if ( !myGUIMap.contains( libraryName ) ) {
// try to load library if it is not loaded yet // try to load library if it is not loaded yet
#if defined(WIN32) #if defined(WIN32)
@ -334,8 +320,6 @@ GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName )
typedef GEOMPluginGUI* (*PluginLibraryGUI)( GeometryGUI* ); typedef GEOMPluginGUI* (*PluginLibraryGUI)( GeometryGUI* );
GEOMPluginGUI* GeometryGUI::getPluginLibrary( const QString& libraryName ) GEOMPluginGUI* GeometryGUI::getPluginLibrary( const QString& libraryName )
{ {
DBG_FUN();
ARG(libraryName);
if ( !myGUIMap.contains( libraryName ) ) { if ( !myGUIMap.contains( libraryName ) ) {
// try to load library if it is not loaded yet // try to load library if it is not loaded yet
@ -386,7 +370,6 @@ GEOMPluginGUI* GeometryGUI::getPluginLibrary( const QString& libraryName )
//======================================================================= //=======================================================================
void GeometryGUI::ActiveWorkingPlane() void GeometryGUI::ActiveWorkingPlane()
{ {
DBG_FUN();
gp_Dir DZ = myWorkingPlane.Direction(); gp_Dir DZ = myWorkingPlane.Direction();
gp_Dir DY = myWorkingPlane.YDirection(); gp_Dir DY = myWorkingPlane.YDirection();
@ -420,7 +403,6 @@ void GeometryGUI::ActiveWorkingPlane()
else if ( ViewPV3D ) { else if ( ViewPV3D ) {
PV3DViewer_ViewWindow* vw = dynamic_cast<PV3DViewer_ViewWindow*>( window ); PV3DViewer_ViewWindow* vw = dynamic_cast<PV3DViewer_ViewWindow*>( window );
if ( vw ) { if ( vw ) {
MSGEL("...(NYI) => orient view to active plane");
} }
} }
} }
@ -451,7 +433,6 @@ GEOMGUI_TextTreeWdg* GeometryGUI::GetTextTreeWdg() const
//======================================================================= //=======================================================================
void GeometryGUI::SetActiveDialogBox( QDialog* aDlg ) void GeometryGUI::SetActiveDialogBox( QDialog* aDlg )
{ {
DBG_FUN();
myActiveDialogBox = (QDialog*)aDlg; myActiveDialogBox = (QDialog*)aDlg;
} }
@ -489,7 +470,6 @@ void GeometryGUI::EmitSignalDefaultStepValueChanged(double newVal)
//======================================================================= //=======================================================================
void GeometryGUI::OnGUIEvent() void GeometryGUI::OnGUIEvent()
{ {
DBG_FUN();
const QObject* obj = sender(); const QObject* obj = sender();
if ( !obj || !obj->inherits( "QAction" ) ) if ( !obj || !obj->inherits( "QAction" ) )
return; return;
@ -504,8 +484,6 @@ void GeometryGUI::OnGUIEvent()
//======================================================================= //=======================================================================
void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam ) void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
{ {
DBG_FUN();
ARG(id);
SUIT_Application* anApp = application(); SUIT_Application* anApp = application();
if (!anApp) return; if (!anApp) return;
SUIT_Desktop* desk = anApp->desktop(); SUIT_Desktop* desk = anApp->desktop();
@ -519,7 +497,6 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
#else #else
bool ViewDep = 0; bool ViewDep = 0;
#endif #endif
MSGEL("....Flags: " << X_(ViewOCC) << " " << X_(ViewVTK) << " " << X_(ViewDep));
// if current viewframe is not of OCC and not of VTK type - return immediately // if current viewframe is not of OCC and not of VTK type - return immediately
// fix for IPAL8958 - allow some commands to execute even when NO viewer is active (rename for example) // fix for IPAL8958 - allow some commands to execute even when NO viewer is active (rename for example)
QList<int> NotViewerDependentCommands; QList<int> NotViewerDependentCommands;
@ -841,7 +818,6 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
//================================================================================= //=================================================================================
bool GeometryGUI::activateOperation( int actionId ) bool GeometryGUI::activateOperation( int actionId )
{ {
DBG_FUN();
OnGUIEvent(actionId); OnGUIEvent(actionId);
return true; return true;
} }
@ -852,8 +828,6 @@ bool GeometryGUI::activateOperation( int actionId )
//================================================================================= //=================================================================================
bool GeometryGUI::activateOperation( const QString& actionId ) bool GeometryGUI::activateOperation( const QString& actionId )
{ {
DBG_FUN();
ARG(actionId);
bool isOk = false; bool isOk = false;
int id = actionId.toInt(&isOk); int id = actionId.toInt(&isOk);
@ -869,9 +843,6 @@ bool GeometryGUI::activateOperation( const QString& actionId )
//================================================================================= //=================================================================================
bool GeometryGUI::activateOperation( const QString& actionId, const QString& plugin ) bool GeometryGUI::activateOperation( const QString& actionId, const QString& plugin )
{ {
DBG_FUN();
ARG(actionId);
ARG(plugin);
bool isOk = false; bool isOk = false;
QString pluginLib = plugin; QString pluginLib = plugin;
@ -947,9 +918,6 @@ void GeometryGUI::OnMousePress( SUIT_ViewWindow* w, QMouseEvent* e )
void GeometryGUI::createGeomAction( const int id, const QString& label, const QString& icolabel, void GeometryGUI::createGeomAction( const int id, const QString& label, const QString& icolabel,
const int accel, const bool toggle, const QString& shortcutAction ) const int accel, const bool toggle, const QString& shortcutAction )
{ {
DBG_FUN();
ARG(id);
ARG(label);
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
QPixmap icon = icolabel.isEmpty() ? resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+label).toLatin1().constData() ), false ) QPixmap icon = icolabel.isEmpty() ? resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+label).toLatin1().constData() ), false )
: resMgr->loadPixmap( "GEOM", tr( icolabel.toLatin1().constData() ) ); : resMgr->loadPixmap( "GEOM", tr( icolabel.toLatin1().constData() ) );
@ -971,7 +939,6 @@ void GeometryGUI::createGeomAction( const int id, const QString& label, const QS
//======================================================================= //=======================================================================
void GeometryGUI::createOriginAndBaseVectors() void GeometryGUI::createOriginAndBaseVectors()
{ {
DBG_FUN();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() ); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked(); bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked();
if ( aLocked ) { if ( aLocked ) {
@ -1011,7 +978,6 @@ void GeometryGUI::createOriginAndBaseVectors()
//======================================================================= //=======================================================================
void GeometryGUI::initialize( CAM_Application* app ) void GeometryGUI::initialize( CAM_Application* app )
{ {
DBG_FUN();
SalomeApp_Module::initialize( app ); SalomeApp_Module::initialize( app );
// ----- create actions -------------- // ----- create actions --------------
@ -1815,7 +1781,6 @@ void GeometryGUI::initialize( CAM_Application* app )
//======================================================================= //=======================================================================
void GeometryGUI::addPluginActions() void GeometryGUI::addPluginActions()
{ {
DBG_FUN();
// Resource manager // Resource manager
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
if (!resMgr) return; if (!resMgr) return;
@ -1906,7 +1871,6 @@ namespace
//======================================================================= //=======================================================================
bool GeometryGUI::activateModule( SUIT_Study* study ) bool GeometryGUI::activateModule( SUIT_Study* study )
{ {
DBG_FUN();
// Fill in: Help Panel // Fill in: Help Panel
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( application() ); SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( application() );
app->infoPanel()->setTitle(tr("INFO_WELCOME_TO_GEOM")); app->infoPanel()->setTitle(tr("INFO_WELCOME_TO_GEOM"));
@ -2053,7 +2017,6 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
//======================================================================= //=======================================================================
bool GeometryGUI::deactivateModule( SUIT_Study* study ) bool GeometryGUI::deactivateModule( SUIT_Study* study )
{ {
DBG_FUN();
QMenu* viewMenu = menuMgr()->findMenu( STD_Application::MenuViewId ); QMenu* viewMenu = menuMgr()->findMenu( STD_Application::MenuViewId );
if ( viewMenu ) if ( viewMenu )
disconnect( viewMenu, SIGNAL( aboutToShow() ), this, SLOT( onViewAboutToShow() ) ); disconnect( viewMenu, SIGNAL( aboutToShow() ), this, SLOT( onViewAboutToShow() ) );
@ -2104,7 +2067,6 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study )
//======================================================================= //=======================================================================
void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win ) void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win )
{ {
DBG_FUN();
if ( !win ) if ( !win )
return; return;
@ -2150,8 +2112,6 @@ void GeometryGUI::viewManagers( QStringList& lst ) const
void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm ) void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm )
{ {
DBG_FUN();
if (vm) { SHOW(vm->getType()); }
if ( vm && vm->getType() == OCCViewer_Viewer::Type() ) if ( vm && vm->getType() == OCCViewer_Viewer::Type() )
{ {
qDebug( "connect" ); qDebug( "connect" );
@ -2190,8 +2150,6 @@ void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm )
void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm ) void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm )
{ {
DBG_FUN();
if (vm) { SHOW(vm->getType()); }
SUIT_ViewModel* viewer = vm->getViewModel(); SUIT_ViewModel* viewer = vm->getViewModel();
if ( vm->getType() == OCCViewer_Viewer::Type() ) if ( vm->getType() == OCCViewer_Viewer::Type() )
{ {
@ -2229,7 +2187,6 @@ void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm )
void GeometryGUI::updateCreationInfo() void GeometryGUI::updateCreationInfo()
{ {
DBG_FUN();
if ( myCreationInfoWdg ) if ( myCreationInfoWdg )
myCreationInfoWdg->clear(); myCreationInfoWdg->clear();
@ -2279,7 +2236,6 @@ void GeometryGUI::updateCreationInfo()
void GeometryGUI::onAutoBringToFront() void GeometryGUI::onAutoBringToFront()
{ {
DBG_FUN();
bool isAutoBringToFront = SUIT_Session::session()->resourceMgr()->booleanValue( "Geometry", "auto_bring_to_front", "false" ); bool isAutoBringToFront = SUIT_Session::session()->resourceMgr()->booleanValue( "Geometry", "auto_bring_to_front", "false" );
if( !isAutoBringToFront ) if( !isAutoBringToFront )
return; return;
@ -2369,14 +2325,11 @@ Handle(TColStd_HArray1OfByte) GeometryGUI::getTexture (int theId, int& theWidth,
LightApp_Selection* GeometryGUI::createSelection() const LightApp_Selection* GeometryGUI::createSelection() const
{ {
DBG_FUN();
return new GEOMGUI_Selection(); return new GEOMGUI_Selection();
} }
void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title ) void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
{ {
DBG_FUN();
ARG(client);
SalomeApp_Module::contextMenuPopup( client, menu, title ); SalomeApp_Module::contextMenuPopup( client, menu, title );
SALOME_ListIO lst; SALOME_ListIO lst;
getApp()->selectionMgr()->selectedObjects( lst ); getApp()->selectionMgr()->selectedObjects( lst );
@ -2436,15 +2389,12 @@ void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString&
void GeometryGUI::OnSetMaterial(const QString& theName) void GeometryGUI::OnSetMaterial(const QString& theName)
{ {
DBG_FUN();
ARG(theName);
OnGUIEvent( GEOMOp::OpPredefMaterial, QVariant( theName ) ); OnGUIEvent( GEOMOp::OpPredefMaterial, QVariant( theName ) );
} }
void GeometryGUI::createPreferences() void GeometryGUI::createPreferences()
{ {
DBG_FUN();
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) ); int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
@ -3003,7 +2953,6 @@ void GeometryGUI::preferencesChanged( const QString& section, const QString& par
LightApp_Displayer* GeometryGUI::displayer() LightApp_Displayer* GeometryGUI::displayer()
{ {
DBG_FUN();
if ( !myDisplayer ) if ( !myDisplayer )
myDisplayer = new GEOM_Displayer(); myDisplayer = new GEOM_Displayer();
return myDisplayer; return myDisplayer;
@ -3011,8 +2960,6 @@ LightApp_Displayer* GeometryGUI::displayer()
void GeometryGUI::setLocalSelectionMode(const int mode) void GeometryGUI::setLocalSelectionMode(const int mode)
{ {
DBG_FUN();
ARG(mode);
myLocalSelectionMode = mode; myLocalSelectionMode = mode;
} }
@ -3032,7 +2979,6 @@ const char gDigitsSep = ':'; // character used to separate numeric parameter val
*/ */
void GeometryGUI::storeVisualParameters (int savePoint) void GeometryGUI::storeVisualParameters (int savePoint)
{ {
DBG_FUN();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy()); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
if ( !appStudy || !appStudy->studyDS() ) if ( !appStudy || !appStudy->studyDS() )
return; return;
@ -3232,7 +3178,6 @@ void GeometryGUI::storeVisualParameters (int savePoint)
*/ */
void GeometryGUI::restoreVisualParameters (int savePoint) void GeometryGUI::restoreVisualParameters (int savePoint)
{ {
DBG_FUN();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy()); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
if (!appStudy || !appStudy->studyDS()) if (!appStudy || !appStudy->studyDS())
return; return;
@ -3423,7 +3368,6 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
// Compute current name mode of the viewer // Compute current name mode of the viewer
void UpdateNameMode( SalomeApp_Application* app ) void UpdateNameMode( SalomeApp_Application* app )
{ {
DBG_FUNC();
bool isMode = false; bool isMode = false;
SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() ); SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
SUIT_ViewWindow* viewWindow = app->desktop()->activeWindow(); SUIT_ViewWindow* viewWindow = app->desktop()->activeWindow();
@ -3448,7 +3392,6 @@ void UpdateNameMode( SalomeApp_Application* app )
void GeometryGUI::onViewAboutToShow() void GeometryGUI::onViewAboutToShow()
{ {
DBG_FUN();
SUIT_ViewWindow* window = application()->desktop()->activeWindow(); SUIT_ViewWindow* window = application()->desktop()->activeWindow();
QAction* a = action( GEOMOp::OpSwitchVectors ); QAction* a = action( GEOMOp::OpSwitchVectors );
QAction* aVerticesAction = action( GEOMOp::OpSwitchVertices ); QAction* aVerticesAction = action( GEOMOp::OpSwitchVertices );
@ -3493,8 +3436,6 @@ QAction* GeometryGUI::getAction(const int id) {
*/ */
void GeometryGUI::message(const QString& msg) void GeometryGUI::message(const QString& msg)
{ {
DBG_FUNC();
ARG(msg);
// dispatch message // dispatch message
QStringList data = msg.split("/"); QStringList data = msg.split("/");
const int nbStrings = data.count(); const int nbStrings = data.count();
@ -3526,7 +3467,6 @@ void GeometryGUI::message(const QString& msg)
*/ */
void GeometryGUI::ClearShapeBuffer( GEOM::GEOM_Object_ptr theObj ) void GeometryGUI::ClearShapeBuffer( GEOM::GEOM_Object_ptr theObj )
{ {
DBG_FUNC();
if ( CORBA::is_nil( theObj ) ) if ( CORBA::is_nil( theObj ) )
return; return;
@ -3626,9 +3566,6 @@ bool GeometryGUI::renameAllowed( const QString& entry) const {
*/ */
bool GeometryGUI::renameObject( const QString& entry, const QString& name) bool GeometryGUI::renameObject( const QString& entry, const QString& name)
{ {
DBG_FUN();
ARG(entry);
ARG(name);
bool result = false; bool result = false;
SalomeApp_Application* app = SalomeApp_Application* app =
@ -3670,7 +3607,6 @@ bool GeometryGUI::renameObject( const QString& entry, const QString& name)
void GeometryGUI::updateMaterials() void GeometryGUI::updateMaterials()
{ {
DBG_FUN();
LightApp_Preferences* pref = preferences(); LightApp_Preferences* pref = preferences();
if ( pref ) { if ( pref ) {
QStringList materials = Material_ResourceMgr::resourceMgr()->materials(); QStringList materials = Material_ResourceMgr::resourceMgr()->materials();
@ -3780,7 +3716,6 @@ bool GeometryGUI::isDropAccepted( const SUIT_DataObject* where ) const
void GeometryGUI::dropObjects( const DataObjectList& what, SUIT_DataObject* where, void GeometryGUI::dropObjects( const DataObjectList& what, SUIT_DataObject* where,
const int row, Qt::DropAction action ) const int row, Qt::DropAction action )
{ {
DBG_FUN();
if (action != Qt::CopyAction && action != Qt::MoveAction) if (action != Qt::CopyAction && action != Qt::MoveAction)
return; // unsupported action return; // unsupported action

View File

@ -1,245 +0,0 @@
#ifndef MBDebug_HeaderFile
#define MBDebug_HeaderFile
//---------------------------------------------------------------
// Usage of the logging facilities:
//
// (1) At the beginning of each class file to be debugged, there
// should be a static string variable defined with the name
// of the class. Then, include the "MBDebug.h" header file.
//
// //---------------------------------------------------------
// #define USE_DEBUG
// //#define MB_IGNORE_QT
// #define MBCLASSNAME "ClassName"
// #include "MBDebug.h"
// //---------------------------------------------------------
//
// (2) At the beginning of each class method, call the DBG_FUN
// macro.
//
// int ClassName::MyMethod(int x)
// {
// DBG_FUN();
// ...
// }
//
// NOTE: For static methods, call the DBG_FUNC() macro!!
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// This debugging/logging class is a "header-only" solution and
// does NOT require any additional implementation (.cpp) file!
//---------------------------------------------------------------
#include <iostream>
#include <string>
#include <locale>
#include <codecvt>
#include <list>
#include <map>
#include <set>
#include <vector>
#ifndef MB_IGNORE_QT
# include <qstring.h>
#endif
//---------------------------------------------------------------
// Set the debug flags dependent on the preprocessor definitions
//---------------------------------------------------------------
#ifdef USE_DEBUG
# define MBS_DEBUG_FLAG MBDebug::DF_DEBUG
#else
# define MBS_DEBUG_FLAG 0
#endif /*DEBUG*/
#define MBS_DBG_FLAGS (MBS_DEBUG_FLAG)
//---------------------------------------------------------------
// Define the global debug macros
//---------------------------------------------------------------
#define DLOG MBDebug::LogPrint()
#define RETURN(var) { RET(var); return (var); }
#ifdef USE_DEBUG
# define DBG_FUN() MBDebug _dbg(MBCLASSNAME, __FUNCTION__, MBS_DBG_FLAGS, (void*)this)
# define DBG_FUNC() MBDebug _dbg(MBCLASSNAME, __FUNCTION__, MBS_DBG_FLAGS)
# define DBG_FUNB(blk) MBDebug _dbg(MBCLASSNAME, blk, MBS_DBG_FLAGS)
# define MSGEL(txt) MBDebug::LogPrint() << txt << std::endl
# define PRINT(txt) MBDebug::LogPrint() << txt
# define SHOW2(var,typ) DumpVar(#var,(typ)(var))
# define SHOW(var) DumpVar(#var,var)
# define ARG(var) do { PRINT("in:"); DumpVar(#var,var); } while (0)
# define ARG2(var,typ) do { PRINT("in:"); DumpVar(#var,(typ)(var)); } while (0)
# define RET(var) do { PRINT("out:"); DumpVar(#var,var); } while (0)
# define MSG(txt) MBDebug::LogPrint() << txt
#else /*!USE_DEBUG*/
# define DBG_FUN()
# define DBG_FUNC()
# define DBG_FUNB(blk)
# define MSGEL(txt)
# define PRINT(txt)
# define SHOW2(var,typ)
# define SHOW(var)
# define ARG(var)
# define ARG2(var,typ)
# define RET(var)
# define MSG(txt)
#endif /*USE_DEBUG*/
//---------------------------------------------------------------
// Declare the debugging and profiling class
//---------------------------------------------------------------
class MBDebug
{
public:
enum {
DF_NONE = 0x00, // no debug
DF_DEBUG = 0x01 // debug a function
};
MBDebug(const char* aClassName, const char* aFuncName, const short aFlag, void* aThis=NULL)
:mClassName(aClassName),mFuncName(aFuncName),mThis(aThis),mFlags((unsigned char)aFlag)
{
if (mFlags & (DF_DEBUG))
{
std::cout << "{ENTER: " << mClassName + "::" + mFuncName;
if (mThis) std::cout << "(this=" << mThis << ")";
std::cout << std::endl;
}
}
virtual ~MBDebug()
{
if (mFlags & (DF_DEBUG))
std::cout << "}LEAVE: " << mClassName << "::" << mFuncName << std::endl;
}
// Log file output management
static std::ostream& LogPrint() { return std::cout; }
private:
std::string mClassName; // Name of class to be debugged
std::string mFuncName; // Name of function to be debugged
void* mThis; // The "this" pointer to the class being debugged
unsigned char mFlags; // Debug mode flags
};
#define YesNo(b) (b ? "Yes" : "No")
#define X_(b) (b ? "[x] " #b : "[ ] " #b)
inline std::string w2s(std::wstring ws)
{
using convert_typeX = std::codecvt_utf8<wchar_t>;
std::wstring_convert<convert_typeX, wchar_t> converterX;
return(converterX.to_bytes(ws));
}
// Primitive types
inline void DumpVar(const char *szName, char value)
{
DLOG << "[chr]: " << szName << "='" << value << "'" << std::endl;
}
inline void DumpVar(const char *szName, bool value)
{
DLOG << "[bool]: " << szName << "=" << (value ? "true" : "false") << std::endl;
}
inline void DumpVar(const char *szName, short value)
{
DLOG << "[shrt]: " << szName << "=" << value << std::endl;
}
inline void DumpVar(const char *szName, int value)
{
DLOG << "[int]: " << szName << "=" << value << std::endl;
}
inline void DumpVar(const char *szName, long value)
{
DLOG << "[long]: " << szName << "=" << value << std::endl;
}
inline void DumpVar(const char *szName, double value)
{
DLOG << "[dbl]: " << szName << "=" << value << std::endl;
}
inline void DumpVar(const char *szName, unsigned char value)
{
DLOG << "[byte]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;
}
inline void DumpVar(const char *szName, unsigned short value)
{
DLOG << "[word]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;
}
inline void DumpVar(const char *szName, unsigned int value)
{
DLOG << "[uint]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;
}
inline void DumpVar(const char *szName, unsigned long value)
{
DLOG << "[dword]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;
}
inline void DumpVar(const char *szName, const char* value)
{
DLOG << "[str]: " << szName << "=\"" << (value ? value : "") << "\"" << std::endl;
}
inline void DumpVar(const char *szName, const std::string &value)
{
DLOG << "[Str]: " << szName << "=\"" << value << "\"" << std::endl;
}
inline void DumpVar(const char *szName, const std::wstring &value)
{
DLOG << "[WStr]: " << szName << "=\"" << w2s(value) << "\"" << std::endl;
}
#ifndef MB_IGNORE_QT
inline void DumpVar(const char *szName, const QString &value)
{
DLOG << "[QStr]: " << szName << "=\"" << value.toStdString() << "\"" << std::endl;
}
#endif
inline void DumpVar(const char *szName, const void* value)
{
DLOG << "[ptr]: " << szName << "=" << value << std::endl;
}
// Collection of primitive types
inline void DumpVar(const char *szName, const std::set<int> &values)
{
DLOG << "[intSet]: " << szName << "={" << values.size() << "}[";
bool bFirst = true;
for (auto it=values.cbegin(); it!=values.cend(); ++it)
DLOG << (bFirst ? "" : ",") << *it;
DLOG << "]" << std::endl;
}
inline void DumpVar(const char *szName, const std::list<bool>& values)
{
DLOG << "[boolList]: " << szName << "={" << values.size() << "}[";
bool bFirst = true;
for (auto it=values.cbegin(); it!=values.cend(); ++it)
DLOG << (bFirst ? "" : ",") << (*it ? "Y" : "N");
DLOG << "]" << std::endl;
}
#endif // MBDebug_HeaderFile

View File

@ -1,436 +0,0 @@
#ifndef MBOCC_H
#define MBOCC_H
#include <iostream>
#include <locale>
#include <codecvt>
#include <chrono>
#include <TDataStd_AsciiString.hxx>
#include <TDataStd_BooleanArray.hxx>
#include <TDataStd_BooleanList.hxx>
#include <TDataStd_ByteArray.hxx>
#include <TDataStd_Comment.hxx>
#include <TDataStd_ExtStringArray.hxx>
#include <TDataStd_ExtStringList.hxx>
#include <TDataStd_Integer.hxx>
#include <TDataStd_IntegerArray.hxx>
#include <TDataStd_IntegerList.hxx>
#include <TDataStd_Name.hxx>
#include <TDataStd_Real.hxx>
#include <TDataStd_RealArray.hxx>
#include <TDataStd_RealList.hxx>
#include <TDataStd_ReferenceArray.hxx>
#include <TDataStd_ReferenceList.hxx>
#include <TDataStd_Relation.hxx>
#include <TDataStd_UAttribute.hxx>
#include <TDataStd_Variable.hxx>
#include <TDF_AttributeIterator.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_ChildIDIterator.hxx>
#include <TDF_Reference.hxx>
#include <TDF_TagSource.hxx>
#include <TDF_Tool.hxx>
#include <TNaming_NamedShape.hxx>
#include <TNaming_Iterator.hxx>
#include <BRepTools.hxx>
#include <TopoDS_Shape.hxx>
#include <TopExp_Explorer.hxx>
//--------------------------------------------------------------------------
// Function declarations
//--------------------------------------------------------------------------
static std::string ShapeTypeStr(const TopoDS_Shape shp);
static std::string EvolutionStr(const TNaming_Evolution evol);
static void DumpEvolution(Handle(TNaming_NamedShape) aNS);
static void DumpShapeHistory(const TDF_Label& theLabel, const TopoDS_Shape& theShape);
static void DumpVar(const char *szName, Handle(TNaming_NamedShape) aNS);
static void DumpVar(const char *szName, Handle(TDF_Attribute) aAttr);
static void DumpVar(const char *szName, const TDF_Label &lbl);
static void DumpVar(const char *szName, const TopoDS_Shape &aShape);
//==========================================================================
static std::string ShapeTypeStr(const TopoDS_Shape shp) {
if (shp.IsNull())
return "null";
switch (shp.ShapeType()) {
case TopAbs_COMPOUND: return "COMPOUND";
case TopAbs_COMPSOLID: return "COMPSOLID";
case TopAbs_SOLID: return "SOLID";
case TopAbs_SHELL: return "SHELL";
case TopAbs_FACE: return "FACE";
case TopAbs_WIRE: return "WIRE";
case TopAbs_EDGE: return "EDGE";
case TopAbs_VERTEX: return "VERTEX";
case TopAbs_SHAPE: return "SHAPE";
}
return "??";
}
//==========================================================================
static std::string EvolutionStr(const TNaming_Evolution evol) {
switch (evol) {
case TNaming_PRIMITIVE: return "PRIMITIVE";
case TNaming_GENERATED: return "GENERATED";
case TNaming_MODIFY: return "MODIFY";
case TNaming_DELETE: return "DELETE";
case TNaming_REPLACE: return "REPLACE";
case TNaming_SELECTED: return "SELECTED";
}
return "??";
}
//==========================================================================
static void SaveShape(const TopoDS_Shape &shp, const char* szFileName) {
std::string fn("/home/bernhard/brep/");
std::chrono::high_resolution_clock::time_point now_t = std::chrono::high_resolution_clock::now();
unsigned long long now_c = *((unsigned long long*)&now_t);
fn = fn + std::to_string(now_c) + "_" + szFileName + ".brep";
MSGEL("...saving shape \"" << szFileName << "\"to [" << fn << "]");
BRepTools::Write(shp, fn.c_str());
}
//==========================================================================
static void DumpChildren(const TDF_Label& aLabel) {
TDF_ChildIterator it;
//TCollection_AsciiString as;
for (it.Initialize(aLabel); it.More(); it.Next()) {
SHOW(it.Value());
DumpChildren(it.Value());
// TDF_Tool::Entry(it.Value(),as);
// MSGEL("* [Label]: child=" << as.ToCString());
}
}
//==========================================================================
static void DumpShapeHistory(const TDF_Label& theLabel, const TopoDS_Shape& theShape)
{
SHOW(theLabel);
SHOW(theShape);
DLOG << "{-------ShapeHistory-------------------------" << std::endl;
TopoDS_Shape anOldShape; // old shape in the pair old shape->theShape in the named shape
TopoDS_Shape aShapeContainer; // old shape of the shape that contains theShape as sub-element
Handle(TNaming_NamedShape) aCandidatInThis, aCandidatContainer;
// use child and this label (the lowest priority)
TDF_ChildIDIterator aNSIter(theLabel, TNaming_NamedShape::GetID(), Standard_True);
bool aUseThis = !aNSIter.More();
while(anOldShape.IsNull() && (aNSIter.More() || aUseThis)) {
Handle(TNaming_NamedShape) aNS;
if (aUseThis) {
if (!theLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS))
break;
} else {
aNS = Handle(TNaming_NamedShape)::DownCast(aNSIter.Value());
}
for(TNaming_Iterator aShapesIter(aNS); aShapesIter.More(); aShapesIter.Next()) {
if (aShapesIter.Evolution() == TNaming_SELECTED || aShapesIter.Evolution() == TNaming_DELETE)
continue; // don't use the selection evolution
if (aShapesIter.NewShape().IsSame(theShape)) { // found the original shape
aCandidatInThis = aNS;
if (aCandidatInThis->Evolution() == TNaming_MODIFY) {
anOldShape = aShapesIter.OldShape();
MSG("* modified from: "); SHOW(anOldShape);
}
// otherwise may we searching for another item of this shape with longer history
if (!anOldShape.IsNull())
break;
}
// check that the shape contains theShape as sub-shape to fill container
if (aShapesIter.NewShape().ShapeType() < theShape.ShapeType() && aCandidatContainer.IsNull()) {
TopExp_Explorer anExp(aShapesIter.NewShape(), theShape.ShapeType());
for(; anExp.More(); anExp.Next()) {
if (theShape.IsSame(anExp.Current())) {
aCandidatContainer = aNS;
aShapeContainer = aShapesIter.NewShape();
}
}
}
}
// iterate to the next label or to the body label in the end
if (!aUseThis)
aNSIter.Next();
if (!aNSIter.More()) {
if (aUseThis)
break;
aUseThis = true;
}
}
DLOG << "}--------------------------------------------" << std::endl;
}
//==========================================================================
static void DumpEvolution(Handle(TNaming_NamedShape) aNS) {
DLOG << "{";
// TNaming_Iterator iterates in reversed way than it was put in Builder, so, keep it in container
// and iterate from end to begin
NCollection_List<TopoDS_Shape> aOlds;
NCollection_List<TopoDS_Shape> aNews;
NCollection_List<TNaming_Evolution> aEvol;
for (TNaming_Iterator anIt(aNS); anIt.More(); anIt.Next()) {
aOlds.Prepend(anIt.OldShape());
aNews.Prepend(anIt.NewShape());
aEvol.Prepend(anIt.Evolution());
}
NCollection_List<TopoDS_Shape>::Iterator aOldIter(aOlds);
NCollection_List<TopoDS_Shape>::Iterator aNewIter(aNews);
NCollection_List<TNaming_Evolution>::Iterator aEvolIter(aEvol);
for(; aOldIter.More(); aOldIter.Next(), aNewIter.Next(), aEvolIter.Next()) {
switch (aEvolIter.Value()) {
case TNaming_PRIMITIVE :
DLOG << " * primitive " << ShapeTypeStr(aNewIter.Value()) << std::endl;
break;
case TNaming_GENERATED :
DLOG << " * generated from " << ShapeTypeStr(aOldIter.Value()) << " to " << ShapeTypeStr(aNewIter.Value()) << std::endl;
break;
case TNaming_MODIFY :
DLOG << " * modified from " << ShapeTypeStr(aOldIter.Value()) << " to " << ShapeTypeStr(aNewIter.Value()) << std::endl;
break;
case TNaming_DELETE :
DLOG << " * deleted " << ShapeTypeStr(aOldIter.Value()) << std::endl;
break;
case TNaming_SELECTED :
DLOG << " * selected in " << ShapeTypeStr(aNewIter.Value()) << " a(n) " << ShapeTypeStr(aOldIter.Value()) << std::endl;
break;
default:
break;
}
}
DLOG << "}" << std::endl;
}
//==========================================================================
static void DumpVar(const char *szName, Handle(TNaming_NamedShape) aNS) {
if (aNS.IsNull()) {
DLOG << "[NamShp]: " << szName << "=Null" << std::endl;
return;
}
DLOG << "[NamShp]: " << szName << " vers=" << aNS->Version() << " Evol=[" << EvolutionStr(aNS->Evolution()) << "] Shape=\"" << ShapeTypeStr(aNS->Get()) << "\"" << std::endl;
//DumpEvolution(aNS);
}
//==========================================================================
static void DumpVar(const char *szName, Handle(TDF_Attribute) attr) {
if (attr.IsNull()) {
DLOG << "[TDFAttr]: " << szName << "=Null" << std::endl;
return;
}
int trans = attr->Transaction();
std::string state(" state=[");
state = state + (attr->IsValid() ? "valid" : "invalid");
state = state + "|" + (attr->IsNew() ? "new" : "old");
state = state + "|" + (attr->IsForgotten() ? "forgot" : "known") + "]";
Handle(TDataStd_AsciiString) aAS = Handle(TDataStd_AsciiString)::DownCast(attr);
if (!aAS.IsNull()) {
DLOG << "[TDFAttr_AscStr]: " << szName << "=\"" << aAS->Get() << "\"" << " trans=" << trans << state << std::endl;
return;
}
Handle(TDataStd_BooleanArray) aBoolArr = Handle(TDataStd_BooleanArray)::DownCast(attr);
if (!aBoolArr.IsNull()) {
DLOG << "[TDFAttr_BoolArr]: " << szName << "=" << aBoolArr->Length() << " [";
if (aBoolArr->Length() > 0) {
for (int i=aBoolArr->Lower(); i<=aBoolArr->Upper(); i++) {
DLOG << (i == aBoolArr->Lower() ? "" : ",") << YesNo(aBoolArr->Value(i));
}
}
DLOG << "]" << " trans=" << trans << state << std::endl;
return;
}
Handle(TDataStd_BooleanList) aBoolLst = Handle(TDataStd_BooleanList)::DownCast(attr);
if (!aBoolLst.IsNull()) {
const TDataStd_ListOfByte& lst = aBoolLst->List();
DLOG << "[TDFAttr_BoolLst]: " << szName << "=" << lst.Size() << " [";
if (!lst.IsEmpty()) {
for (auto b=lst.cbegin(); b!=lst.cend(); ++b) {
DLOG << (b == lst.cbegin() ? "" : ",") << YesNo(*b);
}
}
DLOG << "]" << " trans=" << trans << state << std::endl;
return;
}
Handle(TDataStd_Comment) aCmt = Handle(TDataStd_Comment)::DownCast(attr);
if (!aCmt.IsNull()) {
DLOG << "[TDFAttr_Comment]: " << szName << "=\"" << aCmt->Get() << "\"" << " trans=" << trans << state << std::endl;
return;
}
Handle(TDataStd_ExtStringList) aESLst = Handle(TDataStd_ExtStringList)::DownCast(attr);
if (!aESLst.IsNull()) {
const TDataStd_ListOfExtendedString& lst = aESLst->List();
DLOG << "[TDFAttr_ExStrLst]: " << szName << "=" << lst.Size() << " [";
if (!lst.IsEmpty()) {
for (auto str=lst.cbegin(); str!=lst.cend(); ++str) {
//std::wstring ws((wchar_t*)(*str).ToExtString());
DLOG << (str == lst.cbegin() ? "" : ",") << "\"" << *str << "\"";
}
}
DLOG << "]" << " trans=" << trans << state << std::endl;
return;
}
Handle(TDataStd_Integer) aInt = Handle(TDataStd_Integer)::DownCast(attr);
if (!aInt.IsNull()) {
DLOG << "[TDFAttr_Int]: " << szName << "=" << aInt->Get() << " trans=" << trans << state << std::endl;
return;
}
Handle(TDataStd_IntegerArray) aIntArr = Handle(TDataStd_IntegerArray)::DownCast(attr);
if (!aIntArr.IsNull()) {
DLOG << "[TDFAttr_IntArr]: " << szName << "=" << aIntArr->Length() << " [";
if (aIntArr->Length() > 0) {
for (int i=aIntArr->Lower(); i<=aIntArr->Upper(); i++) {
DLOG << (i == aIntArr->Lower() ? "" : ",") << aIntArr->Value(i);
}
}
DLOG << "]" << " trans=" << trans << state << std::endl;
return;
}
Handle(TDataStd_Name) aNam = Handle(TDataStd_Name)::DownCast(attr);
if (!aNam.IsNull()) {
DLOG << "[TDFAttr_Name]: " << szName << "=\"" << aNam->Get() << "\"" << " trans=" << trans << state << std::endl;
return;
}
Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(attr);
if (!aNS.IsNull()) {
DLOG << "[TDFAttr_NamShp]: " << szName << "=\"" << ShapeTypeStr(aNS->Get()) << "\" trans=" << trans << state << std::endl;
DLOG << aNS;
TNaming_Iterator it(aNS);
for (; it.More(); it.Next()) {
MSGEL("[NamShp]: child: Modif=" << YesNo(it.IsModification()) << " Evol=[" << EvolutionStr(it.Evolution()) << "] Old=\"" << ShapeTypeStr(it.OldShape()) << "\" New=\""<< ShapeTypeStr(it.NewShape()) << "\"");
}
//SHOW(aNS);
return;
}
Handle(TDataStd_Real) aReal = Handle(TDataStd_Real)::DownCast(attr);
if (!aReal.IsNull()) {
DLOG << "[TDFAttr_Real]: " << szName << "=" << aReal->Get() << " trans=" << trans << state << std::endl;
return;
}
Handle(TDF_Reference) aRef = Handle(TDF_Reference)::DownCast(attr);
if (!aRef.IsNull()) {
TCollection_AsciiString entry;
TDF_Tool::Entry(aRef->Get(), entry);
DLOG << "[TDFAttr_Ref]: " << szName << "=" << entry << " trans=" << trans << state << std::endl;
return;
}
Handle(TDataStd_ReferenceArray) aRefArr = Handle(TDataStd_ReferenceArray)::DownCast(attr);
if (!aRefArr.IsNull()) {
DLOG << "[TDFAttr_RefArr]: " << szName << "=" << aRefArr->Length() << " [";
if (aRefArr->Length() > 0) {
TCollection_AsciiString entry;
for (int i=aRefArr->Lower(); i<=aRefArr->Upper(); i++) {
TDF_Tool::Entry(aRefArr->Value(i), entry);
DLOG << (i == aRefArr->Lower() ? "" : ",") << entry;
}
}
DLOG << "]" << " trans=" << trans << state << std::endl;
return;
}
Handle(TDataStd_ReferenceList) aRefLst = Handle(TDataStd_ReferenceList)::DownCast(attr);
if (!aRefLst.IsNull()) {
const TDF_LabelList& lst = aRefLst->List();
DLOG << "[TDFAttr_RefLst]: " << szName << "=" << lst.Size() << " [";
if (!lst.IsEmpty()) {
TCollection_AsciiString entry;
for (auto ref=lst.cbegin(); ref!=lst.cend(); ++ref) {
TDF_Tool::Entry(*ref, entry);
DLOG << (ref == lst.cbegin() ? "" : ",") << entry;
}
}
DLOG << "]" << " trans=" << trans << state << std::endl;
return;
}
Handle(TDF_TagSource) aTS = Handle(TDF_TagSource)::DownCast(attr);
if (!aTS.IsNull()) {
DLOG << "[TDFAttr_TagSrc]: " << szName << "=" << aTS->Get() << " trans=" << trans << state << std::endl;
return;
}
Handle(TDataStd_UAttribute) aUA = Handle(TDataStd_UAttribute)::DownCast(attr);
if (!aUA.IsNull()) {
DLOG << "[TDFAttr_UAttr]: " << szName << "= trans=" << trans << state << std::endl;
return;
}
DLOG << "[" << attr->DynamicType()->Name() << "]" << attr << std::endl;
}
//==========================================================================
static void DumpVar(const char *szName, const TDF_Label &lbl) {
try {
if (lbl.IsNull()) {
DLOG << "[Label]: " << szName << "=Null" << std::endl;
} else {
TCollection_AsciiString entry; TDF_Tool::Entry(lbl, entry);
std::string imp = (lbl.IsImported() ? "import" : "noimp");
std::string modif = (lbl.MayBeModified() ? "modif" : "nomodif");
int nAttr = (lbl.HasAttribute() ? lbl.NbAttributes() : 0);
int nChild = (lbl.HasChild() ? lbl.NbChildren() : 0);
DLOG << "[Label]: " << szName << "={" << entry << " state=[" << imp << "|" << modif << "] nAttr=" << nAttr << " nChild=" << nChild << (nChild > 0 || nAttr > 0 ? "" : "}") << std::endl;
if (nAttr > 0) {
// Dump all attributes
for (TDF_AttributeIterator itr(lbl); itr.More(); itr.Next()) {
Handle(TDF_Attribute) attr = itr.Value();
SHOW(attr);
}
}
if (nChild > 0) {
TDF_Label child;
for (TDF_ChildIterator it(lbl); it.More(); it.Next()) {
child = it.Value();
SHOW(child);
}
}
if (nAttr > 0 || nChild > 0) {
MSGEL("}");
}
}
}
catch (...) { }
}
//==========================================================================
static void DumpVar(const char *szName, const TopoDS_Shape &aShape) {
if (aShape.IsNull()) {
DLOG << "[TopShp]: " << szName << "=Null" << std::endl;
} else {
std::string typ = ShapeTypeStr(aShape);
DLOG << "[TopShp]: " << szName << "=" << aShape.TShape().get() << " ShapeType=" << typ;
if (aShape.ShapeType() == TopAbs_COMPOUND) {
int children[TopAbs_SHAPE+1] = {0};
int nbChild = 0;
for (TopoDS_Iterator Iter(aShape); Iter.More(); Iter.Next()) {
if (!Iter.Value().IsNull()) {
children[(int)Iter.Value().ShapeType()]++;
nbChild++;
}
}
DLOG << " NumChild=" << nbChild;
if (nbChild > 0) {
bool bFirst = true;
DLOG << " (";
for (int i=TopAbs_COMPOUND; i<TopAbs_SHAPE; i++) {
if (children[i] > 0) {
if (!bFirst) DLOG << ", ";
DLOG << children[i] << " " << TopAbs::ShapeTypeToString((TopAbs_ShapeEnum)i);
bFirst = false;
}
}
DLOG << ")";
}
}
else if (aShape.ShapeType() == TopAbs_COMPSOLID) {
DLOG << " NumChild=" << aShape.NbChildren();
}
DLOG << std::endl;
}
}
#endif // MBOCC_H