Changeset 12071 for trunk/FACT++
- Timestamp:
- 09/12/11 14:05:21 (13 years ago)
- Location:
- trunk/FACT++
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/BasicGlCamera.cc
r12055 r12071 6 6 #include <sstream> 7 7 #include "src/tools.h" 8 9 #include <algorithm> 10 #include "src/Time.h" 8 11 9 12 using namespace std;; … … 40 43 fMin = -1; 41 44 fMax = -1; 45 fScaleLimit = -0.5; 46 fTextSize = 0; 42 47 autoRefresh = false; 43 48 logScale = false; … … 343 348 updateGL(); 344 349 } 350 void BasicGlCamera::setAutoscaleLowerLimit(float val) 351 { 352 fScaleLimit = val; 353 if (isVisible() && autoRefresh) 354 updateGL(); 355 } 356 345 357 void BasicGlCamera::SetMax(int64_t max) 346 358 { … … 368 380 double rms = 0; 369 381 median = 0; 370 multiset<double> medianSet; 382 // multiset<double> medianSet; 383 vector<double> medianVec; 384 medianVec.resize(ACTUAL_NUM_PIXELS); 385 auto it = medianVec.begin(); 371 386 for (int i=0;i<ACTUAL_NUM_PIXELS;i++) 372 387 { … … 377 392 mean += fData[i]; 378 393 rms += fData[i]*fData[i]; 379 medianSet.insert(fData[i]); 380 } 394 //medianSet.insert(fData[i]); 395 *it = fData[i]; 396 it++; 397 } 398 399 // vector<double> medianVec; 400 // medianVec.resize(ACTUAL_NUM_PIXELS); 401 // int iii=0; 402 // for (auto it=medianVec.begin(); it != medianVec.end(); it++) { 403 // *it = fData[iii]; 404 // iii++; 405 // } 406 sort(medianVec.begin(), medianVec.end()); 407 381 408 382 409 mean /= ACTUAL_NUM_PIXELS; 383 410 rms = sqrt(rms/ACTUAL_NUM_PIXELS - mean * mean); 384 411 385 multiset<double>::iterator it = medianSet.begin(); 412 // multiset<double>::iterator it = medianSet.begin(); 413 auto jt = medianVec.begin(); 386 414 for (int i=0;i<(ACTUAL_NUM_PIXELS/2)-1;i++) 387 it++; 388 median = *it; 389 it++; 390 median += *it; 415 { 416 // it++; 417 jt++; 418 } 419 median = *jt; 420 // cout << *it << " " << *jt << endl; 421 jt++; 422 median += *jt; 391 423 median /= 2; 392 424 … … 646 678 } 647 679 glMatrixMode(GL_MODELVIEW); 680 681 fTextSize = (int)(cWidth*12/600); //want a sized 12 font for a window of 600 pixels width 682 setFont(QFont("Monospace", fTextSize)); 648 683 } 649 684 void BasicGlCamera::paintGL() -
trunk/FACT++/gui/BasicGlCamera.h
r12055 r12071 55 55 int64_t fMin; 56 56 int64_t fMax; 57 float fScaleLimit; 58 void setAutoscaleLowerLimit(float); 59 60 int fTextSize; 57 61 58 62 static PixelMap fPixelMap; -
trunk/FACT++/gui/QCameraWidget.cc
r12054 r12071 88 88 89 89 90 int textSize = (int)(height()*14/600);91 setFont(QFont("Monospace", textSize));90 // int textSize = (int)(width()*14/600); 91 // setFont(QFont("Monospace", textSize)); 92 92 qglColor(QColor(255, 223, 127)); 93 93 94 94 //first let's draw the usual data 95 95 //title 96 renderText(-shownSizex/2.f + 0.01f, shownSizey/2.f - textSize*pixelSize - 0.01f, 0.f, QString(titleText.c_str()));96 renderText(-shownSizex/2.f + 0.01f, shownSizey/2.f - fTextSize*pixelSize - 0.01f, 0.f, QString(titleText.c_str())); 97 97 //stats 98 98 ostringstream str; … … 100 100 str.setf(ios::fixed,ios::floatfield); 101 101 str << "Med " << fmedian;// << unitsText; 102 renderText(3, height()-3-4* textSize-35, QString(str.str().c_str()));102 renderText(3, height()-3-4*fTextSize-35, QString(str.str().c_str())); 103 103 str.str(""); 104 104 str << "Avg " << fmean;// << unitsText; 105 renderText(3, height()-3-3* textSize-27, QString(str.str().c_str()));105 renderText(3, height()-3-3*fTextSize-27, QString(str.str().c_str())); 106 106 str.str(""); 107 107 str << "RMS " << frms;// << unitsText; 108 renderText(3, height()-3-2* textSize-21, QString(str.str().c_str()));108 renderText(3, height()-3-2*fTextSize-21, QString(str.str().c_str())); 109 109 str.str(""); 110 110 str << "Min " << fmin;// << unitsText; … … 112 112 str.str(""); 113 113 str << "Max " << fmax;// << unitsText; 114 renderText(3, height()-3-1* textSize-8, QString(str.str().c_str()));114 renderText(3, height()-3-1*fTextSize-8, QString(str.str().c_str())); 115 115 //then draw the values beside the scale 116 116 //the difficulty here is to write the correct min/max besides the scale … … 119 119 //real min/max are fmin and fmax (I know, quite confusing... sorry about that) 120 120 //so. first let's see what is the span of one pixel 121 float min = (fMin < 0) ? fmin : fMin;122 float max = (fM ax < 0) ? fmax : fMax;123 textSize = (int)(height()*12/600);124 setFont(QFont("Monospace", textSize));125 float pixelSpan = (height() - textSize - 1)/(max - min);121 float min = (fMin < fScaleLimit || fMax < fScaleLimit) ? fmin : fMin; 122 float max = (fMin < fScaleLimit || fMax < fScaleLimit) ? fmax : fMax; 123 // textSize = (int)(height()*12/600); 124 // setFont(QFont("Monospace", textSize)); 125 float pixelSpan = (height() - fTextSize - 1)/(max - min); 126 126 127 127 //draw the scale values 128 128 float value = min; 129 int fontWidth = textSize; 130 if (textSize > 12) fontWidth-=3; else fontWidth -=2; 131 if (textSize < 7) fontWidth++; 129 int fontWidth = fTextSize; 130 if (fTextSize > 12) fontWidth--; 131 if (fTextSize > 10) fontWidth--; 132 if (fTextSize > 7) fontWidth--;//else fontWidth -=1; 133 // if (fTextSize < 7) fontWidth++; 132 134 for (int i=0;i<11;i++) 133 135 { … … 149 151 int w = width() - (width()/50) - fontWidth*str.str().size(); 150 152 if (i==0 || i==10) w -= width()/50; 151 if (i!=0 && i!=10) h -= textSize/2;153 if (i!=0 && i!=10) h -= fTextSize/2; 152 154 renderText(w, h, QString(str.str().c_str())); 153 155 value += (max - min)/10; … … 171 173 glPopMatrix(); 172 174 173 textSize = (int)(600*14/600);174 setFont(QFont("Times", textSize));175 // textSize = (int)(600*14/600); 176 // setFont(QFont("Times", textSize)); 175 177 } 176 178 void QCameraWidget::drawPatches() … … 399 401 void QCameraWidget::highlightPixel(int idx, bool highlight) 400 402 { 401 if (idx < 0 || idx > ACTUAL_NUM_PIXELS)403 if (idx < 0 || idx >= ACTUAL_NUM_PIXELS) 402 404 { 403 405 cout << "Error: requested pixel highlight out of bounds" << endl; … … 422 424 void QCameraWidget::highlightPatch(int idx, bool highlight) 423 425 { 424 if (idx < 0 || idx > NTMARK)426 if (idx < 0 || idx >= NTMARK) 425 427 { 426 428 cout << "Error: requested patch highlight out of bounds" << endl; -
trunk/FACT++/src/Fits.h
r12035 r12071 56 56 public: 57 57 ///current run number being logged 58 uint32_t fRunNumber;58 int32_t fRunNumber; 59 59 60 60 Fits() : fFile(NULL), -
trunk/FACT++/src/datalogger.cc
r12034 r12071 95 95 string reportName; 96 96 ///the actual run number 97 uint32_t runNumber;97 int32_t runNumber; 98 98 ///the time at which the run number was received 99 99 Time time; … … 145 145 shared_ptr<Converter> fConv; 146 146 ///the current run number used by this subscription 147 uint32_t runNumber;147 int32_t runNumber; 148 148 ///time of the latest received event 149 149 Time lastReceivedEvent; … … 515 515 fServiceSubscriptions[server].clear(); 516 516 fServiceSubscriptions.erase(server); 517 fRunNumberService = NULL; 517 if (server == "FAD_CONTROL") 518 fRunNumberService = NULL; 518 519 if (fDebugIsOn) 519 520 { … … 1241 1242 if (rit->time < cTime) //this is the run number that we want to use 1242 1243 { 1244 if (rit->runNumber <= 0)//take only positive numbers. 1245 break; 1243 1246 //Find something better to convert iterator to pointer than the ugly line below.... 1244 1247 cRunNumber = &(*rit);
Note:
See TracChangeset
for help on using the changeset viewer.