#include <QStatusBar>
#include <QCursor>
-//#define _DEVDEBUG_
+#define _DEVDEBUG_
#include "HYDRO_trace.hxx"
static int ViewManagerId = 0;
// Remove defunct view managers from the map.
// It's essential to do this before "update( UF_All )" call!
- QList<int> anObsoleteIds;
+ QList<size_t> 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();
+ size_t anId = anIter.next().key();
const ViewManagerInfo& anInfo = anIter.value();
aHydroViewManagers << anInfo.first;
anObsoleteIds << anId;
}
}
- foreach ( const int anId, anObsoleteIds ) {
+ foreach ( const size_t anId, anObsoleteIds ) {
myViewManagerMap.remove( anId );
myObjectStateMap.remove( anId );
myShapesMap.remove( anId );
}
}
-bool HYDROGUI_Module::isObjectVisible( const int theViewId,
+bool HYDROGUI_Module::isObjectVisible( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject ) const
{
if( theObject.IsNull() )
return false;
- if( theViewId < 0 )
+ if( theViewId == 0 )
{
//search in all
- foreach( int aViewId, myObjectStateMap.keys() )
+ foreach( size_t aViewId, myObjectStateMap.keys() )
{
if( isObjectVisible( aViewId, theObject ) )
return true;
return false;
}
-void HYDROGUI_Module::setObjectVisible( const int theViewId,
+void HYDROGUI_Module::setObjectVisible( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject,
const bool theState )
{
+ DEBTRACE("setObjectVisible, theViewId: " << theViewId);
if( !theObject.IsNull() )
{
- Entry2ObjectStateMap& aEntry2ObjectStateMap = myObjectStateMap[ theViewId ];
- QString anEntry = HYDROGUI_DataObject::dataObjectEntry( theObject );
+ DEBTRACE("myObjectStateMap.size: " << myObjectStateMap.size());
+ QString anEntry = HYDROGUI_DataObject::dataObjectEntry( theObject );
+ DEBTRACE("anEntry: " << anEntry.toStdString());
+ if (myObjectStateMap.find(theViewId) == myObjectStateMap.end())
+ {
+ DEBTRACE("theViewId is not a valid key for myObjectStateMap, created");
+ }
+ Entry2ObjectStateMap& aEntry2ObjectStateMap = myObjectStateMap[ theViewId ]; // created OK if it does not exist
ObjectState& anObjectState = aEntry2ObjectStateMap[ anEntry ];
anObjectState.Visibility = theState;
};
typedef QPair< SUIT_ViewManager*, ViewManagerRole > ViewManagerInfo;
- typedef QMap < int, ViewManagerInfo > ViewManagerMap;
- typedef QMapIterator< int, ViewManagerInfo > ViewManagerMapIterator;
+ typedef QMap < size_t, ViewManagerInfo > ViewManagerMap;
+ typedef QMapIterator< size_t, ViewManagerInfo > ViewManagerMapIterator;
struct ObjectState
{
ObjectState() : Visibility( false ), Transparency( 1.0 ), ZValue( 0.0 ) {}
};
typedef QMap< QString, ObjectState > Entry2ObjectStateMap;
- typedef QMap< int, Entry2ObjectStateMap > ViewId2Entry2ObjectStateMap;
+ typedef QMap< size_t, Entry2ObjectStateMap > ViewId2Entry2ObjectStateMap;
typedef QList<HYDROGUI_Shape*> ListOfShapes;
typedef QMap<int,ListOfShapes> ViewId2ListOfShapes;
void setViewManagerRole( SUIT_ViewManager* theViewManager,
const ViewManagerRole theRole );
- bool isObjectVisible( const int theViewId,
+ bool isObjectVisible( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject ) const;
- void setObjectVisible( const int theViewId,
+ void setObjectVisible( const size_t theViewId,
const Handle(HYDROData_Entity)& theObject,
const bool theState );