##// END OF EJS Templates
Amda provider update (2)...
Alexandre Leroux -
r413:0a12bde5fff2
parent child
Show More
@@ -22,7 +22,7 public:
22 void requestDataLoading(QUuid token, const DataProviderParameters &parameters) override;
22 void requestDataLoading(QUuid token, const DataProviderParameters &parameters) override;
23
23
24 private:
24 private:
25 void retrieveData(QUuid token, const SqpDateTime &dateTime);
25 void retrieveData(QUuid token, const SqpDateTime &dateTime, const QVariantHash &data);
26 };
26 };
27
27
28 #endif // SCIQLOP_AMDAPROVIDER_H
28 #endif // SCIQLOP_AMDAPROVIDER_H
@@ -1,4 +1,5
1 #include "AmdaProvider.h"
1 #include "AmdaProvider.h"
2 #include "AmdaDefs.h"
2 #include "AmdaResultParser.h"
3 #include "AmdaResultParser.h"
3
4
4 #include <Data/DataProviderParameters.h>
5 #include <Data/DataProviderParameters.h>
@@ -51,20 +52,27 void AmdaProvider::requestDataLoading(QUuid token, const DataProviderParameters
51 {
52 {
52 // NOTE: Try to use multithread if possible
53 // NOTE: Try to use multithread if possible
53 const auto times = parameters.m_Times;
54 const auto times = parameters.m_Times;
55 const auto data = parameters.m_Data;
54 for (const auto &dateTime : qAsConst(times)) {
56 for (const auto &dateTime : qAsConst(times)) {
55 retrieveData(token, dateTime);
57 retrieveData(token, dateTime, data);
56 }
58 }
57 }
59 }
58
60
59 void AmdaProvider::retrieveData(QUuid token, const SqpDateTime &dateTime)
61 void AmdaProvider::retrieveData(QUuid token, const SqpDateTime &dateTime, const QVariantHash &data)
60 {
62 {
63 // Retrieves product ID from data: if the value is invalid, no request is made
64 auto productId = data.value(AMDA_XML_ID_KEY).toString();
65 if (productId.isNull()) {
66 qCCritical(LOG_AmdaProvider()) << tr("Can't retrieve data: unknown product id");
67 return;
68 }
69
61 // /////////// //
70 // /////////// //
62 // Creates URL //
71 // Creates URL //
63 // /////////// //
72 // /////////// //
64
73
65 auto startDate = dateFormat(dateTime.m_TStart);
74 auto startDate = dateFormat(dateTime.m_TStart);
66 auto endDate = dateFormat(dateTime.m_TEnd);
75 auto endDate = dateFormat(dateTime.m_TEnd);
67 auto productId = QStringLiteral("imf(0)");
68
76
69 auto url = QUrl{QString{AMDA_URL_FORMAT}.arg(startDate, endDate, productId)};
77 auto url = QUrl{QString{AMDA_URL_FORMAT}.arg(startDate, endDate, productId)};
70
78
General Comments 0
You need to be logged in to leave comments. Login now