1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
From 9b82cd986238df2644af0a05dcc5e75ea4535390 Mon Sep 17 00:00:00 2001
From: Mike Walters <mike@flomp.net>
Date: Fri, 21 Jan 2022 21:48:20 +0000
Subject: [PATCH 27/31] sigmf: use core:label for annotations
---
src/inputsource.cpp | 4 ++--
src/samplesource.h | 6 +++---
src/spectrogramplot.cpp | 10 +++++-----
3 files changed, 10 insertions(+), 10 deletions(-)
--- a/src/inputsource.cpp
+++ b/src/inputsource.cpp
@@ -287,9 +287,9 @@
const double freq_upper_edge = sigmf_annotation["core:freq_upper_edge"].toDouble();
auto frequencyRange = range_t<double>{freq_lower_edge, freq_upper_edge};
- auto description = sigmf_annotation["core:description"].toString();
+ auto label = sigmf_annotation["core:label"].toString();
- annotationList.emplace_back(sampleRange, frequencyRange, description);
+ annotationList.emplace_back(sampleRange, frequencyRange, label);
}
}
}
--- a/src/samplesource.h
+++ b/src/samplesource.h
@@ -32,10 +32,10 @@
public:
range_t<size_t> sampleRange;
range_t<double> frequencyRange;
- QString description;
+ QString label;
- Annotation(range_t<size_t> sampleRange, range_t<double>frequencyRange, QString description)
- : sampleRange(sampleRange), frequencyRange(frequencyRange), description(description) {}
+ Annotation(range_t<size_t> sampleRange, range_t<double>frequencyRange, QString label)
+ : sampleRange(sampleRange), frequencyRange(frequencyRange), label(label) {}
};
template<typename T>
--- a/src/spectrogramplot.cpp
+++ b/src/spectrogramplot.cpp
@@ -172,17 +172,17 @@
for (int i = 0; i < inputSource->annotationList.size(); i++) {
Annotation a = inputSource->annotationList.at(i);
- size_t descriptionLength = fm.boundingRect(a.description).width() * getStride();
+ size_t labelLength = fm.boundingRect(a.label).width() * getStride();
// Check if:
- // (1) End of annotation (might be maximum, or end of description text) is still visible in time
+ // (1) End of annotation (might be maximum, or end of label text) is still visible in time
// (2) Part of the annotation is already visible in time
//
// Currently there is no check if the annotation is visible in frequency. This is a
// possible performance improvement
//
size_t start = a.sampleRange.minimum;
- size_t end = std::max(a.sampleRange.minimum + descriptionLength, a.sampleRange.maximum);
+ size_t end = std::max(a.sampleRange.minimum + labelLength, a.sampleRange.maximum);
if(start <= sampleRange.maximum && end >= sampleRange.minimum) {
@@ -192,8 +192,8 @@
int height = (a.frequencyRange.maximum - a.frequencyRange.minimum) / sampleRate * rect.height();
int width = (a.sampleRange.maximum - a.sampleRange.minimum) / getStride();
- // Draw the description 2 pixels above the box
- painter.drawText(x, y - 2, a.description);
+ // Draw the label 2 pixels above the box
+ painter.drawText(x, y - 2, a.label);
painter.drawRect(x, y, width, height);
}
}
|