diff --git a/Code/VisuRefac/otbCurve2D.h b/Code/VisuRefac/otbCurve2D.h index a1cc356c52157370390caca1a577fd9c8345ae21..871f613b96e790e6502ab943f4ababf8958f0212 100644 --- a/Code/VisuRefac/otbCurve2D.h +++ b/Code/VisuRefac/otbCurve2D.h @@ -18,10 +18,7 @@ #ifndef __otbCurve2D_h #define __otbCurve2D_h -#include "itkObject.h" -#include "itkImageRegion.h" -#include "itkAffineTransform.h" -#include "itkFixedArray.h" +#include "otbGlComponent.h" // FLTK includes #include <FL/gl.h> @@ -32,31 +29,28 @@ namespace otb /** \class Curve2D * \brief Base class Curves to be rendered in Curves2DWidget. * -* \sa ImageViewerModel +* \sa Curves2DWidget */ class Curve2D - : public itk::Object + : public GlComponent { public: /** Standard class typedefs */ typedef Curve2D Self; - typedef itk::Object Superclass; + typedef GlComponent Superclass; typedef itk::SmartPointer<Self> Pointer; typedef itk::SmartPointer<const Self> ConstPointer; typedef itk::ImageRegion<2> RegionType; // affine transform - typedef itk::AffineTransform<double,2> AffineTransformType; - typedef AffineTransformType::InputPointType PointType; - typedef AffineTransformType::InputVectorType VectorType; - typedef itk::FixedArray<double,4> ColorType; + typedef Superclass::AffineTransformType AffineTransformType; + typedef Superclass::PointType PointType; + typedef Superclass::VectorType VectorType; + typedef Superclass::ColorType ColorType; /** Runtime information */ - itkTypeMacro(Curve2D,Object); - - /// Render the curve according to display extent and axis characteristics - virtual void Render(const RegionType& extent,const AffineTransformType * space2ScreenTransform) = 0; + itkTypeMacro(Curve2D,GlComponent); /// This method is provided to do some computation before rendering virtual void BeforeRendering() {}; diff --git a/Code/VisuRefac/otbGlComponent.h b/Code/VisuRefac/otbGlComponent.h new file mode 100644 index 0000000000000000000000000000000000000000..cb01b308b87ef37037126d25498748807e62c03f --- /dev/null +++ b/Code/VisuRefac/otbGlComponent.h @@ -0,0 +1,80 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef __otbGlComponent_h +#define __otbGlComponent_h + +#include "itkObject.h" +#include "itkImageRegion.h" +#include "itkAffineTransform.h" +#include "itkFixedArray.h" + +// FLTK includes +#include <FL/gl.h> +#include "FL/Fl_Gl_Window.H" + +namespace otb +{ +/** \class GlComponent +* \brief Base class for openGl rendered components. +*/ + +class GlComponent + : public itk::Object +{ +public: + /** Standard class typedefs */ + typedef GlComponent Self; + typedef itk::Object Superclass; + typedef itk::SmartPointer<Self> Pointer; + typedef itk::SmartPointer<const Self> ConstPointer; + typedef itk::ImageRegion<2> RegionType; + + // affine transform + typedef itk::AffineTransform<double,2> AffineTransformType; + typedef AffineTransformType::InputPointType PointType; + typedef AffineTransformType::InputVectorType VectorType; + typedef itk::FixedArray<double,4> ColorType; + + /** Runtime information */ + itkTypeMacro(GlComponent,Object); + + /// Render the curve according to display extent and axis characteristics + virtual void Render(const RegionType& extent,const AffineTransformType * space2ScreenTransform) = 0; + +protected: + /** Constructor */ + GlComponent() + {} + /** Destructor */ + virtual ~GlComponent(){} + /** Printself method */ + void PrintSelf(std::ostream& os, itk::Indent indent) const + { + Superclass::PrintSelf(os,indent); + } + +private: + GlComponent(const Self&); // purposely not implemented + void operator=(const Self&); // purposely not implemented + +}; // end class +} // end namespace otb + +#endif + +