]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
fix bug abort when viewId is 0 on displaying images (import images)
authorPaul RASCLE <paul.rascle@openfields.fr>
Fri, 9 Oct 2020 08:52:15 +0000 (10:52 +0200)
committerYOANN AUDOUIN <B61570@dsp0851742.postes.calibre.edf.fr>
Fri, 30 Oct 2020 16:09:38 +0000 (17:09 +0100)
src/HYDROGUI/HYDROGUI_LandCoverColoringOp.cxx
src/HYDROGUI/HYDROGUI_Module.cxx

index 2b17f3e879fad1b1094a88eac325108c015e6d30..bd495e2b190081996f8678bdf21cddb208394bb1 100644 (file)
@@ -68,7 +68,7 @@ void HYDROGUI_LandCoverColoringOp::startOperation()
 
   if ( myId == LandCoverScalarMapModeOnId ) {
     aTable = Handle(HYDROData_StricklerTable)::DownCast( HYDROGUI_Tool::GetSelectedObject( module() ) );
-    if ( !aTable.IsNull() ) {
+    if ( !aTable.IsNull() && aViewId) {
       aModule->setLandCoverColoringTable( aViewId, aTable );
     }
   } else if ( myId == LandCoverScalarMapModeOffId ) {
index 3a64a59624b57a9d882c0ebc6f7e0ed92aa04dd7..df571a98642342c27b48c2f627638087ca18641f 100755 (executable)
@@ -1321,12 +1321,16 @@ void HYDROGUI_Module::setObjectVisible( const size_t theViewId,
        DEBTRACE("anEntry: " << anEntry.toStdString());
        if (myObjectStateMap.find(theViewId) == myObjectStateMap.end())
        {
-               DEBTRACE("theViewId is not a valid key for myObjectStateMap, created");
+               DEBTRACE("theViewId is not a valid key for myObjectStateMap");
        }
-    Entry2ObjectStateMap& aEntry2ObjectStateMap = myObjectStateMap[ theViewId ]; // created OK if it does not exist
+    if (theViewId)
+    {
+        Entry2ObjectStateMap& aEntry2ObjectStateMap = myObjectStateMap[ theViewId ]; // created OK if it does not exist
+        DEBTRACE("myObjectStateMap key created");
 
-    ObjectState& anObjectState = aEntry2ObjectStateMap[ anEntry ];
-    anObjectState.Visibility = theState;
+        ObjectState& anObjectState = aEntry2ObjectStateMap[ anEntry ];
+        anObjectState.Visibility = theState;
+    }
 
     HYDROGUI_DataObject* hydroObject = getDataModel()->getDataObject( theObject );
     if ( hydroObject )
@@ -2204,7 +2208,7 @@ Handle(HYDROData_StricklerTable) HYDROGUI_Module::getLandCoverColoringTable( con
 void HYDROGUI_Module::setLandCoverColoringTable( const size_t theViewId,
                                                  const Handle(HYDROData_StricklerTable)& theTable )
 {
-  if ( !theTable.IsNull() ) {
+  if ( !theTable.IsNull() && theViewId ) {
     myLandCoverColoringMap.insert( theViewId, theTable );
   }
 }