geopro/src/render/actors/AxesActor.hpp

54 lines
2.3 KiB
C++
Raw 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 <vtkSmartPointer.h>
#include "geo/GeoLocalFrame.hpp"
class vtkCubeAxesActor;
class vtkRenderer;
namespace geopro::render {
// 坐标轴显示方式spec §4 C3I3
// Standard 标准 = vtkCubeAxesActor 包围盒 + 刻度(外侧最近轴显示刻度)。
// Stereo 三维立体 = vtkCubeAxesActor 闭合立方(四周/网格更完整)。语义待 1.0 确认,先合理近似。
// None 不显示 = 不构建(返回 nullptr
enum class AxesMode { Standard, Stereo, None };
// 刻度单位spec §4 D5I5
// None 无刻度 = 隐藏刻度标签。
// Meter 米 = 原值(世界系本就是米)。
// Feet 英尺 = ×3.28084。
// LatLon 经纬度 = 经 GeoLocalFrame 反算 X→经度、Y→纬度Z 退化为米深度)。
enum class AxesUnit { None, Meter, Feet, LatLon };
// 单轴显示(原型坐标轴设置):是否显示该轴 + 是否用自定义刻度范围(覆盖按单位换算的自动范围)。
struct AxisDisplay {
bool visible = true;
bool customRange = false; // true=用 min/max 作刻度显示范围(值按当前单位)
double min = 0.0;
double max = 0.0;
};
// 坐标轴构建参数。
struct AxesOptions {
AxesMode mode = AxesMode::Standard;
AxesUnit unit = AxesUnit::Meter;
int fontSize = 12; // 标题/标签字号
// 经纬度刻度需 frame 反算;为空则 LatLon 退化为米。
const geopro::core::GeoLocalFrame* frame = nullptr;
AxisDisplay x, y, z; // per-axis 可见性 + 自定义范围
};
// 由数据包围盒 bounds[6]={xmin,xmax,ymin,ymax,zmin,zmax} + 选项构建坐标轴 prop。
// O 点 = 数据包围盒角(待 1.0 确认spec §13 倾向"数据包围盒角")。
// bounds 退化min>max 或全 0或 mode==None → 返回 nullptr。
// cameravtkCubeAxesActor 需绑定相机(决定外侧刻度轴);可空(测试场景)。
vtkSmartPointer<vtkCubeAxesActor> buildAxes(const double bounds[6], const AxesOptions& opts,
vtkRenderer* renderer);
// 单位换算系数米→目标单位。LatLon 不是线性系数X/Y 分别反算),此处仅供米/英尺;
// 暴露为可测纯函数。
double unitScaleFactor(AxesUnit unit);
} // namespace geopro::render