forked from jedi98/sark-100-antenna-analyzer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgraph.h
More file actions
126 lines (98 loc) · 2.53 KB
/
Copy pathgraph.h
File metadata and controls
126 lines (98 loc) · 2.53 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
(C) Copyright 2015 Jeremy Burton
This file is part of Sark-100-antenna-analyzer.
Sark-100-antenna-analyzer is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
Sark-100-antenna-analyzerr is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRAPH_H
#define GRAPH_H
#include <QPainter>
#include <QRect>
#include <QFont>
class GraphItem;
class Graph
{
public:
Graph();
void SetSize(QRect size);
void AddItem(GraphItem *item);
void Draw(QPainter &painter);
int marginl,marginb,marginr,margint;
int xo,yo,w,h;
private:
std::vector<GraphItem *> items;
};
class GraphItem
{
public:
GraphItem(Graph *g);
virtual ~GraphItem() {};
virtual void Draw(QPainter &painter) = 0;
bool enabled;
QPen pen;
protected:
Graph *graph;
};
class GraphScale : public GraphItem
{
public:
enum pos_t {pos_left,pos_right,pos_bottom,pos_top};
GraphScale(Graph *g, pos_t p);
virtual ~GraphScale() {};
void Draw(QPainter &painter);
void SetIncAuto();
void SetMinAuto();
void Expand(double min,double max);
QFont font;
double vmin, vmax, vinc;
pos_t pos;
int labdps;
QString title,labsuffix;
double labdiv;
};
class GraphDataItem : public GraphItem
{
public:
GraphDataItem(Graph *g, GraphScale *s);
protected:
GraphScale *scale;
};
class GraphHorizLine : public GraphDataItem
{
public:
GraphHorizLine(Graph *g, GraphScale *s) : GraphDataItem(g,s) {};
virtual ~GraphHorizLine() {};
void Draw(QPainter &painter);
double val;
//private:
// GraphScale *scale;
};
class GraphVertLine : public GraphDataItem
{
public:
GraphVertLine(Graph *g, GraphScale *s) : GraphDataItem(g,s) {};
virtual ~GraphVertLine() {};
void Draw(QPainter &painter);
double val;
//private:
// GraphScale *scale;
};
class GraphTrace : public GraphDataItem
{
public:
GraphTrace(Graph *g, GraphScale *s) : GraphDataItem(g,s) {};
virtual ~GraphTrace() {};
void Draw(QPainter &painter);
std::vector<double> points;
//private:
// GraphScale *scale;
};
#endif // GRAPH_H