Salome HOME
refs #585: polylines operations (split/merge)
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_DataModel.cxx
index 61f5453c82b9af3f3f129c9bab390edfee3fbbde..6255c5e5a2548e9c10aff48adf998b887a11c9c2 100644 (file)
@@ -978,7 +978,7 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent,
     LightApp_DataObject* aCaseRegionsSect = 
       createObject( aGuiObj, tr( "CASE_REGIONS" ), aGuiObj->entry() );
 
-    HYDROData_SequenceOfObjects aCaseRegions = aCaseObj->GetRegions();
+    HYDROData_SequenceOfObjects aCaseRegions = aCaseObj->GetRegions( false );
     HYDROData_SequenceOfObjects::Iterator anIter( aCaseRegions );
     for ( ; anIter.More(); anIter.Next() )
     {
@@ -988,6 +988,19 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent,
         createRegion( aCaseRegionsSect, aCaseRegion, "", true, theIsInOperation );
     }
 
+    LightApp_DataObject* aCaseLandCoverRegionsSect = 
+      createObject( aGuiObj, tr( "CASE_LAND_COVER_REGIONS" ), aGuiObj->entry() );
+
+    HYDROData_SequenceOfObjects aCaseLandCoverRegions = aCaseObj->GetRegions( true );
+    anIter.Init( aCaseLandCoverRegions );
+    for ( ; anIter.More(); anIter.Next() )
+    {
+      Handle(HYDROData_Region) aCaseLCRegion =
+        Handle(HYDROData_Region)::DownCast( anIter.Value() );
+      if( !aCaseLCRegion.IsNull() && !aCaseLCRegion->IsRemoved() )
+        createRegion( aCaseLandCoverRegionsSect, aCaseLCRegion, "", true, theIsInOperation );
+    }
+    
 #ifdef DEB_GROUPS
     HYDROData_SequenceOfObjects aCalcGroups = aCaseObj->GetGeometryGroups();
     buildObjectPartition( aGuiObj, aCalcGroups, tr( "OBJECT_GROUPS" ), false );
@@ -1058,9 +1071,19 @@ void HYDROGUI_DataModel::buildObjectTree( SUIT_DataObject* theParent,
       createObject( aGuiObj, aBottomPolyline, aGuiObj->entry(), false );
     }
   }
+  else if ( anObjectKind == KIND_LAND_COVER )
+  {
+    Handle(HYDROData_LandCover) aLandCoverObj =
+      Handle(HYDROData_LandCover)::DownCast( aDataObj );
+
+    HYDROData_SequenceOfObjects aPolylines = aLandCoverObj->GetPolylines();
+    buildObjectPartition( aGuiObj, aPolylines, tr( "LAND_COVER_POLYLINES" ), true );
+  }
+  
 }
 
-void HYDROGUI_DataModel::buildCaseTree( SUIT_DataObject* theParent, Handle(HYDROData_CalculationCase) theCase )
+void HYDROGUI_DataModel::buildCaseTree( SUIT_DataObject* theParent, Handle(HYDROData_CalculationCase) theCase,
+                                        const bool theLandCover )
 {
   if ( !theCase.IsNull() )
   {
@@ -1076,7 +1099,7 @@ void HYDROGUI_DataModel::buildCaseTree( SUIT_DataObject* theParent, Handle(HYDRO
 
     new HYDROGUI_DropTargetObject( theParent, tr( "NEW_REGION" ), "", true );
 
-    HYDROData_SequenceOfObjects aCaseRegions = theCase->GetRegions();
+    HYDROData_SequenceOfObjects aCaseRegions = theCase->GetRegions( theLandCover );
     HYDROData_SequenceOfObjects::Iterator anIter( aCaseRegions );
     for ( ; anIter.More(); anIter.Next() )
     {
@@ -1147,7 +1170,8 @@ SUIT_DataObject* HYDROGUI_DataModel::findChildByName( const SUIT_DataObject* the
 }
 
 bool HYDROGUI_DataModel::createNewRegion( Handle(HYDROData_CalculationCase) theCase, 
-                                         const QList<HYDROGUI_Zone*>& theZonesList )
+                                         const QList<HYDROGUI_Zone*>& theZonesList,
+                                         const bool theLandCover )
 {
   bool isOk = !theCase.IsNull();
   if ( isOk )
@@ -1161,7 +1185,7 @@ bool HYDROGUI_DataModel::createNewRegion( Handle(HYDROData_CalculationCase) theC
       {
         if ( aRegion.IsNull() )
         {
-          aRegion = theCase->AddNewRegion( aZone );
+          aRegion = theCase->AddNewRegion( aZone, theLandCover );
           isOk = !aRegion.IsNull();
         }
         else