summaryrefslogtreecommitdiff
path: root/support/fastpictex/src/fastpictex.h
blob: f73e8d4d955c5953c4298738e87019a63c080402 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*******************************************************/
/* Linux  GNU     C++ Compiler                         */
/* Name : fastpictex.h                                 */
/* Autor: Harald Stauss                                */
/*******************************************************/

#ifndef FPICTEX
#define FPICTEX
#define MAX_FIELD_LENGTH 256
#define WHITE_SPACE " \t\n\0"
#define NSYMBOL 10    /* number of different plot symbols          */
#define N_XTICKS 5    /* number of ticks on x-scale                */
#define N_YTICKS 5    /* number of ticks on y-scale                */
#define BARWIDTH 0.8  /* How much space is used for bar graphs 0-1 */

#include <string.h>

class FASTPICTEX {

    typedef struct {
	short         type;                    /* type of graph: 0:ndef, 1:xy, 2:line, 3:bar */
	short         tline;                   /* trendline for xy: 0:no, 1:yes no formula, 2: yes with formula */
	float         m1, m2, b;               /* linear regression line parameters */
	unsigned long nreg;                    /* number of data points for regression line */
	unsigned long ndata, nx, ny, ndx, ndy; /* number of data points    */
	float         *x;                      /* pointer to x values      */
	float         *y;                      /* pointer to y values      */
	float         *dx;                     /* pointer to x-errors      */
	float         *dy;                     /* pointer to y-errors      */
	char          **sig;                   /* pointer to sig. signs    */
	char          *legend;                 /* pointer to legend string */
  }
  SERIES;

  /* holds plot symbols */
  char  plotsym[NSYMBOL][80];
  char  linesym[NSYMBOL][80];
  short need_errorbarmacros;

  /* To add a new series */
  int AddSeries();  

  /* Get Extrema */
  int GetExtrema(short is_limit, float x1, float x2, float *xmin, float *xmax, float *ymin, float *ymax);

public:

    float   width, height;              /* width and height of graph */
    short   nofseries;                  /* number of series */
    short   nofbar;                     /* number of bar graph series */
    short   linenoxmax;                 /* fist line graph without x-values */
    short   noftline;                   /* number of trendlines     */
    short   xgrid, ygrid;               /* if 1 draw x/y-gridlines */
    char    *xlabel, *ylabel, *heading; /* various labels */
    unsigned long nxticlabels;          /* number of ticlabels     */
    char    **xticlabels;               /* pointers to x tic labels */
    int     nofrawpictex;               /* number of pictex commands */
    char    **rawpictex;                /* raw pictex commands */
    SERIES  *series;                    /* pointer to an array of SERIES */
    
  /* Initialisierung der Registrierung */
  FASTPICTEX();   // Constructor;
  ~FASTPICTEX();  // Destructor;

  /* function to read input file */
  int Read(char *fname);

  /* function to write PicTeX file */
  int Write(char *fname);
  
}; /* Ende der Klassendefinition */

#endif