#include <cstdio>
#include <iostream>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "CAM_Application";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
namespace
{
class BusyLocker
myAutoLoad( autoLoad ),
myBlocked( false )
{
+ DBG_FUN();
+ ARG(autoLoad);
readModuleList();
}
*/
CAM_Application::~CAM_Application()
{
+ DBG_FUN();
for ( QList<CAM_Module*>::const_iterator it = myModules.begin(); it != myModules.end(); ++it )
delete *it;
myModules.clear();
*/
void CAM_Application::start()
{
+ DBG_FUN();
// check modules
for ( ModuleInfoList::iterator it = myInfoList.begin();
it != myInfoList.end(); ++it )
*/
CAM_Module* CAM_Application::module( const QString& modName ) const
{
+ DBG_FUN();
+ ARG(modName);
CAM_Module* mod = 0;
for ( QList<CAM_Module*>::const_iterator it = myModules.begin();
it != myModules.end() && !mod; ++it )
*/
void CAM_Application::modules( CAM_Application::ModuleList& out ) const
{
+ DBG_FUN();
out.clear();
for ( QList<CAM_Module*>::const_iterator it = myModules.begin();
*/
void CAM_Application::modules( QStringList& lst, const bool loaded ) const
{
+ DBG_FUN();
+ ARG(loaded);
lst.clear();
if ( loaded )
*/
void CAM_Application::addModule( CAM_Module* mod )
{
+ DBG_FUN();
if ( !mod || myModules.contains( mod ) )
return;
*/
void CAM_Application::loadModules()
{
+ DBG_FUN();
for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end(); ++it )
{
CAM_Module* mod = loadModule( (*it).title );
*/
CAM_Module* CAM_Application::loadModule( const QString& modName, const bool showMsg )
{
+ DBG_FUN();
+ ARG(modName);
+ ARG(showMsg);
if ( myInfoList.isEmpty() )
{
qWarning( qPrintable( tr( "Modules configuration is not defined." ) ) );
*/
bool CAM_Application::activateModule( const QString& modName )
{
+ DBG_FUN();
+ ARG(modName);
if ( (!modName.isEmpty() && !activeStudy()) || myBlocked )
return false;
*/
bool CAM_Application::activateModule( CAM_Module* mod )
{
+ DBG_FUN();
if ( mod && !activeStudy() )
return false;
*/
bool CAM_Application::activateOperation( const QString& modName, int actionId )
{
+ DBG_FUN();
+ ARG(modName);
+ ARG(actionId);
CAM_Module* mod = loadModule(modName, false);
if (mod) {
addModule(mod);
*/
bool CAM_Application::activateOperation( const QString& modName, const QString& actionId )
{
+ DBG_FUN();
+ ARG(modName);
+ ARG(actionId);
CAM_Module* mod = loadModule(modName, false);
if (mod) {
addModule(mod);
const QString& actionId,
const QString& pluginName )
{
+ DBG_FUN();
+ ARG(modName);
+ ARG(actionId);
+ ARG(pluginName);
CAM_Module* mod = loadModule(modName, false);
if (mod) {
addModule(mod);
*/
SUIT_Study* CAM_Application::createNewStudy()
{
+ DBG_FUN();
return new CAM_Study( this );
}
*/
void CAM_Application::updateCommandsStatus()
{
+ DBG_FUN();
STD_Application::updateCommandsStatus();
if ( activeModule() )
*/
void CAM_Application::beforeCloseDoc( SUIT_Study* theDoc )
{
+ DBG_FUN();
for ( QList<CAM_Module*>::iterator it = myModules.begin(); it != myModules.end(); ++it )
(*it)->studyClosed( theDoc );
}
void CAM_Application::afterCloseDoc()
{
+ DBG_FUN();
}
/*!
*/
void CAM_Application::setActiveStudy( SUIT_Study* study )
{
+ DBG_FUN();
STD_Application::setActiveStudy( study );
}
*/
bool CAM_Application::checkModule( const QString& )
{
+ DBG_FUN();
return true;
}
*/
void CAM_Application::moduleAdded( CAM_Module* /*mod*/ )
{
+ DBG_FUN();
}
/*!
*/
void CAM_Application::moduleDeactivated( CAM_Module* /*mod*/ )
{
+ DBG_FUN();
}
/*!
*/
QString CAM_Application::moduleName( const QString& title )
{
+ DBG_FUNC();
+ ARG(title);
QString res;
for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it )
{
if ( (*it).title == title )
res = (*it).name;
}
+ RET(res);
return res;
}
*/
QString CAM_Application::moduleTitle( const QString& name )
{
+ DBG_FUNC();
+ ARG(name);
QString res;
for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it )
{
if ( (*it).name == name )
res = (*it).title;
}
+ RET(res);
return res;
}
*/
QString CAM_Application::moduleDescription( const QString& name )
{
+ DBG_FUNC();
+ ARG(name);
QString res;
for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isNull(); ++it )
{
if ( (*it).name == name || (*it).title == name )
res = tr((*it).description.toUtf8());
}
+ RET(res);
return res;
}
*/
QString CAM_Application::moduleLibrary( const QString& name, const bool full )
{
+ DBG_FUNC();
+ ARG(name);
QString res;
for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it )
{
}
if ( !res.isEmpty() && full )
res = SUIT_Tools::library( res );
+ RET(res);
return res;
}
*/
QString CAM_Application::moduleDisplayer( const QString& name )
{
+ DBG_FUNC();
+ ARG(name);
QString res;
if ( !name.isEmpty() )
}
}
+ RET(res);
return res;
}
*/
void CAM_Application::readModuleList()
{
+ DBG_FUN();
if ( !myInfoList.isEmpty() )
return;
QStringList modList;
QString args = QApplication::arguments().join( " " );
+ SHOW(args);
QRegExp rx1("--modules=([\\w,]*)");
rx1.setMinimal( false );
if ( modList.isEmpty() ) {
QString mods = resMgr->stringValue( "launch", "modules", QString() );
+ SHOW(mods);
modList = mods.split( ",", QString::SkipEmptyParts );
}
bool CAM_Application::appendModuleInfo( const QString& modName )
{
+ DBG_FUN();
+ ARG(modName);
if ( modName.isEmpty() )
return false; // empty module name
void CAM_Application::removeModuleInfo( const QString& modName )
{
+ DBG_FUN();
+ ARG(modName);
QMutableListIterator<ModuleInfo> it( myInfoList );
while ( it.hasNext() )
{
*/
void CAM_Application::contextMenuPopup( const QString& type, QMenu* menu, QString& title )
{
+ DBG_FUN();
+ ARG(type);
// to do : add common items for popup menu ( if they are exist )
if ( activeModule() )
activeModule()->contextMenuPopup( type, menu, title );
*/
void CAM_Application::createEmptyStudy()
{
+ DBG_FUN();
/*SUIT_Study* study = */activeStudy();
STD_Application::createEmptyStudy();
}
*/
CAM_Application::ModuleShortInfoList CAM_Application::getVersionInfo()
{
+ DBG_FUNC();
ModuleShortInfoList info;
ModuleShortInfo kernel;
*/
bool CAM_Application::abortAllOperations()
{
+ DBG_FUN();
bool aborted = true;
for ( QList<CAM_Module*>::const_iterator it = myModules.begin(); it != myModules.end() && aborted; ++it )
{
#include <QMenu>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "CAM_Module";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
\class CAM_Module
\brief Base implementation of the module in the CAM application architecture.
myApp( 0 ),
myDataModel( 0 )
{
+ DBG_FUN();
}
/*!
myMenuShown( false ),
myToolShown( false )
{
+ DBG_FUN();
+ ARG(name);
}
/*!
*/
CAM_Module::~CAM_Module()
{
+ DBG_FUN();
delete myDataModel;
myDataModel = 0;
}
*/
void CAM_Module::initialize( CAM_Application* app )
{
+ DBG_FUN();
myApp = app;
if ( myApp )
{
*/
bool CAM_Module::activateModule( SUIT_Study* /*study*/ )
{
+ DBG_FUN();
// IMN 05/03/2015: we copied myActionMap for reset/unset actions accelerator keys
// after activate/deactivate modules
for ( QMap<QAction*, QKeySequence>::Iterator it = myActionShortcutMap.begin(); it != myActionShortcutMap.end(); ++it )
*/
bool CAM_Module::deactivateModule( SUIT_Study* )
{
+ DBG_FUN();
// IMN 05/03/2015: we copied myActionMap for reset/unset actions accelerator keys
// after activate/deactivate modules
myActionShortcutMap.clear();
*/
void CAM_Module::studyClosed( SUIT_Study* study )
{
+ DBG_FUN();
CAM_Study* camDoc = dynamic_cast<CAM_Study*>( study );
if ( !camDoc )
return;
*/
void CAM_Module::studyChanged( SUIT_Study* /*oldStudy*/, SUIT_Study* /*newStudy*/ )
{
+ DBG_FUN();
}
/*!
*/
void CAM_Module::putInfo( const QString& msg, const int msec )
{
+ DBG_FUN();
+ ARG(msg);
if ( application() )
application()->putInfo( msg, msec );
*/
int CAM_Module::showNotification( const QString& message, const QString& title, int timeout )
{
+ DBG_FUN();
+ ARG(message);
+ ARG(title);
int res = -1;
if ( application() )
res = application()->showNotification( message, title, timeout );
*/
void CAM_Module::hideNotification( const QString& message )
{
+ DBG_FUN();
+ ARG(message);
if ( application() )
application()->hideNotification( message );
}
*/
void CAM_Module::hideNotification( int id )
{
+ DBG_FUN();
+ ARG(id);
if ( application() )
application()->hideNotification( id );
}
*/
void CAM_Module::onInfoChanged( QString txt )
{
+ DBG_FUN();
+ ARG(txt);
if ( txt.isEmpty() && isActiveModule() && !myInfo.isEmpty() && application() )
application()->putInfo( myInfo );
}
*/
void CAM_Module::onApplicationClosed( SUIT_Application* theApp )
{
+ DBG_FUN();
if (myApp == theApp)
myApp = NULL;
}
*/
CAM_DataModel* CAM_Module::createDataModel()
{
+ DBG_FUN();
return new CAM_DataModel( this );
}
*/
void CAM_Module::setName( const QString& name )
{
+ DBG_FUN();
+ ARG(name);
setObjectName( name );
}
*/
void CAM_Module::setModuleName( const QString& name )
{
+ DBG_FUN();
+ ARG(name);
myName = name;
}
*/
int CAM_Module::createTool( const QString& title, const QString& name )
{
+ MSGEL("CAM_Module::createTool(title=\"" << title.toStdString() << "\", name=\"" << name.toStdString() << "\")");
if ( !toolMgr() )
return -1;
*/
int CAM_Module::createTool( QAction* a, const int tBar, const int id, const int idx )
{
+ MSGEL("CAM_Module::createTool(tBar=" << tBar << ", id=" << id << ", idx=" << idx <<")");
if ( !toolMgr() )
return -1;
*/
int CAM_Module::createTool( QAction* a, const QString& tBar, const int id, const int idx )
{
+ MSGEL("CAM_Module::createTool(tBar=\"" << tBar.toStdString() << "\", id=" << id << ", idx=" << idx <<")");
if ( !toolMgr() )
return -1;
*/
int CAM_Module::createTool( const int id, const int tBar, const int idx )
{
+ MSGEL("CAM_Module::createTool(id=" << id << ", tBar=" << tBar << ", idx=" << idx <<")");
if ( !toolMgr() )
return -1;
*/
int CAM_Module::createTool( const int id, const QString& tBar, const int idx )
{
+ MSGEL("CAM_Module::createTool(id=" << id << ", tBar=\"" << tBar.toStdString() << "\", idx=" << idx <<")");
if ( !toolMgr() )
return -1;
*/
void CAM_Module::clearTool( const QString& title )
{
+ DBG_FUN();
+ ARG(title);
if ( toolMgr() )
toolMgr()->clear( title );
}
int CAM_Module::createMenu( const QString& subMenu, const int menu,
const int id, const int group, const int idx, QMenu * menuObj )
{
+ MSGEL("CAM_Module::createMenu(subMenu=\"" << subMenu.toStdString() << "\", menu=" << menu << ", id=" << id << ")");
if ( !menuMgr() )
return -1;
int CAM_Module::createMenu( const QString& subMenu, const QString& menu,
const int id, const int group, const int idx )
{
+ MSGEL("CAM_Module::createMenu(subMenu=\"" << subMenu.toStdString() << "\", menu=\"" << menu.toStdString() << "\", id=" << id << ")");
if ( !menuMgr() )
return -1;
*/
int CAM_Module::createMenu( QAction* a, const int menu, const int id, const int group, const int idx )
{
+ MSGEL("CAM_Module::createMenu(menu=" << menu << ", id=" << id << ")");
if ( !a || !menuMgr() )
return -1;
*/
int CAM_Module::createMenu( QAction* a, const QString& menu, const int id, const int group, const int idx )
{
+ MSGEL("CAM_Module::createMenu(action, menu=\"" << menu.toStdString() << "\", id=" << id << ")");
if ( !a || !menuMgr() )
return -1;
*/
int CAM_Module::createMenu( const int id, const int menu, const int group, const int idx )
{
+ MSGEL("CAM_Module::createMenu(id=" << id << ", menu=" << menu << ")");
if ( !menuMgr() )
return -1;
*/
int CAM_Module::createMenu( const int id, const QString& menu, const int group, const int idx )
{
+ MSGEL("CAM_Module::createMenu(id=" << id << ", menu=\"" << menu.toStdString() << "\")");
if ( !menuMgr() )
return -1;
*/
void CAM_Module::setMenuShown( const bool on )
{
+ MSGEL("CAM_Module::setMenuShown(on=" << on << ")");
myMenuShown = on;
QtxActionMenuMgr* mMgr = menuMgr();
*/
void CAM_Module::setMenuShown( const int id, const bool on )
{
+ MSGEL("CAM_Module::setMenuShown(id=" << id << ", on=" << on << ")");
setMenuShown( action( id ), on );
}
*/
void CAM_Module::setToolShown( const bool on )
{
+ MSGEL("CAM_Module::setToolShown(on=" << on << ")");
myToolShown = on;
QtxActionToolMgr* tMgr = toolMgr();
*/
void CAM_Module::setToolShown( const int id, const bool on )
{
+ MSGEL("CAM_Module::setToolShown(id=" << id << ", on=" << on << ")");
setToolShown( action( id ), on );
}
QObject* parent, const bool toggle, QObject* reciever,
const char* member, const QString& shortcutAction )
{
+ MSGEL("CAM_Module::createAction(id=" << id << ", text=\"" << text.toStdString() << "\")");
QtxAction* a = new QtxAction( text, icon, menu, key, parent, toggle, shortcutAction );
a->setStatusTip( tip );
*/
QtxActionGroup* CAM_Module::createActionGroup( const int id, const bool exclusive )
{
+ DBG_FUN();
+ ARG(id);
QtxActionGroup* a = qobject_cast<QtxActionGroup*>( action( id ) );
if ( !a ) {
a = new QtxActionGroup( this );
*/
int CAM_Module::registerAction( const int id, QAction* a )
{
+ MSGEL("CAM_Module::registerAction(id=" << id << ")");
int ident = -1;
for ( QMap<int, QAction*>::ConstIterator it = myActionMap.begin(); it != myActionMap.end() && ident == -1; ++it )
if ( it.value() == a )
*/
bool CAM_Module::unregisterAction( const int id )
{
+ DBG_FUN();
+ ARG(id);
return unregisterAction( action( id ) );
}
*/
bool CAM_Module::unregisterAction( QAction* a )
{
+ DBG_FUN();
if ( !a )
return false;
if ( menuMgr() ) {
\brief Update visibility state of the module objects.
*/
void CAM_Module::updateModuleVisibilityState() {
+ DBG_FUN();
}
*/
bool CAM_Module::activateOperation( int /*actionId*/ )
{
+ DBG_FUN();
return false;
}
*/
bool CAM_Module::activateOperation( const QString& /*actionId*/ )
{
+ DBG_FUN();
return false;
}
*/
bool CAM_Module::activateOperation( const QString& /*actionId*/, const QString& /*pluginName*/ )
{
+ DBG_FUN();
return false;
}
*/
void CAM_Module::connectToStudy( CAM_Study* camStudy )
{
+ DBG_FUN();
CAM_Application* app = camStudy ? dynamic_cast<CAM_Application*>( camStudy->application() ) : 0;
if( !app )
return;
bool CAM_Module::abortAllOperations()
{
+ DBG_FUN();
return true;
}
--- /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
+\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
#include <utilities.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "LightApp_Application";
+#include "MBDebug.h"
+#include "MBSUIT.h"
+//---------------------------------------------------------
+
#define FIRST_HELP_ID 1000000
#define HAS_WWW_URL true
#define HAS_FORUM_URL true
/*!Create new instance of LightApp_Application.*/
extern "C" LIGHTAPP_EXPORT SUIT_Application* createApplication()
{
+ DBG_FUNC();
return new LightApp_Application();
}
myPrefs( 0 ),
myScreenHelper(new LightApp_FullScreenHelper())
{
+ DBG_FUN();
Q_INIT_RESOURCE( LightApp );
STD_TabDesktop* desk = new STD_TabDesktop();
*/
LightApp_Application::~LightApp_Application()
{
+ DBG_FUN();
savePreferences();
delete mySelMgr;
delete myScreenHelper;
/*!Start application.*/
void LightApp_Application::start()
{
+ DBG_FUN();
CAM_Application::start();
updateWindows();
/*!Closeapplication.*/
void LightApp_Application::closeApplication()
{
+ DBG_FUN();
#ifndef DISABLE_QTXWEBBROWSER
QProcess::startDetached( "HelpBrowser",
QStringList() << QString( "--remove=%1" ).arg( QApplication::instance()->applicationPid() ) );
QString LightApp_Application::applicationName() const
{
static QString _app_name;
- if ( _app_name.isEmpty() )
+ if ( _app_name.isEmpty() ) {
_app_name = tr( "APP_NAME" );
+ SHOW(_app_name);
+ }
return _app_name;
}
{
_app_version = GUI_VERSION_STR;
}
+ SHOW(_app_version);
}
return _app_version;
}
/*!Load module by \a name.*/
CAM_Module* LightApp_Application::loadModule( const QString& name, const bool showMsg )
{
+ DBG_FUN();
+ SHOW(name);
CAM_Module* mod = CAM_Application::loadModule( name, showMsg );
if ( mod )
{
/*!Activate module by \a modName*/
bool LightApp_Application::activateModule( const QString& modName )
{
+ DBG_FUN();
+ ARG(modName);
QString actName;
CAM_Module* prevMod = activeModule();
void LightApp_Application::createActions()
{
+ DBG_FUN();
CAM_Application::createActions();
SUIT_Desktop* desk = desktop();
*/
void LightApp_Application::customize()
{
+ DBG_FUN();
// List of modules
LightApp_ModuleAction* moduleAction = qobject_cast<LightApp_ModuleAction*>( action( ModulesListId ) );
// a. regular modules were added in createActions() method
/*!On module activation action.*/
void LightApp_Application::onModuleActivation( const QString& modTitle )
{
+ DBG_FUN();
+ ARG(modTitle);
+
// Force user to create/open a study before module activation
QPixmap icon = moduleIcon( modTitle );
bool cancelled = false;
/*!On module adding action.*/
void LightApp_Application::onModuleAdding()
{
+ DBG_FUN();
// show dialog to browse configuration file
QStringList filters = ( QStringList() << tr( "Config files") + " (*.salomex)" << tr( "All files" ) + " (*)" );
QStringList paths = getOpenFileNames( QString(), filters.join( ";;" ), QString(), desktop() );
/*Add user module.*/
bool LightApp_Application::addUserModule( const QString& name, const QString& root, bool interactive )
{
+ DBG_FUN();
+ ARG(name);
+ ARG(root);
if ( name.isEmpty() || root.isEmpty() )
return false;
/*!On module removing action.*/
void LightApp_Application::onModuleRemoving( const QString& title )
{
+ DBG_FUN();
+ ARG(title);
+
QString root = resourceMgr()->stringValue( "user_modules", moduleName( title ) );
QDir rootDirectory = QDir( root );
/*!On new window slot.*/
void LightApp_Application::onNewWindow()
{
+ DBG_FUN();
const QObject* obj = sender();
if ( !obj || !obj->inherits( "QAction" ) )
return;
break;
#endif
}
+ SHOW(type);
if ( !type.isEmpty() )
createViewManager( type );
*/
void LightApp_Application::onNewDoc()
{
+ DBG_FUN();
if ( !checkExistingDoc() )
return;
*/
void LightApp_Application::onOpenDoc()
{
+ DBG_FUN();
SUIT_Study* study = activeStudy();
if ( !checkExistingDoc( false ) )
*/
bool LightApp_Application::onOpenDoc( const QString& aName )
{
+ DBG_FUN();
+ ARG(aName);
if ( !canOpenDoc(aName)) {
bool showError = !property("open_study_from_command_line").isValid() ||
!property("open_study_from_command_line").toBool();
*/
void LightApp_Application::onSelection()
{
+ DBG_FUN();
//MESSAGE("onSelection")
onSelectionChanged();
*/
void LightApp_Application::setActiveStudy( SUIT_Study* study )
{
+ DBG_FUN();
CAM_Application::setActiveStudy( study );
}
*/
void LightApp_Application::updateCommandsStatus()
{
+ DBG_FUN();
CAM_Application::updateCommandsStatus();
QAction* a = 0;
void LightApp_Application::showHelp( const QString& path )
{
+ DBG_FUN();
+ ARG(path);
SUIT_ResourceMgr* resMgr = resourceMgr();
#if DISABLE_QTXWEBBROWSER
*/
void LightApp_Application::onSelectionChanged()
{
+ DBG_FUN();
LightApp_Module* m = dynamic_cast<LightApp_Module*>( activeModule() );
bool canCopy = m ? m->canCopy() : false;
bool canPaste = m ? m->canPaste() : false;
*/
void LightApp_Application::updateObjectBrowser( const bool updateModels )
{
+ DBG_FUN();
+ ARG(updateModels);
+
// update existing data models
if ( updateModels )
{
*/
SUIT_ViewManager* LightApp_Application::getViewManager( const QString& vmType, const bool create )
{
+ DBG_FUN();
+ ARG(vmType);
+ ARG(create);
+
SUIT_ViewManager* aVM = viewManager( vmType );
SUIT_ViewManager* anActiveVM = CAM_Application::activeViewManager();
MESSAGE("vmType: " << vmType.toStdString() << " aVM: " << aVM << " anActiveVM: " << anActiveVM );
*/
SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType, bool detached )
{
+ DBG_FUN();
+ ARG(vmType);
+ ARG(detached);
+
SUIT_ResourceMgr* resMgr = resourceMgr();
SUIT_ViewManager* viewMgr = 0;
SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType, QWidget* w )
{
+ DBG_FUN();
+ ARG(vmType);
+
SUIT_ResourceMgr* resMgr = resourceMgr();
SUIT_ViewManager* vm = new SUIT_ViewManager( activeStudy(),
SUIT_ViewManager* LightApp_Application::createViewManager( SUIT_ViewModel* theModel )
{
+ DBG_FUN();
+
SUIT_ResourceMgr* resMgr = resourceMgr();
SUIT_ViewManager* vm = new SUIT_ViewManager( activeStudy(),
*/
void LightApp_Application::onCloseView( SUIT_ViewManager* theVM )
{
+ DBG_FUN();
removeViewManager( theVM );
}
*/
void LightApp_Application::onStudyCreated( SUIT_Study* theStudy )
{
+ DBG_FUN();
SUIT_DataObject* aRoot = 0;
if ( theStudy && theStudy->root() )
{
*/
void LightApp_Application::onStudyOpened( SUIT_Study* theStudy )
{
+ DBG_FUN();
SUIT_DataObject* aRoot = 0;
if ( theStudy && theStudy->root() )
{
aRoot = theStudy->root();
+ SHOW(aRoot);
//aRoot->dump();
}
/*!Protected SLOT. On study saved.*/
void LightApp_Application::onStudySaved( SUIT_Study* s )
{
+ DBG_FUN();
QtxMRUAction* mru = ::qobject_cast<QtxMRUAction*>( action( MRUId ) );
if ( mru && s )
mru->insert( s->studyName() );
/*!Protected SLOT. On study closed.*/
void LightApp_Application::onStudyClosed( SUIT_Study* /*s*/ )
{
+ DBG_FUN();
/*
disconnect( this, SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
/*!Protected SLOT.On desktop activated.*/
void LightApp_Application::onDesktopActivated()
{
+ DBG_FUN();
CAM_Application::onDesktopActivated();
LightApp_Module* aModule = dynamic_cast<LightApp_Module*>(activeModule());
if(aModule)
void LightApp_Application::studyOpened( SUIT_Study* s )
{
+ DBG_FUN();
CAM_Application::studyOpened( s );
updateWindows();
void LightApp_Application::studySaved( SUIT_Study* s )
{
+ DBG_FUN();
CAM_Application::studyOpened( s );
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
if ( aResMgr && activeStudy() ) {
void LightApp_Application::studyCreated( SUIT_Study* s )
{
+ DBG_FUN();
CAM_Application::studyCreated( s );
updateWindows();
/*!Private SLOT. Update object browser.*/
void LightApp_Application::onRefresh()
{
+ DBG_FUN();
updateObjectBrowser( true );
}
/*!Private SLOT. Update actions after rename object.*/
void LightApp_Application::onRenamed()
{
+ DBG_FUN();
activeStudy()->Modified();
updateActions();
}
/*!Protected SLOT. On preferences changed.*/
void LightApp_Application::onPreferenceChanged( QString& modName, QString& section, QString& param )
{
+ DBG_FUN();
+ ARG(modName);
+ ARG(section);
+ ARG(param);
LightApp_Module* sMod = 0;
CAM_Module* mod = module( modName );
if ( mod && mod->inherits( "LightApp_Module" ) )
/*!Remove all windows from study.*/
void LightApp_Application::beforeCloseDoc( SUIT_Study* s )
{
+ DBG_FUN();
saveDockWindowsState();
if ( SUIT_DataBrowser* ob = objectBrowser() )
*/
SUIT_Study* LightApp_Application::createNewStudy()
{
+ DBG_FUN();
LightApp_Study* aStudy = new LightApp_Study( this );
// Set up processing of major study-related events
*/
QWidget* LightApp_Application::createWindow( const int flag )
{
+ DBG_FUN();
+ ARG(flag);
QWidget* wid = 0;
SUIT_ResourceMgr* resMgr = resourceMgr();
if ( flag == WT_ObjectBrowser )
{
+ MSGEL("--> create ObjectBrowser");
SUIT_DataBrowser* ob = new SUIT_DataBrowser( new LightApp_DataObject(), desktop() );
ob->setObjectName( "objectBrowser" );
ob->setSortMenuEnabled( true );
}
else if ( flag == WT_InfoPanel)
{
+ MSGEL("--> create InfoPanel");
QtxInfoPanel* ipanel = new QtxInfoPanel( desktop() );
ipanel->setObjectName( "infoPanel" );
ipanel->setWindowTitle( tr( "INFO_PANEL" ) );
#ifndef DISABLE_PYCONSOLE
else if ( flag == WT_PyConsole )
{
+ MSGEL("--> create PythonConsole");
PyConsole_Console* pyCons = new PyConsole_Console( desktop(), new LightApp_PyEditor( getPyInterp() ) );
pyCons->setObjectName( "pythonConsole" );
pyCons->setWindowTitle( tr( "PYTHON_CONSOLE" ) );
#endif
else if ( flag == WT_LogWindow )
{
+ MSGEL("--> create LogWindow");
LogWindow* logWin = new LogWindow( desktop() );
logWin->handleQtMessages( true );
logWin->setObjectName( "logWindow" );
*/
void LightApp_Application::moduleAdded( CAM_Module* mod )
{
+ DBG_FUN();
CAM_Application::moduleAdded( mod );
LightApp_Module* lightMod = 0;
void LightApp_Application::moduleDeactivated( CAM_Module* /*mod*/ )
{
+ DBG_FUN();
if ( infoPanel() )
infoPanel()->clear();
}
*/
void LightApp_Application::createPreferences( LightApp_Preferences* pref )
{
+ DBG_FUN();
if ( !pref )
return;
*/
void LightApp_Application::loadPreferences()
{
+ DBG_FUN();
CAM_Application::loadPreferences();
SUIT_ResourceMgr* aResMgr = resourceMgr();
*/
void LightApp_Application::savePreferences()
{
+ DBG_FUN();
CAM_Application::savePreferences();
saveDockWindowsState();
*/
void LightApp_Application::updateDesktopTitle()
{
+ DBG_FUN();
QString aTitle = applicationName();
QString aVer = applicationVersion();
if ( !aVer.isEmpty() )
aTitle += QString( " - [%1]" ).arg( sName );
}
+ SHOW(aTitle);
desktop()->setWindowTitle( aTitle );
}
*/
void LightApp_Application::afterCloseDoc()
{
+ DBG_FUN();
updateWindows();
CAM_Application::afterCloseDoc();
bool LightApp_Application::checkModule( const QString& title )
{
+ DBG_FUN();
+ ARG(title);
+
if ( title.isEmpty() )
return false;
*/
void LightApp_Application::updateWindows()
{
+ DBG_FUN();
QMap<int, int> winMap;
currentWindows( winMap );
*/
void LightApp_Application::updateViewManagers()
{
+ DBG_FUN();
QStringList lst;
currentViewManagers( lst );
+ std::cout << "-----Current ViewManagers-----------------" << std::endl;
+ for (auto it = lst.begin(); it != lst.end(); ++it)
+ std::cout << "VM-Type: [" << (*it).toStdString() << "]" << std::endl;
+ std::cout << "------------------------------------------" << std::endl;
+
for ( QStringList::const_iterator it = lst.begin(); it != lst.end(); ++it )
getViewManager( *it, true );
}
*/
void LightApp_Application::loadDockWindowsState()
{
+ DBG_FUN();
if ( !desktop() )
return;
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
*/
void LightApp_Application::saveDockWindowsState()
{
+ DBG_FUN();
if ( !desktop() )
return;
*/
void LightApp_Application::contextMenuPopup( const QString& type, QMenu* thePopup, QString& title )
{
+ MSGEL("LightApp_Application::contextMenuPopup(type=\"" << type.toStdString() << "\")");
//Add "Rename" item
LightApp_SelectionMgr* selMgr = LightApp_Application::selectionMgr();
bool cacheIsOn = selMgr->isSelectionCacheEnabled();
*/
void LightApp_Application::createEmptyStudy()
{
+ DBG_FUN();
CAM_Application::createEmptyStudy();
if ( objectBrowser() )
/*!Set desktop:*/
void LightApp_Application::setDesktop( SUIT_Desktop* desk )
{
+ DBG_FUN();
+
CAM_Application::setDesktop( desk );
if ( desk ) {
*/
bool LightApp_Application::activateModule( CAM_Module* mod )
{
+ DBG_FUN();
bool res = CAM_Application::activateModule( mod );
if ( objectBrowser() )
*/
void LightApp_Application::addViewManager( SUIT_ViewManager* vm )
{
+ DBG_FUN();
connect( vm, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
this, SLOT( onCloseView( SUIT_ViewManager* ) ) );
CAM_Application::addViewManager( vm );
*/
void LightApp_Application::removeViewManager( SUIT_ViewManager* vm )
{
+ DBG_FUN();
disconnect( vm, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
this, SLOT( onCloseView( SUIT_ViewManager* ) ) );
LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>(activeStudy());
*/
void LightApp_Application::onRenameWindow()
{
+ DBG_FUN();
if( !desktop() )
return;
*/
void LightApp_Application::onCloseWindow()
{
+ DBG_FUN();
if( !desktop() )
return;
*/
void LightApp_Application::onCloseAllWindow()
{
+ DBG_FUN();
STD_TabDesktop* desk = dynamic_cast<STD_TabDesktop*>( desktop() );
if( !desk )
return;
*/
void LightApp_Application::onGroupAllWindow()
{
+ DBG_FUN();
STD_TabDesktop* desk = dynamic_cast<STD_TabDesktop*>( desktop() );
if( !desk )
return;
*/
void LightApp_Application::setDefaultStudyName( const QString& theName )
{
+ DBG_FUN();
+ ARG(theName);
QStringList anInfoList;
modules( anInfoList, false );
*/
bool LightApp_Application::event( QEvent* e )
{
+ DBG_FUN();
if( e && e->type()==2000 )
{
SALOME_CustomEvent* ce = ( SALOME_CustomEvent* )e;
/*! Check data object */
bool LightApp_Application::checkDataObject(LightApp_DataObject* theObj)
{
+ DBG_FUN();
if (theObj)
{
bool isSuitable = !theObj->entry().isEmpty() &&
int LightApp_Application::openChoice( const QString& aName )
{
+ DBG_FUN();
+ ARG(aName);
int choice = CAM_Application::openChoice( aName );
if ( choice == OpenExist ) // The document is already open.
bool LightApp_Application::openAction( const int choice, const QString& aName )
{
+ DBG_FUN();
+ ARG(choice);
+ ARG(aName);
bool res = false;
switch ( choice )
{
*/
void LightApp_Application::clearKnownViewManagers()
{
+ DBG_FUN();
QStringList aTypesList = viewManagersTypes();
QList<SUIT_ViewManager*> aMgrList;
viewManagers( aMgrList );
const bool theIsApplyAndClose,
const bool theIsOptimizedBrowsing )
{
+ DBG_FUN();
QString aResult;
if( SUIT_ResourceMgr* aResourceMgr = resourceMgr() )
{
anObject = aStudy->findObjectByEntry( anEntry );
if( anObject )
{
+ SHOW2(anObject, SUIT_DataObject*);
QModelIndex anIndex = aModel->index( anObject );
anOB->treeView()->scrollTo( anIndex );
}
/*! Process standard messages from desktop */
void LightApp_Application::onDesktopMessage( const QString& message )
{
+ DBG_FUN();
+ ARG(message);
const QString sectionSeparator = "/";
if ( message.toLower() == "updateobjectbrowser" ||
void LightApp_Application::updateVisibilityState( DataObjectList& theList,
SUIT_ViewModel* theViewModel )
{
+ DBG_FUN();
if ( !theViewModel || theList.isEmpty() ) return;
LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>(activeStudy());
for ( DataObjectList::iterator itr = theList.begin(); itr != theList.end(); ++itr ) {
LightApp_DataObject* obj = dynamic_cast<LightApp_DataObject*>(*itr);
+ SHOW2(obj, SUIT_DataObject*);
+ MSGEL("Entry=[" << obj->entry().toStdString() << "] isComponent=" << (aStudy->isComponent( obj->entry() ) ? "Yes" : "No"));
if ( !obj || aStudy->isComponent( obj->entry() ) )
continue;
QString mname = aStudy->componentDataType(obj->entry());
+ SHOW(mname);
LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(mname, false);
if ( aDisplayer ) {
Qtx::VisibilityState anObjState = Qtx::UnpresentableState;
if ( aDisplayer->canBeDisplayed( obj->entry(), theViewModel->getType() ) ) {
if ( aDisplayer->IsDisplayed( obj->entry(), aView ) )
+ {
+ MSGEL("Component=[" << mname.toStdString() << "] Entry=[" << obj->entry().toStdString() << "] - shown");
anObjState = Qtx::ShownState;
+ }
else
+ {
+ MSGEL("Component=[" << mname.toStdString() << "] Entry=[" << obj->entry().toStdString() << "] - hidden");
anObjState = Qtx::HiddenState;
+ }
+ }
+ else{
+ MSGEL("Component=[" << mname.toStdString() << "] Entry=[" << obj->entry().toStdString() << "]...cannot be displayed");
+ //anObjState = Qtx::HiddenState;
}
aStudy->setVisibilityState( obj->entry(), anObjState );
}
+ else
+ {
+ MSGEL("....no displayer found for component [" << mname.toStdString() << "]!");
+ }
}
}
void LightApp_Application::updatePresentations( const QString& theComponent,
const QStringList& theViewManagerTypes )
{
+ DBG_FUN();
+ ARG(theComponent);
LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(theComponent, false);
if ( aDisplayer ) {
LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>(activeStudy());
DataObjectList::const_iterator itObjs = anObjs.begin();
for ( ; itObjs != anObjs.end(); itObjs++ ) {
LightApp_DataObject* anObj = dynamic_cast<LightApp_DataObject*>( *itObjs );
+ SHOW2(anObj, SUIT_DataObject*);
QString anEntry = anObj->entry();
QListIterator<SUIT_ViewManager*> itViewMgrs( aViewMgrs );
*/
void LightApp_Application::onWindowActivated( SUIT_ViewWindow* theViewWindow )
{
+ DBG_FUN();
SUIT_DataBrowser* anOB = objectBrowser();
if ( !anOB )
return;
SUIT_DataObject* rootObj = anOB->root();
+ SHOW(rootObj);
if ( !rootObj )
return;
*/
void LightApp_Application::onViewManagerRemoved( SUIT_ViewManager* )
{
+ DBG_FUN();
ViewManagerList lst;
viewManagers( lst );
if ( lst.count() == 1) { // in case if closed last view window
*/
bool LightApp_Application::checkExistingDoc( bool closeExistingDoc )
{
+ DBG_FUN();
+ ARG(closeExistingDoc);
bool result = true;
if( activeStudy() ) {
int answer = !activeStudy()->isModified() ? 1 :
void LightApp_Application::createHelpItems( const QString& modTitle )
{
+ DBG_FUN();
+ ARG(modTitle);
if ( modTitle.isEmpty() )
return;
void LightApp_Application::removeHelpItems( const QString& modTitle )
{
+ DBG_FUN();
+ ARG(modTitle);
QString modName = moduleName( modTitle );
if ( myHelpItems.contains( modName ) )
{
#include <SUIT_DataBrowser.h>
#include <SUIT_DataObject.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "LightApp_DataModel";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Constructor
*/
LightApp_DataModel::LightApp_DataModel( CAM_Module* theModule )
: CAM_DataModel( theModule )
{
+ DBG_FUN();
myGroupId = 0;
if( module() )
myGroupId = qHash( module()->name() );
*/
LightApp_DataModel::~LightApp_DataModel()
{
+ DBG_FUN();
}
/*!
*/
bool LightApp_DataModel::open( const QString&, CAM_Study*, QStringList )
{
+ DBG_FUN();
emit opened(); //TODO: is it really needed? to be removed maybe...
return true;
}
*/
bool LightApp_DataModel::save( QStringList& )
{
+ DBG_FUN();
emit saved();
return true;
}
*/
bool LightApp_DataModel::saveAs( const QString&, CAM_Study*, QStringList& )
{
+ DBG_FUN();
emit saved();
return true;
}
*/
bool LightApp_DataModel::dumpPython( const QString&, CAM_Study*, bool, QStringList& )
{
+ DBG_FUN();
return true;
}
*/
bool LightApp_DataModel::close()
{
+ DBG_FUN();
emit closed();
return true;
}
*/
void LightApp_DataModel::build()
{
+ DBG_FUN();
}
/*!
*/
void LightApp_DataModel::updateWidgets()
{
+ DBG_FUN();
LightApp_Application* app = dynamic_cast<LightApp_Application*>( module()->application() );
if ( app && app->objectBrowser() )
app->objectBrowser()->updateTree( 0, false );
*/
void LightApp_DataModel::update( LightApp_DataObject*, LightApp_Study* )
{
+ DBG_FUN();
// san: Previously modelRoot was casted to LightApp_ModuleObject*,
// BUT this is incorrect: in full SALOME the model root has different type.
// Hopefully LightApp_DataObject* is sufficient here.
*/
void LightApp_DataModel::registerColumn( SUIT_DataBrowser* browser, const QString& name, const int custom_id )
{
+ DBG_FUN();
+ ARG(name);
SUIT_AbstractModel* m = dynamic_cast<SUIT_AbstractModel*>( browser ? browser->model() : 0 );
if( m )
m->registerColumn( groupId(), name, custom_id );
*/
void LightApp_DataModel::unregisterColumn( SUIT_DataBrowser* browser, const QString& name )
{
+ DBG_FUN();
+ ARG(name);
SUIT_AbstractModel* m = dynamic_cast<SUIT_AbstractModel*>( browser ? browser->model() : 0 );
if( m )
m->unregisterColumn( groupId(), name );
*/
CAM_ModuleObject* LightApp_DataModel::createModuleObject( SUIT_DataObject* theRoot ) const
{
+ DBG_FUN();
LightApp_RootObject* aStudyRoot = dynamic_cast<LightApp_RootObject*>( theRoot );
if ( !aStudyRoot )
return 0;
#include <iostream>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "LightApp_DataObject";
+#include "MBDebug.h"
+#include "MBSUIT.h"
+//---------------------------------------------------------
+
/*!
\class LightApp_DataObject::Key
\brief Represents unique data object key for the LightApp_DataObject
myCompDataType( "" ),
myCompObject( 0 )
{
+ DBG_FUN();
+ ARG(parent);
}
/*!
*/
LightApp_DataObject::~LightApp_DataObject()
{
+ DBG_FUN();
}
int LightApp_DataObject::groupId() const
*/
bool LightApp_DataObject::setName(const QString& name)
{
+ DBG_FUN();
+ ARG(name);
LightApp_Module* m = dynamic_cast<LightApp_Module*>( module() );
LightApp_RootObject* r = dynamic_cast<LightApp_RootObject*>( root() );
LightApp_Application* app =
break;
}
+ MSGEL("LightApp_DataObject::text(id=" << id << ") -> \"" << txt.toStdString() << "\"");
return txt;
}
LightApp_DataObject( parent ),
CAM_ModuleObject( parent )
{
+ DBG_FUN();
}
/*!
LightApp_DataObject( parent ),
CAM_ModuleObject( dm, parent )
{
+ DBG_FUN();
}
/*
*/
LightApp_ModuleObject::~LightApp_ModuleObject()
{
+ DBG_FUN();
}
/*!
*/
void LightApp_ModuleObject::insertChild( SUIT_DataObject* obj, int pos )
{
+ DBG_FUN();
LightApp_DataObject::insertChild( obj, pos );
CAM_DataModel* aModel = dataModel();
LightApp_DataObject( 0 ),
myStudy( study )
{
+ DBG_FUN();
}
/*
*/
LightApp_RootObject::~LightApp_RootObject()
{
+ DBG_FUN();
}
/*
*/
void LightApp_RootObject::setStudy( LightApp_Study* study )
{
+ DBG_FUN();
myStudy = study;
}
#include "LightApp_DataOwner.h"
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "LightApp_DataOwner";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!Constructor. Initialize by \a theEntry.*/
LightApp_DataOwner::LightApp_DataOwner( const QString& theEntry )
: myEntry( theEntry )
{
+ DBG_FUN();
+ ARG(theEntry);
}
#ifndef DISABLE_SALOMEOBJECT
myEntry(!theIO.IsNull()? theIO->getEntry(): ""),
myIO(theIO)
{
+ DBG_FUN();
}
#endif
/*!Destructor. Do nothing.*/
LightApp_DataOwner::~LightApp_DataOwner()
{
+ DBG_FUN();
}
/*!Gets key string, used for data owners comparison.*/
#include "SALOME_InteractiveObject.hxx"
#endif
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "LightApp_Displayer";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Default constructor
*/
LightApp_Displayer::LightApp_Displayer()
{
+ DBG_FUN();
}
/*!
*/
LightApp_Displayer::~LightApp_Displayer()
{
+ DBG_FUN();
}
/*!
void LightApp_Displayer::Display( const QString& entry, const bool updateViewer,
SALOME_View* theViewFrame )
{
+ DBG_FUN();
+ ARG(entry);
QStringList aList;
aList.append( entry );
Display( aList, updateViewer, theViewFrame );
void LightApp_Displayer::Display( const QStringList& list, const bool updateViewer,
SALOME_View* theViewFrame )
{
+ DBG_FUN();
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
QStringList::const_iterator it = list.constBegin();
for ( ; it != list.constEnd(); ++it)
*/
void LightApp_Displayer::Redisplay( const QString& entry, const bool updateViewer )
{
+ DBG_FUN();
+ ARG(entry);
// Remove the object permanently (<forced> == true)
SUIT_Session* ses = SUIT_Session::session();
SUIT_Application* app = ses->activeApplication();
const bool updateViewer,
SALOME_View* theViewFrame )
{
+ DBG_FUN();
+ ARG(entry);
QStringList aList;
aList.append( entry );
Erase( aList, forced, updateViewer, theViewFrame );
const bool updateViewer,
SALOME_View* theViewFrame )
{
+ DBG_FUN();
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
if ( !vf )
*/
void LightApp_Displayer::EraseAll( const bool forced, const bool updateViewer, SALOME_View* theViewFrame )
{
+ DBG_FUN();
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
if ( vf ) {
*/
void LightApp_Displayer::UpdateViewer() const
{
+ DBG_FUN();
SALOME_View* vf = GetActiveView();
if ( vf )
vf->Repaint();
*/
SALOME_Prs* LightApp_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame )
{
+ DBG_FUN();
+ ARG(entry);
SALOME_Prs* prs = 0;
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
*/
SALOME_View* LightApp_Displayer::GetActiveView()
{
+ DBG_FUNC();
SUIT_Session* session = SUIT_Session::session();
if ( SUIT_Application* app = session->activeApplication() ) {
if ( LightApp_Application* sApp = dynamic_cast<LightApp_Application*>( app ) ) {
if( SUIT_ViewManager* vman = sApp->activeViewManager() )
if( SUIT_ViewModel* vmod = vman->getViewModel() )
viewerType = vmod->getType();
+ MSGEL(".....LApp_Displayer: [" << entry.toStdString() << "] can be displayed in \"" << viewerType.toStdString() << "\"?");
return canBeDisplayed( entry, viewerType );
}
*/
LightApp_Displayer* LightApp_Displayer::FindDisplayer( const QString& mod_name, const bool load )
{
+ DBG_FUNC();
+ ARG(mod_name);
+ ARG(load);
QString mname = LightApp_Application::moduleDisplayer( mod_name );
SUIT_Session* session = SUIT_Session::session();
SUIT_Application* sapp = session ? session->activeApplication() : 0;
\param load - is module has to be forced loaded
*/
void LightApp_Displayer::setVisibilityState( const QString& theEntry, Qtx::VisibilityState theState) const {
+ DBG_FUN();
+ ARG(theEntry);
LightApp_Application* app = dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() );
LightApp_Study* study = app ? dynamic_cast<LightApp_Study*>( app->activeStudy() ) : 0;
#include <time.h>
#endif
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "LightApp_Driver";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
using namespace std;
/*! Constructor.*/
LightApp_Driver::LightApp_Driver()
: myIsTemp( false )
{
+ DBG_FUN();
}
/*! Destructor.*/
LightApp_Driver::~LightApp_Driver()
{
+ DBG_FUN();
}
/*!
*/
bool LightApp_Driver::SaveDatasInFile( const char* theFileName, bool isMultiFile )
{
+ DBG_FUN();
+ ARG(theFileName);
int aNbModules = 0;
std::map<std::string, ListOfFiles>::const_iterator it;
for (it = myMap.begin(); it != myMap.end(); ++it)
*/
bool LightApp_Driver::ReadDatasFromFile( const char* theFileName, bool isMultiFile )
{
+ DBG_FUN();
+ ARG(theFileName);
#ifdef WIN32
ifstream aFile(theFileName, ios::binary);
#else
*/
std::string LightApp_Driver::GetTmpDir (const char* theURL, const bool isMultiFile)
{
+ DBG_FUN();
+ ARG(theURL);
std::string anURLDir = GetDirFromPath(theURL);
std::string aTmpDir = isMultiFile ? anURLDir : GetTmpDir();
+ RET(aTmpDir);
return aTmpDir;
}
*/
LightApp_Driver::ListOfFiles LightApp_Driver::GetListOfFiles( const char* theModuleName )
{
+ DBG_FUN();
ListOfFiles aListOfFiles;
std::string aName(theModuleName);
*/
void LightApp_Driver::SetListOfFiles( const char* theModuleName, const ListOfFiles theListOfFiles )
{
+ DBG_FUN();
+ ARG(theModuleName);
std::string aName (theModuleName);
myMap[aName] = theListOfFiles;
}
void LightApp_Driver::PutFilesToStream( const std::string& theModuleName, unsigned char*& theBuffer,
long& theBufferSize, bool theNamesOnly )
{
+ DBG_FUN();
+ ARG(theModuleName);
ListOfFiles aFiles = myMap[theModuleName];
// aFiles must contain temporary directory name in its first item
// and names of files (relatively the temporary directory) in the others
LightApp_Driver::ListOfFiles LightApp_Driver::PutStreamToFiles( const unsigned char* theBuffer,
const long theBufferSize, bool theNamesOnly )
{
+ DBG_FUN();
if(theBufferSize == 0 || theBuffer == 0)
return ListOfFiles();
*/
void LightApp_Driver::RemoveFiles( const ListOfFiles& theFiles, const bool IsDirDeleted)
{
+ DBG_FUN();
int i, aLength = (int)theFiles.size() - 1; //!< TODO: conversion size_t to int
if(aLength <= 0) {
return;
*/
void LightApp_Driver::RemoveTemporaryFiles( const char* theModuleName, const bool IsDirDeleted )
{
+ DBG_FUN();
+ ARG(theModuleName);
std::string aModuleName(theModuleName);
ListOfFiles aFiles = myMap[aModuleName];
// aFiles must contain temporary directory name in its first item
*/
void LightApp_Driver::ClearDriverContents()
{
+ DBG_FUN();
std::map<std::string, ListOfFiles>::iterator it;
for ( it = myMap.begin(); it != myMap.end(); ++it )
{
*/
std::string LightApp_Driver::GetTmpDir()
{
+ DBG_FUN();
if ( myTmpDir.length() != 0 )
return myTmpDir;
myTmpDir = aTmpDir.ToCString();
+ RET(myTmpDir);
return aTmpDir.ToCString();
}
#include <GraphicsView_ViewPort.h>
#include <GraphicsView_Viewer.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "LightApp_GVSelector";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
LightApp_GVSelector::LightApp_GVSelector( GraphicsView_Viewer* theViewer,
SUIT_SelectionMgr* theSelMgr )
: SUIT_Selector( theSelMgr, theViewer ),
myViewer( theViewer )
{
+ DBG_FUN();
connect( theViewer, SIGNAL( selectionChanged( GV_SelectionChangeStatus ) ),
this, SLOT( onSelectionChanged( GV_SelectionChangeStatus ) ) );
}
LightApp_GVSelector::~LightApp_GVSelector()
{
+ DBG_FUN();
}
QString LightApp_GVSelector::type() const
void LightApp_GVSelector::getSelection( SUIT_DataOwnerPtrList& theList ) const
{
+ DBG_FUN();
if( GraphicsView_ViewPort* aViewport = myViewer->getActiveViewPort() )
for( aViewport->initSelected(); aViewport->moreSelected(); aViewport->nextSelected() )
theList.append( new LightApp_DataOwner( aViewport->selectedObject()->getName() ) );
void LightApp_GVSelector::setSelection( const SUIT_DataOwnerPtrList& /*theList*/ )
{
+ DBG_FUN();
}
void LightApp_GVSelector::onSelectionChanged( GV_SelectionChangeStatus )
{
+ DBG_FUN();
selectionChanged();
}
#include <iostream>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "LightApp_Module";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!Constructor.*/
LightApp_Module::LightApp_Module( const QString& name )
: CAM_Module( name ),
myEraseAll( -1 ),
myIsFirstActivate( true )
{
+ DBG_FUN();
+ ARG(name);
}
/*!Destructor.*/
LightApp_Module::~LightApp_Module()
{
+ DBG_FUN();
if ( mySwitchOp )
delete mySwitchOp;
}
/*!Initialize module.*/
void LightApp_Module::initialize( CAM_Application* app )
{
+ DBG_FUN();
CAM_Module::initialize( app );
SUIT_ResourceMgr* resMgr = app ? app->resourceMgr() : 0;
/*!Context menu popup.*/
void LightApp_Module::contextMenuPopup( const QString& client, QMenu* menu, QString& /*title*/ )
{
+ DBG_FUN();
LightApp_Selection* sel = createSelection();
sel->init( client, getApp()->selectionMgr() );
void LightApp_Module::updateObjBrowser( bool theIsUpdateDataModel,
SUIT_DataObject* theDataObject )
{
+ DBG_FUN();
if (!getApp()->objectBrowser())
return;
bool upd = getApp()->objectBrowser()->autoUpdate();
/*!Activate module.*/
bool LightApp_Module::activateModule( SUIT_Study* study )
{
+ DBG_FUN();
bool res = CAM_Module::activateModule( study );
if ( !isSelectionCompatible() )// PAL19290, PAL18352
/*!Deactivate module.*/
bool LightApp_Module::deactivateModule( SUIT_Study* study )
{
+ DBG_FUN();
delete mySwitchOp;
mySwitchOp = 0;
/*! Redefined to reset internal flags valid for study instance */
void LightApp_Module::studyClosed( SUIT_Study* theStudy )
{
+ DBG_FUN();
CAM_Module::studyClosed( theStudy );
myIsFirstActivate = true;
*/
void LightApp_Module::update( const int theFlags )
{
+ DBG_FUN();
+ ARG(theFlags);
if ( theFlags & UF_Model )
{
if( CAM_DataModel* aDataModel = dataModel() )
/*!Create new instance of data model and return it.*/
CAM_DataModel* LightApp_Module::createDataModel()
{
+ DBG_FUN();
return new LightApp_DataModel( this );
}
/*!Create and return instance of LightApp_Selection.*/
LightApp_Selection* LightApp_Module::createSelection() const
{
+ DBG_FUN();
return new LightApp_Selection();
}
/*!Gets popup manager.(create if not exist)*/
QtxPopupMgr* LightApp_Module::popupMgr()
{
+ DBG_FUN();
if ( !myPopupMgr )
{
myPopupMgr = new QtxPopupMgr( 0, this );
*/
void LightApp_Module::startOperation( const int id )
{
+ DBG_FUN();
+ ARG(id);
LightApp_Operation* op = 0;
if( myOperations.contains( id ) && reusableOperation( id ) )
op = myOperations[ id ];
*/
LightApp_Operation* LightApp_Module::createOperation( const int id ) const
{
+ DBG_FUN();
+ ARG(id);
if( id==-1 )
return 0;
*/
void LightApp_Module::onOperationDestroyed()
{
+ DBG_FUN();
const QObject* s = sender();
if( s && s->inherits( "LightApp_Operation" ) )
{
*/
void LightApp_Module::onShowHide()
{
+ DBG_FUN();
if( !sender()->inherits( "QAction" ) || !popupMgr() )
return;
*/
void LightApp_Module::updateModuleVisibilityState()
{
+ DBG_FUN();
// update visibility state of objects
LightApp_Application* app = dynamic_cast<LightApp_Application*>(SUIT_Session::session()->activeApplication());
if ( !app ) return;
*/
void LightApp_Module::onObjectClicked( SUIT_DataObject* theObject, int theColumn )
{
+ DBG_FUN();
if ( !isActiveModule() ) return;
// change visibility of object
void LightApp_Module::onOBDestroyed()
{
+ DBG_FUN();
myIsFirstActivate = true;
}
#include <QTime>
#include <time.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "LightApp_OBSelector";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
\class LightApp_OBSelector
\brief Object browser selection handler class.
: SUIT_Selector( mgr, ob ),
myBrowser( ob )
{
+ DBG_FUN();
if ( myBrowser ) {
connect( myBrowser, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) );
}
*/
LightApp_OBSelector::~LightApp_OBSelector()
{
+ DBG_FUN();
}
/*!
*/
void LightApp_OBSelector::setModified()
{
+ DBG_FUN();
myModifiedTime = clock();
}
*/
void LightApp_OBSelector::onSelectionChanged()
{
+ DBG_FUN();
#ifdef _DEBUG_
QTime t1 = QTime::currentTime();
#endif
*/
void LightApp_OBSelector::getSelection( SUIT_DataOwnerPtrList& theList ) const
{
+ DBG_FUN();
if ( mySelectedList.count() == 0 ) {
SUIT_Session* session = SUIT_Session::session();
SUIT_Application* sapp = session ? session->activeApplication() : 0;
}
}
}
+ RET(mySelectedList.count());
theList = mySelectedList;
}
*/
void LightApp_OBSelector::setSelection( const SUIT_DataOwnerPtrList& theList )
{
+ DBG_FUN();
if ( !myBrowser )
return;
*/
void LightApp_OBSelector::fillEntries( QMap<QString, LightApp_DataObject*>& entries )
{
+ DBG_FUN();
entries.clear();
if ( !myBrowser )
#include <SUIT_Desktop.h>
#include <SUIT_Study.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "LightApp_Operation";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
* \brief Constructor
*
myModule( 0 ),
myIsAutoResumed( true )
{
+ DBG_FUN();
}
/*!
*/
LightApp_Operation::~LightApp_Operation()
{
-
+ DBG_FUN();
}
/*!
*/
void LightApp_Operation::setModule( LightApp_Module* theModule )
{
+ DBG_FUN();
myModule = theModule;
setApplication( myModule ? myModule->application() : 0 );
setStudy( application() ? application()->activeStudy() : 0 );
*/
void LightApp_Operation::resumeOperation()
{
+ DBG_FUN();
SUIT_Operation::resumeOperation();
setDialogActive( true );
}
*/
void LightApp_Operation::startOperation()
{
+ DBG_FUN();
if( selectionMgr() )
connect( selectionMgr(), SIGNAL( selectionChanged() ), SLOT( onSelectionDone() ) );
*/
void LightApp_Operation::suspendOperation()
{
+ DBG_FUN();
SUIT_Operation::suspendOperation();
setDialogActive( false );
}
*/
void LightApp_Operation::abortOperation()
{
+ DBG_FUN();
SUIT_Operation::abortOperation();
setDialogActive( true );
if ( dlg() )
*/
void LightApp_Operation::commitOperation()
{
+ DBG_FUN();
SUIT_Operation::commitOperation();
setDialogActive( true );
if ( dlg() )
*/
void LightApp_Operation::activateSelection()
{
+ DBG_FUN();
}
/*!
*/
void LightApp_Operation::selectionDone()
{
+ DBG_FUN();
}
/*!
*/
void LightApp_Operation::onSelectionDone()
{
+ DBG_FUN();
if ( isActive() )
selectionDone();
}
*/
void LightApp_Operation::update( const int flags )
{
+ DBG_FUN();
if ( myModule != 0 )
myModule->update( flags );
}
*/
void LightApp_Operation::setDialogActive( const bool active )
{
+ DBG_FUN();
+ ARG(active);
if( dlg() )
{
if( active )
*/
void LightApp_Operation::setAutoResumed( const bool on )
{
+ DBG_FUN();
+ ARG(on);
myIsAutoResumed = on;
}
#include <QtCore/QSet>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "LightApp_Selection";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Constructor
*/
LightApp_Selection::LightApp_Selection()
: myStudy( 0 )
{
+ DBG_FUN();
}
/*!
*/
LightApp_Selection::~LightApp_Selection()
{
+ DBG_FUN();
}
/*!
*/
void LightApp_Selection::init( const QString& client, LightApp_SelectionMgr* mgr)
{
+ DBG_FUN();
+ ARG(client);
myContext = client;
if ( mgr ) {
*/
int LightApp_Selection::count() const
{
+ MSGEL("...numSelObjs = " << (int)myObjects.size());
return myObjects.size();
}
//QVariant LightApp_Selection::contextParameter( const QString& p ) const
QVariant LightApp_Selection::parameter( const QString& p ) const
{
+ DBG_FUN();
+ ARG(p);
QVariant v;
if ( p == "client" )
//QVariant LightApp_Selection::objectParameter( const int idx, const QString& p ) const
QVariant LightApp_Selection::parameter( const int idx, const QString& p ) const
{
+ DBG_FUN();
+ ARG(idx);
+ ARG(p);
LightApp_Application* app = 0;
if ( myStudy )
app = dynamic_cast<LightApp_Application*>( myStudy->application() );
QString LightApp_Selection::entry( const int index ) const
{
QVariant v = objectInfo( index, OI_Entry );
+ QString qEntry = v.canConvert( QVariant::String ) ? v.toString() : QString();
+ MSGEL("LightApp_Selection::entry(index=" << index << ") -> \"" << qEntry.toStdString() << "\"");
return v.canConvert( QVariant::String ) ? v.toString() : QString();
}
*/
void LightApp_Selection::setObjectInfo( const int idx, const int inf, const QVariant& val )
{
+ DBG_FUN();
+ ARG(idx);
+ ARG(inf);
if ( 0 <= idx && idx < myObjects.size() )
myObjects[idx].insert( inf, val );
}
#include <QtCore/QSet>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "LightApp_SelectionMgr";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Constructor.
*/
myTimeStamp( QTime::currentTime() ),
myCacheState( false )
{
+ DBG_FUN();
}
/*!
*/
LightApp_SelectionMgr::~LightApp_SelectionMgr()
{
+ DBG_FUN();
}
/*!
void LightApp_SelectionMgr::setSelected( const SUIT_DataOwnerPtrList& lst, const bool append )
{
+ DBG_FUN();
SUIT_SelectionMgr::setSelected( lst, append );
myTimeStamp = QTime::currentTime();
LightApp_SelectionMgr::soleSelectedObject( const QString& theType,
const bool convertReferences ) const
{
+ DBG_FUN();
+ ARG(theType);
SALOME_ListIO list;
selectedObjects( list, theType, convertReferences, true );
return list.Extent() == 1 ? list.First() : Handle(SALOME_InteractiveObject)();
const bool convertReferences,
const bool sole) const
{
+ DBG_FUN();
+ ARG(theType);
LightApp_Study* study = dynamic_cast<LightApp_Study*>( application()->activeStudy() );
if ( !study )
return;
*/
void LightApp_SelectionMgr::setSelectedObjects( const SALOME_ListIO& lst, const bool append )
{
+ DBG_FUN();
SUIT_DataOwnerPtrList owners;
for ( SALOME_ListIteratorOfListIO it( lst ); it.More(); it.Next() )
{
*/
void LightApp_SelectionMgr::selectionChanged( SUIT_Selector* theSel )
{
+ DBG_FUN();
SUIT_SelectionMgr::selectionChanged( theSel );
myTimeStamp = QTime::currentTime();
void LightApp_SelectionMgr::GetIndexes( const Handle(SALOME_InteractiveObject)& IObject,
TColStd_IndexedMapOfInteger& theIndex)
{
+ DBG_FUN();
theIndex.Clear();
SUIT_DataOwnerPtrList aList;
*/
void LightApp_SelectionMgr::GetIndexes( const QString& theEntry, TColStd_IndexedMapOfInteger& theIndex )
{
+ DBG_FUN();
+ ARG(theEntry);
theIndex.Clear();
SUIT_DataOwnerPtrList aList;
const TColStd_MapOfInteger& theIndexes,
bool modeShift)
{
+ DBG_FUN();
SUIT_DataOwnerPtrList remainsOwners;
SUIT_DataOwnerPtrList aList;
void LightApp_SelectionMgr::selectObjects( const Handle(SALOME_InteractiveObject)& IObject,
TColStd_IndexedMapOfInteger theIndex, bool append )
{
+ DBG_FUN();
SUIT_DataOwnerPtrList aList;
if ( theIndex.IsEmpty() )
*/
void LightApp_SelectionMgr::selectObjects( MapIOOfMapOfInteger theMapIO, bool append )
{
+ DBG_FUN();
SUIT_DataOwnerPtrList aList;
MapIOOfMapOfInteger::Iterator it(theMapIO);
*/
void LightApp_SelectionMgr::selectedSubOwners( MapEntryOfMapOfInteger& theMap )
{
+ DBG_FUN();
theMap.Clear();
TColStd_IndexedMapOfInteger anIndexes;
void LightApp_SelectionMgr::clearSelectionCache()
{
+ DBG_FUN();
myCacheTimes.clear();
myCacheSelection.clear();
}
void LightApp_SelectionMgr::setSelectionCacheEnabled( bool on )
{
+ DBG_FUN();
+ ARG(on);
if ( myCacheState == on )
return;
QList<Handle(SALOME_InteractiveObject)> LightApp_SelectionMgr::selectionCache( const QString& type ) const
{
+ DBG_FUN();
+ ARG(type);
QList<Handle(SALOME_InteractiveObject)> res;
QStringList types;
bool LightApp_SelectionMgr::isActualSelectionCache( const QString& type ) const
{
+ DBG_FUN();
+ ARG(type);
bool ok = true;
QStringList types;
QStringList LightApp_SelectionMgr::selectorTypes() const
{
+ DBG_FUN();
QStringList types;
QList<SUIT_Selector*> selectorList;
selectors( selectorList );
for ( QList<SUIT_Selector*>::const_iterator it = selectorList.begin(); it != selectorList.end(); ++it ) {
if ( (*it)->isEnabled() )
+ {
+ SHOW((*it)->type());
types.append( (*it)->type() );
+ }
}
return types;
}
#include <SALOME_ListIO.hxx>
#endif
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "LightApp_ShowHideOp";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Constructor
*/
: LightApp_Operation(),
myActionType( type )
{
+ DBG_FUN();
}
/*!
*/
LightApp_ShowHideOp::~LightApp_ShowHideOp()
{
+ DBG_FUN();
}
/*!
*/
void LightApp_ShowHideOp::startOperation()
{
+ DBG_FUN();
LightApp_Application* app = dynamic_cast<LightApp_Application*>( application() );
LightApp_Study* study = app ? dynamic_cast<LightApp_Study*>( app->activeStudy() ) : 0;
if( !app || !study )
--- /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
+\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 MBSUIT_H\r
+#define MBSUIT_H\r
+\r
+#include <SUIT_DataObject.h>\r
+\r
+\r
+//==========================================================================\r
+static void DumpVar(const char *szName, const SUIT_DataObject *value) {\r
+ if (value) {\r
+ DLOG << "[DataObj]: " << szName << "=" << (void*)value << " name=\"" << value->name().toStdString() << "\" level=" << value->level() \r
+ << " pos=" << value->position() << " #child=" << value->childCount() << " what=\"" << value->whatsThis().toStdString() << "\"" << std::endl;\r
+ }\r
+ else {\r
+ DLOG << "[DataObj]: " << szName << "=null" << std::endl;\r
+ }\r
+}\r
+\r
+#endif // MBSUIT_H
\ No newline at end of file
--- /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
+\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
#include "OCCViewer_AISSelector.h"
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "OCCViewer_AISSelector";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Constructor
*/
myEnableSelection( true ),
myEnableMultipleSelection( true )
{
+ DBG_FUN();
myHilightColor = Quantity_NOC_CYAN1;
mySelectColor = Quantity_NOC_GRAY80;
*/
OCCViewer_AISSelector::~OCCViewer_AISSelector()
{
+ DBG_FUN();
}
/*!
*/
void OCCViewer_AISSelector::enableSelection( bool bEnable )
{
+ DBG_FUN();
+ ARG(bEnable);
myEnableSelection = bEnable;
}
*/
void OCCViewer_AISSelector::enableMultipleSelection( bool bEnable )
{
+ DBG_FUN();
+ ARG(bEnable);
myEnableMultipleSelection = bEnable;
if ( bEnable ) myEnableSelection = bEnable;
}
*/
void OCCViewer_AISSelector::setAISContext ( const Handle (AIS_InteractiveContext)& aisContext )
{
+ DBG_FUN();
myAISContext = aisContext;
if ( ! myAISContext.IsNull() ) {
const Handle(Prs3d_Drawer)& hStyle = myAISContext->HighlightStyle();
if ( !myEnableSelection )
return false;
+ DBG_FUN();
bool hadSelection = ( myNumSelected > 0 );
/* select and send notifications */
if ( !myEnableSelection || !myEnableMultipleSelection )
return false; /* selection with rectangle is considered as multiple selection */
+ DBG_FUN();
bool hadSelection = ( myNumSelected > 0 );
/* select and send notifications */
if ( !myEnableSelection )
return false;
+ DBG_FUN();
bool hadSelection = ( myNumSelected > 0 ); /* something was selected */
if ( hadSelection && !myEnableMultipleSelection)
return false;
if ( !myEnableSelection || !myEnableMultipleSelection )
return false; /* selection with rectangle is considered as multiple selection */
+ DBG_FUN();
bool hadSelection = ( myNumSelected > 0 ); /* something was selected */
if ( hadSelection && !myEnableMultipleSelection)
return false;
#include <Basics_OCCTVersion.hxx>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "OCCViewer_VService";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Create native view window for CasCade view [ static ]
*/
Handle(Aspect_Window) OCCViewer_VService::CreateWindow( const Handle(V3d_View)& view,
WId winId )
{
+ DBG_FUNC();
#if OCC_VERSION_LARGE < 0x07070000
Aspect_Handle aWindowHandle = (Aspect_Handle)winId;
#else
*/
Handle(V3d_Viewer) OCCViewer_VService::CreateViewer()
{
+ DBG_FUNC();
Handle(OpenGl_GraphicDriver) aGraphicDriver =
new OpenGl_GraphicDriver(new Aspect_DisplayConnection());
return new V3d_Viewer(aGraphicDriver);
#include <QLayout>
#include <QApplication>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "OCCViewer_ViewFrame";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
OCCViewer_ViewFrame::OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel)
: OCCViewer_ViewWindow( theDesktop, theModel ), mySplitMode(-1), myPopupRequestedView(0)
{
+ DBG_FUN();
QFrame* centralFrame = new QFrame( this );
setCentralWidget( centralFrame );
OCCViewer_ViewFrame::~OCCViewer_ViewFrame()
{
+ DBG_FUN();
}
bool OCCViewer_ViewFrame::event( QEvent* e )
//**************************************************************************************
void OCCViewer_ViewFrame::setViewManager( SUIT_ViewManager* theMgr )
{
+ DBG_FUN();
OCCViewer_ViewWindow::setViewManager(theMgr);
foreach (OCCViewer_ViewWindow* aView, myViews) {
aView->setViewManager(theMgr);
//**************************************************************************************
void OCCViewer_ViewFrame::returnTo3dView()
{
+ DBG_FUN();
OCCViewer_ViewWindow* view = 0;
for (int i = BOTTOM_RIGHT; i <= TOP_RIGHT; i++ ) {
view = myViews.at(i);
//**************************************************************************************
void OCCViewer_ViewFrame::onMaximizedView( OCCViewer_ViewWindow* theView, bool isMaximized)
{
+ DBG_FUN();
myMaximizedView = theView;
myActiveView = theView;
if (isMaximized) {
//**************************************************************************************
void OCCViewer_ViewFrame::createSubViews()
{
+ DBG_FUN();
OCCViewer_Viewer* aModel = dynamic_cast<OCCViewer_Viewer*>(myManager->getViewModel());
if (!aModel) return;
int i = 0;
//**************************************************************************************
void OCCViewer_ViewFrame::setSubViewParams( OCCViewer_ViewWindow* theView )
{
+ DBG_FUN();
Handle(V3d_View) aView = theView->getViewPort()->getView();
Handle(V3d_View) aMainView = myViews.at( MAIN_VIEW )->getViewPort()->getView();
void OCCViewer_ViewFrame::splitSubViews()
{
+ DBG_FUN();
if( mySplitMode == -1 )
return;
void OCCViewer_ViewFrame::setCuttingPlane( bool on, const double x , const double y , const double z,
const double dx, const double dy, const double dz)
{
+ DBG_FUN();
foreach (OCCViewer_ViewWindow* aView, myViews) {
aView->setCuttingPlane(on, x, y, z, dx, dy, dz);
aView->update();
//**************************************************************************************
void OCCViewer_ViewFrame::setCuttingPlane( bool on, const gp_Pln thePln )
{
+ DBG_FUN();
foreach (OCCViewer_ViewWindow* aView, myViews) {
aView->setCuttingPlane(on, thePln);
aView->update();
//**************************************************************************************
void OCCViewer_ViewFrame::setInteractionStyle( const int i )
{
+ DBG_FUN();
foreach (OCCViewer_ViewWindow* aView, myViews) {
aView->setInteractionStyle(i);
}
//**************************************************************************************
void OCCViewer_ViewFrame::setProjectionType( int t)
{
+ DBG_FUN();
foreach (OCCViewer_ViewWindow* aView, myViews) {
aView->setProjectionType(t);
}
//**************************************************************************************
void OCCViewer_ViewFrame::setSelectionStyle(OCCViewer_ViewWindow::SelectionStyle t)
{
+ DBG_FUN();
foreach(OCCViewer_ViewWindow* aView, myViews) {
aView->setSelectionStyle(t);
}
//**************************************************************************************
void OCCViewer_ViewFrame::setStereoType( int t)
{
+ DBG_FUN();
foreach (OCCViewer_ViewWindow* aView, myViews) {
aView->setStereoType(t);
}
//**************************************************************************************
void OCCViewer_ViewFrame::setVSync( bool t)
{
+ DBG_FUN();
foreach (OCCViewer_ViewWindow* aView, myViews) {
aView->setVSync(t);
}
//**************************************************************************************
void OCCViewer_ViewFrame::setQuadBufferSupport( bool t)
{
+ DBG_FUN();
foreach (OCCViewer_ViewWindow* aView, myViews) {
aView->setQuadBufferSupport(t);
}
//**************************************************************************************
void OCCViewer_ViewFrame::connectViewSignals(OCCViewer_ViewWindow* theView)
{
+ DBG_FUN();
connect( theView, SIGNAL( returnedTo3d( ) ), this, SLOT( returnTo3dView( ) ) );
connect( theView, SIGNAL( maximized( OCCViewer_ViewWindow*, bool ) ),
// obsolete
void OCCViewer_ViewFrame::setBackgroundColor( const QColor& theColor )
{
+ DBG_FUN();
if (myPopupRequestedView)
myPopupRequestedView->setBackgroundColor(theColor);
else {
}
void OCCViewer_ViewFrame::setBackground( const Qtx::BackgroundData& theBackground )
{
+ DBG_FUN();
if (myPopupRequestedView)
myPopupRequestedView->setBackground(theBackground);
else {
void OCCViewer_ViewFrame::onViewFitAll()
{
+ DBG_FUN();
foreach (OCCViewer_ViewWindow* aView, myViews) {
aView->onViewFitAll();
}
void OCCViewer_ViewFrame::onFitAll()
{
+ DBG_FUN();
foreach (OCCViewer_ViewWindow* aView, myViews) {
aView->onFitAll();
}
void OCCViewer_ViewFrame::setDropDownButtons( bool on )
{
+ DBG_FUN();
foreach( OCCViewer_ViewWindow* aView, myViews ) {
aView->setDropDownButtons( on );
}
void OCCViewer_ViewFrame::setVisualParameters( const QString& parameters )
{
+ DBG_FUN();
QStringList params = parameters.split( "|" );
if ( params.count() > 1 ) {
int maximizedView = params[0].toInt();
void OCCViewer_ViewFrame::enableSelection( bool isEnabled )
{
+ DBG_FUN();
+ ARG(isEnabled);
foreach (OCCViewer_ViewWindow* aView, myViews) {
aView->enableSelection(isEnabled);
}
void OCCViewer_ViewFrame::enablePreselection( bool isEnabled )
{
+ DBG_FUN();
+ ARG(isEnabled);
foreach (OCCViewer_ViewWindow* aView, myViews) {
aView->enablePreselection(isEnabled);
}
bool OCCViewer_ViewFrame::enableDrawMode( bool on )
{
+ DBG_FUN();
+ ARG(on);
bool prev = false;
foreach (OCCViewer_ViewWindow* aView, myViews) {
prev = prev || aView->enableDrawMode( on );
#include "OCCViewer_ViewWindow.h"
#include "SUIT_Desktop.h"
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "OCCViewer_ViewManager";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Constructor
*/
: SUIT_ViewManager( study, theDesktop, new OCCViewer_Viewer( DisplayTrihedron ) ),
myIsChainedOperations( false )
{
+ DBG_FUN();
setTitle( tr( "OCC_VIEW_TITLE" ) );
}
*/
OCCViewer_ViewManager::~OCCViewer_ViewManager()
{
+ DBG_FUN();
}
/*!
*/
void OCCViewer_ViewManager::contextMenuPopup( QMenu* popup )
{
+ DBG_FUN();
SUIT_ViewManager::contextMenuPopup( popup );
// if it is necessary invoke method CreatePopup of ViewPort
// be sure that existing QPopupMenu menu is used for that.
void OCCViewer_ViewManager::setChainedOperations( bool isChainedOperations )
{
+ DBG_FUN();
+ ARG(isChainedOperations);
myIsChainedOperations = isChainedOperations;
}
#include <Basics_OCCTVersion.hxx>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "OCCViewer_ViewModel";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
namespace
{
void setCappingColor(const Handle(Graphic3d_ClipPlane)& plane, const QColor& color)
myClippingDlg(0),
myFitter(0)
{
+ DBG_FUN();
// init CasCade viewers
myV3dViewer = OCCViewer_VService::CreateViewer();
//myV3dViewer->Init(); // to avoid creation of the useless perspective view (see OCCT issue 0024267)
*/
OCCViewer_Viewer::~OCCViewer_Viewer()
{
+ DBG_FUN();
myAISContext.Nullify();
myV3dViewer.Nullify();
}
*/
void OCCViewer_Viewer::setBackgroundColor( const QColor& c )
{
+ DBG_FUN();
setBackgroundColor( 0, c );
}
*/
void OCCViewer_Viewer::setBackground( const Qtx::BackgroundData& theBackground )
{
+ DBG_FUN();
setBackground( 0, theBackground );
}
*/
void OCCViewer_Viewer::initView( OCCViewer_ViewWindow* view )
{
+ DBG_FUN();
if ( view ) {
view->initLayout();
view->initSketchers();
*/
SUIT_ViewWindow* OCCViewer_Viewer::createView( SUIT_Desktop* theDesktop )
{
+ DBG_FUN();
// create view frame
OCCViewer_ViewFrame* view = new OCCViewer_ViewFrame(theDesktop, this);
// get main view window (created by view frame)
*/
void OCCViewer_Viewer::setViewManager(SUIT_ViewManager* theViewManager)
{
+ DBG_FUN();
SUIT_ViewModel::setViewManager(theViewManager);
if (theViewManager) {
connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)),
*/
void OCCViewer_Viewer::onMouseRelease(SUIT_ViewWindow* theWindow, QMouseEvent* theEvent)
{
+ DBG_FUN();
if (!mySelectionEnabled) return;
if (theEvent->button() != Qt::LeftButton) return;
if (!theWindow->inherits("OCCViewer_ViewWindow")) return;
void OCCViewer_Viewer::onViewClosed(OCCViewer_ViewPort3d*)
{
+ DBG_FUN();
Standard_Integer aViewsNb = 0;
for ( myV3dViewer->InitActiveViews(); myV3dViewer->MoreActiveViews(); myV3dViewer->NextActiveViews())
++aViewsNb;
void OCCViewer_Viewer::onViewMapped(OCCViewer_ViewPort3d* viewPort)
{
+ DBG_FUN();
+
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
setTrihedronShown( true );
*/
void OCCViewer_Viewer::setInteractionStyle( const int theStyle )
{
+ DBG_FUN();
myInteractionStyle = theStyle;
//!! To be done for view windows
if ( !myViewManager )
*/
void OCCViewer_Viewer::setProjectionType( const int theType )
{
+ DBG_FUN();
if ( myProjectionType != theType ) {
if ( theType != OCCViewer_ViewWindow::Stereo )
myProjectionType = theType;
void OCCViewer_Viewer::setSelectionStyle(OCCViewer_ViewWindow::SelectionStyle theMode)
{
+ DBG_FUN();
if (mySelectionStyle != theMode) {
mySelectionStyle = theMode;
if (!myViewManager)
*/
void OCCViewer_Viewer::setStereoType( const int theType )
{
+ DBG_FUN();
myStereoType = theType;
if ( !myViewManager )
*/
void OCCViewer_Viewer::setVSync( const bool theEnable )
{
+ DBG_FUN();
myVSyncMode = theEnable;
if ( !myViewManager )
*/
void OCCViewer_Viewer::setQuadBufferSupport( const bool theEnable )
{
+ DBG_FUN();
myQuadBufferSupport = theEnable;
if ( !myViewManager )
*/
void OCCViewer_Viewer::enablePreselection(bool isEnabled)
{
+ DBG_FUN();
myPreselectionEnabled = isEnabled;
if ( !myViewManager )
*/
void OCCViewer_Viewer::enableSelection(bool isEnabled)
{
+ DBG_FUN();
mySelectionEnabled = isEnabled;
//!! To be done for view windows
*/
void OCCViewer_Viewer::enableMultiselection(bool isEnable)
{
+ DBG_FUN();
myMultiSelectionEnabled = isEnable;
//!! To be done for view windows
if ( !myViewManager )
void OCCViewer_Viewer::setClippingTextureParams( const bool isDefault, const QString& theTexture,
const bool isModulate, const double theScale )
{
+ DBG_FUN();
myDefaultTextureUsed = isDefault;
myClippingTexture = theTexture;
myTextureModulated = isModulate;
*/
void OCCViewer_Viewer::contextMenuPopup(QMenu* thePopup)
{
+ DBG_FUN();
thePopup->addAction( tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
thePopup->addAction( tr( "MEN_CHANGE_BACKGROUND" ), this, SLOT( onChangeBackground() ) );
*/
void OCCViewer_Viewer::onChangeBackground()
{
+ DBG_FUN();
OCCViewer_ViewWindow* aView = dynamic_cast<OCCViewer_ViewWindow*>(myViewManager->getActiveView());
if ( !aView )
return;
*/
void OCCViewer_Viewer::update()
{
+ DBG_FUN();
if (!myV3dViewer.IsNull())
myV3dViewer->Update();
*/
void OCCViewer_Viewer::setObjectsSelected(const AIS_ListOfInteractive& theList)
{
+ DBG_FUN();
AIS_ListIteratorOfListOfInteractive aIt;
for (aIt.Initialize(theList); aIt.More(); aIt.Next())
myAISContext->AddOrRemoveSelected(aIt.Value(), false);
*/
void OCCViewer_Viewer::setDefaultLights()
{
+ DBG_FUN();
// clear all light sources
myV3dViewer->InitDefinedLights();
while ( myV3dViewer->MoreDefinedLights() )
const QColor& color,
bool update )
{
+ DBG_FUN();
if( !obj.IsNull() )
{
Quantity_Color CSFColor = Quantity_Color ( color.red() / 255.,
void OCCViewer_Viewer::switchRepresentation( const Handle(AIS_InteractiveObject)& obj,
int mode, bool update )
{
+ DBG_FUN();
myAISContext->SetDisplayMode( obj, (Standard_Integer)mode, update );
if( update )
myV3dViewer->Update();
void OCCViewer_Viewer::setTransparency( const Handle(AIS_InteractiveObject)& obj,
float trans, bool update )
{
+ DBG_FUN();
myAISContext->SetTransparency( obj, trans, false );
myAISContext->Redisplay( obj, Standard_False, Standard_True );
if( update )
*/
OCCViewer_ViewWindow* OCCViewer_Viewer::createSubWindow()
{
+ DBG_FUN();
return new OCCViewer_ViewWindow(0, this);
}
*/
Handle(Graphic3d_ClipPlane) OCCViewer_Viewer::createClipPlane(const gp_Pln& thePlane, const Standard_Boolean theIsOn)
{
+ DBG_FUN();
Handle(Graphic3d_ClipPlane) aGraphic3dPlane = new Graphic3d_ClipPlane( thePlane );
aGraphic3dPlane->SetOn( theIsOn );
aGraphic3dPlane->SetCapping( Standard_True );
*/
void OCCViewer_Viewer::setClipPlanes(ClipPlanesList theList)
{
+ DBG_FUN();
// 1. Remove existing clipping planes
myClipPlanes.clear();
myInternalClipPlanes.Clear();
bool OCCViewer_Viewer::enableDrawMode( bool on )
{
+ DBG_FUN();
+ ARG(on);
+
//!! To be done for view windows
if ( !myViewManager )
return false;
#undef QT_CLEAN_NAMESPACE
#include <Xw_Window.hxx>
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "OCCViewer_ViewPort";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
struct CMapEntry
{
CMapEntry();
OCCViewer_ViewPort::OCCViewer_ViewPort( QWidget* parent )
: QWidget( parent )
{
+ DBG_FUN();
initialize();
}
*/
OCCViewer_ViewPort::~OCCViewer_ViewPort()
{
+ DBG_FUN();
cleanup();
}
*/
void OCCViewer_ViewPort::initialize()
{
+ DBG_FUN();
myPaintersRedrawing = false;
myEnableSketching = true;
myEnableTransform = true;
*/
void OCCViewer_ViewPort::cleanup()
{
+ DBG_FUN();
}
/*!
*/
void OCCViewer_ViewPort::selectVisualId()
{
+ DBG_FUN();
#if !defined WIN32 && !defined __APPLE__
XVisualInfo* pVisualInfo;
if ( QX11Info::display() )
*/
void OCCViewer_ViewPort::setBackgroundColor( const QColor& color )
{
+ DBG_FUN();
QPalette pal = palette();
pal.setColor( QPalette::Background, color );
setPalette( pal );
*/
void OCCViewer_ViewPort::setSketchingEnabled( bool enable )
{
+ DBG_FUN();
myEnableSketching = enable;
}
*/
void OCCViewer_ViewPort::setTransformEnabled( bool enable )
{
+ DBG_FUN();
myEnableTransform = enable;
}
*/
void OCCViewer_ViewPort::onChangeBackground()
{
+ DBG_FUN();
QColor selColor = QColorDialog::getColor ( backgroundColor(), this );
if ( selColor.isValid() )
setBackgroundColor( selColor );
//#include <Xw_Window.hxx>
#endif
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "OCCViewer_ViewPort3d";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
static double rx = 0.;
static double ry = 0.;
static int sx = 0;
myScale( 1.0 ),
myIsAdvancedZoomingEnabled( false )
{
+ DBG_FUN();
// VSR: 01/07/2010 commented to avoid SIGSEGV at SALOME exit
//selectVisualId();
*/
OCCViewer_ViewPort3d::~OCCViewer_ViewPort3d()
{
+ DBG_FUN();
if ( myCursor )
{
delete myCursor;
*/
bool OCCViewer_ViewPort3d::mapView( const Handle(V3d_View)& view )
{
+ DBG_FUN();
if ( !setWindow( view ) )
return false;
*/
Handle( V3d_View ) OCCViewer_ViewPort3d::setView( const Handle( V3d_View )& view )
{
+ DBG_FUN();
/* map the new view */
if ( view == activeView() || !mapView( view ) )
return activeView();
*/
void OCCViewer_ViewPort3d::setBackgroundColor( const QColor& color )
{
+ DBG_FUN();
Qtx::BackgroundData bg = background();
bg.setColor( color );
setBackground( bg );
*/
void OCCViewer_ViewPort3d::setBackground( const Qtx::BackgroundData& bgData )
{
+ DBG_FUN();
if ( bgData.isValid() ) {
myBackground = bgData;
updateBackground();
void OCCViewer_ViewPort3d::updateBackground()
{
+ DBG_FUN();
if ( activeView().IsNull() ) return;
if ( !myBackground.isValid() ) return;
*/
void OCCViewer_ViewPort3d::onUpdate()
{
+ DBG_FUN();
if ( !activeView().IsNull() )
activeView()->Update();
}
*/
void OCCViewer_ViewPort3d::fitRect( const QRect& rect )
{
+ DBG_FUN();
if ( !activeView().IsNull() ) {
activeView()->WindowFit( rect.left(), rect.top(), rect.right(), rect.bottom() );
emit vpTransformed( this );
*/
void OCCViewer_ViewPort3d::resizeEvent( QResizeEvent* e )
{
+ DBG_FUN();
/* Map before first show to avoid flicker */
if ( !mapped( activeView() ) )
mapView( activeView() );
*/
void OCCViewer_ViewPort3d::fitAll( bool keepScale, bool /*withZ*/, bool upd )
{
+ DBG_FUN();
if ( activeView().IsNull() )
return;
*/
bool OCCViewer_ViewPort3d::setWindow( const Handle(V3d_View)& view )
{
+ DBG_FUN();
if ( !myWindow.IsNull() )
return true;
void OCCViewer_ViewPort3d::attachWindow( const Handle(V3d_View)& view,
const Handle(Aspect_Window)& window)
{
+ DBG_FUN();
if (!view.IsNull()) {
view->SetWindow( window );
updateBackground();
*/
bool OCCViewer_ViewPort3d::synchronize( OCCViewer_ViewPort* view )
{
+ DBG_FUN();
bool ok = false;
OCCViewer_ViewPort3d* vp3d = qobject_cast<OCCViewer_ViewPort3d*>( view );
if ( vp3d ) {
*/
void OCCViewer_ViewPort3d::setDefaultParams()
{
+ DBG_FUN();
setBackground( Qtx::BackgroundData( Qt::black ) ); // set default background
// get ray tracing parameters from preferences
#include "utilities.h"
+//---------------------------------------------------------
+#define USE_DEBUG
+static const char *dbg_class = "OCCViewer_ViewWindow";
+#include "MBDebug.h"
+//---------------------------------------------------------
+
// // OpenCV includes
// #include <cv.h>
// #include <highgui.h>
OCCViewer_Viewer* theModel )
: SUIT_ViewWindow( theDesktop )
{
+ DBG_FUN();
myModel = theModel;
myRestoreFlag = 0;
myEnableDrawMode = false;
*/
OCCViewer_ViewWindow::~OCCViewer_ViewWindow()
{
+ DBG_FUN();
endDrawRect();
qDeleteAll( mySketchers );
}
*/
void OCCViewer_ViewWindow::initLayout()
{
+ DBG_FUN();
myViewPort = new OCCViewer_ViewPort3d( this, myModel->getViewer3d(), V3d_ORTHOGRAPHIC );
myViewPort->installEventFilter(this);
setCentralWidget(myViewPort);
*/
bool OCCViewer_ViewWindow::enableDrawMode( bool on )
{
+ DBG_FUN();
bool prev = myDrawRectEnabled;
myDrawRectEnabled = on;
updateEnabledDrawMode();
*/
void OCCViewer_ViewWindow::vpMousePressEvent( QMouseEvent* theEvent )
{
+ DBG_FUN();
myStartX = theEvent->x();
myStartY = theEvent->y();
int anInteractionStyle = interactionStyle();
*/
bool OCCViewer_ViewWindow::computeGravityCenter( double& theX, double& theY, double& theZ )
{
+ DBG_FUN();
Handle(V3d_View) aView3d = myViewPort->getView();
// Project boundaries points and add to avergae gravity
*/
void OCCViewer_ViewWindow::activateSetRotationGravity()
{
+ DBG_FUN();
if ( myRotationPointSelection )
{
Handle(AIS_InteractiveContext) ic = myModel->getAISContext();
*/
void OCCViewer_ViewWindow::updateGravityCoords()
{
+ DBG_FUN();
if ( mySetRotationPointDlg && mySetRotationPointDlg->isVisible() && myCurrPointType == BBCENTER )
{
Standard_Real Xcenter, Ycenter, Zcenter;
*/
void OCCViewer_ViewWindow::activateWindowFit()
{
+ DBG_FUN();
if ( !transformRequested() && !myCursorIsHand )
saveCursor(); /* save old cursor */
*/
bool OCCViewer_ViewWindow::setTransformRequested( OperationType op )
{
+ DBG_FUN();
bool ok = transformEnabled( op );
myOperation = ok ? op : NOVIEWOP;
myViewPort->setMouseTracking( myOperation == NOVIEWOP );
*/
void OCCViewer_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent)
{
+ DBG_FUN();
switch ( myOperation ) {
case NOVIEWOP:
{
*/
void OCCViewer_ViewWindow::resetState()
{
+ DBG_FUN();
myDrawRect = false;
if ( myRotationPointSelection )
*/
void OCCViewer_ViewWindow::createActions()
{
+ DBG_FUN();
if( !toolMgr()->isEmpty() )
return;
*/
void OCCViewer_ViewWindow::createToolBar()
{
+ DBG_FUN();
static const char* titles[] = {
"LBL_3DTOOLBAR_LABEL",
"LBL_XYTOOLBAR_LABEL",
*/
void OCCViewer_ViewWindow::onViewFitAll()
{
+ DBG_FUN();
myViewPort->fitAll();
}
*/
void OCCViewer_ViewWindow::onFrontView()
{
+ DBG_FUN();
emit vpTransformationStarted ( FRONTVIEW );
Handle(V3d_View) aView3d = myViewPort->getView();
if (myAutomaticZoom)
*/
void OCCViewer_ViewWindow::onBackView()
{
+ DBG_FUN();
emit vpTransformationStarted ( BACKVIEW );
Handle(V3d_View) aView3d = myViewPort->getView();
if (myAutomaticZoom)
*/
void OCCViewer_ViewWindow::onTopView()
{
+ DBG_FUN();
emit vpTransformationStarted ( TOPVIEW );
Handle(V3d_View) aView3d = myViewPort->getView();
if (myAutomaticZoom)
*/
void OCCViewer_ViewWindow::onBottomView()
{
+ DBG_FUN();
emit vpTransformationStarted ( BOTTOMVIEW );
Handle(V3d_View) aView3d = myViewPort->getView();
if (myAutomaticZoom)
*/
void OCCViewer_ViewWindow::onLeftView()
{
+ DBG_FUN();
emit vpTransformationStarted ( LEFTVIEW );
Handle(V3d_View) aView3d = myViewPort->getView();
if (myAutomaticZoom)
*/
void OCCViewer_ViewWindow::onRightView()
{
+ DBG_FUN();
emit vpTransformationStarted ( RIGHTVIEW );
Handle(V3d_View) aView3d = myViewPort->getView();
if (myAutomaticZoom)
*/
void OCCViewer_ViewWindow::onClockWiseView()
{
+ DBG_FUN();
emit vpTransformationStarted ( CLOCKWISEVIEW );
myViewPort->rotateXY( 90. );
emit vpTransformationFinished ( CLOCKWISEVIEW );
*/
void OCCViewer_ViewWindow::onAntiClockWiseView()
{
+ DBG_FUN();
emit vpTransformationStarted ( ANTICLOCKWISEVIEW );
myViewPort->rotateXY( -90. );
emit vpTransformationFinished ( ANTICLOCKWISEVIEW );
*/
void OCCViewer_ViewWindow::onResetView()
{
+ DBG_FUN();
emit vpTransformationStarted( RESETVIEW );
bool upd = myViewPort->getView()->SetImmediateUpdate( false );
myViewPort->getView()->Reset( false );
*/
void OCCViewer_ViewWindow::onProjectionType( QAction* theAction )
{
+ DBG_FUN();
Handle(V3d_View) aView3d = myViewPort->getView();
if ( !aView3d.IsNull() ) {
Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
*/
void OCCViewer_ViewWindow::onStereoType( bool activate )
{
+ DBG_FUN();
Handle(V3d_View) aView3d = myViewPort->getView();
if ( !aView3d.IsNull() ) {
Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
*/
void OCCViewer_ViewWindow::onProjectionType()
{
+ DBG_FUN();
emit vpTransformationStarted( PROJECTION );
if (toolMgr()->action( OrthographicId )->isChecked())
setProjectionType( Orthographic );
void OCCViewer_ViewWindow::setProjectionType( int mode )
{
+ DBG_FUN();
QtxAction* anOrthographicAction = dynamic_cast<QtxAction*>( toolMgr()->action( OrthographicId ) );
QtxAction* aPerspectiveAction = dynamic_cast<QtxAction*>( toolMgr()->action( PerspectiveId ) );
QtxAction* aStereoAction = dynamic_cast<QtxAction*>( toolMgr()->action( StereoId ) );
*/
void OCCViewer_ViewWindow::onFitAll()
{
+ DBG_FUN();
emit vpTransformationStarted( FITALLVIEW );
if (myModel->fitter())
myModel->fitter()->fitAll(myViewPort->getView());
*/
void OCCViewer_ViewWindow::onFitSelection()
{
+ DBG_FUN();
emit vpTransformationStarted( FITSELECTION );
myModel->getAISContext()->FitSelected( getViewPort()->getView() );
emit vpTransformationFinished( FITSELECTION );
*/
void OCCViewer_ViewWindow::onSetRotationPoint( bool on )
{
+ DBG_FUN();
if (on)
{
if (!mySetRotationPointDlg)
*/
void OCCViewer_ViewWindow::onCloneView()
{
+ DBG_FUN();
SUIT_ViewWindow* vw = myManager->createViewWindow();
//vw->show();
emit viewCloned( vw );
*/
void OCCViewer_ViewWindow::onAxialScale()
{
+ DBG_FUN();
if ( !myScalingDlg )
myScalingDlg = new OCCViewer_AxialScaleDlg( this , myModel );
*/
void OCCViewer_ViewWindow::onGraduatedAxes()
{
+ DBG_FUN();
myCubeAxesDlg->Update();
myCubeAxesDlg->show();
}
void OCCViewer_ViewWindow::onAmbientToogle()
{
+ DBG_FUN();
Handle(V3d_Viewer) viewer = myViewPort->getViewer();
viewer->InitDefinedLights();
while(viewer->MoreDefinedLights())
*/
void OCCViewer_ViewWindow::onMemorizeView()
{
+ DBG_FUN();
appendViewAspect( getViewParams() );
}
*/
void OCCViewer_ViewWindow::onRestoreView()
{
+ DBG_FUN();
OCCViewer_CreateRestoreViewDlg* aDlg = new OCCViewer_CreateRestoreViewDlg( centralWidget(), this );
connect( aDlg, SIGNAL( dlgOk() ), this, SLOT( setRestoreFlag() ) );
aDlg->exec();
*/
void OCCViewer_ViewWindow::performRestoring( const viewAspect& anItem, bool baseParamsOnly )
{
+ DBG_FUN();
Handle(V3d_View) aView3d = myViewPort->getView();
Standard_Boolean prev = aView3d->SetImmediateUpdate( Standard_False );
*/
void OCCViewer_ViewWindow::setRestoreFlag()
{
+ DBG_FUN();
myRestoreFlag = 1;
}
*/
void OCCViewer_ViewWindow::onTrihedronShow(bool show)
{
+ DBG_FUN();
myModel->setTrihedronShown(show);
}
*/
void OCCViewer_ViewWindow::onSwitchPreselection( bool on )
{
+ DBG_FUN();
myPreselectionEnabled = on;
myModel->setSelectionOptions( isPreselectionEnabled(), myModel->isSelectionEnabled() );
*/
void OCCViewer_ViewWindow::onSwitchSelection( bool on )
{
+ DBG_FUN();
mySelectionEnabled = on;
myModel->setSelectionOptions( myModel->isPreselectionEnabled(), isSelectionEnabled() );
void OCCViewer_ViewWindow::onSwitchSelectionStyle(QAction* theAction)
{
// selection
+ DBG_FUN();
OCCViewer_ViewSketcher* aSkecher = getSketcher(Polygon);
if (aSkecher) {
if (theAction == toolMgr()->action(PolygonSelectionStyleId)) {
void OCCViewer_ViewWindow::setSelectionStyle(SelectionStyle theMode)
{
+ DBG_FUN();
toolMgr()->action(RectangleSelectionStyleId)->setChecked(false);
toolMgr()->action(PolygonSelectionStyleId)->setChecked(false);
toolMgr()->action(CircleSelectionStyleId)->setChecked(false);
*/
void OCCViewer_ViewWindow::onSwitchInteractionStyle( bool on )
{
+ DBG_FUN();
myInteractionStyle = on ? (int)SUIT_ViewModel::KEY_FREE : (int)SUIT_ViewModel::STANDARD;
// update action state if method is called outside
*/
void OCCViewer_ViewWindow::onSwitchZoomingStyle( bool on )
{
+ DBG_FUN();
myViewPort->setAdvancedZoomingEnabled( on );
// update action state if method is called outside
*/
void OCCViewer_ViewWindow::setInteractionStyle( const int theStyle )
{
+ DBG_FUN();
onSwitchInteractionStyle( theStyle == (int)SUIT_ViewModel::KEY_FREE );
}
*/
void OCCViewer_ViewWindow::setZoomingStyle( const int theStyle )
{
+ DBG_FUN();
onSwitchZoomingStyle( theStyle == 1 );
}
//#define USE_OLD_IMPLEMENTATION
QImage OCCViewer_ViewWindow::dumpView()
{
+ DBG_FUN();
Handle(V3d_View) view = myViewPort->getView();
if ( view.IsNull() )
return QImage();
const QString& fileName,
const QString& /*format*/ )
{
+ DBG_FUN();
bool res = false;
QApplication::setOverrideCursor( Qt::WaitCursor );
void OCCViewer_ViewWindow::setCuttingPlane( bool on, const double x, const double y, const double z,
const double dx, const double dy, const double dz )
{
+ DBG_FUN();
Handle(V3d_View) view = myViewPort->getView();
if ( view.IsNull() )
return;
void OCCViewer_ViewWindow::setCuttingPlane( bool on, const gp_Pln pln )
{
+ DBG_FUN();
gp_Dir aDir = pln.Axis().Direction();
gp_Pnt aPnt = pln.Location();
setCuttingPlane(on, aPnt.X(), aPnt.Y(), aPnt.Z(), aDir.X(), aDir.Y(), aDir.Z());
*/
void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters )
{
+ DBG_FUN();
viewAspect params;
ClipPlanesList aClipPlanes;
QStringList data = parameters.split( '*' );
*/
void OCCViewer_ViewWindow::showEvent( QShowEvent* theEvent )
{
+ DBG_FUN();
emit Show( theEvent );
}
*/
void OCCViewer_ViewWindow::hideEvent( QHideEvent* theEvent )
{
+ DBG_FUN();
emit Hide( theEvent );
}
*/
void OCCViewer_ViewWindow::saveCursor()
{
+ DBG_FUN();
QCursor* aCursor = NULL;
if ( myViewPort )
aCursor = myViewPort->getDefaultCursor();
*/
OCCViewer_ViewSketcher* OCCViewer_ViewWindow::createSketcher( int type )
{
+ DBG_FUN();
if ( type == Rect )
return new OCCViewer_RectSketcher( this, type );
if ( type == Polygon )
void OCCViewer_ViewWindow::initSketchers()
{
+ DBG_FUN();
if ( mySketchers.isEmpty() )
{
mySketchers.append( createSketcher( Rect ) );
*/
void OCCViewer_ViewWindow::activateSketching( int type )
{
+ DBG_FUN();
OCCViewer_ViewPort3d* vp = getViewPort();
if ( !vp )
return;
*/
void OCCViewer_ViewWindow::onSketchingStarted()
{
+ DBG_FUN();
}
/*!
*/
void OCCViewer_ViewWindow::onSketchingFinished()
{
+ DBG_FUN();
MESSAGE("OCCViewer_ViewWindow::onSketchingFinished()");
if ( mypSketcher && mypSketcher->result() == OCCViewer_ViewSketcher::Accept )
{
void OCCViewer_ViewWindow::setTransformInProcess( bool bOn )
{
+ DBG_FUN();
myEventStarted = bOn;
}
*/
void OCCViewer_ViewWindow::setTransformEnabled( const OperationType id, const bool on )
{
+ DBG_FUN();
if ( id != NOVIEWOP ) myStatus.insert( id, on );
}
void OCCViewer_ViewWindow::onMaximizedView()
{
+ DBG_FUN();
setMaximized(!isMaximized());
}
void OCCViewer_ViewWindow::returnTo3dView()
{
+ DBG_FUN();
setReturnedTo3dView( true );
}
void OCCViewer_ViewWindow::setReturnedTo3dView(bool isVisible3dView)
{
+ DBG_FUN();
if ( !toolMgr()->action( ReturnTo3dViewId ) ||
toolMgr()->isShown(ReturnTo3dViewId) != isVisible3dView ) return;
if ( !isVisible3dView )
void OCCViewer_ViewWindow::setMaximized(bool toMaximize, bool toSendSignal)
{
+ DBG_FUN();
QAction* anAction = toolMgr()->action( MaximizedId );
QAction* anAction2 = toolMgr()->action( ReturnTo3dViewId );
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
void OCCViewer_ViewWindow::setSketcherStyle( bool enable )
{
+ DBG_FUN();
IsSketcherStyle = enable;
}
void OCCViewer_ViewWindow::set2dMode(Mode2dType theType)
{
+ DBG_FUN();
my2dMode = theType;
}
void OCCViewer_ViewWindow::setStereoType( int type )
{
+ DBG_FUN();
Handle(V3d_View) aView3d = myViewPort->getView();
if ( !aView3d.IsNull() ) {
Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams();
void OCCViewer_ViewWindow::setAnaglyphFilter( int type )
{
+ DBG_FUN();
Handle(V3d_View) aView3d = myViewPort->getView();
if ( !aView3d.IsNull() ) {
Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams();
void OCCViewer_ViewWindow::setStereographicFocus( int type, double value )
{
+ DBG_FUN();
Handle(V3d_View) aView3d = myViewPort->getView();
if ( !aView3d.IsNull() ) {
Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
void OCCViewer_ViewWindow::setInterocularDistance( int type, double value )
{
+ DBG_FUN();
Handle(V3d_View) aView3d = myViewPort->getView();
if ( !aView3d.IsNull() ) {
Handle(Graphic3d_Camera) aCamera = aView3d->Camera();
void OCCViewer_ViewWindow::setReverseStereo( bool reverse )
{
+ DBG_FUN();
Handle(V3d_View) aView3d = myViewPort->getView();
if ( !aView3d.IsNull() ) {
Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams();
void OCCViewer_ViewWindow::setVSync( bool enable )
{
+ DBG_FUN();
Handle(AIS_InteractiveContext) anIntCont = myModel->getAISContext();
if ( !anIntCont.IsNull() ) {
Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(anIntCont->CurrentViewer()->Driver());
void OCCViewer_ViewWindow::setQuadBufferSupport( bool enable )
{
+ DBG_FUN();
Handle(AIS_InteractiveContext) anIntCont = myModel->getAISContext();
if ( !anIntCont.IsNull() ) {
Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(anIntCont->CurrentViewer()->Driver());
// obsolete
void OCCViewer_ViewWindow::setBackgroundColor( const QColor& theColor )
{
+ DBG_FUN();
if ( myViewPort ) myViewPort->setBackgroundColor( theColor );
}
void OCCViewer_ViewWindow::setBackground( const Qtx::BackgroundData& theBackground )
{
+ DBG_FUN();
if ( myViewPort ) myViewPort->setBackground( theBackground );
}
void OCCViewer_ViewWindow::showStaticTrihedron( bool on )
{
+ DBG_FUN();
if ( myViewPort ) myViewPort->showStaticTrihedron( on );
}
*/
void OCCViewer_ViewWindow::clearViewAspects()
{
+ DBG_FUN();
myViewAspects.clear();
}
*/
void OCCViewer_ViewWindow::appendViewAspect( const viewAspect& aParams )
{
+ DBG_FUN();
myViewAspects.append( aParams );
}
*/
void OCCViewer_ViewWindow::updateViewAspects( const viewAspectList& aViewList )
{
+ DBG_FUN();
myViewAspects = aViewList;
}
*/
SUIT_CameraProperties OCCViewer_ViewWindow::cameraProperties()
{
+ DBG_FUN();
SUIT_CameraProperties aProps;
Handle(V3d_View) aSourceView = getViewPort()->getView();
*/
void OCCViewer_ViewWindow::synchronize( SUIT_ViewWindow* theView )
{
+ DBG_FUN();
bool blocked = blockSignals( true );
SUIT_CameraProperties aProps = theView->cameraProperties();
*/
void OCCViewer_ViewWindow::enablePreselection( bool theIsToEnable )
{
+ DBG_FUN();
onSwitchPreselection( theIsToEnable );
}
*/
void OCCViewer_ViewWindow::enableSelection( bool theIsToEnable )
{
+ DBG_FUN();
onSwitchSelection( theIsToEnable );
}
*/
void OCCViewer_ViewWindow::onClipping (bool theIsOn)
{
+ DBG_FUN();
if(!myModel) return;
OCCViewer_ClippingDlg* aClippingDlg = myModel->getClippingDlg();
void OCCViewer_ViewWindow::onRayTracing()
{
+ DBG_FUN();
if( !OCCViewer_Utilities::isDialogOpened( this, OCCViewer_RayTracingDlg::getName() ) ) {
QDialog* aDlg = new OCCViewer_RayTracingDlg( this );
if ( aDlg != NULL )
void OCCViewer_ViewWindow::onEnvTexture()
{
+ DBG_FUN();
if( !OCCViewer_Utilities::isDialogOpened( this, OCCViewer_EnvTextureDlg::getName() ) ) {
QDialog* aDlg = new OCCViewer_EnvTextureDlg( this );
if ( aDlg != NULL )
void OCCViewer_ViewWindow::onLightSource()
{
+ DBG_FUN();
if( !OCCViewer_Utilities::isDialogOpened( this, OCCViewer_LightSourceDlg::getName() ) ) {
QDialog* aDlg = new OCCViewer_LightSourceDlg( this, myModel );
if ( aDlg != NULL )
void OCCViewer_ViewWindow::setActionVisible( ActionId theId, bool isVisible )
{
+ DBG_FUN();
QAction* a = toolMgr()->action( theId );
if( a )
a->setVisible( isVisible );
void OCCViewer_ViewWindow::projAndPanToGravity(V3d_TypeOfOrientation CamOri)
{
+ DBG_FUN();
const bool USE_XY = true;
Handle(V3d_View) aView3d = myViewPort->getView();
void OCCViewer_ViewWindow::setAutomaticZoom(const bool isOn)
{
+ DBG_FUN();
myAutomaticZoom = isOn;
}
--- /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
+\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
#include "SALOME_Prs.h"
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MB_IGNORE_QT
+#define MBCLASSNAME "SALOME_Prs"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Constructor
*/
SALOME_Prs::SALOME_Prs(const char* e) : myIsClippable(true)
{
myEntry = std::string( e ? e : "" );
+ DBG_FUN();
+ ARG(myEntry);
}
/*!
// base implementation does nothing
}
+#define MBCLASSNAME "SALOME_OCCPrs"
/*!
Dispatches display operation to proper Display() method of SALOME_View
*/
void SALOME_OCCPrs::DisplayIn( SALOME_View* v ) const
{
+ DBG_FUN();
if ( v ) v->Display( this );
}
*/
void SALOME_OCCPrs::EraseIn( SALOME_View* v, const bool forced ) const
{
+ DBG_FUN();
if ( v ) v->Erase( this, forced );
}
*/
void SALOME_OCCPrs::BeforeDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
{
+ DBG_FUN();
d->BeforeDisplay( v, this );
}
*/
void SALOME_OCCPrs::AfterDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
{
+ DBG_FUN();
d->AfterDisplay( v, this );
}
*/
void SALOME_OCCPrs::BeforeEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
{
+ DBG_FUN();
d->BeforeErase( v, this );
}
*/
void SALOME_OCCPrs::AfterEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
{
+ DBG_FUN();
d->AfterErase( v, this );
}
*/
void SALOME_OCCPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
{
+ DBG_FUN();
std::list<int> modes;
modes.push_back( mode );
LocalSelectionIn( v, modes );
*/
void SALOME_OCCPrs::LocalSelectionIn( SALOME_View* v, const std::list<int> modes ) const
{
+ DBG_FUN();
if ( v && !modes.empty() ) v->LocalSelection( this, modes );
}
*/
void SALOME_OCCPrs::Update( SALOME_Displayer* d )
{
+ DBG_FUN();
if ( d ) d->Update( this );
}
+#define MBCLASSNAME "SALOME_VTKPrs"
/*!
Dispatches display operation to proper Display() method of SALOME_View
*/
void SALOME_VTKPrs::DisplayIn( SALOME_View* v ) const
{
+ DBG_FUN();
if ( v ) v->Display( this );
}
*/
void SALOME_VTKPrs::EraseIn( SALOME_View* v, const bool forced ) const
{
+ DBG_FUN();
if ( v ) v->Erase( this, forced );
}
*/
void SALOME_VTKPrs::BeforeDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
{
+ DBG_FUN();
d->BeforeDisplay( v, this );
}
*/
void SALOME_VTKPrs::AfterDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
{
+ DBG_FUN();
d->AfterDisplay( v, this );
}
*/
void SALOME_VTKPrs::BeforeEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
{
+ DBG_FUN();
d->BeforeErase( v, this );
}
*/
void SALOME_VTKPrs::AfterEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
{
+ DBG_FUN();
d->AfterErase( v, this );
}
*/
void SALOME_VTKPrs::LocalSelectionIn( SALOME_View* v, const int mode ) const
{
+ DBG_FUN();
if ( v ) v->LocalSelection( this, mode );
}
*/
void SALOME_VTKPrs::Update( SALOME_Displayer* d )
{
+ DBG_FUN();
if ( d ) d->Update( this );
}
+#define MBCLASSNAME "SALOME_Prs2d"
/*!
Dispatches display operation to proper Display() method of SALOME_View
*/
void SALOME_Prs2d::DisplayIn( SALOME_View* v ) const
{
+ DBG_FUN();
if ( v ) v->Display( this );
}
*/
void SALOME_Prs2d::EraseIn( SALOME_View* v, const bool forced ) const
{
+ DBG_FUN();
if ( v ) v->Erase( this, forced );
}
*/
void SALOME_Prs2d::BeforeDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
{
+ DBG_FUN();
d->BeforeDisplay( v, this );
}
*/
void SALOME_Prs2d::AfterDisplayIn( SALOME_Displayer* d, SALOME_View* v ) const
{
+ DBG_FUN();
d->AfterDisplay( v, this );
}
*/
void SALOME_Prs2d::BeforeEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
{
+ DBG_FUN();
d->BeforeErase( v, this );
}
*/
void SALOME_Prs2d::AfterEraseIn( SALOME_Displayer* d, SALOME_View* v ) const
{
+ DBG_FUN();
d->AfterErase( v, this );
}
*/
void SALOME_Prs2d::LocalSelectionIn( SALOME_View* v, const int mode ) const
{
+ DBG_FUN();
if ( v ) v->LocalSelection( this, mode );
}
*/
void SALOME_Prs2d::Update( SALOME_Displayer* d )
{
+ DBG_FUN();
if ( d ) d->Update( this );
}
+#define MBCLASSNAME "SALOME_View"
/*!
Gives control to SALOME_Prs object, so that it could perform double dispatch
*/
void SALOME_View::Display( SALOME_Displayer* d, const SALOME_Prs* prs )
{
+ DBG_FUN();
prs->DisplayIn( this );
if ( d ) d->UpdateVisibility( this, prs, true );
}
*/
void SALOME_View::Erase( SALOME_Displayer* d, const SALOME_Prs* prs, const bool forced )
{
+ DBG_FUN();
prs->EraseIn( this, forced );
if ( d ) d->UpdateVisibility( this, prs, false );
}
*/
void SALOME_View::LocalSelection( const SALOME_Prs* prs, const int mode )
{
+ DBG_FUN();
std::list<int> modes;
modes.push_back( mode );
LocalSelection( prs, modes );
*/
void SALOME_View::LocalSelection( const SALOME_Prs* prs, const std::list<int> modes )
{
+ DBG_FUN();
prs->LocalSelectionIn( this, modes );
}
*/
void SALOME_View::Display( const SALOME_OCCPrs* )
{
+ MSGEL("...SALOME_View::Display(SALOME_OCCPrs)");
// MESSAGE( "SALOME_View::Display( const SALOME_OCCPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
}
*/
void SALOME_View::Display( const SALOME_VTKPrs* )
{
+ MSGEL("...SALOME_View::Display(SALOME_VTKPrs)");
// MESSAGE( "SALOME_View::Display( const SALOME_VTKPrs& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
}
*/
void SALOME_View::Display( const SALOME_Prs2d* )
{
+ MSGEL("...SALOME_View::Display(SALOME_Prs2d)");
// MESSAGE( "SALOME_View::Display( const SALOME_Prs2d& ) called! Probably, presentation is being displayed in uncompatible viewframe." );
}
*/
void SALOME_View::Erase( const SALOME_OCCPrs*, const bool )
{
+ MSGEL("...SALOME_View::Erase(SALOME_OCCPrs,bool)");
// MESSAGE( "SALOME_View::Erase( const SALOME_OCCPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
}
*/
void SALOME_View::Erase( const SALOME_VTKPrs*, const bool )
{
+ MSGEL("...SALOME_View::Erase(SALOME_VTKPrs,bool)");
// MESSAGE( "SALOME_View::Erase( const SALOME_VTKPrs& ) called! Probably, presentation is being erased in uncompatible viewframe." );
}
*/
void SALOME_View::Erase( const SALOME_Prs2d*, const bool )
{
+ MSGEL("...SALOME_View::Erase(SALOME_Prs2d,bool)");
// MESSAGE( "SALOME_View::Erase( const SALOME_Prs2d& ) called! Probably, presentation is being erased in uncompatible viewframe." );
}
*/
void SALOME_View::EraseAll( SALOME_Displayer* d, const bool )
{
+ DBG_FUN();
// MESSAGE( "SALOME_View::EraseAll() called!" );
if ( d ) d->UpdateVisibility( this, 0, false );
}
*/
void SALOME_View::LocalSelection( const SALOME_OCCPrs*, const int )
{
+ MSGEL("...SALOME_View::LocalSelection(SALOME_OCCPrs,int)");
// MESSAGE( "SALOME_View::LocalSelection( const SALOME_OCCPrs* ) called!
// Probably, selection is being activated in uncompatible viewframe." );
}
*/
void SALOME_View::LocalSelection( const SALOME_OCCPrs*, const std::list<int> )
{
+ MSGEL("...SALOME_View::LocalSelection(SALOME_OCCPrs,list)");
// MESSAGE( "SALOME_View::LocalSelection( const SALOME_OCCPrs* ) called!
// Probably, selection is being activated in uncompatible viewframe." );
}
*/
void SALOME_View::LocalSelection( const SALOME_VTKPrs*, const int )
{
+ MSGEL("...SALOME_View::LocalSelection(SALOME_VTKPrs,int)");
// MESSAGE( "SALOME_View::LocalSelection( const SALOME_VTKPrs* ) called!
// Probably, selection is being activated in uncompatible viewframe." );
}
*/
void SALOME_View::LocalSelection( const SALOME_Prs2d*, const int )
{
+ MSGEL("...SALOME_View::LocalSelection(SALOME_Prs2d,int)");
// MESSAGE( "SALOME_View::LocalSelection( const SALOME_Prs2d* ) called!
// Probably, selection is being activated in uncompatible viewframe." );
}
*/
void SALOME_View::GlobalSelection( const bool ) const
{
+ MSGEL("...SALOME_View::GlobalSelection(bool)");
// MESSAGE( "SALOME_View::GlobalSelection() called!
// Probably, selection is being activated in uncompatible viewframe." );
}
void SALOME_View::BeforeDisplay( SALOME_Displayer* d, const SALOME_Prs* p )
{
+ DBG_FUN();
p->BeforeDisplayIn( d, this );
}
void SALOME_View::AfterDisplay( SALOME_Displayer* d, const SALOME_Prs* p )
{
+ DBG_FUN();
p->AfterDisplayIn( d, this );
}
void SALOME_View::BeforeErase( SALOME_Displayer* d, const SALOME_Prs* p )
{
+ DBG_FUN();
p->BeforeEraseIn( d, this );
}
void SALOME_View::AfterErase ( SALOME_Displayer* d, const SALOME_Prs* p )
{
+ DBG_FUN();
p->AfterEraseIn( d, this );
}
+#define MBCLASSNAME "SALOME_Displayer"
/*!
Gives control to SALOME_Prs object, so that it could perform double dispatch
*/
void SALOME_Displayer::UpdatePrs( SALOME_Prs* prs )
{
+ DBG_FUN();
prs->Update( this );
}
*/
void SALOME_Displayer::Update( SALOME_OCCPrs* )
{
+ MSGEL("...SALOME_Displayer::Update(SALOME_OCCPrs)");
// MESSAGE( "SALOME_Displayer::Update( SALOME_OCCPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
}
*/
void SALOME_Displayer::Update( SALOME_VTKPrs* )
{
+ MSGEL("...SALOME_Displayer::Update(SALOME_VTKPrs)");
// MESSAGE( "SALOME_Displayer::Update( SALOME_VTKPrs* ) called! Probably, presentation is being updated in uncompatible viewframe." );
}
*/
void SALOME_Displayer::Update( SALOME_Prs2d* )
{
+ MSGEL("...SALOME_Displayer::Update(SALOME_Prs2d)");
// MESSAGE( "SALOME_Displayer::Update( SALOME_Prs2d* ) called! Probably, presentation is being updated in uncompatible viewframe." );
}
*/
void SALOME_Displayer::UpdateVisibility( SALOME_View*, const SALOME_Prs*, bool )
{
+ MSGEL("...SALOME_Displayer::UpdateVisibility(SALOME_View,SALOME_Prs,bool)");
}
--- /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
+\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
#include <AIS_InteractiveObject.hxx>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SOCC_Prs"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Default constructor
*/
SOCC_Prs::SOCC_Prs( const char* entry )
: SALOME_OCCPrs( entry )
{
+ DBG_FUN();
+ ARG(entry);
myToActivate = true;
}
SOCC_Prs::SOCC_Prs( const char* entry, const Handle(AIS_InteractiveObject)& obj )
: SALOME_OCCPrs( entry )
{
+ DBG_FUN();
+ ARG(entry);
AddObject( obj );
}
*/
SOCC_Prs::~SOCC_Prs()
{
+ DBG_FUN();
myObjects.Clear();
}
*/
void SOCC_Prs::AddObject( const Handle(AIS_InteractiveObject)& obj )
{
+ DBG_FUN();
myObjects.Append( obj );
}
*/
void SOCC_Prs::PrependObject( const Handle(AIS_InteractiveObject)& obj )
{
+ DBG_FUN();
myObjects.Prepend( obj );
}
*/
void SOCC_Prs::RemoveFirst()
{
+ DBG_FUN();
myObjects.RemoveFirst();
}
*/
void SOCC_Prs::Clear()
{
+ DBG_FUN();
myObjects.Clear();
}
#include <algorithm>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SOCC_Viewer"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Constructor
\param DisplayTrihedron - is trihedron displayed
SOCC_Viewer::SOCC_Viewer( bool DisplayTrihedron )
: OCCViewer_Viewer( DisplayTrihedron )
{
+ DBG_FUN();
}
/*!
*/
SOCC_Viewer::~SOCC_Viewer()
{
+ DBG_FUN();
}
/*!
void SOCC_Viewer::setColor( const Handle(SALOME_InteractiveObject)& obj,
const QColor& color, bool update )
{
+ DBG_FUN();
if(obj.IsNull() || !obj->hasEntry() )
return;
void SOCC_Viewer::switchRepresentation( const Handle(SALOME_InteractiveObject)& obj,
int mode, bool update )
{
+ DBG_FUN();
if(obj.IsNull() || !obj->hasEntry() )
return;
void SOCC_Viewer::setTransparency( const Handle(SALOME_InteractiveObject)& obj,
float trans, bool update )
{
+ DBG_FUN();
if(obj.IsNull() || !obj->hasEntry() )
return;
void SOCC_Viewer::rename( const Handle(SALOME_InteractiveObject)& obj,
const QString& name )
{
+ DBG_FUN();
AIS_ListOfInteractive List;
getAISContext()->DisplayedObjects(List);
*/
void SOCC_Viewer::Display( const SALOME_OCCPrs* prs )
{
+ DBG_FUN();
// try do downcast object
const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );
if ( !anOCCPrs || anOCCPrs->IsNull() )
*/
void SOCC_Viewer::Erase( const SALOME_OCCPrs* prs, const bool /*forced*/ )
{
+ DBG_FUN();
// try do downcast object
const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );
if ( !anOCCPrs || anOCCPrs->IsNull() )
*/
void SOCC_Viewer::EraseAll( SALOME_Displayer* d, const bool forced )
{
+ DBG_FUN();
// get context
Handle(AIS_InteractiveContext) ic = getAISContext();
*/
SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry )
{
+ DBG_FUN();
+ ARG(entry);
SOCC_Prs* prs = new SOCC_Prs(entry);
if ( entry )
{
*/
void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const std::list<int> modes )
{
+ DBG_FUN();
Handle(AIS_InteractiveContext) ic = getAISContext();
const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( thePrs );
*/
void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode )
{
+ DBG_FUN();
std::list<int> modes;
modes.push_back( theMode );
LocalSelection( thePrs, modes );
*/
void SOCC_Viewer::GlobalSelection( const bool update ) const
{
+ DBG_FUN();
Handle(AIS_InteractiveContext) ic = getAISContext();
if ( !ic.IsNull() )
{
*/
OCCViewer_ViewWindow* SOCC_Viewer::createSubWindow()
{
+ DBG_FUN();
return new SOCC_ViewWindow( 0, this);
}
#include "SUIT_Accel.h"
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SOCC_ViewWindow"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Constructor
*/
OCCViewer_Viewer* theModel)
: OCCViewer_ViewWindow( theDesktop, theModel )
{
+ DBG_FUN();
}
/*!
SOCC_ViewWindow
::~SOCC_ViewWindow()
{
+ DBG_FUN();
}
/*!
SOCC_ViewWindow
::action( const int theAction )
{
+ MSGEL("...SOCC_ViewWindow::action(" << theAction << ")");
const int inc = 10;
int cx = 0, cy = 0;
if ( theAction == SUIT_Accel::ZoomIn || theAction == SUIT_Accel::ZoomOut ||
--- /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
+\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 MBSUIT_H\r
+#define MBSUIT_H\r
+\r
+#include "SUIT_DataObject.h"\r
+\r
+\r
+//==========================================================================\r
+static void DumpVar(const char *szName, const SUIT_DataObject *value) {\r
+ if (value) {\r
+ DLOG << "[DataObj]: " << szName << "=" << (void*)value << " name=\"" << value->name().toStdString() << "\" level=" << value->level() \r
+ << " pos=" << value->position() << " #child=" << value->childCount() << " what=\"" << value->whatsThis().toStdString() << "\"" << std::endl;\r
+ }\r
+ else {\r
+ DLOG << "[DataObj]: " << szName << "=null" << std::endl;\r
+ }\r
+}\r
+\r
+#endif // MBSUIT_H
\ No newline at end of file
#include <QtxAction.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SUIT_ActionOperation"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Constructor.
*/
: SUIT_Operation( app ),
myAction( 0 )
{
+ DBG_FUN();
}
/*!
*/
SUIT_ActionOperation::~SUIT_ActionOperation()
{
+ DBG_FUN();
}
/*!
const QString& menuText, QKeySequence accel,
QObject* parent, bool toggle )
{
+ MSGEL("...SUIT_ActionOperation::setAction(\"" << text.toStdString() << "\", \"" << menuText.toStdString() << "\"");
setAction( new QtxAction( text, icon, menuText, accel, parent, toggle ) );
}
void SUIT_ActionOperation::setAction( const QString& text, const QString& menuText,
QKeySequence accel, QObject* parent, bool toggle )
{
+ MSGEL("...SUIT_ActionOperation::setAction(\"" << text.toStdString() << "\", \"" << menuText.toStdString() << "\"");
setAction( new QtxAction( text, menuText, accel, parent, toggle ) );
}
#include <QShortcut>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SUIT_DataBrowser"
+#include "MBDebug.h"
+#include "MBSUIT.h"
+//---------------------------------------------------------
+
/*!
\class SUIT_DataBrowser
\brief Object browser customization.
SUIT_DataBrowser::SUIT_DataBrowser( QWidget* parent )
: OB_Browser( parent )
{
+ DBG_FUN();
init( 0 );
}
SUIT_DataBrowser::SUIT_DataBrowser( SUIT_DataObject* root, QWidget* parent )
: OB_Browser( parent )
{
+ DBG_FUN();
+ ARG(root);
init( root );
}
*/
SUIT_DataBrowser::~SUIT_DataBrowser()
{
+ DBG_FUN();
}
/*!
*/
void SUIT_DataBrowser::setRoot( SUIT_DataObject* r )
{
+ DBG_FUN();
+ ARG(r);
SUIT_ProxyModel* m = qobject_cast<SUIT_ProxyModel*>( model() );
if ( m )
m->setRoot( r );
*/
void SUIT_DataBrowser::setAutoUpdate( const bool on )
{
+ DBG_FUN();
+ ARG(on);
SUIT_ProxyModel* m = qobject_cast<SUIT_ProxyModel*>( model() );
if ( m )
m->setAutoUpdate( on );
*/
void SUIT_DataBrowser::setUpdateModified( const bool on )
{
+ DBG_FUN();
+ ARG(on);
SUIT_ProxyModel* m = qobject_cast<SUIT_ProxyModel*>( model() );
if ( m )
m->setUpdateModified( on );
*/
void SUIT_DataBrowser::updateTree( SUIT_DataObject* obj, const bool /*autoOpen*/ )
{
+ DBG_FUN();
+ ARG(obj);
SUIT_ProxyModel* m = qobject_cast<SUIT_ProxyModel*>( model() );
if ( m ) {
m->updateTree( obj );
*/
void SUIT_DataBrowser::setSelected( const SUIT_DataObject* obj, const bool append )
{
+ DBG_FUN();
+ ARG(obj);
+ ARG(append);
SUIT_ProxyModel* m = qobject_cast<SUIT_ProxyModel*>( model() );
if ( m ) {
*/
void SUIT_DataBrowser::setSelected( const DataObjectList& lst, const bool append )
{
+ DBG_FUN();
+ ARG(append);
SUIT_ProxyModel* m = qobject_cast<SUIT_ProxyModel*>( model() );
if ( m ) {
*/
void SUIT_DataBrowser::ensureVisible( const DataObjectList& lst )
{
+ DBG_FUN();
QtxTreeView* tv = treeView();
SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( model() );
if ( !tv || !treeModel )
*/
void SUIT_DataBrowser::contextMenuPopup( QMenu* menu )
{
+ DBG_FUN();
createPopupMenu( menu );
}
*/
void SUIT_DataBrowser::contextMenuEvent( QContextMenuEvent* e )
{
+ DBG_FUN();
contextMenuRequest( e );
}
*/
void SUIT_DataBrowser::init( SUIT_DataObject* root )
{
+ DBG_FUN();
+ ARG(root);
SUIT_ProxyModel* m = new SUIT_ProxyModel( root, this );
connect( m, SIGNAL( modelUpdated() ), this, SLOT( onModelUpdated() ) );
*/
void SUIT_DataBrowser::onModelUpdated()
{
+ DBG_FUN();
setModified();
}
*/
void SUIT_DataBrowser::onClicked( const QModelIndex& index )
{
+ DBG_FUN();
+ MSGEL("in:[MdlIdx]: index={row=" << index.row() << ", col=" << index.column() << "}");
SUIT_ProxyModel* m = qobject_cast<SUIT_ProxyModel*>( model() );
if ( m ) {
SUIT_DataObject* obj = m->object( index );
if ( obj ) {
+ SHOW(obj);
emit( clicked( obj ) );
m->emitClicked(obj, index);
}
*/
void SUIT_DataBrowser::onDblClicked( const QModelIndex& index )
{
+ DBG_FUN();
+ MSGEL("in:[MdlIdx]: index={row=" << index.row() << ", col=" << index.column() << "}");
SUIT_ProxyModel* m = qobject_cast<SUIT_ProxyModel*>( model() );
if ( m ) {
SUIT_DataObject* obj = m->object( index );
+ SHOW(obj);
if ( obj ) emit( doubleClicked( obj ) );
}
}
*/
void SUIT_DataBrowser::onExpanded( const QModelIndex& /*index*/ )
{
+ DBG_FUN();
if (myResizeOnExpandItem) {
adjustFirstColumnWidth();
adjustColumnsWidth();
\internal
*/
void SUIT_DataBrowser::onStartEditing() {
+ DBG_FUN();
DataObjectList sel = getSelected();
SUIT_ProxyModel* m = qobject_cast<SUIT_ProxyModel*>( model() );
if(treeView() && m && sel.count() == 1){
--- /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
+\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
#include <vtkActorCollection.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SVTK_Prs"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Default constructor
*/
SVTK_Prs::SVTK_Prs( const char* entry ) : SALOME_VTKPrs(entry), myObjects( 0 )
{
+ DBG_FUN();
+ ARG(entry);
}
/*!
*/
SVTK_Prs::SVTK_Prs( const char* entry, const vtkActor* obj ) : SALOME_VTKPrs(entry)
{
+ DBG_FUN();
+ ARG(entry);
AddObject( obj );
}
*/
SVTK_Prs:: ~SVTK_Prs()
{
+ DBG_FUN();
if ( myObjects ) myObjects->Delete();
}
*/
void SVTK_Prs::AddObject( const vtkActor* obj )
{
+ DBG_FUN();
if ( !myObjects)
myObjects = vtkActorCollection::New();
myObjects->AddItem( (vtkActor*)obj );
#include <vtkProperty.h>
#include <vtkProp3DCollection.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SVTK_Renderer"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
// undefining min and max because CASCADE's defines them and
// it clashes with std::min(), std::max() included in utilities.h
#undef min
myTrihedronSize(105),
myIsTrihedronRelative(true)
{
+ DBG_FUN();
myDevice->Delete();
myTransform->Delete();
SVTK_Renderer
::~SVTK_Renderer()
{
+ DBG_FUN();
VTK::ActorCollectionCopy aCopy(GetDevice()->GetActors());
vtkActorCollection* anActors = aCopy.GetActors();
vtkActorCollection* anActors2 = vtkActorCollection::New();
void* theClientData,
void* vtkNotUsed(theCallData))
{
+ DBG_FUN();
SVTK_Renderer* self = reinterpret_cast<SVTK_Renderer*>(theClientData);
switch(theEvent){
::Initialize(vtkRenderWindowInteractor* theInteractor,
SVTK_Selector* theSelector)
{
+ DBG_FUN();
myInteractor = theInteractor;
mySelector = theSelector;
SetSelectionTolerance();
SVTK_Renderer
::AddActor(VTKViewer_Actor* theActor, bool theIsAdjustActors)
{
+ DBG_FUN();
if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(theActor)){
anActor->SetInteractor(myInteractor);
anActor->SetTransform(GetTransform());
SVTK_Renderer
::RemoveActor(VTKViewer_Actor* theActor, bool theIsAdjustActors)
{
+ DBG_FUN();
if(SALOME_Actor* anActor = dynamic_cast<SALOME_Actor*>(theActor)){
// Order of the calls are important because VTKViewer_Actor::RemoveFromRender
// can leads do destruction of the actor
SVTK_Renderer
::SetScale( double theScale[3] )
{
+ DBG_FUN();
+ MSGEL("in:[dbl]: theScale=[" << theScale[0] << ", " << theScale[1] << ", " << theScale[2] << "]");
myTransform->SetMatrixScale( theScale[0], theScale[1], theScale[2] );
AdjustActors();
SVTK_Renderer
::OnAdjustActors()
{
+ DBG_FUN();
bool aTDisplayed = IsTrihedronDisplayed();
bool aCDisplayed = IsCubeAxesDisplayed();
SVTK_Renderer
::AdjustActors()
{
+ DBG_FUN();
if(OnAdjustActors())
::ResetCameraClippingRange(GetDevice());
}
void
SVTK_Renderer
::SetTrihedronVisibility( const bool show ) {
+ DBG_FUN();
+ ARG(show);
if(show)
myTrihedron->VisibilityOn();
else
SVTK_Renderer
::OnResetView()
{
+ DBG_FUN();
int aTrihedronIsVisible = IsTrihedronDisplayed();
int aCubeAxesIsVisible = IsCubeAxesDisplayed();
SVTK_Renderer
::OnFitAll()
{
+ DBG_FUN();
int aTrihedronWasVisible = false;
int aCubeAxesWasVisible = false;
*/
void SVTK_Renderer::onFitSelection()
{
+ DBG_FUN();
vtkActorCollection* aSelectedCollection = vtkActorCollection::New();
VTK::ActorCollectionCopy aCopy( GetDevice()->GetActors() );
void SVTK_Renderer::OnFitIObjects(const SALOME_ListIO& objects)
{
+ DBG_FUN();
vtkActorCollection* aSelectedCollection = vtkActorCollection::New();
VTK::ActorCollectionCopy aCopy( GetDevice()->GetActors() );
SVTK_Renderer
::OnResetClippingRange()
{
+ DBG_FUN();
return;
::ResetCameraClippingRange(GetDevice());
}
SVTK_Renderer
::OnFrontView()
{
+ DBG_FUN();
vtkCamera* aCamera = GetDevice()->GetActiveCamera();
aCamera->SetPosition(1,0,0);
aCamera->SetViewUp(0,0,1);
SVTK_Renderer
::OnBackView()
{
+ DBG_FUN();
vtkCamera* aCamera = GetDevice()->GetActiveCamera();
aCamera->SetPosition(-1,0,0);
aCamera->SetViewUp(0,0,1);
SVTK_Renderer
::OnTopView()
{
+ DBG_FUN();
vtkCamera* aCamera = GetDevice()->GetActiveCamera();
aCamera->SetPosition(0,0,1);
aCamera->SetViewUp(0,1,0);
SVTK_Renderer
::OnBottomView()
{
+ DBG_FUN();
vtkCamera* aCamera = GetDevice()->GetActiveCamera();
aCamera->SetPosition(0,0,-1);
aCamera->SetViewUp(0,1,0);
SVTK_Renderer
::OnLeftView()
{
+ DBG_FUN();
vtkCamera* aCamera = GetDevice()->GetActiveCamera();
aCamera->SetPosition(0,-1,0);
aCamera->SetViewUp(0,0,1);
SVTK_Renderer
::onClockWiseView()
{
+ DBG_FUN();
vtkCamera* aCamera = GetDevice()->GetActiveCamera();
aCamera->Roll(-90);
aCamera->OrthogonalizeViewUp();
SVTK_Renderer
::onAntiClockWiseView()
{
+ DBG_FUN();
vtkCamera* aCamera = GetDevice()->GetActiveCamera();
aCamera->Roll(90);
aCamera->OrthogonalizeViewUp();
SVTK_Renderer
::OnRightView()
{
+ DBG_FUN();
vtkCamera* aCamera = GetDevice()->GetActiveCamera();
aCamera->SetPosition(0,1,0);
aCamera->SetViewUp(0,0,1);
#include <vtkActorCollection.h>
#include <vtkCellPicker.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SVTK_Selector"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
\return new SVTK_Selector
SVTK_Selector
::New()
{
+ DBG_FUNC();
return new SVTK_SelectorDef();
}
+#define MBCLASSNAME "SVTK_SelectorDef"
/*!
Default constructor
*/
myPicker(vtkPicker::New()),
myCellPicker(vtkCellPicker::New())
{
+ DBG_FUN();
mySelectionMode = ActorSelection;
myDynamicPreselection = true;
myPreselectionEnabled = true;
SVTK_SelectorDef
::~SVTK_SelectorDef()
{
+ DBG_FUN();
}
/*!
SVTK_SelectorDef
::SetSelectionMode(Selection_Mode theMode)
{
+ DBG_FUN();
if(mySelectionMode != theMode){
mySelectionMode = theMode;
myMapIOSubIndex.clear();
SVTK_SelectorDef
::ClearIObjects()
{
+ DBG_FUN();
myIO2Actors.clear();
myIObjects.clear();
myMapIOSubIndex.clear();
SVTK_SelectorDef
::AddIObject(const Handle(SALOME_InteractiveObject)& theIO)
{
+ DBG_FUN();
if(!IsSelected(theIO)){
myIObjects.insert(theIO);
return true;
SVTK_SelectorDef
::AddIObject(SALOME_Actor* theActor)
{
+ DBG_FUN();
const Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
bool anIsIOBound = IsSelected(anIO);
SVTK_SelectorDef
::RemoveIObject(const Handle(SALOME_InteractiveObject)& theIO)
{
+ DBG_FUN();
bool anIsIOBound = myIObjects.find(theIO) != myIObjects.end();
myIObjects.erase(theIO);
SVTK_SelectorDef
::RemoveIObject(SALOME_Actor* theActor)
{
+ DBG_FUN();
const Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
bool anIsActorBound = myIO2Actors.find(anIO) != myIO2Actors.end();
const SVTK_TIndexedMapOfVtkId& theIndices,
bool theIsModeShift)
{
+ DBG_FUN();
TMapIOSubIndex::iterator aMapIter = myMapIOSubIndex.find(theIO);
if(aMapIter == myMapIOSubIndex.end()){
TIndexedMapOfInteger anEmpty;
const SVTK_TVtkIDsMap& theIndices,
bool theIsModeShift)
{
+ DBG_FUN();
TMapIOSubIndex::iterator aMapIter = myMapIOSubIndex.find(theIO);
if(aMapIter == myMapIOSubIndex.end()){
TIndexedMapOfInteger anEmpty;
int theIndex,
bool theIsModeShift)
{
+ DBG_FUN();
+ ARG(theIndex);
TMapIOSubIndex::iterator anIter = myMapIOSubIndex.find(theIO);
if(anIter == myMapIOSubIndex.end()){
TIndexedMapOfInteger anEmpty;
::RemoveIndex( const Handle(SALOME_InteractiveObject)& theIO,
int theIndex)
{
+ DBG_FUN();
+ ARG(theIndex);
if(IsIndexSelected(theIO,theIndex)){
TMapIOSubIndex::iterator anIter = myMapIOSubIndex.find(theIO);
SVTK_TIndexedMapOfVtkId& aMapIndex = anIter->second.myMap;
SVTK_SelectorDef
::ClearIndex()
{
+ DBG_FUN();
myMapIOSubIndex.clear();
}
const SVTK_IndexedMapOfVtkIds& theIds,
bool theIsModeShift)
{
+ DBG_FUN();
TMapIOSubCompositeIndex::iterator aMapIter = myMapIOSubCompositeIndex.find( theIO );
if( aMapIter == myMapIOSubCompositeIndex.end() ) {
SVTK_IndexedMapOfVtkIds anEmpty;
SVTK_ListOfVtk theIds,
bool theIsModeShift)
{
+ DBG_FUN();
TMapIOSubCompositeIndex::iterator anIter = myMapIOSubCompositeIndex.find( theIO );
if( anIter == myMapIOSubCompositeIndex.end() ) {
SVTK_IndexedMapOfVtkIds anEmpty;
::RemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO,
SVTK_ListOfVtk theIds )
{
+ DBG_FUN();
if(IsCompositeIndexSelected( theIO, theIds ) ) {
TMapIOSubCompositeIndex::iterator anIter = myMapIOSubCompositeIndex.find( theIO );
SVTK_IndexedMapOfVtkIds& aMapIndex = anIter->second;
SVTK_SelectorDef
::ClearCompositeIndex()
{
+ DBG_FUN();
myMapIOSubCompositeIndex.clear();
}
SVTK_SelectorDef
::SetFilter(const Handle(VTKViewer_Filter)& theFilter)
{
+ DBG_FUN();
myFilters.insert(TFilters::value_type(theFilter->GetId(),theFilter));
}
SVTK_SelectorDef
::RemoveFilter(const TFilterID theId)
{
+ DBG_FUN();
if(IsFilterPresent(theId))
myFilters.erase(theId);
}
SVTK_SelectorDef
::Pick(const SVTK_SelectionEvent* theEvent, vtkRenderer* theRenderer) const
{
+ DBG_FUN();
vtkActorCollection* aListActors = NULL;
if ( GetDynamicPreSelection() ) {
#include <vtkRenderer.h>
#include <vtkProperty.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SVTK_SignalHandler"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Constructor
*/
QObject(theMainWindow),
myMainWindow(theMainWindow)
{
+ DBG_FUN();
SVTK_RenderWindowInteractor* anInteractor = theMainWindow->GetInteractor();
connect(anInteractor,SIGNAL(KeyPressed(QKeyEvent*)),
SVTK_SignalHandler
::~SVTK_SignalHandler()
{
+ DBG_FUN();
}
/*!
SVTK_SignalHandler
::Repaint(bool theUpdateTrihedron)
{
+ DBG_FUN();
myMainWindow->Repaint(theUpdateTrihedron);
}
SVTK_SignalHandler
::onSelectionChanged()
{
+ DBG_FUN();
VTK::ActorCollectionCopy aCopy(myMainWindow->getRenderer()->GetActors());
vtkActorCollection* anActors = aCopy.GetActors();
myMainWindow->Repaint(false);
}
+
+#define MBCLASSNAME "SVTK_View"
/*!
Constructor
*/
::SVTK_View(SVTK_ViewWindow* theMainWindow) :
SVTK_SignalHandler(theMainWindow)
{
+ DBG_FUN();
}
/*!
SVTK_View
::~SVTK_View()
{
+ DBG_FUN();
}
/*!
SVTK_View
::unHighlightAll()
{
+ DBG_FUN();
using namespace SVTK;
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
ForEach<SALOME_Actor>(aCopy.GetActors(),
bool theIsHighlight,
bool /*theIsUpdate*/ )
{
+ DBG_FUN();
using namespace SVTK;
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
ForEachIf<SALOME_Actor>(aCopy.GetActors(),
SVTK_View
::FindIObject(const char* theEntry)
{
+ DBG_FUN();
+ ARG(theEntry);
using namespace SVTK;
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
SALOME_Actor* anActor =
::rename(const Handle(SALOME_InteractiveObject)& theIObject,
const QString& theName)
{
+ DBG_FUN();
+ ARG(theName);
using namespace SVTK;
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
ForEachIf<SALOME_Actor>(aCopy.GetActors(),
SVTK_View
::SetDisplayMode(int theMode)
{
+ DBG_FUN();
+ ARG(theMode);
if(theMode == 0)
ChangeRepresentationToWireframe();
else if (theMode == 1)
::SetDisplayMode(const Handle(SALOME_InteractiveObject)& theIObject,
int theMode)
{
+ DBG_FUN();
+ ARG(theMode);
using namespace SVTK;
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
ForEachIf<SALOME_Actor>(aCopy.GetActors(),
SVTK_View
::ChangeRepresentationToWireframe()
{
+ DBG_FUN();
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
ChangeRepresentationToWireframe(aCopy.GetActors());
}
SVTK_View
::ChangeRepresentationToSurface()
{
+ DBG_FUN();
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
ChangeRepresentationToSurface(aCopy.GetActors());
}
SVTK_View
::ChangeRepresentationToSurfaceWithEdges()
{
+ DBG_FUN();
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
ChangeRepresentationToSurfaceWithEdges(aCopy.GetActors());
}
SVTK_View
::ChangeRepresentationToWireframe(vtkActorCollection* theCollection)
{
+ DBG_FUN();
using namespace SVTK;
ForEach<SALOME_Actor>(theCollection,
TSetFunction<SALOME_Actor,int>
SVTK_View
::ChangeRepresentationToSurface(vtkActorCollection* theCollection)
{
+ DBG_FUN();
using namespace SVTK;
ForEach<SALOME_Actor>(theCollection,
TSetFunction<SALOME_Actor,int>
SVTK_View
::ChangeRepresentationToSurfaceWithEdges(vtkActorCollection* theCollection)
{
+ DBG_FUN();
using namespace SVTK;
ForEach<SALOME_Actor>(theCollection,
TSetFunction<SALOME_Actor,int>
SVTK_View
::EraseAll()
{
+ DBG_FUN();
using namespace SVTK;
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
ForEach<SALOME_Actor>(aCopy.GetActors(),
SVTK_View
::DisplayAll()
{
+ DBG_FUN();
using namespace SVTK;
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
ForEach<SALOME_Actor>(aCopy.GetActors(),
::Erase(SALOME_Actor* theActor,
bool theIsUpdate)
{
+ DBG_FUN();
SVTK::TErase()(theActor);
if(theIsUpdate)
::Erase(const Handle(SALOME_InteractiveObject)& theIObject,
bool theIsUpdate)
{
+ DBG_FUN();
using namespace SVTK;
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
ForEachIf<SALOME_Actor>(aCopy.GetActors(),
::Display(SALOME_Actor* theActor,
bool theIsUpdate)
{
+ DBG_FUN();
GetRenderer()->AddActor(theActor);
theActor->SetVisibility(true);
::Display(const Handle(SALOME_InteractiveObject)& theIObject,
bool theIsUpdate)
{
+ DBG_FUN();
using namespace SVTK;
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
ForEachIf<SALOME_Actor>(aCopy.GetActors(),
SVTK_View
::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject)
{
+ DBG_FUN();
EraseAll();
Display(theIObject);
}
::Remove(const Handle(SALOME_InteractiveObject)& theIObject,
bool theIsUpdate)
{
+ DBG_FUN();
using namespace SVTK;
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
ForEachIf<SALOME_Actor>(aCopy.GetActors(),
::Remove(SALOME_Actor* theActor,
bool theIsUpdate)
{
+ DBG_FUN();
GetRenderer()->RemoveActor(theActor);
if(theIsUpdate)
Repaint();
SVTK_View
::RemoveAll(bool theIsUpdate)
{
+ DBG_FUN();
vtkRenderer* aRenderer = getRenderer();
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
if(vtkActorCollection* anActors = aCopy.GetActors()){
::SetTransparency(const Handle(SALOME_InteractiveObject)& theIObject,
float theTrans)
{
+ DBG_FUN();
double anOpacity = 1.0 - theTrans;
using namespace SVTK;
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
::SetColor(const Handle(SALOME_InteractiveObject)& theIObject,
const QColor& theColor)
{
+ DBG_FUN();
double aColor[3] = {theColor.red()/255., theColor.green()/255., theColor.blue()/255.};
using namespace SVTK;
::SetMaterial(const Handle(SALOME_InteractiveObject)& theIObject,
vtkProperty* thePropF, vtkProperty* thePropB)
{
+ DBG_FUN();
using namespace SVTK;
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
std::vector<vtkProperty*> aProps;
*/
void SVTK_View::GetVisible( SALOME_ListIO& theList )
{
+ DBG_FUN();
using namespace SVTK;
VTK::ActorCollectionCopy aCopy(getRenderer()->GetActors());
ForEach<SALOME_Actor>(aCopy.GetActors(),
#include <VTKViewer_ViewManager.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SVTK_ViewManager"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Constructor
*/
SVTK_ViewManager::SVTK_ViewManager( SUIT_Study* study, SUIT_Desktop* theDesktop )
: SUIT_ViewManager( study, theDesktop, new SVTK_Viewer() )
{
+ DBG_FUN();
setTitle( VTKViewer_ViewManager::tr( "VTK_VIEW_TITLE" ) );
}
*/
SVTK_ViewManager::~SVTK_ViewManager()
{
+ DBG_FUN();
}
/*!
// VSR: Uncomment below line to allow texture background support in VTK viewer
#define VTK_ENABLE_TEXTURED_BACKGROUND
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SVTK_Viewer"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!
Constructor
*/
SVTK_Viewer::SVTK_Viewer()
{
+ DBG_FUN();
myTrihedronSize = 105;
myTrihedronRelative = true;
myIsStaticTrihedronVisible = true;
*/
SVTK_Viewer::~SVTK_Viewer()
{
+ DBG_FUN();
}
/*! Get data for supported background modes: gradient types, identifiers and supported image formats */
//! Set background color to the viewer [obsolete]
void SVTK_Viewer::setBackgroundColor( const QColor& c )
{
+ DBG_FUN();
Qtx::BackgroundData bg = background();
bg.setColor( c );
setBackground( bg );
*/
void SVTK_Viewer::setBackground( const Qtx::BackgroundData& theBackground )
{
+ DBG_FUN();
myDefaultBackground = theBackground.isValid() ? theBackground : Qtx::BackgroundData( Qt::black );
QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
*/
SUIT_ViewWindow* SVTK_Viewer::createView( SUIT_Desktop* theDesktop )
{
+ DBG_FUN();
TViewWindow* aViewWindow = new TViewWindow(theDesktop);
aViewWindow->Initialize(this);
*/
void SVTK_Viewer::setProjectionMode( const int theMode )
{
+ DBG_FUN();
+ ARG(theMode);
if ( myProjMode != theMode ) {
if ( theMode != SVTK_ViewWindow::Stereo )
myProjMode = theMode;
*/
void SVTK_Viewer::setQuadBufferSupport( const bool theEnable )
{
+ DBG_FUN();
+ ARG(theEnable);
if ( myQuadBufferSupport != theEnable ) {
myQuadBufferSupport = theEnable;
*/
void SVTK_Viewer::setViewManager(SUIT_ViewManager* theViewManager)
{
+ DBG_FUN();
SUIT_ViewModel::setViewManager(theViewManager);
if ( !theViewManager )
*/
void SVTK_Viewer::contextMenuPopup( QMenu* thePopup )
{
+ DBG_FUN();
thePopup->addAction( VTKViewer_Viewer::tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
thePopup->addAction( VTKViewer_Viewer::tr( "MEN_CHANGE_BACKGROUND" ), this, SLOT( onChangeBackground() ) );
*/
void SVTK_Viewer::enableSelection(bool isEnabled)
{
+ DBG_FUN();
+ ARG(isEnabled);
mySelectionEnabled = isEnabled;
//!! To be done for view windows
*/
void SVTK_Viewer::Display( const SALOME_VTKPrs* prs )
{
+ DBG_FUN();
// try do downcast object
if(const SVTK_Prs* aPrs = dynamic_cast<const SVTK_Prs*>( prs )){
if(aPrs->IsNull())
*/
void SVTK_Viewer::Erase( const SALOME_VTKPrs* prs, const bool forced )
{
+ DBG_FUN();
// try do downcast object
if(const SVTK_Prs* aPrs = dynamic_cast<const SVTK_Prs*>( prs )){
if(aPrs->IsNull())
*/
void SVTK_Viewer::EraseAll( SALOME_Displayer* d, const bool forced )
{
+ DBG_FUN();
QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(aViews.at(i)))
*/
SALOME_Prs* SVTK_Viewer::CreatePrs( const char* entry )
{
+ DBG_FUN();
+ ARG(entry);
SVTK_Prs* prs = new SVTK_Prs( entry );
if ( entry ) {
if(SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>(getViewManager()->getActiveView()))
*/
void SVTK_Viewer::GetVisible( SALOME_ListIO& theList )
{
+ DBG_FUN();
// here we collect object if it is disaplaed even one view
QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
*/
void SVTK_Viewer::Repaint()
{
+ DBG_FUN();
// if (theUpdateTrihedron) onAdjustTrihedron();
QVector<SUIT_ViewWindow*> aViews = myViewManager->getViews();
for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
void SVTK_Viewer::onActorAdded(VTKViewer_Actor* theActor)
{
+ DBG_FUN();
emit actorAdded((SVTK_ViewWindow*)sender(), theActor);
}
void SVTK_Viewer::onActorRemoved(VTKViewer_Actor* theActor)
{
+ DBG_FUN();
emit actorRemoved((SVTK_ViewWindow*)sender(), theActor);
}
void SVTK_Viewer::onViewCreated( SUIT_ViewWindow* view) {
+ DBG_FUN();
#ifdef VGL_WORKAROUND
if ( SVTK_ViewWindow* svw = dynamic_cast<SVTK_ViewWindow*>( view ) )
QTimer::singleShot(500, [svw] () { svw->Repaint(); } );
#include <GL/gl.h>
#endif
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SVTK_ViewWindow"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
// Use workaround for rendering transparent object over MESA
#define USE_WORKAROUND_FOR_MESA
myEventCallbackCommand(vtkCallbackCommand::New()),
myDumpImage(QImage())
{
+ DBG_FUN();
setWindowFlags( windowFlags() & ~Qt::Window );
// specific of vtkSmartPointer
myKeyFreeInteractorStyle->Delete();
*/
void SVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel)
{
+ DBG_FUN();
myModel = theModel;
myInteractor = new SVTK_RenderWindowInteractor(this,"SVTK_RenderWindowInteractor");
void SVTK_ViewWindow::Initialize(SVTK_View* theView,
SVTK_ViewModelBase* theModel)
{
+ DBG_FUN();
connect(theView,SIGNAL(KeyPressed(QKeyEvent*)),
this,SLOT(onKeyPressed(QKeyEvent*)) );
connect(theView,SIGNAL(KeyReleased(QKeyEvent*)),
*/
SVTK_ViewWindow::~SVTK_ViewWindow()
{
+ DBG_FUN();
myRecorder->Delete();
myAxesWidget->Delete();
}
*/
void SVTK_ViewWindow::onFrontView()
{
+ DBG_FUN();
GetRenderer()->OnFrontView();
Repaint();
emit transformed( this );
*/
void SVTK_ViewWindow::onBackView()
{
+ DBG_FUN();
GetRenderer()->OnBackView();
Repaint();
emit transformed( this );
*/
void SVTK_ViewWindow::onTopView()
{
+ DBG_FUN();
GetRenderer()->OnTopView();
Repaint();
emit transformed( this );
*/
void SVTK_ViewWindow::onBottomView()
{
+ DBG_FUN();
GetRenderer()->OnBottomView();
Repaint();
emit transformed( this );
*/
void SVTK_ViewWindow::onLeftView()
{
+ DBG_FUN();
GetRenderer()->OnLeftView();
Repaint();
emit transformed( this );
*/
void SVTK_ViewWindow::onRightView()
{
+ DBG_FUN();
GetRenderer()->OnRightView();
Repaint();
emit transformed( this );
*/
void SVTK_ViewWindow::onClockWiseView()
{
+ DBG_FUN();
GetRenderer()->onClockWiseView();
Repaint();
emit transformed( this );
*/
void SVTK_ViewWindow::onAntiClockWiseView()
{
+ DBG_FUN();
GetRenderer()->onAntiClockWiseView();
Repaint();
emit transformed( this );
*/
void SVTK_ViewWindow::onResetView()
{
+ DBG_FUN();
GetRenderer()->OnResetView();
Repaint();
emit transformed( this );
*/
void SVTK_ViewWindow::onFitAll()
{
+ DBG_FUN();
GetRenderer()->OnFitAll();
Repaint();
emit transformed( this );
*/
void SVTK_ViewWindow::onFitSelection()
{
+ DBG_FUN();
GetRenderer()->onFitSelection();
Repaint();
emit transformed( this );
*/
void SVTK_ViewWindow::onFitIObjects(const SALOME_ListIO& objects)
{
+ DBG_FUN();
GetRenderer()->OnFitIObjects(objects);
Repaint();
emit transformed( this );
*/
void SVTK_ViewWindow::onSelectionChanged()
{
+ DBG_FUN();
myView->onSelectionChanged();
}
*/
void SVTK_ViewWindow::SetSelectionMode(Selection_Mode theMode)
{
+ DBG_FUN();
GetSelector()->SetSelectionMode(theMode);
}
void SVTK_ViewWindow::Display(const Handle(SALOME_InteractiveObject)& theIO,
bool theImmediatly)
{
+ DBG_FUN();
+ ARG(theImmediatly);
myView->Display(theIO,theImmediatly);
}
void SVTK_ViewWindow::Erase(const Handle(SALOME_InteractiveObject)& theIO,
bool theImmediatly)
{
+ DBG_FUN();
+ ARG(theImmediatly);
myView->Erase(theIO,theImmediatly);
}
*/
void SVTK_ViewWindow::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIO)
{
+ DBG_FUN();
myView->DisplayOnly(theIO);
}
*/
void SVTK_ViewWindow::DisplayAll()
{
+ DBG_FUN();
myView->DisplayAll();
}
*/
void SVTK_ViewWindow::EraseAll()
{
+ DBG_FUN();
myView->EraseAll();
}
*/
void SVTK_ViewWindow::setBackgroundColor( const QColor& c )
{
+ DBG_FUN();
Qtx::BackgroundData bg = background();
bg.setColor( c );
setBackground( bg );
*/
void SVTK_ViewWindow::setBackground( const Qtx::BackgroundData& bgData )
{
+ DBG_FUN();
bool ok = false;
if ( bgData.isValid() ) {
*/
void SVTK_ViewWindow::SetScale( double theScale[3] )
{
+ DBG_FUN();
GetRenderer()->SetScale( theScale );
Repaint();
emit transformed( this );
*/
void SVTK_ViewWindow::onViewTrihedron(bool show)
{
+ DBG_FUN();
GetRenderer()->SetTrihedronVisibility(show);
Repaint();
}
*/
void SVTK_ViewWindow::SetProjectionMode(const int theMode)
{
+ DBG_FUN();
+ ARG(theMode);
QtxAction* aParallelAction = dynamic_cast<QtxAction*>( toolMgr()->action( ParallelModeId ) );
QtxAction* aProjectionAction = dynamic_cast<QtxAction*>( toolMgr()->action( ProjectionModeId ) );
QtxAction* aStereoAction = dynamic_cast<QtxAction*>( toolMgr()->action( StereoModeId ) );
*/
void SVTK_ViewWindow::SetStereoType(const int theType)
{
+ DBG_FUN();
vtkRenderWindow* aWindow = getRenderWindow();
switch (theType ) {
case CrystalEyes:
*/
void SVTK_ViewWindow::SetAnaglyphFilter(const int theFilter)
{
+ DBG_FUN();
vtkRenderWindow* aWindow = getRenderWindow();
switch (theFilter ) {
case RedCyan:
*/
void SVTK_ViewWindow::SetQuadBufferSupport(const bool theEnable)
{
+ DBG_FUN();
vtkRenderWindow* aWindow = getRenderWindow();
aWindow->SetStereoCapableWindow((int)theEnable);
}
*/
void SVTK_ViewWindow::SetInteractionStyle(const int theStyle)
{
+ DBG_FUN();
onSwitchInteractionStyle( theStyle==1 );
}
*/
void SVTK_ViewWindow::SetZoomingStyle(const int theStyle)
{
+ DBG_FUN();
onSwitchZoomingStyle( theStyle==1 );
}
*/
void SVTK_ViewWindow::SetPreSelectionMode( Preselection_Mode theMode )
{
+ DBG_FUN();
onSwitchPreSelectionMode( theMode );
}
*/
void SVTK_ViewWindow::SetSelectionEnabled( bool theEnable )
{
+ DBG_FUN();
GetSelector()->SetSelectionEnabled( theEnable );
QtxAction* a = getAction( EnableSelectionId );
if ( a->isChecked() != theEnable)
*/
void SVTK_ViewWindow::onSwitchInteractionStyle(bool theOn)
{
+ DBG_FUN();
if (theOn) {
// check if style is already set
if ( GetInteractorStyle() != myKeyFreeInteractorStyle.GetPointer() )
*/
void SVTK_ViewWindow::onSwitchZoomingStyle( bool theOn )
{
+ DBG_FUN();
if( myDefaultInteractorStyle.GetPointer() )
myDefaultInteractorStyle->SetAdvancedZoomingEnabled( theOn );
if( myKeyFreeInteractorStyle.GetPointer() )
*/
void SVTK_ViewWindow::onSwitchPreSelectionMode( int theMode )
{
+ DBG_FUN();
GetSelector()->SetDynamicPreSelection( theMode == Dynamic_Preselection );
GetSelector()->SetPreSelectionEnabled( theMode != Preselection_Disabled );
*/
void SVTK_ViewWindow::onEnableSelection( bool on )
{
+ DBG_FUN();
SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>(myModel);
if(aViewer)
aViewer->enableSelection(on);
*/
void SVTK_ViewWindow::SetIncrementalSpeed(const int theValue, const int theMode)
{
+ DBG_FUN();
if ( (SVTK_InteractorStyle*)GetInteractorStyle() )
((SVTK_InteractorStyle*)GetInteractorStyle())->SetIncrementSpeed(theValue, theMode);
}
const int theBtn2,
const int theBtn3)
{
+ DBG_FUN();
int val = theBtn1;
myEventDispatcher->InvokeEvent(SVTK::SetSMDecreaseSpeedEvent, &val);
val = theBtn2;
void SVTK_ViewWindow::synchronize(SVTK_ViewWindow* otherViewWindow )
{
+ DBG_FUN();
if ( otherViewWindow ) {
bool blocked = blockSignals( true );
doSetVisualParameters( otherViewWindow->getVisualParameters(), true );
*/
void SVTK_ViewWindow::onMouseReleased(QMouseEvent* event)
{
+ DBG_FUN();
emit mouseReleased( this, event );
}
bool theUpdate,
bool theIsAdjustActors )
{
+ DBG_FUN();
GetRenderer()->AddActor(theActor, theIsAdjustActors);
if(theUpdate)
Repaint();
bool theUpdate,
bool theIsAdjustActors )
{
+ DBG_FUN();
GetRenderer()->RemoveActor(theActor, theIsAdjustActors);
if ( myDefaultInteractorStyle )
myDefaultInteractorStyle->FreeActors();
void setGradAxisVisualParams(QXmlStreamReader& reader, vtkAxisActor2D* actor)
{
+ DBG_FUNC();
if ( !actor )
return;
*/
void setGradAxisVisualParams( vtkAxisActor2D* actor, const QString& params )
{
+ DBG_FUNC();
if ( !actor )
return;
*/
void SVTK_ViewWindow::setVisualParameters( const QString& parameters )
{
+ DBG_FUN();
//printf("#### %s\n", qPrintable(parameters));
SVTK_RenderWindowInteractor* anInteractor = GetInteractor();
if ( anInteractor->isVisible() ) {
*/
void SVTK_ViewWindow::doSetVisualParameters( const QString& parameters, bool baseParamsOnly )
{
+ DBG_FUN();
double pos[3], focalPnt[3], viewUp[3], parScale = 1.0, scale[3];
*/
void SVTK_ViewWindow::onProjectionMode( QAction* theAction )
{
+ DBG_FUN();
int aMode = Parallel;
if (theAction == toolMgr()->action( ProjectionModeId ))
aMode = Projection;
*/
void SVTK_ViewWindow::onStereoMode( bool activate )
{
+ DBG_FUN();
if (activate) {
toolMgr()->action( ProjectionModeId )->setChecked(true);
vtkCamera* aCamera = getRenderer()->GetActiveCamera();
*/
void SVTK_ViewWindow::onProjectionMode()
{
+ DBG_FUN();
if (toolMgr()->action( ParallelModeId )->isChecked())
SetProjectionMode( Parallel);
if (toolMgr()->action( ProjectionModeId )->isChecked())
*/
void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr)
{
+ DBG_FUN();
QtxAction* anAction;
QtxActionToolMgr* mgr = toolMgr();
*/
void SVTK_ViewWindow::showEvent( QShowEvent * theEvent )
{
+ DBG_FUN();
emit Show( theEvent );
}
*/
void SVTK_ViewWindow::hideEvent( QHideEvent * theEvent )
{
+ DBG_FUN();
emit Hide( theEvent );
}
void* theClientData,
void* /*theCallData*/)
{
+ DBG_FUN();
SVTK_ViewWindow* self = reinterpret_cast<SVTK_ViewWindow*>(theClientData);
if(self)
self->emitTransformed();
*/
void SVTK_ViewWindow::synchronize( SUIT_ViewWindow* theView )
{
+ DBG_FUN();
bool blocked = blockSignals( true );
SUIT_CameraProperties aProps = theView->cameraProperties();
--- /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
+\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
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SalomeApp_Application"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
std::unique_ptr<SALOME_NamingService_Abstract> SalomeApp_Application::_ns;
/*!Internal class that updates object browser item properties */
/*!Constructor.*/
SalomeApp_Application::SalomeApp_Application(SALOME_NamingService_Abstract *ns):myIsCloseFromExit( false ),myToIgnoreMessages( false )
{
+ DBG_FUN();
if(!ns)
_ns.reset(new SALOME_NamingService(orb()));
else
*/
SalomeApp_Application::~SalomeApp_Application()
{
+ DBG_FUN();
// Do not destroy. It's a singleton !
//SALOME_EventFilter::Destroy();
}
/*!Start application.*/
void SalomeApp_Application::start()
{
+ DBG_FUN();
// process the command line options before start: to createActions in accordance to the options
static bool isFirst = true;
if ( isFirst ) {
/*!Create actions:*/
void SalomeApp_Application::createActions()
{
+ DBG_FUN();
LightApp_Application::createActions();
SUIT_Desktop* desk = desktop();
*/
void SalomeApp_Application::onExit()
{
+ DBG_FUN();
//MessageLocker ml( myToIgnoreMessages );
bool killServers = false;
/*!SLOT. Create a document.*/
void SalomeApp_Application::onNewDoc()
{
+ DBG_FUN();
MessageLocker ml( myToIgnoreMessages );
LightApp_Application::onNewDoc();
/*!SLOT. Load document.*/
void SalomeApp_Application::onLoadDoc()
{
+ DBG_FUN();
MessageLocker ml( myToIgnoreMessages );
QString studyName;
/*!SLOT. Unload document.*/
void SalomeApp_Application::onUnloadDoc( bool ask )
{
+ DBG_FUN();
if ( ask ) {
activeStudy()->abortAllOperations();
if ( activeStudy()->isModified() ) {
/*!SLOT. Create new study and load script*/
void SalomeApp_Application::onNewWithScript()
{
+ DBG_FUN();
QStringList filtersList;
filtersList.append(tr("PYTHON_FILES_FILTER"));
filtersList.append(tr("ALL_FILES_FILTER"));
/*!SLOT. Load document with \a aName.*/
bool SalomeApp_Application::onLoadDoc( const QString& aName )
{
+ DBG_FUN();
+ ARG(aName);
if ( !LightApp_Application::closeDoc() )
return false;
/*!SLOT. Parse message for desktop.*/
void SalomeApp_Application::onDesktopMessage( const QString& message )
{
+ DBG_FUN();
+ ARG(message);
if ( myToIgnoreMessages )
return; // a message from SALOMEDS is caused by GUI action
/*!On module activation action.*/
void SalomeApp_Application::onModuleActivation( const QString& modName )
{
+ DBG_FUN();
+ ARG(modName);
if (!activeStudy() && !modName.isEmpty())
getStudy()->Init();
/*!SLOT. Copy objects to study maneger from selection maneger..*/
void SalomeApp_Application::onCopy()
{
+ DBG_FUN();
LightApp_Application::onCopy();
SALOME_ListIO list;
/*!SLOT. Paste objects to study maneger from selection manager.*/
void SalomeApp_Application::onPaste()
{
+ DBG_FUN();
LightApp_Application::onPaste();
SALOME_ListIO list;
/*! Check if the study is locked */
void SalomeApp_Application::onCloseDoc( bool ask )
{
+ DBG_FUN();
if(getStudy()->IsStudyLocked()) {
if ( SUIT_MessageBox::question( desktop(),
QObject::tr( "WRN_WARNING" ),
/*!SLOT. Reload document from the file.*/
bool SalomeApp_Application::onReopenDoc()
{
+ DBG_FUN();
MessageLocker ml( myToIgnoreMessages );
return LightApp_Application::onReopenDoc();
/*!SLOT. Load document.*/
void SalomeApp_Application::onOpenDoc()
{
+ DBG_FUN();
MessageLocker ml( myToIgnoreMessages );
LightApp_Application::onOpenDoc();
/*!SLOT. Load document.*/
bool SalomeApp_Application::onOpenDoc(const QString& name)
{
+ DBG_FUN();
+ ARG(name);
MessageLocker ml( myToIgnoreMessages );
return LightApp_Application::onOpenDoc(name);
/*!Sets enable or disable some actions on selection changed.*/
void SalomeApp_Application::onSelectionChanged()
{
+ DBG_FUN();
SALOME_ListIO list;
LightApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(list);
/*!Delete references.*/
void SalomeApp_Application::onDeleteInvalidReferences()
{
+ DBG_FUN();
SALOME_ListIO aList;
LightApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects( aList, QString(), false );
/*!Private SLOT. */
void SalomeApp_Application::onOpenWith()
{
+ DBG_FUN();
QApplication::setOverrideCursor( Qt::WaitCursor );
SALOME_ListIO aList;
LightApp_SelectionMgr* mgr = selectionMgr();
*/
SUIT_Study* SalomeApp_Application::createNewStudy()
{
+ DBG_FUN();
SalomeApp_Study* aStudy = new SalomeApp_Study( this );
// Set up processing of major study-related events
*/
void SalomeApp_Application::updateCommandsStatus()
{
+ DBG_FUN();
LightApp_Application::updateCommandsStatus();
// Dump study menu
/*!Private SLOT. On dump study.*/
void SalomeApp_Application::onDumpStudy( )
{
+ DBG_FUN();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
if ( !appStudy ) return;
/*!Private SLOT. On load script.*/
void SalomeApp_Application::onLoadScript( )
{
+ DBG_FUN();
if ( getStudy()->GetProperties()->IsLocked() ) {
SUIT_MessageBox::warning( desktop(),
QObject::tr("WRN_WARNING"),
/*!Private SLOT. On save GUI state.*/
void SalomeApp_Application::onSaveGUIState()
{
+ DBG_FUN();
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( activeStudy() );
if ( study ) {
SalomeApp_VisualState( this ).storeState();
/*!Public SLOT. Performs some actions when dockable windows are triggered.*/
void SalomeApp_Application::onDockWindowVisibilityChanged( bool theIsVisible )
{
+ DBG_FUN();
+ ARG(theIsVisible);
LightApp_Application::onDockWindowVisibilityChanged( theIsVisible );
QAction* send = ::qobject_cast<QAction*>( sender() );
if ( !send )
/*!Create window.*/
QWidget* SalomeApp_Application::createWindow( const int flag )
{
+ DBG_FUN();
+ ARG(flag);
QWidget* wid = 0;
#ifndef DISABLE_PYCONSOLE
if ( flag != WT_PyConsole ) wid = LightApp_Application::createWindow(flag);
/*!Create preferences.*/
void SalomeApp_Application::createPreferences( LightApp_Preferences* pref )
{
+ DBG_FUN();
LightApp_Application::createPreferences(pref);
if ( !pref )
/*!Update desktop title.*/
void SalomeApp_Application::updateDesktopTitle() {
+ DBG_FUN();
QString aTitle = applicationName();
QString aVer = applicationVersion();
if ( !aVer.isEmpty() )
}
}
+ SHOW(aTitle);
desktop()->setWindowTitle( aTitle );
}
int SalomeApp_Application::closeChoice( const QString& /*docName*/ )
{
+ DBG_FUN();
QStringList buttons;
QMap<int, int> choices;
int idx = 0;
bool SalomeApp_Application::closeAction( const int choice, bool& closePermanently )
{
+ DBG_FUN();
+ ARG(choice);
bool res = true;
switch( choice )
{
int SalomeApp_Application::openChoice( const QString& aName )
{
+ DBG_FUN();
+ ARG(aName);
int choice = LightApp_Application::openChoice( aName );
if ( QFileInfo( aName ).exists() ) {
bool SalomeApp_Application::openAction( const int aChoice, const QString& aName )
{
+ DBG_FUN();
+ ARG(aChoice);
+ ARG(aName);
bool res = false;
int choice = aChoice;
switch ( choice )
*/
QMap<int, QString> SalomeApp_Application::activateModuleActions() const
{
+ DBG_FUN();
QMap<int, QString> opmap = LightApp_Application::activateModuleActions();
opmap.insert( LoadStudyId, tr( "ACTIVATE_MODULE_OP_LOAD" ) );
*/
void SalomeApp_Application::moduleActionSelected( const int id )
{
+ DBG_FUN();
+ ARG(id);
switch ( id ) {
case LoadStudyId:
onLoadDoc();
/*!Private SLOT. On preferences.*/
void SalomeApp_Application::onProperties()
{
+ DBG_FUN();
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( activeStudy() );
if( !study )
return;
/*!Insert items in popup, which necessary for current application*/
void SalomeApp_Application::contextMenuPopup( const QString& type, QMenu* thePopup, QString& title )
{
+ DBG_FUN();
+ ARG(type);
LightApp_SelectionMgr* mgr = selectionMgr();
bool cacheIsOn = mgr->isSelectionCacheEnabled();
mgr->setSelectionCacheEnabled( true );
3. update object browser if it exists */
void SalomeApp_Application::updateObjectBrowser( const bool updateModels )
{
+ DBG_FUN();
+ ARG(updateModels);
// update "non-existing" (not loaded yet) data models
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
if ( study )
/*!Display Catalog Genenerator dialog */
void SalomeApp_Application::onCatalogGen()
{
+ DBG_FUN();
ToolsGUI_CatalogGeneratorDlg aDlg( desktop() );
aDlg.exec();
}
/*!Display Registry Display dialog */
void SalomeApp_Application::onRegDisplay()
{
+ DBG_FUN();
CORBA::ORB_var anOrb = orb();
ToolsGUI_RegWidget* regWnd = ToolsGUI_RegWidget::GetRegWidget( anOrb, desktop() );
regWnd->show();
/*!find original object by double click on item */
void SalomeApp_Application::onDblClick( SUIT_DataObject* theObj )
{
+ DBG_FUN();
// Issue 21379: References are supported at LightApp_DataObject level
LightApp_DataObject* obj = dynamic_cast<LightApp_DataObject*>( theObj );
*/
SUIT_ViewManager* SalomeApp_Application::newViewManager(const QString& type)
{
+ DBG_FUN();
+ ARG(type);
return createViewManager(type);
}
/*!Called on Restore GUI State popup command*/
void SalomeApp_Application::onRestoreGUIState()
{
+ DBG_FUN();
int savePoint = ::getSelectedSavePoint( selectionMgr() );
if ( savePoint == -1 )
return;
/*!Called on Delete GUI State popup command*/
void SalomeApp_Application::onDeleteGUIState()
{
+ DBG_FUN();
int savePoint = ::getSelectedSavePoint( selectionMgr() );
if ( savePoint == -1 )
return;
/*!Called on New study operation*/
void SalomeApp_Application::onStudyCreated( SUIT_Study* study )
{
+ DBG_FUN();
LightApp_Application::onStudyCreated( study );
//#ifndef DISABLE_PYCONSOLE
/*!Called on Open study operation*/
void SalomeApp_Application::onStudyOpened( SUIT_Study* study )
{
+ DBG_FUN();
LightApp_Application::onStudyOpened( study );
//#ifndef DISABLE_PYCONSOLE
/*! updateSavePointDataObjects: syncronize data objects that correspond to save points (gui states)*/
void SalomeApp_Application::updateSavePointDataObjects( SalomeApp_Study* study )
{
+ DBG_FUN();
SUIT_DataBrowser* ob = objectBrowser();
LightApp_SelectionMgr* selMgr = selectionMgr();
*/
bool SalomeApp_Application::useStudy( const QString& theName )
{
+ DBG_FUN();
+ ARG(theName);
createEmptyStudy();
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
bool res = false;
/*! Show/hide object browser colums according to preferences */
void SalomeApp_Application::objectBrowserColumnsVisibility()
{
+ DBG_FUN();
if ( objectBrowser() )
for ( int i = SalomeApp_DataObject::EntryId; i < SalomeApp_DataObject::LastId; i++ )
{
/*! Set SalomeApp_NoteBook pointer */
void SalomeApp_Application::setNoteBook( SalomeApp_NoteBook* theNoteBook )
{
+ DBG_FUN();
myNoteBook = theNoteBook;
}
*/
void SalomeApp_Application::createExtraActions()
{
+ DBG_FUN();
myExtActions.clear();
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
*/
void SalomeApp_Application::onExtAction()
{
+ DBG_FUN();
QAction* aAction = ::qobject_cast<QAction*>(sender());
if (!aAction)
return;
*/
bool SalomeApp_Application::renameObject( const QString& /*entry*/, const QString& name )
{
+ DBG_FUN();
+ ARG(name);
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
int savePoint = ::getSelectedSavePoint( selectionMgr() );
//============================================================================
void SalomeApp_Application::onUpdateStudy()
{
+ DBG_FUN();
QApplication::setOverrideCursor( Qt::WaitCursor );
if( !updateStudy() )
//============================================================================
bool SalomeApp_Application::updateStudy()
{
+ DBG_FUN();
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( activeStudy() );
if ( !study || !myNoteBook )
return false;
const QString& theStudyName,
bool theIsStudySaved )
{
+ DBG_FUN();
+ ARG(theDumpScript);
+ ARG(theStudyName);
bool ok = true;
// create a new study
*/
void SalomeApp_Application::afterCloseDoc()
{
+ DBG_FUN();
#ifndef DISABLE_PYCONSOLE
// emit signal to restore study from Python script
if ( myNoteBook ) {
bool SalomeApp_Application::canOpenDoc( const QString& url )
{
+ DBG_FUN();
_PTR(Study) aStudyDS = getStudy();
if ( aStudyDS )
return aStudyDS->CanOpen( url.toUtf8().data() );
PyConsole_Interp* SalomeApp_Application::createPyInterp()
{
+ DBG_FUN();
return new SalomeApp_PyInterp( resourceMgr() );
}
void SalomeApp_Application::ensureShaperIsActivated()
{
+ DBG_FUN();
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
_PTR(Study) studyDS = getStudy();
if ( study && studyDS )
void SalomeApp_Application::addCatalogue( const QString& moduleName, const QString& catalogue )
{
+ DBG_FUN();
+ ARG(moduleName);
+ ARG(catalogue);
CORBA::Object_var obj = namingService()->Resolve( "/Kernel/ModulCatalog" );
SALOME_ModuleCatalog::ModuleCatalog_var moduleCatalogue = SALOME_ModuleCatalog::ModuleCatalog::_narrow( obj );
QFileInfo fi( catalogue );
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_Exception)
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SalomeApp_DataModel"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
typedef _PTR(SObject) kerPtr;
typedef SUIT_DataObject* suitPtr;
: myStudy( aStudy ),
myRoot( aRoot )
{
+ DBG_FUN();
}
/*!
*/
bool SalomeApp_DataModelSync::isCorrect( const kerPtr& so ) const
{
+ DBG_FUN();
#ifdef WITH_SALOMEDS_OBSERVER
// with GUI observers this function is not needed anymore
return true;
const suitPtr& parent,
const suitPtr& after ) const
{
+ DBG_FUN();
if( !isCorrect( so ) )
return 0;
*/
void SalomeApp_DataModelSync::deleteItemWithChildren( const suitPtr& p ) const
{
+ DBG_FUN();
if( !p )
return;
*/
QList<kerPtr> SalomeApp_DataModelSync::children( const kerPtr& obj ) const
{
+ DBG_FUN();
QList<kerPtr> ch;
_PTR( GenericAttribute ) anAttr;
*/
QList<suitPtr> SalomeApp_DataModelSync::children( const suitPtr& p ) const
{
+ DBG_FUN();
QList<suitPtr> ch;
if ( p )
ch = p->children();
*/
void SalomeApp_DataModelSync::updateItem( const kerPtr&, const suitPtr& ) const
{
+ DBG_FUN();
}
/*!
SalomeApp_DataModel::SalomeApp_DataModel( CAM_Module* theModule )
: LightApp_DataModel( theModule )
{
+ DBG_FUN();
}
/*!
*/
SalomeApp_DataModel::~SalomeApp_DataModel()
{
+ DBG_FUN();
}
/*!
*/
bool SalomeApp_DataModel::open( const QString& name, CAM_Study* study, QStringList )
{
+ DBG_FUN();
+ ARG(name);
SalomeApp_Study* aDoc = dynamic_cast<SalomeApp_Study*>( study );
if ( !aDoc )
return false;
*/
bool SalomeApp_DataModel::create( CAM_Study* theStudy )
{
+ DBG_FUN();
update(NULL, (LightApp_Study*)theStudy);
return true;
}
*/
void SalomeApp_DataModel::update( LightApp_DataObject*, LightApp_Study* study )
{
+ DBG_FUN();
SalomeApp_Study* aSStudy = dynamic_cast<SalomeApp_Study*>(study);
LightApp_RootObject* studyRoot = 0;
_PTR(SComponent) sobj;
*/
SUIT_DataObject* SalomeApp_DataModel::synchronize( const _PTR( SComponent )& sobj, SalomeApp_Study* study )
{
+ DBG_FUNC();
if( !study || !study->root() || !sobj )
return 0;
*/
void SalomeApp_DataModel::updateTree( const _PTR( SComponent )& comp, SalomeApp_Study* study )
{
+ DBG_FUN();
SalomeApp_ModuleObject* aNewRoot = dynamic_cast<SalomeApp_ModuleObject*>( synchronize( comp, study ) );
if( aNewRoot )
{
*/
SalomeApp_Study* SalomeApp_DataModel::getStudy() const
{
+ DBG_FUN();
if(!root()) return 0;
LightApp_RootObject* aRoot = dynamic_cast<LightApp_RootObject*>( root()->root() );
if ( !aRoot )
*/
QString SalomeApp_DataModel::getRootEntry( SalomeApp_Study* study ) const
{
+ DBG_FUN();
QString anEntry;
if ( root() && root()->root() ) { // data model already in a study
SalomeApp_DataObject* anObj = dynamic_cast<SalomeApp_DataObject*>( root() );
#include <QString>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SalomeApp_Module"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!Constructor.*/
SalomeApp_Module::SalomeApp_Module( const QString& name )
: LightApp_Module( name )
{
+ DBG_FUN();
}
/*!Destructor.*/
SalomeApp_Module::~SalomeApp_Module()
{
+ DBG_FUN();
}
/*!Gets application.*/
/*!Create new instance of data model and return it.*/
CAM_DataModel* SalomeApp_Module::createDataModel()
{
+ DBG_FUN();
return new SalomeApp_DataModel(this);
}
/*!Create and return instance of LightApp_Selection.*/
LightApp_Selection* SalomeApp_Module::createSelection() const
{
+ DBG_FUN();
return LightApp_Module::createSelection();
}
*/
void SalomeApp_Module::extractContainers( const SALOME_ListIO& source, SALOME_ListIO& dest ) const
{
+ DBG_FUN();
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if( !study )
{
*/
void SalomeApp_Module::storeVisualParameters(int /*savePoint*/)
{
+ DBG_FUN();
}
/*!
*/
void SalomeApp_Module::restoreVisualParameters(int /*savePoint*/)
{
+ DBG_FUN();
}
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_Exception)
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "SalomeApp_Study"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
//#define NOTIFY_BY_EVENT
class ObserverEvent : public QEvent
Observer_i( SalomeApp_Study* aStudy):QObject(aStudy)
{
+ DBG_FUN();
myStudy=aStudy;
fillEntryMap();
}
virtual void notifyObserverID(const char* theID, CORBA::Long event)
{
+ DBG_FUN();
#ifdef NOTIFY_BY_EVENT
QCoreApplication::postEvent(this,new ObserverEvent(theID,event));
#else
virtual bool event(QEvent *event)
{
+ DBG_FUN();
if (event->type() == QEvent::User )
{
//START_TIMING(notify);
switch(event) {
case 1:
{ //Add sobject
+ MSGEL("...Add SObject: theID=\"" << theID << "\", event=" << event);
_PTR(SObject) aSObj = SalomeApp_Application::getStudy()->FindObjectID(theID);
_PTR(SComponent) aSComp = aSObj->GetFatherComponent();
}
case 2:
{ // Remove sobject
+ MSGEL("...Remove SObject: theID=\"" << theID << "\", event=" << event);
EntryMapIter it = entry2SuitObject.find( theID );
if ( it != entry2SuitObject.end() )
{
}
case 0:
{ //modify sobject
+ MSGEL("...Modify SObject: theID=\"" << theID << "\", event=" << event);
//MESSAGE("Want to modify an object " << theID);
EntryMapIter it = entry2SuitObject.find( theID );
if ( it != entry2SuitObject.end() )
}
case 5: //IOR of the object modified
{
+ MSGEL("...IOR of SObject modified: theID=\"" << theID << "\", event=" << event);
EntryMapIter it = entry2SuitObject.find( theID );
if ( it != entry2SuitObject.end() )
suit_obj = it->second;
#ifndef DISABLE_PYCONSOLE
case 6: //NoteBook variables were modified
{
+ MSGEL("...NoteBook variable modified: theID=\"" << theID << "\", event=" << event);
myStudy->onNoteBookVarUpdate( QString( theID.c_str() ) );
break;
}
private:
void fillEntryMap()
{
+ DBG_FUN();
entry2SuitObject.clear();
SUIT_DataObject* o = myStudy->root();
while (o) {
SalomeApp_Study::SalomeApp_Study( SUIT_Application* app )
: LightApp_Study( app ), myObserver( 0 )
{
+ DBG_FUN();
myStudyDS = SalomeApp_Application::getStudy();
}
*/
SalomeApp_Study::~SalomeApp_Study()
{
+ DBG_FUN();
if ( myObserver ) {
PortableServer::ObjectId_var oid = myObserver->_default_POA()->servant_to_id( myObserver );
myObserver->_default_POA()->deactivate_object( oid.in() );
#ifndef DISABLE_PYCONSOLE
void SalomeApp_Study::onNoteBookVarUpdate( QString theVarName)
{
+ DBG_FUN();
+ ARG(theVarName);
emit notebookVarUpdated( theVarName );
}
#endif
*/
QString SalomeApp_Study::studyName() const
{
+ DBG_FUN();
// redefined from SUIT_Study to update study name properly since
// it can be changed outside of GUI
// TEMPORARILY SOLUTION: better to be implemented with help of SALOMEDS observers
*/
bool SalomeApp_Study::createDocument( const QString& theStr )
{
+ DBG_FUN();
+ ARG(theStr);
MESSAGE( "createDocument" );
setStudyName( QString::fromUtf8(myStudyDS->URL().c_str()) );
*/
bool SalomeApp_Study::openDocument( const QString& theFileName )
{
+ DBG_FUN();
+ ARG(theFileName);
MESSAGE( "openDocument" );
// read HDF file
*/
bool SalomeApp_Study::loadDocument( const QString& theStudyName )
{
+ DBG_FUN();
+ ARG(theStudyName);
MESSAGE( "loadDocument" );
setRoot( new SalomeApp_RootObject( this ) ); // create myRoot
*/
bool SalomeApp_Study::saveDocumentAs( const QString& theFileName )
{
+ DBG_FUN();
+ ARG(theFileName);
bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", false );
if ( store )
SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState();
*/
bool SalomeApp_Study::saveDocument()
{
+ DBG_FUN();
bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true );
if ( store )
SalomeApp_VisualState( (SalomeApp_Application*)application() ).storeState();
*/
void SalomeApp_Study::closeDocument(bool permanently)
{
+ DBG_FUN();
+ ARG(permanently);
LightApp_Study::closeDocument(permanently);
// close SALOMEDS document
bool isMultiFile,
bool toSaveGUI )
{
+ DBG_FUN();
+ ARG(theFileName);
int savePoint = 0;
_PTR(AttributeParameter) ap;
_PTR(IParameters) ip = ClientFactory::getIParameters(ap);
*/
void SalomeApp_Study::Modified()
{
+ DBG_FUN();
myStudyDS->Modified();
LightApp_Study::Modified();
}
*/
void SalomeApp_Study::saveModuleData( QString theModuleName, int type, QStringList theListOfFiles )
{
+ DBG_FUN();
+ ARG(theModuleName);
+ ARG(type);
int aNb = theListOfFiles.count();
if ( aNb == 0 )
return;
*/
void SalomeApp_Study::openModuleData( QString theModuleName, int type, QStringList& theListOfFiles )
{
+ DBG_FUN();
+ ARG(theModuleName);
+ ARG(type);
std::vector<std::string> aListOfFiles = GetListOfFiles( theModuleName.toStdString().c_str(), type );
int i, aLength = (int)aListOfFiles.size() - 1; //!< TODO: conversion from size_t to int
*/
bool SalomeApp_Study::saveStudyData( const QString& /*theFileName*/, int type )
{
+ DBG_FUN();
ModelList list; dataModels( list );
QListIterator<CAM_DataModel*> it( list );
while ( it.hasNext() ){
*/
bool SalomeApp_Study::openStudyData( const QString& /*theFileName*/, int /*type*/ )
{
+ DBG_FUN();
return true;
}
CAM_ModuleObject* SalomeApp_Study::createModuleObject( LightApp_DataModel* theDataModel,
SUIT_DataObject* theParent ) const
{
+ DBG_FUN();
SalomeApp_Study* that = const_cast<SalomeApp_Study*>( this );
// Ensure that SComponent instance is published in the study for the given module
*/
void SalomeApp_Study::dataModelInserted (const CAM_DataModel* dm)
{
+ DBG_FUN();
MESSAGE("SalomeApp_Study::dataModelInserted() : module name() = " << dm->module()->name().toStdString());
CAM_Study::dataModelInserted(dm);
*/
void SalomeApp_Study::addComponent(const CAM_DataModel* dm)
{
+ DBG_FUN();
SalomeApp_Module* aModule = dynamic_cast<SalomeApp_Module*>( dm->module() );
// 1. aModule == 0 means that this is a light module (no CORBA enigine)
if (!aModule) {
*/
bool SalomeApp_Study::openDataModel( const QString& studyName, CAM_DataModel* dm )
{
+ DBG_FUN();
+ ARG(studyName);
if (!dm)
return false;
*/
std::vector<std::string> SalomeApp_Study::GetListOfFiles( const char* theModuleName, int type ) const
{
+ DBG_FUN();
+ ARG(theModuleName);
+ ARG(type);
// Issue 21377 - using separate engine for each type of light module
SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance( theModuleName, false );
if (aDefaultEngine)
void SalomeApp_Study::SetListOfFiles ( const char* theModuleName, int type,
const std::vector<std::string> theListOfFiles )
{
+ DBG_FUN();
+ ARG(theModuleName);
+ ARG(type);
// Issue 21377 - using separate engine for each type of light module
SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance( theModuleName, false );
if (aDefaultEngine)
*/
std::string SalomeApp_Study::GetTmpDir ( const char* theURL, const bool isMultiFile )
{
+ DBG_FUN();
+ ARG(theURL);
std::string anURLDir = SALOMEDS_Tool::GetDirFromPath(theURL);
std::string aTmpDir = isMultiFile ? anURLDir : SALOMEDS_Tool::GetTmpDir();
return aTmpDir;
*/
void SalomeApp_Study::RemoveTemporaryFiles ( const char* theModuleName, bool isMultiFile, bool force )
{
+ DBG_FUN();
+ ARG(theModuleName);
if (isMultiFile)
return;
*/
void SalomeApp_Study::updateFromNotebook( const QString& theFileName, bool isSaved )
{
+ DBG_FUN();
+ ARG(theFileName);
setStudyName(theFileName);
studyDS()->URL(theFileName.toStdString());
setIsSaved( isSaved );
LightApp_DataObject* SalomeApp_Study::findObjectByEntry( const QString& theEntry )
{
+ DBG_FUN();
+ ARG(theEntry);
LightApp_DataObject* o = 0;
if ( myObserver ) {
o = dynamic_cast<LightApp_DataObject*>( myObserver->findObject( theEntry.toUtf8().constData() ) );
*/
void SalomeApp_Study::deleteReferencesTo( _PTR( SObject ) obj )
{
+ DBG_FUN();
_PTR(StudyBuilder) sb = studyDS()->NewBuilder();
std::vector<_PTR(SObject)> aRefs = studyDS()->FindDependances( obj );
for( size_t i=0, n=aRefs.size(); i<n; i++ )
*/
QString SalomeApp_Study::referencedToEntry( const QString& entry ) const
{
+ DBG_FUN();
+ ARG(entry);
_PTR(SObject) obj = studyDS()->FindObjectID( entry.toStdString() );
_PTR(SObject) refobj;
*/
void SalomeApp_Study::children( const QString& entry, QStringList& child_entries ) const
{
+ DBG_FUN();
+ ARG(entry);
_PTR(SObject) SO = studyDS()->FindObjectID( entry.toStdString() );
_PTR(ChildIterator) anIter ( studyDS()->NewChildIterator( SO ) );
anIter->InitEx( true );
*/
void SalomeApp_Study::components( QStringList& comps ) const
{
+ DBG_FUN();
for( _PTR(SComponentIterator) it ( studyDS()->NewComponentIterator() ); it->More(); it->Next() )
{
_PTR(SComponent) aComponent ( it->Value() );
*/
QString SalomeApp_Study::centry( const QString& comp ) const
{
+ DBG_FUN();
+ ARG(comp);
QString e;
for( _PTR(SComponentIterator) it ( studyDS()->NewComponentIterator() ); it->More() && e.isEmpty(); it->Next() )
{
if ( aComponent && comp == aComponent->ComponentDataType().c_str() )
e = aComponent->GetID().c_str();
}
+ RET(e);
return e;
}
*/
std::vector<int> SalomeApp_Study::getSavePoints()
{
+ DBG_FUN();
std::vector<int> v;
_PTR(SObject) so = studyDS()->FindComponent( getVisualComponentName().toLatin1().constData() );
*/
void SalomeApp_Study::removeSavePoint(int savePoint)
{
+ DBG_FUN();
+ ARG(savePoint);
if(savePoint <= 0) return;
_PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName().toLatin1().constData(), savePoint);
_PTR(SObject) so = AP->GetSObject();
*/
void SalomeApp_Study::setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint)
{
+ DBG_FUN();
+ ARG(savePoint);
+ ARG(nameOfSavePoint);
_PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName().toLatin1().constData(), savePoint);
_PTR(IParameters) ip = ClientFactory::getIParameters(AP);
ip->setProperty("AP_SAVEPOINT_NAME", nameOfSavePoint.toStdString());
*/
void SalomeApp_Study::restoreState(int savePoint)
{
+ DBG_FUN();
+ ARG(savePoint);
SalomeApp_VisualState((SalomeApp_Application*)application()).restoreState(savePoint);
}
*/
void SalomeApp_Study::updateModelRoot( const CAM_DataModel* dm )
{
+ DBG_FUN();
LightApp_Study::updateModelRoot( dm );
// calling updateSavePointDataObjects in order to set correct order of "Gui states" object
--- /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
+\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
#include <vtkRenderer.h>
#include <vtkPassThrough.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_Actor"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
#if defined __GNUC__
#if __GNUC__ == 2
#define __GNUC_2__
myIsPreselected(false),
myIsHighlighted(false)
{
+ DBG_FUN();
VTKViewer_Actor::GetDefaultPolygonOffsetParameters(myPolygonOffsetFactor,
myPolygonOffsetUnits);
VTKViewer_Actor
::~VTKViewer_Actor()
{
+ DBG_FUN();
SetPreviewProperty(NULL);
myGeomFilter->Delete();
VTKViewer_Actor
::setName(const char* theName)
{
+ DBG_FUN();
myName = theName;
+ ARG(myName);
}
/*!
VTKViewer_Actor
::AddToRender(vtkRenderer* theRenderer)
{
+ DBG_FUN();
theRenderer->AddActor(this);
}
VTKViewer_Actor
::RemoveFromRender(vtkRenderer* theRenderer)
{
+ DBG_FUN();
theRenderer->RemoveActor(this);
}
VTKViewer_Actor
::SetTransform(VTKViewer_Transform* theTransform)
{
+ DBG_FUN();
myTransformFilter->SetTransform(theTransform);
}
VTKViewer_Actor
::SetMapper(vtkMapper* theMapper)
{
+ DBG_FUN();
InitPipeLine(theMapper);
}
VTKViewer_Actor
::InitPipeLine(vtkMapper* theMapper)
{
+ DBG_FUN();
if(theMapper){
int anId = 0;
myPassFilter[ anId ]->SetInputData( theMapper->GetInput() );
VTKViewer_Actor
::Render(vtkRenderer *ren, vtkMapper* m)
{
+ //DBG_FUN();
+ MSGEL("...VTKViewer_Actor::Render()");
+
if(vtkDataSet* aDataSet = GetInput()){
static double PERCENTS_OF_DETAILS = 0.50;
vtkIdType aNbOfPoints = vtkIdType(aDataSet->GetNumberOfPoints()*PERCENTS_OF_DETAILS);
VTKViewer_Actor
::SetResolveCoincidentTopology(bool theIsResolve)
{
+ DBG_FUN();
myIsResolveCoincidentTopology = theIsResolve;
}
::SetPolygonOffsetParameters(double factor,
double units)
{
+ DBG_FUN();
myPolygonOffsetFactor = factor;
myPolygonOffsetUnits = units;
}
VTKViewer_Actor
::SetRepresentation(int theMode)
{
+ DBG_FUN();
+ ARG(theMode);
using namespace VTKViewer::Representation;
switch(myRepresentation){
case Points :
VTKViewer_Actor
::SetInfinitive(bool theIsInfinite)
{
+ DBG_FUN();
+ ARG(theIsInfinite);
myIsInfinite = theIsInfinite;
}
VTKViewer_Actor
::SetOpacity(double theOpacity)
{
+ DBG_FUN();
+ ARG(theOpacity);
myOpacity = theOpacity;
GetProperty()->SetOpacity(theOpacity);
}
double g,
double b)
{
+ DBG_FUN();
+ MSGEL("RGB=(" << r << ", " << g << ", " << b << ")");
GetProperty()->SetColor(r,g,b);
}
VTKViewer_Actor
::SetColor(const double theRGB[3])
{
+ MSGEL("RGB=(" << theRGB[0] << ", " << theRGB[1] << ", " << theRGB[2] << ")");
SetColor(theRGB[0],theRGB[1],theRGB[2]);
}
VTKViewer_Actor
::setDisplayMode(int theMode)
{
+ DBG_FUN();
+ ARG(theMode);
SetRepresentation(theMode + 1);
myDisplayMode = GetRepresentation() - 1;
}
VTKViewer_Actor
::SetPreSelected(bool thePreselect)
{
+ //DBG_FUN();
myIsPreselected = thePreselect;
}
* On/Off representation 2D quadratic element as arked polygon
*/
void VTKViewer_Actor::SetQuadraticArcMode(bool theFlag){
+ DBG_FUN();
myGeomFilter->SetQuadraticArcMode(theFlag);
}
* Set Max angle for representation 2D quadratic element as arked polygon
*/
void VTKViewer_Actor::SetQuadraticArcAngle(double theMaxAngle){
+ DBG_FUN();
myGeomFilter->SetQuadraticArcAngle(theMaxAngle);
}
#include <vtkPoints.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_AppendFilter"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
#if defined __GNUC__
#if __GNUC__ == 2
#define __GNUC_2__
VTKViewer_AppendFilter
::VTKViewer_AppendFilter()
{
+ DBG_FUN();
myDoMappingFlag = false;
}
VTKViewer_AppendFilter
::~VTKViewer_AppendFilter()
-{}
+{
+ DBG_FUN();
+}
void
VTKViewer_AppendFilter
::SetDoMappingFlag(const bool theFlag)
{
+ DBG_FUN();
+ ARG(theFlag);
if(myDoMappingFlag == theFlag)
return;
VTKViewer_AppendFilter
::SetSharedPointsDataSet(vtkPointSet* thePointsDataSet)
{
+ DBG_FUN();
if(GetSharedPointsDataSet() == thePointsDataSet)
return;
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
+ DBG_FUN();
int aRet = 0;
if(GetSharedPointsDataSet())
aRet = MakeOutput(request,inputVector,outputVector);
VTKViewer_AppendFilter
::DoMapping()
{
+ DBG_FUN();
myNodeRanges.clear();
myCellRanges.clear();
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
+ DBG_FUN();
int idx;
vtkIdType numPts, numCells, cellId;
// vtkCellData *cd;
int VTKViewer_AppendFilter::FillInputPortInformation(int, vtkInformation *info)
{
+ DBG_FUN();
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataSet");
info->Set(vtkAlgorithm::INPUT_IS_REPEATABLE(), 1);
return 1;
#include <vtkPolyData.h>
#include <vtkPointData.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_ArcBuilder"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
#define PRECISION 10e-4
#define ANGLE_PRECISION 0.5
//#define _MY_DEBUG_
myAngle(theAngle),
myStatus(Arc_Error)
{
+ DBG_FUN();
Vec V1(thePnt2.GetXYZ().X()-thePnt1.GetXYZ().X(),
thePnt2.GetXYZ().Y()-thePnt1.GetXYZ().Y(),
thePnt2.GetXYZ().Z()-thePnt1.GetXYZ().Z());
* Destructor
*/
VTKViewer_ArcBuilder::~VTKViewer_ArcBuilder()
-{}
+{
+ DBG_FUN();
+}
/*
*/
vtkUnstructuredGrid* VTKViewer_ArcBuilder::BuildGrid(const PntList& theList) const
{
+ DBG_FUN();
int aListsize = (int)theList.size(); //!< TODO: conversion from size_t to int
vtkUnstructuredGrid* aGrid = NULL;
VTKViewer_ArcBuilder::TransformGrid(vtkUnstructuredGrid* theGrid,
const Vec& theAxis, const double angle) const
{
+ DBG_FUN();
vtkTransform *aTransform = vtkTransform::New();
aTransform->RotateWXYZ(angle, theAxis.GetXYZ().X(), theAxis.GetXYZ().Y(), theAxis.GetXYZ().Z());
vtkTransformFilter* aTransformFilter = vtkTransformFilter::New();
vtkUnstructuredGrid* VTKViewer_ArcBuilder::BuildArc(std::vector<double>& theScalarValues)
{
+ DBG_FUN();
double x1 = myPnt1.GetXYZ().X(); double x2 = myPnt2.GetXYZ().X(); double x3 = myPnt3.GetXYZ().X();
double y1 = myPnt1.GetXYZ().Y(); double y2 = myPnt2.GetXYZ().Y(); double y3 = myPnt3.GetXYZ().Y();
double z = myPnt1.GetXYZ().Z(); //Points on plane || XOY
#include <vtkPolyData.h>
#include <vtkCellArray.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_CellCenters"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
vtkStandardNewMacro(VTKViewer_CellCenters)
/*!
*/
VTKViewer_CellCenters::VTKViewer_CellCenters()
{
+ DBG_FUN();
}
/*!
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
+ DBG_FUN();
// get the info objects
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
vtkInformation *outInfo = outputVector->GetInformationObject(0);
#include <vtkTriangle.h>
#include <vtkOrderedTriangulator.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_Triangulator"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
#ifdef _DEBUG_
static int DEBUG_TRIA_EXECUTE = 0;
#else
myPointIds(NULL),
myFaceIds(vtkIdList::New()),
myPoints(vtkPoints::New())
-{}
+{
+ DBG_FUN();
+}
//----------------------------------------------------------------------------
VTKViewer_Triangulator
::~VTKViewer_Triangulator()
{
+ DBG_FUN();
myCellIds->Delete();
myFaceIds->Delete();
myPoints->Delete();
::InitPoints(vtkUnstructuredGrid *theInput,
vtkIdType theCellId)
{
+ DBG_FUN();
myPoints->Reset();
myPoints->Modified(); // the VTK bug
std::vector< std::vector<vtkIdType> >& theDimension2VTK2ObjIds,
bool theIsCheckConvex)
{
+ DBG_FUN();
vtkPoints *aPoints = InitPoints(theInput, theCellId);
vtkIdType aNumPts = GetNbOfPoints();
if(DEBUG_TRIA_EXECUTE) cout<<"Triangulator - aNumPts = "<<aNumPts<<"\n";
}
+#define MBCLASSNAME "VTKViewer_OrderedTriangulator"
//----------------------------------------------------------------------------
VTKViewer_OrderedTriangulator
::VTKViewer_OrderedTriangulator():
myBoundaryTris(vtkCellArray::New()),
myTriangle(vtkTriangle::New())
{
+ DBG_FUN();
myBoundaryTris->Allocate(VTK_CELL_SIZE);
myTriangulator->PreSortedOff();
}
VTKViewer_OrderedTriangulator
::~VTKViewer_OrderedTriangulator()
{
+ DBG_FUN();
myTriangle->Delete();
myBoundaryTris->Delete();
myTriangulator->Delete();
::InitPoints(vtkUnstructuredGrid *theInput,
vtkIdType theCellId)
{
+ DBG_FUN();
myBoundaryTris->Reset();
vtkPoints* aPoints = VTKViewer_Triangulator::InitPoints(theInput, theCellId);
}
+#define MBCLASSNAME "VTKViewer_DelaunayTriangulator"
//----------------------------------------------------------------------------
VTKViewer_DelaunayTriangulator
::VTKViewer_DelaunayTriangulator():
myDelaunay3D(vtkDelaunay3D::New()),
myPolyData(NULL)
{
+ DBG_FUN();
myUnstructuredGrid->Initialize();
myUnstructuredGrid->Allocate();
myUnstructuredGrid->SetPoints(myPoints);
VTKViewer_DelaunayTriangulator
::~VTKViewer_DelaunayTriangulator()
{
+ DBG_FUN();
myUnstructuredGrid->Delete();
myGeometryFilter->Delete();
myDelaunay3D->Delete();
::InitPoints(vtkUnstructuredGrid *theInput,
vtkIdType theCellId)
{
+ DBG_FUN();
vtkPoints* aPoints = VTKViewer_Triangulator::InitPoints(theInput, theCellId);
myPoints->Modified();
#include <vtkDataSetSurfaceFilter.h>
#include <vtkObjectFactory.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_DataSetMapper"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
vtkStandardNewMacro(VTKViewer_DataSetMapper)
//----------------------------------------------------------------------------
VTKViewer_DataSetMapper::VTKViewer_DataSetMapper()
{
+ DBG_FUN();
this->MarkerEnabled = false;
this->BallEnabled = false;
this->BallScale = 1;
//----------------------------------------------------------------------------
VTKViewer_DataSetMapper::~VTKViewer_DataSetMapper()
{
+ DBG_FUN();
}
//----------------------------------------------------------------------------
void VTKViewer_DataSetMapper::Render(vtkRenderer *ren, vtkActor *act)
{
+ DBG_FUN();
// just to create VTKViewer_PolyDataMapper instead of vtkPolyDataMapper
if( this->PolyDataMapper == NULL )
{
//-----------------------------------------------------------------------------
void VTKViewer_DataSetMapper::SetMarkerEnabled( bool theMarkerEnabled )
{
+ DBG_FUN();
this->MarkerEnabled = theMarkerEnabled;
if( this->PolyDataMapper )
if( VTKViewer_PolyDataMapper* aMapper = dynamic_cast<VTKViewer_PolyDataMapper*>( this->PolyDataMapper ) )
//-----------------------------------------------------------------------------
void VTKViewer_DataSetMapper::SetBallEnabled( bool theBallEnabled )
{
+ DBG_FUN();
this->BallEnabled = theBallEnabled;
if( this->PolyDataMapper )
if( VTKViewer_PolyDataMapper* aMapper = dynamic_cast<VTKViewer_PolyDataMapper*>( this->PolyDataMapper ) )
//-----------------------------------------------------------------------------
void VTKViewer_DataSetMapper::SetBallScale( double theBallScale )
{
+ DBG_FUN();
this->BallScale = theBallScale;
if( this->PolyDataMapper )
if( VTKViewer_PolyDataMapper* aMapper = dynamic_cast<VTKViewer_PolyDataMapper*>( this->PolyDataMapper ) )
//----------------------------------------------------------------------------
void VTKViewer_DataSetMapper::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
{
+ DBG_FUN();
this->MarkerType = theMarkerType;
this->MarkerScale = theMarkerScale;
if( this->PolyDataMapper )
//----------------------------------------------------------------------------
void VTKViewer_DataSetMapper::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
{
+ DBG_FUN();
this->MarkerType = VTK::MT_USER;
this->MarkerId = theMarkerId;
this->MarkerTexture = theMarkerTexture;
#include "utilities.h"
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_ExtractUnstructuredGrid"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
#if defined __GNUC__
#if __GNUC__ == 2
#define __GNUC_2__
VTKViewer_ExtractUnstructuredGrid::VTKViewer_ExtractUnstructuredGrid():
myExtractionMode(eCells), myChangeMode(ePassAll), myStoreMapping( false ), myPassAll( false )
-{}
+{
+ DBG_FUN();
+}
VTKViewer_ExtractUnstructuredGrid::~VTKViewer_ExtractUnstructuredGrid()
-{}
+{
+ DBG_FUN();
+}
void VTKViewer_ExtractUnstructuredGrid::RegisterCell(vtkIdType theCellId)
{
+ DBG_FUN();
+ ARG2(theCellId, long);
if ( myCellIds.insert(theCellId).second )
Modified();
}
void VTKViewer_ExtractUnstructuredGrid::RegisterCellsWithType(vtkIdType theCellType)
{
+ DBG_FUN();
+ ARG2(theCellType, long);
if ( myCellTypes.insert(theCellType).second )
Modified();
}
void VTKViewer_ExtractUnstructuredGrid::SetStoreMapping(int theStoreMapping)
{
+ DBG_FUN();
+ ARG(theStoreMapping);
if ( myStoreMapping != ( theStoreMapping != 0 ))
{
myStoreMapping = theStoreMapping != 0;
void VTKViewer_ExtractUnstructuredGrid::BuildOut2InMap()
{
+ DBG_FUN();
if ( myPassAll || !myOut2InId.empty() ) return;
vtkUnstructuredGrid *anInput = dynamic_cast< vtkUnstructuredGrid*>( this->GetInput() );
VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId/*,
VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId*/)
{
+ //DBG_FUNC();
vtkCell *aCell = theInput->GetCell(theCellId);
vtkIdType aCellType = aCell->GetCellType();
vtkIdType aCellId = -1;
VTKViewer_ExtractUnstructuredGrid::TVectorId& theOut2InId/*,
VTKViewer_ExtractUnstructuredGrid::TMapId& theIn2OutId*/)
{
+ //DBG_FUNC();
theIdList->SetId(0,theCellId);
theConnectivity->InsertNextCell(theIdList);
theCellTypesArray->InsertNextValue(VTK_VERTEX);
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
+ DBG_FUN();
// get the info objects
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
vtkInformation *outInfo = outputVector->GetInformationObject(0);
#include "VTKViewer_Filter.h"
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_Filter"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
IMPLEMENT_STANDARD_RTTIEXT(VTKViewer_Filter, Standard_Transient)
/*!
/*!Constructor.*/
VTKViewer_Filter::VTKViewer_Filter()
{
+ DBG_FUN();
myActor = 0;
}
/*!Virtual Destructor.*/
VTKViewer_Filter::~VTKViewer_Filter()
{
+ DBG_FUN();
}
/*!Check correctness of \a theCellId for actor \a theActor by
*/
void VTKViewer_Filter::SetActor( VTKViewer_Actor* theActor )
{
+ DBG_FUN();
+ ARG2(theActor, void*);
myActor = theActor;
}
#include "utilities.h"
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_GeometryFilter"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
#if defined __GNUC__
#if __GNUC__ == 2
#define __GNUC_2__
myMaxArcAngle(2),
myIsBuildArc(false)
{
+ DBG_FUN();
static int forceDelegateToVtk = -1;
if ( forceDelegateToVtk < 0 )
{
VTKViewer_GeometryFilter
::~VTKViewer_GeometryFilter()
-{}
+{
+ DBG_FUN();
+}
/*!
* \brief Return true for only one volume including a given edge
// computed in vtkGeometryFilter::UnstructuredGridExecute) and original cell ids (mesh cells)
void VTKViewer_GeometryFilter
::FillVTK2ObjIds(vtkPolyData *output) {
+ DBG_FUN();
vtkDataArray* vtkOriginalCellIds = output->GetCellData()->GetArray("vtkOriginalCellIds");
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
+ DBG_FUN();
// get the info objects
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
VTKViewer_GeometryFilter
::UnstructuredGridExecute(vtkDataSet *dataSetInput,
vtkPolyData *output,
- vtkInformation */*outInfo*/)
+ vtkInformation * /*outInfo*/)
{
+ DBG_FUN();
vtkUnstructuredGrid *input= (vtkUnstructuredGrid *)dataSetInput;
vtkCellArray *Connectivity = input->GetCells();
// Check input
TVectorId& /*theVTK2ObjIds*/,
TMapOfVectorId& theDimension2VTK2ObjIds )
{
+ //DBG_FUNC();
//theVTK2ObjIds.push_back( theCellId );
int aDimension = 0;
VTKViewer_GeometryFilter
::SetInside(int theShowInside)
{
+ DBG_FUN();
+ ARG(theShowInside);
if(myShowInside == theShowInside)
return;
VTKViewer_GeometryFilter
::SetWireframeMode(int theIsWireframeMode)
{
+ DBG_FUN();
+ ARG(theIsWireframeMode);
if(myIsWireframeMode == theIsWireframeMode)
return;
VTKViewer_GeometryFilter
::SetStoreMapping(int theStoreMapping)
{
+ DBG_FUN();
+ ARG(theStoreMapping);
if(myStoreMapping == theStoreMapping)
return;
TMapOfVectorId& theDimension2VTK2ObjIds,
bool triangulate)
{
+ DBG_FUN();
vtkIdType aCellType = VTK_POLYGON;
vtkIdType *aNewPoints = NULL;
vtkIdType aNbPoints = 0;
void VTKViewer_GeometryFilter::SetQuadraticArcMode(bool theFlag)
{
+ DBG_FUN();
+ ARG(theFlag);
if(myIsBuildArc != theFlag) {
myIsBuildArc = theFlag;
this->Modified();
void VTKViewer_GeometryFilter::SetQuadraticArcAngle(double theMaxAngle)
{
+ DBG_FUN();
+ ARG(theMaxAngle);
if(myMaxArcAngle != theMaxAngle) {
myMaxArcAngle = theMaxAngle;
this->Modified();
}
void VTKViewer_GeometryFilter::SetAppendCoincident3D(int theFlag) {
+ DBG_FUN();
+ ARG(theFlag);
if(myAppendCoincident3D != theFlag){
myAppendCoincident3D = theFlag;
this->Modified();
#include <Basics_Utils.hxx>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_OpenGLRenderer"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
vtkStandardNewMacro(VTKViewer_OpenGLRenderer)
VTKViewer_OpenGLRenderer::VTKViewer_OpenGLRenderer()
{
+ DBG_FUN();
this->GradientType = HorizontalGradient;
#ifdef VTK_OPENGL2
VTKViewer_OpenGLRenderer::~VTKViewer_OpenGLRenderer()
{
+ DBG_FUN();
}
void VTKViewer_OpenGLRenderer::SetGradientType( const int theGradientType )
{
+ DBG_FUN();
this->GradientType = theGradientType;
}
void VTKViewer_OpenGLRenderer::Clear(void)
{
+ MSGEL("...VTKViewer_OpenGLRenderer::Clear()");
+
vtkOpenGLRenderer::Clear();
#ifdef VTK_OPENGL2
if (this->OpenGLHelper.IsInitialized())
#include <Basics_Utils.hxx>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_PolyDataMapper"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
#ifndef WIN32
# ifndef GLX_GLXEXT_LEGACY
# define GLX_GLXEXT_LEGACY
//-----------------------------------------------------------------------------
VTKViewer_PolyDataMapper::VTKViewer_PolyDataMapper()
{
+ DBG_FUN();
Q_INIT_RESOURCE( VTKViewer );
this->ExtensionsInitialized = ES_None;
//-----------------------------------------------------------------------------
VTKViewer_PolyDataMapper::~VTKViewer_PolyDataMapper()
{
+ DBG_FUN();
if( PointSpriteTexture > 0 )
glDeleteTextures( 1, &PointSpriteTexture );
//-----------------------------------------------------------------------------
int VTKViewer_PolyDataMapper::InitShader()
{
+ DBG_FUN();
#ifdef VTK_OPENGL2
#if defined(WIN32) && defined(UNICODE)
std::wstring wFilePath = std::wstring(_wgetenv(L"GUI_ROOT_DIR")) + L"/share/salome/resources/gui/Point";
//-----------------------------------------------------------------------------
void VTKViewer_PolyDataMapper::SetMarkerEnabled( bool theMarkerEnabled )
{
+ DBG_FUN();
+ ARG(theMarkerEnabled);
if( this->MarkerEnabled == theMarkerEnabled )
return;
{
//----------------------------------------------------------------------------
vtkSmartPointer<vtkImageData> MakeTexture( const char* theMainTexture, const char* theAlphaTexture ) {
+ DBG_FUNC();
+ ARG(theMainTexture);
+ ARG(theAlphaTexture);
+
if( !theMainTexture || !theAlphaTexture )
return 0;
//-----------------------------------------------------------------------------
void VTKViewer_PolyDataMapper::SetBallEnabled( bool theBallEnabled )
{
+ DBG_FUN();
if( this->BallEnabled == theBallEnabled )
return;
else
//-----------------------------------------------------------------------------
void VTKViewer_PolyDataMapper::SetBallScale( double theBallScale )
{
+ DBG_FUN();
+ ARG(theBallScale);
if( this->BallScale == theBallScale )
return;
this->BallScale = theBallScale;
//-----------------------------------------------------------------------------
void VTKViewer_PolyDataMapper::SetMarkerStd( VTK::MarkerType theMarkerType, VTK::MarkerScale theMarkerScale )
{
+ DBG_FUN();
if( this->MarkerType == theMarkerType && this->MarkerScale == theMarkerScale )
return;
//-----------------------------------------------------------------------------
void VTKViewer_PolyDataMapper::SetMarkerTexture( int theMarkerId, VTK::MarkerTexture theMarkerTexture )
{
+ DBG_FUN();
if( this->MarkerType == VTK::MT_USER && this->MarkerId == theMarkerId )
return;
//-----------------------------------------------------------------------------
int VTKViewer_PolyDataMapper::InitExtensions()
{
+ DBG_FUN();
#ifdef VTK_OPENGL2
int n = 0;
std::ostringstream strm;
//-----------------------------------------------------------------------------
void VTKViewer_PolyDataMapper::InitPointSprites()
{
+ DBG_FUN();
glEnable( GL_POINT_SPRITE_ARB );
glEnable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB );
//-----------------------------------------------------------------------------
void VTKViewer_PolyDataMapper::CleanupPointSprites()
{
+ DBG_FUN();
glPopAttrib();
glDisable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB );
//-----------------------------------------------------------------------------
void VTKViewer_PolyDataMapper::InitTextures()
{
+ DBG_FUN();
if( !this->ImageData.GetPointer() )
return;
//-----------------------------------------------------------------------------
void VTKViewer_PolyDataMapper::RenderPiece( vtkRenderer* ren, vtkActor* act )
{
+ DBG_FUN();
bool isUsePointSprites = (this->MarkerEnabled && this->MarkerType != VTK::MT_NONE) ||
this->BallEnabled;
if( isUsePointSprites )
//-----------------------------------------------------------------------------
int VTKViewer_PolyDataMapper::Draw( vtkRenderer* ren, vtkActor* act )
{
+ DBG_FUN();
int noAbort = 1;
if( (!this->MarkerEnabled || this->MarkerType == VTK::MT_NONE || !this->ImageData.GetPointer()) && !this->BallEnabled)
return MAPPER_SUPERCLASS::Draw( ren, act );
#endif
void VTKViewer_PolyDataMapper::InternalDraw(vtkRenderer* ren, vtkActor* act ) {
+ DBG_FUN();
vtkUnsignedCharArray* colors = NULL;
vtkPolyData* input = this->GetInput();
vtkPoints* points;
#include <vtkXOpenGLRenderWindow.h>
#endif
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_RenderWindow"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!Constructor. Create render window with parant \a parent and name \a name.
*\param parent - parent window
*\param name - render window name.
VTKViewer_RenderWindow::VTKViewer_RenderWindow(QWidget* parent, const char* name) :
QWidget(parent, Qt::FramelessWindowHint )
{
+ DBG_FUN();
setObjectName( name );
setAttribute( Qt::WA_DeleteOnClose );
/*!Destructor.*/
VTKViewer_RenderWindow::~VTKViewer_RenderWindow()
{
+ DBG_FUN();
myRW->Delete();
}
/*!Resize render window.*/
void VTKViewer_RenderWindow::resizeEvent(QResizeEvent* /*theEvent*/)
{
+ DBG_FUN();
int aWidth = myRW->GetSize()[0], aHeight = myRW->GetSize()[1];
+ MSGEL("size = " << aWidth << " x " << aHeight);
if(vtkRenderWindowInteractor* aRWI = myRW->GetInteractor())
aRWI->UpdateSize(width(), height());
if(aWidth != width() || aHeight != height()){
/*!Reaction on change background color.*/
void VTKViewer_RenderWindow::onChangeBackgroundColor()
{
+ DBG_FUN();
//float red, green, blue;
double backint[3];
/*!Emit content menu requested.*/
void VTKViewer_RenderWindow::contextMenuEvent ( QContextMenuEvent * e )
{
+ DBG_FUN();
if ( e->reason() != QContextMenuEvent::Mouse )
emit contextMenuRequested( e );
}
#include <QKeyEvent>
#include <QContextMenuEvent>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_RenderWindowInteractor"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*! Create new instance of VTKViewer_RenderWindowInteractor*/
VTKViewer_RenderWindowInteractor* VTKViewer_RenderWindowInteractor::New()
{
+ DBG_FUNC();
vtkObject *ret = vtkObjectFactory::CreateInstance("VTKViewer_RenderWindowInteractor") ;
if( ret ) {
return dynamic_cast<VTKViewer_RenderWindowInteractor *>(ret) ;
/*!Constructor.*/
VTKViewer_RenderWindowInteractor::VTKViewer_RenderWindowInteractor()
{
+ DBG_FUN();
this->Enabled = 0 ;
this->mTimer = new QTimer( this ) ;
myDisplayMode = 0;
/*!Destructor.*/
VTKViewer_RenderWindowInteractor::~VTKViewer_RenderWindowInteractor()
{
+ DBG_FUN();
delete mTimer ;
if ( GetRenderWindow() ) {
*/
void VTKViewer_RenderWindowInteractor::Initialize()
{
+ DBG_FUN();
//
// We cannot do much unless there is a render window
// associated with this interactor.
/*!Sets view window and add to it selection actors.*/
void VTKViewer_RenderWindowInteractor::setViewWindow(VTKViewer_ViewWindow* theViewWnd){
+ DBG_FUN();
myViewWnd = theViewWnd;
if ( myViewWnd ) {
/*!Move selection actors to view window.*/
void VTKViewer_RenderWindowInteractor::MoveInternalActors()
{
+ DBG_FUN();
myViewWnd->MoveActor(myCellActor);
myViewWnd->MoveActor(myEdgeActor);
myViewWnd->MoveActor(myPointActor);
/*!Sets interactor style.*/
void VTKViewer_RenderWindowInteractor::SetInteractorStyle(vtkInteractorObserver *theInteractor){
+ DBG_FUN();
myInteractorStyle = dynamic_cast<VTKViewer_InteractorStyle*>(theInteractor);
vtkRenderWindowInteractor::SetInteractorStyle(theInteractor);
}
void VTKViewer_RenderWindowInteractor::SetSelectionProp(const double& theRed, const double& theGreen,
const double& theBlue, const int& theWidth)
{
+ DBG_FUN();
myCellActor->GetProperty()->SetColor(theRed, theGreen, theBlue);
myCellActor->GetProperty()->SetLineWidth(theWidth);
*/
void VTKViewer_RenderWindowInteractor::SetSelectionTolerance(const double& theTolNodes, const double& theTolItems)
{
+ DBG_FUN();
myTolNodes = theTolNodes;
myTolItems = theTolItems;
*/
void VTKViewer_RenderWindowInteractor::Enable()
{
+ DBG_FUN();
//
// Do not need to do anything if already enabled.
//
/*!See Enable().*/
void VTKViewer_RenderWindowInteractor::Disable()
{
+ DBG_FUN();
if( ! this->Enabled ) {
return ;
}
*/
void VTKViewer_RenderWindowInteractor::Start()
{
+ DBG_FUN();
//
// We do not allow this interactor to control the
// event loop. Only the QtApplication objects are
*If render window enabled.
*/
void VTKViewer_RenderWindowInteractor::LeftButtonReleased(const QMouseEvent *event) {
+ DBG_FUN();
if( ! this->Enabled ) {
return ;
}
*If render window enabled.
*/
void VTKViewer_RenderWindowInteractor::MiddleButtonReleased(const QMouseEvent *event) {
+ DBG_FUN();
if( ! this->Enabled ) {
return ;
}
*Emit context menu requested, if interactor style state equal VTK_INTERACTOR_STYLE_CAMERA_NONE.
*/
void VTKViewer_RenderWindowInteractor::RightButtonReleased(const QMouseEvent *event) {
+ DBG_FUN();
if( ! this->Enabled ) {
return ;
}
/*!Sets display mode.*/
void VTKViewer_RenderWindowInteractor::SetDisplayMode(int theMode) {
+ DBG_FUN();
if(theMode == 0)
ChangeRepresentationToWireframe();
else if (theMode == 1)
/*!Change all actors to wireframe*/
void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe()
{
+ DBG_FUN();
using namespace VTK;
ActorCollectionCopy aCopy(GetRenderer()->GetActors());
ChangeRepresentationToWireframe(aCopy.GetActors());
/*!Change all actors to surface*/
void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface()
{
+ DBG_FUN();
using namespace VTK;
ActorCollectionCopy aCopy(GetRenderer()->GetActors());
ChangeRepresentationToSurface(aCopy.GetActors());
/*!Change all actors to surface with edges*/
void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurfaceWithEdges()
{
+ DBG_FUN();
using namespace VTK;
ActorCollectionCopy aCopy(GetRenderer()->GetActors());
ChangeRepresentationToSurfaceWithEdges(aCopy.GetActors());
*/
void VTKViewer_RenderWindowInteractor::ChangeRepresentationToWireframe(vtkActorCollection* theCollection)
{
+ DBG_FUN();
using namespace VTK;
ForEach<VTKViewer_Actor>(theCollection,
TSetFunction<VTKViewer_Actor,int>
*/
void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurface(vtkActorCollection* theCollection)
{
+ DBG_FUN();
using namespace VTK;
ForEach<VTKViewer_Actor>(theCollection,
TSetFunction<VTKViewer_Actor,int>
*/
void VTKViewer_RenderWindowInteractor::ChangeRepresentationToSurfaceWithEdges(vtkActorCollection* theCollection)
{
+ DBG_FUN();
using namespace VTK;
ForEach<VTKViewer_Actor>(theCollection,
TSetFunction<VTKViewer_Actor,int>
/*!Do nothing*/
void VTKViewer_RenderWindowInteractor::EraseAll()
{
+ DBG_FUN();
}
/*!Display all actors.
*/
void VTKViewer_RenderWindowInteractor::DisplayAll()
{
+ DBG_FUN();
using namespace VTK;
ActorCollectionCopy aCopy(GetRenderer()->GetActors());
ForEach<VTKViewer_Actor>(aCopy.GetActors(),TSetVisibility<VTKViewer_Actor>(true));
/*!Do nothing*/
void VTKViewer_RenderWindowInteractor::Erase( VTKViewer_Actor* /*SActor*/, bool /*update*/)
{
+ DBG_FUN();
}
/*!Remove \a SActor from renderer and emit update window, if \a updateViewer - true*/
void VTKViewer_RenderWindowInteractor::Remove( VTKViewer_Actor* SActor, bool updateViewer )
{
+ DBG_FUN();
if ( SActor != 0 )
{
GetRenderer()->RemoveViewProp( SActor );
*/
void VTKViewer_RenderWindowInteractor::RemoveAll( const bool updateViewer )
{
+ DBG_FUN();
using namespace VTK;
vtkRenderer* aRenderer = GetRenderer();
ActorCollectionCopy aCopy(aRenderer->GetActors());
*/
void VTKViewer_RenderWindowInteractor::Display( VTKViewer_Actor* theActor, bool update)
{
+ DBG_FUN();
GetRenderer()->AddActor(theActor);
theActor->SetVisibility(true);
/*!Update all actors from renderer and emit render window modified.*/
void VTKViewer_RenderWindowInteractor::Update() {
+ DBG_FUN();
using namespace VTK;
vtkRenderer* aRen = GetRenderer();
ActorCollectionCopy aCopy(aRen->GetActors());
VTKViewer_Actor * theActor,
TUpdateActor theFun)
{
+ DBG_FUN();
(*theFun)(theMapIndex,theMapActor,theActor);
double aPos[3];
theMapActor->GetPosition(aPos);
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_Utilities"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!@see vtkRenderer::ResetCamera(double bounds[6]) method*/
void
ResetCamera(vtkRenderer* theRenderer,
int theUsingZeroFocalPoint)
-{
+{
+ DBG_FUNC();
if(!theRenderer)
return;
ComputeVisiblePropBounds(vtkRenderer* theRenderer,
double theBounds[6])
{
+ DBG_FUNC();
VTK::ActorCollectionCopy aCopy(theRenderer->GetActors());
vtkActorCollection* aCollection = aCopy.GetActors();
return ComputeBounds( aCollection, theBounds );
int
ComputeBounds(vtkActorCollection* theCollection, double theBounds[6])
{
+ DBG_FUNC();
int aCount = 0;
theBounds[0] = theBounds[2] = theBounds[4] = VTK_FLOAT_MAX;
void
ResetCameraClippingRange(vtkRenderer* theRenderer)
{
+ DBG_FUNC();
if(!theRenderer || !theRenderer->VisibleActorCount()) return;
vtkCamera* anActiveCamera = theRenderer->GetActiveCamera();
const double theSize,
const double theSizeInPercents )
{
+ DBG_FUNC();
// calculating diagonal of visible props of the renderer
double bnd[ 6 ];
if ( ComputeVisiblePropBounds( theRenderer, bnd ) == 0 )
bool IsBBEmpty(vtkRenderer* theRenderer)
{
+ DBG_FUNC();
if(!theRenderer)
return false;
bool ComputeBBCenter(vtkRenderer* theRenderer, double theCenter[3])
{
+ //DBG_FUNC();
+ MSGEL("...ComputeBBCenter()");
theCenter[0] = theCenter[1] = theCenter[2] = 0.0;
if(!theRenderer)
#include "VTKViewer_ViewManager.h"
#include "VTKViewer_ViewModel.h"
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_ViewManager"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*!Constructor.Initialize SIUT_ViewManager by \a study and \a theDesktop.
* Create new instance of VTKViewer_Viewer and set view model by it.
*/
VTKViewer_ViewManager::VTKViewer_ViewManager( SUIT_Study* study, SUIT_Desktop* theDesktop )
: SUIT_ViewManager( study, theDesktop, new VTKViewer_Viewer() )
{
+ DBG_FUN();
setTitle( tr( "VTK_VIEW_TITLE" ) );
}
/*!Destructor.*/
VTKViewer_ViewManager::~VTKViewer_ViewManager()
{
+ DBG_FUN();
/*!Do nothing.*/
}
#include <QMouseEvent>
#include <QToolBar>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_Viewer"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
// VSR: Uncomment below line to allow texture background support in VTK viewer
#define VTK_ENABLE_TEXTURED_BACKGROUND
bool _InitializeVtkWarningsCall()
{
+ DBG_FUNC();
char* isOn = getenv( "VTK_WARNINGS_IS_ON" );
if ( !isOn || strcmp( isOn, "1" ) )
vtkObject::GlobalWarningDisplayOff();
: SUIT_ViewModel(),
myDefaultBackground( Qtx::BackgroundData( Qt::black ) )
{
+ DBG_FUN();
}
/*!Destructor.*/
VTKViewer_Viewer::~VTKViewer_Viewer()
{
+ DBG_FUN();
}
/*! Get data for supported background modes: gradient types, identifiers and supported image formats */
QString VTKViewer_Viewer::backgroundData( QStringList& gradList, QIntList& idList, QIntList& txtList )
{
+ DBG_FUNC();
gradList << tr( "GT_HORIZONTALGRADIENT" )
<< tr( "GT_VERTICALGRADIENT" )
<< tr( "GT_FIRSTDIAGONALGRADIENT" )
/*!Sets background color [obsolete]*/
void VTKViewer_Viewer::setBackgroundColor( const QColor& c )
{
+ DBG_FUN();
Qtx::BackgroundData bg = background();
bg.setColor( c );
setBackground( bg );
/*!Sets default background data.*/
void VTKViewer_Viewer::setBackground( const Qtx::BackgroundData& theBackground )
{
+ DBG_FUN();
myDefaultBackground = theBackground.isValid() ? theBackground : Qtx::BackgroundData( Qt::black );
}
/*!Create new instance of VTKViewer_ViewWindow, sets background color and return pointer to it.*/
SUIT_ViewWindow* VTKViewer_Viewer::createView( SUIT_Desktop* theDesktop )
{
+ DBG_FUN();
VTKViewer_ViewWindow* vw = new VTKViewer_ViewWindow( theDesktop, this );
vw->setBackground( myDefaultBackground );
return vw;
/*!Sets view manager and connect slots.*/
void VTKViewer_Viewer::setViewManager(SUIT_ViewManager* theViewManager)
{
+ DBG_FUN();
SUIT_ViewModel::setViewManager(theViewManager);
connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)),
this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
/*!Insert context into popup menu.*/
void VTKViewer_Viewer::contextMenuPopup(QMenu* thePopup)
{
+ DBG_FUN();
thePopup->addAction( tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
thePopup->addAction( tr( "MEN_CHANGE_BACKGROUND" ), this, SLOT( onChangeBackground() ) );
/*!Sets flag to enable selection \a isEnable.*/
void VTKViewer_Viewer::enableSelection(bool isEnabled)
{
+ DBG_FUN();
+ ARG(isEnabled);
mySelectionEnabled = isEnabled;
//!! To be done for view windows
}
/*!Sets flag to multi selection enable \a isEnable.*/
void VTKViewer_Viewer::enableMultiselection(bool isEnable)
{
+ DBG_FUN();
+ ARG(isEnable);
myMultiSelectionEnabled = isEnable;
//!! To be done for view windows
}
/*!On change back ground color event.*/
void VTKViewer_Viewer::onChangeBackground()
{
+ DBG_FUN();
VTKViewer_ViewWindow* aView = (VTKViewer_ViewWindow*)(myViewManager->getActiveView());
if ( !aView )
return;
/*!On show tool bar event.*/
void VTKViewer_Viewer::onShowToolbar() {
+ DBG_FUN();
VTKViewer_ViewWindow* aView = (VTKViewer_ViewWindow*)(myViewManager->getActiveView());
if ( aView )
aView->getToolBar()->show();
#include <QtxToolBar.h>
#include <QtxMultiAction.h>
+//---------------------------------------------------------
+#define USE_DEBUG
+#define MBCLASSNAME "VTKViewer_ViewWindow"
+#include "MBDebug.h"
+//---------------------------------------------------------
+
/*! Construction*/
VTKViewer_ViewWindow::VTKViewer_ViewWindow( SUIT_Desktop* theDesktop,
VTKViewer_Viewer* theModel,
VTKViewer_RenderWindowInteractor* rw )
: SUIT_ViewWindow( theDesktop )
{
+ DBG_FUN();
+
myModel = theModel;
myTrihedron = VTKViewer_Trihedron::New();
/*!Destructor.*/
VTKViewer_ViewWindow::~VTKViewer_ViewWindow()
{
+ DBG_FUN();
myTransform->Delete();
// In order to ensure that the interactor unregisters
// this RenderWindow, we assign a NULL RenderWindow to
/*!Activates 'fit area' transformation*/
void VTKViewer_ViewWindow::activateWindowFit()
{
+ DBG_FUN();
myRWInteractor->GetInteractorStyle()->startFitArea();
}
/*!Create actions:*/
void VTKViewer_ViewWindow::createActions()
{
+ DBG_FUN();
if (!myActionsMap.isEmpty()) return;
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
/*!Create tool bar.*/
void VTKViewer_ViewWindow::createToolBar()
{
+ DBG_FUN();
myToolBar->addAction( myActionsMap[DumpId] );
myToolBar->addAction( myActionsMap[TrihedronShowId] );
/*!On front view event.*/
void VTKViewer_ViewWindow::onFrontView()
{
+ DBG_FUN();
vtkCamera* camera = myRenderer->GetActiveCamera();
camera->SetPosition(1,0,0);
camera->SetViewUp(0,0,1);
/*!On back view slot.*/
void VTKViewer_ViewWindow::onBackView()
{
+ DBG_FUN();
vtkCamera* camera = myRenderer->GetActiveCamera();
camera->SetPosition(-1,0,0);
camera->SetViewUp(0,0,1);
/*!On back view slot.*/
void VTKViewer_ViewWindow::onTopView()
{
+ DBG_FUN();
vtkCamera* camera = myRenderer->GetActiveCamera();
camera->SetPosition(0,0,1);
camera->SetViewUp(0,1,0);
/*!On bottom view slot.*/
void VTKViewer_ViewWindow::onBottomView()
{
+ DBG_FUN();
vtkCamera* camera = myRenderer->GetActiveCamera();
camera->SetPosition(0,0,-1);
camera->SetViewUp(0,1,0);
/*!On left view slot.*/
void VTKViewer_ViewWindow::onLeftView()
{
+ DBG_FUN();
vtkCamera* camera = myRenderer->GetActiveCamera();
camera->SetPosition(0,-1,0);
camera->SetViewUp(0,0,1);
/*!On right view slot.*/
void VTKViewer_ViewWindow::onRightView()
{
+ DBG_FUN();
vtkCamera* camera = myRenderer->GetActiveCamera();
camera->SetPosition(0,1,0);
camera->SetViewUp(0,0,1);
*/
void VTKViewer_ViewWindow::onClockWiseView()
{
+ DBG_FUN();
vtkCamera* aCamera = myRenderer->GetActiveCamera();
aCamera->Roll(-90);
aCamera->OrthogonalizeViewUp();
*/
void VTKViewer_ViewWindow::onAntiClockWiseView()
{
+ DBG_FUN();
vtkCamera* aCamera = myRenderer->GetActiveCamera();
aCamera->Roll(90);
aCamera->OrthogonalizeViewUp();
/*!On reset view slot.*/
void VTKViewer_ViewWindow::onResetView()
{
+ DBG_FUN();
int aTriedronIsVisible = isTrihedronDisplayed();
myTrihedron->SetVisibility( VTKViewer_Trihedron::eOnlyLineOn );
::ResetCamera(myRenderer,true);
/*!On fit all slot.*/
void VTKViewer_ViewWindow::onFitAll()
{
+ DBG_FUN();
myRWInteractor->GetInteractorStyle()->ViewFitAll();
Repaint();
}
/*!On fit selection slot.*/
void VTKViewer_ViewWindow::onFitSelection()
{
+ DBG_FUN();
myRWInteractor->GetInteractorStyle()->ViewFitSelection();
Repaint();
}
/*!Set background color of the viewport [obsolete]*/
void VTKViewer_ViewWindow::setBackgroundColor( const QColor& c )
{
+ DBG_FUN();
Qtx::BackgroundData bg = background();
bg.setColor( c );
setBackground( bg );
/*!Set background of the viewport*/
void VTKViewer_ViewWindow::setBackground( const Qtx::BackgroundData& bgData )
{
+ DBG_FUN();
bool ok = false;
if ( bgData.isValid() ) {
*Move Internal actors, if \a theMoveInternalActors is true.
*/
void VTKViewer_ViewWindow::InsertActor( VTKViewer_Actor* theActor, bool theMoveInternalActors ){
+ DBG_FUN();
theActor->AddToRender(myRenderer);
theActor->SetTransform(myTransform);
if(theMoveInternalActors)
*@see InsertActor( VTKViewer_Actor* theActor, bool theMoveInternalActors )
*/
void VTKViewer_ViewWindow::AddActor( VTKViewer_Actor* theActor, bool theUpdate /*=false*/ ){
+ DBG_FUN();
InsertActor(theActor);
if(theUpdate)
Repaint();
/*!Remove \a theActor from renderer and pepaint, if \a theUpdate is true.*/
void VTKViewer_ViewWindow::RemoveActor( VTKViewer_Actor* theActor, bool theUpdate /*=false*/ ){
+ DBG_FUN();
theActor->RemoveFromRender(myRenderer);
if(theUpdate)
Repaint();
/*!@see RemoveActor() and InsertActor().*/
void VTKViewer_ViewWindow::MoveActor( VTKViewer_Actor* theActor)
{
+ DBG_FUN();
RemoveActor(theActor);
InsertActor(theActor,true);
}
/*!On trihedron show slot.*/
void VTKViewer_ViewWindow::onTrihedronShow()
{
+ DBG_FUN();
if (isTrihedronDisplayed())
myTrihedron->VisibilityOff();
else
*/
void VTKViewer_ViewWindow::setVisualParameters( const QString& parameters )
{
+ DBG_FUN();
QStringList paramsLst = parameters.split( '*' );
if ( paramsLst.size() == 13 ) {
double pos[3], focalPnt[3], viewUp[3], parScale, scale[3];