Changeset 12012 for trunk


Ignore:
Timestamp:
09/07/11 16:58:52 (13 years ago)
Author:
lyard
Message:
Now take the config files from methods instead of files
Location:
trunk/FACT++/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/gui/BasicGlCamera.cc

    r11985 r12012  
    66#include <sstream>
    77#include "src/tools.h"
     8
     9const PixelMapEntry PixelMap::empty = { 0, 0, 0, 0, 0, 0 };
     10
     11//static variables
     12PixelMap BasicGlCamera::fPixelMap;
     13GLfloat BasicGlCamera::pixelsCoords[MAX_NUM_PIXELS][3];
     14PixelsNeighbors BasicGlCamera::neighbors[MAX_NUM_PIXELS];
     15int BasicGlCamera::hardwareMapping[NPIX];
     16GLfloat BasicGlCamera::verticesList[NPIX*6][2];
     17vector<edge> BasicGlCamera::patchesIndices[160];
     18int BasicGlCamera::verticesIndices[NPIX][6];
     19int BasicGlCamera::pixelsPatch[NPIX];
     20int BasicGlCamera::softwareMapping[NPIX];
     21int BasicGlCamera::patches[160][9];
    822
    923//Coordinates of an hexagon of radius 1 and center 0
     
    5165        calculatePixelsCoords();
    5266
    53         ifstream fin2("MasterList-v3.txt");
     67/*        ifstream fin2("MasterList-v3.txt");
    5468        if (!fin2.is_open())
    5569        {
     
    8094
    8195            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        }*/
    9097        buildVerticesList();
     98/*
    9199       ifstream fin1("Trigger-Patches.txt");
    92100       if (!fin1.is_open())
     
    125133
    126134        buildPatchesIndices();
    127 
     135*/////////////////////////////////
    128136        ss[0] = 0;    ss[1] = 0.25f; ss[2] = 0.5f; ss[3] = 0.75f; ss[4] = 1.0f;
    129137        rr[0] = 0.15; rr[1] = 0;     rr[2] = 0;    rr[3] = 1.0f;  rr[4] = 0.85f;
     
    136144        for (int i=0;i<NPIX;i++)
    137145            fData[i] = (double)i;///1.44;//(double)(i)/(double)(ACTUAL_NUM_PIXELS);
    138 
    139146
    140147        setFont(QFont("Arial", 8));
     
    257264        connect(this, SIGNAL(signalUpdateCamera()),
    258265                this, SLOT(timedUpdate()));
    259 
    260 
    261266    }
    262267    BasicGlCamera::~BasicGlCamera()
    263268    {
     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();
    264306    }
    265307    void BasicGlCamera::setPatchColor(int id, float color[3])
     
    870912    void BasicGlCamera::calculatePixelsCoords()
    871913    {
     914        if (pixelsCoords[0][1] >= 0.299999 && pixelsCoords[0][1] <= 0.300001)
     915            return;
    872916        pixelsCoords[0][0] = 0;
    873917        pixelsCoords[0][1] = 0.3;
     
    884928        for (int i=2;i<MAX_NUM_PIXELS;i++)
    885929        {
    886  //           cout << "i " << i << endl;
    887930            toSide = fromSide-1;
    888931            if (toSide < 0)
  • trunk/FACT++/gui/BasicGlCamera.h

    r11985 r12012  
    1818
    1919#include <set>
     20
     21#include "src/PixelMap.h"
    2022
    2123using namespace std;
     
    5557    int64_t fMax;
    5658
     59    static PixelMap fPixelMap;
     60
    5761    bool pixelColorUpToDate;
    5862
     
    7680    void SetAutoRefresh(bool on);
    7781    void updateCamera();
     82    void assignPixelMap(PixelMap& );
     83    void assignTriggerPatchesMap(vector<int>& );
    7884
    7985    float ss[5];// = {0.00, 0.25, 0.5, 0.75, 1.00};
     
    122128
    123129 //   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];
    127133    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];
    134140    float shownSizex;
    135141    float shownSizey;
Note: See TracChangeset for help on using the changeset viewer.