64 lines
2.2 KiB
C++
64 lines
2.2 KiB
C++
#pragma once
|
|
#include <cstdint>
|
|
#include "../architecture/Renderable.h"
|
|
#include "../Axis/Abs_Axis.h"
|
|
#include "../base/Style.h"
|
|
namespace renderive {
|
|
struct Band_Region_Private;
|
|
/// @brief 带状区域方向。
|
|
enum class Band_Axis : std::uint8_t {
|
|
/// @brief 沿 X 轴范围绘制竖向区域。
|
|
Domain,
|
|
/// @brief 沿 Y 轴范围绘制横向区域。
|
|
Value
|
|
};
|
|
/// @brief 带状区域构造属性。
|
|
struct Band_Region_Prop {
|
|
std::weak_ptr<Abs_Axis> domain_axis{};
|
|
std::weak_ptr<Abs_Axis> value_axis{};
|
|
Range range{0.0, 1.0};
|
|
Band_Axis orientation = Band_Axis::Domain;
|
|
Brush brush = Brush{Color{255, 255, 255, 48}, Brush_Style::Solid};
|
|
Pen pen = Pen{.style = Line_Style::None};
|
|
};
|
|
/// @brief 在两个坐标轴之间绘制指定范围的带状区域。
|
|
class LIB_DECL Band_Region : public Renderable {
|
|
public:
|
|
/// @brief 绑定 X 轴。
|
|
PROP(std::shared_ptr<Abs_Axis>, domain_axis)
|
|
/// @brief 绑定 Y 轴。
|
|
PROP(std::shared_ptr<Abs_Axis>, value_axis)
|
|
/// @brief 数据区域范围。
|
|
PROP(Range, range)
|
|
/// @brief 带状区域方向。
|
|
PROP(Band_Axis, orientation)
|
|
/// @brief 区域填充刷。
|
|
PROP(Brush, brush)
|
|
/// @brief 区域边框画笔。
|
|
PROP(Pen, pen)
|
|
struct Builder;
|
|
/// @brief 创建带状区域图元。
|
|
Band_Region();
|
|
private:
|
|
Band_Region_Private* d();
|
|
Render_Object_Owner create_render_data() override;
|
|
Render_Object_Owner create_render_state() override;
|
|
Render_Object_Owner create_input_data() override;
|
|
};
|
|
/// @brief 带状区域构造器。
|
|
struct LIB_DECL Band_Region::Builder : Band_Region_Prop {
|
|
PROP_B(std::shared_ptr<Renderable>, parent)
|
|
PROP_B(std::shared_ptr<Abs_Axis>, domain_axis)
|
|
PROP_B(std::shared_ptr<Abs_Axis>, value_axis)
|
|
PROP_B(Range, range)
|
|
PROP_B(Band_Axis, orientation)
|
|
PROP_B(Brush, brush)
|
|
PROP_B(Pen, pen)
|
|
/// @brief 创建带状区域构造器。
|
|
Builder(std::shared_ptr<Renderable> parent, std::shared_ptr<Abs_Axis> domain_axis, std::shared_ptr<Abs_Axis> value_axis);
|
|
/// @brief 构建并返回带状区域对象。
|
|
std::shared_ptr<Band_Region> build();
|
|
std::shared_ptr<Renderable> parent{};
|
|
};
|
|
} // namespace renderive
|