Allink  v0.1
ElementiGrafici.h
00001 /***********************************************************************
00002 ElementiGrafici: Header file for the ElementiGrafici class
00003  Copyright (C) 2008 by Giovanni Marelli <sabeiro@virgilio.it>
00004 
00005 
00006 This program is free software; you can redistribute it and/or modify
00007 it under the terms of the GNU General Public License as published by
00008 the Free Software Foundation; either version 2 of the License, or
00009 (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 ***********************************************************************/
00020 #ifndef ELEMENTIGRAFICI_H
00021 #define ELEMENTIGRAFICI_H
00022 
00023 #include <qprinter.h>
00024 #include <qmessagebox.h>
00025 #include <qimage.h>
00026 #include <qerrormessage.h>
00027 #include <Q3VBox>
00028 #include <qslider.h>
00029 #include <qtextdocument.h>
00030 //#include <qvbox.h>
00031 
00032 /* #include <qwidget.h> */
00033 /* #include <Q3PointArray> */
00034 
00035 /* #include <qtimer.h> */
00036 /* #include <qpixmap.h> */
00037 /* #include <qdatetime.h> */
00038 /* /\* /\\* #include <stdlib.h> *\\/ *\/ */
00039 /* /\* /\\* #include <math.h> *\\/ *\/ */
00040 /* /\*             //#include <qpointarray.h> *\/ */
00041 /* #include <qpixmap.h> */
00042 /*              //#include <qpaintdevicemetrics.h> */
00043 /* #include <QLineEdit> */
00044 //#include <QMenuBar>
00045 #include <VarDatFile.h>
00046 
00047 #define LINEA_NIENTE 0x00000
00048 #define LINEA_PUNTO  0x00001
00049 #define LINEA_TRATTO 0x00002
00050 #define LINEA_PUNTOETRATTO 0x00003
00051 #define LINEA_ERRORE 0x00008
00052 
00053 ;
00055 enum VisDis{
00057   DIS_SEGNALE =  0x00002,
00059   DIS_TUTTI   =  0x00004,
00061   DIS_MOMENTI =  0x00008,
00063   DIS_BLU     =  0x00010,
00065   DIS_RETTA   =  0x00020,
00067   DIS_PARABOLA=  0x00040,
00069   DIS_EXP     =  0x00080,
00071   DIS_GAUSS   =  0x00100,
00073   DIS_PUNTI   =  0x00200,
00075   DIS_ERR     =  0x00400,
00076 };
00077 #define RIS_UNO       0x00002
00078 #define RIS_TUTTI     0x00004
00079 
00080 #define INIT_NUM  15
00081 ;
00083 class ElementiGrafici:public QWidget{
00084   Q_OBJECT
00085     public:
00087   ElementiGrafici( QWidget *parent=0,const char *name=0);
00089   ~ElementiGrafici();
00090   QSizePolicy Dimensionamento() const;
00091   //vector <double> st;
00093   int NMax;
00095   int NDis;
00097   VarDatFile *v1;
00099   char *nomeFile;
00101   char *nomeConf;
00103   char *nomeSalva;
00105   QString nomeTit;
00107   QString nomeEtX;
00109   QString nomeEtY;
00110  public:
00112   void ChooseDataFile(char* FileName);
00114   void ChooseConfFile(char* FileName);
00115   public slots:
00117   void ImpNBin(int n);
00119   void ImpNMobile(int n);
00121   void ImpNCorrela(int n);
00123   void ImpNVisMin(int n);
00125   void ImpNVisMax(int n);
00127   void ImpNElMin(int n);
00129   void ImpNElMax(int n);
00130   void ImpNElMinY(int n);
00131   void ImpNElMaxY(int n);
00132   void ImpInter(int n);
00133   void ImpInterEl(int n);
00134   void ImpCoordX(int n);
00135   void ImpCoordY(int n);
00137   void ImpCoordDY(int n);
00139   /* typedef void(ElementiGrafici::*IMP_COORD)(int n); */
00141   /* IMP_COORD Imp_Coord; */
00142   /* /// Pointer to a generic function */
00143   /* void ImpCoord(int n){return (*this.*Imp_Coord)(n);} */
00144   void ImpNVarX(int n,int m);
00145   void ImpNVarY(int n,int m);
00146   void ImpInter(int n,int m);
00147   void ImpInterEl(int n,int m);
00148   void ImpInterY(int n,int m);
00149   void Apri();
00150   void Apri(char **argv,int *FileList,int NFile);
00151   void ApriExt(double **ExtSt,int ExtNMax,int ExtNVar,int ExtNBin);
00152   void ApriExt(VarDatFile *Extv1);
00153   void Aggiungi();
00154   void PuntiSegnale();
00155   void PuntiDistribuzione();
00156   void PuntiSommaSegnali();
00157   void PuntiInterRett();
00158   void PuntiInterExp();
00159   void PuntiInterGauss();
00160   void PuntiParabola();
00161   void PuntiMediaMob();
00162   void PuntiCorrelaADue();
00163   void PuntiAutosimilarita();
00164   void PuntiIntegrale();
00165   void PuntiDerivata();
00166   void PuntiVarie();
00167   void PuntiSpettro();
00168   void PuntiNormalizza();
00169   void PuntiModulo();
00170   void PuntiRadice();
00171   void PuntiAutocor();
00172   void PuntiSum();
00173   void DisegnaLinee();
00174   void DisegnaPunti();
00175   void DisegnaGriglia();
00176   void DisegnaLogx();
00177   void DisegnaLogy();
00178   void SeRiscala();
00179   void SeRiscalaTutto();
00180   void NSet();
00181   void StampaFile();
00182   void PuntaExt(double **ExtSt,int nVar);
00183   void SulSegnale(bool);
00184   void SulGrafico(bool);
00185   void SuX(bool);
00186   void SuY(bool);
00187   void SuDX(bool);
00188   void SuDY(bool);
00189   void Ridisegna();
00190   void InfoStato(const char *);
00191   void InfoSequenza(const char *);
00192   void Salva();
00193   void NomeFile(const QString &);
00194   void NomeConf(const QString &);
00195   void NomeEntrata(const QString &);  
00196   void NomeSalva(const QString &);
00197   void NomeUscita(const QString &);
00198   void NomeTitolo(const QString &);
00199   void NomeEtichettaX(const QString &);
00200   void NomeEtichettaY(const QString &);
00201   void NomeTit(const QString &);
00202   void NomeEtX(const QString &);
00203   void NomeEtY(const QString &);
00204   
00205   private slots:
00206 
00207   signals:
00208   void NBinCambiati(int);
00209   void NMobileCambiato(int);
00210   void NCorrelaCambiato(int);
00211   void NVisMinCambiato(int);
00212   void NVisMaxCambiato(int);
00213   void NElMinCambiato(int);
00214   void NElMaxCambiato(int);
00215   void NElMinYCambiato(int);
00216   void NElMaxYCambiato(int);
00217   void LogxCambiato(bool);
00218   void LogyCambiato(bool);
00219   void MediaCambiata(int);
00220   void ScartoCambiato(int);
00221   void InterVisCambiato(int);
00222   void InterElCambiato(int);
00223   void InterVisCambiato(int,int);
00224   void InterElCambiato(int,int);
00225   void InterYCambiato(int,int);
00226   void CoordXCambiata(int);
00227   void CoordYCambiata(int);
00228   void InterCoordXCambiato(int,int);
00229   void InterCoordYCambiato(int,int);
00230   void FineSimulazione();
00231   void SegnaleGrafico(bool);
00232   void Stato(const QString &);
00233   void StatoSequenza(const QString &);
00234   void TestoCambiato(const QString &);
00235   void ConfCambiato(const QString &);
00236   void SalvaCambiato(const QString &);
00237   void TitoloCambiato(const QString &);
00238   void EtichettaXCambiato(const QString &);
00239   void EtichettaYCambiato(const QString &);
00240   
00241  protected:
00242   virtual void paintEvent(QPaintEvent *);
00243   virtual void mouseMoveEvent(QMouseEvent *);
00244   
00245  private:
00246   void DisegnaPunti(QPainter *);
00247   void GrStampante(QPainter *);
00248   void GrMomenti(QPainter *);
00249   void GrBlu(QPainter *);
00250   void GrSet(QPainter *p,int s);
00251   void GrPunti(QPainter *);
00252   void GrGriglia(QPainter *);
00253   void GrBarre(QPainter *);
00254   void GrRiscala();
00255   void GrLegenda(QPainter *);
00256   void GrMessage(const char *s, ... );
00257   void DisegnaTesto(QPainter *);
00258   void GrScript(char *File2Read,QPainter *p);
00259   void GrConf(char *File2Read);
00260   void StringToUnicode(char *cLine,QString *Label);
00261   FILE *SEGNALE;
00262   QRect PuntiRett(QPoint) const;
00263   QColor *GrLinee;
00264   QString *GrLabel;
00265   //  vector <QPoint> Punti;
00266   //double *Punti;
00267   //double *SetPunti;
00268   //double *PuntiBlu;
00269   //double *Ascissa;
00270   QPoint Punto;
00271   //  QPointArray *PuntiLinea;
00272   QPoint Punto1;
00273   QPoint Punto2;
00274   QPoint Punto3;
00275   int PointSize;
00276   int ContaTempo;
00277   QTimer *TempoGrafica;
00278   char *stringa;
00279   char *cPos;
00280   char **LineaQuale;
00281   char FormatPrecX;
00282   char FormatPrecY;
00283   char XFormula[60];
00284   char YFormula[60];
00285   int NBin;
00286   int NMobile;
00287   int NCorrela;
00288   int NVisMin;
00289   int NVisMax;
00290   int NElMin;
00291   int NElMax;
00292   int NElMinY;
00293   int NElMaxY;
00294   int PuntiMax;
00295   int RisY;
00296   int RisX;
00297   int GrigliaX;
00298   int GrigliaY;
00299   int StampaX;
00300   int StampaY;
00301   int DigPrecX;
00302   int DigPrecY;
00303   double yMax;
00304   double yMin;
00305   double yMax1;
00306   double yMin1;
00307   double xMax;
00308   double xMin;
00309   double yBluMin;
00310   double yBluMax;
00311   double Delta;
00312   double ViewportX;
00313   double ViewportY;
00314   double ScalaTopoX;
00315   double ScalaTopoY;
00316   double PosLegenda[4];
00317   double PosInterp[2];
00318   double RatioWidthHeight;
00319   int NyMin;
00320   int NyMax;
00321   int NxMin;
00322   int NxMax;
00323   int NVar;
00324   int CoordX;
00325   int CoordY;
00326   int CoordDY;
00327   int Tempx;
00328   int Tempy;
00329   int NSequenza;
00330   int Coord;
00331   int Confini[2];
00332   int *LineaCome;
00333   int PrimaVolta;
00334   int VoltaBlu;
00335   int VoltaMomenti;
00336   int VoltaRetta;
00337   int VoltaParabola;
00338   int Linee;
00339   int Quadrati;
00340   int LogLog;
00341   int IfLogx;
00342   int IfLogy;
00343   int Griglia;
00344   int IfSegnale;
00345   int IfStampa;
00346   int IfRiscala;
00347   int IfRiscalaTutto;
00348   int IfDisegna;
00349   int IfNorm;
00350   int FontSize;
00351   QErrorMessage *ErrPrima;
00352   QMessageBox *Messaggio;
00353   QImage Immagine;
00354   QPrinter *Stampante;
00355   QFont Font;
00356   MOMENTI m1;
00357   RETTA r1;
00358   PARABOLA p1;
00359   QColor *Colors;
00360 };
00362 class Finestra: public QWidget{
00363  private:
00364   //         Elementi Grafici
00365   ElementiGrafici *e1;
00366  public:
00367   Finestra(QWidget *parent=0,const char *name=0);
00368   void DataFile(char **argv,int *FileList,int NFIle);
00369   void ConfFile(char *FileName);
00370   //  char *FileDaScrivere;
00371   //  void ScriviNomeFile(char *);
00372 };
00374 class ImpostaNBin : public Q3VBox{
00375   Q_OBJECT
00376     public:
00377   ImpostaNBin(QWidget *parent,const char *name =0);
00378   void Testo(const char *);
00379   int Numero() const;
00380 
00381   public slots:
00382   void ImpNumero( int );
00383   void ImpInter(int Max);
00384   void ImpInter(int Min,int Max);
00385  signals:
00386   void ValoreCambiato( int );
00387 
00388  private:
00389   QSlider *slider;
00390   QLabel *label;
00391   QLabel *title;
00392 };
00393 
00394 /* class Sets : public QMenuBar{ */
00395 /*   Q_OBJECT */
00396 /*     public: */
00397 /*   Sets(QWidget *parent,const char *name =0); */
00398 /*   QAction *ASet; */
00399 /*   int NSet; */
00400 /*   public slots: */
00401 /*   void ImpCoord(int Coord); */
00402 /*  signals: */
00403 /*   void ChoosedSet(void); */
00404 /*  }; */
00405 
00406 
00407 #endif //ELEMENTIGRAFICI_H