Qucs-GUI  0.0.18
 All Data Structures 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>
26 #include <Q3PtrList>
27 #include <QDateTime>
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  Q3PtrList<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  Q3PtrList<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
QString save()
Definition: graph.cpp:91
Q3PtrList< Marker > Markers
Definition: graph.h:79
Defines drawing elements for schematics.
int Thick
Definition: graph.h:77
int Precision
Definition: graph.h:82
int countY
Definition: graph.h:74
int count
Definition: graph.h:53
Definition: graph.h:57
float * ScrPoints
Definition: graph.h:73
QString Var
Definition: graph.h:50
void paintLines(ViewPainter *, int, int)
Definition: graph.cpp:73
Definition: graph.h:47
bool load(const QString &)
Definition: graph.cpp:105
int getSelected(int, int)
Definition: graph.cpp:148
~DataX()
Definition: graph.h:50
QString Var
Definition: graph.h:75
Graph * sameNewOne()
Definition: graph.cpp:230
QDateTime lastLoaded
Definition: graph.h:69
Superclass of all schematic drawing elements.
Definition: element.h:142
int numMode
Definition: graph.h:83
int Style
Definition: graph.h:78
QColor Color
Definition: graph.h:76
void paint(ViewPainter *, int, int)
Definition: graph.cpp:53
Graph(const QString &_Line="")
Definition: graph.cpp:24
double * Points
Definition: graph.h:52
Q3PtrList< DataX > cPointsX
Definition: graph.h:71
double * cPointsY
Definition: graph.h:72
~Graph()
Definition: graph.cpp:44
DataX(const QString &Var_, double *Points_=0, int count_=0)
Definition: graph.h:48
int yAxisNo
Definition: graph.h:70