carrot/selfdrive/ui/qt/maps/map_instructions.h
Vehicle Researcher b2f2dabe71 openpilot v0.9.5 release
date: 2023-11-17T23:53:40
master commit: d3aad9ca4601ae0a448ed971c1cd151c7c1eb690
2023-11-17 23:53:40 +00:00

39 lines
1007 B
C++

#pragma once
#include <map>
#include <vector>
#include <QHash>
#include <QHBoxLayout>
#include <QLabel>
#include "cereal/gen/cpp/log.capnp.h"
static std::map<cereal::NavInstruction::Direction, QString> DIRECTIONS = {
{cereal::NavInstruction::Direction::NONE, "none"},
{cereal::NavInstruction::Direction::LEFT, "left"},
{cereal::NavInstruction::Direction::RIGHT, "right"},
{cereal::NavInstruction::Direction::STRAIGHT, "straight"},
{cereal::NavInstruction::Direction::SLIGHT_LEFT, "slight_left"},
{cereal::NavInstruction::Direction::SLIGHT_RIGHT, "slight_right"},
};
class MapInstructions : public QWidget {
Q_OBJECT
private:
QLabel *distance;
QLabel *primary;
QLabel *secondary;
QLabel *icon_01;
QHBoxLayout *lane_layout;
bool is_rhd = false;
std::vector<QLabel *> lane_labels;
QHash<QString, QPixmap> pixmap_cache;
public:
MapInstructions(QWidget * parent=nullptr);
void buildPixmapCache();
void updateInstructions(cereal::NavInstruction::Reader instruction);
};