soonspacejs 2.4.13 → 2.5.0-alpha.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soonspacejs",
3
- "version": "2.4.13",
3
+ "version": "2.5.0-alpha.0",
4
4
  "homepage": "http://www.xwbuilders.com:8800/",
5
5
  "description": "soonspacejs 2.x",
6
6
  "module": "./dist/index.esm.js",
@@ -25,5 +25,5 @@
25
25
  "@tweenjs/tween.js": "^18.6.4",
26
26
  "@types/three": "0.141.0"
27
27
  },
28
- "gitHead": "2bf40c05acea4b0b8df5edd11bafa0cc3dfd89d5"
28
+ "gitHead": "b8187989f9105b6b235cc22a8e093b4ecab698fb"
29
29
  }
@@ -1,16 +1,16 @@
1
1
  import { Mesh, Intersection } from 'three';
2
- import { Poi, Sbm, Model } from '../Library';
2
+ import { Poi, Model } from '../Library';
3
3
  import { Position, SceneEventType } from './base';
4
4
  interface ScenePoiIntersect {
5
5
  poi: Poi;
6
6
  sourceData: Intersection;
7
7
  }
8
8
  interface SceneModelIntersect {
9
- model: Sbm | Model;
9
+ model: Model;
10
10
  sourceData: Intersection;
11
11
  }
12
12
  interface ModelEventParams {
13
- target: Sbm | Model;
13
+ target: Model;
14
14
  currentTarget: Mesh;
15
15
  intersects: SceneModelIntersect[];
16
16
  event: MouseEvent | TouchEvent;
@@ -25,7 +25,7 @@ interface SceneClickParam {
25
25
  }
26
26
  interface SceneGlobalEvents {
27
27
  modelHover?: (param: ModelEventParams) => void;
28
- modelUnHover?: (model: Sbm | Model) => void;
28
+ modelUnHover?: (model: Model) => void;
29
29
  modelClick?: (param: ModelEventParams) => void;
30
30
  modelRightClick?: (param: ModelEventParams) => void;
31
31
  modelDblClick?: (param: ModelEventParams) => void;
@@ -7,3 +7,6 @@ export * from './plugin';
7
7
  export * from './signals';
8
8
  export * from './viewport';
9
9
  export * from './controls';
10
+ export * from './sbmCache';
11
+ export * from './sbmXmlToJson';
12
+ export * from './gmlToJson';
@@ -1,5 +1,5 @@
1
1
  import { IColor, IVector2, Position, Rotation, Scale } from './base';
2
- import { BaseObject3D, BaseObject3DInfo, LinkInfo, SbmInfo, ModelInfo, PoiInfo } from '../Library';
2
+ import { BaseObject3D, BaseObject3DInfo, LinkInfo, ModelInfo, PoiInfo } from '../Library';
3
3
  import { Box3, DirectionalLight, HemisphereLight, SpotLight, PointLight, RectAreaLight } from 'three';
4
4
  interface UserDataPropertyFindFunc<T = BaseObject3D['userData']> {
5
5
  (userData: T): T;
@@ -39,7 +39,6 @@ interface RectAreaLightOptions extends BaseLightInfo {
39
39
  width?: number;
40
40
  height?: number;
41
41
  }
42
- declare type CloneSbmInfo = Omit<SbmInfo, 'url'>;
43
42
  interface ModelLoadingProgress {
44
43
  total: number;
45
44
  loaded: number;
@@ -175,4 +174,4 @@ interface RectAreaLightHelperOptions extends BaseHelperOptions {
175
174
  light: RectAreaLight;
176
175
  color?: IColor;
177
176
  }
178
- export { UserDataPropertyFindFunc, BaseLightInfo, AmbientLightOptions, DirectionalLightOptions, HemisphereLightOptions, SpotLightOptions, PointLightOptions, RectAreaLightOptions, CloneSbmInfo, ModelLoadingProgress, ModelLoadingProgressCallback, GroupProgress, GroupProgressCallback, CloneModelInfo, ClonePoiInfo, TopologyInfoForGml, TopologyEffectInfo, ShortestPathInfo, ShortestPathByMultipleStartPoints, ShortestPathByMultipleEndPoints, TwoWaysLink, TopologyNodeGraph, TopologyNodeInfo, TopologyInnerNodeInfo, GridHelperOptions, AxesHelperOptions, BoxHelperOptions, PlaneHelperOptions, GroundHelperOptions, DirectionalLightHelperOptions, HemisphereLightHelperOptions, SpotLightHelperOptions, PointLightHelperOptions, RectAreaLightHelperOptions, };
177
+ export { UserDataPropertyFindFunc, BaseLightInfo, AmbientLightOptions, DirectionalLightOptions, HemisphereLightOptions, SpotLightOptions, PointLightOptions, RectAreaLightOptions, CloneModelInfo, ModelLoadingProgress, ModelLoadingProgressCallback, GroupProgress, GroupProgressCallback, ClonePoiInfo, TopologyInfoForGml, TopologyEffectInfo, ShortestPathInfo, ShortestPathByMultipleStartPoints, ShortestPathByMultipleEndPoints, TwoWaysLink, TopologyNodeGraph, TopologyNodeInfo, TopologyInnerNodeInfo, GridHelperOptions, AxesHelperOptions, BoxHelperOptions, PlaneHelperOptions, GroundHelperOptions, DirectionalLightHelperOptions, HemisphereLightHelperOptions, SpotLightHelperOptions, PointLightHelperOptions, RectAreaLightHelperOptions, };
@@ -2,6 +2,7 @@ import { BaseObject3D, BaseObject3DInfo } from './BaseObject3D';
2
2
  import { ObjectEvents, ObjectEventsListener } from '../Interface';
3
3
  interface ModelInfo extends BaseObject3DInfo, ObjectEvents<Model> {
4
4
  url: string;
5
+ isPlatform?: boolean;
5
6
  }
6
7
  interface ModelInnerInfo extends ModelInfo {
7
8
  format: string;
@@ -4,7 +4,6 @@ export * from './SceneManage';
4
4
  export * from './Group';
5
5
  export * from './PluginObject';
6
6
  export * from './PoiNode';
7
- export * from './Sbm';
8
7
  export * from './Model';
9
8
  export * from './Poi';
10
9
  export * from './Icon';
@@ -1,4 +1,4 @@
1
- import { BufferGeometry, Loader, Mesh } from 'three';
1
+ import { BufferGeometry, Loader, Mesh, MeshStandardMaterial } from 'three';
2
2
  import { Material } from 'three';
3
3
  import localforage from 'localforage';
4
4
  export interface SubMesh {
@@ -35,15 +35,17 @@ export interface TexturesIndexes {
35
35
  alphamode: number;
36
36
  use_list: string[];
37
37
  }
38
+ export declare type TexturesIndexesJson = Record<string, TexturesIndexes>;
38
39
  export interface MaterialsMapValue {
39
40
  material: Material;
40
41
  materialIndex: number;
41
42
  }
42
43
  declare class DatLoader extends Loader {
43
44
  readonly store: typeof localforage;
44
- loadedTextures: Map<string, Promise<any>>;
45
+ loadedTextures: Map<string, Promise<TexturesIndexesJson>>;
45
46
  loadedMaterialsMap: Map<string, MaterialsMapValue>;
46
- loadedMaterials: Material[];
47
+ defaultMaterial: MeshStandardMaterial;
48
+ loadedMaterials: MeshStandardMaterial[];
47
49
  dracoDecoderPath: string | null;
48
50
  workerPool: any;
49
51
  workerSourceURL: string;
@@ -53,7 +55,7 @@ declare class DatLoader extends Loader {
53
55
  * @param buffer
54
56
  * @param url
55
57
  */
56
- parseAsync(buffer: ArrayBuffer, url: string): Promise<Mesh<BufferGeometry, Material[]> | undefined>;
58
+ parseAsync(buffer: ArrayBuffer, url: string): Promise<Mesh<BufferGeometry, MeshStandardMaterial[]> | undefined>;
57
59
  private _decodeBuffer;
58
60
  private _initWorkerCreator;
59
61
  private _createMesh;
@@ -4,10 +4,10 @@ declare global {
4
4
  }
5
5
  }
6
6
  export declare const dracoCompress: (compressBuffer: ArrayBuffer) => Promise<{
7
- position: Uint8Array | Uint32Array | Float32Array | Int8Array | Int16Array | Int32Array | Uint16Array;
8
- normal: Uint8Array | Uint32Array | Float32Array | Int8Array | Int16Array | Int32Array | Uint16Array;
9
- color: Uint8Array | Uint32Array | Float32Array | Int8Array | Int16Array | Int32Array | Uint16Array;
10
- texcoord: Uint8Array | Uint32Array | Float32Array | Int8Array | Int16Array | Int32Array | Uint16Array;
7
+ position: Uint8Array | Float32Array | Int8Array | Int16Array | Int32Array | Uint16Array | Uint32Array;
8
+ normal: Uint8Array | Float32Array | Int8Array | Int16Array | Int32Array | Uint16Array | Uint32Array;
9
+ color: Uint8Array | Float32Array | Int8Array | Int16Array | Int32Array | Uint16Array | Uint32Array;
10
+ texcoord: Uint8Array | Float32Array | Int8Array | Int16Array | Int32Array | Uint16Array | Uint32Array;
11
11
  indice: Uint32Array;
12
12
  sub_mesh: {
13
13
  start: number;
@@ -1,10 +1,10 @@
1
- import { Sbm, SbmInfo } from '../../Library';
1
+ import { Model, ModelInfo } from '../../Library';
2
2
  import SDataView from './SDataView';
3
3
  import { ModelLoadingProgressCallback } from '../../Interface';
4
4
  import { SbmCache } from '../../Interface/sbmCache';
5
5
  declare class SbkLoader {
6
6
  materials: Map<string, any>;
7
- sbmInfo: SbmInfo | null;
7
+ sbmInfo: ModelInfo | null;
8
8
  constructor();
9
9
  /**
10
10
  * 解析模型
@@ -12,8 +12,8 @@ declare class SbkLoader {
12
12
  * @param sbmInfo 模型信息
13
13
  * @param onProgress 模型加载进度回填函数
14
14
  */
15
- parseBuffer(buffer: ArrayBuffer, sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback): Promise<{
16
- sbm: Sbm;
15
+ parseBuffer(buffer: ArrayBuffer, sbmInfo: ModelInfo, onProgress?: ModelLoadingProgressCallback): Promise<{
16
+ model: Model;
17
17
  caches: SbmCache;
18
18
  }>;
19
19
  /**
@@ -22,7 +22,7 @@ declare class SbkLoader {
22
22
  * @param onProgress
23
23
  */
24
24
  _parseV2(dataView: SDataView, onProgress?: ModelLoadingProgressCallback): Promise<{
25
- sbm: Sbm;
25
+ model: Model;
26
26
  caches: SbmCache;
27
27
  }>;
28
28
  /**
@@ -31,7 +31,7 @@ declare class SbkLoader {
31
31
  * @param onProgress
32
32
  */
33
33
  _parseV3(dataView: SDataView, onProgress?: ModelLoadingProgressCallback): Promise<{
34
- sbm: Sbm;
34
+ model: Model;
35
35
  caches: SbmCache;
36
36
  }>;
37
37
  /**
@@ -1,9 +1,9 @@
1
- import { Sbm, SbmInfo } from '../../Library';
1
+ import { Model, ModelInfo } from '../../Library';
2
2
  import { ModelLoadingProgress, ModelLoadingProgressCallback } from '../../Interface';
3
3
  import { SbmCache } from '../../Interface/sbmCache';
4
4
  declare class SbmLoader {
5
5
  materials: Map<string, any>;
6
- sbmInfo: SbmInfo | null;
6
+ sbmInfo: ModelInfo | null;
7
7
  isLE: boolean;
8
8
  constructor();
9
9
  /**
@@ -12,8 +12,8 @@ declare class SbmLoader {
12
12
  * @param sbmInfo 模型信息
13
13
  * @param onProgress 模型加载进度回填函数
14
14
  */
15
- parseBuffer(buffer: ArrayBuffer, sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback): Promise<{
16
- sbm: Sbm;
15
+ parseBuffer(buffer: ArrayBuffer, sbmInfo: ModelInfo, onProgress?: ModelLoadingProgressCallback): Promise<{
16
+ model: Model;
17
17
  caches: SbmCache;
18
18
  }>;
19
19
  /**
@@ -22,7 +22,7 @@ declare class SbmLoader {
22
22
  * @param onProgress
23
23
  */
24
24
  _parseV2(dataView: DataView, offset: number, onProgress?: ModelLoadingProgressCallback): Promise<{
25
- sbm: Sbm;
25
+ model: Model;
26
26
  caches: SbmCache;
27
27
  }>;
28
28
  /**
@@ -31,7 +31,7 @@ declare class SbmLoader {
31
31
  * @param onProgress
32
32
  */
33
33
  _parseV3(dataView: DataView, offset: number, onProgress?: ModelLoadingProgressCallback): Promise<{
34
- sbm: Sbm;
34
+ model: Model;
35
35
  caches: SbmCache;
36
36
  }>;
37
37
  /**
@@ -1,5 +1,5 @@
1
1
  import { Material } from 'three';
2
- import { Sbm, SbmInfo } from '../../Library';
2
+ import { Model, ModelInfo } from '../../Library';
3
3
  import { SbmCache } from '../../Interface/sbmCache';
4
4
  declare class SbmObjectLoader {
5
5
  materials: Map<string, Material>;
@@ -20,6 +20,6 @@ declare class SbmObjectLoader {
20
20
  * @param sbmInfo
21
21
  * @returns
22
22
  */
23
- parseObject(sbmObject: SbmCache, sbmInfo: SbmInfo): Sbm;
23
+ parseObject(sbmObject: SbmCache, sbmInfo: ModelInfo): Model;
24
24
  }
25
25
  export default SbmObjectLoader;
@@ -1,4 +1,5 @@
1
1
  import sbk from './SbkLoader';
2
2
  import sbm from './SbmLoader';
3
+ export { default as SbmObjectLoader, } from './SbmObjectLoader';
3
4
  declare const _default: typeof sbm | typeof sbk;
4
5
  export default _default;
@@ -3,44 +3,44 @@ import { FBXLoader } from 'three/examples/jsm/loaders/FBXLoader.js';
3
3
  import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
4
4
  import localforage from 'localforage';
5
5
  import { DatLoader } from '../Loader/DatLoader';
6
- import DefaultManage from './DefaultManage';
6
+ import Viewport from '../Viewport';
7
7
  import { BaseObject3D, Group, GroupInfo, Model, ModelInfo, SceneManage } from '../Library';
8
8
  import { CloneModelInfo } from '../Interface';
9
- import Viewport from '../Viewport';
9
+ import DefaultManage from './DefaultManage';
10
10
  declare class ModelManage extends DefaultManage {
11
11
  readonly viewport: Viewport;
12
+ modelsPromiseMap: Map<string, Promise<Model | null>>;
12
13
  modelMaps: Map<string, Model>;
13
14
  /**
14
15
  * workaround for types
15
16
  */
16
17
  store: typeof localforage;
18
+ cacheStore: typeof localforage;
17
19
  loadingManager: LoadingManager;
18
20
  datLoader: DatLoader;
19
21
  gltfLoader: GLTFLoader;
20
22
  fbxLoader: FBXLoader;
21
23
  dracoDecoderPath: string | null;
22
24
  constructor(viewport: Viewport, scene: SceneManage);
23
- private _initLoadingManager;
24
- private _setModelMpas;
25
- private _parseSbmx;
26
- private _parseDat;
27
- private _parseGltf;
28
- private _parseFbx;
29
25
  /**
30
26
  * 设置 draco path
31
27
  * @param path
32
28
  */
33
29
  setDracoDecoderPath(path: string): void;
34
- load(modelInfo: ModelInfo): Promise<Model>;
35
- _loadItem(modelInfo: ModelInfo, parent?: BaseObject3D | null): Promise<Model>;
36
30
  /**
37
- * model 解析
31
+ * 加载模型
32
+ * @param modelInfo
33
+ * @returns
34
+ */
35
+ load(modelInfo: ModelInfo, parent?: BaseObject3D | null): Promise<Model | null>;
36
+ /**
37
+ * 模型解析
38
38
  * @param format
39
39
  * @param buffer
40
40
  * @param modelInfo
41
41
  * @returns
42
42
  */
43
- parse(format: string, buffer: ArrayBuffer, modelInfo: ModelInfo): Promise<Model>;
43
+ parse(modelInfo: ModelInfo): Promise<Model | null>;
44
44
  clone(model: Model, info: CloneModelInfo, parent?: BaseObject3D | null): Promise<Model>;
45
45
  loadToGroup(groupInfo: GroupInfo, modelInfo: ModelInfo[]): Promise<Group>;
46
46
  addForGroup(group: Group | null, modelInfo: ModelInfo[]): Promise<Group | null>;
@@ -50,10 +50,17 @@ declare class ModelManage extends DefaultManage {
50
50
  clearIdb(): Promise<void>;
51
51
  dispose(): void;
52
52
  /**
53
- * 远程请求 model
54
- * @param modelInfo
55
- * @returns
53
+ * private methods
56
54
  */
57
- _fetchBuffer(modelInfo: ModelInfo): Promise<ArrayBuffer>;
55
+ private _initLoadingManager;
56
+ private _setModelMpas;
57
+ private _parseSbm;
58
+ private _parseSbmx;
59
+ private _parseDat;
60
+ private _parseGltf;
61
+ private _parseFbx;
62
+ private _innerLoad;
63
+ private _fetchBuffer;
64
+ private _getBuffer;
58
65
  }
59
66
  export default ModelManage;
@@ -2,7 +2,6 @@ import { Object3D } from 'three';
2
2
  import Viewport from '../Viewport';
3
3
  import { BaseObject3D, SceneManage } from '../Library';
4
4
  import LightManage from './LightManage';
5
- import SbmManage from './SbmManage';
6
5
  import ModelManage from './ModelManage';
7
6
  import PoiManage from './PoiManage';
8
7
  import PoiNodeManage from './PoiNodeManage';
@@ -15,7 +14,6 @@ import { UserDataPropertyFindFunc } from '../Interface';
15
14
  interface ManagerStore {
16
15
  groupManager: GroupManage;
17
16
  lightManager: LightManage;
18
- sbmManager: SbmManage;
19
17
  modelManager: ModelManage;
20
18
  poiManager: PoiManage;
21
19
  poiNodeManager: PoiNodeManage;
@@ -26,3 +26,4 @@ export { hasOwn, };
26
26
  export { isString, isBoolean, isNumber, isNull, isUndefined, isSymbol, };
27
27
  export { isDate, isArray, isObject, isFunction, isPromise, };
28
28
  export { getValueType, sleep, getAsciiString, };
29
+ export { exportGltf, } from '../exporters';
@@ -1 +1,3 @@
1
1
  export declare const log: (text: string, style?: any) => void;
2
+ export declare const warn: (text: string) => void;
3
+ export declare const error: (text: string) => void;
@@ -1,3 +1,6 @@
1
1
  import { Object3D } from 'three';
2
- declare function exportGltf(object: Object3D): Promise<string>;
2
+ import { GLTFExporterOptions } from 'three/examples/jsm/exporters/GLTFExporter.js';
3
+ declare function exportGltf(object: Object3D, options?: GLTFExporterOptions): Promise<ArrayBuffer | {
4
+ [key: string]: any;
5
+ }>;
3
6
  export { exportGltf, };
package/types/index.d.ts CHANGED
@@ -13,10 +13,10 @@ import { Object3D, Vector3, Euler, Box3, AnimationClip, AnimationAction, Light }
13
13
  import * as shared from './Shared';
14
14
  import Animation from './Animation';
15
15
  import * as library from './Library';
16
- import { BaseObject3D, BaseObject3DInfo, Sbm, SbmInfo, Model, ModelInfo, Poi, PoiInfo, PoiNode, PoiNodeInfo, Topology, TopologyInfo, Group, GroupInfo, Canvas3D, Canvas3DInfo, PluginObject, PluginObjectInfo } from './Library';
16
+ import { BaseObject3D, BaseObject3DInfo, Model, ModelInfo, Poi, PoiInfo, PoiNode, PoiNodeInfo, Topology, TopologyInfo, Group, GroupInfo, Canvas3D, Canvas3DInfo, PluginObject, PluginObjectInfo } from './Library';
17
17
  import Viewport from './Viewport';
18
18
  import Manager from './Manager';
19
- import { ViewportOptions, SceneGlobalEvents, PluginsConstructor, IColor, Position, Rotation, OffsetPoint, AnimationOptions, ModelAnimationFindFunc, TopologyNodeInfo, CameraViewpointData, FlyToViewpoint, FlyToObjOptions, SurroundOptions, LabelOptions, EdgeSelectOptions, StrokeSelectOptions, OpacitySelectOptions, HighlightSelectOptions, EmissiveSelectOptions, FogOptions, UserDataPropertyFindFunc, AmbientLightOptions, DirectionalLightOptions, HemisphereLightOptions, SpotLightOptions, PointLightOptions, CloneSbmInfo, ModelLoadingProgressCallback, GroupProgressCallback, CloneModelInfo, ClonePoiInfo, ShortestPathInfo, ShortestPathByMultipleStartPoints, ShortestPathByMultipleEndPoints, TopologyInfoForGml, GridHelperOptions, AxesHelperOptions, BoxHelperOptions, PlaneHelperOptions, GroundHelperOptions, DirectionalLightHelperOptions, HemisphereLightHelperOptions, SpotLightHelperOptions, PointLightHelperOptions, SignalsState, ControlsOptions, RectAreaLightOptions, RectAreaLightHelperOptions, SkyOptions, ColorSpace, ToneMappingOptions, SSAOOptions } from './Interface';
19
+ import { ViewportOptions, SceneGlobalEvents, PluginsConstructor, IColor, Position, Rotation, OffsetPoint, AnimationOptions, ModelAnimationFindFunc, TopologyNodeInfo, CameraViewpointData, FlyToViewpoint, FlyToObjOptions, SurroundOptions, LabelOptions, EdgeSelectOptions, StrokeSelectOptions, OpacitySelectOptions, HighlightSelectOptions, EmissiveSelectOptions, FogOptions, UserDataPropertyFindFunc, AmbientLightOptions, DirectionalLightOptions, HemisphereLightOptions, SpotLightOptions, PointLightOptions, CloneModelInfo, ClonePoiInfo, ShortestPathInfo, ShortestPathByMultipleStartPoints, ShortestPathByMultipleEndPoints, TopologyInfoForGml, GridHelperOptions, AxesHelperOptions, BoxHelperOptions, PlaneHelperOptions, GroundHelperOptions, DirectionalLightHelperOptions, HemisphereLightHelperOptions, SpotLightHelperOptions, PointLightHelperOptions, SignalsState, ControlsOptions, RectAreaLightOptions, RectAreaLightHelperOptions, SkyOptions, ColorSpace, ToneMappingOptions, SSAOOptions } from './Interface';
20
20
  export declare type InitOptions = ViewportOptions;
21
21
  export declare type InitEvents = SceneGlobalEvents;
22
22
  export interface SoonSpaceConstructor {
@@ -111,6 +111,7 @@ export default class SoonSpace {
111
111
  remove: (tween: import("@tweenjs/tween.js").Tween<Record<string, any>>) => void;
112
112
  update: (time?: number | undefined, preserve?: boolean | undefined) => boolean;
113
113
  };
114
+ static readonly utils: typeof shared;
114
115
  readonly THREE: typeof THREE;
115
116
  readonly THREE_PLUGINS: {
116
117
  TransformControls: typeof TransformControls;
@@ -552,125 +553,35 @@ export default class SoonSpace {
552
553
  getGroupById(id: GroupInfo['id']): Group | null;
553
554
  getGroupByName(name: string): Group[];
554
555
  getAllGroup(): Group[];
556
+ showAllGroup(): void;
557
+ hideAllGroup(): void;
555
558
  removeGroupById(id: GroupInfo['id']): boolean;
556
559
  /******/
557
- /******/
560
+ /******* deprecated */
558
561
  /******* Sbm methods */
559
562
  /******/
560
563
  /******/
561
- /**
562
- * 加载 Sbm 模型
563
- * @param sbmInfo
564
- * @param parent
565
- * @param onProgress
566
- */
567
- loadSbm(sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback): Promise<Sbm>;
568
- /**
569
- * 解析 Sbm 模型
570
- * @param data
571
- * @param sbmInfo
572
- * @param onProgress
573
- */
574
- parseSbm(data: ArrayBuffer, sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback): Promise<Sbm>;
575
- /**
576
- * 克隆 Sbm 模型
577
- * @param model
578
- * @param sbmInfo
579
- * @param parent
580
- */
581
- cloneSbm(model: Sbm, sbmInfo: CloneSbmInfo, parent?: BaseObject3D | null): Promise<Sbm>;
582
- /**
583
- * 根据 id 查询 Sbm 模型
584
- * @param id
585
- */
586
- getSbmById(id: SbmInfo['id']): Sbm | null;
587
- /**
588
- * 根据 name 查询 Sbm 模型
589
- * @param name
590
- */
591
- getSbmByName(name: string): Sbm[];
592
- /**
593
- * 根据用户数据查询 Sbm 模型
594
- * @param name
595
- */
596
- getSbmByUserDataProperty(propNameOrFindFunc: string | UserDataPropertyFindFunc, propValue?: any): Sbm[];
597
- /**
598
- * 根据 id 删除 Sbm 模型
599
- * @param id
600
- */
601
- removeSbmById(id: SbmInfo['id']): boolean;
602
- /**
603
- * 为 Sbm 创建组
604
- * @param groupInfo
605
- */
564
+ loadSbm(sbmInfo: ModelInfo): Promise<Model | null>;
565
+ parseSbm(): void;
566
+ cloneSbm(model: Model, sbmInfo: CloneModelInfo, parent?: BaseObject3D | null): Promise<Model>;
567
+ getSbmById(id: ModelInfo['id']): Model | null;
568
+ getSbmByName(name: string): Model[];
569
+ getSbmByUserDataProperty(propNameOrFindFunc: string | UserDataPropertyFindFunc, propValue?: any): Model[];
570
+ removeSbmById(id: ModelInfo['id']): boolean;
606
571
  createGroupForSbm(groupInfo: GroupInfo): Group;
607
- /**
608
- * 加载 Sbm 模型到组内
609
- * @param groupInfo
610
- * @param sbmInfoList
611
- * @param onProgress
612
- */
613
- loadSbmToGroup(groupInfo: GroupInfo, sbmInfoList: SbmInfo[], onProgress?: GroupProgressCallback): Promise<Group>;
614
- /**
615
- * 为已有的组添加 Sbm 模型
616
- * @param groupId
617
- * @param sbmInfoList
618
- * @param onProgress
619
- */
620
- addSbmForGroup(groupId: GroupInfo['id'], sbmInfoList: SbmInfo[], onProgress?: GroupProgressCallback): Promise<Group | null>;
621
- /**
622
- * 创建 SSbm 组,从 xml 文件资源
623
- * @param groupInfo
624
- * @param url
625
- */
626
- createSbmGroupFromXml(groupInfo: GroupInfo, url: string): Promise<Group>;
627
- /**
628
- * 根据 id 查询 Sbm 模型组
629
- * @param id
630
- */
572
+ loadSbmToGroup(groupInfo: GroupInfo, sbmInfoList: ModelInfo[]): Promise<Group>;
573
+ addSbmForGroup(groupId: GroupInfo['id'], sbmInfoList: ModelInfo[]): Promise<Group | null>;
574
+ createSbmGroupFromXml(): void;
631
575
  getSbmGroupById(id: GroupInfo['id']): Group | null;
632
- /**
633
- * 根据 name 查询 Sbm 模型组
634
- * @param name
635
- */
636
576
  getSbmGroupByName(name: string): Group[];
637
- /**
638
- * 获取所有 Sbm 模型组
639
- */
640
577
  getAllSbmGroup(): Group[];
641
- /**
642
- * 根据 id 删除 Sbm 模型组
643
- * @param id
644
- */
645
578
  removeSbmGroupById(id: GroupInfo['id']): boolean;
646
- /**
647
- * 清空 Sbm 模型
648
- */
649
579
  clearSbm(): void;
650
- /**
651
- * 获取所有 Sbm 模型
652
- */
653
- getAllSbm(): Sbm[];
654
- /**
655
- * 显示所有 Sbm 模型
656
- */
580
+ getAllSbm(): Model[];
657
581
  showAllSbm(): void;
658
- /**
659
- * 隐藏所有 Sbm 模型
660
- */
661
582
  hideAllSbm(): void;
662
- /**
663
- * 获取 Sbm 模型缓冲
664
- */
665
- getSbmModelMaps(): Map<string, library.Sbm>;
666
- /**
667
- * 设置 Sbm 模型缓冲
668
- */
669
- setSbmModelMaps(maps: Map<string, Sbm>): void;
670
- /**
671
- * 清空本地模型缓存数据
672
- */
673
- clearIdb(): Promise<void[]>;
583
+ getSbmModelMaps(): Map<string, library.Model>;
584
+ setSbmModelMaps(maps: Map<string, Model>): void;
674
585
  /******/
675
586
  /******/
676
587
  /******* Model methods */
@@ -686,9 +597,8 @@ export default class SoonSpace {
686
597
  * 加载 Model 模型
687
598
  * @param modelInfo
688
599
  * @param parent
689
- * @param onProgress
690
600
  */
691
- loadModel(modelInfo: ModelInfo): Promise<Model>;
601
+ loadModel(modelInfo: ModelInfo): Promise<Model | null>;
692
602
  /**
693
603
  * 克隆 Model 模型
694
604
  * @param model
@@ -725,14 +635,12 @@ export default class SoonSpace {
725
635
  * 加载 Model 模型到组内
726
636
  * @param groupInfo
727
637
  * @param modelInfo
728
- * @param onProgress
729
638
  */
730
639
  loadModelToGroup(groupInfo: GroupInfo, modelInfo: ModelInfo[]): Promise<Group>;
731
640
  /**
732
641
  * 为已有的组添加 Model 模型
733
642
  * @param groupId
734
643
  * @param modelInfo
735
- * @param onProgress
736
644
  */
737
645
  addModelForGroup(groupId: GroupInfo['id'], modelInfo: ModelInfo[]): Promise<Group | null>;
738
646
  /**
@@ -770,6 +678,18 @@ export default class SoonSpace {
770
678
  * 隐藏所有 Model 模型
771
679
  */
772
680
  hideAllModel(): void;
681
+ /**
682
+ * 清空本地模型缓存数据
683
+ */
684
+ clearIdb(): Promise<void>;
685
+ /**
686
+ * 获取 Model 模型缓冲
687
+ */
688
+ getModelMaps(): Map<string, library.Model>;
689
+ /**
690
+ * 设置 Model 模型缓冲
691
+ */
692
+ setModelMaps(maps: Map<string, Model>): void;
773
693
  /******/
774
694
  /******/
775
695
  /******* Poi methods */
@@ -1,20 +0,0 @@
1
- import { BaseObject3D, BaseObject3DInfo } from './BaseObject3D';
2
- import { ObjectEvents, ObjectEventsListener } from '../Interface';
3
- interface SbmInfo extends BaseObject3DInfo, ObjectEvents<Sbm> {
4
- url: string;
5
- isPlatform?: boolean;
6
- }
7
- declare class Sbm extends BaseObject3D<ObjectEventsListener> implements ObjectEvents<Sbm> {
8
- isEventPropagation: boolean;
9
- onLoad: ((object: Sbm) => void) | null;
10
- onClick: ((object: Sbm) => void) | null;
11
- onDblClick: ((object: Sbm) => void) | null;
12
- onRightClick: ((object: Sbm) => void) | null;
13
- constructor(param: SbmInfo);
14
- eventPropagation(): void;
15
- setEnvMap(dirPath: string, fileNames?: string[], options?: {
16
- reflectivity?: number;
17
- }): void;
18
- sClone<T extends BaseObject3D>(recursive?: boolean): T;
19
- }
20
- export { Sbm, SbmInfo, };
@@ -1,31 +0,0 @@
1
- import * as localforage from 'localforage';
2
- import DefaultManage from './DefaultManage';
3
- import Viewport from '../Viewport';
4
- import { BaseObject3D, Group, GroupInfo, Sbm, SbmInfo, SceneManage } from '../Library';
5
- import { CloneSbmInfo, ModelLoadingProgressCallback, GroupProgressCallback } from '../Interface';
6
- import { SbmCache } from '../Interface/sbmCache';
7
- declare class SbmManage extends DefaultManage {
8
- readonly viewport: Viewport;
9
- modelMaps: Map<string, Sbm>;
10
- store: typeof localforage;
11
- constructor(viewport: Viewport, scene: SceneManage);
12
- load(sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback): Promise<Sbm>;
13
- parse(data: ArrayBuffer | SbmCache, sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback): Promise<Sbm>;
14
- clone(model: Sbm, sbmInfo: CloneSbmInfo, parent?: BaseObject3D | null): Promise<Sbm>;
15
- loadToGroup(groupInfo: GroupInfo, sbmInfoList: SbmInfo[], onProgress?: GroupProgressCallback): Promise<Group>;
16
- addForGroup(group: Group | null, sbmInfoList: SbmInfo[], onProgress?: GroupProgressCallback): Promise<Group | null>;
17
- createGroupFromXml(groupInfo: GroupInfo, url: string): Promise<Group>;
18
- /**
19
- * 清空本地模型缓存数据
20
- */
21
- clearIdb(): Promise<void>;
22
- dispose(): void;
23
- _loadItem(sbmInfo: SbmInfo, onProgress?: ModelLoadingProgressCallback, parent?: BaseObject3D | null): Promise<Sbm>;
24
- /**
25
- * 远程请求 sbm
26
- * @param sbmInfo
27
- * @returns
28
- */
29
- _fetchBuffer(sbmInfo: SbmInfo): Promise<ArrayBuffer>;
30
- }
31
- export default SbmManage;