Salome HOME
refs #575, #580: display the information about the chosen land cover objects in the...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Zone.cxx
index 469695cf7525571c720343917491cc51119d3867..c1139e1e4e66153e03a82a6dddabb20245e7f8d7 100644 (file)
@@ -101,6 +101,7 @@ QString HYDROGUI_Zone::getObjectName() const
       QString aName;
       for ( ; anIter.More(); anIter.Next() )
       {
+        aName.clear();
         Handle(HYDROData_Object) aRefGeomObj =
           Handle(HYDROData_Object)::DownCast( anIter.Value() );
         if ( !aRefGeomObj.IsNull() )
@@ -116,13 +117,29 @@ QString HYDROGUI_Zone::getObjectName() const
               aRes = aName;
               break;
             }
-
-            if ( !aNamesSet.contains( aName ) )
+          }
+        }
+        else
+        {
+          Handle(HYDROData_LandCover) aRefLandCoverObj =
+            Handle(HYDROData_LandCover)::DownCast( anIter.Value() );
+          if ( !aRefLandCoverObj.IsNull() )
+          {
+            // Get name of land cover object
+            aName = aRefLandCoverObj->GetName();
+            if ( !isMergingNeed )
             {
-              aRes += aName + ", ";
-              aNamesSet.insert( aName );
+              // Get the first land cover object's altitude name and go out
+              aRes = aName;
+              break;
             }
-          }
+          }        
+        }
+
+        if ( !aName.isEmpty() && !aNamesSet.contains( aName ) )
+        {
+          aRes += aName + ", ";
+          aNamesSet.insert( aName );
         }
       }
       // Remove the last comma if necessary