dataload_ulog.cpp
Go to the documentation of this file.
1 #include "dataload_ulog.h"
2 #include <QTextStream>
3 #include <QFile>
4 #include <QMessageBox>
5 #include <QDebug>
6 #include <QWidget>
7 #include <QSettings>
8 #include <QProgressDialog>
9 #include <QMainWindow>
10 #include "selectlistdialog.h"
11 #include "ulog_parser.h"
12 #include "ulog_parameters_dialog.h"
13 
14 DataLoadULog::DataLoadULog(): _main_win(nullptr)
15 {
16  for(QWidget *widget: qApp->topLevelWidgets())
17  {
18  if(widget->inherits("QMainWindow"))
19  {
20  _main_win = widget;
21  break;
22  }
23  }
24 }
25 
26 const std::vector<const char*> &DataLoadULog::compatibleFileExtensions() const
27 {
28  static std::vector<const char*> extensions = { "ulg" };
29  return extensions;
30 }
31 
33 {
34  const auto& filename = fileload_info->filename;
35 
36  ULogParser parser( filename.toStdString() );
37 
38  const auto& timeseries_map = parser.getTimeseriesMap();
39 
40  for( const auto& it: timeseries_map)
41  {
42  const std::string& sucsctiption_name = it.first;
43  const ULogParser::Timeseries& timeseries = it.second;
44 
45  for (const auto& data: timeseries.data )
46  {
47  std::string series_name = sucsctiption_name + data.first;
48 
49  auto series = plot_data.addNumeric( series_name );
50 
51  for( size_t i=0; i < data.second.size(); i++ )
52  {
53  double msg_time = static_cast<double>(timeseries.timestamps[i]) * 0.000001;
54  PlotData::Point point( msg_time, data.second[i] );
55  series->second.pushBack( point );
56  }
57  }
58  }
59 
61  dialog->setWindowTitle( QString("ULog file %1").arg(filename) );
62  dialog->setAttribute(Qt::WA_DeleteOnClose);
63  dialog->restoreSettings();
64  dialog->show();
65 
66  return true;
67 }
68 
70 {
71 
72 }
73 
74 bool DataLoadULog::xmlSaveState(QDomDocument &doc, QDomElement &parent_element) const
75 {
76  return true;
77 }
78 
79 bool DataLoadULog::xmlLoadState(const QDomElement &)
80 {
81  return true;
82 }
83 
std::vector< uint64_t > timestamps
Definition: ulog_parser.h:70
bool xmlSaveState(QDomDocument &doc, QDomElement &parent_element) const override
filename
QString filename
const std::vector< const char * > & compatibleFileExtensions() const override
std::vector< std::pair< std::string, std::vector< double > > > data
Definition: ulog_parser.h:71
bool xmlLoadState(const QDomElement &parent_element) override
~DataLoadULog() override
void * arg
QWidget * _main_win
Definition: dataload_ulog.h:34
std::unordered_map< std::string, PlotData >::iterator addNumeric(const std::string &name)
Definition: plotdata.h:147
parser
bool readDataFromFile(FileLoadInfo *fileload_info, PlotDataMapRef &destination) override
empty_struct data[sizeof(T)/sizeof(empty_struct)]
int i


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17