*/
#include <cassert>
+#include <QDebug>
#include "decoder.hpp"
#include "row.hpp"
void Row::set_visible(bool visible)
{
visible_ = visible;
+
+ visibility_changed();
}
void Row::set_base_color(QColor base_color)
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
{
for (const AnnotationClass* c : ann_classes())
- if (!c->visible)
+ if (!c->visible())
return true;
return false;
}
+bool Row::class_is_visible(uint32_t ann_class_id) const
+{
+ return decoder_->get_ann_class_by_id(ann_class_id)->visible();
+}
+
bool Row::operator<(const Row& other) const
{
return (decoder_ < other.decoder_) ||