Salome HOME
lot 3 - coloring of section in OCC view see also refs #1838
[modules/hydro.git] / src / HYDROData / HYDROData_IPolyline.cxx
index 1ec97913a28b97a035e8b46d213c000c7c06389d..ddd6908aa381f9cb8f1993dbeaa05c0361fdb444 100644 (file)
@@ -41,7 +41,11 @@ HYDROData_IPolyline::~HYDROData_IPolyline()
 
 void HYDROData_IPolyline::SetWireColor( const QColor& theColor )
 {
-  SetColor( theColor, DataTag_WireColor );
+  //SetColor( theColor, DataTag_WireColor ); //DEPRECATED;
+  //set theColor for all sections
+  int nbSec = NbSections();
+  for (int i = 0; i < nbSec; i++)
+    SetSectionColor(i, theColor);
 }
 
 QColor HYDROData_IPolyline::GetWireColor() const
@@ -168,7 +172,7 @@ void HYDROData_IPolyline::removePointsLists( const int theSectionIndex ) const
   }
 }
 
-bool HYDROData_IPolyline::getSectionColor( const int theSectionIndex, QColor &theColor) const
+bool HYDROData_IPolyline::GetSectionColor( const int theSectionIndex, QColor &theColor) const
 {
   TDF_Label aLabel = myLab.FindChild( DataTag_SectionColors, false );
   if ( aLabel.IsNull() )
@@ -189,8 +193,8 @@ bool HYDROData_IPolyline::getSectionColor( const int theSectionIndex, QColor &th
   }
 }
 
-void HYDROData_IPolyline::setSectionColor( const int theSectionIndex,
-                                           const QColor& theColor ) const
+void HYDROData_IPolyline::SetSectionColor( const int theSectionIndex,
+                                           const QColor& theColor )
 {
   TDF_Label aLabel = myLab.FindChild( DataTag_SectionColors, true );
   if ( aLabel.IsNull() )
@@ -228,3 +232,14 @@ void HYDROData_IPolyline::removeSectionColor( const int theSectionIndex ) const
       aSectLabel.ForgetAllAttributes();
   }
 }
+
+ void HYDROData_IPolyline::setPythonPolylineSectionColor( QStringList&  theScript,
+                                                          const int     theSectIndex,
+                                                          const QColor& theColor ) const
+{
+  QString anObjName = GetObjPyName();
+  theScript << QString( "%1.SetSectionColor( %2, QColor( %3, %4, %5, %6 ) )" )
+              .arg( anObjName ).arg( theSectIndex )
+              .arg( theColor.red()  ).arg( theColor.green() )
+              .arg( theColor.blue() ).arg( theColor.alpha() );
+}