@aibee/crc-bmap 0.0.92 → 0.0.94

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/lib/src/bmap.d.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import { EventDispatcher, Object3D, Vector3 } from "three";
2
2
  import { Context } from "./context";
3
- import { Config } from './config';
3
+ import { Timer, Events } from "./utils";
4
+ import { Config } from "./config";
4
5
  import { Graphic, HeatmapDataParam, ModelOptions, PoiOptionsParam } from "./elements";
5
6
  import { GraphicInfo, GraphicOptions } from "./types";
7
+ import { Plugin } from "./plugins/base";
6
8
  export interface LoadQuery {
7
9
  brand: string;
8
10
  project: string;
@@ -38,14 +40,20 @@ export declare class BMap extends EventDispatcher<BmapEventMap> {
38
40
  buildingGroundMap: Map<string, GraphicInfo | null>;
39
41
  currentBuildGround: GraphicInfo | null;
40
42
  private observe;
43
+ event: Events;
44
+ timer: Timer;
45
+ plugins: Plugin[];
41
46
  constructor(container: HTMLElement, config?: Partial<Config>);
42
47
  private loadGraphics;
43
- getBuildingKey({ brand, project, phase, building }: Omit<LoadQuery, "floor" | "ts" | "resource_type_list">): string;
48
+ getBuildingKey({ brand, project, phase, building, }: Omit<LoadQuery, "floor" | "ts" | "resource_type_list">): string;
44
49
  private loadBuildingGround;
45
- getFloorKey({ brand, project, phase, building, floor, ts, resource_type_list }: LoadQuery): string;
46
- load({ brand, project, phase, building, floor, ts, resource_type_list }: LoadQuery): Promise<GraphicInfo[] | undefined>;
50
+ getFloorKey({ brand, project, phase, building, floor, ts, resource_type_list, }: LoadQuery): string;
51
+ load({ brand, project, phase, building, floor, ts, resource_type_list, }: LoadQuery): Promise<GraphicInfo[] | undefined>;
52
+ loadEquipment(): void;
53
+ use(plugin: Plugin): void;
54
+ loadNavigation(): void;
47
55
  private createFloor;
48
- switchFloor({ brand, project, phase, building, floor, ts, resource_type_list }: LoadQuery): void;
56
+ switchFloor({ brand, project, phase, building, floor, ts, resource_type_list, }: LoadQuery): void;
49
57
  onControlChange: () => void;
50
58
  addModel(graphic: Graphic, options: ModelOptions): void;
51
59
  addHeatmap(data: HeatmapDataParam): import("./elements").HeatmapElement | undefined;
@@ -72,7 +80,7 @@ export declare class BMap extends EventDispatcher<BmapEventMap> {
72
80
  */
73
81
  translateElementToCenterX(ele: {
74
82
  getPosition: () => Vector3;
75
- }, duration?: number): Promise<void>;
83
+ }, duration?: number): Promise<unknown>;
76
84
  /**
77
85
  * 获取物体的屏幕坐标
78
86
  */
@@ -5,6 +5,7 @@ export interface Config {
5
5
  apiPath: {
6
6
  floorGraphic: string;
7
7
  floorRange: string;
8
+ equipmentList: string;
8
9
  };
9
10
  resizeObserver: boolean;
10
11
  heatMap: Partial<HeatmapConfiguration>;
@@ -6,3 +6,4 @@ export * from './context';
6
6
  export * from './layer';
7
7
  export * from './types';
8
8
  export * from './operations';
9
+ export * from './plugins';
@@ -0,0 +1,6 @@
1
+ import { BMap } from "src/bmap";
2
+ export declare class Plugin {
3
+ bmap: BMap;
4
+ constructor(bmap: BMap);
5
+ dispose(): void;
6
+ }
@@ -0,0 +1,21 @@
1
+ import { BMap } from "../../bmap";
2
+ import { Plugin } from "../base";
3
+ import { Graphic } from "../../elements";
4
+ interface EquipmentData {
5
+ equipment_id: string;
6
+ equipment_name: string;
7
+ equipment_icon: string;
8
+ }
9
+ export declare class Equipment extends Plugin {
10
+ equipmentList: EquipmentData[];
11
+ equipmentMap: Map<string, EquipmentData>;
12
+ constructor(bmap: BMap);
13
+ fetchEquipment(): Promise<void>;
14
+ onSwitchFloor: (floor: {
15
+ graphics: Graphic[];
16
+ }) => void;
17
+ getGraphicEquipment(graphic: Graphic): any;
18
+ changeGraphicToEquipment(graphics: Graphic[]): void;
19
+ dispose(): void;
20
+ }
21
+ export {};
@@ -0,0 +1 @@
1
+ export * from './equipment';
@@ -0,0 +1,2 @@
1
+ export * from "./equipment";
2
+ export * from "./navigation";
@@ -0,0 +1 @@
1
+ export * from './navigation';
@@ -0,0 +1,9 @@
1
+ import { BMap } from "../../bmap";
2
+ import { Plugin } from "../base";
3
+ export declare class Navigation extends Plugin {
4
+ worker_url: string;
5
+ worker: Worker;
6
+ constructor(bmap: BMap);
7
+ fetchRoad(): void;
8
+ dispose(): void;
9
+ }
@@ -0,0 +1,2 @@
1
+ declare const workerCode = "\nself.onmessage = (e) => {\n console.log(e.data)\n loadRoad(\"\");\n getPath(\"\", \"\")\n}\n\nfunction loadRoad(project) { \n // \u8BF7\u6C42\u5168\u90E8\u697C\u5C42\u7684\u8DEF\u7F51\n console.log(project)\n self.postMessage(\"project\")\n}\n\nfunction getPath(start, end) { \n // \u89C4\u5212\u8DEF\u7EBF\n console.log(start, end)\n self.postMessage(\"getPath\")\n}\n";
2
+ export default workerCode;
@@ -0,0 +1,4 @@
1
+ export declare enum EventName {
2
+ SWITCH_FLOOR_BEFORE = "switch_floor_before",
3
+ SWITCH_FLOOR_AFTER = "switch_floor_after"
4
+ }
@@ -0,0 +1,17 @@
1
+ type DefaultFn = (...args: any[]) => void;
2
+ interface EventI {
3
+ on(type: string, callback: DefaultFn): void;
4
+ once(type: string, callback: DefaultFn): void;
5
+ off(type: string, callback: DefaultFn): void;
6
+ offAll(): void;
7
+ emit(type: string, ...args: any[]): void;
8
+ }
9
+ export type { EventI };
10
+ export declare class Events implements EventI {
11
+ events: Map<string, Set<DefaultFn>>;
12
+ on(type: string, callback: DefaultFn): Set<DefaultFn> | Map<string, Set<DefaultFn>> | undefined;
13
+ once(type: string, callback: DefaultFn): Set<DefaultFn> | Map<string, Set<DefaultFn>> | undefined;
14
+ off(type: string, callback: DefaultFn): void;
15
+ offAll(): void;
16
+ emit(type: string, ...args: any[]): void;
17
+ }
@@ -12,3 +12,5 @@ export * from './color';
12
12
  export * from './model';
13
13
  export * from './keyboard';
14
14
  export * from './os';
15
+ export * from './events';
16
+ export * from './event-name';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aibee/crc-bmap",
3
- "version": "0.0.92",
3
+ "version": "0.0.94",
4
4
  "description": "",
5
5
  "main": "lib/bmap.min.js",
6
6
  "module": "lib/bmap.esm.min.js",
@@ -9,14 +9,15 @@
9
9
  "lib",
10
10
  "example"
11
11
  ],
12
+ "type": "module",
12
13
  "scripts": {
13
14
  "build": "pnpm clean && pnpm build:min",
14
- "build:min": "ts-node ./build/index.ts",
15
+ "build:min": "ts-node --esm ./build/index.ts",
15
16
  "gen-type": "tsc",
16
17
  "clean": "rm -rf lib",
17
18
  "lint": "eslint src/**/*.ts",
18
19
  "start": "cd example && vite",
19
- "publish:all": "npm run build && npm version patch && npm run publish:npm && npm run publish:aibee",
20
+ "publish:all": "npm run build && npm version patch && npm run publish:npm && npm run publish:aibee",
20
21
  "publish:npm": "npm publish --access public --registry https://registry.npmjs.org",
21
22
  "publish:aibee": "npm publish --registry https://npm.aibee.cn"
22
23
  },
@@ -36,10 +37,10 @@
36
37
  "vite": "^4.4.11"
37
38
  },
38
39
  "dependencies": {
39
- "@types/three": "^0.156.0",
40
40
  "@mars3d/heatmap.js": "^2.0.7",
41
41
  "@turf/turf": "^6.5.0",
42
42
  "@tweenjs/tween.js": "^21.0.0",
43
+ "@types/three": "^0.156.0",
43
44
  "hotkeys-js": "^3.12.0",
44
45
  "lodash": "^4.17.21",
45
46
  "three": "^0.157.0"