6. Chapter 3
Class Documentation
3.1
FLPlotColor Class Reference
#include <MyGlWindowPlot.h>
Public Member Functions
•
•
•
•
•
•
•
FLPlotColor (unsigned char r=0, unsigned char g=0, unsigned char b=0)
void r (unsigned char red)
void g (unsigned char green)
void b (unsigned char blue)
unsigned char r (void)
unsigned char g (void)
unsigned char b (void)
3.1.1
Detailed Description
Classe para armazenamento das componentes da cor em rgb.
Definition at line 23 of file MyGlWindowPlot.h.
3.1.2
Constructor & Destructor Documentation
3.1.2.1
FLPlotColor::FLPlotColor (unsigned char r = 0, unsigned char g = 0, unsigned char b =
0) [inline]
Definition at line 30 of file MyGlWindowPlot.h.
00030 : _r(r), _g(g), _b(b) {};
3.1.3
Member Function Documentation
3.1.3.1
unsigned char FLPlotColor::b (void) [inline]
Definition at line 38 of file MyGlWindowPlot.h.
7. 6
Class Documentation
00038 { return _b; };
3.1.3.2
void FLPlotColor::b (unsigned char blue) [inline]
Definition at line 34 of file MyGlWindowPlot.h.
00034 {
3.1.3.3
_b = blue; };
unsigned char FLPlotColor::g (void) [inline]
Definition at line 37 of file MyGlWindowPlot.h.
00037 { return _g; };
3.1.3.4
void FLPlotColor::g (unsigned char green) [inline]
Definition at line 33 of file MyGlWindowPlot.h.
00033 { _g = green; };
3.1.3.5
unsigned char FLPlotColor::r (void) [inline]
Definition at line 36 of file MyGlWindowPlot.h.
00036 { return _r; };
3.1.3.6
void FLPlotColor::r (unsigned char red) [inline]
Definition at line 32 of file MyGlWindowPlot.h.
00032 { _r = red;
};
The documentation for this class was generated from the following file:
• MyGlWindowPlot.h
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
8. 3.2 FLPlotPointXY Class Reference
3.2
7
FLPlotPointXY Class Reference
#include <MyGlWindowPlot.h>
Collaboration diagram for FLPlotPointXY:
FLPlotColor
- _r
- _g
- _b
+ FLPlotColor()
+ r()
+ g()
+ b()
+ r()
+ g()
+ b()
_color
FLPlotPointXY
- _x
- _y
- _color
- _label
+ FLPlotPointXY()
+ FLPlotPointXY()
+ x()
+ x()
+ y()
+ y()
+ color()
+ color()
+ label()
+ label()
Public Member Functions
•
•
•
•
•
•
•
•
•
•
FLPlotPointXY ()
FLPlotPointXY (float x, float y, FLPlotColor color, std::string label)
float x (void)
void x (float X)
float y (void)
void y (float Y)
FLPlotColor color (void)
void color (FLPlotColor color)
std::string label (void)
void label (std::string L)
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
9. 8
3.2.1
Class Documentation
Detailed Description
Classe para armazenamento das caracteristicas do ponto
Definition at line 44 of file MyGlWindowPlot.h.
3.2.2
Constructor & Destructor Documentation
3.2.2.1
FLPlotPointXY::FLPlotPointXY () [inline]
Definition at line 52 of file MyGlWindowPlot.h.
00052 { _x = 0; _y = 0; _color = 0; _label = ""; };
3.2.2.2
FLPlotPointXY::FLPlotPointXY (float x, float y, FLPlotColor color, std::string label)
[inline]
Definition at line 53 of file MyGlWindowPlot.h.
00053 { _x = x; _y = y; _color = color; _label = label; };
3.2.3
Member Function Documentation
3.2.3.1
void FLPlotPointXY::color (FLPlotColor color) [inline]
Definition at line 62 of file MyGlWindowPlot.h.
00062 { _color
3.2.3.2
= color; };
FLPlotColor FLPlotPointXY::color (void) [inline]
Definition at line 61 of file MyGlWindowPlot.h.
00061 { return _color;
3.2.3.3
};
void FLPlotPointXY::label (std::string L) [inline]
Definition at line 65 of file MyGlWindowPlot.h.
00065 { _label
3.2.3.4
= L;
};
std::string FLPlotPointXY::label (void) [inline]
Definition at line 64 of file MyGlWindowPlot.h.
00064 { return _label; };
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
10. 3.2 FLPlotPointXY Class Reference
3.2.3.5
void FLPlotPointXY::x (float X) [inline]
Definition at line 56 of file MyGlWindowPlot.h.
00056 { _x
3.2.3.6
= X;
};
float FLPlotPointXY::x (void) [inline]
Definition at line 55 of file MyGlWindowPlot.h.
00055 { return _x; };
3.2.3.7
void FLPlotPointXY::y (float Y) [inline]
Definition at line 59 of file MyGlWindowPlot.h.
00059 { _y
3.2.3.8
= Y;
};
float FLPlotPointXY::y (void) [inline]
Definition at line 58 of file MyGlWindowPlot.h.
00058 { return _y; };
The documentation for this class was generated from the following file:
• MyGlWindowPlot.h
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
9
12. 3.3 MyGlWindowPlot Class Reference
11
• void MarkPoint (bool _mark)
• int handle (int e)
• void clear (void)
3.3.1
Detailed Description
Classe para plotagem de pontos em um canvas opengl
Definition at line 71 of file MyGlWindowPlot.h.
3.3.2
Constructor & Destructor Documentation
3.3.2.1
MyGlWindowPlot::MyGlWindowPlot (int X, int Y, int W, int H, const char ∗ L = 0)
Construtor default
Definition at line 26 of file MyGlWindowPlot.cxx.
00027 : Fl_Gl_Window(X,Y,W,H,L) { InitializeSystem(); };
3.3.3
Member Function Documentation
3.3.3.1
void MyGlWindowPlot::add (float x, float y, FLPlotColor color = 0, std::string label = "")
Insere itens na lista de pontos do plotador
Definition at line 150 of file MyGlWindowPlot.cxx.
00151 {
00152
_points.push_back(FLPlotPointXY(x*_aspect_ratio_x,y*_aspect_ratio_y,color,label
));
00153 }
3.3.3.2
void MyGlWindowPlot::clear (void)
Executa limpeza do vetor de pontos e da área de desenho.
Definition at line 187 of file MyGlWindowPlot.cxx.
00187 { _points.clear(); redraw(); };
3.3.3.3
void MyGlWindowPlot::drawCircle (float Radius, unsigned int numPoints)
Desenha marcador em volta do ponto.
Definition at line 171 of file MyGlWindowPlot.cxx.
00172 {
00173
glBegin( GL_LINE_STRIP );
00174
for(unsigned int i=0; i <= numPoints; i++ )
00175
{
00176
float Angle = i * (2.0*M_PI/numPoints); // use 360 instead of 2.0*PI if
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
13. 12
Class Documentation
00177
float X = cos( Angle )*Radius;
00178
float Y = sin( Angle )*Radius;
00179
glVertex2f( X, Y );
00180
}
00181
glEnd();
00182 }
3.3.3.4
// you use d_cos and d_sin
int MyGlWindowPlot::handle (int e)
Implementação do método que manipula eventos
Definition at line 158 of file MyGlWindowPlot.cxx.
00159 {
00160
switch (e)
00161
{
00162
case FL_ENTER: cursor(FL_CURSOR_CROSS); break;
00163
case FL_LEAVE: cursor(FL_CURSOR_DEFAULT); break;
00164
}
00165
return Fl_Gl_Window::handle(e);
00166 }
3.3.3.5
void MyGlWindowPlot::MarkedPoint (FLPlotPointXY p) [inline]
Manipula o ponto que deve ser marcado
Definition at line 148 of file MyGlWindowPlot.h.
00148 { _marked_point = p;
3.3.3.6
};
void MyGlWindowPlot::MarkPoint (bool _mark) [inline]
Verifica se um ponto deve ser marcado ou não
Definition at line 153 of file MyGlWindowPlot.h.
00153 { _mark_point = _mark; };
3.3.3.7
void MyGlWindowPlot::max_y_value (long double y_max)
Armazena o maior valor existente dentro do conjunto.
Definition at line 133 of file MyGlWindowPlot.cxx.
00134 {
00135
_max_y_value = y_max;
00136 };
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
14. 3.3 MyGlWindowPlot Class Reference
3.3.3.8
long double MyGlWindowPlot::Normalize (long double y_value)
Normaliza o ponto para que o mesmo possa ser mostrado no canvas.
Normaliza o ponto, para que o mesmo possa ser mostrado no canvas.
Definition at line 141 of file MyGlWindowPlot.cxx.
00142 {
00143
00144
00145 }
3.3.3.9
long double _max = (_max_y_value == 0)?(1):(_max_y_value);
return (long double)( ((h()*0.55)*y_value)/(_max));
void MyGlWindowPlot::ResetZoom (void)
Controlador que retorna a câmera ao seu estado normal - reset zoom
Definition at line 124 of file MyGlWindowPlot.cxx.
00125 {
00126
_aspect_ratio = (double)w()/(double)h();
00127
redraw();
00128 };
3.3.3.10
void MyGlWindowPlot::ZoomLess (void)
Controlador de afastamento de camera - zoom less
Definition at line 106 of file MyGlWindowPlot.cxx.
00107 {
00108
_aspect_ratio = (double)_aspect_ratio/1.05;
00109
redraw();
00110 };
3.3.3.11
void MyGlWindowPlot::ZoomMore (void)
Controlador de aproximação de camera - zoom more
Definition at line 115 of file MyGlWindowPlot.cxx.
00116 {
00117
_aspect_ratio = (double)_aspect_ratio*1.05;
00118
redraw();
00119 };
The documentation for this class was generated from the following files:
• MyGlWindowPlot.h
• MyGlWindowPlot.cxx
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
13
20. 4.3 MyGlWindowPlot.h File Reference
4.3
19
MyGlWindowPlot.h File Reference
#include <cmath>
#include <vector>
#include <iostream>
#include <sstream>
#include <FL/Fl.H>
#include <FL/gl.h>
#include <FL/Fl_Gl_Window.H>
Include dependency graph for MyGlWindowPlot.h:
MyGlWindowPlot.h
cmath
vector
iostream
sstream
FL/Fl.H
FL/gl.h
This graph shows which files directly or indirectly include this file:
MyGlWindowPlot.h
Sys-MyGlWindowPlot.cpp
Classes
• class FLPlotColor
• class FLPlotPointXY
• class MyGlWindowPlot
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
FL/Fl_Gl_Window.H
22. 4.4 MyGlWindowPlot.h
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
double
_aspect_ratio;
o geral
float
_aspect_ratio_x;
float
_aspect_ratio_y;
float
_mark_height_in_x;
dade em x
float
_submark_height_in_x;
unidades inteiras
std::vector<FLPlotPointXY>
_points;
plotados
std::ostringstream
_oss;
s eixos;
std::string
_label_plotter;
FLPlotPointXY
_marked_point;
bool
_mark_point;
marcado
long double
_max_y_value;
pontos
21
//razao de aspecto para exibiçã
//razão de aspecto em x
//razão de aspecto em y
//altura da marca para cada uni
//altura da submarca entre duas
//lista de pontos que devem ser
//Conversor para a numeração do
//Rótulo ou título do plotador
//Ponto que deve ser marcado.
//Verifica se o ponto deve ser
//Recebe o maior valor entre os
00084
00088
void InitializeSystem();
00089
00093
void draw();
00094
00102
void resize(int X,int Y,int W,int H);
00103
00104 public:
00108
MyGlWindowPlot(int X,int Y,int W,int H,const char*L=0);
00109
00113
void ZoomLess(void);
00114
00118
void ZoomMore(void);
00119
00123
void ResetZoom(void);
00124
00128
void max_y_value(long double y_max);
00129
00133
long double Normalize(long double y_value);
00134
00138
void add (float x, float y, FLPlotColor color = 0, std::string label = "");
00139
00143
void drawCircle(float Radius, unsigned int numPoints);
00144
00148
void MarkedPoint(FLPlotPointXY p) { _marked_point = p; };
00149
00153
void MarkPoint(bool _mark) { _mark_point = _mark; };
00154
00158
int handle(int e);
00159
00163
void clear(void);
00164 };
00165
00166 #endif /* MYGLWINDOWPLOT_H_ */
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
23. 22
File Documentation
4.5
Sys-MyGlWindowPlot.cpp File Reference
#include <iostream>
#include <FL/Fl.H>
#include <FL/glut.H>
#include <FL/Fl_Double_Window.H>
#include "MyGlWindowPlot.h"
Include dependency graph for Sys-MyGlWindowPlot.cpp:
Sys-MyGlWindowPlot.cpp
MyGlWindowPlot.h
iostream
FL/Fl.H
vector
FL/glut.H
sstream
FL/gl.h
FL/Fl_Double_Window.H
FL/Fl_Gl_Window.H
cmath
Functions
• int main (int argc, char ∗argv[ ])
4.5.1
Function Documentation
4.5.1.1
int main (int argc, char ∗ argv[ ])
Função para testes com a biblioteca.
Definition at line 16 of file Sys-MyGlWindowPlot.cpp.
00017 {
00018
Fl_Double_Window mywin(0,0,400,300);
00019
mywin.resizable(mywin);
00020
mywin.begin();
00021
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
00022
MyGlWindowPlot g(10, 10, 380, 260);
00023
mywin.end();
00024
mywin.show();
00025
return Fl::run();
00026 }
Generated on Sun Dec 4 13:31:15 2011 by Doxygen