• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Documentation - MyGlWindowPlot
 

Documentation - MyGlWindowPlot

on

  • 139 views

Class that implements the behavior of an OpenGL window in FLTK. The class in question simulates a plotter points in two dimensions.

Class that implements the behavior of an OpenGL window in FLTK. The class in question simulates a plotter points in two dimensions.

Statistics

Views

Total Views
139
Views on SlideShare
139
Embed Views
0

Actions

Likes
0
Downloads
1
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Documentation - MyGlWindowPlot Documentation - MyGlWindowPlot Document Transcript

    • Reference Manual Generated by Doxygen 1.6.3 Sun Dec 4 13:31:15 2011
    • Contents 1 1 1.1 2 Class Index 1 Class List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2.1 3 File Index 3 File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 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 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 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 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 3.1.3 3.2 3.2.3
    • ii CONTENTS 3.2.3.6 9 3.2.3.7 y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.2.3.8 y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 MyGlWindowPlot Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.3.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.3.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . 11 3.3.2.1 MyGlWindowPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.3.3 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 Sys-MyGlWindowPlot.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.6 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 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . FLPlotPointXY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . MyGlWindowPlot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 7 10
    • Chapter 2 File Index 2.1 File List Here is a list of all files with brief descriptions: MyGlWindowPlot.cxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . MyGlWindowPlot.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Sys-MyGlWindowPlot.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 19 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 { 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
    • 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
    • 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
    • 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
    • 10 Class Documentation 3.3 MyGlWindowPlot Class Reference #include <MyGlWindowPlot.h> Collaboration diagram for MyGlWindowPlot: 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() _marked_point 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() 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; 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
    • 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
    • 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 This graph shows which files directly or indirectly include this file: MyGlWindowPlot.cxx FL/Fl_Gl_Window.H
    • 16 4.2 00001 00002 00003 00004 00005 00006 00007 00008 00009 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00026 00027 00028 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 File Documentation MyGlWindowPlot.cxx /* * MyGlWindowPlot.cxx * * Created on: 11/09/2009 Author: Michel Alves dos Santos * */ #include "MyGlWindowPlot.h" void MyGlWindowPlot::InitializeSystem() { _aspect_ratio_x = 2.5; _aspect_ratio_y = 1; _mark_height_in_x = 2.5; _submark_height_in_x = 1.5; _aspect_ratio = (double)w()/(double)h(); _label_plotter = ""; } MyGlWindowPlot::MyGlWindowPlot(int X,int Y,int W,int H,const char*L) : Fl_Gl_Window(X,Y,W,H,L) { InitializeSystem(); }; void MyGlWindowPlot::draw() { // Inicialização dos atributos de visualização da janela if (!valid()) { valid(1); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0,0,w(),h()); glOrtho(0, w(), -h() , h(), -1, 1); } // Limpando a tela glClear(GL_COLOR_BUFFER_BIT); //Habilitando transparência glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glShadeModel(GL_FLAT); //Desenhando o eixo de coordenadas glLineWidth(2); glColor3f(1.0, 1.0, 1.0); glBegin(GL_LINE_STRIP); glVertex2f(1, h()); glVertex2f(1,-h()); glBegin(GL_LINE_STRIP); glVertex2f(0, 0); glVertex2f(w(), 0); glEnd(); glEnd(); //Nomeando os eixos de coordenadas ... gl_font(FL_COURIER_BOLD,15); gl_color(FL_YELLOW); gl_draw(" x " , w()-40, -40); gl_color(FL_YELLOW); gl_draw(" y - Diagrama Dispersivo", 5, h()-20); //Desenhando a linha poligonal que representa a curva glPushMatrix(); glScalef(_aspect_ratio,_aspect_ratio,1); glPointSize(2); //Desenho os pontos que foram fornecidos para o plotter glPointSize(2); glColor3ub(63,255,6); glBegin(GL_POINTS); for(register unsigned int index = 0; index < _points.size(); index++) glVertex2f(_points[index].x(),Normalize(_points[index].y())); glEnd(); Generated on Sun Dec 4 13:31:15 2011 by Doxygen
    • 4.2 MyGlWindowPlot.cxx 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00106 00107 00108 00109 00110 00111 00115 00116 00117 00118 00119 00120 00124 00125 00126 00127 00128 00129 00133 00134 00135 00136 00137 00141 00142 00143 00144 00145 00146 00150 17 glPopMatrix(); //Desabilitando o alpha / transparência glDisable(GL_BLEND); //Marcando a origem dos eixos glPointSize(4); glColor3ub(255,99,23); glBegin(GL_POINTS); glVertex2f(0,0); glVertex2f(0,0); glEnd(); } void MyGlWindowPlot::resize(int X,int Y,int W,int H) { Fl_Gl_Window::resize(X,Y,W,H); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(0,0,W,H); glOrtho(-W,W,-H,H,-1,1); redraw(); } void MyGlWindowPlot::ZoomLess(void) { _aspect_ratio = (double)_aspect_ratio/1.05; redraw(); }; void MyGlWindowPlot::ZoomMore(void) { _aspect_ratio = (double)_aspect_ratio*1.05; redraw(); }; void MyGlWindowPlot::ResetZoom(void) { _aspect_ratio = (double)w()/(double)h(); redraw(); }; void MyGlWindowPlot::max_y_value(long double y_max) { _max_y_value = y_max; }; long double MyGlWindowPlot::Normalize(long double y_value) { long double _max = (_max_y_value == 0)?(1):(_max_y_value); return (long double)( ((h()*0.55)*y_value)/(_max)); } 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 } 00154 00158 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 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00187 File Documentation void MyGlWindowPlot::drawCircle(float Radius, unsigned int numPoints) { glBegin( GL_LINE_STRIP ); for(unsigned int i=0; i <= numPoints; i++ ) { float Angle = i * (2.0*M_PI/numPoints); // use 360 instead of 2.0*PI if float X = cos( Angle )*Radius; // you use d_cos and d_sin float Y = sin( Angle )*Radius; glVertex2f( X, Y ); } glEnd(); } void MyGlWindowPlot::clear(void) { _points.clear(); redraw(); }; Generated on Sun Dec 4 13:31:15 2011 by Doxygen
    • 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
    • 20 4.4 00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00023 00024 00025 00026 00027 00028 00029 00030 File Documentation MyGlWindowPlot.h /* * MyGlWindowplot.h * * Created on: 11/09/2009 Author: Administrador * */ #ifndef MYGLWINDOWPLOT_H_ #define MYGLWINDOWPLOT_H_ #include #include #include #include <cmath> <vector> <iostream> <sstream> #include <FL/Fl.H> #include <FL/gl.h> #include <FL/Fl_Gl_Window.H> class FLPlotColor { unsigned char _r; unsigned char _g; unsigned char _b; //Componente vermelha //Componente verde //Componente azul public: FLPlotColor(unsigned char r = 0, unsigned char g =0, unsigned char b = 0): _r (r), _g(g), _b(b) {}; 00031 00032 void r(unsigned char red) { _r = red; }; 00033 void g(unsigned char green) { _g = green; }; 00034 void b(unsigned char blue) { _b = blue; }; 00035 00036 unsigned char r(void) { return _r; }; 00037 unsigned char g(void) { return _g; }; 00038 unsigned char b(void) { return _b; }; 00039 }; 00040 00044 class FLPlotPointXY 00045 { 00046 float _x; // Coordenada x 00047 float _y; // Coordenada y 00048 FLPlotColor _color; // Cor do ponto 00049 std::string _label; // Um rótulo para o ponto 00050 00051 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; }; 00054 00055 float x(void) { return _x; }; 00056 void x(float X) { _x = X; }; 00057 00058 float y(void) { return _y; }; 00059 void y(float Y) { _y = Y; }; 00060 00061 FLPlotColor color(void) { return _color; }; 00062 void color(FLPlotColor color) { _color = color; }; 00063 00064 std::string label(void) { return _label; }; 00065 void label(std::string L) { _label = L; }; 00066 }; 00067 00071 class MyGlWindowPlot : public Fl_Gl_Window 00072 { Generated on Sun Dec 4 13:31:15 2011 by Doxygen
    • 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
    • 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
    • 4.6 Sys-MyGlWindowPlot.cpp 4.6 00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 Sys-MyGlWindowPlot.cpp //============================================================================ // Name : Sys-MyGlWindowPlot // Author : Michel Alves dos Santos // Version : 1.0 //============================================================================ #include #include #include #include #include <iostream> <FL/Fl.H> <FL/glut.H> <FL/Fl_Double_Window.H> "MyGlWindowPlot.h" int main(int argc, char* argv[]) { Fl_Double_Window mywin(0,0,400,300); mywin.resizable(mywin); mywin.begin(); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); MyGlWindowPlot g(10, 10, 380, 260); mywin.end(); mywin.show(); return Fl::run(); } Generated on Sun Dec 4 13:31:15 2011 by Doxygen 23
    • Index add MyGlWindowPlot, 11 b FLPlotColor, 5, 6 clear MyGlWindowPlot, 11 color FLPlotPointXY, 8 drawCircle MyGlWindowPlot, 11 FLPlotColor, 5 b, 5, 6 FLPlotColor, 5 g, 6 r, 6 FLPlotPointXY, 7 color, 8 FLPlotPointXY, 8 label, 8 x, 8, 9 y, 9 drawCircle, 11 handle, 12 MarkedPoint, 12 MarkPoint, 12 max_y_value, 12 MyGlWindowPlot, 11 Normalize, 12 ResetZoom, 13 ZoomLess, 13 ZoomMore, 13 MyGlWindowPlot.cxx, 15 MyGlWindowPlot.h, 19 Normalize MyGlWindowPlot, 12 r FLPlotColor, 6 ResetZoom MyGlWindowPlot, 13 Sys-MyGlWindowPlot.cpp, 22 main, 22 x FLPlotPointXY, 8, 9 g FLPlotColor, 6 y FLPlotPointXY, 9 handle MyGlWindowPlot, 12 label FLPlotPointXY, 8 main Sys-MyGlWindowPlot.cpp, 22 MarkedPoint MyGlWindowPlot, 12 MarkPoint MyGlWindowPlot, 12 max_y_value MyGlWindowPlot, 12 MyGlWindowPlot, 10 add, 11 clear, 11 ZoomLess MyGlWindowPlot, 13 ZoomMore MyGlWindowPlot, 13