DianLi/LandslidePredict/CProcessBase.h
2023-03-13 16:17:55 +08:00

99 lines
1.5 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <iostream>
using namespace std;
/**
* @brief 进度条基类
*
* 提供进度条基类接口,来反映当前算法的进度值
*/
//源码class IMGALG_API CProcessBase
class CProcessBase
{
public:
/**
* @brief 构造函数
*/
CProcessBase()
{
m_dPosition = 0.0;
m_iStepCount = 100;
m_iCurStep = 0;
m_bIsContinue = true;
}
/**
* @brief 析构函数
*/
virtual ~CProcessBase() {}
/**
* @brief 设置进度信息
* @param pszMsg 进度信息
*/
virtual void SetMessage(const char* pszMsg) = 0;
/**
* @brief 设置进度值
* @param dPosition 进度值
* @return 返回是否取消的状态true为不取消false为取消
*/
virtual bool SetPosition(double dPosition) = 0;
/**
* @brief 进度条前进一步返回true表示继续false表示取消
* @return 返回是否取消的状态true为不取消false为取消
*/
virtual bool StepIt() = 0;
/**
* @brief 设置进度个数
* @param iStepCount 进度个数
*/
virtual void SetStepCount(int iStepCount)
{
ReSetProcess();
m_iStepCount = iStepCount;
}
/**
* @brief 获取进度信息
* @return 返回当前进度信息
*/
string GetMessage()
{
return m_strMessage;
}
/**
* @brief 获取进度值
* @return 返回当前进度值
*/
double GetPosition()
{
return m_dPosition;
}
/**
* @brief 重置进度条
*/
void ReSetProcess()
{
m_dPosition = 0.0;
m_iStepCount = 100;
m_iCurStep = 0;
m_bIsContinue = true;
}
/*! 进度信息 */
string m_strMessage;
/*! 进度值 */
double m_dPosition;
/*! 进度个数 */
int m_iStepCount;
/*! 进度当前个数 */
int m_iCurStep;
/*! 是否取消值为false时表示计算取消 */
bool m_bIsContinue;
};