source: GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/LogReader.cpp @ 2578

Revision 2578, 1.4 KB checked in by mattausch, 17 years ago (diff)
Line 
1#include "LogReader.h"
2#include "ViewCellsManager.h"
3
4
5namespace GtpVisibilityPreprocessor {
6
7
8void LogReader::SetFilename(const std::string &filename)
9{
10        mFilename = filename;
11}
12
13
14void LogReader::Read(ViewCellHistoryContainer &history)
15{
16        /*std::vector<int>::const_iterator it, it_end = numSamples.end();
17
18        for (it = numSamples.begin(); it != it_end; ++ it)
19        {
20                int numSamples = *it;
21
22                Read(numSamples, infos);
23                }*/
24
25        int numViewCells, numSamples;
26   
27        // open file
28        std::ifstream src(mFilename.c_str());
29
30        if (src.is_open())
31        {
32                src >> numViewCells;
33                src >> numSamples;
34
35                while (!src.eof())
36                {
37                        ViewCellInfoContainer *infos = new ViewCellInfoContainer();
38
39                        for (size_t i = 0; i << numViewCells; ++ i)
40                        {
41                                ViewCellInfo info;
42                                src >> info.mPiercingRays;     
43                                infos->push_back(info);
44                        }
45
46                        history[numSamples] = infos;
47                }
48
49                src.close();
50        }
51}
52
53
54/*void LogReader::Read(const int numSamples, ViewCellInfoContainer &infos)
55{
56         char filename[64];
57         sprintf(filename, "%s %06d", mFilename.c_str(), numSamples);
58       
59         // open file
60         std::ifstream src(filename);
61
62         if (src.is_open())
63         {
64                 while (!src.eof())
65                 {
66                         ViewCellInfo info;
67
68                         src >> info.mPiercingRays;     
69
70                         infos.push_back(info);
71                 }
72
73                 // HACK pop last frame, was doubled while reading
74                 //framelist.pop_back();
75
76                 src.close();
77         }
78}*/
79
80}
Note: See TracBrowser for help on using the repository browser.