ff5f089dc1
- 标签顺序:几何与安装 放到 测试序列 之前 - 序列点增加可选 uv_px(向后兼容),点表新增 U/V 列;加入所选点、删除所选、 送到标定页(按 U/V 经同一套求解加入标定队列并切换页面) - 已选点结果改显示在选点区状态行,不再写入全局顶部状态条 - 序列页左上区改紧凑:名称与备注同一行,分“阵列”“运动参数”两页; 运动参数每行三组,输入框改用 compactField - 新增阵列工具(array_plan.py、ui/array_tool.py):UV 规则网格(可蛇形遍历)与 阶段预设,逐点检查是否在曲面内、是否留有边距,候选点实时预览在 2D 图上, 只有可用点才能加入,已在序列里的点不重复加入 - 2D 平面图:标记改为缩放后再绘制并加深色描边,修复缩小后点不清; 底图可选 原图/灰度/变暗/仅轮廓,点色可选 黄/白/青/橙/灰(默认灰度+黄,写入偏好); 序列点带编号并连线显示遍历顺序,选中行高亮 - 新增测试 test_sequence_uv、test_sequence_to_capture、test_array_plan、test_array_tool
48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
"""U/V on sequence points: the optional field and the way it travels in a document."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
|
|
from orisys_autocal.sequence_io import SequencePoint, from_document, to_document
|
|
|
|
PROFILE = {"mode": "plane", "pitch_mm": 2.0, "repeats": 1}
|
|
|
|
|
|
def _round_trip(points):
|
|
document = to_document(profile=PROFILE, points=points)
|
|
# Through JSON text, as a file would carry it.
|
|
return from_document(json.loads(json.dumps(document)), current_profile=PROFILE)
|
|
|
|
|
|
def test_uv_survives_a_round_trip():
|
|
point = SequencePoint(
|
|
id=1, target_mm={"x": 1.0, "y": 2.0, "z": 3.0}, uv_px={"u": -130.0, "v": 470.5}
|
|
)
|
|
back = _round_trip([point]).points[0]
|
|
assert back.uv_px == {"u": -130.0, "v": 470.5}
|
|
|
|
|
|
def test_a_point_without_uv_stays_without_it():
|
|
point = SequencePoint(id=1, target_mm={"x": 1.0, "y": 2.0, "z": 3.0})
|
|
document = to_document(profile=PROFILE, points=[point])
|
|
assert "uv_px" not in document["points"][0]
|
|
assert _round_trip([point]).points[0].uv_px is None
|
|
|
|
|
|
def test_an_older_file_with_no_uv_still_loads():
|
|
document = to_document(
|
|
profile=PROFILE,
|
|
points=[SequencePoint(id=1, target_mm={"x": 0.0, "y": 0.0, "z": 12.4})],
|
|
)
|
|
assert from_document(document, current_profile=PROFILE).points[0].uv_px is None
|
|
|
|
|
|
def test_a_half_written_uv_is_ignored_rather_than_half_used():
|
|
document = to_document(
|
|
profile=PROFILE,
|
|
points=[SequencePoint(id=1, target_mm={"x": 0.0, "y": 0.0, "z": 12.4})],
|
|
)
|
|
document["points"][0]["uv_px"] = {"u": 5.0}
|
|
assert from_document(document, current_profile=PROFILE).points[0].uv_px is None
|