完善了注释
This commit is contained in:
@@ -32,9 +32,11 @@ public:
|
||||
class BusWidget
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* 真正的公交车显示对象
|
||||
*/
|
||||
BusItem *item;
|
||||
|
||||
|
||||
explicit BusWidget();
|
||||
|
||||
~BusWidget();
|
||||
@@ -54,10 +56,24 @@ public:
|
||||
void StartAnimation(int direction, int duration);
|
||||
|
||||
private:
|
||||
/**
|
||||
* 存储各个站点位置对的数组
|
||||
*/
|
||||
PosPair *pos_pairs = nullptr;
|
||||
|
||||
/**
|
||||
* 动画对象
|
||||
*/
|
||||
QPropertyAnimation *animation;
|
||||
|
||||
/**
|
||||
* 公交车所在的站点
|
||||
*/
|
||||
int pos = 0;
|
||||
|
||||
/**
|
||||
* 站点总数
|
||||
*/
|
||||
int node_num = 0;
|
||||
};
|
||||
|
||||
|
@@ -21,6 +21,7 @@ public:
|
||||
int pos_y;
|
||||
|
||||
PosPair();
|
||||
|
||||
/**
|
||||
* 获取两个站点之间的距离
|
||||
* @param stop_number 站点的数量
|
||||
@@ -47,10 +48,29 @@ public:
|
||||
int GetBusPosY() const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* 设定的轨道开始坐标x
|
||||
*/
|
||||
const int stop_begin_x = 100;
|
||||
|
||||
/**
|
||||
* 设定的轨道开始坐标y
|
||||
*/
|
||||
const int stop_begin_y = 80;
|
||||
|
||||
/**
|
||||
* 轨道的宽度
|
||||
*/
|
||||
const int stop_rail_width = 300;
|
||||
|
||||
/**
|
||||
* 轨道的高度
|
||||
*/
|
||||
const int stop_rail_height = 200;
|
||||
|
||||
/**
|
||||
* 公交车到站点的距离
|
||||
*/
|
||||
const int stop_bus_distance = 30;
|
||||
|
||||
int distance = 0;
|
||||
|
@@ -15,6 +15,11 @@
|
||||
class StrategyFactory
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* 生成控制器的工厂函数
|
||||
* @param file_name 配置文件的名称
|
||||
* @return 控制器对象
|
||||
*/
|
||||
static BusStrategyBase *GetStrategy(const QString& file_name);
|
||||
};
|
||||
|
||||
|
@@ -13,7 +13,6 @@
|
||||
#define BUS_SSTF 1 // 最短寻找时间优先
|
||||
#define BUS_SCAN 2 // 顺便服务
|
||||
#define BUS_RUNNING 0
|
||||
#define BUS_PAUSING 1
|
||||
#define BUS_END 2
|
||||
|
||||
#endif //AUTO_BUS_GUI_DEFINE_H
|
||||
|
@@ -12,15 +12,22 @@
|
||||
#include "PosPair.h"
|
||||
#include "BusWidget.h"
|
||||
|
||||
/**
|
||||
* 控制画图的管理类
|
||||
*/
|
||||
class SceneManager
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* 场景对象
|
||||
*/
|
||||
QGraphicsScene *scene;
|
||||
|
||||
/**
|
||||
* 构造函数,同时生成站点
|
||||
*/
|
||||
explicit SceneManager();
|
||||
|
||||
~SceneManager();
|
||||
|
||||
/**
|
||||
@@ -29,6 +36,9 @@ public:
|
||||
*/
|
||||
void SetStopScene(int node_number);
|
||||
|
||||
/**
|
||||
* 重设公交车的位置
|
||||
*/
|
||||
void ResetBus();
|
||||
|
||||
/**
|
||||
@@ -44,6 +54,9 @@ private:
|
||||
*/
|
||||
QGraphicsPixmapItem *pixmap_items;
|
||||
|
||||
/**
|
||||
* 站点名称的对象数组
|
||||
*/
|
||||
QGraphicsSimpleTextItem *name_items;
|
||||
|
||||
/**
|
||||
|
@@ -11,6 +11,9 @@
|
||||
|
||||
#include "define.h"
|
||||
|
||||
/**
|
||||
* 请求列表中显示请求的控件
|
||||
*/
|
||||
class QueryListItem : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -19,8 +22,14 @@ public:
|
||||
|
||||
void SetColumnName();
|
||||
|
||||
/**
|
||||
* 请求的类别
|
||||
*/
|
||||
int query_type;
|
||||
|
||||
/**
|
||||
* 目标的站点id
|
||||
*/
|
||||
int target_node_id;
|
||||
|
||||
private:
|
||||
|
@@ -11,14 +11,17 @@ struct bus_query {
|
||||
* 请求产生的时间
|
||||
*/
|
||||
int time;
|
||||
|
||||
/**
|
||||
* 请求的类型
|
||||
*/
|
||||
int type;
|
||||
|
||||
/**
|
||||
* 请求产生/指向的站点
|
||||
*/
|
||||
rail_node_t *node;
|
||||
|
||||
/**
|
||||
* 指向下一个请求的指针
|
||||
*/
|
||||
@@ -32,10 +35,6 @@ class QueryModel
|
||||
public:
|
||||
bus_query_t *queries = nullptr;
|
||||
|
||||
/**
|
||||
* 析构函数
|
||||
* 负责释放内存
|
||||
*/
|
||||
~QueryModel();
|
||||
|
||||
/**
|
||||
|
@@ -11,18 +11,22 @@ struct rail_node{
|
||||
* 站点的编号
|
||||
*/
|
||||
int id;
|
||||
|
||||
/**
|
||||
* 距离上一个站点的距离
|
||||
*/
|
||||
int last_node_distance;
|
||||
|
||||
/**
|
||||
* 距离下一个站点的距离
|
||||
*/
|
||||
int next_node_distance;
|
||||
|
||||
/**
|
||||
* 指向上一个站点的指针
|
||||
*/
|
||||
struct rail_node* last_node;
|
||||
|
||||
/**
|
||||
* 指向下一个站点的指针
|
||||
*/
|
||||
@@ -45,6 +49,9 @@ public:
|
||||
*/
|
||||
int node_num;
|
||||
|
||||
/**
|
||||
* 轨道的总长度
|
||||
*/
|
||||
int total_distance;
|
||||
|
||||
explicit RailsModel();
|
||||
|
Reference in New Issue
Block a user