@@ -25,12 +25,10 public: | |||
|
25 | 25 | * Creates a new variable in the model |
|
26 | 26 | * @param name the name of the new variable |
|
27 | 27 | * @param dateTime the dateTime of the new variable |
|
28 | * @param defaultDataSeries the default data of the new variable | |
|
29 | 28 | * @return the pointer to the new variable |
|
30 | 29 | */ |
|
31 | std::shared_ptr<Variable> | |
|
32 | createVariable(const QString &name, const SqpDateTime &dateTime, | |
|
33 | std::shared_ptr<IDataSeries> defaultDataSeries) noexcept; | |
|
30 | std::shared_ptr<Variable> createVariable(const QString &name, | |
|
31 | const SqpDateTime &dateTime) noexcept; | |
|
34 | 32 | |
|
35 | 33 | std::shared_ptr<Variable> variable(int index) const; |
|
36 | 34 |
@@ -55,7 +55,7 void VariableCacheController::addDateTime(std::shared_ptr<Variable> variable, | |||
|
55 | 55 | impl->m_VariableToSqpDateTimeListMap.at(variable), 0); |
|
56 | 56 | } |
|
57 | 57 | catch (const std::out_of_range &e) { |
|
58 | qCWarning(LOG_VariableCacheController()) << e.what(); | |
|
58 | qCWarning(LOG_VariableCacheController()) << "addDateTime" << e.what(); | |
|
59 | 59 | } |
|
60 | 60 | } |
|
61 | 61 | } |
@@ -71,13 +71,12 VariableCacheController::provideNotInCacheDateTimeList(std::shared_ptr<Variable> | |||
|
71 | 71 | // list of date time request associated to the variable |
|
72 | 72 | // We assume that the list is ordered in a way that l(0) < l(1). We assume also a < b |
|
73 | 73 | // (with a & b of type SqpDateTime) means ts(b) > te(a) |
|
74 | ||
|
75 | try { | |
|
76 |
impl->addInCacheDataByStart(dateTime, i |
|
|
77 | notInCache, 0, dateTime.m_TStart); | |
|
74 | auto it = impl->m_VariableToSqpDateTimeListMap.find(variable); | |
|
75 | if (it != impl->m_VariableToSqpDateTimeListMap.end()) { | |
|
76 | impl->addInCacheDataByStart(dateTime, it->second, notInCache, 0, dateTime.m_TStart); | |
|
78 | 77 | } |
|
79 | catch (const std::out_of_range &e) { | |
|
80 | qCWarning(LOG_VariableCacheController()) << e.what(); | |
|
78 | else { | |
|
79 | notInCache << dateTime; | |
|
81 | 80 | } |
|
82 | 81 | |
|
83 | 82 | return notInCache; |
@@ -99,8 +99,7 void VariableController::createVariable(const QString &name, | |||
|
99 | 99 | /// - default data are generated for the variable, without taking into account the timerange set |
|
100 | 100 | /// in sciqlop |
|
101 | 101 | auto dateTime = impl->m_TimeController->dateTime(); |
|
102 | if (auto newVariable = impl->m_VariableModel->createVariable( | |
|
103 | name, dateTime, generateDefaultDataSeries(*provider, dateTime))) { | |
|
102 | if (auto newVariable = impl->m_VariableModel->createVariable(name, dateTime)) { | |
|
104 | 103 | |
|
105 | 104 | // store the provider |
|
106 | 105 | impl->m_VariableToProviderMap[newVariable] = provider; |
@@ -114,10 +113,7 void VariableController::createVariable(const QString &name, | |||
|
114 | 113 | }; |
|
115 | 114 | |
|
116 | 115 | connect(provider.get(), &IDataProvider::dataProvided, addDateTimeAcquired); |
|
117 | ||
|
118 | ||
|
119 | // store in cache | |
|
120 | impl->m_VariableCacheController->addDateTime(newVariable, dateTime); | |
|
116 | this->onRequestDataLoading(newVariable, dateTime); | |
|
121 | 117 | |
|
122 | 118 | // notify the creation |
|
123 | 119 | emit variableCreated(newVariable); |
@@ -52,9 +52,8 VariableModel::VariableModel(QObject *parent) | |||
|
52 | 52 | { |
|
53 | 53 | } |
|
54 | 54 | |
|
55 | std::shared_ptr<Variable> | |
|
56 | VariableModel::createVariable(const QString &name, const SqpDateTime &dateTime, | |
|
57 | std::shared_ptr<IDataSeries> defaultDataSeries) noexcept | |
|
55 | std::shared_ptr<Variable> VariableModel::createVariable(const QString &name, | |
|
56 | const SqpDateTime &dateTime) noexcept | |
|
58 | 57 | { |
|
59 | 58 | auto insertIndex = rowCount(); |
|
60 | 59 | beginInsertRows({}, insertIndex, insertIndex); |
@@ -62,7 +61,6 VariableModel::createVariable(const QString &name, const SqpDateTime &dateTime, | |||
|
62 | 61 | /// @todo For the moment, the other data of the variable is initialized with default values |
|
63 | 62 | auto variable = std::make_shared<Variable>(name, QStringLiteral("unit"), |
|
64 | 63 | QStringLiteral("mission"), dateTime); |
|
65 | variable->setDataSeries(std::move(defaultDataSeries)); | |
|
66 | 64 | |
|
67 | 65 | impl->m_Variables.push_back(variable); |
|
68 | 66 |
General Comments 0
You need to be logged in to leave comments.
Login now