gs-bim-air 0.1.3-0.37 → 0.1.3-0.38

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.
@@ -8,6 +8,7 @@ module.exports = {
8
8
  lineNumbers: true,
9
9
  },
10
10
  dest: "public/docsHtml",
11
+ home: "/快速上手/",
11
12
  themeConfig: {
12
13
  sidebarDepth: 2,
13
14
  smoothScroll: true,
@@ -22,7 +23,7 @@ module.exports = {
22
23
  sidebar: [
23
24
  {
24
25
  title: "简介",
25
- collapsable: true,
26
+ collapsable: false,
26
27
  children: ["/简介.md"],
27
28
  },
28
29
  {
@@ -66,7 +67,6 @@ module.exports = {
66
67
  },
67
68
  ],
68
69
  },
69
-
70
70
  {
71
71
  title: "BimAir文档",
72
72
  collapsable: false,
@@ -40,6 +40,7 @@
40
40
  - [customBlinnPhong](Longan.BaseShader.md#customblinnphong)
41
41
  - [customEdgeFragment](Longan.BaseShader.md#customedgefragment)
42
42
  - [customTextureSampling](Longan.BaseShader.md#customtexturesampling)
43
+ - [customVertexPos](Longan.BaseShader.md#customvertexpos)
43
44
  - [fragment](Longan.BaseShader.md#fragment)
44
45
  - [fragmentIn](Longan.BaseShader.md#fragmentin)
45
46
  - [fragmentMain](Longan.BaseShader.md#fragmentmain)
@@ -54,6 +55,7 @@
54
55
  - [vertexMain](Longan.BaseShader.md#vertexmain)
55
56
  - [vertexOut](Longan.BaseShader.md#vertexout)
56
57
  - [vertexUniform](Longan.BaseShader.md#vertexuniform)
58
+ - [vertexVoid](Longan.BaseShader.md#vertexvoid)
57
59
 
58
60
  ### Methods
59
61
 
@@ -83,9 +85,9 @@
83
85
 
84
86
  ### \_fragment
85
87
 
86
- • **\_fragment**: `string`
88
+ • **\_fragment**: `string` = `null`
87
89
 
88
- #### Overrides
90
+ #### Inherited from
89
91
 
90
92
  [Shader](Longan.Shader.md).[_fragment](Longan.Shader.md#_fragment)
91
93
 
@@ -143,9 +145,9 @@ ___
143
145
 
144
146
  ### \_vertex
145
147
 
146
- • **\_vertex**: `string`
148
+ • **\_vertex**: `string` = `null`
147
149
 
148
- #### Overrides
150
+ #### Inherited from
149
151
 
150
152
  [Shader](Longan.Shader.md).[_vertex](Longan.Shader.md#_vertex)
151
153
 
@@ -239,6 +241,16 @@ ___
239
241
 
240
242
  ___
241
243
 
244
+ ### customVertexPos
245
+
246
+ • `get` **customVertexPos**(): `string`
247
+
248
+ #### Returns
249
+
250
+ `string`
251
+
252
+ ___
253
+
242
254
  ### fragment
243
255
 
244
256
  • `get` **fragment**(): `string`
@@ -247,7 +259,7 @@ ___
247
259
 
248
260
  `string`
249
261
 
250
- #### Inherited from
262
+ #### Overrides
251
263
 
252
264
  Shader.fragment
253
265
 
@@ -403,7 +415,7 @@ ___
403
415
 
404
416
  `string`
405
417
 
406
- #### Inherited from
418
+ #### Overrides
407
419
 
408
420
  Shader.vertex
409
421
 
@@ -437,6 +449,16 @@ ___
437
449
 
438
450
  `string`
439
451
 
452
+ ___
453
+
454
+ ### vertexVoid
455
+
456
+ • `get` **vertexVoid**(): `string`
457
+
458
+ #### Returns
459
+
460
+ `string`
461
+
440
462
  ## Methods
441
463
 
442
464
  ### finaComponent
@@ -99,6 +99,7 @@
99
99
  - [sceneKey](Longan.Viewer.md#scenekey)
100
100
  - [sceneSegment](Longan.Viewer.md#scenesegment)
101
101
  - [screenSegment](Longan.Viewer.md#screensegment)
102
+ - [selectDistanceTolerance](Longan.Viewer.md#selectdistancetolerance)
102
103
  - [selectionManager](Longan.Viewer.md#selectionmanager)
103
104
  - [selectionTolerance](Longan.Viewer.md#selectiontolerance)
104
105
  - [smoothTransition](Longan.Viewer.md#smoothtransition)
@@ -1211,6 +1212,28 @@ ___
1211
1212
 
1212
1213
  ___
1213
1214
 
1215
+ ### selectDistanceTolerance
1216
+
1217
+ • `get` **selectDistanceTolerance**(): `number`
1218
+
1219
+ #### Returns
1220
+
1221
+ `number`
1222
+
1223
+ • `set` **selectDistanceTolerance**(`selectDistanceTolerance`): `void`
1224
+
1225
+ #### Parameters
1226
+
1227
+ | Name | Type |
1228
+ | :------ | :------ |
1229
+ | `selectDistanceTolerance` | `number` |
1230
+
1231
+ #### Returns
1232
+
1233
+ `void`
1234
+
1235
+ ___
1236
+
1214
1237
  ### selectionManager
1215
1238
 
1216
1239
  • `get` **selectionManager**(): [`SelectionManager`](Longan.SelectionManager.md)
@@ -109,6 +109,7 @@
109
109
  - [sceneKey](Viewer.md#scenekey)
110
110
  - [sceneSegment](Viewer.md#scenesegment)
111
111
  - [screenSegment](Viewer.md#screensegment)
112
+ - [selectDistanceTolerance](Viewer.md#selectdistancetolerance)
112
113
  - [selectionManager](Viewer.md#selectionmanager)
113
114
  - [selectionTolerance](Viewer.md#selectiontolerance)
114
115
  - [smoothTransition](Viewer.md#smoothtransition)
@@ -1565,6 +1566,36 @@ LonganViewer.screenSegment
1565
1566
 
1566
1567
  ___
1567
1568
 
1569
+ ### selectDistanceTolerance
1570
+
1571
+ • `get` **selectDistanceTolerance**(): `number`
1572
+
1573
+ #### Returns
1574
+
1575
+ `number`
1576
+
1577
+ #### Inherited from
1578
+
1579
+ LonganViewer.selectDistanceTolerance
1580
+
1581
+ • `set` **selectDistanceTolerance**(`selectDistanceTolerance`): `void`
1582
+
1583
+ #### Parameters
1584
+
1585
+ | Name | Type |
1586
+ | :------ | :------ |
1587
+ | `selectDistanceTolerance` | `number` |
1588
+
1589
+ #### Returns
1590
+
1591
+ `void`
1592
+
1593
+ #### Inherited from
1594
+
1595
+ LonganViewer.selectDistanceTolerance
1596
+
1597
+ ___
1598
+
1568
1599
  ### selectionManager
1569
1600
 
1570
1601
  • `get` **selectionManager**(): [`SelectionManager`](SelectionManager.md)
@@ -1,35 +1,45 @@
1
- # 快速上手
1
+ # 加载显示模型
2
2
 
3
- ## 安装
3
+ 要显示一个模型首先需要先加载 BimAir 的全部依赖,调用 `BimAir.Loader()` 加载 Longan 内核的和其他必要的文件,在 `BimAir.Loader()` 返回的 Promise 内创建一个 `BimAir.Viewer` 来作为承载模型的容器,最后执行 `viewer.loadModels()` 请求加载模型
4
4
 
5
- ### NPM
5
+ ## 加载依赖
6
6
 
7
+ ```js
8
+ BimAir.Loader({
9
+ isShareArrayBuffer: false, // 配置是否开启SharedArrayBuffer,若关闭,viewer.isUpdateTt 需要同步设 false
10
+ url: "https://static.graphicstone.com/bimAir", // url 是 longan依赖文件路径前缀,若文件已放到 /public/js 则不需要设置,函数内部拼成的完整url实际是 https://static.graphicstone.com/bimAir/js/longan/longan.js
11
+ isInitDataBase: false, //通常我们会在创建 Viewer 的时候执行 InitDataBase 初始化图形数据库,如果你不需要创建 Viewer 而想要直接管理数据,可提前 InitDataBase
12
+ });
7
13
  ```
8
- # 最新稳定版
9
- $ npm install gs-bim-air
14
+
15
+ 完整配置可查看[Options](./配置/LoaderOptions.md)
16
+
17
+ ## 创建 Viewer 容器
18
+
19
+ 三维模型需要显示在一个容器上,Viewer 就是一个通过 id 与 html 元素绑定的容器。
20
+
21
+ ```js
22
+ let options = {
23
+ elementId: "viewer", //与html元素的id一致
24
+ modelService: "https://static.graphicstone.com/modelApi", //模型加载的后台服务
25
+ fileService: "https://static.graphicstone.com/fileApi", //文件管理的后台服务
26
+ };
27
+ let viewer = new BimAir.Viewer(options);
10
28
  ```
11
29
 
12
- #### 添加静态资源
30
+ 完整配置可查看[Options](./配置/Options.md)
31
+
32
+ ## 加载模型
13
33
 
14
- gs-bim-air 安装包里的 public 文件夹复制 js 文件夹到 Vue 项目的静态资源目录(通常为 public 目录),复制后路径为:
34
+ 创建完 viewer 后需要通过 loadModels 加载模型,需要传入模型 id 和模型版本,版本可不传,默认为当前版本
15
35
 
16
- > public\js\fonts\微软雅黑.ttf
17
- >
18
- > public\js\longan\longan.js
19
- > public\js\longan\longan.wasm
20
- > public\js\longan\longan.worker.js
21
- >
22
- > public\js\longanWithoutShareArrayBuffer\longan.js
23
- > public\js\longanWithoutShareArrayBuffer\longan.wasm
24
- >
25
- > public\js\lzma\lzma.js
26
- > public\js\lzma\lzma.shim.js
27
- > public\js\lzma\lzmap.js
28
- > public\js\lzma\pwlzma.js
29
- > public\js\lzma\wlzma.js
30
- > public\js\lzma\wlzma.wrk.js
36
+ ```js
37
+ viewer.loadModels([{ id: "6253e9d6b0545a0a6e49bf85", version: 0 }], true, true);
38
+ ```
31
39
 
32
- #### vue 用法
40
+ 完整接口可查看[Viewer.loadModels](./classes/Viewer.md#loadmodels)
41
+
42
+ #### 完整例子
33
43
 
34
44
  ```html
35
45
  <template>
@@ -81,59 +91,3 @@ $ npm install gs-bim-air
81
91
  }
82
92
  </style>
83
93
  ```
84
-
85
- ### 直接用 &lt;script&gt; 引入
86
-
87
- ```html
88
- <!DOCTYPE html>
89
- <html>
90
- <head>
91
- <meta charset="UTF-8" />
92
- <title>引入BimAir</title>
93
- <link
94
- rel="stylesheet"
95
- href="https://static.graphicstone.com/bimAir/BimAir.css"
96
- />
97
- <script src="https://static.graphicstone.com/vue.min.js"></script>
98
- <script src="https://static.graphicstone.com/bimAir/BimAir.umd.min.js"></script>
99
- </head>
100
-
101
- <body>
102
- <style>
103
- body {
104
- margin: 0;
105
- padding: 0;
106
- height: 100vh;
107
- }
108
-
109
- #app {
110
- height: 100vh;
111
- position: relative;
112
- }
113
- </style>
114
- <div id="app">
115
- <viewer-wrapper elementId="viewer" style="height: 100%; width: 100%" />
116
- </div>
117
-
118
- <script type="text/javascript">
119
- new Vue({
120
- el: "#app",
121
- });
122
-
123
- let options = {
124
- elementId: "viewer",
125
- modelService: "https://static.graphicstone.com/modelApi",
126
- fileService: "https://static.graphicstone.com/fileApi",
127
- };
128
- BimAir.Loader({ url: "https://static.graphicstone.com/bimAir" }).then(
129
- () => {
130
- let viewer = new BimAir.Viewer(options);
131
- let modelId = "624fff10aba44c07ef4b184e";
132
- viewer.loadModels(["624fff10aba44c07ef4b184e"]);
133
- viewer.fitWorld();
134
- }
135
- );
136
- </script>
137
- </body>
138
- </html>
139
- ```
@@ -3,121 +3,137 @@
3
3
  ## 安装
4
4
 
5
5
  ### NPM
6
+
6
7
  ```
7
8
  # 最新稳定版
8
9
  $ npm install gs-bim-air
9
10
  ```
10
11
 
11
12
  #### 添加静态资源
12
- 从gs-bim-air安装包里复的public文件夹复制js文件夹到Vue项目的静态资源目录(通常为public目录),复制后路径为:
13
13
 
14
- > public\js\lzma\lzma.js
14
+ gs-bim-air 安装包里复的 public 文件夹复制 js 文件夹到 Vue 项目的静态资源目录(通常为 public 目录),复制后路径为:
15
15
 
16
+ > public\js\fonts\微软雅黑.ttf
17
+ >
18
+ > public\js\longan\longan.js
19
+ > public\js\longan\longan.wasm
20
+ > public\js\longan\longan.worker.js
21
+ >
16
22
  > public\js\longanWithoutShareArrayBuffer\longan.js
17
23
  > public\js\longanWithoutShareArrayBuffer\longan.wasm
24
+ >
25
+ > public\js\lzma\lzma.js
26
+ > public\js\lzma\lzma.shim.js
27
+ > public\js\lzma\lzmap.js
28
+ > public\js\lzma\pwlzma.js
29
+ > public\js\lzma\wlzma.js
30
+ > public\js\lzma\wlzma.wrk.js
31
+
32
+ #### vue 用法
18
33
 
19
- #### vue用法
20
34
  ```html
21
35
  <template>
22
- <div id="app">
36
+ <div id="app">
23
37
  <div id="viewerWrapper">
24
- <viewer-wrapper elementId="viewer" ></viewer-wrapper>
38
+ <viewer-wrapper elementId="viewer"></viewer-wrapper>
25
39
  </div>
26
40
  </div>
27
41
  </template>
28
42
  <script>
29
- import Vue from "vue";
30
- import BimAir from 'gs-bim-air'
31
- import 'gs-bim-air/lib/BimAir.css'
32
-
33
- Vue.use(BimAir.ViewerWrapper);
34
-
35
- export default {
36
- name: "App",
37
- components: {},
38
- methods: {
39
- },
40
-
41
- mounted() {
42
- let options = {
43
- elementId: "viewer",
44
- modelService: "https://static.graphicstone.com/modelApi",
45
- fileService: "https://static.graphicstone.com/fileApi",
46
- };
47
-
48
- BimAir.Loader().then(() => {
49
- let viewer = new BimAir.Viewer(options);
50
-
51
- viewer.loadModels(["6253e9d6b0545a0a6e49bf85"]).then(() => {
52
- viewer.fitWorld();
43
+ import Vue from "vue";
44
+ import BimAir from "gs-bim-air";
45
+ import "gs-bim-air/lib/BimAir.css";
46
+
47
+ Vue.use(BimAir.ViewerWrapper);
48
+
49
+ export default {
50
+ name: "App",
51
+ components: {},
52
+ methods: {},
53
+
54
+ mounted() {
55
+ let options = {
56
+ elementId: "viewer",
57
+ modelService: "https://static.graphicstone.com/modelApi",
58
+ fileService: "https://static.graphicstone.com/fileApi",
59
+ };
60
+
61
+ BimAir.Loader().then(() => {
62
+ let viewer = new BimAir.Viewer(options);
63
+
64
+ viewer.loadModels(["6253e9d6b0545a0a6e49bf85"]).then(() => {
65
+ viewer.fitWorld();
66
+ });
53
67
  });
54
- });
55
- },
56
- };
68
+ },
69
+ };
57
70
  </script>
58
71
 
59
72
  <style>
60
- #app {
61
- margin: 0;
62
- padding: 0;
63
- height: 100vh;
64
- }
65
-
66
- #viewerWrapper {
67
- height: 100vh;
68
- }
73
+ #app {
74
+ margin: 0;
75
+ padding: 0;
76
+ height: 100vh;
77
+ }
78
+
79
+ #viewerWrapper {
80
+ height: 100vh;
81
+ }
69
82
  </style>
70
83
  ```
71
84
 
72
85
  ### 直接用 &lt;script&gt; 引入
86
+
73
87
  ```html
74
88
  <!DOCTYPE html>
75
89
  <html>
76
- <head>
77
- <meta charset="UTF-8">
90
+ <head>
91
+ <meta charset="UTF-8" />
78
92
  <title>引入BimAir</title>
79
- <link rel="stylesheet" href="https://static.graphicstone.com/bimAir/BimAir.css">
93
+ <link
94
+ rel="stylesheet"
95
+ href="https://static.graphicstone.com/bimAir/BimAir.css"
96
+ />
80
97
  <script src="https://static.graphicstone.com/vue.min.js"></script>
81
98
  <script src="https://static.graphicstone.com/bimAir/BimAir.umd.min.js"></script>
82
- </head>
99
+ </head>
83
100
 
84
- <body>
101
+ <body>
85
102
  <style>
86
- body {
87
- margin: 0;
88
- padding: 0;
89
- height: 100vh;
90
- }
91
-
92
- #app {
93
- height: 100vh;
94
- position: relative;
95
- }
103
+ body {
104
+ margin: 0;
105
+ padding: 0;
106
+ height: 100vh;
107
+ }
108
+
109
+ #app {
110
+ height: 100vh;
111
+ position: relative;
112
+ }
96
113
  </style>
97
114
  <div id="app">
98
- <viewer-wrapper elementId="viewer" style="height: 100%; width: 100%" />
115
+ <viewer-wrapper elementId="viewer" style="height: 100%; width: 100%" />
99
116
  </div>
100
117
 
101
118
  <script type="text/javascript">
102
- new Vue({
103
- el: '#app',
104
- });
119
+ new Vue({
120
+ el: "#app",
121
+ });
105
122
 
106
- let options = {
107
- elementId: "viewer",
108
- modelService: "https://static.graphicstone.com/modelApi",
109
- fileService: "https://static.graphicstone.com/fileApi",
123
+ let options = {
124
+ elementId: "viewer",
125
+ modelService: "https://static.graphicstone.com/modelApi",
126
+ fileService: "https://static.graphicstone.com/fileApi",
127
+ };
128
+ BimAir.Loader({ url: "https://static.graphicstone.com/bimAir" }).then(
129
+ () => {
130
+ let viewer = new BimAir.Viewer(options);
131
+ let modelId = "624fff10aba44c07ef4b184e";
132
+ viewer.loadModels(["624fff10aba44c07ef4b184e"]);
133
+ viewer.fitWorld();
110
134
  }
111
- BimAir.Loader({ url: "https://static.graphicstone.com/bimAir" }).then(() => {
112
- let viewer = new BimAir.Viewer(options)
113
- let modelId = "624fff10aba44c07ef4b184e";
114
- viewer.loadModels(["624fff10aba44c07ef4b184e"])
115
- viewer.fitWorld();
116
- })
135
+ );
117
136
  </script>
118
- </body>
137
+ </body>
119
138
  </html>
120
139
  ```
121
-
122
-
123
-