Changeset 11865
- Timestamp:
- 08/09/11 17:23:41 (13 years ago)
- Location:
- trunk/FACT++/gui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/BasicGlCamera.cc
r11861 r11865 89 89 l++; 90 90 } 91 92 //now construct the correspondance between pixels and patches 93 for (int i=0;i<NTMARK;i++) 94 for (int j=0;j<9;j++) 95 pixelsPatch[softwareMapping[patches[i][j]]] = i; 91 96 92 97 for (int i=0;i<1440;i++) … … 209 214 void BasicGlCamera::drawPatches() 210 215 { 211 // cout << "*************************DRAWING PATCHES**************************" << endl;212 // for (int i=0;i<NTMARK;i++)213 // {214 // cout << ".....................patch " << i << endl;215 // for (unsigned int j=0;patchesIndices[i].size();j++)216 // {217 // cout << patchesIndices[i][j].first << " and " << patchesIndices[i][j].second << endl;218 // }219 // }220 216 glLineWidth(2.0f); 221 217 float backupRadius = hexRadius; … … 491 487 for (int j=0;j<9;j++)//for all cells of the current patch 492 488 { 489 if (softwareMapping[patches[i][j]] >= ACTUAL_NUM_PIXELS) 490 continue; 493 491 for (int k=0;k<6;k++)//for all sides of the current cell 494 492 { -
trunk/FACT++/gui/BasicGlCamera.h
r11861 r11865 51 51 virtual void mouseDoubleClickEvent(QMouseEvent *event); 52 52 virtual void drawCamera(bool alsoWire); 53 v oid drawPatches();53 virtual void drawPatches(); 54 54 int PixelAtPosition(const QPoint &pos); 55 55 void drawHexagon(int index, bool solid); … … 68 68 vector<edge> patchesIndices[160]; 69 69 int verticesIndices[NPIX][6]; 70 int pixelsPatch[NPIX]; 71 int softwareMapping[NPIX]; 72 int patches[160][9]; 73 float shownSizex; 74 float shownSizey; 70 75 private: 71 76 void updateNeighbors(int currentPixel); … … 78 83 float viewSize; 79 84 float pixelSize; 80 float shownSizex;81 float shownSizey;82 85 GLfloat pixelsCoords[MAX_NUM_PIXELS][3]; 83 86 PixelsNeighbors neighbors[MAX_NUM_PIXELS]; … … 85 88 86 89 int hardwareMapping[NPIX]; 87 int softwareMapping[NPIX];88 int patches[160][9];89 90 int numVertices; 90 91 -
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 } -
trunk/FACT++/gui/QCameraWidget.h
r11828 r11865 20 20 21 21 int fWhite; 22 int fWhitePatch; 22 23 23 24 int64_t fMin; … … 27 28 28 29 bool pixelColorUpToDate; 30 31 GLfloat patchColour[3]; 29 32 30 33 public: … … 36 39 void Reset(); 37 40 void drawCamera(bool alsoWire); 41 void drawPatches(); 38 42 void SetBold(int idx); 39 43 void SetWhite(int idx); … … 57 61 private: 58 62 void CalculatePixelsColor(); 63 void CalculatePatchColor(); 64 void DrawCameraText(); 59 65 }; 60 66
Note:
See TracChangeset
for help on using the changeset viewer.