You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWTAI-Platform/Include/nmNum/nmSubWxs/nmPebiResultDisplayStateBui...

60 lines
2.3 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef NMPEBIRESULTDISPLAYSTATEBUILDER_H
#define NMPEBIRESULTDISPLAYSTATEBUILDER_H
#include "nmPebiResultDisplaySettings.h"
#include <QSharedPointer>
#include <QString>
#include <vtkLookupTable.h>
#include <vtkSmartPointer.h>
class nmPebiResultSnapshot;
/** @brief 屏幕场景和离屏导出共同使用的完整属性显示状态。 */
struct nmPebiResultDisplayState
{
/** @brief 创建不持有LUT的空显示状态。 */
nmPebiResultDisplayState();
/** @brief 经过normalized()处理并实际用于构造状态的设置。 */
nmPebiResultDisplaySettings m_oSettings;
/** @brief 快照中的真实属性范围,不受手工显示范围影响。 */
double m_dBusinessRange[2];
/** @brief 色标和设置界面对外显示的范围。 */
double m_dVisibleRange[2];
/** @brief LUT实际范围;单值模式下为满足VTK要求进行微量扩展。 */
double m_dInternalRange[2];
/** @brief 网格和色标共同使用的完整LookupTable。 */
vtkSmartPointer<vtkLookupTable> m_pLookupTable;
/** @brief 与线性或对数模式对应的ASCII色标标题。 */
QString m_sScalarBarTitle;
/** @brief 自动范围为单值时为true,手工范围始终为false。 */
bool m_bSingleValueMode;
};
/** @brief 统一构造结果网格和色标使用的颜色映射状态。 */
class nmPebiResultDisplayStateBuilder
{
public:
/**
* @brief 事务式构造网格和色标共用的完整颜色显示状态。
* @param pSnapshot 只读结果快照强引用。
* @param sPropertyId 快照中的稳定属性ID。
* @param oRequestedSettings 待规范化和校验的显示设置。
* @param oState 成功时接收完整状态;失败时保持原值不变。
* @param pError 可选错误输出;进入函数后先清空。
* @return 属性、范围、比例模式和LUT全部构造成功时返回true。
*/
static bool build(
const QSharedPointer<const nmPebiResultSnapshot>& pSnapshot,
const QString& sPropertyId,
const nmPebiResultDisplaySettings& oRequestedSettings,
nmPebiResultDisplayState& oState,
QString* pError = nullptr);
private:
/** @brief 纯静态构造器,不允许创建实例。 */
nmPebiResultDisplayStateBuilder();
};
#endif // NMPEBIRESULTDISPLAYSTATEBUILDER_H