Changeset 11907 for trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
- Timestamp:
- 08/16/11 11:53:58 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/RawEventsViewer/RawEventsViewer.cc
r11902 r11907 5 5 * Author: lyard 6 6 */ 7 7 8 8 9 #include "RawEventsViewer.h" … … 603 604 delete inputFile; 604 605 } 606 try { 605 607 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 } 606 614 if (!*inputFile) 607 615 { … … 635 643 for (vector<string>::const_iterator it=entriesToCheck.begin(); it != entriesToCheck.end(); it++) 636 644 { 645 try { 637 646 if (!inputFile->HasKey(*it)){ 638 647 cout << *it << " missing. Aborting load..." << endl; 639 648 return;} 649 } 650 catch (std::runtime_error e) 651 { 652 cout << e.what() << endl; 653 return; 654 } 640 655 } 641 656 nRows = inputFile->GetInt("NAXIS2"); … … 779 794 return; 780 795 inputFile->GetRow(rowNum); 796 // cout << "Getting row " << rowNum << endl; 781 797 for (int i=0;i<(1440+160)*nRoi;i++) 782 798 eventData[i] = (float)rawEventData[i]; … … 841 857 UIConnector::UIConnector(QWidget*) 842 858 { 859 updateSpinnerDisplay = true; 860 843 861 timer.setInterval(10.0); 844 862 QObject::connect(&timer, SIGNAL(timeout()), … … 1169 1187 { 1170 1188 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"; 1173 1193 // fileLoadedLabel->setText(QString(str.str().c_str())); 1174 1194 // str.str(""); … … 1177 1197 // str.str(""); 1178 1198 str << "Number of Events: " << viewer->nRows << "\n"; 1199 1200 eventNumberBox->setMaximum(viewer->nRows-1); 1201 1179 1202 str << "Number of Slices: " << viewer->nRoi << "\n";// << "/1024"; 1180 1203 // numberOfSlicesLabel->setText(QString(str.str().c_str())); … … 1226 1249 { 1227 1250 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); 1231 1255 1232 1256 str.str(""); 1233 1257 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()); 1235 1259 emit updateCurrentPixelSliceValue(qstr); 1236 1260 … … 1241 1265 double xval[4096]; 1242 1266 double yval[4096]; 1243 1267 void 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 } 1280 void UIConnector::sliceChangedFromSpinner(int cSlice) 1281 { 1282 updateSpinnerDisplay = false; 1283 currentSliceHasChanged(cSlice); 1284 updateSpinnerDisplay = true; 1285 viewer->whichSlice = cSlice; 1286 viewer->updateGL(); 1287 } 1244 1288 void UIConnector::currentEventHasChanged(int cEvent) 1245 1289 { 1246 1290 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 1251 1301 str.str(""); 1252 1302 str << "PC Time: " << viewer->pcTime; 1253 qstr = qstr.fromStdString(str.str());1303 QString qstr = qstr.fromStdString(str.str()); 1254 1304 emit updateCurrentPCTime(qstr); 1255 1305 … … 2032 2082 connector.patchIDBox = myUi.patchIDBox; 2033 2083 2084 connector.eventNumberBox = myUi.displayingEventBox; 2085 2034 2086 connector.range0 = myUi.colorRange0; 2035 2087 connector.range1 = myUi.colorRange1; … … 2157 2209 &connector, SLOT(currentEventHasChanged(int))); 2158 2210 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 2163 2224 QObject::connect(&connector, SIGNAL(updateCurrentPCTime(QString)), 2164 2225 myUi.PCTimeLabel, SLOT(setText(const QString)));
Note:
See TracChangeset
for help on using the changeset viewer.