From d22ca9f71017a1ac0199071afba018620e71176d Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Sun, 13 Sep 2020 22:32:29 +0200 Subject: [PATCH] fix highlight: int instead of size_t in OCC_Selector. Look for other similar errors on view ids --- src/HYDROGUI/HYDROGUI_DataModel.cxx | 8 +++++-- src/HYDROGUI/HYDROGUI_Module.cxx | 25 ++++++++++----------- src/HYDROGUI/HYDROGUI_Module.h | 8 +++---- src/HYDROGUI/HYDROGUI_OCCSelector.cxx | 6 ++--- src/HYDROGUI/HYDROGUI_ShapeLandCoverMap.cxx | 2 +- src/HYDROGUI/HYDROGUI_VisualStateOp.cxx | 2 +- 6 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_DataModel.cxx b/src/HYDROGUI/HYDROGUI_DataModel.cxx index 90f5aee8..99a67e8d 100644 --- a/src/HYDROGUI/HYDROGUI_DataModel.cxx +++ b/src/HYDROGUI/HYDROGUI_DataModel.cxx @@ -75,7 +75,7 @@ #include #endif -//#define _DEVDEBUG_ +#define _DEVDEBUG_ #include "HYDRO_trace.hxx" static HYDROData_SequenceOfObjects myCopyingObjects; @@ -653,7 +653,7 @@ Handle(HYDROData_Entity) HYDROGUI_DataModel::objectByEntry( const QString& theEn QString anEntry = theEntry; if( anEntry.indexOf( "_" ) != -1 ) // reference object anEntry = anEntry.section( "_", -1 ); - + //DEBTRACE("objectByEntry: " << anEntry.toStdString() << " kind: " << theObjectKind); Handle(HYDROData_Document) aDocument = getDocument(); if( !aDocument.IsNull() ) { @@ -664,8 +664,12 @@ Handle(HYDROData_Entity) HYDROGUI_DataModel::objectByEntry( const QString& theEn if( !anObject.IsNull() ) { QString anEntryRef = HYDROGUI_DataObject::dataObjectEntry( anObject ); + //DEBTRACE(" anEntryRef " << anEntryRef.toStdString()); if( anEntryRef == anEntry ) + { + //DEBTRACE(" found!"); return anObject; + } } } } diff --git a/src/HYDROGUI/HYDROGUI_Module.cxx b/src/HYDROGUI/HYDROGUI_Module.cxx index 5eafac64..5ce22f7c 100755 --- a/src/HYDROGUI/HYDROGUI_Module.cxx +++ b/src/HYDROGUI/HYDROGUI_Module.cxx @@ -1028,7 +1028,7 @@ void HYDROGUI_Module::preferencesChanged( const QString& theSection, const QStri ViewManagerMap::const_iterator it = myViewManagerMap.begin(), last = myViewManagerMap.end(); for( ; it!=last; it++ ) { - int aViewerId = it.key(); + size_t aViewerId = it.key(); OCCViewer_ViewManager* aMgr = dynamic_cast( it.value().first ); if( aMgr ) getOCCDisplayer()->UpdatePolylines( aViewerId, aType, aSize ); @@ -1268,8 +1268,8 @@ void HYDROGUI_Module::setViewManagerRole( SUIT_ViewManager* theViewManager, const ViewManagerRole theRole ) { DEBTRACE("HYDROGUI_Module::setViewManagerRole"); - int anId = getViewManagerId( theViewManager ); - if( anId != -1 ) + size_t anId = getViewManagerId( theViewManager ); + if( anId != 0 ) { ViewManagerInfo& anInfo = myViewManagerMap[ anId ]; anInfo.second = theRole; @@ -1756,8 +1756,8 @@ void HYDROGUI_Module::onViewManagerRemoved( SUIT_ViewManager* theViewManager ) createSelector( theViewManager ); // replace the default selector - int anId = getViewManagerId( theViewManager ); - if( anId != -1 ) + size_t anId = getViewManagerId( theViewManager ); + if( anId != 0 ) { OCCViewer_ViewManager* anOCCViewManager = ::qobject_cast( myViewManagerMap[ anId ].first ); @@ -1765,7 +1765,7 @@ void HYDROGUI_Module::onViewManagerRemoved( SUIT_ViewManager* theViewManager ) { OCCViewer_Viewer* anOCCViewer = anOCCViewManager->getOCCViewer(); if ( anOCCViewer ) { - int aViewerId = (size_t)anOCCViewer; + size_t aViewerId = (size_t)anOCCViewer; removeViewShapes( aViewerId ); setLandCoversScalarMapModeOff( aViewerId ); } @@ -1882,7 +1882,7 @@ void HYDROGUI_Module::updateViewer( HYDROGUI_AbstractDisplayer* theDisplayer, const bool theDoFitAll ) { DEBTRACE("HYDROGUI_Module::updateViewer"); - QList aViewManagerIdList; + QList aViewManagerIdList; // currently, all views are updated ViewManagerMapIterator anIter( myViewManagerMap ); @@ -1897,7 +1897,7 @@ void HYDROGUI_Module::updateViewer( HYDROGUI_AbstractDisplayer* theDisplayer, } } - QListIterator anIdIter( aViewManagerIdList ); + QListIterator anIdIter( aViewManagerIdList ); while( anIdIter.hasNext() ) { theDisplayer->UpdateAll( anIdIter.next(), theIsInit, theIsForced, theDoFitAll ); @@ -2193,7 +2193,7 @@ void HYDROGUI_Module::dropObjects( const DataObjectList& what, SUIT_DataObject* } -Handle(HYDROData_StricklerTable) HYDROGUI_Module::getLandCoverColoringTable( const int theViewId ) const +Handle(HYDROData_StricklerTable) HYDROGUI_Module::getLandCoverColoringTable( const size_t theViewId ) const { Handle(HYDROData_StricklerTable) aTable; @@ -2204,7 +2204,7 @@ Handle(HYDROData_StricklerTable) HYDROGUI_Module::getLandCoverColoringTable( con return aTable; } -void HYDROGUI_Module::setLandCoverColoringTable( const int theViewId, +void HYDROGUI_Module::setLandCoverColoringTable( const size_t theViewId, const Handle(HYDROData_StricklerTable)& theTable ) { if ( !theTable.IsNull() ) { @@ -2212,12 +2212,12 @@ void HYDROGUI_Module::setLandCoverColoringTable( const int theViewId, } } -void HYDROGUI_Module::setLandCoversScalarMapModeOff( const int theViewId ) +void HYDROGUI_Module::setLandCoversScalarMapModeOff( const size_t theViewId ) { myLandCoverColoringMap.remove( theViewId ); } -bool HYDROGUI_Module::isLandCoversScalarMapModeOn( const int theViewId ) const +bool HYDROGUI_Module::isLandCoversScalarMapModeOn( const size_t theViewId ) const { return myLandCoverColoringMap.contains( theViewId ); } @@ -2231,7 +2231,6 @@ void HYDROGUI_Module::setObjectRemoved( const Handle(HYDROData_Entity)& theObjec if ( theObject->GetKind() == KIND_STRICKLER_TABLE ) { Handle(HYDROData_StricklerTable) aTable = Handle(HYDROData_StricklerTable)::DownCast( theObject ); - QList aViewIds; QMutableMapIterator anIter( myLandCoverColoringMap ); while ( anIter.hasNext() ) { if ( HYDROGUI_DataObject::dataObjectEntry( anIter.next().value() ) == diff --git a/src/HYDROGUI/HYDROGUI_Module.h b/src/HYDROGUI/HYDROGUI_Module.h index b8b57f38..fead3a71 100644 --- a/src/HYDROGUI/HYDROGUI_Module.h +++ b/src/HYDROGUI/HYDROGUI_Module.h @@ -239,27 +239,27 @@ public: * @return the Strickler table used for scalar map coloring of Land Covers in the given view; null - if scalar map coloring is off for the view */ - Handle(HYDROData_StricklerTable) getLandCoverColoringTable( const int theViewId ) const; + Handle(HYDROData_StricklerTable) getLandCoverColoringTable( const size_t theViewId ) const; /** * Set Strickler table to be used for Land Cover scalar map coloring in the given view. * @param theViewId the view id * @param theTable the Strickler table */ - void setLandCoverColoringTable( const int theViewId, + void setLandCoverColoringTable( const size_t theViewId, const Handle(HYDROData_StricklerTable)& theTable ); /** * Set Land Cover scalar map coloring mode off for the given view. * @param theViewId the view id */ - void setLandCoversScalarMapModeOff( const int theViewId ); + void setLandCoversScalarMapModeOff( const size_t theViewId ); /** * Check if Land Cover scalar map coloring mode is on in the given view. * @param theViewId the view id * @return true if the mode is on, false if the mode is off */ - bool isLandCoversScalarMapModeOn( const int theViewId ) const; + bool isLandCoversScalarMapModeOn( const size_t theViewId ) const; /** * Set object as removed. diff --git a/src/HYDROGUI/HYDROGUI_OCCSelector.cxx b/src/HYDROGUI/HYDROGUI_OCCSelector.cxx index 6bd771fa..15d9d3b3 100644 --- a/src/HYDROGUI/HYDROGUI_OCCSelector.cxx +++ b/src/HYDROGUI/HYDROGUI_OCCSelector.cxx @@ -85,7 +85,7 @@ void HYDROGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) if ( !aViewer ) return; - int aViewerId = (size_t)aViewer; + size_t aViewerId = (size_t)aViewer; Handle(AIS_InteractiveContext) aContext = aViewer->getAISContext(); if ( aContext.IsNull() ) { @@ -106,7 +106,6 @@ 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( (*itr).operator->() ); @@ -117,6 +116,7 @@ void HYDROGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) Handle(HYDROData_Entity) anEntity = myModule->getDataModel()->objectByEntry( anEntry ); if( !anEntity.IsNull() ) { + DEBTRACE("aViewerId, anEntity " << aViewerId << " " << anEntity.get()); HYDROGUI_Shape* aShape = myModule->getObjectShape( aViewerId, anEntity ); if( aShape && aShape->isVisible() ) { @@ -134,7 +134,7 @@ void HYDROGUI_OCCSelector::setSelection( const SUIT_DataOwnerPtrList& aList ) mySelectedExternals.append(*itr); } } - + DEBTRACE("aSelList.Size() " << aSelList.Size()); aViewer->unHighlightAll( false ); aViewer->setObjectsSelected( aSelList ); } diff --git a/src/HYDROGUI/HYDROGUI_ShapeLandCoverMap.cxx b/src/HYDROGUI/HYDROGUI_ShapeLandCoverMap.cxx index e3917683..3545fa82 100644 --- a/src/HYDROGUI/HYDROGUI_ShapeLandCoverMap.cxx +++ b/src/HYDROGUI/HYDROGUI_ShapeLandCoverMap.cxx @@ -113,7 +113,7 @@ QList HYDROGUI_ShapeLandCoverMap::createShape() c { if ( OCCViewer_Viewer* aViewer = aViewManager->getOCCViewer() ) { - int aViewerId = (size_t)aViewer; + size_t aViewerId = (size_t)aViewer; // Set Strickler table Handle(HYDROData_StricklerTable) aTable = diff --git a/src/HYDROGUI/HYDROGUI_VisualStateOp.cxx b/src/HYDROGUI/HYDROGUI_VisualStateOp.cxx index 9c866b85..7837456c 100644 --- a/src/HYDROGUI/HYDROGUI_VisualStateOp.cxx +++ b/src/HYDROGUI/HYDROGUI_VisualStateOp.cxx @@ -110,7 +110,7 @@ bool HYDROGUI_VisualStateOp::saveVisualState() setVisualProperty( aPropertyMap, "AP_ACTIVE_VIEW", aViewWindow->objectName() ); // C. Store view properties. - int aViewerId = 0; + size_t aViewerId = 0; QListIterator anIter( aViewManagerList ); while( anIter.hasNext() ) { -- 2.39.2