@@ -46,6 +46,9 extern const QString VALUES_UNIT_PROPERTY; | |||||
46 | /// ... - Units : m/s - ... |
|
46 | /// ... - Units : m/s - ... | |
47 | extern const QRegularExpression DEFAULT_X_AXIS_UNIT_REGEX; |
|
47 | extern const QRegularExpression DEFAULT_X_AXIS_UNIT_REGEX; | |
48 |
|
48 | |||
|
49 | /// Regex to find end time of data in a line for a spectrogram | |||
|
50 | extern const QRegularExpression SPECTROGRAM_END_TIME_REGEX; | |||
|
51 | ||||
49 | /// Regex to find fill value used in a line for a spectrogram |
|
52 | /// Regex to find fill value used in a line for a spectrogram | |
50 | extern const QRegularExpression SPECTROGRAM_FILL_VALUE_REGEX; |
|
53 | extern const QRegularExpression SPECTROGRAM_FILL_VALUE_REGEX; | |
51 |
|
54 | |||
@@ -61,6 +64,9 extern const QRegularExpression SPECTROGRAM_MAX_SAMPLING_REGEX; | |||||
61 | /// Regex to find min x-axis sampling in a line for a spectrogram |
|
64 | /// Regex to find min x-axis sampling in a line for a spectrogram | |
62 | extern const QRegularExpression SPECTROGRAM_MIN_SAMPLING_REGEX; |
|
65 | extern const QRegularExpression SPECTROGRAM_MIN_SAMPLING_REGEX; | |
63 |
|
66 | |||
|
67 | /// Regex to find start time of data in a line for a spectrogram | |||
|
68 | extern const QRegularExpression SPECTROGRAM_START_TIME_REGEX; | |||
|
69 | ||||
64 | /// Regex to find y-axis unit in a line for a spectrogram |
|
70 | /// Regex to find y-axis unit in a line for a spectrogram | |
65 | extern const QRegularExpression SPECTROGRAM_Y_AXIS_UNIT_REGEX; |
|
71 | extern const QRegularExpression SPECTROGRAM_Y_AXIS_UNIT_REGEX; | |
66 |
|
72 |
@@ -14,6 +14,9 const QString VALUES_UNIT_PROPERTY = QStringLiteral("valuesUnit"); | |||||
14 | const QRegularExpression DEFAULT_X_AXIS_UNIT_REGEX |
|
14 | const QRegularExpression DEFAULT_X_AXIS_UNIT_REGEX | |
15 | = QRegularExpression{QStringLiteral("-\\s*Units\\s*:\\s*(.+?)\\s*-")}; |
|
15 | = QRegularExpression{QStringLiteral("-\\s*Units\\s*:\\s*(.+?)\\s*-")}; | |
16 |
|
16 | |||
|
17 | const QRegularExpression SPECTROGRAM_END_TIME_REGEX | |||
|
18 | = QRegularExpression{QStringLiteral("\\s*INTERVAL_STOP\\s*:\\s*(.*)")}; | |||
|
19 | ||||
17 | const QRegularExpression SPECTROGRAM_FILL_VALUE_REGEX |
|
20 | const QRegularExpression SPECTROGRAM_FILL_VALUE_REGEX | |
18 | = QRegularExpression{QStringLiteral("\\s*PARAMETER_FILL_VALUE\\s*:\\s*(.*)")}; |
|
21 | = QRegularExpression{QStringLiteral("\\s*PARAMETER_FILL_VALUE\\s*:\\s*(.*)")}; | |
19 |
|
22 | |||
@@ -29,6 +32,9 const QRegularExpression SPECTROGRAM_MAX_SAMPLING_REGEX | |||||
29 | const QRegularExpression SPECTROGRAM_MIN_SAMPLING_REGEX |
|
32 | const QRegularExpression SPECTROGRAM_MIN_SAMPLING_REGEX | |
30 | = QRegularExpression{QStringLiteral("\\s*DATASET_MIN_SAMPLING\\s*:\\s*(.*)")}; |
|
33 | = QRegularExpression{QStringLiteral("\\s*DATASET_MIN_SAMPLING\\s*:\\s*(.*)")}; | |
31 |
|
34 | |||
|
35 | const QRegularExpression SPECTROGRAM_START_TIME_REGEX | |||
|
36 | = QRegularExpression{QStringLiteral("\\s*INTERVAL_START\\s*:\\s*(.*)")}; | |||
|
37 | ||||
32 | const QRegularExpression SPECTROGRAM_Y_AXIS_UNIT_REGEX |
|
38 | const QRegularExpression SPECTROGRAM_Y_AXIS_UNIT_REGEX | |
33 | = QRegularExpression{QStringLiteral("\\s*PARAMETER_TABLE_UNITS\\[0\\]\\s*:\\s*(.*)")}; |
|
39 | = QRegularExpression{QStringLiteral("\\s*PARAMETER_TABLE_UNITS\\[0\\]\\s*:\\s*(.*)")}; | |
34 |
|
40 |
@@ -159,6 +159,18 bool tryReadProperty(Properties &properties, const QString &key, const QString & | |||||
159 | } |
|
159 | } | |
160 |
|
160 | |||
161 | /** |
|
161 | /** | |
|
162 | * Reads a line from the AMDA file and tries to extract a data from it. Date is converted to double | |||
|
163 | * @sa tryReadProperty() | |||
|
164 | */ | |||
|
165 | bool tryReadDate(Properties &properties, const QString &key, const QString &line, | |||
|
166 | const QRegularExpression ®ex, bool timeUnit = false) | |||
|
167 | { | |||
|
168 | return tryReadProperty(properties, key, line, regex, [timeUnit](const auto &match) { | |||
|
169 | return QVariant::fromValue(doubleDate(match.captured(1))); | |||
|
170 | }); | |||
|
171 | } | |||
|
172 | ||||
|
173 | /** | |||
162 | * Reads a line from the AMDA file and tries to extract a double from it |
|
174 | * Reads a line from the AMDA file and tries to extract a double from it | |
163 | * @sa tryReadProperty() |
|
175 | * @sa tryReadProperty() | |
164 | */ |
|
176 | */ | |
@@ -339,6 +351,15 void SpectrogramParserHelper::readPropertyLine(const QString &line) | |||||
339 | [&] { |
|
351 | [&] { | |
340 | return tryReadDoubles(m_Properties, MAX_BANDS_PROPERTY, line, |
|
352 | return tryReadDoubles(m_Properties, MAX_BANDS_PROPERTY, line, | |
341 | SPECTROGRAM_MAX_BANDS_REGEX); |
|
353 | SPECTROGRAM_MAX_BANDS_REGEX); | |
|
354 | }, | |||
|
355 | // start time of data | |||
|
356 | [&] { | |||
|
357 | return tryReadDate(m_Properties, START_TIME_PROPERTY, line, | |||
|
358 | SPECTROGRAM_START_TIME_REGEX); | |||
|
359 | }, | |||
|
360 | // end time of data | |||
|
361 | [&] { | |||
|
362 | return tryReadDate(m_Properties, END_TIME_PROPERTY, line, SPECTROGRAM_END_TIME_REGEX); | |||
342 | }}; |
|
363 | }}; | |
343 |
|
364 | |||
344 | for (auto function : functions) { |
|
365 | for (auto function : functions) { |
General Comments 0
You need to be logged in to leave comments.
Login now