00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00020 #ifndef _ImageProgress_hpp
00021 #define _ImageProgress_hpp
00022
00023 #include<ImLib3D/TaskProgressManager.hpp>
00024 #include<ImLib3D/ImLib3D.hpp>
00025
00026 class ImageProgressHelper
00027 {
00028 public:
00029 virtual double Progress() const =0;
00030 virtual ~ImageProgressHelper(){;};
00031 };
00032 template<class ItType>
00033 class ImageProgressHelperNormal : public ImageProgressHelper
00034 {
00035 ItType *it;
00036 public:
00037 virtual double Progress() const {return it->Progress();}
00038 ImageProgressHelperNormal(ItType &_it):it(&_it){;}
00039 };
00041
00043 class ImageProgress : public TaskInProgress
00044 {
00045 ImageProgressHelper *helper;
00046 public:
00047 virtual double Progress() const {return helper->Progress();}
00048 virtual string ProgressLabel() const {return SPrintf("%2.1f%%",100*Progress());}
00050 template<class ItType>
00051 ImageProgress(const string &_name,ItType &p):
00052 TaskInProgress(_name,imLib3D.taskProgressManager),
00053 helper(new ImageProgressHelperNormal<ItType>(p))
00054 {
00055 }
00056 virtual ~ImageProgress(){delete helper;}
00057 };
00058
00059
00060 #endif //_ImageProgress_hpp