@@ -273,6 +273,13 public: | |||||
273 | return m_Data.size() / m_NbComponents; |
|
273 | return m_Data.size() / m_NbComponents; | |
274 | } |
|
274 | } | |
275 |
|
275 | |||
|
276 | /// @return the total size (i.e. number of values) of the array data | |||
|
277 | int totalSize() const | |||
|
278 | { | |||
|
279 | QReadLocker locker{&m_Lock}; | |||
|
280 | return m_Data.size(); | |||
|
281 | } | |||
|
282 | ||||
276 | std::shared_ptr<ArrayData<Dim> > sort(const std::vector<int> &sortPermutation) |
|
283 | std::shared_ptr<ArrayData<Dim> > sort(const std::vector<int> &sortPermutation) | |
277 | { |
|
284 | { | |
278 | QReadLocker locker{&m_Lock}; |
|
285 | QReadLocker locker{&m_Lock}; |
@@ -146,6 +146,7 public: | |||||
146 | /// @sa IDataSeries::valuesUnit() |
|
146 | /// @sa IDataSeries::valuesUnit() | |
147 | Unit valuesUnit() const override { return m_ValuesUnit; } |
|
147 | Unit valuesUnit() const override { return m_ValuesUnit; } | |
148 |
|
148 | |||
|
149 | int nbPoints() const override { return m_XAxisData->totalSize() + m_ValuesData->totalSize(); } | |||
149 |
|
150 | |||
150 | SqpRange range() const override |
|
151 | SqpRange range() const override | |
151 | { |
|
152 | { |
@@ -64,6 +64,10 public: | |||||
64 | virtual std::shared_ptr<IDataSeries> subDataSeries(const SqpRange &range) = 0; |
|
64 | virtual std::shared_ptr<IDataSeries> subDataSeries(const SqpRange &range) = 0; | |
65 |
|
65 | |||
66 | virtual std::unique_ptr<IDataSeries> clone() const = 0; |
|
66 | virtual std::unique_ptr<IDataSeries> clone() const = 0; | |
|
67 | ||||
|
68 | /// @return the total number of points contained in the data series | |||
|
69 | virtual int nbPoints() const = 0; | |||
|
70 | ||||
67 | virtual SqpRange range() const = 0; |
|
71 | virtual SqpRange range() const = 0; | |
68 |
|
72 | |||
69 | // ///////// // |
|
73 | // ///////// // |
@@ -40,6 +40,10 public: | |||||
40 | SqpRange cacheRange() const noexcept; |
|
40 | SqpRange cacheRange() const noexcept; | |
41 | void setCacheRange(const SqpRange &cacheRange) noexcept; |
|
41 | void setCacheRange(const SqpRange &cacheRange) noexcept; | |
42 |
|
42 | |||
|
43 | /// @return the number of points hold by the variable. The number of points is updated each time | |||
|
44 | /// the data series changes | |||
|
45 | int nbPoints() const noexcept; | |||
|
46 | ||||
43 | /// Returns the real range of the variable, i.e. the min and max x-axis values of the data |
|
47 | /// Returns the real range of the variable, i.e. the min and max x-axis values of the data | |
44 | /// series between the range of the variable. The real range is updated each time the variable |
|
48 | /// series between the range of the variable. The real range is updated each time the variable | |
45 | /// range or the data series changed |
|
49 | /// range or the data series changed |
@@ -16,7 +16,8 struct Variable::VariablePrivate { | |||||
16 | m_Range{dateTime}, |
|
16 | m_Range{dateTime}, | |
17 | m_Metadata{metadata}, |
|
17 | m_Metadata{metadata}, | |
18 | m_DataSeries{nullptr}, |
|
18 | m_DataSeries{nullptr}, | |
19 | m_RealRange{INVALID_RANGE} |
|
19 | m_RealRange{INVALID_RANGE}, | |
|
20 | m_NbPoints{0} | |||
20 | { |
|
21 | { | |
21 | } |
|
22 | } | |
22 |
|
23 | |||
@@ -25,7 +26,8 struct Variable::VariablePrivate { | |||||
25 | m_Range{other.m_Range}, |
|
26 | m_Range{other.m_Range}, | |
26 | m_Metadata{other.m_Metadata}, |
|
27 | m_Metadata{other.m_Metadata}, | |
27 | m_DataSeries{other.m_DataSeries != nullptr ? other.m_DataSeries->clone() : nullptr}, |
|
28 | m_DataSeries{other.m_DataSeries != nullptr ? other.m_DataSeries->clone() : nullptr}, | |
28 | m_RealRange{other.m_RealRange} |
|
29 | m_RealRange{other.m_RealRange}, | |
|
30 | m_NbPoints{other.m_NbPoints} | |||
29 | { |
|
31 | { | |
30 | } |
|
32 | } | |
31 |
|
33 | |||
@@ -39,8 +41,11 struct Variable::VariablePrivate { | |||||
39 | m_DataSeries->purge(m_CacheRange.m_TStart, m_CacheRange.m_TEnd); |
|
41 | m_DataSeries->purge(m_CacheRange.m_TStart, m_CacheRange.m_TEnd); | |
40 | } |
|
42 | } | |
41 | updateRealRange(); |
|
43 | updateRealRange(); | |
|
44 | updateNbPoints(); | |||
42 | } |
|
45 | } | |
43 |
|
46 | |||
|
47 | void updateNbPoints() { m_NbPoints = m_DataSeries ? m_DataSeries->nbPoints() : 0; } | |||
|
48 | ||||
44 | /// Updates real range according to current variable range and data series |
|
49 | /// Updates real range according to current variable range and data series | |
45 | void updateRealRange() |
|
50 | void updateRealRange() | |
46 | { |
|
51 | { | |
@@ -67,6 +72,7 struct Variable::VariablePrivate { | |||||
67 | QVariantHash m_Metadata; |
|
72 | QVariantHash m_Metadata; | |
68 | std::shared_ptr<IDataSeries> m_DataSeries; |
|
73 | std::shared_ptr<IDataSeries> m_DataSeries; | |
69 | SqpRange m_RealRange; |
|
74 | SqpRange m_RealRange; | |
|
75 | int m_NbPoints; | |||
70 |
|
76 | |||
71 | QReadWriteLock m_Lock; |
|
77 | QReadWriteLock m_Lock; | |
72 | }; |
|
78 | }; | |
@@ -135,6 +141,11 void Variable::setCacheRange(const SqpRange &cacheRange) noexcept | |||||
135 | impl->unlock(); |
|
141 | impl->unlock(); | |
136 | } |
|
142 | } | |
137 |
|
143 | |||
|
144 | int Variable::nbPoints() const noexcept | |||
|
145 | { | |||
|
146 | return impl->m_NbPoints; | |||
|
147 | } | |||
|
148 | ||||
138 | SqpRange Variable::realRange() const noexcept |
|
149 | SqpRange Variable::realRange() const noexcept | |
139 | { |
|
150 | { | |
140 | return impl->m_RealRange; |
|
151 | return impl->m_RealRange; |
@@ -17,10 +17,11 namespace { | |||||
17 | const auto NAME_COLUMN = 0; |
|
17 | const auto NAME_COLUMN = 0; | |
18 | const auto TSTART_COLUMN = 1; |
|
18 | const auto TSTART_COLUMN = 1; | |
19 | const auto TEND_COLUMN = 2; |
|
19 | const auto TEND_COLUMN = 2; | |
20 |
const auto |
|
20 | const auto NBPOINTS_COLUMN = 3; | |
21 |
const auto |
|
21 | const auto UNIT_COLUMN = 4; | |
22 |
const auto |
|
22 | const auto MISSION_COLUMN = 5; | |
23 |
const auto N |
|
23 | const auto PLUGIN_COLUMN = 6; | |
|
24 | const auto NB_COLUMNS = 7; | |||
24 |
|
25 | |||
25 | // Column properties |
|
26 | // Column properties | |
26 | const auto DEFAULT_HEIGHT = 25; |
|
27 | const auto DEFAULT_HEIGHT = 25; | |
@@ -40,8 +41,9 struct ColumnProperties { | |||||
40 |
|
41 | |||
41 | const auto COLUMN_PROPERTIES = QHash<int, ColumnProperties>{ |
|
42 | const auto COLUMN_PROPERTIES = QHash<int, ColumnProperties>{ | |
42 |
{NAME_COLUMN, {QObject::tr("Name")}}, |
|
43 | {NAME_COLUMN, {QObject::tr("Name")}}, {TSTART_COLUMN, {QObject::tr("tStart"), 180}}, | |
43 |
{TEND_COLUMN, {QObject::tr("tEnd"), 180}}, |
|
44 | {TEND_COLUMN, {QObject::tr("tEnd"), 180}}, {NBPOINTS_COLUMN, {QObject::tr("Nb points")}}, | |
44 | {MISSION_COLUMN, {QObject::tr("Mission")}}, {PLUGIN_COLUMN, {QObject::tr("Plugin")}}}; |
|
45 | {UNIT_COLUMN, {QObject::tr("Unit")}}, {MISSION_COLUMN, {QObject::tr("Mission")}}, | |
|
46 | {PLUGIN_COLUMN, {QObject::tr("Plugin")}}}; | |||
45 |
|
47 | |||
46 | /// Format for datetimes |
|
48 | /// Format for datetimes | |
47 | const auto DATETIME_FORMAT = QStringLiteral("dd/MM/yyyy \nhh:mm:ss:zzz"); |
|
49 | const auto DATETIME_FORMAT = QStringLiteral("dd/MM/yyyy \nhh:mm:ss:zzz"); | |
@@ -198,6 +200,8 QVariant VariableModel::data(const QModelIndex &index, int role) const | |||||
198 | ? DateUtils::dateTime(range.m_TEnd).toString(DATETIME_FORMAT) |
|
200 | ? DateUtils::dateTime(range.m_TEnd).toString(DATETIME_FORMAT) | |
199 | : QVariant{}; |
|
201 | : QVariant{}; | |
200 | } |
|
202 | } | |
|
203 | case NBPOINTS_COLUMN: | |||
|
204 | return variable->nbPoints(); | |||
201 | case UNIT_COLUMN: |
|
205 | case UNIT_COLUMN: | |
202 | return variable->metadata().value(QStringLiteral("units")); |
|
206 | return variable->metadata().value(QStringLiteral("units")); | |
203 | case MISSION_COLUMN: |
|
207 | case MISSION_COLUMN: |
General Comments 0
You need to be logged in to leave comments.
Login now