Orfeo Toolbox  3.16
otbImageWidgetBoxForm.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 #ifndef __otbImageWidgetBoxForm_h
19 #define __otbImageWidgetBoxForm_h
20 
21 #include "vcl_deprecated_header.h"
22 
23 #include "itkSize.h"
24 #include "itkIndex.h"
25 #include "otbImageWidgetFormBase.h"
26 
27 namespace otb
28 {
37  : public ImageWidgetFormBase
38 {
39 public:
45 
47  itkNewMacro(Self);
48 
51 
52  typedef itk::Size<2> SizeType;
54 
55  itkSetMacro(Size, SizeType);
56  itkGetMacro(Size, SizeType);
57 
58  itkSetMacro(Index, IndexType);
59  itkGetMacro(Index, IndexType);
60 
61  void Draw(double openGlZoom, unsigned int originx, unsigned int originy, unsigned int windowh, unsigned int ss_rate)
62  {
63  if (this->GetVisible())
64  {
65  double xul =
66  static_cast<double>((static_cast<double>(m_Index[0]) -
67  static_cast<double>(originx)) * openGlZoom * (1 / static_cast<double>(ss_rate)));
68  double xlr =
69  static_cast<double>((static_cast<double>(m_Index[0] +
70  m_Size[0]) -
71  static_cast<double>(originx)) * openGlZoom * (1 / static_cast<double>(ss_rate)));
72 
73  double yul =
74  static_cast<double>(static_cast<double>(windowh) +
75  (static_cast<double>(originy) -
76  static_cast<double>(m_Index[1])) * openGlZoom * (1 / static_cast<double>(ss_rate)));
77 
78  double ylr =
79  static_cast<double>(static_cast<double>(windowh) +
80  (static_cast<double>(originy) -
81  static_cast<double>(m_Size[1] +
82  m_Index[1])) * openGlZoom * (1 / static_cast<double>(ss_rate)));
83 
84  glEnable(GL_BLEND);
85  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
86  glColor4f(m_Color[0], m_Color[1], m_Color[2], m_Color[3]);
87  glBegin(GL_LINE_LOOP);
88  glVertex2d(xul, yul);
89  glVertex2d(xul, ylr);
90  glVertex2d(xlr, ylr);
91  glVertex2d(xlr, yul);
92  glEnd();
93  glDisable(GL_BLEND);
94  }
95  }
96 protected:
99  {
100  m_Index.Fill(0);
101  m_Size.Fill(0);
102  }
105 
106 private:
107  ImageWidgetBoxForm(const Self&); // purposely not implemented
108  void operator =(const Self&); // purposely not implemented
109 
112 
113 };
114 } // end namespace otb
115 #endif

Generated at Sun Feb 3 2013 00:31:22 for Orfeo Toolbox with doxygen 1.8.1.1