SuperAPI AI 工具集

thatopen-impl-measurements

数据与分析

查看项目

更新于 10-16 09:56

技能介绍

用途:为 ThatOpen BIM 查看器添加距离(LengthMeasurement)、面积(AreaMeasurement)、体积(VolumeMeasurement)、角度(AngleMeasurement)测量工具。四个类均继承抽象基类 Measurement<T, U>,实现 Createable、Hideable、Disposable。

主要能力:共享 enabled、visible、units、rounding、color、delay、world 等配置;统一的 lines、fills、labels、volumes 等 DataSet 存储;事件 onPointerStop、onPointerMove、onStateChanged、onEnabledChange、onVisibilityChange、onDisposed;长度支持 free/edge 两种模式;面积支持 free/square/face 三种模式;体积仅有 free 模式,角度仅 free 模式(三点,第二点为顶点)。默认单位:长度 m、面积 m2、体积 m3、角度 deg。

必要用法:先通过 components.get(OBCF.LengthMeasurement) 等获取组件,必须先赋 world 再设 enabled = true;如需自定义标签,须在启用前设置静态属性 Measurement.valueFormatter;可通过 snappings、snapDistance、pickerSize、pickerMode 配置吸附;创建流程为点击触发 create(),以 endCreation() 完成、cancelCreation() 取消;delete() 删除指针下的测量;切换类型前必须先禁用当前类型,不得同时启用多个;清理时调用 dispose() 或 components.dispose()。支持 applyPlanesVisibility(planes) 集成裁剪平面。

限制与注意:enable 前未赋 world 会导致顶点拾取无法射线检测;未调用 endCreation() 测量会停留在预览状态;endCreation() 后不能再修改 valueFormatter;未调用 dispose() 或遗留 preview 元素可能泄漏;资料中含 UUID、常量与完整 API 说明,但本次不逐条展开;其他具体参数默认值与版本以 @thatopen/components-front 3.3.x 为准。