*/
#include <cassert>
+#include <QDebug>
#include "decoder.hpp"
#include "row.hpp"
const QColor Row::get_class_color(uint32_t ann_class_id) const
{
- return ann_class_color_.at(ann_class_id);
+ try {
+ return ann_class_color_.at(ann_class_id);
+ } catch (std::out_of_range &e) {
+ qWarning() << "Warning: annotation type" << decoder_->get_ann_class_by_id(ann_class_id)->name
+ << "(" << ann_class_id << ")" << "not assigned to any annotation row!";
+ return QColor(20, 20, 20);
+ }
}
const QColor Row::get_bright_class_color(uint32_t ann_class_id) const
{
- return ann_bright_class_color_.at(ann_class_id);
+ try {
+ return ann_bright_class_color_.at(ann_class_id);
+ } catch (std::out_of_range &e) {
+ return QColor(20, 20, 20);
+ }
}
const QColor Row::get_dark_class_color(uint32_t ann_class_id) const
{
- return ann_dark_class_color_.at(ann_class_id);
+ try {
+ return ann_dark_class_color_.at(ann_class_id);
+ } catch (std::out_of_range &e) {
+ return QColor(20, 20, 20);
+ }
}
bool Row::has_hidden_classes() const