HYDROGUI_Tool::WindowDock( anApp->getWindow( LightApp_Application::WT_LogWindow ) ) );
#endif
+ // Remove defunct view managers from the map.
+ // It's essential to do this before "update( UF_All )" call!
+ QList<int> anObsoleteIds;
+ ViewManagerList anAllViewManagers = anApp->viewManagers();
+ ViewManagerList aHydroViewManagers; // view managers created inside the HYDRO module
+ ViewManagerMapIterator anIter( myViewManagerMap );
+ while( anIter.hasNext() ) {
+ int anId = anIter.next().key();
+ const ViewManagerInfo& anInfo = anIter.value();
+
+ aHydroViewManagers << anInfo.first;
+
+ if ( !anAllViewManagers.contains( anInfo.first ) ) {
+ anObsoleteIds << anId;
+ }
+ }
+ foreach ( const int anId, anObsoleteIds ) {
+ myViewManagerMap.remove( anId );
+ myObjectStateMap.remove( anId );
+ myShapesMap.remove( anId );
+ myVTKPrsMap.remove( anId );
+ }
+ // Replace the default selector for all view managers.
+ // Add view managers created outside of HYDRO module to the map.
+ foreach ( SUIT_ViewManager* aViewManager, anAllViewManagers ) {
+ createSelector( aViewManager ); // replace the default selector
+ if ( !aHydroViewManagers.contains( aViewManager ) ) {
+ ViewManagerInfo anInfo( aViewManager, VMR_General );
+ myViewManagerMap.insert( ViewManagerId++, anInfo );
+ }
+ }
+
update( UF_All );
updateCommandsStatus();
bool HYDROGUI_Module::deactivateModule( SUIT_Study* theStudy )
{
+ /* Issues ## 68, 88.
ViewManagerMapIterator anIter( myViewManagerMap );
while( anIter.hasNext() )
if( SUIT_ViewManager* aViewManager = anIter.next().value().first )
getApp()->removeViewManager( aViewManager );
myViewManagerMap.clear();
+ */
ViewManagerList anOCCViewManagers;
getApp()->viewManagers( OCCViewer_Viewer::Type(), anOCCViewManagers );
this, SLOT( onMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
}
+ /* Issues ## 68, 88.
myObjectStateMap.clear();
myShapesMap.clear();
myVTKPrsMap.clear();
+ */
// clear the data model's list of copying objects
HYDROGUI_DataModel::changeCopyingObjects( HYDROData_SequenceOfObjects() );
void HYDROGUI_Module::viewManagers( QStringList& theTypesList ) const
{
- theTypesList << OCCViewer_Viewer::Type() << GraphicsView_Viewer::Type();
+ theTypesList << GraphicsView_Viewer::Type() << OCCViewer_Viewer::Type();
}
void HYDROGUI_Module::contextMenuPopup( const QString& theClient,
bool anIsGeomObject = false;
// check the selected GEOM objects
- if ( !HYDROGUI_Tool::GetSelectedGeomObjects( this ).isEmpty() ) {
+ if ( anIsObjectBrowser && !HYDROGUI_Tool::GetSelectedGeomObjects( this ).isEmpty() ) {
theMenu->addAction( action( ImportGeomObjectId ) );
theMenu->addSeparator();
}