Date post: | 02-Jul-2015 |
Category: |
Education |
Upload: | michel-alves |
View: | 89 times |
Download: | 0 times |
Reference Manual
Generated by Doxygen 1.6.3
Sun Dec 4 13:31:15 2011
Contents
1 Class Index 1
1.1 Class List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 File Index 3
2.1 File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Class Documentation 5
3.1 FLPlotColor Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 5
3.1.2.1 FLPlotColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1.3.1 b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.1.3.2 b . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1.3.3 g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1.3.4 g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1.3.5 r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1.3.6 r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2 FLPlotPointXY Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 8
3.2.2.1 FLPlotPointXY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.2.2 FLPlotPointXY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.3.1 color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.3.2 color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.3.3 label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.3.4 label . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2.3.5 x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
ii CONTENTS
3.2.3.6 x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.3.7 y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.3.8 y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3 MyGlWindowPlot Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 11
3.3.2.1 MyGlWindowPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3.3.1 add . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3.3.2 clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3.3.3 drawCircle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3.3.4 handle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3.3.5 MarkedPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3.3.6 MarkPoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3.3.7 max_y_value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3.3.8 Normalize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3.3.9 ResetZoom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3.3.10 ZoomLess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3.3.11 ZoomMore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4 File Documentation 15
4.1 MyGlWindowPlot.cxx File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.2 MyGlWindowPlot.cxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.3 MyGlWindowPlot.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.4 MyGlWindowPlot.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.5 Sys-MyGlWindowPlot.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.5.1 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.5.1.1 main . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.6 Sys-MyGlWindowPlot.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
Chapter 1
Class Index
1.1 Class List
Here are the classes, structs, unions and interfaces with brief descriptions:
FLPlotColor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5FLPlotPointXY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7MyGlWindowPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Chapter 2
File Index
2.1 File List
Here is a list of all files with brief descriptions:
MyGlWindowPlot.cxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15MyGlWindowPlot.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19Sys-MyGlWindowPlot.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
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.
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 { _b = blue; };
3.1.3.3 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
3.2 FLPlotPointXY Class Reference 7
3.2 FLPlotPointXY Class Reference
#include <MyGlWindowPlot.h>
Collaboration diagram for FLPlotPointXY:
FLPlotPointXY
- _x- _y- _color- _label
+ FLPlotPointXY()+ FLPlotPointXY()+ x()+ x()+ y()+ y()+ color()+ color()+ label()+ label()
FLPlotColor
- _r- _g- _b
+ FLPlotColor()+ r()+ g()+ b()+ r()+ g()+ b()
_color
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
8 Class Documentation
3.2.1 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 = color; };
3.2.3.2 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 = L; };
3.2.3.4 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
3.2 FLPlotPointXY Class Reference 9
3.2.3.5 void FLPlotPointXY::x (float X) [inline]
Definition at line 56 of file MyGlWindowPlot.h.
00056 { _x = X; };
3.2.3.6 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 = Y; };
3.2.3.8 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
10 Class Documentation
3.3 MyGlWindowPlot Class Reference
#include <MyGlWindowPlot.h>
Collaboration diagram for MyGlWindowPlot:
MyGlWindowPlot
- _aspect_ratio- _aspect_ratio_x- _aspect_ratio_y- _mark_height_in_x- _submark_height_in_x- _points- _oss- _label_plotter- _marked_point- _mark_point- _max_y_value
+ MyGlWindowPlot()+ ZoomLess()+ ZoomMore()+ ResetZoom()+ max_y_value()+ Normalize()+ add()+ drawCircle()+ MarkedPoint()+ MarkPoint()+ handle()+ clear()- InitializeSystem()- draw()- resize()
FLPlotPointXY
- _x- _y- _color- _label
+ FLPlotPointXY()+ FLPlotPointXY()+ x()+ x()+ y()+ y()+ color()+ color()+ label()+ label()
_marked_point
FLPlotColor
- _r- _g- _b
+ FLPlotColor()+ r()+ g()+ b()+ r()+ g()+ b()
_color
Public Member Functions
• MyGlWindowPlot (int X, int Y, int W, int H, const char ∗L=0)• void ZoomLess (void)• void ZoomMore (void)• void ResetZoom (void)• void max_y_value (long double y_max)• long double Normalize (long double y_value)• void add (float x, float y, FLPlotColor color=0, std::string label="")• void drawCircle (float Radius, unsigned int numPoints)• void MarkedPoint (FLPlotPointXY p)
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
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
12 Class Documentation
00177 float X = cos( Angle )*Radius; // you use d_cos and d_sin00178 float Y = sin( Angle )*Radius;00179 glVertex2f( X, Y );00180 }00181 glEnd();00182 }
3.3.3.4 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
3.3 MyGlWindowPlot Class Reference 13
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 long double _max = (_max_y_value == 0)?(1):(_max_y_value);00144 return (long double)( ((h()*0.55)*y_value)/(_max));00145 }
3.3.3.9 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
14 Class Documentation
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
Chapter 4
File Documentation
4.1 MyGlWindowPlot.cxx File Reference
#include "MyGlWindowPlot.h"
#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.cxx:
MyGlWindowPlot.cxx
cmath vector iostream sstream FL/Fl.H FL/gl.h FL/Fl_Gl_Window.H
This graph shows which files directly or indirectly include this file:
MyGlWindowPlot.cxx
16 File Documentation
4.2 MyGlWindowPlot.cxx
00001 /*00002 * MyGlWindowPlot.cxx00003 *00004 * Created on: 11/09/200900005 * Author: Michel Alves dos Santos00006 */0000700008 #include "MyGlWindowPlot.h"0000900013 void MyGlWindowPlot::InitializeSystem()00014 {00015 _aspect_ratio_x = 2.5;00016 _aspect_ratio_y = 1;00017 _mark_height_in_x = 2.5;00018 _submark_height_in_x = 1.5;00019 _aspect_ratio = (double)w()/(double)h();00020 _label_plotter = "";00021 }0002200026 MyGlWindowPlot::MyGlWindowPlot(int X,int Y,int W,int H,const char*L)00027 : Fl_Gl_Window(X,Y,W,H,L) { InitializeSystem(); };0002800032 void MyGlWindowPlot::draw()00033 {00034 // Inicialização dos atributos de visualização da janela00035 if (!valid())00036 {00037 valid(1);00038 glMatrixMode(GL_PROJECTION);00039 glLoadIdentity();00040 glViewport(0,0,w(),h());00041 glOrtho(0, w(), -h() , h(), -1, 1);00042 }0004300044 // Limpando a tela00045 glClear(GL_COLOR_BUFFER_BIT);0004600047 //Habilitando transparência00048 glEnable(GL_BLEND);00049 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);00050 glShadeModel(GL_FLAT);0005100052 //Desenhando o eixo de coordenadas00053 glLineWidth(2);00054 glColor3f(1.0, 1.0, 1.0);00055 glBegin(GL_LINE_STRIP); glVertex2f(1, h()); glVertex2f(1,-h()); glEnd();00056 glBegin(GL_LINE_STRIP); glVertex2f(0, 0); glVertex2f(w(), 0); glEnd();0005700058 //Nomeando os eixos de coordenadas ...00059 gl_font(FL_COURIER_BOLD,15);00060 gl_color(FL_YELLOW); gl_draw(" x " , w()-40, -40);00061 gl_color(FL_YELLOW); gl_draw(" y - Diagrama Dispersivo", 5, h()-20);0006200063 //Desenhando a linha poligonal que representa a curva00064 glPushMatrix();00065 glScalef(_aspect_ratio,_aspect_ratio,1);00066 glPointSize(2);0006700068 //Desenho os pontos que foram fornecidos para o plotter00069 glPointSize(2);00070 glColor3ub(63,255,6);00071 glBegin(GL_POINTS);00072 for(register unsigned int index = 0; index < _points.size(); index++)00073 glVertex2f(_points[index].x(),Normalize(_points[index].y()));00074 glEnd();
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
4.2 MyGlWindowPlot.cxx 17
00075 glPopMatrix();0007600077 //Desabilitando o alpha / transparência00078 glDisable(GL_BLEND);0007900080 //Marcando a origem dos eixos00081 glPointSize(4);00082 glColor3ub(255,99,23);00083 glBegin(GL_POINTS); glVertex2f(0,0); glVertex2f(0,0); glEnd();00084 }0008500093 void MyGlWindowPlot::resize(int X,int Y,int W,int H)00094 {00095 Fl_Gl_Window::resize(X,Y,W,H);00096 glMatrixMode(GL_PROJECTION);00097 glLoadIdentity();00098 glViewport(0,0,W,H);00099 glOrtho(-W,W,-H,H,-1,1);00100 redraw();00101 }0010200106 void MyGlWindowPlot::ZoomLess(void)00107 {00108 _aspect_ratio = (double)_aspect_ratio/1.05;00109 redraw();00110 };0011100115 void MyGlWindowPlot::ZoomMore(void)00116 {00117 _aspect_ratio = (double)_aspect_ratio*1.05;00118 redraw();00119 };0012000124 void MyGlWindowPlot::ResetZoom(void)00125 {00126 _aspect_ratio = (double)w()/(double)h();00127 redraw();00128 };0012900133 void MyGlWindowPlot::max_y_value(long double y_max)00134 {00135 _max_y_value = y_max;00136 };0013700141 long double MyGlWindowPlot::Normalize(long double y_value)00142 {00143 long double _max = (_max_y_value == 0)?(1):(_max_y_value);00144 return (long double)( ((h()*0.55)*y_value)/(_max));00145 }0014600150 void MyGlWindowPlot::add (float x, float y, FLPlotColor color, std::string label)
00151 {00152 _points.push_back(FLPlotPointXY(x*_aspect_ratio_x,y*_aspect_ratio_y,color,label
));00153 }0015400158 int MyGlWindowPlot::handle(int e)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 }00167
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
18 File Documentation
00171 void MyGlWindowPlot::drawCircle(float Radius, unsigned int numPoints)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 if00177 float X = cos( Angle )*Radius; // you use d_cos and d_sin00178 float Y = sin( Angle )*Radius;00179 glVertex2f( X, Y );00180 }00181 glEnd();00182 }0018300187 void MyGlWindowPlot::clear(void) { _points.clear(); redraw(); };
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
4.3 MyGlWindowPlot.h File Reference 19
4.3 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 FL/Fl_Gl_Window.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
20 File Documentation
4.4 MyGlWindowPlot.h
00001 /*00002 * MyGlWindowplot.h00003 *00004 * Created on: 11/09/200900005 * Author: Administrador00006 */0000700008 #ifndef MYGLWINDOWPLOT_H_00009 #define MYGLWINDOWPLOT_H_0001000011 #include <cmath>00012 #include <vector>00013 #include <iostream>00014 #include <sstream>0001500016 #include <FL/Fl.H>00017 #include <FL/gl.h>00018 #include <FL/Fl_Gl_Window.H>0001900023 class FLPlotColor00024 {00025 unsigned char _r; //Componente vermelha00026 unsigned char _g; //Componente verde00027 unsigned char _b; //Componente azul0002800029 public:00030 FLPlotColor(unsigned char r = 0, unsigned char g =0, unsigned char b = 0): _r
(r), _g(g), _b(b) {};0003100032 void r(unsigned char red) { _r = red; };00033 void g(unsigned char green) { _g = green; };00034 void b(unsigned char blue) { _b = blue; };0003500036 unsigned char r(void) { return _r; };00037 unsigned char g(void) { return _g; };00038 unsigned char b(void) { return _b; };00039 };0004000044 class FLPlotPointXY00045 {00046 float _x; // Coordenada x00047 float _y; // Coordenada y00048 FLPlotColor _color; // Cor do ponto00049 std::string _label; // Um rótulo para o ponto0005000051 public :00052 FLPlotPointXY(){ _x = 0; _y = 0; _color = 0; _label = ""; };00053 FLPlotPointXY(float x, float y, FLPlotColor color, std::string label){ _x
= x; _y = y; _color = color; _label = label; };0005400055 float x(void) { return _x; };00056 void x(float X) { _x = X; };0005700058 float y(void) { return _y; };00059 void y(float Y) { _y = Y; };0006000061 FLPlotColor color(void) { return _color; };00062 void color(FLPlotColor color) { _color = color; };0006300064 std::string label(void) { return _label; };00065 void label(std::string L) { _label = L; };00066 };0006700071 class MyGlWindowPlot : public Fl_Gl_Window00072 {
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
4.4 MyGlWindowPlot.h 21
00073 double _aspect_ratio; //razao de aspecto para exibição geral
00074 float _aspect_ratio_x; //razão de aspecto em x00075 float _aspect_ratio_y; //razão de aspecto em y00076 float _mark_height_in_x; //altura da marca para cada uni
dade em x00077 float _submark_height_in_x; //altura da submarca entre duas
unidades inteiras00078 std::vector<FLPlotPointXY> _points; //lista de pontos que devem ser
plotados00079 std::ostringstream _oss; //Conversor para a numeração do
s eixos;00080 std::string _label_plotter; //Rótulo ou título do plotador00081 FLPlotPointXY _marked_point; //Ponto que deve ser marcado.00082 bool _mark_point; //Verifica se o ponto deve ser
marcado00083 long double _max_y_value; //Recebe o maior valor entre os
pontos0008400088 void InitializeSystem();0008900093 void draw();0009400102 void resize(int X,int Y,int W,int H);0010300104 public:00108 MyGlWindowPlot(int X,int Y,int W,int H,const char*L=0);0010900113 void ZoomLess(void);0011400118 void ZoomMore(void);0011900123 void ResetZoom(void);0012400128 void max_y_value(long double y_max);0012900133 long double Normalize(long double y_value);0013400138 void add (float x, float y, FLPlotColor color = 0, std::string label = "");0013900143 void drawCircle(float Radius, unsigned int numPoints);0014400148 void MarkedPoint(FLPlotPointXY p) { _marked_point = p; };0014900153 void MarkPoint(bool _mark) { _mark_point = _mark; };0015400158 int handle(int e);0015900163 void clear(void);00164 };0016500166 #endif /* MYGLWINDOWPLOT_H_ */
Generated on Sun Dec 4 13:31:15 2011 by Doxygen
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
iostream FL/Fl.H
FL/glut.H FL/Fl_Double_Window.HMyGlWindowPlot.h
cmathvector sstream FL/gl.h FL/Fl_Gl_Window.H
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
4.6 Sys-MyGlWindowPlot.cpp 23
4.6 Sys-MyGlWindowPlot.cpp
00001 //============================================================================00002 // Name : Sys-MyGlWindowPlot00003 // Author : Michel Alves dos Santos00004 // Version : 1.000005 //============================================================================0000600007 #include <iostream>00008 #include <FL/Fl.H>00009 #include <FL/glut.H>00010 #include <FL/Fl_Double_Window.H>00011 #include "MyGlWindowPlot.h"0001200016 int main(int argc, char* argv[])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
Index
addMyGlWindowPlot, 11
bFLPlotColor, 5, 6
clearMyGlWindowPlot, 11
colorFLPlotPointXY, 8
drawCircleMyGlWindowPlot, 11
FLPlotColor, 5b, 5, 6FLPlotColor, 5g, 6r, 6
FLPlotPointXY, 7color, 8FLPlotPointXY, 8label, 8x, 8, 9y, 9
gFLPlotColor, 6
handleMyGlWindowPlot, 12
labelFLPlotPointXY, 8
mainSys-MyGlWindowPlot.cpp, 22
MarkedPointMyGlWindowPlot, 12
MarkPointMyGlWindowPlot, 12
max_y_valueMyGlWindowPlot, 12
MyGlWindowPlot, 10add, 11clear, 11
drawCircle, 11handle, 12MarkedPoint, 12MarkPoint, 12max_y_value, 12MyGlWindowPlot, 11Normalize, 12ResetZoom, 13ZoomLess, 13ZoomMore, 13
MyGlWindowPlot.cxx, 15MyGlWindowPlot.h, 19
NormalizeMyGlWindowPlot, 12
rFLPlotColor, 6
ResetZoomMyGlWindowPlot, 13
Sys-MyGlWindowPlot.cpp, 22main, 22
xFLPlotPointXY, 8, 9
yFLPlotPointXY, 9
ZoomLessMyGlWindowPlot, 13
ZoomMoreMyGlWindowPlot, 13