Changeset 164 for Evidence


Ignore:
Timestamp:
02/08/10 15:03:53 (15 years ago)
Author:
ogrimm
Message:
Revision number tracked in server status
Location:
Evidence
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Evidence/Edd/Edd.cc

    r159 r164  
    2222class GUI *Handler;
    2323
     24
     25// History chooser function (opens plot for numeric data, TextHist for all other)
     26QWidget *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
    2440//////////////////////////////////////////
    2541// Text display for arbitary DIM service//
     
    4157  // Context menu
    4258  Menu = new QMenu(this);
    43   Menu->addAction("Open history", this, SLOT(MenuOpenHistory()));
     59  Menu->addAction("Open new history", this, SLOT(MenuOpenHistory()));
    4460  Menu->addAction("Copy service", this, SLOT(MenuCopyService()));
    4561  Menu->addAction("Copy data", this, SLOT(MenuCopyData()));
     
    135151void Edd_Indicator::MenuOpenHistory() {
    136152 
    137   LastPlot = new Edd_Plot(Data->getName());
    138   LastPlot->show();
     153  LastPlot = OpenHistory(Data->getName());
     154  if (LastPlot != NULL) LastPlot->show();
    139155}
    140156
     
    165181  // Graph properties
    166182  setAutoReplot(false);
    167   QwtText XAxisTitle("Time (RJD-55200)");
    168   XAxisTitle.setFont(QFont("Helvetica", 10));
    169   setAxisTitle(QwtPlot::xBottom, XAxisTitle);
    170183  setCanvasBackground(QColor(Qt::yellow));
     184  setAxisScaleDraw(QwtPlot::xBottom, new TimeScale());
    171185
    172186  Zoomer = new QwtPlotZoomer(QwtPlot::xBottom,QwtPlot::yLeft,canvas());
     
    347361    else Items[ItemNo].Signal->setSymbol(Sym1);
    348362
    349     int DataPoints = Items[ItemNo].x.size();
    350        
     363    int DataPoints = Items[ItemNo].x.size();   
    351364        if (DataPoints == 0) continue;
    352   
    353     double *x = new double [DataPoints];
     365 
     366    // Normalize y scale if requested
    354367    double *y = new double [DataPoints];
    355  
    356     // Adapt time scale and normalize y scale if requested
    357368    for (int i=0; i<DataPoints; i++) {
    358       x[i] = Items[ItemNo].x[i] / 86400.0 + 40587.5 - 55200;
    359369      y[i] = Items[ItemNo].y[i];
    360370
     
    368378
    369379    // Plot data
    370     Items[ItemNo].Signal->setData(x, y, DataPoints);
     380    Items[ItemNo].Signal->setData(Items[ItemNo].x.data(), y, DataPoints);
    371381    Items[ItemNo].Signal->show();
    372382    Zoomer->setZoomBase(Items[ItemNo].Signal->boundingRect());
    373383
    374     delete[] x;
    375384    delete[] y;
    376385  }
     
    825834    Result = Result.trimmed();
    826835    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();
    829838  }
    830839}
  • Evidence/Edd/Edd.h

    r159 r164  
    2424
    2525#define SVN_REVISION "$Revision$"
     26
     27QWidget *OpenHistory(char *);
     28
     29// Time scale for axis
     30class 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
    2639                 
    2740// General indicator for DIM service
     
    3144    QMenu *Menu;
    3245    QPoint dragStart;
    33     QwtPlot *LastPlot;
     46    //QwtPlot *LastPlot;
     47    QWidget *LastPlot;
    3448       
    3549    DimStampedInfo *Data;
  • Evidence/Evidence.cc

    r159 r164  
    5151 
    5252  // Start server
    53   static char Init[] = "Server started";
     53  static char Init[] = "Server started (" EVIDENCE_REVISION "  Compiled "__DATE__ __TIME__ ")";
    5454  Status = new DimService((string(Name) + "/Status").c_str(), (char *) "C", Init, sizeof(Init));
    5555
  • Evidence/Evidence.h

    • Property svn:keywords set to Revision
    r159 r164  
    88#include <exception>
    99#include <vector>
    10 
     10 
    1111#include "dis.hxx"
    1212#include "dic.hxx"
     
    1414#define NO_LINK (char *) "__&DIM&NOLINK&__" // Data if no link available
    1515#define STATUS_SIZE 1000                                        // Bytes for status service string
     16#define EVIDENCE_REVISION "$Revision$"
    1617
    1718// Class declation of Evidence server
Note: See TracChangeset for help on using the changeset viewer.