添加了获得公交车在画布中位置的函数

This commit is contained in:
2022-06-27 11:00:00 +08:00
parent 6c9328d783
commit 50aa9d9c6a
2 changed files with 64 additions and 1 deletions

View File

@@ -8,10 +8,19 @@
#include "QGraphicsScene"
#include "QGraphicsPixmapItem"
/**
* 储存每个站点位置的类
*/
class PosPair{
public:
/*
* 站点位置的x坐标
*/
int pos_x;
/**
* 站点位置的y坐标
*/
int pos_y;
PosPair();
@@ -21,17 +30,31 @@ public:
* @return 站点之间的距离
*/
int GetStopSpaceLength(int stop_number) const;
/**
* 加上一定的距离
* @param length 需要加上的距离
*/
void AddLength(int length);
/**
* 获得该站点公交车停车的位置x坐标
* @return
*/
int GetBusPosX() const;
/**
* 获得该站点公交车停车位置的y坐标
* @return
*/
int GetBusPosY() const;
private:
const int stop_begin_x = 100;
const int stop_begin_y = 80;
const int stop_rail_width = 300;
const int stop_rail_height = 200;
const int stop_bus_distance = 20;
int distance = 0;
};