Changeset 164 for Evidence/Edd
- Timestamp:
- 02/08/10 15:03:53 (15 years ago)
- Location:
- Evidence/Edd
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Evidence/Edd/Edd.cc
r159 r164 22 22 class GUI *Handler; 23 23 24 25 // History chooser function (opens plot for numeric data, TextHist for all other) 26 QWidget *OpenHistory(char *Service) { 27 28 char *Name, *Format; 29 DimBrowser Browser; 30 31 //if (Browser.getServices(Service) == 0) return NULL; 32 Browser.getServices(Service); 33 if (Browser.getNextService(Name, Format) != DimSERVICE) return NULL; 34 35 if (strlen(Format) == 1 && *Format != 'C') return new Edd_Plot(Service); 36 else return new Edd_TextHist(Service); 37 } 38 39 24 40 ////////////////////////////////////////// 25 41 // Text display for arbitary DIM service// … … 41 57 // Context menu 42 58 Menu = new QMenu(this); 43 Menu->addAction("Open history", this, SLOT(MenuOpenHistory()));59 Menu->addAction("Open new history", this, SLOT(MenuOpenHistory())); 44 60 Menu->addAction("Copy service", this, SLOT(MenuCopyService())); 45 61 Menu->addAction("Copy data", this, SLOT(MenuCopyData())); … … 135 151 void Edd_Indicator::MenuOpenHistory() { 136 152 137 LastPlot = new Edd_Plot(Data->getName());138 LastPlot->show();153 LastPlot = OpenHistory(Data->getName()); 154 if (LastPlot != NULL) LastPlot->show(); 139 155 } 140 156 … … 165 181 // Graph properties 166 182 setAutoReplot(false); 167 QwtText XAxisTitle("Time (RJD-55200)");168 XAxisTitle.setFont(QFont("Helvetica", 10));169 setAxisTitle(QwtPlot::xBottom, XAxisTitle);170 183 setCanvasBackground(QColor(Qt::yellow)); 184 setAxisScaleDraw(QwtPlot::xBottom, new TimeScale()); 171 185 172 186 Zoomer = new QwtPlotZoomer(QwtPlot::xBottom,QwtPlot::yLeft,canvas()); … … 347 361 else Items[ItemNo].Signal->setSymbol(Sym1); 348 362 349 int DataPoints = Items[ItemNo].x.size(); 350 363 int DataPoints = Items[ItemNo].x.size(); 351 364 if (DataPoints == 0) continue; 352 353 double *x = new double [DataPoints];365 366 // Normalize y scale if requested 354 367 double *y = new double [DataPoints]; 355 356 // Adapt time scale and normalize y scale if requested357 368 for (int i=0; i<DataPoints; i++) { 358 x[i] = Items[ItemNo].x[i] / 86400.0 + 40587.5 - 55200;359 369 y[i] = Items[ItemNo].y[i]; 360 370 … … 368 378 369 379 // Plot data 370 Items[ItemNo].Signal->setData( x, y, DataPoints);380 Items[ItemNo].Signal->setData(Items[ItemNo].x.data(), y, DataPoints); 371 381 Items[ItemNo].Signal->show(); 372 382 Zoomer->setZoomBase(Items[ItemNo].Signal->boundingRect()); 373 383 374 delete[] x;375 384 delete[] y; 376 385 } … … 825 834 Result = Result.trimmed(); 826 835 if (Result.endsWith(".hist")) Result.chop(5); 827 Edd_Plot *Plot = new Edd_Plot(Result);828 Plot->show();836 QWidget *Hist = OpenHistory(Result.toAscii().data()); 837 if (Hist != NULL) Hist->show(); 829 838 } 830 839 } -
Evidence/Edd/Edd.h
r159 r164 24 24 25 25 #define SVN_REVISION "$Revision$" 26 27 QWidget *OpenHistory(char *); 28 29 // Time scale for axis 30 class TimeScale: public QwtScaleDraw { 31 public: 32 TimeScale() { } 33 virtual QwtText label(double v) const { 34 QDateTime t = QDateTime::fromTime_t((int) v); 35 return t.toString("dMMM'\n'h:m:s"); 36 } 37 }; 38 26 39 27 40 // General indicator for DIM service … … 31 44 QMenu *Menu; 32 45 QPoint dragStart; 33 QwtPlot *LastPlot; 46 //QwtPlot *LastPlot; 47 QWidget *LastPlot; 34 48 35 49 DimStampedInfo *Data;
Note:
See TracChangeset
for help on using the changeset viewer.