2022-06-16 22:42:55 +08:00
|
|
|
|
//
|
|
|
|
|
// Created by ricardo on 2022/6/11.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#ifndef AUTO_BUS_GUI_MAIN_SCENE_H
|
|
|
|
|
#define AUTO_BUS_GUI_MAIN_SCENE_H
|
|
|
|
|
|
|
|
|
|
#include "QGraphicsScene"
|
|
|
|
|
#include "QGraphicsPixmapItem"
|
2022-06-28 22:55:00 +08:00
|
|
|
|
#include "QGraphicsSimpleTextItem"
|
2022-06-17 10:33:28 +08:00
|
|
|
|
|
2022-06-28 11:10:49 +08:00
|
|
|
|
#include "PosPair.h"
|
|
|
|
|
#include "BusWidget.h"
|
2022-06-16 22:42:55 +08:00
|
|
|
|
|
|
|
|
|
class SceneManager
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QGraphicsScene *scene;
|
|
|
|
|
|
2022-06-17 10:33:28 +08:00
|
|
|
|
/**
|
|
|
|
|
* 构造函数,同时生成站点
|
|
|
|
|
*/
|
2022-06-26 15:02:43 +08:00
|
|
|
|
explicit SceneManager();
|
2022-06-16 22:42:55 +08:00
|
|
|
|
~SceneManager();
|
|
|
|
|
|
2022-06-26 15:02:43 +08:00
|
|
|
|
/**
|
|
|
|
|
* 生成站点画面
|
|
|
|
|
* @param node_number
|
|
|
|
|
*/
|
|
|
|
|
void SetStopScene(int node_number);
|
|
|
|
|
|
2022-06-29 12:14:38 +08:00
|
|
|
|
void ResetBus();
|
|
|
|
|
|
2022-06-28 18:44:55 +08:00
|
|
|
|
/**
|
|
|
|
|
* 开始公交车动画
|
|
|
|
|
* @param direction 公交车前进的方向
|
|
|
|
|
* @param duration 前进持续的时间
|
|
|
|
|
*/
|
|
|
|
|
void BeginBusAnimation(int direction, int duration);
|
|
|
|
|
|
2022-06-17 10:33:28 +08:00
|
|
|
|
private:
|
2022-06-16 22:42:55 +08:00
|
|
|
|
/**
|
2022-06-17 10:33:28 +08:00
|
|
|
|
* 显示站点的像素图对象
|
2022-06-16 22:42:55 +08:00
|
|
|
|
*/
|
2022-06-17 10:33:28 +08:00
|
|
|
|
QGraphicsPixmapItem *pixmap_items;
|
2022-06-28 11:10:49 +08:00
|
|
|
|
|
2022-06-28 22:55:00 +08:00
|
|
|
|
QGraphicsSimpleTextItem *name_items;
|
|
|
|
|
|
2022-06-16 22:42:55 +08:00
|
|
|
|
/**
|
2022-06-17 10:33:28 +08:00
|
|
|
|
* 每个站点的所在位置
|
2022-06-16 22:42:55 +08:00
|
|
|
|
*/
|
2022-06-17 10:33:28 +08:00
|
|
|
|
PosPair *stop_pos_pairs;
|
2022-06-16 22:42:55 +08:00
|
|
|
|
|
2022-06-28 11:10:49 +08:00
|
|
|
|
/**
|
|
|
|
|
* 公交车对象
|
|
|
|
|
*/
|
|
|
|
|
BusWidget *bus;
|
|
|
|
|
|
2022-06-26 15:02:43 +08:00
|
|
|
|
/**
|
|
|
|
|
* 总共的站点数量
|
|
|
|
|
*/
|
|
|
|
|
int stop_node_number;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 一个矩形的边框
|
|
|
|
|
* 使无论中间存在多少站点,这个scene都能在view的中心
|
|
|
|
|
*/
|
2022-06-17 10:33:28 +08:00
|
|
|
|
QGraphicsRectItem *rect_item;
|
2022-06-26 15:02:43 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 清除画面
|
|
|
|
|
*/
|
2022-06-28 11:10:49 +08:00
|
|
|
|
void ClearStopScene();
|
2022-06-16 22:42:55 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif //AUTO_BUS_GUI_MAIN_SCENE_H
|