<commit_before>/*=========================================================================

  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 __otbGlWidget_h
#define __otbGlWidget_h

// FLTK includes
#include <FL/gl.h>
#include <FL/Fl.h>
#include "FL/Fl_Gl_Window.H"

// This include is needed to get the OTB_GL_USE_ACCEL definition
#include "otbConfigure.h"

#include "itkFixedArray.h"
#include "itkPoint.h"

#include "otbImageWidgetController.h"

namespace otb
{
/** \class GlWidget
*   \brief Base class for widgets using OpenGl
*
*   The SetUseGlAcceleration() allows you to disable Gl
*   acceleration. If OTB_USE_GL_ACCEL is OFF, enabling Gl acceleration
*   will generate an exception.
*   Using Gl acceleration allows you to have a better rendering when
*   zooming.
*
*  \sa ImageWidget
*/

class GlWidget
  : public Fl_Gl_Window, public itk::Object
{
public:
  /** Standard class typedefs */
  typedef GlWidget                          Self;
  typedef itk::Object                       Superclass;
  typedef itk::SmartPointer<Self>           Pointer;
  typedef itk::SmartPointer<const Self>     ConstPointer;

  /** Method for creation through the object factory */
  itkNewMacro(Self);

  /** Runtime information */
  itkTypeMacro(GlWidget,Object);
  
  /** Controller typedef */
  typedef otb::ImageWidgetController        ControllerType;
  typedef ControllerType::Pointer           ControllerPointerType;
  
  /** Index typedef */
  typedef itk::Point<double,2>              PointType;

  /** Color typedef (used to draw the rectangle, 4th channel is alpha) */
  typedef itk::FixedArray<float,4>          ColorType;

  /** Set/Get the Controller */
  itkSetObjectMacro(Controller,ControllerType);
  itkGetObjectMacro(Controller,ControllerType);

  /** Handle resizing event. This method is used by FLTK routines and
   *  should not be called on its own.
   */
  virtual void resize(int x, int y, int w, int h);

  
  /** Enable/disable Gl acceleration */
  itkSetMacro(UseGlAcceleration,bool);
  itkGetMacro(UseGlAcceleration,bool);
  itkBooleanMacro(UseGlAcceleration);

   /** Set/Get the identifier */
  itkSetStringMacro(Identifier);
  itkGetStringMacro(Identifier);

  /** Set/Get the background color */
  itkSetMacro(BackgroundColor,ColorType);
  itkGetMacro(BackgroundColor,ColorType);


  /** Fltk y axis is flipped, therefore we use this function to get
   *  the cursor position using gl axis */
  PointType GetMousePosition();

protected:
  /** Constructor */
  GlWidget();
  /** Destructor */
  ~GlWidget();
  /** Printself method */
  virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;<commit_msg>BUG: fix Fl.H include<commit_after>/*=========================================================================

  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 __otbGlWidget_h
#define __otbGlWidget_h

// FLTK includes
#include <FL/gl.h>
#include <FL/Fl.H>
#include "FL/Fl_Gl_Window.H"

// This include is needed to get the OTB_GL_USE_ACCEL definition
#include "otbConfigure.h"

#include "itkFixedArray.h"
#include "itkPoint.h"

#include "otbImageWidgetController.h"

namespace otb
{
/** \class GlWidget
*   \brief Base class for widgets using OpenGl
*
*   The SetUseGlAcceleration() allows you to disable Gl
*   acceleration. If OTB_USE_GL_ACCEL is OFF, enabling Gl acceleration
*   will generate an exception.
*   Using Gl acceleration allows you to have a better rendering when
*   zooming.
*
*  \sa ImageWidget
*/

class GlWidget
  : public Fl_Gl_Window, public itk::Object
{
public:
  /** Standard class typedefs */
  typedef GlWidget                          Self;
  typedef itk::Object                       Superclass;
  typedef itk::SmartPointer<Self>           Pointer;
  typedef itk::SmartPointer<const Self>     ConstPointer;

  /** Method for creation through the object factory */
  itkNewMacro(Self);

  /** Runtime information */
  itkTypeMacro(GlWidget,Object);

  /** Controller typedef */
  typedef otb::ImageWidgetController        ControllerType;
  typedef ControllerType::Pointer           ControllerPointerType;

  /** Index typedef */
  typedef itk::Point<double,2>              PointType;

  /** Color typedef (used to draw the rectangle, 4th channel is alpha) */
  typedef itk::FixedArray<float,4>          ColorType;

  /** Set/Get the Controller */
  itkSetObjectMacro(Controller,ControllerType);
  itkGetObjectMacro(Controller,ControllerType);

  /** Handle resizing event. This method is used by FLTK routines and
   *  should not be called on its own.
   */
  virtual void resize(int x, int y, int w, int h);


  /** Enable/disable Gl acceleration */
  itkSetMacro(UseGlAcceleration,bool);
  itkGetMacro(UseGlAcceleration,bool);
  itkBooleanMacro(UseGlAcceleration);

   /** Set/Get the identifier */
  itkSetStringMacro(Identifier);
  itkGetStringMacro(Identifier);

  /** Set/Get the background color */
  itkSetMacro(BackgroundColor,ColorType);
  itkGetMacro(BackgroundColor,ColorType);


  /** Fltk y axis is flipped, therefore we use this function to get
   *  the cursor position using gl axis */
  PointType GetMousePosition();

protected:
  /** Constructor */
  GlWidget();
  /** Destructor */
  ~GlWidget();
  /** Printself method */
  virtual void PrintSelf(std::ostream& os, itk::Indent indent) const;
{'fraction_non_alphanumeric': 0.1378640776699029, 'fraction_numerical': 0.000970873786407767, 'mean_word_length': 3.7003802281368823, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5740819', 'n_tokens_mistral': 1832, 'n_tokens_neox': 1737, 'n_words': 540}