@@ -161,14 +161,18 double __decodeTimeFromEpochDayOnly(int | |||
|
161 | 161 | { |
|
162 | 162 | struct tm t; |
|
163 | 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 | 166 | t.tm_mon=(10*(data[ofset+5] & 0x0F)) + ((data[ofset+6] & 0x0F)); |
|
166 | 167 | t.tm_mday=(10*(data[ofset+8] & 0x0F)) + ((data[ofset+9] & 0x0F)); |
|
167 | 168 | t.tm_hour=0; |
|
168 | 169 | t.tm_min=0; |
|
169 | 170 | t.tm_sec=0; |
|
170 | t_of_day = mktime(&t); | |
|
171 | return (double)t_of_day; | |
|
171 | // t_of_day = mktime(&t); | |
|
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 | 178 | void CassiniDataFile::run() |
@@ -10,6 +10,7 CassiniToolsGUI* CassiniTools::m_Cassini | |||
|
10 | 10 | CassiniDataFile* CassiniTools::m_dataFile=NULL; |
|
11 | 11 | int CassiniTools::m_defaultPlot=-1; |
|
12 | 12 | int CassiniTools::m_fftPlot=-1; |
|
13 | SocExplorerPlotActions* CassiniTools::ExportAction=NULL; | |
|
13 | 14 | |
|
14 | 15 | Qt::GlobalColor QLopColours[]= {Qt::black, |
|
15 | 16 | Qt::red, |
@@ -61,6 +62,9 void CassiniTools::makePlot() | |||
|
61 | 62 | SocExplorerPlotActions* action=new SocExplorerPlotActions("export view",plot->PID(),_self); |
|
62 | 63 | plot->addAction(action); |
|
63 | 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 | 68 | action=new SocExplorerPlotActions("FFT of the current view",plot->PID(),_self); |
|
65 | 69 | plot->addAction(action); |
|
66 | 70 | QObject::connect(action,SIGNAL(triggered(int)),_self,SLOT(compute_fft_on_view(int))); |
@@ -100,7 +104,10 void CassiniTools::plotFile(const QStrin | |||
|
100 | 104 | plot = QLopPlots::getPlot(m_defaultPlot); |
|
101 | 105 | } |
|
102 | 106 | if(plot) |
|
107 | { | |
|
103 | 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 | 123 | if(plot==NULL) |
|
117 | 124 | return; |
|
118 | 125 | { |
|
119 |
QString fileName = |
|
|
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 | 149 | if(fileName!="") |
|
121 | 150 | { |
|
122 | 151 | QLopDataList vectors; |
@@ -18,6 +18,7 private: | |||
|
18 | 18 | static CassiniToolsGUI* m_CassiniToolsGUI; |
|
19 | 19 | static CassiniDataFile* m_dataFile; |
|
20 | 20 | static int m_defaultPlot,m_fftPlot; |
|
21 | static SocExplorerPlotActions* ExportAction; | |
|
21 | 22 | CassiniTools(bool noGUI=false, QObject *parent=0); |
|
22 | 23 | ~CassiniTools(); |
|
23 | 24 | static void makePlot(); |
@@ -32,6 +33,7 public: | |||
|
32 | 33 | public slots: |
|
33 | 34 | void plot_TAB_File(const QString& fileName); |
|
34 | 35 | void export_view(int PID); |
|
36 | void export_view_Predefined_FileName(int PID); | |
|
35 | 37 | void compute_fft_on_view(int PID); |
|
36 | 38 | private slots: |
|
37 | 39 | void dataReady(QLopDataList data); |
@@ -104,10 +104,16 void SocExplorerPlot::setTitle(QString t | |||
|
104 | 104 | /*! |
|
105 | 105 | @todo Function borcken fixe this! |
|
106 | 106 | */ |
|
107 | this->m_Title = title; | |
|
107 | 108 | emit titleChanged(title); |
|
108 | 109 | this->repaint(); |
|
109 | 110 | } |
|
110 | 111 | |
|
112 | const QString &SocExplorerPlot::title() | |
|
113 | { | |
|
114 | return m_Title; | |
|
115 | } | |
|
116 | ||
|
111 | 117 | void SocExplorerPlot::setXaxisLabel(QString label) |
|
112 | 118 | { |
|
113 | 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 | 223 | void SocExplorerPlot::setGraphData(int graphIndex, QList<QVariant> x, QList<QVariant> y) |
|
209 | 224 | { |
@@ -63,6 +63,7 public: | |||
|
63 | 63 | explicit SocExplorerPlot(QWidget *parent = 0); |
|
64 | 64 | ~SocExplorerPlot(); |
|
65 | 65 | void setTitle(QString title); |
|
66 | const QString& title(); | |
|
66 | 67 | void setXaxisLabel(QString label); |
|
67 | 68 | void setXaxisLog(); |
|
68 | 69 | void setXaxisRange(double lower, double upper); |
@@ -79,6 +80,7 public: | |||
|
79 | 80 | int graphCount(); |
|
80 | 81 | void removeAllGraphs(); |
|
81 | 82 | void setGraphName(int graphIndex,QString name); |
|
83 | const QString& graphName(int graphIndex); | |
|
82 | 84 | void setGraphData(int graphIndex, QList<QVariant> x, QList<QVariant> y); |
|
83 | 85 | void setGraphData(int graphIndex, QCPDataMap* data,bool copy = true,bool replot=true); |
|
84 | 86 | void setGraphData(int graphIndex, QVector<QCPData> *data, bool replot); |
@@ -125,6 +127,7 private: | |||
|
125 | 127 | QRubberBand * mRubberBand; |
|
126 | 128 | QPoint mOrigin; |
|
127 | 129 | QList<SocExplorerPlotActions*> m_actions; |
|
130 | QString m_Title; | |
|
128 | 131 | int m_PID; |
|
129 | 132 | }; |
|
130 | 133 |
General Comments 0
You need to be logged in to leave comments.
Login now