#include <QTextStream>
#include <QColor>
+//#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Document,MMgt_TShared)
#define PYTHON_DOC_NAME "hydro_doc"
Handle(HYDROData_Document) aResult =
HYDROData_Application::GetApplication()->GetDocument();
if (aResult.IsNull()) {
+ DEBTRACE("new HYDROData_Document");
aResult = new HYDROData_Document();
HYDROData_Application::GetApplication()->AddDocument(aResult);
}
Data_DocError HYDROData_Document::Load(const char* theFileName)
{
+ DEBTRACE("Load");
Handle(TDocStd_Document) aResult;
TCollection_ExtendedString aPath ((const Standard_CString)theFileName);
PCDM_ReaderStatus aStatus = (PCDM_ReaderStatus) -1;
Data_DocError HYDROData_Document::Save(const char* theFileName)
{
+ DEBTRACE("Save");
TCollection_ExtendedString aPath ((const Standard_CString)theFileName);
PCDM_StoreStatus aStatus;
try {
void HYDROData_Document::Close()
{
+ DEBTRACE("Close");
myDoc->Close();
HYDROData_Application::GetApplication()->RemoveDocument(this);
}
bool HYDROData_Document::DumpToPython( const QString& thePyScriptPath,
const bool theIsMultiFile ) const
{
+ DEBTRACE("DumpToPython");
// Try to open the file
QFile aFile( thePyScriptPath );
if ( !aFile.open( QIODevice::WriteOnly | QFile::Text ) )
MapOfTreatedObjects& theTreatedObjects,
const bool theIsMultiFile ) const
{
+ DEBTRACE("DumpToPython");
QString aDocName = GetDocPyName();
// Append document in to the map of treated objects to prevent names overlaping
MapOfTreatedObjects& theTreatedObjects,
const ObjectKind& theObjectKind ) const
{
+ DEBTRACE("dumpPartitionToPython");
if ( !theFile.isOpen() )
return false;
HYDROData_Document::HYDROData_Document()
{
+ DEBTRACE("HYDROData_Document");
HYDROData_Application::GetApplication()->NewDocument("BinOcaf", myDoc);
myDoc->SetUndoLimit(UNDO_LIMIT);
NewID(); // needed to have at least one attribute in initial document to avoid errors
HYDROData_Document::HYDROData_Document(const Handle(TDocStd_Document)& theDoc)
{
+ DEBTRACE("HYDROData_Document");
myDoc = theDoc;
myTransactionsAfterSave = 0;
myLX = -1;
HYDROData_Document::~HYDROData_Document()
{
+ DEBTRACE("~HYDROData_Document");
}
int HYDROData_Document::NewID()
#include <HYDROData_ShapesGroup.h>
#endif
+//#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
static HYDROData_SequenceOfObjects myCopyingObjects;
const int ENTRY_COLUMN = 2;
HYDROGUI_DataModel::HYDROGUI_DataModel( CAM_Module* theModule )
-: LightApp_DataModel( theModule )
+: LightApp_DataModel( theModule ), myIsAboutToClose(false)
{
+ DEBTRACE("HYDROGUI_DataModel");
update( module()->application()->activeStudy()->id() );
}
HYDROGUI_DataModel::~HYDROGUI_DataModel()
{
+ DEBTRACE("~HYDROGUI_DataModel");
}
bool HYDROGUI_DataModel::create( CAM_Study* theStudy )
{
+ DEBTRACE("create");
bool status = LightApp_DataModel::create( theStudy );
if ( status )
updateDocument();
CAM_Study* theStudy,
QStringList theFileList )
{
+ DEBTRACE("open");
LightApp_DataModel::open( theURL, theStudy, theFileList );
const int aStudyId = theStudy->id();
bool HYDROGUI_DataModel::save( QStringList& theFileList )
{
+ DEBTRACE("save");
if( !module()->application()->activeStudy() )
return false;
CAM_Study*,
QStringList& theFileList )
{
+ DEBTRACE("saveAs");
myStudyURL = theURL;
return save( theFileList );
}
bool HYDROGUI_DataModel::close()
{
+ DEBTRACE("close");
+ myIsAboutToClose = true;
HYDROGUI_Module* aModule = dynamic_cast<HYDROGUI_Module*>( module() );
if ( aModule )
aModule->clearCache();
return true;
}
+bool HYDROGUI_DataModel::isAboutToClose()
+{
+ DEBTRACE("isAboutToClose " << myIsAboutToClose);
+ return myIsAboutToClose;
+}
+
bool HYDROGUI_DataModel::dumpPython( const QString& theURL,
CAM_Study* theStudy,
bool isMultiFile,
QStringList& theListOfFiles )
{
+ DEBTRACE("dumpPython");
LightApp_DataModel::dumpPython( theURL, theStudy, isMultiFile, theListOfFiles );
int aStudyId = theStudy->id();
void HYDROGUI_DataModel::update( const int theStudyId )
{
+ DEBTRACE("update");
LightApp_Application* anApp = dynamic_cast<LightApp_Application*>( module()->application() );
if( !anApp )
return;
void HYDROGUI_DataModel::updateModel()
{
+ DEBTRACE("updateModel");
HYDROGUI_Module* aModule = dynamic_cast<HYDROGUI_Module*>( module() );
if( aModule )
update( aModule->getStudyId() );
void HYDROGUI_DataModel::updateDocument()
{
+ DEBTRACE("updateDocument");
// Sets the default strickler coefficient from preferences to document.
Handle(HYDROData_Document) aDoc = getDocument();
SUIT_ResourceMgr* resMgr = module()->application()->resourceMgr();
#include <QStatusBar>
#include <QCursor>
+//#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
static int ViewManagerId = 0;
extern "C" HYDRO_EXPORT CAM_Module* createModule()
myIsUpdateEnabled( true ),
myOverview( 0 )
{
+ DEBTRACE("HYDROGUI_Module::HYDROGUI_Module()");
}
HYDROGUI_Module::~HYDROGUI_Module()
{
+ DEBTRACE("HYDROGUI_Module::~HYDROGUI_Module()");
}
int HYDROGUI_Module::getStudyId() const
{
+ DEBTRACE("HYDROGUI_Module::getStudyId()");
LightApp_Application* anApp = getApp();
return anApp ? anApp->activeStudy()->id() : 0;
}
void HYDROGUI_Module::initialize( CAM_Application* theApp )
{
+ DEBTRACE("HYDROGUI_Module::initialize");
LightApp_Module::initialize( theApp );
createActions();
bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
{
+ DEBTRACE("HYDROGUI_Module::activateModule");
bool aRes = LightApp_Module::activateModule( theStudy );
LightApp_Application* anApp = getApp();
bool HYDROGUI_Module::deactivateModule( SUIT_Study* theStudy )
{
+ DEBTRACE("HYDROGUI_Module::deactivateModule");
/* Issues ## 68, 88.
ViewManagerMapIterator anIter( myViewManagerMap );
while( anIter.hasNext() )
myViewManagerMap.clear();
- return LightApp_Module::deactivateModule( theStudy );
+ bool ret = LightApp_Module::deactivateModule( theStudy );
+ HYDROGUI_DataModel* aModel = getDataModel();
+ if (aModel->isAboutToClose())
+ {
+ Handle(HYDROData_Document) aDoc = HYDROData_Document::Document();
+ if (!aDoc.IsNull())
+ aDoc->Close();
+ }
+ return ret;
}
void HYDROGUI_Module::windows( QMap<int, int>& theMap ) const
{
+ DEBTRACE("HYDROGUI_Module::windows");
static bool inWindows = false;
if( inWindows )
return;
void HYDROGUI_Module::viewManagers( QStringList& theTypesList ) const
{
+ DEBTRACE("HYDROGUI_Module::viewManagers");
theTypesList << GraphicsView_Viewer::Type() << OCCViewer_Viewer::Type();
}
void HYDROGUI_Module::createPreferences()
{
+ DEBTRACE("HYDROGUI_Module::createPreferences");
int genTab = addPreference( tr( "PREF_TAB_GENERAL" ) );
int CursorGroup = addPreference( tr( "PREF_GROUP_CURSOR" ), genTab );
void HYDROGUI_Module::preferencesChanged( const QString& theSection, const QString& thePref )
{
+ DEBTRACE("HYDROGUI_Module::preferencesChanged");
SUIT_ResourceMgr* resMgr = application()->resourceMgr();
if ( theSection == "preferences" && thePref == "default_strickler_coefficient" )
{
void HYDROGUI_Module::update( const int flags )
{
+ DEBTRACE("HYDROGUI_Module::update");
if ( !isUpdateEnabled() )
return;
void HYDROGUI_Module::updateCommandsStatus()
{
+ DEBTRACE("HYDROGUI_Module::updateCommandsStatus");
LightApp_Module::updateCommandsStatus();
updateUndoRedoControls();
HYDROGUI_DataModel* HYDROGUI_Module::getDataModel() const
{
+ //DEBTRACE("HYDROGUI_Module::getDataModel()");
return (HYDROGUI_DataModel*)dataModel();
}
HYDROGUI_Displayer* HYDROGUI_Module::getDisplayer() const
{
+ //DEBTRACE("HYDROGUI_Module::getDisplayer()");
return myDisplayer;
}
HYDROGUI_OCCDisplayer* HYDROGUI_Module::getOCCDisplayer() const
{
+ DEBTRACE("HYDROGUI_Module::getOCCDisplayer");
return myOCCDisplayer;
}
HYDROGUI_VTKPrsDisplayer* HYDROGUI_Module::getVTKDisplayer() const
{
+ DEBTRACE("HYDROGUI_Module::getVTKDisplayer");
return myVTKDisplayer;
}
SUIT_ViewManager* HYDROGUI_Module::getViewManager( const int theId ) const
{
+ DEBTRACE("HYDROGUI_Module::getViewManager");
if( myViewManagerMap.contains( theId ) )
{
return myViewManagerMap[ theId ].first;
GraphicsView_Viewer* HYDROGUI_Module::getViewer( const int theId ) const
{
+ DEBTRACE("HYDROGUI_Module::getViewer");
if( myViewManagerMap.contains( theId ) )
{
ViewManagerInfo anInfo = myViewManagerMap[ theId ];
OCCViewer_Viewer* HYDROGUI_Module::getOCCViewer( const int theId ) const
{
+ DEBTRACE("HYDROGUI_Module::getOCCViewer");
if( myViewManagerMap.contains( theId ) )
{
ViewManagerInfo anInfo = myViewManagerMap[ theId ];
SVTK_Viewer* HYDROGUI_Module::getVTKViewer( const int theId ) const
{
+ DEBTRACE("HYDROGUI_Module::getVTKViewer");
if( myViewManagerMap.contains( theId ) )
{
ViewManagerInfo anInfo = myViewManagerMap[ theId ];
int HYDROGUI_Module::getViewManagerId( SUIT_ViewManager* theViewManager )
{
+ DEBTRACE("HYDROGUI_Module::getViewManagerId");
ViewManagerMapIterator anIter( myViewManagerMap );
while( anIter.hasNext() )
{
HYDROGUI_Module::ViewManagerRole HYDROGUI_Module::getViewManagerRole( SUIT_ViewManager* theViewManager )
{
+ DEBTRACE("HYDROGUI_Module::getViewManagerRole");
int anId = getViewManagerId( theViewManager );
if( anId != -1 )
{
void HYDROGUI_Module::setViewManagerRole( SUIT_ViewManager* theViewManager,
const ViewManagerRole theRole )
{
+ DEBTRACE("HYDROGUI_Module::setViewManagerRole");
int anId = getViewManagerId( theViewManager );
if( anId != -1 )
{
void HYDROGUI_Module::setIsToUpdate( const Handle(HYDROData_Entity)& theObject,
const bool theState )
{
+ DEBTRACE("HYDROGUI_Module::setIsToUpdate");
if( !theObject.IsNull() )
{
// Process OCC shapes
void HYDROGUI_Module::clearCache()
{
+ DEBTRACE("HYDROGUI_Module::clearCache");
myObjectStateMap.clear();
}
CAM_DataModel* HYDROGUI_Module::createDataModel()
{
+ DEBTRACE("HYDROGUI_Module::createDataModel");
return new HYDROGUI_DataModel( this );
}
void HYDROGUI_Module::onViewManagerAdded( SUIT_ViewManager* theViewManager )
{
+ DEBTRACE("HYDROGUI_Module::onViewManagerAdded");
LightApp_Module::onViewManagerAdded( theViewManager );
if( theViewManager->getType() == GraphicsView_Viewer::Type() )
void HYDROGUI_Module::onViewManagerRemoved( SUIT_ViewManager* theViewManager )
{
+ DEBTRACE("HYDROGUI_Module::onViewManagerRemoved");
LightApp_Module::onViewManagerRemoved( theViewManager );
createSelector( theViewManager ); // replace the default selector
void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theViewWindow )
{
+ DEBTRACE("HYDROGUI_Module::onViewCreated");
if( theViewWindow && theViewWindow->inherits( "GraphicsView_ViewFrame" ) )
{
if( GraphicsView_ViewFrame* aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>( theViewWindow ) )
const bool theIsForced,
const bool theDoFitAll )
{
+ DEBTRACE("HYDROGUI_Module::updateViewer");
QList<int> aViewManagerIdList;
// currently, all views are updated
void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager )
{
+ DEBTRACE("HYDROGUI_Module::createSelector");
if( !theViewManager )
return;
bool HYDROGUI_Module::setUpdateEnabled( const bool theState )
{
+ DEBTRACE("HYDROGUI_Module::setUpdateEnabled");
bool aPrevState = myIsUpdateEnabled;
myIsUpdateEnabled = theState;
return aPrevState;
QStringList HYDROGUI_Module::storeSelection() const
{
+ DEBTRACE("HYDROGUI_Module::storeSelection");
QStringList anEntryList;
if( LightApp_SelectionMgr* aSelectionMgr = getApp()->selectionMgr() )
{
void HYDROGUI_Module::restoreSelection( const QStringList& theEntryList )
{
+ DEBTRACE("HYDROGUI_Module::restoreSelection");
if( LightApp_SelectionMgr* aSelectionMgr = getApp()->selectionMgr() )
{
SUIT_DataOwnerPtrList aList( true );
*/
QStack<HYDROGUI_Operation*>& HYDROGUI_Module::getActiveOperations()
{
+ DEBTRACE("HYDROGUI_Module::getActiveOperations");
return myActiveOperationMap;
}
void HYDROGUI_Module::onViewActivated( SUIT_ViewManager* theMgr )
{
+ DEBTRACE("HYDROGUI_Module::onViewActivated");
if( !theMgr )
return;