- Timestamp:
- 09/07/11 16:58:52 (13 years ago)
- Location:
- trunk/FACT++/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/BasicGlCamera.cc
r11985 r12012 6 6 #include <sstream> 7 7 #include "src/tools.h" 8 9 const PixelMapEntry PixelMap::empty = { 0, 0, 0, 0, 0, 0 }; 10 11 //static variables 12 PixelMap BasicGlCamera::fPixelMap; 13 GLfloat BasicGlCamera::pixelsCoords[MAX_NUM_PIXELS][3]; 14 PixelsNeighbors BasicGlCamera::neighbors[MAX_NUM_PIXELS]; 15 int BasicGlCamera::hardwareMapping[NPIX]; 16 GLfloat BasicGlCamera::verticesList[NPIX*6][2]; 17 vector<edge> BasicGlCamera::patchesIndices[160]; 18 int BasicGlCamera::verticesIndices[NPIX][6]; 19 int BasicGlCamera::pixelsPatch[NPIX]; 20 int BasicGlCamera::softwareMapping[NPIX]; 21 int BasicGlCamera::patches[160][9]; 8 22 9 23 //Coordinates of an hexagon of radius 1 and center 0 … … 51 65 calculatePixelsCoords(); 52 66 53 ifstream fin2("MasterList-v3.txt");67 /* ifstream fin2("MasterList-v3.txt"); 54 68 if (!fin2.is_open()) 55 69 { … … 80 94 81 95 l++; 82 } 83 // GLfloat tempPixelsCoords[MAX_NUM_PIXELS][3]; 84 // for (int i=0;i<1440;i++) 85 // for (int j=0;j<3;j++) 86 // tempPixelsCoords[hardwareMapping[i]][j] = pixelsCoords[i][j]; 87 // for (int i=0;i<1440;i++) 88 // for (int j=0;j<3;j++) 89 // pixelsCoords[i][j] = tempPixelsCoords[i][j]; 96 }*/ 90 97 buildVerticesList(); 98 /* 91 99 ifstream fin1("Trigger-Patches.txt"); 92 100 if (!fin1.is_open()) … … 125 133 126 134 buildPatchesIndices(); 127 135 *///////////////////////////////// 128 136 ss[0] = 0; ss[1] = 0.25f; ss[2] = 0.5f; ss[3] = 0.75f; ss[4] = 1.0f; 129 137 rr[0] = 0.15; rr[1] = 0; rr[2] = 0; rr[3] = 1.0f; rr[4] = 0.85f; … … 136 144 for (int i=0;i<NPIX;i++) 137 145 fData[i] = (double)i;///1.44;//(double)(i)/(double)(ACTUAL_NUM_PIXELS); 138 139 146 140 147 setFont(QFont("Arial", 8)); … … 257 264 connect(this, SIGNAL(signalUpdateCamera()), 258 265 this, SLOT(timedUpdate())); 259 260 261 266 } 262 267 BasicGlCamera::~BasicGlCamera() 263 268 { 269 } 270 void BasicGlCamera::assignPixelMap(PixelMap& map) 271 { 272 fPixelMap = map; 273 for (auto i=fPixelMap.begin();i!=fPixelMap.end(); i++) 274 { 275 hardwareMapping[i->index] = i->hw(); 276 softwareMapping[i->hw()] = i->index; 277 } 278 } 279 void BasicGlCamera::assignTriggerPatchesMap(vector<int>& pa) 280 { 281 vector<vector<int> > intervec; 282 intervec.resize(160); 283 int i=0; 284 for (auto it=pa.begin(); it != pa.end(); it++) 285 { 286 intervec[*it].push_back(hardwareMapping[i]); 287 i++; 288 } 289 for (i=0;i<160;i++) 290 { 291 for (int j=0;j<9;j++) 292 { 293 patches[i][j] = intervec[i][j]; 294 } 295 } 296 297 //now construct the correspondance between pixels and patches 298 for (int i=0;i<NTMARK;i++) 299 for (int j=0;j<9;j++) 300 pixelsPatch[softwareMapping[patches[i][j]]] = i; 301 302 for (int i=0;i<1440;i++) 303 updateNeighbors(i); 304 305 buildPatchesIndices(); 264 306 } 265 307 void BasicGlCamera::setPatchColor(int id, float color[3]) … … 870 912 void BasicGlCamera::calculatePixelsCoords() 871 913 { 914 if (pixelsCoords[0][1] >= 0.299999 && pixelsCoords[0][1] <= 0.300001) 915 return; 872 916 pixelsCoords[0][0] = 0; 873 917 pixelsCoords[0][1] = 0.3; … … 884 928 for (int i=2;i<MAX_NUM_PIXELS;i++) 885 929 { 886 // cout << "i " << i << endl;887 930 toSide = fromSide-1; 888 931 if (toSide < 0) -
trunk/FACT++/gui/BasicGlCamera.h
r11985 r12012 18 18 19 19 #include <set> 20 21 #include "src/PixelMap.h" 20 22 21 23 using namespace std; … … 55 57 int64_t fMax; 56 58 59 static PixelMap fPixelMap; 60 57 61 bool pixelColorUpToDate; 58 62 … … 76 80 void SetAutoRefresh(bool on); 77 81 void updateCamera(); 82 void assignPixelMap(PixelMap& ); 83 void assignTriggerPatchesMap(vector<int>& ); 78 84 79 85 float ss[5];// = {0.00, 0.25, 0.5, 0.75, 1.00}; … … 122 128 123 129 // bool recalcColorPlease; 124 GLfloat pixelsCoords[MAX_NUM_PIXELS][3];125 PixelsNeighbors neighbors[MAX_NUM_PIXELS];126 int hardwareMapping[NPIX];130 static GLfloat pixelsCoords[MAX_NUM_PIXELS][3]; 131 static PixelsNeighbors neighbors[MAX_NUM_PIXELS]; 132 static int hardwareMapping[NPIX]; 127 133 GLfloat pixelsColor[NPIX][3]; 128 GLfloat verticesList[NPIX*6][2];129 vector<edge> patchesIndices[160];130 int verticesIndices[NPIX][6];131 int pixelsPatch[NPIX];132 int softwareMapping[NPIX];133 int patches[160][9];134 static GLfloat verticesList[NPIX*6][2]; 135 static vector<edge> patchesIndices[160]; 136 static int verticesIndices[NPIX][6]; 137 static int pixelsPatch[NPIX]; 138 static int softwareMapping[NPIX]; 139 static int patches[160][9]; 134 140 float shownSizex; 135 141 float shownSizey;
Note:
See TracChangeset
for help on using the changeset viewer.