-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBasicDrawPane.h
More file actions
executable file
·83 lines (66 loc) · 2.61 KB
/
BasicDrawPane.h
File metadata and controls
executable file
·83 lines (66 loc) · 2.61 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
//
// Created by rostam on 15.10.19.
//
#ifndef CGTEA_BASICDRAWPANE_H
#define CGTEA_BASICDRAWPANE_H
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#include "datatypes.h"
#include <string>
#endif
#include <wx/graphics.h>
#include <map>
class BasicDrawPane : public wxPanel
{
public:
std::map<int, wxColour> distinctColors;
BasicDrawPane(wxWindow* parent);
void paintEvent(wxPaintEvent & evt);
void paintNow();
void render(wxPaintDC& dc);
void drawEdges(const Graph &g, wxGraphicsContext* gc);
void drawVertices(const Graph &g, wxGraphicsContext* gc);
void drawShape(wxGraphicsContext* gc, VertexShape shape, const cgtea_geometry::Point& pos, double size);
void drawCircle(wxGraphicsContext* gc, const cgtea_geometry::Point& pos, double size);
void drawSquare(wxGraphicsContext* gc, const cgtea_geometry::Point& pos, double size);
void drawTriangle(wxGraphicsContext* gc, const cgtea_geometry::Point& pos, double size);
void drawDiamond(wxGraphicsContext* gc, const cgtea_geometry::Point& pos, double size);
void drawEdgeShape(wxGraphicsContext* gc, EdgeShape shape,
const cgtea_geometry::Point& src,
const cgtea_geometry::Point& tgt);
void drawLine(wxGraphicsContext* gc,
const cgtea_geometry::Point& src,
const cgtea_geometry::Point& tgt);
void drawCurve(wxGraphicsContext* gc,
const cgtea_geometry::Point& src,
const cgtea_geometry::Point& tgt);
void drawDoubleArrow(wxGraphicsContext* gc,
const cgtea_geometry::Point& src,
const cgtea_geometry::Point& tgt);
void drawDashed(wxGraphicsContext* gc,
const cgtea_geometry::Point& src,
const cgtea_geometry::Point& tgt);
void mouseMoved(wxMouseEvent& event);
void mouseDown(wxMouseEvent& event);
void mouseDoubleClick(wxMouseEvent& event);
void mouseWheelMoved(wxMouseEvent& event);
void mouseReleased(wxMouseEvent& event);
void rightClick(wxMouseEvent& event);
void mouseLeftWindow(wxMouseEvent& event);
void keyPressed(wxKeyEvent& event);
void keyReleased(wxKeyEvent& event);
int m_selectedVertex = -1;
bool m_edgeSelected = false;
Ver m_edgeSrc = 0;
Ver m_edgeTgt = 0;
bool m_dragging = false;
double m_dragLastX = 0;
double m_dragLastY = 0;
bool m_edgeDrawing = false;
Ver m_edgeDrawSrc = 0;
double m_rubberX = 0;
double m_rubberY = 0;
DECLARE_EVENT_TABLE()
};
#endif //CGTEA_BASICDRAWPANE_H