@soonspacejs/plugin-soonmanager2-sync 2.5.12 → 2.5.14

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/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import SoonSpace from 'soonspacejs';
2
+ import { TopologyInfo } from 'soonspacejs/types/Library';
2
3
  import { TreeData } from './types';
3
4
  declare class Soonmanager2SyncPlugin {
4
5
  readonly ssp: SoonSpace;
5
6
  path: string;
6
7
  treeData: TreeData[] | null;
8
+ topologyData: TopologyInfo[] | null;
7
9
  constructor(ssp: SoonSpace);
8
10
  private resolvePath;
9
11
  private fetchData;
@@ -11,6 +13,11 @@ declare class Soonmanager2SyncPlugin {
11
13
  * 获取场景树
12
14
  */
13
15
  private fetchTreeData;
16
+ /**
17
+ * 获取拓扑路径
18
+ * @returns
19
+ */
20
+ private fetchTopologyData;
14
21
  /**
15
22
  * 设置 path
16
23
  * @param path
@@ -24,5 +31,9 @@ declare class Soonmanager2SyncPlugin {
24
31
  * 同步场景树
25
32
  */
26
33
  loadScene(): Promise<void>;
34
+ /**
35
+ * 获取拓扑路径列表
36
+ */
37
+ getTopologies(): Promise<TopologyInfo[]>;
27
38
  }
28
39
  export default Soonmanager2SyncPlugin;
package/dist/index.esm.js CHANGED
@@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
12
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
13
  PERFORMANCE OF THIS SOFTWARE.
14
14
  ***************************************************************************** */
15
- function t(t,e,i,a){return new(i||(i=Promise))((function(n,r){function s(t){try{l(a.next(t))}catch(t){r(t)}}function o(t){try{l(a.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,o)}l((a=a.apply(t,e||[])).next())}))}class e{constructor(t){this.ssp=t,this.path="",this.treeData=null}resolvePath(t){return`${this.path}${t}`}fetchData(e){return t(this,void 0,void 0,(function*(){const{utils:t}=this.ssp;return yield t.fetchFile(this.resolvePath(e)).then((t=>t.json()))}))}fetchTreeData(){return t(this,void 0,void 0,(function*(){this.treeData=yield this.fetchData("/db/tree_models.json")}))}setPath(t){this.path=t}loadObjects(){return t(this,void 0,void 0,(function*(){if(!this.treeData)return void console.error("treeData is null");const e=(i,a)=>t(this,void 0,void 0,(function*(){const{ssp:t}=this,{THREE:{Matrix4:n}}=t,{id:r,name:s,renderType:o,path:l,matrix:h,pid:d}=i,c=(new n).fromArray(h);let u=null;if("3D"===o&&l)try{u=yield t.loadModel({id:r,name:s,url:this.resolvePath(l),userData:{pid:d}})}catch(t){console.error(t)}else"GROUP"===o&&(u=t.createGroup({id:r,name:s,userData:{pid:d}}));u&&(u.applyMatrix4(c),a&&t.addObject(u,a)),i.children.length>0&&(yield Promise.allSettled(i.children.map((t=>e(t,u)))))}));yield Promise.allSettled(this.treeData.map((t=>e(t,null))))}))}loadScene(){return t(this,void 0,void 0,(function*(){this.treeData||(yield this.fetchTreeData()),yield this.loadObjects()}))}}export{e as default};
15
+ function t(t,e,i,o){return new(i||(i=Promise))((function(a,n){function s(t){try{l(o.next(t))}catch(t){n(t)}}function r(t){try{l(o.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?a(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(s,r)}l((o=o.apply(t,e||[])).next())}))}class e{constructor(t){this.ssp=t,this.path="",this.treeData=null,this.topologyData=null}resolvePath(t){return`${this.path}${t}`}fetchData(e){return t(this,void 0,void 0,(function*(){const{utils:t}=this.ssp;return yield t.fetchFile(this.resolvePath(e)).then((t=>t.json()))}))}fetchTreeData(){return t(this,void 0,void 0,(function*(){return this.fetchData("/db/tree_models.json")}))}fetchTopologyData(){return t(this,void 0,void 0,(function*(){return this.fetchData("/db/topology_paths.json")}))}setPath(t){this.path=t}loadObjects(){return t(this,void 0,void 0,(function*(){if(!this.treeData)return void console.error("treeData is null");const e=(i,o)=>t(this,void 0,void 0,(function*(){const{ssp:t}=this,{THREE:{Matrix4:a}}=t,{id:n,name:s,renderType:r,path:l,matrix:h,pid:c}=i,d=(new a).fromArray(h);let u=null;if("3D"===r&&l)try{u=yield t.loadModel({id:n,name:s,url:this.resolvePath(l),userData:Object.assign({},i)})}catch(t){console.error(t)}else"GROUP"===r&&(u=t.createGroup({id:n,name:s,userData:{pid:c}}));u&&(u.applyMatrix4(d),o&&t.addObject(u,o)),i.children.length>0&&(yield Promise.allSettled(i.children.map((t=>e(t,u)))))}));yield Promise.allSettled(this.treeData.map((t=>e(t,null))))}))}loadScene(){return t(this,void 0,void 0,(function*(){this.treeData||(this.treeData=yield this.fetchTreeData()),yield this.loadObjects()}))}getTopologies(){return t(this,void 0,void 0,(function*(){if(!this.topologyData){const t=yield this.fetchTopologyData();this.topologyData=t.map((t=>Object.assign(Object.assign({},t),{type:"network"})))}return this.topologyData}))}}export{e as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soonspacejs/plugin-soonmanager2-sync",
3
3
  "pluginName": "Soonmanager2SyncPlugin",
4
- "version": "2.5.12",
4
+ "version": "2.5.14",
5
5
  "description": "Sync soonmanager 2.x data plugin for SoonSpace.js",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.esm.js",
@@ -13,5 +13,5 @@
13
13
  ],
14
14
  "author": "xuek",
15
15
  "license": "UNLICENSED",
16
- "gitHead": "73fc223e99bce281015908133d4ffb050d863595"
16
+ "gitHead": "819574da59580bb499b0cd50c91b677f9c5ff707"
17
17
  }