Applied initial patches for wx2.8 compatibility
[ctsim.git] / src / threadraster.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **   Name:          threadraster.h
5 **   Purpose:       Header file for threaded rasterizations
6 **   Programmer:    Kevin Rosenberg
7 **   Date Started:  February 2001
8 **
9 **  This is part of the CTSim program
10 **  Copyright (C) 1983-2001 Kevin Rosenberg
11 **
12 **  $Id$
13 **
14 **  This program is free software; you can redistribute it and/or modify
15 **  it under the terms of the GNU General Public License (version 2) as
16 **  published by the Free Software Foundation.
17 **
18 **  This program is distributed in the hope that it will be useful,
19 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 **  GNU General Public License for more details.
22 **
23 **  You should have received a copy of the GNU General Public License
24 **  along with this program; if not, write to the Free Software
25 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26 ******************************************************************************/
27
28 #ifndef _THREADRASTER_H
29 #define _THREADRASTER_H
30
31 #ifdef HAVE_WXTHREADS
32
33 #include <vector>
34 #include <wx/thread.h>
35 #include <wx/progdlg.h>
36 #include "timer.h"
37 #include "backgroundsupr.h"
38
39
40 class Reconstructor;
41 class ImageFile;
42 class PhantomFileDocument;
43 class RasterizerWorker;
44 class ImageFileView;
45
46 class RasterizerSupervisorThread : public SupervisorThread {
47 private:
48   PhantomFileView* m_pPhantomView;
49   const int m_iNX;
50   const int m_iNY;
51   const int m_iNSample;
52   const double m_dViewRatio;
53   const wxString m_strLabel;
54
55 public:
56   RasterizerSupervisorThread(PhantomFileView* pProjView, int iNX, int iNY, int iNSample, double dViewRatio, wxChar const* strLabel);
57
58   virtual wxThread::ExitCode Entry();
59   virtual void OnExit();
60 };
61
62
63
64 class RasterizerSupervisor : public BackgroundSupervisor {
65 private:
66
67   PhantomFileView* m_pPhantomView;
68   std::vector<ImageFile*> m_vecpChildImageFiles;
69   PhantomFileDocument* m_pPhantomDoc;
70
71   const int m_iNX;
72   const int m_iNY;
73   const int m_iNSample;
74   const double m_dViewRatio;
75   const wxString m_strLabel;
76
77
78 public:
79    RasterizerSupervisor (SupervisorThread* pThread, PhantomFileView* pProjView, int iNX, int iNY,
80    int iNSample, double dViewRatio, wxChar const* pszLabel);
81
82    virtual BackgroundWorkerThread* createWorker (int iThread, int iStartUnit, int iNumUnits);
83
84    virtual ~RasterizerSupervisor ();
85
86   void onDone();
87
88   ImageFile* getImageFile();
89
90 };
91
92
93
94
95 class RasterizerWorker : public BackgroundWorkerThread {
96 private:
97   PhantomFileView* m_pPhantomView;
98   ImageFile* m_pImageFile;
99   int m_iNX;
100   int m_iNY;
101   int m_iNSample;
102   double m_dViewRatio;
103
104
105 public:
106   RasterizerWorker (RasterizerSupervisor* pSupervisor, int iThread, int iStartView, int iNumViews)
107     : BackgroundWorkerThread (pSupervisor, iThread, iStartView, iNumViews)
108   {}
109
110   void SetParameters (PhantomFileView* pPhantomFile, ImageFile* pImageFile, int iNX, int iY,
111    int iNSample, double dViewRatio);
112
113   virtual wxThread::ExitCode Entry();      // thread execution starts here
114
115   virtual void OnExit();
116 };
117
118 #endif // HAVE_WXTHREADS
119 #endif // _THREADRASTER_H_
120