auto_bus/include/mainScene.h

108 lines
1.9 KiB
C
Raw Normal View History

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-17 10:33:28 +08:00
/**
*
*/
2022-06-17 10:33:28 +08:00
class PosPair{
public:
/*
* x坐标
*/
2022-06-17 10:33:28 +08:00
int pos_x;
/**
* y坐标
*/
2022-06-17 10:33:28 +08:00
int pos_y;
PosPair();
/**
*
* @param stop_number
* @return
*/
int GetStopSpaceLength(int stop_number) const;
2022-06-17 10:33:28 +08:00
/**
*
* @param length
*/
void AddLength(int length);
/**
* x坐标
* @return
*/
int GetBusPosX() const;
/**
* y坐标
* @return
*/
int GetBusPosY() const;
2022-06-17 10:33:28 +08:00
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;
2022-06-17 10:33:28 +08:00
int distance = 0;
};
2022-06-16 22:42:55 +08:00
class SceneManager
{
public:
QGraphicsScene *scene;
2022-06-17 10:33:28 +08:00
/**
*
* @param stop_node_number
*/
explicit SceneManager();
2022-06-16 22:42:55 +08:00
~SceneManager();
/**
*
* @param node_number
*/
void SetStopScene(int node_number);
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-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
/**
*
*/
int stop_node_number;
/**
*
* 使scene都能在view的中心
*/
2022-06-17 10:33:28 +08:00
QGraphicsRectItem *rect_item;
/**
*
*/
void ClearScene();
2022-06-16 22:42:55 +08:00
};
#endif //AUTO_BUS_GUI_MAIN_SCENE_H