Orfeo Toolbox  3.16
otbCrossGlComponent.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 __otbCrossGlComponent_h
19 #define __otbCrossGlComponent_h
20 
21 #include "otbGlComponent.h"
23 
24 # ifdef __APPLE__
25 # include <OpenGL/glu.h>
26 # else
27 # include <GL/glu.h>
28 # endif
29 
30 // There are function prototype conflits under cygwin between standard w32 API
31 // and standard C ones
32 #ifndef CALLBACK
33 #if defined(_WINDOWS) || defined(__CYGWIN__)
34 #define CALLBACK __stdcall
35 #else
36 #define CALLBACK
37 #endif
38 #endif
39 
40 namespace otb
41 {
52 {
53 public:
60 
61  // affine transform
66 
68  typedef std::vector<IndexType> IndexListType;
69  typedef std::vector<ColorType> ColorListType;
70 
72  itkTypeMacro(CrossGlComponent, GlComponent);
73 
75  itkNewMacro(Self);
76 
78  virtual void Render(const RegionType& extent, const AffineTransformType * space2ScreenTransform);
79 
81  itkSetMacro(Spacing, VectorType);
82  itkGetConstReferenceMacro(Spacing, VectorType);
83 
85  itkSetMacro(Origin, PointType);
86  itkGetConstReferenceMacro(Origin, PointType);
87 
89  void SetIndexList(IndexListType idList) { m_IndexList = idList; }
91  void AddIndex(IndexType id) { m_IndexList.push_back(id); m_ColorList.push_back(m_RedColor); }
92  void RemoveIndex(unsigned int id)
93  {
94  if (id >= m_IndexList.size()) itkExceptionMacro(<< "Index out of size ");
95 
96  m_IndexList.erase(m_IndexList.begin() + id);
97  }
98 
100  void SetColorList(ColorListType colorList) { m_ColorList = colorList; }
102  void ChangeColor(ColorType color, unsigned int id)
103  {
104  if (id >= m_ColorList.size()) itkExceptionMacro(<< "Index out of size ");
105 
106  m_ColorList[id] = color;
107  }
108  void RemoveColor(unsigned int id)
109  {
110  if (id >= m_ColorList.size()) itkExceptionMacro(<< "Index out of size ");
111 
112  m_ColorList.erase(m_ColorList.begin() + id);
113  }
114 
116  void Clear() { m_IndexList.clear(); m_ColorList.clear(); }
117  void ClearIndex(unsigned int id)
118  {
119  this->RemoveIndex(id);
120  this->RemoveColor(id);
121  }
122 
124  itkSetMacro(LineWidth, double);
125  itkGetMacro(LineWidth, double);
126 
128  itkSetMacro(CrossWidth, double);
129  itkGetMacro(CrossWidth, double);
130 
131 protected:
135  virtual ~CrossGlComponent();
137  virtual void PrintSelf(std::ostream& os, itk::Indent indent) const
138  {
139  Superclass::PrintSelf(os, indent);
140  }
141 
142  // Recursive rendering method
143  virtual void Render(unsigned int id, const RegionType& extent, const AffineTransformType * space2ScreenTransform);
144 
145 private:
146  CrossGlComponent(const Self&); // purposely not implemented
147  void operator =(const Self&); // purposely not implemented
148 
151 
154 
157 
159  GLUtesselator * m_GluTesselator;
160 
163 
165  double m_LineWidth;
166 
168  double m_CrossWidth;
169 
172 
173 }; // end class
174 } // end namespace otb
175 
176 #endif

Generated at Sun Feb 3 2013 00:19:54 for Orfeo Toolbox with doxygen 1.8.1.1