##// END OF EJS Templates
Generates vectors (4)...
Alexandre Leroux -
r787:affa100bd0be
parent child
Show More
@@ -114,11 +114,14 std::shared_ptr<IDataSeries> CosinusProvider::retrieveData(QUuid acqIdentifier,
114 114 // included)
115 115 auto dataCount = end - start + 1;
116 116
117 // Number of components (depending on the cosinus type)
118 auto componentCount = type->componentCount();
119
117 120 auto xAxisData = std::vector<double>{};
118 121 xAxisData.resize(dataCount);
119 122
120 123 auto valuesData = std::vector<double>{};
121 valuesData.resize(dataCount);
124 valuesData.resize(dataCount * componentCount);
122 125
123 126 int progress = 0;
124 127 auto progressEnd = dataCount;
@@ -128,7 +131,13 std::shared_ptr<IDataSeries> CosinusProvider::retrieveData(QUuid acqIdentifier,
128 131 const auto timeOnFreq = time / freq;
129 132
130 133 xAxisData[dataIndex] = timeOnFreq;
131 valuesData[dataIndex] = std::cos(timeOnFreq);
134
135 // Generates all components' values
136 // Example: for a vector, values will be : cos(x), cos(x)/2, cos(x)/3
137 auto value = std::cos(timeOnFreq);
138 for (auto i = 0; i < componentCount; ++i) {
139 valuesData[componentCount * dataIndex + i] = value / (i + 1);
140 }
132 141
133 142 // progression
134 143 int currentProgress = (time - start) * 100.0 / progressEnd;
@@ -153,8 +162,8 std::shared_ptr<IDataSeries> CosinusProvider::retrieveData(QUuid acqIdentifier,
153 162 // We can close progression beacause all data has been retrieved
154 163 emit dataProvidedProgress(acqIdentifier, 100);
155 164 }
156 return std::make_shared<ScalarSeries>(std::move(xAxisData), std::move(valuesData),
157 Unit{QStringLiteral("t"), true}, Unit{});
165 return type->createDataSeries(std::move(xAxisData), std::move(valuesData),
166 Unit{QStringLiteral("t"), true}, Unit{});
158 167 }
159 168
160 169 void CosinusProvider::requestDataLoading(QUuid acqIdentifier,
General Comments 0
You need to be logged in to leave comments. Login now