完善了README文件
重写了获得公交车位置的函数
This commit is contained in:
@@ -16,11 +16,29 @@ class BusStrategyBase : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* 轨道模型
|
||||
*/
|
||||
RailsModel *rails_model;
|
||||
|
||||
/**
|
||||
* 请求模型
|
||||
*/
|
||||
QueryModel *query_model;
|
||||
|
||||
/**
|
||||
* 公交车模型
|
||||
*/
|
||||
BusModel *bus_model;
|
||||
|
||||
/**
|
||||
* 当前的计时时刻
|
||||
*/
|
||||
int bus_tick;
|
||||
|
||||
/**
|
||||
* 当前的处理策略
|
||||
*/
|
||||
int strategy;
|
||||
|
||||
BusStrategyBase();
|
||||
@@ -94,8 +112,14 @@ public slots:
|
||||
*/
|
||||
void OneTickSlot(int remaining_time);
|
||||
|
||||
/**
|
||||
* 获得公交车前进方向的槽函数
|
||||
*/
|
||||
void GetBusDirectionSlot();
|
||||
|
||||
/**
|
||||
* 处理到站事件的槽函数
|
||||
*/
|
||||
void OnStopSlot();
|
||||
|
||||
private:
|
||||
@@ -110,9 +134,14 @@ private:
|
||||
*/
|
||||
QString PrintState(int remaining_time) const;
|
||||
|
||||
|
||||
/**
|
||||
* 设置各种连接
|
||||
*/
|
||||
void SetConnection() const;
|
||||
|
||||
/**
|
||||
* 处理请求
|
||||
*/
|
||||
void HandleQuery();
|
||||
};
|
||||
|
||||
|
@@ -19,6 +19,9 @@
|
||||
class BusModel
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* 公交车当前所在的站点
|
||||
*/
|
||||
rail_node_t *rail_pos;
|
||||
|
||||
/**
|
||||
@@ -46,6 +49,11 @@ public:
|
||||
*/
|
||||
void ResetBus(rail_node_t *head);
|
||||
|
||||
/**
|
||||
* 获得公交车当前所在位置
|
||||
* @param remaining_time 行驶计时器剩下的时间
|
||||
* @return 到起点的距离
|
||||
*/
|
||||
double GetBusPosition(int remaining_time);
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user