-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plotter.h
66 lines (52 loc) · 1.51 KB
/
Plotter.h
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
#pragma once
#include <Windows.h>
#include <cassert>
#include <tchar.h>
#include <vector>
#include <iostream>
#include <string>
#include "Painter.h"
enum GRAPHICS {
BUBBLE, SELECTION, QUICK, RADIX, BOGO
};
struct Graph {
std::vector<POINT> points;
COLORREF color;
BOOL connectPoints;
};
class Plotter {
private:
SIZE _size;
HINSTANCE _hInst;
HWND _hWnd;
Painter* _painter;
std::vector<Graph> _graphics;
const int INITIALSTEP = 40;
const COLORREF BACKGROUNDCOLOR = RGB(255, 255, 255);
int _step;
int _divisionPrice;
POINT _offset;
static LRESULT CALLBACK PlotterProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK OnMessage (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
void onMouseMove(POINT pos);
void onScroll(short delta);
bool registerClass(LPCTSTR className);
void drawCursorCoords();
void drawField();
void drawGrid();
void drawAxes();
void signAxes();
void drawPoint(const POINT& point, LONG r);
public:
Plotter(LPCTSTR name, const POINT& pos, const SIZE& size, HWND hPWnd = NULL, HINSTANCE hInst = GetModuleHandle(NULL));
~Plotter();
void redraw();
void clearField();
void plotGraphs();
void plotByPoint(int i);
void addGraph(const Graph& graph);
void editGraphPoints(GRAPHICS name, const std::vector<POINT>& points);
int getNumberOfGraphs();
void getMousePos(POINT* pos);
bool isMouseOnWnd();
};