@xtctwins/tctwins-core 1.1.11 → 1.1.13
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/dist/tctwins-core.es5.js +1772 -2166
- package/dist/tctwins-core.min.es5.js +4 -4
- package/package.json +10 -6
- package/types/plugins/SectionPlanesPlugin/SectionBoxControl.d.ts +36 -0
- package/types/plugins/SectionPlanesPlugin/SectionPlanesPlugin.d.ts +14 -14
- package/types/plugins/SectionPlanesPlugin/index.d.ts +1 -0
- package/types/viewer/scene/sectionPlane/SectionPlane.d.ts +14 -0
- package/types/viewer/scene/utils.d.ts +165 -165
- package/dist/tctwins-core.umd.js +0 -37
- package/types/viewer/scene/sectionBox/SectionBox.d.ts +0 -41
- package/types/viewer/scene/sectionBox/index.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xtctwins/tctwins-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Web Programming Toolkit for 3D/2D BIM and CAD",
|
|
6
6
|
"module": "./dist/tctwins-core.es5.js",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"build": "rollup --config rollup.config.js && rollup --config rollup.minified.config.js",
|
|
11
11
|
"dev": "webpack --config webpack.min.config.js",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
12
|
+
"serve": "vite --open --mode dev",
|
|
13
|
+
"pub": "npm publish",
|
|
14
|
+
"release": "npm version patch && npm publish --access public"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|
|
17
17
|
"webgl",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"3d-viewer"
|
|
39
39
|
],
|
|
40
40
|
"author": "Shao Xiang",
|
|
41
|
-
"license": "",
|
|
41
|
+
"license": "MIT",
|
|
42
42
|
"homepage": "https://tctwins.com",
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@babel/cli": "^7.24.7",
|
|
@@ -74,5 +74,9 @@
|
|
|
74
74
|
"files": [
|
|
75
75
|
"/dist",
|
|
76
76
|
"/types"
|
|
77
|
-
]
|
|
77
|
+
],
|
|
78
|
+
"publishConfig": {
|
|
79
|
+
"registry": "https://registry.npmjs.org/",
|
|
80
|
+
"access": "public"
|
|
81
|
+
}
|
|
78
82
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Component } from "../../viewer/scene/Component";
|
|
2
|
+
|
|
3
|
+
export type SectionBoxConfiguration = {
|
|
4
|
+
/** 场景内唯一 ID;省略时自动生成。 */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** 世界坐标范围,省略时自动适配模型。 */
|
|
7
|
+
aabb?: number[] | Float64Array;
|
|
8
|
+
/** 是否启用裁剪和交互,默认 true。 */
|
|
9
|
+
active?: boolean;
|
|
10
|
+
/** 是否显示控制器,默认 true;隐藏不停止裁剪。 */
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
/** 最小间距,默认模型最大边长的 1%。 */
|
|
13
|
+
minSize?: number | number[] | Float64Array;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 通过 SectionPlanesPlugin 创建;不需要额外 DOM 元素。
|
|
18
|
+
*
|
|
19
|
+
* 未手动调整前会自动跟随模型集合(多个模型取并集);一旦调用 `setAABB()` 或拖动盒面,
|
|
20
|
+
* 就切换为手动模式,不再自动重新适配,直到再次调用 `fitToScene()`。
|
|
21
|
+
*/
|
|
22
|
+
export declare class SectionBoxControl extends Component {
|
|
23
|
+
readonly mode: "inside" | "outside";
|
|
24
|
+
readonly aabb: number[] | null;
|
|
25
|
+
readonly minSize: number[] | null;
|
|
26
|
+
active: boolean;
|
|
27
|
+
visible: boolean;
|
|
28
|
+
/** 原子更新范围;非法范围抛出异常。切换到手动模式。 */
|
|
29
|
+
setAABB(aabb: number[] | Float64Array): void;
|
|
30
|
+
/** 恢复初始范围或最后一次适配范围;不改变自动跟随状态。 */
|
|
31
|
+
reset(): void;
|
|
32
|
+
/** 重新适配模型集合(多个模型取并集),并恢复自动跟随;无有效模型时返回 false。 */
|
|
33
|
+
fitToScene(): boolean;
|
|
34
|
+
/** 释放控制器及其拥有的六个剖切面。 */
|
|
35
|
+
destroy(): void;
|
|
36
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin, Viewer } from "../../viewer";
|
|
2
2
|
import { SectionPlane } from "../../viewer/scene/sectionPlane";
|
|
3
|
-
import {
|
|
3
|
+
import { SectionBoxControl, SectionBoxConfiguration } from "./SectionBoxControl";
|
|
4
4
|
|
|
5
5
|
export declare type SectionPlanesPluginConfiguration = {
|
|
6
6
|
/** Optional ID for this plugin, so that we can find it within {@link Viewer.plugins}. */
|
|
@@ -57,7 +57,13 @@ export declare class SectionPlanesPlugin extends Plugin {
|
|
|
57
57
|
*/
|
|
58
58
|
createSectionPlane(params?: { id?: string; pos?: number[]; dir?: number[]; active?: boolean }): SectionPlane;
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
/** 创建六面独立伸缩、保留盒内模型的剖切盒。 */
|
|
61
|
+
createClippingBox(params?: SectionBoxConfiguration): SectionBoxControl;
|
|
62
|
+
|
|
63
|
+
/** 创建固定尺寸整体平移、保留盒外模型的箱框。 */
|
|
64
|
+
createBoxFrame(params?: SectionBoxConfiguration): SectionBoxControl;
|
|
65
|
+
|
|
66
|
+
readonly clippingBox: SectionBoxControl | null;
|
|
61
67
|
|
|
62
68
|
/**
|
|
63
69
|
* 设置是否是触屏模式
|
|
@@ -67,6 +73,12 @@ export declare class SectionPlanesPlugin extends Plugin {
|
|
|
67
73
|
|
|
68
74
|
/**
|
|
69
75
|
* 设置剖切方式
|
|
76
|
+
*
|
|
77
|
+
* - `"plane"`:使用带边框的单面剖切控制器。
|
|
78
|
+
* - 其它值(含 `"control"`):使用默认单面剖切控制器。
|
|
79
|
+
*
|
|
80
|
+
* 旧的剖切盒取值 `"box"` / `"singleCtrl"` 已移除,剖切盒请使用 `createClippingBox()`。
|
|
81
|
+
*
|
|
70
82
|
* @param {string} way
|
|
71
83
|
*/
|
|
72
84
|
set sectionWay(way: string);
|
|
@@ -88,18 +100,6 @@ export declare class SectionPlanesPlugin extends Plugin {
|
|
|
88
100
|
*/
|
|
89
101
|
set sectionConfigs(cfg: any);
|
|
90
102
|
|
|
91
|
-
/**
|
|
92
|
-
* 设置剖切盒平面样式
|
|
93
|
-
* @param {any} cfg
|
|
94
|
-
* @param {number} cfg.planeSize?
|
|
95
|
-
* @param {number[]} cfg.controlSize?
|
|
96
|
-
* @param {number[]} cfg.planeOpacity?
|
|
97
|
-
* @param {number} cfg.controlFillColor?
|
|
98
|
-
*/
|
|
99
|
-
set boxPlaneConfigs(cfg: any);
|
|
100
|
-
|
|
101
|
-
get controlBox(): SectionBox;
|
|
102
|
-
|
|
103
103
|
/**
|
|
104
104
|
* 设置剖切面位置
|
|
105
105
|
* @param pos
|
|
@@ -9,6 +9,12 @@ export declare type SectionPlaneConfiguration = {
|
|
|
9
9
|
pos?: number[];
|
|
10
10
|
/** Vector perpendicular to the plane surface, indicating the SectionPlane plane orientation. */
|
|
11
11
|
dir?: number[];
|
|
12
|
+
/**
|
|
13
|
+
* 内部盒体分组标记。同一个分组对象下的六个平面按整体盒体规则裁剪:
|
|
14
|
+
* `mode` 为 `"inside"` 时只保留盒内片元,为 `"outside"` 时只保留盒外片元。
|
|
15
|
+
* 普通单面剖切不设置该字段。
|
|
16
|
+
*/
|
|
17
|
+
clipGroup?: { mode: "inside" | "outside" } | null;
|
|
12
18
|
};
|
|
13
19
|
|
|
14
20
|
/**
|
|
@@ -22,6 +28,14 @@ export declare class SectionPlane extends Component {
|
|
|
22
28
|
*/
|
|
23
29
|
constructor(owner?: Component, cfg?: SectionPlaneConfiguration);
|
|
24
30
|
|
|
31
|
+
/**
|
|
32
|
+
* 内部盒体分组标记,普通单面剖切为 `null`。
|
|
33
|
+
*
|
|
34
|
+
* 由 {@link SectionPlanesPlugin#createClippingBox} / {@link SectionPlanesPlugin#createBoxFrame}
|
|
35
|
+
* 创建的六个平面共享同一个分组对象。
|
|
36
|
+
*/
|
|
37
|
+
readonly clipGroup: { mode: "inside" | "outside" } | null;
|
|
38
|
+
|
|
25
39
|
/**
|
|
26
40
|
* Sets if this SectionPlane is active or not.
|
|
27
41
|
*
|
|
@@ -1,166 +1,166 @@
|
|
|
1
|
-
|
|
2
|
-
interface JsonNode {
|
|
3
|
-
type: string;
|
|
4
|
-
children: JsonNode[];
|
|
5
|
-
[key: string]: string | JsonNode[] | undefined;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface HttpRequestArgs {
|
|
9
|
-
method?: string;
|
|
10
|
-
url: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export declare const utils: {
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
xmlToJson: (node: any, attributeRenamer: Record<string, string>) => JsonNode | string | undefined;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
clone: (ob: any) => any;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
compressGuid: (g: string) => string;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
findNodeOfType: (m: any, t: string) => any;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
timeout: (dt: number) => Promise<void>;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
httpRequest: (args: HttpRequestArgs) => Promise<Document>;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
loadJSON: (url: string, ok?: Function, err?: Function) => void;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
*/
|
|
52
|
-
loadArraybuffer: (url: string, ok?: Function, err?: Function) => void;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
queryString: () => Record<string, string | string[]>;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
Tests if the given object is an array
|
|
61
|
-
@private
|
|
62
|
-
*/
|
|
63
|
-
isArray: (value: any) => boolean;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
Tests if the given value is a string
|
|
67
|
-
@param value
|
|
68
|
-
@returns {Boolean}
|
|
69
|
-
@private
|
|
70
|
-
*/
|
|
71
|
-
isString: (value: any) => boolean;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
Tests if the given value is a number
|
|
75
|
-
@param value
|
|
76
|
-
@returns {Boolean}
|
|
77
|
-
@private
|
|
78
|
-
*/
|
|
79
|
-
isNumeric: (value: any) => boolean;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
Tests if the given value is an ID
|
|
83
|
-
@param value
|
|
84
|
-
@returns {Boolean}
|
|
85
|
-
@private
|
|
86
|
-
*/
|
|
87
|
-
isID: (value: any) => boolean;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
Tests if the given components are the same, where the components can be either IDs or instances.
|
|
91
|
-
@param c1
|
|
92
|
-
@param c2
|
|
93
|
-
@returns {Boolean}
|
|
94
|
-
@private
|
|
95
|
-
*/
|
|
96
|
-
isSameComponent: (c1: any, c2: any) => boolean;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
Tests if the given value is a function
|
|
100
|
-
@param value
|
|
101
|
-
@returns {Boolean}
|
|
102
|
-
@private
|
|
103
|
-
*/
|
|
104
|
-
isFunction: (value: any) => boolean;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
Tests if the given value is a JavaScript JSON object, eg, ````{ foo: "bar" }````.
|
|
108
|
-
@param value
|
|
109
|
-
@returns {Boolean}
|
|
110
|
-
@private
|
|
111
|
-
*/
|
|
112
|
-
isObject: (value: any) => boolean;
|
|
113
|
-
|
|
114
|
-
/** Returns a shallow copy
|
|
115
|
-
*/
|
|
116
|
-
copy: (o: any) => any;
|
|
117
|
-
|
|
118
|
-
/** Add properties of o to o2, overwriting them on o2 if already there
|
|
119
|
-
*/
|
|
120
|
-
apply: (o: any, o2: any) => any;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
Add non-null/defined properties of o to o2
|
|
124
|
-
@private
|
|
125
|
-
*/
|
|
126
|
-
apply2: (o: any, o2: any) => any;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
Add properties of o to o2 where undefined or null on o2
|
|
130
|
-
@private
|
|
131
|
-
*/
|
|
132
|
-
applyIf: (o: any, o2: any) => any;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
Returns true if the given map is empty.
|
|
136
|
-
@param obj
|
|
137
|
-
@returns {Boolean}
|
|
138
|
-
@private
|
|
139
|
-
*/
|
|
140
|
-
isEmptyObject: (obj: any) => boolean;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
Returns the given ID as a string, in quotes if the ID was a string to begin with.
|
|
144
|
-
|
|
145
|
-
This is useful for logging IDs.
|
|
146
|
-
|
|
147
|
-
@param {Number| String} id The ID
|
|
148
|
-
@returns {String}
|
|
149
|
-
@private
|
|
150
|
-
*/
|
|
151
|
-
inQuotes: (id: number | string) => string;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
Returns the concatenation of two typed arrays.
|
|
155
|
-
@param a
|
|
156
|
-
@param b
|
|
157
|
-
@returns {*|a}
|
|
158
|
-
@private
|
|
159
|
-
*/
|
|
160
|
-
concat: (a: any, b: any) => any;
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
*
|
|
164
|
-
*/
|
|
165
|
-
flattenParentChildHierarchy: (root: JsonNode) => JsonNode[];
|
|
1
|
+
|
|
2
|
+
interface JsonNode {
|
|
3
|
+
type: string;
|
|
4
|
+
children: JsonNode[];
|
|
5
|
+
[key: string]: string | JsonNode[] | undefined;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface HttpRequestArgs {
|
|
9
|
+
method?: string;
|
|
10
|
+
url: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export declare const utils: {
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
xmlToJson: (node: any, attributeRenamer: Record<string, string>) => JsonNode | string | undefined;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
clone: (ob: any) => any;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
compressGuid: (g: string) => string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
findNodeOfType: (m: any, t: string) => any;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
timeout: (dt: number) => Promise<void>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
httpRequest: (args: HttpRequestArgs) => Promise<Document>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
loadJSON: (url: string, ok?: Function, err?: Function) => void;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
loadArraybuffer: (url: string, ok?: Function, err?: Function) => void;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
queryString: () => Record<string, string | string[]>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
Tests if the given object is an array
|
|
61
|
+
@private
|
|
62
|
+
*/
|
|
63
|
+
isArray: (value: any) => boolean;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
Tests if the given value is a string
|
|
67
|
+
@param value
|
|
68
|
+
@returns {Boolean}
|
|
69
|
+
@private
|
|
70
|
+
*/
|
|
71
|
+
isString: (value: any) => boolean;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
Tests if the given value is a number
|
|
75
|
+
@param value
|
|
76
|
+
@returns {Boolean}
|
|
77
|
+
@private
|
|
78
|
+
*/
|
|
79
|
+
isNumeric: (value: any) => boolean;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
Tests if the given value is an ID
|
|
83
|
+
@param value
|
|
84
|
+
@returns {Boolean}
|
|
85
|
+
@private
|
|
86
|
+
*/
|
|
87
|
+
isID: (value: any) => boolean;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
Tests if the given components are the same, where the components can be either IDs or instances.
|
|
91
|
+
@param c1
|
|
92
|
+
@param c2
|
|
93
|
+
@returns {Boolean}
|
|
94
|
+
@private
|
|
95
|
+
*/
|
|
96
|
+
isSameComponent: (c1: any, c2: any) => boolean;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
Tests if the given value is a function
|
|
100
|
+
@param value
|
|
101
|
+
@returns {Boolean}
|
|
102
|
+
@private
|
|
103
|
+
*/
|
|
104
|
+
isFunction: (value: any) => boolean;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
Tests if the given value is a JavaScript JSON object, eg, ````{ foo: "bar" }````.
|
|
108
|
+
@param value
|
|
109
|
+
@returns {Boolean}
|
|
110
|
+
@private
|
|
111
|
+
*/
|
|
112
|
+
isObject: (value: any) => boolean;
|
|
113
|
+
|
|
114
|
+
/** Returns a shallow copy
|
|
115
|
+
*/
|
|
116
|
+
copy: (o: any) => any;
|
|
117
|
+
|
|
118
|
+
/** Add properties of o to o2, overwriting them on o2 if already there
|
|
119
|
+
*/
|
|
120
|
+
apply: (o: any, o2: any) => any;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
Add non-null/defined properties of o to o2
|
|
124
|
+
@private
|
|
125
|
+
*/
|
|
126
|
+
apply2: (o: any, o2: any) => any;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
Add properties of o to o2 where undefined or null on o2
|
|
130
|
+
@private
|
|
131
|
+
*/
|
|
132
|
+
applyIf: (o: any, o2: any) => any;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
Returns true if the given map is empty.
|
|
136
|
+
@param obj
|
|
137
|
+
@returns {Boolean}
|
|
138
|
+
@private
|
|
139
|
+
*/
|
|
140
|
+
isEmptyObject: (obj: any) => boolean;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
Returns the given ID as a string, in quotes if the ID was a string to begin with.
|
|
144
|
+
|
|
145
|
+
This is useful for logging IDs.
|
|
146
|
+
|
|
147
|
+
@param {Number| String} id The ID
|
|
148
|
+
@returns {String}
|
|
149
|
+
@private
|
|
150
|
+
*/
|
|
151
|
+
inQuotes: (id: number | string) => string;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
Returns the concatenation of two typed arrays.
|
|
155
|
+
@param a
|
|
156
|
+
@param b
|
|
157
|
+
@returns {*|a}
|
|
158
|
+
@private
|
|
159
|
+
*/
|
|
160
|
+
concat: (a: any, b: any) => any;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
*
|
|
164
|
+
*/
|
|
165
|
+
flattenParentChildHierarchy: (root: JsonNode) => JsonNode[];
|
|
166
166
|
}
|