Changeset 11865 for trunk/FACT++/gui/QCameraWidget.cc
- Timestamp:
- 08/09/11 17:23:41 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/QCameraWidget.cc
r11861 r11865 6 6 { 7 7 fWhite = 0; 8 fWhitePatch = pixelsPatch[0]; 8 9 fBold.resize(1440); 9 10 fEnable.resize(1440); … … 29 30 glColor3f(1,1,1); 30 31 drawHexagon(fWhite, false); 32 33 DrawCameraText(); 31 34 } 32 35 void QCameraWidget::drawCamera(bool alsoWire) … … 49 52 } 50 53 } 54 void QCameraWidget::drawPatches() 55 { 56 glLineWidth(2.0f); 57 glColor3f(patchColour[0],patchColour[1],patchColour[2]);//0.5f, 0.5f, 0.3f); 58 glBegin(GL_LINES); 59 // for (int i=0;i<NTMARK;i++) 60 // { 61 for (unsigned int j=0;j<patchesIndices[fWhitePatch].size();j++) 62 { 63 glVertex2fv(verticesList[patchesIndices[fWhitePatch][j].first]); 64 glVertex2fv(verticesList[patchesIndices[fWhitePatch][j].second]); 65 } 66 // } 67 glEnd(); 68 } 51 69 void QCameraWidget::Reset() 52 70 { … … 58 76 if (face != -1) { 59 77 fWhite = face; 78 fWhitePatch = pixelsPatch[fWhite]; 79 CalculatePatchColor(); 60 80 emit signalCurrentPixel(face); 61 81 updateGL(); … … 75 95 if (face != -1) { 76 96 fWhite = face; 97 fWhitePatch = pixelsPatch[fWhite]; 98 CalculatePatchColor(); 77 99 emit signalPixelDoubleClick(face); 78 100 updateGL(); … … 86 108 { 87 109 fWhite = idx; 110 fWhitePatch = pixelsPatch[fWhite]; 111 CalculatePatchColor(); 88 112 } 89 113 void QCameraWidget::SetEnable(int idx, bool b) … … 163 187 index--; 164 188 if (index < 0) index = 0; 165 // if (index > 3) index = 3;166 189 float weight0 = (color-ss[index]) / (ss[index+1]-ss[index]); 167 190 if (weight0 > 1.0f) weight0 = 1.0f; … … 172 195 pixelsColor[i][2] = weight1*bb[index] + weight0*bb[index+1]; 173 196 } 197 CalculatePatchColor(); 174 198 pixelColorUpToDate = true; 199 } 200 void QCameraWidget::CalculatePatchColor() 201 { 202 //calculate the patch contour color. let's use the anti-colour of the pixels 203 GLfloat averagePatchColour[3] = {0.0f,0.0f,0.0f}; 204 for (int i=0;i<9;i++) 205 for (int j=0;j<3;j++) 206 averagePatchColour[j] += pixelsColor[softwareMapping[patches[fWhitePatch][i]]][j]; 207 for (int j=0;j<3;j++) 208 averagePatchColour[j] /= 9; 209 for (int j=0;j<3;j++) 210 patchColour[j] = 1.0f - averagePatchColour[j]; 175 211 } 176 212 void QCameraWidget::SetData(const valarray<double> &ddata) … … 183 219 updateGL(); 184 220 } 221 void QCameraWidget::DrawCameraText() 222 { 223 glPushMatrix(); 224 glLoadIdentity(); 225 cout << width() << " " << height() << endl; 226 int textSize = (int)(height()*14/600); 227 setFont(QFont("Times", textSize)); 228 qglColor(QColor(255,223,127)); 229 float shiftx = 0.01f;//0.55f; 230 float shifty = 0.01f;//0.65f; 231 renderText(-shownSizex/2.f + shiftx, -shownSizey/2.f + shifty, 0.f, QString("This is a first text that is scaled according to the drawing size")); 232 glPopMatrix(); 233 }
Note:
See TracChangeset
for help on using the changeset viewer.