-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPassenger.h
52 lines (39 loc) · 1.14 KB
/
Passenger.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
#pragma once
#include "Object.h"
#include "Utils.h"
#include <cmath>
#include <vector>
#include <QPoint>
#include <QPainter>
class Passenger : public Object {
enum Shape { CIRCLE, TRIANGLE, SQUARE, STAR, PENTAGON, RHOMBUS, CROSS, DIAMOND };
private:
Shape _shape;
int _trainIndex;
int _stationIndex;
QPoint _position;
int _ticket;
std::vector<int> _finalStations;
public:
Passenger(int stationIndex, QPoint pos, int shape);
// Metodi virtuali reimplementati
void paint(QPainter* painter,
const QStyleOptionGraphicsItem* option,
QWidget* widget);
QRectF boundingRect() const;
void advance();
// Setters
void setPos(QPoint pos) { _position = pos; }
void setTicket(int passengers) { _ticket = passengers; }
// Getters
int stationIndex() { return _stationIndex; }
int trainIndex() { return _trainIndex; }
int ticket() { return _ticket; }
int passengerShape() { return int(_shape); }
std::vector<int> finalStations() { return _finalStations; }
// Utility
void getOnTrain(int trainIndex);
void getOffTrain(int stationIndex);
void moveTransformPoint(QPoint point) { setTransformOriginPoint(point); }
void updateFinalStations();
};