Orfeo Toolbox  3.16
otbCircleGlComponent.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 __otbCircleGlComponent_h
19 #define __otbCircleGlComponent_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 {
53 {
54 public:
61 
62  // affine transform
67 
69  typedef std::vector<IndexType> IndexListType;
70  typedef std::vector<ColorType> ColorListType;
71 
73 
75  itkTypeMacro(CircleGlComponent, GlComponent);
76 
78  itkNewMacro(Self);
79 
81  virtual void Render(const RegionType& extent, const AffineTransformType * space2ScreenTransform);
82 
84  itkSetMacro(Spacing, VectorType);
85  itkGetConstReferenceMacro(Spacing, VectorType);
86 
88  itkSetMacro(Origin, PointType);
89  itkGetConstReferenceMacro(Origin, PointType);
90 
92  void SetIndexList(IndexListType idList) { m_IndexList = idList; }
94  void AddIndex(IndexType id) { m_IndexList.push_back(id); m_ColorList.push_back(m_RedColor); }
95  void RemoveIndex(unsigned int id)
96  {
97  if (id >= m_IndexList.size()) itkExceptionMacro(<< "Index out of size ");
98 
99  m_IndexList.erase(m_IndexList.begin() + id);
100  }
101 
103  void SetColorList(ColorListType colorList) { m_ColorList = colorList; }
105  void ChangeColor(ColorType color, unsigned int id)
106  {
107  if (id >= m_ColorList.size()) itkExceptionMacro(<< "Index out of size ");
108 
109  m_ColorList[id] = color;
110  }
111  void RemoveColor(unsigned int id)
112  {
113  if (id >= m_ColorList.size()) itkExceptionMacro(<< "Index out of size ");
114 
115  m_ColorList.erase(m_ColorList.begin() + id);
116  }
117 
119  void Clear() { m_IndexList.clear(); m_ColorList.clear(); }
120  void ClearIndex(unsigned int id)
121  {
122  this->RemoveIndex(id);
123  this->RemoveColor(id);
124  }
125 
127  itkSetMacro(LineWidth, double);
128  itkGetMacro(LineWidth, double);
129 
131  itkSetMacro(Radius, double);
132  itkGetMacro(Radius, double);
133 
135  itkSetMacro(CenterRepresentation, CenterRepresentationEnumType);
136  itkGetMacro(CenterRepresentation, CenterRepresentationEnumType);
137 
138 protected:
142  virtual ~CircleGlComponent();
144  virtual void PrintSelf(std::ostream& os, itk::Indent indent) const
145  {
146  Superclass::PrintSelf(os, indent);
147  }
148 
149  // Recursive rendering method
150  virtual void Render(unsigned int id, const RegionType& extent, const AffineTransformType * space2ScreenTransform);
151 
152 private:
153  CircleGlComponent(const Self&); // purposely not implemented
154  void operator =(const Self&); // purposely not implemented
155 
158 
161 
164 
166  GLUtesselator * m_GluTesselator;
167 
170 
172  double m_LineWidth;
173 
175  double m_Radius;
176 
179 
182 
183 }; // end class
184 } // end namespace otb
185 
186 #endif

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