From 56e8f7f64b5444a493410eaf9c5cb914a75f48e5 Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@orfeo-toolbox.org>
Date: Tue, 10 Mar 2009 15:25:13 +0100
Subject: [PATCH] ENH: (Visu Refactoring) Adding a Visible status flag to
 GlComponent

---
 Code/VisuRefac/otbCurves2DWidget.cxx |  5 ++++-
 Code/VisuRefac/otbGlComponent.h      | 10 +++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/Code/VisuRefac/otbCurves2DWidget.cxx b/Code/VisuRefac/otbCurves2DWidget.cxx
index 318f5d9c15..7fd9754287 100644
--- a/Code/VisuRefac/otbCurves2DWidget.cxx
+++ b/Code/VisuRefac/otbCurves2DWidget.cxx
@@ -264,7 +264,10 @@ void Curves2DWidget::RenderCurves()
   for(CurveListType::Iterator it = m_Curves->Begin();
       it!=m_Curves->End(); ++it)
     {
-    it.Get()->Render(m_Extent,m_SpaceToScreenTransform);
+    if(it.Get()->GetVisible())
+      {
+      it.Get()->Render(m_Extent,m_SpaceToScreenTransform);
+      }
     }
 }
 
diff --git a/Code/VisuRefac/otbGlComponent.h b/Code/VisuRefac/otbGlComponent.h
index cb01b308b8..2dc765c56b 100644
--- a/Code/VisuRefac/otbGlComponent.h
+++ b/Code/VisuRefac/otbGlComponent.h
@@ -56,9 +56,14 @@ public:
   /// Render the curve according to display extent and axis characteristics
   virtual void  Render(const RegionType& extent,const AffineTransformType * space2ScreenTransform) = 0;
 
+  /** Set/Get the visible status */
+  itkSetMacro(Visible,bool);
+  itkGetMacro(Visible,bool);
+  itkBooleanMacro(Visible);
+
 protected:
   /** Constructor */
-  GlComponent()
+  GlComponent() : m_Visible(true)
   {}
   /** Destructor */
   virtual ~GlComponent(){}
@@ -72,6 +77,9 @@ private:
   GlComponent(const Self&);     // purposely not implemented
   void operator=(const Self&); // purposely not implemented
 
+  /// Is the component visible ?
+  bool m_Visible;
+
 }; // end class 
 } // end namespace otb
 
-- 
GitLab