-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraph.h
More file actions
79 lines (62 loc) · 1.64 KB
/
Graph.h
File metadata and controls
79 lines (62 loc) · 1.64 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
#pragma once
#include "Point.h"
namespace Graph_lib {
struct Color {
enum Color_type {
red = FL_RED,
blue = FL_BLUE,
green = FL_GREEN,
yellow = FL_YELLOW,
white = FL_WHITE,
black = FL_BLACK,
magenta = FL_MAGENTA,
cyan = FL_CYAN,
dark_red = FL_DARK_RED,
dark_green = FL_DARK_GREEN,
dark_yellow = FL_DARK_YELLOW,
dark_blue = FL_DARK_BLUE,
dark_magenta = FL_DARK_MAGENTA,
dark_cyan = FL_DARK_CYAN
};
enum Transparency {invisible = 0, visible=255};
Color(Color_type cc):c{FL_Color(cc)}, v{visible} {}
Color(Color_type cc, Transparency vv):c{FL_Color(cc)}, v{vv} {};
Color(int cc):c{FL_Color(cc)}, v{visible} {}
Color(Transparency vv):c{FL_Color(), v{vv}} {}
int as_int() const {return c;}
char visibility() const {return v;}
void set_visibility(Transparency vv) {v=vv;}
private:
char v;
FL_Color c;
};
struct Line_style {
enum Line_stype_type {
solid = FL_SOLID,
dash = FL_DASH,
dot = FL_DOT,
dashdot = FL_DASHDOT,
dashdotdot = FL_DASHDOTDOT
};
Line_style(Line_style_type ss):s{ss}, w{0} {}
Line_style(Line_stype_type lst, int ww):s{lst}, w{ww} {}
Line_style(int ss) : s{ss}, w{0} {}
int width() const { return w; }
int style() const { return s; }
private:
int s;
int w;
};
struct Shape {
void add(Point p);
};
struct Line : Shape {
Line(Point p1, Point p2);
};
struct Lines : Shape {
Lines() {};
Lines(initializer_list<pair<Point, Point>> lst);
void draw_lines() const;
void add(Point p1, Point p2);
};
}