diff --git a/Code/Visualization/otbCurves2DWidget.cxx b/Code/Visualization/otbCurves2DWidget.cxx index 7bd7a3a80b799c6d14c4c9cb69621dd56564a481..267b66f333c454201d7f134a15f1ca93a3c26d82 100644 --- a/Code/Visualization/otbCurves2DWidget.cxx +++ b/Code/Visualization/otbCurves2DWidget.cxx @@ -247,6 +247,11 @@ void Curves2DWidget::RenderAxis() screenLabelPosition[0] = this->w() - m_Margins[0] - 5 * m_XAxisLabel.size(); screenLabelPosition[1] = xAxisYPos - 10; gl_draw(m_XAxisLabel.c_str(), (float) screenLabelPosition[0], (float) screenLabelPosition[1]); + + // Draw the title of the curve + screenLabelPosition[0] = this->w() - m_Margins[0] - 7 * m_Title.size(); + screenLabelPosition[1] = this->h() - m_Margins[1] - 10; + gl_draw(m_Title.c_str(), (float) screenLabelPosition[0], (float) screenLabelPosition[1]); } void Curves2DWidget::RenderGrid() diff --git a/Code/Visualization/otbCurves2DWidget.h b/Code/Visualization/otbCurves2DWidget.h index f8585aac1e9a61cbe6e6c934869270dac846c837..9d812534ab5f5f389611004ece38b666362f6c09 100644 --- a/Code/Visualization/otbCurves2DWidget.h +++ b/Code/Visualization/otbCurves2DWidget.h @@ -136,6 +136,10 @@ public: /** Get curve by ID instead of index */ CurvePointerType GetCurveByItsId(unsigned int id); + /** Set the title of the curve */ + itkSetStringMacro(Title); + itkGetStringMacro(Title); + protected: /** Constructor */ Curves2DWidget(); @@ -200,6 +204,9 @@ private: // Space to screen transform AffineTransformPointerType m_SpaceToScreenTransform; + // Title + std::string m_Title; + }; // end class } // end namespace otb