auto_bus/include/busModel.h

75 lines
1.4 KiB
C
Raw Normal View History

2022-06-11 19:05:06 +08:00
//
// Created by ricardo on 2022/6/10.
//
#ifndef AUTO_BUS_GUI_BUS_MODEL_H
#define AUTO_BUS_GUI_BUS_MODEL_H
#include "railsModel.h"
#include "queryModel.h"
#include "define.h"
2022-06-25 16:35:07 +08:00
#include "QObject"
2022-06-26 13:57:45 +08:00
#include "QDebug"
#include "QTimer"
2022-06-11 19:05:06 +08:00
2022-06-25 16:35:07 +08:00
/**
*
2022-06-25 16:35:07 +08:00
*/
class BusModel
2022-06-11 19:05:06 +08:00
{
public:
/**
*
*/
2022-06-11 19:05:06 +08:00
rail_node_t *rail_pos;
/**
*
2022-06-11 19:05:06 +08:00
*/
const int velocity = 1;
2022-06-11 19:05:06 +08:00
/**
*
*/
int direction;
/**
*
*/
bus_query_t *target_query;
explicit BusModel();
2022-06-25 16:35:07 +08:00
~BusModel();
2022-06-25 16:35:07 +08:00
2022-06-17 12:18:43 +08:00
/**
*
* @param head
2022-06-17 12:18:43 +08:00
*/
void ResetBus(rail_node_t *head);
2022-06-17 12:18:43 +08:00
/**
*
* @param remaining_time
* @return
*/
double GetBusPosition(int remaining_time);
/**
*
* @param query
* @param orientation BUS_CLOCK_WISE BUS_COUNTER_CLOCK_WISE
* @return
*/
int GetQueryDistance(bus_query_t *query, int orientation) const;
private:
/**
*
2022-06-17 12:18:43 +08:00
*/
rail_node_t *rail_head;
2022-06-11 19:05:06 +08:00
};
#endif //AUTO_BUS_GUI_BUS_MODEL_H