Salome HOME
trying to fix selection mecanism in OCC Viewer: Selection is OK, but broken after...
authorPaul RASCLE <paul.rascle@openfields.fr>
Sun, 13 Sep 2020 16:08:21 +0000 (18:08 +0200)
committerYOANN AUDOUIN <B61570@dsp0851742.postes.calibre.edf.fr>
Fri, 30 Oct 2020 16:08:09 +0000 (17:08 +0100)
14 files changed:
src/HYDROGUI/HYDROGUI_AbstractDisplayer.cxx
src/HYDROGUI/HYDROGUI_AbstractDisplayer.h
src/HYDROGUI/HYDROGUI_BathymetrySelectionOp.cxx
src/HYDROGUI/HYDROGUI_Displayer.cxx
src/HYDROGUI/HYDROGUI_Displayer.h
src/HYDROGUI/HYDROGUI_Module.cxx
src/HYDROGUI/HYDROGUI_Module.h
src/HYDROGUI/HYDROGUI_OCCDisplayer.cxx
src/HYDROGUI/HYDROGUI_OCCDisplayer.h
src/HYDROGUI/HYDROGUI_OCCSelector.cxx
src/HYDROGUI/HYDROGUI_Shape.cxx
src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.cxx
src/HYDROGUI/HYDROGUI_VTKPrsDisplayer.h
src/HYDRO_tests/TestViewer.cxx

index 032c9d3f6bbd4c66f91322e111d96ba2a11715b3..c0a7099ea0d2c369071df8bda0a7f7abc96cd681 100644 (file)
@@ -25,6 +25,9 @@
 #include <SUIT_ViewManager.h>
 #include <SUIT_ViewModel.h>
 
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
 HYDROGUI_AbstractDisplayer::HYDROGUI_AbstractDisplayer( HYDROGUI_Module* theModule )
 : myModule( theModule )
 {
@@ -34,7 +37,7 @@ HYDROGUI_AbstractDisplayer::~HYDROGUI_AbstractDisplayer()
 {
 }
 
-bool HYDROGUI_AbstractDisplayer::IsApplicable( const int theViewerId ) const
+bool HYDROGUI_AbstractDisplayer::IsApplicable( const size_t theViewerId ) const
 {
   return IsApplicable( myModule->getViewManager( theViewerId ) );
 }
@@ -44,31 +47,34 @@ bool HYDROGUI_AbstractDisplayer::IsApplicable( const SUIT_ViewManager* theViewMg
   return ( theViewMgr && ( theViewMgr->getType() == GetType() ) );
 }
 
-void HYDROGUI_AbstractDisplayer::UpdateAll( const int  theViewerId,
+void HYDROGUI_AbstractDisplayer::UpdateAll( const size_t theViewerId,
                                        const bool theIsInit,
                                        const bool theIsForced,
                                        const bool theDoFitAll )
 {
+  DEBTRACE("UpdateAll");
   if ( theIsInit )
     EraseAll( theViewerId );
 
   DisplayAll( theViewerId, theIsForced, theDoFitAll );
 }
 
-void HYDROGUI_AbstractDisplayer::DisplayAll( const int  theViewerId,
+void HYDROGUI_AbstractDisplayer::DisplayAll( const size_t theViewerId,
                                              const bool theIsForced,
                                              const bool theDoFitAll )
 {
+       DEBTRACE("DisplayAll");
   HYDROData_SequenceOfObjects aSeq;
   HYDROGUI_Tool::GetPrsSubObjects( myModule, aSeq );
   Update( aSeq, theViewerId, theIsForced, theDoFitAll );
 }
 
 void HYDROGUI_AbstractDisplayer::Update( const HYDROData_SequenceOfObjects& theObjs,
-                                         const int                          theViewerId,
+                                         const size_t                       theViewerId,
                                          const bool                         theIsForced,
                                          const bool                         theDoFitAll )
 {
+       DEBTRACE("Update");
   // First of all, kill all bad presentations
   purgeObjects( theViewerId );
 
index 2973dc1db5d4e426106f261c0763a06036e0018d..5c3888ac52591049003c8d72e7acee94333e0d89 100644 (file)
@@ -48,7 +48,7 @@ public:
    * The view manager method getType is used.
    * \param theViewerId viewer identifier
    */
-  virtual bool     IsApplicable( const int theViewerId ) const;
+  virtual bool     IsApplicable( const size_t theViewerId ) const;
 
   /**
    * \brief Check if this displayer is applicable to the given view manager.
@@ -63,7 +63,7 @@ public:
    * \param theIsInit flag used for initial update
    * \param theIsForced flag used to update all objects, including the unchanged ones
    */
-  virtual void     UpdateAll( const int theViewerId,
+  virtual void     UpdateAll( const size_t theViewerId,
                               const bool theIsInit,
                               const bool theIsForced,
                               const bool theDoFitAll );
@@ -74,7 +74,7 @@ public:
    * \param theViewerId viewer identifier
    */
   virtual void     SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
-                                const int theViewerId ) = 0;
+                                const size_t theViewerId ) = 0;
 
   /**
    * \brief Get the applicable viewer type.
@@ -89,7 +89,7 @@ protected:
    * \param theViewerId viewer identifier
    * \param theIsForced flag used to update all objects, including the unchanged ones
    */
-  virtual void     DisplayAll( const int theViewerId,
+  virtual void     DisplayAll( const size_t theViewerId,
                                const bool theIsForced,
                                const bool theDoFitAll );
 
@@ -101,7 +101,7 @@ protected:
    * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
    */
   virtual void     Update( const HYDROData_SequenceOfObjects& theObjs,
-                           const int theViewerId,
+                           const size_t theViewerId,
                            const bool theIsForced,
                            const bool theDoFitAll );
 
@@ -109,7 +109,7 @@ protected:
    * \brief Erase all viewer objects.
    * \param theViewerId viewer identifier
    */
-  virtual void     EraseAll( const int theViewerId ) = 0;
+  virtual void     EraseAll( const size_t theViewerId ) = 0;
 
   /**
    * \brief Erase the specified viewer objects.
@@ -117,7 +117,7 @@ protected:
    * \param theViewerId viewer identifier
    */
   virtual void     Erase( const HYDROData_SequenceOfObjects& theObjs,
-                          const int theViewerId ) = 0;
+                          const size_t theViewerId ) = 0;
 
   /**
    * \brief Display the specified viewer objects.
@@ -127,7 +127,7 @@ protected:
    * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
    */
   virtual void     Display( const HYDROData_SequenceOfObjects& theObjs,
-                            const int theViewerId,
+                            const size_t theViewerId,
                             const bool theIsForced,
                             const bool theDoFitAll ) = 0;
 
@@ -136,7 +136,7 @@ protected:
    * \brief Purge all invalid objects in the viewer.
    * \param theViewerId viewer identifier
    */
-  virtual void     purgeObjects( const int theViewerId ) = 0;
+  virtual void     purgeObjects( const size_t theViewerId ) = 0;
 
   //HYDROGUI_Module* module() const {return myModule;}
 
index e9ec399b97124cc10c3469318109bff6b15b333a..a6896f367e9ae2d157e03fee6ef1e87ac9ea4130 100644 (file)
@@ -28,6 +28,9 @@
 #include <QAction>
 #include <QApplication>
 
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
 HYDROGUI_BathymetrySelectionOp::HYDROGUI_BathymetrySelectionOp( HYDROGUI_Module* theModule )
 : HYDROGUI_Operation( theModule ), myIsActive( false )
 {
@@ -88,6 +91,7 @@ QList<Handle(HYDROGUI_BathymetryPrs)> getShownBathymetries( HYDROGUI_Module* the
 
 void HYDROGUI_BathymetrySelectionOp::activateSelection( bool isActive )
 {
+  DEBTRACE("activateSelection " << isActive);
   if( myIsActive==isActive )
     return;
 
@@ -99,6 +103,7 @@ void HYDROGUI_BathymetrySelectionOp::activateSelection( bool isActive )
   if( isActive )
   {
     const int aSelectionMode = 1;
+    //ctx->Deactivate( Standard_True );
     //ctx->OpenLocalContext( Standard_True );
     foreach( Handle(HYDROGUI_BathymetryPrs) bath, baths )
     {
index 64bbb6e462a62dd205c32635b2c6f423b8bc3dcc..c869d87c2c33e5b6796a4a7ba6a9dbaa7e0bebca 100644 (file)
@@ -55,7 +55,7 @@ HYDROGUI_Displayer::~HYDROGUI_Displayer()
 }
 
 void HYDROGUI_Displayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
-                                      const int theViewerId )
+                                      const size_t theViewerId )
 {
   GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId );
   if( !aViewer )
@@ -77,7 +77,7 @@ void HYDROGUI_Displayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs
   }
 }
 
-void HYDROGUI_Displayer::EraseAll( const int theViewerId )
+void HYDROGUI_Displayer::EraseAll( const size_t theViewerId )
 {
   GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId );
   if( !aViewer )
@@ -99,7 +99,7 @@ void HYDROGUI_Displayer::EraseAll( const int theViewerId )
 }
 
 void HYDROGUI_Displayer::Erase( const HYDROData_SequenceOfObjects& theObjs,
-                                const int theViewerId )
+                                const size_t theViewerId )
 {
   GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId );
   if( !aViewer )
@@ -128,7 +128,7 @@ void HYDROGUI_Displayer::Erase( const HYDROData_SequenceOfObjects& theObjs,
 }
 
 void HYDROGUI_Displayer::Display( const HYDROData_SequenceOfObjects& theObjs,
-                                  const int theViewerId,
+                                  const size_t theViewerId,
                                   const bool theIsForced,
                                   const bool theDoFitAll)
 {
@@ -174,7 +174,7 @@ void HYDROGUI_Displayer::Display( const HYDROData_SequenceOfObjects& theObjs,
   }
 }
 
-void HYDROGUI_Displayer::purgeObjects( const int theViewerId )
+void HYDROGUI_Displayer::purgeObjects( const size_t theViewerId )
 {
   GraphicsView_Viewer* aViewer = module()->getViewer( theViewerId );
   if( !aViewer )
index b4a574ed450bbb01763e3d3c578aeb7a2e6c3fd6..70ebb1d8c9ecd2f511bb7f9cd503abba23612bba 100644 (file)
@@ -55,7 +55,7 @@ public:
    * \param theViewerId viewer identifier
    */
   void             SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
-                                const int theViewerId );
+                                const size_t theViewerId );
 
   /**
    * \brief Get the applicable viewer type.
@@ -86,7 +86,7 @@ protected:
    * \brief Erase all viewer objects.
    * \param theViewerId viewer identifier
    */
-  void             EraseAll( const int theViewerId );
+  void             EraseAll( const size_t theViewerId );
 
   /**
    * \brief Erase the specified viewer objects.
@@ -94,7 +94,7 @@ protected:
    * \param theViewerId viewer identifier
    */
   void             Erase( const HYDROData_SequenceOfObjects& theObjs,
-                          const int theViewerId );
+                          const size_t theViewerId );
 
   /**
    * \brief Display the specified viewer objects.
@@ -104,7 +104,7 @@ protected:
    * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
    */
   void             Display( const HYDROData_SequenceOfObjects& theObjs,
-                            const int theViewerId,
+                            const size_t theViewerId,
                             const bool theIsForced,
                             const bool theDoFitAll );
 
@@ -113,7 +113,7 @@ protected:
    * \brief Purge all invalid objects in the viewer.
    * \param theViewerId viewer identifier
    */
-  void             purgeObjects( const int theViewerId );
+  void             purgeObjects( const size_t theViewerId );
 
 private:
   /**
index 7cee9227fb0d3fa3b6c356b5147ab4f3e8672ec7..5eafac6457d5775e6a8310d294909a6e8be70c3e 100755 (executable)
 #define _DEVDEBUG_
 #include "HYDRO_trace.hxx"
 
-static int ViewManagerId = 0;
+static size_t ViewManagerId = 1;
 
 extern "C" HYDRO_EXPORT CAM_Module* createModule()
 {
@@ -1157,6 +1157,7 @@ void HYDROGUI_Module::updateCommandsStatus()
 
 void HYDROGUI_Module::selectionChanged()
 {
+  DEBTRACE("HYDROGUI_Module::selectionChanged");
   LightApp_Module::selectionChanged();
   updateCommandsStatus();
 }
@@ -1185,9 +1186,9 @@ HYDROGUI_VTKPrsDisplayer* HYDROGUI_Module::getVTKDisplayer() const
   return myVTKDisplayer;
 }
 
-SUIT_ViewManager* HYDROGUI_Module::getViewManager( const int theId ) const
+SUIT_ViewManager* HYDROGUI_Module::getViewManager( const size_t theId ) const
 {
-  DEBTRACE("HYDROGUI_Module::getViewManager");
+  DEBTRACE("HYDROGUI_Module::getViewManager " << theId);
   if( myViewManagerMap.contains( theId ) )
   {
     return myViewManagerMap[ theId ].first;
@@ -1195,9 +1196,9 @@ SUIT_ViewManager* HYDROGUI_Module::getViewManager( const int theId ) const
   return NULL;
 }
 
-GraphicsView_Viewer* HYDROGUI_Module::getViewer( const int theId ) const
+GraphicsView_Viewer* HYDROGUI_Module::getViewer( const size_t theId ) const
 {
-  DEBTRACE("HYDROGUI_Module::getViewer");
+  DEBTRACE("HYDROGUI_Module::getViewer " << theId);
   if( myViewManagerMap.contains( theId ) )
   {
     ViewManagerInfo anInfo = myViewManagerMap[ theId ];
@@ -1209,9 +1210,9 @@ GraphicsView_Viewer* HYDROGUI_Module::getViewer( const int theId ) const
   return NULL;
 }
 
-OCCViewer_Viewer* HYDROGUI_Module::getOCCViewer( const int theId ) const
+OCCViewer_Viewer* HYDROGUI_Module::getOCCViewer( const size_t theId ) const
 {
-  DEBTRACE("HYDROGUI_Module::getOCCViewer");
+  DEBTRACE("HYDROGUI_Module::getOCCViewer " << theId);
   if( myViewManagerMap.contains( theId ) )
   {
     ViewManagerInfo anInfo = myViewManagerMap[ theId ];
@@ -1223,9 +1224,9 @@ OCCViewer_Viewer* HYDROGUI_Module::getOCCViewer( const int theId ) const
   return NULL;
 }
 
-SVTK_Viewer* HYDROGUI_Module::getVTKViewer( const int theId ) const
+SVTK_Viewer* HYDROGUI_Module::getVTKViewer( const size_t theId ) const
 {
-  DEBTRACE("HYDROGUI_Module::getVTKViewer");
+  DEBTRACE("HYDROGUI_Module::getVTKViewer "  << theId);
   if( myViewManagerMap.contains( theId ) )
   {
     ViewManagerInfo anInfo = myViewManagerMap[ theId ];
@@ -1237,25 +1238,25 @@ SVTK_Viewer* HYDROGUI_Module::getVTKViewer( const int theId ) const
   return NULL;
 }
 
-int HYDROGUI_Module::getViewManagerId( SUIT_ViewManager* theViewManager )
+size_t HYDROGUI_Module::getViewManagerId( SUIT_ViewManager* theViewManager )
 {
   DEBTRACE("HYDROGUI_Module::getViewManagerId");
   ViewManagerMapIterator anIter( myViewManagerMap );
   while( anIter.hasNext() )
   {
-    int anId = anIter.next().key();
+    size_t anId = anIter.next().key();
     const ViewManagerInfo& anInfo = anIter.value();
     if( anInfo.first == theViewManager )
       return anId;
   }
-  return -1;
+  return 0;
 }
 
 HYDROGUI_Module::ViewManagerRole HYDROGUI_Module::getViewManagerRole( SUIT_ViewManager* theViewManager )
 {
   DEBTRACE("HYDROGUI_Module::getViewManagerRole");
-  int anId = getViewManagerId( theViewManager );
-  if( anId != -1 )
+  size_t anId = getViewManagerId( theViewManager );
+  if( anId == 0 )
   {
     const ViewManagerInfo& anInfo = myViewManagerMap[ anId ];
     return anInfo.second;
@@ -1386,7 +1387,7 @@ void HYDROGUI_Module::setIsToUpdate( const Handle(HYDROData_Entity)& theObject,
 }
 
 /////////////////// OCC SHAPES PROCESSING
-QList<HYDROGUI_Shape*> HYDROGUI_Module::getObjectShapes( const int  theViewId,
+QList<HYDROGUI_Shape*> HYDROGUI_Module::getObjectShapes( const size_t  theViewId,
                                                          ObjectKind theKind ) const
 {
   QList<HYDROGUI_Shape*> aResult;
@@ -1403,7 +1404,7 @@ QList<HYDROGUI_Shape*> HYDROGUI_Module::getObjectShapes( const int  theViewId,
   return aResult;
 }
 
-HYDROGUI_Shape* HYDROGUI_Module::getObjectShape( const int                       theViewId,
+HYDROGUI_Shape* HYDROGUI_Module::getObjectShape( const size_t                    theViewId,
                                                  const Handle(HYDROData_Entity)& theObject ) const
 {
   HYDROGUI_Shape* aResShape = NULL;
@@ -1426,7 +1427,7 @@ HYDROGUI_Shape* HYDROGUI_Module::getObjectShape( const int
   return aResShape;
 }
 
-void HYDROGUI_Module::setObjectShape( const int                       theViewId,
+void HYDROGUI_Module::setObjectShape( const size_t                    theViewId,
                                       const Handle(HYDROData_Entity)& theObject,
                                       HYDROGUI_Shape*                 theShape )
 {
@@ -1437,7 +1438,7 @@ void HYDROGUI_Module::setObjectShape( const int                       theViewId,
   aViewShapes.append( theShape );
 }
 
-void HYDROGUI_Module::removeObjectShape( const int                       theViewId,
+void HYDROGUI_Module::removeObjectShape( const size_t                    theViewId,
                                          const Handle(HYDROData_Entity)& theObject )
 {
   if ( !myShapesMap.contains( theViewId ) )
@@ -1460,7 +1461,7 @@ void HYDROGUI_Module::removeObjectShape( const int                       theView
   }
 }
 
-void HYDROGUI_Module::removeViewShapes( const int theViewId )
+void HYDROGUI_Module::removeViewShapes( const size_t theViewId )
 {
   if ( !myShapesMap.contains( theViewId ) )
     return;
@@ -1478,7 +1479,7 @@ void HYDROGUI_Module::removeViewShapes( const int theViewId )
 /////////////////// END OF OCC SHAPES PROCESSING
 
 /////////////////// VTKPrs PROCESSING
-HYDROGUI_VTKPrs* HYDROGUI_Module::getObjectVTKPrs( const int                       theViewId,
+HYDROGUI_VTKPrs* HYDROGUI_Module::getObjectVTKPrs( const size_t                  theViewId,
                                                  const Handle(HYDROData_Entity)& theObject ) const
 {
   HYDROGUI_VTKPrs* aResShape = NULL;
@@ -1501,7 +1502,7 @@ HYDROGUI_VTKPrs* HYDROGUI_Module::getObjectVTKPrs( const int
   return aResShape;
 }
 
-void HYDROGUI_Module::setObjectVTKPrs( const int                       theViewId,
+void HYDROGUI_Module::setObjectVTKPrs( const size_t                    theViewId,
                                        const Handle(HYDROData_Entity)& theObject,
                                        HYDROGUI_VTKPrs*                 theShape )
 {
@@ -1535,7 +1536,7 @@ void HYDROGUI_Module::setObjectVTKPrs( const int                       theViewId
   aViewShapes.append( theShape );
 }
 
-void HYDROGUI_Module::removeObjectVTKPrs( const int      theViewId,
+void HYDROGUI_Module::removeObjectVTKPrs( const size_t   theViewId,
                                           const QString& theEntry )
 {
   if ( !myVTKPrsMap.contains( theViewId ) )
@@ -1564,7 +1565,7 @@ void HYDROGUI_Module::removeObjectVTKPrs( const int      theViewId,
   getVTKDisplayer()->SetZRange( theViewId, anInvalidRange );
 }
 
-void HYDROGUI_Module::removeObjectVTKPrs( const int                       theViewId,
+void HYDROGUI_Module::removeObjectVTKPrs( const size_t                    theViewId,
                                           const Handle(HYDROData_Entity)& theObject )
 {
   if ( !myVTKPrsMap.contains( theViewId ) )
@@ -1591,7 +1592,7 @@ void HYDROGUI_Module::removeObjectVTKPrs( const int                       theVie
   getVTKDisplayer()->SetZRange( theViewId, anInvalidRange );
 }
 
-void HYDROGUI_Module::removeViewVTKPrs( const int theViewId )
+void HYDROGUI_Module::removeViewVTKPrs( const size_t theViewId )
 {
   if ( !myVTKPrsMap.contains( theViewId ) )
     return;
@@ -1607,7 +1608,7 @@ void HYDROGUI_Module::removeViewVTKPrs( const int theViewId )
   myVTKPrsMap.remove( theViewId );
 }
 
-void HYDROGUI_Module::updateVTKZRange( const int theViewId, double theRange[] )
+void HYDROGUI_Module::updateVTKZRange( const size_t theViewId, double theRange[] )
 {
   if ( myVTKPrsMap.contains( theViewId ) )
   {
@@ -1789,8 +1790,10 @@ void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theViewWindow )
   DEBTRACE("HYDROGUI_Module::onViewCreated");
   if( theViewWindow && theViewWindow->inherits( "GraphicsView_ViewFrame" ) )
   {
+       DEBTRACE("theViewWindow->inherits( 'GraphicsView_ViewFrame' )");
     if( GraphicsView_ViewFrame* aViewFrame = dynamic_cast<GraphicsView_ViewFrame*>( theViewWindow ) )
     {
+      DEBTRACE("---");
       aViewFrame->installEventFilter( this );
 
       GraphicsView_ViewPort* aViewPort = aViewFrame->getViewPort();
@@ -1802,8 +1805,10 @@ void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theViewWindow )
   }
   else if( theViewWindow && theViewWindow->inherits( "OCCViewer_ViewFrame" ) )
   {
+       DEBTRACE("theViewWindow->inherits( 'OCCViewer_ViewFrame' )");
     if( OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>( theViewWindow ) )
     {
+      DEBTRACE("---");
       aViewFrame->onTopView();
 
       HYDROGUI_Tool::setOCCActionShown( aViewFrame, OCCViewer_ViewWindow::MaximizedId, false );
@@ -1815,8 +1820,10 @@ void HYDROGUI_Module::onViewCreated( SUIT_ViewWindow* theViewWindow )
   }
   else if( theViewWindow && theViewWindow->inherits( "SVTK_ViewWindow" ) )
   {
+       DEBTRACE("theViewWindow->inherits( 'SVTK_ViewWindow' )");
     if( SVTK_ViewWindow* aViewFrame = dynamic_cast<SVTK_ViewWindow*>( theViewWindow ) )
     {
+      DEBTRACE("---");
       aViewFrame->installEventFilter( this );
     }
   }
@@ -1900,7 +1907,7 @@ void HYDROGUI_Module::updateViewer( HYDROGUI_AbstractDisplayer* theDisplayer,
 
 void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager )
 {
-  DEBTRACE("HYDROGUI_Module::createSelector");
+  DEBTRACE("HYDROGUI_Module::createSelector ====================================");
   if( !theViewManager )
     return;
 
@@ -1909,6 +1916,7 @@ void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager )
     return;
 
   QString aViewType = theViewManager->getType();
+  DEBTRACE("aViewType " << aViewType.toStdString() << " " << GraphicsView_Viewer::Type().toStdString() << " "  << OCCViewer_Viewer::Type().toStdString());
   if( aViewType != GraphicsView_Viewer::Type() &&
       aViewType != OCCViewer_Viewer::Type())
     return;
@@ -1917,29 +1925,70 @@ void HYDROGUI_Module::createSelector( SUIT_ViewManager* theViewManager )
   aSelectionMgr->selectors( aViewType, aSelectorList );
 
   // disable all alien selectors
+  bool isGV = false;
+  bool isOCC = false;
   QList<SUIT_Selector*>::iterator anIter, anIterEnd = aSelectorList.end();
   for( anIter = aSelectorList.begin(); anIter != anIterEnd; anIter++ )
   {
     SUIT_Selector* aSelector = *anIter;
-    if( aSelector && ( !dynamic_cast<HYDROGUI_GVSelector*>( aSelector ) &&
-                       !dynamic_cast<SVTK_Selector*>( aSelector ) &&
-                       !dynamic_cast<HYDROGUI_OCCSelector*>( aSelector ) ) )
-      aSelector->setEnabled( false );
+//    if( aSelector && ( !dynamic_cast<HYDROGUI_GVSelector*>( aSelector ) &&
+//                       !dynamic_cast<SVTK_Selector*>( aSelector ) &&
+//                       !dynamic_cast<HYDROGUI_OCCSelector*>( aSelector ) ) )
+    bool isOk = false;
+    if (aSelector)
+    {
+       DEBTRACE("Selector " << aSelector->type().toStdString());
+       if (dynamic_cast<HYDROGUI_GVSelector*>( aSelector ))
+       {
+               isOk = true;
+               isGV = true;
+               DEBTRACE("HYDROGUI_GVSelector");
+       }
+       else if (dynamic_cast<SVTK_Selector*>( aSelector ))
+       {
+               isOk = true;
+               DEBTRACE("SVTK_Selector");
+       }
+       else if (dynamic_cast<HYDROGUI_OCCSelector*>( aSelector ))
+       {
+               isOk = true;
+               isOCC = true;
+               DEBTRACE("HYDROGUI_OCCSelector");
+       }
+       if (isOk)
+               {
+                 DEBTRACE("Selector enabled " << aSelector->type().toStdString());
+                 aSelector->setEnabled( true );
+               }
+       else
+               {
+                 DEBTRACE("Selector disabled " << aSelector->type().toStdString());
+                 aSelector->setEnabled( false );
+               }
+    }
   }
 
-  if ( aViewType == GraphicsView_Viewer::Type() )
+  if ( !isGV && aViewType == GraphicsView_Viewer::Type() )
   {
     GraphicsView_ViewManager* aViewManager =
       ::qobject_cast<GraphicsView_ViewManager*>( theViewManager );
     if( aViewManager )
-      new HYDROGUI_GVSelector( this, aViewManager->getViewer(), aSelectionMgr );
+    {
+      HYDROGUI_GVSelector* sel = new HYDROGUI_GVSelector( this, aViewManager->getViewer(), aSelectionMgr );
+      DEBTRACE("new HYDROGUI_GVSelector " << sel << " " << sel->type().toStdString());
+      sel->setEnabled( true );
+    }
   }
-  else if ( aViewType == OCCViewer_Viewer::Type() )
+  else if ( !isOCC && aViewType == OCCViewer_Viewer::Type() )
   {
     OCCViewer_ViewManager* aViewManager =
       ::qobject_cast<OCCViewer_ViewManager*>( theViewManager );
     if( aViewManager )
-      new HYDROGUI_OCCSelector( this, aViewManager->getOCCViewer(), aSelectionMgr );
+    {
+      HYDROGUI_OCCSelector* sel =  new HYDROGUI_OCCSelector( this, aViewManager->getOCCViewer(), aSelectionMgr );
+      DEBTRACE("new HYDROGUI_OCCSelector " << sel << " " << sel->type().toStdString());
+      sel->setEnabled( true );
+    }
   }
 }
 
@@ -2183,7 +2232,7 @@ void HYDROGUI_Module::setObjectRemoved( const Handle(HYDROData_Entity)& theObjec
     Handle(HYDROData_StricklerTable) aTable = 
       Handle(HYDROData_StricklerTable)::DownCast( theObject );
     QList<int> aViewIds;
-    QMutableMapIterator<int, Handle(HYDROData_StricklerTable)> anIter( myLandCoverColoringMap );
+    QMutableMapIterator<size_t, Handle(HYDROData_StricklerTable)> anIter( myLandCoverColoringMap );
     while ( anIter.hasNext() ) {
       if ( HYDROGUI_DataObject::dataObjectEntry( anIter.next().value() ) == 
            HYDROGUI_DataObject::dataObjectEntry( aTable ) ) {
index a8daaaa2e1606796fa7baa1dadbe886311967f5c..b8b57f38ac1e0be96bf5cae420afd7a7b3aac59b 100644 (file)
@@ -116,12 +116,12 @@ public:
   typedef QMap< size_t, Entry2ObjectStateMap > ViewId2Entry2ObjectStateMap;
 
   typedef QList<HYDROGUI_Shape*> ListOfShapes;
-  typedef QMap<int,ListOfShapes> ViewId2ListOfShapes;
+  typedef QMap<size_t,ListOfShapes> ViewId2ListOfShapes;
 
   typedef QList<HYDROGUI_VTKPrs*> ListOfVTKPrs;
-  typedef QMap<int,ListOfVTKPrs> ViewId2ListOfVTKPrs;
+  typedef QMap<size_t,ListOfVTKPrs> ViewId2ListOfVTKPrs;
 
-  typedef QMap<int, Handle(HYDROData_StricklerTable)> ViewId2StricklerTable;
+  typedef QMap<size_t, Handle(HYDROData_StricklerTable)> ViewId2StricklerTable;
 
 public:
   HYDROGUI_Module();
@@ -142,17 +142,17 @@ public:
   virtual void                    selectionChanged();
   virtual void                    studyClosed( SUIT_Study* );
 
-  SUIT_ViewManager*               getViewManager( const int theId ) const;
+  SUIT_ViewManager*               getViewManager( const size_t theId ) const;
   HYDROGUI_DataModel*             getDataModel() const;
   HYDROGUI_Displayer*             getDisplayer() const;
   HYDROGUI_OCCDisplayer*          getOCCDisplayer() const;
   HYDROGUI_VTKPrsDisplayer*       getVTKDisplayer() const;
 
-  GraphicsView_Viewer*            getViewer( const int theId ) const;
-  OCCViewer_Viewer*               getOCCViewer( const int theId ) const;
-  SVTK_Viewer*                    getVTKViewer( const int theId ) const;
+  GraphicsView_Viewer*            getViewer( const size_t theId ) const;
+  OCCViewer_Viewer*               getOCCViewer( const size_t theId ) const;
+  SVTK_Viewer*                    getVTKViewer( const size_t theId ) const;
 
-  int                             getViewManagerId( SUIT_ViewManager* theViewManager );
+  size_t                          getViewManagerId( SUIT_ViewManager* theViewManager );
   ViewManagerRole                 getViewManagerRole( SUIT_ViewManager* theViewManager );
   void                            setViewManagerRole( SUIT_ViewManager* theViewManager,
                                                       const ViewManagerRole theRole );
@@ -175,33 +175,33 @@ public:
    */
   void                            setIsToUpdate( const Handle(HYDROData_Entity)& theObject,
                                                  const bool theState = true );
-  QList<HYDROGUI_Shape*>          getObjectShapes( const int  theViewId,
+  QList<HYDROGUI_Shape*>          getObjectShapes( const size_t  theViewId,
                                                    ObjectKind theKind ) const;
-  HYDROGUI_Shape*                 getObjectShape( const int                       theViewId,
+  HYDROGUI_Shape*                 getObjectShape( const size_t                    theViewId,
                                                   const Handle(HYDROData_Entity)& theObject ) const;
-  void                            setObjectShape( const int                       theViewId,
+  void                            setObjectShape( const size_t                    theViewId,
                                                   const Handle(HYDROData_Entity)& theObject,
                                                   HYDROGUI_Shape*                 theShape );
-  void                            removeViewShapes( const int                     theViewId );
-  void                            removeObjectShape( const int                       theViewId,
+  void                            removeViewShapes( const size_t                  theViewId );
+  void                            removeObjectShape( const size_t                    theViewId,
                                                      const Handle(HYDROData_Entity)& theObject );
 
-  HYDROGUI_VTKPrs*                getObjectVTKPrs( const int                       theViewId,
+  HYDROGUI_VTKPrs*                getObjectVTKPrs( const size_t                    theViewId,
                                                    const Handle(HYDROData_Entity)& theObject ) const;
-  void                            setObjectVTKPrs( const int                       theViewId,
+  void                            setObjectVTKPrs( const size_t                    theViewId,
                                                    const Handle(HYDROData_Entity)& theObject,
                                                    HYDROGUI_VTKPrs*                theShape );
-  void                            removeViewVTKPrs( const int                      theViewId );
-  void                            removeObjectVTKPrs( const int                      theViewId,
+  void                            removeViewVTKPrs( const size_t                   theViewId );
+  void                            removeObjectVTKPrs( const size_t                   theViewId,
                                                      const Handle(HYDROData_Entity)& theObject );
 
-  void                            removeObjectVTKPrs( const int      theViewId,
+  void                            removeObjectVTKPrs( const size_t   theViewId,
                                                       const QString& theEntry );
 
   /**
    * Update global imposed range of Z values for the given VTK viewer id
    */
-  void                            updateVTKZRange( const int theViewId, double theRange[] );
+  void                            updateVTKZRange( const size_t theViewId, double theRange[] );
 
   /**
    * Returns true if the object with the given entry can be renamed.
index f3ab5f2fbda3106217e96c4d623d6572d2254a0c..11b8175d44cd8649ea45f68aa10ae39323db7495 100644 (file)
@@ -49,6 +49,9 @@
 #include <OCCViewer_ViewWindow.h>
 #include <OCCViewer_ViewPort3d.h>
 
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
 HYDROGUI_OCCDisplayer::HYDROGUI_OCCDisplayer( HYDROGUI_Module* theModule )
 : HYDROGUI_AbstractDisplayer( theModule )
 {
@@ -60,7 +63,7 @@ HYDROGUI_OCCDisplayer::~HYDROGUI_OCCDisplayer()
 }
 
 void HYDROGUI_OCCDisplayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
-                                         const int                          theViewerId )
+                                         const size_t                       theViewerId )
 {
   OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
   if( !aViewer )
@@ -120,7 +123,7 @@ void HYDROGUI_OCCDisplayer::RemoveZLayer( OCCViewer_ViewManager* theMgr,
     aViewer->getViewer3d()->RemoveZLayer( theLayer );
 }
 
-void HYDROGUI_OCCDisplayer::EraseAll( const int theViewerId )
+void HYDROGUI_OCCDisplayer::EraseAll( const size_t theViewerId )
 {
   OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
   if( !aViewer )
@@ -131,7 +134,7 @@ void HYDROGUI_OCCDisplayer::EraseAll( const int theViewerId )
 }
 
 void HYDROGUI_OCCDisplayer::Erase( const HYDROData_SequenceOfObjects& theObjs,
-                                   const int                          theViewerId )
+                                   const size_t                       theViewerId )
 {
   OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
   if( !aViewer )
@@ -151,10 +154,11 @@ void HYDROGUI_OCCDisplayer::Erase( const HYDROData_SequenceOfObjects& theObjs,
   }
 }
 
-HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const int                             theViewerId,
+HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const size_t                          theViewerId,
                                                     const Handle(AIS_InteractiveContext)& theContext,
                                                     const Handle(HYDROData_Entity)&       theObject )
 {
+  DEBTRACE("createShape " << theViewerId);
   HYDROGUI_Shape* aResShape = NULL;
   if ( theContext.IsNull() || theObject.IsNull() )
     return aResShape;
@@ -179,7 +183,7 @@ HYDROGUI_Shape* HYDROGUI_OCCDisplayer::createShape( const int
 }
 
 void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs,
-                                     const int                          theViewerId,
+                                     const size_t                       theViewerId,
                                      const bool                         theIsForced,
                                      const bool theDoFitAll )
 {
@@ -300,7 +304,7 @@ void HYDROGUI_OCCDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs,
   UpdateColorScale( aViewer );
 }
 
-void HYDROGUI_OCCDisplayer::purgeObjects( const int theViewerId )
+void HYDROGUI_OCCDisplayer::purgeObjects( const size_t theViewerId )
 {
   OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
   if( !aViewer )
@@ -337,6 +341,7 @@ bool HYDROGUI_OCCDisplayer::Display( const Handle(HYDROData_Entity)& theObject,
                                      const OCCViewer_Viewer* theViewer,
                                      const bool theIsForced )
 {
+  DEBTRACE("Display");
   bool aRes = false;
 
   if ( theObject.IsNull() || theObject->IsRemoved() || !theViewer ) {
@@ -548,7 +553,7 @@ void HYDROGUI_OCCDisplayer::UpdateColorScale( const OCCViewer_Viewer* theViewer
   myToUpdateColorScale = false;
 }
 
-Handle(AIS_ColorScale) HYDROGUI_OCCDisplayer::GetColorScale( const int theViewerId )
+Handle(AIS_ColorScale) HYDROGUI_OCCDisplayer::GetColorScale( const size_t theViewerId )
 {
   Handle(AIS_ColorScale) aColorScale;
 
@@ -582,7 +587,7 @@ Handle(AIS_ColorScale) HYDROGUI_OCCDisplayer::GetColorScale( const int theViewer
   return aColorScale;
 }
 
-void HYDROGUI_OCCDisplayer::UpdatePolylines( int theViewerId, int theType, int theSize )
+void HYDROGUI_OCCDisplayer::UpdatePolylines( size_t theViewerId, int theType, int theSize )
 {
   OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
   if( !aViewer )
index e7aea2a9d960a92485c276ad3a097b9fa82e34dc..80a55c9ce0e6ffa4fff1a3d4798874fdcdbe0fed 100644 (file)
@@ -52,7 +52,7 @@ public:
    * \param theViewerId viewer identifier
    */
   void                            SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
-                                               const int theViewerId );
+                                               const size_t theViewerId );
 
   /**
    * \brief Get the applicable viewer type.
@@ -80,10 +80,10 @@ public:
    * \param theViewerId viewer identifier
    * \return the color scale 
    */
-  Handle(AIS_ColorScale) GetColorScale( const int theViewerId );
+  Handle(AIS_ColorScale) GetColorScale( const size_t theViewerId );
 
 
-  void UpdatePolylines( int theViewerId, int theType, int theSize );
+  void UpdatePolylines( size_t theViewerId, int theType, int theSize );
 
   void UpdateColorScale( const OCCViewer_Viewer* );
 
@@ -92,7 +92,7 @@ protected:
    * \brief Erase all viewer objects.
    * \param theViewerId viewer identifier
    */
-  void                            EraseAll( const int theViewerId );
+  void                            EraseAll( const size_t theViewerId );
 
   /**
    * \brief Erase the specified viewer objects.
@@ -100,7 +100,7 @@ protected:
    * \param theViewerId viewer identifier
    */
   void                            Erase( const HYDROData_SequenceOfObjects& theObjs,
-                                         const int theViewerId );
+                                         const size_t theViewerId );
 
   /**
    * \brief Display the specified viewer objects.
@@ -110,14 +110,14 @@ protected:
    * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
    */
   void                            Display( const HYDROData_SequenceOfObjects& theObjs,
-                                           const int theViewerId,
+                                           const size_t theViewerId,
                                            const bool theIsForced,
                                            const bool theDoFitAll );
   /**
    * \brief Purge all invalid objects in the viewer.
    * \param theViewerId viewer identifier
    */
-  void                            purgeObjects( const int theViewerId );
+  void                            purgeObjects( const size_t theViewerId );
   
 private:
   /**
@@ -127,7 +127,7 @@ private:
    * \param theObject data model object
    * \return pointer to new created shape
    */
-  HYDROGUI_Shape*                 createShape( const int                             theViewerId,
+  HYDROGUI_Shape*                 createShape( const size_t                          theViewerId,
                                                const Handle(AIS_InteractiveContext)& theContext,
                                                const Handle(HYDROData_Entity)&       theObject );
 
@@ -155,7 +155,7 @@ private:
 private:
   bool myToUpdateColorScale;
   
-  QMap<int, Handle(AIS_ColorScale)> myColorScales;
+  QMap<size_t, Handle(AIS_ColorScale)> myColorScales;
 };
 
 #endif
index 8f189c57d653d5443873c1238fc3c847c7c50ed0..6bd771fa2a37619ceb530ed35d4612b8d6f8e42f 100644 (file)
@@ -29,6 +29,9 @@
 
 #include <LightApp_DataOwner.h>
 
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
 HYDROGUI_OCCSelector::HYDROGUI_OCCSelector( HYDROGUI_Module*   theModule,
                                             OCCViewer_Viewer*  theViewer,
                                             SUIT_SelectionMgr* theSelMgr )
@@ -43,6 +46,7 @@ HYDROGUI_OCCSelector::~HYDROGUI_OCCSelector()
 
 void HYDROGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
 {
+  DEBTRACE("getSelection");
   OCCViewer_Viewer* aViewer = viewer();
   if ( !aViewer )
     return;
@@ -52,11 +56,13 @@ void HYDROGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
 
   AIS_ListOfInteractive aSelList;
   aViewer->getSelectedObjects( aSelList );
+  DEBTRACE("  aSelList.Size(): " << aSelList.Size());
   for ( AIS_ListIteratorOfListOfInteractive anIt( aSelList ); anIt.More(); anIt.Next() )
     if ( !anIt.Value().IsNull() )
     {
       //if ( !isLocalContext ) {
         QString anEntry = entry( anIt.Value() );
+        DEBTRACE("  anEntry: " << anEntry.toStdString());
         if ( !anEntry.isEmpty() ) {
           aList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( entry( anIt.Value() ) ) ) );
         } else {
@@ -67,12 +73,14 @@ void HYDROGUI_OCCSelector::getSelection( SUIT_DataOwnerPtrList& aList ) const
   // add externally selected objects
   SUIT_DataOwnerPtrList::const_iterator anExtIter;
   for(anExtIter = mySelectedExternals.begin(); anExtIter != mySelectedExternals.end(); anExtIter++) {
+       DEBTRACE("  anExternal");
     aList.append(*anExtIter);
   }
 }
 
 void HYDROGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList )
 {
+  DEBTRACE("setSelection");
   OCCViewer_Viewer* aViewer = viewer();
   if ( !aViewer )
     return;
@@ -98,13 +106,14 @@ void HYDROGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList )
   }*/
 
   mySelectedExternals.clear();
-
+  DEBTRACE("  ...");
   for ( SUIT_DataOwnerPtrList::const_iterator itr = aList.begin(); itr != aList.end(); ++itr )
   {
     const LightApp_DataOwner* owner = dynamic_cast<const LightApp_DataOwner*>( (*itr).operator->() );
     if ( owner )   //&& aDisplayed.contains( owner->entry() ) )
     {
       QString anEntry = owner->entry();
+      DEBTRACE("  anEntry: " << anEntry.toStdString());
       Handle(HYDROData_Entity) anEntity = myModule->getDataModel()->objectByEntry( anEntry );
       if( !anEntity.IsNull() )
       {
@@ -118,6 +127,7 @@ void HYDROGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList )
     }
     else {
       const HYDROGUI_DataOwner* hydroOwner = dynamic_cast<const HYDROGUI_DataOwner*>( (*itr).operator->() );
+      DEBTRACE("  hydroOwner: " << hydroOwner);
       if ( hydroOwner && !hydroOwner->IO().IsNull() ) {
         aSelList.Append( hydroOwner->IO() );
       } else
index 6ce0e1a1fb11fceb9710958a9a1a3814c4e4f3ac..96a2fd197205bdabc2bc9e74f0ae9fc3633d7901 100644 (file)
@@ -47,6 +47,9 @@
 #include <SUIT_ResourceMgr.h>
 #include <SUIT_Session.h>
 
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
 HYDROGUI_Shape::HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext,
                                 const Handle(HYDROData_Entity)&       theObject,
                                 const int                             theZLayer )
@@ -124,6 +127,7 @@ void HYDROGUI_Shape::update( bool isUpdateViewer,
                              bool isDeactivateSelection )
 
 {
+  DEBTRACE("update " << isUpdateViewer << " " << isDeactivateSelection);
   setIsToUpdate( false );
 
   if ( myContext.IsNull() )
@@ -389,6 +393,7 @@ void HYDROGUI_Shape::update( bool isUpdateViewer,
 void HYDROGUI_Shape::setVisible( const bool theState,
                                  const bool theIsUpdateViewer )
 {
+  DEBTRACE("setVisible")
   myIsVisible = theState;
 
   if ( myShapes.empty() )
@@ -407,6 +412,7 @@ void HYDROGUI_Shape::setVisible( const bool theState,
 
 void HYDROGUI_Shape::highlight( bool theIsHighlight, bool isUpdateViewer )
 {
+  DEBTRACE("highlight " << theIsHighlight << " " << isUpdateViewer);
   if ( myIsHighlight == theIsHighlight )
     return;
 
@@ -421,6 +427,7 @@ void HYDROGUI_Shape::highlight( bool theIsHighlight, bool isUpdateViewer )
 
 bool HYDROGUI_Shape::isHighlighted() const
 {
+  DEBTRACE("isHighlighted " << myIsHighlight);
   return myIsHighlight;
 }
 
@@ -659,6 +666,7 @@ void HYDROGUI_Shape::buildShape()
 void HYDROGUI_Shape::updateShape( const bool theToDisplay,
                                   const bool theIsUpdateViewer )
 {
+  DEBTRACE("updateShape " << theToDisplay << " " << theIsUpdateViewer);
   foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
   {
     const Handle(Prs3d_Drawer)& anAttributes = aShape->Attributes();
@@ -691,14 +699,16 @@ void HYDROGUI_Shape::updateShape( const bool theToDisplay,
 
 void HYDROGUI_Shape::displayShape( const bool theIsUpdateViewer )
 {
+  DEBTRACE("displayShape " << theIsUpdateViewer << " " << mySelectionMode);
 //   if ( myContext->HasOpenedContext() && mySelectionMode > 0 )
 //     myContext->CloseLocalContext();
 
   foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
   {
-    if ( mySelectionMode > 0 )
+    if ( mySelectionMode >= 0 )
       // Display object in local context with selection
-      myContext->Display( aShape, myDisplayMode, mySelectionMode, Standard_False, Standard_False );
+        //myContext->Display( aShape, myDisplayMode, mySelectionMode, Standard_False, Standard_False );
+        myContext->Display( aShape, Standard_False );
     else
     {
 //       if ( !myContext->HasOpenedContext() )
@@ -710,9 +720,9 @@ void HYDROGUI_Shape::displayShape( const bool theIsUpdateViewer )
     }
   }
 
-  if ( mySelectionMode > 0 )
+  if ( mySelectionMode >= 0 )
   {
-    //myContext->OpenLocalContext();
+    //myContext->Deactivate(); //OpenLocalContext();
     foreach( Handle(AIS_InteractiveObject) aShape, myShapes )
       myContext->Activate( aShape, mySelectionMode, Standard_True );
   }
index 20901f2b6c9dd78e10be7a8656b53d06bcc743b5..7401f43e958c3d8defd6c392c803366f285a6af8 100644 (file)
@@ -65,7 +65,7 @@ HYDROGUI_VTKPrsDisplayer::~HYDROGUI_VTKPrsDisplayer()
 }
 
 void HYDROGUI_VTKPrsDisplayer::SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
-                                      const int theViewerId )
+                                      const size_t theViewerId )
 {
   SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
   if( !aViewer )
@@ -86,7 +86,7 @@ void HYDROGUI_VTKPrsDisplayer::SetToUpdate( const HYDROData_SequenceOfObjects& t
   }
 }
 
-void HYDROGUI_VTKPrsDisplayer::DisplayAll( const int theViewerId,
+void HYDROGUI_VTKPrsDisplayer::DisplayAll( const size_t theViewerId,
                                            const bool theIsForced,
                                            const bool theDoFitAll )
 {
@@ -123,7 +123,7 @@ void HYDROGUI_VTKPrsDisplayer::DisplayAll( const int theViewerId,
     EraseScalarBar( theViewerId );
 }
 
-void HYDROGUI_VTKPrsDisplayer::EraseAll( const int theViewerId )
+void HYDROGUI_VTKPrsDisplayer::EraseAll( const size_t theViewerId )
 {
   SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
   if( aViewer )
@@ -134,7 +134,7 @@ void HYDROGUI_VTKPrsDisplayer::EraseAll( const int theViewerId )
   }
 }
 
-void HYDROGUI_VTKPrsDisplayer::EraseScalarBar( const int theViewerId, const bool theIsDelete )
+void HYDROGUI_VTKPrsDisplayer::EraseScalarBar( const size_t theViewerId, const bool theIsDelete )
 {
   SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
   if( aViewer )
@@ -163,7 +163,7 @@ void HYDROGUI_VTKPrsDisplayer::EraseScalarBar( const int theViewerId, const bool
 }
 
 void HYDROGUI_VTKPrsDisplayer::Erase( const HYDROData_SequenceOfObjects& theObjs,
-                                const int theViewerId )
+                                const size_t theViewerId )
 {
   SVTK_Viewer* aViewer = module()->getVTKViewer( theViewerId );
   if( aViewer )
@@ -189,7 +189,7 @@ void HYDROGUI_VTKPrsDisplayer::Erase( const HYDROData_SequenceOfObjects& theObjs
 }
 
 void HYDROGUI_VTKPrsDisplayer::Display( const HYDROData_SequenceOfObjects& theObjs,
-                                        const int theViewerId,
+                                        const size_t theViewerId,
                                         const bool theIsForced,
                                         const bool theDoFitAll)
 {
@@ -310,7 +310,7 @@ void HYDROGUI_VTKPrsDisplayer::Display( const HYDROData_SequenceOfObjects& theOb
   }
 }
 
-void HYDROGUI_VTKPrsDisplayer::purgeObjects( const int theViewerId )
+void HYDROGUI_VTKPrsDisplayer::purgeObjects( const size_t theViewerId )
 {
   bool doEraseScalarBar = false;
 
@@ -373,7 +373,7 @@ void HYDROGUI_VTKPrsDisplayer::purgeObjects( const int theViewerId )
   }
 }
 
-HYDROGUI_VTKPrsDriver* HYDROGUI_VTKPrsDisplayer::getDriver( const int theViewId, const Handle(HYDROData_Entity)& theObj )
+HYDROGUI_VTKPrsDriver* HYDROGUI_VTKPrsDisplayer::getDriver( const size_t theViewId, const Handle(HYDROData_Entity)& theObj )
 {
   HYDROGUI_VTKPrsDriver* aDriver = NULL;
   ObjectKind aKind = theObj->GetKind();
@@ -402,17 +402,17 @@ QString HYDROGUI_VTKPrsDisplayer::GetType() const
   return SVTK_Viewer::Type();
 }
 
-void HYDROGUI_VTKPrsDisplayer::SetZRange( const int theViewId, double theRange[] )
+void HYDROGUI_VTKPrsDisplayer::SetZRange( const size_t theViewId, double theRange[] )
 {
   myScalarBars[ theViewId ]->GetLookupTable()->SetRange( theRange );
 }
 
-double* HYDROGUI_VTKPrsDisplayer::GetZRange( const int theViewId ) const
+double* HYDROGUI_VTKPrsDisplayer::GetZRange( const size_t theViewId ) const
 {
   return myScalarBars[ theViewId ]->GetLookupTable()->GetRange();
 }
 
-void HYDROGUI_VTKPrsDisplayer::createScalarBar( const int theViewId )
+void HYDROGUI_VTKPrsDisplayer::createScalarBar( const size_t theViewId )
 {
   if ( !myScalarBars.contains( theViewId ) )
   {
index 403bae9c2211411d7681a454c6edab7157d489ef..e9beb9b268fb27fbe1b4c29e491c96db1d2e29f4 100644 (file)
@@ -50,7 +50,7 @@ public:
    * \param theViewerId viewer identifier
    */
   void             SetToUpdate( const HYDROData_SequenceOfObjects& theObjs,
-                                const int theViewerId );
+                                const size_t theViewerId );
 
   /**
    * \brief Get the applicable viewer type.
@@ -60,22 +60,22 @@ public:
   /**
    * \brief Set the range of Z values for the color legend bar.
    */
-  void             SetZRange( const int theViewerId, double theRange[] );
+  void             SetZRange( const size_t theViewerId, double theRange[] );
 
   /**
    * \brief Get the range of Z values for the color legend bar.
    */
-  double*          GetZRange( const int theViewerId ) const;
+  double*          GetZRange( const size_t theViewerId ) const;
 
   /**
    * \brief Delete scalar bar for the given viewer id.
    * \param theViewerId viewer identifier
    */
-  void             EraseScalarBar( const int theViewerId, const bool theIsDelete = false );
+  void             EraseScalarBar( const size_t theViewerId, const bool theIsDelete = false );
 
 protected:
 
-  virtual void     DisplayAll( const int theViewerId,
+  virtual void     DisplayAll( const size_t theViewerId,
                                const bool theIsForced,
                                const bool theDoFitAll );
 
@@ -83,7 +83,7 @@ protected:
    * \brief Erase all viewer objects.
    * \param theViewerId viewer identifier
    */
-  void             EraseAll( const int theViewerId );
+  void             EraseAll( const size_t theViewerId );
 
   /**
    * \brief Erase the specified viewer objects.
@@ -91,7 +91,7 @@ protected:
    * \param theViewerId viewer identifier
    */
   void             Erase( const HYDROData_SequenceOfObjects& theObjs,
-                          const int theViewerId );
+                          const size_t theViewerId );
 
   /**
    * \brief Display the specified viewer objects.
@@ -101,7 +101,7 @@ protected:
    * \param theDoFitAll flag used to fit the view to all visible objects; do not fit by default
    */
   void             Display( const HYDROData_SequenceOfObjects& theObjs,
-                            const int theViewerId,
+                            const size_t theViewerId,
                             const bool theIsForced,
                             const bool theDoFitAll );
 
@@ -110,7 +110,7 @@ protected:
    * \brief Purge all invalid objects in the viewer.
    * \param theViewerId viewer identifier
    */
-  void             purgeObjects( const int theViewerId );
+  void             purgeObjects( const size_t theViewerId );
 
 private:
 
@@ -118,18 +118,18 @@ private:
    * \brief Create a new scalar bar for the given view id.
    * \param theViewId view identifier
    */
-  void             createScalarBar( const int theViewId );
+  void             createScalarBar( const size_t theViewId );
 
   /**
    * \brief Get the presentation driver for the specified data object.
    * \param theObj data object
    */
-  HYDROGUI_VTKPrsDriver* getDriver( const int theViewId, const Handle(HYDROData_Entity)& theObj );
+  HYDROGUI_VTKPrsDriver* getDriver( const size_t theViewId, const Handle(HYDROData_Entity)& theObj );
 
   HYDROGUI_VTKPrsDriver*       myDriver;
   HYDROGUI_VTKPrsDriver*       myShapeDriver;
 
-  QMap<int, vtkSmartPointer<vtkScalarBarActor> > myScalarBars; //!< Colors legend presentations
+  QMap<size_t, vtkSmartPointer<vtkScalarBarActor> > myScalarBars; //!< Colors legend presentations
 };
 
 #endif
index c4219ae2d51167a9176153074562f0afa1fe441e..c350a2198a27881c2ff92cca78779ccf5178985b 100644 (file)
@@ -152,7 +152,7 @@ void TestViewer::show( const Handle(AIS_InteractiveObject)& theObject,
 
   if( theSelectionMode > 0 )
   {
-    //context()->OpenLocalContext();
+    context()->Deactivate(); //OpenLocalContext();
     context()->Display( theObject, theMode, theSelectionMode, true );
     context()->Activate( theObject, theSelectionMode, Standard_True );
   }