-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrender.h
118 lines (103 loc) · 5.03 KB
/
render.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
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
/***************************************************************************
* Copyright (C) 2011 by Daniel 'gordonc64' Gorazdowski *
* *
* This program 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 2 of the License, or *
* (at your option) any later version. *
* *
* This program 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 this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "obliczenia.h"
class Render : public QGraphicsView, public QHoverEvent
{
Q_OBJECT
enum swaptype { asymmetric, symmetric, last_swaptype };
struct swaprecord {
int x1,x2,y1,y2,z1,z2,gain;
swaptype choice;
};
public:
Render ( QWidget *parent );
void drawBackground ( QPainter *painter, const QRectF &rect );
void polygonfunction ( QVector<QPointF> * );
void polygonfunction2 ( QVector<QPointF> * );
void delaunay( QVector<QPointF> * );
void delaunayplot( QVector<QPointF> * );
void macierzwag(/*QList<dot*> */);
void macierzwag2(QList<dot*> );
int wprowadzonytext() { return _text.toInt(); }
void mousePressEvent ( QMouseEvent * evt );
void mouseReleaseEvent ( QMouseEvent *evt );
void mouseMoveEvent ( QMouseEvent * evt );
void HoverEnter( QHoverEvent *evt);
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
void fitsp( int ,int ,float ,QVector<QVector<float> > *,QVector<int> *,double *);
void twooptfast( int , QVector<QVector<float> > *,QVector<int> *);
void twoopt( int , QVector<QVector<float> > *,QVector<int> *);
void threeoptfast( int , QVector<QVector<float> > *, QVector<int> *);
void threeopt( int , QVector<QVector<float> > *, QVector<int> *);
void reverse(int ,int , QVector<int> &);
void swapcheck(swaprecord& , QVector<QVector<float> > *);
QStatusBar *mainwidgetbar;
QPolygonF p;
QPainterPath path;
QPoint pos, oldpos, mousePressScene, mousePressView, mouseLastPosScene, mouseLastPosSceneRelease, mouseLastPosView;
QVector<QPointF> *polygon;
QVector<QPointF> *polygon2;
QVector<QVector<float> > *macierzw;
char macierzwtemp[1000][1000];
QVector<dot *> dotslist;
QVector<QGraphicsLineItem *> dasline;
QVector<dot> dots;
QVector<int> *trasa;
double wagatrasy, wagatrasystart;
double *tourwaga;
double badaniatimer;
double licznik;
int looplimit;
QGraphicsScene *scene;
QString _text;
QPointF test1,test2;
int liczbapunktow,indexrender;
int linesize,listsize;
QPoint mouseDownPos;
QPoint lastMouseViewPos;
QPoint liniaPos2,liniaPos1;
unsigned long long licznikiteracji,licznikiteracjipoprawy;
int sasiedzinumber;
int stopien;
QRect rubberRect;
QRectF testelipsa;
bool pressed,zaznacz;
QLabel *labelwagatrasy;
QLabel *labelilosciteracji;
QLabel *labelilosciteracjibetter;
QLabel *labelczasms;
QLabel *labelsasiedztwo;
QRubberBand *rubberBand;
QGraphicsLineItem *qgline, *qglinebackup;
QGraphicsEllipseItem *qgellipse;
QGraphicsRectItem *qgrect;
QGraphicsPolygonItem *qgpolygon;
public slots:
void punkty_slot ( QString text );
void twooptslot();
void twooptslotfast();
void threeoptslot();
void threeoptslotfast();
void delaunayslot();
signals:
void losuj();
void pole_slot ( QVector<QPointF> );
void punkty_signal ( QVector<QPointF> );
};