Salome HOME
lot 10 - warnings for DTM - untested
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_PolylineOp.cxx
index 486b182e5d150c5ddac9831350c8fb08cd2bc4a1..9c3ffd7e27e52ea4b7fee172becc8913b0439f4f 100755 (executable)
@@ -22,6 +22,7 @@
 #include "HYDROGUI_DataObject.h"
 #include "HYDROGUI_PolylineDlg.h"
 #include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Tool2.h"
 #include "HYDROGUI_UpdateFlags.h"
 
 #include <HYDROData_Document.h>
@@ -30,6 +31,7 @@
 
 #include <CurveCreator_Curve.hxx>
 #include <CurveCreator_Displayer.hxx>
+#include <CurveCreator_Utils.hxx>
 
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
@@ -152,7 +154,10 @@ void HYDROGUI_PolylineOp::startOperation()
     NCollection_Sequence<TCollection_AsciiString>           aSectNames;
     NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
     NCollection_Sequence<bool>                              aSectClosures;
+    bool aIsInCustom = myEditedObject->GetIsInCustomFlag();
+    myEditedObject->SetIsInCustomFlag( true );
     myEditedObject->GetSections( aSectNames, aSectTypes, aSectClosures );
+    myEditedObject->SetIsInCustomFlag( aIsInCustom );
 
     if (!aSectNames.IsEmpty())
     {
@@ -178,8 +183,12 @@ void HYDROGUI_PolylineOp::startOperation()
           aCurveCoords.push_back( aSectPoint.Y() );
         }
 
+        Quantity_Color aColor = CurveCreator_Utils::getRandColor();      
+        QColor aQColor = CurveCreator_Utils::colorConv(aColor);
+        myEditedObject->GetSectionColor(i-1, aQColor);
+
         myCurve->addSectionInternal( aSectName.toStdString(),
-          aCurveType, aSectClosure, aCurveCoords );
+          aCurveType, aSectClosure, aCurveCoords, CurveCreator_Utils::colorConv(aQColor) );
       }
     }
     else
@@ -235,7 +244,7 @@ void HYDROGUI_PolylineOp::startOperation()
         for (int aSI = 0; aSI < aSCount; ++aSI)
         {
           myCurve->addSectionInternal((aNamePrefix + (aSI + 1)).ToCString(),
-            CurveCreator::Spline, isCloseds[aSI], aPs[aSI]);
+            CurveCreator::Spline, isCloseds[aSI], aPs[aSI], CurveCreator_Utils::getRandColor());
         }
       }
     }
@@ -349,8 +358,11 @@ bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags,
 
     aPolylineObj->AddSection( aSectName, aSectType, aSectClosure );
 
-    // Add the points fro section
-    CurveCreator::Coordinates aCurveCoords = myCurve->getPoints( i );
+    Quantity_Color aColor = myCurve->getColorSection(i);
+    aPolylineObj->SetSectionColor(i, CurveCreator_Utils::colorConv(aColor));
+
+    // Add the points from section
+    CurveCreator::Coordinates aCurveCoords = myCurve->getCoords( i );
 
     if ( aCurveCoords.size() <= 2 )
     {
@@ -370,10 +382,10 @@ bool HYDROGUI_PolylineOp::processApply( int& theUpdateFlags,
     }
   }
 
 if ( !myIsEdit )
 {
   aPolylineObj->SetWireColor( HYDROData_PolylineXY::DefaultWireColor() );
 }
//if ( !myIsEdit )
//{
//  aPolylineObj->SetWireColor( HYDROData_PolylineXY::DefaultWireColor() );
//}
 
   // Update the wire of polyline
   aPolylineObj->Update();