##// END OF EJS Templates
Merge pull request 267 from SCIQLOP-Initialisation develop...
leroux -
r721:ba7f1665a341 merge
parent child
Show More
@@ -273,6 +273,13 public:
273 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 283 std::shared_ptr<ArrayData<Dim> > sort(const std::vector<int> &sortPermutation)
277 284 {
278 285 QReadLocker locker{&m_Lock};
@@ -146,6 +146,7 public:
146 146 /// @sa IDataSeries::valuesUnit()
147 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 151 SqpRange range() const override
151 152 {
@@ -64,6 +64,10 public:
64 64 virtual std::shared_ptr<IDataSeries> subDataSeries(const SqpRange &range) = 0;
65 65
66 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 71 virtual SqpRange range() const = 0;
68 72
69 73 // ///////// //
@@ -40,6 +40,10 public:
40 40 SqpRange cacheRange() const noexcept;
41 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 47 /// Returns the real range of the variable, i.e. the min and max x-axis values of the data
44 48 /// series between the range of the variable. The real range is updated each time the variable
45 49 /// range or the data series changed
@@ -16,7 +16,8 struct Variable::VariablePrivate {
16 16 m_Range{dateTime},
17 17 m_Metadata{metadata},
18 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 26 m_Range{other.m_Range},
26 27 m_Metadata{other.m_Metadata},
27 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 41 m_DataSeries->purge(m_CacheRange.m_TStart, m_CacheRange.m_TEnd);
40 42 }
41 43 updateRealRange();
44 updateNbPoints();
42 45 }
43 46
47 void updateNbPoints() { m_NbPoints = m_DataSeries ? m_DataSeries->nbPoints() : 0; }
48
44 49 /// Updates real range according to current variable range and data series
45 50 void updateRealRange()
46 51 {
@@ -67,6 +72,7 struct Variable::VariablePrivate {
67 72 QVariantHash m_Metadata;
68 73 std::shared_ptr<IDataSeries> m_DataSeries;
69 74 SqpRange m_RealRange;
75 int m_NbPoints;
70 76
71 77 QReadWriteLock m_Lock;
72 78 };
@@ -135,6 +141,11 void Variable::setCacheRange(const SqpRange &cacheRange) noexcept
135 141 impl->unlock();
136 142 }
137 143
144 int Variable::nbPoints() const noexcept
145 {
146 return impl->m_NbPoints;
147 }
148
138 149 SqpRange Variable::realRange() const noexcept
139 150 {
140 151 return impl->m_RealRange;
@@ -17,10 +17,11 namespace {
17 17 const auto NAME_COLUMN = 0;
18 18 const auto TSTART_COLUMN = 1;
19 19 const auto TEND_COLUMN = 2;
20 const auto UNIT_COLUMN = 3;
21 const auto MISSION_COLUMN = 4;
22 const auto PLUGIN_COLUMN = 5;
23 const auto NB_COLUMNS = 6;
20 const auto NBPOINTS_COLUMN = 3;
21 const auto UNIT_COLUMN = 4;
22 const auto MISSION_COLUMN = 5;
23 const auto PLUGIN_COLUMN = 6;
24 const auto NB_COLUMNS = 7;
24 25
25 26 // Column properties
26 27 const auto DEFAULT_HEIGHT = 25;
@@ -39,9 +40,10 struct ColumnProperties {
39 40 };
40 41
41 42 const auto COLUMN_PROPERTIES = QHash<int, ColumnProperties>{
42 {NAME_COLUMN, {QObject::tr("Name")}}, {TSTART_COLUMN, {QObject::tr("tStart"), 180}},
43 {TEND_COLUMN, {QObject::tr("tEnd"), 180}}, {UNIT_COLUMN, {QObject::tr("Unit")}},
44 {MISSION_COLUMN, {QObject::tr("Mission")}}, {PLUGIN_COLUMN, {QObject::tr("Plugin")}}};
43 {NAME_COLUMN, {QObject::tr("Name")}}, {TSTART_COLUMN, {QObject::tr("tStart"), 180}},
44 {TEND_COLUMN, {QObject::tr("tEnd"), 180}}, {NBPOINTS_COLUMN, {QObject::tr("Nb points")}},
45 {UNIT_COLUMN, {QObject::tr("Unit")}}, {MISSION_COLUMN, {QObject::tr("Mission")}},
46 {PLUGIN_COLUMN, {QObject::tr("Plugin")}}};
45 47
46 48 /// Format for datetimes
47 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 200 ? DateUtils::dateTime(range.m_TEnd).toString(DATETIME_FORMAT)
199 201 : QVariant{};
200 202 }
203 case NBPOINTS_COLUMN:
204 return variable->nbPoints();
201 205 case UNIT_COLUMN:
202 206 return variable->metadata().value(QStringLiteral("units"));
203 207 case MISSION_COLUMN:
General Comments 0
You need to be logged in to leave comments. Login now