@vsleem-realsee-viewer/bimsee-plugin 2.0.5 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -106
- package/dist/components/Bimsee.vue.d.ts +0 -1
- package/dist/index.css +1 -1
- package/dist/index.mjs +48 -48
- package/dist/index.umd.js +1 -1
- package/dist/settings/index.d.ts +1 -0
- package/dist/types/bimsee.d.ts +3 -3
- package/dist/types/masker.d.ts +6 -6
- package/dist/types/store.d.ts +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,131 +1,151 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
1
|
# Bimsee BIM容器组件
|
|
4
2
|
|
|
5
3
|
## 介绍
|
|
6
4
|
|
|
7
|
-
用于将BIM
|
|
5
|
+
用于将BIM模型展示在页面上的组件,组件包含蒙层容器组件和相关交互等功能
|
|
8
6
|
|
|
9
7
|
### BimseeProps 参数说明
|
|
10
8
|
|
|
11
|
-
| 参数名
|
|
12
|
-
|
|
|
13
|
-
| `
|
|
14
|
-
| `
|
|
15
|
-
| `
|
|
16
|
-
| `
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `fetchError` | `(error: any) => void?` | 否 | 请求失败回调 |
|
|
9
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
10
|
+
| -------------------- | ------------------------------------------------------- | --------------------------- | -------------------------- |
|
|
11
|
+
| `appSetting` | `AppSetting` | 请查看AppSetting类型默认值 | 应用全局配置 |
|
|
12
|
+
| `searchInfo` | `SearchInfo` | - | 数据查询条件参数 |
|
|
13
|
+
| `bimseeSetting?` | `BimseeSetting` | - | 暂未使用 |
|
|
14
|
+
| `masker?` | `MaskerProps` | 请查看MaskerProps类型默认值 | 蒙层相关属性配置 |
|
|
15
|
+
| `immediate?` | `boolean` | true | 是否立即发起数据请求 |
|
|
16
|
+
| `delay?` | `number` | 0 | 请求延迟时间(单位:毫秒) |
|
|
17
|
+
| `handleCheckModelFn` | `(res?: Coordinate) => Promise<boolean>` | - | 处理检查模型状态 |
|
|
18
|
+
| `handleResponseFn?` | `(res?: Coordinate) => Promise<Coordinate \ undefined>` | - | 处理坐标系树响应 |
|
|
19
|
+
| `fetchSuccess?` | `(res?: Coordinate) => void` | - | 坐标系树请求成功 |
|
|
20
|
+
| `fetchError?` | `(error: any) => void` | - | 请求失败回调 |
|
|
24
21
|
|
|
25
22
|
### SearchInfo 类型说明
|
|
26
23
|
|
|
27
|
-
| 参数名
|
|
28
|
-
|
|
|
29
|
-
| `projectId`
|
|
30
|
-
| `modelCsId
|
|
24
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
25
|
+
| ----------- | -------- | ------ | ----------------- |
|
|
26
|
+
| `projectId` | `number` | - | 项目唯一标识 |
|
|
27
|
+
| `modelCsId` | `number` | - | bim模型坐标系标识 |
|
|
31
28
|
|
|
32
29
|
### BimseeStore 类型说明
|
|
33
30
|
|
|
34
|
-
|
|
|
35
|
-
| ----------------------- |
|
|
36
|
-
| `ready
|
|
37
|
-
| `coordinateTree?` | `Coordinate`
|
|
38
|
-
| `mappedCoordinateTree?` | `Coordinate`
|
|
39
|
-
| `currentModel?` | `Coordinate`
|
|
40
|
-
| `currentSpace?` | `Coordinate`
|
|
41
|
-
| `currentPoint?` | `
|
|
42
|
-
| `reload` | `(searchInfo: SearchInfo) => Promise<void>`
|
|
43
|
-
| `selectModel` | `(coordinate: Partial<Coordinate>) => void`
|
|
44
|
-
| `
|
|
31
|
+
| 属性/方法 | 类型/签名 | 说明 |
|
|
32
|
+
| ----------------------- | ------------------------------------------- | ------------------------------------ |
|
|
33
|
+
| `ready` | `boolean` | 是否加载完成 |
|
|
34
|
+
| `coordinateTree?` | `Coordinate` | 坐标树结构 |
|
|
35
|
+
| `mappedCoordinateTree?` | `Coordinate` | 映射后的坐标树结构 |
|
|
36
|
+
| `currentModel?` | `Coordinate` | 当前模型坐标系 |
|
|
37
|
+
| `currentSpace?` | `Coordinate` | 当前空间坐标系 |
|
|
38
|
+
| `currentPoint?` | `Point` | 当前模型的点 |
|
|
39
|
+
| `reload` | `(searchInfo: SearchInfo) => Promise<void>` | 重新加载数据 |
|
|
40
|
+
| `selectModel` | `(coordinate: Partial<Coordinate>) => void` | 选择模型(找不到对应模型时抛出错误) |
|
|
41
|
+
| `setModelPoint` | ` (point: Point) => void` | 设置模型的坐标点 |
|
|
45
42
|
|
|
46
43
|
### BimseeElement 实例对象
|
|
47
44
|
|
|
48
|
-
|
|
|
45
|
+
| 属性/方法 | 类型签名 | 说明 |
|
|
49
46
|
| ------------- | -------------------------------------------------- | -------------------------------------------------- |
|
|
50
47
|
| `storeRef` | `ComputedRef<BimseeStore>` | 响应式存储对象引用 |
|
|
51
48
|
| `getStore()` | `() => BimseeStore` | 获取状态管理库实例 |
|
|
52
|
-
| `
|
|
49
|
+
| `getMasker()` | `() => MaskerElement \ undefined` | 获取蒙层容器控制器 |
|
|
53
50
|
| `getState()` | `() => BimseeProps` | 获取初始化配置(返回原始配置参数) |
|
|
54
51
|
| `setState()` | `(options: Partial<UpdatableBimseeProps>) => void` | 动态更新可修改配置(注意:部分配置初始化后不可更改 |
|
|
55
52
|
|
|
56
53
|
### BimseeEvents 事件说明
|
|
57
54
|
|
|
58
|
-
| 事件名称 |
|
|
59
|
-
| ----------------------- |
|
|
60
|
-
| `ready` |
|
|
61
|
-
| `changeModel` |
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
55
|
+
| 事件名称 | 参数类型 | 说明 |
|
|
56
|
+
| ----------------------- | ------------------------------ | ---------------------- |
|
|
57
|
+
| `ready` | `() => void` | 基本准备就绪事件 |
|
|
58
|
+
| `changeModel` | `(model?: Coordinate) => void` | 模型变化事件 |
|
|
59
|
+
| `maskerReady` | `() => void` | 蒙层准备就绪事件 |
|
|
60
|
+
| `maskerClick` | `(e: any) => void` | 蒙层点击事件 |
|
|
61
|
+
| `maskerMousedown` | `(e: any) => void` | 蒙层鼠标按下事件 |
|
|
62
|
+
| `maskerZoomUpdated` | `(e: any) => void` | 蒙层缩放到指定级别事件 |
|
|
63
|
+
| `maskerPositionUpdated` | `(e: any) => void` | 蒙层旋转到指定位置事件 |
|
|
64
|
+
| `maskerPointLoaded` | `(point: TrackPoint) => void` | 蒙层的坐标点触发事件 |
|
|
68
65
|
|
|
69
66
|
### Bimsee Slot 插槽说明
|
|
70
67
|
|
|
71
|
-
| 插槽名称 |
|
|
72
|
-
|
|
|
73
|
-
| default
|
|
68
|
+
| 插槽名称 | 参数类型 | 说明 |
|
|
69
|
+
| --------- | ---------------------- | -------- |
|
|
70
|
+
| `default` | `(slot) => void` | 默认插槽 |
|
|
71
|
+
| `masker` | `(maskerSlot) => void` | 蒙层插槽 |
|
|
74
72
|
|
|
75
|
-
|
|
73
|
+
```
|
|
74
|
+
type slot = {
|
|
75
|
+
coordinateTree: Coordinate | undefined;
|
|
76
|
+
mappedCoordinateTree: Coordinate | undefined;
|
|
77
|
+
currentSpace: Coordinate | undefined;
|
|
78
|
+
currentModel: Coordinate | undefined;
|
|
79
|
+
currentPoint: Point | undefined;
|
|
80
|
+
}
|
|
81
|
+
type maskerSlot =slot & {
|
|
82
|
+
cameraStatus: CameraStatus | undefined;
|
|
83
|
+
state: Required<Partial<MaskerProps>>;
|
|
84
|
+
}
|
|
85
|
+
```
|
|
76
86
|
|
|
77
|
-
#
|
|
87
|
+
# Masker 蒙层组件
|
|
78
88
|
|
|
79
89
|
## 介绍
|
|
80
90
|
|
|
81
|
-
###
|
|
82
|
-
|
|
83
|
-
| 参数名
|
|
84
|
-
|
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
|
99
|
-
|
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
|
|
128
|
-
|
|
91
|
+
### MaskerProps 类型说明
|
|
92
|
+
|
|
93
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
94
|
+
| ------------------ | --------------------- | ------ | ---------------------- |
|
|
95
|
+
| `visible?` | `boolean` | true | 是否可见 |
|
|
96
|
+
| `defaultYaw?` | `number` | 0 | 默认偏航角(球面基准) |
|
|
97
|
+
| `defaultPitch?` | `number` | 0 | 默认俯仰角(球面基准) |
|
|
98
|
+
| `defaultZoomLvl?` | `number` | 30 | 默认缩放级别(球面基准) |
|
|
99
|
+
| `referPoint?` | `Point` | - | 参考点 |
|
|
100
|
+
| `referCoordinate?` | `Partial<Coordinate>` | - | 参考点坐标系 |
|
|
101
|
+
| `minFov?` | `number` | 20 | 最小视野角度 |
|
|
102
|
+
| `maxFov?` | `number` | 120 | 最大视野角度 |
|
|
103
|
+
| `mouseover?` | `boolean` | - | 鼠标悬浮 |
|
|
104
|
+
| `mousedown?` | `boolean` | - | 鼠标按下 |
|
|
105
|
+
|
|
106
|
+
### MaskerElement 实例对象
|
|
107
|
+
|
|
108
|
+
| 方法/属性 | 类型签名 | 说明 |
|
|
109
|
+
| ------------------- | --------------------------------------------------------- | ------------------------ |
|
|
110
|
+
| `dataHelper` | `DataHelper` | 用于蒙层的数据转换器集合 |
|
|
111
|
+
| `isMouseover` | `() => boolean` | 检查鼠标是否悬停 |
|
|
112
|
+
| `isMousedown` | `() => boolean` | 检查鼠标是否按下 |
|
|
113
|
+
| `setState` | `(options?: Partial<MaskerProps>) => void` | 更新蒙层配置选项 |
|
|
114
|
+
| `setMousedown` | `(mousedown: boolean) => void` | 设置鼠标按下状态 |
|
|
115
|
+
| `setMouseover` | `(mouseover: boolean) => void` | 设置鼠标悬停状态 |
|
|
116
|
+
| `setMinFov` | `(minFov: number) => void` | 设置最小视野 |
|
|
117
|
+
| `setMaxFov` | `(maxFov: number) => void` | 设置最大视野 |
|
|
118
|
+
| `setReferPoint` | `(point: Point, coordinate: Partial<Coordinate>) => void` | 设置参考点 |
|
|
119
|
+
| `zoom` | `(level: number) => void` | 缩放到指定级别 |
|
|
120
|
+
| `rotate` | `(position: Position) => void` | 旋转蒙层到指定位置 |
|
|
121
|
+
| `getState` | ` () => MaskerProps` | 获取当前蒙层状态 |
|
|
122
|
+
| `getPosition` | `() => Position` | 获取当前位置(yaw/pitch) |
|
|
123
|
+
| `getZoomLevel` | ` () => number` | 获取当前缩放级别 |
|
|
124
|
+
| `getCameraPosition` | `() => Vector3 \ undefined` | 获取当前相机位置 |
|
|
125
|
+
| `getCameraTarget` | `() => Vector3 \ undefined` | 获取当前相机视角 |
|
|
126
|
+
| `getCameraFov` | `() => number \ undefined` | 获取当前相机视野角度 |
|
|
127
|
+
| `getCameraStatus` | `() => CameraStatus \ undefined` | 获取相机状态 |
|
|
128
|
+
|
|
129
|
+
### DataHelper 数据转换对象
|
|
130
|
+
|
|
131
|
+
| 属性 | 类型 | 描述 |
|
|
132
|
+
| ---------------------------- | ------------------------------------------------------------- | ------------------------------------ |
|
|
133
|
+
| `referPointToModelPoint` | `(point: Point, coordinate: Coordinate) => Point \ undefined` | 将参考点坐标转当前模型的坐标 |
|
|
134
|
+
| `modelPointToCameraPosition` | `(point: Point) => Vector3` | 将当前模型的坐标转成三维相机位置坐标 |
|
|
135
|
+
| `maskerRotateToCameraTarget` | `(rotate: Position, position: Vector3) => Vector3` | 将球面坐标转换为三维目标点坐标 |
|
|
136
|
+
| `fovToZoomLevel` | `(fov: number) => number` | 将视野转换为缩放级别 |
|
|
137
|
+
| `zoomLevelToFov` | `(level: number) => number` | 将缩放级别转换为视野 |
|
|
138
|
+
|
|
139
|
+
### MaskerEvents 事件说明
|
|
140
|
+
|
|
141
|
+
| 事件名称 | 描述 | 参数类型 |
|
|
142
|
+
| ----------------- | ---------------------- | --------------------------- |
|
|
143
|
+
| `ready` | 蒙层准备就绪事件 | () => void |
|
|
144
|
+
| `click` | 蒙层点击事件 | (e: any) => void |
|
|
145
|
+
| `mousedown` | 蒙层鼠标按下事件 | (e: any) => void |
|
|
146
|
+
| `zoomUpdated` | 蒙层缩放到指定级别事件 | (e: any) => void |
|
|
147
|
+
| `positionUpdated` | 蒙层旋转到指定位置事件 | (e: any) => void |
|
|
148
|
+
| `pointLoaded` | 蒙层坐标点触发事件 | (point: TrackPoint) => void |
|
|
129
149
|
|
|
130
150
|
# 导出的类型声明对象
|
|
131
151
|
|
|
@@ -145,24 +165,31 @@ export type {
|
|
|
145
165
|
BimseeElement, // Bimsee 元素类型
|
|
146
166
|
BimseeStore, // Bimsee 状态管理元素类型
|
|
147
167
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
168
|
+
//蒙层相关
|
|
169
|
+
UpdatableMaskerProps, // 可更新的蒙层属性
|
|
170
|
+
MaskerProps, // 蒙层属性
|
|
171
|
+
MaskerElement, // 蒙层元素类型
|
|
152
172
|
} from '@vsleem-realsee-viewer/bimsee-plugin';
|
|
153
173
|
|
|
154
174
|
export {
|
|
155
175
|
BIMSEE_CONFIG, // Realsee 默认设置
|
|
156
|
-
|
|
176
|
+
MASKER_CONFIG, // 蒙层默认配置
|
|
157
177
|
} from '@vsleem-realsee-viewer/bimsee-plugin';
|
|
158
178
|
|
|
159
179
|
```
|
|
160
180
|
|
|
161
|
-
#
|
|
181
|
+
# 示例
|
|
162
182
|
|
|
163
|
-
|
|
183
|
+
通过以下方式来注册组件
|
|
164
184
|
|
|
165
|
-
|
|
185
|
+
### 安装
|
|
166
186
|
|
|
167
|
-
|
|
168
|
-
|
|
187
|
+
`npm install @vsleem-realsee-viewer/bimsee-plugin @vsleem-realsee-viewer/shared`
|
|
188
|
+
|
|
189
|
+
`pnpm add @vsleem-realsee-viewer/bimsee-plugin @vsleem-realsee-viewer/shared`
|
|
190
|
+
|
|
191
|
+
### 例子
|
|
192
|
+
|
|
193
|
+
`vsleem-realsee-demo仓库下的DualseePlugin.vue`
|
|
194
|
+
|
|
195
|
+
仓库地址:https://gitee.com/yangleistudio/vsleem-realsee-demo
|
|
@@ -189,7 +189,6 @@ declare const __VLS_component: import('vue').DefineComponent<BimseeProps, {
|
|
|
189
189
|
"onChange-model"?: ((...args: any[]) => any) | undefined;
|
|
190
190
|
}>, {
|
|
191
191
|
immediate: boolean;
|
|
192
|
-
appSetting: import('@vsleem-realsee-viewer/shared').AppSetting;
|
|
193
192
|
masker: import('..').MaskerProps;
|
|
194
193
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
195
194
|
maskerElRef: ({
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.vsleem-bimsee-masker[data-v-ab1804ce]{position:relative;width:100%;height:100%}.bimsee-masker-full[data-v-ab1804ce]{position:absolute;top:0;left:0;width:100%;height:100%;z-index:200;cursor:all-scroll}.vsleem-bimsee[data-v-
|
|
1
|
+
.vsleem-bimsee-masker[data-v-ab1804ce]{position:relative;width:100%;height:100%}.bimsee-masker-full[data-v-ab1804ce]{position:absolute;top:0;left:0;width:100%;height:100%;z-index:200;cursor:all-scroll}.vsleem-bimsee[data-v-03ae1278]{position:relative;width:100%;height:100%}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ref as g, computed as I, watch as te, unref as T, defineComponent as oe, onMounted as ne, onBeforeUnmount as
|
|
2
|
-
import { APP_SETTING as
|
|
1
|
+
import { ref as g, computed as I, watch as te, unref as T, defineComponent as oe, onMounted as ne, onBeforeUnmount as ke, createElementBlock as ae, openBlock as U, withDirectives as Te, renderSlot as X, createElementVNode as Ce, vShow as Ee, normalizeProps as G, guardReactiveProps as j, createBlock as Le, createCommentVNode as _e, mergeProps as Ie, toHandlers as be, withCtx as Fe } from "vue";
|
|
2
|
+
import { APP_SETTING as Be, utils as re, Position as A, Vector3 as Q, Point as ee, CoordinateModelType as Ne, AppError as O, DataSource as Re, http as xe } from "@vsleem-realsee-viewer/shared";
|
|
3
3
|
const H = {
|
|
4
4
|
visible: !0,
|
|
5
5
|
//是否可见
|
|
@@ -14,12 +14,12 @@ const H = {
|
|
|
14
14
|
maxFov: 120
|
|
15
15
|
// 最大视野角度
|
|
16
16
|
}, ze = {
|
|
17
|
-
appSetting:
|
|
17
|
+
appSetting: Be,
|
|
18
18
|
//全局设置
|
|
19
19
|
masker: H,
|
|
20
20
|
immediate: !0
|
|
21
21
|
// 是否立即生效
|
|
22
|
-
}, { cloneDeep: Ye, deepMergeProps: De } =
|
|
22
|
+
}, { cloneDeep: Ye, deepMergeProps: De } = re;
|
|
23
23
|
function $e(o, n, v, s) {
|
|
24
24
|
const d = g(Ye(H)), r = g(), m = g(), a = I(() => d.value), w = I(() => {
|
|
25
25
|
const { coordinateTree: e, mappedCoordinateTree: t, currentSpace: i, currentModel: c, currentPoint: l } = n.value || {};
|
|
@@ -97,26 +97,26 @@ function $e(o, n, v, s) {
|
|
|
97
97
|
function z() {
|
|
98
98
|
return a.value;
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function ue() {
|
|
101
101
|
const { defaultYaw: e, defaultPitch: t } = a.value;
|
|
102
102
|
return { yaw: e, pitch: t };
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function ie() {
|
|
105
105
|
return a.value.defaultZoomLvl;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function ce() {
|
|
108
108
|
return r.value?.position;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function de() {
|
|
111
111
|
return r.value?.fov;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function le() {
|
|
114
114
|
return r.value?.target;
|
|
115
115
|
}
|
|
116
116
|
function q() {
|
|
117
117
|
return r.value;
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function me() {
|
|
120
120
|
return a.value?.mouseover ?? !1;
|
|
121
121
|
}
|
|
122
122
|
function K() {
|
|
@@ -134,13 +134,13 @@ function $e(o, n, v, s) {
|
|
|
134
134
|
function V(e) {
|
|
135
135
|
_({ mousedown: e });
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function ve(e) {
|
|
138
138
|
_({ minFov: e });
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function fe(e) {
|
|
141
141
|
_({ maxFov: e });
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function pe(e, t) {
|
|
144
144
|
_({ referPoint: e, referCoordinate: t }), y();
|
|
145
145
|
}
|
|
146
146
|
function W(e) {
|
|
@@ -153,7 +153,7 @@ function $e(o, n, v, s) {
|
|
|
153
153
|
const t = b.zoomLevelToFov(e);
|
|
154
154
|
_({ defaultZoomLvl: e }), D({ fov: t }), s("zoom-updated", { zoomLevel: e, fov: t });
|
|
155
155
|
}
|
|
156
|
-
function
|
|
156
|
+
function he(e, t) {
|
|
157
157
|
const { coordinateTree: i, currentModel: c } = n.value;
|
|
158
158
|
if (c) {
|
|
159
159
|
const l = i?.findCsById(t?.id), p = l?.getDestRelativeMap(c);
|
|
@@ -166,50 +166,50 @@ function $e(o, n, v, s) {
|
|
|
166
166
|
return new ee({ ...L, y: -F });
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function we(e) {
|
|
170
170
|
return new Q(e);
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
const { x: i = 0, y: c = 0, z: l = 0 } = t, { yaw: p, pitch: L } = e, F = -p, R = L, x = 100, B = 0, Z = x * Math.cos(B + F) + i,
|
|
174
|
-
return new Q({ x: Z, y:
|
|
172
|
+
function Me(e, t) {
|
|
173
|
+
const { x: i = 0, y: c = 0, z: l = 0 } = t, { yaw: p, pitch: L } = e, F = -p, R = L, x = 100, B = 0, Z = x * Math.cos(B + F) + i, ge = x * Math.sin(B + F) + c, Se = x * Math.tan(R) + l;
|
|
174
|
+
return new Q({ x: Z, y: ge, z: Se });
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function Pe(e) {
|
|
177
177
|
const { minFov: t = 20, maxFov: i = 120 } = a.value, l = 100 - (Math.max(t, Math.min(i, e)) - t) / (i - t) * 100;
|
|
178
178
|
return Math.max(0, Math.min(100, Math.round(l)));
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function ye(e) {
|
|
181
181
|
const { minFov: t = 20, maxFov: i = 120 } = a.value;
|
|
182
182
|
let c = i + e / 100 * (t - i);
|
|
183
183
|
return Math.max(t, Math.min(i, c));
|
|
184
184
|
}
|
|
185
185
|
const b = {
|
|
186
|
-
referPointToModelPoint:
|
|
187
|
-
modelPointToCameraPosition:
|
|
188
|
-
maskerRotateToCameraTarget:
|
|
189
|
-
fovToZoomLevel:
|
|
190
|
-
zoomLevelToFov:
|
|
186
|
+
referPointToModelPoint: he,
|
|
187
|
+
modelPointToCameraPosition: we,
|
|
188
|
+
maskerRotateToCameraTarget: Me,
|
|
189
|
+
fovToZoomLevel: Pe,
|
|
190
|
+
zoomLevelToFov: ye
|
|
191
191
|
};
|
|
192
192
|
return {
|
|
193
193
|
getProps: a,
|
|
194
194
|
getBindValue: w,
|
|
195
195
|
maskerAction: {
|
|
196
196
|
dataHelper: b,
|
|
197
|
-
isMouseover:
|
|
197
|
+
isMouseover: me,
|
|
198
198
|
isMousedown: K,
|
|
199
199
|
setState: _,
|
|
200
200
|
setMousedown: V,
|
|
201
201
|
setMouseover: $,
|
|
202
|
-
setMinFov:
|
|
203
|
-
setMaxFov:
|
|
204
|
-
setReferPoint:
|
|
202
|
+
setMinFov: ve,
|
|
203
|
+
setMaxFov: fe,
|
|
204
|
+
setReferPoint: pe,
|
|
205
205
|
zoom: J,
|
|
206
206
|
rotate: W,
|
|
207
207
|
getState: z,
|
|
208
|
-
getPosition:
|
|
209
|
-
getZoomLevel:
|
|
210
|
-
getCameraPosition:
|
|
211
|
-
getCameraTarget:
|
|
212
|
-
getCameraFov:
|
|
208
|
+
getPosition: ue,
|
|
209
|
+
getZoomLevel: ie,
|
|
210
|
+
getCameraPosition: ce,
|
|
211
|
+
getCameraTarget: le,
|
|
212
|
+
getCameraFov: de,
|
|
213
213
|
getCameraStatus: q
|
|
214
214
|
},
|
|
215
215
|
handleReady: M,
|
|
@@ -237,23 +237,23 @@ const Ve = { class: "vsleem-bimsee-masker" }, Ze = /* @__PURE__ */ oe({
|
|
|
237
237
|
r,
|
|
238
238
|
d
|
|
239
239
|
);
|
|
240
|
-
return ne(u),
|
|
241
|
-
Ce(
|
|
240
|
+
return ne(u), ke(f), n(C), (h, P) => (U(), ae("div", Ve, [
|
|
241
|
+
Te(Ce("div", {
|
|
242
242
|
ref_key: "maskerElRef",
|
|
243
243
|
ref: r,
|
|
244
244
|
class: "bimsee-masker-full"
|
|
245
245
|
}, null, 512), [
|
|
246
|
-
[
|
|
246
|
+
[Ee, T(w).visible]
|
|
247
247
|
]),
|
|
248
248
|
X(h.$slots, "default", G(j(T(M))), void 0, !0)
|
|
249
249
|
]));
|
|
250
250
|
}
|
|
251
|
-
}),
|
|
251
|
+
}), se = (o, n) => {
|
|
252
252
|
const v = o.__vccOpts || o;
|
|
253
253
|
for (const [s, d] of n)
|
|
254
254
|
v[s] = d;
|
|
255
255
|
return v;
|
|
256
|
-
}, Ae = /* @__PURE__ */
|
|
256
|
+
}, Ae = /* @__PURE__ */ se(Ze, [["__scopeId", "data-v-ab1804ce"]]);
|
|
257
257
|
var Y = /* @__PURE__ */ ((o) => (o[o.StoreMissParams = 11e3] = "StoreMissParams", o[o.StoreNoCSTree = 11001] = "StoreNoCSTree", o[o.StoreSelectNoBIMModel = 11002] = "StoreSelectNoBIMModel", o))(Y || {});
|
|
258
258
|
function Oe(o) {
|
|
259
259
|
const n = g(), v = g(), s = g(!1), d = g(!1), r = g(), m = g(), a = I(() => n.value?.findCsById(r.value)), w = I(() => a.value?.findParentSpace());
|
|
@@ -319,7 +319,7 @@ function Oe(o) {
|
|
|
319
319
|
setReady: C
|
|
320
320
|
};
|
|
321
321
|
}
|
|
322
|
-
const { cloneDeep: Ue, deepMergeProps: Xe } =
|
|
322
|
+
const { cloneDeep: Ue, deepMergeProps: Xe } = re;
|
|
323
323
|
function Ge(o, n, v) {
|
|
324
324
|
const s = g(Ue(ze)), d = I(() => s.value);
|
|
325
325
|
te(() => o, C, { immediate: !0, deep: !0 });
|
|
@@ -401,13 +401,13 @@ const qe = { class: "vsleem-bimsee" }, Ke = /* @__PURE__ */ oe({
|
|
|
401
401
|
name: "Bimsee",
|
|
402
402
|
__name: "Bimsee",
|
|
403
403
|
props: {
|
|
404
|
-
appSetting: {
|
|
405
|
-
bimseeSetting: {},
|
|
404
|
+
appSetting: {},
|
|
406
405
|
searchInfo: {},
|
|
406
|
+
bimseeSetting: {},
|
|
407
407
|
masker: { default: () => H },
|
|
408
408
|
immediate: { type: Boolean, default: !0 },
|
|
409
409
|
delay: {},
|
|
410
|
-
|
|
410
|
+
handleCheckModelFn: {},
|
|
411
411
|
handleResponseFn: {},
|
|
412
412
|
fetchSuccess: {},
|
|
413
413
|
fetchError: {}
|
|
@@ -425,22 +425,22 @@ const qe = { class: "vsleem-bimsee" }, Ke = /* @__PURE__ */ oe({
|
|
|
425
425
|
setup(o, { expose: n, emit: v }) {
|
|
426
426
|
const s = o, d = v, r = g(), m = Ge(s, r, d), { storeRef: a, getMasker: w } = m, { getShow: M, getBindValue: C } = je(a), { maskerEvents: u } = He(w, d);
|
|
427
427
|
return n(m), (f, h) => (U(), ae("div", qe, [
|
|
428
|
-
T(M) ? (U(),
|
|
428
|
+
T(M) ? (U(), Le(Ae, Ie({
|
|
429
429
|
key: 0,
|
|
430
430
|
ref_key: "maskerElRef",
|
|
431
431
|
ref: r,
|
|
432
432
|
bimseeProps: s,
|
|
433
433
|
bimseeStore: T(a)
|
|
434
|
-
},
|
|
435
|
-
default:
|
|
434
|
+
}, be(T(u))), {
|
|
435
|
+
default: Fe((P) => [
|
|
436
436
|
X(f.$slots, "masker", G(j(P)), void 0, !0)
|
|
437
437
|
]),
|
|
438
438
|
_: 3
|
|
439
|
-
}, 16, ["bimseeStore"])) :
|
|
439
|
+
}, 16, ["bimseeStore"])) : _e("", !0),
|
|
440
440
|
X(f.$slots, "default", G(j(T(C))), void 0, !0)
|
|
441
441
|
]));
|
|
442
442
|
}
|
|
443
|
-
}), et = /* @__PURE__ */
|
|
443
|
+
}), et = /* @__PURE__ */ se(Ke, [["__scopeId", "data-v-03ae1278"]]);
|
|
444
444
|
export {
|
|
445
445
|
ze as BIMSEE_CONFIG,
|
|
446
446
|
et as Bimsee,
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(E,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@vsleem-realsee-viewer/shared")):typeof define=="function"&&define.amd?define(["exports","vue","@vsleem-realsee-viewer/shared"],e):(E=typeof globalThis<"u"?globalThis:E||self,e(E.BimseePlugin={},E.Vue,E.VSLeemShared))})(this,(function(E,e,h){"use strict";const x={visible:!0,defaultYaw:0,defaultPitch:0,defaultZoomLvl:30,minFov:20,maxFov:120},G={appSetting:h.APP_SETTING,masker:x,immediate:!0},{cloneDeep:K,deepMergeProps:W}=h.utils;function J(n,a,p,i){const l=e.ref(K(x)),s=e.ref(),f=e.ref(),r=e.computed(()=>l.value),P=e.computed(()=>{const{coordinateTree:t,mappedCoordinateTree:o,currentSpace:u,currentModel:d,currentPoint:m}=a.value||{};return{coordinateTree:t,mappedCoordinateTree:o,currentSpace:u,currentModel:d,currentPoint:m,cameraStatus:s.value,state:r.value}});e.watch(()=>e.unref(n)?.masker,L,{immediate:!0});function S(){c(),g(),i("ready",X(),D())}function C(){v()}function c(){const t=e.unref(p);t&&(t.addEventListener("mousedown",M),t.addEventListener("touchstart",M),window.addEventListener("mousemove",y),window.addEventListener("touchmove",y),window.addEventListener("mouseup",_),window.addEventListener("touchend",_),t.addEventListener("mouseover",k),t.addEventListener("mouseout",T),t.addEventListener("wheel",N))}function v(){const t=e.unref(p);t&&(t.removeEventListener("mousedown",M),t.removeEventListener("touchstart",M),window.removeEventListener("mousemove",y),window.removeEventListener("touchmove",y),window.removeEventListener("mouseup",_),window.removeEventListener("touchend",_),t.removeEventListener("mouseover",k),t.removeEventListener("mouseout",T),t.removeEventListener("wheel",N))}function M(t){const o=t instanceof TouchEvent?t.touches[0]:t,{defaultYaw:u=0,defaultPitch:d=0}=r.value,m=Number(u)-Number(a.value.currentPoint?.yaw||0);f.value={pageX:o.pageX,pageY:o.pageY,defaultYaw:m,defaultPitch:d},$(!0),i("mousedown",t)}function y(t){if(!f.value||!j())return;const o=t instanceof TouchEvent?t.touches[0]:t,{pageX:u,pageY:d}=o,{pageX:m,pageY:w}=f.value,{defaultYaw:I=0,defaultPitch:B=0}=f.value,R=Math.PI*.15/180;let z=(Number(I)-(u-m)*R)%(2*Math.PI),F=(Number(B)+(d-w)*R)%(2*Math.PI);F=Math.max(-Math.PI/2,Math.min(Math.PI/2,F));const O=new h.Position({yaw:z,pitch:F});q(O)}function _(){$(!1),f.value=void 0}function k(){V(!0)}function T(){V(!1)}function N(t){t.preventDefault(),t.stopPropagation();const o=Math.sign(t.deltaY)*5;if(o===0)return;const{minFov:u=0,maxFov:d=0}=r.value,{fov:m=0}=s.value||{},w=Math.min(Math.max(m+o,u),d);w!==m&&H(b.fovToZoomLevel(w))}function g(){const{defaultYaw:t=0,defaultPitch:o=0,defaultZoomLvl:u=0,referPoint:d,referCoordinate:m}=r.value,w=b.referPointToModelPoint(d,m);if(w){const I=Number(t)+(w?.yaw||0),B=new h.Position({yaw:Number(I),pitch:Number(o)}),R=b.modelPointToCameraPosition(w),z=b.maskerRotateToCameraTarget(B,R),F=b.zoomLevelToFov(u);a.value.setModelPoint(w),A({position:R,target:z,fov:F}),L({defaultYaw:t}),i("point-loaded",w)}}function D(){return r.value}function ue(){const{defaultYaw:t,defaultPitch:o}=r.value;return{yaw:t,pitch:o}}function de(){return r.value.defaultZoomLvl}function le(){return s.value?.position}function me(){return s.value?.fov}function fe(){return s.value?.target}function X(){return s.value}function pe(){return r.value?.mouseover??!1}function j(){return r.value?.mousedown??!1}function L(t){t&&W(l.value,t)}function A(t){s.value={...s.value,...t}}function V(t){L({mouseover:t})}function $(t){L({mousedown:t})}function ve(t){L({minFov:t})}function he(t){L({maxFov:t})}function we(t,o){L({referPoint:t,referCoordinate:o}),g()}function q(t){const o=s.value?.position;if(!o)return;const{yaw:u,pitch:d}=t,m=Number(a.value.currentPoint?.yaw||0)+u,w=new h.Position({yaw:Number(m),pitch:Number(d)}),I=b.maskerRotateToCameraTarget(w,o);L({defaultYaw:m,defaultPitch:d}),A({target:I}),i("position-updated",{position:t,target:I})}function H(t){const o=b.zoomLevelToFov(t);L({defaultZoomLvl:t}),A({fov:o}),i("zoom-updated",{zoomLevel:t,fov:o})}function Me(t,o){const{coordinateTree:u,currentModel:d}=a.value;if(d){const m=u?.findCsById(o?.id),w=m?.getDestRelativeMap(d);if(!w)return;const I=new h.Point(t).projection(w,m,d),{y:B=0}=I||{};return new h.Point({...I,y:-B})}}function Pe(t){return new h.Vector3(t)}function Se(t,o){const{x:u=0,y:d=0,z:m=0}=o,{yaw:w,pitch:I}=t,B=-w,R=I,z=100,F=0,O=z*Math.cos(F+B)+u,ke=z*Math.sin(F+B)+d,Te=z*Math.tan(R)+m;return new h.Vector3({x:O,y:ke,z:Te})}function ye(t){const{minFov:o=20,maxFov:u=120}=r.value,m=100-(Math.max(o,Math.min(u,t))-o)/(u-o)*100;return Math.max(0,Math.min(100,Math.round(m)))}function ge(t){const{minFov:o=20,maxFov:u=120}=r.value;let d=u+t/100*(o-u);return Math.max(o,Math.min(u,d))}const b={referPointToModelPoint:Me,modelPointToCameraPosition:Pe,maskerRotateToCameraTarget:Se,fovToZoomLevel:ye,zoomLevelToFov:ge};return{getProps:r,getBindValue:P,maskerAction:{dataHelper:b,isMouseover:pe,isMousedown:j,setState:L,setMousedown:$,setMouseover:V,setMinFov:ve,setMaxFov:he,setReferPoint:we,zoom:H,rotate:q,getState:D,getPosition:ue,getZoomLevel:de,getCameraPosition:le,getCameraTarget:fe,getCameraFov:me,getCameraStatus:X},handleReady:S,handleDestroy:C}}const Q={class:"vsleem-bimsee-masker"},ee=e.defineComponent({__name:"Masker",props:{bimseeProps:{},bimseeStore:{}},emits:["ready","click","mousedown","zoom-updated","position-updated","point-loaded"],setup(n,{expose:a,emit:p}){const i=n,l=p,s=e.ref(),f=e.computed(()=>i.bimseeProps),r=e.computed(()=>i.bimseeStore),{getProps:P,getBindValue:S,maskerAction:C,handleReady:c,handleDestroy:v}=J(f,r,s,l);return e.onMounted(c),e.onBeforeUnmount(v),a(C),(M,y)=>(e.openBlock(),e.createElementBlock("div",Q,[e.withDirectives(e.createElementVNode("div",{ref_key:"maskerElRef",ref:s,class:"bimsee-masker-full"},null,512),[[e.vShow,e.unref(P).visible]]),e.renderSlot(M.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(S))),void 0,!0)]))}}),Z=(n,a)=>{const p=n.__vccOpts||n;for(const[i,l]of a)p[i]=l;return p},te=Z(ee,[["__scopeId","data-v-ab1804ce"]]);var Y=(n=>(n[n.StoreMissParams=11e3]="StoreMissParams",n[n.StoreNoCSTree=11001]="StoreNoCSTree",n[n.StoreSelectNoBIMModel=11002]="StoreSelectNoBIMModel",n))(Y||{});function oe(n){const a=e.ref(),p=e.ref(),i=e.ref(!1),l=e.ref(!1),s=e.ref(),f=e.ref(),r=e.computed(()=>a.value?.findCsById(s.value)),P=e.computed(()=>r.value?.findParentSpace());async function S(k){const{projectId:T,modelCsId:N}=k||{};try{if(!T)throw new h.AppError(Y.StoreMissParams,"缺少必要的查询参数");i.value=!0;let g=await h.DataSource.getCoordinateTree(T);if(g=await n.value.handleResponseFn?.(g)||g,!g)throw new h.AppError(Y.StoreNoCSTree,`未查询到坐标系ID为 ${N} 的坐标系树`);const D=g.findCsById(N);a.value=g,p.value=D?.getMappedCsTree(),c({modelCsId:N}),n.value.fetchSuccess?.(g)}catch(g){console.error(g),n.value.fetchError?.(g)}finally{i.value=!1}}function C(k=!1){l.value=k}function c(k){const{modelCsId:T}=k;T&&v({id:T})}function v(k){const{id:T}=k;if(a.value?.findCsById(T)?.modelType===h.CoordinateModelType.BIMModel)s.value=T;else throw new h.AppError(Y.StoreSelectNoBIMModel,`未找到ID为 ${T} 的BIM模型坐标系`)}function M(k){f.value=k}function y(){return _.value}const _=e.computed(()=>({ready:l.value,coordinateTree:a.value,mappedCoordinateTree:p.value,currentPoint:f.value,currentSpace:P.value,currentModel:r.value,reload:S,selectModel:v,setModelPoint:M}));return{storeRef:_,getStore:y,setReady:C}}const{cloneDeep:ne,deepMergeProps:ae}=h.utils;function re(n,a,p){const i=e.ref(ne(G)),l=e.computed(()=>i.value);e.watch(()=>n,C,{immediate:!0,deep:!0});const{storeRef:s,getStore:f,setReady:r}=oe(l);e.onMounted(P);async function P(){const{appSetting:v,searchInfo:M,immediate:y,delay:_=0}=e.unref(l);v&&h.http.setRequestGlobalConfig(v),y&&M&&(await s.value?.reload(M),setTimeout(()=>{r(!0),p?.("ready")},_))}function S(){return e.unref(l)}function C(v){v&&ae(i.value,v)}function c(){return a.value}return{storeRef:s,getStore:f,getMasker:c,getState:S,setState:C}}function se(n,a,p){const i=e.computed(()=>n.value.ready&&!!n.value.currentModel),l=e.computed(()=>{const{coordinateTree:s,mappedCoordinateTree:f,currentSpace:r,currentModel:P,currentPoint:S}=n.value||{};return{coordinateTree:s,mappedCoordinateTree:f,currentSpace:r,currentModel:P,currentPoint:S}});return{getShow:i,getBindValue:l}}function ie(n,a){const p=e.ref({yaw:0,pitch:0});function i(){a("masker-ready")}function l(c){a("masker-click",c)}function s(c){a("masker-mousedown",c)}function f(c){a("masker-zoom-updated",c)}function r(c){a("masker-position-updated",c,S(c))}function P(c){a("masker-point-loaded",c)}function S(c){const{yaw:v,pitch:M}=c.position,{yaw:y,pitch:_}=e.unref(p);return p.value={yaw:v,pitch:M},{yaw:v-y,pitch:M-_}}return{maskerEvents:{ready:i,click:l,mousedown:s,zoomUpdated:f,positionUpdated:r,pointLoaded:P}}}const ce={class:"vsleem-bimsee"},U=Z(e.defineComponent({name:"Bimsee",__name:"Bimsee",props:{appSetting:{default:()=>h.APP_SETTING},bimseeSetting:{},searchInfo:{},masker:{default:()=>x},immediate:{type:Boolean,default:!0},delay:{},handleCheckedFn:{},handleResponseFn:{},fetchSuccess:{},fetchError:{}},emits:["ready","change-model","masker-ready","masker-click","masker-mousedown","masker-zoom-updated","masker-position-updated","masker-point-loaded"],setup(n,{expose:a,emit:p}){const i=n,l=p,s=e.ref(),f=re(i,s,l),{storeRef:r,getMasker:P}=f,{getShow:S,getBindValue:C}=se(r),{maskerEvents:c}=ie(P,l);return a(f),(v,M)=>(e.openBlock(),e.createElementBlock("div",ce,[e.unref(S)?(e.openBlock(),e.createBlock(te,e.mergeProps({key:0,ref_key:"maskerElRef",ref:s,bimseeProps:i,bimseeStore:e.unref(r)},e.toHandlers(e.unref(c))),{default:e.withCtx(y=>[e.renderSlot(v.$slots,"masker",e.normalizeProps(e.guardReactiveProps(y)),void 0,!0)]),_:3},16,["bimseeStore"])):e.createCommentVNode("",!0),e.renderSlot(v.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(C))),void 0,!0)]))}}),[["__scopeId","data-v-cf5278c3"]]);E.BIMSEE_CONFIG=G,E.Bimsee=U,E.BimseePlugin=U,E.MASKER_CONFIG=x,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(E,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@vsleem-realsee-viewer/shared")):typeof define=="function"&&define.amd?define(["exports","vue","@vsleem-realsee-viewer/shared"],e):(E=typeof globalThis<"u"?globalThis:E||self,e(E.BimseePlugin={},E.Vue,E.VSLeemShared))})(this,(function(E,e,w){"use strict";const x={visible:!0,defaultYaw:0,defaultPitch:0,defaultZoomLvl:30,minFov:20,maxFov:120},Z={appSetting:w.APP_SETTING,masker:x,immediate:!0},{cloneDeep:K,deepMergeProps:W}=w.utils;function J(n,a,p,i){const l=e.ref(K(x)),s=e.ref(),f=e.ref(),r=e.computed(()=>l.value),P=e.computed(()=>{const{coordinateTree:t,mappedCoordinateTree:o,currentSpace:u,currentModel:d,currentPoint:m}=a.value||{};return{coordinateTree:t,mappedCoordinateTree:o,currentSpace:u,currentModel:d,currentPoint:m,cameraStatus:s.value,state:r.value}});e.watch(()=>e.unref(n)?.masker,I,{immediate:!0});function S(){c(),g(),i("ready",X(),D())}function C(){v()}function c(){const t=e.unref(p);t&&(t.addEventListener("mousedown",M),t.addEventListener("touchstart",M),window.addEventListener("mousemove",y),window.addEventListener("touchmove",y),window.addEventListener("mouseup",_),window.addEventListener("touchend",_),t.addEventListener("mouseover",k),t.addEventListener("mouseout",T),t.addEventListener("wheel",R))}function v(){const t=e.unref(p);t&&(t.removeEventListener("mousedown",M),t.removeEventListener("touchstart",M),window.removeEventListener("mousemove",y),window.removeEventListener("touchmove",y),window.removeEventListener("mouseup",_),window.removeEventListener("touchend",_),t.removeEventListener("mouseover",k),t.removeEventListener("mouseout",T),t.removeEventListener("wheel",R))}function M(t){const o=t instanceof TouchEvent?t.touches[0]:t,{defaultYaw:u=0,defaultPitch:d=0}=r.value,m=Number(u)-Number(a.value.currentPoint?.yaw||0);f.value={pageX:o.pageX,pageY:o.pageY,defaultYaw:m,defaultPitch:d},$(!0),i("mousedown",t)}function y(t){if(!f.value||!j())return;const o=t instanceof TouchEvent?t.touches[0]:t,{pageX:u,pageY:d}=o,{pageX:m,pageY:h}=f.value,{defaultYaw:L=0,defaultPitch:B=0}=f.value,N=Math.PI*.15/180;let z=(Number(L)-(u-m)*N)%(2*Math.PI),F=(Number(B)+(d-h)*N)%(2*Math.PI);F=Math.max(-Math.PI/2,Math.min(Math.PI/2,F));const O=new w.Position({yaw:z,pitch:F});q(O)}function _(){$(!1),f.value=void 0}function k(){A(!0)}function T(){A(!1)}function R(t){t.preventDefault(),t.stopPropagation();const o=Math.sign(t.deltaY)*5;if(o===0)return;const{minFov:u=0,maxFov:d=0}=r.value,{fov:m=0}=s.value||{},h=Math.min(Math.max(m+o,u),d);h!==m&&H(b.fovToZoomLevel(h))}function g(){const{defaultYaw:t=0,defaultPitch:o=0,defaultZoomLvl:u=0,referPoint:d,referCoordinate:m}=r.value,h=b.referPointToModelPoint(d,m);if(h){const L=Number(t)+(h?.yaw||0),B=new w.Position({yaw:Number(L),pitch:Number(o)}),N=b.modelPointToCameraPosition(h),z=b.maskerRotateToCameraTarget(B,N),F=b.zoomLevelToFov(u);a.value.setModelPoint(h),V({position:N,target:z,fov:F}),I({defaultYaw:t}),i("point-loaded",h)}}function D(){return r.value}function ue(){const{defaultYaw:t,defaultPitch:o}=r.value;return{yaw:t,pitch:o}}function de(){return r.value.defaultZoomLvl}function le(){return s.value?.position}function me(){return s.value?.fov}function fe(){return s.value?.target}function X(){return s.value}function pe(){return r.value?.mouseover??!1}function j(){return r.value?.mousedown??!1}function I(t){t&&W(l.value,t)}function V(t){s.value={...s.value,...t}}function A(t){I({mouseover:t})}function $(t){I({mousedown:t})}function ve(t){I({minFov:t})}function he(t){I({maxFov:t})}function we(t,o){I({referPoint:t,referCoordinate:o}),g()}function q(t){const o=s.value?.position;if(!o)return;const{yaw:u,pitch:d}=t,m=Number(a.value.currentPoint?.yaw||0)+u,h=new w.Position({yaw:Number(m),pitch:Number(d)}),L=b.maskerRotateToCameraTarget(h,o);I({defaultYaw:m,defaultPitch:d}),V({target:L}),i("position-updated",{position:t,target:L})}function H(t){const o=b.zoomLevelToFov(t);I({defaultZoomLvl:t}),V({fov:o}),i("zoom-updated",{zoomLevel:t,fov:o})}function Me(t,o){const{coordinateTree:u,currentModel:d}=a.value;if(d){const m=u?.findCsById(o?.id),h=m?.getDestRelativeMap(d);if(!h)return;const L=new w.Point(t).projection(h,m,d),{y:B=0}=L||{};return new w.Point({...L,y:-B})}}function Pe(t){return new w.Vector3(t)}function Se(t,o){const{x:u=0,y:d=0,z:m=0}=o,{yaw:h,pitch:L}=t,B=-h,N=L,z=100,F=0,O=z*Math.cos(F+B)+u,ke=z*Math.sin(F+B)+d,Te=z*Math.tan(N)+m;return new w.Vector3({x:O,y:ke,z:Te})}function ye(t){const{minFov:o=20,maxFov:u=120}=r.value,m=100-(Math.max(o,Math.min(u,t))-o)/(u-o)*100;return Math.max(0,Math.min(100,Math.round(m)))}function ge(t){const{minFov:o=20,maxFov:u=120}=r.value;let d=u+t/100*(o-u);return Math.max(o,Math.min(u,d))}const b={referPointToModelPoint:Me,modelPointToCameraPosition:Pe,maskerRotateToCameraTarget:Se,fovToZoomLevel:ye,zoomLevelToFov:ge};return{getProps:r,getBindValue:P,maskerAction:{dataHelper:b,isMouseover:pe,isMousedown:j,setState:I,setMousedown:$,setMouseover:A,setMinFov:ve,setMaxFov:he,setReferPoint:we,zoom:H,rotate:q,getState:D,getPosition:ue,getZoomLevel:de,getCameraPosition:le,getCameraTarget:fe,getCameraFov:me,getCameraStatus:X},handleReady:S,handleDestroy:C}}const Q={class:"vsleem-bimsee-masker"},ee=e.defineComponent({__name:"Masker",props:{bimseeProps:{},bimseeStore:{}},emits:["ready","click","mousedown","zoom-updated","position-updated","point-loaded"],setup(n,{expose:a,emit:p}){const i=n,l=p,s=e.ref(),f=e.computed(()=>i.bimseeProps),r=e.computed(()=>i.bimseeStore),{getProps:P,getBindValue:S,maskerAction:C,handleReady:c,handleDestroy:v}=J(f,r,s,l);return e.onMounted(c),e.onBeforeUnmount(v),a(C),(M,y)=>(e.openBlock(),e.createElementBlock("div",Q,[e.withDirectives(e.createElementVNode("div",{ref_key:"maskerElRef",ref:s,class:"bimsee-masker-full"},null,512),[[e.vShow,e.unref(P).visible]]),e.renderSlot(M.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(S))),void 0,!0)]))}}),G=(n,a)=>{const p=n.__vccOpts||n;for(const[i,l]of a)p[i]=l;return p},te=G(ee,[["__scopeId","data-v-ab1804ce"]]);var Y=(n=>(n[n.StoreMissParams=11e3]="StoreMissParams",n[n.StoreNoCSTree=11001]="StoreNoCSTree",n[n.StoreSelectNoBIMModel=11002]="StoreSelectNoBIMModel",n))(Y||{});function oe(n){const a=e.ref(),p=e.ref(),i=e.ref(!1),l=e.ref(!1),s=e.ref(),f=e.ref(),r=e.computed(()=>a.value?.findCsById(s.value)),P=e.computed(()=>r.value?.findParentSpace());async function S(k){const{projectId:T,modelCsId:R}=k||{};try{if(!T)throw new w.AppError(Y.StoreMissParams,"缺少必要的查询参数");i.value=!0;let g=await w.DataSource.getCoordinateTree(T);if(g=await n.value.handleResponseFn?.(g)||g,!g)throw new w.AppError(Y.StoreNoCSTree,`未查询到坐标系ID为 ${R} 的坐标系树`);const D=g.findCsById(R);a.value=g,p.value=D?.getMappedCsTree(),c({modelCsId:R}),n.value.fetchSuccess?.(g)}catch(g){console.error(g),n.value.fetchError?.(g)}finally{i.value=!1}}function C(k=!1){l.value=k}function c(k){const{modelCsId:T}=k;T&&v({id:T})}function v(k){const{id:T}=k;if(a.value?.findCsById(T)?.modelType===w.CoordinateModelType.BIMModel)s.value=T;else throw new w.AppError(Y.StoreSelectNoBIMModel,`未找到ID为 ${T} 的BIM模型坐标系`)}function M(k){f.value=k}function y(){return _.value}const _=e.computed(()=>({ready:l.value,coordinateTree:a.value,mappedCoordinateTree:p.value,currentPoint:f.value,currentSpace:P.value,currentModel:r.value,reload:S,selectModel:v,setModelPoint:M}));return{storeRef:_,getStore:y,setReady:C}}const{cloneDeep:ne,deepMergeProps:ae}=w.utils;function re(n,a,p){const i=e.ref(ne(Z)),l=e.computed(()=>i.value);e.watch(()=>n,C,{immediate:!0,deep:!0});const{storeRef:s,getStore:f,setReady:r}=oe(l);e.onMounted(P);async function P(){const{appSetting:v,searchInfo:M,immediate:y,delay:_=0}=e.unref(l);v&&w.http.setRequestGlobalConfig(v),y&&M&&(await s.value?.reload(M),setTimeout(()=>{r(!0),p?.("ready")},_))}function S(){return e.unref(l)}function C(v){v&&ae(i.value,v)}function c(){return a.value}return{storeRef:s,getStore:f,getMasker:c,getState:S,setState:C}}function se(n,a,p){const i=e.computed(()=>n.value.ready&&!!n.value.currentModel),l=e.computed(()=>{const{coordinateTree:s,mappedCoordinateTree:f,currentSpace:r,currentModel:P,currentPoint:S}=n.value||{};return{coordinateTree:s,mappedCoordinateTree:f,currentSpace:r,currentModel:P,currentPoint:S}});return{getShow:i,getBindValue:l}}function ie(n,a){const p=e.ref({yaw:0,pitch:0});function i(){a("masker-ready")}function l(c){a("masker-click",c)}function s(c){a("masker-mousedown",c)}function f(c){a("masker-zoom-updated",c)}function r(c){a("masker-position-updated",c,S(c))}function P(c){a("masker-point-loaded",c)}function S(c){const{yaw:v,pitch:M}=c.position,{yaw:y,pitch:_}=e.unref(p);return p.value={yaw:v,pitch:M},{yaw:v-y,pitch:M-_}}return{maskerEvents:{ready:i,click:l,mousedown:s,zoomUpdated:f,positionUpdated:r,pointLoaded:P}}}const ce={class:"vsleem-bimsee"},U=G(e.defineComponent({name:"Bimsee",__name:"Bimsee",props:{appSetting:{},searchInfo:{},bimseeSetting:{},masker:{default:()=>x},immediate:{type:Boolean,default:!0},delay:{},handleCheckModelFn:{},handleResponseFn:{},fetchSuccess:{},fetchError:{}},emits:["ready","change-model","masker-ready","masker-click","masker-mousedown","masker-zoom-updated","masker-position-updated","masker-point-loaded"],setup(n,{expose:a,emit:p}){const i=n,l=p,s=e.ref(),f=re(i,s,l),{storeRef:r,getMasker:P}=f,{getShow:S,getBindValue:C}=se(r),{maskerEvents:c}=ie(P,l);return a(f),(v,M)=>(e.openBlock(),e.createElementBlock("div",ce,[e.unref(S)?(e.openBlock(),e.createBlock(te,e.mergeProps({key:0,ref_key:"maskerElRef",ref:s,bimseeProps:i,bimseeStore:e.unref(r)},e.toHandlers(e.unref(c))),{default:e.withCtx(y=>[e.renderSlot(v.$slots,"masker",e.normalizeProps(e.guardReactiveProps(y)),void 0,!0)]),_:3},16,["bimseeStore"])):e.createCommentVNode("",!0),e.renderSlot(v.$slots,"default",e.normalizeProps(e.guardReactiveProps(e.unref(C))),void 0,!0)]))}}),[["__scopeId","data-v-03ae1278"]]);E.BIMSEE_CONFIG=Z,E.Bimsee=U,E.BimseePlugin=U,E.MASKER_CONFIG=x,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/settings/index.d.ts
CHANGED
package/dist/types/bimsee.d.ts
CHANGED
|
@@ -8,13 +8,13 @@ export type SearchInfo = {
|
|
|
8
8
|
};
|
|
9
9
|
export type BimseeSetting = {};
|
|
10
10
|
export type BimseeProps = {
|
|
11
|
-
appSetting
|
|
11
|
+
appSetting: AppSetting;
|
|
12
|
+
searchInfo: SearchInfo;
|
|
12
13
|
bimseeSetting?: BimseeSetting;
|
|
13
|
-
searchInfo?: SearchInfo;
|
|
14
14
|
masker?: MaskerProps;
|
|
15
15
|
immediate?: boolean;
|
|
16
16
|
delay?: number;
|
|
17
|
-
|
|
17
|
+
handleCheckModelFn: (res?: Coordinate) => Promise<boolean>;
|
|
18
18
|
handleResponseFn?: (res?: Coordinate) => Promise<Coordinate | undefined>;
|
|
19
19
|
fetchSuccess?: (coordinate?: Coordinate) => void;
|
|
20
20
|
fetchError?: (error: any) => void;
|
package/dist/types/masker.d.ts
CHANGED
|
@@ -32,8 +32,8 @@ export type DataHelper = {
|
|
|
32
32
|
};
|
|
33
33
|
export type MaskerElement = {
|
|
34
34
|
dataHelper: DataHelper;
|
|
35
|
-
isMouseover()
|
|
36
|
-
isMousedown()
|
|
35
|
+
isMouseover: () => boolean;
|
|
36
|
+
isMousedown: () => boolean;
|
|
37
37
|
setState: (options?: Partial<MaskerProps>) => void;
|
|
38
38
|
setMousedown: (mousedown: boolean) => void;
|
|
39
39
|
setMouseover: (mouseover: boolean) => void;
|
|
@@ -42,11 +42,11 @@ export type MaskerElement = {
|
|
|
42
42
|
setReferPoint: (point: Point, coordinate: Partial<Coordinate>) => void;
|
|
43
43
|
zoom: (level: number) => void;
|
|
44
44
|
rotate: (position: Position) => void;
|
|
45
|
-
getState
|
|
46
|
-
getPosition
|
|
47
|
-
getZoomLevel
|
|
45
|
+
getState: () => MaskerProps;
|
|
46
|
+
getPosition: () => Position;
|
|
47
|
+
getZoomLevel: () => number;
|
|
48
48
|
getCameraPosition: () => Vector3 | undefined;
|
|
49
49
|
getCameraTarget: () => Vector3 | undefined;
|
|
50
50
|
getCameraFov: () => number | undefined;
|
|
51
|
-
getCameraStatus
|
|
51
|
+
getCameraStatus: () => CameraStatus | undefined;
|
|
52
52
|
};
|
package/dist/types/store.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vsleem-realsee-viewer/bimsee-plugin",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Bimsee plugin for VSLeem RealSee Viewer",
|
|
5
5
|
"main": "./dist/index.umd.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"dist"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@vsleem-realsee-viewer/shared": "2.0.
|
|
16
|
+
"@vsleem-realsee-viewer/shared": "2.0.7"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"vue": "^3.0.0",
|
|
20
|
-
"@vsleem-realsee-viewer/shared": "2.0.
|
|
20
|
+
"@vsleem-realsee-viewer/shared": "2.0.7"
|
|
21
21
|
},
|
|
22
22
|
"peerDependenciesMeta": {
|
|
23
23
|
"vue": {
|