My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
graph.h
Go to the documentation of this file.
1 /***************************************************************************
2  graph.h
3  ---------
4  begin : Thu Oct 2 2003
5  copyright : (C) 2003 by Michael Margraf
6  email : michael.margraf@alumni.tu-berlin.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef GRAPH_H
19 #define GRAPH_H
20 
21 
22 #include "marker.h"
23 #include "element.h"
24 
25 #include <qcolor.h>
26 #include <qptrlist.h>
27 #include <qdatetime.h>
28 
29 
30 // meaning of the values in a graph "Points" list
31 #define STROKEEND -2
32 #define BRANCHEND -10
33 #define GRAPHEND -100
34 
35 #define GRAPHSTYLE_SOLID 0
36 #define GRAPHSTYLE_DASH 1
37 #define GRAPHSTYLE_DOT 2
38 #define GRAPHSTYLE_LONGDASH 3
39 #define GRAPHSTYLE_STAR 4
40 #define GRAPHSTYLE_CIRCLE 5
41 #define GRAPHSTYLE_ARROW 6
42 
43 class Diagram;
44 class ViewPainter;
45 
46 
47 struct DataX {
48  DataX(const QString& Var_, double *Points_=0, int count_=0)
49  : Var(Var_), Points(Points_), count(count_) {};
50  ~DataX() { if(Points) delete[] Points; };
51  QString Var;
52  double *Points;
53  int count;
54 };
55 
56 
57 class Graph : public Element {
58 public:
59  Graph(const QString& _Line="");
60  ~Graph();
61 
62  void paint(ViewPainter*, int, int);
63  void paintLines(ViewPainter*, int, int);
64  QString save();
65  bool load(const QString&);
66  int getSelected(int, int);
67  Graph* sameNewOne();
68 
69  QDateTime lastLoaded; // when it was loaded into memory
70  int yAxisNo; // which y axis is used
71  QPtrList<DataX> cPointsX;
72  double *cPointsY;
73  float *ScrPoints; // data in screen coordinates
74  int countY; // number of curves
75  QString Var;
76  QColor Color;
77  int Thick;
78  int Style;
79  QPtrList<Marker> Markers;
80 
81  // for tabular diagram
82  int Precision; // number of digits to show
83  int numMode; // real/imag or polar (deg/rad)
84 };
85 
86 #endif