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/nmRender/nmVTKScalarBarLayer.h

51 lines
1.8 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 NMVTKSCALARBARLAYER_H
#define NMVTKSCALARBARLAYER_H
#include "nmVTKRenderLayer.h"
#include <vtkSmartPointer.h>
class vtkLookupTable;
class vtkScalarBarActor;
/**
* @brief 通用色标图层。
*
* 色标只展示外部 LookupTable不解析单位也不自行计算数据范围。
*/
class NM_RENDER_EXPORT nmVTKScalarBarLayer : public nmVTKRenderLayer
{
public:
/** @brief 创建空色标,并将二维 Actor 注册为本图层主 Prop。 */
explicit nmVTKScalarBarLayer(const QString& sLayerId);
/** @brief 先解除 Renderer再释放外部颜色表的共享引用。 */
virtual ~nmVTKScalarBarLayer();
/** @brief 共享外部 LookupTable 的 VTK 引用。 */
void setLookupTable(vtkLookupTable* pLookupTable);
/** @brief 返回当前共享颜色表的非所有权指针。 */
vtkLookupTable* getLookupTable() const;
/** @brief 使用 UTF-8 设置色标标题,不解释标题中的业务含义。 */
void setTitle(const QString& sTitle);
/** @brief 返回调用方设置的标题。 */
QString getTitle() const;
/** @brief 设置归一化视口坐标中的左下角位置。 */
bool setPosition(double dX, double dY);
/** @brief 设置归一化视口坐标中的宽度和高度。 */
bool setSize(double dWidth, double dHeight);
/** @brief 返回图层持有的 vtkScalarBarActor 非所有权指针。 */
vtkScalarBarActor* getActor() const;
private:
Q_DISABLE_COPY(nmVTKScalarBarLayer)
vtkSmartPointer<vtkLookupTable> m_pLookupTable; ///< 共享外部颜色表引用。
vtkSmartPointer<vtkScalarBarActor> m_pActor; ///< 图层独占的二维色标 Prop。
QString m_sTitle; ///< 保留无损 Qt 标题,避免从 VTK 窄字符串反向解析。
};
#endif // NMVTKSCALARBARLAYER_H