Changeset 11985
- Timestamp:
- 09/06/11 17:13:56 (13 years ago)
- Location:
- trunk/FACT++/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/BasicGlCamera.cc
r11941 r11985 255 255 this, SLOT(minus90RotationPlease(bool))); 256 256 257 connect(this, SIGNAL(signalUpdateCamera()), 258 this, SLOT(timedUpdate())); 257 259 258 260 … … 345 347 median /= 2; 346 348 347 str << "Min: " << min << " Max: " << max << " Mean: " << mean << " RMS: " << rms << " Median: " << median;349 str << "Min: " << min << endl << " Max: " << max << " Mean: " << mean << " RMS: " << rms << " Median: " << median; 348 350 str << " Units: " << unitsText; 349 351 dataText = str.str(); 352 353 fmin = min; 354 fmax = max; 355 fmean = mean; 356 frms = rms; 357 fmedian = median; 350 358 } 351 359 void BasicGlCamera::DrawCameraText() … … 359 367 float shiftx = 0.01f;//0.55f; 360 368 float shifty = 0.01f;//0.65f; 361 renderText(-shownSizex/2.f + shiftx, -shownSizey/2.f + shifty, 0.f, QString(dataText.c_str()));369 renderText(-shownSizex/2.f + shiftx, 0.f, 0.f, QString(dataText.c_str()));//-shownSizey/2.f + shifty, 0.f, QString(dataText.c_str())); 362 370 363 371 … … 652 660 { 653 661 662 } 663 void BasicGlCamera::timedUpdate() 664 { 665 if (isVisible()) 666 updateGL(); 667 } 668 void BasicGlCamera::updateCamera() 669 { 670 emit signalUpdateCamera(); 654 671 } 655 672 void BasicGlCamera::drawCamera(bool alsoWire) -
trunk/FACT++/gui/BasicGlCamera.h
r11941 r11985 75 75 void SetMax(int64_t max); 76 76 void SetAutoRefresh(bool on); 77 void updateCamera(); 77 78 78 79 float ss[5];// = {0.00, 0.25, 0.5, 0.75, 1.00}; … … 91 92 void plus90RotationPlease(bool); 92 93 void minus90RotationPlease(bool); 94 void timedUpdate(); 93 95 94 96 Q_SIGNALS: … … 97 99 void signalPixelDoubleClick(int pixel); 98 100 void colorPaletteHasChanged(); 101 void signalUpdateCamera(); 99 102 100 103 … … 111 114 virtual void setPatchColor(int id, float color[3]); 112 115 virtual int PixelAtPosition(const QPoint &pos); 116 virtual void DrawCameraText(); 113 117 void drawHexagon(int index, bool solid); 114 118 … … 131 135 float shownSizey; 132 136 float pixelSize; 133 void DrawCameraText();134 137 virtual void UpdateText(); 135 138 void DrawScale(); … … 166 169 float hexTolerance; 167 170 int numVertices; 171 protected: 172 float fmin, fmax, fmean, frms, fmedian; 168 173 169 174 -
trunk/FACT++/gui/QCameraWidget.cc
r11944 r11985 21 21 22 22 glTranslatef(0,-0.44,0); 23 glTranslatef(-0.1,0,0); 23 24 glRotatef(cameraRotation, 0,0,-1); 24 25 if (cameraRotation == 90) … … 33 34 glScalef(1.5, 1.5, 1.5); 34 35 drawCamera(true); 36 37 drawPatches(); 35 38 36 39 glLineWidth(1.0f); … … 40 43 drawHexagon(*it, false); 41 44 } 42 drawPatches();43 45 44 46 glLineWidth(1.0f); … … 59 61 void QCameraWidget::drawCamera(bool alsoWire) 60 62 { 63 61 64 if (!pixelColorUpToDate) 62 65 CalculatePixelsColor(); … … 76 79 } 77 80 } 81 void QCameraWidget::DrawCameraText() 82 { 83 glPushMatrix(); 84 glLoadIdentity(); 85 86 87 88 int textSize = (int)(height()*14/600); 89 setFont(QFont("Monospace", textSize)); 90 qglColor(QColor(255, 223, 127)); 91 92 //first let's draw the usual data 93 //title 94 renderText(-shownSizex/2.f + 0.01f, shownSizey/2.f - textSize*pixelSize - 0.01f, 0.f, QString(titleText.c_str())); 95 //stats 96 ostringstream str; 97 str.precision(2); 98 str.setf(ios::fixed,ios::floatfield); 99 str << "Med. " << fmedian << unitsText; 100 renderText(1, height()-4*textSize-10, QString(str.str().c_str())); 101 str.str(""); 102 str << "Mea. " << fmean << unitsText; 103 renderText(1, height()-3*textSize-8, QString(str.str().c_str())); 104 str.str(""); 105 str << "Rms " << frms << unitsText; 106 renderText(1, height()-2*textSize-6, QString(str.str().c_str())); 107 str.str(""); 108 str << "Min. " << fmin << unitsText; 109 renderText(1, height()-1*textSize-4, QString(str.str().c_str())); 110 str.str(""); 111 str << "Max. " << fmax << unitsText; 112 renderText(1, height()-2, QString(str.str().c_str())); 113 //then draw the values beside the scale 114 //the difficulty here is to write the correct min/max besides the scale 115 //it depends whether the actual mean of the data is given by the user 116 //or not. the values given by user are fMin and fMax, while the data 117 //real min/max are fmin and fmax (I know, quite confusing... sorry about that) 118 //so. first let's see what is the span of one pixel 119 float min = (fMin < 0) ? fmin : fMin; 120 float max = (fMax < 0) ? fmax : fMax; 121 textSize = (int)(height()*12/600); 122 setFont(QFont("Monospace", textSize)); 123 float pixelSpan = (height() - textSize - 1)/(max - min); 124 125 //draw the scale values 126 float value = min; 127 int fontWidth = textSize; 128 if (textSize > 12) fontWidth-=3; else fontWidth -=2; 129 if (textSize < 7) fontWidth++; 130 for (int i=0;i<6;i++) 131 { 132 str.str(""); 133 str << value << unitsText; 134 int h = (value - min)*pixelSpan; 135 if (logScale && h != 0) 136 { 137 float fh = h; 138 float mult = (max - min)*pixelSpan; 139 fh = log10(h*10.f/mult); 140 fh *= mult; 141 h = (int)fh; 142 } 143 h = height()-h; 144 int w = width() - (width()/50) - fontWidth*str.str().size(); 145 if (i==0 || i==5) w -= width()/50; 146 if (i!=0 && i!=5) h -= textSize/2; 147 renderText(w, h, QString(str.str().c_str())); 148 value += (max - min)/5; 149 } 150 151 /* 152 str.str(""); 153 str << min << unitsText; 154 int fontWidth = textSize; 155 if (textSize > 12) fontWidth-=3; else fontWidth -= 2; 156 //height of min ? 157 int hmin = (min - min)*pixelSpan; 158 hmin = height() - hmin; 159 renderText(width() - (width()/25) - fontWidth*str.str().size(), hmin, QString(str.str().c_str())); 160 str.str(""); 161 str << max << unitsText; 162 int hmax = (max - min)*pixelSpan; 163 hmax = height() - hmax; 164 renderText(width() - (width()/25) - fontWidth*str.str().size(), hmax, QString(str.str().c_str())); 165 */ 166 glPopMatrix(); 167 168 textSize = (int)(600*14/600); 169 setFont(QFont("Times", textSize)); 170 } 78 171 void QCameraWidget::drawPatches() 79 172 { 80 glLineWidth( 2.0f);173 glLineWidth(3.0f); 81 174 glColor3fv(patchesCoulour); 82 175 glBegin(GL_LINES); -
trunk/FACT++/gui/QCameraWidget.h
r11941 r11985 41 41 void Reset(); 42 42 void drawCamera(bool alsoWire); 43 void DrawCameraText(); 43 44 void drawPatches(); 44 45 void SetEnable(int idx, bool b);
Note:
See TracChangeset
for help on using the changeset viewer.