Salome HOME
lot 10 - warnings for DTM - untested
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ProfileOp.cxx
index a7ae37ffb0e6844fe49b7f21c24e654074d6784c..0ad3e45ac4789506905d246b01f21e111f815952 100644 (file)
@@ -30,6 +30,7 @@
 #include <CurveCreator_Displayer.hxx>
 #include <HYDROData_Entity.h>
 #include <QSet>
+#include <set>
 
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
@@ -223,7 +224,8 @@ void HYDROGUI_ProfileOp::startOperation()
     {
       HYDROGUI_CurveCreatorProfile* CC = myProfiles[i];
       const Handle(HYDROData_Profile)& CP = myCurveToProfile.Find(CC);
-      const QColor& CurCol = PColors[i]; 
+      QColor CurCol = PColors[i]; 
+      CP->GetProfileColor(CurCol);
       CurveToColor[CC] = CurCol;
       const QString& profName = CP->GetName();
       const QColor& PColor = CurCol;
@@ -261,7 +263,7 @@ void HYDROGUI_ProfileOp::onAddProfiles()
   int ExistingProfLen = myEditedObjects.Length();
   for (int i = 1; i <= aSelectedObj.Length(); i++)
   {
-    Handle(HYDROData_Entity) CurProf = Handle(HYDROData_Entity)::DownCast(aSelectedObj(i));
+    Handle(HYDROData_Profile) CurProf = Handle(HYDROData_Profile)::DownCast(aSelectedObj.Value(i));
     if (CurProf.IsNull())
       continue;
     if (!edObjNamesMap.contains(CurProf->GetName()))
@@ -292,6 +294,7 @@ void HYDROGUI_ProfileOp::onAddProfiles()
     for (int i = ExistingProfLen + 1; i <= NewLen; i++)
     {
       Handle(HYDROData_Profile) aCProfile = Handle(HYDROData_Profile)::DownCast(myEditedObjects(i)); 
+
       QString aProfileName;
       if( !aCProfile.IsNull() )
       {
@@ -313,7 +316,8 @@ void HYDROGUI_ProfileOp::onAddProfiles()
     {
       HYDROGUI_CurveCreatorProfile* CC = myProfiles[i];
       const Handle(HYDROData_Profile)& CP = myCurveToProfile.Find(CC);
-      const QColor& CurCol = PColors[i-ExistingProfLen]; 
+      QColor CurCol = PColors[i-ExistingProfLen]; 
+      CP->GetProfileColor(CurCol);
       CurveToColor[CC] = CurCol;
       const QString& profName = CP->GetName();
       const QColor& PColor = CurCol;
@@ -351,7 +355,8 @@ HYDROGUI_InputPanel* HYDROGUI_ProfileOp::createInputPanel() const
     SLOT( onRemoveProfile(int) ) );  
   return aDlg;
 }
-#include <set>
+
+
 bool HYDROGUI_ProfileOp::processApply( int& theUpdateFlags,
                                        QString& theErrorMsg,
                                        QStringList& theBrowseObjectsEntries )
@@ -397,6 +402,7 @@ bool HYDROGUI_ProfileOp::processApply( int& theUpdateFlags,
     {
       Handle(HYDROData_Profile) HProf = Handle(HYDROData_Profile)::DownCast(myEditedObjects(i));
       int stat = CurveCrProfileToHProfile(myProfiles[i-1], HProf, aProfileNamesFiltered[i-1], true);
+      HProf->SetProfileColor(HYDROData_Tool::toQtColor(myProfiles[i-1]->getColorSection(0)));
       if (stat == 0)
         continue;
       else if (stat == -1)
@@ -412,6 +418,7 @@ bool HYDROGUI_ProfileOp::processApply( int& theUpdateFlags,
   {
     Handle(HYDROData_Profile) aNewProfileObj = Handle(HYDROData_Profile)::DownCast( doc()->CreateObject( KIND_PROFILE ) ); 
     int stat = CurveCrProfileToHProfile(myProfiles[0], aNewProfileObj, aProfileNamesFiltered[0], false);
+    aNewProfileObj->SetProfileColor(HYDROData_Tool::toQtColor(myProfiles[0]->getColorSection(0)));
     if (stat == 0)
       return false;
     else if (stat == -1)
@@ -452,7 +459,7 @@ void HYDROGUI_ProfileOp::displayPreviews(const QMap<HYDROGUI_CurveCreatorProfile
         Quantity_Color CurOCCCol = HYDROData_Tool::toOccColor(QCurCol);
         CC->setDisplayer( myDisplayer );
         CC->myPointAspectColor = CurOCCCol;
-        CC->myCurveColor = CurOCCCol;
+        CC->setColorSectionInternal(0, CurOCCCol);
         CC->myLineWidth = 1;
         myDisplayer->display( CC->getAISObject( true ), true );
       }