crabs_firewall-3.0.1 ©2005-2011 - Christophe CAZAJUS (crabs-mettre_le_signe_at-crabs-world.com)
1 /* 2 **============================================================================= 3 ** crabs_firewall-3.0.1 : Firewall-Masquerade avec interface http 4 ** Copyright (C) 2005-2011 : Christophe CAZAJUS (crabs-mettre_le_signe_at-crabs-world.com) 5 ** 6 ** Ce source fait partie d'un projet logiciel libre. Vous pouvez le distribuer 7 ** et/ou le modifier en respectant les termes de la GNU General Public License 8 ** version 2 ou (suite a votre propre choix) une version ulterieure. 9 ** 10 ** Ce programme est distribue dans l'espoir qu'il puisse etre utile, mais 11 ** sans aucune garantie, meme si il est associe a un produit qui vous en 12 ** propose une. Conformez-vous a la GNU General Public License pour avoir 13 ** plus de precisions. 14 ** 15 ** L'auteur ne peut etre tenu responsable de l'utilisation faite des 16 ** composantes associees a ce projet (en partie ou dans leur totalite). 17 ** 18 ** Une copie du fichier de la GNU GPL est fournie dans le repertoire DOC 19 ** de ce projet sous le nom gnu_gpl.txt 20 ** 21 **============================================================================= 22 */ 23 #ifndef __CRABS__GRAPH__H__ 24 #define __CRABS__GRAPH__H__ 25 /* 26 ** ONLY FOR C++ PROJECT 27 ** NEED libgd http://www.libgd.org/ 28 ** formely known as gd (http://www.boutell.com/gd/) 29 */ 30 #include <stdarg.h> 31 #include <sys/types.h> 32 #include <gd.h> 33 34 // Classe de base : utilise les float 35 class CGserie 36 { 37 public : 38 CGserie( int _nb ) ; 39 virtual ~CGserie() ; 40 virtual void textValeur( int ix, char* str, size_t sz ) ; 41 virtual void textValeur( double v_, char* str, size_t sz ) ; 42 void setTextFormat( const char* _fmt ) ; 43 void setMinMax( double _min, double _max ) ; 44 void setMinMaxReel() ; 45 void setMin( double _min ) ; 46 void setMax( double _max ) ; 47 void setMinMax( CGserie* ) ; 48 void unsetMinMax() ; 49 virtual void getMinMax( double& _min, double& _max ) ; 50 virtual void setValeur( int ix, double _v ) ; 51 virtual double getValeur( int ix ) ; 52 virtual void setNb( int _nb ) ; 53 virtual void setNaNValeur( double _v ) ; 54 int getNb() ; 55 void setNom( const char* _nom ) ; 56 void getNom( char* _nom ) ; 57 static void memeAxe( CGserie*, ... /* CGserie*, ..., O */ ) ; 58 protected : 59 int nb ; 60 double* v ; 61 double min ; 62 double max ; 63 double min_ ; 64 double max_ ; 65 double no_value ; 66 bool no_v ; 67 bool min_set ; 68 bool max_set ; 69 char fmt [128] ; 70 char nom [128] ; 71 } ; 72 class CGserieTimeStamp : public CGserie 73 { 74 public : 75 CGserieTimeStamp( int _nb ) ; 76 virtual ~CGserieTimeStamp() ; 77 virtual void textValeur( int ix, char* str, size_t sz ) ; 78 virtual void textValeur( double v_, char* str, size_t sz ) ; 79 } ; 80 81 class CGgraph 82 { 83 public : 84 CGgraph() ; 85 virtual ~CGgraph() ; 86 void setWidthHeight( int w, int h ) { W=w; H=h ; } 87 void setAxeX( CGserie* axe ) ; 88 int ajouteAxeY( CGserie* axe ) ; 89 bool supprimeAxeY( int axe ) ; 90 int ajouteCourbe( CGserie* valeur, int _axeY, 91 int R, int G, int B, const char* nom=0 ) ; 92 bool supprimeCourbe( int id ) ; 93 void setFichier( const char* _fichier ) ; 94 void setTitre( const char* _titre ) ; 95 virtual bool creerGraph() ; 96 void zoneCourbe( int&x0,int&y0, int&x1,int&y1 ) ; 97 98 protected : 99 int Min( int n, int a, ... ) ; 100 int Max( int n, int a, ... ) ; 101 char* textSize( char* txt, char* font, int sz, int& w, int& h ) ; 102 void dessineTitre( gdImagePtr im, int col ) ; 103 void dessineLegende( gdImagePtr im ) ; 104 void dessineValeurAxe( gdImagePtr im ) ; 105 106 static const int mDEF = 0x00000000 ; 107 static const int mCX = 0x00000001 ; 108 static const int mDX = 0x00000002 ; 109 static const int mGX = 0x00000004 ; 110 static const int mCY = 0x00000010 ; 111 static const int mHY = 0x00000020 ; 112 static const int mBY = 0x00000040 ; 113 void dessineTexte( gdImagePtr im, char* txt, int x, int y, int mode, 114 char * font, int sz ) ; 115 static const int NbAxeY = 2 ; 116 static const int NbCourbe= 10 ; 117 struct CGcourbe 118 { 119 CGserie* valeur ; 120 int axeY ; 121 int R,G,B ; 122 char nom [32]; 123 } ; 124 char fichier [1024] ; 125 char titre [256] ; 126 CGserie * axeX ; 127 CGserie * axeY [NbAxeY] ; 128 CGcourbe crb [NbCourbe] ; 129 int W, H ; 130 int margeG, margeD ; 131 int margeH, margeB ; 132 int blanc, noir, caxe ; 133 } ; 134 135 #endif
Date de génération : 22/09/2011 21:48