#include <Basics_OCCTVersion.hxx>
+//---------------------------------------------------------
+#define USE_DEBUG
+//#define MB_IGNORE_QT
+#define MBCLASSNAME "GEOMGUI_OCCSelector"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
//================================================================
// Function : GEOMGUI_OCCSelector
// Purpose :
GEOMGUI_OCCSelector::GEOMGUI_OCCSelector( OCCViewer_Viewer* viewer, SUIT_SelectionMgr* mgr )
: LightApp_OCCSelector( viewer, mgr )
{
+ DBG_FUN();
}
//================================================================
//================================================================
GEOMGUI_OCCSelector::~GEOMGUI_OCCSelector()
{
+ DBG_FUN();
}
//================================================================
//================================================================
void GEOMGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
{
+ DBG_FUN();
OCCViewer_Viewer* vw = viewer();
if (!vw)
return;
//================================================================
void GEOMGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList )
{
+ DBG_FUN();
OCCViewer_Viewer* vw = viewer();
if ( !vw || !vw->isSelectionEnabled())
return;
// VTK Includes
#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 ) { \
if ( dm == AIS_WireFrame ) \
str = QString( "Wireframe" ); \
GEOMGUI_Selection::GEOMGUI_Selection()
: LightApp_Selection()
{
+ DBG_FUN();
}
GEOMGUI_Selection::~GEOMGUI_Selection()
{
+ DBG_FUN();
}
void GEOMGUI_Selection::init( const QString& context, LightApp_SelectionMgr* selMgr )
{
+ DBG_FUN();
+ ARG(context);
LightApp_Selection::init( context, selMgr );
myObjects.resize( count() );
//QVariant GEOMGUI_Selection::contextParameter( const QString& p ) const
QVariant GEOMGUI_Selection::parameter( const QString& p ) const
{
+ DBG_FUN();
+ ARG(p);
QVariant v;
if ( p == "isOCC" )
v = activeViewType() == OCCViewer_Viewer::Type();
//QVariant GEOMGUI_Selection::objectParameter( 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;
if ( p == "type" )
v = typeName( idx );
// the method to skip temporary objects from selection (called from LightApp)
bool GEOMGUI_Selection::processOwner( const LightApp_DataOwner* theOwner )
{
+ DBG_FUN();
if ( theOwner->entry().contains( GEOMGUI_AnnotationMgr::GetEntrySeparator() ) ) {
myAnnotationEntries.append( theOwner->entry() );
}
#include <Image_SupportedFormats.hxx>
#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 it is undefined, autocolor feature works for groups only
#define GENERAL_AUTOCOLOR
//================================================================
SUIT_SelectionFilter* GEOM_Displayer::getFilter( const int theMode )
{
+ DBG_FUN();
+ ARG(theMode);
SUIT_SelectionFilter* aFilter;
int aTopAbsMode = getTopAbsMode( theMode );
//================================================================
SUIT_SelectionFilter* GEOM_Displayer::getComplexFilter( const QList<int>* aSubShapes)
{
+ DBG_FUN();
GEOM_CompoundFilter* aFilter = 0;
if(aSubShapes != NULL ) {
GEOM_Displayer::GEOM_Displayer()
: myUpdateColorScale(true), myIsRedisplayed( false )
{
+ DBG_FUN();
SUIT_Session* session = SUIT_Session::session();
myApp = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
//=================================================================
GEOM_Displayer::~GEOM_Displayer()
{
+ DBG_FUN();
}
//=================================================================
const bool updateViewer,
SALOME_View* theViewFrame )
{
+ DBG_FUN();
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
if ( vf )
{
//=================================================================
void GEOM_Displayer::Display( GEOM::GEOM_BaseObject_ptr theObj, const bool updateViewer )
{
+ DBG_FUN();
if ( theObj->_is_nil() )
return;
const bool updateViewer,
SALOME_View* theViewFrame )
{
+ DBG_FUN();
if ( theIO.IsNull() )
return;
const bool updateViewer,
SALOME_View* theViewFrame)
{
+ DBG_FUN();
std::string entry = getEntry( theObj );
if ( entry != "" )
{
const bool updateViewer,
const bool checkActiveViewer )
{
+ DBG_FUN();
bool aRedisplayed = myIsRedisplayed;
myIsRedisplayed = true;
// Remove the object permanently (<forced> == true)
const bool theUpdateViewer,
SALOME_View* theViewFrame )
{
+ DBG_FUN();
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
if ( !vf )
{
//=================================================================
void GEOM_Displayer::Display( const SALOME_ListIO& theIOList, const bool updateViewer )
{
+ DBG_FUN();
SALOME_ListIteratorOfListIO Iter( theIOList );
for ( ; Iter.More(); Iter.Next() ) {
Display( Iter.Value(), false );
void GEOM_Displayer::UpdateVisibility( SALOME_View* v, const SALOME_Prs* p, bool on )
{
+ DBG_FUN();
+ ARG(on);
SalomeApp_Study* aStudy = getStudy();
int vId = -1;
if ( v ) vId = getViewManagerId( v );
void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShape, bool create )
{
+ DBG_FUN();
// check that shape is not null
if ( AISShape.IsNull() ) return;
void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create )
{
+ DBG_FUN();
// check that actor is not null
if ( !actor ) return;
SALOME_OCCPrs* thePrs,
const gp_Ax3& theShapeLCS )
{
+ DBG_FUN();
SalomeApp_Study* aStudy = getStudy();
if ( !aStudy )
{
const bool forced,
const bool updateViewer )
{
+ DBG_FUN();
SALOME_ListIteratorOfListIO Iter( theIOList );
for ( ; Iter.More(); Iter.Next() )
Erase( Iter.Value(), forced, false );
const bool updateViewer,
const bool checkActiveViewer )
{
+ DBG_FUN();
SALOME_ListIteratorOfListIO Iter( theIOList );
for ( ; Iter.More(); Iter.Next() )
Redisplay( Iter.Value(), false, checkActiveViewer );
const bool theUpdateViewer,
SALOME_View* theViewFrame )
{
+ DBG_FUN();
SALOME_ListIteratorOfListIO anIter( theIOList );
for ( ; anIter.More(); anIter.Next() )
{
//=================================================================
void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
{
+ DBG_FUN();
SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( prs );
SalomeApp_Study* study = getStudy();
//=================================================================
void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
{
+ DBG_FUN();
SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
SalomeApp_Study* study = getStudy();
//=================================================================
SALOME_Prs* GEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj )
{
+ DBG_FUN();
if ( theObj->_is_nil() )
return 0;
//=================================================================
SALOME_Prs* GEOM_Displayer::BuildPrs( const TopoDS_Shape& theShape )
{
+ DBG_FUN();
myViewFrame = GetActiveView();
if ( theShape.IsNull() || myViewFrame == 0 )
return 0;
SALOME_Prs* GEOM_Displayer::buildPresentation( const QString& entry,
SALOME_View* theViewFrame )
{
+ DBG_FUN();
+ ARG(entry);
SALOME_Prs* prs = 0;
internalReset();
const QString& entry,
SALOME_View* theViewFrame)
{
+ DBG_FUN();
+ ARG(aShape);
+ ARG(entry);
SALOME_Prs* prs = 0;
internalReset();
//=================================================================
void GEOM_Displayer::internalReset()
{
+ DBG_FUN();
myIO.Nullify();
myShape.Nullify();
//=================================================================
void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& theIO, const std::list<int> modes )
{
+ DBG_FUN();
SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( !app )
//=================================================================
void GEOM_Displayer::LocalSelection( const Handle(SALOME_InteractiveObject)& theIO, const int theMode )
{
+ DBG_FUN();
std::list<int> modes;
modes.push_back( theMode );
LocalSelection( theIO, modes );
//=================================================================
void GEOM_Displayer::GlobalSelection( const int theMode, const bool update )
{
+ DBG_FUN();
+ ARG(theMode);
+ ARG(update);
TColStd_MapOfInteger aModes;
aModes.Add( theMode );
GlobalSelection( aModes, update );
void GEOM_Displayer::GlobalSelection( const TColStd_MapOfInteger& theModes,
const bool update, const QList<int>* theSubShapes )
{
+ DBG_FUN();
SUIT_Session* session = SUIT_Session::session();
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
if ( !app )
//=================================================================
void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const std::list<int> modes )
{
+ DBG_FUN();
SALOME_ListIteratorOfListIO Iter( theIOList );
for ( ; Iter.More(); Iter.Next() )
LocalSelection( Iter.Value(), modes );
//=================================================================
void GEOM_Displayer::LocalSelection( const SALOME_ListIO& theIOList, const int theMode )
{
+ DBG_FUN();
+ ARG(theMode);
std::list<int> modes;
modes.push_back( theMode );
LocalSelection( theIOList, modes );
//=================================================================
void GEOM_Displayer::BeforeDisplay( SALOME_View* v, const SALOME_OCCPrs* )
{
+ DBG_FUN();
SOCC_Viewer* vf = dynamic_cast<SOCC_Viewer*>( v );
if ( vf )
{
void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p )
{
+ DBG_FUN();
UpdateColorScale();
// visualize annotations for displayed presentation
void GEOM_Displayer::BeforeErase( SALOME_View* v, const SALOME_OCCPrs* p )
{
+ DBG_FUN();
LightApp_Displayer::BeforeErase( v, p );
releaseTextures( p );
}
void GEOM_Displayer::AfterErase( SALOME_View* v, const SALOME_OCCPrs* p )
{
+ DBG_FUN();
LightApp_Displayer::AfterErase( v, p );
UpdateColorScale();
//=================================================================
void GEOM_Displayer::SetColor( const int color )
{
+ DBG_FUN();
+ ARG2(color,DWORD);
if ( color == -1 )
UnsetColor();
else
//=================================================================
double GEOM_Displayer::SetTransparency( const double transparency )
{
+ DBG_FUN();
double prevTransparency = myTransparency;
myTransparency = transparency;
return prevTransparency;
//=================================================================
void GEOM_Displayer::clearTemporary( LightApp_SelectionMgr* theSelMgr )
{
+ DBG_FUN();
SALOME_ListIO selected, toSelect;
theSelMgr->selectedObjects( selected );
void GEOM_Displayer::SetName( const char* theName )
{
+ DBG_FUN();
+ ARG(theName);
myName = theName;
}
void GEOM_Displayer::UnsetName()
{
+ DBG_FUN();
myName = "";
}
void GEOM_Displayer::setShape( const TopoDS_Shape& theShape )
{
+ DBG_FUN();
+ ARG(theShape);
myShape = theShape;
}
const double theFieldStepRangeMin,
const double theFieldStepRangeMax )
{
+ DBG_FUN();
myFieldDataType = theFieldDataType;
myFieldDimension = theFieldDimension;
myFieldStepData = theFieldStepData;
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() );
//if ( ! GeometryGUI::IsInGeomComponent( anObj )) return false;
- GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of GEOM objects
- GEOM::GEOM_FieldStep_var aFieldStepObj = GEOM::GEOM_FieldStep::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of GEOM field steps
- GEOM::GEOM_Gen_var aCompObj = GEOM::GEOM_Gen::_narrow(GeometryGUI::ClientSObjectToObject(anObj)); // enable displaying of whole GEOM component
- return ( !CORBA::is_nil( aGeomObj ) || !CORBA::is_nil( aFieldStepObj ) || !CORBA::is_nil( aCompObj ) ) &&
+ CORBA::Object_var anOrbObj = GeometryGUI::ClientSObjectToObject(anObj);
+ bool isCorbaObj = (!CORBA::is_nil(anOrbObj));
+ GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(anOrbObj); // enable displaying of GEOM objects
+ GEOM::GEOM_FieldStep_var aFieldStepObj = GEOM::GEOM_FieldStep::_narrow(anOrbObj); // enable displaying of GEOM field steps
+ GEOM::GEOM_Gen_var aCompObj = GEOM::GEOM_Gen::_narrow(anOrbObj); // enable displaying of whole GEOM component
+ bool isGeomObj = (!CORBA::is_nil( aGeomObj ) || !CORBA::is_nil( aFieldStepObj ) || !CORBA::is_nil( aCompObj ));
+ bool ret = ( isGeomObj ) &&
(viewer_type == SOCC_Viewer::Type() || viewer_type == SVTK_Viewer::Type());
+ MSGEL("..... --> isCorbaObj=" << YesNo(isCorbaObj) << ", isGeomObj=" << YesNo(isGeomObj) << ", canBeDisp=" << YesNo(ret));
+ return ret;
}
int GEOM_Displayer::SetDisplayMode( const int theMode )
{
+ DBG_FUN();
+ ARG(theMode);
int aPrevMode = myDisplayMode;
if ( theMode != -1 ) {
myDisplayMode = theMode;
int GEOM_Displayer::UnsetDisplayMode()
{
+ DBG_FUN();
int aPrevMode = myDisplayMode;
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
myDisplayMode = resMgr->integerValue( "Geometry", "display_mode", 0 );
void GEOM_Displayer::EraseWithChildren(const Handle(SALOME_InteractiveObject)& theIO,
const bool eraseOnlyChildren)
{
+ DBG_FUN();
LightApp_DataObject* parent = getStudy()->findObjectByEntry(theIO->getEntry());
if( !parent)
void GEOM_Displayer::UpdateColorScale()
{
+ DBG_FUN();
if ( !myUpdateColorScale )
return;
bool GEOM_Displayer::SetUpdateColorScale( bool toUpdate ) // IPAL54049
{
+ DBG_FUN();
bool previous = myUpdateColorScale;
myUpdateColorScale = toUpdate;
if ( myUpdateColorScale && !previous )
#include "GEOM_version.h"
#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" {
Standard_EXPORT CAM_Module* createModule() {
+ DBG_FUNC();
return new GeometryGUI();
}
GEOM::GEOM_Gen_var GeometryGUI::GetGeomGen()
{
+ DBG_FUNC();
// Bug 12290: exception in Mesh GUI on GEOMBase::GetShape() if Geometry GUI hasn't been loaded
if (CORBA::is_nil(myComponentGeom))
InitGeomGen();
bool GeometryGUI::InitGeomGen()
{
+ DBG_FUNC();
GeometryGUI aGG;
if ( CORBA::is_nil( myComponentGeom ) ) return false;
return true;
//=======================================================================
GeometryGUI::GeometryGUI() : SalomeApp_Module( "GEOM" )
{
+ DBG_FUN();
if ( CORBA::is_nil( myComponentGeom ) )
{
SALOME_NamingService_Abstract *ns = SalomeApp_Application::namingService();
//=======================================================================
GeometryGUI::~GeometryGUI()
{
+ DBG_FUN();
while (!myOCCSelectors.isEmpty())
delete myOCCSelectors.takeFirst();
typedef GEOMGUI* (*LibraryGUI)( GeometryGUI* );
GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName )
{
+ DBG_FUN();
+ ARG(libraryName);
if ( !myGUIMap.contains( libraryName ) ) {
// try to load library if it is not loaded yet
#if defined(WIN32)
typedef GEOMPluginGUI* (*PluginLibraryGUI)( GeometryGUI* );
GEOMPluginGUI* GeometryGUI::getPluginLibrary( const QString& libraryName )
{
+ DBG_FUN();
+ ARG(libraryName);
if ( !myGUIMap.contains( libraryName ) ) {
// try to load library if it is not loaded yet
//=======================================================================
void GeometryGUI::ActiveWorkingPlane()
{
+ DBG_FUN();
gp_Dir DZ = myWorkingPlane.Direction();
gp_Dir DY = myWorkingPlane.YDirection();
//=======================================================================
void GeometryGUI::SetActiveDialogBox( QDialog* aDlg )
{
+ DBG_FUN();
myActiveDialogBox = (QDialog*)aDlg;
}
//=======================================================================
void GeometryGUI::OnGUIEvent()
{
+ DBG_FUN();
const QObject* obj = sender();
if ( !obj || !obj->inherits( "QAction" ) )
return;
//=======================================================================
void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
{
+ DBG_FUN();
+ ARG(id);
SUIT_Application* anApp = application();
if (!anApp) return;
SUIT_Desktop* desk = anApp->desktop();
#else
bool ViewDep = 0;
#endif
+ MSGEL("....Flags: " << X_(ViewOCC) << " " << X_(ViewVTK) << " " << X_(ViewDep));
// 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)
QList<int> NotViewerDependentCommands;
//=================================================================================
bool GeometryGUI::activateOperation( int actionId )
{
+ DBG_FUN();
OnGUIEvent(actionId);
return true;
}
//=================================================================================
bool GeometryGUI::activateOperation( const QString& actionId )
{
+ DBG_FUN();
+ ARG(actionId);
bool isOk = false;
int id = actionId.toInt(&isOk);
//=================================================================================
bool GeometryGUI::activateOperation( const QString& actionId, const QString& plugin )
{
+ DBG_FUN();
+ ARG(actionId);
+ ARG(plugin);
bool isOk = false;
QString pluginLib = plugin;
void GeometryGUI::createGeomAction( const int id, const QString& label, const QString& icolabel,
const int accel, const bool toggle, const QString& shortcutAction )
{
+ DBG_FUN();
+ ARG(id);
+ ARG(label);
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
QPixmap icon = icolabel.isEmpty() ? resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+label).toLatin1().constData() ), false )
: resMgr->loadPixmap( "GEOM", tr( icolabel.toLatin1().constData() ) );
//=======================================================================
void GeometryGUI::createOriginAndBaseVectors()
{
+ DBG_FUN();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked();
if ( aLocked ) {
//=======================================================================
void GeometryGUI::initialize( CAM_Application* app )
{
+ DBG_FUN();
SalomeApp_Module::initialize( app );
// ----- create actions --------------
//=======================================================================
void GeometryGUI::addPluginActions()
{
+ DBG_FUN();
// Resource manager
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
if (!resMgr) return;
//=======================================================================
bool GeometryGUI::activateModule( SUIT_Study* study )
{
+ DBG_FUN();
// Fill in: Help Panel
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( application() );
app->infoPanel()->setTitle(tr("INFO_WELCOME_TO_GEOM"));
//=======================================================================
bool GeometryGUI::deactivateModule( SUIT_Study* study )
{
+ DBG_FUN();
QMenu* viewMenu = menuMgr()->findMenu( STD_Application::MenuViewId );
if ( viewMenu )
disconnect( viewMenu, SIGNAL( aboutToShow() ), this, SLOT( onViewAboutToShow() ) );
//=======================================================================
void GeometryGUI::onWindowActivated( SUIT_ViewWindow* win )
{
+ DBG_FUN();
if ( !win )
return;
void GeometryGUI::onViewManagerAdded( SUIT_ViewManager* vm )
{
+ DBG_FUN();
+ if (vm) { SHOW(vm->getType()); }
if ( vm && vm->getType() == OCCViewer_Viewer::Type() )
{
qDebug( "connect" );
void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm )
{
+ DBG_FUN();
+ if (vm) { SHOW(vm->getType()); }
SUIT_ViewModel* viewer = vm->getViewModel();
if ( vm->getType() == OCCViewer_Viewer::Type() )
{
void GeometryGUI::updateCreationInfo()
{
+ DBG_FUN();
if ( myCreationInfoWdg )
myCreationInfoWdg->clear();
void GeometryGUI::onAutoBringToFront()
{
+ DBG_FUN();
bool isAutoBringToFront = SUIT_Session::session()->resourceMgr()->booleanValue( "Geometry", "auto_bring_to_front", "false" );
if( !isAutoBringToFront )
return;
LightApp_Selection* GeometryGUI::createSelection() const
{
+ DBG_FUN();
return new GEOMGUI_Selection();
}
void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
{
+ DBG_FUN();
+ ARG(client);
SalomeApp_Module::contextMenuPopup( client, menu, title );
SALOME_ListIO lst;
getApp()->selectionMgr()->selectedObjects( lst );
void GeometryGUI::OnSetMaterial(const QString& theName)
{
+ DBG_FUN();
+ ARG(theName);
OnGUIEvent( GEOMOp::OpPredefMaterial, QVariant( theName ) );
}
void GeometryGUI::createPreferences()
{
+ DBG_FUN();
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
LightApp_Displayer* GeometryGUI::displayer()
{
+ DBG_FUN();
if ( !myDisplayer )
myDisplayer = new GEOM_Displayer();
return myDisplayer;
void GeometryGUI::setLocalSelectionMode(const int mode)
{
+ DBG_FUN();
+ ARG(mode);
myLocalSelectionMode = mode;
}
*/
void GeometryGUI::storeVisualParameters (int savePoint)
{
+ DBG_FUN();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
if ( !appStudy || !appStudy->studyDS() )
return;
*/
void GeometryGUI::restoreVisualParameters (int savePoint)
{
+ DBG_FUN();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
if (!appStudy || !appStudy->studyDS())
return;
// Compute current name mode of the viewer
void UpdateNameMode( SalomeApp_Application* app )
{
+ DBG_FUNC();
bool isMode = false;
SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
SUIT_ViewWindow* viewWindow = app->desktop()->activeWindow();
void GeometryGUI::onViewAboutToShow()
{
+ DBG_FUN();
SUIT_ViewWindow* window = application()->desktop()->activeWindow();
QAction* a = action( GEOMOp::OpSwitchVectors );
QAction* aVerticesAction = action( GEOMOp::OpSwitchVertices );
*/
void GeometryGUI::message(const QString& msg)
{
+ DBG_FUNC();
+ ARG(msg);
// dispatch message
QStringList data = msg.split("/");
const int nbStrings = data.count();
*/
void GeometryGUI::ClearShapeBuffer( GEOM::GEOM_Object_ptr theObj )
{
+ DBG_FUNC();
if ( CORBA::is_nil( theObj ) )
return;
*/
bool GeometryGUI::renameObject( const QString& entry, const QString& name)
{
+ DBG_FUN();
+ ARG(entry);
+ ARG(name);
bool result = false;
SalomeApp_Application* app =
void GeometryGUI::updateMaterials()
{
+ DBG_FUN();
LightApp_Preferences* pref = preferences();
if ( pref ) {
QStringList materials = Material_ResourceMgr::resourceMgr()->materials();
void GeometryGUI::dropObjects( const DataObjectList& what, SUIT_DataObject* where,
const int row, Qt::DropAction action )
{
+ DBG_FUN();
if (action != Qt::CopyAction && action != Qt::MoveAction)
return; // unsupported action
--- /dev/null
+#ifndef MBDebug_HeaderFile\r
+#define MBDebug_HeaderFile\r
+\r
+//---------------------------------------------------------------\r
+// Usage of the logging facilities:\r
+//\r
+// (1) At the beginning of each class file to be debugged, there\r
+// should be a static string variable defined with the name\r
+// of the class. Then, include the "MBDebug.h" header file.\r
+//\r
+// //---------------------------------------------------------\r
+// #define USE_DEBUG\r
+// //#define MB_IGNORE_QT\r
+// #define MBCLASSNAME "ClassName"\r
+// #include "MBDebug.h"\r
+// //---------------------------------------------------------\r
+//\r
+// (2) At the beginning of each class method, call the DBG_FUN\r
+// macro.\r
+//\r
+// int ClassName::MyMethod(int x)\r
+// {\r
+// DBG_FUN();\r
+// ...\r
+// }\r
+//\r
+// NOTE: For static methods, call the DBG_FUNC() macro!!\r
+//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\r
+// This debugging/logging class is a "header-only" solution and\r
+// does NOT require any additional implementation (.cpp) file!\r
+//---------------------------------------------------------------\r
+\r
+#include <iostream>\r
+#include <string>\r
+#include <locale>\r
+#include <codecvt>\r
+#include <list>\r
+#include <map>\r
+#include <set>\r
+#include <vector>\r
+#ifndef MB_IGNORE_QT\r
+# include <qstring.h>\r
+#endif\r
+\r
+//---------------------------------------------------------------\r
+// Set the debug flags dependent on the preprocessor definitions\r
+//---------------------------------------------------------------\r
+#ifdef USE_DEBUG\r
+# define MBS_DEBUG_FLAG MBDebug::DF_DEBUG\r
+#else\r
+# define MBS_DEBUG_FLAG 0\r
+#endif /*DEBUG*/ \r
+\r
+#define MBS_DBG_FLAGS (MBS_DEBUG_FLAG)\r
+\r
+\r
+//---------------------------------------------------------------\r
+// Define the global debug macros\r
+//---------------------------------------------------------------\r
+#define DLOG MBDebug::LogPrint()\r
+#define RETURN(var) { RET(var); return (var); }\r
+\r
+#ifdef USE_DEBUG\r
+\r
+# define DBG_FUN() MBDebug _dbg(MBCLASSNAME, __FUNCTION__, MBS_DBG_FLAGS, (void*)this)\r
+# define DBG_FUNC() MBDebug _dbg(MBCLASSNAME, __FUNCTION__, MBS_DBG_FLAGS)\r
+# define DBG_FUNB(blk) MBDebug _dbg(MBCLASSNAME, blk, MBS_DBG_FLAGS)\r
+# define MSGEL(txt) MBDebug::LogPrint() << txt << std::endl\r
+# define PRINT(txt) MBDebug::LogPrint() << txt\r
+# define SHOW2(var,typ) DumpVar(#var,(typ)(var))\r
+# define SHOW(var) DumpVar(#var,var)\r
+# define ARG(var) do { PRINT("in:"); DumpVar(#var,var); } while (0)\r
+# define ARG2(var,typ) do { PRINT("in:"); DumpVar(#var,(typ)(var)); } while (0)\r
+# define RET(var) do { PRINT("out:"); DumpVar(#var,var); } while (0)\r
+# define MSG(txt) MBDebug::LogPrint() << txt\r
+\r
+#else /*!USE_DEBUG*/ \r
+\r
+# define DBG_FUN()\r
+# define DBG_FUNC()\r
+# define DBG_FUNB(blk)\r
+# define MSGEL(txt)\r
+# define PRINT(txt)\r
+# define SHOW2(var,typ)\r
+# define SHOW(var)\r
+# define ARG(var)\r
+# define ARG2(var,typ)\r
+# define RET(var)\r
+# define MSG(txt)\r
+\r
+#endif /*USE_DEBUG*/ \r
+\r
+\r
+//---------------------------------------------------------------\r
+// Declare the debugging and profiling class\r
+//---------------------------------------------------------------\r
+class MBDebug\r
+{\r
+public:\r
+ enum {\r
+ DF_NONE = 0x00, // no debug\r
+ DF_DEBUG = 0x01 // debug a function\r
+ };\r
+\r
+ MBDebug(const char* aClassName, const char* aFuncName, const short aFlag, void* aThis=NULL)\r
+ :mClassName(aClassName),mFuncName(aFuncName),mThis(aThis),mFlags((unsigned char)aFlag)\r
+ {\r
+ if (mFlags & (DF_DEBUG))\r
+ {\r
+ std::cout << "{ENTER: " << mClassName + "::" + mFuncName;\r
+ if (mThis) std::cout << "(this=" << mThis << ")";\r
+ std::cout << std::endl;\r
+ }\r
+ }\r
+ virtual ~MBDebug()\r
+ {\r
+ if (mFlags & (DF_DEBUG))\r
+ std::cout << "}LEAVE: " << mClassName << "::" << mFuncName << std::endl;\r
+ }\r
+\r
+ // Log file output management\r
+ static std::ostream& LogPrint() { return std::cout; }\r
+\r
+private:\r
+ std::string mClassName; // Name of class to be debugged\r
+ std::string mFuncName; // Name of function to be debugged\r
+ void* mThis; // The "this" pointer to the class being debugged\r
+ unsigned char mFlags; // Debug mode flags\r
+};\r
+\r
+\r
+\r
+#define YesNo(b) (b ? "Yes" : "No")\r
+#define X_(b) (b ? "[x] " #b : "[ ] " #b)\r
+\r
+\r
+\r
+inline std::string w2s(std::wstring ws)\r
+{\r
+ using convert_typeX = std::codecvt_utf8<wchar_t>;\r
+ std::wstring_convert<convert_typeX, wchar_t> converterX;\r
+ return(converterX.to_bytes(ws));\r
+}\r
+\r
+// Primitive types\r
+inline void DumpVar(const char *szName, char value)\r
+{\r
+ DLOG << "[chr]: " << szName << "='" << value << "'" << std::endl;\r
+}\r
+\r
+inline void DumpVar(const char *szName, bool value)\r
+{\r
+ DLOG << "[bool]: " << szName << "=" << (value ? "true" : "false") << std::endl;\r
+}\r
+\r
+inline void DumpVar(const char *szName, short value)\r
+{\r
+ DLOG << "[shrt]: " << szName << "=" << value << std::endl;\r
+}\r
+\r
+inline void DumpVar(const char *szName, int value)\r
+{\r
+ DLOG << "[int]: " << szName << "=" << value << std::endl;\r
+}\r
+\r
+inline void DumpVar(const char *szName, long value)\r
+{\r
+ DLOG << "[long]: " << szName << "=" << value << std::endl;\r
+}\r
+\r
+inline void DumpVar(const char *szName, double value)\r
+{\r
+ DLOG << "[dbl]: " << szName << "=" << value << std::endl;\r
+}\r
+\r
+inline void DumpVar(const char *szName, unsigned char value)\r
+{\r
+ DLOG << "[byte]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
+}\r
+\r
+inline void DumpVar(const char *szName, unsigned short value)\r
+{\r
+ DLOG << "[word]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
+}\r
+\r
+inline void DumpVar(const char *szName, unsigned int value)\r
+{\r
+ DLOG << "[uint]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
+}\r
+\r
+inline void DumpVar(const char *szName, unsigned long value)\r
+{\r
+ DLOG << "[dword]: " << szName << "=0x" << std::hex << value << std::dec << std::endl;\r
+}\r
+\r
+inline void DumpVar(const char *szName, const char* value)\r
+{\r
+ DLOG << "[str]: " << szName << "=\"" << (value ? value : "") << "\"" << std::endl;\r
+}\r
+\r
+inline void DumpVar(const char *szName, const std::string &value)\r
+{\r
+ DLOG << "[Str]: " << szName << "=\"" << value << "\"" << std::endl;\r
+}\r
+\r
+inline void DumpVar(const char *szName, const std::wstring &value)\r
+{\r
+ DLOG << "[WStr]: " << szName << "=\"" << w2s(value) << "\"" << std::endl;\r
+}\r
+\r
+#ifndef MB_IGNORE_QT\r
+inline void DumpVar(const char *szName, const QString &value)\r
+{\r
+ DLOG << "[QStr]: " << szName << "=\"" << value.toStdString() << "\"" << std::endl;\r
+}\r
+#endif\r
+\r
+inline void DumpVar(const char *szName, const void* value)\r
+{\r
+ DLOG << "[ptr]: " << szName << "=" << value << std::endl;\r
+}\r
+\r
+\r
+// Collection of primitive types\r
+inline void DumpVar(const char *szName, const std::set<int> &values)\r
+{\r
+ DLOG << "[intSet]: " << szName << "={" << values.size() << "}[";\r
+ bool bFirst = true;\r
+ for (auto it=values.cbegin(); it!=values.cend(); ++it)\r
+ DLOG << (bFirst ? "" : ",") << *it;\r
+ DLOG << "]" << std::endl;\r
+}\r
+\r
+inline void DumpVar(const char *szName, const std::list<bool>& values)\r
+{\r
+ DLOG << "[boolList]: " << szName << "={" << values.size() << "}[";\r
+ bool bFirst = true;\r
+ for (auto it=values.cbegin(); it!=values.cend(); ++it)\r
+ DLOG << (bFirst ? "" : ",") << (*it ? "Y" : "N");\r
+ DLOG << "]" << std::endl;\r
+}\r
+\r
+\r
+#endif // MBDebug_HeaderFile\r
+\r
--- /dev/null
+#ifndef MBOCC_H\r
+#define MBOCC_H\r
+\r
+#include <iostream>\r
+#include <locale>\r
+#include <codecvt>\r
+#include <chrono>\r
+\r
+#include <TDataStd_AsciiString.hxx>\r
+#include <TDataStd_BooleanArray.hxx>\r
+#include <TDataStd_BooleanList.hxx>\r
+#include <TDataStd_ByteArray.hxx>\r
+#include <TDataStd_Comment.hxx>\r
+#include <TDataStd_ExtStringArray.hxx>\r
+#include <TDataStd_ExtStringList.hxx>\r
+#include <TDataStd_Integer.hxx>\r
+#include <TDataStd_IntegerArray.hxx>\r
+#include <TDataStd_IntegerList.hxx>\r
+#include <TDataStd_Name.hxx>\r
+#include <TDataStd_Real.hxx>\r
+#include <TDataStd_RealArray.hxx>\r
+#include <TDataStd_RealList.hxx>\r
+#include <TDataStd_ReferenceArray.hxx>\r
+#include <TDataStd_ReferenceList.hxx>\r
+#include <TDataStd_Relation.hxx>\r
+#include <TDataStd_UAttribute.hxx>\r
+#include <TDataStd_Variable.hxx>\r
+#include <TDF_AttributeIterator.hxx>\r
+#include <TDF_ChildIterator.hxx>\r
+#include <TDF_ChildIDIterator.hxx>\r
+#include <TDF_Reference.hxx>\r
+#include <TDF_TagSource.hxx>\r
+#include <TDF_Tool.hxx>\r
+#include <TNaming_NamedShape.hxx>\r
+#include <TNaming_Iterator.hxx>\r
+#include <BRepTools.hxx>\r
+#include <TopoDS_Shape.hxx>\r
+#include <TopExp_Explorer.hxx>\r
+\r
+\r
+\r
+//--------------------------------------------------------------------------\r
+// Function declarations\r
+//--------------------------------------------------------------------------\r
+static std::string ShapeTypeStr(const TopoDS_Shape shp);\r
+static std::string EvolutionStr(const TNaming_Evolution evol);\r
+\r
+static void DumpEvolution(Handle(TNaming_NamedShape) aNS);\r
+static void DumpShapeHistory(const TDF_Label& theLabel, const TopoDS_Shape& theShape);\r
+\r
+static void DumpVar(const char *szName, Handle(TNaming_NamedShape) aNS);\r
+static void DumpVar(const char *szName, Handle(TDF_Attribute) aAttr);\r
+static void DumpVar(const char *szName, const TDF_Label &lbl);\r
+static void DumpVar(const char *szName, const TopoDS_Shape &aShape);\r
+\r
+\r
+\r
+\r
+\r
+//==========================================================================\r
+static std::string ShapeTypeStr(const TopoDS_Shape shp) {\r
+ if (shp.IsNull())\r
+ return "null";\r
+\r
+ switch (shp.ShapeType()) {\r
+ case TopAbs_COMPOUND: return "COMPOUND";\r
+ case TopAbs_COMPSOLID: return "COMPSOLID";\r
+ case TopAbs_SOLID: return "SOLID";\r
+ case TopAbs_SHELL: return "SHELL";\r
+ case TopAbs_FACE: return "FACE";\r
+ case TopAbs_WIRE: return "WIRE";\r
+ case TopAbs_EDGE: return "EDGE";\r
+ case TopAbs_VERTEX: return "VERTEX";\r
+ case TopAbs_SHAPE: return "SHAPE";\r
+ }\r
+ return "??";\r
+}\r
+\r
+//==========================================================================\r
+static std::string EvolutionStr(const TNaming_Evolution evol) {\r
+ switch (evol) {\r
+ case TNaming_PRIMITIVE: return "PRIMITIVE";\r
+ case TNaming_GENERATED: return "GENERATED";\r
+ case TNaming_MODIFY: return "MODIFY";\r
+ case TNaming_DELETE: return "DELETE";\r
+ case TNaming_REPLACE: return "REPLACE";\r
+ case TNaming_SELECTED: return "SELECTED";\r
+ }\r
+ return "??";\r
+}\r
+\r
+//==========================================================================\r
+static void SaveShape(const TopoDS_Shape &shp, const char* szFileName) {\r
+ std::string fn("/home/bernhard/brep/");\r
+ std::chrono::high_resolution_clock::time_point now_t = std::chrono::high_resolution_clock::now();\r
+ unsigned long long now_c = *((unsigned long long*)&now_t);\r
+ fn = fn + std::to_string(now_c) + "_" + szFileName + ".brep";\r
+ MSGEL("...saving shape \"" << szFileName << "\"to [" << fn << "]");\r
+ BRepTools::Write(shp, fn.c_str());\r
+}\r
+\r
+//==========================================================================\r
+static void DumpChildren(const TDF_Label& aLabel) {\r
+ TDF_ChildIterator it;\r
+ //TCollection_AsciiString as;\r
+ for (it.Initialize(aLabel); it.More(); it.Next()) {\r
+ SHOW(it.Value());\r
+ DumpChildren(it.Value());\r
+ // TDF_Tool::Entry(it.Value(),as);\r
+ // MSGEL("* [Label]: child=" << as.ToCString());\r
+ }\r
+ }\r
+\r
+//==========================================================================\r
+static void DumpShapeHistory(const TDF_Label& theLabel, const TopoDS_Shape& theShape)\r
+{\r
+ SHOW(theLabel);\r
+ SHOW(theShape);\r
+ DLOG << "{-------ShapeHistory-------------------------" << std::endl;\r
+ TopoDS_Shape anOldShape; // old shape in the pair old shape->theShape in the named shape\r
+ TopoDS_Shape aShapeContainer; // old shape of the shape that contains theShape as sub-element\r
+ Handle(TNaming_NamedShape) aCandidatInThis, aCandidatContainer;\r
+ // use child and this label (the lowest priority)\r
+ TDF_ChildIDIterator aNSIter(theLabel, TNaming_NamedShape::GetID(), Standard_True);\r
+ bool aUseThis = !aNSIter.More();\r
+ while(anOldShape.IsNull() && (aNSIter.More() || aUseThis)) {\r
+ Handle(TNaming_NamedShape) aNS;\r
+ if (aUseThis) {\r
+ if (!theLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS))\r
+ break;\r
+ } else {\r
+ aNS = Handle(TNaming_NamedShape)::DownCast(aNSIter.Value());\r
+ }\r
+ for(TNaming_Iterator aShapesIter(aNS); aShapesIter.More(); aShapesIter.Next()) {\r
+ if (aShapesIter.Evolution() == TNaming_SELECTED || aShapesIter.Evolution() == TNaming_DELETE)\r
+ continue; // don't use the selection evolution\r
+\r
+ if (aShapesIter.NewShape().IsSame(theShape)) { // found the original shape\r
+ aCandidatInThis = aNS;\r
+ if (aCandidatInThis->Evolution() == TNaming_MODIFY) {\r
+ anOldShape = aShapesIter.OldShape();\r
+ MSG("* modified from: "); SHOW(anOldShape);\r
+ }\r
+ // otherwise may we searching for another item of this shape with longer history\r
+ if (!anOldShape.IsNull())\r
+ break;\r
+ }\r
+ // check that the shape contains theShape as sub-shape to fill container\r
+ if (aShapesIter.NewShape().ShapeType() < theShape.ShapeType() && aCandidatContainer.IsNull()) {\r
+ TopExp_Explorer anExp(aShapesIter.NewShape(), theShape.ShapeType());\r
+ for(; anExp.More(); anExp.Next()) {\r
+ if (theShape.IsSame(anExp.Current())) {\r
+ aCandidatContainer = aNS;\r
+ aShapeContainer = aShapesIter.NewShape();\r
+ }\r
+ }\r
+ }\r
+ }\r
+ // iterate to the next label or to the body label in the end\r
+ if (!aUseThis)\r
+ aNSIter.Next();\r
+ if (!aNSIter.More()) {\r
+ if (aUseThis)\r
+ break;\r
+ aUseThis = true;\r
+ }\r
+ }\r
+ DLOG << "}--------------------------------------------" << std::endl;\r
+}\r
+\r
+\r
+\r
+//==========================================================================\r
+static void DumpEvolution(Handle(TNaming_NamedShape) aNS) {\r
+ DLOG << "{";\r
+ // TNaming_Iterator iterates in reversed way than it was put in Builder, so, keep it in container\r
+ // and iterate from end to begin\r
+ NCollection_List<TopoDS_Shape> aOlds;\r
+ NCollection_List<TopoDS_Shape> aNews;\r
+ NCollection_List<TNaming_Evolution> aEvol;\r
+ for (TNaming_Iterator anIt(aNS); anIt.More(); anIt.Next()) {\r
+ aOlds.Prepend(anIt.OldShape());\r
+ aNews.Prepend(anIt.NewShape());\r
+ aEvol.Prepend(anIt.Evolution());\r
+ }\r
+ NCollection_List<TopoDS_Shape>::Iterator aOldIter(aOlds);\r
+ NCollection_List<TopoDS_Shape>::Iterator aNewIter(aNews);\r
+ NCollection_List<TNaming_Evolution>::Iterator aEvolIter(aEvol);\r
+ for(; aOldIter.More(); aOldIter.Next(), aNewIter.Next(), aEvolIter.Next()) {\r
+ switch (aEvolIter.Value()) {\r
+ case TNaming_PRIMITIVE :\r
+ DLOG << " * primitive " << ShapeTypeStr(aNewIter.Value()) << std::endl;\r
+ break;\r
+ case TNaming_GENERATED :\r
+ DLOG << " * generated from " << ShapeTypeStr(aOldIter.Value()) << " to " << ShapeTypeStr(aNewIter.Value()) << std::endl;\r
+ break;\r
+ case TNaming_MODIFY :\r
+ DLOG << " * modified from " << ShapeTypeStr(aOldIter.Value()) << " to " << ShapeTypeStr(aNewIter.Value()) << std::endl;\r
+ break;\r
+ case TNaming_DELETE :\r
+ DLOG << " * deleted " << ShapeTypeStr(aOldIter.Value()) << std::endl;\r
+ break;\r
+ case TNaming_SELECTED :\r
+ DLOG << " * selected in " << ShapeTypeStr(aNewIter.Value()) << " a(n) " << ShapeTypeStr(aOldIter.Value()) << std::endl;\r
+ break;\r
+ default:\r
+ break;\r
+ }\r
+ }\r
+ DLOG << "}" << std::endl;\r
+}\r
+\r
+//==========================================================================\r
+static void DumpVar(const char *szName, Handle(TNaming_NamedShape) aNS) {\r
+ if (aNS.IsNull()) {\r
+ DLOG << "[NamShp]: " << szName << "=Null" << std::endl;\r
+ return;\r
+ }\r
+ DLOG << "[NamShp]: " << szName << " vers=" << aNS->Version() << " Evol=[" << EvolutionStr(aNS->Evolution()) << "] Shape=\"" << ShapeTypeStr(aNS->Get()) << "\"" << std::endl;\r
+ //DumpEvolution(aNS);\r
+}\r
+\r
+//==========================================================================\r
+static void DumpVar(const char *szName, Handle(TDF_Attribute) attr) {\r
+ if (attr.IsNull()) {\r
+ DLOG << "[TDFAttr]: " << szName << "=Null" << std::endl;\r
+ return;\r
+ }\r
+ int trans = attr->Transaction();\r
+ std::string state(" state=[");\r
+ state = state + (attr->IsValid() ? "valid" : "invalid");\r
+ state = state + "|" + (attr->IsNew() ? "new" : "old");\r
+ state = state + "|" + (attr->IsForgotten() ? "forgot" : "known") + "]";\r
+ Handle(TDataStd_AsciiString) aAS = Handle(TDataStd_AsciiString)::DownCast(attr);\r
+ if (!aAS.IsNull()) {\r
+ DLOG << "[TDFAttr_AscStr]: " << szName << "=\"" << aAS->Get() << "\"" << " trans=" << trans << state << std::endl;\r
+ return;\r
+ }\r
+ Handle(TDataStd_BooleanArray) aBoolArr = Handle(TDataStd_BooleanArray)::DownCast(attr);\r
+ if (!aBoolArr.IsNull()) {\r
+ DLOG << "[TDFAttr_BoolArr]: " << szName << "=" << aBoolArr->Length() << " [";\r
+ if (aBoolArr->Length() > 0) {\r
+ for (int i=aBoolArr->Lower(); i<=aBoolArr->Upper(); i++) {\r
+ DLOG << (i == aBoolArr->Lower() ? "" : ",") << YesNo(aBoolArr->Value(i));\r
+ }\r
+ }\r
+ DLOG << "]" << " trans=" << trans << state << std::endl;\r
+ return;\r
+ }\r
+ Handle(TDataStd_BooleanList) aBoolLst = Handle(TDataStd_BooleanList)::DownCast(attr);\r
+ if (!aBoolLst.IsNull()) {\r
+ const TDataStd_ListOfByte& lst = aBoolLst->List();\r
+ DLOG << "[TDFAttr_BoolLst]: " << szName << "=" << lst.Size() << " [";\r
+ if (!lst.IsEmpty()) {\r
+ for (auto b=lst.cbegin(); b!=lst.cend(); ++b) {\r
+ DLOG << (b == lst.cbegin() ? "" : ",") << YesNo(*b);\r
+ }\r
+ }\r
+ DLOG << "]" << " trans=" << trans << state << std::endl;\r
+ return;\r
+ }\r
+ Handle(TDataStd_Comment) aCmt = Handle(TDataStd_Comment)::DownCast(attr);\r
+ if (!aCmt.IsNull()) {\r
+ DLOG << "[TDFAttr_Comment]: " << szName << "=\"" << aCmt->Get() << "\"" << " trans=" << trans << state << std::endl;\r
+ return;\r
+ }\r
+ Handle(TDataStd_ExtStringList) aESLst = Handle(TDataStd_ExtStringList)::DownCast(attr);\r
+ if (!aESLst.IsNull()) {\r
+ const TDataStd_ListOfExtendedString& lst = aESLst->List();\r
+ DLOG << "[TDFAttr_ExStrLst]: " << szName << "=" << lst.Size() << " [";\r
+ if (!lst.IsEmpty()) {\r
+ for (auto str=lst.cbegin(); str!=lst.cend(); ++str) {\r
+ //std::wstring ws((wchar_t*)(*str).ToExtString());\r
+ DLOG << (str == lst.cbegin() ? "" : ",") << "\"" << *str << "\"";\r
+ }\r
+ }\r
+ DLOG << "]" << " trans=" << trans << state << std::endl;\r
+ return;\r
+ }\r
+ Handle(TDataStd_Integer) aInt = Handle(TDataStd_Integer)::DownCast(attr);\r
+ if (!aInt.IsNull()) {\r
+ DLOG << "[TDFAttr_Int]: " << szName << "=" << aInt->Get() << " trans=" << trans << state << std::endl;\r
+ return;\r
+ }\r
+ Handle(TDataStd_IntegerArray) aIntArr = Handle(TDataStd_IntegerArray)::DownCast(attr);\r
+ if (!aIntArr.IsNull()) {\r
+ DLOG << "[TDFAttr_IntArr]: " << szName << "=" << aIntArr->Length() << " [";\r
+ if (aIntArr->Length() > 0) {\r
+ for (int i=aIntArr->Lower(); i<=aIntArr->Upper(); i++) {\r
+ DLOG << (i == aIntArr->Lower() ? "" : ",") << aIntArr->Value(i);\r
+ }\r
+ }\r
+ DLOG << "]" << " trans=" << trans << state << std::endl;\r
+ return;\r
+ }\r
+\r
+ Handle(TDataStd_Name) aNam = Handle(TDataStd_Name)::DownCast(attr);\r
+ if (!aNam.IsNull()) {\r
+ DLOG << "[TDFAttr_Name]: " << szName << "=\"" << aNam->Get() << "\"" << " trans=" << trans << state << std::endl;\r
+ return;\r
+ }\r
+ Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(attr);\r
+ if (!aNS.IsNull()) { \r
+ DLOG << "[TDFAttr_NamShp]: " << szName << "=\"" << ShapeTypeStr(aNS->Get()) << "\" trans=" << trans << state << std::endl;\r
+ DLOG << aNS;\r
+ TNaming_Iterator it(aNS);\r
+ for (; it.More(); it.Next()) {\r
+ MSGEL("[NamShp]: child: Modif=" << YesNo(it.IsModification()) << " Evol=[" << EvolutionStr(it.Evolution()) << "] Old=\"" << ShapeTypeStr(it.OldShape()) << "\" New=\""<< ShapeTypeStr(it.NewShape()) << "\"");\r
+ }\r
+ //SHOW(aNS);\r
+ return;\r
+ }\r
+ Handle(TDataStd_Real) aReal = Handle(TDataStd_Real)::DownCast(attr);\r
+ if (!aReal.IsNull()) {\r
+ DLOG << "[TDFAttr_Real]: " << szName << "=" << aReal->Get() << " trans=" << trans << state << std::endl;\r
+ return;\r
+ }\r
+ Handle(TDF_Reference) aRef = Handle(TDF_Reference)::DownCast(attr);\r
+ if (!aRef.IsNull()) {\r
+ TCollection_AsciiString entry;\r
+ TDF_Tool::Entry(aRef->Get(), entry);\r
+ DLOG << "[TDFAttr_Ref]: " << szName << "=" << entry << " trans=" << trans << state << std::endl;\r
+ return;\r
+ }\r
+ Handle(TDataStd_ReferenceArray) aRefArr = Handle(TDataStd_ReferenceArray)::DownCast(attr);\r
+ if (!aRefArr.IsNull()) {\r
+ DLOG << "[TDFAttr_RefArr]: " << szName << "=" << aRefArr->Length() << " [";\r
+ if (aRefArr->Length() > 0) {\r
+ TCollection_AsciiString entry;\r
+ for (int i=aRefArr->Lower(); i<=aRefArr->Upper(); i++) {\r
+ TDF_Tool::Entry(aRefArr->Value(i), entry);\r
+ DLOG << (i == aRefArr->Lower() ? "" : ",") << entry;\r
+ }\r
+ }\r
+ DLOG << "]" << " trans=" << trans << state << std::endl;\r
+ return;\r
+ }\r
+ Handle(TDataStd_ReferenceList) aRefLst = Handle(TDataStd_ReferenceList)::DownCast(attr);\r
+ if (!aRefLst.IsNull()) {\r
+ const TDF_LabelList& lst = aRefLst->List();\r
+ DLOG << "[TDFAttr_RefLst]: " << szName << "=" << lst.Size() << " [";\r
+ if (!lst.IsEmpty()) {\r
+ TCollection_AsciiString entry;\r
+ for (auto ref=lst.cbegin(); ref!=lst.cend(); ++ref) {\r
+ TDF_Tool::Entry(*ref, entry);\r
+ DLOG << (ref == lst.cbegin() ? "" : ",") << entry;\r
+ }\r
+ }\r
+ DLOG << "]" << " trans=" << trans << state << std::endl;\r
+ return;\r
+ }\r
+ Handle(TDF_TagSource) aTS = Handle(TDF_TagSource)::DownCast(attr);\r
+ if (!aTS.IsNull()) {\r
+ DLOG << "[TDFAttr_TagSrc]: " << szName << "=" << aTS->Get() << " trans=" << trans << state << std::endl;\r
+ return;\r
+ }\r
+ Handle(TDataStd_UAttribute) aUA = Handle(TDataStd_UAttribute)::DownCast(attr);\r
+ if (!aUA.IsNull()) {\r
+ DLOG << "[TDFAttr_UAttr]: " << szName << "= trans=" << trans << state << std::endl;\r
+ return;\r
+ }\r
+ DLOG << "[" << attr->DynamicType()->Name() << "]" << attr << std::endl;\r
+}\r
+\r
+//==========================================================================\r
+static void DumpVar(const char *szName, const TDF_Label &lbl) {\r
+ try {\r
+ if (lbl.IsNull()) {\r
+ DLOG << "[Label]: " << szName << "=Null" << std::endl;\r
+ } else {\r
+ TCollection_AsciiString entry; TDF_Tool::Entry(lbl, entry);\r
+ std::string imp = (lbl.IsImported() ? "import" : "noimp");\r
+ std::string modif = (lbl.MayBeModified() ? "modif" : "nomodif");\r
+ int nAttr = (lbl.HasAttribute() ? lbl.NbAttributes() : 0);\r
+ int nChild = (lbl.HasChild() ? lbl.NbChildren() : 0);\r
+ DLOG << "[Label]: " << szName << "={" << entry << " state=[" << imp << "|" << modif << "] nAttr=" << nAttr << " nChild=" << nChild << (nChild > 0 || nAttr > 0 ? "" : "}") << std::endl;\r
+ if (nAttr > 0) {\r
+ // Dump all attributes\r
+ for (TDF_AttributeIterator itr(lbl); itr.More(); itr.Next()) {\r
+ Handle(TDF_Attribute) attr = itr.Value();\r
+ SHOW(attr);\r
+ }\r
+ }\r
+ if (nChild > 0) {\r
+ TDF_Label child;\r
+ for (TDF_ChildIterator it(lbl); it.More(); it.Next()) {\r
+ child = it.Value();\r
+ SHOW(child);\r
+ }\r
+ }\r
+ if (nAttr > 0 || nChild > 0) {\r
+ MSGEL("}");\r
+ }\r
+ }\r
+ }\r
+ catch (...) { }\r
+}\r
+\r
+//==========================================================================\r
+static void DumpVar(const char *szName, const TopoDS_Shape &aShape) {\r
+ if (aShape.IsNull()) {\r
+ DLOG << "[TopShp]: " << szName << "=Null" << std::endl;\r
+ } else {\r
+ std::string typ = ShapeTypeStr(aShape);\r
+ DLOG << "[TopShp]: " << szName << "=" << aShape.TShape().get() << " ShapeType=" << typ;\r
+ if (aShape.ShapeType() == TopAbs_COMPOUND) {\r
+ int children[TopAbs_SHAPE+1] = {0};\r
+ int nbChild = 0;\r
+ for (TopoDS_Iterator Iter(aShape); Iter.More(); Iter.Next()) {\r
+ if (!Iter.Value().IsNull()) {\r
+ children[(int)Iter.Value().ShapeType()]++;\r
+ nbChild++;\r
+ }\r
+ }\r
+ DLOG << " NumChild=" << nbChild;\r
+ if (nbChild > 0) {\r
+ bool bFirst = true;\r
+ DLOG << " (";\r
+ for (int i=TopAbs_COMPOUND; i<TopAbs_SHAPE; i++) {\r
+ if (children[i] > 0) {\r
+ if (!bFirst) DLOG << ", ";\r
+ DLOG << children[i] << " " << TopAbs::ShapeTypeToString((TopAbs_ShapeEnum)i);\r
+ bFirst = false;\r
+ }\r
+ }\r
+ DLOG << ")";\r
+ }\r
+ }\r
+ else if (aShape.ShapeType() == TopAbs_COMPSOLID) {\r
+ DLOG << " NumChild=" << aShape.NbChildren();\r
+ }\r
+ DLOG << std::endl;\r
+ }\r
+}\r
+\r
+#endif // MBOCC_H
\ No newline at end of file