##// END OF EJS Templates
added quick fileName generation for data export, and fixed wrong date reading...
jeandet -
r10:63067c6877ba default
parent child
Show More
@@ -161,14 +161,18 double __decodeTimeFromEpochDayOnly(int
161 {
161 {
162 struct tm t;
162 struct tm t;
163 time_t t_of_day;
163 time_t t_of_day;
164 t.tm_year=(1000*(data[ofset] & 0x0F)) + (100*(data[ofset+1] & 0x0F)) + (10*(data[ofset+2] & 0x0F)) + ((data[ofset+3] & 0x0F)) -1900;
164 // t.tm_year=(1000*(data[ofset] & 0x0F)) + (100*(data[ofset+1] & 0x0F)) + (10*(data[ofset+2] & 0x0F)) + ((data[ofset+3] & 0x0F)) -1900;
165 t.tm_year=(1000*(data[ofset] & 0x0F)) + (100*(data[ofset+1] & 0x0F)) + (10*(data[ofset+2] & 0x0F)) + ((data[ofset+3] & 0x0F));
165 t.tm_mon=(10*(data[ofset+5] & 0x0F)) + ((data[ofset+6] & 0x0F));
166 t.tm_mon=(10*(data[ofset+5] & 0x0F)) + ((data[ofset+6] & 0x0F));
166 t.tm_mday=(10*(data[ofset+8] & 0x0F)) + ((data[ofset+9] & 0x0F));
167 t.tm_mday=(10*(data[ofset+8] & 0x0F)) + ((data[ofset+9] & 0x0F));
167 t.tm_hour=0;
168 t.tm_hour=0;
168 t.tm_min=0;
169 t.tm_min=0;
169 t.tm_sec=0;
170 t.tm_sec=0;
170 t_of_day = mktime(&t);
171 // t_of_day = mktime(&t);
171 return (double)t_of_day;
172 // return (double)t_of_day;
173 QDateTime date(QDate(t.tm_year,t.tm_mon,1),QTime(0,0));
174 // date.setDate();
175 return (double)((date.toMSecsSinceEpoch()/1000.0)-(24*3600));
172 }
176 }
173
177
174 void CassiniDataFile::run()
178 void CassiniDataFile::run()
@@ -10,6 +10,7 CassiniToolsGUI* CassiniTools::m_Cassini
10 CassiniDataFile* CassiniTools::m_dataFile=NULL;
10 CassiniDataFile* CassiniTools::m_dataFile=NULL;
11 int CassiniTools::m_defaultPlot=-1;
11 int CassiniTools::m_defaultPlot=-1;
12 int CassiniTools::m_fftPlot=-1;
12 int CassiniTools::m_fftPlot=-1;
13 SocExplorerPlotActions* CassiniTools::ExportAction=NULL;
13
14
14 Qt::GlobalColor QLopColours[]= {Qt::black,
15 Qt::GlobalColor QLopColours[]= {Qt::black,
15 Qt::red,
16 Qt::red,
@@ -61,6 +62,9 void CassiniTools::makePlot()
61 SocExplorerPlotActions* action=new SocExplorerPlotActions("export view",plot->PID(),_self);
62 SocExplorerPlotActions* action=new SocExplorerPlotActions("export view",plot->PID(),_self);
62 plot->addAction(action);
63 plot->addAction(action);
63 QObject::connect(action,SIGNAL(triggered(int)),_self,SLOT(export_view(int)));
64 QObject::connect(action,SIGNAL(triggered(int)),_self,SLOT(export_view(int)));
65 ExportAction=new SocExplorerPlotActions("export view to "+QString(plot->title()).replace(".TAB","-part.TAB"),plot->PID(),_self);
66 plot->addAction(ExportAction);
67 QObject::connect(ExportAction,SIGNAL(triggered(int)),_self,SLOT(export_view_Predefined_FileName(int)));
64 action=new SocExplorerPlotActions("FFT of the current view",plot->PID(),_self);
68 action=new SocExplorerPlotActions("FFT of the current view",plot->PID(),_self);
65 plot->addAction(action);
69 plot->addAction(action);
66 QObject::connect(action,SIGNAL(triggered(int)),_self,SLOT(compute_fft_on_view(int)));
70 QObject::connect(action,SIGNAL(triggered(int)),_self,SLOT(compute_fft_on_view(int)));
@@ -100,7 +104,10 void CassiniTools::plotFile(const QStrin
100 plot = QLopPlots::getPlot(m_defaultPlot);
104 plot = QLopPlots::getPlot(m_defaultPlot);
101 }
105 }
102 if(plot)
106 if(plot)
107 {
103 plot->setTitle(File);
108 plot->setTitle(File);
109 ExportAction->setText("export view to "+QString(File).replace(".TAB","-part.TAB"));
110 }
104 }
111 }
105 }
112 }
106
113
@@ -116,7 +123,29 void CassiniTools::export_view(int PID)
116 if(plot==NULL)
123 if(plot==NULL)
117 return;
124 return;
118 {
125 {
119 QString fileName = QFileDialog::getSaveFileName();
126 QString fileName = plot->title();
127 fileName = QFileDialog::getSaveFileName(0,tr("Set filename"),fileName.replace(".TAB","-part.TAB"));
128 if(fileName!="")
129 {
130 QLopDataList vectors;
131 for(int i=0;i<plot->graphCount();i++)
132 {
133 QLopData* vect = new QLopData();
134 vect->data = plot->getVisibleData(i);
135 vectors.append(vect);
136 }
137 m_dataFile->saveFile(fileName,vectors);
138 }
139 }
140 }
141
142 void CassiniTools::export_view_Predefined_FileName(int PID)
143 {
144 SocExplorerPlot* plot = QLopPlots::getPlot(PID);
145 if(plot==NULL)
146 return;
147 {
148 QString fileName = QString(plot->title()).replace(".TAB","-part.TAB");
120 if(fileName!="")
149 if(fileName!="")
121 {
150 {
122 QLopDataList vectors;
151 QLopDataList vectors;
@@ -18,6 +18,7 private:
18 static CassiniToolsGUI* m_CassiniToolsGUI;
18 static CassiniToolsGUI* m_CassiniToolsGUI;
19 static CassiniDataFile* m_dataFile;
19 static CassiniDataFile* m_dataFile;
20 static int m_defaultPlot,m_fftPlot;
20 static int m_defaultPlot,m_fftPlot;
21 static SocExplorerPlotActions* ExportAction;
21 CassiniTools(bool noGUI=false, QObject *parent=0);
22 CassiniTools(bool noGUI=false, QObject *parent=0);
22 ~CassiniTools();
23 ~CassiniTools();
23 static void makePlot();
24 static void makePlot();
@@ -32,6 +33,7 public:
32 public slots:
33 public slots:
33 void plot_TAB_File(const QString& fileName);
34 void plot_TAB_File(const QString& fileName);
34 void export_view(int PID);
35 void export_view(int PID);
36 void export_view_Predefined_FileName(int PID);
35 void compute_fft_on_view(int PID);
37 void compute_fft_on_view(int PID);
36 private slots:
38 private slots:
37 void dataReady(QLopDataList data);
39 void dataReady(QLopDataList data);
@@ -104,10 +104,16 void SocExplorerPlot::setTitle(QString t
104 /*!
104 /*!
105 @todo Function borcken fixe this!
105 @todo Function borcken fixe this!
106 */
106 */
107 this->m_Title = title;
107 emit titleChanged(title);
108 emit titleChanged(title);
108 this->repaint();
109 this->repaint();
109 }
110 }
110
111
112 const QString &SocExplorerPlot::title()
113 {
114 return m_Title;
115 }
116
111 void SocExplorerPlot::setXaxisLabel(QString label)
117 void SocExplorerPlot::setXaxisLabel(QString label)
112 {
118 {
113 this->m_plot->xAxis->setLabel(label);
119 this->m_plot->xAxis->setLabel(label);
@@ -204,6 +210,15 void SocExplorerPlot::setGraphName(int g
204 }
210 }
205 }
211 }
206
212
213 const QString &SocExplorerPlot::graphName(int graphIndex)
214 {
215 if(graphIndex<this->m_plot->graphCount())
216 {
217 return this->m_plot->graph(graphIndex)->name();
218 }
219 return "";
220 }
221
207
222
208 void SocExplorerPlot::setGraphData(int graphIndex, QList<QVariant> x, QList<QVariant> y)
223 void SocExplorerPlot::setGraphData(int graphIndex, QList<QVariant> x, QList<QVariant> y)
209 {
224 {
@@ -63,6 +63,7 public:
63 explicit SocExplorerPlot(QWidget *parent = 0);
63 explicit SocExplorerPlot(QWidget *parent = 0);
64 ~SocExplorerPlot();
64 ~SocExplorerPlot();
65 void setTitle(QString title);
65 void setTitle(QString title);
66 const QString& title();
66 void setXaxisLabel(QString label);
67 void setXaxisLabel(QString label);
67 void setXaxisLog();
68 void setXaxisLog();
68 void setXaxisRange(double lower, double upper);
69 void setXaxisRange(double lower, double upper);
@@ -79,6 +80,7 public:
79 int graphCount();
80 int graphCount();
80 void removeAllGraphs();
81 void removeAllGraphs();
81 void setGraphName(int graphIndex,QString name);
82 void setGraphName(int graphIndex,QString name);
83 const QString& graphName(int graphIndex);
82 void setGraphData(int graphIndex, QList<QVariant> x, QList<QVariant> y);
84 void setGraphData(int graphIndex, QList<QVariant> x, QList<QVariant> y);
83 void setGraphData(int graphIndex, QCPDataMap* data,bool copy = true,bool replot=true);
85 void setGraphData(int graphIndex, QCPDataMap* data,bool copy = true,bool replot=true);
84 void setGraphData(int graphIndex, QVector<QCPData> *data, bool replot);
86 void setGraphData(int graphIndex, QVector<QCPData> *data, bool replot);
@@ -125,6 +127,7 private:
125 QRubberBand * mRubberBand;
127 QRubberBand * mRubberBand;
126 QPoint mOrigin;
128 QPoint mOrigin;
127 QList<SocExplorerPlotActions*> m_actions;
129 QList<SocExplorerPlotActions*> m_actions;
130 QString m_Title;
128 int m_PID;
131 int m_PID;
129 };
132 };
130
133
General Comments 0
You need to be logged in to leave comments. Login now