- Timestamp:
- 08/11/11 10:36:17 (13 years ago)
- Location:
- trunk/FACT++/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/FactGui.h
r11866 r11878 3132 3132 3133 3133 // Loop over the software idx of all pixels 3134 for (unsigned int i=0; i<1440; i++)3135 if (fPatchHW[i]==ihw)3136 cam.SetBold(i);3134 // for (unsigned int i=0; i<1440; i++) 3135 // if (fPatchHW[i]==ihw) 3136 // cam.SetBold(i); 3137 3137 } 3138 3138 -
trunk/FACT++/gui/QCameraWidget.cc
r11877 r11878 19 19 logScale = false; 20 20 cameraRotation = 0; 21 22 pixelContourColour[0] = 0.1f; 23 pixelContourColour[1] = 0.1f; 24 pixelContourColour[2] = 0.1f; 25 patchesCoulour[0] = 0.15f; 26 patchesCoulour[1] = 0.15f; 27 patchesCoulour[2] = 0.15f; 28 highlightedPatchesCoulour[0] = 0.6f; 29 highlightedPatchesCoulour[1] = 0.6f; 30 highlightedPatchesCoulour[2] = 0.6f; 31 highlightedPixelsCoulour[0] = 0.8f; 32 highlightedPixelsCoulour[1] = 0.8f; 33 highlightedPixelsCoulour[2] = 0.8f; 34 35 tooHighValueCoulour[0] = 1.f; 36 tooHighValueCoulour[1] = 1.f; 37 tooHighValueCoulour[2] = 0.f; 38 tooLowValueCoulour[0] = 0.f; 39 tooLowValueCoulour[1] = 1.f; 40 tooLowValueCoulour[2] = 1.f; 41 21 42 CalculatePixelsColor(); 22 43 … … 160 181 glScalef(1.5, 1.5, 1.5); 161 182 drawCamera(true); 183 184 glLineWidth(1.0f); 185 glColor3fv(highlightedPixelsCoulour); 186 for (vector<int>::iterator it = highlightedPixels.begin(); it!= highlightedPixels.end(); it++) 187 { 188 drawHexagon(*it, false); 189 } 162 190 drawPatches(); 163 191 164 192 glLineWidth(1.0f); 165 glColor3f(1,1,1); 166 drawHexagon(fWhite, false); 167 193 194 //glColor3f(1.f - pixelsColor[fWhite][0],1.f - pixelsColor[fWhite][1],1.f - pixelsColor[fWhite][2]); 195 if (fWhite != -1) 196 { 197 glColor3f(1.f, 0.f, 0.f); 198 drawHexagon(fWhite, false); 199 } 168 200 DrawCameraText(); 169 201 … … 186 218 if (!alsoWire) 187 219 return; 188 glColor3f (0.0f,0.0f,0.0f);220 glColor3fv(pixelContourColour);//0.0f,0.0f,0.0f); 189 221 for (int i=0;i<ACTUAL_NUM_PIXELS;i++) 190 222 { … … 195 227 { 196 228 glLineWidth(2.0f); 197 glColor3f(patchColour[0],patchColour[1],patchColour[2]);//0.5f, 0.5f, 0.3f); 198 glBegin(GL_LINES); 199 // for (int i=0;i<NTMARK;i++) 200 // { 201 for (unsigned int j=0;j<patchesIndices[fWhitePatch].size();j++) 202 { 203 glVertex2fv(verticesList[patchesIndices[fWhitePatch][j].first]); 204 glVertex2fv(verticesList[patchesIndices[fWhitePatch][j].second]); 205 } 206 // } 207 glEnd(); 229 glColor3fv(patchesCoulour); 230 glBegin(GL_LINES); 231 for (int i=0;i<NTMARK;i++) 232 { 233 for (unsigned int j=0;j<patchesIndices[i].size();j++) 234 { 235 glVertex2fv(verticesList[patchesIndices[i][j].first]); 236 glVertex2fv(verticesList[patchesIndices[i][j].second]); 237 } 238 } 239 glEnd(); 240 241 glColor3fv(highlightedPatchesCoulour); 242 glBegin(GL_LINES); 243 for (vector<int>::iterator it=highlightedPatches.begin(); it!= highlightedPatches.end(); it++) 244 { 245 for (unsigned int j=0;j<patchesIndices[*it].size();j++) 246 { 247 glVertex2fv(verticesList[patchesIndices[*it][j].first]); 248 glVertex2fv(verticesList[patchesIndices[*it][j].second]); 249 } 250 } 251 glEnd(); 252 if (fWhitePatch != -1) 253 { 254 glColor3f(1.f, 0.5f, 0.f);//patchColour);//[0],patchColour[1],patchColour[2]);//0.5f, 0.5f, 0.3f); 255 glBegin(GL_LINES); 256 for (unsigned int j=0;j<patchesIndices[fWhitePatch].size();j++) 257 { 258 glVertex2fv(verticesList[patchesIndices[fWhitePatch][j].first]); 259 glVertex2fv(verticesList[patchesIndices[fWhitePatch][j].second]); 260 } 261 glEnd(); 262 } 263 208 264 } 209 265 void QCameraWidget::Reset() … … 276 332 fWhite = face; 277 333 fWhitePatch = pixelsPatch[fWhite]; 278 CalculatePatchColor();334 // CalculatePatchColor(); 279 335 emit signalCurrentPixel(face); 280 updateGL();281 336 } 282 } 337 else 338 { 339 fWhite = -1; 340 fWhitePatch = -1; 341 } 342 updateGL(); 343 } 283 344 void QCameraWidget::mouseMoveEvent(QMouseEvent* cEvent) 284 345 { … … 293 354 int face = PixelAtPosition(cEvent->pos()); 294 355 if (face != -1) { 356 // cout << "Event !" << endl; 295 357 fWhite = face; 296 fWhitePatch = pixelsPatch[fWhite]; 297 CalculatePatchColor(); 358 fWhitePatch = pixelsPatch[fWhite]; 359 highlightPixel(face); 360 highlightPatch(fWhitePatch); 361 // CalculatePatchColor(); 298 362 emit signalPixelDoubleClick(face); 299 updateGL(); 300 } 363 } 364 else 365 { 366 fWhite = -1; 367 fWhitePatch = -1; 368 clearHighlightedPixels(); 369 clearHighlightedPatches(); 370 } 371 updateGL(); 372 301 373 } 302 void QCameraWidget::SetBold(int idx) 303 { 304 //cout << "Boldness not taken into account yet" << endl; 305 } 374 306 375 void QCameraWidget::SetWhite(int idx) 307 376 { 308 377 fWhite = idx; 309 378 fWhitePatch = pixelsPatch[fWhite]; 310 CalculatePatchColor(); 379 if (isVisible()) 380 updateGL(); 381 // CalculatePatchColor(); 311 382 } 312 383 void QCameraWidget::SetEnable(int idx, bool b) … … 314 385 fEnable[idx] = b; 315 386 } 316 void QCameraWidget::Toggle(int idx) 317 { 318 } 387 319 388 double QCameraWidget::GetData(int idx) 320 389 { … … 373 442 for (int i=0;i<ACTUAL_NUM_PIXELS;i++) 374 443 { 375 if (fData[i] < dmin) 444 if (!fEnable[i]) 445 { 446 // cout << "not enabled !" << i << endl; 447 pixelsColor[i][0] = 0.1f; 448 pixelsColor[i][1] = 0.1f; 449 pixelsColor[i][2] = 0.15f; 450 continue; 451 } 452 if (fData[i] < dmin) 376 453 { 377 pixelsColor[i][0] = pixelsColor[i][1] = pixelsColor[i][2] = 0; 454 pixelsColor[i][0] = tooLowValueCoulour[0]; 455 pixelsColor[i][1] = tooLowValueCoulour[1]; 456 pixelsColor[i][2] = tooLowValueCoulour[2]; 378 457 continue; 379 458 } 380 459 if (fData[i] > dmax) 381 460 { 382 pixelsColor[i][0] = pixelsColor[i][1] = pixelsColor[i][2] = 1; 461 pixelsColor[i][0] = tooHighValueCoulour[0]; 462 pixelsColor[i][1] = tooHighValueCoulour[1]; 463 pixelsColor[i][2] = tooHighValueCoulour[2]; 383 464 continue; 384 465 } … … 390 471 color = log10(color); 391 472 } 392 if (!fEnable[i]) 393 color = 0; 473 394 474 int index = 0; 395 475 while (ss[index] < color && index < 4) … … 411 491 void QCameraWidget::CalculatePatchColor() 412 492 { 493 return; 413 494 //calculate the patch contour color. let's use the anti-colour of the pixels 414 495 GLfloat averagePatchColour[3] = {0.0f,0.0f,0.0f}; … … 521 602 glVertex2f(twoX, fiveY); 522 603 glVertex2f(oneX, fiveY); 604 float zeroX = oneX - shownSizex/50.f; 605 float zeroY = fiveY - shownSizey/50.f; 606 glColor3fv(tooHighValueCoulour); 607 glVertex2f(zeroX, fiveY); 608 glVertex2f(oneX, fiveY); 609 glVertex2f(oneX, zeroY); 610 glVertex2f(zeroX, zeroY); 611 glColor3fv(tooLowValueCoulour); 612 glVertex2f(zeroX, -fiveY); 613 glVertex2f(oneX, -fiveY); 614 glVertex2f(oneX, -zeroY); 615 glVertex2f(zeroX, -zeroY); 523 616 glEnd(); 524 617 //draw linear/log tick marks … … 543 636 { 544 637 unitsText = units; 638 pixelColorUpToDate = false; 639 if (isVisible()) 640 updateGL(); 545 641 } 546 642 void QCameraWidget::setTitle(const string& title) 547 643 { 548 644 titleText = title; 645 pixelColorUpToDate = false; 646 if (isVisible()) 647 updateGL(); 549 648 } 550 649 void QCameraWidget::linearScalePlease(bool checked) … … 571 670 gg[0] = 0.15; gg[1] = 0; gg[2] = 1; gg[3] = 0; gg[4] = 0.85f; 572 671 bb[0] = 0.15; bb[1] = 1; bb[2] = 0; bb[3] = 0; bb[4] = 0.85f; 672 tooHighValueCoulour[0] = 1.f; 673 tooHighValueCoulour[1] = 1.f; 674 tooHighValueCoulour[2] = 0.f; 675 tooLowValueCoulour[0] = 0.f; 676 tooLowValueCoulour[1] = 1.f; 677 tooLowValueCoulour[2] = 1.f; 573 678 pixelColorUpToDate = false; 574 679 if (isVisible()) … … 582 687 gg[0] = 0.f; gg[1] = 0.10f; gg[2] = 0.20f; gg[3] = 0.73f; gg[4] = 1.f; 583 688 bb[0] = 0.f; bb[1] = 0.03f; bb[2] = 0.06f; bb[3] = 0.00f; bb[4] = 1.f; 689 tooHighValueCoulour[0] = 0.f; 690 tooHighValueCoulour[1] = 1.f; 691 tooHighValueCoulour[2] = 0.f; 692 tooLowValueCoulour[0] = 0.f; 693 tooLowValueCoulour[1] = 0.f; 694 tooLowValueCoulour[2] = 1.f; 584 695 pixelColorUpToDate = false; 585 696 if (isVisible()) … … 593 704 gg[0] = 0; gg[1] = 0.25f; gg[2] = 0.5f; gg[3] = 0.75f; gg[4] = 1.0f; 594 705 bb[0] = 0; bb[1] = 0.25f; bb[2] = 0.5f; bb[3] = 0.75f; bb[4] = 1.0f; 706 tooHighValueCoulour[0] = 0.f; 707 tooHighValueCoulour[1] = 1.f; 708 tooHighValueCoulour[2] = 0.f; 709 tooLowValueCoulour[0] = 0.f; 710 tooLowValueCoulour[1] = 0.f; 711 tooLowValueCoulour[2] = 1.f; 595 712 pixelColorUpToDate = false; 596 713 if (isVisible()) … … 604 721 gg[0] = 0.15; gg[1] = 0.5; gg[2] = 1.f; gg[3] = 0.5f; gg[4] = 0.5f; 605 722 bb[0] = 0.15; bb[1] = 0.5; bb[2] = 1; bb[3] = 1.f; bb[4] = 0.f; 723 tooHighValueCoulour[0] = 1.f; 724 tooHighValueCoulour[1] = 0.f; 725 tooHighValueCoulour[2] = 0.f; 726 tooLowValueCoulour[0] = 0.f; 727 tooLowValueCoulour[1] = 1.f; 728 tooLowValueCoulour[2] = 0.f; 606 729 pixelColorUpToDate = false; 607 730 if (isVisible()) … … 632 755 updateGL(); 633 756 } 757 void QCameraWidget::highlightPixel(int idx) 758 { 759 if (idx < 0 || idx > ACTUAL_NUM_PIXELS) 760 { 761 cout << "Error: requested pixel highlight out of bounds" << endl; 762 return; 763 } 764 highlightedPixels.push_back(idx); 765 if (isVisible()) 766 updateGL(); 767 } 768 void QCameraWidget::highlightPatch(int idx) 769 { 770 if (idx < 0 || idx > NTMARK) 771 { 772 cout << "Error: requested patch highlight out of bounds" << endl; 773 return; 774 } 775 highlightedPatches.push_back(idx); 776 if (isVisible()) 777 updateGL(); 778 779 } 780 void QCameraWidget::clearHighlightedPatches() 781 { 782 highlightedPatches.clear(); 783 if (isVisible()) 784 updateGL(); 785 } 786 void QCameraWidget::clearHighlightedPixels() 787 { 788 highlightedPixels.clear(); 789 if (isVisible()) 790 updateGL(); 791 } 792 793 794 795 -
trunk/FACT++/gui/QCameraWidget.h
r11876 r11878 24 24 vector<bool> fEnable; 25 25 26 vector<int> highlightedPatches; 27 vector<int> highlightedPixels; 28 26 29 int fWhite; 27 30 int fWhitePatch; … … 35 38 36 39 GLfloat patchColour[3]; 40 GLfloat pixelContourColour[3]; 41 GLfloat patchesCoulour[3]; 42 GLfloat highlightedPatchesCoulour[3]; 43 GLfloat highlightedPixelsCoulour[3]; 44 GLfloat tooHighValueCoulour[3]; 45 GLfloat tooLowValueCoulour[3]; 37 46 38 47 string dataText; … … 41 50 42 51 public: 52 void highlightPixel(int idx); 53 void highlightPatch(int idx); 54 void clearHighlightedPatches(); 55 void clearHighlightedPixels(); 43 56 void setUnits(const string& units); 44 57 void setTitle(const string& title); … … 51 64 void drawCamera(bool alsoWire); 52 65 void drawPatches(); 53 void SetBold(int idx);54 66 void SetWhite(int idx); 55 67 void SetEnable(int idx, bool b); 56 void Toggle(int idx);57 68 double GetData(int idx); 58 69 void SetMin(int64_t min);
Note:
See TracChangeset
for help on using the changeset viewer.