@aibee/crc-bmap 0.0.93 → 0.0.95

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.
@@ -0,0 +1,15 @@
1
+ import { Config } from "../config";
2
+ import { GraphicInfo, LoadQuery } from "../types";
3
+ type BuildingGroundQuery = Omit<LoadQuery, "floor" | "ts" | "resource_type_list">;
4
+ /**
5
+ * 请求楼栋地面
6
+ */
7
+ export declare function loadBuildingGround({ brand, project }: BuildingGroundQuery, config: Config): Promise<GraphicInfo | null>;
8
+ /**
9
+ * 加载图元
10
+ * @param param0
11
+ * @param config
12
+ * @returns
13
+ */
14
+ export declare function loadGraphics({ brand, project, floor, ts, resource_type_list, }: LoadQuery, config: Config): Promise<GraphicInfo[]>;
15
+ export {};
@@ -0,0 +1 @@
1
+ export * from './floor';
package/lib/src/bmap.d.ts CHANGED
@@ -1,18 +1,10 @@
1
1
  import { EventDispatcher, Object3D, Vector3 } from "three";
2
2
  import { Context } from "./context";
3
- import { Timer } from "./utils";
3
+ import { Timer, Events, HooksName } from "./utils";
4
4
  import { Config } from "./config";
5
- import { Graphic, HeatmapDataParam, ModelOptions, PoiOptionsParam } from "./elements";
6
- import { GraphicInfo, GraphicOptions } from "./types";
7
- export interface LoadQuery {
8
- brand: string;
9
- project: string;
10
- phase: string;
11
- building: string;
12
- floor: string;
13
- ts: string;
14
- resource_type_list: string;
15
- }
5
+ import { Floor, Graphic, HeatmapDataParam, ModelOptions, PoiOptionsParam } from "./elements";
6
+ import { GraphicInfo, GraphicOptions, LoadQuery } from "./types";
7
+ import { Plugin } from "./plugins/base";
16
8
  interface BmapEventMap {
17
9
  "zoom-change": {
18
10
  basicZoom: number;
@@ -39,15 +31,23 @@ export declare class BMap extends EventDispatcher<BmapEventMap> {
39
31
  buildingGroundMap: Map<string, GraphicInfo | null>;
40
32
  currentBuildGround: GraphicInfo | null;
41
33
  private observe;
34
+ event: Events;
42
35
  timer: Timer;
36
+ plugins: Plugin[];
43
37
  constructor(container: HTMLElement, config?: Partial<Config>);
44
- private loadGraphics;
45
- getBuildingKey({ brand, project, phase, building, }: Omit<LoadQuery, "floor" | "ts" | "resource_type_list">): string;
38
+ loadGraphics({ brand, project, floor, ts, resource_type_list, }: LoadQuery): Promise<GraphicInfo[]>;
46
39
  private loadBuildingGround;
47
- getFloorKey({ brand, project, phase, building, floor, ts, resource_type_list, }: LoadQuery): string;
48
- load({ brand, project, phase, building, floor, ts, resource_type_list, }: LoadQuery): Promise<GraphicInfo[] | undefined>;
49
- private createFloor;
50
- switchFloor({ brand, project, phase, building, floor, ts, resource_type_list, }: LoadQuery): void;
40
+ load({ brand, project, floor, ts, resource_type_list, }: LoadQuery): Promise<GraphicInfo[] | undefined>;
41
+ transformGraphicData(data: GraphicInfo[], center: [number, number]): void;
42
+ loadEquipment(): void;
43
+ use(plugin: Plugin): void;
44
+ createFloor(data: GraphicInfo[]): {
45
+ curFloor: Floor;
46
+ graphics: Graphic[];
47
+ };
48
+ triggerHooks(hooks: HooksName, ...args: any[]): void;
49
+ switchFloor({ brand, project, floor, ts, resource_type_list, }: LoadQuery): void;
50
+ initialFloorCamera(): void;
51
51
  onControlChange: () => void;
52
52
  addModel(graphic: Graphic, options: ModelOptions): void;
53
53
  addHeatmap(data: HeatmapDataParam): import("./elements").HeatmapElement | undefined;
@@ -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>;
@@ -18,6 +18,7 @@ export declare class Floor extends Object3D {
18
18
  models: Object3D<import("three").Object3DEventMap>;
19
19
  modelMap: Map<any, any>;
20
20
  private groundMaxHeight;
21
+ name: string;
21
22
  constructor(context: Context);
22
23
  getPosition(): Vector3;
23
24
  createGround(options: GraphicOptionsParam): void;
@@ -50,6 +50,7 @@ export declare class Poi extends EventDispatcher<PoiEventMap> {
50
50
  position: Vector3;
51
51
  userData: {};
52
52
  showTextStatus: boolean;
53
+ disposed: boolean;
53
54
  constructor(context: Context, options: PoiOptionsParam);
54
55
  get withinDisplayRange(): boolean;
55
56
  resetSize(): Promise<void>;
@@ -6,3 +6,5 @@ export * from './context';
6
6
  export * from './layer';
7
7
  export * from './types';
8
8
  export * from './operations';
9
+ export * from './plugins';
10
+ export * from './api';
@@ -0,0 +1,6 @@
1
+ import { BMap } from "../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,3 @@
1
+ export * from "./equipment";
2
+ export * from "./navigation";
3
+ export * from './split-load';
@@ -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 @@
1
+ export * from './split-load';
@@ -0,0 +1,14 @@
1
+ import { GraphicInfo, LoadQuery } from "../../types";
2
+ import { Plugin } from "../base";
3
+ type LoadGraphicQuery = Omit<LoadQuery, "resource_type_list">;
4
+ export declare class SplitLoad extends Plugin {
5
+ cacheData: Map<string, GraphicInfo[]>;
6
+ load(query: LoadQuery): Promise<GraphicInfo[]>;
7
+ isSameFloor(query: LoadGraphicQuery): boolean;
8
+ switchFloorByData(data: GraphicInfo[], query: LoadGraphicQuery): void;
9
+ filterData(data: GraphicInfo[], query: LoadGraphicQuery): GraphicInfo[];
10
+ private switchFloorByStoreData;
11
+ private switchFloorByOtherData;
12
+ changeFloor(query: LoadGraphicQuery): Promise<unknown[]>;
13
+ }
14
+ export {};
@@ -59,3 +59,10 @@ export interface ResGraphicInfo {
59
59
  export interface GraphicInfo extends Omit<ResGraphicInfo, "info"> {
60
60
  info: GraphicOptions;
61
61
  }
62
+ export interface LoadQuery {
63
+ brand: string;
64
+ project: string;
65
+ floor: string;
66
+ ts: string;
67
+ resource_type_list: string;
68
+ }
@@ -1,4 +1,4 @@
1
- import { Coordinate } from 'src/types';
1
+ import { Coordinate } from '../types';
2
2
  import { Vector3, Camera } from 'three';
3
3
  /**
4
4
  * 3D坐标转屏幕坐标
@@ -16,7 +16,7 @@ export declare function vector3ToDevice(vector: Vector3, camera: Camera, w: numb
16
16
  * 获取多变形的中心点
17
17
  * @param coordinates
18
18
  */
19
- export declare function getCenter(coordinates: Coordinate[]): import("@turf/turf").Position;
19
+ export declare function getCenter(coordinates: Coordinate[]): [number, number];
20
20
  type Position = {
21
21
  x: number;
22
22
  y: number;
@@ -0,0 +1,4 @@
1
+ export declare enum HooksName {
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,6 @@ 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';
17
+ export * from './obj-utils';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 生成对象的key
3
+ * @param obj
4
+ * @returns
5
+ */
6
+ export declare function generatorKeyByObj(obj: Record<string, any>): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aibee/crc-bmap",
3
- "version": "0.0.93",
3
+ "version": "0.0.95",
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"