Ignore:
Timestamp:
08/16/11 11:53:58 (13 years ago)
Author:
lyard
Message:
added spinners for slices and events
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc

    r11902 r11907  
    55 *      Author: lyard
    66 */
     7
    78
    89#include "RawEventsViewer.h"
     
    603604        delete inputFile;
    604605    }
     606    try {
    605607    inputFile = new fits(file);
     608    }
     609    catch (std::runtime_error e)
     610    {
     611        cout << "Something went wrong while loading fits. aborting: " << e.what() << endl;
     612        return;
     613    }
    606614    if (!*inputFile)
    607615    {
     
    635643    for (vector<string>::const_iterator it=entriesToCheck.begin(); it != entriesToCheck.end(); it++)
    636644    {
     645        try {
    637646        if (!inputFile->HasKey(*it)){
    638647            cout << *it << " missing. Aborting load..." << endl;
    639648            return;}
     649        }
     650        catch (std::runtime_error e)
     651        {
     652            cout << e.what() << endl;
     653            return;
     654        }
    640655    }
    641656    nRows = inputFile->GetInt("NAXIS2");
     
    779794        return;
    780795    inputFile->GetRow(rowNum);
     796//    cout << "Getting row " << rowNum << endl;
    781797    for (int i=0;i<(1440+160)*nRoi;i++)
    782798        eventData[i] = (float)rawEventData[i];
     
    841857UIConnector::UIConnector(QWidget*)
    842858{
     859    updateSpinnerDisplay = true;
     860
    843861    timer.setInterval(10.0);
    844862    QObject::connect(&timer, SIGNAL(timeout()),
     
    11691187{
    11701188    ostringstream str;
    1171     str << "File loaded: " << currentFile << "\n";
    1172     str << "Calibration file loaded: " << currentCalibFile << "\n";
     1189
     1190    //extract the file name only (no path) from the full name
     1191    str << "File: " << currentFile.substr(currentFile.find_last_of("//")+1, currentFile.size()) << "\n";
     1192    str << "Calibration: " << currentCalibFile.substr(currentCalibFile.find_last_of("//")+1, currentCalibFile.size()) << "\n";
    11731193//    fileLoadedLabel->setText(QString(str.str().c_str()));
    11741194//    str.str("");
     
    11771197//    str.str("");
    11781198    str << "Number of Events: " << viewer->nRows << "\n";
     1199
     1200    eventNumberBox->setMaximum(viewer->nRows-1);
     1201
    11791202    str << "Number of Slices: " << viewer->nRoi << "\n";// << "/1024";
    11801203//    numberOfSlicesLabel->setText(QString(str.str().c_str()));
     
    12261249{
    12271250    ostringstream str;
    1228     str << "Displaying Slice " << slice;
    1229     QString qstr(str.str().c_str());
    1230     emit updateCurrentSliceDisplay(qstr);
     1251//    str << "Displaying Slice " << slice;
     1252//    QString qstr(str.str().c_str());
     1253    if (updateSpinnerDisplay)
     1254        emit updateCurrentSliceDisplay(slice);
    12311255
    12321256    str.str("");
    12331257    str << "Current Pixel val.: " << viewer->eventData[viewer->nRoi*viewer->selectedPixel + viewer->whichSlice];
    1234     qstr = qstr.fromStdString(str.str());
     1258    QString qstr = qstr.fromStdString(str.str());
    12351259    emit updateCurrentPixelSliceValue(qstr);
    12361260
     
    12411265double xval[4096];
    12421266double yval[4096];
    1243 
     1267void UIConnector::eventChangedFromSpinner(int cEvent)
     1268{
     1269//    cout << "Here " << updateSpinnerDisplay << endl;
     1270    if (!updateSpinnerDisplay)
     1271        return;
     1272    updateSpinnerDisplay = false;
     1273//    currentEventHasChanged(cEvent);
     1274    viewer->rowNum = cEvent - viewer->eventStep;
     1275    viewer->eventStepping(true);
     1276    updateSpinnerDisplay = true;
     1277
     1278//    viewer->updateGL();
     1279}
     1280void UIConnector::sliceChangedFromSpinner(int cSlice)
     1281{
     1282    updateSpinnerDisplay = false;
     1283    currentSliceHasChanged(cSlice);
     1284    updateSpinnerDisplay = true;
     1285    viewer->whichSlice = cSlice;
     1286    viewer->updateGL();
     1287}
    12441288void UIConnector::currentEventHasChanged(int cEvent)
    12451289{
    12461290    ostringstream str;
    1247     str << "Displaying Event " << cEvent;
    1248     QString qstr(str.str().c_str());
    1249     emit updateCurrentEventDisplay(qstr);
    1250     //retrieve the data that we want to display
     1291//    str << "Displaying Event " << cEvent;
     1292//    QString qstr(str.str().c_str());
     1293//    emit updateCurrentEventDisplay(qstr);
     1294    if (updateSpinnerDisplay)
     1295    {
     1296        updateSpinnerDisplay = false;
     1297        emit updateCurrentEventDisplay(viewer->rowNum);
     1298        updateSpinnerDisplay = true;
     1299    }
     1300        //retrieve the data that we want to display
    12511301    str.str("");
    12521302    str << "PC Time: " << viewer->pcTime;
    1253     qstr = qstr.fromStdString(str.str());
     1303    QString qstr = qstr.fromStdString(str.str());
    12541304    emit updateCurrentPCTime(qstr);
    12551305
     
    20322082    connector.patchIDBox = myUi.patchIDBox;
    20332083
     2084    connector.eventNumberBox = myUi.displayingEventBox;
     2085
    20342086    connector.range0 = myUi.colorRange0;
    20352087    connector.range1 = myUi.colorRange1;
     
    21572209                     &connector, SLOT(currentEventHasChanged(int)));
    21582210
    2159     QObject::connect(&connector, SIGNAL(updateCurrentSliceDisplay(QString)),
    2160                      myUi.displayingSliceLabel, SLOT(setText(const QString)));
    2161     QObject::connect(&connector, SIGNAL(updateCurrentEventDisplay(QString)),
    2162                      myUi.displayingEventLabel, SLOT(setText(const QString)));
     2211    QObject::connect(&connector, SIGNAL(updateCurrentSliceDisplay(int)),
     2212                     myUi.displayingSliceBox, SLOT(setValue(int)));
     2213
     2214    QObject::connect(myUi.displayingSliceBox, SIGNAL(valueChanged(int)),
     2215                    &connector, SLOT(sliceChangedFromSpinner(int)));
     2216    QObject::connect(myUi.displayingEventBox, SIGNAL(valueChanged(int)),
     2217                    &connector, SLOT(eventChangedFromSpinner(int)));
     2218
     2219//    QObject::connect(&connector, SIGNAL(updateCurrentEventDisplay(QString)),
     2220//                     myUi.displayingEventLabel, SLOT(setText(const QString)));
     2221    QObject::connect(&connector, SIGNAL(updateCurrentEventDisplay(int)),
     2222                     myUi.displayingEventBox, SLOT(setValue(int)));
     2223
    21632224    QObject::connect(&connector, SIGNAL(updateCurrentPCTime(QString)),
    21642225                     myUi.PCTimeLabel, SLOT(setText(const QString)));
Note: See TracChangeset for help on using the changeset viewer.