]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
bug on display (bathy, selection...) seems fixed !
authorPaul RASCLE <paul.rascle@openfields.fr>
Sat, 5 Sep 2020 22:47:21 +0000 (00:47 +0200)
committerYOANN AUDOUIN <B61570@dsp0851742.postes.calibre.edf.fr>
Fri, 30 Oct 2020 16:06:23 +0000 (17:06 +0100)
src/HYDROGUI/HYDROGUI_DataModel.cxx
src/HYDROGUI/HYDROGUI_LandCoverMapOp.cxx
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Module.h
src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx

index 38c283fc6c7e3d4adc167adb46a73574a1223de3..90f5aee873c499cb0603423aca3984b06f09ee56 100644 (file)
@@ -1383,7 +1383,7 @@ void HYDROGUI_DataModel::setObjectVisibilityState( Handle(HYDROData_Entity) theM
   if ( treeModel )
   {
     HYDROGUI_Module* aModule = dynamic_cast<HYDROGUI_Module*>( module() );
-    bool isVisible = aModule->isObjectVisible( -1, theModelObject );
+    bool isVisible = aModule->isObjectVisible( 0, theModelObject );
     Qtx::VisibilityState aVisState = isVisible ? Qtx::ShownState : Qtx::HiddenState;
     treeModel->setVisibilityState( theObject->text( theObject->customData( Qtx::IdType ).toInt() ), aVisState, false );
   }
index 5c982205e6deb6245d7851bb347080f1ca7ce0fc..7ef2e0a8604bfef7baa56a10d7a64f72bc9eecf8 100644 (file)
@@ -458,7 +458,7 @@ void HYDROGUI_LandCoverMapOp::onPolylineFaceChanged()
             myPolylineFacePreviewPrs = 0;
           }
 
-          int aViewerId = (size_t)aViewer;
+          size_t aViewerId = (size_t)aViewer;
           if ( !module()->isObjectVisible( aViewerId, aPolylineFace ) )
           {
             Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
index 96823ea6d5b52fd73398bf46758f7f2fe4511c25..7cee9227fb0d3fa3b6c356b5147ab4f3e8672ec7 100755 (executable)
 #include <QStatusBar>
 #include <QCursor>
 
-//#define _DEVDEBUG_
+#define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 
 static int ViewManagerId = 0;
@@ -208,12 +208,12 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
 
   // 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;
@@ -222,7 +222,7 @@ bool HYDROGUI_Module::activateModule( SUIT_Study* theStudy )
       anObsoleteIds << anId;
     }
   }
-  foreach ( const int anId, anObsoleteIds ) {
+  foreach ( const size_t anId, anObsoleteIds ) {
     myViewManagerMap.remove( anId );
     myObjectStateMap.remove( anId );
     myShapesMap.remove( anId );
@@ -1275,16 +1275,16 @@ void HYDROGUI_Module::setViewManagerRole( SUIT_ViewManager* theViewManager,
   }
 }
 
-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;
@@ -1308,14 +1308,21 @@ bool HYDROGUI_Module::isObjectVisible( const int theViewId,
   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;
index e39ca9566af4bf1b9c4a44a169273e764e8f8042..a8daaaa2e1606796fa7baa1dadbe886311967f5c 100644 (file)
@@ -102,8 +102,8 @@ public:
   };
   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
   {
@@ -113,7 +113,7 @@ public:
     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;
@@ -157,9 +157,9 @@ public:
   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 );
 
index 2bb54eda444e496c872b0a98850f7d527bee2ee2..f3ab5f2fbda3106217e96c4d623d6572d2254a0c 100644 (file)
@@ -423,7 +423,7 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer
       
 
   HYDROGUI_Module* aModule = module();
-  int aViewerId = (size_t)theViewer;//TODO: check if viewer id is correct
+  size_t aViewerId = (size_t)theViewer;//TODO: check if viewer id is correct
   bool isLandCoverColoringOn = aModule->isLandCoversScalarMapModeOn( aViewerId );
     
   QList<HYDROGUI_Shape*> aLandCoverMapShapes = aModule->getObjectShapes( aViewerId, KIND_LAND_COVER_MAP );