Salome HOME
Merge remote-tracking branch 'origin/BR_LAND_COVER' into BR_v14_rc
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_LandCoverOp.cxx
index d8b4fdc36811221377d778809512b54583fd8076..75c4ce082a4225d2a7a445ddfc46c11c401244b1 100644 (file)
@@ -80,24 +80,16 @@ void HYDROGUI_LandCoverOp::startOperation()
     {
       anObjectName = myEditedObject->GetName();
 
-      // TODO: Temporary commented until getPolylinesCount, GetPolyline and GetStricklerType data model methods will be implemented
-      /*
-      int nNoPolylines = myEditedObject->getPolylinesCount();
-      for (int i=0; i<nNoPolylines; i++)
-      {
-        Handle(HYDROData_PolylineXY) aRefPolyline = myEditedObject->GetPolyline(i);
-        if ( !aRefPolyline.IsNull() )
-          aSelectedPolylines.append( aRefPolyline->GetName() );
+      HYDROData_SequenceOfObjects aRefPolylines = myEditedObject->GetPolylines();
+      for ( int i = aRefPolylines.Lower(); i <= aRefPolylines.Upper(); i++ ) {
+        Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast( aRefPolylines.Value( i ) );
+        if ( !aPolyline.IsNull() ) {
+          aSelectedPolylines.append( aPolyline->GetName() );
+        }
       }
-
-      aSelectedStricklerType = myEditedObject->GetStricklerType();
-      */
-
-      // The code below is a sample of data filling Land cover object
-      aSelectedPolylines.append( "Lake_1" );
-      aSelectedPolylines.append( "Polyline_1" );
-      aSelectedStricklerType = "Canaux naturels";
     }
+
+    aSelectedStricklerType = myEditedObject->GetStricklerType();
   }
 
   aPanel->setObjectName( anObjectName );
@@ -111,17 +103,11 @@ void HYDROGUI_LandCoverOp::startOperation()
       Handle(HYDROData_StricklerTable)::DownCast( anIterator.Current() );      
     if ( !aStricklerTableObj.IsNull() )
     {
-      // TODO: implement GetTypes method in data model
-      //QStringList aTypes = aStricklerTableObj->GetTypes();
-      // The code below is a sample of data filling list of Strickler types
-      QStringList aTypes;
-      aTypes.append("Zones de champs, prairies, sans cultures");
-      aTypes.append("Canaux naturels");
-      aTypes.append("Zones à faible urbanization (bourg)");
-      QStringList::const_iterator anIt = aTypes.begin(), aLast = aTypes.end();
-      for( ; anIt!=aLast; anIt++ )
+      // Get Strickler table data from the data model
+      TColStd_SequenceOfExtendedString aTypes = aStricklerTableObj->GetTypes();
+      for ( int i = 1; i <= aTypes.Length(); i++ )
       {
-        QString aType = *anIt;
+        QString aType = HYDROGUI_Tool::ToQString( aTypes.Value( i ) );
         if ( !aType.isEmpty() && !aStricklerTypes.contains( aType ))
           aStricklerTypes.append( aType );
       }
@@ -184,7 +170,7 @@ bool HYDROGUI_LandCoverOp::processApply( int& theUpdateFlags,
     }
   }
 
-  QList<Handle(HYDROData_PolylineXY)> aZonePolylines;
+  HYDROData_SequenceOfObjects aZonePolylines;
   QString aStricklerType;
 
   QStringList aSelectedPolylineNames = aPanel->getSelectedPolylineNames();
@@ -194,7 +180,7 @@ bool HYDROGUI_LandCoverOp::processApply( int& theUpdateFlags,
     QString aPolylineName = *anIt;
     if ( !aPolylineName.isEmpty() )
     {
-      aZonePolylines.append( Handle(HYDROData_PolylineXY)::DownCast(
+      aZonePolylines.Append( Handle(HYDROData_PolylineXY)::DownCast(
         HYDROGUI_Tool::FindObjectByName( module(), aPolylineName, KIND_POLYLINEXY ) ) );
     }
   }
@@ -215,19 +201,14 @@ bool HYDROGUI_LandCoverOp::processApply( int& theUpdateFlags,
 
   aZoneObj->SetName( anObjectName );
 
-  // TODO: Temporary commented until SetFillingColor, DefaultFillingColor,
-  // SetBorderColor and DefaultBorderColor data model methods will be implemented
-  /*
   if ( !myIsEdit )
   {    
     aZoneObj->SetFillingColor( HYDROData_LandCover::DefaultFillingColor() );
     aZoneObj->SetBorderColor( HYDROData_LandCover::DefaultBorderColor() );
   }
-  */
 
-  // TODO: Temporary commented until SetPolylines and SetStricklerType data model methods will be implemented
-  //aZoneObj->SetPolylines( aZonePolylines );
-  //aZoneObj->SetStricklerType( aSelectedStricklerType );
+  aZoneObj->SetPolylines( aZonePolylines );
+  aZoneObj->SetStricklerType( aSelectedStricklerType );
   aZoneObj->Update();
 
   closePreview();
@@ -288,9 +269,6 @@ void HYDROGUI_LandCoverOp::onCreatePreview( const QStringList& thePolylineNames
 
   if ( aViewManager && myPreviewPrs )
   {
-    // TODO: Temporary commented until GetFillingColor, DefaultFillingColor,
-    // GetBorderColor and DefaultBorderColor data model methods will be implemented
-    /*
     QColor aFillingColor = HYDROData_LandCover::DefaultFillingColor();
     QColor aBorderColor = HYDROData_LandCover::DefaultBorderColor();
     if ( !myEditedObject.IsNull() ) {
@@ -300,7 +278,6 @@ void HYDROGUI_LandCoverOp::onCreatePreview( const QStringList& thePolylineNames
 
     myPreviewPrs->setFillingColor( aFillingColor, false, false );
     myPreviewPrs->setBorderColor( aBorderColor, false, false );
-    */
 
     TopoDS_Face aFace;
     if( !aZoneShape.IsNull() )